Mercurial > audlegacy-plugins
comparison src/audiocompress/audacious-glue.c @ 12:3da1b8942b8b trunk
[svn] - remove src/Input src/Output src/Effect src/General src/Visualization src/Container
author | nenolod |
---|---|
date | Mon, 18 Sep 2006 03:14:20 -0700 |
parents | src/Effect/audiocompress/audacious-glue.c@088092a52fea |
children | d124034ebea3 |
comparison
equal
deleted
inserted
replaced
11:cff1d04026ae | 12:3da1b8942b8b |
---|---|
1 /* audacious-glue.c | |
2 ** Audacious effect plugin for AudioCompress | |
3 */ | |
4 | |
5 #include <stdio.h> | |
6 #include <stdlib.h> | |
7 #include <string.h> | |
8 #include <gtk/gtk.h> | |
9 #include <glib/gi18n.h> | |
10 #include "audacious/plugin.h" | |
11 #include "audacious/util.h" | |
12 #include "audacious/configdb.h" | |
13 | |
14 #include "config.h" | |
15 #include "compress.h" | |
16 | |
17 typedef struct { | |
18 gboolean anticlip; | |
19 gint target; | |
20 gint gainmax; | |
21 gint gainsmooth; | |
22 gint buckets; | |
23 | |
24 GtkWidget *dialog; | |
25 } CompressorPrefs; | |
26 | |
27 void initPrefs(CompressorPrefs *prefs); | |
28 void freePrefs(CompressorPrefs *prefs); | |
29 void showPrefs(CompressorPrefs *prefs); | |
30 void savePrefs(CompressorPrefs *prefs); | |
31 | |
32 static CompressorPrefs prefs; | |
33 static void myInit(void); | |
34 static void myCleanup(void); | |
35 static void myAbout(void); | |
36 static void myPrefs(void); | |
37 static int myModify(gpointer * data, gint length, AFormat fmt, | |
38 gint srate, gint nch); | |
39 | |
40 static int inited = 0; | |
41 | |
42 | |
43 static EffectPlugin xmms_plugin = { | |
44 NULL, NULL, | |
45 "AudioCompressor AGC plugin", | |
46 myInit, | |
47 myCleanup, | |
48 myAbout, | |
49 myPrefs, | |
50 myModify, | |
51 NULL | |
52 }; | |
53 | |
54 EffectPlugin *get_eplugin_info(void) | |
55 { | |
56 return &xmms_plugin; | |
57 } | |
58 | |
59 void myInit(void) | |
60 { | |
61 if (!inited) | |
62 { | |
63 initPrefs(&prefs); | |
64 CompressCfg(prefs.anticlip, | |
65 prefs.target, | |
66 prefs.gainmax, | |
67 prefs.gainsmooth, | |
68 prefs.buckets); | |
69 } | |
70 inited = 1; | |
71 } | |
72 | |
73 void myCleanup(void) | |
74 { | |
75 savePrefs(&prefs); | |
76 freePrefs(&prefs); | |
77 CompressFree(); | |
78 inited = 0; | |
79 } | |
80 | |
81 int myModify(gpointer * data, gint length, AFormat fmt, gint srate, gint nch) | |
82 { | |
83 if (fmt == FMT_S16_NE || | |
84 (fmt == FMT_S16_LE && G_BYTE_ORDER == G_LITTLE_ENDIAN) || | |
85 (fmt == FMT_S16_BE && G_BYTE_ORDER == G_BIG_ENDIAN)) | |
86 CompressDo(*data, length); | |
87 | |
88 return length; | |
89 } | |
90 | |
91 void myAbout(void) | |
92 { | |
93 static GtkWidget *about_xmms_compress = NULL; | |
94 if ( !about_xmms_compress ) | |
95 { | |
96 gchar *about_text = g_strjoin( "" , _("AudioCompress ") , ACVERSION , | |
97 _("\n(c)2003 trikuare studios(http://trikuare.cx)\n" | |
98 "Ported to Audacious by Tony Vroon (chainsaw@gentoo.org)\n\n" | |
99 "Simple dynamic range compressor for transparently\n" | |
100 "keeping the volume level more or less consistent") , NULL ); | |
101 | |
102 about_xmms_compress = xmms_show_message( _("About AudioCompress") , | |
103 about_text , _("Ok") , FALSE , NULL , NULL ); | |
104 gtk_signal_connect( GTK_OBJECT(about_xmms_compress) , "destroy" , | |
105 GTK_SIGNAL_FUNC(gtk_widget_destroyed), &about_xmms_compress ); | |
106 g_free( about_text ); | |
107 } | |
108 gtk_widget_show( about_xmms_compress ); | |
109 } | |
110 | |
111 void myPrefs(void) | |
112 { | |
113 myInit(); | |
114 showPrefs(&prefs); | |
115 } | |
116 | |
117 | |
118 GtkWidget *create_prefs_dialog(CompressorPrefs * prefs); | |
119 | |
120 /* Manage preferences */ | |
121 | |
122 void initPrefs(CompressorPrefs * prefs) | |
123 { | |
124 ConfigDb *db; | |
125 | |
126 db = bmp_cfg_db_open(); | |
127 | |
128 bmp_cfg_db_get_bool(db, "AudioCompress", | |
129 "anticlip", &prefs->anticlip); | |
130 bmp_cfg_db_get_int(db, "AudioCompress", "target", | |
131 &prefs->target); | |
132 bmp_cfg_db_get_int(db, "AudioCompress", "gainmax", | |
133 &prefs->gainmax); | |
134 bmp_cfg_db_get_int(db, "AudioCompress", | |
135 "gainsmooth", &prefs->gainsmooth); | |
136 bmp_cfg_db_get_int(db, "AudioCompress", "buckets", | |
137 &prefs->buckets); | |
138 | |
139 bmp_cfg_db_close(db); | |
140 | |
141 if ((prefs->gainmax == 0) && (prefs->gainsmooth == 0) && (prefs->buckets == 0)) { | |
142 prefs->anticlip = ANTICLIP; | |
143 prefs->target = TARGET; | |
144 prefs->gainmax = GAINMAX; | |
145 prefs->gainsmooth = GAINSMOOTH; | |
146 prefs->buckets = BUCKETS; | |
147 } | |
148 | |
149 prefs->dialog = create_prefs_dialog(prefs); | |
150 } | |
151 | |
152 void freePrefs(CompressorPrefs * prefs) | |
153 { | |
154 /* this shouldn't happen, but... */ | |
155 if (prefs == NULL || prefs->dialog == NULL) | |
156 return; | |
157 | |
158 gtk_widget_destroy(prefs->dialog); | |
159 } | |
160 | |
161 void savePrefs(CompressorPrefs * prefs) | |
162 { | |
163 ConfigDb *db; | |
164 | |
165 db = bmp_cfg_db_open(); | |
166 | |
167 bmp_cfg_db_set_bool(db, "AudioCompress", "anticlip", | |
168 prefs->anticlip); | |
169 bmp_cfg_db_set_int(db, "AudioCompress", "target", | |
170 prefs->target); | |
171 bmp_cfg_db_set_int(db, "AudioCompress", "gainmax", | |
172 prefs->gainmax); | |
173 bmp_cfg_db_set_int(db, "AudioCompress", "gainsmooth", | |
174 prefs->gainsmooth); | |
175 bmp_cfg_db_set_int(db, "AudioCompress", "buckets", | |
176 prefs->buckets); | |
177 | |
178 bmp_cfg_db_close(db); | |
179 } | |
180 | |
181 | |
182 /* Dialogs */ | |
183 | |
184 GtkWidget *lookup_widget(GtkWidget * widget, const gchar * widget_name) | |
185 { | |
186 GtkWidget *parent, *found_widget; | |
187 | |
188 for (;;) | |
189 { | |
190 if (GTK_IS_MENU(widget)) | |
191 parent = gtk_menu_get_attach_widget(GTK_MENU | |
192 (widget)); | |
193 else | |
194 parent = GTK_WIDGET(widget)->parent; | |
195 if (parent == NULL) | |
196 break; | |
197 widget = parent; | |
198 } | |
199 | |
200 found_widget =(GtkWidget *)g_object_get_data(G_OBJECT(widget), | |
201 widget_name); | |
202 if (!GTK_IS_WIDGET(found_widget)) | |
203 g_warning("Widget not found: %s", widget_name); | |
204 return found_widget; | |
205 } | |
206 | |
207 | |
208 /* Preferences dialog callbacks */ | |
209 | |
210 void close_window(GtkWidget * button, GtkWidget * win) | |
211 { | |
212 gtk_widget_hide(GTK_WIDGET(win)); | |
213 } | |
214 | |
215 void on_apply_preferences_clicked(GtkWidget * wg, CompressorPrefs * prefs) | |
216 { | |
217 /* Read spinbuttons values and update variables */ | |
218 | |
219 GtkWidget *look; | |
220 | |
221 look = lookup_widget(prefs->dialog, "anticlip"); | |
222 prefs->anticlip = GTK_TOGGLE_BUTTON(look)->active; | |
223 | |
224 look = lookup_widget(prefs->dialog, "target"); | |
225 prefs->target = | |
226 gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(look)); | |
227 | |
228 look = lookup_widget(prefs->dialog, "gainmax"); | |
229 prefs->gainmax = | |
230 gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(look)); | |
231 | |
232 look = lookup_widget(prefs->dialog, "gainsmooth"); | |
233 prefs->gainsmooth = | |
234 gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(look)); | |
235 | |
236 look = lookup_widget(prefs->dialog, "buckets"); | |
237 prefs->buckets = | |
238 gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(look)); | |
239 | |
240 savePrefs(prefs); | |
241 CompressCfg(prefs->anticlip, prefs->target, prefs->gainmax, | |
242 prefs->gainsmooth, prefs->buckets); | |
243 } | |
244 | |
245 void | |
246 on_load_default_values_clicked(GtkWidget * wg, CompressorPrefs * prefs) | |
247 { | |
248 | |
249 /* When the button is pressed, sets the values from config.h */ | |
250 | |
251 GtkWidget *look; | |
252 | |
253 look = lookup_widget(prefs->dialog, "anticlip"); | |
254 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(look), FALSE); | |
255 | |
256 look = lookup_widget(prefs->dialog, "target"); | |
257 gtk_spin_button_set_value(GTK_SPIN_BUTTON(look),(gfloat)TARGET); | |
258 | |
259 look = lookup_widget(prefs->dialog, "gainmax"); | |
260 gtk_spin_button_set_value(GTK_SPIN_BUTTON(look),(gfloat)GAINMAX); | |
261 | |
262 look = lookup_widget(prefs->dialog, "gainsmooth"); | |
263 gtk_spin_button_set_value(GTK_SPIN_BUTTON(look), | |
264 (gfloat)GAINSMOOTH); | |
265 | |
266 look = lookup_widget(prefs->dialog, "buckets"); | |
267 gtk_spin_button_set_value(GTK_SPIN_BUTTON(look),(gfloat)BUCKETS); | |
268 | |
269 } | |
270 | |
271 void | |
272 on_ok_preferences_clicked(GtkWidget * wg, CompressorPrefs * prefs) | |
273 { | |
274 | |
275 /* The same as apply, but also closes the window */ | |
276 | |
277 on_apply_preferences_clicked(NULL, prefs); | |
278 close_window(NULL, prefs->dialog); | |
279 | |
280 } | |
281 | |
282 /* Create / show prefs */ | |
283 | |
284 void showPrefs(CompressorPrefs * prefs) | |
285 { | |
286 | |
287 GtkWidget *look; | |
288 | |
289 /* Set values */ | |
290 | |
291 look = lookup_widget(prefs->dialog, "anticlip"); | |
292 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(look), | |
293 prefs->anticlip); | |
294 | |
295 look = lookup_widget(prefs->dialog, "target"); | |
296 gtk_spin_button_set_value(GTK_SPIN_BUTTON(look), prefs->target); | |
297 | |
298 look = lookup_widget(prefs->dialog, "gainmax"); | |
299 gtk_spin_button_set_value(GTK_SPIN_BUTTON(look), | |
300 (gfloat)prefs->gainmax); | |
301 | |
302 look = lookup_widget(prefs->dialog, "gainsmooth"); | |
303 gtk_spin_button_set_value(GTK_SPIN_BUTTON(look), | |
304 (gfloat)prefs->gainsmooth); | |
305 | |
306 look = lookup_widget(prefs->dialog, "buckets"); | |
307 gtk_spin_button_set_value(GTK_SPIN_BUTTON(look), | |
308 (gfloat)prefs->buckets); | |
309 | |
310 gtk_widget_show(prefs->dialog); | |
311 | |
312 } | |
313 | |
314 GtkWidget * | |
315 create_prefs_dialog(CompressorPrefs * prefs) | |
316 { | |
317 | |
318 /* Preferences dialog */ | |
319 | |
320 gchar *clip_tip = | |
321 "If checked, when the sound peaks the volume will be " | |
322 "cut instantly; otherwise, it will ramp down just in time " | |
323 "for the peak (but some minor clipping may still occur)."; | |
324 gchar *gainmax_tip = | |
325 "The maximum amount to amplify the audio by"; | |
326 gchar *gainsmooth_tip = | |
327 "Defines how smoothly the volume will ramp up"; | |
328 gchar *target_tip = | |
329 "The target audio level for ramping up. Lowering the " | |
330 "value gives a bit more dynamic range for peaks, but " | |
331 "will make the overall sound quieter."; | |
332 gchar *hist_text = "How long of a window to maintain"; | |
333 | |
334 GtkWidget *preferences; | |
335 GtkWidget *vbox2; | |
336 GtkWidget *notebook1; | |
337 GtkWidget *vbox5; | |
338 GtkWidget *frame1; | |
339 GtkWidget *clipping; | |
340 GtkWidget *frame2; | |
341 GtkWidget *table1; | |
342 GtkWidget *label5; | |
343 GtkWidget *label6; | |
344 GtkWidget *label7; | |
345 GtkObject *gainmax_adj; | |
346 GtkWidget *gainmax_sp; | |
347 GtkObject *gainsmooth_adj; | |
348 GtkWidget *gainsmooth_sp; | |
349 GtkObject *target_adj; | |
350 GtkWidget *target_sp; | |
351 GtkWidget *label4; | |
352 GtkWidget *hbuttonbox2; | |
353 GtkWidget *hbuttonbox7; | |
354 GtkWidget *button3; | |
355 GtkWidget *button4; | |
356 GtkWidget *button7; | |
357 GtkWidget *button8; | |
358 GtkWidget *frame3; | |
359 GtkWidget *table3; | |
360 GtkWidget *label9; | |
361 GtkWidget *buckets_sp; | |
362 GtkWidget *hseparator3; | |
363 GtkObject *buckets_adj; | |
364 GtkTooltips *tooltips; | |
365 | |
366 tooltips = gtk_tooltips_new(); | |
367 | |
368 preferences = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
369 g_object_set_data(G_OBJECT(preferences), "preferences", | |
370 preferences); | |
371 gtk_container_set_border_width(GTK_CONTAINER(preferences), 10); | |
372 gtk_window_set_title(GTK_WINDOW(preferences), | |
373 "AudioCompress preferences"); | |
374 gtk_window_set_policy(GTK_WINDOW(preferences), TRUE, TRUE, FALSE); | |
375 gtk_window_set_wmclass(GTK_WINDOW(preferences), "prefs", "xmms"); | |
376 | |
377 vbox2 = gtk_vbox_new(FALSE, 5); | |
378 gtk_widget_show(vbox2); | |
379 gtk_container_add(GTK_CONTAINER(preferences), vbox2); | |
380 | |
381 notebook1 = gtk_notebook_new(); | |
382 gtk_widget_show(notebook1); | |
383 gtk_box_pack_start(GTK_BOX(vbox2), notebook1, TRUE, TRUE, 0); | |
384 | |
385 vbox5 = gtk_vbox_new(FALSE, 5); | |
386 gtk_widget_show(vbox5); | |
387 gtk_container_add(GTK_CONTAINER(notebook1), vbox5); | |
388 gtk_container_set_border_width(GTK_CONTAINER(vbox5), 5); | |
389 | |
390 frame1 = gtk_frame_new(" Quality Options "); | |
391 gtk_widget_show(frame1); | |
392 gtk_box_pack_start(GTK_BOX(vbox5), frame1, FALSE, FALSE, 0); | |
393 | |
394 clipping = gtk_check_button_new_with_label | |
395 (" Aggressively prevent clipping"); | |
396 gtk_widget_ref(clipping); | |
397 g_object_set_data_full(G_OBJECT(preferences), "anticlip", | |
398 clipping, | |
399 (GtkDestroyNotify)gtk_widget_unref); | |
400 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(clipping), | |
401 prefs->anticlip); | |
402 gtk_widget_show(clipping); | |
403 gtk_container_add(GTK_CONTAINER(frame1), clipping); | |
404 gtk_container_set_border_width(GTK_CONTAINER(clipping), 5); | |
405 gtk_tooltips_set_tip(tooltips, clipping, clip_tip, NULL); | |
406 | |
407 frame2 = gtk_frame_new(" Target & gain"); | |
408 gtk_widget_show(frame2); | |
409 gtk_box_pack_start(GTK_BOX(vbox5), frame2, TRUE, TRUE, 0); | |
410 | |
411 table1 = gtk_table_new(4, 2, TRUE); | |
412 gtk_widget_show(table1); | |
413 gtk_container_add(GTK_CONTAINER(frame2), table1); | |
414 gtk_container_set_border_width(GTK_CONTAINER(table1), 5); | |
415 gtk_table_set_row_spacings(GTK_TABLE(table1), 5); | |
416 gtk_table_set_col_spacings(GTK_TABLE(table1), 5); | |
417 | |
418 label5 = gtk_label_new("Target audio level:"); | |
419 gtk_widget_show(label5); | |
420 gtk_table_attach(GTK_TABLE(table1), label5, 0, 1, 0, 1, | |
421 (GtkAttachOptions)(GTK_FILL), | |
422 (GtkAttachOptions)(0), 0, 0); | |
423 gtk_label_set_justify(GTK_LABEL(label5), GTK_JUSTIFY_RIGHT); | |
424 gtk_misc_set_alignment(GTK_MISC(label5), 0, 0.5); | |
425 | |
426 label6 = gtk_label_new("Maximum gain:"); | |
427 gtk_widget_show(label6); | |
428 gtk_table_attach(GTK_TABLE(table1), label6, 0, 1, 1, 2, | |
429 (GtkAttachOptions)(GTK_FILL), | |
430 (GtkAttachOptions)(0), 0, 0); | |
431 gtk_label_set_justify(GTK_LABEL(label6), GTK_JUSTIFY_LEFT); | |
432 gtk_misc_set_alignment(GTK_MISC(label6), 0, 0.5); | |
433 | |
434 label7 = gtk_label_new("Gain smooth:"); | |
435 gtk_widget_show(label7); | |
436 gtk_table_attach(GTK_TABLE(table1), label7, 0, 1, 2, 3, | |
437 (GtkAttachOptions)(GTK_FILL), | |
438 (GtkAttachOptions)(0), 0, 0); | |
439 gtk_label_set_justify(GTK_LABEL(label7), GTK_JUSTIFY_LEFT); | |
440 gtk_misc_set_alignment(GTK_MISC(label7), 0, 0.5); | |
441 | |
442 gainmax_adj = | |
443 gtk_adjustment_new(prefs->gainmax, 0, | |
444 1 << (31 - GAINSHIFT), 1, 2, 5); | |
445 gainmax_sp = gtk_spin_button_new(GTK_ADJUSTMENT(gainmax_adj), 1, 0); | |
446 gtk_widget_ref(gainmax_sp); | |
447 g_object_set_data_full(G_OBJECT(preferences), "gainmax", | |
448 gainmax_sp, | |
449 (GtkDestroyNotify)gtk_widget_unref); | |
450 gtk_widget_show(gainmax_sp); | |
451 gtk_table_attach(GTK_TABLE(table1), gainmax_sp, 1, 2, 1, 2, | |
452 (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), | |
453 (GtkAttachOptions)(GTK_FILL), 0, 0); | |
454 gtk_tooltips_set_tip(tooltips, gainmax_sp, gainmax_tip, NULL); | |
455 gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(gainmax_sp), TRUE); | |
456 | |
457 gainsmooth_adj = | |
458 gtk_adjustment_new(prefs->gainsmooth, 0, GAINSHIFT - 1, | |
459 1, 1, 1); | |
460 gainsmooth_sp = | |
461 gtk_spin_button_new(GTK_ADJUSTMENT(gainsmooth_adj), 1, 0); | |
462 gtk_widget_ref(gainsmooth_sp); | |
463 g_object_set_data_full(G_OBJECT(preferences), "gainsmooth", | |
464 gainsmooth_sp, | |
465 (GtkDestroyNotify)gtk_widget_unref); | |
466 gtk_widget_show(gainsmooth_sp); | |
467 gtk_table_attach(GTK_TABLE(table1), gainsmooth_sp, 1, 2, 2, 3, | |
468 (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), | |
469 (GtkAttachOptions)(0), 0, 0); | |
470 gtk_tooltips_set_tip(tooltips, gainsmooth_sp, gainsmooth_tip, NULL); | |
471 gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(gainsmooth_sp), TRUE); | |
472 | |
473 target_adj = gtk_adjustment_new(prefs->target, 0, 100000, 1, 10, 10); | |
474 target_sp = gtk_spin_button_new(GTK_ADJUSTMENT(target_adj), 1, 0); | |
475 gtk_widget_ref(target_sp); | |
476 g_object_set_data_full(G_OBJECT(preferences), "target", | |
477 target_sp, | |
478 (GtkDestroyNotify)gtk_widget_unref); | |
479 gtk_widget_show(target_sp); | |
480 gtk_table_attach(GTK_TABLE(table1), target_sp, 1, 2, 0, 1, | |
481 (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), | |
482 (GtkAttachOptions)(GTK_FILL), 0, 0); | |
483 gtk_tooltips_set_tip(tooltips, target_sp, target_tip, NULL); | |
484 gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(target_sp), TRUE); | |
485 | |
486 frame3 = gtk_frame_new(" History "); | |
487 gtk_widget_show(frame3); | |
488 gtk_box_pack_start(GTK_BOX(vbox5), frame3, TRUE, TRUE, 0); | |
489 | |
490 table3 = gtk_table_new(1, 2, TRUE); | |
491 gtk_widget_show(table3); | |
492 gtk_container_add(GTK_CONTAINER(frame3), table3); | |
493 gtk_container_set_border_width(GTK_CONTAINER(table3), 5); | |
494 gtk_table_set_col_spacings(GTK_TABLE(table3), 5); | |
495 | |
496 /* Buckets label and spin */ | |
497 | |
498 label9 = gtk_label_new(hist_text); | |
499 gtk_widget_show(label9); | |
500 gtk_table_attach(GTK_TABLE(table3), label9, 0, 1, 0, 1, | |
501 (GtkAttachOptions)(GTK_FILL), | |
502 (GtkAttachOptions)(0), 0, 0); | |
503 gtk_misc_set_alignment(GTK_MISC(label9), 7.45058e-09, 0.5); | |
504 | |
505 buckets_adj = | |
506 gtk_adjustment_new(prefs->buckets, 1, 10000, 1, 10, 10); | |
507 buckets_sp = gtk_spin_button_new(GTK_ADJUSTMENT(buckets_adj), 1, 0); | |
508 gtk_widget_ref(buckets_sp); | |
509 g_object_set_data_full(G_OBJECT(preferences), "buckets", | |
510 buckets_sp, | |
511 (GtkDestroyNotify)gtk_widget_unref); | |
512 gtk_widget_show(buckets_sp); | |
513 gtk_table_attach(GTK_TABLE(table3), buckets_sp, 1, 2, 0, 1, | |
514 (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), | |
515 (GtkAttachOptions)(0), 0, 0); | |
516 | |
517 gtk_tooltips_set_tip(tooltips, buckets_sp, | |
518 "How long of a history to maintain. " | |
519 "A higher number will make the volume changes " | |
520 "less responsive.", | |
521 NULL); | |
522 | |
523 hbuttonbox7 = gtk_hbutton_box_new(); | |
524 gtk_widget_show(hbuttonbox7); | |
525 gtk_box_pack_start(GTK_BOX(vbox5), hbuttonbox7, FALSE, FALSE, 0); | |
526 gtk_button_box_set_layout(GTK_BUTTON_BOX(hbuttonbox7), | |
527 GTK_BUTTONBOX_END); | |
528 | |
529 button8 = gtk_button_new_with_label("Load default values"); | |
530 gtk_widget_show(button8); | |
531 gtk_container_add(GTK_CONTAINER(hbuttonbox7), button8); | |
532 GTK_WIDGET_SET_FLAGS(button8, GTK_CAN_DEFAULT); | |
533 | |
534 label4 = gtk_label_new("Audio values"); | |
535 gtk_widget_show(label4); | |
536 gtk_notebook_set_tab_label(GTK_NOTEBOOK(notebook1), | |
537 gtk_notebook_get_nth_page(GTK_NOTEBOOK | |
538 (notebook1), | |
539 0), label4); | |
540 | |
541 hseparator3 = gtk_hseparator_new(); | |
542 gtk_widget_show(hseparator3); | |
543 gtk_box_pack_start(GTK_BOX(vbox2), hseparator3, TRUE, TRUE, 0); | |
544 | |
545 hbuttonbox2 = gtk_hbutton_box_new(); | |
546 gtk_widget_show(hbuttonbox2); | |
547 gtk_box_pack_start(GTK_BOX(vbox2), hbuttonbox2, TRUE, TRUE, 0); | |
548 gtk_button_box_set_spacing(GTK_BUTTON_BOX(hbuttonbox2), 5); | |
549 gtk_button_box_set_child_size(GTK_BUTTON_BOX(hbuttonbox2), 80, 0); | |
550 gtk_button_box_set_child_ipadding(GTK_BUTTON_BOX(hbuttonbox2), 0, | |
551 0); | |
552 | |
553 button3 = gtk_button_new_with_label("Ok"); | |
554 gtk_widget_show(button3); | |
555 gtk_container_add(GTK_CONTAINER(hbuttonbox2), button3); | |
556 GTK_WIDGET_SET_FLAGS(button3, GTK_CAN_DEFAULT); | |
557 | |
558 button4 = gtk_button_new_with_label("Cancel"); | |
559 gtk_widget_show(button4); | |
560 gtk_container_add(GTK_CONTAINER(hbuttonbox2), button4); | |
561 GTK_WIDGET_SET_FLAGS(button4, GTK_CAN_DEFAULT); | |
562 | |
563 button7 = gtk_button_new_with_label("Apply"); | |
564 gtk_widget_show(button7); | |
565 gtk_container_add(GTK_CONTAINER(hbuttonbox2), button7); | |
566 GTK_WIDGET_SET_FLAGS(button7, GTK_CAN_DEFAULT); | |
567 | |
568 gtk_widget_grab_default(button4); | |
569 | |
570 gtk_signal_connect(GTK_OBJECT(button3), "clicked", | |
571 GTK_SIGNAL_FUNC(on_ok_preferences_clicked), | |
572 prefs); | |
573 gtk_signal_connect(GTK_OBJECT(button4), "clicked", | |
574 GTK_SIGNAL_FUNC(close_window), preferences); | |
575 gtk_signal_connect(GTK_OBJECT(button7), "clicked", | |
576 GTK_SIGNAL_FUNC(on_apply_preferences_clicked), | |
577 prefs); | |
578 gtk_signal_connect(GTK_OBJECT(button8), "clicked", | |
579 GTK_SIGNAL_FUNC(on_load_default_values_clicked), | |
580 prefs); | |
581 | |
582 return preferences; | |
583 } |