Mercurial > mplayer.hg
annotate Gui/mplayer/widgets.c @ 5429:e9e2dc1306b1
BITMAPINFOHEADER fixed to be accepted by win32 decoders (divx,divxds)
author | arpi |
---|---|
date | Sun, 31 Mar 2002 20:17:27 +0000 |
parents | 307a94037c5c |
children | 25c43bd75e4c |
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" | |
21 | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
22 #include "gtk/menu.h" |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
23 #include "play.h" |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
24 #include "gtk/fs.h" |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
25 |
1693 | 26 #include "../../config.h" |
1884 | 27 #include "../../help_mp.h" |
1693 | 28 |
29 GtkWidget * SkinBrowser; | |
30 GtkWidget * PlayList; | |
31 GtkWidget * FileSelect; | |
32 GtkWidget * AboutBox; | |
33 GtkWidget * Options; | |
4950 | 34 GtkWidget * PopUpMenu = NULL; |
1693 | 35 |
1925 | 36 GtkWidget * MessageBox; |
37 | |
38 GtkWidget * WarningPixmap; | |
39 GtkWidget * ErrorPixmap; | |
40 | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
41 int gtkPopupMenu = 0; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
42 int gtkPopupMenuParam = 0; |
1693 | 43 |
44 #include "gtk/sb.h" | |
45 #include "gtk/pl.h" | |
46 #include "gtk/fs.h" | |
47 #include "gtk/mb.h" | |
48 #include "gtk/about.h" | |
49 #include "gtk/opts.h" | |
2901 | 50 #include "gtk/menu.h" |
1693 | 51 |
52 void widgetsCreate( void ) | |
53 { | |
54 AboutBox=create_About(); | |
55 SkinBrowser=create_SkinBrowser(); | |
56 PlayList=create_PlayList(); | |
57 FileSelect=create_FileSelect(); | |
1907 | 58 MessageBox=create_MessageBox(0); |
1693 | 59 Options=create_Options(); |
2980 | 60 // PopUpMenu=create_PopUpMenu(); |
1693 | 61 } |
62 | |
63 // --- init & close gtk | |
64 | |
65 void gtkInit( int argc,char* argv[], char *envp[] ) | |
66 { | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
67 gtk_set_locale(); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
68 gtk_init( &argc,&argv ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
69 gdk_set_use_xshm( TRUE ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
70 widgetsCreate(); |
1693 | 71 } |
72 | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
73 void gtkDone( void ) |
1693 | 74 { |
75 } | |
76 | |
77 void gtkClearList( GtkWidget * list ) | |
78 { gtk_clist_clear( GTK_CLIST( list ) ); } | |
79 | |
80 int gtkFindCList( GtkWidget * list,char * item ) | |
81 { | |
82 gint j,t; | |
83 gchar * tmpstr; | |
84 for( t=0,j=0;j<GTK_CLIST( list )->rows;j++ ) | |
85 { | |
86 gtk_clist_get_text( GTK_CLIST( list ),j,0,&tmpstr ); | |
87 if ( !strcmp( tmpstr,item ) ) return j; | |
88 } | |
89 return -1; | |
90 } | |
91 | |
92 void gtkSetDefaultToCList( GtkWidget * list,char * item ) | |
93 { | |
94 gint i; | |
95 if ( ( i=gtkFindCList( list,item ) ) > -1 ) gtk_clist_select_row( GTK_CLIST( list ),i,0 ); | |
96 } | |
97 | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
98 void gtkEventHandling( void ) |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
99 { |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
100 int i; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
101 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
|
102 } |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
103 |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
104 // --- funcs |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
105 |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
106 void gtkMessageBox( int type,gchar * str ) |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
107 { |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
108 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
|
109 gtk_widget_hide( MessageBox ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
110 switch( type) |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
111 { |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
112 case GTK_MB_FATAL: |
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_FatalError ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
114 gtk_widget_hide( WarningPixmap ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
115 gtk_widget_show( 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 case GTK_MB_ERROR: |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
118 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
|
119 gtk_widget_hide( WarningPixmap ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
120 gtk_widget_show( ErrorPixmap ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
121 break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
122 case GTK_MB_WARNING: |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
123 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
|
124 gtk_widget_show( WarningPixmap ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
125 gtk_widget_hide( ErrorPixmap ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
126 break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
127 } |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
128 gtk_widget_show( MessageBox ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
129 } |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
130 |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
131 void gtkShow( int type,char * param ) |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
132 { |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
133 switch( type ) |
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 case evSkinBrowser: |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
136 gtk_widget_hide( SkinBrowser ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
137 gtkClearList( SkinList ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
138 if ( gtkFillSkinList( sbMPlayerPrefixDir )&>kFillSkinList( sbMPlayerDirInHome ) ) |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
139 { |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
140 gtkSetDefaultToCList( SkinList,param ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
141 gtk_widget_show( SkinBrowser ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
142 } |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
143 break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
144 case evPreferences: |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
145 gtk_widget_hide( Options ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
146 gtk_widget_show( Options ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
147 break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
148 case evPlayList: |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
149 gtk_widget_hide( PlayList ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
150 gtk_widget_show( PlayList ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
151 break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
152 case evLoad: |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
153 ShowFileSelect( fsVideoSelector ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
154 break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
155 case evFirstLoad: |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
156 ShowFileSelect( fsVideoSelector ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
157 break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
158 case evLoadSubtitle: |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
159 ShowFileSelect( fsSubtitleSelector ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
160 break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
161 case evAbout: |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
162 gtk_widget_hide( AboutBox ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
163 gtk_widget_show( AboutBox ); |
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 evShowPopUpMenu: |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
166 gtkPopupMenu=evNone; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
167 gtkPopupMenuParam=0; |
4950 | 168 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
|
169 PopUpMenu=create_PopUpMenu(); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
170 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
|
171 break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
172 case evHidePopUpMenu: |
4950 | 173 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
|
174 break; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
175 } |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4176
diff
changeset
|
176 } |