summaryrefslogtreecommitdiff
path: root/control-image.h
blob: f234927d0faaa2e1b7c0fee688983c312f0555f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
/*
 * Image plugin to VDR (C++)
 *
 * (c) 2004-2011 Andreas Brachold <vdr07 at deltab.de>
 * based on (C) 2003 Kai Tobias Burwieck <kai -at- burwieck.net>
 *
 * This code is distributed under the terms and conditions of the
 * GNU GENERAL PUBLIC LICENSE. See the file COPYING for details.
 *
 */

// --- cImageControl ---------------------------------------------------------

#ifndef ___DVB_IMAGE_CONTROL_H
#define ___DVB_IMAGE_CONTROL_H

#include <vdr/player.h>
#include <vdr/osdbase.h>

#define memberof(x) (sizeof(x)/sizeof(*x))

class cImagePlayer;    
class cImageMenuCommands;

class cImageControl
 : public cControl 
{
  /** All supported Replaymodes */
  enum ePlayMode { ePlayModeNormal, ePlayModeZoom, ePlayModeJump };
  /** All supported OSD Modes */
  enum eOSDStatusMode { eDisplayNothing, eDisplayModeOnly,
  eDisplayProgress
  };
  /** All move directions to navigate inside zoomed image */
  enum eDirection {eLeft = 1,eRight,eUp,eDown};
  
  /** Our one and only Imageplayer, don't rename it see cControl  */
  cImagePlayer            *player;
  /** Interface to Menu with Usercommands*/
  cImageMenuCommands      *m_pCmdMenu;

  /** Current playing mode (Jump <-> Normal <-> Zoom) */
  ePlayMode               m_ePlayMode;
  /** Remember the active Slideshow mode before Jump or Zoom used */
  bool                    m_bSlideShowBefore;
  /** What should on OSD visable (Nothing <-> ModeOnly <-> Progress) */
  eOSDStatusMode          m_eOSDStatusVisable;
  /** Who was OSD Interface open (Nothing <-> ModeOnly <-> Progress) */
  eOSDStatusMode          m_eOSDStatusIsOpen;
  /** View our picture in a slideshow */
  bool                    m_bSlideShowActiv; 
  /** date at image was open*/
  time_t                  m_tStarted;
  /** Last Message for Statusmonitor */
  static char*            m_szLastShowStatusMsg;
  /** Display replayprogress*/
  cSkinDisplayReplay *m_pDisplayReplay;
  /** Faked Marks for Images*/
  cMarks m_Marks;

  /** zoom factor on zoom mode */ 
  int                     m_nZoomFactor;
  /** minimum zoom factor (1... */
  int                     m_nZoomMin;
  /** maximum value move steps on zoom on width */
  int                     m_nMaxStepX;
  /** maximum value move steps on zoom on height */
  int                     m_nMaxStepY;
  /** current value move steps on zoom on width, 0 is center*/
  int m_nMoveStepX;
  /** current value move steps on zoom on height, 0 is center*/
  int m_nMoveStepY;
  /** How may pixel are outside screen after zoom, on width */
  int m_nZoomXMax;
  /** How may pixel are outside screen after zoom, on height */
  int m_nZoomYMax;
  /** real image pixel width*/
  unsigned int m_nRealImageWidth;
  /** real image pixel height*/
  unsigned int m_nRealImageHeight;
  
  char m_szZoomRotation[32];
  
  static const char* szRotation [];
  /** rotation mode */ 
  unsigned int m_nRotation;

private:  
  void ShowOSD(void);
  void HideOSD(void);
  void ShowMode(void);
  void ShowProgress(void);
  /** Send Message if changed to any statusmonitor */
  void ShowStatusMsg();
  
  void PictureZoomInitial(void);
  
  void ProcessKeyBeginJump();
  void ProcessKeyBeginZoom();
  
  /** Deliver the Status of running convert-script */
  bool IsConvertRunning() const;
  /** Deliver the current number of viewed Image */
  int ImageCurrent(void) const;
  /** Deliver the total number of viewed Image */
  int ImageTotal(void) const;
  /** Deliver the filename from the current number of viewed Image */
  const char* FileName() const;
  
  /** Check if key for pluginstop was processed*/
  eOSState ProcessKeyStopped();
  /** Toogle between all supported OSD Modes */
  void ToogleShowMode(void);
  /** Toogle between Play and Stop of the current SlideShow */
  void ToogleSlideShowActiv(void);
  
  /** Zoom inside a image*/
  void ZoomIn();
  /** Zoom outside a image*/
  void ZoomOut();
  /** Navigate inside a zoomed image */
  void MoveZoomWindow(eDirection nDirection);
  
  eOSState ProcessKeyPlayMode(eKeys nKey);
  eOSState ProcessKeyJumpMode(eKeys nKey);
  eOSState ProcessKeyZoomMode(eKeys nKey);
  eOSState ProcessKeyCommands(eKeys nKey);
#ifdef HAVE_LIBEXIF
  virtual cOsdObject *GetInfo(void);
#endif
  
  void NextImage(int Step);
  void PrevImage(int Step);
  void GotoImage(int Pict);
  void RFlipImage(void);
  void LFlipImage(void);
  void OriginalImage(bool bCached);
  void ConvertZoom();
  void ConvertJump(int Step);
  
  void IncSlideTime(void);
  void DecSlideTime(void);
  
  bool CheckAccess() const;
private:
  cImageControl(cSlideShow * pNewSlideShow);
public:
  virtual ~ cImageControl();

  static void SetSlideShow(cSlideShow * pNewSlideShow);

  virtual eOSState ProcessKey(eKeys Key);
  virtual void Hide(void);
  virtual void Show(void);

protected:  
  void SlideImage();
  void Stop(void);
};

#endif				//___DVB_IMAGE_CONTROL_H