summaryrefslogtreecommitdiff
path: root/control-image.h
blob: a09c02f1adb8deb0af4f5d634463c0fa73e6bcb0 (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
162
163
164
165
166
167
168
169
/*
 * Image plugin to VDR (C++)
 *
 * (C) 2004 Andreas Brachold <vdr04 -at- deltab.de>
 * based on (C) 2003 Kai Tobias Burwieck <kai -at- burwieck.net>
 *
 * This code is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This code is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
 */

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

#ifndef ___DVB_IMAGE_CONTROL_H
#define ___DVB_IMAGE_CONTROL_H

#include <vdr/player.h>
#if VDRVERSNUM >= 10307
#include <vdr/osdbase.h>
#endif

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_pImageMenu;
  /** 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;
#if VDRVERSNUM >= 10307
  /** Display replayprogress*/
  cSkinDisplayReplay *m_pDisplayReplay;
  /** Faked Marks for Images*/
  cMarks m_Marks;
#endif

  /** 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*/
  int m_nRealImageWidth;
  /** real image pixel height*/
  int m_nRealImageHeight;
  
  char zoom_command[20];

private:  
  void ShowOSD(void);
  void HideOSD(void);
  void ShowMode(void);
#if VDRVERSNUM < 10307
  void DisplayAtBottom(const char *s);
#endif
  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);
  
  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