From c425e61bb9d88e67bee0a240a031919ea46b313e Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 19 May 2011 21:29:47 +0000 Subject: [PATCH] Fix double MIDI track display on initial load. git-svn-id: svn://localhost/ardour2/branches/3.0@9559 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/midi_time_axis.cc | 17 +++++++++++------ gtk2_ardour/midi_time_axis.h | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc index 2f06fdb127..cf37ace16a 100644 --- a/gtk2_ardour/midi_time_axis.cc +++ b/gtk2_ardour/midi_time_axis.cc @@ -227,7 +227,7 @@ MidiTimeAxisView::MidiTimeAxisView (PublicEditor& ed, Session* sess, } } - set_color_mode (_color_mode, true); + set_color_mode (_color_mode, true, false); } void @@ -761,17 +761,20 @@ 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, false))); + sigc::bind (sigc::mem_fun (*this, &MidiTimeAxisView::set_color_mode), + MeterColors, false, true))); _meter_color_mode_item = dynamic_cast(&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, false))); + sigc::bind (sigc::mem_fun (*this, &MidiTimeAxisView::set_color_mode), + ChannelColors, false, true))); _channel_color_mode_item = dynamic_cast(&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, false))); + sigc::bind (sigc::mem_fun (*this, &MidiTimeAxisView::set_color_mode), + TrackColor, false, true))); _channel_color_mode_item = dynamic_cast(&items.back()); _channel_color_mode_item->set_active(_color_mode == TrackColor); @@ -790,7 +793,7 @@ MidiTimeAxisView::set_note_mode(NoteMode mode) } void -MidiTimeAxisView::set_color_mode (ColorMode mode, bool force) +MidiTimeAxisView::set_color_mode (ColorMode mode, bool force, bool redisplay) { if (_color_mode == mode && !force) { return; @@ -804,7 +807,9 @@ MidiTimeAxisView::set_color_mode (ColorMode mode, bool force) _color_mode = mode; xml_node->add_property ("color-mode", enum_2_string(_color_mode)); - _view->redisplay_track(); + if (redisplay) { + _view->redisplay_track(); + } } void diff --git a/gtk2_ardour/midi_time_axis.h b/gtk2_ardour/midi_time_axis.h index c18c6c33ce..489ce0ccd3 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, bool force = false); + void set_color_mode (ARDOUR::ColorMode, bool force=false, bool redisplay=true); void set_note_range(MidiStreamView::VisibleNoteRange range); void route_active_changed ();