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