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