1 /* libxmms-flac - XMMS FLAC input plugin
2 * Copyright (C) 2002,2003,2004 Daisuke Shimamura
4 * Based on mpg123 plugin
5 * and prefs.c - 2000/05/06
6 * EasyTAG - Tag editor for MP3 and OGG files
7 * Copyright (C) 2000-2002 Jerome Couderc <j.couderc@ifrance.com>
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
31 #include <xmms/configfile.h>
32 #include <xmms/dirbrowser.h>
33 #include <xmms/titlestring.h>
34 #include <xmms/util.h>
35 #include <xmms/plugin.h>
37 #include "plugin_common/locale_hack.h"
38 #include "share/replaygain_synthesis.h" /* for NOISE_SHAPING_LOW */
40 #include "configure.h"
43 * Initialize Global Valueable
45 flac_config_t flac_cfg = {
48 FALSE, /* tag_override */
49 NULL, /* tag_format */
50 FALSE, /* convert_char_set */
51 NULL /* user_char_set */
58 TRUE, /* album_mode */
60 FALSE /* hard_limit */
66 TRUE /* dither_24_to_16 */
71 NOISE_SHAPING_LOW, /* noise_shaping */
79 static GtkWidget *flac_configurewin = NULL;
80 static GtkWidget *vbox, *notebook;
82 static GtkWidget *title_tag_override, *title_tag_box, *title_tag_entry, *title_desc;
83 static GtkWidget *convert_char_set, *fileCharacterSetEntry, *userCharacterSetEntry;
84 static GtkWidget *replaygain_enable, *replaygain_album_mode;
85 static GtkWidget *replaygain_preamp_hscale, *replaygain_preamp_label, *replaygain_hard_limit;
86 static GtkObject *replaygain_preamp;
87 static GtkWidget *resolution_normal_dither_24_to_16;
88 static GtkWidget *resolution_replaygain_dither;
89 static GtkWidget *resolution_replaygain_noise_shaping_frame;
90 static GtkWidget *resolution_replaygain_noise_shaping_radio_none;
91 static GtkWidget *resolution_replaygain_noise_shaping_radio_low;
92 static GtkWidget *resolution_replaygain_noise_shaping_radio_medium;
93 static GtkWidget *resolution_replaygain_noise_shaping_radio_high;
94 static GtkWidget *resolution_replaygain_bps_out_frame;
95 static GtkWidget *resolution_replaygain_bps_out_radio_16bps;
96 static GtkWidget *resolution_replaygain_bps_out_radio_24bps;
98 static gchar *gtk_entry_get_text_1 (GtkWidget *widget);
99 static void flac_configurewin_ok(GtkWidget * widget, gpointer data);
100 static void configure_destroy(GtkWidget * w, gpointer data);
102 static void flac_configurewin_ok(GtkWidget * widget, gpointer data)
107 (void)widget, (void)data; /* unused arguments */
108 g_free(flac_cfg.title.tag_format);
109 flac_cfg.title.tag_format = g_strdup(gtk_entry_get_text(GTK_ENTRY(title_tag_entry)));
110 flac_cfg.title.user_char_set = Charset_Get_Name_From_Title(gtk_entry_get_text_1(userCharacterSetEntry));
112 filename = g_strconcat(g_get_home_dir(), "/.xmms/config", NULL);
113 cfg = xmms_cfg_open_file(filename);
115 cfg = xmms_cfg_new();
117 xmms_cfg_write_boolean(cfg, "flac", "title.tag_override", flac_cfg.title.tag_override);
118 xmms_cfg_write_string(cfg, "flac", "title.tag_format", flac_cfg.title.tag_format);
119 xmms_cfg_write_boolean(cfg, "flac", "title.convert_char_set", flac_cfg.title.convert_char_set);
120 xmms_cfg_write_string(cfg, "flac", "title.user_char_set", flac_cfg.title.user_char_set);
122 xmms_cfg_write_boolean(cfg, "flac", "output.replaygain.enable", flac_cfg.output.replaygain.enable);
123 xmms_cfg_write_boolean(cfg, "flac", "output.replaygain.album_mode", flac_cfg.output.replaygain.album_mode);
124 xmms_cfg_write_int(cfg, "flac", "output.replaygain.preamp", flac_cfg.output.replaygain.preamp);
125 xmms_cfg_write_boolean(cfg, "flac", "output.replaygain.hard_limit", flac_cfg.output.replaygain.hard_limit);
126 xmms_cfg_write_boolean(cfg, "flac", "output.resolution.normal.dither_24_to_16", flac_cfg.output.resolution.normal.dither_24_to_16);
127 xmms_cfg_write_boolean(cfg, "flac", "output.resolution.replaygain.dither", flac_cfg.output.resolution.replaygain.dither);
128 xmms_cfg_write_int(cfg, "flac", "output.resolution.replaygain.noise_shaping", flac_cfg.output.resolution.replaygain.noise_shaping);
129 xmms_cfg_write_int(cfg, "flac", "output.resolution.replaygain.bps_out", flac_cfg.output.resolution.replaygain.bps_out);
130 xmms_cfg_write_file(cfg, filename);
133 gtk_widget_destroy(flac_configurewin);
136 static void configure_destroy(GtkWidget *widget, gpointer data)
138 (void)widget, (void)data; /* unused arguments */
141 static void title_tag_override_cb(GtkWidget *widget, gpointer data)
143 (void)widget, (void)data; /* unused arguments */
144 flac_cfg.title.tag_override = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(title_tag_override));
146 gtk_widget_set_sensitive(title_tag_box, flac_cfg.title.tag_override);
147 gtk_widget_set_sensitive(title_desc, flac_cfg.title.tag_override);
151 static void convert_char_set_cb(GtkWidget *widget, gpointer data)
153 (void)widget, (void)data; /* unused arguments */
154 flac_cfg.title.convert_char_set = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(convert_char_set));
156 gtk_widget_set_sensitive(fileCharacterSetEntry, flac_cfg.title.convert_char_set);
157 gtk_widget_set_sensitive(userCharacterSetEntry, flac_cfg.title.convert_char_set);
160 static void replaygain_enable_cb(GtkWidget *widget, gpointer data)
162 (void)widget, (void)data; /* unused arguments */
163 flac_cfg.output.replaygain.enable = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(replaygain_enable));
165 gtk_widget_set_sensitive(replaygain_album_mode, flac_cfg.output.replaygain.enable);
166 gtk_widget_set_sensitive(replaygain_preamp_hscale, flac_cfg.output.replaygain.enable);
167 gtk_widget_set_sensitive(replaygain_hard_limit, flac_cfg.output.replaygain.enable);
170 static void replaygain_album_mode_cb(GtkWidget *widget, gpointer data)
172 (void)widget, (void)data; /* unused arguments */
173 flac_cfg.output.replaygain.album_mode = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(replaygain_album_mode));
176 static void replaygain_hard_limit_cb(GtkWidget *widget, gpointer data)
178 (void)widget, (void)data; /* unused arguments */
179 flac_cfg.output.replaygain.hard_limit = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(replaygain_hard_limit));
182 static void replaygain_preamp_cb(GtkWidget *widget, gpointer data)
184 GString *gstring = g_string_new("");
185 (void)widget, (void)data; /* unused arguments */
186 flac_cfg.output.replaygain.preamp = (int) floor(GTK_ADJUSTMENT(replaygain_preamp)->value + 0.5);
188 g_string_sprintf(gstring, "%i dB", flac_cfg.output.replaygain.preamp);
189 gtk_label_set_text(GTK_LABEL(replaygain_preamp_label), _(gstring->str));
192 static void resolution_normal_dither_24_to_16_cb(GtkWidget *widget, gpointer data)
194 (void)widget, (void)data; /* unused arguments */
195 flac_cfg.output.resolution.normal.dither_24_to_16 = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resolution_normal_dither_24_to_16));
198 static void resolution_replaygain_dither_cb(GtkWidget *widget, gpointer data)
200 (void)widget, (void)data; /* unused arguments */
201 flac_cfg.output.resolution.replaygain.dither = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resolution_replaygain_dither));
203 gtk_widget_set_sensitive(resolution_replaygain_noise_shaping_frame, flac_cfg.output.resolution.replaygain.dither);
206 static void resolution_replaygain_noise_shaping_cb(GtkWidget *widget, gpointer data)
208 (void)widget, (void)data; /* unused arguments */
209 flac_cfg.output.resolution.replaygain.noise_shaping =
210 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_none))? 0 :
211 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_low))? 1 :
212 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_medium))? 2 :
213 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_high))? 3 :
218 static void resolution_replaygain_bps_out_cb(GtkWidget *widget, gpointer data)
220 (void)widget, (void)data; /* unused arguments */
221 flac_cfg.output.resolution.replaygain.bps_out =
222 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resolution_replaygain_bps_out_radio_16bps))? 16 :
223 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resolution_replaygain_bps_out_radio_24bps))? 24 :
229 void FLAC_XMMS__configure(void)
231 GtkWidget *title_frame, *title_tag_vbox, *title_tag_label;
232 GtkWidget *replaygain_frame, *resolution_frame, *output_vbox, *resolution_normal_frame, *resolution_replaygain_frame;
233 GtkWidget *replaygain_vbox, *resolution_hbox, *resolution_normal_vbox, *resolution_replaygain_vbox;
234 GtkWidget *resolution_replaygain_noise_shaping_vbox;
235 GtkWidget *resolution_replaygain_bps_out_vbox;
236 GtkWidget *label, *hbox;
237 GtkWidget *bbox, *ok, *cancel;
240 if (flac_configurewin != NULL) {
241 gdk_window_raise(flac_configurewin->window);
244 flac_configurewin = gtk_window_new(GTK_WINDOW_DIALOG);
245 gtk_signal_connect(GTK_OBJECT(flac_configurewin), "destroy", GTK_SIGNAL_FUNC(gtk_widget_destroyed), &flac_configurewin);
246 gtk_signal_connect(GTK_OBJECT(flac_configurewin), "destroy", GTK_SIGNAL_FUNC(configure_destroy), &flac_configurewin);
247 gtk_window_set_title(GTK_WINDOW(flac_configurewin), _("Flac Configuration"));
248 gtk_window_set_policy(GTK_WINDOW(flac_configurewin), FALSE, FALSE, FALSE);
249 gtk_container_border_width(GTK_CONTAINER(flac_configurewin), 10);
251 vbox = gtk_vbox_new(FALSE, 10);
252 gtk_container_add(GTK_CONTAINER(flac_configurewin), vbox);
254 notebook = gtk_notebook_new();
255 gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0);
259 title_frame = gtk_frame_new(_("Tag Handling"));
260 gtk_container_border_width(GTK_CONTAINER(title_frame), 5);
262 title_tag_vbox = gtk_vbox_new(FALSE, 10);
263 gtk_container_border_width(GTK_CONTAINER(title_tag_vbox), 5);
264 gtk_container_add(GTK_CONTAINER(title_frame), title_tag_vbox);
266 /* Convert Char Set */
268 convert_char_set = gtk_check_button_new_with_label(_("Convert Character Set"));
269 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(convert_char_set), flac_cfg.title.convert_char_set);
270 gtk_signal_connect(GTK_OBJECT(convert_char_set), "clicked", convert_char_set_cb, NULL);
271 gtk_box_pack_start(GTK_BOX(title_tag_vbox), convert_char_set, FALSE, FALSE, 0);
273 hbox = gtk_hbox_new(FALSE,4);
274 gtk_container_add(GTK_CONTAINER(title_tag_vbox),hbox);
275 label = gtk_label_new(_("Convert character set from :"));
276 gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,FALSE,0);
277 fileCharacterSetEntry = gtk_combo_new();
278 gtk_box_pack_start(GTK_BOX(hbox),fileCharacterSetEntry,TRUE,TRUE,0);
280 label = gtk_label_new (_("to :"));
281 gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,FALSE,0);
282 userCharacterSetEntry = gtk_combo_new();
283 gtk_box_pack_start(GTK_BOX(hbox),userCharacterSetEntry,TRUE,TRUE,0);
285 gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(fileCharacterSetEntry)->entry),FALSE);
286 gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(userCharacterSetEntry)->entry),FALSE);
287 gtk_combo_set_value_in_list(GTK_COMBO(fileCharacterSetEntry),TRUE,FALSE);
288 gtk_combo_set_value_in_list(GTK_COMBO(userCharacterSetEntry),TRUE,FALSE);
290 list = Charset_Create_List();
291 gtk_combo_set_popdown_strings(GTK_COMBO(fileCharacterSetEntry),list);
292 gtk_combo_set_popdown_strings(GTK_COMBO(userCharacterSetEntry),list);
293 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(userCharacterSetEntry)->entry),Charset_Get_Title_From_Name(flac_cfg.title.user_char_set));
294 gtk_widget_set_sensitive(fileCharacterSetEntry, flac_cfg.title.convert_char_set);
295 gtk_widget_set_sensitive(userCharacterSetEntry, flac_cfg.title.convert_char_set);
297 /* Override Tagging Format */
299 title_tag_override = gtk_check_button_new_with_label(_("Override generic titles"));
300 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(title_tag_override), flac_cfg.title.tag_override);
301 gtk_signal_connect(GTK_OBJECT(title_tag_override), "clicked", title_tag_override_cb, NULL);
302 gtk_box_pack_start(GTK_BOX(title_tag_vbox), title_tag_override, FALSE, FALSE, 0);
304 title_tag_box = gtk_hbox_new(FALSE, 5);
305 gtk_widget_set_sensitive(title_tag_box, flac_cfg.title.tag_override);
306 gtk_box_pack_start(GTK_BOX(title_tag_vbox), title_tag_box, FALSE, FALSE, 0);
308 title_tag_label = gtk_label_new(_("Title format:"));
309 gtk_box_pack_start(GTK_BOX(title_tag_box), title_tag_label, FALSE, FALSE, 0);
311 title_tag_entry = gtk_entry_new();
312 gtk_entry_set_text(GTK_ENTRY(title_tag_entry), flac_cfg.title.tag_format);
313 gtk_box_pack_start(GTK_BOX(title_tag_box), title_tag_entry, TRUE, TRUE, 0);
315 title_desc = xmms_titlestring_descriptions("pafFetnygc", 2);
316 gtk_widget_set_sensitive(title_desc, flac_cfg.title.tag_override);
317 gtk_box_pack_start(GTK_BOX(title_tag_vbox), title_desc, FALSE, FALSE, 0);
319 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), title_frame, gtk_label_new(_("Title")));
321 /* Output config.. */
323 output_vbox = gtk_vbox_new(FALSE, 10);
324 gtk_container_border_width(GTK_CONTAINER(output_vbox), 5);
328 replaygain_frame = gtk_frame_new(_("ReplayGain"));
329 gtk_container_border_width(GTK_CONTAINER(replaygain_frame), 5);
330 gtk_box_pack_start(GTK_BOX(output_vbox), replaygain_frame, TRUE, TRUE, 0);
332 replaygain_vbox = gtk_vbox_new(FALSE, 10);
333 gtk_container_border_width(GTK_CONTAINER(replaygain_vbox), 5);
334 gtk_container_add(GTK_CONTAINER(replaygain_frame), replaygain_vbox);
336 replaygain_enable = gtk_check_button_new_with_label(_("Enable ReplayGain processing"));
337 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(replaygain_enable), flac_cfg.output.replaygain.enable);
338 gtk_signal_connect(GTK_OBJECT(replaygain_enable), "clicked", replaygain_enable_cb, NULL);
339 gtk_box_pack_start(GTK_BOX(replaygain_vbox), replaygain_enable, FALSE, FALSE, 0);
341 replaygain_album_mode = gtk_check_button_new_with_label(_("Album mode"));
342 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(replaygain_album_mode), flac_cfg.output.replaygain.album_mode);
343 gtk_signal_connect(GTK_OBJECT(replaygain_album_mode), "clicked", replaygain_album_mode_cb, NULL);
344 gtk_box_pack_start(GTK_BOX(replaygain_vbox), replaygain_album_mode, FALSE, FALSE, 0);
346 hbox = gtk_hbox_new(FALSE,3);
347 gtk_container_add(GTK_CONTAINER(replaygain_vbox),hbox);
348 label = gtk_label_new(_("Preamp:"));
349 gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,FALSE,0);
350 replaygain_preamp = gtk_adjustment_new(flac_cfg.output.replaygain.preamp, -24.0, +24.0, 1.0, 6.0, 0.0);
351 gtk_signal_connect(GTK_OBJECT(replaygain_preamp), "value-changed", replaygain_preamp_cb, NULL);
352 replaygain_preamp_hscale = gtk_hscale_new(GTK_ADJUSTMENT(replaygain_preamp));
353 gtk_scale_set_draw_value(GTK_SCALE(replaygain_preamp_hscale), FALSE);
354 gtk_box_pack_start(GTK_BOX(hbox),replaygain_preamp_hscale,TRUE,TRUE,0);
355 replaygain_preamp_label = gtk_label_new(_("0 dB"));
356 gtk_box_pack_start(GTK_BOX(hbox),replaygain_preamp_label,FALSE,FALSE,0);
357 gtk_adjustment_value_changed(GTK_ADJUSTMENT(replaygain_preamp));
359 replaygain_hard_limit = gtk_check_button_new_with_label(_("6dB hard limiting"));
360 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(replaygain_hard_limit), flac_cfg.output.replaygain.hard_limit);
361 gtk_signal_connect(GTK_OBJECT(replaygain_hard_limit), "clicked", replaygain_hard_limit_cb, NULL);
362 gtk_box_pack_start(GTK_BOX(replaygain_vbox), replaygain_hard_limit, FALSE, FALSE, 0);
364 replaygain_enable_cb(replaygain_enable, NULL);
368 resolution_frame = gtk_frame_new(_("Resolution"));
369 gtk_container_border_width(GTK_CONTAINER(resolution_frame), 5);
370 gtk_box_pack_start(GTK_BOX(output_vbox), resolution_frame, TRUE, TRUE, 0);
372 resolution_hbox = gtk_hbox_new(FALSE, 10);
373 gtk_container_border_width(GTK_CONTAINER(resolution_hbox), 5);
374 gtk_container_add(GTK_CONTAINER(resolution_frame), resolution_hbox);
376 resolution_normal_frame = gtk_frame_new(_("Without ReplayGain"));
377 gtk_container_border_width(GTK_CONTAINER(resolution_normal_frame), 5);
378 gtk_box_pack_start(GTK_BOX(resolution_hbox), resolution_normal_frame, TRUE, TRUE, 0);
380 resolution_normal_vbox = gtk_vbox_new(FALSE, 10);
381 gtk_container_border_width(GTK_CONTAINER(resolution_normal_vbox), 5);
382 gtk_container_add(GTK_CONTAINER(resolution_normal_frame), resolution_normal_vbox);
384 resolution_normal_dither_24_to_16 = gtk_check_button_new_with_label(_("Dither 24bps to 16bps"));
385 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_normal_dither_24_to_16), flac_cfg.output.resolution.normal.dither_24_to_16);
386 gtk_signal_connect(GTK_OBJECT(resolution_normal_dither_24_to_16), "clicked", resolution_normal_dither_24_to_16_cb, NULL);
387 gtk_box_pack_start(GTK_BOX(resolution_normal_vbox), resolution_normal_dither_24_to_16, FALSE, FALSE, 0);
389 resolution_replaygain_frame = gtk_frame_new(_("With ReplayGain"));
390 gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_frame), 5);
391 gtk_box_pack_start(GTK_BOX(resolution_hbox), resolution_replaygain_frame, TRUE, TRUE, 0);
393 resolution_replaygain_vbox = gtk_vbox_new(FALSE, 10);
394 gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_vbox), 5);
395 gtk_container_add(GTK_CONTAINER(resolution_replaygain_frame), resolution_replaygain_vbox);
397 resolution_replaygain_dither = gtk_check_button_new_with_label(_("Enable dithering"));
398 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_dither), flac_cfg.output.resolution.replaygain.dither);
399 gtk_signal_connect(GTK_OBJECT(resolution_replaygain_dither), "clicked", resolution_replaygain_dither_cb, NULL);
400 gtk_box_pack_start(GTK_BOX(resolution_replaygain_vbox), resolution_replaygain_dither, FALSE, FALSE, 0);
402 hbox = gtk_hbox_new(FALSE, 10);
403 gtk_container_border_width(GTK_CONTAINER(hbox), 5);
404 gtk_box_pack_start(GTK_BOX(resolution_replaygain_vbox), hbox, TRUE, TRUE, 0);
406 resolution_replaygain_noise_shaping_frame = gtk_frame_new(_("Noise shaping"));
407 gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_noise_shaping_frame), 5);
408 gtk_box_pack_start(GTK_BOX(hbox), resolution_replaygain_noise_shaping_frame, TRUE, TRUE, 0);
410 resolution_replaygain_noise_shaping_vbox = gtk_vbutton_box_new();
411 gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_noise_shaping_vbox), 5);
412 gtk_container_add(GTK_CONTAINER(resolution_replaygain_noise_shaping_frame), resolution_replaygain_noise_shaping_vbox);
414 resolution_replaygain_noise_shaping_radio_none = gtk_radio_button_new_with_label(NULL, _("none"));
415 if(flac_cfg.output.resolution.replaygain.noise_shaping == 0)
416 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_none), TRUE);
417 gtk_signal_connect(GTK_OBJECT(resolution_replaygain_noise_shaping_radio_none), "clicked", resolution_replaygain_noise_shaping_cb, NULL);
418 gtk_container_add(GTK_CONTAINER(resolution_replaygain_noise_shaping_vbox), resolution_replaygain_noise_shaping_radio_none);
420 resolution_replaygain_noise_shaping_radio_low = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(resolution_replaygain_noise_shaping_radio_none), _("low"));
421 if(flac_cfg.output.resolution.replaygain.noise_shaping == 1)
422 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_low), TRUE);
423 gtk_signal_connect(GTK_OBJECT(resolution_replaygain_noise_shaping_radio_low), "clicked", resolution_replaygain_noise_shaping_cb, NULL);
424 gtk_container_add(GTK_CONTAINER(resolution_replaygain_noise_shaping_vbox), resolution_replaygain_noise_shaping_radio_low);
426 resolution_replaygain_noise_shaping_radio_medium = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(resolution_replaygain_noise_shaping_radio_none), _("medium"));
427 if(flac_cfg.output.resolution.replaygain.noise_shaping == 2)
428 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_medium), TRUE);
429 gtk_signal_connect(GTK_OBJECT(resolution_replaygain_noise_shaping_radio_medium), "clicked", resolution_replaygain_noise_shaping_cb, NULL);
430 gtk_container_add(GTK_CONTAINER(resolution_replaygain_noise_shaping_vbox), resolution_replaygain_noise_shaping_radio_medium);
432 resolution_replaygain_noise_shaping_radio_high = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(resolution_replaygain_noise_shaping_radio_none), _("high"));
433 if(flac_cfg.output.resolution.replaygain.noise_shaping == 3)
434 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_high), TRUE);
435 gtk_signal_connect(GTK_OBJECT(resolution_replaygain_noise_shaping_radio_high), "clicked", resolution_replaygain_noise_shaping_cb, NULL);
436 gtk_container_add(GTK_CONTAINER(resolution_replaygain_noise_shaping_vbox), resolution_replaygain_noise_shaping_radio_high);
438 resolution_replaygain_bps_out_frame = gtk_frame_new(_("Dither to"));
439 gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_bps_out_frame), 5);
440 gtk_box_pack_start(GTK_BOX(hbox), resolution_replaygain_bps_out_frame, FALSE, FALSE, 0);
442 resolution_replaygain_bps_out_vbox = gtk_vbutton_box_new();
443 gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_bps_out_vbox), 0);
444 gtk_container_add(GTK_CONTAINER(resolution_replaygain_bps_out_frame), resolution_replaygain_bps_out_vbox);
446 resolution_replaygain_bps_out_radio_16bps = gtk_radio_button_new_with_label(NULL, _("16 bps"));
447 if(flac_cfg.output.resolution.replaygain.bps_out == 16)
448 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_bps_out_radio_16bps), TRUE);
449 gtk_signal_connect(GTK_OBJECT(resolution_replaygain_bps_out_radio_16bps), "clicked", resolution_replaygain_bps_out_cb, NULL);
450 gtk_container_add(GTK_CONTAINER(resolution_replaygain_bps_out_vbox), resolution_replaygain_bps_out_radio_16bps);
452 resolution_replaygain_bps_out_radio_24bps = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(resolution_replaygain_bps_out_radio_16bps), _("24 bps"));
453 if(flac_cfg.output.resolution.replaygain.bps_out == 24)
454 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_bps_out_radio_24bps), TRUE);
455 gtk_signal_connect(GTK_OBJECT(resolution_replaygain_bps_out_radio_24bps), "clicked", resolution_replaygain_bps_out_cb, NULL);
456 gtk_container_add(GTK_CONTAINER(resolution_replaygain_bps_out_vbox), resolution_replaygain_bps_out_radio_24bps);
458 resolution_replaygain_dither_cb(resolution_replaygain_dither, NULL);
460 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), output_vbox, gtk_label_new(_("Output")));
464 bbox = gtk_hbutton_box_new();
465 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
466 gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5);
467 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);
469 ok = gtk_button_new_with_label(_("Ok"));
470 gtk_signal_connect(GTK_OBJECT(ok), "clicked", GTK_SIGNAL_FUNC(flac_configurewin_ok), NULL);
471 GTK_WIDGET_SET_FLAGS(ok, GTK_CAN_DEFAULT);
472 gtk_box_pack_start(GTK_BOX(bbox), ok, TRUE, TRUE, 0);
473 gtk_widget_grab_default(ok);
475 cancel = gtk_button_new_with_label(_("Cancel"));
476 gtk_signal_connect_object(GTK_OBJECT(cancel), "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(flac_configurewin));
477 GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT);
478 gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0);
480 gtk_widget_show_all(flac_configurewin);
483 void FLAC_XMMS__aboutbox()
485 static GtkWidget *about_window;
488 gdk_window_raise(about_window->window);
490 about_window = xmms_show_message(
491 _("About Flac Plugin"),
492 _("Flac Plugin by Josh Coalson\n"
497 "Daisuke Shimamura\n"
498 "Visit http://flac.sourceforge.net/"),
499 _("Ok"), FALSE, NULL, NULL);
500 gtk_signal_connect(GTK_OBJECT(about_window), "destroy",
501 GTK_SIGNAL_FUNC(gtk_widget_destroyed),
506 * Get text of an Entry or a ComboBox
508 static gchar *gtk_entry_get_text_1 (GtkWidget *widget)
510 if (GTK_IS_COMBO(widget))
512 return gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(widget)->entry));
513 }else if (GTK_IS_ENTRY(widget))
515 return gtk_entry_get_text(GTK_ENTRY(widget));