13
0

Make MIDI channel selector button colours more distinct (#3772).

git-svn-id: svn://localhost/ardour2/branches/3.0@9524 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2011-05-16 18:18:13 +00:00
parent 29dd7bbac7
commit 7390303728
6 changed files with 39 additions and 23 deletions

View File

@ -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"

View File

@ -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);
}
}
}

View File

@ -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*);
};

View File

@ -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

View File

@ -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 ();

View File

@ -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);
};
};