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-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 * SkinBrowser;
|
|
|
|
GtkWidget * PlayList;
|
|
|
|
GtkWidget * FileSelect;
|
|
|
|
GtkWidget * AboutBox;
|
|
|
|
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 * MessageBox;
|
|
|
|
|
|
|
|
GtkWidget * WarningPixmap;
|
|
|
|
GtkWidget * ErrorPixmap;
|
|
|
|
|
2002-02-23 15:12:55 +00:00
|
|
|
int gtkPopupMenu = 0;
|
|
|
|
int gtkPopupMenuParam = 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
|
|
|
|
|
|
|
void widgetsCreate( void )
|
|
|
|
{
|
|
|
|
AboutBox=create_About();
|
|
|
|
SkinBrowser=create_SkinBrowser();
|
|
|
|
PlayList=create_PlayList();
|
|
|
|
FileSelect=create_FileSelect();
|
2001-09-17 21:16:00 +00:00
|
|
|
MessageBox=create_MessageBox(0);
|
2001-08-25 21:04:29 +00:00
|
|
|
Options=create_Options();
|
2001-11-18 19:22:55 +00:00
|
|
|
// PopUpMenu=create_PopUpMenu();
|
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-02-23 15:12:55 +00:00
|
|
|
void gtkInit( int argc,char* argv[], char *envp[] )
|
2001-08-25 21:04:29 +00:00
|
|
|
{
|
|
|
|
gtk_set_locale();
|
2002-02-23 15:12:55 +00:00
|
|
|
gtk_init( &argc,&argv );
|
2001-08-25 21:04:29 +00:00
|
|
|
gdk_set_use_xshm( TRUE );
|
|
|
|
widgetsCreate();
|
|
|
|
}
|
|
|
|
|
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 )
|
|
|
|
{
|
|
|
|
gtk_label_set_text( GTK_LABEL( gtkMessageBoxText ),str );
|
|
|
|
gtk_widget_hide( MessageBox );
|
|
|
|
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 );
|
|
|
|
}
|
|
|
|
|
|
|
|
void gtkShow( int type,char * param )
|
|
|
|
{
|
|
|
|
switch( type )
|
|
|
|
{
|
|
|
|
case evSkinBrowser:
|
|
|
|
gtk_widget_hide( SkinBrowser );
|
|
|
|
gtkClearList( SkinList );
|
|
|
|
if ( gtkFillSkinList( sbMPlayerPrefixDir )&>kFillSkinList( sbMPlayerDirInHome ) )
|
|
|
|
{
|
|
|
|
gtkSetDefaultToCList( SkinList,param );
|
|
|
|
gtk_widget_show( SkinBrowser );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case evPreferences:
|
|
|
|
gtk_widget_hide( Options );
|
|
|
|
gtk_widget_show( Options );
|
|
|
|
break;
|
|
|
|
case evPlayList:
|
|
|
|
gtk_widget_hide( PlayList );
|
|
|
|
gtk_widget_show( PlayList );
|
|
|
|
break;
|
|
|
|
case evLoad:
|
|
|
|
ShowFileSelect( fsVideoSelector );
|
|
|
|
break;
|
|
|
|
case evFirstLoad:
|
|
|
|
ShowFileSelect( fsVideoSelector );
|
|
|
|
break;
|
|
|
|
case evLoadSubtitle:
|
|
|
|
ShowFileSelect( fsSubtitleSelector );
|
|
|
|
break;
|
|
|
|
case evAbout:
|
|
|
|
gtk_widget_hide( AboutBox );
|
|
|
|
gtk_widget_show( AboutBox );
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|