?? options.c
字號:
/* -*- linux-c -*- Copyright (C) 2004 Tom Szilagyi This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. $Id: options.c,v 1.80 2006/09/25 18:17:29 peterszilagyi Exp $*/#include <config.h>#include <gtk/gtk.h>#include <gdk/gdkkeysyms.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <sys/stat.h>#include <libxml/xmlmemory.h>#include <libxml/parser.h>#ifdef HAVE_SRC#include <samplerate.h>#endif /* HAVE_SRC */#include "common.h"#include "gui_main.h"#include "music_browser.h"#include "playlist.h"#include "i18n.h"#include "options.h"options_t options;static int current_notebook_page = 0;extern GtkWidget * main_window;extern GtkWidget * play_button;extern GtkTooltips * aqualung_tooltips;extern PangoFontDescription *fd_playlist;extern PangoFontDescription *fd_browser;extern PangoFontDescription *fd_bigtimer;extern PangoFontDescription *fd_smalltimer;extern PangoFontDescription *fd_songtitle;extern PangoFontDescription *fd_songinfo;extern PangoFontDescription *fd_statusbar;extern GtkWidget * bigtimer_label;extern GtkWidget * smalltimer_label_1;extern GtkWidget * smalltimer_label_2;extern GtkWidget * label_title;extern GtkWidget * label_format;extern GtkWidget * label_samplerate;extern GtkWidget * label_bps;extern GtkWidget * label_mono;extern GtkWidget * label_output;extern GtkWidget * label_src_type;extern GtkWidget * statusbar_total;extern GtkWidget * statusbar_total_label;extern GtkWidget * statusbar_selected;extern GtkWidget * statusbar_selected_label;extern GtkWidget * statusbar_ms;extern int music_store_changed;extern GtkWidget * music_tree;extern GtkTreeStore * music_store;extern GtkWidget * play_list;extern GtkTreeViewColumn * track_column;extern GtkTreeViewColumn * rva_column;extern GtkTreeViewColumn * length_column;extern GtkListStore * play_store;extern GtkWidget* gui_stock_label_button(gchar *blabel, const gchar *bstock);extern void disable_bold_font_in_playlist(void);extern void playlist_selection_changed(GtkTreeSelection * sel, gpointer data);extern void set_buttons_relief(void);extern void show_active_position_in_playlist(void);int rva_is_enabled_shadow;int rva_env_shadow;float rva_refvol_shadow;float rva_steepness_shadow;int rva_use_averaging_shadow;int rva_use_linear_thresh_shadow;float rva_avg_linear_thresh_shadow;float rva_avg_stddev_thresh_shadow;int appearance_changed;int reskin_flag;int restart_flag;int override_shadow;int track_name_in_bold_shadow;GtkWidget * options_window;GtkWidget * notebook;GtkWidget * entry_title;GtkWidget * entry_param;GtkWidget * check_enable_tooltips;GtkWidget * check_buttons_at_the_bottom;GtkWidget * check_disable_buttons_relief;GtkWidget * check_main_window_always_on_top;GtkWidget * check_simple_view_in_fx;GtkWidget * check_united_minimization;GtkWidget * check_show_sn_title;GtkWidget * check_show_hidden;GtkWidget * check_tags_tab_first;GtkWidget * check_playlist_is_embedded;GtkWidget * check_autoplsave;GtkWidget * check_playlist_is_tree;GtkWidget * check_album_shuffle_mode;GtkWidget * check_enable_playlist_statusbar;GtkWidget * check_pl_statusbar_show_size;GtkWidget * check_show_rva_in_playlist;GtkWidget * check_show_length_in_playlist;GtkWidget * check_show_active_track_name_in_bold;GtkWidget * check_enable_pl_rules_hint;GtkListStore * plistcol_store;GtkWidget * check_hide_comment_pane;GtkWidget * check_enable_mstore_toolbar;GtkWidget * check_enable_mstore_statusbar;GtkWidget * check_ms_statusbar_show_size;GtkWidget * check_expand_stores;GtkWidget * check_enable_ms_rules_hint;GtkWidget * check_enable_ms_tree_icons;GtkWidget * combo_cwidth;GtkWidget * check_magnify_smaller_images;GtkListStore * ms_pathlist_store = NULL;GtkTreeSelection * ms_pathlist_select;GtkWidget * entry_ms_pathlist;#ifdef HAVE_LADSPAGtkWidget * combo_ladspa;#endif /* HAVE_LADSPA */#ifdef HAVE_SRCextern int src_type;GtkWidget * combo_src;#endif /* HAVE_SRC */GtkWidget * label_src;GtkWidget * check_rva_is_enabled;GtkWidget * rva_drawing_area;GdkPixmap * rva_pixmap = NULL;GtkWidget * rva_viewport;GtkWidget * combo_listening_env;GtkWidget * spin_refvol;GtkWidget * spin_steepness;GtkWidget * check_rva_use_averaging;GtkWidget * combo_threshold;GtkWidget * spin_linthresh;GtkWidget * spin_stdthresh;GtkObject * adj_refvol;GtkObject * adj_steepness;GtkObject * adj_linthresh;GtkObject * adj_stdthresh;GtkWidget * label_listening_env;GtkWidget * label_refvol;GtkWidget * label_steepness;GtkWidget * label_threshold;GtkWidget * label_linthresh;GtkWidget * label_stdthresh;GtkWidget * check_auto_use_meta_artist;GtkWidget * check_auto_use_meta_record;GtkWidget * check_auto_use_meta_track;GtkWidget * check_auto_use_ext_meta_artist;GtkWidget * check_auto_use_ext_meta_record;GtkWidget * check_auto_use_ext_meta_track;GtkWidget * combo_replaygain;#ifdef HAVE_CDDBGtkWidget * cddb_server_entry;GtkWidget * cddb_tout_spinner;GtkWidget * cddb_email_entry;GtkWidget * cddb_radio_direct;GtkWidget * cddb_radio_proxy;GtkWidget * cddb_proto_combo;GtkWidget * cddb_proxy_entry;GtkWidget * cddb_proxy_port_spinner;GtkWidget * cddb_label_proto;GtkWidget * cddb_label_proxy;GtkWidget * cddb_label_proxy_port;#endif /* HAVE_CDDB */GtkWidget * check_override_skin;#define DEFAULT_FONT_NAME "Sans 11"GtkWidget * entry_pl_font;GtkWidget * entry_ms_font;GtkWidget * entry_bt_font;GtkWidget * entry_st_font;GtkWidget * entry_songt_font;GtkWidget * entry_si_font;GtkWidget * entry_sb_font;GtkWidget * button_pl_font;GtkWidget * button_ms_font;GtkWidget * button_bt_font;GtkWidget * button_st_font;GtkWidget * button_songt_font;GtkWidget * button_si_font;GtkWidget * button_sb_font;GdkColor color;GtkWidget * color_picker;void draw_rva_diagram(void);void show_restart_info(void);GtkListStore * restart_list_store = NULL;voidopen_font_desc(void) { if (fd_playlist) pango_font_description_free(fd_playlist); fd_playlist = pango_font_description_from_string(options.playlist_font); if (fd_browser) pango_font_description_free(fd_browser); fd_browser = pango_font_description_from_string(options.browser_font); if (fd_bigtimer) pango_font_description_free(fd_bigtimer); fd_bigtimer = pango_font_description_from_string(options.bigtimer_font); if (fd_smalltimer) pango_font_description_free(fd_smalltimer); fd_smalltimer = pango_font_description_from_string(options.smalltimer_font); if (fd_songtitle) pango_font_description_free(fd_songtitle); fd_songtitle = pango_font_description_from_string(options.songtitle_font); if (fd_songinfo) pango_font_description_free(fd_songinfo); fd_songinfo = pango_font_description_from_string(options.songinfo_font); if (fd_statusbar) pango_font_description_free(fd_statusbar); fd_statusbar = pango_font_description_from_string(options.statusbar_font);}voidset_option_from_toggle(GtkWidget * widget, int * opt) { if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) { *opt = 1; } else { *opt = 0; }}voidset_option_from_combo(GtkWidget * widget, int * opt) { *opt = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));}voidset_option_from_spin(GtkWidget * widget, int * opt) { *opt = gtk_spin_button_get_value(GTK_SPIN_BUTTON(widget));}voidset_option_from_entry(GtkWidget * widget, char * opt) { strncpy(opt, gtk_entry_get_text(GTK_ENTRY(widget)), MAXLEN-1);}voidoptions_window_accept(void) { int i; int n; int n_prev = 3; GtkTreeIter iter; GtkTreeIter iter2; GdkColor color; if (restart_flag) { show_restart_info(); } /* General */ strncpy(options.title_format, gtk_entry_get_text(GTK_ENTRY(entry_title)), MAXLEN - 1); strncpy(options.default_param, gtk_entry_get_text(GTK_ENTRY(entry_param)), MAXLEN - 1); set_option_from_toggle(check_enable_tooltips, &options.enable_tooltips); if (options.enable_tooltips) { gtk_tooltips_enable(aqualung_tooltips); } else { gtk_tooltips_disable(aqualung_tooltips); } set_option_from_toggle(check_buttons_at_the_bottom, &options.buttons_at_the_bottom_shadow); set_option_from_toggle(check_disable_buttons_relief, &options.disable_buttons_relief); set_option_from_toggle(check_main_window_always_on_top, &options.main_window_always_on_top);#ifdef HAVE_LADSPA set_option_from_toggle(check_simple_view_in_fx, &options.simple_view_in_fx_shadow);#endif /* HAVE_LADSPA */ set_option_from_toggle(check_united_minimization, &options.united_minimization); set_option_from_toggle(check_show_sn_title, &options.show_sn_title); set_option_from_toggle(check_show_hidden, &options.show_hidden); set_option_from_toggle(check_tags_tab_first, &options.tags_tab_first); /* Playlist */ set_option_from_toggle(check_autoplsave, &options.auto_save_playlist); set_option_from_toggle(check_playlist_is_embedded, &options.playlist_is_embedded_shadow); set_option_from_toggle(check_playlist_is_tree, &options.playlist_is_tree); set_option_from_toggle(check_album_shuffle_mode, &options.album_shuffle_mode); set_option_from_toggle(check_enable_playlist_statusbar, &options.enable_playlist_statusbar_shadow); set_option_from_toggle(check_pl_statusbar_show_size, &options.pl_statusbar_show_size); set_option_from_toggle(check_show_rva_in_playlist, &options.show_rva_in_playlist); gtk_tree_view_column_set_visible(GTK_TREE_VIEW_COLUMN(rva_column), options.show_rva_in_playlist); set_option_from_toggle(check_show_length_in_playlist, &options.show_length_in_playlist); gtk_tree_view_column_set_visible(GTK_TREE_VIEW_COLUMN(length_column), options.show_length_in_playlist); set_option_from_toggle(check_show_active_track_name_in_bold, &options.show_active_track_name_in_bold); if (!options.show_active_track_name_in_bold) { disable_bold_font_in_playlist(); } set_option_from_toggle(check_enable_pl_rules_hint, &options.enable_pl_rules_hint); gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(play_list), options.enable_pl_rules_hint); /* Music Store */ set_option_from_toggle(check_hide_comment_pane, &options.hide_comment_pane_shadow); set_option_from_toggle(check_enable_mstore_toolbar, &options.enable_mstore_toolbar_shadow); set_option_from_toggle(check_enable_mstore_statusbar, &options.enable_mstore_statusbar_shadow); set_option_from_toggle(check_ms_statusbar_show_size, &options.ms_statusbar_show_size); set_option_from_toggle(check_expand_stores, &options.autoexpand_stores); set_option_from_toggle(check_enable_ms_rules_hint, &options.enable_ms_rules_hint); gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(music_tree), options.enable_ms_rules_hint); set_option_from_toggle(check_enable_ms_tree_icons, &options.enable_ms_tree_icons_shadow); set_option_from_combo(combo_cwidth, &options.cover_width); set_option_from_toggle(check_magnify_smaller_images, &options.magnify_smaller_images); /* RVA */ options.rva_is_enabled = rva_is_enabled_shadow; options.rva_env = rva_env_shadow; options.rva_refvol = rva_refvol_shadow; options.rva_steepness = rva_steepness_shadow; options.rva_use_averaging = rva_use_averaging_shadow; options.rva_use_linear_thresh = rva_use_linear_thresh_shadow; options.rva_avg_linear_thresh = rva_avg_linear_thresh_shadow; options.rva_avg_stddev_thresh = rva_avg_stddev_thresh_shadow; /* Metadata */ set_option_from_toggle(check_auto_use_meta_artist, &options.auto_use_meta_artist); set_option_from_toggle(check_auto_use_meta_record, &options.auto_use_meta_record); set_option_from_toggle(check_auto_use_meta_track, &options.auto_use_meta_track); set_option_from_toggle(check_auto_use_ext_meta_artist, &options.auto_use_ext_meta_artist); set_option_from_toggle(check_auto_use_ext_meta_record, &options.auto_use_ext_meta_record); set_option_from_toggle(check_auto_use_ext_meta_track, &options.auto_use_ext_meta_track); set_option_from_combo(combo_replaygain, &options.replaygain_tag_to_use); /* CDDB */#ifdef HAVE_CDDB set_option_from_entry(cddb_server_entry, options.cddb_server); set_option_from_spin(cddb_tout_spinner, &options.cddb_timeout); set_option_from_entry(cddb_email_entry, options.cddb_email); set_option_from_toggle(cddb_radio_proxy, &options.cddb_use_proxy); set_option_from_combo(cddb_proto_combo, &options.cddb_use_http);
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -