2001-08-25 21:04:29 +00:00
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
2001-08-26 00:28:56 +00:00
|
|
|
#include <sys/wait.h>
|
2001-08-25 21:04:29 +00:00
|
|
|
#include <unistd.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <signal.h>
|
|
|
|
|
2002-01-15 17:03:19 +00:00
|
|
|
#include <gdk/gdkprivate.h>
|
2001-08-25 21:04:29 +00:00
|
|
|
#include <gdk/gdkkeysyms.h>
|
2002-01-15 17:03:19 +00:00
|
|
|
#include <gdk/gdk.h>
|
2001-08-25 21:04:29 +00:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
#include "widgets.h"
|
|
|
|
|
|
|
|
#include "./mplayer.h"
|
|
|
|
#include "../events.h"
|
2002-05-06 15:05:07 +00:00
|
|
|
#include "../app.h"
|
2001-08-25 21:04:29 +00:00
|
|
|
|
2002-02-23 15:12:55 +00:00
|
|
|
#include "gtk/menu.h"
|
|
|
|
#include "play.h"
|
|
|
|
#include "gtk/fs.h"
|
|
|
|
|
2001-08-25 21:04:29 +00:00
|
|
|
#include "../../config.h"
|
2001-09-12 15:08:53 +00:00
|
|
|
#include "../../help_mp.h"
|
2001-08-25 21:04:29 +00:00
|
|
|
|
|
|
|
GtkWidget * PlayList;
|
|
|
|
GtkWidget * Options;
|
2002-03-06 18:42:56 +00:00
|
|
|
GtkWidget * PopUpMenu = NULL;
|
2001-08-25 21:04:29 +00:00
|
|
|
|
2001-09-20 10:27:24 +00:00
|
|
|
GtkWidget * WarningPixmap;
|
|
|
|
GtkWidget * ErrorPixmap;
|
|
|
|
|
2002-02-23 15:12:55 +00:00
|
|
|
int gtkPopupMenu = 0;
|
|
|
|
int gtkPopupMenuParam = 0;
|
2002-05-01 09:29:06 +00:00
|
|
|
int gtkInited = 0;
|
2001-08-25 21:04:29 +00:00
|
|
|
|
|
|
|
#include "gtk/sb.h"
|
|
|
|
#include "gtk/pl.h"
|
|
|
|
#include "gtk/fs.h"
|
|
|
|
#include "gtk/mb.h"
|
|
|
|
#include "gtk/about.h"
|
|
|
|
#include "gtk/opts.h"
|
2001-11-14 16:04:25 +00:00
|
|
|
#include "gtk/menu.h"
|
2001-08-25 21:04:29 +00:00
|
|
|
|
2002-02-23 15:12:55 +00:00
|
|
|
// --- init & close gtk
|
2002-01-15 17:03:19 +00:00
|
|
|
|
2002-05-28 11:55:17 +00:00
|
|
|
void gtkInit( void )
|
2001-08-25 21:04:29 +00:00
|
|
|
{
|
2002-05-01 09:29:06 +00:00
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[widget] init gtk ...\n" );
|
2001-08-25 21:04:29 +00:00
|
|
|
gtk_set_locale();
|
2002-05-28 11:55:17 +00:00
|
|
|
// gtk_init( &argc,&argv );
|
|
|
|
gtk_init( 0,NULL );
|
2002-05-20 13:56:16 +00:00
|
|
|
// gdk_set_use_xshm( TRUE );
|
2002-05-01 09:29:06 +00:00
|
|
|
gtkInited=1;
|
2001-08-25 21:04:29 +00:00
|
|
|
}
|
|
|
|
|
2002-02-23 15:12:55 +00:00
|
|
|
void gtkDone( void )
|
2001-08-25 21:04:29 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void gtkClearList( GtkWidget * list )
|
|
|
|
{ gtk_clist_clear( GTK_CLIST( list ) ); }
|
|
|
|
|
|
|
|
int gtkFindCList( GtkWidget * list,char * item )
|
|
|
|
{
|
|
|
|
gint j,t;
|
|
|
|
gchar * tmpstr;
|
|
|
|
for( t=0,j=0;j<GTK_CLIST( list )->rows;j++ )
|
|
|
|
{
|
|
|
|
gtk_clist_get_text( GTK_CLIST( list ),j,0,&tmpstr );
|
|
|
|
if ( !strcmp( tmpstr,item ) ) return j;
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void gtkSetDefaultToCList( GtkWidget * list,char * item )
|
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
if ( ( i=gtkFindCList( list,item ) ) > -1 ) gtk_clist_select_row( GTK_CLIST( list ),i,0 );
|
|
|
|
}
|
|
|
|
|
2002-02-23 15:12:55 +00:00
|
|
|
void gtkEventHandling( void )
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for( i=0;i < 25;i++ ) gtk_main_iteration_do( 0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
// --- funcs
|
|
|
|
|
|
|
|
void gtkMessageBox( int type,gchar * str )
|
|
|
|
{
|
2002-05-01 09:29:06 +00:00
|
|
|
if ( !gtkInited ) return;
|
2002-05-20 13:56:16 +00:00
|
|
|
ShowMessageBox( str );
|
2002-02-23 15:12:55 +00:00
|
|
|
gtk_label_set_text( GTK_LABEL( gtkMessageBoxText ),str );
|
|
|
|
switch( type)
|
|
|
|
{
|
|
|
|
case GTK_MB_FATAL:
|
|
|
|
gtk_window_set_title( GTK_WINDOW( MessageBox ),MSGTR_MSGBOX_LABEL_FatalError );
|
|
|
|
gtk_widget_hide( WarningPixmap );
|
|
|
|
gtk_widget_show( ErrorPixmap );
|
|
|
|
break;
|
|
|
|
case GTK_MB_ERROR:
|
|
|
|
gtk_window_set_title( GTK_WINDOW( MessageBox ),MSGTR_MSGBOX_LABEL_Error );
|
|
|
|
gtk_widget_hide( WarningPixmap );
|
|
|
|
gtk_widget_show( ErrorPixmap );
|
|
|
|
break;
|
|
|
|
case GTK_MB_WARNING:
|
|
|
|
gtk_window_set_title( GTK_WINDOW( MessageBox ),MSGTR_MSGBOX_LABEL_Warning );
|
|
|
|
gtk_widget_show( WarningPixmap );
|
|
|
|
gtk_widget_hide( ErrorPixmap );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
gtk_widget_show( MessageBox );
|
|
|
|
}
|
|
|
|
|
2002-05-06 15:05:07 +00:00
|
|
|
void gtkSetLayer( GtkWidget * wdg )
|
|
|
|
{
|
|
|
|
GdkWindowPrivate * win = wdg->window;
|
|
|
|
wsSetLayer( gdk_display,win->xwindow,appMPlayer.subWindow.isFullScreen );
|
|
|
|
}
|
|
|
|
|
2002-05-20 13:56:16 +00:00
|
|
|
void gtkActive( GtkWidget * wdg )
|
|
|
|
{
|
|
|
|
GdkWindowPrivate * win = wdg->window;
|
|
|
|
wsMoveTopWindow( gdk_display,win->xwindow );
|
|
|
|
}
|
|
|
|
|
2002-02-23 15:12:55 +00:00
|
|
|
void gtkShow( int type,char * param )
|
|
|
|
{
|
|
|
|
switch( type )
|
|
|
|
{
|
|
|
|
case evSkinBrowser:
|
2002-05-20 13:56:16 +00:00
|
|
|
// SkinBrowser=create_SkinBrowser();
|
|
|
|
ShowSkinBrowser();
|
2002-05-11 16:37:58 +00:00
|
|
|
// gtkClearList( SkinList );
|
|
|
|
if ( gtkFillSkinList( sbMPlayerPrefixDir ) && gtkFillSkinList( sbMPlayerDirInHome ) )
|
2002-02-23 15:12:55 +00:00
|
|
|
{
|
|
|
|
gtkSetDefaultToCList( SkinList,param );
|
|
|
|
gtk_widget_show( SkinBrowser );
|
2002-05-11 16:37:58 +00:00
|
|
|
gtkSetLayer( SkinBrowser );
|
2002-05-20 13:56:16 +00:00
|
|
|
} else gtk_widget_destroy( SkinBrowser );
|
2002-02-23 15:12:55 +00:00
|
|
|
break;
|
|
|
|
case evPreferences:
|
2002-05-20 13:56:16 +00:00
|
|
|
gtkMessageBox( GTK_MB_WARNING,"Sorry, this feature is under development ..." );
|
|
|
|
// Options=create_Options();
|
|
|
|
// gtk_widget_show( Options );
|
|
|
|
// gtkSetLayer( Options );
|
2002-02-23 15:12:55 +00:00
|
|
|
break;
|
|
|
|
case evPlayList:
|
2002-05-20 13:56:16 +00:00
|
|
|
gtkMessageBox( GTK_MB_WARNING,"Sorry, this feature is under development ..." );
|
|
|
|
// PlayList=create_PlayList();
|
|
|
|
// gtk_widget_show( PlayList );
|
|
|
|
// gtkSetLayer( PlayList );
|
2002-02-23 15:12:55 +00:00
|
|
|
break;
|
|
|
|
case evLoad:
|
|
|
|
ShowFileSelect( fsVideoSelector );
|
2002-05-20 13:56:16 +00:00
|
|
|
gtkSetLayer( fsFileSelect );
|
2002-02-23 15:12:55 +00:00
|
|
|
break;
|
|
|
|
case evFirstLoad:
|
|
|
|
ShowFileSelect( fsVideoSelector );
|
2002-05-20 13:56:16 +00:00
|
|
|
gtkSetLayer( fsFileSelect );
|
2002-02-23 15:12:55 +00:00
|
|
|
break;
|
|
|
|
case evLoadSubtitle:
|
|
|
|
ShowFileSelect( fsSubtitleSelector );
|
2002-05-20 13:56:16 +00:00
|
|
|
gtkSetLayer( fsFileSelect );
|
2002-02-23 15:12:55 +00:00
|
|
|
break;
|
|
|
|
case evAbout:
|
2002-05-20 13:56:16 +00:00
|
|
|
ShowAboutBox();
|
2002-05-06 15:05:07 +00:00
|
|
|
gtkSetLayer( AboutBox );
|
2002-02-23 15:12:55 +00:00
|
|
|
break;
|
|
|
|
case evShowPopUpMenu:
|
|
|
|
gtkPopupMenu=evNone;
|
|
|
|
gtkPopupMenuParam=0;
|
2002-03-06 18:42:56 +00:00
|
|
|
if ( PopUpMenu ) gtk_widget_hide_on_delete( PopUpMenu );
|
2002-02-23 15:12:55 +00:00
|
|
|
PopUpMenu=create_PopUpMenu();
|
|
|
|
gtk_menu_popup( GTK_MENU( PopUpMenu ),NULL,NULL,NULL,NULL,0,0 );
|
|
|
|
break;
|
|
|
|
case evHidePopUpMenu:
|
2002-03-06 18:42:56 +00:00
|
|
|
if ( PopUpMenu ) gtk_widget_hide_on_delete( PopUpMenu );
|
2002-02-23 15:12:55 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2002-05-06 15:05:07 +00:00
|
|
|
|
|
|
|
|