Mercurial > mplayer.hg
annotate Gui/mplayer/mw.c @ 18179:3628371ad165
We now have CJPG samples and they work with the CJPG and ijpg decoders.
author | diego |
---|---|
date | Sat, 22 Apr 2006 11:22:18 +0000 |
parents | f9a939c204ad |
children | 34cc93e9848f |
rev | line source |
---|---|
1693 | 1 |
2 // main window | |
3 | |
8055 | 4 #include <stdlib.h> |
5 #include <stdio.h> | |
6 #include <inttypes.h> | |
7 #include <sys/stat.h> | |
8 #include <unistd.h> | |
9 | |
17144 | 10 #include "app.h" |
11 #include "skin/font.h" | |
12 #include "skin/skin.h" | |
13 #include "wm/ws.h" | |
8055 | 14 |
17144 | 15 #include "../config.h" |
16 #include "../help_mp.h" | |
17 #include "../libvo/x11_common.h" | |
18 #include "../libvo/fastmemcpy.h" | |
8055 | 19 |
17144 | 20 #include "../libmpdemux/stream.h" |
21 #include "../mixer.h" | |
22 #include "../libvo/sub.h" | |
23 #include "../mplayer.h" | |
2447 | 24 |
17144 | 25 #include "../libmpdemux/demuxer.h" |
26 #include "../libmpdemux/stheader.h" | |
27 #include "../codec-cfg.h" | |
8305
4c23944315d6
- add Rdiger Kuhlmann's <mplayer-list-UGa6JdjLujS2@ruediger-kuhlmann.de> patch
pontscho
parents:
8302
diff
changeset
|
28 |
13672 | 29 #define GUI_REDRAW_WAIT 375 |
8305
4c23944315d6
- add Rdiger Kuhlmann's <mplayer-list-UGa6JdjLujS2@ruediger-kuhlmann.de> patch
pontscho
parents:
8302
diff
changeset
|
30 |
8055 | 31 #include "play.h" |
32 #include "widgets.h" | |
33 | |
12691
0230544f52a1
Fix GUI compilation, patch by Reimar Dffinger and Alexander Strasser.
diego
parents:
10194
diff
changeset
|
34 extern mixer_t mixer; // mixer from mplayer.c |
18118
f9a939c204ad
Adds "cheap" subtitle switching for non-DVD playouts (for ex. OGG or MKV).
gpoirier
parents:
17254
diff
changeset
|
35 extern int global_sub_size; |
f9a939c204ad
Adds "cheap" subtitle switching for non-DVD playouts (for ex. OGG or MKV).
gpoirier
parents:
17254
diff
changeset
|
36 extern int global_sub_pos; |
f9a939c204ad
Adds "cheap" subtitle switching for non-DVD playouts (for ex. OGG or MKV).
gpoirier
parents:
17254
diff
changeset
|
37 extern int global_sub_indices[]; |
f9a939c204ad
Adds "cheap" subtitle switching for non-DVD playouts (for ex. OGG or MKV).
gpoirier
parents:
17254
diff
changeset
|
38 extern int sub_source(void); |
f9a939c204ad
Adds "cheap" subtitle switching for non-DVD playouts (for ex. OGG or MKV).
gpoirier
parents:
17254
diff
changeset
|
39 #define SUB_SOURCE_VOBSUB 1 |
f9a939c204ad
Adds "cheap" subtitle switching for non-DVD playouts (for ex. OGG or MKV).
gpoirier
parents:
17254
diff
changeset
|
40 #define SUB_SOURCE_DEMUX 2 |
12691
0230544f52a1
Fix GUI compilation, patch by Reimar Dffinger and Alexander Strasser.
diego
parents:
10194
diff
changeset
|
41 |
8043 | 42 extern unsigned int GetTimerMS( void ); |
43 | |
1693 | 44 unsigned char * mplDrawBuffer = NULL; |
45 int mplMainRender = 1; | |
2940 | 46 |
1693 | 47 int mplMainAutoPlay = 0; |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
48 int mplMiddleMenu = 0; |
1693 | 49 |
50 int mainVisible = 1; | |
51 | |
52 int boxMoved = 0; | |
53 int sx = 0,sy = 0; | |
54 int i,pot = 0; | |
55 | |
8973 | 56 #include "common.h" |
1693 | 57 |
8058 | 58 void mplMainDraw( void ) |
1693 | 59 { |
60 wItem * item; | |
61 txSample * image = NULL; | |
8300 | 62 int i, type; |
1693 | 63 |
6043 | 64 if ( appMPlayer.mainWindow.State == wsWindowClosed ) exit_player( MSGTR_Exit_quit ); |
65 | |
1693 | 66 if ( appMPlayer.mainWindow.Visible == wsWindowNotVisible || |
1729 | 67 !mainVisible ) return; |
68 // !appMPlayer.mainWindow.Mapped ) return; | |
69 | |
6794 | 70 if ( mplMainRender && appMPlayer.mainWindow.State == wsWindowExpose ) |
1693 | 71 { |
8973 | 72 btnModify( evSetMoviePosition,guiIntfStruct.Position ); |
73 btnModify( evSetVolume,guiIntfStruct.Volume ); | |
74 | |
1693 | 75 memcpy( mplDrawBuffer,appMPlayer.main.Bitmap.Image,appMPlayer.main.Bitmap.ImageSize ); |
8973 | 76 Render( &appMPlayer.mainWindow,appMPlayer.Items,appMPlayer.NumberOfItems,mplDrawBuffer,appMPlayer.main.Bitmap.ImageSize ); |
1693 | 77 mplMainRender=0; |
78 } | |
79 wsPutImage( &appMPlayer.mainWindow ); | |
2854 | 80 // XFlush( wsDisplay ); |
1693 | 81 } |
82 | |
1729 | 83 extern void exit_player(char* how); |
6280 | 84 extern int vcd_track; |
6619
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
85 extern int osd_visible; |
13672 | 86 static unsigned last_redraw_time = 0; |
1729 | 87 |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
88 void mplEventHandling( int msg,float param ) |
1693 | 89 { |
90 int j; | |
8423 | 91 int iparam = (int)param; |
1693 | 92 |
93 switch( msg ) | |
94 { | |
95 // --- user events | |
96 case evExit: | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
97 exit_player( "Exit" ); |
1693 | 98 break; |
2994 | 99 |
6298 | 100 case evPlayNetwork: |
9040
2a0619fd84f0
- add new entry's to hungarian skin howto (please Gabu translate)
pontscho
parents:
8975
diff
changeset
|
101 gfree( (void **)&guiIntfStruct.Subtitlename ); |
2a0619fd84f0
- add new entry's to hungarian skin howto (please Gabu translate)
pontscho
parents:
8975
diff
changeset
|
102 gfree( (void **)&guiIntfStruct.AudioFile ); |
6298 | 103 guiIntfStruct.StreamType=STREAMTYPE_STREAM; |
104 goto play; | |
105 case evSetURL: | |
106 gtkShow( evPlayNetwork,NULL ); | |
107 break; | |
8312
ef8c992672f4
- audio track handling in menu (idea from Rdiger Kuhlmann)
pontscho
parents:
8305
diff
changeset
|
108 |
ef8c992672f4
- audio track handling in menu (idea from Rdiger Kuhlmann)
pontscho
parents:
8305
diff
changeset
|
109 case evSetAudio: |
8423 | 110 if ( !guiIntfStruct.demuxer || audio_id == iparam ) break; |
111 audio_id=iparam; | |
8484 | 112 goto play; |
8380 | 113 |
114 case evSetVideo: | |
8423 | 115 if ( !guiIntfStruct.demuxer || video_id == iparam ) break; |
116 video_id=iparam; | |
8484 | 117 goto play; |
8380 | 118 |
18118
f9a939c204ad
Adds "cheap" subtitle switching for non-DVD playouts (for ex. OGG or MKV).
gpoirier
parents:
17254
diff
changeset
|
119 case evSetSubtitle: |
f9a939c204ad
Adds "cheap" subtitle switching for non-DVD playouts (for ex. OGG or MKV).
gpoirier
parents:
17254
diff
changeset
|
120 if ( !guiIntfStruct.demuxer || global_sub_pos == iparam ) break; |
f9a939c204ad
Adds "cheap" subtitle switching for non-DVD playouts (for ex. OGG or MKV).
gpoirier
parents:
17254
diff
changeset
|
121 global_sub_pos = iparam; |
f9a939c204ad
Adds "cheap" subtitle switching for non-DVD playouts (for ex. OGG or MKV).
gpoirier
parents:
17254
diff
changeset
|
122 if ( global_sub_pos >= 0 ) |
f9a939c204ad
Adds "cheap" subtitle switching for non-DVD playouts (for ex. OGG or MKV).
gpoirier
parents:
17254
diff
changeset
|
123 switch ( sub_source() ) |
f9a939c204ad
Adds "cheap" subtitle switching for non-DVD playouts (for ex. OGG or MKV).
gpoirier
parents:
17254
diff
changeset
|
124 { |
f9a939c204ad
Adds "cheap" subtitle switching for non-DVD playouts (for ex. OGG or MKV).
gpoirier
parents:
17254
diff
changeset
|
125 case SUB_SOURCE_VOBSUB: |
f9a939c204ad
Adds "cheap" subtitle switching for non-DVD playouts (for ex. OGG or MKV).
gpoirier
parents:
17254
diff
changeset
|
126 vobsub_id = global_sub_pos - global_sub_indices[SUB_SOURCE_VOBSUB]; |
f9a939c204ad
Adds "cheap" subtitle switching for non-DVD playouts (for ex. OGG or MKV).
gpoirier
parents:
17254
diff
changeset
|
127 goto play; |
f9a939c204ad
Adds "cheap" subtitle switching for non-DVD playouts (for ex. OGG or MKV).
gpoirier
parents:
17254
diff
changeset
|
128 case SUB_SOURCE_DEMUX: |
f9a939c204ad
Adds "cheap" subtitle switching for non-DVD playouts (for ex. OGG or MKV).
gpoirier
parents:
17254
diff
changeset
|
129 vobsub_id = -1; |
f9a939c204ad
Adds "cheap" subtitle switching for non-DVD playouts (for ex. OGG or MKV).
gpoirier
parents:
17254
diff
changeset
|
130 dvdsub_id = global_sub_pos - global_sub_indices[SUB_SOURCE_DEMUX]; |
f9a939c204ad
Adds "cheap" subtitle switching for non-DVD playouts (for ex. OGG or MKV).
gpoirier
parents:
17254
diff
changeset
|
131 goto play; |
f9a939c204ad
Adds "cheap" subtitle switching for non-DVD playouts (for ex. OGG or MKV).
gpoirier
parents:
17254
diff
changeset
|
132 } |
f9a939c204ad
Adds "cheap" subtitle switching for non-DVD playouts (for ex. OGG or MKV).
gpoirier
parents:
17254
diff
changeset
|
133 vobsub_id = -1; |
f9a939c204ad
Adds "cheap" subtitle switching for non-DVD playouts (for ex. OGG or MKV).
gpoirier
parents:
17254
diff
changeset
|
134 dvdsub_id = -2; |
f9a939c204ad
Adds "cheap" subtitle switching for non-DVD playouts (for ex. OGG or MKV).
gpoirier
parents:
17254
diff
changeset
|
135 goto play; |
f9a939c204ad
Adds "cheap" subtitle switching for non-DVD playouts (for ex. OGG or MKV).
gpoirier
parents:
17254
diff
changeset
|
136 |
6280 | 137 #ifdef HAVE_VCD |
138 case evSetVCDTrack: | |
8423 | 139 guiIntfStruct.Track=iparam; |
6280 | 140 case evPlayVCD: |
7009 | 141 gtkSet( gtkClearStruct,0,(void *)guiALL ); |
6280 | 142 guiIntfStruct.StreamType=STREAMTYPE_VCD; |
143 goto play; | |
144 #endif | |
3054 | 145 #ifdef USE_DVDREAD |
2994 | 146 case evPlayDVD: |
5665 | 147 guiIntfStruct.DVD.current_title=1; |
148 guiIntfStruct.DVD.current_chapter=1; | |
149 guiIntfStruct.DVD.current_angle=1; | |
3618 | 150 play_dvd_2: |
7009 | 151 gtkSet( gtkClearStruct,0,(void *)(guiALL - guiDVD) ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
152 guiIntfStruct.StreamType=STREAMTYPE_DVD; |
8423 | 153 goto play; |
3054 | 154 #endif |
2994 | 155 case evPlay: |
156 case evPlaySwitchToPause: | |
6280 | 157 play: |
6713 | 158 |
6794 | 159 if ( ( msg == evPlaySwitchToPause )&&( guiIntfStruct.Playing == 2 ) ) goto NoPause; |
3618 | 160 |
6905 | 161 if ( gtkSet( gtkGetCurrPlItem,0,NULL ) &&( guiIntfStruct.StreamType == STREAMTYPE_FILE ) ) |
6713 | 162 { |
163 plItem * next = gtkSet( gtkGetCurrPlItem,0,NULL ); | |
164 plLastPlayed=next; | |
8423 | 165 mplSetFileName( next->path,next->name,STREAMTYPE_FILE ); |
6713 | 166 } |
167 | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
168 switch ( guiIntfStruct.StreamType ) |
1693 | 169 { |
6298 | 170 case STREAMTYPE_STREAM: |
6280 | 171 case STREAMTYPE_FILE: |
7009 | 172 gtkSet( gtkClearStruct,0,(void *)(guiALL - guiFilenames) ); |
6280 | 173 break; |
174 #ifdef HAVE_VCD | |
2995 | 175 case STREAMTYPE_VCD: |
7009 | 176 gtkSet( gtkClearStruct,0,(void *)(guiALL - guiVCD - guiFilenames) ); |
8933
bfe1b826cff1
add DVD and CDRom device entry's, and fix two 10l bug
pontscho
parents:
8883
diff
changeset
|
177 if ( !cdrom_device ) cdrom_device=gstrdup( DEFAULT_CDROM_DEVICE ); |
7009 | 178 mplSetFileName( NULL,cdrom_device,STREAMTYPE_VCD ); |
6280 | 179 if ( guiIntfStruct.Playing != 2 ) |
180 { | |
181 if ( !guiIntfStruct.Track ) | |
182 { | |
8423 | 183 if ( guiIntfStruct.VCDTracks > 1 ) guiIntfStruct.Track=2; |
184 else guiIntfStruct.Track=1; | |
6280 | 185 } |
186 guiIntfStruct.DiskChanged=1; | |
187 } | |
188 break; | |
189 #endif | |
3054 | 190 #ifdef USE_DVDREAD |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
191 case STREAMTYPE_DVD: |
7009 | 192 gtkSet( gtkClearStruct,0,(void *)(guiALL - guiDVD - guiFilenames) ); |
8933
bfe1b826cff1
add DVD and CDRom device entry's, and fix two 10l bug
pontscho
parents:
8883
diff
changeset
|
193 if ( !dvd_device ) dvd_device=gstrdup( DEFAULT_DVD_DEVICE ); |
7009 | 194 mplSetFileName( NULL,dvd_device,STREAMTYPE_DVD ); |
5667 | 195 if ( guiIntfStruct.Playing != 2 ) |
196 { | |
8423 | 197 guiIntfStruct.Title=guiIntfStruct.DVD.current_title; |
198 guiIntfStruct.Chapter=guiIntfStruct.DVD.current_chapter; | |
199 guiIntfStruct.Angle=guiIntfStruct.DVD.current_angle; | |
6280 | 200 guiIntfStruct.DiskChanged=1; |
5667 | 201 } |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
202 break; |
3054 | 203 #endif |
1693 | 204 } |
8423 | 205 guiIntfStruct.NewPlay=1; |
1693 | 206 mplPlay(); |
207 break; | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
208 #ifdef USE_DVDREAD |
3597 | 209 case evSetDVDSubtitle: |
8423 | 210 dvdsub_id=iparam; |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
211 goto play_dvd_2; |
3597 | 212 break; |
213 case evSetDVDAudio: | |
8423 | 214 audio_id=iparam; |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
215 goto play_dvd_2; |
3597 | 216 break; |
217 case evSetDVDChapter: | |
8423 | 218 guiIntfStruct.DVD.current_chapter=iparam; |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
219 goto play_dvd_2; |
3597 | 220 break; |
221 case evSetDVDTitle: | |
8423 | 222 guiIntfStruct.DVD.current_title=iparam; |
5665 | 223 guiIntfStruct.DVD.current_chapter=1; |
224 guiIntfStruct.DVD.current_angle=1; | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
225 goto play_dvd_2; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
226 break; |
3618 | 227 #endif |
1693 | 228 |
2994 | 229 case evPause: |
1693 | 230 case evPauseSwitchToPlay: |
231 NoPause: | |
4963 | 232 mplPause(); |
1693 | 233 break; |
234 | |
8423 | 235 case evStop: |
236 guiIntfStruct.Playing=guiSetStop; | |
237 mplState(); | |
238 guiIntfStruct.NoWindow=False; | |
239 break; | |
1693 | 240 |
241 case evLoadPlay: | |
242 mplMainAutoPlay=1; | |
6280 | 243 // guiIntfStruct.StreamType=STREAMTYPE_FILE; |
1693 | 244 case evLoad: |
6713 | 245 gtkSet( gtkDelPl,0,NULL ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
246 gtkShow( evLoad,NULL ); |
1693 | 247 break; |
6794 | 248 case evLoadSubtitle: gtkShow( evLoadSubtitle,NULL ); break; |
7169 | 249 case evDropSubtitle: |
250 gfree( (void **)&guiIntfStruct.Subtitlename ); | |
251 guiLoadSubtitle( NULL ); | |
252 break; | |
6794 | 253 case evLoadAudioFile: gtkShow( evLoadAudioFile,NULL ); break; |
254 case evPrev: mplPrev(); break; | |
255 case evNext: mplNext(); break; | |
1693 | 256 |
6713 | 257 case evPlayList: gtkShow( evPlayList,NULL ); break; |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
258 case evSkinBrowser: gtkShow( evSkinBrowser,skinName ); break; |
6713 | 259 case evAbout: gtkShow( evAbout,NULL ); break; |
260 case evPreferences: gtkShow( evPreferences,NULL ); break; | |
261 case evEqualizer: gtkShow( evEqualizer,NULL ); break; | |
1693 | 262 |
8720 | 263 case evForward10min: mplRelSeek( 600 ); break; |
264 case evBackward10min: mplRelSeek( -600 );break; | |
1693 | 265 case evForward1min: mplRelSeek( 60 ); break; |
266 case evBackward1min: mplRelSeek( -60 ); break; | |
267 case evForward10sec: mplRelSeek( 10 ); break; | |
268 case evBackward10sec: mplRelSeek( -10 ); break; | |
269 case evSetMoviePosition: mplAbsSeek( param ); break; | |
270 | |
1860 | 271 case evIncVolume: vo_x11_putkey( wsGrayMul ); break; |
272 case evDecVolume: vo_x11_putkey( wsGrayDiv ); break; | |
12691
0230544f52a1
Fix GUI compilation, patch by Reimar Dffinger and Alexander Strasser.
diego
parents:
10194
diff
changeset
|
273 case evMute: mixer_mute( &mixer ); break; |
6619
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
274 |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
275 case evSetVolume: |
6619
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
276 guiIntfStruct.Volume=param; |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
277 goto set_volume; |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
278 case evSetBalance: |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
279 guiIntfStruct.Balance=param; |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
280 set_volume: |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
281 { |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
282 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
|
283 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
|
284 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
|
285 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
|
286 // printf( "!!! v: %.2f b: %.2f -> %.2f x %.2f\n",guiIntfStruct.Volume,guiIntfStruct.Balance,l,r ); |
12691
0230544f52a1
Fix GUI compilation, patch by Reimar Dffinger and Alexander Strasser.
diego
parents:
10194
diff
changeset
|
287 mixer_setvolume( &mixer,l,r ); |
6619
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
288 } |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
289 #ifdef USE_OSD |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
290 if ( osd_level ) |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
291 { |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
292 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
|
293 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
|
294 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
|
295 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
|
296 } |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
297 #endif |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6546
diff
changeset
|
298 break; |
1847 | 299 |
1693 | 300 |
2994 | 301 case evIconify: |
8423 | 302 switch ( iparam ) |
2994 | 303 { |
304 case 0: wsIconify( appMPlayer.mainWindow ); break; | |
305 case 1: wsIconify( appMPlayer.subWindow ); break; | |
306 } | |
307 break; | |
14589 | 308 case evHalfSize: |
309 btnSet( evFullScreen,btnReleased ); | |
310 if ( guiIntfStruct.Playing ) | |
311 { | |
312 if ( appMPlayer.subWindow.isFullScreen ) | |
313 { | |
314 mplFullScreen(); | |
315 } | |
316 wsResizeWindow( &appMPlayer.subWindow, guiIntfStruct.MovieWidth / 2, guiIntfStruct.MovieHeight / 2 ); | |
317 wsMoveWindow( &appMPlayer.subWindow, 0, | |
318 ( wsMaxX - guiIntfStruct.MovieWidth/2 )/2 + wsOrgX, | |
319 ( wsMaxY - guiIntfStruct.MovieHeight/2 )/2 + wsOrgY ); | |
320 } | |
321 break; | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
322 case evDoubleSize: |
9202 | 323 btnSet( evFullScreen,btnReleased ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
324 if ( guiIntfStruct.Playing ) |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
325 { |
14006
62aeba62685c
Restore normal/double size GUI functionality ( broken since EWMH fs support ).
al
parents:
13672
diff
changeset
|
326 if ( appMPlayer.subWindow.isFullScreen ) |
62aeba62685c
Restore normal/double size GUI functionality ( broken since EWMH fs support ).
al
parents:
13672
diff
changeset
|
327 { |
62aeba62685c
Restore normal/double size GUI functionality ( broken since EWMH fs support ).
al
parents:
13672
diff
changeset
|
328 mplFullScreen(); |
62aeba62685c
Restore normal/double size GUI functionality ( broken since EWMH fs support ).
al
parents:
13672
diff
changeset
|
329 } |
62aeba62685c
Restore normal/double size GUI functionality ( broken since EWMH fs support ).
al
parents:
13672
diff
changeset
|
330 wsResizeWindow( &appMPlayer.subWindow, guiIntfStruct.MovieWidth * 2, guiIntfStruct.MovieHeight * 2 ); |
62aeba62685c
Restore normal/double size GUI functionality ( broken since EWMH fs support ).
al
parents:
13672
diff
changeset
|
331 wsMoveWindow( &appMPlayer.subWindow, 0, |
62aeba62685c
Restore normal/double size GUI functionality ( broken since EWMH fs support ).
al
parents:
13672
diff
changeset
|
332 ( wsMaxX - guiIntfStruct.MovieWidth*2 )/2 + wsOrgX, |
62aeba62685c
Restore normal/double size GUI functionality ( broken since EWMH fs support ).
al
parents:
13672
diff
changeset
|
333 ( wsMaxY - guiIntfStruct.MovieHeight*2 )/2 + wsOrgY ); |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
334 } |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
335 break; |
6623 | 336 case evNormalSize: |
9202 | 337 btnSet( evFullScreen,btnReleased ); |
6623 | 338 if ( guiIntfStruct.Playing ) |
339 { | |
14006
62aeba62685c
Restore normal/double size GUI functionality ( broken since EWMH fs support ).
al
parents:
13672
diff
changeset
|
340 if ( appMPlayer.subWindow.isFullScreen ) |
62aeba62685c
Restore normal/double size GUI functionality ( broken since EWMH fs support ).
al
parents:
13672
diff
changeset
|
341 { |
62aeba62685c
Restore normal/double size GUI functionality ( broken since EWMH fs support ).
al
parents:
13672
diff
changeset
|
342 mplFullScreen(); |
62aeba62685c
Restore normal/double size GUI functionality ( broken since EWMH fs support ).
al
parents:
13672
diff
changeset
|
343 } |
62aeba62685c
Restore normal/double size GUI functionality ( broken since EWMH fs support ).
al
parents:
13672
diff
changeset
|
344 wsResizeWindow( &appMPlayer.subWindow, guiIntfStruct.MovieWidth, guiIntfStruct.MovieHeight ); |
62aeba62685c
Restore normal/double size GUI functionality ( broken since EWMH fs support ).
al
parents:
13672
diff
changeset
|
345 wsMoveWindow( &appMPlayer.subWindow, 0, |
62aeba62685c
Restore normal/double size GUI functionality ( broken since EWMH fs support ).
al
parents:
13672
diff
changeset
|
346 ( wsMaxX - guiIntfStruct.MovieWidth )/2 + wsOrgX, |
62aeba62685c
Restore normal/double size GUI functionality ( broken since EWMH fs support ).
al
parents:
13672
diff
changeset
|
347 ( wsMaxY - guiIntfStruct.MovieHeight )/2 + wsOrgY ); |
6623 | 348 break; |
349 } else if ( !appMPlayer.subWindow.isFullScreen ) break; | |
2994 | 350 case evFullScreen: |
9202 | 351 if ( !guiIntfStruct.Playing && !gtkShowVideoWindow ) break; |
4981 | 352 mplFullScreen(); |
9202 | 353 if ( appMPlayer.subWindow.isFullScreen ) btnSet( evFullScreen,btnPressed ); |
354 else btnSet( evFullScreen,btnReleased ); | |
2994 | 355 break; |
1693 | 356 |
7541 | 357 case evSetAspect: |
8423 | 358 switch ( iparam ) |
7541 | 359 { |
360 case 2: movie_aspect=16.0f / 9.0f; break; | |
361 case 3: movie_aspect=4.0f / 3.0f; break; | |
362 case 4: movie_aspect=2.35; break; | |
363 case 1: | |
364 default: movie_aspect=-1; | |
365 } | |
366 wsClearWindow( appMPlayer.subWindow ); | |
8039 | 367 #ifdef USE_DVDREAD |
8423 | 368 if ( guiIntfStruct.StreamType == STREAMTYPE_DVD || guiIntfStruct.StreamType == STREAMTYPE_VCD ) goto play_dvd_2; |
8039 | 369 else |
370 #endif | |
8423 | 371 guiIntfStruct.NewPlay=1; |
7541 | 372 break; |
373 | |
1693 | 374 // --- timer events |
375 case evRedraw: | |
13672 | 376 { |
377 unsigned now = GetTimerMS(); | |
378 extern int mplPBFade; | |
379 if ((now > last_redraw_time) && | |
380 (now < last_redraw_time + GUI_REDRAW_WAIT) && | |
381 !mplPBFade) | |
382 break; | |
383 last_redraw_time = now; | |
384 } | |
1693 | 385 mplMainRender=1; |
386 wsPostRedisplay( &appMPlayer.mainWindow ); | |
8973 | 387 wsPostRedisplay( &appMPlayer.barWindow ); |
1693 | 388 break; |
389 // --- system events | |
6218 | 390 #ifdef MP_DEBUG |
1693 | 391 case evNone: |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
392 mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[mw] event none received.\n" ); |
1693 | 393 break; |
394 default: | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
395 mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[mw] unknown event received ( %d,%.2f ).\n",msg,param ); |
1693 | 396 break; |
6218 | 397 #endif |
1693 | 398 } |
399 } | |
400 | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
401 #define itPLMButton (itNULL - 1) |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
402 #define itPRMButton (itNULL - 2) |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
403 |
1693 | 404 void mplMainMouseHandle( int Button,int X,int Y,int RX,int RY ) |
405 { | |
406 static int itemtype = 0; | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
407 int i; |
1693 | 408 wItem * item = NULL; |
409 float value = 0.0f; | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
410 |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
411 static int SelectedItem = -1; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
412 int currentselected = -1; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
413 |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
414 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
|
415 if ( ( appMPlayer.Items[i].pressed != btnDisabled )&& |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
416 ( 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
|
417 { currentselected=i; break; } |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
418 |
1693 | 419 switch ( Button ) |
420 { | |
6651 | 421 case wsPMMouseButton: |
6755 | 422 gtkShow( evHidePopUpMenu,NULL ); |
1693 | 423 mplShowMenu( RX,RY ); |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
424 itemtype=itPRMButton; |
1693 | 425 break; |
6651 | 426 case wsRMMouseButton: |
5919 | 427 mplHideMenu( RX,RY,0 ); |
1693 | 428 break; |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
429 |
1693 | 430 case wsPLMouseButton: |
6755 | 431 gtkShow( evHidePopUpMenu,NULL ); |
8973 | 432 sx=X; sy=Y; boxMoved=1; itemtype=itPLMButton; |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
433 SelectedItem=currentselected; |
8973 | 434 if ( SelectedItem == -1 ) break; |
435 boxMoved=0; | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
436 item=&appMPlayer.Items[SelectedItem]; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
437 itemtype=item->type; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
438 item->pressed=btnPressed; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
439 switch( item->type ) |
1693 | 440 { |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
441 case itButton: |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
442 if ( ( SelectedItem > -1 ) && |
8973 | 443 ( ( ( item->msg == evPlaySwitchToPause && item->msg == evPauseSwitchToPlay ) ) || |
444 ( ( item->msg == evPauseSwitchToPlay && item->msg == evPlaySwitchToPause ) ) ) ) | |
445 { item->pressed=btnDisabled; } | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
446 break; |
1693 | 447 } |
448 break; | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
449 case wsRLMouseButton: |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
450 boxMoved=0; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
451 item=&appMPlayer.Items[SelectedItem]; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
452 item->pressed=btnReleased; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
453 SelectedItem=-1; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
454 if ( currentselected == - 1 ) { itemtype=0; break; } |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
455 value=0; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
456 switch( itemtype ) |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
457 { |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
458 case itPotmeter: |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
459 case itHPotmeter: |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
460 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
|
461 mplEventHandling( item->msg,item->value ); |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
462 value=item->value; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
463 break; |
17254 | 464 case itVPotmeter: |
465 btnModify( item->msg, ( 1. - (float)( Y - item->y ) / item->height) * 100.0f ); | |
466 mplEventHandling( item->msg,item->value ); | |
467 value=item->value; | |
468 break; | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
469 } |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
470 mplEventHandling( item->msg,value ); |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
471 itemtype=0; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
472 break; |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
473 |
17087
4a56f15dee5f
Fix popup menu problems: GTK cannot get a grab while the button is down,
reimar
parents:
14589
diff
changeset
|
474 case wsRRMouseButton: |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
475 gtkShow( evShowPopUpMenu,NULL ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
476 break; |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
477 |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
478 // --- rolled mouse ... de szar :))) |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
479 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
|
480 case wsP4MouseButton: value= 2.5f; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
481 rollerhandled: |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
482 item=&appMPlayer.Items[currentselected]; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
483 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
|
484 { |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
485 item->value+=value; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
486 btnModify( item->msg,item->value ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4465
diff
changeset
|
487 mplEventHandling( item->msg,item->value ); |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
488 } |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
489 break; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
490 |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
491 // --- moving |
1693 | 492 case wsMoveMouse: |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
493 item=&appMPlayer.Items[SelectedItem]; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
494 switch ( itemtype ) |
1693 | 495 { |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
496 case itPLMButton: |
2854 | 497 wsMoveWindow( &appMPlayer.mainWindow,False,RX - abs( sx ),RY - abs( sy ) ); |
1693 | 498 mplMainRender=0; |
499 break; | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
500 case itPRMButton: |
1693 | 501 mplMenuMouseHandle( X,Y,RX,RY ); |
502 break; | |
503 case itPotmeter: | |
1729 | 504 item->value=(float)( X - item->x ) / item->width * 100.0f; |
1693 | 505 goto potihandled; |
8973 | 506 case itVPotmeter: |
17254 | 507 item->value=(1. - (float)( Y - item->y ) / item->height) * 100.0f; |
8973 | 508 goto potihandled; |
1693 | 509 case itHPotmeter: |
1729 | 510 item->value=(float)( X - item->x ) / item->width * 100.0f; |
1693 | 511 potihandled: |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2447
diff
changeset
|
512 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
|
513 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
|
514 mplEventHandling( item->msg,item->value ); |
1693 | 515 break; |
516 } | |
517 break; | |
518 } | |
519 } | |
520 | |
521 int keyPressed = 0; | |
522 | |
6183
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
523 void mplMainKeyHandle( int KeyCode,int Type,int Key ) |
1693 | 524 { |
525 int msg = evNone; | |
4950 | 526 |
4409 | 527 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
|
528 |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
529 if ( !Key ) |
1693 | 530 { |
6183
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
531 switch ( KeyCode ) |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
532 { |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
533 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
|
534 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
|
535 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
|
536 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
|
537 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
|
538 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
|
539 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
|
540 } |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
541 } |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
542 else |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
543 { |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
544 switch ( Key ) |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
545 { |
8302 | 546 case wsEnter: msg=evPlay; break; |
6183
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
547 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
|
548 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
|
549 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
|
550 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
|
551 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
|
552 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
|
553 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
|
554 case wsXF86Media: msg=evLoad; break; |
8973 | 555 case wsEscape: |
8302 | 556 if ( appMPlayer.subWindow.isFullScreen ) |
557 { | |
8973 | 558 if ( guiIntfStruct.event_struct ) ((XEvent *)guiIntfStruct.event_struct)->type=None; |
8302 | 559 mplEventHandling( evNormalSize,0 ); |
8973 | 560 return; |
8302 | 561 } |
6183
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
562 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
|
563 } |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
564 } |
4858 | 565 if ( msg != evNone ) mplEventHandling( msg,0 ); |
1693 | 566 } |
6967
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
567 |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
568 /* 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
|
569 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
|
570 { |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
571 struct stat buf; |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
572 int f = 0; |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
573 |
8481 | 574 char* subtitles = NULL; |
575 char* filename = NULL; | |
576 | |
6967
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
577 if (num <= 0) |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
578 return; |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
579 |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
580 |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
581 /* 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
|
582 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
|
583 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
|
584 plItem* item; |
6977
7242f1840f8d
kde3 dnd fix from Gregory Kovriga and file name handling fix in dnd callback
pontscho
parents:
6967
diff
changeset
|
585 |
6996 | 586 #ifdef USE_ICONV |
6977
7242f1840f8d
kde3 dnd fix from Gregory Kovriga and file name handling fix in dnd callback
pontscho
parents:
6967
diff
changeset
|
587 if ( strchr( str,'%' ) ) |
7242f1840f8d
kde3 dnd fix from Gregory Kovriga and file name handling fix in dnd callback
pontscho
parents:
6967
diff
changeset
|
588 { |
6996 | 589 char * tmp=gconvert_uri_to_filename( str ); |
590 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
|
591 } |
6996 | 592 #endif |
6977
7242f1840f8d
kde3 dnd fix from Gregory Kovriga and file name handling fix in dnd callback
pontscho
parents:
6967
diff
changeset
|
593 |
6967
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
594 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
|
595 /* this is not a directory so try to play it */ |
14156 | 596 mp_msg( MSGT_GPLAYER,MSGL_V,"Received D&D %s\n",str ); |
8481 | 597 |
598 /* check if it is a subtitle file */ | |
599 { | |
600 char* ext = strrchr(str,'.'); | |
601 if (ext) { | |
602 static char supported[] = "utf/sub/srt/smi/rt//txt/ssa/aqt/"; | |
603 char* type; | |
604 int len; | |
605 if((len=strlen(++ext)) && (type=strstr(supported,ext)) &&\ | |
606 (type-supported)%4 == 0 && *(type+len) == '/'){ | |
607 /* handle subtitle file */ | |
608 gfree((void**)&subtitles); | |
609 subtitles = str; | |
610 continue; | |
611 } | |
612 } | |
613 } | |
614 | |
615 /* clear playlist */ | |
616 if (filename == NULL) { | |
617 filename = files[f]; | |
618 gtkSet(gtkDelPl,0,NULL); | |
619 } | |
620 | |
6967
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
621 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
|
622 |
6967
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
623 /* 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
|
624 /* yes -- Pontscho */ |
8481 | 625 if ( strrchr( str,'/' ) ) { |
6977
7242f1840f8d
kde3 dnd fix from Gregory Kovriga and file name handling fix in dnd callback
pontscho
parents:
6967
diff
changeset
|
626 char * s = strrchr( str,'/' ); *s=0; s++; |
8481 | 627 item->name = gstrdup( s ); |
628 item->path = gstrdup( str ); | |
629 } else { | |
630 item->name = strdup(str); | |
631 item->path = strdup(""); | |
632 } | |
6967
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
633 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
|
634 } else { |
14156 | 635 mp_msg( MSGT_GPLAYER,MSGL_WARN,MSGTR_NotAFile,str ); |
6967
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
636 } |
6977
7242f1840f8d
kde3 dnd fix from Gregory Kovriga and file name handling fix in dnd callback
pontscho
parents:
6967
diff
changeset
|
637 free( str ); |
6967
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
638 } |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
639 |
8481 | 640 if (filename) { |
641 mplSetFileName( NULL,filename,STREAMTYPE_FILE ); | |
642 if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evStop,0 ); | |
643 mplEventHandling( evPlay,0 ); | |
644 } | |
645 if (subtitles) { | |
646 gfree((void**)&guiIntfStruct.Subtitlename); | |
647 guiIntfStruct.Subtitlename = subtitles; | |
648 guiLoadSubtitle(guiIntfStruct.Subtitlename); | |
649 } | |
6967
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6905
diff
changeset
|
650 } |