Remove unused variable.
[mplayer/greg.git] / gui / interface.c
blob4a2103ec8475ed2f138e673812f8274bfbb60e8a
1 /*
2 * This file is part of MPlayer.
4 * MPlayer is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * MPlayer is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #include <inttypes.h>
20 #include <stdlib.h>
21 #include <stdio.h>
22 #include <string.h>
23 #include <sys/types.h>
25 #include "wm/ws.h"
26 #include "wm/wsxdnd.h"
27 #include "interface.h"
28 #include "skin/skin.h"
30 #include "mplayer/gtk/eq.h"
31 #include "mplayer/widgets.h"
32 #include "mplayer/gmplayer.h"
33 #include "mplayer/play.h"
35 #include "access_mpcontext.h"
36 #include "app.h"
37 #include "cfg.h"
38 #include "help_mp.h"
39 #include "get_path.h"
40 #include "libvo/x11_common.h"
41 #include "libvo/video_out.h"
42 #include "libvo/font_load.h"
43 #include "libvo/sub.h"
44 #include "input/input.h"
45 #include "libao2/audio_out.h"
46 #include "mixer.h"
47 #include "libaf/af.h"
48 #include "libaf/equalizer.h"
49 #include "libass/ass.h"
50 #include "libass/ass_mp.h"
52 extern af_cfg_t af_cfg;
54 #ifdef CONFIG_ICONV
55 #include <iconv.h>
56 #endif
58 #include "stream/stream.h"
59 #include "libmpdemux/demuxer.h"
60 #include "libmpdemux/stheader.h"
61 #include "libmpcodecs/dec_video.h"
63 #ifdef CONFIG_DVDREAD
64 #include "stream/stream_dvd.h"
65 #endif
67 int vcd_seek_to_track(void *vcd, int track);
69 #include "m_config.h"
70 #include "m_option.h"
73 guiInterface_t guiIntfStruct;
74 int guiWinID=-1;
76 char * gstrcat( char ** dest,const char * src )
78 char * tmp = NULL;
80 if ( !src ) return NULL;
82 if ( *dest )
84 tmp=malloc( strlen( *dest ) + strlen( src ) + 1 );
86 if ( tmp ) /* TODO: advanced error handling */
88 strcpy( tmp,*dest ); strcat( tmp,src ); free( *dest );
91 else
92 { tmp=malloc( strlen( src ) + 1 ); strcpy( tmp,src ); }
93 *dest=tmp;
94 return tmp;
97 int gstrcmp( const char * a,const char * b )
99 if ( !a && !b ) return 0;
100 if ( !a || !b ) return -1;
101 return strcmp( a,b );
104 int gstrncmp( const char * a,const char * b,int size )
106 if ( !a && !b ) return 0;
107 if ( !a || !b ) return -1;
108 return strncmp( a,b,size );
111 char * gstrdup( const char * str )
113 if ( !str ) return NULL;
114 return strdup( str );
117 char * gstrchr( char * str,int c )
119 if ( !str ) return NULL;
120 return strchr( str,c );
123 void gfree( void ** p )
125 if ( *p == NULL ) return;
126 free( *p ); *p=NULL;
129 void gset( char ** str, const char * what )
131 if ( *str ) { if ( !strstr( *str,what ) ) { gstrcat( str,"," ); gstrcat( str,what ); }}
132 else gstrcat( str,what );
136 * \brief this actually creates a new list containing only one element...
138 void gaddlist( char *** list,const char * entry )
140 int i;
142 if ( (*list) )
144 for ( i=0;(*list)[i];i++ ) free( (*list)[i] );
145 free( (*list) );
148 (*list)=malloc( 2 * sizeof(char **) );
149 (*list)[0]=gstrdup( entry );
150 (*list)[1]=NULL;
154 * \brief this replaces a string starting with search by replace.
155 * If not found, replace is appended.
157 void greplace(char ***list, const char *search, const char *replace)
159 int i = 0;
160 int len = (search) ? strlen(search) : 0;
162 if (*list) {
163 for (i = 0; (*list)[i]; i++) {
164 if (search && (strncmp((*list)[i], search, len) == 0)) {
165 free((*list)[i]);
166 (*list)[i] = gstrdup(replace);
167 return;
170 *list = realloc(*list, (i + 2) * sizeof(char *));
172 else
173 *list = malloc(2 * sizeof(char *));
175 (*list)[i] = gstrdup(replace);
176 (*list)[i + 1] = NULL;
179 void guiInit( void )
181 int i;
183 memset( &guiIntfStruct,0,sizeof( guiIntfStruct ) );
184 guiIntfStruct.Balance=50.0f;
185 guiIntfStruct.StreamType=-1;
187 memset( &gtkEquChannels,0,sizeof( gtkEquChannels ) );
188 #ifdef CONFIG_DXR3
189 if ( !gtkDXR3Device ) gtkDXR3Device=strdup( "/dev/em8300-0" );
190 #endif
191 if ( stream_cache_size > 0 ) { gtkCacheOn=1; gtkCacheSize=stream_cache_size; }
192 else if ( stream_cache_size == 0 ) gtkCacheOn = 0;
193 if ( autosync && autosync != gtkAutoSync ) { gtkAutoSyncOn=1; gtkAutoSync=autosync; }
195 #ifdef CONFIG_ASS
196 gtkASS.enabled = ass_enabled;
197 gtkASS.use_margins = ass_use_margins;
198 gtkASS.top_margin = ass_top_margin;
199 gtkASS.bottom_margin = ass_bottom_margin;
200 #endif
202 gtkInit();
203 // --- initialize X
204 wsXInit( (void *)mDisplay );
205 // --- load skin
206 skinDirInHome=get_path("skins");
207 skinDirInHome_obsolete=get_path("Skin");
208 skinMPlayerDir=MPLAYER_DATADIR "/skins";
209 skinMPlayerDir_obsolete=MPLAYER_DATADIR "/Skin";
210 mp_msg( MSGT_GPLAYER,MSGL_V,"SKIN dir 1: '%s'\n",skinDirInHome);
211 mp_msg( MSGT_GPLAYER,MSGL_V,"SKIN dir 1 (obsolete): '%s'\n",skinDirInHome_obsolete);
212 mp_msg( MSGT_GPLAYER,MSGL_V,"SKIN dir 2: '%s'\n",skinMPlayerDir);
213 mp_msg( MSGT_GPLAYER,MSGL_V,"SKIN dir 2 (obsolete): '%s'\n",skinMPlayerDir_obsolete);
214 if ( !skinName ) skinName=strdup( "default" );
215 i = skinRead( skinName );
216 if ((i == -1) && strcmp(skinName,"default"))
218 mp_msg( MSGT_GPLAYER,MSGL_WARN,MSGTR_SKIN_SKINCFG_SelectedSkinNotFound, skinName);
219 skinName=strdup( "default" );
220 i = skinRead( skinName );
222 switch (i) {
223 case -1: mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_SKIN_SKINCFG_SkinNotFound,skinName ); exit( 0 );
224 case -2: mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_SKIN_SKINCFG_SkinCfgReadError,skinName ); exit( 0 );
226 // --- initialize windows
227 if ( ( mplDrawBuffer = malloc( appMPlayer.main.Bitmap.ImageSize ) ) == NULL )
229 fprintf( stderr,MSGTR_NEMDB );
230 exit( 0 );
233 if ( gui_save_pos )
235 appMPlayer.main.x = gui_main_pos_x;
236 appMPlayer.main.y = gui_main_pos_y;
237 appMPlayer.sub.x = gui_sub_pos_x;
238 appMPlayer.sub.y = gui_sub_pos_y;
241 if (WinID>0)
243 appMPlayer.subWindow.Parent=WinID;
244 appMPlayer.sub.x=0;
245 appMPlayer.sub.y=0;
247 if (guiWinID>=0) appMPlayer.mainWindow.Parent=guiWinID;
249 wsCreateWindow( &appMPlayer.subWindow,
250 appMPlayer.sub.x,appMPlayer.sub.y,appMPlayer.sub.width,appMPlayer.sub.height,
251 wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsShowFrame|wsHideWindow,"MPlayer - Video" );
253 wsDestroyImage( &appMPlayer.subWindow );
254 wsCreateImage( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Width,appMPlayer.sub.Bitmap.Height );
255 wsXDNDMakeAwareness(&appMPlayer.subWindow);
257 mplMenuInit();
258 mplPBInit();
260 vo_setwindow( appMPlayer.subWindow.WindowID, appMPlayer.subWindow.wGC );
262 // i=wsHideFrame|wsMaxSize|wsHideWindow;
263 // if ( appMPlayer.mainDecoration ) i=wsShowFrame|wsMaxSize|wsHideWindow;
264 i=wsShowFrame|wsMaxSize|wsHideWindow;
265 wsCreateWindow( &appMPlayer.mainWindow,
266 appMPlayer.main.x,appMPlayer.main.y,appMPlayer.main.width,appMPlayer.main.height,
267 wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,i,"MPlayer" );
269 wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image );
270 wsXDNDMakeAwareness(&appMPlayer.mainWindow);
272 #ifdef DEBUG
273 mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] depth on screen: %d\n",wsDepthOnScreen );
274 mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] parent: 0x%x\n",(int)appMPlayer.mainWindow.WindowID );
275 mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] sub: 0x%x\n",(int)appMPlayer.subWindow.WindowID );
276 #endif
278 appMPlayer.mainWindow.ReDraw=(void *)mplMainDraw;
279 appMPlayer.mainWindow.MouseHandler=mplMainMouseHandle;
280 appMPlayer.mainWindow.KeyHandler=mplMainKeyHandle;
281 appMPlayer.mainWindow.DandDHandler=mplDandDHandler;
283 appMPlayer.subWindow.ReDraw=(void *)mplSubDraw;
284 appMPlayer.subWindow.MouseHandler=mplSubMouseHandle;
285 appMPlayer.subWindow.KeyHandler=mplMainKeyHandle;
286 appMPlayer.subWindow.DandDHandler=mplDandDHandler;
288 wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.sub.R,appMPlayer.sub.G,appMPlayer.sub.B );
289 wsClearWindow( appMPlayer.subWindow );
290 if ( appMPlayer.sub.Bitmap.Image ) wsConvert( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Image,appMPlayer.sub.Bitmap.ImageSize );
292 btnModify( evSetVolume,guiIntfStruct.Volume );
293 btnModify( evSetBalance,guiIntfStruct.Balance );
294 btnModify( evSetMoviePosition,guiIntfStruct.Position );
296 wsSetIcon( wsDisplay,appMPlayer.mainWindow.WindowID,guiIcon,guiIconMask );
297 wsSetIcon( wsDisplay,appMPlayer.subWindow.WindowID,guiIcon,guiIconMask );
299 guiIntfStruct.Playing=0;
301 if ( !appMPlayer.mainDecoration ) wsWindowDecoration( &appMPlayer.mainWindow,0 );
303 wsVisibleWindow( &appMPlayer.mainWindow,wsShowWindow );
304 #if 0
305 wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow );
308 XEvent xev;
309 do { XNextEvent( wsDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != appMPlayer.subWindow.WindowID );
310 appMPlayer.subWindow.Mapped=wsMapped;
313 if ( !fullscreen ) fullscreen=gtkLoadFullscreen;
314 if ( fullscreen )
316 mplFullScreen();
317 btnModify( evFullScreen,btnPressed );
319 #else
320 if ( !fullscreen ) fullscreen=gtkLoadFullscreen;
321 if ( gtkShowVideoWindow )
323 wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow );
325 XEvent xev;
326 do { XNextEvent( wsDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != appMPlayer.subWindow.WindowID );
327 appMPlayer.subWindow.Mapped=wsMapped;
330 if ( fullscreen )
332 mplFullScreen();
333 btnModify( evFullScreen,btnPressed );
336 else
338 if ( fullscreen )
340 wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow );
342 XEvent xev;
343 do { XNextEvent( wsDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != appMPlayer.subWindow.WindowID );
344 appMPlayer.subWindow.Mapped=wsMapped;
346 wsVisibleWindow( &appMPlayer.subWindow, wsShowWindow );
348 mplFullScreen();
349 btnModify( evFullScreen,btnPressed );
352 #endif
353 mplSubRender=1;
354 // ---
356 if ( filename ) mplSetFileName( NULL,filename,STREAMTYPE_FILE );
357 if ( plCurrent && !filename ) mplSetFileName( plCurrent->path,plCurrent->name,STREAMTYPE_FILE );
358 if ( subdata ) guiSetFilename( guiIntfStruct.Subtitlename, subdata->filename );
359 guiLoadFont();
362 void guiDone( void )
364 mplMainRender=0;
365 mp_msg( MSGT_GPLAYER,MSGL_V,"[GUI] done.\n" );
367 if ( gui_save_pos )
369 gui_main_pos_x=appMPlayer.mainWindow.X; gui_main_pos_y=appMPlayer.mainWindow.Y;
370 gui_sub_pos_x=appMPlayer.subWindow.X; gui_sub_pos_y=appMPlayer.subWindow.Y;
373 #ifdef CONFIG_ASS
374 ass_enabled = gtkASS.enabled;
375 ass_use_margins = gtkASS.use_margins;
376 ass_top_margin = gtkASS.top_margin;
377 ass_bottom_margin = gtkASS.bottom_margin;
378 #endif
380 cfg_write();
381 wsXDone();
384 int guiCMDArray[] =
386 evLoadPlay,
387 evLoadSubtitle,
388 evAbout,
389 evPlay,
390 evStop,
391 evPlayList,
392 evPreferences,
393 evFullScreen,
394 evSkinBrowser
397 extern int stream_dump_type;
398 extern int vcd_track;
399 extern m_obj_settings_t * vf_settings;
401 void guiLoadFont( void )
403 #ifdef CONFIG_FREETYPE
404 load_font_ft(vo_image_width, vo_image_height, &vo_font, font_name, osd_font_scale_factor);
405 #else
406 if ( vo_font )
408 int i;
409 if ( vo_font->name ) free( vo_font->name );
410 if ( vo_font->fpath ) free( vo_font->fpath );
411 for ( i=0;i<16;i++ )
412 if ( vo_font->pic_a[i] )
414 if ( vo_font->pic_a[i]->bmp ) free( vo_font->pic_a[i]->bmp );
415 if ( vo_font->pic_a[i]->pal ) free( vo_font->pic_a[i]->pal );
417 for ( i=0;i<16;i++ )
418 if ( vo_font->pic_b[i] )
420 if ( vo_font->pic_b[i]->bmp ) free( vo_font->pic_b[i]->bmp );
421 if ( vo_font->pic_b[i]->pal ) free( vo_font->pic_b[i]->pal );
423 free( vo_font ); vo_font=NULL;
425 if ( font_name )
427 vo_font=read_font_desc( font_name,font_factor,0 );
428 if ( !vo_font ) mp_msg( MSGT_CPLAYER,MSGL_ERR,MSGTR_CantLoadFont,font_name );
430 else
432 font_name=gstrdup( get_path( "font/font.desc" ) );
433 vo_font=read_font_desc( font_name,font_factor,0 );
434 if ( !vo_font )
436 gfree( (void **)&font_name ); font_name=gstrdup(MPLAYER_DATADIR "/font/font.desc" );
437 vo_font=read_font_desc( font_name,font_factor,0 );
440 #endif
443 extern mp_osd_obj_t* vo_osd_list;
445 extern char **sub_name;
447 void guiLoadSubtitle( char * name )
449 if ( guiIntfStruct.Playing == 0 )
451 guiIntfStruct.SubtitleChanged=1; //what is this for? (mw)
452 return;
454 if ( subdata )
456 mp_msg( MSGT_GPLAYER,MSGL_INFO,MSGTR_DeletingSubtitles );
457 sub_free( subdata );
458 subdata=NULL;
459 vo_sub=NULL;
460 if ( vo_osd_list )
462 int len;
463 mp_osd_obj_t * osd = vo_osd_list;
464 while ( osd )
466 if ( osd->type == OSDTYPE_SUBTITLE ) break;
467 osd=osd->next;
469 if ( osd && osd->flags&OSDFLAG_VISIBLE )
471 len=osd->stride * ( osd->bbox.y2 - osd->bbox.y1 );
472 memset( osd->bitmap_buffer,0,len );
473 memset( osd->alpha_buffer,0,len );
477 if ( name )
479 mp_msg( MSGT_GPLAYER,MSGL_INFO,MSGTR_LoadingSubtitles,name );
480 subdata=sub_read_file( name, guiIntfStruct.FPS );
481 if ( !subdata ) mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_CantLoadSub,name );
482 sub_name = (malloc(2 * sizeof(char*))); //when mplayer will be restarted
483 sub_name[0] = strdup(name); //sub_name[0] will be read
484 sub_name[1] = NULL;
486 update_set_of_subtitles();
490 static void add_vf( char * str )
492 mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_AddingVideoFilter,str );
493 if ( vf_settings )
495 int i = 0;
496 while ( vf_settings[i].name ) if ( !gstrcmp( vf_settings[i++].name,str ) ) { i=-1; break; }
497 if ( i != -1 )
498 { vf_settings=realloc( vf_settings,( i + 2 ) * sizeof( m_obj_settings_t ) ); vf_settings[i].name=strdup( str );vf_settings[i].attribs = NULL; vf_settings[i+1].name=NULL; }
499 } else { vf_settings=malloc( 2 * sizeof( m_obj_settings_t ) ); vf_settings[0].name=strdup( str );vf_settings[0].attribs = NULL; vf_settings[1].name=NULL; }
502 static void remove_vf( char * str )
504 int n = 0;
506 if ( !vf_settings ) return;
508 mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_RemovingVideoFilter,str );
510 while ( vf_settings[n++].name ); n--;
511 if ( n > -1 )
513 int i = 0,m = -1;
514 while ( vf_settings[i].name ) if ( !gstrcmp( vf_settings[i++].name,str ) ) { m=i - 1; break; }
515 i--;
516 if ( m > -1 )
518 if ( n == 1 ) { free( vf_settings[0].name );free( vf_settings[0].attribs ); free( vf_settings ); vf_settings=NULL; }
519 else { free( vf_settings[i].name );free( vf_settings[i].attribs ); memcpy( &vf_settings[i],&vf_settings[i + 1],( n - i ) * sizeof( m_obj_settings_t ) ); }
524 int guiGetEvent( int type,char * arg )
526 const ao_functions_t *audio_out = NULL;
527 const vo_functions_t *video_out = NULL;
528 mixer_t *mixer = NULL;
530 stream_t * stream = (stream_t *) arg;
531 #ifdef CONFIG_DVDREAD
532 dvd_priv_t * dvdp = (dvd_priv_t *) arg;
533 #endif
535 if (guiIntfStruct.mpcontext) {
536 audio_out = mpctx_get_audio_out(guiIntfStruct.mpcontext);
537 video_out = mpctx_get_video_out(guiIntfStruct.mpcontext);
538 mixer = mpctx_get_mixer(guiIntfStruct.mpcontext);
541 switch ( type )
543 case guiXEvent:
544 guiIntfStruct.event_struct=(void *)arg;
545 wsEvents( wsDisplay,(XEvent *)arg,NULL );
546 gtkEventHandling();
547 break;
548 case guiCEvent:
549 switch ( (int)arg )
551 case guiSetPlay:
552 guiIntfStruct.Playing=1;
553 // if ( !gtkShowVideoWindow ) wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow );
554 break;
555 case guiSetStop:
556 guiIntfStruct.Playing=0;
557 // if ( !gtkShowVideoWindow ) wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow );
558 break;
559 case guiSetPause: guiIntfStruct.Playing=2; break;
561 mplState();
562 break;
563 case guiSetState:
564 mplState();
565 break;
566 case guiSetFileName:
567 if ( arg ) guiSetFilename( guiIntfStruct.Filename,arg );
568 break;
569 case guiSetAudioOnly:
570 guiIntfStruct.AudioOnly=(int)arg;
571 if ( (int)arg ) { guiIntfStruct.NoWindow=True; wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); }
572 else wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow );
573 break;
574 case guiSetContext:
575 guiIntfStruct.mpcontext=(void *)arg;
576 case guiSetDemuxer:
577 guiIntfStruct.demuxer=(void *)arg;
578 break;
579 case guiSetAfilter:
580 guiIntfStruct.afilter=(void *)arg;
581 break;
582 case guiSetShVideo:
584 if ( !appMPlayer.subWindow.isFullScreen )
586 wsResizeWindow( &appMPlayer.subWindow,vo_dwidth,vo_dheight );
587 wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y );
589 guiIntfStruct.MovieWidth=vo_dwidth;
590 guiIntfStruct.MovieHeight=vo_dheight;
591 if (guiWinID>=0)
592 wsMoveWindow( &appMPlayer.mainWindow,0,0, vo_dheight);
594 break;
595 #ifdef CONFIG_DVDREAD
596 case guiSetDVD:
597 guiIntfStruct.DVD.titles=dvdp->vmg_file->tt_srpt->nr_of_srpts;
598 guiIntfStruct.DVD.chapters=dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_ptts;
599 guiIntfStruct.DVD.angles=dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_angles;
600 guiIntfStruct.DVD.nr_of_audio_channels=dvdp->nr_of_channels;
601 memcpy( guiIntfStruct.DVD.audio_streams,dvdp->audio_streams,sizeof( dvdp->audio_streams ) );
602 guiIntfStruct.DVD.nr_of_subtitles=dvdp->nr_of_subtitles;
603 memcpy( guiIntfStruct.DVD.subtitles,dvdp->subtitles,sizeof( dvdp->subtitles ) );
604 guiIntfStruct.DVD.current_title=dvd_title + 1;
605 guiIntfStruct.DVD.current_chapter=dvd_chapter + 1;
606 guiIntfStruct.DVD.current_angle=dvd_angle + 1;
607 guiIntfStruct.Track=dvd_title + 1;
608 break;
609 #endif
610 case guiSetStream:
611 guiIntfStruct.StreamType=stream->type;
612 switch( stream->type )
614 #ifdef CONFIG_DVDREAD
615 case STREAMTYPE_DVD:
616 guiGetEvent( guiSetDVD,(char *)stream->priv );
617 break;
618 #endif
619 #ifdef CONFIG_VCD
620 case STREAMTYPE_VCD:
622 int i;
624 if (!stream->priv)
626 guiIntfStruct.VCDTracks=0;
627 break;
629 for ( i=1;i < 100;i++ )
630 if ( vcd_seek_to_track( stream->priv,i ) < 0 ) break;
631 vcd_seek_to_track( stream->priv,vcd_track );
632 guiIntfStruct.VCDTracks=--i;
633 break;
635 #endif
636 default: break;
638 break;
639 case guiIEvent:
640 mp_msg( MSGT_GPLAYER,MSGL_V,"cmd: %d\n",(int)arg );
641 switch( (int)arg )
643 case MP_CMD_QUIT:
644 mplEventHandling( evExit,0 );
645 break;
646 case MP_CMD_VO_FULLSCREEN:
647 mplEventHandling( evFullScreen,0 );
648 break;
649 default:
650 mplEventHandling( guiCMDArray[ (int)arg - MP_CMD_GUI_EVENTS - 1 ],0 );
652 break;
653 case guiReDraw:
654 mplEventHandling( evRedraw,0 );
655 break;
656 case guiSetVolume:
657 if ( audio_out )
659 float l,r;
660 mixer_getvolume( mixer,&l,&r );
661 guiIntfStruct.Volume=(r>l?r:l);
662 if ( r != l ) guiIntfStruct.Balance=( ( r - l ) + 100 ) * 0.5f;
663 else guiIntfStruct.Balance=50.0f;
664 btnModify( evSetVolume,guiIntfStruct.Volume );
665 btnModify( evSetBalance,guiIntfStruct.Balance );
667 break;
668 case guiSetFileFormat:
669 guiIntfStruct.FileFormat=(int)arg;
670 break;
671 case guiSetValues:
672 // -- video
673 guiIntfStruct.sh_video=arg;
674 if ( arg )
676 sh_video_t * sh = (sh_video_t *)arg;
677 guiIntfStruct.FPS=sh->fps;
680 if ( guiIntfStruct.NoWindow ) wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow );
682 if ( guiIntfStruct.StreamType == STREAMTYPE_STREAM ) btnSet( evSetMoviePosition,btnDisabled );
683 else btnSet( evSetMoviePosition,btnReleased );
685 // -- audio
686 if ( audio_out )
688 float l,r;
689 mixer_getvolume( mixer,&l,&r );
690 guiIntfStruct.Volume=(r>l?r:l);
691 if ( r != l ) guiIntfStruct.Balance=( ( r - l ) + 100 ) * 0.5f;
692 else guiIntfStruct.Balance=50.0f;
693 btnModify( evSetVolume,guiIntfStruct.Volume );
694 btnModify( evSetBalance,guiIntfStruct.Balance );
697 if ( gtkEnableAudioEqualizer )
699 equalizer_t eq;
700 int i,j;
701 for ( i=0;i<6;i++ )
702 for ( j=0;j<10;j++ )
704 eq.channel=i; eq.band=j; eq.gain=gtkEquChannels[i][j];
705 gtkSet( gtkSetEqualizer,0,&eq );
708 // -- subtitle
709 #ifdef CONFIG_DXR3
710 if ( video_driver_list && !gstrcmp( video_driver_list[0],"dxr3" ) && guiIntfStruct.FileFormat != DEMUXER_TYPE_MPEG_PS
711 #ifdef CONFIG_LIBAVCODEC
712 && !gtkVfLAVC
713 #endif
716 gtkMessageBox( GTK_MB_FATAL,MSGTR_NEEDLAVC );
717 guiIntfStruct.Playing=0;
718 return True;
720 #endif
721 break;
722 case guiSetDefaults:
723 // if ( guiIntfStruct.Playing == 1 && guiIntfStruct.FilenameChanged )
724 if ( guiIntfStruct.FilenameChanged )
726 audio_id=-1;
727 video_id=-1;
728 dvdsub_id=-1;
729 vobsub_id=-1;
730 stream_cache_size=-1;
731 autosync=0;
732 vcd_track=0;
733 dvd_title=0;
734 force_fps=0;
736 guiIntfStruct.demuxer=NULL;
737 guiIntfStruct.sh_video=NULL;
738 wsPostRedisplay( &appMPlayer.subWindow );
739 break;
740 case guiSetParameters:
741 guiGetEvent( guiSetDefaults,NULL );
742 switch ( guiIntfStruct.StreamType )
744 case STREAMTYPE_PLAYLIST:
745 break;
746 #ifdef CONFIG_VCD
747 case STREAMTYPE_VCD:
749 char tmp[512];
750 sprintf( tmp,"vcd://%d",guiIntfStruct.Track + 1 );
751 guiSetFilename( guiIntfStruct.Filename,tmp );
753 break;
754 #endif
755 #ifdef CONFIG_DVDREAD
756 case STREAMTYPE_DVD:
758 char tmp[512];
759 sprintf( tmp,"dvd://%d",guiIntfStruct.Title );
760 guiSetFilename( guiIntfStruct.Filename,tmp );
762 dvd_chapter=guiIntfStruct.Chapter;
763 dvd_angle=guiIntfStruct.Angle;
764 break;
765 #endif
767 //if ( guiIntfStruct.StreamType != STREAMTYPE_PLAYLIST ) // Does not make problems anymore!
769 if ( guiIntfStruct.Filename ) filename=gstrdup( guiIntfStruct.Filename );
770 else if ( filename ) guiSetFilename( guiIntfStruct.Filename,filename );
772 // --- video opts
774 if ( !video_driver_list )
776 int i = 0;
777 while ( video_out_drivers[i++] )
778 if ( video_out_drivers[i - 1]->control( VOCTRL_GUISUPPORT,NULL ) == VO_TRUE )
780 gaddlist( &video_driver_list,(char *)video_out_drivers[i - 1]->info->short_name );
781 break;
785 if ( !video_driver_list && !video_driver_list[0] ) { gtkMessageBox( GTK_MB_FATAL,MSGTR_IDFGCVD ); exit_player( "gui init" ); }
788 int i = 0;
789 guiIntfStruct.NoWindow=False;
790 while ( video_out_drivers[i++] )
791 if ( video_out_drivers[i - 1]->control( VOCTRL_GUISUPPORT,NULL ) == VO_TRUE )
793 if ( ( video_driver_list && !gstrcmp( video_driver_list[0],(char *)video_out_drivers[i - 1]->info->short_name ) )&&( video_out_drivers[i - 1]->control( VOCTRL_GUI_NOWINDOW,NULL ) == VO_TRUE ) )
794 { guiIntfStruct.NoWindow=True; break; }
798 #ifdef CONFIG_DXR3
799 #ifdef CONFIG_LIBAVCODEC
800 remove_vf( "lavc" );
801 #endif
802 if ( video_driver_list && !gstrcmp( video_driver_list[0],"dxr3" ) )
804 if ( ( guiIntfStruct.StreamType != STREAMTYPE_DVD)&&( guiIntfStruct.StreamType != STREAMTYPE_VCD ) )
806 #ifdef CONFIG_LIBAVCODEC
807 if ( gtkVfLAVC ) add_vf( "lavc" );
808 #endif
811 #endif
812 // ---
813 if ( gtkVfPP ) add_vf( "pp" );
814 else remove_vf( "pp" );
816 // --- audio opts
817 // if ( ao_plugin_cfg.plugin_list ) { free( ao_plugin_cfg.plugin_list ); ao_plugin_cfg.plugin_list=NULL; }
818 if (gtkAONorm)
819 greplace(&af_cfg.list, "volnorm", "volnorm");
820 if (gtkEnableAudioEqualizer)
821 greplace(&af_cfg.list, "equalizer", "equalizer");
822 if ( gtkAOExtraStereo )
824 char *name = malloc(12 + 20 + 1);
825 snprintf(name, 12 + 20, "extrastereo=%f", gtkAOExtraStereoMul);
826 name[12 + 20] = 0;
827 greplace(&af_cfg.list, "extrastereo", name);
828 free(name);
830 #ifdef CONFIG_OSS_AUDIO
831 if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"oss",3 ) )
833 char *tmp;
834 mixer_device = gtkAOOSSMixer;
835 mixer_channel = gtkAOOSSMixerChannel;
836 if (gtkAOOSSDevice) {
837 tmp = calloc( 1,strlen( gtkAOOSSDevice ) + 7 );
838 sprintf( tmp,"oss:%s",gtkAOOSSDevice );
839 } else
840 tmp = strdup("oss");
841 gaddlist( &audio_driver_list,tmp );
842 free(tmp);
844 #endif
845 #ifdef CONFIG_ALSA
846 if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"alsa",4 ) )
848 char *tmp;
849 mixer_device = gtkAOALSAMixer;
850 mixer_channel = gtkAOALSAMixerChannel;
851 if (gtkAOALSADevice) {
852 tmp = calloc( 1,strlen( gtkAOALSADevice ) + 14 );
853 sprintf( tmp,"alsa:device=%s",gtkAOALSADevice );
854 } else
855 tmp = strdup("alsa");
856 gaddlist( &audio_driver_list,tmp );
857 free(tmp);
859 #endif
860 #ifdef CONFIG_SDL
861 if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"sdl",3 ) )
863 char *tmp;
864 if (gtkAOSDLDriver) {
865 tmp = calloc( 1,strlen( gtkAOSDLDriver ) + 10 );
866 sprintf( tmp,"sdl:%s",gtkAOSDLDriver );
867 } else
868 tmp = strdup("sdl");
869 gaddlist( &audio_driver_list,tmp );
870 free(tmp);
872 #endif
873 #ifdef CONFIG_ESD
874 if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"esd",3 ) )
876 char *tmp;
877 if (gtkAOESDDevice) {
878 tmp = calloc( 1,strlen( gtkAOESDDevice ) + 10 );
879 sprintf( tmp,"esd:%s",gtkAOESDDevice );
880 } else
881 tmp = strdup("esd");
882 gaddlist( &audio_driver_list,tmp );
883 free(tmp);
885 #endif
886 // -- subtitle
887 //subdata->filename=gstrdup( guiIntfStruct.Subtitlename );
888 stream_dump_type=0;
889 if ( gtkSubDumpMPSub ) stream_dump_type=4;
890 if ( gtkSubDumpSrt ) stream_dump_type=6;
891 gtkSubDumpMPSub=gtkSubDumpSrt=0;
892 guiLoadFont();
894 // --- misc
895 if ( gtkCacheOn ) stream_cache_size=gtkCacheSize;
896 if ( gtkAutoSyncOn ) autosync=gtkAutoSync;
898 if ( guiIntfStruct.AudioFile ) audio_stream=gstrdup( guiIntfStruct.AudioFile );
899 else if ( guiIntfStruct.FilenameChanged ) gfree( (void**)&audio_stream );
900 //audio_stream=NULL;
902 guiIntfStruct.DiskChanged=0;
903 guiIntfStruct.FilenameChanged=0;
904 guiIntfStruct.NewPlay=0;
906 #ifdef CONFIG_ASS
907 ass_enabled = gtkASS.enabled;
908 ass_use_margins = gtkASS.use_margins;
909 ass_top_margin = gtkASS.top_margin;
910 ass_bottom_margin = gtkASS.bottom_margin;
911 #endif
913 break;
915 return False;
918 void guiEventHandling( void )
920 if ( !guiIntfStruct.Playing || guiIntfStruct.NoWindow ) wsHandleEvents();
921 gtkEventHandling();
924 // ---
926 float gtkEquChannels[6][10];
928 plItem * plCurrent = NULL;
929 plItem * plList = NULL;
930 plItem * plLastPlayed = NULL;
932 URLItem *URLList = NULL;
934 char *fsHistory[fsPersistant_MaxPos] = { NULL,NULL,NULL,NULL,NULL };
936 #if defined( MP_DEBUG ) && 0
937 void list( void )
939 plItem * next = plList;
940 printf( "--- list ---\n" );
941 while( next || next->next )
943 printf( "item: %s/%s\n",next->path,next->name );
944 if ( next->next ) next=next->next; else break;
946 printf( "--- end of list ---\n" );
948 #else
949 #define list();
950 #endif
952 void * gtkSet( int cmd,float fparam, void * vparam )
954 equalizer_t * eq = (equalizer_t *)vparam;
955 plItem * item = (plItem *)vparam;
957 URLItem * url_item = (URLItem *)vparam;
958 int is_added = True;
960 switch ( cmd )
962 // --- handle playlist
963 case gtkAddPlItem: // add item to playlist
964 if ( plList )
966 plItem * next = plList;
967 while ( next->next ) { /*printf( "%s\n",next->name );*/ next=next->next; }
968 next->next=item; item->prev=next;
969 } else { item->prev=item->next=NULL; plCurrent=plList=item; }
970 list();
971 return NULL;
972 case gtkInsertPlItem: // add item into playlist after current
973 if ( plCurrent )
975 plItem * curr = plCurrent;
976 item->next=curr->next;
977 if (item->next)
978 item->next->prev=item;
979 item->prev=curr;
980 curr->next=item;
981 plCurrent=plCurrent->next;
982 return plCurrent;
984 else
985 return gtkSet(gtkAddPlItem,0,(void*)item);
986 return NULL;
987 case gtkGetNextPlItem: // get current item from playlist
988 if ( plCurrent && plCurrent->next)
990 plCurrent=plCurrent->next;
991 /*if ( !plCurrent && plList )
993 plItem * next = plList;
994 while ( next->next ) { if ( !next->next ) break; next=next->next; }
995 plCurrent=next;
997 return plCurrent;
999 return NULL;
1000 case gtkGetPrevPlItem:
1001 if ( plCurrent && plCurrent->prev)
1003 plCurrent=plCurrent->prev;
1004 //if ( !plCurrent && plList ) plCurrent=plList;
1005 return plCurrent;
1007 return NULL;
1008 case gtkSetCurrPlItem: // set current item
1009 plCurrent=item;
1010 return plCurrent;
1011 case gtkGetCurrPlItem: // get current item
1012 return plCurrent;
1013 case gtkDelCurrPlItem: // delete current item
1015 plItem * curr = plCurrent;
1017 if (!curr)
1018 return NULL;
1019 if (curr->prev)
1020 curr->prev->next=curr->next;
1021 if (curr->next)
1022 curr->next->prev=curr->prev;
1023 if (curr==plList)
1024 plList=curr->next;
1025 plCurrent=curr->next;
1026 // Free it
1027 if ( curr->path ) free( curr->path );
1028 if ( curr->name ) free( curr->name );
1029 free( curr );
1031 mplCurr(); // Instead of using mplNext && mplPrev
1033 return plCurrent;
1034 case gtkDelPl: // delete list
1036 plItem * curr = plList;
1037 plItem * next;
1038 if ( !plList ) return NULL;
1039 if ( !curr->next )
1041 if ( curr->path ) free( curr->path );
1042 if ( curr->name ) free( curr->name );
1043 free( curr );
1045 else
1047 while ( curr->next )
1049 next=curr->next;
1050 if ( curr->path ) free( curr->path );
1051 if ( curr->name ) free( curr->name );
1052 free( curr );
1053 curr=next;
1056 plList=NULL; plCurrent=NULL;
1058 return NULL;
1059 // ----- Handle url
1060 case gtkAddURLItem:
1061 if ( URLList )
1063 URLItem * next_url = URLList;
1064 is_added = False;
1065 while ( next_url->next )
1067 if ( !gstrcmp( next_url->url,url_item->url ) )
1069 is_added=True;
1070 break;
1072 next_url=next_url->next;
1074 if ( ( !is_added )&&( gstrcmp( next_url->url,url_item->url ) ) ) next_url->next=url_item;
1075 } else { url_item->next=NULL; URLList=url_item; }
1076 return NULL;
1077 // --- subtitle
1078 #ifndef CONFIG_FREETYPE
1079 case gtkSetFontFactor:
1080 font_factor=fparam;
1081 guiLoadFont();
1082 return NULL;
1083 #else
1084 case gtkSetFontOutLine:
1085 subtitle_font_thickness=( 8.0f / 100.0f ) * fparam;
1086 guiLoadFont();
1087 return NULL;
1088 case gtkSetFontBlur:
1089 subtitle_font_radius=( 8.0f / 100.0f ) * fparam;
1090 guiLoadFont();
1091 return NULL;
1092 case gtkSetFontTextScale:
1093 text_font_scale_factor=fparam;
1094 guiLoadFont();
1095 return NULL;
1096 case gtkSetFontOSDScale:
1097 osd_font_scale_factor=fparam;
1098 guiLoadFont();
1099 return NULL;
1100 case gtkSetFontEncoding:
1101 gfree( (void **)&subtitle_font_encoding );
1102 subtitle_font_encoding=gstrdup( (char *)vparam );
1103 guiLoadFont();
1104 return NULL;
1105 case gtkSetFontAutoScale:
1106 subtitle_autoscale=(int)fparam;
1107 guiLoadFont();
1108 return NULL;
1109 #endif
1110 #ifdef CONFIG_ICONV
1111 case gtkSetSubEncoding:
1112 gfree( (void **)&sub_cp );
1113 sub_cp=gstrdup( (char *)vparam );
1114 break;
1115 #endif
1116 // --- misc
1117 case gtkClearStruct:
1118 if ( (unsigned int)vparam & guiFilenames )
1120 gfree( (void **)&guiIntfStruct.Filename );
1121 gfree( (void **)&guiIntfStruct.Subtitlename );
1122 gfree( (void **)&guiIntfStruct.AudioFile );
1123 gtkSet( gtkDelPl,0,NULL );
1125 #ifdef CONFIG_DVDREAD
1126 if ( (unsigned int)vparam & guiDVD ) memset( &guiIntfStruct.DVD,0,sizeof( guiDVDStruct ) );
1127 #endif
1128 #ifdef CONFIG_VCD
1129 if ( (unsigned int)vparam & guiVCD ) guiIntfStruct.VCDTracks=0;
1130 #endif
1131 return NULL;
1132 case gtkSetExtraStereo:
1133 gtkAOExtraStereoMul=fparam;
1134 if (guiIntfStruct.afilter)
1135 af_control_any_rev(guiIntfStruct.afilter,
1136 AF_CONTROL_ES_MUL | AF_CONTROL_SET, &gtkAOExtraStereoMul);
1137 return NULL;
1138 case gtkSetPanscan:
1140 mp_cmd_t * mp_cmd;
1141 mp_cmd=calloc( 1,sizeof( *mp_cmd ) );
1142 mp_cmd->id=MP_CMD_PANSCAN; mp_cmd->name=strdup( "panscan" );
1143 mp_cmd->args[0].v.f=fparam; mp_cmd->args[1].v.i=1;
1144 mp_input_queue_cmd( mp_cmd );
1146 return NULL;
1147 case gtkSetAutoq:
1148 auto_quality=(int)fparam;
1149 return NULL;
1150 // --- set equalizers
1151 case gtkSetContrast:
1152 if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"contrast",(int)fparam );
1153 return NULL;
1154 case gtkSetBrightness:
1155 if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"brightness",(int)fparam );
1156 return NULL;
1157 case gtkSetHue:
1158 if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"hue",(int)fparam );
1159 return NULL;
1160 case gtkSetSaturation:
1161 if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"saturation",(int)fparam );
1162 return NULL;
1163 case gtkSetEqualizer:
1165 af_control_ext_t tmp;
1166 if ( eq )
1168 gtkEquChannels[eq->channel][eq->band]=eq->gain;
1169 tmp.ch = eq->channel;
1170 tmp.arg = gtkEquChannels[eq->channel];
1171 if (guiIntfStruct.afilter)
1172 af_control_any_rev(guiIntfStruct.afilter,
1173 AF_CONTROL_EQUALIZER_GAIN | AF_CONTROL_SET, &tmp);
1175 else
1177 int i;
1178 memset( gtkEquChannels,0,sizeof( gtkEquChannels ) );
1179 if (guiIntfStruct.afilter)
1180 for ( i=0;i<6;i++ )
1182 tmp.ch = i;
1183 tmp.arg = gtkEquChannels[i];
1184 af_control_any_rev(guiIntfStruct.afilter,
1185 AF_CONTROL_EQUALIZER_GAIN | AF_CONTROL_SET, &tmp);
1188 return NULL;
1191 return NULL;
1194 #define mp_basename(s) (strrchr(s,'/')==NULL?(char*)s:(strrchr(s,'/')+1))
1196 #include "playtree.h"
1198 //This function adds/inserts one file into the gui playlist
1200 int import_file_into_gui(char* temp, int insert)
1202 char *filename, *pathname;
1203 plItem * item;
1205 filename = strdup(mp_basename(temp));
1206 pathname = strdup(temp);
1207 if (strlen(pathname)-strlen(filename)>0)
1208 pathname[strlen(pathname)-strlen(filename)-1]='\0'; // We have some path so remove / at end
1209 else
1210 pathname[strlen(pathname)-strlen(filename)]='\0';
1211 mp_msg(MSGT_PLAYTREE,MSGL_V, "Adding filename %s && pathname %s\n",filename,pathname); //FIXME: Change to MSGL_DBG2 ?
1212 item=calloc( 1,sizeof( plItem ) );
1213 if (!item)
1214 return 0;
1215 item->name=filename;
1216 item->path=pathname;
1217 if (insert)
1218 gtkSet( gtkInsertPlItem,0,(void*)item ); // Inserts the item after current, and makes current=item
1219 else
1220 gtkSet( gtkAddPlItem,0,(void*)item );
1221 return 1;
1225 // This function imports the initial playtree (based on cmd-line files) into the gui playlist
1226 // by either:
1227 // - overwriting gui pl (enqueue=0)
1228 // - appending it to gui pl (enqueue=1)
1230 int import_initial_playtree_into_gui(play_tree_t* my_playtree, m_config_t* config, int enqueue)
1232 play_tree_iter_t* my_pt_iter=NULL;
1233 int result=0;
1235 if (!enqueue) // Delete playlist before "appending"
1236 gtkSet(gtkDelPl,0,0);
1238 if((my_pt_iter=pt_iter_create(&my_playtree,config)))
1240 while ((filename=pt_iter_get_next_file(my_pt_iter))!=NULL)
1242 if (import_file_into_gui(filename, 0)) // Add it to end of list
1243 result=1;
1247 mplCurr(); // Update filename
1248 mplGotoTheNext=1;
1250 if (!enqueue)
1251 filename=guiIntfStruct.Filename; // Backward compatibility; if file is specified on commandline,
1252 // gmplayer does directly start in Play-Mode.
1253 else
1254 filename=NULL;
1256 return result;
1259 // This function imports and inserts an playtree, that is created "on the fly", for example by
1260 // parsing some MOV-Reference-File; or by loading an playlist with "File Open"
1262 // The file which contained the playlist is thereby replaced with it's contents.
1264 int import_playtree_playlist_into_gui(play_tree_t* my_playtree, m_config_t* config)
1266 play_tree_iter_t* my_pt_iter=NULL;
1267 int result=0;
1268 plItem * save=(plItem*)gtkSet( gtkGetCurrPlItem, 0, 0); // Save current item
1270 if((my_pt_iter=pt_iter_create(&my_playtree,config)))
1272 while ((filename=pt_iter_get_next_file(my_pt_iter))!=NULL)
1274 if (import_file_into_gui(filename, 1)) // insert it into the list and set plCurrent=new item
1275 result=1;
1277 pt_iter_destroy(&my_pt_iter);
1280 if (save)
1281 gtkSet(gtkSetCurrPlItem, 0, (void*)save);
1282 else
1283 gtkSet(gtkSetCurrPlItem, 0, (void*)plList); // go to head, if plList was empty before
1285 if (save && result)
1286 gtkSet(gtkDelCurrPlItem, 0, 0);
1288 mplCurr(); // Update filename
1289 filename=NULL;
1291 return result;
1294 // wrapper function for mp_msg to display a message box for errors and warnings.
1296 void guiMessageBox(int level, char * str) {
1297 switch(level) {
1298 case MSGL_FATAL:
1299 gtkMessageBox(GTK_MB_FATAL|GTK_MB_SIMPLE, str);
1300 break;
1301 case MSGL_ERR:
1302 gtkMessageBox(GTK_MB_ERROR|GTK_MB_SIMPLE, str);
1303 break;
1304 #if 0
1305 // WARNING! Do NOT enable this! There are too many non-critical messages with
1306 // MSGL_WARN, for example: broken SPU packets, codec's bit error messages,
1307 // etc etc, they should not raise up a new window every time.
1308 case MSGL_WARN:
1309 gtkMessageBox(GTK_MB_WARNING|GTK_MB_SIMPLE, str);
1310 break;
1311 #endif