Mercurial > mplayer.hg
annotate Gui/mplayer/mw.h @ 3385:6975a75a47fb
fixed cbr audiocopy (if no sh_audio->wf)
author | alex |
---|---|
date | Sat, 08 Dec 2001 13:30:06 +0000 |
parents | 11b02bd1de45 |
children | 93351eec9f1f |
rev | line source |
---|---|
1693 | 1 |
2 // main window | |
3 | |
2447 | 4 #include "../../libmpdemux/stream.h" |
5 | |
1693 | 6 unsigned char * mplDrawBuffer = NULL; |
7 int mplMainRender = 1; | |
2940 | 8 |
1693 | 9 int mplMainAutoPlay = 0; |
2940 | 10 int mplMiddleMenu = 0; |
1693 | 11 |
12 int mainVisible = 1; | |
13 | |
14 int boxMoved = 0; | |
15 int sx = 0,sy = 0; | |
16 int i,pot = 0; | |
17 | |
3054 | 18 inline void TranslateFilename( int c,char * tmp ) |
19 { | |
20 int i; | |
21 switch ( mplShMem->StreamType ) | |
22 { | |
23 case STREAMTYPE_FILE: | |
24 if ( gtkShMem->fs.filename[0] ) | |
25 { | |
26 strcpy( tmp,gtkShMem->fs.filename ); | |
27 if ( tmp[strlen( tmp ) - 4] == '.' ) tmp[strlen( tmp ) - 4]=0; | |
28 if ( tmp[strlen( tmp ) - 5] == '.' ) tmp[strlen( tmp ) - 5]=0; | |
29 } else strcpy( tmp,"no file loaded" ); | |
30 break; | |
31 #ifdef USE_DVDREAD | |
32 case STREAMTYPE_DVD: | |
33 if ( mplShMem->DVD.current_chapter ) sprintf( tmp,"chapter %d",mplShMem->DVD.current_chapter ); | |
34 else strcat( tmp,"no chapter" ); | |
35 break; | |
36 #endif | |
37 default: strcpy( tmp,"no media opened" ); | |
38 } | |
39 if ( c ) | |
40 { | |
41 for ( i=0;i < strlen( tmp );i++ ) | |
42 { | |
43 int t=0; | |
44 if ( c == 1 ) { if ( ( tmp[i] >= 'A' )&&( tmp[i] <= 'Z' ) ) t=32; } | |
45 if ( c == 2 ) { if ( ( tmp[i] >= 'a' )&&( tmp[i] <= 'z' ) ) t=-32; } | |
46 tmp[i]=(char)( tmp[i] + t ); | |
47 } | |
48 } | |
49 } | |
50 | |
1693 | 51 char * Translate( char * str ) |
52 { | |
53 static char trbuf[512]; | |
54 char tmp[128]; | |
55 int i,c; | |
2045 | 56 int t; |
1693 | 57 memset( trbuf,0,512 ); |
58 memset( tmp,0,128 ); | |
59 for ( c=0,i=0;i < strlen( str );i++ ) | |
60 { | |
61 if ( str[i] != '$' ) { trbuf[c++]=str[i]; trbuf[c]=0; } | |
62 else | |
63 { | |
64 switch ( str[++i] ) | |
65 { | |
3054 | 66 case 't': sprintf( tmp,"%02d",mplShMem->Track ); strcat( trbuf,tmp ); break; |
67 case 'o': TranslateFilename( 0,tmp ); strcat( trbuf,tmp ); break; | |
68 case 'f': TranslateFilename( 1,tmp ); strcat( trbuf,tmp ); break; | |
69 case 'F': TranslateFilename( 2,tmp ); strcat( trbuf,tmp ); break; | |
1693 | 70 case '6': t=mplShMem->LengthInSec; goto calclengthhhmmss; |
71 case '1': t=mplShMem->TimeSec; | |
72 calclengthhhmmss: | |
1888 | 73 sprintf( tmp,"%02d:%02d:%02d",t/3600,t/60%60,t%60 ); strcat( trbuf,tmp ); |
1693 | 74 break; |
75 case '7': t=mplShMem->LengthInSec; goto calclengthmmmmss; | |
76 case '2': t=mplShMem->TimeSec; | |
77 calclengthmmmmss: | |
1888 | 78 sprintf( tmp,"%04d:%02d",t/60,t%60 ); strcat( trbuf,tmp ); |
1693 | 79 break; |
1888 | 80 case '3': sprintf( tmp,"%02d",mplShMem->TimeSec / 3600 ); strcat( trbuf,tmp ); break; |
81 case '4': sprintf( tmp,"%02d",( ( mplShMem->TimeSec / 60 ) % 60 ) ); strcat( trbuf,tmp ); break; | |
1707 | 82 case '5': sprintf( tmp,"%02d",mplShMem->TimeSec % 60 ); strcat( trbuf,tmp ); break; |
1888 | 83 case '8': sprintf( tmp,"%01d:%02d:%02d",mplShMem->TimeSec / 3600,( mplShMem->TimeSec / 60 ) % 60,mplShMem->TimeSec % 60 ); strcat( trbuf,tmp ); break; |
1707 | 84 case 'v': sprintf( tmp,"%3.2f%%",mplShMem->Volume ); strcat( trbuf,tmp ); break; |
85 case 'V': sprintf( tmp,"%3.1f",mplShMem->Volume ); strcat( trbuf,tmp ); break; | |
86 case 'b': sprintf( tmp,"%3.2f%%",mplShMem->Balance ); strcat( trbuf,tmp ); break; | |
87 case 'B': sprintf( tmp,"%3.1f",mplShMem->Balance ); strcat( trbuf,tmp ); break; | |
1823 | 88 case 'd': sprintf( tmp,"%d",mplShMem->FrameDrop ); strcat( trbuf,tmp ); break; |
1707 | 89 case 's': if ( mplShMem->Playing == 0 ) strcat( trbuf,"s" ); break; |
90 case 'l': if ( mplShMem->Playing == 1 ) strcat( trbuf,"p" ); break; | |
91 case 'e': if ( mplShMem->Playing == 2 ) strcat( trbuf,"e" ); break; | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
92 case 'a': |
1888 | 93 switch ( mplShMem->AudioType ) |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
94 { |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
95 case 0: strcat( trbuf,"n" ); break; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
96 case 1: strcat( trbuf,"m" ); break; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
97 case 2: strcat( trbuf,"t" ); break; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
98 } |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
99 break; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
100 case 'T': |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
101 switch ( mplShMem->StreamType ) |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
102 { |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
103 case STREAMTYPE_FILE: strcat( trbuf,"f" ); break; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
104 case STREAMTYPE_VCD: strcat( trbuf,"v" ); break; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
105 case STREAMTYPE_STREAM: strcat( trbuf,"u" ); break; |
3054 | 106 #ifdef USE_DVDREAD |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
107 case STREAMTYPE_DVD: strcat( trbuf,"d" ); break; |
3054 | 108 #endif |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
109 default: strcat( trbuf," " ); break; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
110 } |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
111 break; |
1707 | 112 case '$': strcat( trbuf,"$" ); break; |
1693 | 113 default: continue; |
114 } | |
115 c=strlen( trbuf ); | |
116 } | |
117 } | |
118 return trbuf; | |
119 } | |
120 | |
3054 | 121 inline void PutImage( txSample * bf,int x,int y,int max,int ofs ) |
1693 | 122 { |
123 int i=0,ix,iy; | |
124 unsigned long * buf = NULL; | |
125 unsigned long * drw = NULL; | |
126 unsigned long tmp; | |
127 | |
128 if ( ( !bf )||( bf->Image == NULL ) ) return; | |
129 | |
130 i=( bf->Width * ( bf->Height / max ) ) * ofs; | |
131 buf=(unsigned long *)mplDrawBuffer; | |
132 drw=(unsigned long *)bf->Image; | |
133 | |
134 for ( iy=y;iy < y+bf->Height / max;iy++ ) | |
135 for ( ix=x;ix < x+bf->Width;ix++ ) | |
136 { | |
137 tmp=drw[i++]; | |
138 if ( tmp != 0x00ff00ff ) | |
139 buf[ iy*appMPlayer.main.Bitmap.Width+ix ]=tmp; | |
140 } | |
141 } | |
142 | |
143 void mplMainDraw( wsParamDisplay ) | |
144 { | |
145 wItem * item; | |
146 txSample * image = NULL; | |
147 int i; | |
148 | |
149 if ( appMPlayer.mainWindow.Visible == wsWindowNotVisible || | |
1729 | 150 !mainVisible ) return; |
151 // !appMPlayer.mainWindow.Mapped ) return; | |
152 | |
153 btnModify( evSetMoviePosition,mplShMem->Position ); | |
154 btnModify( evSetVolume,mplShMem->Volume ); | |
1751 | 155 |
1693 | 156 if ( mplMainRender ) |
157 { | |
158 memcpy( mplDrawBuffer,appMPlayer.main.Bitmap.Image,appMPlayer.main.Bitmap.ImageSize ); | |
159 for( i=0;i < appMPlayer.NumberOfItems + 1;i++ ) | |
160 { | |
161 item=&appMPlayer.Items[i]; | |
162 switch( item->type ) | |
163 { | |
164 case itButton: | |
165 PutImage( &item->Bitmap,item->x,item->y,3,item->pressed ); | |
166 break; | |
1729 | 167 case itPotmeter: |
168 PutImage( &item->Bitmap,item->x,item->y,item->phases,item->phases * ( item->value / 100.0f ) ); | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
169 break; |
1693 | 170 case itHPotmeter: |
171 PutImage( &item->Bitmap,item->x,item->y,item->phases,item->phases * ( item->value / 100.0f ) ); | |
172 PutImage( &item->Mask,item->x + (int)( ( item->width - item->psx ) * item->value / 100.0f ),item->y,3,item->pressed ); | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
173 break; |
1693 | 174 case itSLabel: |
175 image=fntRender( item->fontid,0,item->width,"%s",item->label ); | |
176 goto drawrenderedtext; | |
177 case itDLabel: | |
1729 | 178 image=fntRender( item->fontid,mplTimer%item->width,item->width,"%s",Translate( item->label ) ); |
179 // image=fntRender( item->fontid,( mplRedrawTimer / 10 )%item->width,item->width,"%s",Translate( item->label ) ); | |
1693 | 180 drawrenderedtext: |
181 PutImage( image,item->x,item->y,1,0 ); | |
182 if ( image ) | |
183 { | |
184 if ( image->Image ) free( image->Image ); | |
185 free( image ); | |
186 } | |
187 break; | |
188 } | |
189 } | |
190 wsConvert( &appMPlayer.mainWindow,mplDrawBuffer,appMPlayer.main.Bitmap.ImageSize ); | |
191 mplMainRender=0; | |
192 } | |
193 wsPutImage( &appMPlayer.mainWindow ); | |
2854 | 194 // XFlush( wsDisplay ); |
1693 | 195 } |
196 | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1707
diff
changeset
|
197 #define IZE(x) printf("@@@ " x " @@@\n"); |
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1707
diff
changeset
|
198 |
1729 | 199 extern void exit_player(char* how); |
200 | |
1693 | 201 void mplMsgHandle( int msg,float param ) |
202 { | |
203 int j; | |
204 | |
205 switch( msg ) | |
206 { | |
207 // --- user events | |
208 case evExit: | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1707
diff
changeset
|
209 wsDoExit(); // sets wsTrue=False; |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
210 exit_player( "Exit" ); |
1693 | 211 break; |
2994 | 212 |
3054 | 213 #ifdef USE_DVDREAD |
2994 | 214 case evPlayDVD: |
215 mplShMem->StreamType=STREAMTYPE_DVD; | |
3054 | 216 #endif |
2994 | 217 |
218 case evPlay: | |
219 case evPlaySwitchToPause: | |
220 btnModify( evPlaySwitchToPause,btnDisabled ); | |
221 btnModify( evPauseSwitchToPlay,btnReleased ); | |
222 if ( ( msg == evPlaySwitchToPause )&( mplShMem->Playing == 1 ) ) goto NoPause; | |
223 mplMainRender=1; | |
224 | |
225 switch ( mplShMem->StreamType ) | |
1693 | 226 { |
2995 | 227 case STREAMTYPE_STREAM: |
228 case STREAMTYPE_VCD: | |
229 case STREAMTYPE_FILE: | |
230 dvd_title=0; | |
231 break; | |
3054 | 232 #ifdef USE_DVDREAD |
2994 | 233 case STREAMTYPE_DVD: |
234 dvd_title=1; | |
235 dvd_chapter=1; | |
236 dvd_angle=1; | |
237 strcpy( mplShMem->Filename,"/dev/dvd" ); | |
238 break; | |
3054 | 239 #endif |
1693 | 240 } |
241 mplPlay(); | |
242 break; | |
243 | |
2994 | 244 case evPause: |
1693 | 245 case evPauseSwitchToPlay: |
246 btnModify( evPlaySwitchToPause,btnReleased ); | |
247 btnModify( evPauseSwitchToPlay,btnDisabled ); | |
248 NoPause: | |
249 mplMainRender=1; | |
250 mplPause(); | |
251 break; | |
252 | |
253 case evStop: | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1707
diff
changeset
|
254 IZE("evStop"); |
1693 | 255 btnModify( evPlaySwitchToPause,btnReleased ); |
256 btnModify( evPauseSwitchToPlay,btnDisabled ); | |
257 mplMainRender=1; | |
258 mplStop(); | |
259 break; | |
260 | |
261 case evLoadPlay: | |
262 mplMainAutoPlay=1; | |
263 case evLoad: | |
264 mplMainRender=1; | |
265 gtkSendMessage( evLoad ); | |
266 break; | |
267 case evPrev: | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1707
diff
changeset
|
268 IZE("evPrev"); |
1693 | 269 mplMainRender=1; |
270 #ifdef DEBUG | |
271 dbprintf( 1,"[mw.h] previous stream ...\n" ); | |
272 #endif | |
273 break; | |
274 case evNext: | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1707
diff
changeset
|
275 IZE("evNext"); |
1693 | 276 mplMainRender=1; |
277 #ifdef DEBUG | |
278 dbprintf( 1,"[mw.h] next stream ...\n" ); | |
279 #endif | |
280 break; | |
281 | |
282 case evPlayList: | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1707
diff
changeset
|
283 IZE("evPlayList"); |
1693 | 284 mplMainRender=1; |
285 if ( gtkVisiblePlayList ) | |
286 { | |
287 btnModify( evPlayList,btnReleased ); | |
288 gtkShMem->vs.window=evPlayList; | |
289 gtkSendMessage( evHideWindow ); | |
290 gtkVisiblePlayList=0; | |
291 } | |
292 else | |
293 { | |
294 gtkSendMessage( evPlayList ); | |
295 btnModify( evPlayList,btnPressed ); | |
296 gtkVisiblePlayList=1; | |
297 } | |
298 break; | |
299 | |
300 case evSkinBrowser: gtkSendMessage( evSkinBrowser ); break; | |
301 case evAbout: gtkSendMessage( evAbout ); break; | |
302 case evPreferences: gtkSendMessage( evPreferences ); break; | |
303 | |
304 case evForward1min: mplRelSeek( 60 ); break; | |
305 case evBackward1min: mplRelSeek( -60 ); break; | |
306 case evForward10sec: mplRelSeek( 10 ); break; | |
307 case evBackward10sec: mplRelSeek( -10 ); break; | |
308 case evSetMoviePosition: mplAbsSeek( param ); break; | |
309 | |
1860 | 310 case evIncVolume: vo_x11_putkey( wsGrayMul ); break; |
311 case evDecVolume: vo_x11_putkey( wsGrayDiv ); break; | |
1847 | 312 case evMute: mplShMem->Mute=1; break; |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
313 case evSetVolume: |
1847 | 314 case evSetBalance: mplShMem->VolumeChanged=1; break; |
315 | |
1693 | 316 |
2994 | 317 case evIconify: |
318 switch ( (int)param ) | |
319 { | |
320 case 0: wsIconify( appMPlayer.mainWindow ); break; | |
321 case 1: wsIconify( appMPlayer.subWindow ); break; | |
322 } | |
323 break; | |
1765 | 324 case evNormalSize: |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
325 if ( mplShMem->Playing ) |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
326 { |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
327 appMPlayer.subWindow.isFullScreen=True; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
328 appMPlayer.subWindow.OldX=( wsMaxX - moviewidth ) / 2; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
329 appMPlayer.subWindow.OldY=( wsMaxY - movieheight ) / 2; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
330 appMPlayer.subWindow.OldWidth=moviewidth; appMPlayer.subWindow.OldHeight=movieheight; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
331 wsFullScreen( &appMPlayer.subWindow ); |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
332 mplResize( appMPlayer.subWindow.X,appMPlayer.subWindow.Y,moviewidth,movieheight ); |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
333 } |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
334 break; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
335 case evDoubleSize: |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
336 if ( mplShMem->Playing ) |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
337 { |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
338 appMPlayer.subWindow.isFullScreen=True; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
339 appMPlayer.subWindow.OldX=( wsMaxX - moviewidth * 2 ) / 2; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
340 appMPlayer.subWindow.OldY=( wsMaxY - movieheight * 2 ) / 2; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
341 appMPlayer.subWindow.OldWidth=moviewidth * 2; appMPlayer.subWindow.OldHeight=movieheight * 2; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
342 wsFullScreen( &appMPlayer.subWindow ); |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
343 mplResize( appMPlayer.subWindow.X,appMPlayer.subWindow.Y,moviewidth,movieheight ); |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
344 } |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
345 break; |
2994 | 346 case evFullScreen: |
347 IZE("evFullS"); | |
348 for ( j=0;j<appMPlayer.NumberOfItems + 1;j++ ) | |
349 { | |
350 if ( appMPlayer.Items[j].msg == evFullScreen ) | |
351 { | |
352 appMPlayer.Items[j].tmp=!appMPlayer.Items[j].tmp; | |
353 appMPlayer.Items[j].pressed=appMPlayer.Items[j].tmp; | |
354 } | |
355 } | |
356 mplMainRender=1; | |
357 mplFullScreen(); | |
358 break; | |
1693 | 359 |
360 // --- timer events | |
361 case evHideMouseCursor: | |
362 wsVisibleMouse( &appMPlayer.subWindow,wsHideMouseCursor ); | |
363 break; | |
364 case evRedraw: | |
365 mplMainRender=1; | |
366 wsPostRedisplay( &appMPlayer.mainWindow ); | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
367 // if ( !mplShMem->Playing ) |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
368 // wsPostRedisplay( &appMPlayer.subWindow ); |
1693 | 369 XFlush( wsDisplay ); |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
370 mplRedrawTimer=mplRedrawTimerConst; |
1693 | 371 break; |
372 case evGeneralTimer: | |
373 if ( mplMainAutoPlay ) | |
374 { | |
375 mplMainRender=1; | |
376 mplMainAutoPlay=0; | |
377 mplPlay(); | |
378 } | |
2940 | 379 if ( mplMiddleMenu ) |
380 { | |
381 mplMiddleMenu=0; | |
3054 | 382 mplMsgHandle( gtkShMem->popupmenu,gtkShMem->popupmenuparam ); |
2940 | 383 } |
1693 | 384 break; |
385 // --- system events | |
386 case evNone: | |
387 dbprintf( 1,"[mw] event none received.\n" ); | |
388 break; | |
389 default: | |
390 dbprintf( 1,"[mw] unknown event received ( %d,%.2f ).\n",msg,param ); | |
391 break; | |
392 } | |
393 } | |
394 | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
395 #define itPLMButton (itNULL - 1) |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
396 #define itPRMButton (itNULL - 2) |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
397 |
1693 | 398 void mplMainMouseHandle( int Button,int X,int Y,int RX,int RY ) |
399 { | |
400 static int itemtype = 0; | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
401 int i; |
1693 | 402 wItem * item = NULL; |
403 float value = 0.0f; | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
404 |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
405 static int SelectedItem = -1; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
406 int currentselected = -1; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
407 |
1693 | 408 wsVisibleMouse( &appMPlayer.subWindow,wsShowMouseCursor ); |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
409 |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
410 for ( i=0;i < appMPlayer.NumberOfItems + 1;i++ ) |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
411 if ( ( appMPlayer.Items[i].pressed != btnDisabled )&& |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
412 ( 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 ) ) ) |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
413 { currentselected=i; break; } |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
414 |
1693 | 415 switch ( Button ) |
416 { | |
417 case wsPRMouseButton: | |
418 mplShowMenu( RX,RY ); | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
419 itemtype=itPRMButton; |
1693 | 420 break; |
421 case wsRRMouseButton: | |
422 mplHideMenu( RX,RY ); | |
423 break; | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
424 |
1693 | 425 case wsPLMouseButton: |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
426 sx=X; sy=Y; boxMoved=1; itemtype=itPLMButton; // if move the main window |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
427 SelectedItem=currentselected; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
428 if ( SelectedItem == -1 ) break; // yeees, i'm move the fucking window |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
429 boxMoved=0; mplMainRender=1; // No, not move the window, i'm pressed one button |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
430 item=&appMPlayer.Items[SelectedItem]; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
431 itemtype=item->type; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
432 item->pressed=btnPressed; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
433 item->used=1; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
434 switch( item->type ) |
1693 | 435 { |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
436 case itButton: |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
437 if ( ( SelectedItem > -1 ) && |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
438 ( ( ( appMPlayer.Items[SelectedItem].msg == evPlaySwitchToPause && item->msg == evPauseSwitchToPlay ) ) || |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
439 ( ( appMPlayer.Items[SelectedItem].msg == evPauseSwitchToPlay && item->msg == evPlaySwitchToPause ) ) ) ) |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
440 { appMPlayer.Items[SelectedItem].pressed=btnDisabled; } |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
441 break; |
1693 | 442 } |
443 break; | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
444 case wsRLMouseButton: |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
445 boxMoved=0; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
446 item=&appMPlayer.Items[SelectedItem]; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
447 item->pressed=btnReleased; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
448 SelectedItem=-1; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
449 if ( currentselected == - 1 ) { itemtype=0; break; } |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
450 value=0; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
451 switch( itemtype ) |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
452 { |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
453 case itPotmeter: |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
454 case itHPotmeter: |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
455 item->used=0; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
456 btnModify( item->msg,(float)( X - item->x ) / item->width * 100.0f ); |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
457 switch ( item->msg ) |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
458 { |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
459 case evSetVolume: |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
460 mplShMem->VolumeChanged=1; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
461 mplShMem->Volume=item->value; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
462 break; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
463 } |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
464 value=item->value; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
465 break; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
466 } |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
467 mplMsgHandle( item->msg,value ); |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
468 mplMainRender=1; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
469 itemtype=0; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
470 break; |
2902
d47cbcdce1a8
rewrite some header meg jol csinaltam menu -t koepso gombra gonosz mod ( bocs, tom, nem angol).
pontscho
parents:
2854
diff
changeset
|
471 |
d47cbcdce1a8
rewrite some header meg jol csinaltam menu -t koepso gombra gonosz mod ( bocs, tom, nem angol).
pontscho
parents:
2854
diff
changeset
|
472 case wsPMMouseButton: |
3075 | 473 #ifdef USE_DVDREAD |
3054 | 474 memcpy( >kShMem->DVD,&mplShMem->DVD,sizeof( mplDVDStruct ) ); |
3075 | 475 #endif |
2902
d47cbcdce1a8
rewrite some header meg jol csinaltam menu -t koepso gombra gonosz mod ( bocs, tom, nem angol).
pontscho
parents:
2854
diff
changeset
|
476 gtkSendMessage( evShowPopUpMenu ); |
d47cbcdce1a8
rewrite some header meg jol csinaltam menu -t koepso gombra gonosz mod ( bocs, tom, nem angol).
pontscho
parents:
2854
diff
changeset
|
477 break; |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
478 |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
479 // --- rolled mouse ... de szar :))) |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
480 case wsP5MouseButton: value=-2.5f; goto rollerhandled; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
481 case wsP4MouseButton: value= 2.5f; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
482 rollerhandled: |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
483 item=&appMPlayer.Items[currentselected]; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
484 if ( ( item->type == itHPotmeter )||( item->type == itVPotmeter )||( item->type == itPotmeter ) ) |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
485 { |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
486 item->used=0; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
487 item->value+=value; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
488 btnModify( item->msg,item->value ); |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
489 switch ( item->msg ) |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
490 { |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
491 case evSetVolume: |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
492 mplShMem->VolumeChanged=1; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
493 mplShMem->Volume=item->value; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
494 break; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
495 } |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
496 mplMsgHandle( item->msg,item->value ); |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
497 mplMainRender=1; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
498 } |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
499 break; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
500 |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
501 // --- moving |
1693 | 502 case wsMoveMouse: |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
503 item=&appMPlayer.Items[SelectedItem]; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
504 switch ( itemtype ) |
1693 | 505 { |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
506 case itPLMButton: |
2854 | 507 wsMoveWindow( &appMPlayer.mainWindow,False,RX - abs( sx ),RY - abs( sy ) ); |
1693 | 508 mplMainRender=0; |
509 break; | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
510 case itPRMButton: |
1693 | 511 mplMenuMouseHandle( X,Y,RX,RY ); |
512 break; | |
513 case itPotmeter: | |
1729 | 514 item->value=(float)( X - item->x ) / item->width * 100.0f; |
1693 | 515 goto potihandled; |
516 case itHPotmeter: | |
1729 | 517 item->value=(float)( X - item->x ) / item->width * 100.0f; |
1693 | 518 potihandled: |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
519 if ( item->value > 100.0f ) item->value=100.0f; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
520 if ( item->value < 0.0f ) item->value=0.0f; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
521 switch ( item->msg ) |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
522 { |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
523 case evSetVolume: |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
524 mplShMem->VolumeChanged=1; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
525 mplShMem->Volume=item->value; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
526 break; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
527 } |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
528 mplMsgHandle( item->msg,item->value ); |
1693 | 529 mplMainRender=1; wsPostRedisplay( &appMPlayer.mainWindow ); |
530 break; | |
531 } | |
532 break; | |
533 } | |
534 if ( Button != wsMoveMouse ) wsPostRedisplay( &appMPlayer.mainWindow ); | |
535 } | |
536 | |
537 int keyPressed = 0; | |
538 | |
539 void mplMainKeyHandle( int State,int Type,int Key ) | |
540 { | |
541 int msg = evNone; | |
542 switch ( Key ) | |
543 { | |
544 case '.': | |
545 case '>': msg=evNext; break; | |
546 case ',': | |
547 case '<': msg=evPrev; break; | |
548 | |
549 case wsEscape: msg=evExit; break; | |
550 | |
551 case wsEnter: msg=evPlay; break; | |
552 case wsSpace: msg=evPause; break; | |
553 case wsa: | |
554 case wsA: msg=evAbout; break; | |
555 case wsb: | |
556 case wsB: msg=evSkinBrowser; break; | |
557 case wse: | |
558 case wsE: msg=evEqualeaser; break; | |
559 case wsf: | |
560 case wsF: msg=evFullScreen; break; | |
561 case wsl: | |
562 case wsL: msg=evLoad; break; | |
563 case wsm: | |
564 case wsM: msg=evMute; break; | |
565 case wss: | |
566 case wsS: msg=evStop; break; | |
567 case wsp: | |
568 case wsP: msg=evPlayList; break; | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
569 default: vo_x11_putkey( Key ); return; |
1693 | 570 } |
571 if ( ( msg != evNone )&&( Type == wsKeyPressed ) ) | |
572 { | |
573 mplMsgHandle( msg,0 ); | |
1845 | 574 // mplMainRender=1; |
575 // wsPostRedisplay( &appMPlayer.mainWindow ); | |
1693 | 576 } |
577 } |