2 Copyright 2004-2005 Chris Tallon, Andreas Vogel
4 This file is part of VOMP.
6 VOMP is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 VOMP is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with VOMP. If not, see <https://www.gnu.org/licenses/>.
24 #include "messagequeue.h"
26 #include "vmedialist.h"
29 #include "wjpegcomplex.h"
30 #include "imagereader.h"
39 * will ineract with the parent List for ff,back, slide show...
46 class VMediaView : public Boxx, public TimerReceiver, public MessageReceiver
48 friend class VPReader;
50 virtual ~VMediaView();
52 void processMessage(Message* m);
53 int handleCommand(int command);
55 void timercall(int clientReference);
56 //factory method, create an instance (setting it disabled)
57 //return NULL on error
58 static VMediaView *createViewer(VMediaList * parent);
59 //show the picture currently selected in the parent
60 //potentially moving to next/previous one
61 void showPicture(ULONG move,bool bslideshow,bool forceBanner);
63 void enableBanner(bool enable);
66 //if activate is false no info will be shown
67 int play(bool all,bool activate,ULONG move=VMediaList::MV_NONE,bool showInfo=false);
69 //check if the audio player is still running
70 //to decide wether to shutdown or not
71 bool isAudioPlaying();
73 //player event parameters - no interference with audioplayer! - so we start at 100
74 const static int EVENT_SLIDESHOW;
75 const static int EVENT_DRAWINGDONE;
76 const static int EVENT_DRAWINGERROR;
77 const static int EVENT_DIRECTORYDONE;
83 * *************************************************************
85 void setPictureMode(bool enabled);
86 void setAudioMode(bool enabled,bool doHiding=true);
87 //destroy a view (banner, info) - from timer calls
88 void sendViewMsg(Boxx *v);
89 //send command in main thread - especially if this view is not on top
90 void sendCommandMsg(int command);
92 VMediaView(VMediaList * plist);
100 * *************************************************************
102 const static int PICTUREBANNER_TIME=8;
104 void startSlideshow();
106 void stopSlideshow(bool hard=true);
107 //showXXX functions enable the corresponding banner and restart the timer
108 //updateXXX functions update the content but do not retrigger the timer
109 void showPictureBanner(bool loading=false);
110 void destroyPictureBanner(bool fromTimer=false);
111 void updatePictureBanner(bool loading=false);
112 void showPictureInfo();
113 void updatePictureInfo();
114 void destroyInfo(bool fromTimer=false);
115 int loadPicture(Media *m,bool forceBanner);
116 void getDrawingParam(Surface *&sfc,WJpegComplex::JpegControl *&ctl);
117 void switchSurface(); //will switch surface and currentControl
118 void drawingDone(bool hasError);
120 // Picture member variables
121 VPreader *reader; //the reader for the drawing part
122 ImageReader *ireader;//the buffered media reader
123 VPictureBanner *pictureBanner;
124 bool havePictureBanner; //dow we have a normal banner (except during loading)
126 bool pictureShowing; //set to false if loading next is impossible
129 const char * pictureError;
130 Media * currentPicture;
131 const static int INITIAL_SHOWTIME=5;
132 WJpegComplex::Rotation rotate;
133 WJpegComplex::ScaleMode cropmode;
135 static DrawStyle pictureBack;
136 static DrawStyle infoBack;
137 static DrawStyle audioBannerBack;
139 MediaOptions *options;
140 WJpegComplex::JpegControl ctl;
141 WJpegComplex::JpegControl ctl2;
142 WJpegComplex::JpegControl *currentControl;
145 //which is the active surface
146 bool secondSurface(){
147 return surface == sfc2;
153 DrawingThread *drawingThread;
156 * *************************************************************
158 const static int AUDIOBANNER_TIME=30;
159 const static int AUDIOERROR_TIME=5;
162 //margin on SCREEN on each side
163 const static int AUDIOBANNER_X_MARGIN=50;
164 //margin on bottom of screen
165 const static int AUDIOBANNER_BOTTOM_MARGIN=30;
166 //length of the progress bar
167 const static int AUDIOBARLEN=250;
169 //the AudioInfo uses the same member as the PictureInfo
170 //so only one of them can be active at the same time
171 void updateAudioInfo();
172 void showAudioInfo();
173 void drawAudioInfo();
174 void drawAudioClocks();
175 void showAudioBanner();
176 void destroyAudioBanner(); //currently not called from timer!
177 //get the player - create it if necessary
178 AudioPlayer* getPlayer(bool create=true);
180 const char * audioError;
181 Media * currentAudio;
186 //retrigger info on events?
187 bool retriggerAudioInfo;