summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-01-10 18:11:02 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-01-10 18:11:02 +0000
commitdbff8105ab7fd67d9e458f7e87620b9151fa1ba8 (patch)
tree24182cc6949b3adb169b1bbfedf473004267cc0a
parent935eba7979e05a4ec811ad082b3298ac87c919d2 (diff)
mo' better fixes for managing MIDI CC/automation lanes
git-svn-id: svn://localhost/ardour2/branches/3.0@6473 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--gtk2_ardour/midi_time_axis.cc38
-rw-r--r--gtk2_ardour/route_time_axis.cc47
-rw-r--r--gtk2_ardour/time_axis_view.cc2
3 files changed, 65 insertions, 22 deletions
diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc
index 0c8997059c..d1a60ce04a 100644
--- a/gtk2_ardour/midi_time_axis.cc
+++ b/gtk2_ardour/midi_time_axis.cc
@@ -1060,7 +1060,45 @@ MidiTimeAxisView::toggle_note_selection_region_view (RegionView* rv, uint8_t not
void
MidiTimeAxisView::set_channel_mode (ChannelMode, uint16_t)
{
+ /* hide all automation tracks that use the wrong channel(s) and show all those that use
+ the right ones.
+ */
+
+ uint16_t selected_channels = _channel_selector.get_selected_channels();
+ bool changed = false;
+
+ no_redraw = true;
+
+ for (uint32_t ctl = 0; ctl < 127; ++ctl) {
+
+ for (uint32_t chn = 0; chn < 16; ++chn) {
+ Evoral::Parameter fully_qualified_param (MidiCCAutomation, chn, ctl);
+ RouteAutomationNode* node = automation_track (fully_qualified_param);
+
+ if (!node) {
+ continue;
+ }
+
+ if ((selected_channels & (0x0001 << chn)) == 0) {
+ /* channel not in use. hiding it will trigger RouteTimeAxisView::automation_track_hidden()
+ which will cause a redraw. We don't want one per channel, so block that with no_redraw.
+ */
+ changed = node->track->set_visibility (false) || changed;
+ } else {
+ changed = node->track->set_visibility (true) || changed;
+ }
+ }
+ }
+
+ no_redraw = false;
+
+ /* TODO: Bender, PgmChange, Pressure */
+
/* invalidate the controller menu, so that we rebuilt it next time */
delete controller_menu;
controller_menu = 0;
+
+ if (changed) {
+ _route->gui_changed ("track_height", this);
+ }
}
diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc
index 826afc511c..e0b75b3d0a 100644
--- a/gtk2_ardour/route_time_axis.cc
+++ b/gtk2_ardour/route_time_axis.cc
@@ -857,7 +857,7 @@ RouteTimeAxisView::set_height (uint32_t h)
name_label.set_text (_route->name());
}
- if (height_changed) {
+ if (height_changed && !no_redraw) {
/* only emit the signal if the height really changed */
_route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
}
@@ -1623,15 +1623,17 @@ void
RouteTimeAxisView::toggle_automation_track (const Evoral::Parameter& param)
{
RouteAutomationNode* node = automation_track(param);
-
+
if (!node) {
- /* add it */
+ /* it doesn't exist yet, so we don't care about the button state: just add it */
create_automation_child (param, true);
} else {
-
- if (node->track->set_visibility (node->menu_item->get_active())) {
+ bool yn = node->menu_item->get_active();
+ if (node->track->set_visibility (node->menu_item->get_active()) && yn) {
- /* we changed the visibility, now trigger a redisplay */
+ /* we made it visible, now trigger a redisplay. if it was hidden, then automation_track_hidden()
+ will have done that for us.
+ */
if (!no_redraw) {
_route->gui_changed (X_("track_height"), (void *) 0); /* EMIT_SIGNAL */
@@ -1644,20 +1646,23 @@ void
RouteTimeAxisView::automation_track_hidden (Evoral::Parameter param)
{
RouteAutomationNode* ran = automation_track(param);
+
if (!ran) {
return;
}
// if Evoral::Parameter::operator< doesn't obey strict weak ordering, we may crash here....
- _show_automation.erase(param);
+ _show_automation.erase (param);
ran->track->get_state_node()->add_property (X_("shown"), X_("no"));
if (ran->menu_item && !_hidden) {
+ ignore_toggle = true;
ran->menu_item->set_active (false);
+ ignore_toggle = false;
}
- if (_route) {
- _route->gui_changed ("visible_tracks", (void *) 0); /* EMIT_SIGNAL */
+ if (_route && !no_redraw) {
+ _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
}
}
@@ -1694,7 +1699,7 @@ RouteTimeAxisView::show_all_automation ()
/* Redraw */
- _route->gui_changed ("visible_tracks", (void *) 0); /* EMIT_SIGNAL */
+ _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
}
void
@@ -1727,7 +1732,7 @@ RouteTimeAxisView::show_existing_automation ()
no_redraw = false;
- _route->gui_changed ("visible_tracks", (void *) 0); /* EMIT_SIGNAL */
+ _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
}
void
@@ -1755,7 +1760,7 @@ RouteTimeAxisView::hide_all_automation ()
_show_automation.clear();
no_redraw = false;
- _route->gui_changed ("visible_tracks", (void *) 0); /* EMIT_SIGNAL */
+ _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
}
@@ -1897,7 +1902,9 @@ RouteTimeAxisView::processor_automation_track_hidden (RouteTimeAxisView::Process
i->mark_automation_visible (pan->what, false);
- _route->gui_changed ("visible_tracks", (void *) 0); /* EMIT_SIGNAL */
+ if (!no_redraw) {
+ _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
+ }
}
void
@@ -1953,7 +1960,9 @@ RouteTimeAxisView::add_automation_child (Evoral::Parameter param, boost::shared_
_show_automation.insert (param);
}
- _route->gui_changed ("visible_tracks", (void *) 0); /* EMIT_SIGNAL */
+ if (!no_redraw) {
+ _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
+ }
if (!EventTypeMap::instance().is_midi_parameter(param)) {
/* MIDI-related parameters are always in the menu, there's no
@@ -1966,7 +1975,6 @@ RouteTimeAxisView::add_automation_child (Evoral::Parameter param, boost::shared_
}
}
-
void
RouteTimeAxisView::add_processor_to_subplugin_menu (boost::weak_ptr<Processor> p)
{
@@ -2086,10 +2094,7 @@ RouteTimeAxisView::processor_menu_item_toggled (RouteTimeAxisView::ProcessorAuto
}
if (redraw && !no_redraw) {
-
- /* now trigger a redisplay */
-
- _route->gui_changed ("visible_tracks", (void *) 0); /* EMIT_SIGNAL */
+ _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
}
}
@@ -2133,8 +2138,8 @@ RouteTimeAxisView::processors_changed (RouteProcessorChange c)
i = tmp;
}
- if (deleted_processor_automation) {
- _route->gui_changed ("visible_tracks", this);
+ if (deleted_processor_automation && !no_redraw) {
+ _route->gui_changed ("track_height", this);
}
}
diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc
index d17c1b8338..983bd8c33b 100644
--- a/gtk2_ardour/time_axis_view.cc
+++ b/gtk2_ardour/time_axis_view.cc
@@ -1367,7 +1367,7 @@ TimeAxisView::set_visibility (bool yn)
canvas_display()->show();
} else {
set_marked_for_display (false);
- canvas_display()->hide ();
+ hide ();
}
return true; // things changed
}