Mercurial > mplayer.hg
annotate Gui/mplayer/mw.h @ 7846:99d2902782ed
some fixes
author | arpi |
---|---|
date | Tue, 22 Oct 2002 15:55:40 +0000 |
parents | 27c9c440536f |
children | b9b758651741 |
rev | line source |
---|---|
1693 | 1 |
2 // main window | |
3 | |
2447 | 4 #include "../../libmpdemux/stream.h" |
6311
da2dda48b7ec
add mute support ( step 1 ) and fixed panscan bugs (1000l for me)
pontscho
parents:
6298
diff
changeset
|
5 #include "../../mixer.h" |
6619
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
6 #include "../../libvo/sub.h" |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
7 #include "../../mplayer.h" |
2447 | 8 |
1693 | 9 unsigned char * mplDrawBuffer = NULL; |
10 int mplMainRender = 1; | |
2940 | 11 |
1693 | 12 int mplMainAutoPlay = 0; |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
13 int mplMiddleMenu = 0; |
1693 | 14 |
15 int mainVisible = 1; | |
16 | |
17 int boxMoved = 0; | |
18 int sx = 0,sy = 0; | |
19 int i,pot = 0; | |
20 | |
3054 | 21 inline void TranslateFilename( int c,char * tmp ) |
22 { | |
23 int i; | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
24 switch ( guiIntfStruct.StreamType ) |
3054 | 25 { |
6298 | 26 case STREAMTYPE_STREAM: |
27 strcpy( tmp,guiIntfStruct.Filename ); | |
28 break; | |
3054 | 29 case STREAMTYPE_FILE: |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
30 if ( ( guiIntfStruct.Filename )&&( guiIntfStruct.Filename[0] ) ) |
3054 | 31 { |
4979 | 32 if ( strrchr( guiIntfStruct.Filename,'/' ) ) strcpy( tmp,strrchr( guiIntfStruct.Filename,'/' ) + 1 ); |
33 else strcpy( tmp,guiIntfStruct.Filename ); | |
3054 | 34 if ( tmp[strlen( tmp ) - 4] == '.' ) tmp[strlen( tmp ) - 4]=0; |
35 if ( tmp[strlen( tmp ) - 5] == '.' ) tmp[strlen( tmp ) - 5]=0; | |
7150 | 36 } else strcpy( tmp,MSGTR_NoFileLoaded ); |
3054 | 37 break; |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
38 #ifdef USE_DVDREAD |
3054 | 39 case STREAMTYPE_DVD: |
7150 | 40 if ( guiIntfStruct.DVD.current_chapter ) sprintf( tmp,MSGTR_Chapter,guiIntfStruct.DVD.current_chapter ); |
41 else strcat( tmp,MSGTR_NoChapter ); | |
3054 | 42 break; |
43 #endif | |
6280 | 44 #ifdef HAVE_VCD |
45 case STREAMTYPE_VCD: | |
7150 | 46 sprintf( tmp,MSGTR_VCDTrack,guiIntfStruct.Track ); |
6280 | 47 break; |
48 #endif | |
7150 | 49 default: strcpy( tmp,MSGTR_NoMediaOpened ); |
3054 | 50 } |
51 if ( c ) | |
52 { | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
53 for ( i=0;i < (int)strlen( tmp );i++ ) |
3054 | 54 { |
55 int t=0; | |
56 if ( c == 1 ) { if ( ( tmp[i] >= 'A' )&&( tmp[i] <= 'Z' ) ) t=32; } | |
57 if ( c == 2 ) { if ( ( tmp[i] >= 'a' )&&( tmp[i] <= 'z' ) ) t=-32; } | |
58 tmp[i]=(char)( tmp[i] + t ); | |
59 } | |
60 } | |
61 } | |
62 | |
1693 | 63 char * Translate( char * str ) |
64 { | |
65 static char trbuf[512]; | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
66 char tmp[512]; |
1693 | 67 int i,c; |
2045 | 68 int t; |
1693 | 69 memset( trbuf,0,512 ); |
70 memset( tmp,0,128 ); | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
71 for ( c=0,i=0;i < (int)strlen( str );i++ ) |
1693 | 72 { |
73 if ( str[i] != '$' ) { trbuf[c++]=str[i]; trbuf[c]=0; } | |
74 else | |
75 { | |
76 switch ( str[++i] ) | |
77 { | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
78 case 't': sprintf( tmp,"%02d",guiIntfStruct.Track ); strcat( trbuf,tmp ); break; |
3054 | 79 case 'o': TranslateFilename( 0,tmp ); strcat( trbuf,tmp ); break; |
80 case 'f': TranslateFilename( 1,tmp ); strcat( trbuf,tmp ); break; | |
81 case 'F': TranslateFilename( 2,tmp ); strcat( trbuf,tmp ); break; | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
82 case '6': t=guiIntfStruct.LengthInSec; goto calclengthhhmmss; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
83 case '1': t=guiIntfStruct.TimeSec; |
1693 | 84 calclengthhhmmss: |
1888 | 85 sprintf( tmp,"%02d:%02d:%02d",t/3600,t/60%60,t%60 ); strcat( trbuf,tmp ); |
1693 | 86 break; |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
87 case '7': t=guiIntfStruct.LengthInSec; goto calclengthmmmmss; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
88 case '2': t=guiIntfStruct.TimeSec; |
1693 | 89 calclengthmmmmss: |
1888 | 90 sprintf( tmp,"%04d:%02d",t/60,t%60 ); strcat( trbuf,tmp ); |
1693 | 91 break; |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
92 case '3': sprintf( tmp,"%02d",guiIntfStruct.TimeSec / 3600 ); strcat( trbuf,tmp ); break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
93 case '4': sprintf( tmp,"%02d",( ( guiIntfStruct.TimeSec / 60 ) % 60 ) ); strcat( trbuf,tmp ); break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
94 case '5': sprintf( tmp,"%02d",guiIntfStruct.TimeSec % 60 ); strcat( trbuf,tmp ); break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
95 case '8': sprintf( tmp,"%01d:%02d:%02d",guiIntfStruct.TimeSec / 3600,( guiIntfStruct.TimeSec / 60 ) % 60,guiIntfStruct.TimeSec % 60 ); strcat( trbuf,tmp ); break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
96 case 'v': sprintf( tmp,"%3.2f%%",guiIntfStruct.Volume ); strcat( trbuf,tmp ); break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
97 case 'V': sprintf( tmp,"%3.1f",guiIntfStruct.Volume ); strcat( trbuf,tmp ); break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
98 case 'b': sprintf( tmp,"%3.2f%%",guiIntfStruct.Balance ); strcat( trbuf,tmp ); break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
99 case 'B': sprintf( tmp,"%3.1f",guiIntfStruct.Balance ); strcat( trbuf,tmp ); break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
100 case 'd': sprintf( tmp,"%d",guiIntfStruct.FrameDrop ); strcat( trbuf,tmp ); break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
101 case 's': if ( guiIntfStruct.Playing == 0 ) strcat( trbuf,"s" ); break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
102 case 'l': if ( guiIntfStruct.Playing == 1 ) strcat( trbuf,"p" ); break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
103 case 'e': if ( guiIntfStruct.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
|
104 case 'a': |
6619
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
105 if ( muted ) { strcat( trbuf,"n" ); break; } |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
106 switch ( guiIntfStruct.AudioType ) |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
107 { |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
108 case 0: strcat( trbuf,"n" ); break; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
109 case 1: strcat( trbuf,"m" ); break; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
110 case 2: strcat( trbuf,"t" ); break; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
111 } |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
112 break; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
113 case 'T': |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
114 switch ( guiIntfStruct.StreamType ) |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
115 { |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
116 case STREAMTYPE_FILE: strcat( trbuf,"f" ); break; |
6280 | 117 #ifdef HAVE_VCD |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
118 case STREAMTYPE_VCD: strcat( trbuf,"v" ); break; |
6280 | 119 #endif |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
120 case STREAMTYPE_STREAM: strcat( trbuf,"u" ); break; |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
121 #ifdef USE_DVDREAD |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
122 case STREAMTYPE_DVD: strcat( trbuf,"d" ); break; |
3054 | 123 #endif |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
124 default: strcat( trbuf," " ); break; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
125 } |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
126 break; |
1707 | 127 case '$': strcat( trbuf,"$" ); break; |
1693 | 128 default: continue; |
129 } | |
130 c=strlen( trbuf ); | |
131 } | |
132 } | |
133 return trbuf; | |
134 } | |
135 | |
3054 | 136 inline void PutImage( txSample * bf,int x,int y,int max,int ofs ) |
1693 | 137 { |
138 int i=0,ix,iy; | |
6159
dcf195b784bf
applied 64bit patch from Ulrich Hecht <uli@suse.de>
pontscho
parents:
6145
diff
changeset
|
139 uint32_t * buf = NULL; |
dcf195b784bf
applied 64bit patch from Ulrich Hecht <uli@suse.de>
pontscho
parents:
6145
diff
changeset
|
140 uint32_t * drw = NULL; |
dcf195b784bf
applied 64bit patch from Ulrich Hecht <uli@suse.de>
pontscho
parents:
6145
diff
changeset
|
141 uint32_t tmp; |
1693 | 142 |
143 if ( ( !bf )||( bf->Image == NULL ) ) return; | |
144 | |
145 i=( bf->Width * ( bf->Height / max ) ) * ofs; | |
6159
dcf195b784bf
applied 64bit patch from Ulrich Hecht <uli@suse.de>
pontscho
parents:
6145
diff
changeset
|
146 buf=(uint32_t *)mplDrawBuffer; |
dcf195b784bf
applied 64bit patch from Ulrich Hecht <uli@suse.de>
pontscho
parents:
6145
diff
changeset
|
147 drw=(uint32_t *)bf->Image; |
1693 | 148 |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
149 for ( iy=y;iy < (int)(y+bf->Height / max);iy++ ) |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
150 for ( ix=x;ix < (int)(x+bf->Width);ix++ ) |
1693 | 151 { |
152 tmp=drw[i++]; | |
153 if ( tmp != 0x00ff00ff ) | |
154 buf[ iy*appMPlayer.main.Bitmap.Width+ix ]=tmp; | |
155 } | |
156 } | |
157 | |
158 void mplMainDraw( wsParamDisplay ) | |
159 { | |
160 wItem * item; | |
161 txSample * image = NULL; | |
162 int i; | |
163 | |
6043 | 164 if ( appMPlayer.mainWindow.State == wsWindowClosed ) exit_player( MSGTR_Exit_quit ); |
165 | |
1693 | 166 if ( appMPlayer.mainWindow.Visible == wsWindowNotVisible || |
1729 | 167 !mainVisible ) return; |
168 // !appMPlayer.mainWindow.Mapped ) return; | |
169 | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
170 btnModify( evSetMoviePosition,guiIntfStruct.Position ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
171 btnModify( evSetVolume,guiIntfStruct.Volume ); |
1751 | 172 |
6794 | 173 if ( mplMainRender && appMPlayer.mainWindow.State == wsWindowExpose ) |
1693 | 174 { |
175 memcpy( mplDrawBuffer,appMPlayer.main.Bitmap.Image,appMPlayer.main.Bitmap.ImageSize ); | |
176 for( i=0;i < appMPlayer.NumberOfItems + 1;i++ ) | |
177 { | |
178 item=&appMPlayer.Items[i]; | |
179 switch( item->type ) | |
180 { | |
181 case itButton: | |
182 PutImage( &item->Bitmap,item->x,item->y,3,item->pressed ); | |
183 break; | |
1729 | 184 case itPotmeter: |
5919 | 185 PutImage( &item->Bitmap,item->x,item->y,item->phases,( item->phases - 1 ) * ( item->value / 100.0f ) ); |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
186 break; |
1693 | 187 case itHPotmeter: |
188 PutImage( &item->Bitmap,item->x,item->y,item->phases,item->phases * ( item->value / 100.0f ) ); | |
189 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
|
190 break; |
1693 | 191 case itSLabel: |
192 image=fntRender( item->fontid,0,item->width,"%s",item->label ); | |
193 goto drawrenderedtext; | |
194 case itDLabel: | |
6755 | 195 { |
196 char * t = Translate( item->label ); | |
197 int l = fntTextWidth( item->fontid,t ); | |
198 image=fntRender( item->fontid,mplTimer%(l?l:item->width),item->width,"%s",t ); | |
199 } | |
1693 | 200 drawrenderedtext: |
201 if ( image ) | |
202 { | |
5919 | 203 PutImage( image,item->x,item->y,1,0 ); |
1693 | 204 if ( image->Image ) free( image->Image ); |
205 free( image ); | |
206 } | |
207 break; | |
208 } | |
209 } | |
210 wsConvert( &appMPlayer.mainWindow,mplDrawBuffer,appMPlayer.main.Bitmap.ImageSize ); | |
211 mplMainRender=0; | |
212 } | |
213 wsPutImage( &appMPlayer.mainWindow ); | |
2854 | 214 // XFlush( wsDisplay ); |
1693 | 215 } |
216 | |
1729 | 217 extern void exit_player(char* how); |
3618 | 218 extern int audio_id; |
219 extern int dvdsub_id; | |
5665 | 220 extern char * dvd_device; |
6280 | 221 extern int vcd_track; |
222 extern char * cdrom_device; | |
6619
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
223 extern int osd_visible; |
1729 | 224 |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
225 void mplEventHandling( int msg,float param ) |
1693 | 226 { |
227 int j; | |
228 | |
229 switch( msg ) | |
230 { | |
231 // --- user events | |
232 case evExit: | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
233 exit_player( "Exit" ); |
1693 | 234 break; |
2994 | 235 |
6298 | 236 case evPlayNetwork: |
6794 | 237 if ( guiIntfStruct.Subtitlename ) { free( guiIntfStruct.Subtitlename ); guiIntfStruct.Subtitlename=NULL; } |
238 if ( guiIntfStruct.AudioFile ) { free( guiIntfStruct.AudioFile ); guiIntfStruct.AudioFile=NULL; } | |
6298 | 239 guiIntfStruct.StreamType=STREAMTYPE_STREAM; |
240 goto play; | |
241 case evSetURL: | |
242 gtkShow( evPlayNetwork,NULL ); | |
243 break; | |
244 | |
6280 | 245 #ifdef HAVE_VCD |
246 case evSetVCDTrack: | |
247 guiIntfStruct.Track=(int)param; | |
248 case evPlayVCD: | |
7009 | 249 gtkSet( gtkClearStruct,0,(void *)guiALL ); |
6280 | 250 guiIntfStruct.StreamType=STREAMTYPE_VCD; |
251 goto play; | |
252 #endif | |
3054 | 253 #ifdef USE_DVDREAD |
2994 | 254 case evPlayDVD: |
5665 | 255 guiIntfStruct.DVD.current_title=1; |
256 guiIntfStruct.DVD.current_chapter=1; | |
257 guiIntfStruct.DVD.current_angle=1; | |
3618 | 258 play_dvd_2: |
7009 | 259 gtkSet( gtkClearStruct,0,(void *)(guiALL - guiDVD) ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
260 guiIntfStruct.StreamType=STREAMTYPE_DVD; |
3054 | 261 #endif |
2994 | 262 case evPlay: |
263 case evPlaySwitchToPause: | |
6280 | 264 play: |
6713 | 265 |
6794 | 266 if ( ( msg == evPlaySwitchToPause )&&( guiIntfStruct.Playing == 2 ) ) goto NoPause; |
3618 | 267 |
6280 | 268 vcd_track=0; |
269 dvd_title=0; | |
270 | |
6905 | 271 if ( gtkSet( gtkGetCurrPlItem,0,NULL ) &&( guiIntfStruct.StreamType == STREAMTYPE_FILE ) ) |
6713 | 272 { |
273 plItem * next = gtkSet( gtkGetCurrPlItem,0,NULL ); | |
274 plLastPlayed=next; | |
275 guiSetDF( guiIntfStruct.Filename,next->path,next->name ); | |
276 guiIntfStruct.StreamType=STREAMTYPE_FILE; | |
277 guiIntfStruct.FilenameChanged=1; | |
6794 | 278 gfree( (void **)&guiIntfStruct.AudioFile ); |
279 gfree( (void **)&guiIntfStruct.Subtitlename ); | |
6713 | 280 } |
281 | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
282 switch ( guiIntfStruct.StreamType ) |
1693 | 283 { |
6298 | 284 case STREAMTYPE_STREAM: |
6280 | 285 case STREAMTYPE_FILE: |
7009 | 286 gtkSet( gtkClearStruct,0,(void *)(guiALL - guiFilenames) ); |
6280 | 287 break; |
288 #ifdef HAVE_VCD | |
2995 | 289 case STREAMTYPE_VCD: |
7009 | 290 gtkSet( gtkClearStruct,0,(void *)(guiALL - guiVCD - guiFilenames) ); |
291 if ( !cdrom_device ) cdrom_device=DEFAULT_CDROM_DEVICE; | |
292 mplSetFileName( NULL,cdrom_device,STREAMTYPE_VCD ); | |
6280 | 293 if ( guiIntfStruct.Playing != 2 ) |
294 { | |
295 if ( !guiIntfStruct.Track ) | |
296 { | |
297 if ( guiIntfStruct.VCDTracks == 1 ) guiIntfStruct.Track=1; | |
298 else guiIntfStruct.Track=2; | |
299 } | |
300 vcd_track=guiIntfStruct.Track; | |
301 guiIntfStruct.DiskChanged=1; | |
302 } | |
303 break; | |
304 #endif | |
3054 | 305 #ifdef USE_DVDREAD |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
306 case STREAMTYPE_DVD: |
7009 | 307 gtkSet( gtkClearStruct,0,(void *)(guiALL - guiDVD - guiFilenames) ); |
308 if ( !dvd_device ) dvd_device=DEFAULT_DVD_DEVICE; | |
309 mplSetFileName( NULL,dvd_device,STREAMTYPE_DVD ); | |
5667 | 310 if ( guiIntfStruct.Playing != 2 ) |
311 { | |
312 dvd_title=guiIntfStruct.DVD.current_title; | |
313 dvd_angle=guiIntfStruct.DVD.current_angle; | |
314 dvd_chapter=guiIntfStruct.DVD.current_chapter; | |
6280 | 315 guiIntfStruct.DiskChanged=1; |
5667 | 316 } |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
317 break; |
3054 | 318 #endif |
1693 | 319 } |
320 mplPlay(); | |
321 break; | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
322 #ifdef USE_DVDREAD |
3597 | 323 case evSetDVDSubtitle: |
3618 | 324 dvdsub_id=(int)param; |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
325 goto play_dvd_2; |
3597 | 326 break; |
327 case evSetDVDAudio: | |
3618 | 328 audio_id=(int)param; |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
329 goto play_dvd_2; |
3597 | 330 break; |
331 case evSetDVDChapter: | |
5665 | 332 guiIntfStruct.DVD.current_chapter=(int)param; |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
333 goto play_dvd_2; |
3597 | 334 break; |
335 case evSetDVDTitle: | |
5665 | 336 guiIntfStruct.DVD.current_title=(int)param; |
337 guiIntfStruct.DVD.current_chapter=1; | |
338 guiIntfStruct.DVD.current_angle=1; | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
339 goto play_dvd_2; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
340 break; |
3618 | 341 #endif |
1693 | 342 |
2994 | 343 case evPause: |
1693 | 344 case evPauseSwitchToPlay: |
345 NoPause: | |
4963 | 346 mplPause(); |
1693 | 347 break; |
348 | |
6794 | 349 case evStop: guiIntfStruct.Playing=guiSetStop; break; |
1693 | 350 |
351 case evLoadPlay: | |
352 mplMainAutoPlay=1; | |
6280 | 353 // guiIntfStruct.StreamType=STREAMTYPE_FILE; |
1693 | 354 case evLoad: |
6713 | 355 gtkSet( gtkDelPl,0,NULL ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
356 gtkShow( evLoad,NULL ); |
1693 | 357 break; |
6794 | 358 case evLoadSubtitle: gtkShow( evLoadSubtitle,NULL ); break; |
7169 | 359 case evDropSubtitle: |
360 gfree( (void **)&guiIntfStruct.Subtitlename ); | |
361 guiLoadSubtitle( NULL ); | |
362 break; | |
6794 | 363 case evLoadAudioFile: gtkShow( evLoadAudioFile,NULL ); break; |
364 case evPrev: mplPrev(); break; | |
365 case evNext: mplNext(); break; | |
1693 | 366 |
6713 | 367 case evPlayList: gtkShow( evPlayList,NULL ); break; |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
368 case evSkinBrowser: gtkShow( evSkinBrowser,skinName ); break; |
6713 | 369 case evAbout: gtkShow( evAbout,NULL ); break; |
370 case evPreferences: gtkShow( evPreferences,NULL ); break; | |
371 case evEqualizer: gtkShow( evEqualizer,NULL ); break; | |
1693 | 372 |
373 case evForward1min: mplRelSeek( 60 ); break; | |
374 case evBackward1min: mplRelSeek( -60 ); break; | |
375 case evForward10sec: mplRelSeek( 10 ); break; | |
376 case evBackward10sec: mplRelSeek( -10 ); break; | |
377 case evSetMoviePosition: mplAbsSeek( param ); break; | |
378 | |
1860 | 379 case evIncVolume: vo_x11_putkey( wsGrayMul ); break; |
380 case evDecVolume: vo_x11_putkey( wsGrayDiv ); break; | |
6619
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
381 case evMute: mixer_mute(); break; |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
382 |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
383 case evSetVolume: |
6619
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
384 guiIntfStruct.Volume=param; |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
385 goto set_volume; |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
386 case evSetBalance: |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
387 guiIntfStruct.Balance=param; |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
388 set_volume: |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
389 { |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
390 float l = guiIntfStruct.Volume * ( ( 100.0 - guiIntfStruct.Balance ) / 50.0 ); |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
391 float r = guiIntfStruct.Volume * ( ( guiIntfStruct.Balance ) / 50.0 ); |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
392 if ( l > guiIntfStruct.Volume ) l=guiIntfStruct.Volume; |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
393 if ( r > guiIntfStruct.Volume ) r=guiIntfStruct.Volume; |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
394 // printf( "!!! v: %.2f b: %.2f -> %.2f x %.2f\n",guiIntfStruct.Volume,guiIntfStruct.Balance,l,r ); |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
395 mixer_setvolume( l,r ); |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
396 } |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
397 #ifdef USE_OSD |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
398 if ( osd_level ) |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
399 { |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
400 osd_visible=vo_mouse_timer_const; |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
401 vo_osd_progbar_type=OSD_VOLUME; |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
402 vo_osd_progbar_value=( ( guiIntfStruct.Volume ) * 256.0 ) / 100.0; |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
403 vo_osd_changed( OSDTYPE_PROGBAR ); |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
404 } |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
405 #endif |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
406 break; |
1847 | 407 |
1693 | 408 |
2994 | 409 case evIconify: |
410 switch ( (int)param ) | |
411 { | |
412 case 0: wsIconify( appMPlayer.mainWindow ); break; | |
413 case 1: wsIconify( appMPlayer.subWindow ); break; | |
414 } | |
415 break; | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
416 case evDoubleSize: |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
417 if ( guiIntfStruct.Playing ) |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
418 { |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
419 appMPlayer.subWindow.isFullScreen=True; |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
420 appMPlayer.subWindow.OldX=( wsMaxX - guiIntfStruct.MovieWidth * 2 ) / 2; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
421 appMPlayer.subWindow.OldY=( wsMaxY - guiIntfStruct.MovieHeight * 2 ) / 2; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
422 appMPlayer.subWindow.OldWidth=guiIntfStruct.MovieWidth * 2; appMPlayer.subWindow.OldHeight=guiIntfStruct.MovieHeight * 2; |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
423 wsFullScreen( &appMPlayer.subWindow ); |
5520 | 424 vo_fs=0; |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
425 } |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
426 break; |
6623 | 427 case evNormalSize: |
428 if ( guiIntfStruct.Playing ) | |
429 { | |
430 appMPlayer.subWindow.isFullScreen=True; | |
431 appMPlayer.subWindow.OldX=( wsMaxX - guiIntfStruct.MovieWidth ) / 2; | |
432 appMPlayer.subWindow.OldY=( wsMaxY - guiIntfStruct.MovieHeight ) / 2; | |
433 appMPlayer.subWindow.OldWidth=guiIntfStruct.MovieWidth; appMPlayer.subWindow.OldHeight=guiIntfStruct.MovieHeight; | |
434 wsFullScreen( &appMPlayer.subWindow ); | |
435 vo_fs=0; | |
436 break; | |
437 } else if ( !appMPlayer.subWindow.isFullScreen ) break; | |
2994 | 438 case evFullScreen: |
439 for ( j=0;j<appMPlayer.NumberOfItems + 1;j++ ) | |
440 { | |
441 if ( appMPlayer.Items[j].msg == evFullScreen ) | |
442 { | |
443 appMPlayer.Items[j].tmp=!appMPlayer.Items[j].tmp; | |
444 appMPlayer.Items[j].pressed=appMPlayer.Items[j].tmp; | |
445 } | |
446 } | |
4981 | 447 mplFullScreen(); |
2994 | 448 break; |
1693 | 449 |
7541 | 450 case evSetAspect: |
451 switch ( (int)param ) | |
452 { | |
453 case 2: movie_aspect=16.0f / 9.0f; break; | |
454 case 3: movie_aspect=4.0f / 3.0f; break; | |
455 case 4: movie_aspect=2.35; break; | |
456 case 1: | |
457 default: movie_aspect=-1; | |
458 } | |
459 wsClearWindow( appMPlayer.subWindow ); | |
7751 | 460 if ( guiIntfStruct.StreamType == STREAMTYPE_DVD ) goto play_dvd_2; |
461 else guiIntfStruct.FilenameChanged=1; | |
7541 | 462 break; |
463 | |
1693 | 464 // --- timer events |
465 case evRedraw: | |
466 mplMainRender=1; | |
467 wsPostRedisplay( &appMPlayer.mainWindow ); | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
468 mplRedrawTimer=mplRedrawTimerConst; |
1693 | 469 break; |
470 // --- system events | |
6218 | 471 #ifdef MP_DEBUG |
1693 | 472 case evNone: |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
473 mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[mw] event none received.\n" ); |
1693 | 474 break; |
475 default: | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
476 mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[mw] unknown event received ( %d,%.2f ).\n",msg,param ); |
1693 | 477 break; |
6218 | 478 #endif |
1693 | 479 } |
480 } | |
481 | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
482 #define itPLMButton (itNULL - 1) |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
483 #define itPRMButton (itNULL - 2) |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
484 |
1693 | 485 void mplMainMouseHandle( int Button,int X,int Y,int RX,int RY ) |
486 { | |
487 static int itemtype = 0; | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
488 int i; |
1693 | 489 wItem * item = NULL; |
490 float value = 0.0f; | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
491 |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
492 static int SelectedItem = -1; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
493 int currentselected = -1; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
494 |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
495 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
|
496 if ( ( appMPlayer.Items[i].pressed != btnDisabled )&& |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
497 ( 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
|
498 { currentselected=i; break; } |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
499 |
1693 | 500 switch ( Button ) |
501 { | |
6651 | 502 case wsPMMouseButton: |
6755 | 503 gtkShow( evHidePopUpMenu,NULL ); |
1693 | 504 mplShowMenu( RX,RY ); |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
505 itemtype=itPRMButton; |
1693 | 506 break; |
6651 | 507 case wsRMMouseButton: |
5919 | 508 mplHideMenu( RX,RY,0 ); |
1693 | 509 break; |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
510 |
1693 | 511 case wsPLMouseButton: |
6755 | 512 gtkShow( evHidePopUpMenu,NULL ); |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
513 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
|
514 SelectedItem=currentselected; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
515 if ( SelectedItem == -1 ) break; // yeees, i'm move the fucking window |
6794 | 516 boxMoved=0; //mplMainRender=1; // No, not move the window, i'm pressed one button |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
517 item=&appMPlayer.Items[SelectedItem]; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
518 itemtype=item->type; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
519 item->pressed=btnPressed; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
520 switch( item->type ) |
1693 | 521 { |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
522 case itButton: |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
523 if ( ( SelectedItem > -1 ) && |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
524 ( ( ( 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
|
525 ( ( 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
|
526 { appMPlayer.Items[SelectedItem].pressed=btnDisabled; } |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
527 break; |
1693 | 528 } |
529 break; | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
530 case wsRLMouseButton: |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
531 boxMoved=0; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
532 item=&appMPlayer.Items[SelectedItem]; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
533 item->pressed=btnReleased; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
534 SelectedItem=-1; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
535 if ( currentselected == - 1 ) { itemtype=0; break; } |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
536 value=0; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
537 switch( itemtype ) |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
538 { |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
539 case itPotmeter: |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
540 case itHPotmeter: |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
541 btnModify( item->msg,(float)( X - item->x ) / item->width * 100.0f ); |
6619
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
542 mplEventHandling( item->msg,item->value ); |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
543 value=item->value; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
544 break; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
545 } |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
546 mplEventHandling( item->msg,value ); |
6794 | 547 // mplMainRender=1; |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
548 itemtype=0; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
549 break; |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
550 |
6651 | 551 case wsPRMouseButton: |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
552 gtkShow( evShowPopUpMenu,NULL ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
553 break; |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
554 |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
555 // --- rolled mouse ... de szar :))) |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
556 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
|
557 case wsP4MouseButton: value= 2.5f; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
558 rollerhandled: |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
559 item=&appMPlayer.Items[currentselected]; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
560 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
|
561 { |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
562 item->value+=value; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
563 btnModify( item->msg,item->value ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
564 mplEventHandling( item->msg,item->value ); |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
565 } |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
566 break; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
567 |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
568 // --- moving |
1693 | 569 case wsMoveMouse: |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
570 item=&appMPlayer.Items[SelectedItem]; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
571 switch ( itemtype ) |
1693 | 572 { |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
573 case itPLMButton: |
2854 | 574 wsMoveWindow( &appMPlayer.mainWindow,False,RX - abs( sx ),RY - abs( sy ) ); |
1693 | 575 mplMainRender=0; |
576 break; | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
577 case itPRMButton: |
1693 | 578 mplMenuMouseHandle( X,Y,RX,RY ); |
579 break; | |
580 case itPotmeter: | |
1729 | 581 item->value=(float)( X - item->x ) / item->width * 100.0f; |
1693 | 582 goto potihandled; |
583 case itHPotmeter: | |
1729 | 584 item->value=(float)( X - item->x ) / item->width * 100.0f; |
1693 | 585 potihandled: |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
586 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
|
587 if ( item->value < 0.0f ) item->value=0.0f; |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
588 mplEventHandling( item->msg,item->value ); |
1693 | 589 break; |
590 } | |
591 break; | |
592 } | |
6619
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
593 // if ( Button != wsMoveMouse ) wsPostRedisplay( &appMPlayer.mainWindow ); |
1693 | 594 } |
595 | |
596 int keyPressed = 0; | |
597 | |
6183
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
598 void mplMainKeyHandle( int KeyCode,int Type,int Key ) |
1693 | 599 { |
600 int msg = evNone; | |
4950 | 601 |
4409 | 602 if ( Type != wsKeyPressed ) return; |
6183
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
603 |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
604 if ( !Key ) |
1693 | 605 { |
6183
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
606 switch ( KeyCode ) |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
607 { |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
608 case wsXFMMPrev: msg=evPrev; break; |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
609 case wsXFMMStop: msg=evStop; break; |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
610 case wsXFMMPlay: msg=evPlaySwitchToPause; break; |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
611 case wsXFMMNext: msg=evNext; break; |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
612 case wsXFMMVolUp: msg=evIncVolume; break; |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
613 case wsXFMMVolDown: msg=evDecVolume; break; |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
614 case wsXFMMMute: msg=evMute; break; |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
615 } |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
616 } |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
617 else |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
618 { |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
619 switch ( Key ) |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
620 { |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
621 case wsEnter: msg=evPlay; break; |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
622 case wsXF86LowerVolume: msg=evDecVolume; break; |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
623 case wsXF86RaiseVolume: msg=evIncVolume; break; |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
624 case wsXF86Mute: msg=evMute; break; |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
625 case wsXF86Play: msg=evPlaySwitchToPause; break; |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
626 case wsXF86Stop: msg=evStop; break; |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
627 case wsXF86Prev: msg=evPrev; break; |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
628 case wsXF86Next: msg=evNext; break; |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
629 case wsXF86Media: msg=evLoad; break; |
4409 | 630 |
6183
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
631 default: vo_x11_putkey( Key ); return; |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
632 } |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
633 } |
4858 | 634 if ( msg != evNone ) mplEventHandling( msg,0 ); |
1693 | 635 } |
6967
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
636 |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
637 /* this will be used to handle Drag&Drop files */ |
7092
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7009
diff
changeset
|
638 void mplDandDHandler(int num,char** files) |
6967
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
639 { |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
640 struct stat buf; |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
641 int f = 0; |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
642 |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
643 if (num <= 0) |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
644 return; |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
645 |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
646 /* clear playlist */ |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
647 gtkSet(gtkDelPl,0,NULL); |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
648 |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
649 /* now fill it with new items */ |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
650 for(f=0; f < num; f++){ |
6977
7242f1840f8d
kde3 dnd fix from Gregory Kovriga and file name handling fix in dnd callback
pontscho
parents:
6967
diff
changeset
|
651 char* str = strdup( files[f] ); |
6967
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
652 plItem* item; |
6977
7242f1840f8d
kde3 dnd fix from Gregory Kovriga and file name handling fix in dnd callback
pontscho
parents:
6967
diff
changeset
|
653 |
6996 | 654 #ifdef USE_ICONV |
6977
7242f1840f8d
kde3 dnd fix from Gregory Kovriga and file name handling fix in dnd callback
pontscho
parents:
6967
diff
changeset
|
655 if ( strchr( str,'%' ) ) |
7242f1840f8d
kde3 dnd fix from Gregory Kovriga and file name handling fix in dnd callback
pontscho
parents:
6967
diff
changeset
|
656 { |
6996 | 657 char * tmp=gconvert_uri_to_filename( str ); |
658 free( str ); str=tmp; | |
6977
7242f1840f8d
kde3 dnd fix from Gregory Kovriga and file name handling fix in dnd callback
pontscho
parents:
6967
diff
changeset
|
659 } |
6996 | 660 #endif |
6977
7242f1840f8d
kde3 dnd fix from Gregory Kovriga and file name handling fix in dnd callback
pontscho
parents:
6967
diff
changeset
|
661 |
6967
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
662 if(stat(str,&buf) == 0 && S_ISDIR(buf.st_mode) == 0) { |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
663 /* this is not a directory so try to play it */ |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
664 printf("Received D&D %s\n",str); |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
665 item = calloc(1,sizeof(plItem)); |
6977
7242f1840f8d
kde3 dnd fix from Gregory Kovriga and file name handling fix in dnd callback
pontscho
parents:
6967
diff
changeset
|
666 |
6967
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
667 /* FIXME: decompose file name ? */ |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
668 /* yes -- Pontscho */ |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
669 if ( strrchr( str,'/' ) ) |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
670 { |
6977
7242f1840f8d
kde3 dnd fix from Gregory Kovriga and file name handling fix in dnd callback
pontscho
parents:
6967
diff
changeset
|
671 char * s = strrchr( str,'/' ); *s=0; s++; |
6967
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
672 item->name = gstrdup( s ); |
6977
7242f1840f8d
kde3 dnd fix from Gregory Kovriga and file name handling fix in dnd callback
pontscho
parents:
6967
diff
changeset
|
673 item->path = gstrdup( str ); |
6967
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
674 } else { item->name = strdup(str); item->path = strdup(""); } |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
675 gtkSet(gtkAddPlItem,0,(void*)item); |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
676 } else { |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
677 printf("Received not a file: %s !\n",str); |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
678 } |
6977
7242f1840f8d
kde3 dnd fix from Gregory Kovriga and file name handling fix in dnd callback
pontscho
parents:
6967
diff
changeset
|
679 free( str ); |
6967
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
680 } |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
681 |
7009 | 682 mplSetFileName( NULL,files[0],STREAMTYPE_FILE ); |
6967
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
683 if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evStop,0 ); |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
684 mplEventHandling( evPlay,0 ); |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
685 |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
686 } |