Mercurial > mplayer.hg
annotate Gui/mplayer/mw.h @ 1821:3c65d5675676
fix keyh
author | pontscho |
---|---|
date | Sat, 01 Sep 2001 14:58:12 +0000 |
parents | b5b89f8efc5f |
children | a6c67352ccac |
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 | |
1819 | 128 int mainis = 1; |
129 | |
1693 | 130 void mplMainDraw( wsParamDisplay ) |
131 { | |
132 wItem * item; | |
133 txSample * image = NULL; | |
134 int i; | |
135 | |
1819 | 136 if ( appMPlayer.mainWindow.Focused == 2 ) mainis=1; |
137 | |
1693 | 138 if ( appMPlayer.mainWindow.Visible == wsWindowNotVisible || |
1729 | 139 !mainVisible ) return; |
140 // !appMPlayer.mainWindow.Mapped ) return; | |
141 | |
142 btnModify( evSetMoviePosition,mplShMem->Position ); | |
143 btnModify( evSetVolume,mplShMem->Volume ); | |
1751 | 144 |
145 switch ( mplShMem->Playing ) | |
146 { | |
147 case 2: | |
148 case 0: | |
149 btnModify( evPlaySwitchToPause,btnReleased ); | |
150 btnModify( evPauseSwitchToPlay,btnDisabled ); | |
151 break; | |
152 case 1: | |
1777 | 153 if ( mplShMem->Filename[0] != 0 ) |
1751 | 154 { |
155 btnModify( evPlaySwitchToPause,btnDisabled ); | |
156 btnModify( evPauseSwitchToPlay,btnReleased ); | |
157 } | |
158 } | |
159 | |
1744 | 160 // --- erosen ideiglenes. |
161 strcpy( gtkShMem->fs.filename,mplShMem->Filename ); | |
162 // --- | |
1693 | 163 |
164 if ( mplMainRender ) | |
165 { | |
166 memcpy( mplDrawBuffer,appMPlayer.main.Bitmap.Image,appMPlayer.main.Bitmap.ImageSize ); | |
167 for( i=0;i < appMPlayer.NumberOfItems + 1;i++ ) | |
168 { | |
169 item=&appMPlayer.Items[i]; | |
170 switch( item->type ) | |
171 { | |
172 case itButton: | |
173 PutImage( &item->Bitmap,item->x,item->y,3,item->pressed ); | |
174 break; | |
1729 | 175 case itPotmeter: |
176 PutImage( &item->Bitmap,item->x,item->y,item->phases,item->phases * ( item->value / 100.0f ) ); | |
177 break; | |
1693 | 178 case itHPotmeter: |
179 PutImage( &item->Bitmap,item->x,item->y,item->phases,item->phases * ( item->value / 100.0f ) ); | |
180 PutImage( &item->Mask,item->x + (int)( ( item->width - item->psx ) * item->value / 100.0f ),item->y,3,item->pressed ); | |
1729 | 181 break; |
1693 | 182 case itSLabel: |
183 image=fntRender( item->fontid,0,item->width,"%s",item->label ); | |
184 goto drawrenderedtext; | |
185 case itDLabel: | |
1729 | 186 image=fntRender( item->fontid,mplTimer%item->width,item->width,"%s",Translate( item->label ) ); |
187 // image=fntRender( item->fontid,( mplRedrawTimer / 10 )%item->width,item->width,"%s",Translate( item->label ) ); | |
1693 | 188 drawrenderedtext: |
189 PutImage( image,item->x,item->y,1,0 ); | |
190 if ( image ) | |
191 { | |
192 if ( image->Image ) free( image->Image ); | |
193 free( image ); | |
194 } | |
195 break; | |
196 } | |
197 } | |
198 wsConvert( &appMPlayer.mainWindow,mplDrawBuffer,appMPlayer.main.Bitmap.ImageSize ); | |
199 mplMainRender=0; | |
200 } | |
201 wsPutImage( &appMPlayer.mainWindow ); | |
1707 | 202 XFlush( wsDisplay ); |
1693 | 203 } |
204 | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1707
diff
changeset
|
205 #define IZE(x) printf("@@@ " x " @@@\n"); |
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1707
diff
changeset
|
206 |
1729 | 207 extern void exit_player(char* how); |
208 | |
1693 | 209 void mplMsgHandle( int msg,float param ) |
210 { | |
211 int j; | |
212 | |
213 switch( msg ) | |
214 { | |
215 // --- user events | |
216 case evExit: | |
1729 | 217 // IZE("evExit"); |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1707
diff
changeset
|
218 wsDoExit(); // sets wsTrue=False; |
1729 | 219 exit_player( "Exit" ); |
1693 | 220 break; |
221 case evIconify: | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1707
diff
changeset
|
222 IZE("evIcon"); |
1693 | 223 wsIconify( appMPlayer.mainWindow ); |
224 break; | |
225 case evFullScreen: | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1707
diff
changeset
|
226 IZE("evFullS"); |
1693 | 227 for ( j=0;j<appMPlayer.NumberOfItems + 1;j++ ) |
228 { | |
229 if ( appMPlayer.Items[j].msg == evFullScreen ) | |
230 { | |
231 appMPlayer.Items[j].tmp=!appMPlayer.Items[j].tmp; | |
232 appMPlayer.Items[j].pressed=appMPlayer.Items[j].tmp; | |
233 } | |
234 } | |
235 mplMainRender=1; | |
236 mplFullScreen(); | |
237 break; | |
238 | |
239 case evPlaySwitchToPause: | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1707
diff
changeset
|
240 IZE("evPlay->Pause"); |
1693 | 241 if ( Filename ) |
242 { | |
243 btnModify( evPlaySwitchToPause,btnDisabled ); | |
244 btnModify( evPauseSwitchToPlay,btnReleased ); | |
245 } | |
246 if ( mplShMem->Playing == 1 ) goto NoPause; | |
247 case evPlay: | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1707
diff
changeset
|
248 IZE("evPlay"); |
1693 | 249 mplMainRender=1; |
250 mplPlay(); | |
251 break; | |
252 | |
253 case evPauseSwitchToPlay: | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1707
diff
changeset
|
254 IZE("evPause->Play"); |
1693 | 255 btnModify( evPlaySwitchToPause,btnReleased ); |
256 btnModify( evPauseSwitchToPlay,btnDisabled ); | |
257 case evPause: | |
258 NoPause: | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1707
diff
changeset
|
259 IZE("evPause"); |
1693 | 260 mplMainRender=1; |
261 mplPause(); | |
262 break; | |
263 | |
264 case evStop: | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1707
diff
changeset
|
265 IZE("evStop"); |
1693 | 266 btnModify( evPlaySwitchToPause,btnReleased ); |
267 btnModify( evPauseSwitchToPlay,btnDisabled ); | |
268 mplMainRender=1; | |
269 mplStop(); | |
270 break; | |
271 | |
272 case evLoadPlay: | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1707
diff
changeset
|
273 IZE("evLoadPlay"); |
1693 | 274 mplMainAutoPlay=1; |
275 case evLoad: | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1707
diff
changeset
|
276 IZE("evLoad"); |
1693 | 277 mplMainRender=1; |
278 gtkSendMessage( evLoad ); | |
279 break; | |
280 case evPrev: | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1707
diff
changeset
|
281 IZE("evPrev"); |
1693 | 282 mplMainRender=1; |
283 #ifdef DEBUG | |
284 dbprintf( 1,"[mw.h] previous stream ...\n" ); | |
285 #endif | |
286 break; | |
287 case evNext: | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1707
diff
changeset
|
288 IZE("evNext"); |
1693 | 289 mplMainRender=1; |
290 #ifdef DEBUG | |
291 dbprintf( 1,"[mw.h] next stream ...\n" ); | |
292 #endif | |
293 break; | |
294 | |
295 case evPlayList: | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1707
diff
changeset
|
296 IZE("evPlayList"); |
1693 | 297 mplMainRender=1; |
298 if ( gtkVisiblePlayList ) | |
299 { | |
300 btnModify( evPlayList,btnReleased ); | |
301 gtkShMem->vs.window=evPlayList; | |
302 gtkSendMessage( evHideWindow ); | |
303 gtkVisiblePlayList=0; | |
304 } | |
305 else | |
306 { | |
307 gtkSendMessage( evPlayList ); | |
308 btnModify( evPlayList,btnPressed ); | |
309 gtkVisiblePlayList=1; | |
310 } | |
311 break; | |
312 | |
313 case evSkinBrowser: gtkSendMessage( evSkinBrowser ); break; | |
314 case evAbout: gtkSendMessage( evAbout ); break; | |
315 case evPreferences: gtkSendMessage( evPreferences ); break; | |
316 | |
317 case evForward1min: mplRelSeek( 60 ); break; | |
318 case evBackward1min: mplRelSeek( -60 ); break; | |
319 case evForward10sec: mplRelSeek( 10 ); break; | |
320 case evBackward10sec: mplRelSeek( -10 ); break; | |
321 case evSetMoviePosition: mplAbsSeek( param ); break; | |
322 | |
323 case evIncVolume: mixerIncVolume(); break; | |
324 case evDecVolume: mixerDecVolume(); break; | |
325 case evSetVolume: mixerSetVolume( param ); break; | |
326 case evSetBalance: mixerSetBalance( param ); break; | |
327 case evMute: mixerMute(); 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 ) |
1798 | 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 | |
1821 | 539 case wsGrayMul: msg=evIncVolume; break; |
540 case wsGrayDiv: msg=evDecVolume; break; | |
1693 | 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; | |
560 } | |
561 if ( ( msg != evNone )&&( Type == wsKeyPressed ) ) | |
562 { | |
563 mplMsgHandle( msg,0 ); | |
564 mplMainRender=1; | |
565 wsPostRedisplay( &appMPlayer.mainWindow ); | |
566 } | |
1821 | 567 vo_x11_putkey( Key ); |
1693 | 568 } |