From fc7a2e9ee1616cdcb78d6b60804baff336ad07ee Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 27 Jun 2007 21:37:08 +0000 Subject: [PATCH] Added dialog to allow adding any Midi CC track. Fix display/menu generation when adding a MIDI CC track. Fix crash bug triggered by recording MIDI track with visible CC child track. git-svn-id: svn://localhost/ardour2/trunk@2073 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/SConscript | 1 + gtk2_ardour/add_route_dialog.cc | 2 +- gtk2_ardour/midi_region_view.cc | 17 +++++++++++++++-- gtk2_ardour/midi_time_axis.cc | 12 ++++++++---- gtk2_ardour/route_time_axis.cc | 9 ++++++--- 5 files changed, 31 insertions(+), 10 deletions(-) diff --git a/gtk2_ardour/SConscript b/gtk2_ardour/SConscript index 197f557a3b..3643d3ad32 100644 --- a/gtk2_ardour/SConscript +++ b/gtk2_ardour/SConscript @@ -84,6 +84,7 @@ gtkardour_files=Split(""" about.cc actions.cc add_route_dialog.cc +add_midi_cc_track_dialog.cc ardour_dialog.cc ardour_ui.cc ardour_ui2.cc diff --git a/gtk2_ardour/add_route_dialog.cc b/gtk2_ardour/add_route_dialog.cc index ea8233ff52..16d81cc589 100644 --- a/gtk2_ardour/add_route_dialog.cc +++ b/gtk2_ardour/add_route_dialog.cc @@ -117,7 +117,7 @@ AddRouteDialog::AddRouteDialog () VBox *dvbox = manage (new VBox); HBox *dhbox = manage (new HBox); - ccframe.set_label (_("Channel Configuration")); + ccframe.set_label (_("Channel Configuration")); ccframe.set_shadow_type (SHADOW_IN); dvbox->pack_start (channel_combo, true, false, 5); diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index 678f97b6c6..de8a6b7392 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -175,8 +175,21 @@ MidiRegionView::show_region_editor () GhostRegion* MidiRegionView::add_ghost (AutomationTimeAxisView& atv) { - throw; // FIXME - return NULL; + RouteTimeAxisView* rtv = dynamic_cast(&trackview); + assert(rtv); + + double unit_position = _region->position () / samples_per_unit; + GhostRegion* ghost = new GhostRegion (atv, unit_position); + + cerr << "FIXME: add notes to MIDI region ghost." << endl; + + ghost->set_height (); + ghost->set_duration (_region->length() / samples_per_unit); + ghosts.push_back (ghost); + + ghost->GoingAway.connect (mem_fun(*this, &MidiRegionView::remove_ghost)); + + return ghost; } diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc index 7db14012ef..52c9a29f12 100644 --- a/gtk2_ardour/midi_time_axis.cc +++ b/gtk2_ardour/midi_time_axis.cc @@ -49,6 +49,7 @@ #include "midi_time_axis.h" #include "automation_time_axis.h" #include "automation_midi_cc_line.h" +#include "add_midi_cc_track_dialog.h" #include "canvas_impl.h" #include "crossfade_view.h" #include "enums.h" @@ -168,10 +169,13 @@ MidiTimeAxisView::build_automation_action_menu () void MidiTimeAxisView::add_controller_track() { - /* TODO: fancy controller selection dialog here... */ - - ParamID param(MidiCCAutomation, 7); - create_automation_child(param); + AddMidiCCTrackDialog dialog; + dialog.set_transient_for(editor); + int response = dialog.run(); + if (response == Gtk::RESPONSE_ACCEPT) { + ParamID param = dialog.parameter(); + create_automation_child(param); + } } void diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index 66cf53bc33..3b89517fce 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -1786,7 +1786,7 @@ RouteTimeAxisView::add_automation_child(ParamID param, AutomationTimeAxisView* t track->Hiding.connect (bind (mem_fun (*this, &RouteTimeAxisView::automation_track_hidden), param)); - bool hideit = true; + bool hideit = false; XMLNode* node; @@ -1797,14 +1797,17 @@ RouteTimeAxisView::add_automation_child(ParamID param, AutomationTimeAxisView* t } } } + + _automation_tracks.insert(std::make_pair(param, new RouteAutomationNode(param, NULL, track))); if (hideit) { track->hide (); } else { _show_automation.insert(param); + _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */ } - - _automation_tracks.insert(std::make_pair(param, new RouteAutomationNode(param, NULL, track))); + + build_automation_action_menu(); }