comparison src/audacious/ui_preferences.c @ 4244:8b9b5d04aac4

Automated merge with file:/home/asphyx/ahinea/audacious-newaudio
author Eugene Zagidullin <e.asphyx@gmail.com>
date Mon, 04 Feb 2008 05:55:43 +0300
parents 9f3cc7f3aaf6 21008f43bb93
children 96df51b80892
comparison
equal deleted inserted replaced
4228:9f3cc7f3aaf6 4244:8b9b5d04aac4
128 GtkTooltips *tooltips; 128 GtkTooltips *tooltips;
129 129
130 static Category categories[] = { 130 static Category categories[] = {
131 {DATA_DIR "/images/appearance.png", N_("Appearance")}, 131 {DATA_DIR "/images/appearance.png", N_("Appearance")},
132 {DATA_DIR "/images/audio.png", N_("Audio")}, 132 {DATA_DIR "/images/audio.png", N_("Audio")},
133 {DATA_DIR "/images/replay_gain.png", N_("Replay Gain")},
133 {DATA_DIR "/images/connectivity.png", N_("Connectivity")}, 134 {DATA_DIR "/images/connectivity.png", N_("Connectivity")},
134 {DATA_DIR "/images/mouse.png", N_("Mouse")}, 135 {DATA_DIR "/images/mouse.png", N_("Mouse")},
135 {DATA_DIR "/images/playback.png", N_("Playback")}, 136 {DATA_DIR "/images/playback.png", N_("Playback")},
136 {DATA_DIR "/images/playlist.png", N_("Playlist")}, 137 {DATA_DIR "/images/playlist.png", N_("Playlist")},
137 {DATA_DIR "/images/plugins.png", N_("Plugins")}, 138 {DATA_DIR "/images/plugins.png", N_("Plugins")},
189 static void show_wm_decorations_cb(); 190 static void show_wm_decorations_cb();
190 static void bitmap_fonts_cb(); 191 static void bitmap_fonts_cb();
191 static void mainwin_font_set_cb(); 192 static void mainwin_font_set_cb();
192 static void playlist_font_set_cb(); 193 static void playlist_font_set_cb();
193 GtkWidget *ui_preferences_chardet_table_populate(void); 194 GtkWidget *ui_preferences_chardet_table_populate(void);
194 static gint titlestring_timeout_counter = 0; 195 static GtkWidget *ui_preferences_bit_depth(void);
196 static GtkWidget *ui_preferences_rg_params(void);
195 197
196 static PreferencesWidget appearance_misc_widgets[] = { 198 static PreferencesWidget appearance_misc_widgets[] = {
197 {WIDGET_LABEL, N_("<b>_Fonts</b>"), NULL, NULL, NULL, FALSE}, 199 {WIDGET_LABEL, N_("<b>_Fonts</b>"), NULL, NULL, NULL, FALSE},
198 {WIDGET_FONT_BTN, N_("_Player:"), &cfg.mainwin_font, G_CALLBACK(mainwin_font_set_cb), N_("Select main player window font:"), FALSE}, 200 {WIDGET_FONT_BTN, N_("_Player:"), &cfg.mainwin_font, G_CALLBACK(mainwin_font_set_cb), N_("Select main player window font:"), FALSE},
199 {WIDGET_FONT_BTN, N_("_Playlist:"), &cfg.playlist_font, G_CALLBACK(playlist_font_set_cb), N_("Select playlist font:"), FALSE}, 201 {WIDGET_FONT_BTN, N_("_Playlist:"), &cfg.playlist_font, G_CALLBACK(playlist_font_set_cb), N_("Select playlist font:"), FALSE},
217 {WIDGET_LABEL, N_("<b>Format Detection</b>"), NULL, NULL, NULL, FALSE}, 219 {WIDGET_LABEL, N_("<b>Format Detection</b>"), NULL, NULL, NULL, FALSE},
218 {WIDGET_CHK_BTN, N_("Detect file formats on demand, instead of immediately."), &cfg.playlist_detect, NULL, 220 {WIDGET_CHK_BTN, N_("Detect file formats on demand, instead of immediately."), &cfg.playlist_detect, NULL,
219 N_("When checked, Audacious will detect file formats on demand. This can result in a messier playlist, but delivers a major speed benefit."), FALSE}, 221 N_("When checked, Audacious will detect file formats on demand. This can result in a messier playlist, but delivers a major speed benefit."), FALSE},
220 {WIDGET_CHK_BTN, N_("Detect file formats by extension."), &cfg.use_extension_probing, NULL, 222 {WIDGET_CHK_BTN, N_("Detect file formats by extension."), &cfg.use_extension_probing, NULL,
221 N_("When checked, Audacious will detect file formats based by extension. Only files with extensions of supported formats will be loaded."), FALSE}, 223 N_("When checked, Audacious will detect file formats based by extension. Only files with extensions of supported formats will be loaded."), FALSE},
224 {WIDGET_LABEL, N_("<b>Bit Depth</b>"), NULL, NULL, NULL, FALSE},
225 {WIDGET_CUSTOM, NULL, NULL, NULL, NULL, FALSE, ui_preferences_bit_depth},
226 };
227
228 static PreferencesWidget replay_gain_page_widgets[] = {
229 {WIDGET_LABEL, N_("<b>Replay Gain configuration</b>"), NULL, NULL, NULL, FALSE},
230 {WIDGET_CHK_BTN, N_("Enable Replay Gain"), &cfg.enable_replay_gain, NULL, NULL, FALSE},
231 {WIDGET_LABEL, N_("<b>Replay Gain mode</b>"), NULL, NULL, NULL, TRUE},
232 {WIDGET_RADIO_BTN, N_("Track gain/peak"), &cfg.replay_gain_track, NULL, NULL, TRUE},
233 {WIDGET_RADIO_BTN, N_("Album gain/peak"), &cfg.replay_gain_album, NULL, NULL, TRUE},
234 {WIDGET_LABEL, N_("<b>Miscellaneous</b>"), NULL, NULL, NULL, TRUE},
235 {WIDGET_CHK_BTN, N_("Enable clipping prevention"), &cfg.enable_clipping_prevention, NULL, NULL, TRUE},
236 {WIDGET_CHK_BTN, N_("Enable 6 dB hard limiter"), &cfg.enable_hard_limiter, NULL, NULL, TRUE},
237 {WIDGET_CUSTOM, NULL, NULL, NULL, NULL, TRUE, ui_preferences_rg_params},
222 }; 238 };
223 239
224 static PreferencesWidget playback_page_widgets[] = { 240 static PreferencesWidget playback_page_widgets[] = {
225 {WIDGET_LABEL, N_("<b>Playback</b>"), NULL, NULL, NULL, FALSE}, 241 {WIDGET_LABEL, N_("<b>Playback</b>"), NULL, NULL, NULL, FALSE},
226 {WIDGET_CHK_BTN, N_("Continue playback on startup"), &cfg.resume_playback_on_startup, NULL, 242 {WIDGET_CHK_BTN, N_("Continue playback on startup"), &cfg.resume_playback_on_startup, NULL,
1653 g_signal_connect_after(G_OBJECT(entry), "realize", 1669 g_signal_connect_after(G_OBJECT(entry), "realize",
1654 G_CALLBACK(on_chardet_fallback_realize), 1670 G_CALLBACK(on_chardet_fallback_realize),
1655 NULL); 1671 NULL);
1656 1672
1657 return widget; 1673 return widget;
1674 }
1675
1676 static void
1677 on_bit_depth_cbox_changed(GtkWidget *cbox, gpointer data)
1678 {
1679 gint active = gtk_combo_box_get_active(GTK_COMBO_BOX(cbox));
1680 cfg.output_bit_depth = (active == 1) ? 24 : 16;
1681 }
1682
1683 GtkWidget *
1684 ui_preferences_bit_depth(void)
1685 {
1686 GtkWidget *box = gtk_hbox_new(FALSE, 10);
1687 GtkWidget *label = gtk_label_new(_("Output bit depth:"));
1688 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
1689 gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 0);
1690
1691 GtkWidget *combo = gtk_combo_box_new_text ();
1692 gtk_combo_box_append_text(GTK_COMBO_BOX (combo), "16");
1693 gtk_combo_box_append_text(GTK_COMBO_BOX (combo), "24");
1694 gtk_box_pack_start(GTK_BOX(box), combo, FALSE, FALSE, 0);
1695
1696 gint active = (cfg.output_bit_depth == 24) ? 1 : 0;
1697 gtk_combo_box_set_active(GTK_COMBO_BOX(combo), active);
1698 g_signal_connect(combo, "changed", G_CALLBACK(on_bit_depth_cbox_changed), NULL);
1699
1700 gtk_tooltips_set_tip (tooltips, box,
1701 _("All streams will be converted to this bit depth.\n"
1702 "This should be the max supported bit depth of\nthe sound card or output plugin."),
1703 NULL);
1704
1705 return box;
1706 }
1707
1708 static void
1709 on_rg_spin_changed(GtkSpinButton *spinbutton, gpointer user_data)
1710 {
1711 *((gfloat*) user_data) = gtk_spin_button_get_value(spinbutton);
1712 }
1713
1714 static GtkWidget *
1715 ui_preferences_rg_params(void)
1716 {
1717 GtkWidget *alignment = gtk_alignment_new(0.5, 0.5, 1, 1);
1718 GtkWidget *table = gtk_table_new(2, 3, FALSE);
1719 gtk_table_set_row_spacings (GTK_TABLE (table), 6);
1720 gtk_table_set_col_spacings (GTK_TABLE (table), 6);
1721
1722 GtkWidget *label = gtk_label_new(_("Preamp:"));
1723 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1,
1724 (GtkAttachOptions) (GTK_FILL),
1725 (GtkAttachOptions) (0), 0, 0);
1726 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
1727
1728 GtkWidget *spin = gtk_spin_button_new_with_range(-15, 15, 0.01);
1729 gtk_table_attach(GTK_TABLE(table), spin, 1, 2, 0, 1,
1730 (GtkAttachOptions) (0),
1731 (GtkAttachOptions) (0), 0, 0);
1732 gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin), cfg.replay_gain_preamp);
1733 g_signal_connect(G_OBJECT(spin), "value_changed", G_CALLBACK(on_rg_spin_changed), &cfg.replay_gain_preamp);
1734
1735 label = gtk_label_new(_("dB"));
1736 gtk_table_attach(GTK_TABLE(table), label, 2, 3, 0, 1,
1737 (GtkAttachOptions) (GTK_FILL),
1738 (GtkAttachOptions) (0), 0, 0);
1739 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
1740
1741 label = gtk_label_new(_("Default gain:"));
1742 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2,
1743 (GtkAttachOptions) (GTK_FILL),
1744 (GtkAttachOptions) (0), 0, 0);
1745 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
1746
1747 spin = gtk_spin_button_new_with_range(-15, 15, 0.01);
1748 gtk_table_attach(GTK_TABLE(table), spin, 1, 2, 1, 2,
1749 (GtkAttachOptions) (0),
1750 (GtkAttachOptions) (0), 0, 0);
1751 gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin), cfg.default_gain);
1752 g_signal_connect(G_OBJECT(spin), "value_changed", G_CALLBACK(on_rg_spin_changed), &cfg.default_gain);
1753 gtk_tooltips_set_tip (tooltips, spin, _("This gain will be used if file doesn't contain Replay Gain metadata."), NULL);
1754
1755 label = gtk_label_new(_("dB"));
1756 gtk_table_attach(GTK_TABLE(table), label, 2, 3, 1, 2,
1757 (GtkAttachOptions) (GTK_FILL),
1758 (GtkAttachOptions) (0), 0, 0);
1759 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
1760
1761 gtk_container_add(GTK_CONTAINER(alignment), table);
1762 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 0, 0, 12, 0);
1763
1764 return alignment;
1658 } 1765 }
1659 1766
1660 /* it's at early stage */ 1767 /* it's at early stage */
1661 static void 1768 static void
1662 create_widgets(GtkBox *box, PreferencesWidget *widgets, gint amt) 1769 create_widgets(GtkBox *box, PreferencesWidget *widgets, gint amt)
1703 widget = gtk_label_new_with_mnemonic(_(widgets[x].label)); 1810 widget = gtk_label_new_with_mnemonic(_(widgets[x].label));
1704 gtk_label_set_use_markup(GTK_LABEL(widget), TRUE); 1811 gtk_label_set_use_markup(GTK_LABEL(widget), TRUE);
1705 gtk_misc_set_alignment(GTK_MISC(widget), 0, 0.5); 1812 gtk_misc_set_alignment(GTK_MISC(widget), 0, 0.5);
1706 break; 1813 break;
1707 case WIDGET_RADIO_BTN: 1814 case WIDGET_RADIO_BTN:
1815 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 0, 0, 12, 0);
1708 widget = gtk_radio_button_new_with_mnemonic(radio_btn_group, _(widgets[x].label)); 1816 widget = gtk_radio_button_new_with_mnemonic(radio_btn_group, _(widgets[x].label));
1709 radio_btn_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget)); 1817 radio_btn_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
1710 g_signal_connect(G_OBJECT(widget), "toggled", 1818 g_signal_connect(G_OBJECT(widget), "toggled",
1711 G_CALLBACK(on_toggle_button_toggled), 1819 G_CALLBACK(on_toggle_button_toggled),
1712 widgets[x].cfg); 1820 widgets[x].cfg);
1961 gtk_container_add (GTK_CONTAINER (category_notebook), playback_page_vbox); 2069 gtk_container_add (GTK_CONTAINER (category_notebook), playback_page_vbox);
1962 2070
1963 widgets_vbox = gtk_vbox_new (FALSE, 0); 2071 widgets_vbox = gtk_vbox_new (FALSE, 0);
1964 create_widgets(GTK_BOX(widgets_vbox), playback_page_widgets, G_N_ELEMENTS(playback_page_widgets)); 2072 create_widgets(GTK_BOX(widgets_vbox), playback_page_widgets, G_N_ELEMENTS(playback_page_widgets));
1965 gtk_box_pack_start (GTK_BOX (playback_page_vbox), widgets_vbox, TRUE, TRUE, 0); 2073 gtk_box_pack_start (GTK_BOX (playback_page_vbox), widgets_vbox, TRUE, TRUE, 0);
2074 }
2075
2076 static void
2077 create_replay_gain_category(void)
2078 {
2079 GtkWidget *rg_page_vbox;
2080 GtkWidget *widgets_vbox;
2081
2082 rg_page_vbox = gtk_vbox_new (FALSE, 0);
2083 gtk_container_add (GTK_CONTAINER (category_notebook), rg_page_vbox);
2084
2085 widgets_vbox = gtk_vbox_new (FALSE, 0);
2086 create_widgets(GTK_BOX(widgets_vbox), replay_gain_page_widgets, G_N_ELEMENTS(replay_gain_page_widgets));
2087 gtk_box_pack_start (GTK_BOX (rg_page_vbox), widgets_vbox, TRUE, TRUE, 0);
1966 } 2088 }
1967 2089
1968 static void 2090 static void
1969 create_playlist_category(void) 2091 create_playlist_category(void)
1970 { 2092 {
2979 3101
2980 3102
2981 3103
2982 create_appearence_category(); 3104 create_appearence_category();
2983 create_audio_category(); 3105 create_audio_category();
3106 create_replay_gain_category();
2984 create_connectivity_category(); 3107 create_connectivity_category();
2985 create_mouse_category(); 3108 create_mouse_category();
2986 create_playback_category(); 3109 create_playback_category();
2987 create_playlist_category(); 3110 create_playlist_category();
2988 create_plugin_category(); 3111 create_plugin_category();