summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2011-05-16 18:18:13 +0000
committerCarl Hetherington <carl@carlh.net>2011-05-16 18:18:13 +0000
commit739030372838d0eb71481ed8a4750fe9df6f2945 (patch)
tree39d33c6e0112bab5e9c53d0545e18d3f0ca3c079
parent29dd7bbac783b3f28527c7aa5a7a1fbe94e84e08 (diff)
Make MIDI channel selector button colours more distinct (#3772).
git-svn-id: svn://localhost/ardour2/branches/3.0@9524 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--gtk2_ardour/ardour3_ui_dark.rc.in10
-rw-r--r--gtk2_ardour/midi_channel_selector.cc8
-rw-r--r--gtk2_ardour/midi_channel_selector.h4
-rw-r--r--gtk2_ardour/midi_time_axis.cc32
-rw-r--r--gtk2_ardour/midi_time_axis.h2
-rw-r--r--libs/gtkmm2ext/gtkmm2ext/stateful_button.h6
6 files changed, 39 insertions, 23 deletions
diff --git a/gtk2_ardour/ardour3_ui_dark.rc.in b/gtk2_ardour/ardour3_ui_dark.rc.in
index 0658655e35..570c3b97c3 100644
--- a/gtk2_ardour/ardour3_ui_dark.rc.in
+++ b/gtk2_ardour/ardour3_ui_dark.rc.in
@@ -25,6 +25,7 @@
#@color arm #F33
#@color solo #A8F730
+#@color midi_channel_selector #A8F730
#@color isolate #B9ECF2
#@color mute #FFFA87
#@color mono #DEC
@@ -712,6 +713,14 @@ style "transport_rec_button_alternate"
bg[ACTIVE] = @@COLPREFIX@_arm
}
+style "midi_channel_selector_button"
+{
+ bg[NORMAL] = @@COLPREFIX@_bg
+ bg[ACTIVE] = @@COLPREFIX@_midi_channel_selector
+ fg[NORMAL] = @@COLPREFIX@_fg
+ fg[ACTIVE] = @@COLPREFIX@_darkest
+}
+
style "shuttle_control" = "very_small_text"
{
fg[NORMAL] = @@COLPREFIX@_control_text2
@@ -1831,6 +1840,7 @@ widget "*SoloSafeLED" style:highest "solo_safe_led"
widget "*SoloLEDLabel" style:highest "very_small_text"
widget "*ContrastingPopup" style:highest "contrasting_popup"
widget "*ContrastingPopup*" style:highest "contrasting_popup"
+widget "*MidiChannelSelectorButton" style:highest "midi_channel_selector_button"
widget "*RouteNameEditorEntry" style:highest "text_cell_entry"
widget "*RegionNameEditorEntry" style:highest "text_cell_entry"
diff --git a/gtk2_ardour/midi_channel_selector.cc b/gtk2_ardour/midi_channel_selector.cc
index e5416c81ff..cdaf42e51f 100644
--- a/gtk2_ardour/midi_channel_selector.cc
+++ b/gtk2_ardour/midi_channel_selector.cc
@@ -52,11 +52,11 @@ MidiChannelSelector::MidiChannelSelector(int n_rows, int n_columns, int start_ro
sigc::mem_fun(this, &MidiChannelSelector::button_toggled),
&_buttons[row][column],
channel_nr - 1));
+ _buttons[row][column].set_widget_name (X_("MidiChannelSelectorButton"));
_buttons[row][column].signal_button_release_event().connect(
sigc::mem_fun(this, &MidiChannelSelector::was_clicked), false);
-
int table_row = start_row + row;
int table_column = start_column + column;
attach(_buttons[row][column], table_column, table_column + 1, table_row, table_row + 1);
@@ -95,8 +95,10 @@ MidiChannelSelector::set_default_channel_color()
{
for (int row = 0; row < 4; ++row) {
for (int column = 0; column < 4; ++column) {
- _buttons[row][column].unset_bg(STATE_NORMAL);
- _buttons[row][column].unset_bg(STATE_ACTIVE);
+ _buttons[row][column].unset_fg (STATE_NORMAL);
+ _buttons[row][column].unset_fg (STATE_ACTIVE);
+ _buttons[row][column].unset_bg (STATE_NORMAL);
+ _buttons[row][column].unset_bg (STATE_ACTIVE);
}
}
}
diff --git a/gtk2_ardour/midi_channel_selector.h b/gtk2_ardour/midi_channel_selector.h
index 2777282e2c..de20b4db8e 100644
--- a/gtk2_ardour/midi_channel_selector.h
+++ b/gtk2_ardour/midi_channel_selector.h
@@ -25,8 +25,8 @@
#include "sigc++/trackable.h"
#include "gtkmm/table.h"
#include "gtkmm/button.h"
-#include "gtkmm/togglebutton.h"
#include "gtkmm/label.h"
+#include "gtkmm2ext/stateful_button.h"
#include "ardour/types.h"
@@ -45,7 +45,7 @@ public:
protected:
virtual void button_toggled(Gtk::ToggleButton* button, uint8_t button_nr) = 0;
Gtk::Label _button_labels[4][4];
- Gtk::ToggleButton _buttons[4][4];
+ Gtkmm2ext::StatefulToggleButton _buttons[4][4];
int _recursion_counter;
bool was_clicked (GdkEventButton*);
};
diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc
index 2f809ce2e1..7b080dd97d 100644
--- a/gtk2_ardour/midi_time_axis.cc
+++ b/gtk2_ardour/midi_time_axis.cc
@@ -226,6 +226,8 @@ MidiTimeAxisView::MidiTimeAxisView (PublicEditor& ed, Session* sess,
_percussion_mode_item->set_active (_note_mode == Percussive);
}
}
+
+ set_color_mode (_color_mode, true);
}
void
@@ -759,17 +761,17 @@ MidiTimeAxisView::build_color_mode_menu()
RadioMenuItem::Group mode_group;
items.push_back (RadioMenuElem (mode_group, _("Meter Colors"),
- sigc::bind (sigc::mem_fun (*this, &MidiTimeAxisView::set_color_mode), MeterColors)));
+ sigc::bind (sigc::mem_fun (*this, &MidiTimeAxisView::set_color_mode), MeterColors, false)));
_meter_color_mode_item = dynamic_cast<RadioMenuItem*>(&items.back());
_meter_color_mode_item->set_active(_color_mode == MeterColors);
items.push_back (RadioMenuElem (mode_group, _("Channel Colors"),
- sigc::bind (sigc::mem_fun (*this, &MidiTimeAxisView::set_color_mode), ChannelColors)));
+ sigc::bind (sigc::mem_fun (*this, &MidiTimeAxisView::set_color_mode), ChannelColors, false)));
_channel_color_mode_item = dynamic_cast<RadioMenuItem*>(&items.back());
_channel_color_mode_item->set_active(_color_mode == ChannelColors);
items.push_back (RadioMenuElem (mode_group, _("Track Color"),
- sigc::bind (sigc::mem_fun (*this, &MidiTimeAxisView::set_color_mode), TrackColor)));
+ sigc::bind (sigc::mem_fun (*this, &MidiTimeAxisView::set_color_mode), TrackColor, false)));
_channel_color_mode_item = dynamic_cast<RadioMenuItem*>(&items.back());
_channel_color_mode_item->set_active(_color_mode == TrackColor);
@@ -788,19 +790,21 @@ MidiTimeAxisView::set_note_mode(NoteMode mode)
}
void
-MidiTimeAxisView::set_color_mode(ColorMode mode)
+MidiTimeAxisView::set_color_mode (ColorMode mode, bool force)
{
- if (_color_mode != mode) {
- if (mode == ChannelColors) {
- _channel_selector.set_channel_colors(CanvasNoteEvent::midi_channel_colors);
- } else {
- _channel_selector.set_default_channel_color();
- }
-
- _color_mode = mode;
- xml_node->add_property ("color-mode", enum_2_string(_color_mode));
- _view->redisplay_track();
+ if (_color_mode == mode && !force) {
+ return;
}
+
+ if (mode == ChannelColors) {
+ _channel_selector.set_channel_colors(CanvasNoteEvent::midi_channel_colors);
+ } else {
+ _channel_selector.set_default_channel_color();
+ }
+
+ _color_mode = mode;
+ xml_node->add_property ("color-mode", enum_2_string(_color_mode));
+ _view->redisplay_track();
}
void
diff --git a/gtk2_ardour/midi_time_axis.h b/gtk2_ardour/midi_time_axis.h
index 88dcb9d917..c18c6c33ce 100644
--- a/gtk2_ardour/midi_time_axis.h
+++ b/gtk2_ardour/midi_time_axis.h
@@ -117,7 +117,7 @@ class MidiTimeAxisView : public RouteTimeAxisView
Gtk::Menu* build_color_mode_menu();
void set_note_mode (ARDOUR::NoteMode mode);
- void set_color_mode(ARDOUR::ColorMode mode);
+ void set_color_mode (ARDOUR::ColorMode, bool force = false);
void set_note_range(MidiStreamView::VisibleNoteRange range);
void route_active_changed ();
diff --git a/libs/gtkmm2ext/gtkmm2ext/stateful_button.h b/libs/gtkmm2ext/gtkmm2ext/stateful_button.h
index b69dba83fc..5954d4de45 100644
--- a/libs/gtkmm2ext/gtkmm2ext/stateful_button.h
+++ b/libs/gtkmm2ext/gtkmm2ext/stateful_button.h
@@ -35,6 +35,7 @@ class StateButton
void set_visual_state (int);
int get_visual_state () { return visual_state; }
void set_self_managed (bool yn) { _self_managed = yn; }
+ virtual void set_widget_name (const std::string& name) = 0;
protected:
int visual_state;
@@ -45,7 +46,6 @@ class StateButton
bool is_toggle;
virtual std::string get_widget_name() const = 0;
- virtual void set_widget_name (const std::string& name) = 0;
virtual Gtk::Widget* get_child_widget () = 0;
void avoid_prelight_on_style_changed (const Glib::RefPtr<Gtk::Style>& style, GtkWidget* widget);
@@ -59,6 +59,7 @@ class StatefulToggleButton : public StateButton, public Gtk::ToggleButton
StatefulToggleButton();
explicit StatefulToggleButton(const std::string &label);
~StatefulToggleButton() {}
+ void set_widget_name (const std::string& name);
protected:
void on_realize ();
@@ -68,7 +69,6 @@ class StatefulToggleButton : public StateButton, public Gtk::ToggleButton
Gtk::Widget* get_child_widget ();
std::string get_widget_name() const { return get_name(); }
- void set_widget_name (const std::string& name);
};
class StatefulButton : public StateButton, public Gtk::Button
@@ -77,6 +77,7 @@ class StatefulButton : public StateButton, public Gtk::Button
StatefulButton();
explicit StatefulButton(const std::string &label);
virtual ~StatefulButton() {}
+ void set_widget_name (const std::string& name);
protected:
void on_realize ();
@@ -85,7 +86,6 @@ class StatefulButton : public StateButton, public Gtk::Button
Gtk::Widget* get_child_widget ();
std::string get_widget_name() const { return get_name(); }
- void set_widget_name (const std::string& name);
};
};