Mercurial > mplayer.hg
annotate Gui/mplayer/widgets.c @ 6539:79b536a37e40
better planar support, chroma subsampling support and Y8/Y800 support
author | alex |
---|---|
date | Sun, 23 Jun 2002 21:08:31 +0000 |
parents | d42cb911d7f7 |
children | da08877b9512 |
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" |
6298 | 48 #include "gtk/url.h" |
1693 | 49 |
50 // --- init & close gtk | |
51 | |
6218 | 52 void gtkInit( void ) |
1693 | 53 { |
5919 | 54 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
|
55 gtk_set_locale(); |
6218 | 56 // gtk_init( &argc,&argv ); |
57 gtk_init( 0,NULL ); | |
6146 | 58 // gdk_set_use_xshm( TRUE ); |
5919 | 59 gtkInited=1; |
1693 | 60 } |
61 | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
62 void gtkDone( void ) |
1693 | 63 { |
64 } | |
65 | |
66 void gtkClearList( GtkWidget * list ) | |
67 { gtk_clist_clear( GTK_CLIST( list ) ); } | |
68 | |
69 int gtkFindCList( GtkWidget * list,char * item ) | |
70 { | |
71 gint j,t; | |
72 gchar * tmpstr; | |
73 for( t=0,j=0;j<GTK_CLIST( list )->rows;j++ ) | |
74 { | |
75 gtk_clist_get_text( GTK_CLIST( list ),j,0,&tmpstr ); | |
76 if ( !strcmp( tmpstr,item ) ) return j; | |
77 } | |
78 return -1; | |
79 } | |
80 | |
81 void gtkSetDefaultToCList( GtkWidget * list,char * item ) | |
82 { | |
83 gint i; | |
84 if ( ( i=gtkFindCList( list,item ) ) > -1 ) gtk_clist_select_row( GTK_CLIST( list ),i,0 ); | |
85 } | |
86 | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
87 void gtkEventHandling( void ) |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
88 { |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
89 int i; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
90 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
|
91 } |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
92 |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
93 // --- funcs |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
94 |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
95 void gtkMessageBox( int type,gchar * str ) |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
96 { |
5919 | 97 if ( !gtkInited ) return; |
6146 | 98 ShowMessageBox( str ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
99 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
|
100 switch( type) |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
101 { |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
102 case GTK_MB_FATAL: |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
103 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
|
104 gtk_widget_hide( WarningPixmap ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
105 gtk_widget_show( ErrorPixmap ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
106 break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
107 case GTK_MB_ERROR: |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
108 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
|
109 gtk_widget_hide( WarningPixmap ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
110 gtk_widget_show( ErrorPixmap ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
111 break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
112 case GTK_MB_WARNING: |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
113 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
|
114 gtk_widget_show( WarningPixmap ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
115 gtk_widget_hide( ErrorPixmap ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
116 break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
117 } |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
118 gtk_widget_show( MessageBox ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
119 } |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
120 |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5919
diff
changeset
|
121 void gtkSetLayer( GtkWidget * wdg ) |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5919
diff
changeset
|
122 { |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5919
diff
changeset
|
123 GdkWindowPrivate * win = wdg->window; |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5919
diff
changeset
|
124 wsSetLayer( gdk_display,win->xwindow,appMPlayer.subWindow.isFullScreen ); |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5919
diff
changeset
|
125 } |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5919
diff
changeset
|
126 |
6146 | 127 void gtkActive( GtkWidget * wdg ) |
128 { | |
129 GdkWindowPrivate * win = wdg->window; | |
130 wsMoveTopWindow( gdk_display,win->xwindow ); | |
131 } | |
132 | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
133 void gtkShow( int type,char * param ) |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
134 { |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
135 switch( type ) |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
136 { |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
137 case evSkinBrowser: |
6146 | 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 ); |
6222 | 143 gtk_clist_sort( SkinList ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
144 gtk_widget_show( SkinBrowser ); |
6044 | 145 gtkSetLayer( SkinBrowser ); |
6222 | 146 } |
147 else | |
148 { | |
149 gtk_widget_destroy( SkinBrowser ); | |
150 gtkMessageBox( GTK_MB_ERROR,"Skin dirs not found ... Please install skins." ); | |
151 } | |
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 evPreferences: |
6146 | 154 gtkMessageBox( GTK_MB_WARNING,"Sorry, this feature is under development ..." ); |
155 // Options=create_Options(); | |
156 // gtk_widget_show( Options ); | |
157 // gtkSetLayer( Options ); | |
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 evPlayList: |
6146 | 160 gtkMessageBox( GTK_MB_WARNING,"Sorry, this feature is under development ..." ); |
161 // PlayList=create_PlayList(); | |
162 // gtk_widget_show( PlayList ); | |
163 // gtkSetLayer( PlayList ); | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
164 break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
165 case evLoad: |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
166 ShowFileSelect( fsVideoSelector ); |
6146 | 167 gtkSetLayer( fsFileSelect ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
168 break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
169 case evFirstLoad: |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
170 ShowFileSelect( fsVideoSelector ); |
6146 | 171 gtkSetLayer( fsFileSelect ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
172 break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
173 case evLoadSubtitle: |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
174 ShowFileSelect( fsSubtitleSelector ); |
6146 | 175 gtkSetLayer( fsFileSelect ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
176 break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
177 case evAbout: |
6146 | 178 ShowAboutBox(); |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5919
diff
changeset
|
179 gtkSetLayer( AboutBox ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
180 break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
181 case evShowPopUpMenu: |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
182 gtkPopupMenu=evNone; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
183 gtkPopupMenuParam=0; |
4950 | 184 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
|
185 PopUpMenu=create_PopUpMenu(); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
186 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
|
187 break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
188 case evHidePopUpMenu: |
4950 | 189 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
|
190 break; |
6298 | 191 case evPlayNetwork: |
192 ShowURLDialogBox(); | |
193 break; | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
194 } |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
195 } |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5919
diff
changeset
|
196 |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5919
diff
changeset
|
197 |