2005-09-25 14:42:24 -04:00
|
|
|
/*
|
2009-10-14 12:10:01 -04:00
|
|
|
Copyright (C) 2000 Paul Davis
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
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 <algorithm>
|
2007-06-27 18:06:35 -04:00
|
|
|
#include <inttypes.h>
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2012-07-25 13:48:55 -04:00
|
|
|
#include <glibmm/threads.h>
|
2005-09-25 16:33:00 -04:00
|
|
|
#include <gtkmm2ext/utils.h>
|
2007-03-18 12:45:43 -04:00
|
|
|
#include <gtkmm2ext/window_title.h>
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2011-10-28 11:35:09 -04:00
|
|
|
#include "ardour/audioengine.h"
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "ardour/plugin.h"
|
2009-05-07 13:31:18 -04:00
|
|
|
#include "ardour/plugin_insert.h"
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "ardour/plugin_manager.h"
|
2009-05-07 13:31:18 -04:00
|
|
|
#include "ardour/port_insert.h"
|
|
|
|
#include "ardour/return.h"
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "ardour/route.h"
|
|
|
|
#include "ardour/send.h"
|
2013-07-27 09:02:19 -04:00
|
|
|
#include "ardour/internal_send.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-05-07 13:31:18 -04:00
|
|
|
#include "ardour_ui.h"
|
|
|
|
#include "gui_thread.h"
|
|
|
|
#include "io_selector.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
#include "keyboard.h"
|
|
|
|
#include "mixer_strip.h"
|
2010-08-31 10:16:29 -04:00
|
|
|
#include "port_insert_ui.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
#include "plugin_selector.h"
|
|
|
|
#include "plugin_ui.h"
|
2009-05-07 13:31:18 -04:00
|
|
|
#include "return_ui.h"
|
|
|
|
#include "route_params_ui.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
#include "send_ui.h"
|
|
|
|
#include "utils.h"
|
|
|
|
|
|
|
|
#include "i18n.h"
|
|
|
|
|
|
|
|
using namespace ARDOUR;
|
2006-06-21 19:01:03 -04:00
|
|
|
using namespace PBD;
|
2005-09-25 14:42:24 -04:00
|
|
|
using namespace Gtk;
|
2007-03-18 12:45:43 -04:00
|
|
|
using namespace Gtkmm2ext;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2007-03-13 12:17:29 -04:00
|
|
|
RouteParams_UI::RouteParams_UI ()
|
2011-11-18 19:56:35 -05:00
|
|
|
: ArdourWindow (_("Tracks and Busses")),
|
2007-06-27 18:06:35 -04:00
|
|
|
latency_apply_button (Stock::APPLY),
|
2005-09-25 14:42:24 -04:00
|
|
|
track_menu(0)
|
|
|
|
{
|
2009-07-12 20:26:28 -04:00
|
|
|
insert_box = 0;
|
2005-09-25 14:42:24 -04:00
|
|
|
_input_iosel = 0;
|
|
|
|
_output_iosel = 0;
|
2009-07-12 20:26:28 -04:00
|
|
|
_active_view = 0;
|
2007-06-27 18:06:35 -04:00
|
|
|
latency_widget = 0;
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
using namespace Notebook_Helpers;
|
|
|
|
|
2005-10-06 14:24:23 -04:00
|
|
|
input_frame.set_shadow_type(Gtk::SHADOW_NONE);
|
|
|
|
output_frame.set_shadow_type(Gtk::SHADOW_NONE);
|
2007-06-27 18:06:35 -04:00
|
|
|
latency_frame.set_shadow_type (Gtk::SHADOW_NONE);
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
notebook.set_show_tabs (true);
|
|
|
|
notebook.set_show_border (true);
|
|
|
|
notebook.set_name ("RouteParamNotebook");
|
2005-10-06 14:24:23 -04:00
|
|
|
|
|
|
|
// create the tree model
|
|
|
|
route_display_model = ListStore::create(route_display_columns);
|
|
|
|
|
|
|
|
// setup the treeview
|
|
|
|
route_display.set_model(route_display_model);
|
2007-10-19 10:57:04 -04:00
|
|
|
route_display.append_column(_("Tracks/Busses"), route_display_columns.text);
|
2005-10-06 14:24:23 -04:00
|
|
|
route_display.set_name(X_("RouteParamsListDisplay"));
|
|
|
|
route_display.get_selection()->set_mode(Gtk::SELECTION_SINGLE); // default
|
|
|
|
route_display.set_reorderable(false);
|
|
|
|
route_display.set_size_request(75, -1);
|
|
|
|
route_display.set_headers_visible(true);
|
|
|
|
route_display.set_headers_clickable(true);
|
|
|
|
|
2010-03-16 16:16:13 -04:00
|
|
|
dynamic_cast<Gtk::CellRendererText*>(route_display.get_column_cell_renderer(0))->property_ellipsize() = Pango::ELLIPSIZE_START;
|
2010-03-16 15:21:09 -04:00
|
|
|
|
2005-10-06 14:24:23 -04:00
|
|
|
route_select_scroller.add(route_display);
|
|
|
|
route_select_scroller.set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
route_select_frame.set_name("RouteSelectBaseFrame");
|
2005-09-25 16:33:00 -04:00
|
|
|
route_select_frame.set_shadow_type (Gtk::SHADOW_IN);
|
2005-09-25 14:42:24 -04:00
|
|
|
route_select_frame.add(route_select_scroller);
|
|
|
|
|
|
|
|
list_vpacker.pack_start (route_select_frame, true, true);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
notebook.pages().push_back (TabElem (input_frame, _("Inputs")));
|
|
|
|
notebook.pages().push_back (TabElem (output_frame, _("Outputs")));
|
2009-07-12 20:26:28 -04:00
|
|
|
notebook.pages().push_back (TabElem (redir_hpane, _("Plugins, Inserts & Sends")));
|
2007-06-27 18:06:35 -04:00
|
|
|
notebook.pages().push_back (TabElem (latency_frame, _("Latency")));
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
notebook.set_name ("InspectorNotebook");
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
title_label.set_name ("RouteParamsTitleLabel");
|
|
|
|
update_title();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2007-06-27 18:06:35 -04:00
|
|
|
latency_packer.set_spacing (18);
|
|
|
|
latency_button_box.pack_start (latency_apply_button);
|
|
|
|
delay_label.set_alignment (0, 0.5);
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
// changeable area
|
|
|
|
route_param_frame.set_name("RouteParamsBaseFrame");
|
2005-09-25 16:33:00 -04:00
|
|
|
route_param_frame.set_shadow_type (Gtk::SHADOW_IN);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
route_hpacker.pack_start (notebook, true, true);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
route_vpacker.pack_start (title_label, false, false);
|
|
|
|
route_vpacker.pack_start (route_hpacker, true, true);
|
|
|
|
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-05-06 17:01:18 -04:00
|
|
|
list_hpane.pack1 (list_vpacker);
|
2005-09-25 14:42:24 -04:00
|
|
|
list_hpane.add2 (route_vpacker);
|
|
|
|
|
|
|
|
list_hpane.set_position(110);
|
|
|
|
|
2009-07-12 20:26:28 -04:00
|
|
|
redir_hpane.set_position(110);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-05-06 17:01:18 -04:00
|
|
|
//global_vpacker.pack_start (list_hpane, true, true);
|
|
|
|
//get_vbox()->pack_start (global_vpacker);
|
2011-11-18 19:56:35 -05:00
|
|
|
add (list_hpane);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
set_name ("RouteParamsWindow");
|
|
|
|
set_default_size (620,370);
|
2010-08-16 20:28:20 -04:00
|
|
|
set_wmclass (X_("ardour_route_parameters"), PROGRAM_NAME);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
// events
|
2009-12-11 18:29:48 -05:00
|
|
|
route_display.get_selection()->signal_changed().connect(sigc::mem_fun(*this, &RouteParams_UI::route_selected));
|
|
|
|
route_display.get_column(0)->signal_clicked().connect(sigc::mem_fun(*this, &RouteParams_UI::show_track_menu));
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-09-25 16:33:00 -04:00
|
|
|
add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::BUTTON_RELEASE_MASK);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2011-11-14 12:41:29 -05:00
|
|
|
_plugin_selector = new PluginSelector (PluginManager::instance());
|
2013-07-10 07:16:42 -04:00
|
|
|
show_all();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
RouteParams_UI::~RouteParams_UI ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-01-30 02:40:13 -05:00
|
|
|
RouteParams_UI::add_routes (RouteList& routes)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2009-12-11 18:29:48 -05:00
|
|
|
ENSURE_GUI_THREAD (*this, &RouteParams_UI::add_routes, routes)
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-01-30 02:40:13 -05:00
|
|
|
for (RouteList::iterator x = routes.begin(); x != routes.end(); ++x) {
|
2006-08-16 22:12:20 -04:00
|
|
|
boost::shared_ptr<Route> route = (*x);
|
2005-10-06 14:24:23 -04:00
|
|
|
|
2013-04-06 16:04:02 -04:00
|
|
|
if (route->is_auditioner()) {
|
2006-08-16 22:12:20 -04:00
|
|
|
return;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-08-16 22:12:20 -04:00
|
|
|
TreeModel::Row row = *(route_display_model->append());
|
|
|
|
row[route_display_columns.text] = route->name();
|
|
|
|
row[route_display_columns.route] = route;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-08-16 22:12:20 -04:00
|
|
|
//route_select_list.rows().back().select ();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2012-04-25 08:58:19 -04:00
|
|
|
route->PropertyChanged.connect (*this, invalidator (*this), boost::bind (&RouteParams_UI::route_property_changed, this, _1, boost::weak_ptr<Route>(route)), gui_context());
|
2010-03-30 11:18:43 -04:00
|
|
|
route->DropReferences.connect (*this, invalidator (*this), boost::bind (&RouteParams_UI::route_removed, this, boost::weak_ptr<Route>(route)), gui_context());
|
2006-08-16 22:12:20 -04:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2010-02-19 13:09:08 -05:00
|
|
|
RouteParams_UI::route_property_changed (const PropertyChange& what_changed, boost::weak_ptr<Route> wr)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2010-02-19 13:09:08 -05:00
|
|
|
if (!what_changed.contains (ARDOUR::Properties::name)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
boost::shared_ptr<Route> route (wr.lock());
|
|
|
|
|
2011-06-01 13:00:29 -04:00
|
|
|
if (!route) {
|
2009-12-17 13:24:23 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ENSURE_GUI_THREAD (*this, &RouteParams_UI::route_name_changed, wr)
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-10-06 14:24:23 -04:00
|
|
|
bool found = false ;
|
|
|
|
TreeModel::Children rows = route_display_model->children();
|
|
|
|
for(TreeModel::Children::iterator iter = rows.begin(); iter != rows.end(); ++iter) {
|
2006-07-27 12:52:14 -04:00
|
|
|
boost::shared_ptr<Route> r =(*iter)[route_display_columns.route];
|
|
|
|
if (r == route) {
|
2005-10-06 14:24:23 -04:00
|
|
|
(*iter)[route_display_columns.text] = route->name() ;
|
|
|
|
found = true ;
|
|
|
|
break;
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2006-07-27 12:52:14 -04:00
|
|
|
if(!found) {
|
2005-10-06 14:24:23 -04:00
|
|
|
error << _("route display list item for renamed route not found!") << endmsg;
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
if (route == _route) {
|
|
|
|
track_input_label.set_text (route->name());
|
|
|
|
update_title();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2007-06-27 16:23:48 -04:00
|
|
|
RouteParams_UI::setup_processor_boxes()
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2009-12-17 13:24:23 -05:00
|
|
|
if (_session && _route) {
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
// just in case... shouldn't need this
|
2007-06-27 16:23:48 -04:00
|
|
|
cleanup_processor_boxes();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
// construct new redirect boxes
|
2009-12-17 13:24:23 -05:00
|
|
|
insert_box = new ProcessorBox (_session, boost::bind (&RouteParams_UI::plugin_selector, this), _rr_selection, 0);
|
2009-10-22 13:17:34 -04:00
|
|
|
insert_box->set_route (_route);
|
2009-07-12 20:26:28 -04:00
|
|
|
|
2009-10-22 13:17:34 -04:00
|
|
|
redir_hpane.pack1 (*insert_box);
|
2009-07-12 20:26:28 -04:00
|
|
|
|
2009-12-11 18:29:48 -05:00
|
|
|
insert_box->ProcessorSelected.connect (sigc::mem_fun(*this, &RouteParams_UI::redirect_selected));
|
|
|
|
insert_box->ProcessorUnselected.connect (sigc::mem_fun(*this, &RouteParams_UI::redirect_selected));
|
2009-07-12 20:26:28 -04:00
|
|
|
|
|
|
|
redir_hpane.show_all();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2007-06-27 16:23:48 -04:00
|
|
|
RouteParams_UI::cleanup_processor_boxes()
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2009-07-12 20:26:28 -04:00
|
|
|
if (insert_box) {
|
|
|
|
redir_hpane.remove(*insert_box);
|
|
|
|
delete insert_box;
|
|
|
|
insert_box = 0;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-06-27 18:06:35 -04:00
|
|
|
void
|
|
|
|
RouteParams_UI::refresh_latency ()
|
|
|
|
{
|
|
|
|
if (latency_widget) {
|
|
|
|
latency_widget->refresh();
|
|
|
|
|
|
|
|
char buf[128];
|
2010-12-03 17:26:29 -05:00
|
|
|
snprintf (buf, sizeof (buf), _("Playback delay: %" PRId64 " samples"), _route->initial_delay());
|
2007-06-27 18:06:35 -04:00
|
|
|
delay_label.set_text (buf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
RouteParams_UI::cleanup_latency_frame ()
|
|
|
|
{
|
|
|
|
if (latency_widget) {
|
|
|
|
latency_frame.remove ();
|
|
|
|
latency_packer.remove (*latency_widget);
|
|
|
|
latency_packer.remove (latency_button_box);
|
|
|
|
latency_packer.remove (delay_label);
|
2009-12-17 13:24:23 -05:00
|
|
|
latency_connections.drop_connections ();
|
|
|
|
latency_click_connection.disconnect ();
|
|
|
|
|
2007-06-27 18:06:35 -04:00
|
|
|
delete latency_widget;
|
|
|
|
latency_widget = 0;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2007-06-27 18:06:35 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
RouteParams_UI::setup_latency_frame ()
|
|
|
|
{
|
2009-12-17 13:24:23 -05:00
|
|
|
latency_widget = new LatencyGUI (*(_route->output()), _session->frame_rate(), _session->engine().frames_per_cycle());
|
2007-06-27 18:06:35 -04:00
|
|
|
|
|
|
|
char buf[128];
|
2010-12-03 17:26:29 -05:00
|
|
|
snprintf (buf, sizeof (buf), _("Playback delay: %" PRId64 " samples"), _route->initial_delay());
|
2007-06-27 18:06:35 -04:00
|
|
|
delay_label.set_text (buf);
|
|
|
|
|
|
|
|
latency_packer.pack_start (*latency_widget, false, false);
|
|
|
|
latency_packer.pack_start (latency_button_box, false, false);
|
|
|
|
latency_packer.pack_start (delay_label);
|
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
latency_click_connection = latency_apply_button.signal_clicked().connect (sigc::mem_fun (*latency_widget, &LatencyGUI::finish));
|
2010-03-30 11:18:43 -04:00
|
|
|
_route->signal_latency_changed.connect (latency_connections, invalidator (*this), boost::bind (&RouteParams_UI::refresh_latency, this), gui_context());
|
|
|
|
_route->initial_delay_changed.connect (latency_connections, invalidator (*this), boost::bind (&RouteParams_UI::refresh_latency, this), gui_context());
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2007-06-27 18:06:35 -04:00
|
|
|
latency_frame.add (latency_packer);
|
|
|
|
latency_frame.show_all ();
|
|
|
|
}
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void
|
|
|
|
RouteParams_UI::setup_io_frames()
|
|
|
|
{
|
|
|
|
cleanup_io_frames();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
// input
|
2009-12-17 13:24:23 -05:00
|
|
|
_input_iosel = new IOSelector (this, _session, _route->input());
|
2009-01-12 20:15:19 -05:00
|
|
|
_input_iosel->setup ();
|
2007-05-10 13:42:57 -04:00
|
|
|
input_frame.add (*_input_iosel);
|
2005-09-25 14:42:24 -04:00
|
|
|
input_frame.show_all();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
// output
|
2009-12-17 13:24:23 -05:00
|
|
|
_output_iosel = new IOSelector (this, _session, _route->output());
|
2009-01-12 20:15:19 -05:00
|
|
|
_output_iosel->setup ();
|
2007-05-10 13:42:57 -04:00
|
|
|
output_frame.add (*_output_iosel);
|
2005-09-25 14:42:24 -04:00
|
|
|
output_frame.show_all();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
RouteParams_UI::cleanup_io_frames()
|
|
|
|
{
|
|
|
|
if (_input_iosel) {
|
|
|
|
_input_iosel->Finished (IOSelector::Cancelled);
|
|
|
|
input_frame.remove();
|
|
|
|
delete _input_iosel;
|
|
|
|
_input_iosel = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_output_iosel) {
|
|
|
|
_output_iosel->Finished (IOSelector::Cancelled);
|
|
|
|
|
|
|
|
output_frame.remove();
|
|
|
|
delete _output_iosel;
|
|
|
|
_output_iosel = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-07-12 20:26:28 -04:00
|
|
|
RouteParams_UI::cleanup_view (bool stopupdate)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2009-07-12 20:26:28 -04:00
|
|
|
if (_active_view) {
|
2008-01-10 16:20:59 -05:00
|
|
|
GenericPluginUI * plugui = 0;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-12 20:26:28 -04:00
|
|
|
if (stopupdate && (plugui = dynamic_cast<GenericPluginUI*>(_active_view)) != 0) {
|
2005-11-25 19:06:46 -05:00
|
|
|
plugui->stop_updating (0);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
_processor_going_away_connection.disconnect ();
|
2009-07-12 20:26:28 -04:00
|
|
|
redir_hpane.remove(*_active_view);
|
|
|
|
delete _active_view;
|
|
|
|
_active_view = 0;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-12-17 13:24:23 -05:00
|
|
|
RouteParams_UI::route_removed (boost::weak_ptr<Route> wr)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2009-12-17 13:24:23 -05:00
|
|
|
boost::shared_ptr<Route> route (wr.lock());
|
|
|
|
|
2011-06-01 13:00:29 -04:00
|
|
|
if (!route) {
|
2009-12-17 13:24:23 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-03-30 11:18:43 -04:00
|
|
|
ENSURE_GUI_THREAD (*this, invalidator (*this), &RouteParams_UI::route_removed, wr)
|
2005-10-06 14:24:23 -04:00
|
|
|
|
|
|
|
TreeModel::Children rows = route_display_model->children();
|
|
|
|
TreeModel::Children::iterator ri;
|
|
|
|
|
|
|
|
for(TreeModel::Children::iterator iter = rows.begin(); iter != rows.end(); ++iter) {
|
2006-07-27 12:52:14 -04:00
|
|
|
boost::shared_ptr<Route> r =(*iter)[route_display_columns.route];
|
|
|
|
|
|
|
|
if (r == route) {
|
2005-10-06 14:24:23 -04:00
|
|
|
route_display_model->erase(iter);
|
|
|
|
break;
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2006-07-27 12:52:14 -04:00
|
|
|
if (route == _route) {
|
2005-09-25 14:42:24 -04:00
|
|
|
cleanup_io_frames();
|
2009-07-12 20:26:28 -04:00
|
|
|
cleanup_view();
|
2007-06-27 16:23:48 -04:00
|
|
|
cleanup_processor_boxes();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-07-27 12:52:14 -04:00
|
|
|
_route.reset ((Route*) 0);
|
2009-07-12 20:26:28 -04:00
|
|
|
_processor.reset ((Processor*) 0);
|
2005-09-25 14:42:24 -04:00
|
|
|
update_title();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
RouteParams_UI::set_session (Session *sess)
|
|
|
|
{
|
2011-11-18 19:56:35 -05:00
|
|
|
ArdourWindow::set_session (sess);
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2005-11-28 17:36:26 -05:00
|
|
|
route_display_model->clear();
|
2009-12-17 13:24:23 -05:00
|
|
|
_plugin_selector->set_session (_session);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
if (_session) {
|
|
|
|
boost::shared_ptr<RouteList> r = _session->get_routes();
|
2006-08-16 22:12:20 -04:00
|
|
|
add_routes (*r);
|
2012-04-25 08:58:19 -04:00
|
|
|
_session->RouteAdded.connect (_session_connections, invalidator (*this), boost::bind (&RouteParams_UI::add_routes, this, _1), gui_context());
|
2005-09-25 14:42:24 -04:00
|
|
|
start_updating ();
|
|
|
|
} else {
|
|
|
|
stop_updating ();
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
|
|
|
|
void
|
2009-12-17 13:24:23 -05:00
|
|
|
RouteParams_UI::session_going_away ()
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2009-12-17 13:24:23 -05:00
|
|
|
ENSURE_GUI_THREAD (*this, &RouteParams_UI::session_going_away);
|
|
|
|
|
|
|
|
SessionHandlePtr::session_going_away ();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-11-28 17:36:26 -05:00
|
|
|
route_display_model->clear();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
cleanup_io_frames();
|
2009-07-12 20:26:28 -04:00
|
|
|
cleanup_view();
|
2007-06-27 16:23:48 -04:00
|
|
|
cleanup_processor_boxes();
|
2007-06-27 18:06:35 -04:00
|
|
|
cleanup_latency_frame ();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-07-27 12:52:14 -04:00
|
|
|
_route.reset ((Route*) 0);
|
2009-07-12 20:26:28 -04:00
|
|
|
_processor.reset ((Processor*) 0);
|
2005-09-25 14:42:24 -04:00
|
|
|
update_title();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2005-10-06 14:24:23 -04:00
|
|
|
RouteParams_UI::route_selected()
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2005-10-06 14:24:23 -04:00
|
|
|
Glib::RefPtr<TreeSelection> selection = route_display.get_selection();
|
|
|
|
TreeModel::iterator iter = selection->get_selected(); // only used with Gtk::SELECTION_SINGLE
|
2007-06-27 18:06:35 -04:00
|
|
|
|
2005-10-06 14:24:23 -04:00
|
|
|
if(iter) {
|
|
|
|
//If anything is selected
|
2006-07-27 12:52:14 -04:00
|
|
|
boost::shared_ptr<Route> route = (*iter)[route_display_columns.route] ;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
if (_route == route) {
|
|
|
|
// do nothing
|
|
|
|
return;
|
|
|
|
}
|
2005-10-06 14:24:23 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
// remove event binding from previously selected
|
|
|
|
if (_route) {
|
2009-12-17 13:24:23 -05:00
|
|
|
_route_processors_connection.disconnect ();
|
2007-06-27 16:23:48 -04:00
|
|
|
cleanup_processor_boxes();
|
2009-07-12 20:26:28 -04:00
|
|
|
cleanup_view();
|
2005-09-25 14:42:24 -04:00
|
|
|
cleanup_io_frames();
|
2007-06-27 18:06:35 -04:00
|
|
|
cleanup_latency_frame ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2005-10-06 14:24:23 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
// update the other panes with the correct info
|
|
|
|
_route = route;
|
|
|
|
//update_routeinfo (route);
|
|
|
|
|
|
|
|
setup_io_frames();
|
2007-06-27 16:23:48 -04:00
|
|
|
setup_processor_boxes();
|
2007-06-27 18:06:35 -04:00
|
|
|
setup_latency_frame ();
|
2005-10-06 14:24:23 -04:00
|
|
|
|
2012-04-25 08:58:19 -04:00
|
|
|
route->processors_changed.connect (_route_processors_connection, invalidator (*this), boost::bind (&RouteParams_UI::processors_changed, this, _1), gui_context());
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
track_input_label.set_text (_route->name());
|
2005-10-06 14:24:23 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
update_title();
|
2007-06-27 18:06:35 -04:00
|
|
|
|
2005-10-06 14:24:23 -04:00
|
|
|
} else {
|
|
|
|
// no selection
|
|
|
|
if (_route) {
|
2009-12-17 13:24:23 -05:00
|
|
|
_route_processors_connection.disconnect ();
|
2005-10-06 14:24:23 -04:00
|
|
|
|
|
|
|
// remove from view
|
|
|
|
cleanup_io_frames();
|
2009-07-12 20:26:28 -04:00
|
|
|
cleanup_view();
|
2007-06-27 16:23:48 -04:00
|
|
|
cleanup_processor_boxes();
|
2007-06-27 18:06:35 -04:00
|
|
|
cleanup_latency_frame ();
|
2005-10-06 14:24:23 -04:00
|
|
|
|
2006-07-27 12:52:14 -04:00
|
|
|
_route.reset ((Route*) 0);
|
2009-07-12 20:26:28 -04:00
|
|
|
_processor.reset ((Processor*) 0);
|
2005-10-06 14:24:23 -04:00
|
|
|
track_input_label.set_text(_("NO TRACK"));
|
|
|
|
update_title();
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2010-09-02 13:01:36 -04:00
|
|
|
RouteParams_UI::processors_changed (RouteProcessorChange)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2009-07-12 20:26:28 -04:00
|
|
|
cleanup_view();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-12 20:26:28 -04:00
|
|
|
_processor.reset ((Processor*) 0);
|
2007-06-27 18:06:35 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
//update_title();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2005-10-06 14:24:23 -04:00
|
|
|
RouteParams_UI::show_track_menu()
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
using namespace Menu_Helpers;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
if (track_menu == 0) {
|
|
|
|
track_menu = new Menu;
|
|
|
|
track_menu->set_name ("ArdourContextMenu");
|
2009-10-14 12:10:01 -04:00
|
|
|
track_menu->items().push_back
|
2010-05-02 19:54:25 -04:00
|
|
|
(MenuElem (_("Add Track or Bus"),
|
2009-12-11 18:29:48 -05:00
|
|
|
sigc::bind (sigc::mem_fun (*(ARDOUR_UI::instance()), &ARDOUR_UI::add_route), (Gtk::Window*) 0)));
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2006-11-21 19:58:22 -05:00
|
|
|
track_menu->popup (1, gtk_get_current_event_time());
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-12-17 13:24:23 -05:00
|
|
|
RouteParams_UI::redirect_selected (boost::shared_ptr<ARDOUR::Processor> proc)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2007-06-23 16:13:13 -04:00
|
|
|
boost::shared_ptr<Send> send;
|
2009-05-07 13:31:18 -04:00
|
|
|
boost::shared_ptr<Return> retrn;
|
2007-06-23 16:13:13 -04:00
|
|
|
boost::shared_ptr<PluginInsert> plugin_insert;
|
|
|
|
boost::shared_ptr<PortInsert> port_insert;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2013-07-27 09:02:19 -04:00
|
|
|
if ((boost::dynamic_pointer_cast<InternalSend> (proc)) != 0) {
|
|
|
|
cleanup_view();
|
|
|
|
_processor.reset ((Processor*) 0);
|
|
|
|
update_title();
|
|
|
|
return;
|
|
|
|
} else if ((send = boost::dynamic_pointer_cast<Send> (proc)) != 0) {
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
SendUI *send_ui = new SendUI (this, send, _session);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-07-12 20:26:28 -04:00
|
|
|
cleanup_view();
|
2010-03-30 11:18:43 -04:00
|
|
|
send->DropReferences.connect (_processor_going_away_connection, invalidator (*this), boost::bind (&RouteParams_UI::processor_going_away, this, boost::weak_ptr<Processor>(proc)), gui_context());
|
2009-07-12 20:26:28 -04:00
|
|
|
_active_view = send_ui;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-12 20:26:28 -04:00
|
|
|
redir_hpane.add2 (*_active_view);
|
|
|
|
redir_hpane.show_all();
|
2009-05-07 13:31:18 -04:00
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
} else if ((retrn = boost::dynamic_pointer_cast<Return> (proc)) != 0) {
|
2009-05-07 13:31:18 -04:00
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
ReturnUI *return_ui = new ReturnUI (this, retrn, _session);
|
2009-05-07 13:31:18 -04:00
|
|
|
|
2009-07-12 20:26:28 -04:00
|
|
|
cleanup_view();
|
2010-03-30 11:18:43 -04:00
|
|
|
retrn->DropReferences.connect (_processor_going_away_connection, invalidator (*this), boost::bind (&RouteParams_UI::processor_going_away, this, boost::weak_ptr<Processor>(proc)), gui_context());
|
2009-07-12 20:26:28 -04:00
|
|
|
_active_view = return_ui;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-12 20:26:28 -04:00
|
|
|
redir_hpane.add2 (*_active_view);
|
|
|
|
redir_hpane.show_all();
|
2009-05-07 13:31:18 -04:00
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
} else if ((plugin_insert = boost::dynamic_pointer_cast<PluginInsert> (proc)) != 0) {
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2008-01-10 16:20:59 -05:00
|
|
|
GenericPluginUI *plugin_ui = new GenericPluginUI (plugin_insert, true);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-07-12 20:26:28 -04:00
|
|
|
cleanup_view();
|
2010-03-30 11:18:43 -04:00
|
|
|
plugin_insert->plugin()->DropReferences.connect (_processor_going_away_connection, invalidator (*this), boost::bind (&RouteParams_UI::plugin_going_away, this, PreFader), gui_context());
|
2009-07-12 20:26:28 -04:00
|
|
|
plugin_ui->start_updating (0);
|
|
|
|
_active_view = plugin_ui;
|
2009-12-19 15:26:31 -05:00
|
|
|
|
2009-07-12 20:26:28 -04:00
|
|
|
redir_hpane.pack2 (*_active_view);
|
|
|
|
redir_hpane.show_all();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
} else if ((port_insert = boost::dynamic_pointer_cast<PortInsert> (proc)) != 0) {
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
PortInsertUI *portinsert_ui = new PortInsertUI (this, _session, port_insert);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-12 20:26:28 -04:00
|
|
|
cleanup_view();
|
2010-03-30 11:18:43 -04:00
|
|
|
port_insert->DropReferences.connect (_processor_going_away_connection, invalidator (*this), boost::bind (&RouteParams_UI::processor_going_away, this, boost::weak_ptr<Processor> (proc)), gui_context());
|
2009-07-12 20:26:28 -04:00
|
|
|
_active_view = portinsert_ui;
|
2009-12-19 15:26:31 -05:00
|
|
|
|
2009-07-12 20:26:28 -04:00
|
|
|
redir_hpane.pack2 (*_active_view);
|
|
|
|
portinsert_ui->redisplay();
|
|
|
|
redir_hpane.show_all();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
_processor = proc;
|
2005-09-25 14:42:24 -04:00
|
|
|
update_title();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2006-08-24 21:07:15 -04:00
|
|
|
RouteParams_UI::plugin_going_away (Placement place)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2009-12-11 18:29:48 -05:00
|
|
|
ENSURE_GUI_THREAD (*this, &RouteParams_UI::plugin_going_away, place)
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
// delete the current view without calling finish
|
|
|
|
|
|
|
|
if (place == PreFader) {
|
2009-07-12 20:26:28 -04:00
|
|
|
cleanup_view (false);
|
|
|
|
_processor.reset ((Processor*) 0);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-12-17 13:24:23 -05:00
|
|
|
RouteParams_UI::processor_going_away (boost::weak_ptr<ARDOUR::Processor> wproc)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2009-12-17 13:24:23 -05:00
|
|
|
boost::shared_ptr<Processor> proc = (wproc.lock());
|
|
|
|
|
|
|
|
if (!proc) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ENSURE_GUI_THREAD (*this, &RouteParams_UI::processor_going_away, wproc)
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
printf ("redirect going away\n");
|
|
|
|
// delete the current view without calling finish
|
2009-12-17 13:24:23 -05:00
|
|
|
if (proc == _processor) {
|
2009-07-12 20:26:28 -04:00
|
|
|
cleanup_view (false);
|
|
|
|
_processor.reset ((Processor*) 0);
|
2009-10-14 12:10:01 -04:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
RouteParams_UI::update_title ()
|
|
|
|
{
|
2010-05-02 19:54:25 -04:00
|
|
|
WindowTitle title (_("Tracks and Busses"));
|
2007-03-18 12:45:43 -04:00
|
|
|
|
|
|
|
if (_route) {
|
|
|
|
title_label.set_text(_route->name());
|
|
|
|
title += _route->name();
|
|
|
|
set_title(title.get_string());
|
2010-05-02 19:54:25 -04:00
|
|
|
} else {
|
|
|
|
title_label.set_text(_("No Track or Bus Selected"));
|
|
|
|
title += _("No Track or Bus Selected");
|
2007-03-18 12:45:43 -04:00
|
|
|
set_title(title.get_string());
|
2009-10-14 12:10:01 -04:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
RouteParams_UI::start_updating ()
|
|
|
|
{
|
2009-10-14 12:10:01 -04:00
|
|
|
update_connection = ARDOUR_UI::instance()->RapidScreenUpdate.connect
|
2009-12-11 18:29:48 -05:00
|
|
|
(sigc::mem_fun(*this, &RouteParams_UI::update_views));
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
RouteParams_UI::stop_updating ()
|
|
|
|
{
|
|
|
|
update_connection.disconnect();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
RouteParams_UI::update_views ()
|
|
|
|
{
|
|
|
|
SendUI *sui;
|
|
|
|
// TODO: only do it if correct tab is showing
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-12 20:26:28 -04:00
|
|
|
if ((sui = dynamic_cast<SendUI*> (_active_view)) != 0) {
|
2005-09-25 14:42:24 -04:00
|
|
|
sui->update ();
|
|
|
|
}
|
|
|
|
}
|