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