Mercurial > mplayer.hg
annotate Gui/mplayer/widgets.c @ 6195:39805251ef61
Downloads w32codecs from M$, script by Tom Lees <tal26 at cam.ac.uk>
author | atmos4 |
---|---|
date | Sun, 26 May 2002 12:50:58 +0000 |
parents | b9651eb9749e |
children | 8cfddba867b4 |
rev | line source |
---|---|
1693 | 1 |
2 #include <stdlib.h> | |
3 #include <stdio.h> | |
4 | |
5 #include <sys/types.h> | |
6 #include <sys/stat.h> | |
1700 | 7 #include <sys/wait.h> |
1693 | 8 #include <unistd.h> |
9 #include <string.h> | |
10 #include <signal.h> | |
11 | |
4176
116abdd0aed1
small gtk bug fix (-display bug, baze gabu, miattad fogok elkarhozni:), and remove gui dependencie in mencoder
pontscho
parents:
3586
diff
changeset
|
12 #include <gdk/gdkprivate.h> |
1693 | 13 #include <gdk/gdkkeysyms.h> |
4176
116abdd0aed1
small gtk bug fix (-display bug, baze gabu, miattad fogok elkarhozni:), and remove gui dependencie in mencoder
pontscho
parents:
3586
diff
changeset
|
14 #include <gdk/gdk.h> |
1693 | 15 #include <gtk/gtk.h> |
16 | |
17 #include "widgets.h" | |
18 | |
19 #include "./mplayer.h" | |
20 #include "../events.h" | |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5919
diff
changeset
|
21 #include "../app.h" |
1693 | 22 |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
23 #include "gtk/menu.h" |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
24 #include "play.h" |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
25 #include "gtk/fs.h" |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
26 |
1693 | 27 #include "../../config.h" |
1884 | 28 #include "../../help_mp.h" |
1693 | 29 |
30 GtkWidget * PlayList; | |
31 GtkWidget * Options; | |
4950 | 32 GtkWidget * PopUpMenu = NULL; |
1693 | 33 |
1925 | 34 GtkWidget * WarningPixmap; |
35 GtkWidget * ErrorPixmap; | |
36 | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
37 int gtkPopupMenu = 0; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
38 int gtkPopupMenuParam = 0; |
5919 | 39 int gtkInited = 0; |
1693 | 40 |
41 #include "gtk/sb.h" | |
42 #include "gtk/pl.h" | |
43 #include "gtk/fs.h" | |
44 #include "gtk/mb.h" | |
45 #include "gtk/about.h" | |
46 #include "gtk/opts.h" | |
2901 | 47 #include "gtk/menu.h" |
1693 | 48 |
49 // --- init & close gtk | |
50 | |
51 void gtkInit( int argc,char* argv[], char *envp[] ) | |
52 { | |
5919 | 53 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[widget] init gtk ...\n" ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
54 gtk_set_locale(); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
55 gtk_init( &argc,&argv ); |
6146 | 56 // gdk_set_use_xshm( TRUE ); |
5919 | 57 |
58 gtkInited=1; | |
1693 | 59 } |
60 | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
61 void gtkDone( void ) |
1693 | 62 { |
63 } | |
64 | |
65 void gtkClearList( GtkWidget * list ) | |
66 { gtk_clist_clear( GTK_CLIST( list ) ); } | |
67 | |
68 int gtkFindCList( GtkWidget * list,char * item ) | |
69 { | |
70 gint j,t; | |
71 gchar * tmpstr; | |
72 for( t=0,j=0;j<GTK_CLIST( list )->rows;j++ ) | |
73 { | |
74 gtk_clist_get_text( GTK_CLIST( list ),j,0,&tmpstr ); | |
75 if ( !strcmp( tmpstr,item ) ) return j; | |
76 } | |
77 return -1; | |
78 } | |
79 | |
80 void gtkSetDefaultToCList( GtkWidget * list,char * item ) | |
81 { | |
82 gint i; | |
83 if ( ( i=gtkFindCList( list,item ) ) > -1 ) gtk_clist_select_row( GTK_CLIST( list ),i,0 ); | |
84 } | |
85 | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
86 void gtkEventHandling( void ) |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
87 { |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
88 int i; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
89 for( i=0;i < 25;i++ ) gtk_main_iteration_do( 0 ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
90 } |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
91 |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
92 // --- funcs |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
93 |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
94 void gtkMessageBox( int type,gchar * str ) |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
95 { |
5919 | 96 if ( !gtkInited ) return; |
6146 | 97 ShowMessageBox( str ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
98 gtk_label_set_text( GTK_LABEL( gtkMessageBoxText ),str ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
99 switch( type) |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
100 { |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
101 case GTK_MB_FATAL: |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
102 gtk_window_set_title( GTK_WINDOW( MessageBox ),MSGTR_MSGBOX_LABEL_FatalError ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
103 gtk_widget_hide( WarningPixmap ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
104 gtk_widget_show( ErrorPixmap ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
105 break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
106 case GTK_MB_ERROR: |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
107 gtk_window_set_title( GTK_WINDOW( MessageBox ),MSGTR_MSGBOX_LABEL_Error ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
108 gtk_widget_hide( WarningPixmap ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
109 gtk_widget_show( ErrorPixmap ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
110 break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
111 case GTK_MB_WARNING: |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
112 gtk_window_set_title( GTK_WINDOW( MessageBox ),MSGTR_MSGBOX_LABEL_Warning ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
113 gtk_widget_show( WarningPixmap ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
114 gtk_widget_hide( ErrorPixmap ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
115 break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
116 } |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
117 gtk_widget_show( MessageBox ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
118 } |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
119 |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5919
diff
changeset
|
120 void gtkSetLayer( GtkWidget * wdg ) |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5919
diff
changeset
|
121 { |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5919
diff
changeset
|
122 GdkWindowPrivate * win = wdg->window; |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5919
diff
changeset
|
123 wsSetLayer( gdk_display,win->xwindow,appMPlayer.subWindow.isFullScreen ); |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5919
diff
changeset
|
124 } |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5919
diff
changeset
|
125 |
6146 | 126 void gtkActive( GtkWidget * wdg ) |
127 { | |
128 GdkWindowPrivate * win = wdg->window; | |
129 wsMoveTopWindow( gdk_display,win->xwindow ); | |
130 } | |
131 | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
132 void gtkShow( int type,char * param ) |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
133 { |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
134 switch( type ) |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
135 { |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
136 case evSkinBrowser: |
6146 | 137 // SkinBrowser=create_SkinBrowser(); |
138 ShowSkinBrowser(); | |
6044 | 139 // gtkClearList( SkinList ); |
140 if ( gtkFillSkinList( sbMPlayerPrefixDir ) && gtkFillSkinList( sbMPlayerDirInHome ) ) | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
141 { |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
142 gtkSetDefaultToCList( SkinList,param ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
143 gtk_widget_show( SkinBrowser ); |
6044 | 144 gtkSetLayer( SkinBrowser ); |
6146 | 145 } else gtk_widget_destroy( SkinBrowser ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
146 break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
147 case evPreferences: |
6146 | 148 gtkMessageBox( GTK_MB_WARNING,"Sorry, this feature is under development ..." ); |
149 // Options=create_Options(); | |
150 // gtk_widget_show( Options ); | |
151 // gtkSetLayer( Options ); | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
152 break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
153 case evPlayList: |
6146 | 154 gtkMessageBox( GTK_MB_WARNING,"Sorry, this feature is under development ..." ); |
155 // PlayList=create_PlayList(); | |
156 // gtk_widget_show( PlayList ); | |
157 // gtkSetLayer( PlayList ); | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
158 break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
159 case evLoad: |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
160 ShowFileSelect( fsVideoSelector ); |
6146 | 161 gtkSetLayer( fsFileSelect ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
162 break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
163 case evFirstLoad: |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
164 ShowFileSelect( fsVideoSelector ); |
6146 | 165 gtkSetLayer( fsFileSelect ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
166 break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
167 case evLoadSubtitle: |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
168 ShowFileSelect( fsSubtitleSelector ); |
6146 | 169 gtkSetLayer( fsFileSelect ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
170 break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
171 case evAbout: |
6146 | 172 ShowAboutBox(); |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5919
diff
changeset
|
173 gtkSetLayer( AboutBox ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
174 break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
175 case evShowPopUpMenu: |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
176 gtkPopupMenu=evNone; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
177 gtkPopupMenuParam=0; |
4950 | 178 if ( PopUpMenu ) gtk_widget_hide_on_delete( PopUpMenu ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
179 PopUpMenu=create_PopUpMenu(); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
180 gtk_menu_popup( GTK_MENU( PopUpMenu ),NULL,NULL,NULL,NULL,0,0 ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
181 break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
182 case evHidePopUpMenu: |
4950 | 183 if ( PopUpMenu ) gtk_widget_hide_on_delete( PopUpMenu ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
184 break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
185 } |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
186 } |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5919
diff
changeset
|
187 |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5919
diff
changeset
|
188 |