From c5e15fbf08aa61c950f624ebd9bb48268564b73e Mon Sep 17 00:00:00 2001 From: petern Date: Fri, 27 Nov 2009 23:02:55 +0000 Subject: [PATCH] Add aliases to preferences window git-svn-id: file:///home/vcs/svn/jsweeper/trunk@12 6611ac79-6612-48ef-a1e9-b906f853523e --- src/gui.cpp | 31 +++ src/gui.h | 21 +++ src/jsweeper.glade | 461 ++++++++++++++++++++++++--------------------- 3 files changed, 295 insertions(+), 218 deletions(-) diff --git a/src/gui.cpp b/src/gui.cpp index 478b5f2..a69054d 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -247,6 +247,28 @@ Preferences::Preferences(BaseObjectType *cobject, const Glib::RefPtrset_active(cfg.ExpandClients); check_expand_groups->set_active(cfg.ExpandGroups); + { + check_activate_aliases->set_active(cfg.UseAliases); + + m_tree_model_aliases = Gtk::ListStore::create(m_columns); + treeview_aliases->set_model(m_tree_model_aliases); + + const AliasList &list = pm.AliasGetList(); + AliasList::const_iterator it; + int i = 0; + for (it = list.begin(); it != list.end(); ++it, i++) { + const Alias &a = *it; + Gtk::TreeModel::Row row = *(m_tree_model_aliases->append()); + + row[m_columns.m_row] = i; + row[m_columns.m_first] = a.match; + row[m_columns.m_second] = a.replace; + } + + treeview_aliases->append_column("Match", m_columns.m_first); + treeview_aliases->append_column("Replace", m_columns.m_second); + } + char font[256]; snprintf(font, sizeof font, "%s %d", cfg.FontFace.c_str(), cfg.FontSize); fontbutton_font->set_font_name(font); @@ -268,6 +290,8 @@ Preferences::Preferences(BaseObjectType *cobject, const Glib::RefPtrsignal_clicked().connect(sigc::mem_fun(*this, &Preferences::on_check_expand_clients_click)); check_expand_groups->signal_clicked().connect(sigc::mem_fun(*this, &Preferences::on_check_expand_groups_click)); + check_activate_aliases->signal_clicked().connect(sigc::mem_fun(*this, &Preferences::on_check_activate_aliases_click)); + spin_cell_padding->signal_value_changed().connect(sigc::mem_fun(*this, &Preferences::on_spin_cell_padding_click)); } @@ -300,6 +324,13 @@ void Preferences::on_check_expand_groups_click() cfg.ExpandGroups = check_expand_groups->get_active(); } +void Preferences::on_check_activate_aliases_click() +{ + cfg.UseAliases = check_activate_aliases->get_active(); + pm.Refresh(); + g->Refresh(); +} + void Preferences::on_spin_cell_padding_click() { cfg.CellPadding = spin_cell_padding->get_value(); diff --git a/src/gui.h b/src/gui.h index f836501..21368eb 100644 --- a/src/gui.h +++ b/src/gui.h @@ -101,7 +101,28 @@ protected: void on_check_expand_clients_click(); void on_check_expand_groups_click(); + void on_check_activate_aliases_click(); + void on_spin_cell_padding_click(); + + class ModelColumns : public Gtk::TreeModel::ColumnRecord + { + public: + ModelColumns() + { + add(m_row); + add(m_first); + add(m_second); + } + + Gtk::TreeModelColumn m_row; + Gtk::TreeModelColumn m_first; + Gtk::TreeModelColumn m_second; + }; + + ModelColumns m_columns; + Glib::RefPtr m_tree_model_connections; + Glib::RefPtr m_tree_model_aliases; }; extern Gui *g; diff --git a/src/jsweeper.glade b/src/jsweeper.glade index cac7504..9f7fa9e 100644 --- a/src/jsweeper.glade +++ b/src/jsweeper.glade @@ -1,6 +1,6 @@ - + JACK Sweeper @@ -425,6 +425,9 @@ 0 True + + False + @@ -458,6 +461,9 @@ True 0 + + False + @@ -469,6 +475,7 @@ 0 + False 1 @@ -482,6 +489,7 @@ 0 + False 2 @@ -535,9 +543,6 @@ - - False - @@ -578,6 +583,9 @@ 0 True + + False + @@ -587,7 +595,7 @@ True True - GTK_POLICY_AUTOMATIC + GTK_POLICY_NEVER GTK_POLICY_AUTOMATIC GTK_SHADOW_IN @@ -611,6 +619,9 @@ True 0 + + False + @@ -622,6 +633,7 @@ 0 + False 1 @@ -635,6 +647,7 @@ 0 + False 2 @@ -677,6 +690,19 @@ 1 + + + True + True + Use client side only aliases + 0 + True + + + False + 2 + + 1 @@ -689,7 +715,6 @@ - False 1 @@ -750,27 +775,12 @@ 6 6 - - True - True - 0 0 100 1 10 10 - - - 1 - 2 - 1 - 2 - - - - + True 0 - Cell padding: + Font: - 1 - 2 GTK_FILL @@ -787,15 +797,30 @@ - + True 0 - Font: + Cell padding: + 1 + 2 GTK_FILL + + + True + True + 0 0 100 1 10 10 + + + 1 + 2 + 1 + 2 + + 1 @@ -847,147 +872,53 @@ 6 6 - + True + 0 + Background: - 2 - 3 - 4 - 5 GTK_FILL - + True 0 - Grid lines (ports): + Client tabs: - 2 - 3 - 3 - 4 - GTK_FILL - - - - - True - 0 - Grid lines (groups): - - - 2 - 3 - 2 - 3 - GTK_FILL - - - - - True - 0 - Grid lines (clients): - - - 2 - 3 1 2 GTK_FILL - - True - - - 3 - 4 - 4 - 5 - GTK_FILL - - - - - True - True - True - 0 - #000000000000 - - - 3 - 4 - 3 - 4 - - - - - - True - True - True - 0 - #000000000000 - - - 3 - 4 - 2 - 3 - - - - - - True - True - True - 0 - #000000000000 - - - 3 - 4 - 1 - 2 - - - - - - True - True - True - 0 - #000000000000 - - - 3 - 4 - - - - - + True 0 - Foreground: + Port group tabs: - 2 - 3 + 2 + 3 GTK_FILL - + + True + 0 + Audio port tabs: + + + 3 + 4 + GTK_FILL + + + + True True True @@ -997,25 +928,11 @@ 1 2 - 4 - 5 - GTK_EXPAND + - - True - 0 - MIDI port tabs: - - - 4 - 5 - GTK_FILL - - - - + True True True @@ -1025,8 +942,8 @@ 1 2 - 3 - 4 + 1 + 2 GTK_EXPAND @@ -1047,7 +964,7 @@ - + True True True @@ -1057,13 +974,25 @@ 1 2 - 1 - 2 + 3 + 4 GTK_EXPAND - + + True + 0 + MIDI port tabs: + + + 4 + 5 + GTK_FILL + + + + True True True @@ -1073,52 +1002,148 @@ 1 2 - + 4 + 5 + GTK_EXPAND - + True 0 - Audio port tabs: + Foreground: - 3 - 4 + 2 + 3 GTK_FILL - + True - 0 - Port group tabs: + True + True + 0 + #000000000000 + 3 + 4 + + + + + + True + True + True + 0 + #000000000000 + + + 3 + 4 + 1 + 2 + + + + + + True + True + True + 0 + #000000000000 + + + 3 + 4 + 2 + 3 + + + + + + True + True + True + 0 + #000000000000 + + + 3 + 4 + 3 + 4 + + + + + + True + + + 3 + 4 + 4 + 5 + GTK_FILL + + + + + True + 0 + Grid lines (clients): + + + 2 + 3 + 1 + 2 + GTK_FILL + + + + + True + 0 + Grid lines (groups): + + + 2 + 3 2 3 GTK_FILL - + True 0 - Client tabs: + Grid lines (ports): - 1 - 2 + 2 + 3 + 3 + 4 GTK_FILL - + True - 0 - Background: + 2 + 3 + 4 + 5 GTK_FILL @@ -1236,29 +1261,25 @@ 6 6 - + True True - Stop after matching rule - 0 - True + 1 2 - 2 - 3 + 1 + 2 - + True - 0 - _Source match rule: - True - True + True - GTK_FILL + 1 + 2 @@ -1276,25 +1297,29 @@ - + True - True + 0 + _Source match rule: + True + True - 1 - 2 + GTK_FILL - + True True + Stop after matching rule + 0 + True - 1 2 - 1 - 2 + 2 + 3 @@ -1359,29 +1384,25 @@ 6 6 - + True True - Stop after matching rule - 0 - True + 1 2 - 2 - 3 + 1 + 2 - + True - 0 - _Match rule: - True - True + True - GTK_FILL + 1 + 2 @@ -1399,25 +1420,29 @@ - + True - True + 0 + _Match rule: + True + True - 1 - 2 + GTK_FILL - + True True + Stop after matching rule + 0 + True - 1 2 - 1 - 2 + 2 + 3