From 05bcdd1d4c583c68ed977164913ff47e94df7adb Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 27 Jun 2007 20:23:48 +0000 Subject: Renamed Insert to Processor and Redirect to IOProcessor. git-svn-id: svn://localhost/ardour2/trunk@2071 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/SConscript | 8 +- gtk2_ardour/ardour_ui_dependents.cc | 2 +- gtk2_ardour/au_pluginui.cc | 4 +- gtk2_ardour/au_pluginui.h | 4 +- gtk2_ardour/audio_time_axis.cc | 6 +- gtk2_ardour/audio_time_axis.h | 4 +- gtk2_ardour/editor_canvas_events.cc | 8 +- gtk2_ardour/editor_items.h | 2 +- gtk2_ardour/editor_mouse.cc | 14 +- gtk2_ardour/io_selector.h | 2 +- gtk2_ardour/ladspa_pluginui.cc | 14 +- gtk2_ardour/midi_time_axis.cc | 10 +- gtk2_ardour/midi_time_axis.h | 5 +- gtk2_ardour/mixer_strip.cc | 32 +- gtk2_ardour/mixer_strip.h | 14 +- gtk2_ardour/mixer_ui.h | 2 +- gtk2_ardour/pan_automation_time_axis.h | 2 +- gtk2_ardour/plugin_automation_line.cc | 90 ++ gtk2_ardour/plugin_automation_line.h | 56 + gtk2_ardour/plugin_ui.h | 4 +- gtk2_ardour/processor_automation_time_axis.cc | 174 +++ gtk2_ardour/processor_automation_time_axis.h | 65 ++ gtk2_ardour/processor_box.cc | 1440 +++++++++++++++++++++++++ gtk2_ardour/processor_box.h | 229 ++++ gtk2_ardour/processor_selection.h | 32 + gtk2_ardour/redirect_automation_line.cc | 95 -- gtk2_ardour/redirect_automation_line.h | 57 - gtk2_ardour/redirect_automation_time_axis.cc | 173 --- gtk2_ardour/redirect_automation_time_axis.h | 65 -- gtk2_ardour/redirect_box.cc | 1440 ------------------------- gtk2_ardour/redirect_box.h | 230 ---- gtk2_ardour/redirect_selection.h | 32 - gtk2_ardour/route_params_ui.cc | 72 +- gtk2_ardour/route_params_ui.h | 30 +- gtk2_ardour/route_processor_selection.cc | 176 +++ gtk2_ardour/route_processor_selection.h | 63 ++ gtk2_ardour/route_redirect_selection.cc | 176 --- gtk2_ardour/route_redirect_selection.h | 63 -- gtk2_ardour/route_time_axis.cc | 144 ++- gtk2_ardour/route_time_axis.h | 48 +- gtk2_ardour/route_ui.h | 2 +- gtk2_ardour/selection.cc | 48 +- gtk2_ardour/selection.h | 18 +- gtk2_ardour/send_ui.h | 2 +- gtk2_ardour/time_axis_view.cc | 2 +- gtk2_ardour/visual_time_axis.cc | 2 +- gtk2_ardour/vst_pluginui.cc | 2 +- 47 files changed, 2577 insertions(+), 2586 deletions(-) create mode 100644 gtk2_ardour/plugin_automation_line.cc create mode 100644 gtk2_ardour/plugin_automation_line.h create mode 100644 gtk2_ardour/processor_automation_time_axis.cc create mode 100644 gtk2_ardour/processor_automation_time_axis.h create mode 100644 gtk2_ardour/processor_box.cc create mode 100644 gtk2_ardour/processor_box.h create mode 100644 gtk2_ardour/processor_selection.h delete mode 100644 gtk2_ardour/redirect_automation_line.cc delete mode 100644 gtk2_ardour/redirect_automation_line.h delete mode 100644 gtk2_ardour/redirect_automation_time_axis.cc delete mode 100644 gtk2_ardour/redirect_automation_time_axis.h delete mode 100644 gtk2_ardour/redirect_box.cc delete mode 100644 gtk2_ardour/redirect_box.h delete mode 100644 gtk2_ardour/redirect_selection.h create mode 100644 gtk2_ardour/route_processor_selection.cc create mode 100644 gtk2_ardour/route_processor_selection.h delete mode 100644 gtk2_ardour/route_redirect_selection.cc delete mode 100644 gtk2_ardour/route_redirect_selection.h (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/SConscript b/gtk2_ardour/SConscript index cb5cc41ae2..f2b599f076 100644 --- a/gtk2_ardour/SConscript +++ b/gtk2_ardour/SConscript @@ -168,9 +168,9 @@ plugin_selector.cc plugin_ui.cc prompter.cc public_editor.cc -redirect_automation_line.cc -redirect_automation_time_axis.cc -redirect_box.cc +plugin_automation_line.cc +processor_automation_time_axis.cc +processor_box.cc region_gain_line.cc region_selection.cc region_view.cc @@ -178,7 +178,7 @@ audio_region_view.cc midi_region_view.cc tape_region_view.cc route_params_ui.cc -route_redirect_selection.cc +route_processor_selection.cc route_ui.cc selection.cc sfdb_ui.cc diff --git a/gtk2_ardour/ardour_ui_dependents.cc b/gtk2_ardour/ardour_ui_dependents.cc index 5617cdbc4f..89abebf9cb 100644 --- a/gtk2_ardour/ardour_ui_dependents.cc +++ b/gtk2_ardour/ardour_ui_dependents.cc @@ -74,7 +74,7 @@ void ARDOUR_UI::setup_keybindings () { install_actions (); - RedirectBox::register_actions (); + ProcessorBox::register_actions (); cerr << "loading bindings from " << keybindings_path << endl; diff --git a/gtk2_ardour/au_pluginui.cc b/gtk2_ardour/au_pluginui.cc index 3f0c6f44bc..84d39393fe 100644 --- a/gtk2_ardour/au_pluginui.cc +++ b/gtk2_ardour/au_pluginui.cc @@ -19,7 +19,7 @@ */ #include -#include +#include #include @@ -123,7 +123,7 @@ AUPluginUI::~AUPluginUI () } void -AUPluginUI::plugin_going_away (ARDOUR::Redirect* ignored) +AUPluginUI::plugin_going_away (ARDOUR::IOProcessor* ignored) { ENSURE_GUI_THREAD(bind (mem_fun(*this, &AUPluginUI::plugin_going_away), ignored)); diff --git a/gtk2_ardour/au_pluginui.h b/gtk2_ardour/au_pluginui.h index 2dcefcc42f..d757ea3bf0 100644 --- a/gtk2_ardour/au_pluginui.h +++ b/gtk2_ardour/au_pluginui.h @@ -28,7 +28,7 @@ namespace ARDOUR { class AUPlugin; class PluginInsert; - class Redirect; + class IOProcessor; } class AUPluginUI @@ -41,7 +41,7 @@ class AUPluginUI WindowRef wr; boost::shared_ptr au; - void plugin_going_away (ARDOUR::Redirect*); + void plugin_going_away (ARDOUR::IOProcessor*); Component get_carbon_view_component(OSType subtype); }; diff --git a/gtk2_ardour/audio_time_axis.cc b/gtk2_ardour/audio_time_axis.cc index b259d8723d..416a86c1a5 100644 --- a/gtk2_ardour/audio_time_axis.cc +++ b/gtk2_ardour/audio_time_axis.cc @@ -39,7 +39,7 @@ #include #include -#include +#include #include #include #include @@ -102,8 +102,8 @@ AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session& sess, boost::sh /* map current state of the route */ - inserts_changed (); - reset_insert_automation_curves (); + processors_changed (); + reset_processor_automation_curves (); ensure_xml_node (); diff --git a/gtk2_ardour/audio_time_axis.h b/gtk2_ardour/audio_time_axis.h index a2f331cf6a..291a900e8b 100644 --- a/gtk2_ardour/audio_time_axis.h +++ b/gtk2_ardour/audio_time_axis.h @@ -44,8 +44,8 @@ namespace ARDOUR { class Session; class AudioDiskstream; class RouteGroup; - class Redirect; - class Insert; + class IOProcessor; + class Processor; class Location; class AudioPlaylist; } diff --git a/gtk2_ardour/editor_canvas_events.cc b/gtk2_ardour/editor_canvas_events.cc index e1ed2d2fa1..0af15d1e7d 100644 --- a/gtk2_ardour/editor_canvas_events.cc +++ b/gtk2_ardour/editor_canvas_events.cc @@ -37,7 +37,7 @@ #include "automation_pan_line.h" #include "automation_midi_cc_line.h" #include "automation_time_axis.h" -#include "redirect_automation_line.h" +#include "plugin_automation_line.h" #include "canvas_impl.h" #include "simplerect.h" @@ -591,7 +591,7 @@ Editor::canvas_control_point_event (GdkEvent *event, ArdourCanvas::Item* item, C type = GainAutomationControlPointItem; } else if (dynamic_cast (&cp->line) != 0) { type = PanAutomationControlPointItem; - } else if (dynamic_cast (&cp->line) != 0) { + } else if (dynamic_cast (&cp->line) != 0) { type = RedirectAutomationControlPointItem; } else if (dynamic_cast (&cp->line) != 0) { type = MidiCCAutomationControlPointItem; @@ -613,8 +613,8 @@ Editor::canvas_line_event (GdkEvent *event, ArdourCanvas::Item* item, Automation type = GainAutomationLineItem; } else if (dynamic_cast (al) != 0) { type = PanAutomationLineItem; - } else if (dynamic_cast (al) != 0) { - type = RedirectAutomationLineItem; + } else if (dynamic_cast (al) != 0) { + type = ProcessorAutomationLineItem; } else if (dynamic_cast (al) != 0) { type = MidiCCAutomationLineItem; } else { diff --git a/gtk2_ardour/editor_items.h b/gtk2_ardour/editor_items.h index ddba43350a..160dff3230 100644 --- a/gtk2_ardour/editor_items.h +++ b/gtk2_ardour/editor_items.h @@ -37,7 +37,7 @@ enum ItemType { PanAutomationControlPointItem, PanAutomationLineItem, RedirectAutomationControlPointItem, - RedirectAutomationLineItem, + ProcessorAutomationLineItem, MidiCCAutomationControlPointItem, MidiCCAutomationLineItem, MeterMarkerItem, diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index 773c26f67d..f6f4d3bf0b 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -547,7 +547,7 @@ Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemTyp case GainAutomationLineItem: case PanAutomationLineItem: - case RedirectAutomationLineItem: + case ProcessorAutomationLineItem: case MidiCCAutomationLineItem: start_line_grab_from_line (item, event); return true; @@ -632,7 +632,7 @@ Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemTyp case GainAutomationLineItem: case PanAutomationLineItem: - case RedirectAutomationLineItem: + case ProcessorAutomationLineItem: case MidiCCAutomationLineItem: start_line_grab_from_line (item, event); break; @@ -924,7 +924,7 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT case GainLineItem: case GainAutomationLineItem: case PanAutomationLineItem: - case RedirectAutomationLineItem: + case ProcessorAutomationLineItem: case MidiCCAutomationLineItem: case StartSelectionTrimItem: case EndSelectionTrimItem: @@ -1105,7 +1105,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_ break; case GainAutomationLineItem: - case RedirectAutomationLineItem: + case ProcessorAutomationLineItem: case MidiCCAutomationLineItem: case PanAutomationLineItem: if (mouse_mode == MouseGain || mouse_mode == MouseObject) { @@ -1228,7 +1228,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_ switch (item_type) { case GainLineItem: case GainAutomationLineItem: - case RedirectAutomationLineItem: + case ProcessorAutomationLineItem: case MidiCCAutomationLineItem: case PanAutomationLineItem: case GainControlPointItem: @@ -1302,7 +1302,7 @@ Editor::leave_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_ case GainLineItem: case GainAutomationLineItem: - case RedirectAutomationLineItem: + case ProcessorAutomationLineItem: case MidiCCAutomationLineItem: case PanAutomationLineItem: al = reinterpret_cast (item->get_data ("line")); @@ -1457,7 +1457,7 @@ Editor::motion_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item case EndSelectionTrimItem: case SelectionItem: case GainLineItem: - case RedirectAutomationLineItem: + case ProcessorAutomationLineItem: case MidiCCAutomationLineItem: case GainAutomationLineItem: case PanAutomationLineItem: diff --git a/gtk2_ardour/io_selector.h b/gtk2_ardour/io_selector.h index 625ba12d83..5ece771a63 100644 --- a/gtk2_ardour/io_selector.h +++ b/gtk2_ardour/io_selector.h @@ -47,7 +47,7 @@ namespace ARDOUR { class Session; class PortInsert; class Port; - class Redirect; + class IOProcessor; } class IOSelector : public Gtk::VBox { diff --git a/gtk2_ardour/ladspa_pluginui.cc b/gtk2_ardour/ladspa_pluginui.cc index 25c497a377..3d516d3056 100644 --- a/gtk2_ardour/ladspa_pluginui.cc +++ b/gtk2_ardour/ladspa_pluginui.cc @@ -103,9 +103,9 @@ LadspaPluginUI::LadspaPluginUI (boost::shared_ptr pi, bool scrolla pack_start (hpacker, false, false); } - insert->ActiveChanged.connect (bind(mem_fun(*this, &LadspaPluginUI::insert_active_changed), - boost::weak_ptr(insert))); - bypass_button.set_active (!insert->active()); + pi->ActiveChanged.connect (bind(mem_fun(*this, &LadspaPluginUI::processor_active_changed), + boost::weak_ptr(pi))); + bypass_button.set_active (!pi->active()); build (); } @@ -673,13 +673,13 @@ LadspaPluginUI::control_combo_changed (ControlUI* cui) } void -LadspaPluginUI::insert_active_changed (boost::weak_ptr weak_insert) +LadspaPluginUI::processor_active_changed (boost::weak_ptr weak_processor) { - ENSURE_GUI_THREAD(bind (mem_fun(*this, &LadspaPluginUI::insert_active_changed), weak_insert)); + ENSURE_GUI_THREAD(bind (mem_fun(*this, &LadspaPluginUI::processor_active_changed), weak_processor)); - boost::shared_ptr insert = weak_insert.lock(); + boost::shared_ptr processor = weak_processor.lock(); - bypass_button.set_active (!insert || !insert->active()); + bypass_button.set_active (!processor || !processor->active()); } bool diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc index 960ca36af9..7745d6ec3e 100644 --- a/gtk2_ardour/midi_time_axis.cc +++ b/gtk2_ardour/midi_time_axis.cc @@ -37,7 +37,7 @@ #include #include -#include +#include #include #include #include @@ -60,8 +60,8 @@ #include "point_selection.h" #include "prompter.h" #include "public_editor.h" -#include "redirect_automation_line.h" -#include "redirect_automation_time_axis.h" +#include "plugin_automation_line.h" +#include "processor_automation_time_axis.h" #include "midi_controller_time_axis.h" #include "region_view.h" #include "rgb_macros.h" @@ -100,13 +100,13 @@ MidiTimeAxisView::MidiTimeAxisView (PublicEditor& ed, Session& sess, boost::shar /* map current state of the route */ - inserts_changed (); + processors_changed (); ensure_xml_node (); set_state (*xml_node); - _route->inserts_changed.connect (mem_fun(*this, &MidiTimeAxisView::inserts_changed)); + _route->processors_changed.connect (mem_fun(*this, &MidiTimeAxisView::processors_changed)); if (is_track()) { diff --git a/gtk2_ardour/midi_time_axis.h b/gtk2_ardour/midi_time_axis.h index 3b06411418..6f4777e152 100644 --- a/gtk2_ardour/midi_time_axis.h +++ b/gtk2_ardour/midi_time_axis.h @@ -44,8 +44,7 @@ namespace ARDOUR { class Session; class MidiDiskstream; class RouteGroup; - class Insert; - class Insert; + class Processor; class Location; class MidiPlaylist; } @@ -71,7 +70,7 @@ class MidiTimeAxisView : public RouteTimeAxisView void route_active_changed (); - void add_insert_to_subplugin_menu (ARDOUR::Insert *); + void add_insert_to_subplugin_menu (ARDOUR::Processor *); Gtk::Menu subplugin_menu; }; diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index cb27ef4e88..cb57f9809c 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -40,7 +40,7 @@ #include #include #include -#include +#include #include #include #include @@ -85,8 +85,8 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, boost::shared_ptr rt : AxisView(sess), RouteUI (rt, sess, _("Mute"), _("Solo"), _("Record")), _mixer(mx), - pre_redirect_box (PreFader, sess, rt, mx.plugin_selector(), mx.selection(), in_mixer), - post_redirect_box (PostFader, sess, rt, mx.plugin_selector(), mx.selection(), in_mixer), + pre_processor_box (PreFader, sess, rt, mx.plugin_selector(), mx.selection(), in_mixer), + post_processor_box (PostFader, sess, rt, mx.plugin_selector(), mx.selection(), in_mixer), gpm (_route, sess), panners (_route, sess), button_table (3, 2), @@ -251,11 +251,11 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, boost::shared_ptr rt global_vpacker.pack_start (*whvbox, Gtk::PACK_SHRINK); global_vpacker.pack_start (button_table,Gtk::PACK_SHRINK); - global_vpacker.pack_start (pre_redirect_box, true, true); + global_vpacker.pack_start (pre_processor_box, true, true); global_vpacker.pack_start (middle_button_table,Gtk::PACK_SHRINK); global_vpacker.pack_start (*gain_meter_alignment,Gtk::PACK_SHRINK); global_vpacker.pack_start (bottom_button_table,Gtk::PACK_SHRINK); - global_vpacker.pack_start (post_redirect_box, true, true); + global_vpacker.pack_start (post_processor_box, true, true); if (!is_midi_track()) global_vpacker.pack_start (panners, Gtk::PACK_SHRINK); global_vpacker.pack_start (output_button, Gtk::PACK_SHRINK); @@ -332,8 +332,8 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, boost::shared_ptr rt /* now force an update of all the various elements */ - pre_redirect_box.update(); - post_redirect_box.update(); + pre_processor_box.update(); + post_processor_box.update(); mute_changed (0); solo_changed (0); name_changed (); @@ -400,8 +400,8 @@ MixerStrip::set_width (Width w, void* owner) gpm.set_width (w); panners.set_width (w); - pre_redirect_box.set_width (w); - post_redirect_box.set_width (w); + pre_processor_box.set_width (w); + post_processor_box.set_width (w); _width_owner = owner; @@ -1138,24 +1138,24 @@ MixerStrip::map_frozen () if (at) { switch (at->freeze_state()) { case AudioTrack::Frozen: - pre_redirect_box.set_sensitive (false); - post_redirect_box.set_sensitive (false); + pre_processor_box.set_sensitive (false); + post_processor_box.set_sensitive (false); speed_spinner.set_sensitive (false); break; default: - pre_redirect_box.set_sensitive (true); - post_redirect_box.set_sensitive (true); + pre_processor_box.set_sensitive (true); + post_processor_box.set_sensitive (true); speed_spinner.set_sensitive (true); break; } } - _route->foreach_insert (this, &MixerStrip::hide_insert_editor); + _route->foreach_processor (this, &MixerStrip::hide_processor_editor); } void -MixerStrip::hide_insert_editor (boost::shared_ptr insert) +MixerStrip::hide_processor_editor (boost::shared_ptr processor) { - void* gui = insert->get_gui (); + void* gui = processor->get_gui (); if (gui) { static_cast(gui)->hide (); diff --git a/gtk2_ardour/mixer_strip.h b/gtk2_ardour/mixer_strip.h index 98675d503b..b7bd20cfbd 100644 --- a/gtk2_ardour/mixer_strip.h +++ b/gtk2_ardour/mixer_strip.h @@ -43,8 +43,8 @@ #include #include #include -#include -#include +#include +#include #include @@ -53,7 +53,7 @@ #include "gain_meter.h" #include "panner_ui.h" #include "enums.h" -#include "redirect_box.h" +#include "processor_box.h" #include "ardour_dialog.h" class MotionController; @@ -66,7 +66,7 @@ namespace Gtkmm2ext { namespace ARDOUR { class Route; class Send; - class Insert; + class Processor; class Session; class PortInsert; class Bundle; @@ -121,8 +121,8 @@ class MixerStrip : public RouteUI, public Gtk::EventBox Gtk::Frame global_frame; Gtk::VBox global_vpacker; - RedirectBox pre_redirect_box; - RedirectBox post_redirect_box; + ProcessorBox pre_processor_box; + ProcessorBox post_processor_box; GainMeter gpm; PannerUI panners; @@ -239,7 +239,7 @@ class MixerStrip : public RouteUI, public Gtk::EventBox void name_changed (); void update_speed_display (); void map_frozen (); - void hide_insert_editor (boost::shared_ptr insert); + void hide_processor_editor (boost::shared_ptr processor); bool ignore_speed_adjustment; diff --git a/gtk2_ardour/mixer_ui.h b/gtk2_ardour/mixer_ui.h index d4fb6d0fb7..62fa0f7ebf 100644 --- a/gtk2_ardour/mixer_ui.h +++ b/gtk2_ardour/mixer_ui.h @@ -37,7 +37,7 @@ #include #include -#include "route_redirect_selection.h" +#include "route_processor_selection.h" #include "enums.h" namespace ARDOUR { diff --git a/gtk2_ardour/pan_automation_time_axis.h b/gtk2_ardour/pan_automation_time_axis.h index c2803c0172..d4a22ebc29 100644 --- a/gtk2_ardour/pan_automation_time_axis.h +++ b/gtk2_ardour/pan_automation_time_axis.h @@ -26,7 +26,7 @@ #include namespace ARDOUR { - class Redirect; + class IOProcessor; } class PanAutomationTimeAxisView : public AutomationTimeAxisView diff --git a/gtk2_ardour/plugin_automation_line.cc b/gtk2_ardour/plugin_automation_line.cc new file mode 100644 index 0000000000..3e340123a0 --- /dev/null +++ b/gtk2_ardour/plugin_automation_line.cc @@ -0,0 +1,90 @@ +/* + Copyright (C) 2002-2003 Paul Davis + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#include "public_editor.h" +#include "plugin_automation_line.h" +#include "audio_time_axis.h" +#include "utils.h" + +#include +#include +#include + +#include "i18n.h" + +using namespace std; +using namespace ARDOUR; +using namespace PBD; + +ProcessorAutomationLine::ProcessorAutomationLine (const string & name, Processor& proc, ParamID param, + TimeAxisView& tv, ArdourCanvas::Group& parent, AutomationList& l) + + : AutomationLine (name, tv, parent, l), + _processor(proc), + _param(param) +{ + set_verbose_cursor_uses_gain_mapping (false); + + PluginInsert *pi; + Plugin::ParameterDescriptor desc; + + if ((pi = dynamic_cast(&_processor)) == 0) { + fatal << _("insert automation created for non-plugin") << endmsg; + /*NOTREACHED*/ + } + + pi->plugin()->get_parameter_descriptor (_param, desc); + + _upper = desc.upper; + _lower = desc.lower; + + if (desc.toggled) { + no_draw = true; + return; + } + + no_draw = false; + _range = _upper - _lower; + + /* XXX set min/max for underlying curve ??? */ +} + +string +ProcessorAutomationLine::get_verbose_cursor_string (float fraction) +{ + char buf[32]; + + snprintf (buf, sizeof (buf), "%.2f", _lower + (fraction * _range)); + return buf; +} + +void +ProcessorAutomationLine::view_to_model_y (double& y) +{ + y = _lower + (y * _range); +} + +void +ProcessorAutomationLine::model_to_view_y (double& y) +{ + y = (y - _lower) / _range; + y = max (0.0, y); + y = min (y, 1.0); +} + diff --git a/gtk2_ardour/plugin_automation_line.h b/gtk2_ardour/plugin_automation_line.h new file mode 100644 index 0000000000..3a0a95786b --- /dev/null +++ b/gtk2_ardour/plugin_automation_line.h @@ -0,0 +1,56 @@ +/* + Copyright (C) 2000 Paul Davis + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#ifndef __ardour_gtk_processor_automation_line_h__ +#define __ardour_gtk_processor_automation_line_h__ + +#include + +#include "automation_line.h" + +namespace ARDOUR { + class Processor; +} + +class TimeAxisView; + +class ProcessorAutomationLine : public AutomationLine +{ + public: + ProcessorAutomationLine (const string & name, ARDOUR::Processor&, ARDOUR::ParamID param, + TimeAxisView&, ArdourCanvas::Group& parent, ARDOUR::AutomationList&); + + ARDOUR::ParamID param() const { return _param; } + ARDOUR::Processor& processor() const { return _processor; } + + string get_verbose_cursor_string (float); + + private: + ARDOUR::Processor& _processor; + ARDOUR::ParamID _param; + + float _upper; + float _lower; + float _range; + + void view_to_model_y (double&); + void model_to_view_y (double&); +}; + +#endif /* __ardour_gtk_region_gain_line_h__ */ diff --git a/gtk2_ardour/plugin_ui.h b/gtk2_ardour/plugin_ui.h index e583f11dce..83fdf05444 100644 --- a/gtk2_ardour/plugin_ui.h +++ b/gtk2_ardour/plugin_ui.h @@ -47,7 +47,7 @@ namespace ARDOUR { class PluginInsert; class Plugin; class VSTPlugin; - class Redirect; + class IOProcessor; class AUPlugin; } @@ -184,7 +184,7 @@ class LadspaPluginUI : public PlugUIBase, public Gtk::VBox void control_port_toggled (ControlUI* cui); void control_combo_changed (ControlUI* cui); - void insert_active_changed (boost::weak_ptr); + void processor_active_changed (boost::weak_ptr); void astate_clicked (ControlUI*, uint32_t parameter); void automation_state_changed (ControlUI*); diff --git a/gtk2_ardour/processor_automation_time_axis.cc b/gtk2_ardour/processor_automation_time_axis.cc new file mode 100644 index 0000000000..37c996d17e --- /dev/null +++ b/gtk2_ardour/processor_automation_time_axis.cc @@ -0,0 +1,174 @@ +/* + Copyright (C) 2003 Paul Davis + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#include +#include +#include +#include + +#include "processor_automation_time_axis.h" +#include "automation_line.h" +#include "canvas_impl.h" + +#include "i18n.h" + +using namespace ARDOUR; +using namespace PBD; +using namespace Gtk; + +ProcessorAutomationTimeAxisView::ProcessorAutomationTimeAxisView (Session& s, boost::shared_ptr r, + PublicEditor& e, TimeAxisView& parent, Canvas& canvas, std::string n, + ParamID param, Processor& proc, string state_name) + + : AxisView (s), + AutomationTimeAxisView (s, r, e, parent, canvas, n, state_name, proc.name()), + _processor(proc), + _param (param) + +{ + char buf[32]; + _xml_node = 0; + _marked_for_display = false; + + ensure_xml_node (); + + XMLNodeList kids; + XMLNodeConstIterator iter; + + kids = _xml_node->children (); + + snprintf (buf, sizeof(buf), "Port_%" PRIu32, param.id()); + + for (iter = kids.begin(); iter != kids.end(); ++iter) { + if ((*iter)->name() == buf) { + + XMLProperty *shown = (*iter)->property("shown_editor"); + + if (shown && shown->value() == "yes") { + _marked_for_display = true; + } + break; + } + } +} + +ProcessorAutomationTimeAxisView::~ProcessorAutomationTimeAxisView () +{ +} + +void +ProcessorAutomationTimeAxisView::add_automation_event (ArdourCanvas::Item* item, GdkEvent* event, nframes_t when, double y) +{ + double x = 0; + + canvas_display->w2i (x, y); + + /* compute vertical fractional position */ + + if (y < 0) + y = 0; + else if (y > height) + y = height; + + y = 1.0 - (y / height); + + /* map to model space */ + + if (!lines.empty()) { + AutomationList* alist (_processor.automation_list(_param, true)); + string description = _("add automation event to "); + description += _processor.describe_parameter (_param); + + lines.front()->view_to_model_y (y); + + _session.begin_reversible_command (description); + XMLNode &before = alist->get_state(); + alist->add (when, y); + XMLNode &after = alist->get_state(); + _session.add_command(new MementoCommand(*alist, &before, &after)); + _session.commit_reversible_command (); + _session.set_dirty (); + } +} + +void +ProcessorAutomationTimeAxisView::ensure_xml_node () +{ + if (_xml_node == 0) { + if ((_xml_node = _processor.extra_xml ("GUI")) == 0) { + _xml_node = new XMLNode ("GUI"); + _processor.add_extra_xml (*_xml_node); + } + } +} + +guint32 +ProcessorAutomationTimeAxisView::show_at (double y, int& nth, Gtk::VBox *parent) +{ + ensure_xml_node (); + update_extra_xml_shown (true); + + return TimeAxisView::show_at (y, nth, parent); +} + +void +ProcessorAutomationTimeAxisView::hide () +{ + ensure_xml_node (); + update_extra_xml_shown (false); + + TimeAxisView::hide (); +} + + +void +ProcessorAutomationTimeAxisView::update_extra_xml_shown (bool editor_shown) +{ + char buf[32]; + + XMLNodeList nlist = _xml_node->children (); + XMLNodeConstIterator i; + XMLNode * port_node = 0; + + snprintf (buf, sizeof(buf), "Port_%" PRIu32, _param.id()); + + for (i = nlist.begin(); i != nlist.end(); ++i) { + if ((*i)->name() == buf) { + port_node = (*i); + break; + } + } + + if (!port_node) { + port_node = new XMLNode(buf); + _xml_node->add_child_nocopy(*port_node); + } + + port_node->add_property ("shown_editor", editor_shown ? "yes": "no"); + +} + +void +ProcessorAutomationTimeAxisView::set_automation_state (AutoState state) +{ + if (!ignore_state_request) { + _processor.automation_list (_param, true)->set_automation_state (state); + } +} + diff --git a/gtk2_ardour/processor_automation_time_axis.h b/gtk2_ardour/processor_automation_time_axis.h new file mode 100644 index 0000000000..ec8caaf98f --- /dev/null +++ b/gtk2_ardour/processor_automation_time_axis.h @@ -0,0 +1,65 @@ +/* + Copyright (C) 2000-2007 Paul Davis + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#ifndef __ardour_gtk_processor_automation_time_axis_h__ +#define __ardour_gtk_processor_automation_time_axis_h__ + +#include + +#include "canvas.h" +#include "automation_time_axis.h" +#include + +namespace ARDOUR { + class Processor; +} + +class ProcessorAutomationTimeAxisView : public AutomationTimeAxisView +{ + public: + ProcessorAutomationTimeAxisView (ARDOUR::Session&, + boost::shared_ptr, + PublicEditor&, + TimeAxisView& parent, + ArdourCanvas::Canvas& canvas, + std::string name, + ARDOUR::ParamID param, + ARDOUR::Processor& i, + std::string state_name); + + ~ProcessorAutomationTimeAxisView(); + + void add_automation_event (ArdourCanvas::Item *item, GdkEvent *event, nframes_t, double); + + guint32 show_at (double y, int& nth, Gtk::VBox *parent); + void hide (); + + + private: + ARDOUR::Processor& _processor; + ARDOUR::ParamID _param; + XMLNode* _xml_node; + + void ensure_xml_node(); + void update_extra_xml_shown (bool editor_shown); + + void set_automation_state (ARDOUR::AutoState); +}; + +#endif /* __ardour_gtk_processor_automation_time_axis_h__ */ diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc new file mode 100644 index 0000000000..d9b0dbd845 --- /dev/null +++ b/gtk2_ardour/processor_box.cc @@ -0,0 +1,1440 @@ +/* + Copyright (C) 2000-2004 Paul Davis + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#include +#include + +#include + +#include + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ardour_ui.h" +#include "ardour_dialog.h" +#include "public_editor.h" +#include "processor_box.h" +#include "keyboard.h" +#include "plugin_selector.h" +#include "route_processor_selection.h" +#include "mixer_ui.h" +#include "actions.h" +#include "plugin_ui.h" +#include "send_ui.h" +#include "io_selector.h" +#include "utils.h" +#include "gui_thread.h" + +#include "i18n.h" + +#ifdef HAVE_AUDIOUNIT +#include "au_pluginui.h" +#endif + +using namespace sigc; +using namespace ARDOUR; +using namespace PBD; +using namespace Gtk; +using namespace Glib; +using namespace Gtkmm2ext; + +ProcessorBox* ProcessorBox::_current_processor_box = 0; +RefPtr ProcessorBox::paste_action; +bool ProcessorBox::get_colors = true; +Gdk::Color* ProcessorBox::active_processor_color; +Gdk::Color* ProcessorBox::inactive_processor_color; + +ProcessorBox::ProcessorBox (Placement pcmnt, Session& sess, boost::shared_ptr rt, PluginSelector &plugsel, + RouteRedirectSelection & rsel, bool owner_is_mixer) + : _route(rt), + _session(sess), + _owner_is_mixer (owner_is_mixer), + _placement(pcmnt), + _plugin_selector(plugsel), + _rr_selection(rsel) +{ + if (get_colors) { + active_processor_color = new Gdk::Color; + inactive_processor_color = new Gdk::Color; + set_color (*active_processor_color, rgba_from_style ("RedirectSelector", 0xff, 0, 0, 0, "fg", Gtk::STATE_ACTIVE, false )); + set_color (*inactive_processor_color, rgba_from_style ("RedirectSelector", 0xff, 0, 0, 0, "fg", Gtk::STATE_NORMAL, false )); + get_colors = false; + } + + _width = Wide; + processor_menu = 0; + send_action_menu = 0; + processor_drag_in_progress = false; + no_processor_redisplay = false; + ignore_delete = false; + ab_direction = true; + + model = ListStore::create(columns); + + RefPtr selection = processor_display.get_selection(); + selection->set_mode (Gtk::SELECTION_MULTIPLE); + selection->signal_changed().connect (mem_fun (*this, &ProcessorBox::selection_changed)); + + processor_display.set_model (model); + processor_display.append_column (X_("notshown"), columns.text); + processor_display.set_name ("RedirectSelector"); + processor_display.set_headers_visible (false); + processor_display.set_reorderable (true); + processor_display.set_size_request (-1, 40); + processor_display.get_column(0)->set_sizing(TREE_VIEW_COLUMN_FIXED); + processor_display.get_column(0)->set_fixed_width(48); + processor_display.add_object_drag (columns.processor.index(), "redirects"); + processor_display.signal_object_drop.connect (mem_fun (*this, &ProcessorBox::object_drop)); + + TreeViewColumn* name_col = processor_display.get_column(0); + CellRendererText* renderer = dynamic_cast(processor_display.get_column_cell_renderer (0)); + name_col->add_attribute(renderer->property_foreground_gdk(), columns.color); + + processor_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); + + model->signal_row_deleted().connect (mem_fun (*this, &ProcessorBox::row_deleted)); + + processor_scroller.add (processor_display); + processor_eventbox.add (processor_scroller); + + processor_scroller.set_size_request (-1, 40); + + pack_start (processor_eventbox, true, true); + + _route->processors_changed.connect (mem_fun(*this, &ProcessorBox::redisplay_processors)); + _route->GoingAway.connect (mem_fun (*this, &ProcessorBox::route_going_away)); + + processor_eventbox.signal_enter_notify_event().connect (bind (sigc::ptr_fun (ProcessorBox::enter_box), this)); + + processor_display.signal_button_press_event().connect (mem_fun(*this, &ProcessorBox::processor_button_press_event), false); + processor_display.signal_button_release_event().connect (mem_fun(*this, &ProcessorBox::processor_button_release_event)); + + /* start off as a passthru strip. we'll correct this, if necessary, + in update_diskstream_display(). + */ + + /* now force an update of all the various elements */ + + redisplay_processors (); +} + +ProcessorBox::~ProcessorBox () +{ +} + +void +ProcessorBox::route_going_away () +{ + /* don't keep updating display as processors are deleted */ + no_processor_redisplay = true; +} + +void +ProcessorBox::object_drop (string type, uint32_t cnt, const boost::shared_ptr* ptr) +{ + if (type != "redirects" || cnt == 0 || !ptr) { + return; + } + + /* do something with the dropped processors */ + + list > processors; + + for (uint32_t n = 0; n < cnt; ++n) { + processors.push_back (ptr[n]); + } + + paste_processor_list (processors); +} + +void +ProcessorBox::update() +{ + redisplay_processors (); +} + + +void +ProcessorBox::set_width (Width w) +{ + if (_width == w) { + return; + } + _width = w; + + redisplay_processors (); +} + +void +ProcessorBox::remove_processor_gui (boost::shared_ptr processor) +{ + boost::shared_ptr send; + boost::shared_ptr port_processor; + + if ((port_processor = boost::dynamic_pointer_cast (processor)) != 0) { + PortInsertUI *io_selector = reinterpret_cast (port_processor->get_gui()); + port_processor->set_gui (0); + delete io_selector; + } else if ((send = boost::dynamic_pointer_cast (processor)) != 0) { + SendUIWindow *sui = reinterpret_cast (send->get_gui()); + send->set_gui (0); + delete sui; + } +} + +void +ProcessorBox::build_send_action_menu () + +{ + using namespace Menu_Helpers; + + send_action_menu = new Menu; + send_action_menu->set_name ("ArdourContextMenu"); + MenuList& items = send_action_menu->items(); + + items.push_back (MenuElem (_("New send"), mem_fun(*this, &ProcessorBox::new_send))); + items.push_back (MenuElem (_("Show send controls"), mem_fun(*this, &ProcessorBox::show_send_controls))); +} + +void +ProcessorBox::show_send_controls () + +{ +} + +void +ProcessorBox::new_send () + +{ +} + +void +ProcessorBox::show_processor_menu (gint arg) +{ + if (processor_menu == 0) { + processor_menu = build_processor_menu (); + } + + paste_action->set_sensitive (!_rr_selection.processors.empty()); + + processor_menu->popup (1, arg); +} + +void +ProcessorBox::processor_drag_begin (GdkDragContext *context) +{ + processor_drag_in_progress = true; +} + +void +ProcessorBox::processor_drag_end (GdkDragContext *context) +{ + processor_drag_in_progress = false; +} + +bool +ProcessorBox::processor_button_press_event (GdkEventButton *ev) +{ + TreeIter iter; + TreeModel::Path path; + TreeViewColumn* column; + int cellx; + int celly; + boost::shared_ptr processor; + int ret = false; + bool selected = false; + + if (processor_display.get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly)) { + if ((iter = model->get_iter (path))) { + processor = (*iter)[columns.processor]; + selected = processor_display.get_selection()->is_selected (iter); + } + + } + + if (processor && (Keyboard::is_edit_event (ev) || (ev->button == 1 && ev->type == GDK_2BUTTON_PRESS))) { + + if (_session.engine().connected()) { + /* XXX giving an error message here is hard, because we may be in the midst of a button press */ + edit_processor (processor); + } + ret = true; + + } else if (processor && ev->button == 1 && selected) { + + // this is purely informational but necessary + InsertSelected (processor); // emit + } + + return ret; +} + +bool +ProcessorBox::processor_button_release_event (GdkEventButton *ev) +{ + TreeIter iter; + TreeModel::Path path; + TreeViewColumn* column; + int cellx; + int celly; + boost::shared_ptr processor; + int ret = false; + + + if (processor_display.get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly)) { + if ((iter = model->get_iter (path))) { + processor = (*iter)[columns.processor]; + } + } + + if (processor && Keyboard::is_delete_event (ev)) { + + Glib::signal_idle().connect (bind (mem_fun(*this, &ProcessorBox::idle_delete_processor), boost::weak_ptr(processor))); + ret = true; + + } else if (Keyboard::is_context_menu_event (ev)) { + + show_processor_menu(ev->time); + ret = true; + + } else if (processor && (ev->button == 2) && (ev->state == Gdk::BUTTON2_MASK)) { + + processor->set_active (!processor->active()); + ret = true; + + } + + return ret; +} + +Menu * +ProcessorBox::build_processor_menu () +{ + processor_menu = dynamic_cast(ActionManager::get_widget("/redirectmenu") ); + processor_menu->set_name ("ArdourContextMenu"); + + show_all_children(); + + return processor_menu; +} + +void +ProcessorBox::selection_changed () +{ + bool sensitive = (processor_display.get_selection()->count_selected_rows()) ? true : false; + ActionManager::set_sensitive (ActionManager::plugin_selection_sensitive_actions, sensitive); +} + +void +ProcessorBox::select_all_processors () +{ + processor_display.get_selection()->select_all(); +} + +void +ProcessorBox::deselect_all_processors () +{ + processor_display.get_selection()->unselect_all(); +} + +void +ProcessorBox::choose_plugin () +{ + sigc::connection newplug_connection = _plugin_selector.PluginCreated.connect (mem_fun(*this,&ProcessorBox::processor_plugin_chosen)); + _plugin_selector.show_all(); + _plugin_selector.run (); + newplug_connection.disconnect(); +} + +void +ProcessorBox::processor_plugin_chosen (boost::shared_ptr plugin) +{ + if (plugin) { + + boost::shared_ptr processor (new PluginInsert (_session, plugin, _placement)); + + processor->ActiveChanged.connect (bind (mem_fun (*this, &ProcessorBox::show_processor_active), boost::weak_ptr(processor))); + + Route::ProcessorStreams err; + + if (_route->add_processor (processor, &err)) { + weird_plugin_dialog (*plugin, err, _route); + // XXX SHAREDPTR delete plugin here .. do we even need to care? + } + } +} + +void +ProcessorBox::weird_plugin_dialog (Plugin& p, Route::ProcessorStreams streams, boost::shared_ptr io) +{ + ArdourDialog dialog (_("ardour: weird plugin dialog")); + Label label; + + /* i hate this kind of code */ + + if (streams.count > p.get_info()->n_inputs) { + label.set_text (string_compose (_( +"You attempted to add a plugin (%1).\n" +"The plugin has %2 inputs\n" +"but at the processorion point, there are\n" +"%3 active signal streams.\n" +"\n" +"This makes no sense - you are throwing away\n" +"part of the signal."), + p.name(), + p.get_info()->n_inputs.n_total(), + streams.count.n_total())); + } else if (streams.count < p.get_info()->n_inputs) { + label.set_text (string_compose (_( +"You attempted to add a plugin (%1).\n" +"The plugin has %2 inputs\n" +"but at the processorion point there are\n" +"only %3 active signal streams.\n" +"\n" +"This makes no sense - unless the plugin supports\n" +"side-chain inputs. A future version of Ardour will\n" +"support this type of configuration."), + p.name(), + p.get_info()->n_inputs.n_total(), + streams.count.n_total())); + } else { + label.set_text (string_compose (_( +"You attempted to add a plugin (%1).\n" +"\n" +"The I/O configuration doesn't make sense:\n" +"\n" +"The plugin has %2 inputs and %3 outputs.\n" +"The track/bus has %4 inputs and %5 outputs.\n" +"The processorion point, has %6 active signals.\n" +"\n" +"Ardour does not understand what to do in such situations.\n"), + p.name(), + p.get_info()->n_inputs.n_total(), + p.get_info()->n_outputs.n_total(), + io->n_inputs().n_total(), + io->n_outputs().n_total(), + streams.count.n_total())); + } + + dialog.get_vbox()->pack_start (label); + dialog.add_button (Stock::OK, RESPONSE_ACCEPT); + + dialog.set_name (X_("PluginIODialog")); + dialog.set_position (Gtk::WIN_POS_MOUSE); + dialog.set_modal (true); + dialog.show_all (); + + dialog.run (); +} + +void +ProcessorBox::choose_processor () +{ + boost::shared_ptr processor (new PortInsert (_session, _placement)); + processor->ActiveChanged.connect (bind (mem_fun(*this, &ProcessorBox::show_processor_active), boost::weak_ptr(processor))); + _route->add_processor (processor); +} + +void +ProcessorBox::choose_send () +{ + boost::shared_ptr send (new Send (_session, _placement)); + //send->set_default_type(_route->default_type()); + + /* XXX need redirect lock on route */ + + // This will be set properly in route->add_processor + send->configure_io (_route->max_processor_outs(), _route->max_processor_outs()); + + IOSelectorWindow *ios = new IOSelectorWindow (_session, send->io(), false, true); + + ios->show_all (); + + ios->selector().Finished.connect (bind (mem_fun(*this, &ProcessorBox::send_io_finished), send, ios)); +} + +void +ProcessorBox::send_io_finished (IOSelector::Result r, boost::shared_ptr send, IOSelectorWindow* ios) +{ + if (!send) { + return; + } + + switch (r) { + case IOSelector::Cancelled: + // send will go away when all shared_ptrs to it vanish + break; + + case IOSelector::Accepted: + _route->add_processor (send); + break; + } + + delete_when_idle (ios); +} + +void +ProcessorBox::redisplay_processors () +{ + ENSURE_GUI_THREAD(mem_fun(*this, &ProcessorBox::redisplay_processors)); + + if (no_processor_redisplay) { + return; + } + + ignore_delete = true; + model->clear (); + ignore_delete = false; + + processor_active_connections.clear (); + processor_name_connections.clear (); + + void (ProcessorBox::*pmf)(boost::shared_ptr) = &ProcessorBox::add_processor_to_display; + _route->foreach_processor (this, pmf); + + switch (_placement) { + case PreFader: + build_processor_tooltip(processor_eventbox, _("Pre-fader processors, sends & plugins:")); + break; + case PostFader: + build_processor_tooltip(processor_eventbox, _("Post-fader processors, sends & plugins:")); + break; + } +} + +void +ProcessorBox::add_processor_to_display (boost::shared_ptr processor) +{ + if (processor->placement() != _placement) { + return; + } + + Gtk::TreeModel::Row row = *(model->append()); + row[columns.text] = processor_name (processor); + row[columns.processor] = processor; + + show_processor_active (processor); + + processor_active_connections.push_back (processor->ActiveChanged.connect (bind (mem_fun(*this, &ProcessorBox::show_processor_active), boost::weak_ptr(processor)))); + processor_name_connections.push_back (processor->NameChanged.connect (bind (mem_fun(*this, &ProcessorBox::show_processor_name), boost::weak_ptr(processor)))); +} + +string +ProcessorBox::processor_name (boost::weak_ptr weak_processor) +{ + boost::shared_ptr processor (weak_processor.lock()); + + if (!processor) { + return string(); + } + + boost::shared_ptr send; + string name_display; + + if (!processor->active()) { + name_display = " ("; + } + + if ((send = boost::dynamic_pointer_cast (processor)) != 0) { + + name_display += '>'; + + /* grab the send name out of its overall name */ + + string::size_type lbracket, rbracket; + lbracket = send->name().find ('['); + rbracket = send->name().find (']'); + + switch (_width) { + case Wide: + name_display += send->name().substr (lbracket+1, lbracket-rbracket-1); + break; + case Narrow: + name_display += PBD::short_version (send->name().substr (lbracket+1, lbracket-rbracket-1), 4); + break; + } + + } else { + + switch (_width) { + case Wide: + name_display += processor->name(); + break; + case Narrow: + name_display += PBD::short_version (processor->name(), 5); + break; + } + + } + + if (!processor->active()) { + name_display += ')'; + } + + return name_display; +} + +void +ProcessorBox::build_processor_tooltip (EventBox& box, string start) +{ + string tip(start); + + Gtk::TreeModel::Children children = model->children(); + for(Gtk::TreeModel::Children::iterator iter = children.begin(); iter != children.end(); ++iter) { + Gtk::TreeModel::Row row = *iter; + tip += '\n'; + + /* don't use the column text, since it may be narrowed */ + + boost::shared_ptr i = row[columns.processor]; + tip += i->name(); + } + ARDOUR_UI::instance()->tooltips().set_tip (box, tip); +} + +void +ProcessorBox::show_processor_name (boost::weak_ptr processor) +{ + ENSURE_GUI_THREAD(bind (mem_fun(*this, &ProcessorBox::show_processor_name), processor)); + show_processor_active (processor); +} + +void +ProcessorBox::show_processor_active (boost::weak_ptr weak_processor) +{ + ENSURE_GUI_THREAD(bind (mem_fun(*this, &ProcessorBox::show_processor_active), weak_processor)); + + boost::shared_ptr processor (weak_processor.lock()); + + if (!processor) { + return; + } + + Gtk::TreeModel::Children children = model->children(); + Gtk::TreeModel::Children::iterator iter = children.begin(); + + while (iter != children.end()) { + + boost::shared_ptr r = (*iter)[columns.processor]; + + if (r == processor) { + (*iter)[columns.text] = processor_name (r); + + if (processor->active()) { + (*iter)[columns.color] = *active_processor_color; + } else { + (*iter)[columns.color] = *inactive_processor_color; + } + break; + } + + iter++; + } +} + +void +ProcessorBox::row_deleted (const Gtk::TreeModel::Path& path) +{ + if (!ignore_delete) { + compute_processor_sort_keys (); + } +} + +void +ProcessorBox::compute_processor_sort_keys () +{ + uint32_t sort_key = 0; + Gtk::TreeModel::Children children = model->children(); + + for (Gtk::TreeModel::Children::iterator iter = children.begin(); iter != children.end(); ++iter) { + boost::shared_ptr i = (*iter)[columns.processor]; + i->set_sort_key (sort_key); + sort_key++; + } + + if (_route->sort_processors ()) { + + redisplay_processors (); + + /* now tell them about the problem */ + + ArdourDialog dialog (_("ardour: weird plugin dialog")); + Label label; + + label.set_text (_("\ +You cannot reorder this set of processors\n\ +in that way because the inputs and\n\ +outputs do not work correctly.")); + + dialog.get_vbox()->pack_start (label); + dialog.add_button (Stock::OK, RESPONSE_ACCEPT); + + dialog.set_name (X_("PluginIODialog")); + dialog.set_position (Gtk::WIN_POS_MOUSE); + dialog.set_modal (true); + dialog.show_all (); + + dialog.run (); + } +} + +void +ProcessorBox::rename_processors () +{ + vector > to_be_renamed; + + get_selected_processors (to_be_renamed); + + if (to_be_renamed.empty()) { + return; + } + + for (vector >::iterator i = to_be_renamed.begin(); i != to_be_renamed.end(); ++i) { + rename_processor (*i); + } +} + +void +ProcessorBox::cut_processors () +{ + vector > to_be_removed; + + get_selected_processors (to_be_removed); + + if (to_be_removed.empty()) { + return; + } + + /* this essentially transfers ownership of the processor + of the processor from the route to the mixer + selection. + */ + + _rr_selection.set (to_be_removed); + + no_processor_redisplay = true; + for (vector >::iterator i = to_be_removed.begin(); i != to_be_removed.end(); ++i) { + // Do not cut processors or sends + if (boost::dynamic_pointer_cast((*i)) != 0) { + void* gui = (*i)->get_gui (); + + if (gui) { + static_cast(gui)->hide (); + } + + if (_route->remove_processor (*i)) { + /* removal failed */ + _rr_selection.remove (*i); + } + } else { + _rr_selection.remove (*i); + } + + } + no_processor_redisplay = false; + redisplay_processors (); +} + +void +ProcessorBox::copy_processors () +{ + vector > to_be_copied; + vector > copies; + + get_selected_processors (to_be_copied); + + if (to_be_copied.empty()) { + return; + } + + for (vector >::iterator i = to_be_copied.begin(); i != to_be_copied.end(); ++i) { + // Do not copy processors or sends + if (boost::dynamic_pointer_cast((*i)) != 0) { + copies.push_back (Processor::clone (*i)); + } + } + + _rr_selection.set (copies); + +} + +void +ProcessorBox::delete_processors () +{ + vector > to_be_deleted; + + get_selected_processors (to_be_deleted); + + if (to_be_deleted.empty()) { + return; + } + + for (vector >::iterator i = to_be_deleted.begin(); i != to_be_deleted.end(); ++i) { + + void* gui = (*i)->get_gui (); + + if (gui) { + static_cast(gui)->hide (); + } + + _route->remove_processor(*i); + } + + no_processor_redisplay = false; + redisplay_processors (); +} + +gint +ProcessorBox::idle_delete_processor (boost::weak_ptr weak_processor) +{ + boost::shared_ptr processor (weak_processor.lock()); + + if (!processor) { + return false; + } + + /* NOT copied to _mixer.selection() */ + + no_processor_redisplay = true; + _route->remove_processor (processor); + no_processor_redisplay = false; + redisplay_processors (); + + return false; +} + +void +ProcessorBox::rename_processor (boost::shared_ptr processor) +{ + ArdourPrompter name_prompter (true); + string result; + name_prompter.set_prompt (_("rename processor")); + name_prompter.set_initial_text (processor->name()); + name_prompter.add_button (_("Rename"), Gtk::RESPONSE_ACCEPT); + name_prompter.set_response_sensitive (Gtk::RESPONSE_ACCEPT, false); + name_prompter.show_all (); + + switch (name_prompter.run ()) { + + case Gtk::RESPONSE_ACCEPT: + name_prompter.get_result (result); + if (result.length()) { + processor->set_name (result); + } + break; + } + + return; +} + +void +ProcessorBox::cut_processor (boost::shared_ptr processor) +{ + /* this essentially transfers ownership of the processor + of the processor from the route to the mixer + selection. + */ + + _rr_selection.add (processor); + + void* gui = processor->get_gui (); + + if (gui) { + static_cast(gui)->hide (); + } + + no_processor_redisplay = true; + if (_route->remove_processor (processor)) { + _rr_selection.remove (processor); + } + no_processor_redisplay = false; + redisplay_processors (); +} + +void +ProcessorBox::copy_processor (boost::shared_ptr processor) +{ + boost::shared_ptr copy = Processor::clone (processor); + _rr_selection.add (copy); +} + +void +ProcessorBox::paste_processors () +{ + if (_rr_selection.processors.empty()) { + return; + } + + paste_processor_list (_rr_selection.processors); +} + +void +ProcessorBox::paste_processor_list (list >& processors) +{ + list > copies; + + for (list >::iterator i = processors.begin(); i != processors.end(); ++i) { + + boost::shared_ptr copy = Processor::clone (*i); + + copy->set_placement (_placement); + copies.push_back (copy); + } + + if (_route->add_processors (copies)) { + + string msg = _( + "Copying the set of processors on the clipboard failed,\n\ +probably because the I/O configuration of the plugins\n\ +could not match the configuration of this track."); + MessageDialog am (msg); + am.run (); + } +} + +void +ProcessorBox::activate_processor (boost::shared_ptr r) +{ + r->set_active (true); +} + +void +ProcessorBox::deactivate_processor (boost::shared_ptr r) +{ + r->set_active (false); +} + +void +ProcessorBox::get_selected_processors (vector >& processors) +{ + vector pathlist = processor_display.get_selection()->get_selected_rows(); + + for (vector::iterator iter = pathlist.begin(); iter != pathlist.end(); ++iter) { + processors.push_back ((*(model->get_iter(*iter)))[columns.processor]); + } +} + +void +ProcessorBox::for_selected_processors (void (ProcessorBox::*pmf)(boost::shared_ptr)) +{ + vector pathlist = processor_display.get_selection()->get_selected_rows(); + + for (vector::iterator iter = pathlist.begin(); iter != pathlist.end(); ++iter) { + boost::shared_ptr processor = (*(model->get_iter(*iter)))[columns.processor]; + (this->*pmf)(processor); + } +} + +void +ProcessorBox::clone_processors () +{ + RouteSelection& routes (_rr_selection.routes); + + if (!routes.empty()) { + if (_route->copy_processors (*routes.front(), _placement)) { + string msg = _( +"Copying the set of processors on the clipboard failed,\n\ +probably because the I/O configuration of the plugins\n\ +could not match the configuration of this track."); + MessageDialog am (msg); + am.run (); + } + } +} + +void +ProcessorBox::all_processors_active (bool state) +{ + _route->all_processors_active (_placement, state); +} + +void +ProcessorBox::all_plugins_active (bool state) +{ + if (state) { + // XXX not implemented + } else { + _route->disable_plugins (_placement); + } +} + +void +ProcessorBox::ab_plugins () +{ + _route->ab_plugins (ab_direction); + ab_direction = !ab_direction; +} + +void +ProcessorBox::clear_processors () +{ + string prompt; + vector choices; + + if (boost::dynamic_pointer_cast(_route) != 0) { + if (_placement == PreFader) { + prompt = _("Do you really want to remove all pre-fader processors from this track?\n" + "(this cannot be undone)"); + } else { + prompt = _("Do you really want to remove all post-fader processors from this track?\n" + "(this cannot be undone)"); + } + } else { + if (_placement == PreFader) { + prompt = _("Do you really want to remove all pre-fader processors from this bus?\n" + "(this cannot be undone)"); + } else { + prompt = _("Do you really want to remove all post-fader processors from this bus?\n" + "(this cannot be undone)"); + } + } + + choices.push_back (_("Cancel")); + choices.push_back (_("Yes, remove them all")); + + Gtkmm2ext::Choice prompter (prompt, choices); + + if (prompter.run () == 1) { + _route->clear_processors (_placement); + } +} + +void +ProcessorBox::edit_processor (boost::shared_ptr processor) +{ + boost::shared_ptr send; + boost::shared_ptr plugin_processor; + boost::shared_ptr port_processor; + + if (boost::dynamic_pointer_cast(_route) != 0) { + + if (boost::dynamic_pointer_cast (_route)->freeze_state() == AudioTrack::Frozen) { + return; + } + } + + if ((send = boost::dynamic_pointer_cast (send)) != 0) { + + if (!_session.engine().connected()) { + return; + } + + SendUIWindow *send_ui; + + if (send->get_gui() == 0) { + + send_ui = new SendUIWindow (send, _session); + + WindowTitle title(Glib::get_application_name()); + title += send->name(); + send_ui->set_title (title.get_string()); + + send->set_gui (send_ui); + + } else { + send_ui = reinterpret_cast (send->get_gui()); + } + + if (send_ui->is_visible()) { + send_ui->get_window()->raise (); + } else { + send_ui->show_all (); + send_ui->present (); + } + + } else if ((plugin_processor = boost::dynamic_pointer_cast (processor)) != 0) { + + ARDOUR::PluginType type = plugin_processor->type(); + + if (type == ARDOUR::LADSPA || type == ARDOUR::VST) { + PluginUIWindow *plugin_ui; + + if (plugin_processor->get_gui() == 0) { + + plugin_ui = new PluginUIWindow (plugin_processor); + + if (_owner_is_mixer) { + ARDOUR_UI::instance()->the_mixer()->ensure_float (*plugin_ui); + } else { + ARDOUR_UI::instance()->the_editor().ensure_float (*plugin_ui); + } + + WindowTitle title(Glib::get_application_name()); + title += generate_processor_title (plugin_processor); + plugin_ui->set_title (title.get_string()); + + plugin_processor->set_gui (plugin_ui); + + // change window title when route name is changed + _route->NameChanged.connect (bind (mem_fun(*this, &ProcessorBox::route_name_changed), plugin_ui, boost::weak_ptr (plugin_processor))); + + + } else { + plugin_ui = reinterpret_cast (plugin_processor->get_gui()); + } + + if (plugin_ui->is_visible()) { + plugin_ui->get_window()->raise (); + } else { + plugin_ui->show_all (); + plugin_ui->present (); + } +#ifdef HAVE_AUDIOUNIT + } else if (type == ARDOUR::AudioUnit) { + AUPluginUI* plugin_ui; + if (plugin_processor->get_gui() == 0) { + plugin_ui = new AUPluginUI (plugin_processor); + } else { + plugin_ui = reinterpret_cast (plugin_processor->get_gui()); + } + + if (plugin_ui->is_visible()) { + plugin_ui->get_window()->raise (); + } else { + plugin_ui->show_all (); + plugin_ui->present (); + } +#endif + } else { + warning << "Unsupported plugin sent to ProcessorBox::edit_processor()" << endmsg; + return; + } + + } else if ((port_processor = boost::dynamic_pointer_cast (processor)) != 0) { + + if (!_session.engine().connected()) { + MessageDialog msg ( _("Not connected to JACK - no I/O changes are possible")); + msg.run (); + return; + } + + PortInsertWindow *io_selector; + + if (port_processor->get_gui() == 0) { + io_selector = new PortInsertWindow (_session, port_processor); + port_processor->set_gui (io_selector); + + } else { + io_selector = reinterpret_cast (port_processor->get_gui()); + } + + if (io_selector->is_visible()) { + io_selector->get_window()->raise (); + } else { + io_selector->show_all (); + io_selector->present (); + } + } +} + +bool +ProcessorBox::enter_box (GdkEventCrossing *ev, ProcessorBox* rb) +{ + switch (ev->detail) { + case GDK_NOTIFY_INFERIOR: + break; + + case GDK_NOTIFY_VIRTUAL: + /* fallthru */ + + default: + _current_processor_box = rb; + } + + return false; +} + +void +ProcessorBox::register_actions () +{ + Glib::RefPtr popup_act_grp = Gtk::ActionGroup::create(X_("redirectmenu")); + Glib::RefPtr act; + + /* new stuff */ + ActionManager::register_action (popup_act_grp, X_("newplugin"), _("New Plugin ..."), sigc::ptr_fun (ProcessorBox::rb_choose_plugin)); + + act = ActionManager::register_action (popup_act_grp, X_("newprocessor"), _("New Insert"), sigc::ptr_fun (ProcessorBox::rb_choose_processor)); + ActionManager::jack_sensitive_actions.push_back (act); + act = ActionManager::register_action (popup_act_grp, X_("newsend"), _("New Send ..."), sigc::ptr_fun (ProcessorBox::rb_choose_send)); + ActionManager::jack_sensitive_actions.push_back (act); + + ActionManager::register_action (popup_act_grp, X_("clear"), _("Clear"), sigc::ptr_fun (ProcessorBox::rb_clear)); + + /* standard editing stuff */ + act = ActionManager::register_action (popup_act_grp, X_("cut"), _("Cut"), sigc::ptr_fun (ProcessorBox::rb_cut)); + ActionManager::plugin_selection_sensitive_actions.push_back(act); + act = ActionManager::register_action (popup_act_grp, X_("copy"), _("Copy"), sigc::ptr_fun (ProcessorBox::rb_copy)); + ActionManager::plugin_selection_sensitive_actions.push_back(act); + + act = ActionManager::register_action (popup_act_grp, X_("delete"), _("Delete"), sigc::ptr_fun (ProcessorBox::rb_delete)); + ActionManager::plugin_selection_sensitive_actions.push_back(act); // ?? + + paste_action = ActionManager::register_action (popup_act_grp, X_("paste"), _("Paste"), sigc::ptr_fun (ProcessorBox::rb_paste)); + act = ActionManager::register_action (popup_act_grp, X_("rename"), _("Rename"), sigc::ptr_fun (ProcessorBox::rb_rename)); + ActionManager::plugin_selection_sensitive_actions.push_back(act); + ActionManager::register_action (popup_act_grp, X_("selectall"), _("Select All"), sigc::ptr_fun (ProcessorBox::rb_select_all)); + ActionManager::register_action (popup_act_grp, X_("deselectall"), _("Deselect All"), sigc::ptr_fun (ProcessorBox::rb_deselect_all)); + + /* activation */ + act = ActionManager::register_action (popup_act_grp, X_("activate"), _("Activate"), sigc::ptr_fun (ProcessorBox::rb_activate)); + ActionManager::plugin_selection_sensitive_actions.push_back(act); + act = ActionManager::register_action (popup_act_grp, X_("deactivate"), _("Deactivate"), sigc::ptr_fun (ProcessorBox::rb_deactivate)); + ActionManager::plugin_selection_sensitive_actions.push_back(act); + ActionManager::register_action (popup_act_grp, X_("activate_all"), _("Activate all"), sigc::ptr_fun (ProcessorBox::rb_activate_all)); + ActionManager::register_action (popup_act_grp, X_("deactivate_all"), _("Deactivate all"), sigc::ptr_fun (ProcessorBox::rb_deactivate_all)); + + ActionManager::register_action (popup_act_grp, X_("a_b_plugins"), _("A/B plugins"), sigc::ptr_fun (ProcessorBox::rb_ab_plugins)); + ActionManager::register_action (popup_act_grp, X_("deactivate_plugins"), _("Deactivate plugins"), sigc::ptr_fun (ProcessorBox::rb_deactivate_plugins)); + + /* show editors */ + act = ActionManager::register_action (popup_act_grp, X_("edit"), _("Edit"), sigc::ptr_fun (ProcessorBox::rb_edit)); + ActionManager::plugin_selection_sensitive_actions.push_back(act); + + ActionManager::add_action_group (popup_act_grp); + + +} + +void +ProcessorBox::rb_choose_plugin () +{ + if (_current_processor_box == 0) { + return; + } + _current_processor_box->choose_plugin (); +} + +void +ProcessorBox::rb_choose_processor () +{ + if (_current_processor_box == 0) { + return; + } + _current_processor_box->choose_processor (); +} + +void +ProcessorBox::rb_choose_send () +{ + if (_current_processor_box == 0) { + return; + } + _current_processor_box->choose_send (); +} + +void +ProcessorBox::rb_clear () +{ + if (_current_processor_box == 0) { + return; + } + + _current_processor_box->clear_processors (); +} + +void +ProcessorBox::rb_cut () +{ + if (_current_processor_box == 0) { + return; + } + + _current_processor_box->cut_processors (); +} + +void +ProcessorBox::rb_delete () +{ + if (_current_processor_box == 0) { + return; + } + + _current_processor_box->delete_processors (); +} + +void +ProcessorBox::rb_copy () +{ + if (_current_processor_box == 0) { + return; + } + _current_processor_box->copy_processors (); +} + +void +ProcessorBox::rb_paste () +{ + if (_current_processor_box == 0) { + return; + } + + _current_processor_box->paste_processors (); +} + +void +ProcessorBox::rb_rename () +{ + if (_current_processor_box == 0) { + return; + } + _current_processor_box->rename_processors (); +} + +void +ProcessorBox::rb_select_all () +{ + if (_current_processor_box == 0) { + return; + } + + _current_processor_box->select_all_processors (); +} + +void +ProcessorBox::rb_deselect_all () +{ + if (_current_processor_box == 0) { + return; + } + + _current_processor_box->deselect_all_processors (); +} + +void +ProcessorBox::rb_activate () +{ + if (_current_processor_box == 0) { + return; + } + + _current_processor_box->for_selected_processors (&ProcessorBox::activate_processor); +} + +void +ProcessorBox::rb_deactivate () +{ + if (_current_processor_box == 0) { + return; + } + _current_processor_box->for_selected_processors (&ProcessorBox::deactivate_processor); +} + +void +ProcessorBox::rb_activate_all () +{ + if (_current_processor_box == 0) { + return; + } + + _current_processor_box->all_processors_active (true); +} + +void +ProcessorBox::rb_deactivate_all () +{ + if (_current_processor_box == 0) { + return; + } + _current_processor_box->all_processors_active (false); +} + +void +ProcessorBox::rb_deactivate_plugins () +{ + if (_current_processor_box == 0) { + return; + } + _current_processor_box->all_plugins_active (false); +} + + +void +ProcessorBox::rb_ab_plugins () +{ + if (_current_processor_box == 0) { + return; + } + + _current_processor_box->ab_plugins (); +} + + +void +ProcessorBox::rb_edit () +{ + if (_current_processor_box == 0) { + return; + } + + _current_processor_box->for_selected_processors (&ProcessorBox::edit_processor); +} + +void +ProcessorBox::route_name_changed (PluginUIWindow* plugin_ui, boost::weak_ptr wpi) +{ + ENSURE_GUI_THREAD(bind (mem_fun (*this, &ProcessorBox::route_name_changed), plugin_ui, wpi)); + boost::shared_ptr pi (wpi.lock()); + + + if (pi) { + WindowTitle title(Glib::get_application_name()); + title += generate_processor_title (pi); + plugin_ui->set_title (title.get_string()); + } +} + +string +ProcessorBox::generate_processor_title (boost::shared_ptr pi) +{ + string maker = pi->plugin()->maker(); + string::size_type email_pos; + + if ((email_pos = maker.find_first_of ('<')) != string::npos) { + maker = maker.substr (0, email_pos - 1); + } + + if (maker.length() > 32) { + maker = maker.substr (0, 32); + maker += " ..."; + } + + return string_compose(_("%1: %2 (by %3)"), _route->name(), pi->name(), maker); +} + diff --git a/gtk2_ardour/processor_box.h b/gtk2_ardour/processor_box.h new file mode 100644 index 0000000000..11a3b91fd0 --- /dev/null +++ b/gtk2_ardour/processor_box.h @@ -0,0 +1,229 @@ +/* + Copyright (C) 2004 Paul Davis + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#ifndef __ardour_gtk_processor_box__ +#define __ardour_gtk_processor_box__ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +#include + +#include "route_ui.h" +#include "io_selector.h" +#include "enums.h" + +class MotionController; +class PluginSelector; +class PluginUIWindow; +class RouteRedirectSelection; + +namespace ARDOUR { + class Bundle; + class Processor; + class Plugin; + class PluginInsert; + class PortInsert; + class Route; + class Send; + class Session; +} + + +class ProcessorBox : public Gtk::HBox +{ + public: + ProcessorBox (ARDOUR::Placement, ARDOUR::Session&, + boost::shared_ptr, PluginSelector &, RouteRedirectSelection &, bool owner_is_mixer = false); + ~ProcessorBox (); + + void set_width (Width); + + void update(); + + void select_all_processors (); + void deselect_all_processors (); + void select_all_plugins (); + void select_all_sends (); + + sigc::signal > InsertSelected; + sigc::signal > InsertUnselected; + + static void register_actions(); + + protected: + void set_stuff_from_route (); + + private: + boost::shared_ptr _route; + ARDOUR::Session & _session; + bool _owner_is_mixer; + bool ab_direction; + + ARDOUR::Placement _placement; + + PluginSelector & _plugin_selector; + RouteRedirectSelection & _rr_selection; + + void route_going_away (); + + struct ModelColumns : public Gtk::TreeModel::ColumnRecord { + ModelColumns () { + add (text); + add (processor); + add (color); + } + Gtk::TreeModelColumn text; + Gtk::TreeModelColumn > processor; + Gtk::TreeModelColumn color; + }; + + ModelColumns columns; + Glib::RefPtr model; + + void selection_changed (); + + static bool get_colors; + static Gdk::Color* active_processor_color; + static Gdk::Color* inactive_processor_color; + + Gtk::EventBox processor_eventbox; + Gtk::HBox processor_hpacker; + Gtkmm2ext::DnDTreeView > processor_display; + Gtk::ScrolledWindow processor_scroller; + + void object_drop (std::string type, uint32_t cnt, const boost::shared_ptr*); + + Width _width; + + Gtk::Menu *send_action_menu; + void build_send_action_menu (); + + void new_send (); + void show_send_controls (); + + Gtk::Menu *processor_menu; + gint processor_menu_map_handler (GdkEventAny *ev); + Gtk::Menu * build_processor_menu (); + void build_processor_tooltip (Gtk::EventBox&, string); + void show_processor_menu (gint arg); + + void choose_send (); + void send_io_finished (IOSelector::Result, boost::shared_ptr, IOSelectorWindow*); + void choose_processor (); + void choose_plugin (); + void processor_plugin_chosen (boost::shared_ptr); + + bool no_processor_redisplay; + bool ignore_delete; + + bool processor_button_press_event (GdkEventButton *); + bool processor_button_release_event (GdkEventButton *); + void redisplay_processors (); + void add_processor_to_display (boost::shared_ptr); + void row_deleted (const Gtk::TreeModel::Path& path); + void show_processor_active (boost::weak_ptr); + void show_processor_name (boost::weak_ptr); + string processor_name (boost::weak_ptr); + + void remove_processor_gui (boost::shared_ptr); + + void processors_reordered (const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator&, int*); + void compute_processor_sort_keys (); + vector processor_active_connections; + vector processor_name_connections; + + bool processor_drag_in_progress; + void processor_drag_begin (GdkDragContext*); + void processor_drag_end (GdkDragContext*); + void all_processors_active(bool state); + void all_plugins_active(bool state); + void ab_plugins (); + + void cut_processors (); + void copy_processors (); + void paste_processors (); + void delete_processors (); + void clear_processors (); + void clone_processors (); + void rename_processors (); + + void for_selected_processors (void (ProcessorBox::*pmf)(boost::shared_ptr)); + void get_selected_processors (vector >&); + + static Glib::RefPtr paste_action; + void paste_processor_list (std::list >& processors); + + void activate_processor (boost::shared_ptr); + void deactivate_processor (boost::shared_ptr); + void cut_processor (boost::shared_ptr); + void copy_processor (boost::shared_ptr); + void edit_processor (boost::shared_ptr); + void hide_processor_editor (boost::shared_ptr); + void rename_processor (boost::shared_ptr); + + gint idle_delete_processor (boost::weak_ptr); + + void weird_plugin_dialog (ARDOUR::Plugin& p, ARDOUR::Route::ProcessorStreams streams, boost::shared_ptr io); + + static ProcessorBox* _current_processor_box; + static bool enter_box (GdkEventCrossing*, ProcessorBox*); + static bool leave_box (GdkEventCrossing*, ProcessorBox*); + + static void rb_choose_plugin (); + static void rb_choose_processor (); + static void rb_choose_send (); + static void rb_clear (); + static void rb_cut (); + static void rb_copy (); + static void rb_paste (); + static void rb_delete (); + static void rb_rename (); + static void rb_select_all (); + static void rb_deselect_all (); + static void rb_activate (); + static void rb_deactivate (); + static void rb_activate_all (); + static void rb_deactivate_all (); + static void rb_edit (); + static void rb_ab_plugins (); + static void rb_deactivate_plugins (); + + void route_name_changed (PluginUIWindow* plugin_ui, boost::weak_ptr pi); + std::string generate_processor_title (boost::shared_ptr pi); +}; + +#endif /* __ardour_gtk_processor_box__ */ diff --git a/gtk2_ardour/processor_selection.h b/gtk2_ardour/processor_selection.h new file mode 100644 index 0000000000..e9abcea2dc --- /dev/null +++ b/gtk2_ardour/processor_selection.h @@ -0,0 +1,32 @@ +/* + Copyright (C) 2000-2007 Paul Davis + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#ifndef __ardour_gtk_processor_selection_h__ +#define __ardour_gtk_processor_selection_h__ + +#include +#include + +namespace ARDOUR { + class Processor; +} + +struct ProcessorSelection : list > {}; + +#endif /* __ardour_gtk_processor_selection_h__ */ diff --git a/gtk2_ardour/redirect_automation_line.cc b/gtk2_ardour/redirect_automation_line.cc deleted file mode 100644 index 5680a8b98f..0000000000 --- a/gtk2_ardour/redirect_automation_line.cc +++ /dev/null @@ -1,95 +0,0 @@ -/* - Copyright (C) 2002-2003 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include "public_editor.h" -#include "redirect_automation_line.h" -#include "audio_time_axis.h" -#include "utils.h" - -#include -#include -#include -#include - -#include "i18n.h" - -using namespace std; -using namespace ARDOUR; -using namespace PBD; - -RedirectAutomationLine::RedirectAutomationLine (const string & name, Insert& i, ParamID param, Session& s, - - TimeAxisView& tv, ArdourCanvas::Group& parent, - - AutomationList& l) - - : AutomationLine (name, tv, parent, l), - session (s), - _insert (i), - _param (param) -{ - set_verbose_cursor_uses_gain_mapping (false); - - PluginInsert *pi; - Plugin::ParameterDescriptor desc; - - if ((pi = dynamic_cast(&_insert)) == 0) { - fatal << _("insert automation created for non-plugin") << endmsg; - /*NOTREACHED*/ - } - - pi->plugin()->get_parameter_descriptor (_param, desc); - - upper = desc.upper; - lower = desc.lower; - - if (desc.toggled) { - no_draw = true; - return; - } - - no_draw = false; - range = upper - lower; - - /* XXX set min/max for underlying curve ??? */ -} - -string -RedirectAutomationLine::get_verbose_cursor_string (float fraction) -{ - char buf[32]; - - snprintf (buf, sizeof (buf), "%.2f", lower + (fraction * range)); - return buf; -} - -void -RedirectAutomationLine::view_to_model_y (double& y) -{ - y = lower + (y * range); -} - -void -RedirectAutomationLine::model_to_view_y (double& y) -{ - y = (y - lower) / range; - y = max (0.0, y); - y = min (y, 1.0); -} - diff --git a/gtk2_ardour/redirect_automation_line.h b/gtk2_ardour/redirect_automation_line.h deleted file mode 100644 index d0e3aa8897..0000000000 --- a/gtk2_ardour/redirect_automation_line.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - Copyright (C) 2000 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#ifndef __ardour_gtk_redirect_automation_line_h__ -#define __ardour_gtk_redirect_automation_line_h__ - -#include - -#include "automation_line.h" - -namespace ARDOUR { - class Session; - class Insert; -} - -class TimeAxisView; - -class RedirectAutomationLine : public AutomationLine -{ - public: - RedirectAutomationLine (const string & name, ARDOUR::Insert&, ARDOUR::ParamID param, ARDOUR::Session&, TimeAxisView&, - ArdourCanvas::Group& parent, ARDOUR::AutomationList&); - - ARDOUR::ParamID param() const { return _param; } - ARDOUR::Insert& insert() const { return _insert; } - - string get_verbose_cursor_string (float); - - private: - ARDOUR::Session& session; - ARDOUR::Insert& _insert; - ARDOUR::ParamID _param; - float upper; - float lower; - float range; - - void view_to_model_y (double&); - void model_to_view_y (double&); -}; - -#endif /* __ardour_gtk_region_gain_line_h__ */ diff --git a/gtk2_ardour/redirect_automation_time_axis.cc b/gtk2_ardour/redirect_automation_time_axis.cc deleted file mode 100644 index bb7937cdf7..0000000000 --- a/gtk2_ardour/redirect_automation_time_axis.cc +++ /dev/null @@ -1,173 +0,0 @@ -/* - Copyright (C) 2003 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include -#include -#include -#include - -#include "redirect_automation_time_axis.h" -#include "automation_line.h" -#include "canvas_impl.h" - -#include "i18n.h" - -using namespace ARDOUR; -using namespace PBD; -using namespace Gtk; - -RedirectAutomationTimeAxisView::RedirectAutomationTimeAxisView (Session& s, boost::shared_ptr r, - PublicEditor& e, TimeAxisView& parent, Canvas& canvas, std::string n, - ParamID p, Insert& i, string state_name) - - : AxisView (s), - AutomationTimeAxisView (s, r, e, parent, canvas, n, state_name, i.name()), - insert (i), - param (p) - -{ - char buf[32]; - xml_node = 0; - _marked_for_display = false; - - ensure_xml_node (); - - XMLNodeList kids; - XMLNodeConstIterator iter; - - kids = xml_node->children (); - - snprintf (buf, sizeof(buf), "Port_%" PRIu32, param.id()); - - for (iter = kids.begin(); iter != kids.end(); ++iter) { - if ((*iter)->name() == buf) { - - XMLProperty *shown = (*iter)->property("shown_editor"); - - if (shown && shown->value() == "yes") { - _marked_for_display = true; - } - break; - } - } -} - -RedirectAutomationTimeAxisView::~RedirectAutomationTimeAxisView () -{ -} - -void -RedirectAutomationTimeAxisView::add_automation_event (ArdourCanvas::Item* item, GdkEvent* event, nframes_t when, double y) -{ - double x = 0; - - canvas_display->w2i (x, y); - - /* compute vertical fractional position */ - - if (y < 0) - y = 0; - else if (y > height) - y = height; - - y = 1.0 - (y / height); - - /* map to model space */ - - if (!lines.empty()) { - AutomationList* alist (insert.automation_list(param, true)); - string description = _("add automation event to "); - description += insert.describe_parameter (param); - - lines.front()->view_to_model_y (y); - - _session.begin_reversible_command (description); - XMLNode &before = alist->get_state(); - alist->add (when, y); - XMLNode &after = alist->get_state(); - _session.add_command(new MementoCommand(*alist, &before, &after)); - _session.commit_reversible_command (); - _session.set_dirty (); - } -} - -void -RedirectAutomationTimeAxisView::ensure_xml_node () -{ - if (xml_node == 0) { - if ((xml_node = insert.extra_xml ("GUI")) == 0) { - xml_node = new XMLNode ("GUI"); - insert.add_extra_xml (*xml_node); - } - } -} - -guint32 -RedirectAutomationTimeAxisView::show_at (double y, int& nth, Gtk::VBox *parent) -{ - ensure_xml_node (); - update_extra_xml_shown (true); - - return TimeAxisView::show_at (y, nth, parent); -} - -void -RedirectAutomationTimeAxisView::hide () -{ - ensure_xml_node (); - update_extra_xml_shown (false); - - TimeAxisView::hide (); -} - - -void -RedirectAutomationTimeAxisView::update_extra_xml_shown (bool editor_shown) -{ - char buf[32]; - - XMLNodeList nlist = xml_node->children (); - XMLNodeConstIterator i; - XMLNode * port_node = 0; - - snprintf (buf, sizeof(buf), "Port_%" PRIu32, param.id()); - - for (i = nlist.begin(); i != nlist.end(); ++i) { - if ((*i)->name() == buf) { - port_node = (*i); - break; - } - } - - if (!port_node) { - port_node = new XMLNode(buf); - xml_node->add_child_nocopy(*port_node); - } - - port_node->add_property ("shown_editor", editor_shown ? "yes": "no"); - -} - -void -RedirectAutomationTimeAxisView::set_automation_state (AutoState state) -{ - if (!ignore_state_request) { - insert.automation_list (param, true)->set_automation_state (state); - } -} diff --git a/gtk2_ardour/redirect_automation_time_axis.h b/gtk2_ardour/redirect_automation_time_axis.h deleted file mode 100644 index d87e4faca5..0000000000 --- a/gtk2_ardour/redirect_automation_time_axis.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (C) 2000-2007 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#ifndef __ardour_gtk_redirect_automation_time_axis_h__ -#define __ardour_gtk_redirect_automation_time_axis_h__ - -#include - -#include "canvas.h" -#include "automation_time_axis.h" -#include - -namespace ARDOUR { - class Redirect; -} - -class RedirectAutomationTimeAxisView : public AutomationTimeAxisView -{ - public: - RedirectAutomationTimeAxisView (ARDOUR::Session&, - boost::shared_ptr, - PublicEditor&, - TimeAxisView& parent, - ArdourCanvas::Canvas& canvas, - std::string name, - ARDOUR::ParamID param, - ARDOUR::Insert& i, - std::string state_name); - - ~RedirectAutomationTimeAxisView(); - - void add_automation_event (ArdourCanvas::Item *item, GdkEvent *event, nframes_t, double); - - guint32 show_at (double y, int& nth, Gtk::VBox *parent); - void hide (); - - - private: - ARDOUR::Insert& insert; - ARDOUR::ParamID param; - - XMLNode *xml_node; - void ensure_xml_node(); - void update_extra_xml_shown (bool editor_shown); - - void set_automation_state (ARDOUR::AutoState); -}; - -#endif /* __ardour_gtk_redirect_automation_time_axis_h__ */ diff --git a/gtk2_ardour/redirect_box.cc b/gtk2_ardour/redirect_box.cc deleted file mode 100644 index 0402b0e1f6..0000000000 --- a/gtk2_ardour/redirect_box.cc +++ /dev/null @@ -1,1440 +0,0 @@ -/* - Copyright (C) 2000-2004 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include -#include - -#include - -#include - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "ardour_ui.h" -#include "ardour_dialog.h" -#include "public_editor.h" -#include "redirect_box.h" -#include "keyboard.h" -#include "plugin_selector.h" -#include "route_redirect_selection.h" -#include "mixer_ui.h" -#include "actions.h" -#include "plugin_ui.h" -#include "send_ui.h" -#include "io_selector.h" -#include "utils.h" -#include "gui_thread.h" - -#include "i18n.h" - -#ifdef HAVE_AUDIOUNIT -#include "au_pluginui.h" -#endif - -using namespace sigc; -using namespace ARDOUR; -using namespace PBD; -using namespace Gtk; -using namespace Glib; -using namespace Gtkmm2ext; - -RedirectBox* RedirectBox::_current_insert_box = 0; -RefPtr RedirectBox::paste_action; -bool RedirectBox::get_colors = true; -Gdk::Color* RedirectBox::active_insert_color; -Gdk::Color* RedirectBox::inactive_insert_color; - -RedirectBox::RedirectBox (Placement pcmnt, Session& sess, boost::shared_ptr rt, PluginSelector &plugsel, - RouteRedirectSelection & rsel, bool owner_is_mixer) - : _route(rt), - _session(sess), - _owner_is_mixer (owner_is_mixer), - _placement(pcmnt), - _plugin_selector(plugsel), - _rr_selection(rsel) -{ - if (get_colors) { - active_insert_color = new Gdk::Color; - inactive_insert_color = new Gdk::Color; - set_color (*active_insert_color, rgba_from_style ("RedirectSelector", 0xff, 0, 0, 0, "fg", Gtk::STATE_ACTIVE, false )); - set_color (*inactive_insert_color, rgba_from_style ("RedirectSelector", 0xff, 0, 0, 0, "fg", Gtk::STATE_NORMAL, false )); - get_colors = false; - } - - _width = Wide; - insert_menu = 0; - send_action_menu = 0; - insert_drag_in_progress = false; - no_insert_redisplay = false; - ignore_delete = false; - ab_direction = true; - - model = ListStore::create(columns); - - RefPtr selection = insert_display.get_selection(); - selection->set_mode (Gtk::SELECTION_MULTIPLE); - selection->signal_changed().connect (mem_fun (*this, &RedirectBox::selection_changed)); - - insert_display.set_model (model); - insert_display.append_column (X_("notshown"), columns.text); - insert_display.set_name ("RedirectSelector"); - insert_display.set_headers_visible (false); - insert_display.set_reorderable (true); - insert_display.set_size_request (-1, 40); - insert_display.get_column(0)->set_sizing(TREE_VIEW_COLUMN_FIXED); - insert_display.get_column(0)->set_fixed_width(48); - insert_display.add_object_drag (columns.insert.index(), "redirects"); - insert_display.signal_object_drop.connect (mem_fun (*this, &RedirectBox::object_drop)); - - TreeViewColumn* name_col = insert_display.get_column(0); - CellRendererText* renderer = dynamic_cast(insert_display.get_column_cell_renderer (0)); - name_col->add_attribute(renderer->property_foreground_gdk(), columns.color); - - insert_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); - - model->signal_row_deleted().connect (mem_fun (*this, &RedirectBox::row_deleted)); - - insert_scroller.add (insert_display); - insert_eventbox.add (insert_scroller); - - insert_scroller.set_size_request (-1, 40); - - pack_start (insert_eventbox, true, true); - - _route->inserts_changed.connect (mem_fun(*this, &RedirectBox::redisplay_inserts)); - _route->GoingAway.connect (mem_fun (*this, &RedirectBox::route_going_away)); - - insert_eventbox.signal_enter_notify_event().connect (bind (sigc::ptr_fun (RedirectBox::enter_box), this)); - - insert_display.signal_button_press_event().connect (mem_fun(*this, &RedirectBox::insert_button_press_event), false); - insert_display.signal_button_release_event().connect (mem_fun(*this, &RedirectBox::insert_button_release_event)); - - /* start off as a passthru strip. we'll correct this, if necessary, - in update_diskstream_display(). - */ - - /* now force an update of all the various elements */ - - redisplay_inserts (); -} - -RedirectBox::~RedirectBox () -{ -} - -void -RedirectBox::route_going_away () -{ - /* don't keep updating display as inserts are deleted */ - no_insert_redisplay = true; -} - -void -RedirectBox::object_drop (string type, uint32_t cnt, const boost::shared_ptr* ptr) -{ - if (type != "redirects" || cnt == 0 || !ptr) { - return; - } - - /* do something with the dropped inserts */ - - list > inserts; - - for (uint32_t n = 0; n < cnt; ++n) { - inserts.push_back (ptr[n]); - } - - paste_insert_list (inserts); -} - -void -RedirectBox::update() -{ - redisplay_inserts (); -} - - -void -RedirectBox::set_width (Width w) -{ - if (_width == w) { - return; - } - _width = w; - - redisplay_inserts (); -} - -void -RedirectBox::remove_insert_gui (boost::shared_ptr insert) -{ - boost::shared_ptr send; - boost::shared_ptr port_insert; - - if ((port_insert = boost::dynamic_pointer_cast (insert)) != 0) { - PortInsertUI *io_selector = reinterpret_cast (port_insert->get_gui()); - port_insert->set_gui (0); - delete io_selector; - } else if ((send = boost::dynamic_pointer_cast (insert)) != 0) { - SendUIWindow *sui = reinterpret_cast (send->get_gui()); - send->set_gui (0); - delete sui; - } -} - -void -RedirectBox::build_send_action_menu () - -{ - using namespace Menu_Helpers; - - send_action_menu = new Menu; - send_action_menu->set_name ("ArdourContextMenu"); - MenuList& items = send_action_menu->items(); - - items.push_back (MenuElem (_("New send"), mem_fun(*this, &RedirectBox::new_send))); - items.push_back (MenuElem (_("Show send controls"), mem_fun(*this, &RedirectBox::show_send_controls))); -} - -void -RedirectBox::show_send_controls () - -{ -} - -void -RedirectBox::new_send () - -{ -} - -void -RedirectBox::show_insert_menu (gint arg) -{ - if (insert_menu == 0) { - insert_menu = build_insert_menu (); - } - - paste_action->set_sensitive (!_rr_selection.inserts.empty()); - - insert_menu->popup (1, arg); -} - -void -RedirectBox::insert_drag_begin (GdkDragContext *context) -{ - insert_drag_in_progress = true; -} - -void -RedirectBox::insert_drag_end (GdkDragContext *context) -{ - insert_drag_in_progress = false; -} - -bool -RedirectBox::insert_button_press_event (GdkEventButton *ev) -{ - TreeIter iter; - TreeModel::Path path; - TreeViewColumn* column; - int cellx; - int celly; - boost::shared_ptr insert; - int ret = false; - bool selected = false; - - if (insert_display.get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly)) { - if ((iter = model->get_iter (path))) { - insert = (*iter)[columns.insert]; - selected = insert_display.get_selection()->is_selected (iter); - } - - } - - if (insert && (Keyboard::is_edit_event (ev) || (ev->button == 1 && ev->type == GDK_2BUTTON_PRESS))) { - - if (_session.engine().connected()) { - /* XXX giving an error message here is hard, because we may be in the midst of a button press */ - edit_insert (insert); - } - ret = true; - - } else if (insert && ev->button == 1 && selected) { - - // this is purely informational but necessary - InsertSelected (insert); // emit - } - - return ret; -} - -bool -RedirectBox::insert_button_release_event (GdkEventButton *ev) -{ - TreeIter iter; - TreeModel::Path path; - TreeViewColumn* column; - int cellx; - int celly; - boost::shared_ptr insert; - int ret = false; - - - if (insert_display.get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly)) { - if ((iter = model->get_iter (path))) { - insert = (*iter)[columns.insert]; - } - } - - if (insert && Keyboard::is_delete_event (ev)) { - - Glib::signal_idle().connect (bind (mem_fun(*this, &RedirectBox::idle_delete_insert), boost::weak_ptr(insert))); - ret = true; - - } else if (Keyboard::is_context_menu_event (ev)) { - - show_insert_menu(ev->time); - ret = true; - - } else if (insert && (ev->button == 2) && (ev->state == Gdk::BUTTON2_MASK)) { - - insert->set_active (!insert->active()); - ret = true; - - } - - return ret; -} - -Menu * -RedirectBox::build_insert_menu () -{ - insert_menu = dynamic_cast(ActionManager::get_widget("/redirectmenu") ); - insert_menu->set_name ("ArdourContextMenu"); - - show_all_children(); - - return insert_menu; -} - -void -RedirectBox::selection_changed () -{ - bool sensitive = (insert_display.get_selection()->count_selected_rows()) ? true : false; - ActionManager::set_sensitive (ActionManager::plugin_selection_sensitive_actions, sensitive); -} - -void -RedirectBox::select_all_inserts () -{ - insert_display.get_selection()->select_all(); -} - -void -RedirectBox::deselect_all_inserts () -{ - insert_display.get_selection()->unselect_all(); -} - -void -RedirectBox::choose_plugin () -{ - sigc::connection newplug_connection = _plugin_selector.PluginCreated.connect (mem_fun(*this,&RedirectBox::insert_plugin_chosen)); - _plugin_selector.show_all(); - _plugin_selector.run (); - newplug_connection.disconnect(); -} - -void -RedirectBox::insert_plugin_chosen (boost::shared_ptr plugin) -{ - if (plugin) { - - boost::shared_ptr insert (new PluginInsert (_session, plugin, _placement)); - - insert->ActiveChanged.connect (bind (mem_fun (*this, &RedirectBox::show_insert_active), boost::weak_ptr(insert))); - - Route::InsertStreams err; - - if (_route->add_insert (insert, &err)) { - weird_plugin_dialog (*plugin, err, _route); - // XXX SHAREDPTR delete plugin here .. do we even need to care? - } - } -} - -void -RedirectBox::weird_plugin_dialog (Plugin& p, Route::InsertStreams streams, boost::shared_ptr io) -{ - ArdourDialog dialog (_("ardour: weird plugin dialog")); - Label label; - - /* i hate this kind of code */ - - if (streams.count > p.get_info()->n_inputs) { - label.set_text (string_compose (_( -"You attempted to add a plugin (%1).\n" -"The plugin has %2 inputs\n" -"but at the insertion point, there are\n" -"%3 active signal streams.\n" -"\n" -"This makes no sense - you are throwing away\n" -"part of the signal."), - p.name(), - p.get_info()->n_inputs.n_total(), - streams.count.n_total())); - } else if (streams.count < p.get_info()->n_inputs) { - label.set_text (string_compose (_( -"You attempted to add a plugin (%1).\n" -"The plugin has %2 inputs\n" -"but at the insertion point there are\n" -"only %3 active signal streams.\n" -"\n" -"This makes no sense - unless the plugin supports\n" -"side-chain inputs. A future version of Ardour will\n" -"support this type of configuration."), - p.name(), - p.get_info()->n_inputs.n_total(), - streams.count.n_total())); - } else { - label.set_text (string_compose (_( -"You attempted to add a plugin (%1).\n" -"\n" -"The I/O configuration doesn't make sense:\n" -"\n" -"The plugin has %2 inputs and %3 outputs.\n" -"The track/bus has %4 inputs and %5 outputs.\n" -"The insertion point, has %6 active signals.\n" -"\n" -"Ardour does not understand what to do in such situations.\n"), - p.name(), - p.get_info()->n_inputs.n_total(), - p.get_info()->n_outputs.n_total(), - io->n_inputs().n_total(), - io->n_outputs().n_total(), - streams.count.n_total())); - } - - dialog.get_vbox()->pack_start (label); - dialog.add_button (Stock::OK, RESPONSE_ACCEPT); - - dialog.set_name (X_("PluginIODialog")); - dialog.set_position (Gtk::WIN_POS_MOUSE); - dialog.set_modal (true); - dialog.show_all (); - - dialog.run (); -} - -void -RedirectBox::choose_insert () -{ - boost::shared_ptr insert (new PortInsert (_session, _placement)); - insert->ActiveChanged.connect (bind (mem_fun(*this, &RedirectBox::show_insert_active), boost::weak_ptr(insert))); - _route->add_insert (insert); -} - -void -RedirectBox::choose_send () -{ - boost::shared_ptr send (new Send (_session, _placement)); - //send->set_default_type(_route->default_type()); - - /* XXX need redirect lock on route */ - - // This will be set properly in route->add_insert - send->configure_io (_route->max_insert_outs(), _route->max_insert_outs()); - - IOSelectorWindow *ios = new IOSelectorWindow (_session, send->io(), false, true); - - ios->show_all (); - - ios->selector().Finished.connect (bind (mem_fun(*this, &RedirectBox::send_io_finished), send, ios)); -} - -void -RedirectBox::send_io_finished (IOSelector::Result r, boost::shared_ptr send, IOSelectorWindow* ios) -{ - if (!send) { - return; - } - - switch (r) { - case IOSelector::Cancelled: - // send will go away when all shared_ptrs to it vanish - break; - - case IOSelector::Accepted: - _route->add_insert (send); - break; - } - - delete_when_idle (ios); -} - -void -RedirectBox::redisplay_inserts () -{ - ENSURE_GUI_THREAD(mem_fun(*this, &RedirectBox::redisplay_inserts)); - - if (no_insert_redisplay) { - return; - } - - ignore_delete = true; - model->clear (); - ignore_delete = false; - - insert_active_connections.clear (); - insert_name_connections.clear (); - - void (RedirectBox::*pmf)(boost::shared_ptr) = &RedirectBox::add_insert_to_display; - _route->foreach_insert (this, pmf); - - switch (_placement) { - case PreFader: - build_insert_tooltip(insert_eventbox, _("Pre-fader inserts, sends & plugins:")); - break; - case PostFader: - build_insert_tooltip(insert_eventbox, _("Post-fader inserts, sends & plugins:")); - break; - } -} - -void -RedirectBox::add_insert_to_display (boost::shared_ptr insert) -{ - if (insert->placement() != _placement) { - return; - } - - Gtk::TreeModel::Row row = *(model->append()); - row[columns.text] = insert_name (insert); - row[columns.insert] = insert; - - show_insert_active (insert); - - insert_active_connections.push_back (insert->ActiveChanged.connect (bind (mem_fun(*this, &RedirectBox::show_insert_active), boost::weak_ptr(insert)))); - insert_name_connections.push_back (insert->NameChanged.connect (bind (mem_fun(*this, &RedirectBox::show_insert_name), boost::weak_ptr(insert)))); -} - -string -RedirectBox::insert_name (boost::weak_ptr weak_insert) -{ - boost::shared_ptr insert (weak_insert.lock()); - - if (!insert) { - return string(); - } - - boost::shared_ptr send; - string name_display; - - if (!insert->active()) { - name_display = " ("; - } - - if ((send = boost::dynamic_pointer_cast (insert)) != 0) { - - name_display += '>'; - - /* grab the send name out of its overall name */ - - string::size_type lbracket, rbracket; - lbracket = send->name().find ('['); - rbracket = send->name().find (']'); - - switch (_width) { - case Wide: - name_display += send->name().substr (lbracket+1, lbracket-rbracket-1); - break; - case Narrow: - name_display += PBD::short_version (send->name().substr (lbracket+1, lbracket-rbracket-1), 4); - break; - } - - } else { - - switch (_width) { - case Wide: - name_display += insert->name(); - break; - case Narrow: - name_display += PBD::short_version (insert->name(), 5); - break; - } - - } - - if (!insert->active()) { - name_display += ')'; - } - - return name_display; -} - -void -RedirectBox::build_insert_tooltip (EventBox& box, string start) -{ - string tip(start); - - Gtk::TreeModel::Children children = model->children(); - for(Gtk::TreeModel::Children::iterator iter = children.begin(); iter != children.end(); ++iter) { - Gtk::TreeModel::Row row = *iter; - tip += '\n'; - - /* don't use the column text, since it may be narrowed */ - - boost::shared_ptr i = row[columns.insert]; - tip += i->name(); - } - ARDOUR_UI::instance()->tooltips().set_tip (box, tip); -} - -void -RedirectBox::show_insert_name (boost::weak_ptr insert) -{ - ENSURE_GUI_THREAD(bind (mem_fun(*this, &RedirectBox::show_insert_name), insert)); - show_insert_active (insert); -} - -void -RedirectBox::show_insert_active (boost::weak_ptr weak_insert) -{ - ENSURE_GUI_THREAD(bind (mem_fun(*this, &RedirectBox::show_insert_active), weak_insert)); - - boost::shared_ptr insert (weak_insert.lock()); - - if (!insert) { - return; - } - - Gtk::TreeModel::Children children = model->children(); - Gtk::TreeModel::Children::iterator iter = children.begin(); - - while (iter != children.end()) { - - boost::shared_ptr r = (*iter)[columns.insert]; - - if (r == insert) { - (*iter)[columns.text] = insert_name (r); - - if (insert->active()) { - (*iter)[columns.color] = *active_insert_color; - } else { - (*iter)[columns.color] = *inactive_insert_color; - } - break; - } - - iter++; - } -} - -void -RedirectBox::row_deleted (const Gtk::TreeModel::Path& path) -{ - if (!ignore_delete) { - compute_insert_sort_keys (); - } -} - -void -RedirectBox::compute_insert_sort_keys () -{ - uint32_t sort_key = 0; - Gtk::TreeModel::Children children = model->children(); - - for (Gtk::TreeModel::Children::iterator iter = children.begin(); iter != children.end(); ++iter) { - boost::shared_ptr i = (*iter)[columns.insert]; - i->set_sort_key (sort_key); - sort_key++; - } - - if (_route->sort_inserts ()) { - - redisplay_inserts (); - - /* now tell them about the problem */ - - ArdourDialog dialog (_("ardour: weird plugin dialog")); - Label label; - - label.set_text (_("\ -You cannot reorder this set of inserts\n\ -in that way because the inputs and\n\ -outputs do not work correctly.")); - - dialog.get_vbox()->pack_start (label); - dialog.add_button (Stock::OK, RESPONSE_ACCEPT); - - dialog.set_name (X_("PluginIODialog")); - dialog.set_position (Gtk::WIN_POS_MOUSE); - dialog.set_modal (true); - dialog.show_all (); - - dialog.run (); - } -} - -void -RedirectBox::rename_inserts () -{ - vector > to_be_renamed; - - get_selected_inserts (to_be_renamed); - - if (to_be_renamed.empty()) { - return; - } - - for (vector >::iterator i = to_be_renamed.begin(); i != to_be_renamed.end(); ++i) { - rename_insert (*i); - } -} - -void -RedirectBox::cut_inserts () -{ - vector > to_be_removed; - - get_selected_inserts (to_be_removed); - - if (to_be_removed.empty()) { - return; - } - - /* this essentially transfers ownership of the insert - of the insert from the route to the mixer - selection. - */ - - _rr_selection.set (to_be_removed); - - no_insert_redisplay = true; - for (vector >::iterator i = to_be_removed.begin(); i != to_be_removed.end(); ++i) { - // Do not cut inserts or sends - if (boost::dynamic_pointer_cast((*i)) != 0) { - void* gui = (*i)->get_gui (); - - if (gui) { - static_cast(gui)->hide (); - } - - if (_route->remove_insert (*i)) { - /* removal failed */ - _rr_selection.remove (*i); - } - } else { - _rr_selection.remove (*i); - } - - } - no_insert_redisplay = false; - redisplay_inserts (); -} - -void -RedirectBox::copy_inserts () -{ - vector > to_be_copied; - vector > copies; - - get_selected_inserts (to_be_copied); - - if (to_be_copied.empty()) { - return; - } - - for (vector >::iterator i = to_be_copied.begin(); i != to_be_copied.end(); ++i) { - // Do not copy inserts or sends - if (boost::dynamic_pointer_cast((*i)) != 0) { - copies.push_back (Insert::clone (*i)); - } - } - - _rr_selection.set (copies); - -} - -void -RedirectBox::delete_inserts () -{ - vector > to_be_deleted; - - get_selected_inserts (to_be_deleted); - - if (to_be_deleted.empty()) { - return; - } - - for (vector >::iterator i = to_be_deleted.begin(); i != to_be_deleted.end(); ++i) { - - void* gui = (*i)->get_gui (); - - if (gui) { - static_cast(gui)->hide (); - } - - _route->remove_insert(*i); - } - - no_insert_redisplay = false; - redisplay_inserts (); -} - -gint -RedirectBox::idle_delete_insert (boost::weak_ptr weak_insert) -{ - boost::shared_ptr insert (weak_insert.lock()); - - if (!insert) { - return false; - } - - /* NOT copied to _mixer.selection() */ - - no_insert_redisplay = true; - _route->remove_insert (insert); - no_insert_redisplay = false; - redisplay_inserts (); - - return false; -} - -void -RedirectBox::rename_insert (boost::shared_ptr insert) -{ - ArdourPrompter name_prompter (true); - string result; - name_prompter.set_prompt (_("rename insert")); - name_prompter.set_initial_text (insert->name()); - name_prompter.add_button (_("Rename"), Gtk::RESPONSE_ACCEPT); - name_prompter.set_response_sensitive (Gtk::RESPONSE_ACCEPT, false); - name_prompter.show_all (); - - switch (name_prompter.run ()) { - - case Gtk::RESPONSE_ACCEPT: - name_prompter.get_result (result); - if (result.length()) { - insert->set_name (result); - } - break; - } - - return; -} - -void -RedirectBox::cut_insert (boost::shared_ptr insert) -{ - /* this essentially transfers ownership of the insert - of the insert from the route to the mixer - selection. - */ - - _rr_selection.add (insert); - - void* gui = insert->get_gui (); - - if (gui) { - static_cast(gui)->hide (); - } - - no_insert_redisplay = true; - if (_route->remove_insert (insert)) { - _rr_selection.remove (insert); - } - no_insert_redisplay = false; - redisplay_inserts (); -} - -void -RedirectBox::copy_insert (boost::shared_ptr insert) -{ - boost::shared_ptr copy = Insert::clone (insert); - _rr_selection.add (copy); -} - -void -RedirectBox::paste_inserts () -{ - if (_rr_selection.inserts.empty()) { - return; - } - - paste_insert_list (_rr_selection.inserts); -} - -void -RedirectBox::paste_insert_list (list >& inserts) -{ - list > copies; - - for (list >::iterator i = inserts.begin(); i != inserts.end(); ++i) { - - boost::shared_ptr copy = Insert::clone (*i); - - copy->set_placement (_placement); - copies.push_back (copy); - } - - if (_route->add_inserts (copies)) { - - string msg = _( - "Copying the set of inserts on the clipboard failed,\n\ -probably because the I/O configuration of the plugins\n\ -could not match the configuration of this track."); - MessageDialog am (msg); - am.run (); - } -} - -void -RedirectBox::activate_insert (boost::shared_ptr r) -{ - r->set_active (true); -} - -void -RedirectBox::deactivate_insert (boost::shared_ptr r) -{ - r->set_active (false); -} - -void -RedirectBox::get_selected_inserts (vector >& inserts) -{ - vector pathlist = insert_display.get_selection()->get_selected_rows(); - - for (vector::iterator iter = pathlist.begin(); iter != pathlist.end(); ++iter) { - inserts.push_back ((*(model->get_iter(*iter)))[columns.insert]); - } -} - -void -RedirectBox::for_selected_inserts (void (RedirectBox::*pmf)(boost::shared_ptr)) -{ - vector pathlist = insert_display.get_selection()->get_selected_rows(); - - for (vector::iterator iter = pathlist.begin(); iter != pathlist.end(); ++iter) { - boost::shared_ptr insert = (*(model->get_iter(*iter)))[columns.insert]; - (this->*pmf)(insert); - } -} - -void -RedirectBox::clone_inserts () -{ - RouteSelection& routes (_rr_selection.routes); - - if (!routes.empty()) { - if (_route->copy_inserts (*routes.front(), _placement)) { - string msg = _( -"Copying the set of inserts on the clipboard failed,\n\ -probably because the I/O configuration of the plugins\n\ -could not match the configuration of this track."); - MessageDialog am (msg); - am.run (); - } - } -} - -void -RedirectBox::all_inserts_active (bool state) -{ - _route->all_inserts_active (_placement, state); -} - -void -RedirectBox::all_plugins_active (bool state) -{ - if (state) { - // XXX not implemented - } else { - _route->disable_plugins (_placement); - } -} - -void -RedirectBox::ab_plugins () -{ - _route->ab_plugins (ab_direction); - ab_direction = !ab_direction; -} - -void -RedirectBox::clear_inserts () -{ - string prompt; - vector choices; - - if (boost::dynamic_pointer_cast(_route) != 0) { - if (_placement == PreFader) { - prompt = _("Do you really want to remove all pre-fader inserts from this track?\n" - "(this cannot be undone)"); - } else { - prompt = _("Do you really want to remove all post-fader inserts from this track?\n" - "(this cannot be undone)"); - } - } else { - if (_placement == PreFader) { - prompt = _("Do you really want to remove all pre-fader inserts from this bus?\n" - "(this cannot be undone)"); - } else { - prompt = _("Do you really want to remove all post-fader inserts from this bus?\n" - "(this cannot be undone)"); - } - } - - choices.push_back (_("Cancel")); - choices.push_back (_("Yes, remove them all")); - - Gtkmm2ext::Choice prompter (prompt, choices); - - if (prompter.run () == 1) { - _route->clear_inserts (_placement); - } -} - -void -RedirectBox::edit_insert (boost::shared_ptr insert) -{ - boost::shared_ptr send; - boost::shared_ptr plugin_insert; - boost::shared_ptr port_insert; - - if (boost::dynamic_pointer_cast(_route) != 0) { - - if (boost::dynamic_pointer_cast (_route)->freeze_state() == AudioTrack::Frozen) { - return; - } - } - - if ((send = boost::dynamic_pointer_cast (send)) != 0) { - - if (!_session.engine().connected()) { - return; - } - - SendUIWindow *send_ui; - - if (send->get_gui() == 0) { - - send_ui = new SendUIWindow (send, _session); - - WindowTitle title(Glib::get_application_name()); - title += send->name(); - send_ui->set_title (title.get_string()); - - send->set_gui (send_ui); - - } else { - send_ui = reinterpret_cast (send->get_gui()); - } - - if (send_ui->is_visible()) { - send_ui->get_window()->raise (); - } else { - send_ui->show_all (); - send_ui->present (); - } - - } else if ((plugin_insert = boost::dynamic_pointer_cast (insert)) != 0) { - - ARDOUR::PluginType type = plugin_insert->type(); - - if (type == ARDOUR::LADSPA || type == ARDOUR::VST) { - PluginUIWindow *plugin_ui; - - if (plugin_insert->get_gui() == 0) { - - plugin_ui = new PluginUIWindow (plugin_insert); - - if (_owner_is_mixer) { - ARDOUR_UI::instance()->the_mixer()->ensure_float (*plugin_ui); - } else { - ARDOUR_UI::instance()->the_editor().ensure_float (*plugin_ui); - } - - WindowTitle title(Glib::get_application_name()); - title += generate_insert_title (plugin_insert); - plugin_ui->set_title (title.get_string()); - - plugin_insert->set_gui (plugin_ui); - - // change window title when route name is changed - _route->NameChanged.connect (bind (mem_fun(*this, &RedirectBox::route_name_changed), plugin_ui, boost::weak_ptr (plugin_insert))); - - - } else { - plugin_ui = reinterpret_cast (plugin_insert->get_gui()); - } - - if (plugin_ui->is_visible()) { - plugin_ui->get_window()->raise (); - } else { - plugin_ui->show_all (); - plugin_ui->present (); - } -#ifdef HAVE_AUDIOUNIT - } else if (type == ARDOUR::AudioUnit) { - AUPluginUI* plugin_ui; - if (plugin_insert->get_gui() == 0) { - plugin_ui = new AUPluginUI (plugin_insert); - } else { - plugin_ui = reinterpret_cast (plugin_insert->get_gui()); - } - - if (plugin_ui->is_visible()) { - plugin_ui->get_window()->raise (); - } else { - plugin_ui->show_all (); - plugin_ui->present (); - } -#endif - } else { - warning << "Unsupported plugin sent to RedirectBox::edit_insert()" << endmsg; - return; - } - - } else if ((port_insert = boost::dynamic_pointer_cast (insert)) != 0) { - - if (!_session.engine().connected()) { - MessageDialog msg ( _("Not connected to JACK - no I/O changes are possible")); - msg.run (); - return; - } - - PortInsertWindow *io_selector; - - if (port_insert->get_gui() == 0) { - io_selector = new PortInsertWindow (_session, port_insert); - port_insert->set_gui (io_selector); - - } else { - io_selector = reinterpret_cast (port_insert->get_gui()); - } - - if (io_selector->is_visible()) { - io_selector->get_window()->raise (); - } else { - io_selector->show_all (); - io_selector->present (); - } - } -} - -bool -RedirectBox::enter_box (GdkEventCrossing *ev, RedirectBox* rb) -{ - switch (ev->detail) { - case GDK_NOTIFY_INFERIOR: - break; - - case GDK_NOTIFY_VIRTUAL: - /* fallthru */ - - default: - _current_insert_box = rb; - } - - return false; -} - -void -RedirectBox::register_actions () -{ - Glib::RefPtr popup_act_grp = Gtk::ActionGroup::create(X_("redirectmenu")); - Glib::RefPtr act; - - /* new stuff */ - ActionManager::register_action (popup_act_grp, X_("newplugin"), _("New Plugin ..."), sigc::ptr_fun (RedirectBox::rb_choose_plugin)); - - act = ActionManager::register_action (popup_act_grp, X_("newinsert"), _("New Insert"), sigc::ptr_fun (RedirectBox::rb_choose_insert)); - ActionManager::jack_sensitive_actions.push_back (act); - act = ActionManager::register_action (popup_act_grp, X_("newsend"), _("New Send ..."), sigc::ptr_fun (RedirectBox::rb_choose_send)); - ActionManager::jack_sensitive_actions.push_back (act); - - ActionManager::register_action (popup_act_grp, X_("clear"), _("Clear"), sigc::ptr_fun (RedirectBox::rb_clear)); - - /* standard editing stuff */ - act = ActionManager::register_action (popup_act_grp, X_("cut"), _("Cut"), sigc::ptr_fun (RedirectBox::rb_cut)); - ActionManager::plugin_selection_sensitive_actions.push_back(act); - act = ActionManager::register_action (popup_act_grp, X_("copy"), _("Copy"), sigc::ptr_fun (RedirectBox::rb_copy)); - ActionManager::plugin_selection_sensitive_actions.push_back(act); - - act = ActionManager::register_action (popup_act_grp, X_("delete"), _("Delete"), sigc::ptr_fun (RedirectBox::rb_delete)); - ActionManager::plugin_selection_sensitive_actions.push_back(act); // ?? - - paste_action = ActionManager::register_action (popup_act_grp, X_("paste"), _("Paste"), sigc::ptr_fun (RedirectBox::rb_paste)); - act = ActionManager::register_action (popup_act_grp, X_("rename"), _("Rename"), sigc::ptr_fun (RedirectBox::rb_rename)); - ActionManager::plugin_selection_sensitive_actions.push_back(act); - ActionManager::register_action (popup_act_grp, X_("selectall"), _("Select All"), sigc::ptr_fun (RedirectBox::rb_select_all)); - ActionManager::register_action (popup_act_grp, X_("deselectall"), _("Deselect All"), sigc::ptr_fun (RedirectBox::rb_deselect_all)); - - /* activation */ - act = ActionManager::register_action (popup_act_grp, X_("activate"), _("Activate"), sigc::ptr_fun (RedirectBox::rb_activate)); - ActionManager::plugin_selection_sensitive_actions.push_back(act); - act = ActionManager::register_action (popup_act_grp, X_("deactivate"), _("Deactivate"), sigc::ptr_fun (RedirectBox::rb_deactivate)); - ActionManager::plugin_selection_sensitive_actions.push_back(act); - ActionManager::register_action (popup_act_grp, X_("activate_all"), _("Activate all"), sigc::ptr_fun (RedirectBox::rb_activate_all)); - ActionManager::register_action (popup_act_grp, X_("deactivate_all"), _("Deactivate all"), sigc::ptr_fun (RedirectBox::rb_deactivate_all)); - - ActionManager::register_action (popup_act_grp, X_("a_b_plugins"), _("A/B plugins"), sigc::ptr_fun (RedirectBox::rb_ab_plugins)); - ActionManager::register_action (popup_act_grp, X_("deactivate_plugins"), _("Deactivate plugins"), sigc::ptr_fun (RedirectBox::rb_deactivate_plugins)); - - /* show editors */ - act = ActionManager::register_action (popup_act_grp, X_("edit"), _("Edit"), sigc::ptr_fun (RedirectBox::rb_edit)); - ActionManager::plugin_selection_sensitive_actions.push_back(act); - - ActionManager::add_action_group (popup_act_grp); - - -} - -void -RedirectBox::rb_choose_plugin () -{ - if (_current_insert_box == 0) { - return; - } - _current_insert_box->choose_plugin (); -} - -void -RedirectBox::rb_choose_insert () -{ - if (_current_insert_box == 0) { - return; - } - _current_insert_box->choose_insert (); -} - -void -RedirectBox::rb_choose_send () -{ - if (_current_insert_box == 0) { - return; - } - _current_insert_box->choose_send (); -} - -void -RedirectBox::rb_clear () -{ - if (_current_insert_box == 0) { - return; - } - - _current_insert_box->clear_inserts (); -} - -void -RedirectBox::rb_cut () -{ - if (_current_insert_box == 0) { - return; - } - - _current_insert_box->cut_inserts (); -} - -void -RedirectBox::rb_delete () -{ - if (_current_insert_box == 0) { - return; - } - - _current_insert_box->delete_inserts (); -} - -void -RedirectBox::rb_copy () -{ - if (_current_insert_box == 0) { - return; - } - _current_insert_box->copy_inserts (); -} - -void -RedirectBox::rb_paste () -{ - if (_current_insert_box == 0) { - return; - } - - _current_insert_box->paste_inserts (); -} - -void -RedirectBox::rb_rename () -{ - if (_current_insert_box == 0) { - return; - } - _current_insert_box->rename_inserts (); -} - -void -RedirectBox::rb_select_all () -{ - if (_current_insert_box == 0) { - return; - } - - _current_insert_box->select_all_inserts (); -} - -void -RedirectBox::rb_deselect_all () -{ - if (_current_insert_box == 0) { - return; - } - - _current_insert_box->deselect_all_inserts (); -} - -void -RedirectBox::rb_activate () -{ - if (_current_insert_box == 0) { - return; - } - - _current_insert_box->for_selected_inserts (&RedirectBox::activate_insert); -} - -void -RedirectBox::rb_deactivate () -{ - if (_current_insert_box == 0) { - return; - } - _current_insert_box->for_selected_inserts (&RedirectBox::deactivate_insert); -} - -void -RedirectBox::rb_activate_all () -{ - if (_current_insert_box == 0) { - return; - } - - _current_insert_box->all_inserts_active (true); -} - -void -RedirectBox::rb_deactivate_all () -{ - if (_current_insert_box == 0) { - return; - } - _current_insert_box->all_inserts_active (false); -} - -void -RedirectBox::rb_deactivate_plugins () -{ - if (_current_insert_box == 0) { - return; - } - _current_insert_box->all_plugins_active (false); -} - - -void -RedirectBox::rb_ab_plugins () -{ - if (_current_insert_box == 0) { - return; - } - - _current_insert_box->ab_plugins (); -} - - -void -RedirectBox::rb_edit () -{ - if (_current_insert_box == 0) { - return; - } - - _current_insert_box->for_selected_inserts (&RedirectBox::edit_insert); -} - -void -RedirectBox::route_name_changed (PluginUIWindow* plugin_ui, boost::weak_ptr wpi) -{ - ENSURE_GUI_THREAD(bind (mem_fun (*this, &RedirectBox::route_name_changed), plugin_ui, wpi)); - boost::shared_ptr pi (wpi.lock()); - - - if (pi) { - WindowTitle title(Glib::get_application_name()); - title += generate_insert_title (pi); - plugin_ui->set_title (title.get_string()); - } -} - -string -RedirectBox::generate_insert_title (boost::shared_ptr pi) -{ - string maker = pi->plugin()->maker(); - string::size_type email_pos; - - if ((email_pos = maker.find_first_of ('<')) != string::npos) { - maker = maker.substr (0, email_pos - 1); - } - - if (maker.length() > 32) { - maker = maker.substr (0, 32); - maker += " ..."; - } - - return string_compose(_("%1: %2 (by %3)"), _route->name(), pi->name(), maker); -} - diff --git a/gtk2_ardour/redirect_box.h b/gtk2_ardour/redirect_box.h deleted file mode 100644 index 914402858a..0000000000 --- a/gtk2_ardour/redirect_box.h +++ /dev/null @@ -1,230 +0,0 @@ -/* - Copyright (C) 2004 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#ifndef __ardour_gtk_redirect_box__ -#define __ardour_gtk_redirect_box__ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include - -#include - -#include "route_ui.h" -#include "io_selector.h" -#include "enums.h" - -class MotionController; -class PluginSelector; -class PluginUIWindow; -class RouteRedirectSelection; - -namespace ARDOUR { - class Bundle; - class Insert; - class Plugin; - class PluginInsert; - class PortInsert; - class Route; - class Send; - class Session; -} - - -// FIXME: change name to InsertBox -class RedirectBox : public Gtk::HBox -{ - public: - RedirectBox (ARDOUR::Placement, ARDOUR::Session&, - boost::shared_ptr, PluginSelector &, RouteRedirectSelection &, bool owner_is_mixer = false); - ~RedirectBox (); - - void set_width (Width); - - void update(); - - void select_all_inserts (); - void deselect_all_inserts (); - void select_all_plugins (); - void select_all_sends (); - - sigc::signal > InsertSelected; - sigc::signal > InsertUnselected; - - static void register_actions(); - - protected: - void set_stuff_from_route (); - - private: - boost::shared_ptr _route; - ARDOUR::Session & _session; - bool _owner_is_mixer; - bool ab_direction; - - ARDOUR::Placement _placement; - - PluginSelector & _plugin_selector; - RouteRedirectSelection & _rr_selection; - - void route_going_away (); - - struct ModelColumns : public Gtk::TreeModel::ColumnRecord { - ModelColumns () { - add (text); - add (insert); - add (color); - } - Gtk::TreeModelColumn text; - Gtk::TreeModelColumn > insert; - Gtk::TreeModelColumn color; - }; - - ModelColumns columns; - Glib::RefPtr model; - - void selection_changed (); - - static bool get_colors; - static Gdk::Color* active_insert_color; - static Gdk::Color* inactive_insert_color; - - Gtk::EventBox insert_eventbox; - Gtk::HBox insert_hpacker; - Gtkmm2ext::DnDTreeView > insert_display; - Gtk::ScrolledWindow insert_scroller; - - void object_drop (std::string type, uint32_t cnt, const boost::shared_ptr*); - - Width _width; - - Gtk::Menu *send_action_menu; - void build_send_action_menu (); - - void new_send (); - void show_send_controls (); - - Gtk::Menu *insert_menu; - gint insert_menu_map_handler (GdkEventAny *ev); - Gtk::Menu * build_insert_menu (); - void build_insert_tooltip (Gtk::EventBox&, string); - void show_insert_menu (gint arg); - - void choose_send (); - void send_io_finished (IOSelector::Result, boost::shared_ptr, IOSelectorWindow*); - void choose_insert (); - void choose_plugin (); - void insert_plugin_chosen (boost::shared_ptr); - - bool no_insert_redisplay; - bool ignore_delete; - - bool insert_button_press_event (GdkEventButton *); - bool insert_button_release_event (GdkEventButton *); - void redisplay_inserts (); - void add_insert_to_display (boost::shared_ptr); - void row_deleted (const Gtk::TreeModel::Path& path); - void show_insert_active (boost::weak_ptr); - void show_insert_name (boost::weak_ptr); - string insert_name (boost::weak_ptr); - - void remove_insert_gui (boost::shared_ptr); - - void inserts_reordered (const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator&, int*); - void compute_insert_sort_keys (); - vector insert_active_connections; - vector insert_name_connections; - - bool insert_drag_in_progress; - void insert_drag_begin (GdkDragContext*); - void insert_drag_end (GdkDragContext*); - void all_inserts_active(bool state); - void all_plugins_active(bool state); - void ab_plugins (); - - void cut_inserts (); - void copy_inserts (); - void paste_inserts (); - void delete_inserts (); - void clear_inserts (); - void clone_inserts (); - void rename_inserts (); - - void for_selected_inserts (void (RedirectBox::*pmf)(boost::shared_ptr)); - void get_selected_inserts (vector >&); - - static Glib::RefPtr paste_action; - void paste_insert_list (std::list >& inserts); - - void activate_insert (boost::shared_ptr); - void deactivate_insert (boost::shared_ptr); - void cut_insert (boost::shared_ptr); - void copy_insert (boost::shared_ptr); - void edit_insert (boost::shared_ptr); - void hide_insert_editor (boost::shared_ptr); - void rename_insert (boost::shared_ptr); - - gint idle_delete_insert (boost::weak_ptr); - - void weird_plugin_dialog (ARDOUR::Plugin& p, ARDOUR::Route::InsertStreams streams, boost::shared_ptr io); - - static RedirectBox* _current_insert_box; - static bool enter_box (GdkEventCrossing*, RedirectBox*); - static bool leave_box (GdkEventCrossing*, RedirectBox*); - - static void rb_choose_plugin (); - static void rb_choose_insert (); - static void rb_choose_send (); - static void rb_clear (); - static void rb_cut (); - static void rb_copy (); - static void rb_paste (); - static void rb_delete (); - static void rb_rename (); - static void rb_select_all (); - static void rb_deselect_all (); - static void rb_activate (); - static void rb_deactivate (); - static void rb_activate_all (); - static void rb_deactivate_all (); - static void rb_edit (); - static void rb_ab_plugins (); - static void rb_deactivate_plugins (); - - void route_name_changed (PluginUIWindow* plugin_ui, boost::weak_ptr pi); - std::string generate_insert_title (boost::shared_ptr pi); -}; - -#endif /* __ardour_gtk_redirect_box__ */ diff --git a/gtk2_ardour/redirect_selection.h b/gtk2_ardour/redirect_selection.h deleted file mode 100644 index 0b3e0b2983..0000000000 --- a/gtk2_ardour/redirect_selection.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - Copyright (C) 2000-2007 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#ifndef __ardour_gtk_redirect_selection_h__ -#define __ardour_gtk_redirect_selection_h__ - -#include -#include - -namespace ARDOUR { - class Insert; -} - -struct InsertSelection : list > {}; - -#endif /* __ardour_gtk_redirect_selection_h__ */ diff --git a/gtk2_ardour/route_params_ui.cc b/gtk2_ardour/route_params_ui.cc index 6a03d72973..51b1c9e26b 100644 --- a/gtk2_ardour/route_params_ui.cc +++ b/gtk2_ardour/route_params_ui.cc @@ -211,16 +211,16 @@ RouteParams_UI::route_name_changed (boost::shared_ptr route) } void -RouteParams_UI::setup_redirect_boxes() +RouteParams_UI::setup_processor_boxes() { if (session && _route) { // just in case... shouldn't need this - cleanup_redirect_boxes(); + cleanup_processor_boxes(); // construct new redirect boxes - pre_insert_box = new RedirectBox(PreFader, *session, _route, *_plugin_selector, _rr_selection); - post_insert_box = new RedirectBox(PostFader, *session, _route, *_plugin_selector, _rr_selection); + pre_insert_box = new ProcessorBox(PreFader, *session, _route, *_plugin_selector, _rr_selection); + post_insert_box = new ProcessorBox(PostFader, *session, _route, *_plugin_selector, _rr_selection); pre_redir_hpane.pack1 (*pre_insert_box); post_redir_hpane.pack1 (*post_insert_box); @@ -237,7 +237,7 @@ RouteParams_UI::setup_redirect_boxes() } void -RouteParams_UI::cleanup_redirect_boxes() +RouteParams_UI::cleanup_processor_boxes() { if (pre_insert_box) { pre_redir_hpane.remove(*pre_insert_box); @@ -344,11 +344,11 @@ RouteParams_UI::route_removed (boost::shared_ptr route) cleanup_io_frames(); cleanup_pre_view(); cleanup_post_view(); - cleanup_redirect_boxes(); + cleanup_processor_boxes(); _route.reset ((Route*) 0); - _pre_insert.reset ((Redirect*) 0); - _post_insert.reset ((Redirect*) 0); + _pre_processor.reset ((Processor*) 0); + _post_processor.reset ((Processor*) 0); update_title(); } } @@ -386,11 +386,11 @@ RouteParams_UI::session_gone () cleanup_io_frames(); cleanup_pre_view(); cleanup_post_view(); - cleanup_redirect_boxes(); + cleanup_processor_boxes(); _route.reset ((Route*) 0); - _pre_insert.reset ((Redirect*) 0); - _post_insert.reset ((Redirect*) 0); + _pre_processor.reset ((Processor*) 0); + _post_processor.reset ((Processor*) 0); update_title(); ArdourDialog::session_gone(); @@ -415,7 +415,7 @@ RouteParams_UI::route_selected() if (_route) { _route_conn.disconnect(); _route_ds_conn.disconnect(); - cleanup_redirect_boxes(); + cleanup_processor_boxes(); cleanup_pre_view(); cleanup_post_view(); cleanup_io_frames(); @@ -426,10 +426,10 @@ RouteParams_UI::route_selected() //update_routeinfo (route); setup_io_frames(); - setup_redirect_boxes(); + setup_processor_boxes(); // bind to redirects changed event for this route - _route_conn = route->inserts_changed.connect (mem_fun(*this, &RouteParams_UI::inserts_changed)); + _route_conn = route->processors_changed.connect (mem_fun(*this, &RouteParams_UI::processors_changed)); track_input_label.set_text (_route->name()); @@ -443,11 +443,11 @@ RouteParams_UI::route_selected() cleanup_io_frames(); cleanup_pre_view(); cleanup_post_view(); - cleanup_redirect_boxes(); + cleanup_processor_boxes(); _route.reset ((Route*) 0); - _pre_insert.reset ((Redirect*) 0); - _post_insert.reset ((Redirect *) 0); + _pre_processor.reset ((Processor*) 0); + _post_processor.reset ((Processor *) 0); track_input_label.set_text(_("NO TRACK")); update_title(); } @@ -464,21 +464,21 @@ RouteParams_UI::route_selected() // cleanup_io_frames(); // cleanup_pre_view(); // cleanup_post_view(); -// cleanup_redirect_boxes(); +// cleanup_processor_boxes(); // _route.reset ((Route*)0); -// _pre_insert = 0; -// _post_insert = 0; +// _pre_processor = 0; +// _post_processor = 0; // track_input_label.set_text(_("NO TRACK")); // update_title(); // } //} void -RouteParams_UI::inserts_changed () +RouteParams_UI::processors_changed () { - ENSURE_GUI_THREAD(mem_fun(*this, &RouteParams_UI::inserts_changed)); + ENSURE_GUI_THREAD(mem_fun(*this, &RouteParams_UI::processors_changed)); // pre_insert_list.freeze (); // pre_insert_list.clear (); @@ -493,8 +493,8 @@ RouteParams_UI::inserts_changed () cleanup_pre_view(); cleanup_post_view(); - _pre_insert.reset ((Redirect*) 0); - _post_insert.reset ((Redirect*) 0); + _pre_processor.reset ((Processor*) 0); + _post_processor.reset ((Processor*) 0); //update_title(); } @@ -518,10 +518,10 @@ RouteParams_UI::show_track_menu() void -RouteParams_UI::redirect_selected (boost::shared_ptr insert, ARDOUR::Placement place) +RouteParams_UI::redirect_selected (boost::shared_ptr insert, ARDOUR::Placement place) { - if ((place == PreFader && _pre_insert == insert) - || (place == PostFader && _post_insert == insert)){ + if ((place == PreFader && _pre_processor == insert) + || (place == PostFader && _post_processor == insert)){ return; } @@ -593,9 +593,9 @@ RouteParams_UI::redirect_selected (boost::shared_ptr insert, ARD } if (place == PreFader) { - _pre_insert = insert; + _pre_processor = insert; } else { - _post_insert = insert; + _post_processor = insert; } update_title(); @@ -611,28 +611,28 @@ RouteParams_UI::plugin_going_away (Placement place) if (place == PreFader) { cleanup_pre_view (false); - _pre_insert.reset ((Redirect*) 0); + _pre_processor.reset ((Processor*) 0); } else { cleanup_post_view (false); - _post_insert.reset ((Redirect*) 0); + _post_processor.reset ((Processor*) 0); } } void -RouteParams_UI::redirect_going_away (boost::shared_ptr insert) +RouteParams_UI::redirect_going_away (boost::shared_ptr insert) { ENSURE_GUI_THREAD(bind (mem_fun(*this, &RouteParams_UI::redirect_going_away), insert)); printf ("redirect going away\n"); // delete the current view without calling finish - if (insert == _pre_insert) { + if (insert == _pre_processor) { cleanup_pre_view (false); - _pre_insert.reset ((Redirect*) 0); - } else if (insert == _post_insert) { + _pre_processor.reset ((Processor*) 0); + } else if (insert == _post_processor) { cleanup_post_view (false); - _post_insert.reset ((Redirect*) 0); + _post_processor.reset ((Processor*) 0); } } diff --git a/gtk2_ardour/route_params_ui.h b/gtk2_ardour/route_params_ui.h index ffcf6e1366..39305ae467 100644 --- a/gtk2_ardour/route_params_ui.h +++ b/gtk2_ardour/route_params_ui.h @@ -36,17 +36,17 @@ #include #include -#include +#include #include "io_selector.h" #include "ardour_dialog.h" -#include "redirect_box.h" -#include "route_redirect_selection.h" +#include "processor_box.h" +#include "route_processor_selection.h" namespace ARDOUR { class Route; class Send; - class Insert; + class Processor; class Session; class PortInsert; class Connection; @@ -89,8 +89,8 @@ class RouteParams_UI : public ArdourDialog Gtk::HBox route_hpacker; Gtk::VBox route_vpacker; - RedirectBox * pre_insert_box; - RedirectBox * post_insert_box; + ProcessorBox * pre_insert_box; + ProcessorBox * post_insert_box; Gtk::HPaned list_hpane; @@ -121,11 +121,11 @@ class RouteParams_UI : public ArdourDialog sigc::connection _route_conn; sigc::connection _route_ds_conn; - boost::shared_ptr _pre_insert; - sigc::connection _pre_plugin_conn; + boost::shared_ptr _pre_processor; + sigc::connection _pre_plugin_conn; - boost::shared_ptr _post_insert; - sigc::connection _post_plugin_conn; + boost::shared_ptr _post_processor; + sigc::connection _post_plugin_conn; enum ConfigView { @@ -171,15 +171,15 @@ class RouteParams_UI : public ArdourDialog - void inserts_changed (); + void processors_changed (); - void setup_redirect_boxes(); - void cleanup_redirect_boxes(); + void setup_processor_boxes(); + void cleanup_processor_boxes(); - void redirect_selected (boost::shared_ptr, ARDOUR::Placement); + void redirect_selected (boost::shared_ptr, ARDOUR::Placement); void plugin_going_away (ARDOUR::Placement); - void redirect_going_away (boost::shared_ptr); + void redirect_going_away (boost::shared_ptr); gint edit_input_configuration (GdkEventButton *ev); gint edit_output_configuration (GdkEventButton *ev); diff --git a/gtk2_ardour/route_processor_selection.cc b/gtk2_ardour/route_processor_selection.cc new file mode 100644 index 0000000000..33dd1bfe7b --- /dev/null +++ b/gtk2_ardour/route_processor_selection.cc @@ -0,0 +1,176 @@ +/* + Copyright (C) 2002 Paul Davis + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#include +#include +#include + +#include +#include +#include + +#include "route_processor_selection.h" + +#include "i18n.h" + +using namespace ARDOUR; +using namespace PBD; +using namespace sigc; + +RouteRedirectSelection& +RouteRedirectSelection::operator= (const RouteRedirectSelection& other) +{ + if (&other != this) { + processors = other.processors; + routes = other.routes; + } + return *this; +} + +bool +operator== (const RouteRedirectSelection& a, const RouteRedirectSelection& b) +{ + return a.processors == b.processors && + a.routes == b.routes; +} + +void +RouteRedirectSelection::clear () +{ + clear_processors (); + clear_routes (); +} + +void +RouteRedirectSelection::clear_processors () +{ + processors.clear (); + ProcessorsChanged (); +} + +void +RouteRedirectSelection::clear_routes () +{ + routes.clear (); + RoutesChanged (); +} + +void +RouteRedirectSelection::add (boost::shared_ptr r) +{ + if (find (processors.begin(), processors.end(), r) == processors.end()) { + processors.push_back (r); + + // XXX SHAREDPTR FIXME + // void (RouteRedirectSelection::*pmf)(Redirect*) = &RouteRedirectSelection::remove; + // r->GoingAway.connect (mem_fun(*this, pmf)); + + ProcessorsChanged(); + } +} + +void +RouteRedirectSelection::add (const vector >& rlist) +{ + bool changed = false; + + for (vector >::const_iterator i = rlist.begin(); i != rlist.end(); ++i) { + if (find (processors.begin(), processors.end(), *i) == processors.end()) { + processors.push_back (*i); + + // XXX SHAREDPTR FIXME + + //void (RouteRedirectSelection::*pmf)(Redirect*) = &RouteRedirectSelection::remove; + // (*i)->GoingAway.connect (mem_fun(*this, pmf)); + changed = true; + } + } + + if (changed) { + ProcessorsChanged(); + } +} + +void +RouteRedirectSelection::remove (boost::shared_ptr r) +{ + list >::iterator i; + if ((i = find (processors.begin(), processors.end(), r)) != processors.end()) { + processors.erase (i); + ProcessorsChanged (); + } +} + +void +RouteRedirectSelection::set (boost::shared_ptr r) +{ + clear_processors (); + add (r); +} + +void +RouteRedirectSelection::set (const vector >& rlist) +{ + clear_processors (); + add (rlist); +} + +void +RouteRedirectSelection::add (boost::shared_ptr r) +{ + if (find (routes.begin(), routes.end(), r) == routes.end()) { + routes.push_back (r); + + // XXX SHAREDPTR FIXME + // void (RouteRedirectSelection::*pmf)(Route*) = &RouteRedirectSelection::remove; + // r->GoingAway.connect (bind (mem_fun(*this, pmf), r)); + + RoutesChanged(); + } +} + +void +RouteRedirectSelection::remove (boost::shared_ptr r) +{ + list >::iterator i; + if ((i = find (routes.begin(), routes.end(), r)) != routes.end()) { + routes.erase (i); + RoutesChanged (); + } +} + +void +RouteRedirectSelection::set (boost::shared_ptr r) +{ + clear_routes (); + add (r); +} + +bool +RouteRedirectSelection::selected (boost::shared_ptr r) +{ + return find (routes.begin(), routes.end(), r) != routes.end(); +} + +bool +RouteRedirectSelection::empty () +{ + return processors.empty () && routes.empty (); +} + diff --git a/gtk2_ardour/route_processor_selection.h b/gtk2_ardour/route_processor_selection.h new file mode 100644 index 0000000000..78f6ddca48 --- /dev/null +++ b/gtk2_ardour/route_processor_selection.h @@ -0,0 +1,63 @@ +/* + Copyright (C) 2004 Paul Davis + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#ifndef __ardour_gtk_route_processor_selection_h__ +#define __ardour_gtk_route_processor_selection_h__ + +#include +#include + +#include "processor_selection.h" +#include "route_selection.h" + +class RouteRedirectSelection : public sigc::trackable +{ + public: + ProcessorSelection processors; + RouteSelection routes; + + RouteRedirectSelection() {} + + RouteRedirectSelection& operator= (const RouteRedirectSelection& other); + + sigc::signal ProcessorsChanged; + sigc::signal RoutesChanged; + + void clear (); + bool empty(); + + void set (boost::shared_ptr); + void set (const std::vector >&); + void add (boost::shared_ptr); + void add (const std::vector >&); + void remove (boost::shared_ptr); + + void set (boost::shared_ptr); + void add (boost::shared_ptr); + void remove (boost::shared_ptr); + + void clear_processors (); + void clear_routes (); + + bool selected (boost::shared_ptr); +}; + +bool operator==(const RouteRedirectSelection& a, const RouteRedirectSelection& b); + +#endif /* __ardour_gtk_route_processor_selection_h__ */ diff --git a/gtk2_ardour/route_redirect_selection.cc b/gtk2_ardour/route_redirect_selection.cc deleted file mode 100644 index 735c1b4dc5..0000000000 --- a/gtk2_ardour/route_redirect_selection.cc +++ /dev/null @@ -1,176 +0,0 @@ -/* - Copyright (C) 2002 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include -#include -#include - -#include -#include -#include - -#include "route_redirect_selection.h" - -#include "i18n.h" - -using namespace ARDOUR; -using namespace PBD; -using namespace sigc; - -RouteRedirectSelection& -RouteRedirectSelection::operator= (const RouteRedirectSelection& other) -{ - if (&other != this) { - inserts = other.inserts; - routes = other.routes; - } - return *this; -} - -bool -operator== (const RouteRedirectSelection& a, const RouteRedirectSelection& b) -{ - return a.inserts == b.inserts && - a.routes == b.routes; -} - -void -RouteRedirectSelection::clear () -{ - clear_inserts (); - clear_routes (); -} - -void -RouteRedirectSelection::clear_inserts () -{ - inserts.clear (); - InsertsChanged (); -} - -void -RouteRedirectSelection::clear_routes () -{ - routes.clear (); - RoutesChanged (); -} - -void -RouteRedirectSelection::add (boost::shared_ptr r) -{ - if (find (inserts.begin(), inserts.end(), r) == inserts.end()) { - inserts.push_back (r); - - // XXX SHAREDPTR FIXME - // void (RouteRedirectSelection::*pmf)(Redirect*) = &RouteRedirectSelection::remove; - // r->GoingAway.connect (mem_fun(*this, pmf)); - - InsertsChanged(); - } -} - -void -RouteRedirectSelection::add (const vector >& rlist) -{ - bool changed = false; - - for (vector >::const_iterator i = rlist.begin(); i != rlist.end(); ++i) { - if (find (inserts.begin(), inserts.end(), *i) == inserts.end()) { - inserts.push_back (*i); - - // XXX SHAREDPTR FIXME - - //void (RouteRedirectSelection::*pmf)(Redirect*) = &RouteRedirectSelection::remove; - // (*i)->GoingAway.connect (mem_fun(*this, pmf)); - changed = true; - } - } - - if (changed) { - InsertsChanged(); - } -} - -void -RouteRedirectSelection::remove (boost::shared_ptr r) -{ - list >::iterator i; - if ((i = find (inserts.begin(), inserts.end(), r)) != inserts.end()) { - inserts.erase (i); - InsertsChanged (); - } -} - -void -RouteRedirectSelection::set (boost::shared_ptr r) -{ - clear_inserts (); - add (r); -} - -void -RouteRedirectSelection::set (const vector >& rlist) -{ - clear_inserts (); - add (rlist); -} - -void -RouteRedirectSelection::add (boost::shared_ptr r) -{ - if (find (routes.begin(), routes.end(), r) == routes.end()) { - routes.push_back (r); - - // XXX SHAREDPTR FIXME - // void (RouteRedirectSelection::*pmf)(Route*) = &RouteRedirectSelection::remove; - // r->GoingAway.connect (bind (mem_fun(*this, pmf), r)); - - RoutesChanged(); - } -} - -void -RouteRedirectSelection::remove (boost::shared_ptr r) -{ - list >::iterator i; - if ((i = find (routes.begin(), routes.end(), r)) != routes.end()) { - routes.erase (i); - RoutesChanged (); - } -} - -void -RouteRedirectSelection::set (boost::shared_ptr r) -{ - clear_routes (); - add (r); -} - -bool -RouteRedirectSelection::selected (boost::shared_ptr r) -{ - return find (routes.begin(), routes.end(), r) != routes.end(); -} - -bool -RouteRedirectSelection::empty () -{ - return inserts.empty () && routes.empty (); -} - diff --git a/gtk2_ardour/route_redirect_selection.h b/gtk2_ardour/route_redirect_selection.h deleted file mode 100644 index 395012c32e..0000000000 --- a/gtk2_ardour/route_redirect_selection.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - Copyright (C) 2004 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#ifndef __ardour_gtk_route_redirect_selection_h__ -#define __ardour_gtk_route_redirect_selection_h__ - -#include -#include - -#include "redirect_selection.h" -#include "route_selection.h" - -class RouteRedirectSelection : public sigc::trackable -{ - public: - InsertSelection inserts; - RouteSelection routes; - - RouteRedirectSelection() {} - - RouteRedirectSelection& operator= (const RouteRedirectSelection& other); - - sigc::signal InsertsChanged; - sigc::signal RoutesChanged; - - void clear (); - bool empty(); - - void set (boost::shared_ptr); - void set (const std::vector >&); - void add (boost::shared_ptr); - void add (const std::vector >&); - void remove (boost::shared_ptr); - - void set (boost::shared_ptr); - void add (boost::shared_ptr); - void remove (boost::shared_ptr); - - void clear_inserts (); - void clear_routes (); - - bool selected (boost::shared_ptr); -}; - -bool operator==(const RouteRedirectSelection& a, const RouteRedirectSelection& b); - -#endif /* __ardour_gtk_route_redirect_selection_h__ */ diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index f113724cf5..26f7fd6cd4 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -43,7 +43,7 @@ #include #include #include -#include +#include #include #include #include @@ -56,8 +56,8 @@ #include "ardour_ui.h" #include "route_time_axis.h" #include "automation_time_axis.h" -#include "redirect_automation_time_axis.h" -#include "redirect_automation_line.h" +#include "processor_automation_time_axis.h" +#include "plugin_automation_line.h" #include "canvas_impl.h" #include "crossfade_view.h" #include "enums.h" @@ -182,7 +182,7 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh _route->mute_changed.connect (mem_fun(*this, &RouteUI::mute_changed)); _route->solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed)); - _route->inserts_changed.connect (mem_fun(*this, &RouteTimeAxisView::inserts_changed)); + _route->processors_changed.connect (mem_fun(*this, &RouteTimeAxisView::processors_changed)); _route->NameChanged.connect (mem_fun(*this, &RouteTimeAxisView::route_name_changed)); _route->solo_safe_changed.connect (mem_fun(*this, &RouteUI::solo_changed)); @@ -207,9 +207,9 @@ RouteTimeAxisView::~RouteTimeAxisView () { GoingAway (); /* EMIT_SIGNAL */ - vector_delete (&insert_automation_curves); + vector_delete (&processor_automation_curves); - for (list::iterator i = insert_automation.begin(); i != insert_automation.end(); ++i) { + for (list::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) { delete *i; } @@ -235,9 +235,9 @@ RouteTimeAxisView::post_construct () /* map current state of the route */ update_diskstream_display (); - _route->foreach_insert (this, &RouteTimeAxisView::add_insert_to_subplugin_menu); - _route->foreach_insert (this, &RouteTimeAxisView::add_existing_insert_automation_curves); - reset_insert_automation_curves (); + _route->foreach_processor (this, &RouteTimeAxisView::add_processor_to_subplugin_menu); + _route->foreach_processor (this, &RouteTimeAxisView::add_existing_processor_automation_curves); + reset_processor_automation_curves (); } void @@ -285,8 +285,6 @@ RouteTimeAxisView::set_state (const XMLNode& node) if (param) { - cerr << "RTAV::set_state parameter: " << param.to_string() << endl; - XMLProperty* prop = child_node->property ("shown"); if (_automation_tracks.find(param) == _automation_tracks.end()) @@ -296,7 +294,7 @@ RouteTimeAxisView::set_state (const XMLNode& node) _show_automation.insert(ParamID(GainAutomation)); } else { - cerr << "RTAV: no parameter " << child_node->name() << endl; + warning << "GUI info exists, but no parameter " << child_node->name() << " found." << endmsg; } } } @@ -1542,12 +1540,12 @@ RouteTimeAxisView::show_all_automation () } - /* Show insert automation */ + /* Show processor automation */ - for (list::iterator i = insert_automation.begin(); i != insert_automation.end(); ++i) { + for (list::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) { for (vector::iterator ii = (*i)->lines.begin(); ii != (*i)->lines.end(); ++ii) { if ((*ii)->view == 0) { - add_insert_automation_curve ((*i)->insert, (*ii)->what); + add_processor_automation_curve ((*i)->processor, (*ii)->what); } (*ii)->menu_item->set_active (true); @@ -1581,9 +1579,9 @@ RouteTimeAxisView::show_existing_automation () } - /* Show insert automation */ + /* Show processor automation */ - for (list::iterator i = insert_automation.begin(); i != insert_automation.end(); ++i) { + for (list::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) { for (vector::iterator ii = (*i)->lines.begin(); ii != (*i)->lines.end(); ++ii) { if ((*ii)->view != 0) { (*ii)->menu_item->set_active (true); @@ -1601,7 +1599,7 @@ RouteTimeAxisView::hide_all_automation () { no_redraw = true; - for (list::iterator i = insert_automation.begin(); i != insert_automation.end(); ++i) { + for (list::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) { for (vector::iterator ii = (*i)->lines.begin(); ii != (*i)->lines.end(); ++ii) { (*ii)->menu_item->set_active (false); } @@ -1625,7 +1623,7 @@ RouteTimeAxisView::region_view_added (RegionView* rv) } void -RouteTimeAxisView::add_ghost_to_insert (RegionView* rv, AutomationTimeAxisView* atv) +RouteTimeAxisView::add_ghost_to_processor (RegionView* rv, AutomationTimeAxisView* atv) { rv->add_ghost (*atv); } @@ -1656,11 +1654,11 @@ RouteTimeAxisView::remove_ran (InsertAutomationNode* ran) } RouteTimeAxisView::InsertAutomationNode* -RouteTimeAxisView::find_insert_automation_node (boost::shared_ptr insert, ParamID what) +RouteTimeAxisView::find_processor_automation_node (boost::shared_ptr processor, ParamID what) { - for (list::iterator i = insert_automation.begin(); i != insert_automation.end(); ++i) { + for (list::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) { - if ((*i)->insert == insert) { + if ((*i)->processor == processor) { for (vector::iterator ii = (*i)->lines.begin(); ii != (*i)->lines.end(); ++ii) { if ((*ii)->what == what) { @@ -1693,16 +1691,16 @@ legalize_for_xml_node (string str) void -RouteTimeAxisView::add_insert_automation_curve (boost::shared_ptr insert, ParamID what) +RouteTimeAxisView::add_processor_automation_curve (boost::shared_ptr processor, ParamID what) { - RedirectAutomationLine* ral; + ProcessorAutomationLine* ral; string name; InsertAutomationNode* ran; - if ((ran = find_insert_automation_node (insert, what)) == 0) { + if ((ran = find_processor_automation_node (processor, what)) == 0) { fatal << _("programming error: ") - << string_compose (X_("insert automation curve for %1:%2 not registered with audio track!"), - insert->name(), what) + << string_compose (X_("processor automation curve for %1:%2 not registered with track!"), + processor->name(), what) << endmsg; /*NOTREACHED*/ return; @@ -1712,25 +1710,25 @@ RouteTimeAxisView::add_insert_automation_curve (boost::shared_ptr insert return; } - name = insert->describe_parameter (what); + name = processor->describe_parameter (what); /* create a string that is a legal XML node name that can be used to refer to this redirect+port combination */ char state_name[256]; - snprintf (state_name, sizeof (state_name), "Redirect-%s-%" PRIu32, legalize_for_xml_node (insert->name()).c_str(), what.id()); + snprintf (state_name, sizeof (state_name), "Redirect-%s-%" PRIu32, legalize_for_xml_node (processor->name()).c_str(), what.id()); - ran->view = new RedirectAutomationTimeAxisView (_session, _route, editor, *this, parent_canvas, name, what, *insert, state_name); + ran->view = new ProcessorAutomationTimeAxisView (_session, _route, editor, *this, parent_canvas, name, what, *processor, state_name); - ral = new RedirectAutomationLine (name, - *insert, what, _session, *ran->view, - *ran->view->canvas_display, *insert->automation_list (what, true)); + ral = new ProcessorAutomationLine (name, + *processor, what, *ran->view, + *ran->view->canvas_display, *processor->automation_list (what, true)); - ral->set_line_color (Config->canvasvar_RedirectAutomationLine.get()); + ral->set_line_color (Config->canvasvar_ProcessorAutomationLine.get()); ral->queue_reset (); ran->view->add_line (*ral); - ran->view->Hiding.connect (bind (mem_fun(*this, &RouteTimeAxisView::insert_automation_track_hidden), ran, insert)); + ran->view->Hiding.connect (bind (mem_fun(*this, &RouteTimeAxisView::processor_automation_track_hidden), ran, processor)); if (!ran->view->marked_for_display()) { ran->view->hide (); @@ -1741,14 +1739,14 @@ RouteTimeAxisView::add_insert_automation_curve (boost::shared_ptr insert add_child (ran->view); if (_view) { - _view->foreach_regionview (bind (mem_fun(*this, &RouteTimeAxisView::add_ghost_to_insert), ran->view)); + _view->foreach_regionview (bind (mem_fun(*this, &RouteTimeAxisView::add_ghost_to_processor), ran->view)); } - insert->mark_automation_visible (what, true); + processor->mark_automation_visible (what, true); } void -RouteTimeAxisView::insert_automation_track_hidden (RouteTimeAxisView::InsertAutomationNode* ran, boost::shared_ptr i) +RouteTimeAxisView::processor_automation_track_hidden (RouteTimeAxisView::InsertAutomationNode* ran, boost::shared_ptr i) { if (!_hidden) { ran->menu_item->set_active (false); @@ -1760,19 +1758,19 @@ RouteTimeAxisView::insert_automation_track_hidden (RouteTimeAxisView::InsertAuto } void -RouteTimeAxisView::add_existing_insert_automation_curves (boost::shared_ptr insert) +RouteTimeAxisView::add_existing_processor_automation_curves (boost::shared_ptr processor) { set s; - RedirectAutomationLine *ral; + ProcessorAutomationLine *ral; - insert->what_has_visible_automation (s); + processor->what_has_visible_automation (s); for (set::iterator i = s.begin(); i != s.end(); ++i) { - if ((ral = find_insert_automation_curve (insert, *i)) != 0) { + if ((ral = find_processor_automation_curve (processor, *i)) != 0) { ral->queue_reset (); } else { - add_insert_automation_curve (insert, (*i)); + add_processor_automation_curve (processor, (*i)); } } } @@ -1811,31 +1809,31 @@ RouteTimeAxisView::add_automation_child(ParamID param, AutomationTimeAxisView* t void -RouteTimeAxisView::add_insert_to_subplugin_menu (boost::shared_ptr insert) +RouteTimeAxisView::add_processor_to_subplugin_menu (boost::shared_ptr processor) { using namespace Menu_Helpers; InsertAutomationInfo *rai; list::iterator x; - const std::set& automatable = insert->what_can_be_automated (); + const std::set& automatable = processor->what_can_be_automated (); std::set has_visible_automation; - insert->what_has_visible_automation(has_visible_automation); + processor->what_has_visible_automation(has_visible_automation); if (automatable.empty()) { return; } - for (x = insert_automation.begin(); x != insert_automation.end(); ++x) { - if ((*x)->insert == insert) { + for (x = processor_automation.begin(); x != processor_automation.end(); ++x) { + if ((*x)->processor == processor) { break; } } - if (x == insert_automation.end()) { + if (x == processor_automation.end()) { - rai = new InsertAutomationInfo (insert); - insert_automation.push_back (rai); + rai = new InsertAutomationInfo (processor); + processor_automation.push_back (rai); } else { @@ -1843,7 +1841,7 @@ RouteTimeAxisView::add_insert_to_subplugin_menu (boost::shared_ptr inser } - /* any older menu was deleted at the top of inserts_changed() + /* any older menu was deleted at the top of processors_changed() when we cleared the subplugin menu. */ @@ -1858,7 +1856,7 @@ RouteTimeAxisView::add_insert_to_subplugin_menu (boost::shared_ptr inser InsertAutomationNode* ran; CheckMenuItem* mitem; - string name = insert->describe_parameter (*i); + string name = processor->describe_parameter (*i); items.push_back (CheckMenuElem (name)); mitem = dynamic_cast (&items.back()); @@ -1867,7 +1865,7 @@ RouteTimeAxisView::add_insert_to_subplugin_menu (boost::shared_ptr inser mitem->set_active(true); } - if ((ran = find_insert_automation_node (insert, *i)) == 0) { + if ((ran = find_processor_automation_node (processor, *i)) == 0) { /* new item */ @@ -1881,28 +1879,28 @@ RouteTimeAxisView::add_insert_to_subplugin_menu (boost::shared_ptr inser } - mitem->signal_toggled().connect (bind (mem_fun(*this, &RouteTimeAxisView::insert_menu_item_toggled), rai, ran)); + mitem->signal_toggled().connect (bind (mem_fun(*this, &RouteTimeAxisView::processor_menu_item_toggled), rai, ran)); } - /* add the menu for this insert, because the subplugin - menu is always cleared at the top of inserts_changed(). + /* add the menu for this processor, because the subplugin + menu is always cleared at the top of processors_changed(). this is the result of some poor design in gtkmm and/or GTK+. */ - subplugin_menu.items().push_back (MenuElem (insert->name(), *rai->menu)); + subplugin_menu.items().push_back (MenuElem (processor->name(), *rai->menu)); rai->valid = true; } void -RouteTimeAxisView::insert_menu_item_toggled (RouteTimeAxisView::InsertAutomationInfo* rai, +RouteTimeAxisView::processor_menu_item_toggled (RouteTimeAxisView::InsertAutomationInfo* rai, RouteTimeAxisView::InsertAutomationNode* ran) { bool showit = ran->menu_item->get_active(); bool redraw = false; if (ran->view == 0 && showit) { - add_insert_automation_curve (rai->insert, ran->what); + add_processor_automation_curve (rai->processor, ran->what); redraw = true; } @@ -1912,7 +1910,7 @@ RouteTimeAxisView::insert_menu_item_toggled (RouteTimeAxisView::InsertAutomation ran->view->set_marked_for_display (true); ran->view->canvas_display->show(); } else { - rai->insert->mark_automation_visible (ran->what, true); + rai->processor->mark_automation_visible (ran->what, true); ran->view->set_marked_for_display (false); ran->view->hide (); } @@ -1931,20 +1929,20 @@ RouteTimeAxisView::insert_menu_item_toggled (RouteTimeAxisView::InsertAutomation } void -RouteTimeAxisView::inserts_changed () +RouteTimeAxisView::processors_changed () { using namespace Menu_Helpers; - for (list::iterator i = insert_automation.begin(); i != insert_automation.end(); ++i) { + for (list::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) { (*i)->valid = false; } subplugin_menu.items().clear (); - _route->foreach_insert (this, &RouteTimeAxisView::add_insert_to_subplugin_menu); - _route->foreach_insert (this, &RouteTimeAxisView::add_existing_insert_automation_curves); + _route->foreach_processor (this, &RouteTimeAxisView::add_processor_to_subplugin_menu); + _route->foreach_processor (this, &RouteTimeAxisView::add_existing_processor_automation_curves); - for (list::iterator i = insert_automation.begin(); i != insert_automation.end(); ) { + for (list::iterator i = processor_automation.begin(); i != processor_automation.end(); ) { list::iterator tmp; @@ -1954,7 +1952,7 @@ RouteTimeAxisView::inserts_changed () if (!(*i)->valid) { delete *i; - insert_automation.erase (i); + processor_automation.erase (i); } @@ -1966,14 +1964,14 @@ RouteTimeAxisView::inserts_changed () _route->gui_changed ("track_height", this); } -RedirectAutomationLine * -RouteTimeAxisView::find_insert_automation_curve (boost::shared_ptr insert, ParamID what) +ProcessorAutomationLine * +RouteTimeAxisView::find_processor_automation_curve (boost::shared_ptr processor, ParamID what) { InsertAutomationNode* ran; - if ((ran = find_insert_automation_node (insert, what)) != 0) { + if ((ran = find_processor_automation_node (processor, what)) != 0) { if (ran->view) { - return dynamic_cast (ran->view->lines.front()); + return dynamic_cast (ran->view->lines.front()); } } @@ -1981,9 +1979,9 @@ RouteTimeAxisView::find_insert_automation_curve (boost::shared_ptr inser } void -RouteTimeAxisView::reset_insert_automation_curves () +RouteTimeAxisView::reset_processor_automation_curves () { - for (vector::iterator i = insert_automation_curves.begin(); i != insert_automation_curves.end(); ++i) { + for (vector::iterator i = processor_automation_curves.begin(); i != processor_automation_curves.end(); ++i) { (*i)->reset(); } } diff --git a/gtk2_ardour/route_time_axis.h b/gtk2_ardour/route_time_axis.h index 42c889e16f..9e33d46e2a 100644 --- a/gtk2_ardour/route_time_axis.h +++ b/gtk2_ardour/route_time_axis.h @@ -45,8 +45,8 @@ namespace ARDOUR { class Region; class Diskstream; class RouteGroup; - class Redirect; - class Insert; + class IOProcessor; + class Processor; class Location; class Playlist; } @@ -59,7 +59,7 @@ class RegionSelection; class Selectable; class AutomationTimeAxisView; class AutomationLine; -class RedirectAutomationLine; +class ProcessorAutomationLine; class TimeSelection; class RouteTimeAxisView : public RouteUI, public TimeAxisView @@ -128,13 +128,13 @@ protected: }; struct InsertAutomationInfo { - boost::shared_ptr insert; - bool valid; - Gtk::Menu* menu; - vector lines; + boost::shared_ptr processor; + bool valid; + Gtk::Menu* menu; + vector lines; - InsertAutomationInfo (boost::shared_ptr i) - : insert (i), valid (true), menu (0) {} + InsertAutomationInfo (boost::shared_ptr i) + : processor (i), valid (true), menu (0) {} ~InsertAutomationInfo (); }; @@ -145,16 +145,16 @@ protected: gint edit_click (GdkEventButton *); - void inserts_changed (); + void processors_changed (); - void add_insert_to_subplugin_menu (boost::shared_ptr); + void add_processor_to_subplugin_menu (boost::shared_ptr); void remove_ran (InsertAutomationNode* ran); - void insert_menu_item_toggled (RouteTimeAxisView::InsertAutomationInfo*, + void processor_menu_item_toggled (RouteTimeAxisView::InsertAutomationInfo*, RouteTimeAxisView::InsertAutomationNode*); - void insert_automation_track_hidden (InsertAutomationNode*, - boost::shared_ptr); + void processor_automation_track_hidden (InsertAutomationNode*, + boost::shared_ptr); void automation_track_hidden (ARDOUR::ParamID param); @@ -162,17 +162,17 @@ protected: RouteAutomationNode* automation_track(ARDOUR::AutomationType type); InsertAutomationNode* - find_insert_automation_node (boost::shared_ptr i, ARDOUR::ParamID); + find_processor_automation_node (boost::shared_ptr i, ARDOUR::ParamID); - RedirectAutomationLine* - find_insert_automation_curve (boost::shared_ptr i, ARDOUR::ParamID); + ProcessorAutomationLine* + find_processor_automation_curve (boost::shared_ptr i, ARDOUR::ParamID); - void add_insert_automation_curve (boost::shared_ptr r, ARDOUR::ParamID); - void add_existing_insert_automation_curves (boost::shared_ptr); + void add_processor_automation_curve (boost::shared_ptr r, ARDOUR::ParamID); + void add_existing_processor_automation_curves (boost::shared_ptr); void add_automation_child(ARDOUR::ParamID param, AutomationTimeAxisView* track); - void reset_insert_automation_curves (); + void reset_processor_automation_curves (); void take_name_changed (void *src); void route_name_changed (); @@ -222,7 +222,7 @@ protected: void color_handler (); void region_view_added (RegionView*); - void add_ghost_to_insert (RegionView*, AutomationTimeAxisView*); + void add_ghost_to_processor (RegionView*, AutomationTimeAxisView*); StreamView* _view; ArdourCanvas::Canvas& parent_canvas; @@ -230,7 +230,7 @@ protected: Gtk::HBox other_button_hbox; Gtk::Table button_table; - Gtk::Button insert_button; + Gtk::Button processor_button; Gtk::Button edit_group_button; Gtk::Button playlist_button; Gtk::Button size_button; @@ -257,8 +257,8 @@ protected: void _set_track_mode (ARDOUR::Track* track, ARDOUR::TrackMode mode, Gtk::RadioMenuItem* reset_item); void track_mode_changed (); - list insert_automation; - vector insert_automation_curves; + list processor_automation; + vector processor_automation_curves; // Set from XML so context menu automation buttons can be correctly initialized set _show_automation; diff --git a/gtk2_ardour/route_ui.h b/gtk2_ardour/route_ui.h index e727c2e56d..4a4fed5b75 100644 --- a/gtk2_ardour/route_ui.h +++ b/gtk2_ardour/route_ui.h @@ -98,7 +98,7 @@ class RouteUI : public virtual AxisView void solo_changed(void*); void solo_changed_so_update_mute (); void mute_changed(void*); - virtual void inserts_changed () {} + virtual void processors_changed () {} void route_rec_enable_changed(); void session_rec_enable_changed(); diff --git a/gtk2_ardour/selection.cc b/gtk2_ardour/selection.cc index 7d68d9bbd0..43dd75df61 100644 --- a/gtk2_ardour/selection.cc +++ b/gtk2_ardour/selection.cc @@ -64,7 +64,7 @@ operator== (const Selection& a, const Selection& b) a.time == b.time && a.lines == b.lines && a.playlists == b.playlists && - a.inserts == b.inserts; + a.processors == b.processors; } /** Clear everything from the Selection */ @@ -77,7 +77,7 @@ Selection::clear () clear_lines(); clear_time (); clear_playlists (); - clear_inserts (); + clear_processors (); } void @@ -91,11 +91,11 @@ Selection::dump_region_layers() void -Selection::clear_inserts () +Selection::clear_processors () { - if (!inserts.empty()) { - inserts.clear (); - InsertsChanged (); + if (!processors.empty()) { + processors.clear (); + ProcessorsChanged (); } } @@ -154,16 +154,16 @@ Selection::clear_lines () } void -Selection::toggle (boost::shared_ptr r) +Selection::toggle (boost::shared_ptr r) { - InsertSelection::iterator i; + ProcessorSelection::iterator i; - if ((i = find (inserts.begin(), inserts.end(), r)) == inserts.end()) { - inserts.push_back (r); + if ((i = find (processors.begin(), processors.end(), r)) == processors.end()) { + processors.push_back (r); } else { - inserts.erase (i); + processors.erase (i); } - InsertsChanged(); + ProcessorsChanged(); } @@ -254,11 +254,11 @@ Selection::toggle (nframes_t start, nframes_t end) void -Selection::add (boost::shared_ptr i) +Selection::add (boost::shared_ptr i) { - if (find (inserts.begin(), inserts.end(), i) == inserts.end()) { - inserts.push_back (i); - InsertsChanged(); + if (find (processors.begin(), processors.end(), i) == processors.end()) { + processors.push_back (i); + ProcessorsChanged(); } } @@ -395,12 +395,12 @@ Selection::add (AutomationList* ac) } void -Selection::remove (boost::shared_ptr r) +Selection::remove (boost::shared_ptr r) { - InsertSelection::iterator i; - if ((i = find (inserts.begin(), inserts.end(), r)) != inserts.end()) { - inserts.erase (i); - InsertsChanged (); + ProcessorSelection::iterator i; + if ((i = find (processors.begin(), processors.end(), r)) != processors.end()) { + processors.erase (i); + ProcessorsChanged (); } } @@ -510,9 +510,9 @@ Selection::remove (AutomationList *ac) } void -Selection::set (boost::shared_ptr i) +Selection::set (boost::shared_ptr i) { - clear_inserts (); + clear_processors (); add (i); } @@ -625,7 +625,7 @@ Selection::empty () lines.empty () && time.empty () && playlists.empty () && - inserts.empty () + processors.empty () ; } diff --git a/gtk2_ardour/selection.h b/gtk2_ardour/selection.h index 401531c30b..4ffb2bb9b0 100644 --- a/gtk2_ardour/selection.h +++ b/gtk2_ardour/selection.h @@ -30,7 +30,7 @@ #include "track_selection.h" #include "automation_selection.h" #include "playlist_selection.h" -#include "redirect_selection.h" +#include "processor_selection.h" #include "point_selection.h" class TimeAxisView; @@ -41,7 +41,7 @@ namespace ARDOUR { class Region; class AudioRegion; class Playlist; - class Insert; + class Processor; class AutomationList; } @@ -69,7 +69,7 @@ class Selection : public sigc::trackable TimeSelection time; AutomationSelection lines; PlaylistSelection playlists; - InsertSelection inserts; + ProcessorSelection processors; PointSelection points; Selection() { @@ -84,7 +84,7 @@ class Selection : public sigc::trackable sigc::signal TimeChanged; sigc::signal LinesChanged; sigc::signal PlaylistsChanged; - sigc::signal InsertsChanged; + sigc::signal ProcessorsChanged; sigc::signal PointsChanged; void clear (); @@ -107,7 +107,7 @@ class Selection : public sigc::trackable void set (ARDOUR::AutomationList*); void set (boost::shared_ptr); void set (const std::list >&); - void set (boost::shared_ptr); + void set (boost::shared_ptr); void set (AutomationSelectable*); void toggle (TimeAxisView*); @@ -118,7 +118,7 @@ class Selection : public sigc::trackable void toggle (ARDOUR::AutomationList*); void toggle (boost::shared_ptr); void toggle (const std::list >&); - void toggle (boost::shared_ptr); + void toggle (boost::shared_ptr); void toggle (const std::vector&); void add (TimeAxisView*); @@ -129,7 +129,7 @@ class Selection : public sigc::trackable void add (ARDOUR::AutomationList*); void add (boost::shared_ptr); void add (const std::list >&); - void add (boost::shared_ptr); + void add (boost::shared_ptr); void remove (TimeAxisView*); void remove (const std::list&); @@ -139,7 +139,7 @@ class Selection : public sigc::trackable void remove (ARDOUR::AutomationList*); void remove (boost::shared_ptr); void remove (const std::list >&); - void remove (boost::shared_ptr); + void remove (boost::shared_ptr); void remove (const list&); void replace (uint32_t time_index, nframes_t start, nframes_t end); @@ -149,7 +149,7 @@ class Selection : public sigc::trackable void clear_time(); void clear_lines (); void clear_playlists (); - void clear_inserts (); + void clear_processors (); void clear_points (); void foreach_region (void (ARDOUR::Region::*method)(void)); diff --git a/gtk2_ardour/send_ui.h b/gtk2_ardour/send_ui.h index 2d041bb4fe..0cd4b1a265 100644 --- a/gtk2_ardour/send_ui.h +++ b/gtk2_ardour/send_ui.h @@ -26,7 +26,7 @@ namespace ARDOUR { class Send; class Session; - class Redirect; + class IOProcessor; } class IOSelector; diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc index b2121b26fb..9d368afe01 100644 --- a/gtk2_ardour/time_axis_view.cc +++ b/gtk2_ardour/time_axis_view.cc @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include "ardour_ui.h" diff --git a/gtk2_ardour/visual_time_axis.cc b/gtk2_ardour/visual_time_axis.cc index b685971144..83b95bb5d2 100644 --- a/gtk2_ardour/visual_time_axis.cc +++ b/gtk2_ardour/visual_time_axis.cc @@ -35,7 +35,7 @@ #include #include -#include +#include #include #include "ardour_ui.h" diff --git a/gtk2_ardour/vst_pluginui.cc b/gtk2_ardour/vst_pluginui.cc index 1320ccdc7a..e1378dbb2a 100644 --- a/gtk2_ardour/vst_pluginui.cc +++ b/gtk2_ardour/vst_pluginui.cc @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include "plugin_ui.h" -- cgit v1.2.3