2005-09-25 14:42:24 -04:00
|
|
|
/*
|
2009-10-14 12:10:01 -04:00
|
|
|
Copyright (C) 2000-2004 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.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2010-11-13 00:14:48 -05:00
|
|
|
#ifdef WAF_BUILD
|
|
|
|
#include "gtk2ardour-config.h"
|
|
|
|
#endif
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
#include <algorithm>
|
2009-10-22 20:05:50 -04:00
|
|
|
#include <map>
|
2005-09-25 14:42:24 -04:00
|
|
|
#include <sigc++/bind.h>
|
|
|
|
|
2005-11-29 17:48:54 -05:00
|
|
|
#include <gtkmm/accelmap.h>
|
|
|
|
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "pbd/convert.h"
|
2015-04-21 15:10:49 -04:00
|
|
|
#include "pbd/stacktrace.h"
|
2012-06-27 18:57:06 -04:00
|
|
|
#include "pbd/unwind.h"
|
|
|
|
|
2012-07-25 13:48:55 -04:00
|
|
|
#include <glibmm/threads.h>
|
2006-04-25 16:23:50 -04:00
|
|
|
|
2005-09-25 16:33:00 -04:00
|
|
|
#include <gtkmm2ext/gtk_ui.h>
|
2016-02-22 14:42:40 -05:00
|
|
|
#include <gtkmm2ext/keyboard.h>
|
2005-09-25 16:33:00 -04:00
|
|
|
#include <gtkmm2ext/utils.h>
|
2010-03-18 22:49:01 -04:00
|
|
|
#include <gtkmm2ext/tearoff.h>
|
2007-04-11 09:07:51 -04:00
|
|
|
#include <gtkmm2ext/window_title.h>
|
2015-04-21 15:10:49 -04:00
|
|
|
#include <gtkmm2ext/doi.h>
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2015-12-27 09:32:24 -05:00
|
|
|
#include "ardour/amp.h"
|
2012-06-27 18:57:06 -04:00
|
|
|
#include "ardour/debug.h"
|
2016-05-16 07:30:28 -04:00
|
|
|
#include "ardour/audio_track.h"
|
2012-11-12 21:19:04 -05:00
|
|
|
#include "ardour/midi_track.h"
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "ardour/plugin_manager.h"
|
|
|
|
#include "ardour/route_group.h"
|
|
|
|
#include "ardour/session.h"
|
2016-02-27 22:16:37 -05:00
|
|
|
#include "ardour/vca.h"
|
|
|
|
#include "ardour/vca_manager.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2007-04-11 09:07:51 -04:00
|
|
|
#include "keyboard.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
#include "mixer_ui.h"
|
|
|
|
#include "mixer_strip.h"
|
2010-03-10 12:31:16 -05:00
|
|
|
#include "monitor_section.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
#include "plugin_selector.h"
|
2011-11-15 14:33:09 -05:00
|
|
|
#include "public_editor.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
#include "ardour_ui.h"
|
|
|
|
#include "prompter.h"
|
|
|
|
#include "utils.h"
|
2012-10-26 20:15:45 -04:00
|
|
|
#include "route_sorter.h"
|
2005-11-29 17:48:54 -05:00
|
|
|
#include "actions.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
#include "gui_thread.h"
|
2009-06-20 13:15:33 -04:00
|
|
|
#include "mixer_group_tabs.h"
|
2014-12-25 10:02:00 -05:00
|
|
|
#include "timers.h"
|
2015-01-02 09:44:54 -05:00
|
|
|
#include "ui_config.h"
|
2016-02-27 22:16:37 -05:00
|
|
|
#include "vca_master_strip.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
#include "i18n.h"
|
|
|
|
|
|
|
|
using namespace ARDOUR;
|
2014-06-25 15:27:37 -04:00
|
|
|
using namespace ARDOUR_UI_UTILS;
|
2006-06-21 19:01:03 -04:00
|
|
|
using namespace PBD;
|
2005-09-25 14:42:24 -04:00
|
|
|
using namespace Gtk;
|
2005-11-29 17:48:54 -05:00
|
|
|
using namespace Glib;
|
2005-09-25 16:33:00 -04:00
|
|
|
using namespace Gtkmm2ext;
|
2006-01-17 11:40:57 -05:00
|
|
|
using namespace std;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-04-25 16:23:50 -04:00
|
|
|
using PBD::atoi;
|
2012-06-27 18:57:06 -04:00
|
|
|
using PBD::Unwinder;
|
2006-04-25 16:23:50 -04:00
|
|
|
|
2011-11-15 14:33:09 -05:00
|
|
|
Mixer_UI* Mixer_UI::_instance = 0;
|
|
|
|
|
|
|
|
Mixer_UI*
|
2015-10-04 14:51:05 -04:00
|
|
|
Mixer_UI::instance ()
|
2011-11-15 14:33:09 -05:00
|
|
|
{
|
|
|
|
if (!_instance) {
|
|
|
|
_instance = new Mixer_UI;
|
2015-10-04 14:51:05 -04:00
|
|
|
}
|
2011-11-15 14:33:09 -05:00
|
|
|
|
|
|
|
return _instance;
|
|
|
|
}
|
|
|
|
|
2007-04-11 09:07:51 -04:00
|
|
|
Mixer_UI::Mixer_UI ()
|
2015-07-07 22:12:21 -04:00
|
|
|
: Tabbable (_content, _("Mixer"))
|
2012-06-27 18:57:06 -04:00
|
|
|
, no_track_list_redisplay (false)
|
|
|
|
, in_group_row_change (false)
|
|
|
|
, track_menu (0)
|
|
|
|
, _monitor_section (0)
|
2015-09-12 14:05:46 -04:00
|
|
|
, _plugin_selector (0)
|
2015-01-02 09:44:54 -05:00
|
|
|
, _strip_width (UIConfiguration::instance().get_default_narrow_ms() ? Narrow : Wide)
|
2012-06-27 18:57:06 -04:00
|
|
|
, ignore_reorder (false)
|
2014-06-20 21:51:59 -04:00
|
|
|
, _in_group_rebuild_or_clear (false)
|
|
|
|
, _route_deletion_in_progress (false)
|
2014-06-22 11:41:05 -04:00
|
|
|
, _following_editor_selection (false)
|
2014-06-20 21:51:59 -04:00
|
|
|
, _maximised (false)
|
2015-12-10 18:21:02 -05:00
|
|
|
, _show_mixer_list (true)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2016-05-16 07:30:28 -04:00
|
|
|
Stripable::PresentationInfoChange.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::sync_treeview_from_presentation_info, this), gui_context());
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2015-08-10 14:31:59 -04:00
|
|
|
/* bindings was already set in MixerActor constructor */
|
|
|
|
|
|
|
|
_content.set_data ("ardour-bindings", bindings);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
2012-12-09 21:03:45 -05:00
|
|
|
scroller.set_can_default (true);
|
2015-04-21 15:10:49 -04:00
|
|
|
// set_default (scroller);
|
2012-12-09 21:03:45 -05:00
|
|
|
|
2011-11-04 13:53:21 -04:00
|
|
|
scroller_base.set_flags (Gtk::CAN_FOCUS);
|
2009-10-22 13:17:34 -04:00
|
|
|
scroller_base.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
|
|
|
|
scroller_base.set_name ("MixerWindow");
|
2009-12-11 18:29:48 -05:00
|
|
|
scroller_base.signal_button_release_event().connect (sigc::mem_fun(*this, &Mixer_UI::strip_scroller_button_release));
|
2016-05-06 10:04:05 -04:00
|
|
|
|
|
|
|
/* set up drag-n-drop */
|
|
|
|
vector<TargetEntry> target_table;
|
|
|
|
target_table.push_back (TargetEntry ("PluginFavoritePtr"));
|
|
|
|
scroller_base.drag_dest_set (target_table);
|
|
|
|
scroller_base.signal_drag_data_received().connect (sigc::mem_fun(*this, &Mixer_UI::scroller_drag_data_received));
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
// add as last item of strip packer
|
|
|
|
strip_packer.pack_end (scroller_base, true, true);
|
|
|
|
|
2009-06-20 13:15:33 -04:00
|
|
|
_group_tabs = new MixerGroupTabs (this);
|
|
|
|
VBox* b = manage (new VBox);
|
|
|
|
b->pack_start (*_group_tabs, PACK_SHRINK);
|
|
|
|
b->pack_start (strip_packer);
|
|
|
|
b->show_all ();
|
|
|
|
|
|
|
|
scroller.add (*b);
|
2014-07-28 13:01:54 -04:00
|
|
|
scroller.set_policy (Gtk::POLICY_ALWAYS, Gtk::POLICY_AUTOMATIC);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2011-01-09 14:09:49 -05:00
|
|
|
setup_track_display ();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-03-09 18:44:39 -05:00
|
|
|
group_model = ListStore::create (group_columns);
|
|
|
|
group_display.set_model (group_model);
|
2006-05-19 13:29:05 -04:00
|
|
|
group_display.append_column (_("Group"), group_columns.text);
|
2006-11-27 14:31:33 -05:00
|
|
|
group_display.append_column (_("Show"), group_columns.visible);
|
2005-10-01 12:29:37 -04:00
|
|
|
group_display.get_column (0)->set_data (X_("colnum"), GUINT_TO_POINTER(0));
|
|
|
|
group_display.get_column (1)->set_data (X_("colnum"), GUINT_TO_POINTER(1));
|
2006-05-21 06:11:59 -04:00
|
|
|
group_display.get_column (0)->set_expand(true);
|
|
|
|
group_display.get_column (1)->set_expand(false);
|
2012-12-07 17:38:49 -05:00
|
|
|
group_display.set_name ("EditGroupList");
|
2006-03-09 18:44:39 -05:00
|
|
|
group_display.get_selection()->set_mode (Gtk::SELECTION_SINGLE);
|
2006-02-14 14:12:35 -05:00
|
|
|
group_display.set_reorderable (true);
|
|
|
|
group_display.set_headers_visible (true);
|
2006-03-09 18:44:39 -05:00
|
|
|
group_display.set_rules_hint (true);
|
2015-09-15 15:21:01 -04:00
|
|
|
group_display.set_can_focus(false);
|
2006-03-09 18:44:39 -05:00
|
|
|
|
|
|
|
/* name is directly editable */
|
|
|
|
|
|
|
|
CellRendererText* name_cell = dynamic_cast<CellRendererText*>(group_display.get_column_cell_renderer (0));
|
|
|
|
name_cell->property_editable() = true;
|
2009-12-11 18:29:48 -05:00
|
|
|
name_cell->signal_edited().connect (sigc::mem_fun (*this, &Mixer_UI::route_group_name_edit));
|
2005-10-01 12:29:37 -04:00
|
|
|
|
|
|
|
/* use checkbox for the active column */
|
|
|
|
|
2006-02-14 14:12:35 -05:00
|
|
|
CellRendererToggle* active_cell = dynamic_cast<CellRendererToggle*>(group_display.get_column_cell_renderer (1));
|
2005-10-01 12:29:37 -04:00
|
|
|
active_cell->property_activatable() = true;
|
|
|
|
active_cell->property_radio() = false;
|
2006-02-14 14:12:35 -05:00
|
|
|
|
2009-12-11 18:29:48 -05:00
|
|
|
group_model->signal_row_changed().connect (sigc::mem_fun (*this, &Mixer_UI::route_group_row_change));
|
2011-04-19 11:46:47 -04:00
|
|
|
/* We use this to notice drag-and-drop reorders of the group list */
|
|
|
|
group_model->signal_row_deleted().connect (sigc::mem_fun (*this, &Mixer_UI::route_group_row_deleted));
|
2009-12-11 18:29:48 -05:00
|
|
|
group_display.signal_button_press_event().connect (sigc::mem_fun (*this, &Mixer_UI::group_display_button_press), false);
|
2006-02-14 14:12:35 -05:00
|
|
|
|
2005-10-01 12:29:37 -04:00
|
|
|
group_display_scroller.add (group_display);
|
2005-09-28 12:22:43 -04:00
|
|
|
group_display_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
|
|
|
|
|
2009-06-21 15:59:56 -04:00
|
|
|
HBox* route_group_display_button_box = manage (new HBox());
|
2006-03-09 23:05:11 -05:00
|
|
|
|
2009-06-21 15:59:56 -04:00
|
|
|
Button* route_group_add_button = manage (new Button ());
|
|
|
|
Button* route_group_remove_button = manage (new Button ());
|
2006-03-09 23:05:11 -05:00
|
|
|
|
|
|
|
Widget* w;
|
|
|
|
|
|
|
|
w = manage (new Image (Stock::ADD, ICON_SIZE_BUTTON));
|
|
|
|
w->show();
|
2009-06-21 15:59:56 -04:00
|
|
|
route_group_add_button->add (*w);
|
2006-03-09 23:05:11 -05:00
|
|
|
|
|
|
|
w = manage (new Image (Stock::REMOVE, ICON_SIZE_BUTTON));
|
|
|
|
w->show();
|
2009-06-21 15:59:56 -04:00
|
|
|
route_group_remove_button->add (*w);
|
2006-02-14 14:12:35 -05:00
|
|
|
|
2009-06-21 15:59:56 -04:00
|
|
|
route_group_display_button_box->set_homogeneous (true);
|
2006-05-19 13:29:05 -04:00
|
|
|
|
2009-12-11 18:29:48 -05:00
|
|
|
route_group_add_button->signal_clicked().connect (sigc::mem_fun (*this, &Mixer_UI::new_route_group));
|
|
|
|
route_group_remove_button->signal_clicked().connect (sigc::mem_fun (*this, &Mixer_UI::remove_selected_route_group));
|
2006-03-09 18:44:39 -05:00
|
|
|
|
2009-06-21 15:59:56 -04:00
|
|
|
route_group_display_button_box->add (*route_group_add_button);
|
2010-07-19 19:26:40 -04:00
|
|
|
route_group_display_button_box->add (*route_group_remove_button);
|
2006-02-14 14:12:35 -05:00
|
|
|
|
2005-10-01 12:29:37 -04:00
|
|
|
group_display_vbox.pack_start (group_display_scroller, true, true);
|
2009-06-21 15:59:56 -04:00
|
|
|
group_display_vbox.pack_start (*route_group_display_button_box, false, false);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-10-01 12:29:37 -04:00
|
|
|
group_display_frame.set_name ("BaseFrame");
|
|
|
|
group_display_frame.set_shadow_type (Gtk::SHADOW_IN);
|
|
|
|
group_display_frame.add (group_display_vbox);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2016-05-06 08:55:36 -04:00
|
|
|
|
|
|
|
list<TargetEntry> target_list;
|
|
|
|
target_list.push_back (TargetEntry ("PluginPresetPtr"));
|
|
|
|
|
2015-12-25 10:10:09 -05:00
|
|
|
favorite_plugins_model = PluginTreeStore::create (favorite_plugins_columns);
|
2015-12-21 22:43:26 -05:00
|
|
|
favorite_plugins_display.set_model (favorite_plugins_model);
|
|
|
|
favorite_plugins_display.append_column (_("Favorite Plugins"), favorite_plugins_columns.name);
|
|
|
|
favorite_plugins_display.set_name ("EditGroupList");
|
2015-12-26 18:37:53 -05:00
|
|
|
favorite_plugins_display.get_selection()->set_mode (Gtk::SELECTION_SINGLE);
|
|
|
|
favorite_plugins_display.set_reorderable (false);
|
2015-12-21 22:43:26 -05:00
|
|
|
favorite_plugins_display.set_headers_visible (true);
|
|
|
|
favorite_plugins_display.set_rules_hint (true);
|
|
|
|
favorite_plugins_display.set_can_focus (false);
|
2016-05-06 08:55:36 -04:00
|
|
|
favorite_plugins_display.add_object_drag (favorite_plugins_columns.plugin.index(), "PluginFavoritePtr");
|
2015-12-24 11:28:23 -05:00
|
|
|
favorite_plugins_display.set_drag_column (favorite_plugins_columns.name.index());
|
2016-05-06 08:55:36 -04:00
|
|
|
favorite_plugins_display.add_drop_targets (target_list);
|
2015-12-25 11:11:47 -05:00
|
|
|
favorite_plugins_display.signal_row_activated().connect (sigc::mem_fun (*this, &Mixer_UI::plugin_row_activated));
|
2015-12-26 18:37:53 -05:00
|
|
|
favorite_plugins_display.signal_button_press_event().connect (sigc::mem_fun (*this, &Mixer_UI::plugin_row_button_press), false);
|
2015-12-27 22:11:45 -05:00
|
|
|
favorite_plugins_display.signal_drop.connect (sigc::mem_fun (*this, &Mixer_UI::plugin_drop));
|
2016-01-09 18:00:07 -05:00
|
|
|
favorite_plugins_display.signal_row_expanded().connect (sigc::mem_fun (*this, &Mixer_UI::save_favorite_ui_state));
|
|
|
|
favorite_plugins_display.signal_row_collapsed().connect (sigc::mem_fun (*this, &Mixer_UI::save_favorite_ui_state));
|
|
|
|
favorite_plugins_model->signal_row_has_child_toggled().connect (sigc::mem_fun (*this, &Mixer_UI::sync_treeview_favorite_ui_state));
|
2015-12-21 22:43:26 -05:00
|
|
|
|
|
|
|
favorite_plugins_scroller.add (favorite_plugins_display);
|
|
|
|
favorite_plugins_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
|
|
|
|
|
|
|
|
favorite_plugins_frame.set_name ("BaseFrame");
|
|
|
|
favorite_plugins_frame.set_shadow_type (Gtk::SHADOW_IN);
|
|
|
|
favorite_plugins_frame.add (favorite_plugins_scroller);
|
|
|
|
|
2015-12-26 18:38:28 -05:00
|
|
|
rhs_pane1.pack1 (favorite_plugins_frame, false, true);
|
|
|
|
rhs_pane1.pack2 (track_display_frame);
|
|
|
|
rhs_pane2.pack1 (rhs_pane1);
|
|
|
|
rhs_pane2.pack2 (group_display_frame);
|
2015-12-21 22:43:26 -05:00
|
|
|
|
|
|
|
list_vpacker.pack_start (rhs_pane2, true, true);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2016-05-18 22:27:25 -04:00
|
|
|
vca_scroller_base.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
|
|
|
|
vca_scroller_base.set_name ("MixerWindow");
|
|
|
|
vca_scroller_base.signal_button_release_event().connect (sigc::mem_fun(*this, &Mixer_UI::masters_scroller_button_release), false);
|
|
|
|
vca_packer.pack_end (vca_scroller_base, true, true);
|
|
|
|
|
2016-03-03 11:47:01 -05:00
|
|
|
vca_scroller.add (vca_packer);
|
|
|
|
vca_scroller.set_policy (Gtk::POLICY_ALWAYS, Gtk::POLICY_AUTOMATIC);
|
2016-05-18 22:27:25 -04:00
|
|
|
vca_scroller.signal_button_release_event().connect (sigc::mem_fun(*this, &Mixer_UI::strip_scroller_button_release));
|
2016-03-03 11:47:01 -05:00
|
|
|
|
|
|
|
inner_pane.pack1 (scroller);
|
|
|
|
inner_pane.pack2 (vca_scroller);
|
|
|
|
|
|
|
|
global_hpacker.pack_start (inner_pane, true, true);
|
2016-02-25 13:12:09 -05:00
|
|
|
global_hpacker.pack_start (out_packer, false, false);
|
2015-12-19 18:16:42 -05:00
|
|
|
|
2015-10-14 14:24:17 -04:00
|
|
|
list_hpane.pack1(list_vpacker, false, true);
|
2011-08-16 10:45:19 -04:00
|
|
|
list_hpane.pack2(global_hpacker, true, false);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-12-11 18:29:48 -05:00
|
|
|
rhs_pane1.signal_size_allocate().connect (sigc::bind (sigc::mem_fun(*this, &Mixer_UI::pane_allocation_handler),
|
2005-10-05 09:48:09 -04:00
|
|
|
static_cast<Gtk::Paned*> (&rhs_pane1)));
|
2015-12-21 22:43:26 -05:00
|
|
|
rhs_pane2.signal_size_allocate().connect (sigc::bind (sigc::mem_fun(*this, &Mixer_UI::pane_allocation_handler),
|
|
|
|
static_cast<Gtk::Paned*> (&rhs_pane2)));
|
2009-12-11 18:29:48 -05:00
|
|
|
list_hpane.signal_size_allocate().connect (sigc::bind (sigc::mem_fun(*this, &Mixer_UI::pane_allocation_handler),
|
2005-10-05 09:48:09 -04:00
|
|
|
static_cast<Gtk::Paned*> (&list_hpane)));
|
2016-03-03 11:47:01 -05:00
|
|
|
inner_pane.signal_size_allocate().connect (sigc::bind (sigc::mem_fun(*this, &Mixer_UI::pane_allocation_handler),
|
|
|
|
static_cast<Gtk::Paned*> (&inner_pane)));
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2015-07-07 22:12:21 -04:00
|
|
|
_content.pack_start (list_hpane, true, true);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2011-09-07 11:07:02 -04:00
|
|
|
update_title ();
|
2007-04-11 09:07:51 -04:00
|
|
|
|
2009-06-21 15:59:56 -04:00
|
|
|
route_group_display_button_box->show();
|
|
|
|
route_group_add_button->show();
|
|
|
|
route_group_remove_button->show();
|
2007-07-10 15:11:59 -04:00
|
|
|
|
2015-07-07 22:12:21 -04:00
|
|
|
_content.show ();
|
|
|
|
_content.set_name ("MixerWindow");
|
2015-04-21 15:10:49 -04:00
|
|
|
|
2007-07-10 15:11:59 -04:00
|
|
|
global_hpacker.show();
|
|
|
|
scroller.show();
|
|
|
|
scroller_base.show();
|
|
|
|
scroller_hpacker.show();
|
|
|
|
mixer_scroller_vpacker.show();
|
|
|
|
list_vpacker.show();
|
|
|
|
group_display_button_label.show();
|
|
|
|
group_display_button.show();
|
|
|
|
group_display_scroller.show();
|
2015-12-21 22:43:26 -05:00
|
|
|
favorite_plugins_scroller.show();
|
2007-07-10 15:11:59 -04:00
|
|
|
group_display_vbox.show();
|
|
|
|
group_display_frame.show();
|
2015-12-21 22:43:26 -05:00
|
|
|
favorite_plugins_frame.show();
|
2007-07-10 15:11:59 -04:00
|
|
|
rhs_pane1.show();
|
2015-12-21 22:43:26 -05:00
|
|
|
rhs_pane2.show();
|
2007-07-10 15:11:59 -04:00
|
|
|
strip_packer.show();
|
2016-05-18 22:27:25 -04:00
|
|
|
inner_pane.show();
|
2016-03-03 11:47:01 -05:00
|
|
|
vca_scroller.show();
|
2016-01-25 15:59:36 -05:00
|
|
|
vca_packer.show();
|
2016-05-18 22:27:25 -04:00
|
|
|
vca_scroller_base.show();
|
2007-07-10 15:11:59 -04:00
|
|
|
out_packer.show();
|
|
|
|
list_hpane.show();
|
|
|
|
group_display.show();
|
2015-12-21 22:43:26 -05:00
|
|
|
favorite_plugins_display.show();
|
2008-04-11 10:06:50 -04:00
|
|
|
|
2012-04-25 08:58:19 -04:00
|
|
|
MixerStrip::CatchDeletion.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::remove_strip, this, _1), gui_context());
|
2009-11-15 20:06:33 -05:00
|
|
|
|
2016-05-21 08:34:09 -04:00
|
|
|
/* handle escape */
|
|
|
|
|
|
|
|
ARDOUR_UI::instance()->Escape.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::escape, this), gui_context());
|
|
|
|
|
2010-02-03 14:00:58 -05:00
|
|
|
#ifndef DEFER_PLUGIN_SELECTOR_LOAD
|
2011-11-14 12:41:29 -05:00
|
|
|
_plugin_selector = new PluginSelector (PluginManager::instance ());
|
2015-12-21 22:43:26 -05:00
|
|
|
#else
|
|
|
|
#error implement deferred Plugin-Favorite list
|
2010-02-03 14:00:58 -05:00
|
|
|
#endif
|
2015-12-21 22:43:26 -05:00
|
|
|
PluginManager::instance ().PluginListChanged.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::refill_favorite_plugins, this), gui_context());
|
|
|
|
PluginManager::instance ().PluginStatusesChanged.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::refill_favorite_plugins, this), gui_context());
|
2015-12-25 17:23:00 -05:00
|
|
|
ARDOUR::Plugin::PresetsChanged.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::refill_favorite_plugins, this), gui_context());
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
Mixer_UI::~Mixer_UI ()
|
|
|
|
{
|
2012-01-17 20:30:44 -05:00
|
|
|
if (_monitor_section) {
|
2015-12-19 11:42:36 -05:00
|
|
|
monitor_section_detached ();
|
2012-01-17 20:30:44 -05:00
|
|
|
delete _monitor_section;
|
|
|
|
}
|
2015-09-12 14:05:46 -04:00
|
|
|
delete _plugin_selector;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2016-05-21 08:34:09 -04:00
|
|
|
void
|
|
|
|
Mixer_UI::escape ()
|
|
|
|
{
|
|
|
|
select_none ();
|
|
|
|
}
|
|
|
|
|
2011-11-15 14:33:09 -05:00
|
|
|
void
|
|
|
|
Mixer_UI::track_editor_selection ()
|
|
|
|
{
|
|
|
|
PublicEditor::instance().get_selection().TracksChanged.connect (sigc::mem_fun (*this, &Mixer_UI::follow_editor_selection));
|
|
|
|
}
|
|
|
|
|
2015-07-09 12:40:51 -04:00
|
|
|
Gtk::Window*
|
|
|
|
Mixer_UI::use_own_window (bool and_fill_it)
|
2015-04-21 15:10:49 -04:00
|
|
|
{
|
2015-07-09 12:40:51 -04:00
|
|
|
bool new_window = !own_window();
|
2015-04-21 15:10:49 -04:00
|
|
|
|
2015-07-09 12:40:51 -04:00
|
|
|
Gtk::Window* win = Tabbable::use_own_window (and_fill_it);
|
2015-04-21 15:10:49 -04:00
|
|
|
|
|
|
|
|
2015-07-09 12:40:51 -04:00
|
|
|
if (win && new_window) {
|
|
|
|
win->set_name ("MixerWindow");
|
|
|
|
ARDOUR_UI::instance()->setup_toplevel_window (*win, _("Mixer"), this);
|
|
|
|
win->signal_scroll_event().connect (sigc::mem_fun (*this, &Mixer_UI::on_scroll_event), false);
|
2016-02-22 14:42:40 -05:00
|
|
|
win->signal_event().connect (sigc::bind (sigc::ptr_fun (&Keyboard::catch_user_event_for_pre_dialog_focus), win));
|
2015-07-09 12:40:51 -04:00
|
|
|
win->set_data ("ardour-bindings", bindings);
|
|
|
|
update_title ();
|
|
|
|
}
|
2015-04-21 15:10:49 -04:00
|
|
|
|
2015-07-09 12:40:51 -04:00
|
|
|
return win;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2016-01-11 21:36:44 -05:00
|
|
|
void
|
2005-09-25 14:42:24 -04:00
|
|
|
Mixer_UI::show_window ()
|
|
|
|
{
|
2016-01-11 21:36:44 -05:00
|
|
|
Tabbable::show_window ();
|
2011-02-21 19:11:32 -05:00
|
|
|
|
2016-01-11 21:36:44 -05:00
|
|
|
/* show/hide group tabs as required */
|
|
|
|
parameter_changed ("show-group-tabs");
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2016-01-11 21:36:44 -05:00
|
|
|
/* now reset each strips width so the right widgets are shown */
|
|
|
|
MixerStrip* ms;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2016-01-11 21:36:44 -05:00
|
|
|
TreeModel::Children rows = track_model->children();
|
|
|
|
TreeModel::Children::iterator ri;
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2016-01-11 21:36:44 -05:00
|
|
|
for (ri = rows.begin(); ri != rows.end(); ++ri) {
|
|
|
|
ms = (*ri)[track_columns.strip];
|
2016-02-27 22:16:37 -05:00
|
|
|
if (!ms) {
|
|
|
|
continue;
|
|
|
|
}
|
2016-01-11 21:36:44 -05:00
|
|
|
ms->set_width_enum (ms->get_width_enum (), ms->width_owner());
|
|
|
|
/* Fix visibility of mixer strip stuff */
|
|
|
|
ms->parameter_changed (X_("mixer-element-visibility"));
|
2015-04-21 15:10:49 -04:00
|
|
|
}
|
|
|
|
|
2011-11-04 13:53:21 -04:00
|
|
|
/* force focus into main area */
|
|
|
|
scroller_base.grab_focus ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2016-02-27 22:16:37 -05:00
|
|
|
void
|
|
|
|
Mixer_UI::add_masters (VCAList& vcas)
|
|
|
|
{
|
|
|
|
for (VCAList::iterator v = vcas.begin(); v != vcas.end(); ++v) {
|
|
|
|
|
|
|
|
VCAMasterStrip* vms = new VCAMasterStrip (_session, *v);
|
|
|
|
|
|
|
|
TreeModel::Row row = *(track_model->append());
|
|
|
|
row[track_columns.text] = (*v)->name();
|
|
|
|
row[track_columns.visible] = true;
|
|
|
|
row[track_columns.vca] = vms;
|
2016-04-23 18:25:49 -04:00
|
|
|
|
|
|
|
vms->CatchDeletion.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::remove_master, this, _1), gui_context());
|
2016-02-27 22:16:37 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
redisplay_track_list ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::remove_master (VCAMasterStrip* vms)
|
|
|
|
{
|
2016-04-23 18:25:49 -04:00
|
|
|
if (_session && _session->deletion_in_progress()) {
|
|
|
|
/* its all being taken care of */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
TreeModel::Children rows = track_model->children();
|
|
|
|
TreeModel::Children::iterator ri;
|
|
|
|
|
|
|
|
for (ri = rows.begin(); ri != rows.end(); ++ri) {
|
|
|
|
if ((*ri)[track_columns.vca] == vms) {
|
|
|
|
PBD::Unwinder<bool> uw (_route_deletion_in_progress, true);
|
|
|
|
track_model->erase (ri);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2016-02-27 22:16:37 -05:00
|
|
|
}
|
|
|
|
|
2016-05-18 22:27:25 -04:00
|
|
|
bool
|
|
|
|
Mixer_UI::masters_scroller_button_release (GdkEventButton* ev)
|
|
|
|
{
|
|
|
|
using namespace Menu_Helpers;
|
|
|
|
|
|
|
|
if (Keyboard::is_context_menu_event (ev)) {
|
|
|
|
ARDOUR_UI::instance()->add_route ();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void
|
2012-06-27 18:57:06 -04:00
|
|
|
Mixer_UI::add_strips (RouteList& routes)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2013-10-23 10:27:13 -04:00
|
|
|
Gtk::TreeModel::Children::iterator insert_iter = track_model->children().end();
|
2016-03-04 15:40:44 -05:00
|
|
|
uint32_t nroutes = 0;
|
2013-10-23 10:27:13 -04:00
|
|
|
|
|
|
|
for (Gtk::TreeModel::Children::iterator it = track_model->children().begin(); it != track_model->children().end(); ++it) {
|
|
|
|
boost::shared_ptr<Route> r = (*it)[track_columns.route];
|
|
|
|
|
2016-02-27 22:16:37 -05:00
|
|
|
if (!r) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2016-03-04 15:40:44 -05:00
|
|
|
nroutes++;
|
|
|
|
|
2016-05-16 07:30:28 -04:00
|
|
|
if (r->presentation_info().group_order() == (routes.front()->presentation_info().group_order() + routes.size())) {
|
2013-10-23 10:27:13 -04:00
|
|
|
insert_iter = it;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-04 15:40:44 -05:00
|
|
|
if (nroutes) {
|
2013-10-23 10:27:13 -04:00
|
|
|
_selection.clear_routes ();
|
|
|
|
}
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
MixerStrip* strip;
|
2005-11-29 17:48:54 -05:00
|
|
|
|
2012-12-04 09:32:28 -05:00
|
|
|
try {
|
|
|
|
no_track_list_redisplay = true;
|
|
|
|
track_display.set_model (Glib::RefPtr<ListStore>());
|
|
|
|
|
2012-06-27 18:57:06 -04:00
|
|
|
for (RouteList::iterator x = routes.begin(); x != routes.end(); ++x) {
|
|
|
|
boost::shared_ptr<Route> route = (*x);
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2013-04-06 16:04:02 -04:00
|
|
|
if (route->is_auditioner()) {
|
2012-06-27 18:57:06 -04:00
|
|
|
continue;
|
|
|
|
}
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2012-06-27 18:57:06 -04:00
|
|
|
if (route->is_monitor()) {
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2012-06-27 18:57:06 -04:00
|
|
|
if (!_monitor_section) {
|
|
|
|
_monitor_section = new MonitorSection (_session);
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2012-06-27 18:57:06 -04:00
|
|
|
XMLNode* mnode = ARDOUR_UI::instance()->tearoff_settings (X_("monitor-section"));
|
|
|
|
if (mnode) {
|
|
|
|
_monitor_section->tearoff().set_state (*mnode);
|
|
|
|
}
|
2015-10-04 14:51:05 -04:00
|
|
|
}
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2012-06-27 18:57:06 -04:00
|
|
|
out_packer.pack_end (_monitor_section->tearoff(), false, false);
|
|
|
|
_monitor_section->set_session (_session);
|
|
|
|
_monitor_section->tearoff().show_all ();
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2015-12-19 11:42:36 -05:00
|
|
|
_monitor_section->tearoff().Detach.connect (sigc::mem_fun(*this, &Mixer_UI::monitor_section_detached));
|
|
|
|
_monitor_section->tearoff().Attach.connect (sigc::mem_fun(*this, &Mixer_UI::monitor_section_attached));
|
|
|
|
|
|
|
|
monitor_section_attached ();
|
|
|
|
|
2012-06-27 18:57:06 -04:00
|
|
|
route->DropReferences.connect (*this, invalidator(*this), boost::bind (&Mixer_UI::monitor_section_going_away, this), gui_context());
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2012-06-27 18:57:06 -04:00
|
|
|
/* no regular strip shown for control out */
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2012-06-27 18:57:06 -04:00
|
|
|
continue;
|
|
|
|
}
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2012-06-27 18:57:06 -04:00
|
|
|
strip = new MixerStrip (*this, _session, route);
|
|
|
|
strips.push_back (strip);
|
2012-12-04 09:32:28 -05:00
|
|
|
|
2015-01-02 09:44:54 -05:00
|
|
|
UIConfiguration::instance().get_default_narrow_ms() ? _strip_width = Narrow : _strip_width = Wide;
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2012-06-27 18:57:06 -04:00
|
|
|
if (strip->width_owner() != strip) {
|
|
|
|
strip->set_width_enum (_strip_width, this);
|
|
|
|
}
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2012-06-27 18:57:06 -04:00
|
|
|
show_strip (strip);
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2013-10-23 10:27:13 -04:00
|
|
|
TreeModel::Row row = *(track_model->insert(insert_iter));
|
2012-06-27 18:57:06 -04:00
|
|
|
row[track_columns.text] = route->name();
|
|
|
|
row[track_columns.visible] = strip->route()->is_master() ? true : strip->marked_for_display();
|
|
|
|
row[track_columns.route] = route;
|
|
|
|
row[track_columns.strip] = strip;
|
2016-02-27 22:16:37 -05:00
|
|
|
row[track_columns.vca] = 0;
|
2013-10-23 10:27:13 -04:00
|
|
|
|
2016-03-04 15:40:44 -05:00
|
|
|
if (nroutes != 0) {
|
2013-10-23 10:27:13 -04:00
|
|
|
_selection.add (strip);
|
|
|
|
}
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2012-06-27 18:57:06 -04:00
|
|
|
route->PropertyChanged.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::strip_property_changed, this, _1, strip), gui_context());
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2012-06-27 18:57:06 -04:00
|
|
|
strip->WidthChanged.connect (sigc::mem_fun(*this, &Mixer_UI::strip_width_changed));
|
|
|
|
strip->signal_button_release_event().connect (sigc::bind (sigc::mem_fun(*this, &Mixer_UI::strip_button_release_event), strip));
|
2007-04-29 18:39:21 -04:00
|
|
|
}
|
2012-12-04 09:32:28 -05:00
|
|
|
|
2016-02-25 11:53:59 -05:00
|
|
|
} catch (const std::exception& e) {
|
|
|
|
error << string_compose (_("Error adding GUI elements for new tracks/busses %1"), e.what()) << endmsg;
|
2006-08-16 22:12:20 -04:00
|
|
|
}
|
2008-12-08 13:16:12 -05:00
|
|
|
|
2012-12-04 09:32:28 -05:00
|
|
|
no_track_list_redisplay = false;
|
|
|
|
track_display.set_model (track_model);
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2016-05-16 07:30:28 -04:00
|
|
|
sync_presentation_info_from_treeview ();
|
2008-12-08 13:16:12 -05:00
|
|
|
redisplay_track_list ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2014-07-24 23:49:33 -04:00
|
|
|
void
|
|
|
|
Mixer_UI::deselect_all_strip_processors ()
|
|
|
|
{
|
|
|
|
for (list<MixerStrip *>::iterator i = strips.begin(); i != strips.end(); ++i) {
|
|
|
|
(*i)->deselect_all_processors();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-02 12:13:45 -05:00
|
|
|
void
|
|
|
|
Mixer_UI::select_strip (MixerStrip& ms, bool add)
|
|
|
|
{
|
|
|
|
if (add) {
|
|
|
|
_selection.add (&ms);
|
|
|
|
} else {
|
|
|
|
_selection.set (&ms);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-07-28 12:35:41 -04:00
|
|
|
void
|
|
|
|
Mixer_UI::select_none ()
|
|
|
|
{
|
2014-07-28 16:55:20 -04:00
|
|
|
_selection.clear_routes();
|
2014-07-28 12:35:41 -04:00
|
|
|
deselect_all_strip_processors();
|
|
|
|
}
|
|
|
|
|
2014-07-24 23:49:33 -04:00
|
|
|
void
|
|
|
|
Mixer_UI::delete_processors ()
|
|
|
|
{
|
|
|
|
for (list<MixerStrip *>::iterator i = strips.begin(); i != strips.end(); ++i) {
|
|
|
|
(*i)->delete_processors();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void
|
|
|
|
Mixer_UI::remove_strip (MixerStrip* strip)
|
|
|
|
{
|
2009-12-25 16:06:52 -05:00
|
|
|
if (_session && _session->deletion_in_progress()) {
|
|
|
|
/* its all being taken care of */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-03-09 18:44:39 -05:00
|
|
|
TreeModel::Children rows = track_model->children();
|
2005-09-28 12:22:43 -04:00
|
|
|
TreeModel::Children::iterator ri;
|
2005-09-25 14:42:24 -04:00
|
|
|
list<MixerStrip *>::iterator i;
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
if ((i = find (strips.begin(), strips.end(), strip)) != strips.end()) {
|
|
|
|
strips.erase (i);
|
|
|
|
}
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2005-09-28 12:22:43 -04:00
|
|
|
for (ri = rows.begin(); ri != rows.end(); ++ri) {
|
2006-03-09 18:44:39 -05:00
|
|
|
if ((*ri)[track_columns.strip] == strip) {
|
2014-06-20 21:51:59 -04:00
|
|
|
PBD::Unwinder<bool> uw (_route_deletion_in_progress, true);
|
2006-03-09 18:44:39 -05:00
|
|
|
track_model->erase (ri);
|
2005-09-25 14:42:24 -04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
void
|
2016-05-16 07:30:28 -04:00
|
|
|
Mixer_UI::sync_presentation_info_from_treeview ()
|
2012-07-19 18:35:43 -04:00
|
|
|
{
|
2016-05-16 07:30:28 -04:00
|
|
|
if (ignore_reorder || !_session || _session->deletion_in_progress() || (Config->get_remote_model() != MixerOrdered)) {
|
2012-06-27 18:57:06 -04:00
|
|
|
return;
|
|
|
|
}
|
2007-10-11 18:07:47 -04:00
|
|
|
|
2012-06-27 18:57:06 -04:00
|
|
|
TreeModel::Children rows = track_model->children();
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2012-06-27 18:57:06 -04:00
|
|
|
if (rows.empty()) {
|
2007-10-11 18:07:47 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-05-17 09:36:28 -04:00
|
|
|
DEBUG_TRACE (DEBUG::OrderKeys, "mixer sync presentation info from treeview\n");
|
2007-10-11 18:07:47 -04:00
|
|
|
|
2012-06-27 18:57:06 -04:00
|
|
|
TreeModel::Children::iterator ri;
|
2016-05-16 07:30:28 -04:00
|
|
|
bool change = false;
|
2012-06-27 18:57:06 -04:00
|
|
|
uint32_t order = 0;
|
2008-12-08 13:16:12 -05:00
|
|
|
|
2012-07-19 18:35:43 -04:00
|
|
|
for (ri = rows.begin(); ri != rows.end(); ++ri) {
|
2007-10-11 18:07:47 -04:00
|
|
|
boost::shared_ptr<Route> route = (*ri)[track_columns.route];
|
2012-07-19 18:35:43 -04:00
|
|
|
bool visible = (*ri)[track_columns.visible];
|
|
|
|
|
2016-05-16 07:30:28 -04:00
|
|
|
|
2016-02-27 22:16:37 -05:00
|
|
|
if (!route) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2016-05-16 07:30:28 -04:00
|
|
|
if (route->presentation_info().special()) {
|
|
|
|
continue;
|
2008-12-08 13:16:12 -05:00
|
|
|
}
|
2012-07-19 18:35:43 -04:00
|
|
|
|
2016-05-16 07:30:28 -04:00
|
|
|
if (!visible) {
|
|
|
|
route->presentation_info().set_flag (PresentationInfo::Hidden);
|
|
|
|
} else {
|
|
|
|
route->presentation_info().unset_flag (PresentationInfo::Hidden);
|
|
|
|
}
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2016-05-16 07:30:28 -04:00
|
|
|
if (order != route->presentation_info().group_order()) {
|
|
|
|
route->set_presentation_group_order_explicit (order);
|
|
|
|
change = true;
|
2012-07-19 18:35:43 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
++order;
|
2012-06-27 18:57:06 -04:00
|
|
|
}
|
2012-07-19 18:35:43 -04:00
|
|
|
|
2016-05-16 07:30:28 -04:00
|
|
|
if (change) {
|
|
|
|
DEBUG_TRACE (DEBUG::OrderKeys, "... notify PI change from mixer GUI\n");
|
|
|
|
_session->notify_presentation_info_change ();
|
2012-07-19 18:35:43 -04:00
|
|
|
}
|
2012-06-27 18:57:06 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2016-05-16 07:30:28 -04:00
|
|
|
Mixer_UI::sync_treeview_from_presentation_info ()
|
2012-06-27 18:57:06 -04:00
|
|
|
{
|
|
|
|
if (!_session || _session->deletion_in_progress()) {
|
|
|
|
return;
|
2007-10-11 18:07:47 -04:00
|
|
|
}
|
2009-11-16 16:07:16 -05:00
|
|
|
|
2016-05-17 09:36:28 -04:00
|
|
|
DEBUG_TRACE (DEBUG::OrderKeys, "mixer sync model from presentation info.\n");
|
2009-10-22 20:05:50 -04:00
|
|
|
|
2012-06-27 18:57:06 -04:00
|
|
|
/* we could get here after either a change in the Mixer or Editor sort
|
|
|
|
* order, but either way, the mixer order keys reflect the intended
|
|
|
|
* order for the GUI, so reorder the treeview model to match it.
|
|
|
|
*/
|
|
|
|
|
2009-10-22 20:05:50 -04:00
|
|
|
vector<int> neworder;
|
2012-06-27 18:57:06 -04:00
|
|
|
TreeModel::Children rows = track_model->children();
|
2012-07-19 18:35:43 -04:00
|
|
|
uint32_t old_order = 0;
|
2012-06-28 18:27:37 -04:00
|
|
|
bool changed = false;
|
2012-06-27 18:57:06 -04:00
|
|
|
|
|
|
|
if (rows.empty()) {
|
|
|
|
return;
|
2009-10-22 20:05:50 -04:00
|
|
|
}
|
2007-10-11 18:07:47 -04:00
|
|
|
|
2016-03-02 12:13:45 -05:00
|
|
|
OrderingKeys sorted;
|
|
|
|
uint32_t vca_cnt = 0;
|
|
|
|
uint32_t max_route_order_key = 0;
|
|
|
|
|
|
|
|
/* count number of Routes in track_model (there may be some odd reason
|
|
|
|
why this is not the same as the number in the session, but here we
|
|
|
|
care about the track model.
|
|
|
|
*/
|
|
|
|
|
|
|
|
for (TreeModel::Children::iterator ri = rows.begin(); ri != rows.end(); ++ri) {
|
|
|
|
boost::shared_ptr<Route> route = (*ri)[track_columns.route];
|
|
|
|
if (route) {
|
2016-05-16 07:30:28 -04:00
|
|
|
max_route_order_key = max (route->presentation_info().group_order(), max_route_order_key);
|
2016-03-02 12:13:45 -05:00
|
|
|
}
|
|
|
|
}
|
2012-10-26 20:15:45 -04:00
|
|
|
|
2012-07-19 18:35:43 -04:00
|
|
|
for (TreeModel::Children::iterator ri = rows.begin(); ri != rows.end(); ++ri, ++old_order) {
|
2012-06-27 18:57:06 -04:00
|
|
|
boost::shared_ptr<Route> route = (*ri)[track_columns.route];
|
2016-02-27 22:16:37 -05:00
|
|
|
if (!route) {
|
2016-03-02 12:13:45 -05:00
|
|
|
/* VCAs need to sort after all routes. We don't display
|
|
|
|
* them in the same place (March 2016), but we don't
|
|
|
|
* want them intermixed in the track_model
|
|
|
|
*/
|
|
|
|
sorted.push_back (OrderKeys (old_order, max_route_order_key + ++vca_cnt));
|
|
|
|
} else {
|
2016-05-16 07:30:28 -04:00
|
|
|
sorted.push_back (OrderKeys (old_order, route->presentation_info().group_order()));
|
2016-02-27 22:16:37 -05:00
|
|
|
}
|
2012-10-26 20:15:45 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
SortByNewDisplayOrder cmp;
|
|
|
|
|
2016-03-02 12:13:45 -05:00
|
|
|
sort (sorted.begin(), sorted.end(), cmp);
|
|
|
|
neworder.assign (sorted.size(), 0);
|
2012-10-26 20:15:45 -04:00
|
|
|
|
|
|
|
uint32_t n = 0;
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2016-03-02 12:13:45 -05:00
|
|
|
for (OrderingKeys::iterator sr = sorted.begin(); sr != sorted.end(); ++sr, ++n) {
|
2012-06-28 18:27:37 -04:00
|
|
|
|
2012-10-26 20:15:45 -04:00
|
|
|
neworder[n] = sr->old_display_order;
|
2012-06-28 18:27:37 -04:00
|
|
|
|
2012-10-26 20:15:45 -04:00
|
|
|
if (sr->old_display_order != n) {
|
2012-06-28 18:27:37 -04:00
|
|
|
changed = true;
|
|
|
|
}
|
2012-06-27 18:57:06 -04:00
|
|
|
}
|
|
|
|
|
2012-06-28 18:27:37 -04:00
|
|
|
if (changed) {
|
2012-06-27 18:57:06 -04:00
|
|
|
Unwinder<bool> uw (ignore_reorder, true);
|
2008-12-08 13:16:12 -05:00
|
|
|
track_model->reorder (neworder);
|
|
|
|
}
|
2012-06-27 18:57:06 -04:00
|
|
|
|
|
|
|
redisplay_track_list ();
|
2007-10-11 18:07:47 -04:00
|
|
|
}
|
|
|
|
|
2011-11-15 14:33:09 -05:00
|
|
|
void
|
|
|
|
Mixer_UI::follow_editor_selection ()
|
|
|
|
{
|
2015-04-13 21:55:17 -04:00
|
|
|
if (_following_editor_selection) {
|
2011-11-15 14:33:09 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
_following_editor_selection = true;
|
|
|
|
_selection.block_routes_changed (true);
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2011-11-15 14:33:09 -05:00
|
|
|
TrackSelection& s (PublicEditor::instance().get_selection().tracks);
|
|
|
|
|
|
|
|
_selection.clear_routes ();
|
|
|
|
|
|
|
|
for (TrackViewList::iterator i = s.begin(); i != s.end(); ++i) {
|
|
|
|
RouteTimeAxisView* rtav = dynamic_cast<RouteTimeAxisView*> (*i);
|
|
|
|
if (rtav) {
|
|
|
|
MixerStrip* ms = strip_by_route (rtav->route());
|
|
|
|
if (ms) {
|
|
|
|
_selection.add (ms);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
_following_editor_selection = false;
|
|
|
|
_selection.block_routes_changed (false);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-11-04 13:53:21 -04:00
|
|
|
MixerStrip*
|
|
|
|
Mixer_UI::strip_by_route (boost::shared_ptr<Route> r)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
for (list<MixerStrip *>::iterator i = strips.begin(); i != strips.end(); ++i) {
|
2011-11-04 13:53:21 -04:00
|
|
|
if ((*i)->route() == r) {
|
|
|
|
return (*i);
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2011-11-04 13:53:21 -04:00
|
|
|
|
|
|
|
return 0;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2006-01-04 22:18:44 -05:00
|
|
|
bool
|
2005-09-25 14:42:24 -04:00
|
|
|
Mixer_UI::strip_button_release_event (GdkEventButton *ev, MixerStrip *strip)
|
|
|
|
{
|
|
|
|
if (ev->button == 1) {
|
2011-11-04 13:53:21 -04:00
|
|
|
if (_selection.selected (strip)) {
|
|
|
|
/* primary-click: toggle selection state of strip */
|
|
|
|
if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
|
|
|
|
_selection.remove (strip);
|
2015-05-03 15:34:17 -04:00
|
|
|
} else if (_selection.routes.size() > 1) {
|
|
|
|
/* de-select others */
|
|
|
|
_selection.set (strip);
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
} else {
|
2011-11-04 13:53:21 -04:00
|
|
|
if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
|
|
|
|
_selection.add (strip);
|
|
|
|
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::RangeSelectModifier)) {
|
|
|
|
|
|
|
|
if (!_selection.selected(strip)) {
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2011-11-04 13:53:21 -04:00
|
|
|
/* extend selection */
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2011-11-04 13:53:21 -04:00
|
|
|
vector<MixerStrip*> tmp;
|
|
|
|
bool accumulate = false;
|
2014-11-19 18:27:13 -05:00
|
|
|
bool found_another = false;
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2011-11-04 13:53:21 -04:00
|
|
|
tmp.push_back (strip);
|
|
|
|
|
|
|
|
for (list<MixerStrip*>::iterator i = strips.begin(); i != strips.end(); ++i) {
|
|
|
|
if ((*i) == strip) {
|
2015-10-04 14:51:05 -04:00
|
|
|
/* hit clicked strip, start accumulating till we hit the first
|
2011-11-04 13:53:21 -04:00
|
|
|
selected strip
|
|
|
|
*/
|
|
|
|
if (accumulate) {
|
|
|
|
/* done */
|
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
accumulate = true;
|
|
|
|
}
|
|
|
|
} else if (_selection.selected (*i)) {
|
|
|
|
/* hit selected strip. if currently accumulating others,
|
|
|
|
we're done. if not accumulating others, start doing so.
|
|
|
|
*/
|
2014-11-19 18:27:13 -05:00
|
|
|
found_another = true;
|
2011-11-04 13:53:21 -04:00
|
|
|
if (accumulate) {
|
|
|
|
/* done */
|
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
accumulate = true;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (accumulate) {
|
|
|
|
tmp.push_back (*i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-19 18:27:13 -05:00
|
|
|
if (found_another) {
|
|
|
|
for (vector<MixerStrip*>::iterator i = tmp.begin(); i != tmp.end(); ++i) {
|
|
|
|
_selection.add (*i);
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
_selection.set (strip); //user wants to start a range selection, but there aren't any others selected yet
|
2011-11-04 13:53:21 -04:00
|
|
|
}
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
} else {
|
2011-11-04 13:53:21 -04:00
|
|
|
_selection.set (strip);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-04 22:18:44 -05:00
|
|
|
return true;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-12-17 13:24:23 -05:00
|
|
|
Mixer_UI::set_session (Session* sess)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2009-12-17 13:24:23 -05:00
|
|
|
SessionHandlePtr::set_session (sess);
|
|
|
|
|
|
|
|
if (_plugin_selector) {
|
|
|
|
_plugin_selector->set_session (_session);
|
|
|
|
}
|
|
|
|
|
|
|
|
_group_tabs->set_session (sess);
|
|
|
|
|
|
|
|
if (!_session) {
|
|
|
|
return;
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2016-01-08 16:07:21 -05:00
|
|
|
refill_favorite_plugins();
|
|
|
|
|
2006-08-30 16:48:16 -04:00
|
|
|
XMLNode* node = ARDOUR_UI::instance()->mixer_settings();
|
2015-07-07 22:12:21 -04:00
|
|
|
set_state (*node, 0);
|
2006-08-30 16:48:16 -04:00
|
|
|
|
2011-09-07 11:07:02 -04:00
|
|
|
update_title ();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-01-11 22:43:52 -05:00
|
|
|
initial_track_display ();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2012-06-27 18:57:06 -04:00
|
|
|
_session->RouteAdded.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::add_strips, this, _1), gui_context());
|
2012-04-25 08:58:19 -04:00
|
|
|
_session->route_group_added.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::add_route_group, this, _1), gui_context());
|
2010-03-30 11:18:43 -04:00
|
|
|
_session->route_group_removed.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::route_groups_changed, this), gui_context());
|
2011-04-19 11:46:47 -04:00
|
|
|
_session->route_groups_reordered.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::route_groups_changed, this), gui_context());
|
2012-04-25 08:58:19 -04:00
|
|
|
_session->config.ParameterChanged.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::parameter_changed, this, _1), gui_context());
|
2011-09-07 11:07:02 -04:00
|
|
|
_session->DirtyChanged.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::update_title, this), gui_context());
|
2012-04-25 08:58:19 -04:00
|
|
|
_session->StateSaved.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::update_title, this), gui_context());
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2016-02-27 22:16:37 -05:00
|
|
|
_session->vca_manager().VCAAdded.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::add_masters, this, _1), gui_context());
|
|
|
|
|
2012-04-25 08:58:19 -04:00
|
|
|
Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::parameter_changed, this, _1), gui_context ());
|
2010-05-02 10:28:09 -04:00
|
|
|
|
2009-06-21 15:59:56 -04:00
|
|
|
route_groups_changed ();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-08-30 16:48:16 -04:00
|
|
|
if (_visible) {
|
2010-02-03 14:00:58 -05:00
|
|
|
show_window();
|
2006-08-30 16:48:16 -04:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
start_updating ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-12-17 13:24:23 -05:00
|
|
|
Mixer_UI::session_going_away ()
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2011-04-19 21:24:40 -04:00
|
|
|
ENSURE_GUI_THREAD (*this, &Mixer_UI::session_going_away);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2011-04-19 21:24:40 -04:00
|
|
|
_in_group_rebuild_or_clear = true;
|
2006-03-09 18:44:39 -05:00
|
|
|
group_model->clear ();
|
2011-04-19 21:24:40 -04:00
|
|
|
_in_group_rebuild_or_clear = false;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2007-04-11 09:07:51 -04:00
|
|
|
_selection.clear ();
|
2009-12-22 15:21:43 -05:00
|
|
|
track_model->clear ();
|
|
|
|
|
|
|
|
for (list<MixerStrip *>::iterator i = strips.begin(); i != strips.end(); ++i) {
|
|
|
|
delete (*i);
|
|
|
|
}
|
2010-03-10 12:31:16 -05:00
|
|
|
|
2015-12-19 11:42:36 -05:00
|
|
|
if (_monitor_section) {
|
|
|
|
_monitor_section->tearoff().hide_visible ();
|
|
|
|
}
|
|
|
|
|
|
|
|
monitor_section_detached ();
|
2010-03-18 22:49:01 -04:00
|
|
|
|
2009-12-23 23:04:01 -05:00
|
|
|
strips.clear ();
|
2007-04-11 09:07:51 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
stop_updating ();
|
2009-12-17 13:24:23 -05:00
|
|
|
|
|
|
|
SessionHandlePtr::session_going_away ();
|
2011-09-07 11:07:02 -04:00
|
|
|
|
|
|
|
_session = 0;
|
|
|
|
update_title ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2012-07-19 18:35:43 -04:00
|
|
|
void
|
|
|
|
Mixer_UI::track_visibility_changed (std::string const & path)
|
|
|
|
{
|
|
|
|
if (_session && _session->deletion_in_progress()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
TreeIter iter;
|
|
|
|
|
|
|
|
if ((iter = track_model->get_iter (path))) {
|
|
|
|
MixerStrip* strip = (*iter)[track_columns.strip];
|
|
|
|
if (strip) {
|
|
|
|
bool visible = (*iter)[track_columns.visible];
|
|
|
|
|
|
|
|
if (strip->set_marked_for_display (!visible)) {
|
|
|
|
update_track_visibility ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::update_track_visibility ()
|
|
|
|
{
|
|
|
|
TreeModel::Children rows = track_model->children();
|
|
|
|
TreeModel::Children::iterator i;
|
|
|
|
|
|
|
|
{
|
|
|
|
Unwinder<bool> uw (no_track_list_redisplay, true);
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2012-07-19 18:35:43 -04:00
|
|
|
for (i = rows.begin(); i != rows.end(); ++i) {
|
|
|
|
MixerStrip *strip = (*i)[track_columns.strip];
|
2016-02-27 22:16:37 -05:00
|
|
|
if (strip) {
|
|
|
|
(*i)[track_columns.visible] = strip->marked_for_display ();
|
|
|
|
}
|
2012-07-19 18:35:43 -04:00
|
|
|
}
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2016-05-16 07:30:28 -04:00
|
|
|
/* force presentation catch up with visibility changes
|
2012-07-19 18:35:43 -04:00
|
|
|
*/
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2016-05-16 07:30:28 -04:00
|
|
|
sync_presentation_info_from_treeview ();
|
2012-07-19 18:35:43 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
redisplay_track_list ();
|
|
|
|
}
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void
|
2006-01-11 22:43:52 -05:00
|
|
|
Mixer_UI::show_strip (MixerStrip* ms)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2006-11-12 22:49:00 -05:00
|
|
|
TreeModel::Children rows = track_model->children();
|
2005-09-28 12:22:43 -04:00
|
|
|
TreeModel::Children::iterator i;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-28 12:22:43 -04:00
|
|
|
for (i = rows.begin(); i != rows.end(); ++i) {
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-03-09 18:44:39 -05:00
|
|
|
MixerStrip* strip = (*i)[track_columns.strip];
|
2006-01-11 22:43:52 -05:00
|
|
|
if (strip == ms) {
|
2006-03-09 18:44:39 -05:00
|
|
|
(*i)[track_columns.visible] = true;
|
2012-07-09 15:26:22 -04:00
|
|
|
redisplay_track_list ();
|
2006-01-11 22:43:52 -05:00
|
|
|
break;
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2006-01-11 22:43:52 -05:00
|
|
|
Mixer_UI::hide_strip (MixerStrip* ms)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2006-11-12 22:49:00 -05:00
|
|
|
TreeModel::Children rows = track_model->children();
|
2005-09-28 12:22:43 -04:00
|
|
|
TreeModel::Children::iterator i;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-28 12:22:43 -04:00
|
|
|
for (i = rows.begin(); i != rows.end(); ++i) {
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-03-09 18:44:39 -05:00
|
|
|
MixerStrip* strip = (*i)[track_columns.strip];
|
2006-01-11 22:43:52 -05:00
|
|
|
if (strip == ms) {
|
2006-03-09 18:44:39 -05:00
|
|
|
(*i)[track_columns.visible] = false;
|
2012-07-09 15:26:22 -04:00
|
|
|
redisplay_track_list ();
|
2006-01-11 22:43:52 -05:00
|
|
|
break;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2006-11-12 22:49:00 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gint
|
|
|
|
Mixer_UI::start_updating ()
|
|
|
|
{
|
2014-12-25 10:02:00 -05:00
|
|
|
fast_screen_update_connection = Timers::super_rapid_connect (sigc::mem_fun(*this, &Mixer_UI::fast_update_strips));
|
2006-11-12 22:49:00 -05:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
gint
|
|
|
|
Mixer_UI::stop_updating ()
|
|
|
|
{
|
|
|
|
fast_screen_update_connection.disconnect();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::fast_update_strips ()
|
|
|
|
{
|
2015-07-07 22:12:21 -04:00
|
|
|
if (_content.is_mapped () && _session) {
|
2006-11-12 22:49:00 -05:00
|
|
|
for (list<MixerStrip *>::iterator i = strips.begin(); i != strips.end(); ++i) {
|
|
|
|
(*i)->fast_update ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2005-11-29 17:48:54 -05:00
|
|
|
|
2006-01-11 22:43:52 -05:00
|
|
|
void
|
|
|
|
Mixer_UI::set_all_strips_visibility (bool yn)
|
|
|
|
{
|
2006-11-12 22:49:00 -05:00
|
|
|
TreeModel::Children rows = track_model->children();
|
2006-01-11 22:43:52 -05:00
|
|
|
TreeModel::Children::iterator i;
|
2005-11-29 17:48:54 -05:00
|
|
|
|
2012-06-27 18:57:06 -04:00
|
|
|
{
|
|
|
|
Unwinder<bool> uw (no_track_list_redisplay, true);
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2012-06-27 18:57:06 -04:00
|
|
|
for (i = rows.begin(); i != rows.end(); ++i) {
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2012-06-27 18:57:06 -04:00
|
|
|
TreeModel::Row row = (*i);
|
|
|
|
MixerStrip* strip = row[track_columns.strip];
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2016-02-27 22:16:37 -05:00
|
|
|
if (!strip) {
|
2012-06-27 18:57:06 -04:00
|
|
|
continue;
|
|
|
|
}
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2012-06-27 18:57:06 -04:00
|
|
|
if (strip->route()->is_master() || strip->route()->is_monitor()) {
|
|
|
|
continue;
|
|
|
|
}
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2012-06-27 18:57:06 -04:00
|
|
|
(*i)[track_columns.visible] = yn;
|
2006-01-11 22:43:52 -05:00
|
|
|
}
|
|
|
|
}
|
2005-11-29 17:48:54 -05:00
|
|
|
|
2006-01-11 22:43:52 -05:00
|
|
|
redisplay_track_list ();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2015-07-10 05:11:44 -04:00
|
|
|
Mixer_UI::set_all_audio_midi_visibility (int tracks, bool yn)
|
2006-01-11 22:43:52 -05:00
|
|
|
{
|
2009-10-22 18:38:53 -04:00
|
|
|
TreeModel::Children rows = track_model->children();
|
2006-01-11 22:43:52 -05:00
|
|
|
TreeModel::Children::iterator i;
|
|
|
|
|
2012-06-27 18:57:06 -04:00
|
|
|
{
|
|
|
|
Unwinder<bool> uw (no_track_list_redisplay, true);
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2012-06-27 18:57:06 -04:00
|
|
|
for (i = rows.begin(); i != rows.end(); ++i) {
|
|
|
|
TreeModel::Row row = (*i);
|
|
|
|
MixerStrip* strip = row[track_columns.strip];
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2016-02-27 22:16:37 -05:00
|
|
|
if (!strip) {
|
2012-06-27 18:57:06 -04:00
|
|
|
continue;
|
2006-01-11 22:43:52 -05:00
|
|
|
}
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2012-06-27 18:57:06 -04:00
|
|
|
if (strip->route()->is_master() || strip->route()->is_monitor()) {
|
|
|
|
continue;
|
|
|
|
}
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2012-06-27 18:57:06 -04:00
|
|
|
boost::shared_ptr<AudioTrack> at = strip->audio_track();
|
2015-07-10 05:11:44 -04:00
|
|
|
boost::shared_ptr<MidiTrack> mt = strip->midi_track();
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2012-06-27 18:57:06 -04:00
|
|
|
switch (tracks) {
|
|
|
|
case 0:
|
2006-03-09 18:44:39 -05:00
|
|
|
(*i)[track_columns.visible] = yn;
|
2012-06-27 18:57:06 -04:00
|
|
|
break;
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2012-06-27 18:57:06 -04:00
|
|
|
case 1:
|
|
|
|
if (at) { /* track */
|
|
|
|
(*i)[track_columns.visible] = yn;
|
|
|
|
}
|
|
|
|
break;
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2012-06-27 18:57:06 -04:00
|
|
|
case 2:
|
2015-07-10 05:11:44 -04:00
|
|
|
if (!at && !mt) { /* bus */
|
|
|
|
(*i)[track_columns.visible] = yn;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
if (mt) { /* midi-track */
|
2012-06-27 18:57:06 -04:00
|
|
|
(*i)[track_columns.visible] = yn;
|
|
|
|
}
|
|
|
|
break;
|
2006-01-11 22:43:52 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
redisplay_track_list ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::hide_all_routes ()
|
|
|
|
{
|
|
|
|
set_all_strips_visibility (false);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::show_all_routes ()
|
|
|
|
{
|
|
|
|
set_all_strips_visibility (true);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::show_all_audiobus ()
|
|
|
|
{
|
2015-07-10 05:11:44 -04:00
|
|
|
set_all_audio_midi_visibility (2, true);
|
2006-01-11 22:43:52 -05:00
|
|
|
}
|
|
|
|
void
|
|
|
|
Mixer_UI::hide_all_audiobus ()
|
|
|
|
{
|
2015-07-10 05:11:44 -04:00
|
|
|
set_all_audio_midi_visibility (2, false);
|
2006-01-11 22:43:52 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::show_all_audiotracks()
|
|
|
|
{
|
2015-07-10 05:11:44 -04:00
|
|
|
set_all_audio_midi_visibility (1, true);
|
2006-01-11 22:43:52 -05:00
|
|
|
}
|
|
|
|
void
|
|
|
|
Mixer_UI::hide_all_audiotracks ()
|
|
|
|
{
|
2015-07-10 05:11:44 -04:00
|
|
|
set_all_audio_midi_visibility (1, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::show_all_miditracks()
|
|
|
|
{
|
|
|
|
set_all_audio_midi_visibility (3, true);
|
|
|
|
}
|
|
|
|
void
|
|
|
|
Mixer_UI::hide_all_miditracks ()
|
|
|
|
{
|
|
|
|
set_all_audio_midi_visibility (3, false);
|
2006-01-11 22:43:52 -05:00
|
|
|
}
|
|
|
|
|
2015-07-10 05:11:44 -04:00
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
void
|
2009-07-21 11:55:17 -04:00
|
|
|
Mixer_UI::track_list_reorder (const TreeModel::Path&, const TreeModel::iterator&, int* /*new_order*/)
|
2007-10-11 18:07:47 -04:00
|
|
|
{
|
2012-06-27 18:57:06 -04:00
|
|
|
DEBUG_TRACE (DEBUG::OrderKeys, "mixer UI treeview reordered\n");
|
2016-05-16 07:30:28 -04:00
|
|
|
sync_presentation_info_from_treeview ();
|
2006-01-11 22:43:52 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-07-21 11:55:17 -04:00
|
|
|
Mixer_UI::track_list_delete (const Gtk::TreeModel::Path&)
|
2006-01-11 22:43:52 -05:00
|
|
|
{
|
2012-06-27 18:57:06 -04:00
|
|
|
/* this happens as the second step of a DnD within the treeview as well
|
|
|
|
as when a row/route is actually deleted.
|
2015-10-04 14:51:05 -04:00
|
|
|
|
2014-06-20 21:51:59 -04:00
|
|
|
if it was a deletion then we have to force a redisplay because
|
|
|
|
order keys may not have changed.
|
2012-06-27 18:57:06 -04:00
|
|
|
*/
|
2014-06-20 21:51:59 -04:00
|
|
|
|
2012-06-27 18:57:06 -04:00
|
|
|
DEBUG_TRACE (DEBUG::OrderKeys, "mixer UI treeview row deleted\n");
|
2016-05-16 07:30:28 -04:00
|
|
|
sync_presentation_info_from_treeview ();
|
2014-06-20 21:51:59 -04:00
|
|
|
|
|
|
|
if (_route_deletion_in_progress) {
|
|
|
|
redisplay_track_list ();
|
|
|
|
}
|
2006-01-11 22:43:52 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2016-05-18 17:36:06 -04:00
|
|
|
Mixer_UI::spill_redisplay (boost::shared_ptr<VCA> vca)
|
2006-01-11 22:43:52 -05:00
|
|
|
{
|
2006-03-09 18:44:39 -05:00
|
|
|
TreeModel::Children rows = track_model->children();
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2016-05-18 17:36:06 -04:00
|
|
|
for (TreeModel::Children::iterator i = rows.begin(); i != rows.end(); ++i) {
|
|
|
|
|
|
|
|
MixerStrip* strip = (*i)[track_columns.strip];
|
|
|
|
|
|
|
|
if (!strip) {
|
|
|
|
/* we're in the middle of changing a row, don't worry */
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!strip->route()) {
|
|
|
|
/* non-route element */
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (strip->route()->is_master() || strip->route()->is_monitor()) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (strip->route()->slaved_to (vca)) {
|
|
|
|
|
|
|
|
strip->set_gui_property ("visible", true);
|
|
|
|
|
|
|
|
if (strip->packed()) {
|
|
|
|
strip_packer.reorder_child (*strip, -1); /* put at end */
|
|
|
|
} else {
|
|
|
|
strip_packer.pack_start (*strip, false, false);
|
|
|
|
strip->set_packed (true);
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
strip->set_gui_property ("visible", false);
|
|
|
|
|
|
|
|
if (strip->packed()) {
|
|
|
|
strip_packer.remove (*strip);
|
|
|
|
strip->set_packed (false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::redisplay_track_list ()
|
|
|
|
{
|
2006-01-11 22:43:52 -05:00
|
|
|
if (no_track_list_redisplay) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-05-18 17:36:06 -04:00
|
|
|
boost::shared_ptr<VCA> sv = spilled_vca.lock ();
|
|
|
|
|
|
|
|
if (sv) {
|
|
|
|
spill_redisplay (sv);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
TreeModel::Children rows = track_model->children();
|
|
|
|
TreeModel::Children::iterator i;
|
|
|
|
uint32_t n_masters = 0;
|
|
|
|
|
2016-02-27 22:16:37 -05:00
|
|
|
container_clear (vca_packer);
|
2016-05-18 22:27:25 -04:00
|
|
|
vca_packer.pack_end (vca_scroller_base, true, true);
|
2016-02-27 22:16:37 -05:00
|
|
|
|
2012-06-25 08:46:13 -04:00
|
|
|
for (i = rows.begin(); i != rows.end(); ++i) {
|
|
|
|
|
2016-02-27 22:16:37 -05:00
|
|
|
VCAMasterStrip* vms = (*i)[track_columns.vca];
|
|
|
|
|
|
|
|
if (vms) {
|
|
|
|
vca_packer.pack_start (*vms, false, false);
|
|
|
|
vms->show ();
|
2016-04-29 10:33:05 -04:00
|
|
|
n_masters++;
|
2016-02-27 22:16:37 -05:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2006-03-09 18:44:39 -05:00
|
|
|
MixerStrip* strip = (*i)[track_columns.strip];
|
2006-01-11 22:43:52 -05:00
|
|
|
|
2016-02-27 22:16:37 -05:00
|
|
|
if (!strip) {
|
2006-01-17 11:40:57 -05:00
|
|
|
/* we're in the middle of changing a row, don't worry */
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2011-07-12 07:02:12 -04:00
|
|
|
bool const visible = (*i)[track_columns.visible];
|
2006-01-11 22:43:52 -05:00
|
|
|
|
|
|
|
if (visible) {
|
2011-07-11 16:32:33 -04:00
|
|
|
strip->set_gui_property ("visible", true);
|
2007-10-11 18:07:47 -04:00
|
|
|
|
2006-01-11 22:43:52 -05:00
|
|
|
if (strip->packed()) {
|
|
|
|
|
2010-03-23 08:19:21 -04:00
|
|
|
if (strip->route()->is_master() || strip->route()->is_monitor()) {
|
2006-01-11 22:43:52 -05:00
|
|
|
out_packer.reorder_child (*strip, -1);
|
2012-06-25 08:46:13 -04:00
|
|
|
|
2006-01-11 22:43:52 -05:00
|
|
|
} else {
|
|
|
|
strip_packer.reorder_child (*strip, -1); /* put at end */
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
2010-03-23 08:19:21 -04:00
|
|
|
if (strip->route()->is_master() || strip->route()->is_monitor()) {
|
2006-01-11 22:43:52 -05:00
|
|
|
out_packer.pack_start (*strip, false, false);
|
|
|
|
} else {
|
|
|
|
strip_packer.pack_start (*strip, false, false);
|
|
|
|
}
|
|
|
|
strip->set_packed (true);
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
2011-07-11 16:32:33 -04:00
|
|
|
strip->set_gui_property ("visible", false);
|
2009-06-21 12:58:57 -04:00
|
|
|
|
2010-03-23 08:19:21 -04:00
|
|
|
if (strip->route()->is_master() || strip->route()->is_monitor()) {
|
2006-01-11 22:43:52 -05:00
|
|
|
/* do nothing, these cannot be hidden */
|
|
|
|
} else {
|
2007-04-11 09:07:51 -04:00
|
|
|
if (strip->packed()) {
|
|
|
|
strip_packer.remove (*strip);
|
|
|
|
strip->set_packed (false);
|
|
|
|
}
|
2006-01-11 22:43:52 -05:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2016-04-29 10:33:05 -04:00
|
|
|
/* update visibility of VCA assign buttons */
|
|
|
|
|
|
|
|
if (n_masters == 0) {
|
|
|
|
UIConfiguration::instance().set_mixer_strip_visibility (VisibilityGroup::remove_element (UIConfiguration::instance().get_mixer_strip_visibility(), X_("VCA")));
|
2016-05-16 07:30:28 -04:00
|
|
|
vca_scroller.hide ();
|
2016-04-29 10:33:05 -04:00
|
|
|
} else {
|
|
|
|
UIConfiguration::instance().set_mixer_strip_visibility (VisibilityGroup::add_element (UIConfiguration::instance().get_mixer_strip_visibility(), X_("VCA")));
|
2016-05-16 07:30:28 -04:00
|
|
|
vca_scroller.show ();
|
2016-04-29 10:33:05 -04:00
|
|
|
}
|
|
|
|
|
2009-06-20 13:15:33 -04:00
|
|
|
_group_tabs->set_dirty ();
|
2008-04-11 10:06:50 -04:00
|
|
|
}
|
|
|
|
|
2008-12-12 09:43:24 -05:00
|
|
|
void
|
2009-06-23 19:05:14 -04:00
|
|
|
Mixer_UI::strip_width_changed ()
|
2008-12-12 09:43:24 -05:00
|
|
|
{
|
2009-06-23 19:05:14 -04:00
|
|
|
_group_tabs->set_dirty ();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2015-10-27 13:43:31 -04:00
|
|
|
#ifdef __APPLE__
|
2008-12-12 09:43:24 -05:00
|
|
|
TreeModel::Children rows = track_model->children();
|
|
|
|
TreeModel::Children::iterator i;
|
|
|
|
long order;
|
|
|
|
|
|
|
|
for (order = 0, i = rows.begin(); i != rows.end(); ++i, ++order) {
|
|
|
|
MixerStrip* strip = (*i)[track_columns.strip];
|
|
|
|
|
|
|
|
if (strip == 0) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool visible = (*i)[track_columns.visible];
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-12-12 09:43:24 -05:00
|
|
|
if (visible) {
|
|
|
|
strip->queue_draw();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-06-23 19:05:14 -04:00
|
|
|
}
|
2008-12-12 09:43:24 -05:00
|
|
|
|
2016-05-16 07:30:28 -04:00
|
|
|
struct PresentationInfoRouteSorter
|
|
|
|
{
|
|
|
|
bool operator() (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b) {
|
|
|
|
return a->presentation_info().global_order () < b->presentation_info().global_order ();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2006-01-11 22:43:52 -05:00
|
|
|
void
|
|
|
|
Mixer_UI::initial_track_display ()
|
|
|
|
{
|
2009-12-17 13:24:23 -05:00
|
|
|
boost::shared_ptr<RouteList> routes = _session->get_routes();
|
2009-01-30 02:40:13 -05:00
|
|
|
RouteList copy (*routes);
|
2016-05-16 07:30:28 -04:00
|
|
|
PresentationInfoRouteSorter sorter;
|
2006-01-11 22:43:52 -05:00
|
|
|
|
2006-07-27 12:52:14 -04:00
|
|
|
copy.sort (sorter);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2012-06-27 18:57:06 -04:00
|
|
|
{
|
|
|
|
Unwinder<bool> uw1 (no_track_list_redisplay, true);
|
|
|
|
Unwinder<bool> uw2 (ignore_reorder, true);
|
2006-01-11 22:43:52 -05:00
|
|
|
|
2012-06-27 18:57:06 -04:00
|
|
|
track_model->clear ();
|
2016-02-29 18:12:13 -05:00
|
|
|
VCAList vcas = _session->vca_manager().vcas();
|
|
|
|
add_masters (vcas);
|
2012-06-27 18:57:06 -04:00
|
|
|
add_strips (copy);
|
|
|
|
}
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2006-01-11 22:43:52 -05:00
|
|
|
redisplay_track_list ();
|
|
|
|
}
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void
|
2006-01-11 22:43:52 -05:00
|
|
|
Mixer_UI::show_track_list_menu ()
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
if (track_menu == 0) {
|
|
|
|
build_track_menu ();
|
|
|
|
}
|
|
|
|
|
2006-11-21 19:58:22 -05:00
|
|
|
track_menu->popup (1, gtk_get_current_event_time());
|
2006-01-11 22:43:52 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
Mixer_UI::track_display_button_press (GdkEventButton* ev)
|
|
|
|
{
|
|
|
|
if (Keyboard::is_context_menu_event (ev)) {
|
|
|
|
show_track_list_menu ();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::build_track_menu ()
|
|
|
|
{
|
|
|
|
using namespace Menu_Helpers;
|
|
|
|
using namespace Gtk;
|
|
|
|
|
|
|
|
track_menu = new Menu;
|
|
|
|
track_menu->set_name ("ArdourContextMenu");
|
|
|
|
MenuList& items = track_menu->items();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-12-11 18:29:48 -05:00
|
|
|
items.push_back (MenuElem (_("Show All"), sigc::mem_fun(*this, &Mixer_UI::show_all_routes)));
|
|
|
|
items.push_back (MenuElem (_("Hide All"), sigc::mem_fun(*this, &Mixer_UI::hide_all_routes)));
|
|
|
|
items.push_back (MenuElem (_("Show All Audio Tracks"), sigc::mem_fun(*this, &Mixer_UI::show_all_audiotracks)));
|
|
|
|
items.push_back (MenuElem (_("Hide All Audio Tracks"), sigc::mem_fun(*this, &Mixer_UI::hide_all_audiotracks)));
|
|
|
|
items.push_back (MenuElem (_("Show All Audio Busses"), sigc::mem_fun(*this, &Mixer_UI::show_all_audiobus)));
|
|
|
|
items.push_back (MenuElem (_("Hide All Audio Busses"), sigc::mem_fun(*this, &Mixer_UI::hide_all_audiobus)));
|
2015-07-10 05:11:44 -04:00
|
|
|
items.push_back (MenuElem (_("Show All Midi Tracks"), sigc::mem_fun (*this, &Mixer_UI::show_all_miditracks)));
|
|
|
|
items.push_back (MenuElem (_("Hide All Midi Tracks"), sigc::mem_fun (*this, &Mixer_UI::hide_all_miditracks)));
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2010-02-19 13:09:08 -05:00
|
|
|
Mixer_UI::strip_property_changed (const PropertyChange& what_changed, MixerStrip* mx)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2010-02-19 13:09:08 -05:00
|
|
|
if (!what_changed.contains (ARDOUR::Properties::name)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ENSURE_GUI_THREAD (*this, &Mixer_UI::strip_name_changed, what_changed, mx)
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-03-09 18:44:39 -05:00
|
|
|
TreeModel::Children rows = track_model->children();
|
2005-10-01 12:29:37 -04:00
|
|
|
TreeModel::Children::iterator i;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-10-01 12:29:37 -04:00
|
|
|
for (i = rows.begin(); i != rows.end(); ++i) {
|
2006-03-09 18:44:39 -05:00
|
|
|
if ((*i)[track_columns.strip] == mx) {
|
2006-07-27 12:52:14 -04:00
|
|
|
(*i)[track_columns.text] = mx->route()->name();
|
2005-10-01 12:29:37 -04:00
|
|
|
return;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2016-01-11 21:36:44 -05:00
|
|
|
error << _("track display list item for renamed strip not found!") << endmsg;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2005-10-01 12:29:37 -04:00
|
|
|
bool
|
|
|
|
Mixer_UI::group_display_button_press (GdkEventButton* ev)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2005-10-01 12:29:37 -04:00
|
|
|
TreeModel::Path path;
|
|
|
|
TreeViewColumn* column;
|
|
|
|
int cellx;
|
|
|
|
int celly;
|
|
|
|
|
|
|
|
if (!group_display.get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly)) {
|
2015-05-03 17:33:05 -04:00
|
|
|
_group_tabs->get_menu(0)->popup (1, ev->time);
|
|
|
|
return true;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2006-03-09 18:44:39 -05:00
|
|
|
|
2010-07-19 19:26:40 -04:00
|
|
|
TreeIter iter = group_model->get_iter (path);
|
|
|
|
if (!iter) {
|
2015-05-03 17:33:05 -04:00
|
|
|
_group_tabs->get_menu(0)->popup (1, ev->time);
|
|
|
|
return true;
|
2010-07-19 19:26:40 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
RouteGroup* group = (*iter)[group_columns.group];
|
|
|
|
|
|
|
|
if (Keyboard::is_context_menu_event (ev)) {
|
|
|
|
_group_tabs->get_menu(group)->popup (1, ev->time);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2005-10-05 09:48:09 -04:00
|
|
|
switch (GPOINTER_TO_UINT (column->get_data (X_("colnum")))) {
|
2005-10-01 12:29:37 -04:00
|
|
|
case 0:
|
2006-02-14 14:12:35 -05:00
|
|
|
if (Keyboard::is_edit_event (ev)) {
|
2010-07-19 19:26:40 -04:00
|
|
|
if (group) {
|
|
|
|
// edit_route_group (group);
|
2015-10-27 13:43:31 -04:00
|
|
|
#ifdef __APPLE__
|
2010-07-19 19:26:40 -04:00
|
|
|
group_display.queue_draw();
|
2008-12-12 09:43:24 -05:00
|
|
|
#endif
|
2010-07-19 19:26:40 -04:00
|
|
|
return true;
|
2006-03-09 18:44:39 -05:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
}
|
2006-02-14 14:12:35 -05:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
2010-07-19 19:26:40 -04:00
|
|
|
{
|
|
|
|
bool visible = (*iter)[group_columns.visible];
|
|
|
|
(*iter)[group_columns.visible] = !visible;
|
2015-10-27 13:43:31 -04:00
|
|
|
#ifdef __APPLE__
|
2010-07-19 19:26:40 -04:00
|
|
|
group_display.queue_draw();
|
2008-12-12 09:43:24 -05:00
|
|
|
#endif
|
2010-07-19 19:26:40 -04:00
|
|
|
return true;
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-03-09 18:44:39 -05:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-03-09 18:44:39 -05:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-06-21 15:59:56 -04:00
|
|
|
Mixer_UI::activate_all_route_groups ()
|
2006-03-09 18:44:39 -05:00
|
|
|
{
|
2009-12-17 13:24:23 -05:00
|
|
|
_session->foreach_route_group (sigc::bind (sigc::mem_fun (*this, &Mixer_UI::set_route_group_activation), true));
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-06-21 15:59:56 -04:00
|
|
|
Mixer_UI::disable_all_route_groups ()
|
2006-03-09 18:44:39 -05:00
|
|
|
{
|
2009-12-17 13:24:23 -05:00
|
|
|
_session->foreach_route_group (sigc::bind (sigc::mem_fun (*this, &Mixer_UI::set_route_group_activation), false));
|
2006-03-09 18:44:39 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-06-21 15:59:56 -04:00
|
|
|
Mixer_UI::route_groups_changed ()
|
2006-03-09 18:44:39 -05:00
|
|
|
{
|
2011-04-19 11:46:47 -04:00
|
|
|
ENSURE_GUI_THREAD (*this, &Mixer_UI::route_groups_changed);
|
|
|
|
|
2011-04-19 21:24:40 -04:00
|
|
|
_in_group_rebuild_or_clear = true;
|
2006-03-09 18:44:39 -05:00
|
|
|
|
|
|
|
/* just rebuild the while thing */
|
|
|
|
|
|
|
|
group_model->clear ();
|
|
|
|
|
2015-01-14 14:10:34 -05:00
|
|
|
#if 0
|
|
|
|
/* this is currently not used,
|
|
|
|
* Mixer_UI::group_display_button_press() has a case for it,
|
|
|
|
* and a commented edit_route_group() but that's n/a since 2011.
|
|
|
|
*
|
|
|
|
* This code is left as reminder that
|
|
|
|
* row[group_columns.group] = 0 has special meaning.
|
|
|
|
*/
|
2006-03-09 18:44:39 -05:00
|
|
|
{
|
|
|
|
TreeModel::Row row;
|
|
|
|
row = *(group_model->append());
|
|
|
|
row[group_columns.visible] = true;
|
|
|
|
row[group_columns.text] = (_("-all-"));
|
|
|
|
row[group_columns.group] = 0;
|
|
|
|
}
|
2015-01-14 14:10:34 -05:00
|
|
|
#endif
|
2006-03-09 18:44:39 -05:00
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
_session->foreach_route_group (sigc::mem_fun (*this, &Mixer_UI::add_route_group));
|
2010-07-19 19:26:40 -04:00
|
|
|
|
|
|
|
_group_tabs->set_dirty ();
|
2011-04-19 21:24:40 -04:00
|
|
|
_in_group_rebuild_or_clear = false;
|
2006-03-09 18:44:39 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-06-21 15:59:56 -04:00
|
|
|
Mixer_UI::new_route_group ()
|
2006-03-09 18:44:39 -05:00
|
|
|
{
|
2010-07-19 19:26:40 -04:00
|
|
|
RouteList rl;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2016-05-18 23:44:09 -04:00
|
|
|
_group_tabs->run_new_group_dialog (rl, false);
|
2006-03-09 18:44:39 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-06-21 15:59:56 -04:00
|
|
|
Mixer_UI::remove_selected_route_group ()
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2005-10-05 09:48:09 -04:00
|
|
|
Glib::RefPtr<TreeSelection> selection = group_display.get_selection();
|
2006-03-09 18:44:39 -05:00
|
|
|
TreeView::Selection::ListHandle_Path rows = selection->get_selected_rows ();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-03-09 18:44:39 -05:00
|
|
|
if (rows.empty()) {
|
|
|
|
return;
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-03-09 18:44:39 -05:00
|
|
|
TreeView::Selection::ListHandle_Path::iterator i = rows.begin();
|
|
|
|
TreeIter iter;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-03-09 18:44:39 -05:00
|
|
|
/* selection mode is single, so rows.begin() is it */
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-03-09 18:44:39 -05:00
|
|
|
if ((iter = group_model->get_iter (*i))) {
|
|
|
|
|
|
|
|
RouteGroup* rg = (*iter)[group_columns.group];
|
|
|
|
|
|
|
|
if (rg) {
|
2009-12-17 13:24:23 -05:00
|
|
|
_session->remove_route_group (*rg);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2010-04-01 20:21:08 -04:00
|
|
|
Mixer_UI::route_group_property_changed (RouteGroup* group, const PropertyChange& change)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2006-03-09 18:44:39 -05:00
|
|
|
if (in_group_row_change) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-04-11 09:07:51 -04:00
|
|
|
/* force an update of any mixer strips that are using this group,
|
2009-10-14 12:10:01 -04:00
|
|
|
otherwise mix group names don't change in mixer strips
|
2007-04-11 09:07:51 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
for (list<MixerStrip *>::iterator i = strips.begin(); i != strips.end(); ++i) {
|
2009-06-21 15:59:56 -04:00
|
|
|
if ((*i)->route_group() == group) {
|
2009-12-09 22:25:32 -05:00
|
|
|
(*i)->route_group_changed();
|
2007-04-11 09:07:51 -04:00
|
|
|
}
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-01-11 22:43:52 -05:00
|
|
|
TreeModel::iterator i;
|
2006-03-09 18:44:39 -05:00
|
|
|
TreeModel::Children rows = group_model->children();
|
2006-01-11 22:43:52 -05:00
|
|
|
Glib::RefPtr<TreeSelection> selection = group_display.get_selection();
|
2006-03-09 18:44:39 -05:00
|
|
|
|
|
|
|
in_group_row_change = true;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-01-11 22:43:52 -05:00
|
|
|
for (i = rows.begin(); i != rows.end(); ++i) {
|
2006-03-09 18:44:39 -05:00
|
|
|
if ((*i)[group_columns.group] == group) {
|
|
|
|
(*i)[group_columns.visible] = !group->is_hidden ();
|
|
|
|
(*i)[group_columns.text] = group->name ();
|
2005-10-01 12:29:37 -04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2006-03-09 18:44:39 -05:00
|
|
|
|
|
|
|
in_group_row_change = false;
|
2009-06-20 13:18:41 -04:00
|
|
|
|
2010-04-01 20:21:08 -04:00
|
|
|
if (change.contains (Properties::name)) {
|
|
|
|
_group_tabs->set_dirty ();
|
|
|
|
}
|
2011-04-05 20:36:36 -04:00
|
|
|
|
|
|
|
for (list<MixerStrip*>::iterator j = strips.begin(); j != strips.end(); ++j) {
|
|
|
|
if ((*j)->route_group() == group) {
|
|
|
|
if (group->is_hidden ()) {
|
|
|
|
hide_strip (*j);
|
|
|
|
} else {
|
|
|
|
show_strip (*j);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-03-09 18:44:39 -05:00
|
|
|
}
|
|
|
|
|
2015-12-10 18:21:02 -05:00
|
|
|
void
|
|
|
|
Mixer_UI::show_mixer_list (bool yn)
|
|
|
|
{
|
|
|
|
if (yn) {
|
|
|
|
list_vpacker.show ();
|
2015-04-21 15:10:49 -04:00
|
|
|
|
|
|
|
//if user wants to show the pane, we should make sure that it is wide enough to be visible
|
2015-12-10 18:21:02 -05:00
|
|
|
int width = list_hpane.get_position();
|
2016-04-22 22:17:55 -04:00
|
|
|
if (width < 40) {
|
2015-12-10 18:21:02 -05:00
|
|
|
list_hpane.set_position(40);
|
2016-04-22 22:17:55 -04:00
|
|
|
}
|
2015-12-10 18:21:02 -05:00
|
|
|
} else {
|
|
|
|
list_vpacker.hide ();
|
|
|
|
}
|
2015-04-21 15:10:49 -04:00
|
|
|
|
2015-12-10 18:21:02 -05:00
|
|
|
_show_mixer_list = yn;
|
|
|
|
}
|
|
|
|
|
2015-12-19 11:42:36 -05:00
|
|
|
void
|
|
|
|
Mixer_UI::show_monitor_section (bool yn)
|
|
|
|
{
|
|
|
|
if (!monitor_section()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (monitor_section()->tearoff().torn_off()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (yn) {
|
|
|
|
monitor_section()->tearoff().show();
|
|
|
|
} else {
|
|
|
|
monitor_section()->tearoff().hide();
|
|
|
|
}
|
|
|
|
}
|
2015-12-10 18:21:02 -05:00
|
|
|
|
2006-03-09 18:44:39 -05:00
|
|
|
void
|
2010-09-14 12:51:02 -04:00
|
|
|
Mixer_UI::route_group_name_edit (const std::string& path, const std::string& new_text)
|
2006-03-09 18:44:39 -05:00
|
|
|
{
|
|
|
|
RouteGroup* group;
|
|
|
|
TreeIter iter;
|
|
|
|
|
|
|
|
if ((iter = group_model->get_iter (path))) {
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-03-09 18:44:39 -05:00
|
|
|
if ((group = (*iter)[group_columns.group]) == 0) {
|
|
|
|
return;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-03-09 18:44:39 -05:00
|
|
|
if (new_text != group->name()) {
|
|
|
|
group->set_name (new_text);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-10-14 12:10:01 -04:00
|
|
|
void
|
2009-07-21 11:55:17 -04:00
|
|
|
Mixer_UI::route_group_row_change (const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator& iter)
|
2006-03-09 18:44:39 -05:00
|
|
|
{
|
|
|
|
RouteGroup* group;
|
|
|
|
|
|
|
|
if (in_group_row_change) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((group = (*iter)[group_columns.group]) == 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-09-14 12:51:02 -04:00
|
|
|
std::string name = (*iter)[group_columns.text];
|
2006-03-09 18:44:39 -05:00
|
|
|
|
|
|
|
if (name != group->name()) {
|
|
|
|
group->set_name (name);
|
|
|
|
}
|
2008-04-11 10:06:50 -04:00
|
|
|
|
2011-04-05 20:36:36 -04:00
|
|
|
bool hidden = !(*iter)[group_columns.visible];
|
|
|
|
|
|
|
|
if (hidden != group->is_hidden ()) {
|
|
|
|
group->set_hidden (hidden, this);
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2011-04-19 11:46:47 -04:00
|
|
|
/** Called when a group model row is deleted, but also when the model is
|
|
|
|
* reordered by a user drag-and-drop; the latter is what we are
|
|
|
|
* interested in here.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
Mixer_UI::route_group_row_deleted (Gtk::TreeModel::Path const &)
|
|
|
|
{
|
2011-04-19 21:24:40 -04:00
|
|
|
if (_in_group_rebuild_or_clear) {
|
2011-04-19 11:46:47 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Re-write the session's route group list so that the new order is preserved */
|
|
|
|
|
|
|
|
list<RouteGroup*> new_list;
|
|
|
|
|
|
|
|
Gtk::TreeModel::Children children = group_model->children();
|
|
|
|
for (Gtk::TreeModel::Children::iterator i = children.begin(); i != children.end(); ++i) {
|
|
|
|
RouteGroup* g = (*i)[group_columns.group];
|
|
|
|
if (g) {
|
|
|
|
new_list.push_back (g);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
_session->reorder_route_groups (new_list);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void
|
2009-06-21 15:59:56 -04:00
|
|
|
Mixer_UI::add_route_group (RouteGroup* group)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2009-12-11 18:29:48 -05:00
|
|
|
ENSURE_GUI_THREAD (*this, &Mixer_UI::add_route_group, group)
|
2006-03-09 23:05:11 -05:00
|
|
|
bool focus = false;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-05-18 21:54:00 -04:00
|
|
|
in_group_row_change = true;
|
|
|
|
|
2006-03-09 18:44:39 -05:00
|
|
|
TreeModel::Row row = *(group_model->append());
|
2011-04-05 20:36:36 -04:00
|
|
|
row[group_columns.visible] = !group->is_hidden ();
|
2006-03-09 18:44:39 -05:00
|
|
|
row[group_columns.group] = group;
|
2006-03-09 23:05:11 -05:00
|
|
|
if (!group->name().empty()) {
|
|
|
|
row[group_columns.text] = group->name();
|
|
|
|
} else {
|
|
|
|
row[group_columns.text] = _("unnamed");
|
|
|
|
focus = true;
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2012-04-25 08:58:19 -04:00
|
|
|
group->PropertyChanged.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::route_group_property_changed, this, group, _1), gui_context());
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-03-09 23:05:11 -05:00
|
|
|
if (focus) {
|
2006-03-10 09:35:57 -05:00
|
|
|
TreeViewColumn* col = group_display.get_column (0);
|
|
|
|
CellRendererText* name_cell = dynamic_cast<CellRendererText*>(group_display.get_column_cell_renderer (0));
|
|
|
|
group_display.set_cursor (group_model->get_path (row), *col, *name_cell, true);
|
2006-03-09 23:05:11 -05:00
|
|
|
}
|
2006-05-18 21:54:00 -04:00
|
|
|
|
2010-07-19 17:47:07 -04:00
|
|
|
_group_tabs->set_dirty ();
|
|
|
|
|
2006-05-18 21:54:00 -04:00
|
|
|
in_group_row_change = false;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2006-01-04 22:18:44 -05:00
|
|
|
bool
|
2005-09-25 14:42:24 -04:00
|
|
|
Mixer_UI::strip_scroller_button_release (GdkEventButton* ev)
|
|
|
|
{
|
|
|
|
using namespace Menu_Helpers;
|
|
|
|
|
|
|
|
if (Keyboard::is_context_menu_event (ev)) {
|
2016-05-05 21:08:46 -04:00
|
|
|
ARDOUR_UI::instance()->add_route ();
|
2006-01-04 22:18:44 -05:00
|
|
|
return true;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2006-01-04 22:18:44 -05:00
|
|
|
return false;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2016-05-06 10:04:05 -04:00
|
|
|
void
|
|
|
|
Mixer_UI::scroller_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context, int x, int y, const Gtk::SelectionData& data, guint info, guint time)
|
|
|
|
{
|
|
|
|
printf ("Mixer_UI::scroller_drag_data_received\n");
|
|
|
|
if (data.get_target() != "PluginFavoritePtr") {
|
|
|
|
context->drag_finish (false, false, time);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const void * d = data.get_data();
|
2016-05-17 08:21:05 -04:00
|
|
|
const Gtkmm2ext::DnDTreeView<ARDOUR::PluginPresetPtr>* tv = reinterpret_cast<const Gtkmm2ext::DnDTreeView<ARDOUR::PluginPresetPtr>*>(d);
|
2016-05-06 10:04:05 -04:00
|
|
|
|
|
|
|
PluginPresetList nfos;
|
|
|
|
TreeView* source;
|
|
|
|
tv->get_object_drag_data (nfos, &source);
|
|
|
|
|
|
|
|
Route::ProcessorList pl;
|
|
|
|
bool ok = false;
|
|
|
|
|
|
|
|
for (list<PluginPresetPtr>::const_iterator i = nfos.begin(); i != nfos.end(); ++i) {
|
|
|
|
PluginPresetPtr ppp = (*i);
|
|
|
|
PluginInfoPtr pip = ppp->_pip;
|
|
|
|
if (!pip->is_instrument ()) {
|
|
|
|
continue;
|
|
|
|
}
|
2016-05-17 08:21:05 -04:00
|
|
|
ARDOUR_UI::instance()->session_add_midi_track ((RouteGroup*) 0, 1, _("MIDI"), Config->get_strict_io (), pip, ppp->_preset.valid ? &ppp->_preset : 0, PresentationInfo::max_order);
|
2016-05-06 10:04:05 -04:00
|
|
|
ok = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
context->drag_finish (ok, false, time);
|
|
|
|
}
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void
|
2013-07-10 15:40:42 -04:00
|
|
|
Mixer_UI::set_strip_width (Width w, bool save)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
_strip_width = w;
|
|
|
|
|
|
|
|
for (list<MixerStrip*>::iterator i = strips.begin(); i != strips.end(); ++i) {
|
2013-07-10 15:40:42 -04:00
|
|
|
(*i)->set_width_enum (w, save ? (*i)->width_owner() : this);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-12-22 17:06:08 -05:00
|
|
|
struct PluginStateSorter {
|
|
|
|
public:
|
|
|
|
bool operator() (PluginInfoPtr a, PluginInfoPtr b) const {
|
|
|
|
std::list<std::string>::const_iterator aiter = std::find(_user.begin(), _user.end(), (*a).unique_id);
|
|
|
|
std::list<std::string>::const_iterator biter = std::find(_user.begin(), _user.end(), (*b).unique_id);
|
|
|
|
if (aiter != _user.end() && biter != _user.end()) {
|
|
|
|
return std::distance (_user.begin(), aiter) < std::distance (_user.begin(), biter);
|
|
|
|
}
|
|
|
|
if (aiter != _user.end()) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (biter != _user.end()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return ARDOUR::cmp_nocase((*a).name, (*b).name) == -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
PluginStateSorter(std::list<std::string> user) : _user (user) {}
|
|
|
|
private:
|
|
|
|
std::list<std::string> _user;
|
|
|
|
};
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
int
|
2015-07-07 22:12:21 -04:00
|
|
|
Mixer_UI::set_state (const XMLNode& node, int version)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2016-05-04 23:09:37 -04:00
|
|
|
XMLProperty const * prop;
|
2015-04-21 15:10:49 -04:00
|
|
|
|
2016-01-11 21:36:44 -05:00
|
|
|
Tabbable::set_state (node, version);
|
2006-01-17 11:40:57 -05:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
if ((prop = node.property ("narrow-strips"))) {
|
2009-10-02 16:53:31 -04:00
|
|
|
if (string_is_affirmative (prop->value())) {
|
2005-09-25 14:42:24 -04:00
|
|
|
set_strip_width (Narrow);
|
|
|
|
} else {
|
|
|
|
set_strip_width (Wide);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-08-30 16:48:16 -04:00
|
|
|
if ((prop = node.property ("show-mixer"))) {
|
2009-10-02 16:53:31 -04:00
|
|
|
if (string_is_affirmative (prop->value())) {
|
2006-08-30 16:48:16 -04:00
|
|
|
_visible = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-21 08:45:00 -04:00
|
|
|
if ((prop = node.property ("maximised"))) {
|
|
|
|
bool yn = string_is_affirmative (prop->value());
|
|
|
|
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("ToggleMaximalMixer"));
|
|
|
|
assert (act);
|
|
|
|
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
|
|
|
|
bool fs = tact && tact->get_active();
|
|
|
|
if (yn ^ fs) {
|
2015-04-21 15:10:49 -04:00
|
|
|
ActionManager::do_action ("Common", "ToggleMaximalMixer");
|
2014-03-21 08:45:00 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-10 18:21:02 -05:00
|
|
|
if ((prop = node.property ("show-mixer-list"))) {
|
|
|
|
bool yn = string_is_affirmative (prop->value());
|
|
|
|
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("ToggleMixerList"));
|
|
|
|
assert (act);
|
|
|
|
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
|
|
|
|
|
|
|
|
/* do it twice to force the change */
|
|
|
|
tact->set_active (!yn);
|
|
|
|
tact->set_active (yn);
|
|
|
|
}
|
|
|
|
|
2015-12-25 18:43:59 -05:00
|
|
|
|
2015-12-22 17:06:08 -05:00
|
|
|
XMLNode* plugin_order;
|
|
|
|
if ((plugin_order = find_named_node (node, "PluginOrder")) != 0) {
|
2015-12-25 18:43:59 -05:00
|
|
|
store_current_favorite_order ();
|
2015-12-22 17:06:08 -05:00
|
|
|
std::list<string> order;
|
|
|
|
const XMLNodeList& kids = plugin_order->children("PluginInfo");
|
|
|
|
XMLNodeConstIterator i;
|
|
|
|
for (i = kids.begin(); i != kids.end(); ++i) {
|
|
|
|
if ((prop = (*i)->property ("unique-id"))) {
|
2015-12-25 18:43:59 -05:00
|
|
|
std::string unique_id = prop->value();
|
|
|
|
order.push_back (unique_id);
|
|
|
|
if ((prop = (*i)->property ("expanded"))) {
|
|
|
|
favorite_ui_state[unique_id] = string_is_affirmative (prop->value());
|
|
|
|
}
|
2015-12-22 17:06:08 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
PluginStateSorter cmp (order);
|
|
|
|
favorite_order.sort (cmp);
|
|
|
|
sync_treeview_from_favorite_order ();
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
XMLNode&
|
2015-07-07 22:12:21 -04:00
|
|
|
Mixer_UI::get_state ()
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2015-07-09 12:40:51 -04:00
|
|
|
XMLNode* node = new XMLNode (X_("Mixer"));
|
|
|
|
char buf[128];
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2015-07-09 12:40:51 -04:00
|
|
|
node->add_child_nocopy (Tabbable::get_state());
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2016-04-22 22:17:55 -04:00
|
|
|
snprintf(buf,sizeof(buf), "%f", paned_position_as_fraction (rhs_pane1, true));
|
2016-03-03 11:47:01 -05:00
|
|
|
node->add_property(X_("mixer-rhs-pane1-pos"), string(buf));
|
2016-04-22 22:17:55 -04:00
|
|
|
snprintf(buf,sizeof(buf), "%f", paned_position_as_fraction (rhs_pane2, true));
|
2016-03-03 11:47:01 -05:00
|
|
|
node->add_property(X_("mixer-rhs_pane2-pos"), string(buf));
|
2016-04-22 22:17:55 -04:00
|
|
|
snprintf(buf,sizeof(buf), "%f", paned_position_as_fraction (list_hpane, false));
|
2016-03-03 11:47:01 -05:00
|
|
|
node->add_property(X_("mixer-list-hpane-pos"), string(buf));
|
2016-04-22 22:17:55 -04:00
|
|
|
snprintf(buf,sizeof(buf), "%f", paned_position_as_fraction (inner_pane, false));
|
2016-03-03 11:47:01 -05:00
|
|
|
node->add_property(X_("mixer-inner-pane-pos"), string(buf));
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
node->add_property ("narrow-strips", _strip_width == Narrow ? "yes" : "no");
|
2006-08-30 16:48:16 -04:00
|
|
|
node->add_property ("show-mixer", _visible ? "yes" : "no");
|
2015-12-10 18:21:02 -05:00
|
|
|
node->add_property ("show-mixer-list", _show_mixer_list ? "yes" : "no");
|
2014-03-21 08:45:00 -04:00
|
|
|
node->add_property ("maximised", _maximised ? "yes" : "no");
|
|
|
|
|
2016-04-28 19:39:39 -04:00
|
|
|
store_current_favorite_order ();
|
|
|
|
XMLNode* plugin_order = new XMLNode ("PluginOrder");
|
|
|
|
int cnt = 0;
|
|
|
|
for (PluginInfoList::const_iterator i = favorite_order.begin(); i != favorite_order.end(); ++i, ++cnt) {
|
|
|
|
XMLNode* p = new XMLNode ("PluginInfo");
|
|
|
|
p->add_property ("sort", cnt);
|
|
|
|
p->add_property ("unique-id", (*i)->unique_id);
|
|
|
|
if (favorite_ui_state.find ((*i)->unique_id) != favorite_ui_state.end ()) {
|
|
|
|
p->add_property ("expanded", favorite_ui_state[(*i)->unique_id]);
|
|
|
|
}
|
|
|
|
plugin_order->add_child_nocopy (*p);
|
|
|
|
}
|
|
|
|
node->add_child_nocopy (*plugin_order);
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
return *node;
|
|
|
|
}
|
|
|
|
|
2009-10-14 12:10:01 -04:00
|
|
|
void
|
2016-04-22 22:17:55 -04:00
|
|
|
Mixer_UI::pane_allocation_handler (Allocation& allocation, Gtk::Paned* which)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2016-04-22 22:17:55 -04:00
|
|
|
float pos;
|
2016-03-03 11:47:01 -05:00
|
|
|
XMLProperty* prop = 0;
|
|
|
|
XMLNode* geometry = ARDOUR_UI::instance()->mixer_settings();
|
|
|
|
int height = default_height;
|
|
|
|
static bool done[4] = { false, false, false, false };
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2016-04-22 22:45:51 -04:00
|
|
|
/* Gtk::Paned behaves very oddly and rather undesirably. Setting the
|
|
|
|
* position is a crapshoot if you time it incorrectly with the overall
|
|
|
|
* sizing of the Paned. For example, if you might retrieve the size with
|
|
|
|
* ::get_position() and then later call ::set_position() on a Paned at
|
|
|
|
* a time when its allocation is different than it was when you retrieved
|
|
|
|
* the position. The position will be interpreted as the size of the
|
|
|
|
* first (top or left) child widget. If packing/size allocation later
|
|
|
|
* resizes the Paned to a (final) smaller size, the position will be
|
|
|
|
* used in ways that mean that the Paned ends up NOT in the same state
|
|
|
|
* that it was in when you originally saved the position.
|
|
|
|
*
|
|
|
|
* Concrete example: Paned is 800 pixels wide, position is 400
|
|
|
|
* (halfway). Save position as 400. During program restart, set
|
|
|
|
* position to 400, before Paned has been allocated any space. Paned
|
|
|
|
* ends up initially sized to 1200 pixels. Position is now 1/3 of the
|
|
|
|
* way across/down. Subsequent resizes will leave the position 1/3 of
|
|
|
|
* the way across, rather than leaving it as a fixed pixel
|
|
|
|
* position. Eventually, the Paned ends up 800 pixels wide/high again,
|
|
|
|
* but the position is now 267, not 400.
|
|
|
|
*
|
|
|
|
* So ...
|
|
|
|
*
|
|
|
|
* We deal with this by using two strategies:
|
|
|
|
*
|
|
|
|
* 1) only set the position if the allocated size of the Paned is at
|
|
|
|
* least as big as it needs to be for the position to make sense.
|
|
|
|
*
|
|
|
|
* 2) in recent versions of Ardour, save the position as a fraction,
|
|
|
|
* and restore it using that fraction.
|
|
|
|
*
|
|
|
|
* So, we will only call ::set_position() AFTER the Paned is of a
|
|
|
|
* sensible size, and then in addition, we will set the position in a
|
|
|
|
* way that will be maintained as/when/if the Paned is resized.
|
|
|
|
*
|
|
|
|
* Once we've called ::set_position() on a Paned, we don't do it
|
|
|
|
* again.
|
|
|
|
*/
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
if (which == static_cast<Gtk::Paned*> (&rhs_pane1)) {
|
|
|
|
|
|
|
|
if (done[0]) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-10-05 19:14:48 -04:00
|
|
|
if (!geometry || (prop = geometry->property("mixer-rhs-pane1-pos")) == 0) {
|
2015-12-22 17:26:33 -05:00
|
|
|
pos = height / 3;
|
2005-09-25 14:42:24 -04:00
|
|
|
} else {
|
2016-04-22 22:17:55 -04:00
|
|
|
pos = atof (prop->value());
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2016-04-22 22:17:55 -04:00
|
|
|
if (pos > 1.0f) {
|
2016-04-22 23:02:21 -04:00
|
|
|
/* older versions of Ardour stored absolute position */
|
2016-04-22 22:17:55 -04:00
|
|
|
if ((done[0] = (allocation.get_height() > pos))) {
|
|
|
|
rhs_pane1.set_position (pos);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if ((done[0] = (allocation.get_height() > 1.0/pos))) {
|
2016-04-22 22:53:39 -04:00
|
|
|
paned_set_position_as_fraction (rhs_pane1, pos, true);
|
2016-04-22 22:17:55 -04:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2016-04-22 22:17:55 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (which == static_cast<Gtk::Paned*> (&rhs_pane2)) {
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2015-12-21 22:43:26 -05:00
|
|
|
if (done[1]) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!geometry || (prop = geometry->property("mixer-rhs-pane2-pos")) == 0) {
|
2015-12-22 17:26:33 -05:00
|
|
|
pos = 2 * height / 3;
|
2015-12-21 22:43:26 -05:00
|
|
|
} else {
|
2016-04-22 22:17:55 -04:00
|
|
|
pos = atof (prop->value());
|
2015-12-21 22:43:26 -05:00
|
|
|
}
|
|
|
|
|
2016-04-22 22:17:55 -04:00
|
|
|
if (pos > 1.0f) {
|
2016-04-22 23:02:21 -04:00
|
|
|
/* older versions of Ardour stored absolute position */
|
2016-04-22 22:17:55 -04:00
|
|
|
if ((done[1] = (allocation.get_height() > pos))) {
|
|
|
|
rhs_pane2.set_position (pos);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if ((done[1] = (allocation.get_height() > 1.0/pos))) {
|
2016-04-22 22:53:39 -04:00
|
|
|
paned_set_position_as_fraction (rhs_pane2, pos, true);
|
2016-04-22 22:17:55 -04:00
|
|
|
}
|
2015-12-21 22:43:26 -05:00
|
|
|
}
|
2016-04-22 22:17:55 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (which == static_cast<Gtk::Paned*> (&list_hpane)) {
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
if (done[2]) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-10-15 12:22:11 -04:00
|
|
|
if (!geometry || (prop = geometry->property("mixer-list-hpane-pos")) == 0) {
|
2015-12-22 17:26:33 -05:00
|
|
|
pos = std::max ((float)100, rintf ((float) 125 * UIConfiguration::instance().get_ui_scale()));
|
2005-09-25 14:42:24 -04:00
|
|
|
} else {
|
2016-04-22 22:17:55 -04:00
|
|
|
pos = max (0.1, atof (prop->value ()));
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2016-04-22 22:17:55 -04:00
|
|
|
if (pos > 1.0f) {
|
|
|
|
if ((done[2] = (allocation.get_width() > pos))) {
|
|
|
|
list_hpane.set_position (pos);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if ((done[2] = (allocation.get_width() > 1.0/pos))) {
|
2016-04-22 22:53:39 -04:00
|
|
|
paned_set_position_as_fraction (list_hpane, pos, false);
|
2016-04-22 22:17:55 -04:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2016-04-22 22:17:55 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (which == static_cast<Gtk::Paned*> (&inner_pane)) {
|
2016-03-03 11:47:01 -05:00
|
|
|
|
|
|
|
if (done[3]) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!geometry || (prop = geometry->property("mixer-inner-pane-pos")) == 0) {
|
|
|
|
pos = std::max ((float)100, rintf ((float) 125 * UIConfiguration::instance().get_ui_scale()));
|
|
|
|
} else {
|
2016-04-22 22:17:55 -04:00
|
|
|
pos = max (0.1, atof (prop->value ()));
|
2016-03-03 11:47:01 -05:00
|
|
|
}
|
|
|
|
|
2016-04-22 22:17:55 -04:00
|
|
|
if (pos > 1.0f) {
|
2016-04-22 23:02:21 -04:00
|
|
|
/* older versions of Ardour stored absolute position */
|
2016-04-22 22:17:55 -04:00
|
|
|
if ((done[3] = (allocation.get_width() > pos))) {
|
|
|
|
inner_pane.set_position (pos);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if ((done[3] = (allocation.get_width() > 1.0/pos))) {
|
2016-04-22 22:53:39 -04:00
|
|
|
paned_set_position_as_fraction (inner_pane, pos, false);
|
2016-04-22 22:17:55 -04:00
|
|
|
}
|
2016-03-03 11:47:01 -05:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
2016-03-03 11:47:01 -05:00
|
|
|
|
2009-10-28 17:36:40 -04:00
|
|
|
void
|
2011-06-01 13:00:29 -04:00
|
|
|
Mixer_UI::scroll_left ()
|
2009-10-28 17:36:40 -04:00
|
|
|
{
|
2013-07-13 08:58:23 -04:00
|
|
|
if (!scroller.get_hscrollbar()) return;
|
2009-10-28 17:36:40 -04:00
|
|
|
Adjustment* adj = scroller.get_hscrollbar()->get_adjustment();
|
|
|
|
/* stupid GTK: can't rely on clamping across versions */
|
|
|
|
scroller.get_hscrollbar()->set_value (max (adj->get_lower(), adj->get_value() - adj->get_step_increment()));
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::scroll_right ()
|
|
|
|
{
|
2013-07-13 08:58:23 -04:00
|
|
|
if (!scroller.get_hscrollbar()) return;
|
2009-10-28 17:36:40 -04:00
|
|
|
Adjustment* adj = scroller.get_hscrollbar()->get_adjustment();
|
|
|
|
/* stupid GTK: can't rely on clamping across versions */
|
|
|
|
scroller.get_hscrollbar()->set_value (min (adj->get_upper(), adj->get_value() + adj->get_step_increment()));
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-10-28 17:36:40 -04:00
|
|
|
bool
|
|
|
|
Mixer_UI::on_scroll_event (GdkEventScroll* ev)
|
|
|
|
{
|
|
|
|
switch (ev->direction) {
|
|
|
|
case GDK_SCROLL_LEFT:
|
|
|
|
scroll_left ();
|
|
|
|
return true;
|
|
|
|
case GDK_SCROLL_UP:
|
|
|
|
if (ev->state & Keyboard::TertiaryModifier) {
|
|
|
|
scroll_left ();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
|
|
|
|
case GDK_SCROLL_RIGHT:
|
|
|
|
scroll_right ();
|
|
|
|
return true;
|
|
|
|
|
|
|
|
case GDK_SCROLL_DOWN:
|
|
|
|
if (ev->state & Keyboard::TertiaryModifier) {
|
|
|
|
scroll_right ();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-06-20 13:15:33 -04:00
|
|
|
void
|
|
|
|
Mixer_UI::parameter_changed (string const & p)
|
|
|
|
{
|
|
|
|
if (p == "show-group-tabs") {
|
2009-12-17 13:24:23 -05:00
|
|
|
bool const s = _session->config.get_show_group_tabs ();
|
2009-06-20 13:15:33 -04:00
|
|
|
if (s) {
|
|
|
|
_group_tabs->show ();
|
|
|
|
} else {
|
|
|
|
_group_tabs->hide ();
|
|
|
|
}
|
2010-05-02 10:28:09 -04:00
|
|
|
} else if (p == "default-narrow_ms") {
|
2015-01-02 09:44:54 -05:00
|
|
|
bool const s = UIConfiguration::instance().get_default_narrow_ms ();
|
2010-05-02 10:28:09 -04:00
|
|
|
for (list<MixerStrip*>::iterator i = strips.begin(); i != strips.end(); ++i) {
|
|
|
|
(*i)->set_width_enum (s ? Narrow : Wide, this);
|
|
|
|
}
|
2015-12-19 11:42:36 -05:00
|
|
|
} else if (p == "use-monitor-bus") {
|
2016-02-10 18:52:36 -05:00
|
|
|
if (_session && !_session->monitor_out()) {
|
2015-12-19 11:42:36 -05:00
|
|
|
monitor_section_detached ();
|
|
|
|
}
|
2009-06-20 13:15:33 -04:00
|
|
|
}
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-06-21 15:59:56 -04:00
|
|
|
void
|
|
|
|
Mixer_UI::set_route_group_activation (RouteGroup* g, bool a)
|
|
|
|
{
|
|
|
|
g->set_active (a, this);
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-10-22 21:00:13 -04:00
|
|
|
PluginSelector*
|
2009-10-22 13:17:34 -04:00
|
|
|
Mixer_UI::plugin_selector()
|
|
|
|
{
|
2010-02-03 14:00:58 -05:00
|
|
|
#ifdef DEFER_PLUGIN_SELECTOR_LOAD
|
|
|
|
if (!_plugin_selector)
|
2011-11-14 12:41:29 -05:00
|
|
|
_plugin_selector = new PluginSelector (PluginManager::instance());
|
2010-02-03 14:00:58 -05:00
|
|
|
#endif
|
|
|
|
|
2009-10-22 21:00:13 -04:00
|
|
|
return _plugin_selector;
|
2009-10-22 13:17:34 -04:00
|
|
|
}
|
2011-01-09 14:09:49 -05:00
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::setup_track_display ()
|
|
|
|
{
|
|
|
|
track_model = ListStore::create (track_columns);
|
|
|
|
track_display.set_model (track_model);
|
|
|
|
track_display.append_column (_("Strips"), track_columns.text);
|
|
|
|
track_display.append_column (_("Show"), track_columns.visible);
|
|
|
|
track_display.get_column (0)->set_data (X_("colnum"), GUINT_TO_POINTER(0));
|
|
|
|
track_display.get_column (1)->set_data (X_("colnum"), GUINT_TO_POINTER(1));
|
|
|
|
track_display.get_column (0)->set_expand(true);
|
|
|
|
track_display.get_column (1)->set_expand(false);
|
2015-04-05 12:31:52 -04:00
|
|
|
track_display.get_column (0)->set_sizing (Gtk::TREE_VIEW_COLUMN_FIXED);
|
2012-12-07 17:38:49 -05:00
|
|
|
track_display.set_name (X_("EditGroupList"));
|
2011-01-09 14:09:49 -05:00
|
|
|
track_display.get_selection()->set_mode (Gtk::SELECTION_NONE);
|
|
|
|
track_display.set_reorderable (true);
|
|
|
|
track_display.set_headers_visible (true);
|
2015-09-15 15:21:01 -04:00
|
|
|
track_display.set_can_focus(false);
|
2011-01-09 14:09:49 -05:00
|
|
|
|
|
|
|
track_model->signal_row_deleted().connect (sigc::mem_fun (*this, &Mixer_UI::track_list_delete));
|
|
|
|
track_model->signal_rows_reordered().connect (sigc::mem_fun (*this, &Mixer_UI::track_list_reorder));
|
|
|
|
|
|
|
|
CellRendererToggle* track_list_visible_cell = dynamic_cast<CellRendererToggle*>(track_display.get_column_cell_renderer (1));
|
|
|
|
track_list_visible_cell->property_activatable() = true;
|
|
|
|
track_list_visible_cell->property_radio() = false;
|
2012-07-19 18:35:43 -04:00
|
|
|
track_list_visible_cell->signal_toggled().connect (sigc::mem_fun (*this, &Mixer_UI::track_visibility_changed));
|
2011-01-09 14:09:49 -05:00
|
|
|
|
|
|
|
track_display.signal_button_press_event().connect (sigc::mem_fun (*this, &Mixer_UI::track_display_button_press), false);
|
|
|
|
|
|
|
|
track_display_scroller.add (track_display);
|
|
|
|
track_display_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
|
|
|
|
|
2011-01-09 14:09:56 -05:00
|
|
|
VBox* v = manage (new VBox);
|
|
|
|
v->show ();
|
|
|
|
v->pack_start (track_display_scroller, true, true);
|
|
|
|
|
|
|
|
Button* b = manage (new Button);
|
|
|
|
b->show ();
|
|
|
|
Widget* w = manage (new Image (Stock::ADD, ICON_SIZE_BUTTON));
|
|
|
|
w->show ();
|
|
|
|
b->add (*w);
|
|
|
|
|
|
|
|
b->signal_clicked().connect (sigc::mem_fun (*this, &Mixer_UI::new_track_or_bus));
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2011-01-09 14:09:56 -05:00
|
|
|
v->pack_start (*b, false, false);
|
|
|
|
|
2011-01-09 14:09:49 -05:00
|
|
|
track_display_frame.set_name("BaseFrame");
|
|
|
|
track_display_frame.set_shadow_type (Gtk::SHADOW_IN);
|
2011-01-09 14:09:56 -05:00
|
|
|
track_display_frame.add (*v);
|
2011-01-09 14:09:49 -05:00
|
|
|
|
|
|
|
track_display_scroller.show();
|
|
|
|
track_display_frame.show();
|
|
|
|
track_display.show();
|
|
|
|
}
|
2011-01-09 14:09:56 -05:00
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::new_track_or_bus ()
|
|
|
|
{
|
2016-05-05 21:08:46 -04:00
|
|
|
ARDOUR_UI::instance()->add_route ();
|
2011-01-09 14:09:56 -05:00
|
|
|
}
|
2011-04-19 11:46:47 -04:00
|
|
|
|
2011-09-07 11:07:02 -04:00
|
|
|
void
|
|
|
|
Mixer_UI::update_title ()
|
|
|
|
{
|
2015-07-07 22:12:21 -04:00
|
|
|
if (!own_window()) {
|
|
|
|
return;
|
|
|
|
}
|
2015-07-09 12:40:51 -04:00
|
|
|
|
2011-09-07 11:07:02 -04:00
|
|
|
if (_session) {
|
|
|
|
string n;
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2011-09-07 11:07:02 -04:00
|
|
|
if (_session->snap_name() != _session->name()) {
|
|
|
|
n = _session->snap_name ();
|
|
|
|
} else {
|
|
|
|
n = _session->name ();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_session->dirty ()) {
|
|
|
|
n = "*" + n;
|
|
|
|
}
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2015-10-26 14:35:06 -04:00
|
|
|
WindowTitle title (n);
|
|
|
|
title += S_("Window|Mixer");
|
|
|
|
title += Glib::get_application_name ();
|
|
|
|
own_window()->set_title (title.get_string());
|
2011-09-07 11:07:02 -04:00
|
|
|
|
|
|
|
} else {
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2015-10-26 14:35:06 -04:00
|
|
|
WindowTitle title (S_("Window|Mixer"));
|
|
|
|
title += Glib::get_application_name ();
|
|
|
|
own_window()->set_title (title.get_string());
|
2011-09-07 11:07:02 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-04 13:53:21 -04:00
|
|
|
MixerStrip*
|
|
|
|
Mixer_UI::strip_by_x (int x)
|
|
|
|
{
|
|
|
|
for (list<MixerStrip*>::iterator i = strips.begin(); i != strips.end(); ++i) {
|
|
|
|
int x1, x2, y;
|
|
|
|
|
2015-07-07 22:12:21 -04:00
|
|
|
(*i)->translate_coordinates (_content, 0, 0, x1, y);
|
2011-11-04 13:53:21 -04:00
|
|
|
x2 = x1 + (*i)->get_width();
|
|
|
|
|
|
|
|
if (x >= x1 && x <= x2) {
|
|
|
|
return (*i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::set_route_targets_for_operation ()
|
|
|
|
{
|
|
|
|
_route_targets.clear ();
|
|
|
|
|
|
|
|
if (!_selection.empty()) {
|
|
|
|
_route_targets = _selection.routes;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-07-24 23:49:33 -04:00
|
|
|
// removed "implicit" selections of strips, after discussion on IRC
|
2014-07-24 13:30:11 -04:00
|
|
|
|
2011-11-04 13:53:21 -04:00
|
|
|
}
|
2012-01-17 20:30:44 -05:00
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::monitor_section_going_away ()
|
|
|
|
{
|
|
|
|
if (_monitor_section) {
|
2015-12-19 11:42:36 -05:00
|
|
|
monitor_section_detached ();
|
2012-01-17 20:30:44 -05:00
|
|
|
out_packer.remove (_monitor_section->tearoff());
|
|
|
|
_monitor_section->set_session (0);
|
2015-12-21 09:46:03 -05:00
|
|
|
delete _monitor_section;
|
|
|
|
_monitor_section = 0;
|
2012-01-17 20:30:44 -05:00
|
|
|
}
|
|
|
|
}
|
2012-11-12 21:19:04 -05:00
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::toggle_midi_input_active (bool flip_others)
|
|
|
|
{
|
|
|
|
boost::shared_ptr<RouteList> rl (new RouteList);
|
2013-07-28 14:32:52 -04:00
|
|
|
bool onoff = false;
|
2012-11-12 21:19:04 -05:00
|
|
|
|
|
|
|
set_route_targets_for_operation ();
|
|
|
|
|
|
|
|
for (RouteUISelection::iterator r = _route_targets.begin(); r != _route_targets.end(); ++r) {
|
|
|
|
boost::shared_ptr<MidiTrack> mt = (*r)->midi_track();
|
|
|
|
|
|
|
|
if (mt) {
|
|
|
|
rl->push_back ((*r)->route());
|
|
|
|
onoff = !mt->input_active();
|
|
|
|
}
|
|
|
|
}
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2012-11-12 21:19:04 -05:00
|
|
|
_session->set_exclusive_input_active (rl, onoff, flip_others);
|
|
|
|
}
|
2012-12-09 21:03:45 -05:00
|
|
|
|
2014-03-21 08:45:00 -04:00
|
|
|
void
|
|
|
|
Mixer_UI::maximise_mixer_space ()
|
|
|
|
{
|
2015-07-07 22:12:21 -04:00
|
|
|
if (!own_window()) {
|
2014-03-21 08:45:00 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-10-26 14:35:06 -04:00
|
|
|
if (_maximised) {
|
|
|
|
return;
|
2015-04-21 15:10:49 -04:00
|
|
|
}
|
2015-07-07 22:12:21 -04:00
|
|
|
|
|
|
|
_window->fullscreen ();
|
|
|
|
_maximised = true;
|
2014-03-21 08:45:00 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::restore_mixer_space ()
|
|
|
|
{
|
2015-07-07 22:12:21 -04:00
|
|
|
if (!own_window()) {
|
2014-03-21 08:45:00 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-10-26 14:35:06 -04:00
|
|
|
if (!_maximised) {
|
|
|
|
return;
|
2015-04-21 15:10:49 -04:00
|
|
|
}
|
2015-07-07 22:12:21 -04:00
|
|
|
|
|
|
|
own_window()->unfullscreen();
|
|
|
|
_maximised = false;
|
2014-03-21 08:45:00 -04:00
|
|
|
}
|
2015-12-19 11:42:36 -05:00
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::monitor_section_attached ()
|
|
|
|
{
|
|
|
|
Glib::RefPtr<Action> act = ActionManager::get_action ("Common", "ToggleMonitorSection");
|
|
|
|
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
|
|
|
|
act->set_sensitive (true);
|
|
|
|
tact->set_active ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::monitor_section_detached ()
|
|
|
|
{
|
|
|
|
Glib::RefPtr<Action> act = ActionManager::get_action ("Common", "ToggleMonitorSection");
|
|
|
|
act->set_sensitive (false);
|
|
|
|
}
|
2015-12-21 22:43:26 -05:00
|
|
|
|
2015-12-22 17:06:08 -05:00
|
|
|
void
|
|
|
|
Mixer_UI::store_current_favorite_order ()
|
|
|
|
{
|
|
|
|
typedef Gtk::TreeModel::Children type_children;
|
|
|
|
type_children children = favorite_plugins_model->children();
|
|
|
|
favorite_order.clear();
|
|
|
|
for(type_children::iterator iter = children.begin(); iter != children.end(); ++iter)
|
|
|
|
{
|
|
|
|
Gtk::TreeModel::Row row = *iter;
|
2015-12-25 10:10:09 -05:00
|
|
|
ARDOUR::PluginPresetPtr ppp = row[favorite_plugins_columns.plugin];
|
|
|
|
favorite_order.push_back (ppp->_pip);
|
2015-12-22 17:06:08 -05:00
|
|
|
std::string name = row[favorite_plugins_columns.name];
|
2015-12-25 18:43:59 -05:00
|
|
|
favorite_ui_state[(*ppp->_pip).unique_id] = favorite_plugins_display.row_expanded (favorite_plugins_model->get_path(iter));
|
2015-12-22 17:06:08 -05:00
|
|
|
}
|
|
|
|
}
|
2015-12-21 22:43:26 -05:00
|
|
|
|
2016-01-09 18:00:07 -05:00
|
|
|
void
|
|
|
|
Mixer_UI::save_favorite_ui_state (const TreeModel::iterator& iter, const TreeModel::Path& path)
|
|
|
|
{
|
|
|
|
Gtk::TreeModel::Row row = *iter;
|
|
|
|
ARDOUR::PluginPresetPtr ppp = row[favorite_plugins_columns.plugin];
|
|
|
|
assert (ppp);
|
|
|
|
favorite_ui_state[(*ppp->_pip).unique_id] = favorite_plugins_display.row_expanded (favorite_plugins_model->get_path(iter));
|
|
|
|
}
|
|
|
|
|
2015-12-21 22:43:26 -05:00
|
|
|
void
|
2015-12-22 17:06:08 -05:00
|
|
|
Mixer_UI::refiller (PluginInfoList& result, const PluginInfoList& plugs)
|
2015-12-21 22:43:26 -05:00
|
|
|
{
|
2015-12-22 17:06:08 -05:00
|
|
|
PluginManager& manager (PluginManager::instance());
|
2015-12-21 22:43:26 -05:00
|
|
|
for (PluginInfoList::const_iterator i = plugs.begin(); i != plugs.end(); ++i) {
|
|
|
|
if (manager.get_status (*i) != PluginManager::Favorite) {
|
|
|
|
continue;
|
|
|
|
}
|
2015-12-22 17:06:08 -05:00
|
|
|
result.push_back (*i);
|
2015-12-21 22:43:26 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-22 17:06:08 -05:00
|
|
|
struct PluginCustomSorter {
|
|
|
|
public:
|
|
|
|
bool operator() (PluginInfoPtr a, PluginInfoPtr b) const {
|
2016-01-08 15:12:48 -05:00
|
|
|
PluginInfoList::const_iterator aiter = _user.begin();
|
|
|
|
PluginInfoList::const_iterator biter = _user.begin();
|
2016-01-08 15:53:12 -05:00
|
|
|
while (aiter != _user.end()) { if ((*aiter)->unique_id == a->unique_id) { break; } ++aiter; }
|
|
|
|
while (biter != _user.end()) { if ((*biter)->unique_id == b->unique_id) { break; } ++biter; }
|
2015-12-22 17:06:08 -05:00
|
|
|
|
|
|
|
if (aiter != _user.end() && biter != _user.end()) {
|
2016-01-08 15:12:48 -05:00
|
|
|
return std::distance (_user.begin(), aiter) < std::distance (_user.begin(), biter);
|
2015-12-22 17:06:08 -05:00
|
|
|
}
|
|
|
|
if (aiter != _user.end()) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (biter != _user.end()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return ARDOUR::cmp_nocase((*a).name, (*b).name) == -1;
|
|
|
|
}
|
|
|
|
PluginCustomSorter(PluginInfoList user) : _user (user) {}
|
|
|
|
private:
|
|
|
|
PluginInfoList _user;
|
|
|
|
};
|
|
|
|
|
2015-12-21 22:43:26 -05:00
|
|
|
void
|
|
|
|
Mixer_UI::refill_favorite_plugins ()
|
|
|
|
{
|
2015-12-22 17:06:08 -05:00
|
|
|
PluginInfoList plugs;
|
2015-12-21 22:43:26 -05:00
|
|
|
PluginManager& mgr (PluginManager::instance());
|
|
|
|
|
|
|
|
#ifdef LV2_SUPPORT
|
2015-12-22 17:06:08 -05:00
|
|
|
refiller (plugs, mgr.lv2_plugin_info ());
|
2015-12-21 22:43:26 -05:00
|
|
|
#endif
|
|
|
|
#ifdef WINDOWS_VST_SUPPORT
|
2015-12-22 17:06:08 -05:00
|
|
|
refiller (plugs, mgr.windows_vst_plugin_info ());
|
2015-12-21 22:43:26 -05:00
|
|
|
#endif
|
|
|
|
#ifdef LXVST_SUPPORT
|
2015-12-22 17:06:08 -05:00
|
|
|
refiller (plugs, mgr.lxvst_plugin_info ());
|
2015-12-21 22:43:26 -05:00
|
|
|
#endif
|
|
|
|
#ifdef AUDIOUNIT_SUPPORT
|
2015-12-22 17:06:08 -05:00
|
|
|
refiller (plugs, mgr.au_plugin_info ());
|
2015-12-21 22:43:26 -05:00
|
|
|
#endif
|
2015-12-22 17:06:08 -05:00
|
|
|
refiller (plugs, mgr.ladspa_plugin_info ());
|
2016-04-28 19:26:46 -04:00
|
|
|
refiller (plugs, mgr.lua_plugin_info ());
|
2015-12-22 17:06:08 -05:00
|
|
|
|
|
|
|
store_current_favorite_order ();
|
|
|
|
|
|
|
|
PluginCustomSorter cmp (favorite_order);
|
|
|
|
plugs.sort (cmp);
|
|
|
|
|
|
|
|
favorite_order = plugs;
|
|
|
|
|
|
|
|
sync_treeview_from_favorite_order ();
|
|
|
|
}
|
|
|
|
|
2016-01-09 18:00:07 -05:00
|
|
|
void
|
|
|
|
Mixer_UI::sync_treeview_favorite_ui_state (const TreeModel::Path& path, const TreeModel::iterator&)
|
|
|
|
{
|
|
|
|
TreeIter iter;
|
|
|
|
if (!(iter = favorite_plugins_model->get_iter (path))) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ARDOUR::PluginPresetPtr ppp = (*iter)[favorite_plugins_columns.plugin];
|
|
|
|
if (!ppp) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
PluginInfoPtr pip = ppp->_pip;
|
|
|
|
if (favorite_ui_state.find (pip->unique_id) != favorite_ui_state.end ()) {
|
|
|
|
if (favorite_ui_state[pip->unique_id]) {
|
|
|
|
favorite_plugins_display.expand_row (path, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-22 17:06:08 -05:00
|
|
|
void
|
|
|
|
Mixer_UI::sync_treeview_from_favorite_order ()
|
|
|
|
{
|
|
|
|
favorite_plugins_model->clear ();
|
|
|
|
for (PluginInfoList::const_iterator i = favorite_order.begin(); i != favorite_order.end(); ++i) {
|
2015-12-25 10:10:09 -05:00
|
|
|
PluginInfoPtr pip = (*i);
|
|
|
|
|
2015-12-22 17:06:08 -05:00
|
|
|
TreeModel::Row newrow = *(favorite_plugins_model->append());
|
|
|
|
newrow[favorite_plugins_columns.name] = (*i)->name;
|
2015-12-25 10:10:09 -05:00
|
|
|
newrow[favorite_plugins_columns.plugin] = PluginPresetPtr (new PluginPreset(pip));
|
|
|
|
if (!_session) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2016-01-09 09:22:40 -05:00
|
|
|
vector<ARDOUR::Plugin::PresetRecord> presets = (*i)->get_presets (true);
|
2015-12-25 10:10:09 -05:00
|
|
|
for (vector<ARDOUR::Plugin::PresetRecord>::const_iterator j = presets.begin(); j != presets.end(); ++j) {
|
|
|
|
Gtk::TreeModel::Row child_row = *(favorite_plugins_model->append (newrow.children()));
|
|
|
|
child_row[favorite_plugins_columns.name] = (*j).label;
|
|
|
|
child_row[favorite_plugins_columns.plugin] = PluginPresetPtr (new PluginPreset(pip, &(*j)));
|
|
|
|
}
|
2015-12-26 09:51:02 -05:00
|
|
|
if (favorite_ui_state.find (pip->unique_id) != favorite_ui_state.end ()) {
|
|
|
|
if (favorite_ui_state[pip->unique_id]) {
|
2015-12-25 18:43:59 -05:00
|
|
|
favorite_plugins_display.expand_row (favorite_plugins_model->get_path(newrow), true);
|
|
|
|
}
|
2015-12-26 09:51:02 -05:00
|
|
|
}
|
2015-12-22 17:06:08 -05:00
|
|
|
}
|
2015-12-21 22:43:26 -05:00
|
|
|
}
|
2015-12-25 10:10:09 -05:00
|
|
|
|
2015-12-25 11:11:47 -05:00
|
|
|
void
|
2015-12-26 18:37:53 -05:00
|
|
|
Mixer_UI::popup_note_context_menu (GdkEventButton *ev)
|
2015-12-25 11:11:47 -05:00
|
|
|
{
|
2015-12-26 18:37:53 -05:00
|
|
|
using namespace Gtk::Menu_Helpers;
|
|
|
|
|
|
|
|
Gtk::Menu* m = manage (new Menu);
|
|
|
|
MenuList& items = m->items ();
|
|
|
|
|
|
|
|
if (_selection.routes.empty()) {
|
|
|
|
items.push_back (MenuElem (_("No Track/Bus is selected.")));
|
2015-12-27 12:17:45 -05:00
|
|
|
} else {
|
|
|
|
items.push_back (MenuElem (_("Add at the top"),
|
|
|
|
sigc::bind (sigc::mem_fun (*this, &Mixer_UI::add_selected_processor), AddTop)));
|
|
|
|
items.push_back (MenuElem (_("Add Pre-Fader"),
|
|
|
|
sigc::bind (sigc::mem_fun (*this, &Mixer_UI::add_selected_processor), AddPreFader)));
|
|
|
|
items.push_back (MenuElem (_("Add Post-Fader"),
|
|
|
|
sigc::bind (sigc::mem_fun (*this, &Mixer_UI::add_selected_processor), AddPostFader)));
|
|
|
|
items.push_back (MenuElem (_("Add at the end"),
|
|
|
|
sigc::bind (sigc::mem_fun (*this, &Mixer_UI::add_selected_processor), AddBottom)));
|
|
|
|
}
|
2015-12-27 21:19:28 -05:00
|
|
|
|
2015-12-27 12:17:45 -05:00
|
|
|
items.push_back (SeparatorElem());
|
2015-12-27 21:19:28 -05:00
|
|
|
|
2015-12-27 12:17:45 -05:00
|
|
|
items.push_back (MenuElem (_("Remove from favorites"), sigc::mem_fun (*this, &Mixer_UI::remove_selected_from_favorites)));
|
2015-12-27 21:19:28 -05:00
|
|
|
|
|
|
|
ARDOUR::PluginPresetPtr ppp = selected_plugin();
|
2016-01-07 16:34:19 -05:00
|
|
|
if (ppp && ppp->_preset.valid && ppp->_preset.user) {
|
2016-01-13 12:01:39 -05:00
|
|
|
// we cannot currently delete AU presets
|
|
|
|
if (!ppp->_pip || ppp->_pip->type != AudioUnit) {
|
|
|
|
items.push_back (MenuElem (_("Delete Preset"), sigc::mem_fun (*this, &Mixer_UI::delete_selected_preset)));
|
|
|
|
}
|
2015-12-27 21:19:28 -05:00
|
|
|
}
|
|
|
|
|
2015-12-26 18:37:53 -05:00
|
|
|
m->popup (ev->button, ev->time);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
Mixer_UI::plugin_row_button_press (GdkEventButton *ev)
|
|
|
|
{
|
|
|
|
if ((ev->type == GDK_BUTTON_PRESS) && (ev->button == 3) ) {
|
2015-12-28 11:03:40 -05:00
|
|
|
TreeModel::Path path;
|
|
|
|
TreeViewColumn* column;
|
|
|
|
int cellx, celly;
|
|
|
|
if (favorite_plugins_display.get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly)) {
|
|
|
|
Glib::RefPtr<Gtk::TreeView::Selection> selection = favorite_plugins_display.get_selection();
|
|
|
|
if (selection) {
|
|
|
|
selection->unselect_all();
|
|
|
|
selection->select(path);
|
|
|
|
}
|
|
|
|
}
|
2016-01-07 08:35:10 -05:00
|
|
|
ARDOUR::PluginPresetPtr ppp = selected_plugin();
|
|
|
|
if (ppp) {
|
|
|
|
popup_note_context_menu (ev);
|
|
|
|
}
|
2015-12-26 18:37:53 -05:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-12-27 21:19:28 -05:00
|
|
|
|
|
|
|
PluginPresetPtr
|
|
|
|
Mixer_UI::selected_plugin ()
|
2015-12-26 18:37:53 -05:00
|
|
|
{
|
|
|
|
Glib::RefPtr<Gtk::TreeView::Selection> selection = favorite_plugins_display.get_selection();
|
|
|
|
if (!selection) {
|
2015-12-27 21:19:28 -05:00
|
|
|
return PluginPresetPtr();
|
2015-12-26 18:37:53 -05:00
|
|
|
}
|
|
|
|
Gtk::TreeModel::iterator iter = selection->get_selected();
|
|
|
|
if (!iter) {
|
2015-12-27 21:19:28 -05:00
|
|
|
return PluginPresetPtr();
|
2015-12-26 18:37:53 -05:00
|
|
|
}
|
2015-12-27 21:19:28 -05:00
|
|
|
return (*iter)[favorite_plugins_columns.plugin];
|
2015-12-26 18:37:53 -05:00
|
|
|
}
|
|
|
|
|
2015-12-27 12:17:45 -05:00
|
|
|
void
|
2015-12-27 21:19:28 -05:00
|
|
|
Mixer_UI::add_selected_processor (ProcessorPosition pos)
|
2015-12-27 12:17:45 -05:00
|
|
|
{
|
2015-12-27 21:19:28 -05:00
|
|
|
ARDOUR::PluginPresetPtr ppp = selected_plugin();
|
|
|
|
if (ppp) {
|
|
|
|
add_favorite_processor (ppp, pos);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::delete_selected_preset ()
|
|
|
|
{
|
|
|
|
if (!_session) {
|
2015-12-27 12:17:45 -05:00
|
|
|
return;
|
|
|
|
}
|
2015-12-27 21:19:28 -05:00
|
|
|
ARDOUR::PluginPresetPtr ppp = selected_plugin();
|
2016-01-07 16:34:19 -05:00
|
|
|
if (!ppp || !ppp->_preset.valid || !ppp->_preset.user) {
|
2015-12-27 21:19:28 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
PluginPtr plugin = ppp->_pip->load (*_session);
|
|
|
|
plugin->get_presets();
|
|
|
|
plugin->remove_preset (ppp->_preset.label);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::remove_selected_from_favorites ()
|
|
|
|
{
|
|
|
|
ARDOUR::PluginPresetPtr ppp = selected_plugin();
|
|
|
|
if (!ppp) {
|
2015-12-27 12:17:45 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
PluginManager::PluginStatusType status = PluginManager::Normal;
|
|
|
|
PluginManager& manager (PluginManager::instance());
|
|
|
|
|
|
|
|
manager.set_status (ppp->_pip->type, ppp->_pip->unique_id, status);
|
|
|
|
manager.save_statuses ();
|
|
|
|
}
|
|
|
|
|
2015-12-26 18:37:53 -05:00
|
|
|
void
|
|
|
|
Mixer_UI::plugin_row_activated (const TreeModel::Path& path, TreeViewColumn* column)
|
|
|
|
{
|
2015-12-25 11:11:47 -05:00
|
|
|
TreeIter iter;
|
|
|
|
if (!(iter = favorite_plugins_model->get_iter (path))) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ARDOUR::PluginPresetPtr ppp = (*iter)[favorite_plugins_columns.plugin];
|
2015-12-26 18:37:53 -05:00
|
|
|
add_favorite_processor (ppp, AddPreFader); // TODO: preference?!
|
|
|
|
}
|
2015-12-25 11:11:47 -05:00
|
|
|
|
2015-12-26 18:37:53 -05:00
|
|
|
void
|
|
|
|
Mixer_UI::add_favorite_processor (ARDOUR::PluginPresetPtr ppp, ProcessorPosition pos)
|
|
|
|
{
|
|
|
|
if (!_session || _selection.routes.empty()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
PluginInfoPtr pip = ppp->_pip;
|
2015-12-25 11:11:47 -05:00
|
|
|
for (RouteUISelection::iterator i = _selection.routes.begin(); i != _selection.routes.end(); ++i) {
|
|
|
|
boost::shared_ptr<ARDOUR::Route> rt = (*i)->route();
|
|
|
|
if (!rt) { continue; }
|
|
|
|
|
|
|
|
PluginPtr p = pip->load (*_session);
|
|
|
|
if (!p) { continue; }
|
|
|
|
|
|
|
|
if (ppp->_preset.valid) {
|
|
|
|
p->load_preset (ppp->_preset);
|
|
|
|
}
|
|
|
|
|
|
|
|
Route::ProcessorStreams err;
|
|
|
|
boost::shared_ptr<Processor> processor (new PluginInsert (*_session, p));
|
2015-12-26 18:37:53 -05:00
|
|
|
|
|
|
|
switch (pos) {
|
|
|
|
case AddTop:
|
|
|
|
rt->add_processor_by_index (processor, 0, &err, Config->get_new_plugins_active ());
|
|
|
|
break;
|
|
|
|
case AddPreFader:
|
|
|
|
rt->add_processor (processor, PreFader, &err, Config->get_new_plugins_active ());
|
|
|
|
break;
|
|
|
|
case AddPostFader:
|
2015-12-27 09:32:24 -05:00
|
|
|
{
|
|
|
|
int idx = 0;
|
2016-05-01 07:11:43 -04:00
|
|
|
int pos = 0;
|
2015-12-27 09:32:24 -05:00
|
|
|
for (;;++idx) {
|
|
|
|
boost::shared_ptr<Processor> np = rt->nth_processor (idx);
|
2016-05-01 07:11:43 -04:00
|
|
|
if (!np) {
|
2015-12-27 09:32:24 -05:00
|
|
|
break;
|
|
|
|
}
|
2016-05-01 07:11:43 -04:00
|
|
|
if (!np->display_to_user()) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (boost::dynamic_pointer_cast<Amp> (np) && // Fader, not Trim
|
|
|
|
boost::dynamic_pointer_cast<Amp> (np)->gain_control()->parameter().type() == GainAutomation) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
++pos;
|
2015-12-27 09:32:24 -05:00
|
|
|
}
|
2016-05-01 07:11:43 -04:00
|
|
|
rt->add_processor_by_index (processor, ++pos, &err, Config->get_new_plugins_active ());
|
2015-12-27 09:32:24 -05:00
|
|
|
}
|
2015-12-26 18:37:53 -05:00
|
|
|
break;
|
|
|
|
case AddBottom:
|
|
|
|
rt->add_processor_by_index (processor, -1, &err, Config->get_new_plugins_active ());
|
|
|
|
break;
|
|
|
|
}
|
2015-12-25 11:11:47 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-25 10:10:09 -05:00
|
|
|
bool
|
|
|
|
PluginTreeStore::row_drop_possible_vfunc(const Gtk::TreeModel::Path& dest, const Gtk::SelectionData& data) const
|
|
|
|
{
|
|
|
|
if (data.get_target() != "GTK_TREE_MODEL_ROW") {
|
|
|
|
return false;
|
|
|
|
}
|
2016-01-09 18:25:04 -05:00
|
|
|
|
|
|
|
// only allow to re-order top-level items
|
|
|
|
TreePath src;
|
|
|
|
if (TreePath::get_from_selection_data (data, src)) {
|
|
|
|
if (src.up() && src.up()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// don't allow to drop as child-rows.
|
2015-12-25 10:10:09 -05:00
|
|
|
Gtk::TreeModel::Path _dest = dest; // un const
|
|
|
|
const bool is_child = _dest.up (); // explicit bool for clang
|
|
|
|
if (!is_child || _dest.empty ()) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2015-12-27 22:11:45 -05:00
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::plugin_drop (const Glib::RefPtr<Gdk::DragContext>&, const Gtk::SelectionData& data)
|
|
|
|
{
|
|
|
|
if (data.get_target() != "PluginPresetPtr") {
|
|
|
|
return;
|
|
|
|
}
|
2015-12-28 10:08:35 -05:00
|
|
|
if (data.get_length() != sizeof (PluginPresetPtr)) {
|
|
|
|
return;
|
|
|
|
}
|
2015-12-27 22:11:45 -05:00
|
|
|
const void *d = data.get_data();
|
|
|
|
const PluginPresetPtr ppp = *(static_cast<const PluginPresetPtr*> (d));
|
|
|
|
|
|
|
|
PluginManager::PluginStatusType status = PluginManager::Favorite;
|
|
|
|
PluginManager& manager (PluginManager::instance());
|
|
|
|
|
|
|
|
manager.set_status (ppp->_pip->type, ppp->_pip->unique_id, status);
|
|
|
|
manager.save_statuses ();
|
|
|
|
}
|
2016-02-29 21:26:45 -05:00
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::do_vca_assign (boost::shared_ptr<VCA> vca)
|
|
|
|
{
|
|
|
|
/* call protected MixerActor:: method */
|
|
|
|
vca_assign (vca);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::do_vca_unassign (boost::shared_ptr<VCA> vca)
|
|
|
|
{
|
|
|
|
/* call protected MixerActor:: method */
|
|
|
|
vca_unassign (vca);
|
|
|
|
}
|
2016-05-18 15:56:52 -04:00
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::show_vca_slaves (boost::shared_ptr<VCA> vca)
|
|
|
|
{
|
|
|
|
boost::shared_ptr<VCA> v = spilled_vca.lock();
|
|
|
|
if (v != vca) {
|
|
|
|
spilled_vca = vca;
|
|
|
|
show_vca_change (vca); /* EMIT SIGNAL */
|
2016-05-18 17:36:06 -04:00
|
|
|
redisplay_track_list ();
|
2016-05-18 15:56:52 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
Mixer_UI::showing_vca_slaves_for (boost::shared_ptr<VCA> vca) const
|
|
|
|
{
|
|
|
|
return vca == spilled_vca.lock();
|
|
|
|
}
|