annotate Gui/mplayer/gtk/common.c @ 20240:9b809e2ef375

Support new realaudio codec names
author rtogni
date Sun, 15 Oct 2006 17:19:13 +0000
parents 273bdef43012
children 945fa0eb37c0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8172
ea1bca449b91 new entry
pontscho
parents:
diff changeset
1
ea1bca449b91 new entry
pontscho
parents:
diff changeset
2 #include <gdk/gdkkeysyms.h>
ea1bca449b91 new entry
pontscho
parents:
diff changeset
3 #include <gtk/gtk.h>
ea1bca449b91 new entry
pontscho
parents:
diff changeset
4
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
5 #include "common.h"
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
6
8719
dc27303ae528 correct widget destroy event handler (thank for D J Hawkey Jr <hawkeyd@visi.com>)
pontscho
parents: 8299
diff changeset
7 void WidgetDestroy( GtkWidget * widget,GtkWidget ** widget_pointer )
dc27303ae528 correct widget destroy event handler (thank for D J Hawkey Jr <hawkeyd@visi.com>)
pontscho
parents: 8299
diff changeset
8 {
dc27303ae528 correct widget destroy event handler (thank for D J Hawkey Jr <hawkeyd@visi.com>)
pontscho
parents: 8299
diff changeset
9 if ( !widget_pointer ) return;
dc27303ae528 correct widget destroy event handler (thank for D J Hawkey Jr <hawkeyd@visi.com>)
pontscho
parents: 8299
diff changeset
10 gtk_widget_hide( *widget_pointer );
dc27303ae528 correct widget destroy event handler (thank for D J Hawkey Jr <hawkeyd@visi.com>)
pontscho
parents: 8299
diff changeset
11 gtk_widget_destroy( *widget_pointer );
dc27303ae528 correct widget destroy event handler (thank for D J Hawkey Jr <hawkeyd@visi.com>)
pontscho
parents: 8299
diff changeset
12 *widget_pointer=NULL;
dc27303ae528 correct widget destroy event handler (thank for D J Hawkey Jr <hawkeyd@visi.com>)
pontscho
parents: 8299
diff changeset
13 }
dc27303ae528 correct widget destroy event handler (thank for D J Hawkey Jr <hawkeyd@visi.com>)
pontscho
parents: 8299
diff changeset
14
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
15 GtkWidget * AddDialogFrame( GtkWidget * parent )
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
16 {
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
17 GtkWidget * frame;
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
18 frame=AddFrame( NULL,GTK_SHADOW_IN,parent,1 );
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
19 gtk_container_set_border_width( GTK_CONTAINER( frame ),1 );
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
20 frame=AddFrame( NULL,GTK_SHADOW_NONE,frame,1 );
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
21 frame=AddFrame( NULL,GTK_SHADOW_ETCHED_OUT,frame,1 );
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
22 frame=AddFrame( NULL,GTK_SHADOW_NONE,frame,1 );
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
23 return frame;
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
24 }
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
25
19081
273bdef43012 Mark several string parameters that are not modified in the function as const.
diego
parents: 9055
diff changeset
26 GtkWidget * AddFrame( const char * title,int type,GtkWidget * parent,int add )
8172
ea1bca449b91 new entry
pontscho
parents:
diff changeset
27 {
ea1bca449b91 new entry
pontscho
parents:
diff changeset
28 GtkWidget * frame = NULL;
ea1bca449b91 new entry
pontscho
parents:
diff changeset
29 frame=gtk_frame_new( title );
ea1bca449b91 new entry
pontscho
parents:
diff changeset
30 gtk_widget_set_name( frame,"frame" );
ea1bca449b91 new entry
pontscho
parents:
diff changeset
31 gtk_widget_show( frame );
9055
4a42c0604ce1 - rewrite sub_fps
pontscho
parents: 8719
diff changeset
32 gtk_frame_set_shadow_type( GTK_FRAME( frame ),type );
4a42c0604ce1 - rewrite sub_fps
pontscho
parents: 8719
diff changeset
33 if ( !parent ) return frame;
8172
ea1bca449b91 new entry
pontscho
parents:
diff changeset
34 if ( add ) gtk_container_add( GTK_CONTAINER( parent ),frame );
ea1bca449b91 new entry
pontscho
parents:
diff changeset
35 else gtk_box_pack_start( GTK_BOX( parent ),frame,FALSE,FALSE,0 );
ea1bca449b91 new entry
pontscho
parents:
diff changeset
36 return frame;
ea1bca449b91 new entry
pontscho
parents:
diff changeset
37 }
ea1bca449b91 new entry
pontscho
parents:
diff changeset
38
19081
273bdef43012 Mark several string parameters that are not modified in the function as const.
diego
parents: 9055
diff changeset
39 GtkWidget * AddLabel( const char * title,GtkWidget * parent )
8172
ea1bca449b91 new entry
pontscho
parents:
diff changeset
40 {
ea1bca449b91 new entry
pontscho
parents:
diff changeset
41 GtkWidget * label;
ea1bca449b91 new entry
pontscho
parents:
diff changeset
42 label=gtk_label_new( title );
ea1bca449b91 new entry
pontscho
parents:
diff changeset
43 gtk_widget_set_name( label,"label" );
ea1bca449b91 new entry
pontscho
parents:
diff changeset
44 gtk_widget_show( label );
ea1bca449b91 new entry
pontscho
parents:
diff changeset
45 if ( parent ) gtk_box_pack_start( GTK_BOX( parent ),label,FALSE,FALSE,0 );
ea1bca449b91 new entry
pontscho
parents:
diff changeset
46 gtk_misc_set_alignment( GTK_MISC( label ),0,0.5 );
ea1bca449b91 new entry
pontscho
parents:
diff changeset
47 gtk_misc_set_padding( GTK_MISC( label ),4,0 );
ea1bca449b91 new entry
pontscho
parents:
diff changeset
48 return label;
ea1bca449b91 new entry
pontscho
parents:
diff changeset
49 }
ea1bca449b91 new entry
pontscho
parents:
diff changeset
50
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
51 GtkWidget * AddVBox( GtkWidget * parent,int type )
8172
ea1bca449b91 new entry
pontscho
parents:
diff changeset
52 {
ea1bca449b91 new entry
pontscho
parents:
diff changeset
53 GtkWidget * vbox;
ea1bca449b91 new entry
pontscho
parents:
diff changeset
54 vbox=gtk_vbox_new( FALSE,0 );
ea1bca449b91 new entry
pontscho
parents:
diff changeset
55 gtk_widget_set_name( vbox,"vbox" );
ea1bca449b91 new entry
pontscho
parents:
diff changeset
56 gtk_widget_show( vbox );
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
57 if ( parent )
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
58 {
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
59 if ( type ) gtk_box_pack_start( GTK_BOX( parent ),vbox,FALSE,FALSE,0 );
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
60 else gtk_container_add( GTK_CONTAINER( parent ),vbox );
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
61 }
8172
ea1bca449b91 new entry
pontscho
parents:
diff changeset
62 return vbox;
ea1bca449b91 new entry
pontscho
parents:
diff changeset
63 }
ea1bca449b91 new entry
pontscho
parents:
diff changeset
64
ea1bca449b91 new entry
pontscho
parents:
diff changeset
65 GtkWidget * AddHBox( GtkWidget * parent,int type )
ea1bca449b91 new entry
pontscho
parents:
diff changeset
66 {
ea1bca449b91 new entry
pontscho
parents:
diff changeset
67 GtkWidget * hbox;
ea1bca449b91 new entry
pontscho
parents:
diff changeset
68 hbox=gtk_hbox_new( FALSE,0 );
ea1bca449b91 new entry
pontscho
parents:
diff changeset
69 gtk_widget_set_name( hbox,"hbox" );
ea1bca449b91 new entry
pontscho
parents:
diff changeset
70 gtk_widget_show( hbox );
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
71 if ( parent )
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
72 {
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
73 if ( type ) gtk_box_pack_start( GTK_BOX( parent ),hbox,FALSE,FALSE,0 );
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
74 else gtk_container_add( GTK_CONTAINER( parent ),hbox );
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
75 }
8172
ea1bca449b91 new entry
pontscho
parents:
diff changeset
76 return hbox;
ea1bca449b91 new entry
pontscho
parents:
diff changeset
77 }
ea1bca449b91 new entry
pontscho
parents:
diff changeset
78
19081
273bdef43012 Mark several string parameters that are not modified in the function as const.
diego
parents: 9055
diff changeset
79 GtkWidget * AddCheckButton( const char * title, GtkWidget * parent )
8172
ea1bca449b91 new entry
pontscho
parents:
diff changeset
80 {
ea1bca449b91 new entry
pontscho
parents:
diff changeset
81 GtkWidget * CB;
ea1bca449b91 new entry
pontscho
parents:
diff changeset
82 CB=gtk_check_button_new_with_label( title );
ea1bca449b91 new entry
pontscho
parents:
diff changeset
83 gtk_widget_set_name( CB,"CB" );
ea1bca449b91 new entry
pontscho
parents:
diff changeset
84 gtk_widget_show( CB );
ea1bca449b91 new entry
pontscho
parents:
diff changeset
85 gtk_box_pack_start( GTK_BOX( parent ),CB,FALSE,FALSE,0 );
ea1bca449b91 new entry
pontscho
parents:
diff changeset
86 return CB;
ea1bca449b91 new entry
pontscho
parents:
diff changeset
87 }
ea1bca449b91 new entry
pontscho
parents:
diff changeset
88
19081
273bdef43012 Mark several string parameters that are not modified in the function as const.
diego
parents: 9055
diff changeset
89 GtkWidget * AddRadioButton( const char * title,GSList ** group,GtkWidget * parent )
8172
ea1bca449b91 new entry
pontscho
parents:
diff changeset
90 {
ea1bca449b91 new entry
pontscho
parents:
diff changeset
91 GtkWidget * RB;
ea1bca449b91 new entry
pontscho
parents:
diff changeset
92 RB=gtk_radio_button_new_with_label( *group,title );
ea1bca449b91 new entry
pontscho
parents:
diff changeset
93 *group=gtk_radio_button_group( GTK_RADIO_BUTTON( RB ) );
ea1bca449b91 new entry
pontscho
parents:
diff changeset
94 gtk_widget_set_name( RB,"RB" );
ea1bca449b91 new entry
pontscho
parents:
diff changeset
95 gtk_widget_show( RB );
ea1bca449b91 new entry
pontscho
parents:
diff changeset
96 gtk_box_pack_start( GTK_BOX( parent ),RB,FALSE,FALSE,0 );
ea1bca449b91 new entry
pontscho
parents:
diff changeset
97 return RB;
ea1bca449b91 new entry
pontscho
parents:
diff changeset
98 }
ea1bca449b91 new entry
pontscho
parents:
diff changeset
99
19081
273bdef43012 Mark several string parameters that are not modified in the function as const.
diego
parents: 9055
diff changeset
100 GtkWidget * AddButton( const char * title,GtkWidget * parent )
8172
ea1bca449b91 new entry
pontscho
parents:
diff changeset
101 {
ea1bca449b91 new entry
pontscho
parents:
diff changeset
102 GtkWidget * B;
ea1bca449b91 new entry
pontscho
parents:
diff changeset
103 B=gtk_button_new_with_label( title );
ea1bca449b91 new entry
pontscho
parents:
diff changeset
104 gtk_widget_set_name( B,"B" );
ea1bca449b91 new entry
pontscho
parents:
diff changeset
105 gtk_widget_show( B );
ea1bca449b91 new entry
pontscho
parents:
diff changeset
106 gtk_container_add( GTK_CONTAINER( parent ),B );
ea1bca449b91 new entry
pontscho
parents:
diff changeset
107 return B;
ea1bca449b91 new entry
pontscho
parents:
diff changeset
108 }
ea1bca449b91 new entry
pontscho
parents:
diff changeset
109
ea1bca449b91 new entry
pontscho
parents:
diff changeset
110 GtkWidget * AddHSeparator( GtkWidget * parent )
ea1bca449b91 new entry
pontscho
parents:
diff changeset
111 {
ea1bca449b91 new entry
pontscho
parents:
diff changeset
112 GtkWidget * hseparator;
ea1bca449b91 new entry
pontscho
parents:
diff changeset
113 hseparator=gtk_hseparator_new();
ea1bca449b91 new entry
pontscho
parents:
diff changeset
114 gtk_widget_set_name( hseparator,"hseparator1" );
ea1bca449b91 new entry
pontscho
parents:
diff changeset
115 gtk_widget_show( hseparator );
ea1bca449b91 new entry
pontscho
parents:
diff changeset
116 gtk_box_pack_start( GTK_BOX( parent ),hseparator,FALSE,FALSE,0 );
ea1bca449b91 new entry
pontscho
parents:
diff changeset
117 gtk_widget_set_usize( hseparator,-2,6 );
ea1bca449b91 new entry
pontscho
parents:
diff changeset
118 return hseparator;
ea1bca449b91 new entry
pontscho
parents:
diff changeset
119 }
ea1bca449b91 new entry
pontscho
parents:
diff changeset
120
ea1bca449b91 new entry
pontscho
parents:
diff changeset
121 GtkWidget * AddHButtonBox( GtkWidget * parent )
ea1bca449b91 new entry
pontscho
parents:
diff changeset
122 {
ea1bca449b91 new entry
pontscho
parents:
diff changeset
123 GtkWidget * hbuttonbox;
ea1bca449b91 new entry
pontscho
parents:
diff changeset
124 hbuttonbox=gtk_hbutton_box_new();
ea1bca449b91 new entry
pontscho
parents:
diff changeset
125 gtk_widget_set_name( hbuttonbox,"hbuttonbox" );
ea1bca449b91 new entry
pontscho
parents:
diff changeset
126 gtk_widget_show( hbuttonbox );
ea1bca449b91 new entry
pontscho
parents:
diff changeset
127 gtk_box_pack_start( GTK_BOX( parent ),hbuttonbox,FALSE,FALSE,0 );
ea1bca449b91 new entry
pontscho
parents:
diff changeset
128 gtk_button_box_set_child_size( GTK_BUTTON_BOX( hbuttonbox ),85,20 );
ea1bca449b91 new entry
pontscho
parents:
diff changeset
129 return hbuttonbox;
ea1bca449b91 new entry
pontscho
parents:
diff changeset
130 }
ea1bca449b91 new entry
pontscho
parents:
diff changeset
131
ea1bca449b91 new entry
pontscho
parents:
diff changeset
132 GtkWidget * AddHScaler( GtkAdjustment * adj,GtkWidget * parent,int digit )
ea1bca449b91 new entry
pontscho
parents:
diff changeset
133 {
ea1bca449b91 new entry
pontscho
parents:
diff changeset
134 GtkWidget * HS;
ea1bca449b91 new entry
pontscho
parents:
diff changeset
135 HS=gtk_hscale_new( adj );
ea1bca449b91 new entry
pontscho
parents:
diff changeset
136 gtk_widget_set_name( HS,"HS" );
ea1bca449b91 new entry
pontscho
parents:
diff changeset
137 gtk_widget_show( HS );
ea1bca449b91 new entry
pontscho
parents:
diff changeset
138 if ( parent ) gtk_box_pack_start( GTK_BOX( parent ),HS,TRUE,TRUE,0 );
ea1bca449b91 new entry
pontscho
parents:
diff changeset
139 gtk_scale_set_value_pos( GTK_SCALE( HS ),GTK_POS_RIGHT );
ea1bca449b91 new entry
pontscho
parents:
diff changeset
140 gtk_scale_set_digits( GTK_SCALE( HS ),digit );
ea1bca449b91 new entry
pontscho
parents:
diff changeset
141 return HS;
ea1bca449b91 new entry
pontscho
parents:
diff changeset
142 }
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
143
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
144 GtkWidget * AddVScaler( GtkAdjustment * adj,GtkWidget * parent,int digit )
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
145 {
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
146 GtkWidget * VS;
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
147 VS=gtk_vscale_new( adj );
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
148 gtk_widget_set_name( VS,"VS" );
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
149 gtk_widget_show( VS );
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
150 if ( parent ) gtk_box_pack_start( GTK_BOX( parent ),VS,TRUE,TRUE,0 );
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
151 // gtk_scale_set_value_pos( GTK_SCALE( VS ),GTK_POS_RIGHT );
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
152 if ( digit == -1 ) gtk_scale_set_draw_value( GTK_SCALE( VS ),FALSE );
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
153 else gtk_scale_set_digits( GTK_SCALE( VS ),digit );
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
154 return VS;
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
155 }
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
156
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
157 GtkWidget * AddComboBox( GtkWidget * parent )
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
158 {
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
159 GtkWidget * CB;
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
160 CB=gtk_combo_new();
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
161 gtk_widget_set_name( CB,"CB" );
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
162 gtk_widget_show( CB );
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
163 if ( parent ) gtk_box_pack_start( GTK_BOX( parent ),CB,TRUE,TRUE,0 );
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
164 return CB;
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8172
diff changeset
165 }