annotate gui/mplayer/mw.c @ 24113:07dd0d814d61

Remove unused extern variable declaration.
author diego
date Fri, 24 Aug 2007 09:15:21 +0000
parents e8e6b33cd444
children 01754b23193e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
2 // main window
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
3
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
4 #include <stdlib.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
5 #include <stdio.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
6 #include <inttypes.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
7 #include <sys/stat.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
8 #include <unistd.h>
23305
22d3d12c6dfb Include string.h for memcpy, fastmemcpy.h alone is not enough.
reimar
parents: 23154
diff changeset
9 #include <string.h>
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
10
23154
e564b9cd7290 Fix several implicit declarations of functions warnings.
diego
parents: 23077
diff changeset
11 #include "gmplayer.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
12 #include "app.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
13 #include "skin/font.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
14 #include "skin/skin.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
15 #include "wm/ws.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
16
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
17 #include "../config.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
18 #include "../help_mp.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
19 #include "../libvo/x11_common.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
20 #include "../libvo/fastmemcpy.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
21
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
22 #include "../stream/stream.h"
24110
aefbadd5eead Use consistent include path.
diego
parents: 24086
diff changeset
23 #include "../stream/url.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
24 #include "../mixer.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
25 #include "../libvo/sub.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
26 #include "../access_mpcontext.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
27
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
28 #include "../libmpdemux/demuxer.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
29 #include "../libmpdemux/stheader.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
30 #include "../codec-cfg.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
31 #include "../m_option.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
32 #include "../m_property.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
33
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
34 #define GUI_REDRAW_WAIT 375
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
35
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
36 #include "play.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
37 #include "widgets.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
38
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
39 extern unsigned int GetTimerMS( void );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
40
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
41 unsigned char * mplDrawBuffer = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
42 int mplMainRender = 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
43
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
44 int mplMainAutoPlay = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
45 int mplMiddleMenu = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
46
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
47 int mainVisible = 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
48
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
49 int boxMoved = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
50 int sx = 0,sy = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
51 int i,pot = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
52
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
53 #include "common.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
54
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
55 void mplMainDraw( void )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
56 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
57
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
58 if ( appMPlayer.mainWindow.State == wsWindowClosed ) exit_player( MSGTR_Exit_quit );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
59
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
60 if ( appMPlayer.mainWindow.Visible == wsWindowNotVisible ||
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
61 !mainVisible ) return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
62 // !appMPlayer.mainWindow.Mapped ) return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
63
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
64 if ( mplMainRender && appMPlayer.mainWindow.State == wsWindowExpose )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
65 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
66 btnModify( evSetMoviePosition,guiIntfStruct.Position );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
67 btnModify( evSetVolume,guiIntfStruct.Volume );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
68
23457
a124f3abc1ec Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents: 23305
diff changeset
69 fast_memcpy( mplDrawBuffer,appMPlayer.main.Bitmap.Image,appMPlayer.main.Bitmap.ImageSize );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
70 Render( &appMPlayer.mainWindow,appMPlayer.Items,appMPlayer.NumberOfItems,mplDrawBuffer,appMPlayer.main.Bitmap.ImageSize );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
71 mplMainRender=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
72 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
73 wsPutImage( &appMPlayer.mainWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
74 // XFlush( wsDisplay );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
75 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
76
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
77 static unsigned last_redraw_time = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
78
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
79 void mplEventHandling( int msg,float param )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
80 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
81 int iparam = (int)param;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
82 mixer_t *mixer = mpctx_get_mixer(guiIntfStruct.mpcontext);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
83
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
84 switch( msg )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
85 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
86 // --- user events
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
87 case evExit:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
88 exit_player( "Exit" );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
89 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
90
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
91 case evPlayNetwork:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
92 gfree( (void **)&guiIntfStruct.Subtitlename );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
93 gfree( (void **)&guiIntfStruct.AudioFile );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
94 guiIntfStruct.StreamType=STREAMTYPE_STREAM;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
95 goto play;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
96 case evSetURL:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
97 gtkShow( evPlayNetwork,NULL );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
98 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
99
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
100 case evSetAudio:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
101 if ( !guiIntfStruct.demuxer || audio_id == iparam ) break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
102 audio_id=iparam;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
103 goto play;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
104
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
105 case evSetVideo:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
106 if ( !guiIntfStruct.demuxer || video_id == iparam ) break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
107 video_id=iparam;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
108 goto play;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
109
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
110 case evSetSubtitle:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
111 mp_property_do("sub",M_PROPERTY_SET,&iparam,guiIntfStruct.mpcontext);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
112 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
113
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
114 #ifdef HAVE_VCD
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
115 case evSetVCDTrack:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
116 guiIntfStruct.Track=iparam;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
117 case evPlayVCD:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
118 gtkSet( gtkClearStruct,0,(void *)guiALL );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
119 guiIntfStruct.StreamType=STREAMTYPE_VCD;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
120 goto play;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
121 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
122 #ifdef USE_DVDREAD
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
123 case evPlayDVD:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
124 guiIntfStruct.DVD.current_title=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
125 guiIntfStruct.DVD.current_chapter=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
126 guiIntfStruct.DVD.current_angle=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
127 play_dvd_2:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
128 gtkSet( gtkClearStruct,0,(void *)(guiALL - guiDVD) );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
129 guiIntfStruct.StreamType=STREAMTYPE_DVD;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
130 goto play;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
131 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
132 case evPlay:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
133 case evPlaySwitchToPause:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
134 play:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
135
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
136 if ( ( msg == evPlaySwitchToPause )&&( guiIntfStruct.Playing == 2 ) ) goto NoPause;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
137
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
138 if ( gtkSet( gtkGetCurrPlItem,0,NULL ) &&( guiIntfStruct.StreamType == STREAMTYPE_FILE ) )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
139 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
140 plItem * next = gtkSet( gtkGetCurrPlItem,0,NULL );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
141 plLastPlayed=next;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
142 mplSetFileName( next->path,next->name,STREAMTYPE_FILE );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
143 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
144
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
145 switch ( guiIntfStruct.StreamType )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
146 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
147 case STREAMTYPE_STREAM:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
148 case STREAMTYPE_FILE:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
149 gtkSet( gtkClearStruct,0,(void *)(guiALL - guiFilenames) );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
150 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
151 #ifdef HAVE_VCD
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
152 case STREAMTYPE_VCD:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
153 gtkSet( gtkClearStruct,0,(void *)(guiALL - guiVCD - guiFilenames) );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
154 if ( !cdrom_device ) cdrom_device=gstrdup( DEFAULT_CDROM_DEVICE );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
155 mplSetFileName( NULL,cdrom_device,STREAMTYPE_VCD );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
156 if ( guiIntfStruct.Playing != 2 )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
157 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
158 if ( !guiIntfStruct.Track )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
159 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
160 if ( guiIntfStruct.VCDTracks > 1 ) guiIntfStruct.Track=2;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
161 else guiIntfStruct.Track=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
162 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
163 guiIntfStruct.DiskChanged=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
164 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
165 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
166 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
167 #ifdef USE_DVDREAD
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
168 case STREAMTYPE_DVD:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
169 gtkSet( gtkClearStruct,0,(void *)(guiALL - guiDVD - guiFilenames) );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
170 if ( !dvd_device ) dvd_device=gstrdup( DEFAULT_DVD_DEVICE );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
171 mplSetFileName( NULL,dvd_device,STREAMTYPE_DVD );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
172 if ( guiIntfStruct.Playing != 2 )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
173 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
174 guiIntfStruct.Title=guiIntfStruct.DVD.current_title;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
175 guiIntfStruct.Chapter=guiIntfStruct.DVD.current_chapter;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
176 guiIntfStruct.Angle=guiIntfStruct.DVD.current_angle;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
177 guiIntfStruct.DiskChanged=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
178 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
179 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
180 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
181 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
182 guiIntfStruct.NewPlay=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
183 mplPlay();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
184 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
185 #ifdef USE_DVDREAD
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
186 case evSetDVDSubtitle:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
187 dvdsub_id=iparam;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
188 goto play_dvd_2;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
189 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
190 case evSetDVDAudio:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
191 audio_id=iparam;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
192 goto play_dvd_2;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
193 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
194 case evSetDVDChapter:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
195 guiIntfStruct.DVD.current_chapter=iparam;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
196 goto play_dvd_2;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
197 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
198 case evSetDVDTitle:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
199 guiIntfStruct.DVD.current_title=iparam;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
200 guiIntfStruct.DVD.current_chapter=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
201 guiIntfStruct.DVD.current_angle=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
202 goto play_dvd_2;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
203 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
204 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
205
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
206 case evPause:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
207 case evPauseSwitchToPlay:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
208 NoPause:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
209 mplPause();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
210 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
211
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
212 case evStop:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
213 guiIntfStruct.Playing=guiSetStop;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
214 mplState();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
215 guiIntfStruct.NoWindow=False;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
216 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
217
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
218 case evLoadPlay:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
219 mplMainAutoPlay=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
220 // guiIntfStruct.StreamType=STREAMTYPE_FILE;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
221 case evLoad:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
222 gtkSet( gtkDelPl,0,NULL );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
223 gtkShow( evLoad,NULL );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
224 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
225 case evLoadSubtitle: gtkShow( evLoadSubtitle,NULL ); break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
226 case evDropSubtitle:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
227 gfree( (void **)&guiIntfStruct.Subtitlename );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
228 guiLoadSubtitle( NULL );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
229 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
230 case evLoadAudioFile: gtkShow( evLoadAudioFile,NULL ); break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
231 case evPrev: mplPrev(); break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
232 case evNext: mplNext(); break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
233
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
234 case evPlayList: gtkShow( evPlayList,NULL ); break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
235 case evSkinBrowser: gtkShow( evSkinBrowser,skinName ); break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
236 case evAbout: gtkShow( evAbout,NULL ); break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
237 case evPreferences: gtkShow( evPreferences,NULL ); break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
238 case evEqualizer: gtkShow( evEqualizer,NULL ); break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
239
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
240 case evForward10min: mplRelSeek( 600 ); break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
241 case evBackward10min: mplRelSeek( -600 );break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
242 case evForward1min: mplRelSeek( 60 ); break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
243 case evBackward1min: mplRelSeek( -60 ); break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
244 case evForward10sec: mplRelSeek( 10 ); break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
245 case evBackward10sec: mplRelSeek( -10 ); break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
246 case evSetMoviePosition: mplAbsSeek( param ); break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
247
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
248 case evIncVolume: vo_x11_putkey( wsGrayMul ); break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
249 case evDecVolume: vo_x11_putkey( wsGrayDiv ); break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
250 case evMute: mixer_mute( mixer ); break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
251
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
252 case evSetVolume:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
253 guiIntfStruct.Volume=param;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
254 goto set_volume;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
255 case evSetBalance:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
256 guiIntfStruct.Balance=param;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
257 set_volume:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
258 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
259 float l = guiIntfStruct.Volume * ( ( 100.0 - guiIntfStruct.Balance ) / 50.0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
260 float r = guiIntfStruct.Volume * ( ( guiIntfStruct.Balance ) / 50.0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
261 if ( l > guiIntfStruct.Volume ) l=guiIntfStruct.Volume;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
262 if ( r > guiIntfStruct.Volume ) r=guiIntfStruct.Volume;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
263 // printf( "!!! v: %.2f b: %.2f -> %.2f x %.2f\n",guiIntfStruct.Volume,guiIntfStruct.Balance,l,r );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
264 mixer_setvolume( mixer,l,r );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
265 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
266 if ( osd_level )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
267 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
268 osd_visible=(GetTimerMS() + 1000) | 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
269 vo_osd_progbar_type=OSD_VOLUME;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
270 vo_osd_progbar_value=( ( guiIntfStruct.Volume ) * 256.0 ) / 100.0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
271 vo_osd_changed( OSDTYPE_PROGBAR );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
272 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
273 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
274
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
275
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
276 case evIconify:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
277 switch ( iparam )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
278 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
279 case 0: wsIconify( appMPlayer.mainWindow ); break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
280 case 1: wsIconify( appMPlayer.subWindow ); break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
281 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
282 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
283 case evHalfSize:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
284 btnSet( evFullScreen,btnReleased );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
285 if ( guiIntfStruct.Playing )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
286 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
287 if ( appMPlayer.subWindow.isFullScreen )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
288 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
289 mplFullScreen();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
290 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
291 wsResizeWindow( &appMPlayer.subWindow, guiIntfStruct.MovieWidth / 2, guiIntfStruct.MovieHeight / 2 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
292 wsMoveWindow( &appMPlayer.subWindow, 0,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
293 ( wsMaxX - guiIntfStruct.MovieWidth/2 )/2 + wsOrgX,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
294 ( wsMaxY - guiIntfStruct.MovieHeight/2 )/2 + wsOrgY );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
295 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
296 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
297 case evDoubleSize:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
298 btnSet( evFullScreen,btnReleased );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
299 if ( guiIntfStruct.Playing )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
300 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
301 if ( appMPlayer.subWindow.isFullScreen )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
302 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
303 mplFullScreen();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
304 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
305 wsResizeWindow( &appMPlayer.subWindow, guiIntfStruct.MovieWidth * 2, guiIntfStruct.MovieHeight * 2 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
306 wsMoveWindow( &appMPlayer.subWindow, 0,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
307 ( wsMaxX - guiIntfStruct.MovieWidth*2 )/2 + wsOrgX,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
308 ( wsMaxY - guiIntfStruct.MovieHeight*2 )/2 + wsOrgY );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
309 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
310 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
311 case evNormalSize:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
312 btnSet( evFullScreen,btnReleased );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
313 if ( guiIntfStruct.Playing )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
314 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
315 if ( appMPlayer.subWindow.isFullScreen )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
316 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
317 mplFullScreen();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
318 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
319 wsResizeWindow( &appMPlayer.subWindow, guiIntfStruct.MovieWidth, guiIntfStruct.MovieHeight );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
320 wsMoveWindow( &appMPlayer.subWindow, 0,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
321 ( wsMaxX - guiIntfStruct.MovieWidth )/2 + wsOrgX,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
322 ( wsMaxY - guiIntfStruct.MovieHeight )/2 + wsOrgY );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
323 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
324 } else if ( !appMPlayer.subWindow.isFullScreen ) break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
325 case evFullScreen:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
326 if ( !guiIntfStruct.Playing && !gtkShowVideoWindow ) break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
327 mplFullScreen();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
328 if ( appMPlayer.subWindow.isFullScreen ) btnSet( evFullScreen,btnPressed );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
329 else btnSet( evFullScreen,btnReleased );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
330 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
331
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
332 case evSetAspect:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
333 switch ( iparam )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
334 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
335 case 2: movie_aspect=16.0f / 9.0f; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
336 case 3: movie_aspect=4.0f / 3.0f; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
337 case 4: movie_aspect=2.35; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
338 case 1:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
339 default: movie_aspect=-1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
340 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
341 wsClearWindow( appMPlayer.subWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
342 #ifdef USE_DVDREAD
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
343 if ( guiIntfStruct.StreamType == STREAMTYPE_DVD || guiIntfStruct.StreamType == STREAMTYPE_VCD ) goto play_dvd_2;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
344 else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
345 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
346 guiIntfStruct.NewPlay=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
347 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
348
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
349 // --- timer events
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
350 case evRedraw:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
351 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
352 unsigned now = GetTimerMS();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
353 extern int mplPBFade;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
354 if ((now > last_redraw_time) &&
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
355 (now < last_redraw_time + GUI_REDRAW_WAIT) &&
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
356 !mplPBFade)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
357 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
358 last_redraw_time = now;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
359 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
360 mplMainRender=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
361 wsPostRedisplay( &appMPlayer.mainWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
362 wsPostRedisplay( &appMPlayer.barWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
363 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
364 // --- system events
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
365 #ifdef MP_DEBUG
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
366 case evNone:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
367 mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[mw] event none received.\n" );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
368 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
369 default:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
370 mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[mw] unknown event received ( %d,%.2f ).\n",msg,param );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
371 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
372 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
373 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
374 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
375
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
376 #define itPLMButton (itNULL - 1)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
377 #define itPRMButton (itNULL - 2)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
378
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
379 void mplMainMouseHandle( int Button,int X,int Y,int RX,int RY )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
380 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
381 static int itemtype = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
382 int i;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
383 wItem * item = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
384 float value = 0.0f;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
385
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
386 static int SelectedItem = -1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
387 int currentselected = -1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
388
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
389 for ( i=0;i < appMPlayer.NumberOfItems + 1;i++ )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
390 if ( ( appMPlayer.Items[i].pressed != btnDisabled )&&
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
391 ( wgIsRect( X,Y,appMPlayer.Items[i].x,appMPlayer.Items[i].y,appMPlayer.Items[i].x+appMPlayer.Items[i].width,appMPlayer.Items[i].y+appMPlayer.Items[i].height ) ) )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
392 { currentselected=i; break; }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
393
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
394 switch ( Button )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
395 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
396 case wsPMMouseButton:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
397 gtkShow( evHidePopUpMenu,NULL );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
398 mplShowMenu( RX,RY );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
399 itemtype=itPRMButton;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
400 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
401 case wsRMMouseButton:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
402 mplHideMenu( RX,RY,0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
403 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
404
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
405 case wsPLMouseButton:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
406 gtkShow( evHidePopUpMenu,NULL );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
407 sx=X; sy=Y; boxMoved=1; itemtype=itPLMButton;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
408 SelectedItem=currentselected;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
409 if ( SelectedItem == -1 ) break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
410 boxMoved=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
411 item=&appMPlayer.Items[SelectedItem];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
412 itemtype=item->type;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
413 item->pressed=btnPressed;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
414 switch( item->type )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
415 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
416 case itButton:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
417 if ( ( SelectedItem > -1 ) &&
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
418 ( ( ( item->msg == evPlaySwitchToPause && item->msg == evPauseSwitchToPlay ) ) ||
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
419 ( ( item->msg == evPauseSwitchToPlay && item->msg == evPlaySwitchToPause ) ) ) )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
420 { item->pressed=btnDisabled; }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
421 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
422 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
423 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
424 case wsRLMouseButton:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
425 boxMoved=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
426 item=&appMPlayer.Items[SelectedItem];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
427 item->pressed=btnReleased;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
428 SelectedItem=-1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
429 if ( currentselected == - 1 ) { itemtype=0; break; }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
430 value=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
431 switch( itemtype )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
432 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
433 case itPotmeter:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
434 case itHPotmeter:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
435 btnModify( item->msg,(float)( X - item->x ) / item->width * 100.0f );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
436 mplEventHandling( item->msg,item->value );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
437 value=item->value;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
438 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
439 case itVPotmeter:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
440 btnModify( item->msg, ( 1. - (float)( Y - item->y ) / item->height) * 100.0f );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
441 mplEventHandling( item->msg,item->value );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
442 value=item->value;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
443 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
444 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
445 mplEventHandling( item->msg,value );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
446 itemtype=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
447 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
448
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
449 case wsRRMouseButton:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
450 gtkShow( evShowPopUpMenu,NULL );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
451 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
452
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
453 // --- rolled mouse ... de szar :)))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
454 case wsP5MouseButton: value=-2.5f; goto rollerhandled;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
455 case wsP4MouseButton: value= 2.5f;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
456 rollerhandled:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
457 item=&appMPlayer.Items[currentselected];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
458 if ( ( item->type == itHPotmeter )||( item->type == itVPotmeter )||( item->type == itPotmeter ) )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
459 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
460 item->value+=value;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
461 btnModify( item->msg,item->value );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
462 mplEventHandling( item->msg,item->value );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
463 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
464 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
465
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
466 // --- moving
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
467 case wsMoveMouse:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
468 item=&appMPlayer.Items[SelectedItem];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
469 switch ( itemtype )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
470 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
471 case itPLMButton:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
472 wsMoveWindow( &appMPlayer.mainWindow,False,RX - abs( sx ),RY - abs( sy ) );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
473 mplMainRender=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
474 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
475 case itPRMButton:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
476 mplMenuMouseHandle( X,Y,RX,RY );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
477 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
478 case itPotmeter:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
479 item->value=(float)( X - item->x ) / item->width * 100.0f;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
480 goto potihandled;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
481 case itVPotmeter:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
482 item->value=(1. - (float)( Y - item->y ) / item->height) * 100.0f;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
483 goto potihandled;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
484 case itHPotmeter:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
485 item->value=(float)( X - item->x ) / item->width * 100.0f;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
486 potihandled:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
487 if ( item->value > 100.0f ) item->value=100.0f;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
488 if ( item->value < 0.0f ) item->value=0.0f;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
489 mplEventHandling( item->msg,item->value );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
490 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
491 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
492 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
493 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
494 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
495
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
496 int keyPressed = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
497
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
498 void mplMainKeyHandle( int KeyCode,int Type,int Key )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
499 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
500 int msg = evNone;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
501
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
502 if ( Type != wsKeyPressed ) return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
503
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
504 if ( !Key )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
505 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
506 switch ( KeyCode )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
507 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
508 case wsXFMMPrev: msg=evPrev; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
509 case wsXFMMStop: msg=evStop; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
510 case wsXFMMPlay: msg=evPlaySwitchToPause; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
511 case wsXFMMNext: msg=evNext; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
512 case wsXFMMVolUp: msg=evIncVolume; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
513 case wsXFMMVolDown: msg=evDecVolume; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
514 case wsXFMMMute: msg=evMute; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
515 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
516 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
517 else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
518 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
519 switch ( Key )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
520 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
521 case wsEnter: msg=evPlay; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
522 case wsXF86LowerVolume: msg=evDecVolume; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
523 case wsXF86RaiseVolume: msg=evIncVolume; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
524 case wsXF86Mute: msg=evMute; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
525 case wsXF86Play: msg=evPlaySwitchToPause; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
526 case wsXF86Stop: msg=evStop; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
527 case wsXF86Prev: msg=evPrev; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
528 case wsXF86Next: msg=evNext; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
529 case wsXF86Media: msg=evLoad; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
530 case wsEscape:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
531 if ( appMPlayer.subWindow.isFullScreen )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
532 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
533 if ( guiIntfStruct.event_struct ) ((XEvent *)guiIntfStruct.event_struct)->type=None;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
534 mplEventHandling( evNormalSize,0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
535 return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
536 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
537 default: vo_x11_putkey( Key ); return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
538 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
539 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
540 if ( msg != evNone ) mplEventHandling( msg,0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
541 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
542
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
543 /* this will be used to handle Drag&Drop files */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
544 void mplDandDHandler(int num,char** files)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
545 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
546 struct stat buf;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
547 int f = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
548
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
549 char* subtitles = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
550 char* filename = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
551
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
552 if (num <= 0)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
553 return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
554
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
555
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
556 /* now fill it with new items */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
557 for(f=0; f < num; f++){
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
558 char* str = strdup( files[f] );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
559 plItem* item;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
560
24086
f5b32d12b691 remove gconvert_uri_to_filename() and use url_unescape_string() instead.
iive
parents: 23457
diff changeset
561 url_unescape_string(str, files[f]);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
562
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
563 if(stat(str,&buf) == 0 && S_ISDIR(buf.st_mode) == 0) {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
564 /* this is not a directory so try to play it */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
565 mp_msg( MSGT_GPLAYER,MSGL_V,"Received D&D %s\n",str );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
566
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
567 /* check if it is a subtitle file */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
568 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
569 char* ext = strrchr(str,'.');
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
570 if (ext) {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
571 static char supported[] = "utf/sub/srt/smi/rt//txt/ssa/aqt/";
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
572 char* type;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
573 int len;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
574 if((len=strlen(++ext)) && (type=strstr(supported,ext)) &&\
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
575 (type-supported)%4 == 0 && *(type+len) == '/'){
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
576 /* handle subtitle file */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
577 gfree((void**)&subtitles);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
578 subtitles = str;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
579 continue;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
580 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
581 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
582 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
583
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
584 /* clear playlist */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
585 if (filename == NULL) {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
586 filename = files[f];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
587 gtkSet(gtkDelPl,0,NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
588 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
589
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
590 item = calloc(1,sizeof(plItem));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
591
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
592 /* FIXME: decompose file name ? */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
593 /* yes -- Pontscho */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
594 if ( strrchr( str,'/' ) ) {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
595 char * s = strrchr( str,'/' ); *s=0; s++;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
596 item->name = gstrdup( s );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
597 item->path = gstrdup( str );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
598 } else {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
599 item->name = strdup(str);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
600 item->path = strdup("");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
601 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
602 gtkSet(gtkAddPlItem,0,(void*)item);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
603 } else {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
604 mp_msg( MSGT_GPLAYER,MSGL_WARN,MSGTR_NotAFile,str );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
605 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
606 free( str );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
607 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
608
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
609 if (filename) {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
610 mplSetFileName( NULL,filename,STREAMTYPE_FILE );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
611 if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evStop,0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
612 mplEventHandling( evPlay,0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
613 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
614 if (subtitles) {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
615 gfree((void**)&guiIntfStruct.Subtitlename);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
616 guiIntfStruct.Subtitlename = subtitles;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
617 guiLoadSubtitle(guiIntfStruct.Subtitlename);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
618 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
619 }