Mercurial > mplayer.hg
annotate gui/mplayer/gtk/eq.c @ 25234:02518a3daeef
Fix return type of getGtkEntryText, it must be const
author | reimar |
---|---|
date | Sun, 02 Dec 2007 16:50:33 +0000 |
parents | e564b9cd7290 |
children | 8a0adeba5910 |
rev | line source |
---|---|
23077 | 1 |
2 #include <stdlib.h> | |
3 #include <stdio.h> | |
4 #include <sys/types.h> | |
5 #include <sys/stat.h> | |
6 #include <unistd.h> | |
7 #include <string.h> | |
8 | |
9 #include <gdk/gdkkeysyms.h> | |
10 #include <gtk/gtk.h> | |
11 | |
12 #include "app.h" | |
13 #include "cfg.h" | |
14 #include "config.h" | |
15 #include "help_mp.h" | |
16 #include "libaf/equalizer.h" | |
17 #include "libvo/video_out.h" | |
23154
e564b9cd7290
Fix several implicit declarations of functions warnings.
diego
parents:
23077
diff
changeset
|
18 #include "stream/stream.h" |
e564b9cd7290
Fix several implicit declarations of functions warnings.
diego
parents:
23077
diff
changeset
|
19 #include "libmpdemux/demuxer.h" |
e564b9cd7290
Fix several implicit declarations of functions warnings.
diego
parents:
23077
diff
changeset
|
20 #include "libmpdemux/stheader.h" |
e564b9cd7290
Fix several implicit declarations of functions warnings.
diego
parents:
23077
diff
changeset
|
21 #include "libmpcodecs/dec_video.h" |
23077 | 22 #include "../widgets.h" |
23 | |
24 #include "eq.h" | |
25 #include "common.h" | |
26 | |
27 #define eqRange 15 | |
28 | |
29 GtkWidget * Equalizer = NULL; | |
30 static GtkWidget * EquConfig; | |
31 | |
32 static GtkWidget * Notebook; | |
33 static GtkWidget * ChannelsList; | |
34 static GtkWidget * VContrast, * VBrightness, * VHue, * VSaturation; | |
35 static GtkAdjustment * VContrastadj, * VBrightnessadj, * VHueadj, * VSaturationadj; | |
36 static GtkWidget * Ok, * Clear, * Config; | |
37 static GtkWidget * A3125, * A125, * A6250, * A250, * A500, * A1000, * A2000, * A4000, * A8000, * A16000; | |
38 static GtkAdjustment * A3125adj, * A125adj, * A6250adj, * A250adj, * A500adj, * A1000adj, * A2000adj, * A4000adj, * A8000adj, * A16000adj; | |
39 | |
40 static int Channel = -1; | |
41 | |
42 // --- | |
43 | |
44 char * gtkEquChannel1 = NULL; | |
45 char * gtkEquChannel2 = NULL; | |
46 char * gtkEquChannel3 = NULL; | |
47 char * gtkEquChannel4 = NULL; | |
48 char * gtkEquChannel5 = NULL; | |
49 char * gtkEquChannel6 = NULL; | |
50 | |
51 // --- | |
52 | |
53 void ShowEquConfig( void ); | |
54 void HideEquConfig( void ); | |
55 | |
56 static void eqSetBands( int channel ) | |
57 { | |
58 if ( channel < 0 ) channel=0; | |
59 gtk_adjustment_set_value( A3125adj,0.0f - gtkEquChannels[channel][0] ); | |
60 gtk_adjustment_set_value( A6250adj,0.0f - gtkEquChannels[channel][1] ); | |
61 gtk_adjustment_set_value( A125adj,0.0f - gtkEquChannels[channel][2] ); | |
62 gtk_adjustment_set_value( A250adj,0.0f - gtkEquChannels[channel][3] ); | |
63 gtk_adjustment_set_value( A500adj,0.0f - gtkEquChannels[channel][4] ); | |
64 gtk_adjustment_set_value( A1000adj,0.0f - gtkEquChannels[channel][5] ); | |
65 gtk_adjustment_set_value( A2000adj,0.0f - gtkEquChannels[channel][6] ); | |
66 gtk_adjustment_set_value( A4000adj,0.0f - gtkEquChannels[channel][7] ); | |
67 gtk_adjustment_set_value( A8000adj,0.0f - gtkEquChannels[channel][8] ); | |
68 gtk_adjustment_set_value( A16000adj,0.0f - gtkEquChannels[channel][9] ); | |
69 | |
70 if ( guiIntfStruct.sh_video ) | |
71 { | |
72 get_video_colors( guiIntfStruct.sh_video,"brightness",&vo_gamma_brightness ); | |
73 get_video_colors( guiIntfStruct.sh_video,"contrast",&vo_gamma_contrast ); | |
74 get_video_colors( guiIntfStruct.sh_video,"hue",&vo_gamma_hue ); | |
75 get_video_colors( guiIntfStruct.sh_video,"saturation",&vo_gamma_saturation ); | |
76 } | |
77 | |
78 gtk_adjustment_set_value( VContrastadj,(float)vo_gamma_contrast ); | |
79 gtk_adjustment_set_value( VBrightnessadj,(float)vo_gamma_brightness ); | |
80 gtk_adjustment_set_value( VHueadj,(float)vo_gamma_hue ); | |
81 gtk_adjustment_set_value( VSaturationadj,(float)vo_gamma_saturation ); | |
82 } | |
83 | |
84 static void eqSetChannelNames( void ) | |
85 { | |
86 gchar * str[2]; | |
87 gtk_clist_clear( GTK_CLIST( ChannelsList ) ); | |
88 str[1]=""; | |
89 str[0]=MSGTR_EQU_All; | |
90 gtk_clist_append( GTK_CLIST( ChannelsList ) ,str); | |
91 if ( guiIntfStruct.AudioType > 1 ) | |
92 { | |
93 str[0]=gtkEquChannel1; gtk_clist_append( GTK_CLIST( ChannelsList ) ,str); | |
94 str[0]=gtkEquChannel2; gtk_clist_append( GTK_CLIST( ChannelsList ) ,str); | |
95 } | |
96 if ( guiIntfStruct.AudioType > 2 ) | |
97 { | |
98 str[0]=gtkEquChannel3; gtk_clist_append( GTK_CLIST( ChannelsList ) ,str); | |
99 str[0]=gtkEquChannel4; gtk_clist_append( GTK_CLIST( ChannelsList ) ,str); | |
100 } | |
101 if ( guiIntfStruct.AudioType > 4 ) | |
102 { | |
103 str[0]=gtkEquChannel5; gtk_clist_append( GTK_CLIST( ChannelsList ) ,str); | |
104 str[0]=gtkEquChannel6; gtk_clist_append( GTK_CLIST( ChannelsList ) ,str); | |
105 } | |
106 gtk_clist_select_row( GTK_CLIST( ChannelsList ),0,0 ); | |
107 } | |
108 | |
109 void ShowEqualizer( void ) | |
110 { | |
111 if ( Equalizer ) gtkActive( Equalizer ); | |
112 else Equalizer=create_Equalizer(); | |
113 | |
114 if ( !gtkEquChannel1 ) gtkEquChannel1=strdup( MSGTR_EQU_Front_Right ); | |
115 if ( !gtkEquChannel2 ) gtkEquChannel2=strdup( MSGTR_EQU_Front_Left ); | |
116 if ( !gtkEquChannel3 ) gtkEquChannel3=strdup( MSGTR_EQU_Back_Right ); | |
117 if ( !gtkEquChannel4 ) gtkEquChannel4=strdup( MSGTR_EQU_Back_Left ); | |
118 if ( !gtkEquChannel5 ) gtkEquChannel5=strdup( MSGTR_EQU_Center ); | |
119 if ( !gtkEquChannel6 ) gtkEquChannel6=strdup( MSGTR_EQU_Bass ); | |
120 | |
121 eqSetChannelNames(); | |
122 | |
123 if ( !guiIntfStruct.Playing || !guiIntfStruct.sh_video ) | |
124 { | |
125 gtk_widget_set_sensitive( VContrast,FALSE ); | |
126 gtk_widget_set_sensitive( VBrightness,FALSE ); | |
127 gtk_widget_set_sensitive( VHue,FALSE ); | |
128 gtk_widget_set_sensitive( VSaturation,FALSE ); | |
129 } | |
130 Channel=-1; | |
131 eqSetBands( 0 ); | |
132 if ( !guiIntfStruct.Playing || !gtkEnableAudioEqualizer ) | |
133 { | |
134 gtk_widget_set_sensitive( ChannelsList,FALSE ); | |
135 gtk_widget_set_sensitive( A3125,FALSE ); | |
136 gtk_widget_set_sensitive( A125,FALSE ); | |
137 gtk_widget_set_sensitive( A6250,FALSE ); | |
138 gtk_widget_set_sensitive( A250,FALSE ); | |
139 gtk_widget_set_sensitive( A500,FALSE ); | |
140 gtk_widget_set_sensitive( A1000,FALSE ); | |
141 gtk_widget_set_sensitive( A2000,FALSE ); | |
142 gtk_widget_set_sensitive( A4000,FALSE ); | |
143 gtk_widget_set_sensitive( A8000,FALSE ); | |
144 gtk_widget_set_sensitive( A16000,FALSE ); | |
145 } | |
146 | |
147 if ( gtk_notebook_get_current_page( GTK_NOTEBOOK( Notebook ) ) == 0 ) gtk_widget_show( Config ); | |
148 gtk_widget_show( Equalizer ); | |
149 } | |
150 | |
151 void HideEqualizer( void ) | |
152 { | |
153 if ( !Equalizer ) return; | |
154 gtk_widget_hide( Equalizer ); | |
155 gtk_widget_destroy( Equalizer ); | |
156 Equalizer=NULL; | |
157 if ( EquConfig ) HideEquConfig(); | |
158 } | |
159 | |
160 static gboolean eqHScaleMotion( GtkWidget * widget,GdkEventMotion * event,gpointer user_data ) | |
161 { | |
162 equalizer_t eq; | |
163 switch ( (int)user_data ) | |
164 { | |
165 case 0: eq.gain=A3125adj->value; break; | |
166 case 1: eq.gain=A6250adj->value; break; | |
167 case 2: eq.gain=A125adj->value; break; | |
168 case 3: eq.gain=A250adj->value; break; | |
169 case 4: eq.gain=A500adj->value; break; | |
170 case 5: eq.gain=A1000adj->value; break; | |
171 case 6: eq.gain=A2000adj->value; break; | |
172 case 7: eq.gain=A4000adj->value; break; | |
173 case 8: eq.gain=A8000adj->value; break; | |
174 case 9: eq.gain=A16000adj->value; break; | |
175 default: return FALSE; | |
176 } | |
177 eq.gain=0.0f - eq.gain; | |
178 eq.band=(int)user_data; | |
179 if ( Channel == -1 ) | |
180 { | |
181 int i; | |
182 for ( i=0;i<6;i++ ) | |
183 { eq.channel=i; gtkSet( gtkSetEqualizer,0,&eq ); } | |
184 } else { eq.channel=Channel; gtkSet( gtkSetEqualizer,0,&eq ); } | |
185 | |
186 return FALSE; | |
187 } | |
188 | |
189 static gboolean eqVScaleMotion( GtkWidget * widget,GdkEventMotion * event,gpointer user_data ) | |
190 { | |
191 | |
192 switch( (int)user_data ) | |
193 { | |
194 case 1: gtkSet( gtkSetContrast,VContrastadj->value,NULL ); break; | |
195 case 2: gtkSet( gtkSetBrightness,VBrightnessadj->value,NULL ); break; | |
196 case 3: gtkSet( gtkSetHue,VHueadj->value,NULL ); break; | |
197 case 4: gtkSet( gtkSetSaturation,VSaturationadj->value,NULL ); break; | |
198 } | |
199 | |
200 return FALSE; | |
201 } | |
202 | |
203 static void eqButtonReleased( GtkButton * button,gpointer user_data ) | |
204 { | |
205 switch( (int)user_data ) | |
206 { | |
207 case 0: HideEqualizer(); break; | |
208 case 1: | |
209 if ( gtk_notebook_get_current_page( GTK_NOTEBOOK( Notebook ) ) == 0 ) | |
210 { | |
211 if ( !guiIntfStruct.Playing || !gtkEnableAudioEqualizer ) break; | |
212 gtkSet( gtkSetEqualizer,0,NULL ); | |
213 eqSetBands( Channel ); | |
214 } | |
215 else | |
216 { | |
217 if ( !guiIntfStruct.Playing ) break; | |
218 gtkSet( gtkSetContrast,0.0f,NULL ); | |
219 gtkSet( gtkSetBrightness,0.0f,NULL ); | |
220 gtkSet( gtkSetHue,0.0f,NULL ); | |
221 gtkSet( gtkSetSaturation,0.0f,NULL ); | |
222 eqSetBands( Channel ); | |
223 } | |
224 break; | |
225 case 2: | |
226 ShowEquConfig(); | |
227 break; | |
228 } | |
229 } | |
230 | |
231 static void eqFocus( GtkWindow * window,GtkWidget * widget,gpointer user_data ) | |
232 { eqSetBands( Channel ); } | |
233 | |
234 static void eqSelectChannelsListRow( GtkCList * clist,gint row,gint column,GdkEvent * event,gpointer user_data ) | |
235 { | |
236 Channel=row - 1; | |
237 eqSetBands( Channel ); | |
238 if ( Channel == -1 ) | |
239 { | |
240 int i,j; equalizer_t eq; | |
241 for ( i=1;i<6;i++ ) | |
242 for ( j=0;j<10;j++ ) | |
243 { eq.band=j; eq.channel=i; eq.gain=gtkEquChannels[0][j]; gtkSet( gtkSetEqualizer,0,&eq ); } | |
244 } | |
245 } | |
246 | |
247 void eqNotebook( GtkNotebook * notebook,GtkNotebookPage * page,gint page_num,gpointer user_data ) | |
248 { | |
249 if ( page_num ) gtk_widget_hide( Config ); | |
250 else gtk_widget_show( Config ); | |
251 } | |
252 | |
253 GtkWidget * create_Equalizer( void ) | |
254 { | |
255 GtkWidget * vbox1; | |
256 GtkWidget * hbox1; | |
257 GtkWidget * scrolledwindow1; | |
258 GtkWidget * table1; | |
259 GtkWidget * hbuttonbox1; | |
260 GtkAccelGroup * accel_group; | |
261 | |
262 accel_group=gtk_accel_group_new(); | |
263 | |
264 Equalizer=gtk_window_new( GTK_WINDOW_TOPLEVEL ); | |
265 gtk_widget_set_name( Equalizer,MSGTR_Equalizer ); | |
266 gtk_object_set_data( GTK_OBJECT( Equalizer ),MSGTR_Equalizer,Equalizer ); | |
267 gtk_widget_set_usize( Equalizer,-1,256 ); | |
268 gtk_window_set_title( GTK_WINDOW( Equalizer ),MSGTR_Equalizer ); | |
269 gtk_window_set_position( GTK_WINDOW( Equalizer ),GTK_WIN_POS_CENTER ); | |
270 gtk_window_set_policy( GTK_WINDOW( Equalizer ),FALSE,FALSE,FALSE ); | |
271 gtk_window_set_wmclass( GTK_WINDOW( Equalizer ),"Equalizer","MPlayer" ); | |
272 | |
273 gtk_widget_realize( Equalizer ); | |
274 gtkAddIcon( Equalizer ); | |
275 | |
276 vbox1=AddVBox( AddDialogFrame( Equalizer ),0 ); | |
277 | |
278 Notebook=gtk_notebook_new(); | |
279 gtk_widget_set_name( Notebook,"Notebook" ); | |
280 gtk_widget_show( Notebook ); | |
281 gtk_box_pack_start( GTK_BOX( vbox1 ),Notebook,TRUE,TRUE,0 ); | |
282 gtk_container_set_border_width( GTK_CONTAINER( Notebook ),1 ); | |
283 | |
284 hbox1=AddHBox( Notebook,0 ); | |
285 | |
286 scrolledwindow1=gtk_scrolled_window_new( NULL,NULL ); | |
287 gtk_widget_set_name( scrolledwindow1,"scrolledwindow1" ); | |
288 gtk_widget_show( scrolledwindow1 ); | |
289 gtk_box_pack_start( GTK_BOX( hbox1 ),scrolledwindow1,FALSE,FALSE,0 ); | |
290 gtk_widget_set_usize( scrolledwindow1,106,-2 ); | |
291 gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow1 ),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC ); | |
292 | |
293 ChannelsList=gtk_clist_new( 1 ); | |
294 gtk_widget_set_name( ChannelsList,"ChannelsList" ); | |
295 gtk_widget_show( ChannelsList ); | |
296 gtk_container_add( GTK_CONTAINER( scrolledwindow1 ),ChannelsList ); | |
297 gtk_clist_set_column_width( GTK_CLIST( ChannelsList ),0,80 ); | |
298 gtk_clist_column_titles_hide( GTK_CLIST( ChannelsList ) ); | |
299 | |
300 table1=gtk_table_new( 2,10,FALSE ); | |
301 gtk_widget_set_name( table1,"table1" ); | |
302 gtk_widget_show( table1 ); | |
303 gtk_box_pack_start( GTK_BOX( hbox1 ),table1,FALSE,FALSE,0 ); | |
304 gtk_table_set_row_spacings( GTK_TABLE( table1 ),4 ); | |
305 gtk_table_set_col_spacings( GTK_TABLE( table1 ),9 ); | |
306 | |
307 A3125adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) ); | |
308 A3125=AddVScaler( A3125adj,NULL,-1 ); | |
309 gtk_table_attach( GTK_TABLE( table1 ),A3125,0,1,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 ); | |
310 | |
311 A6250adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) ); | |
312 A6250=AddVScaler( A6250adj,NULL,-1 ); | |
313 gtk_table_attach( GTK_TABLE( table1 ),A6250,1,2,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 ); | |
314 | |
315 A125adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) ); | |
316 A125=AddVScaler( A125adj,NULL,-1 ); | |
317 gtk_table_attach( GTK_TABLE( table1 ),A125,2,3,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 ); | |
318 | |
319 A250adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) ); | |
320 A250=AddVScaler( A250adj,NULL,-1 ); | |
321 gtk_table_attach( GTK_TABLE( table1 ),A250,3,4,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 ); | |
322 | |
323 A500adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) ); | |
324 A500=AddVScaler( A500adj,NULL,-1 ); | |
325 gtk_table_attach( GTK_TABLE( table1 ),A500,4,5,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 ); | |
326 | |
327 A1000adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) ); | |
328 A1000=AddVScaler( A1000adj,NULL,-1 ); | |
329 gtk_table_attach( GTK_TABLE( table1 ),A1000,5,6,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 ); | |
330 | |
331 A2000adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) ); | |
332 A2000=AddVScaler( A2000adj,NULL,-1 ); | |
333 gtk_table_attach( GTK_TABLE( table1 ),A2000,6,7,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 ); | |
334 | |
335 A4000adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) ); | |
336 A4000=AddVScaler( A4000adj,NULL,-1 ); | |
337 gtk_table_attach( GTK_TABLE( table1 ),A4000,7,8,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 ); | |
338 | |
339 A8000adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) ); | |
340 A8000=AddVScaler( A8000adj,NULL,-1 ); | |
341 gtk_table_attach( GTK_TABLE( table1 ),A8000,8,9,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 ); | |
342 | |
343 A16000adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) ); | |
344 A16000=AddVScaler( A16000adj,NULL,-1 ); | |
345 gtk_table_attach( GTK_TABLE( table1 ),A16000,9,10,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 ); | |
346 | |
347 gtk_table_attach( GTK_TABLE( table1 ), | |
348 AddLabel( "31.25",NULL ), | |
349 0,1,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); | |
350 | |
351 gtk_table_attach( GTK_TABLE( table1 ), | |
352 AddLabel( "62.50",NULL ), | |
353 1,2,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); | |
354 | |
355 gtk_table_attach( GTK_TABLE( table1 ), | |
356 AddLabel( "125",NULL ), | |
357 2,3,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); | |
358 | |
359 gtk_table_attach( GTK_TABLE( table1 ), | |
360 AddLabel( "250",NULL ), | |
361 3,4,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); | |
362 | |
363 gtk_table_attach( GTK_TABLE( table1 ), | |
364 AddLabel( "500",NULL ), | |
365 4,5,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); | |
366 | |
367 gtk_table_attach( GTK_TABLE( table1 ), | |
368 AddLabel( "1000",NULL ), | |
369 5,6,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); | |
370 | |
371 gtk_table_attach( GTK_TABLE( table1 ), | |
372 AddLabel( "2000",NULL ), | |
373 6,7,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); | |
374 | |
375 gtk_table_attach( GTK_TABLE( table1 ), | |
376 AddLabel( "4000",NULL ), | |
377 7,8,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); | |
378 | |
379 gtk_table_attach( GTK_TABLE( table1 ), | |
380 AddLabel( "8000",NULL ), | |
381 8,9,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); | |
382 | |
383 gtk_table_attach( GTK_TABLE( table1 ), | |
384 AddLabel( "16000",NULL ), | |
385 9,10,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); | |
386 | |
387 gtk_notebook_set_tab_label( GTK_NOTEBOOK( Notebook ),gtk_notebook_get_nth_page( GTK_NOTEBOOK( Notebook ),0 ), | |
388 AddLabel( MSGTR_EQU_Audio,NULL ) ); | |
389 | |
390 table1=gtk_table_new( 4,2,FALSE ); | |
391 gtk_widget_set_name( table1,"table1" ); | |
392 gtk_widget_show( table1 ); | |
393 gtk_container_add( GTK_CONTAINER( Notebook ),table1 ); | |
394 | |
395 gtk_table_attach( GTK_TABLE( table1 ), | |
396 AddLabel( MSGTR_EQU_Contrast,NULL ), | |
397 0,1,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); | |
398 | |
399 gtk_table_attach( GTK_TABLE( table1 ), | |
400 AddLabel( MSGTR_EQU_Brightness,NULL ), | |
401 0,1,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); | |
402 | |
403 gtk_table_attach( GTK_TABLE( table1 ), | |
404 AddLabel( MSGTR_EQU_Hue,NULL ), | |
405 0,1,2,3,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); | |
406 | |
407 gtk_table_attach( GTK_TABLE( table1 ), | |
408 AddLabel( MSGTR_EQU_Saturation,NULL ), | |
409 0,1,3,4,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); | |
410 | |
411 VContrastadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-100,100,1,0,0 ) ); | |
412 VContrast=AddHScaler( VContrastadj,NULL,1 ); | |
413 gtk_table_attach( GTK_TABLE( table1 ),VContrast,1,2,0,1,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); | |
414 gtk_widget_set_usize( VContrast,-1,45 ); | |
415 | |
416 VBrightnessadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-100,100,1,0,0 ) ); | |
417 VBrightness=AddHScaler( VBrightnessadj,NULL,1 ); | |
418 gtk_table_attach( GTK_TABLE( table1 ),VBrightness,1,2,1,2,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); | |
419 gtk_widget_set_usize( VBrightness,-1,45 ); | |
420 | |
421 VHueadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-100,100,1,0,0 ) ); | |
422 VHue=AddHScaler( VHueadj,NULL,1 ); | |
423 gtk_table_attach( GTK_TABLE( table1 ),VHue,1,2,2,3,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); | |
424 gtk_widget_set_usize( VHue,-1,45 ); | |
425 | |
426 VSaturationadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-100,100,1,0,0 ) ); | |
427 VSaturation=AddHScaler( VSaturationadj,NULL,1 ); | |
428 gtk_table_attach( GTK_TABLE( table1 ),VSaturation,1,2,3,4,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); | |
429 gtk_widget_set_usize( VSaturation,-1,45 ); | |
430 | |
431 gtk_notebook_set_tab_label( GTK_NOTEBOOK( Notebook ),gtk_notebook_get_nth_page( GTK_NOTEBOOK( Notebook ),1 ), | |
432 AddLabel( MSGTR_EQU_Video,NULL ) ); | |
433 | |
434 AddHSeparator( vbox1 ); | |
435 | |
436 hbuttonbox1=AddHButtonBox( vbox1 ); | |
437 gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox1 ),GTK_BUTTONBOX_END ); | |
438 gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox1 ),10 ); | |
439 | |
440 Config=AddButton( MSGTR_Config,hbuttonbox1 ); | |
441 Clear=AddButton( MSGTR_Clear,hbuttonbox1 ); | |
442 Ok=AddButton( MSGTR_Ok,hbuttonbox1 ); | |
443 | |
444 gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE ); | |
445 gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE ); | |
446 | |
447 gtk_signal_connect( GTK_OBJECT( Equalizer ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&Equalizer ); | |
448 gtk_signal_connect( GTK_OBJECT( Equalizer ),"focus_in_event",GTK_SIGNAL_FUNC( eqFocus ),(void *)2 ); | |
449 | |
450 gtk_signal_connect( GTK_OBJECT( ChannelsList ),"select_row",GTK_SIGNAL_FUNC( eqSelectChannelsListRow ),NULL ); | |
451 | |
452 gtk_signal_connect( GTK_OBJECT( A3125 ),"motion_notify_event",GTK_SIGNAL_FUNC( eqHScaleMotion ),(void*)0 ); | |
453 gtk_signal_connect( GTK_OBJECT( A6250 ),"motion_notify_event",GTK_SIGNAL_FUNC( eqHScaleMotion ),(void*)1 ); | |
454 gtk_signal_connect( GTK_OBJECT( A125 ),"motion_notify_event",GTK_SIGNAL_FUNC( eqHScaleMotion ),(void*)2 ); | |
455 gtk_signal_connect( GTK_OBJECT( A250 ),"motion_notify_event",GTK_SIGNAL_FUNC( eqHScaleMotion ),(void*)3 ); | |
456 gtk_signal_connect( GTK_OBJECT( A500 ),"motion_notify_event",GTK_SIGNAL_FUNC( eqHScaleMotion ),(void*)4 ); | |
457 gtk_signal_connect( GTK_OBJECT( A1000 ),"motion_notify_event",GTK_SIGNAL_FUNC( eqHScaleMotion ),(void*)5 ); | |
458 gtk_signal_connect( GTK_OBJECT( A2000 ),"motion_notify_event",GTK_SIGNAL_FUNC( eqHScaleMotion ),(void*)6 ); | |
459 gtk_signal_connect( GTK_OBJECT( A4000 ),"motion_notify_event",GTK_SIGNAL_FUNC( eqHScaleMotion ),(void*)7 ); | |
460 gtk_signal_connect( GTK_OBJECT( A8000 ),"motion_notify_event",GTK_SIGNAL_FUNC( eqHScaleMotion ),(void*)8 ); | |
461 gtk_signal_connect( GTK_OBJECT( A16000 ),"motion_notify_event",GTK_SIGNAL_FUNC( eqHScaleMotion ),(void*)9 ); | |
462 | |
463 gtk_signal_connect( GTK_OBJECT( VContrast ),"motion_notify_event",GTK_SIGNAL_FUNC( eqVScaleMotion ),(void*)1 ); | |
464 gtk_signal_connect( GTK_OBJECT( VBrightness ),"motion_notify_event",GTK_SIGNAL_FUNC( eqVScaleMotion ),(void*)2 ); | |
465 gtk_signal_connect( GTK_OBJECT( VHue ),"motion_notify_event",GTK_SIGNAL_FUNC( eqVScaleMotion ),(void*)3 ); | |
466 gtk_signal_connect( GTK_OBJECT( VSaturation ),"motion_notify_event",GTK_SIGNAL_FUNC( eqVScaleMotion ),(void *)4 ); | |
467 | |
468 gtk_signal_connect( GTK_OBJECT( Ok ),"clicked",GTK_SIGNAL_FUNC( eqButtonReleased ),(void *)0 ); | |
469 gtk_signal_connect( GTK_OBJECT( Clear ),"clicked",GTK_SIGNAL_FUNC( eqButtonReleased ),(void *)1 ); | |
470 gtk_signal_connect( GTK_OBJECT( Config ),"clicked",GTK_SIGNAL_FUNC( eqButtonReleased ),(void *)2 ); | |
471 | |
472 gtk_signal_connect( GTK_OBJECT( Notebook ),"switch_page",GTK_SIGNAL_FUNC( eqNotebook ),NULL ); | |
473 | |
474 gtk_window_add_accel_group( GTK_WINDOW( Equalizer ),accel_group ); | |
475 | |
476 return Equalizer; | |
477 } | |
478 | |
479 // --- equalizer config dialog box | |
480 | |
481 static GtkWidget * CBChannel1; | |
482 static GtkWidget * CEChannel1; | |
483 static GtkWidget * CBChannel2; | |
484 static GtkWidget * CEChannel2; | |
485 static GtkWidget * CBChannel3; | |
486 static GtkWidget * CEChannel3; | |
487 static GtkWidget * CBChannel4; | |
488 static GtkWidget * CEChannel4; | |
489 static GtkWidget * CBChannel5; | |
490 static GtkWidget * CEChannel5; | |
491 static GtkWidget * CBChannel6; | |
492 static GtkWidget * CEChannel6; | |
493 static GtkWidget * ecOk; | |
494 static GtkWidget * ecCancel; | |
495 | |
496 GtkWidget * create_EquConfig( void ); | |
497 | |
498 void ShowEquConfig( void ) | |
499 { | |
500 GList * Items = NULL; | |
501 | |
502 if ( EquConfig ) gtkActive( EquConfig ); | |
503 else EquConfig=create_EquConfig(); | |
504 | |
505 Items=g_list_append( Items,(gpointer)MSGTR_EQU_Front_Right ); | |
506 Items=g_list_append( Items,(gpointer)MSGTR_EQU_Front_Left ); | |
507 Items=g_list_append( Items,(gpointer)MSGTR_EQU_Back_Right ); | |
508 Items=g_list_append( Items,(gpointer)MSGTR_EQU_Back_Left ); | |
509 Items=g_list_append( Items,(gpointer)MSGTR_EQU_Center ); | |
510 Items=g_list_append( Items,(gpointer)MSGTR_EQU_Bass ); | |
511 | |
512 gtk_combo_set_popdown_strings( GTK_COMBO( CBChannel1 ),Items ); | |
513 gtk_combo_set_popdown_strings( GTK_COMBO( CBChannel2 ),Items ); | |
514 gtk_combo_set_popdown_strings( GTK_COMBO( CBChannel3 ),Items ); | |
515 gtk_combo_set_popdown_strings( GTK_COMBO( CBChannel4 ),Items ); | |
516 gtk_combo_set_popdown_strings( GTK_COMBO( CBChannel5 ),Items ); | |
517 gtk_combo_set_popdown_strings( GTK_COMBO( CBChannel6 ),Items ); | |
518 | |
519 g_list_free( Items ); | |
520 | |
521 gtk_entry_set_text( GTK_ENTRY( CEChannel1 ),gtkEquChannel1 ); gtk_entry_set_editable( GTK_ENTRY( CEChannel1 ),FALSE ); | |
522 gtk_entry_set_text( GTK_ENTRY( CEChannel2 ),gtkEquChannel2 ); gtk_entry_set_editable( GTK_ENTRY( CEChannel2 ),FALSE ); | |
523 gtk_entry_set_text( GTK_ENTRY( CEChannel3 ),gtkEquChannel3 ); gtk_entry_set_editable( GTK_ENTRY( CEChannel3 ),FALSE ); | |
524 gtk_entry_set_text( GTK_ENTRY( CEChannel4 ),gtkEquChannel4 ); gtk_entry_set_editable( GTK_ENTRY( CEChannel4 ),FALSE ); | |
525 gtk_entry_set_text( GTK_ENTRY( CEChannel5 ),gtkEquChannel5 ); gtk_entry_set_editable( GTK_ENTRY( CEChannel5 ),FALSE ); | |
526 gtk_entry_set_text( GTK_ENTRY( CEChannel6 ),gtkEquChannel6 ); gtk_entry_set_editable( GTK_ENTRY( CEChannel6 ),FALSE ); | |
527 | |
528 gtk_widget_show( EquConfig ); | |
529 gtkSetLayer( EquConfig ); | |
530 } | |
531 | |
532 void HideEquConfig( void ) | |
533 { | |
534 if ( !EquConfig ) return; | |
535 gtk_widget_hide( EquConfig ); | |
536 gtk_widget_destroy( EquConfig ); | |
537 EquConfig=NULL; | |
538 } | |
539 | |
540 static void ecButtonReleased( GtkButton * button,gpointer user_data ) | |
541 { | |
542 if ( (int)user_data ) | |
543 { // if you pressed Ok | |
544 gfree( (void **)>kEquChannel1 ); gtkEquChannel1=gstrdup( gtk_entry_get_text( GTK_ENTRY( CEChannel1 ) ) ); | |
545 gfree( (void **)>kEquChannel2 ); gtkEquChannel2=gstrdup( gtk_entry_get_text( GTK_ENTRY( CEChannel2 ) ) ); | |
546 gfree( (void **)>kEquChannel3 ); gtkEquChannel3=gstrdup( gtk_entry_get_text( GTK_ENTRY( CEChannel3 ) ) ); | |
547 gfree( (void **)>kEquChannel4 ); gtkEquChannel4=gstrdup( gtk_entry_get_text( GTK_ENTRY( CEChannel4 ) ) ); | |
548 gfree( (void **)>kEquChannel5 ); gtkEquChannel5=gstrdup( gtk_entry_get_text( GTK_ENTRY( CEChannel5 ) ) ); | |
549 gfree( (void **)>kEquChannel6 ); gtkEquChannel6=gstrdup( gtk_entry_get_text( GTK_ENTRY( CEChannel6 ) ) ); | |
550 eqSetChannelNames(); | |
551 } | |
552 HideEquConfig(); | |
553 } | |
554 | |
555 GtkWidget * create_EquConfig( void ) | |
556 { | |
557 GtkWidget * vbox1; | |
558 GtkWidget * table1; | |
559 GtkWidget * hbuttonbox1; | |
560 GtkAccelGroup * accel_group; | |
561 | |
562 accel_group=gtk_accel_group_new(); | |
563 | |
564 EquConfig=gtk_window_new( GTK_WINDOW_TOPLEVEL ); | |
565 gtk_widget_set_name( EquConfig,"EquConfig" ); | |
566 gtk_object_set_data( GTK_OBJECT( EquConfig ),"EquConfig",EquConfig ); | |
567 gtk_widget_set_usize( EquConfig,350,260 ); | |
568 GTK_WIDGET_SET_FLAGS( EquConfig,GTK_CAN_DEFAULT ); | |
569 gtk_window_set_title( GTK_WINDOW( EquConfig ),MSGTR_ConfigureEqualizer ); | |
570 gtk_window_set_position( GTK_WINDOW( EquConfig ),GTK_WIN_POS_CENTER ); | |
571 // gtk_window_set_modal( GTK_WINDOW( EquConfig ),TRUE ); | |
572 gtk_window_set_policy( GTK_WINDOW( EquConfig ),FALSE,FALSE,FALSE ); | |
573 gtk_window_set_wmclass( GTK_WINDOW( EquConfig ),"EquConfig","MPlayer" ); | |
574 | |
575 gtk_widget_realize( EquConfig ); | |
576 gtkAddIcon( EquConfig ); | |
577 | |
578 vbox1=AddVBox( AddDialogFrame( EquConfig ),0 ); | |
579 | |
580 table1=gtk_table_new( 6,2,FALSE ); | |
581 gtk_widget_set_name( table1,"table1" ); | |
582 gtk_widget_show( table1 ); | |
583 gtk_box_pack_start( GTK_BOX( vbox1 ),table1,TRUE,TRUE,0 ); | |
584 gtk_table_set_row_spacings( GTK_TABLE( table1 ),4 ); | |
585 gtk_table_set_col_spacings( GTK_TABLE( table1 ),4 ); | |
586 | |
587 gtk_table_attach( GTK_TABLE( table1 ), | |
588 AddLabel( MSGTR_EQU_Channel1,NULL ), | |
589 0,1,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); | |
590 | |
591 gtk_table_attach( GTK_TABLE( table1 ), | |
592 AddLabel( MSGTR_EQU_Channel2,NULL ), | |
593 0,1,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); | |
594 | |
595 gtk_table_attach( GTK_TABLE( table1 ), | |
596 AddLabel( MSGTR_EQU_Channel3,NULL ), | |
597 0,1,2,3,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); | |
598 | |
599 gtk_table_attach( GTK_TABLE( table1 ), | |
600 AddLabel( MSGTR_EQU_Channel4,NULL ), | |
601 0,1,3,4,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); | |
602 | |
603 gtk_table_attach( GTK_TABLE( table1 ), | |
604 AddLabel( MSGTR_EQU_Channel5,NULL ), | |
605 0,1,4,5,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); | |
606 | |
607 gtk_table_attach( GTK_TABLE( table1 ), | |
608 AddLabel( MSGTR_EQU_Channel6,NULL ), | |
609 0,1,5,6,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); | |
610 | |
611 CBChannel1=AddComboBox( NULL ); | |
612 gtk_table_attach( GTK_TABLE( table1 ),CBChannel1,1,2,0,1,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); | |
613 | |
614 CEChannel1=GTK_COMBO( CBChannel1 )->entry; | |
615 gtk_widget_set_name( CEChannel1,"CEChannel1" ); | |
616 gtk_widget_show( CEChannel1 ); | |
617 | |
618 CBChannel2=AddComboBox( NULL ); | |
619 gtk_table_attach( GTK_TABLE( table1 ),CBChannel2,1,2,1,2,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); | |
620 | |
621 CEChannel2=GTK_COMBO( CBChannel2 )->entry; | |
622 gtk_widget_set_name( CEChannel2,"CEChannel2" ); | |
623 gtk_widget_show( CEChannel2 ); | |
624 | |
625 CBChannel3=AddComboBox( NULL ); | |
626 gtk_table_attach( GTK_TABLE( table1 ),CBChannel3,1,2,2,3,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); | |
627 | |
628 CEChannel3=GTK_COMBO( CBChannel3 )->entry; | |
629 gtk_widget_set_name( CEChannel3,"CEChannel3" ); | |
630 gtk_widget_show( CEChannel3 ); | |
631 | |
632 CBChannel4=AddComboBox( NULL ); | |
633 gtk_table_attach( GTK_TABLE( table1 ),CBChannel4,1,2,3,4,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); | |
634 | |
635 CEChannel4=GTK_COMBO( CBChannel4 )->entry; | |
636 gtk_widget_set_name( CEChannel4,"CEChannel4" ); | |
637 gtk_widget_show( CEChannel4 ); | |
638 | |
639 CBChannel5=AddComboBox( NULL ); | |
640 gtk_table_attach( GTK_TABLE( table1 ),CBChannel5,1,2,4,5,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); | |
641 | |
642 CEChannel5=GTK_COMBO( CBChannel5 )->entry; | |
643 gtk_widget_set_name( CEChannel5,"CEChannel5" ); | |
644 gtk_widget_show( CEChannel5 ); | |
645 | |
646 CBChannel6=AddComboBox( NULL ); | |
647 gtk_table_attach( GTK_TABLE( table1 ),CBChannel6,1,2,5,6,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); | |
648 | |
649 CEChannel6=GTK_COMBO( CBChannel6 )->entry; | |
650 gtk_widget_set_name( CEChannel6,"CEChannel6" ); | |
651 gtk_widget_show( CEChannel6 ); | |
652 | |
653 AddHSeparator( vbox1 ); | |
654 | |
655 hbuttonbox1=AddHButtonBox( vbox1 ); | |
656 gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox1 ),GTK_BUTTONBOX_END ); | |
657 gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox1 ),10 ); | |
658 | |
659 ecOk=AddButton( MSGTR_Ok,hbuttonbox1 ); | |
660 ecCancel=AddButton( MSGTR_Cancel,hbuttonbox1 ); | |
661 | |
662 gtk_widget_add_accelerator( ecOk,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE ); | |
663 gtk_widget_add_accelerator( ecCancel,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE ); | |
664 | |
665 gtk_signal_connect( GTK_OBJECT( EquConfig ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&EquConfig ); | |
666 | |
667 gtk_signal_connect( GTK_OBJECT( ecOk ),"clicked",GTK_SIGNAL_FUNC( ecButtonReleased ),(void *)1 ); | |
668 gtk_signal_connect( GTK_OBJECT( ecCancel ),"clicked",GTK_SIGNAL_FUNC( ecButtonReleased ),(void *)0 ); | |
669 | |
670 gtk_window_add_accel_group( GTK_WINDOW( EquConfig ),accel_group ); | |
671 | |
672 return EquConfig; | |
673 } | |
674 |