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