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"
|
2009-11-16 16:07:16 -05:00
|
|
|
#include "pbd/stacktrace.h"
|
2006-06-07 10:54:12 -04:00
|
|
|
#include <glibmm/thread.h>
|
2006-04-25 16:23:50 -04:00
|
|
|
|
2005-09-25 16:33:00 -04:00
|
|
|
#include <gtkmm2ext/gtk_ui.h>
|
|
|
|
#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>
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "ardour/plugin_manager.h"
|
|
|
|
#include "ardour/route_group.h"
|
|
|
|
#include "ardour/session.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"
|
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"
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
#include "i18n.h"
|
|
|
|
|
|
|
|
using namespace ARDOUR;
|
2006-06-21 19:01:03 -04:00
|
|
|
using namespace PBD;
|
2005-09-25 14:42:24 -04:00
|
|
|
using namespace Gtk;
|
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;
|
|
|
|
|
2011-11-15 14:33:09 -05:00
|
|
|
Mixer_UI* Mixer_UI::_instance = 0;
|
|
|
|
|
|
|
|
Mixer_UI*
|
|
|
|
Mixer_UI::instance ()
|
|
|
|
{
|
|
|
|
if (!_instance) {
|
|
|
|
_instance = new Mixer_UI;
|
|
|
|
}
|
|
|
|
|
|
|
|
return _instance;
|
|
|
|
}
|
|
|
|
|
2007-04-11 09:07:51 -04:00
|
|
|
Mixer_UI::Mixer_UI ()
|
|
|
|
: Window (Gtk::WINDOW_TOPLEVEL)
|
2011-11-15 14:33:09 -05:00
|
|
|
, _following_editor_selection (false)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2011-11-04 13:53:21 -04:00
|
|
|
/* allow this window to become the key focus window */
|
|
|
|
set_flags (CAN_FOCUS);
|
|
|
|
|
2008-02-16 17:43:18 -05:00
|
|
|
_strip_width = Config->get_default_narrow_ms() ? Narrow : Wide;
|
2005-09-25 14:42:24 -04:00
|
|
|
track_menu = 0;
|
2010-03-18 22:49:01 -04:00
|
|
|
_monitor_section = 0;
|
2006-01-11 22:43:52 -05:00
|
|
|
no_track_list_redisplay = false;
|
2006-03-09 18:44:39 -05:00
|
|
|
in_group_row_change = false;
|
2006-08-30 16:48:16 -04:00
|
|
|
_visible = false;
|
2008-12-08 13:16:12 -05:00
|
|
|
strip_redisplay_does_not_reset_order_keys = false;
|
|
|
|
strip_redisplay_does_not_sync_order_keys = false;
|
2007-10-11 18:07:47 -04:00
|
|
|
ignore_sync = false;
|
|
|
|
|
2012-04-25 08:58:19 -04:00
|
|
|
Route::SyncOrderKeys.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::sync_order_keys, this, _1), gui_context());
|
2005-09-25 14:42:24 -04: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));
|
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);
|
2011-02-01 17:39:03 -05:00
|
|
|
scroller.set_policy (Gtk::POLICY_AUTOMATIC, 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);
|
2006-02-14 14:12:35 -05:00
|
|
|
group_display.set_name ("MixerGroupList");
|
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);
|
|
|
|
|
|
|
|
/* 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
|
|
|
|
2006-05-19 13:29:05 -04:00
|
|
|
rhs_pane1.pack1 (track_display_frame);
|
|
|
|
rhs_pane1.pack2 (group_display_frame);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
list_vpacker.pack_start (rhs_pane1, true, true);
|
|
|
|
|
|
|
|
global_hpacker.pack_start (scroller, true, true);
|
2008-10-22 02:41:51 -04:00
|
|
|
#ifdef GTKOSX
|
|
|
|
/* current gtk-quartz has dirty updates on borders like this one */
|
|
|
|
global_hpacker.pack_start (out_packer, false, false, 0);
|
|
|
|
#else
|
2006-11-16 14:34:57 -05:00
|
|
|
global_hpacker.pack_start (out_packer, false, false, 12);
|
2008-10-22 02:41:51 -04:00
|
|
|
#endif
|
2011-08-16 10:45:19 -04:00
|
|
|
list_hpane.pack1(list_vpacker, true, true);
|
|
|
|
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)));
|
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)));
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
global_vpacker.pack_start (list_hpane, true, true);
|
|
|
|
|
|
|
|
add (global_vpacker);
|
|
|
|
set_name ("MixerWindow");
|
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
|
|
|
|
2010-08-16 20:28:20 -04:00
|
|
|
set_wmclass (X_("ardour_mixer"), PROGRAM_NAME);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-12-11 18:29:48 -05:00
|
|
|
signal_delete_event().connect (sigc::mem_fun (*this, &Mixer_UI::hide_window));
|
2005-09-25 16:33:00 -04:00
|
|
|
add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-12-11 18:29:48 -05:00
|
|
|
signal_configure_event().connect (sigc::mem_fun (*ARDOUR_UI::instance(), &ARDOUR_UI::configure_handler));
|
2005-09-25 14:42:24 -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
|
|
|
|
|
|
|
global_hpacker.show();
|
|
|
|
global_vpacker.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();
|
|
|
|
group_display_vbox.show();
|
|
|
|
group_display_frame.show();
|
|
|
|
rhs_pane1.show();
|
|
|
|
strip_packer.show();
|
|
|
|
out_packer.show();
|
|
|
|
list_hpane.show();
|
|
|
|
group_display.show();
|
2008-04-11 10:06:50 -04:00
|
|
|
|
2011-04-19 21:24:40 -04:00
|
|
|
_in_group_rebuild_or_clear = false;
|
2011-04-19 11:46:47 -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
|
|
|
|
2010-03-10 12:31:16 -05:00
|
|
|
MonitorSection::setup_knob_images ();
|
|
|
|
|
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 ());
|
2010-02-03 14:00:58 -05:00
|
|
|
#endif
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
Mixer_UI::~Mixer_UI ()
|
|
|
|
{
|
2012-01-17 20:30:44 -05:00
|
|
|
if (_monitor_section) {
|
|
|
|
delete _monitor_section;
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
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));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void
|
|
|
|
Mixer_UI::ensure_float (Window& win)
|
|
|
|
{
|
|
|
|
win.set_transient_for (*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::show_window ()
|
|
|
|
{
|
2007-07-10 15:11:59 -04:00
|
|
|
present ();
|
2008-10-19 03:55:42 -04:00
|
|
|
if (!_visible) {
|
|
|
|
set_window_pos_and_size ();
|
2008-12-12 09:43:24 -05:00
|
|
|
|
2011-02-21 19:11:32 -05:00
|
|
|
/* show/hide group tabs as required */
|
|
|
|
parameter_changed ("show-group-tabs");
|
|
|
|
|
2008-10-19 03:55:42 -04:00
|
|
|
/* now reset each strips width so the right widgets are shown */
|
|
|
|
MixerStrip* ms;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-10-19 03:55:42 -04:00
|
|
|
TreeModel::Children rows = track_model->children();
|
|
|
|
TreeModel::Children::iterator ri;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-10-19 03:55:42 -04:00
|
|
|
for (ri = rows.begin(); ri != rows.end(); ++ri) {
|
|
|
|
ms = (*ri)[track_columns.strip];
|
2009-06-20 13:15:33 -04:00
|
|
|
ms->set_width_enum (ms->get_width_enum (), ms->width_owner());
|
2011-10-29 16:08:48 -04:00
|
|
|
/* Fix visibility of mixer strip stuff */
|
|
|
|
ms->parameter_changed (X_("mixer-strip-visibility"));
|
2008-10-19 03:55:42 -04:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2011-11-04 13:53:21 -04:00
|
|
|
|
|
|
|
/* force focus into main area */
|
|
|
|
scroller_base.grab_focus ();
|
|
|
|
|
2006-08-30 16:48:16 -04:00
|
|
|
_visible = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
Mixer_UI::hide_window (GdkEventAny *ev)
|
|
|
|
{
|
2007-07-17 22:27:07 -04:00
|
|
|
get_window_pos_and_size ();
|
|
|
|
|
2006-08-30 16:48:16 -04:00
|
|
|
_visible = false;
|
|
|
|
return just_hide_it(ev, static_cast<Gtk::Window *>(this));
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2006-08-30 16:48:16 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void
|
2009-01-30 02:40:13 -05:00
|
|
|
Mixer_UI::add_strip (RouteList& routes)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2009-12-11 18:29:48 -05:00
|
|
|
ENSURE_GUI_THREAD (*this, &Mixer_UI::add_strip, routes)
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
MixerStrip* strip;
|
2005-11-29 17:48:54 -05:00
|
|
|
|
2008-12-08 13:16:12 -05:00
|
|
|
no_track_list_redisplay = true;
|
|
|
|
strip_redisplay_does_not_sync_order_keys = true;
|
|
|
|
|
2009-01-30 02:40:13 -05:00
|
|
|
for (RouteList::iterator x = routes.begin(); x != routes.end(); ++x) {
|
2006-08-16 22:12:20 -04:00
|
|
|
boost::shared_ptr<Route> route = (*x);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2007-06-29 00:02:58 -04:00
|
|
|
if (route->is_hidden()) {
|
2010-03-10 12:31:16 -05:00
|
|
|
continue;
|
2006-08-16 22:12:20 -04:00
|
|
|
}
|
2009-08-29 20:40:48 -04:00
|
|
|
|
2010-03-23 08:19:21 -04:00
|
|
|
if (route->is_monitor()) {
|
2012-01-17 20:30:44 -05:00
|
|
|
|
2010-03-18 22:49:01 -04:00
|
|
|
if (!_monitor_section) {
|
|
|
|
_monitor_section = new MonitorSection (_session);
|
2012-01-17 20:30:44 -05:00
|
|
|
|
|
|
|
XMLNode* mnode = ARDOUR_UI::instance()->tearoff_settings (X_("monitor-section"));
|
|
|
|
if (mnode) {
|
|
|
|
_monitor_section->tearoff().set_state (*mnode);
|
|
|
|
}
|
|
|
|
}
|
2010-03-18 22:49:01 -04:00
|
|
|
|
2012-01-17 20:30:44 -05:00
|
|
|
out_packer.pack_end (_monitor_section->tearoff(), false, false);
|
|
|
|
_monitor_section->set_session (_session);
|
2010-03-19 16:53:22 -04:00
|
|
|
_monitor_section->tearoff().show_all ();
|
|
|
|
|
2012-04-25 08:58:19 -04:00
|
|
|
route->DropReferences.connect (*this, invalidator(*this), boost::bind (&Mixer_UI::monitor_section_going_away, this), gui_context());
|
2010-03-18 22:49:01 -04:00
|
|
|
|
|
|
|
/* no regular strip shown for control out */
|
|
|
|
|
2010-03-10 12:31:16 -05:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
strip = new MixerStrip (*this, _session, route);
|
2006-08-16 22:12:20 -04:00
|
|
|
strips.push_back (strip);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-01-10 17:22:29 -05:00
|
|
|
Config->get_default_narrow_ms() ? _strip_width = Narrow : _strip_width = Wide;
|
|
|
|
|
2007-04-29 18:39:21 -04:00
|
|
|
if (strip->width_owner() != strip) {
|
2009-06-20 13:15:33 -04:00
|
|
|
strip->set_width_enum (_strip_width, this);
|
2007-04-29 18:39:21 -04:00
|
|
|
}
|
|
|
|
|
2006-08-16 22:12:20 -04:00
|
|
|
show_strip (strip);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-08-16 22:12:20 -04:00
|
|
|
TreeModel::Row row = *(track_model->append());
|
|
|
|
row[track_columns.text] = route->name();
|
2011-07-16 17:29:06 -04:00
|
|
|
row[track_columns.visible] = strip->route()->is_master() ? true : strip->marked_for_display();
|
2006-08-16 22:12:20 -04:00
|
|
|
row[track_columns.route] = route;
|
|
|
|
row[track_columns.strip] = strip;
|
2007-10-11 18:07:47 -04:00
|
|
|
|
2008-12-08 13:16:12 -05:00
|
|
|
if (route->order_key (N_("signal")) == -1) {
|
|
|
|
route->set_order_key (N_("signal"), track_model->children().size()-1);
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2012-04-25 08:58:19 -04:00
|
|
|
route->PropertyChanged.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::strip_property_changed, this, _1, strip), gui_context());
|
2008-12-08 13:16:12 -05:00
|
|
|
|
2009-12-11 18:29:48 -05: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));
|
2006-08-16 22:12:20 -04:00
|
|
|
}
|
2008-12-08 13:16:12 -05:00
|
|
|
|
|
|
|
no_track_list_redisplay = false;
|
|
|
|
|
|
|
|
redisplay_track_list ();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-12-08 13:16:12 -05:00
|
|
|
strip_redisplay_does_not_sync_order_keys = false;
|
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;
|
2012-01-17 20:30:44 -05:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
if ((i = find (strips.begin(), strips.end(), strip)) != strips.end()) {
|
|
|
|
strips.erase (i);
|
|
|
|
}
|
2012-01-17 20:30:44 -05:00
|
|
|
|
2008-12-08 13:16:12 -05:00
|
|
|
strip_redisplay_does_not_sync_order_keys = true;
|
2012-01-17 20:30:44 -05: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) {
|
|
|
|
track_model->erase (ri);
|
2005-09-25 14:42:24 -04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2012-01-17 20:30:44 -05:00
|
|
|
|
2008-12-08 13:16:12 -05:00
|
|
|
strip_redisplay_does_not_sync_order_keys = false;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
void
|
2009-07-04 08:40:26 -04:00
|
|
|
Mixer_UI::sync_order_keys (string const & src)
|
2007-10-11 18:07:47 -04:00
|
|
|
{
|
|
|
|
TreeModel::Children rows = track_model->children();
|
|
|
|
TreeModel::Children::iterator ri;
|
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
if (src == N_("signal") || !_session || (_session->state_of_the_state() & (Session::Loading|Session::Deletion)) || rows.empty()) {
|
2007-10-11 18:07:47 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-10-22 20:05:50 -04:00
|
|
|
std::map<int,int> keys;
|
2007-10-11 18:07:47 -04:00
|
|
|
|
2008-12-08 13:16:12 -05:00
|
|
|
bool changed = false;
|
|
|
|
|
2009-10-22 20:05:50 -04:00
|
|
|
unsigned order = 0;
|
|
|
|
for (ri = rows.begin(); ri != rows.end(); ++ri, ++order) {
|
2007-10-11 18:07:47 -04:00
|
|
|
boost::shared_ptr<Route> route = (*ri)[track_columns.route];
|
2009-10-02 07:16:15 -04:00
|
|
|
unsigned int old_key = order;
|
2009-09-08 22:09:04 -04:00
|
|
|
unsigned int new_key = route->order_key (N_("signal"));
|
2008-12-08 13:16:12 -05:00
|
|
|
|
2009-10-22 20:05:50 -04:00
|
|
|
keys[new_key] = old_key;
|
2008-12-08 13:16:12 -05:00
|
|
|
|
|
|
|
if (new_key != old_key) {
|
|
|
|
changed = true;
|
|
|
|
}
|
2007-10-11 18:07:47 -04:00
|
|
|
}
|
2009-11-16 16:07:16 -05:00
|
|
|
|
|
|
|
if (keys.size() != rows.size()) {
|
|
|
|
PBD::stacktrace (cerr, 20);
|
|
|
|
}
|
2009-10-22 20:05:50 -04:00
|
|
|
assert(keys.size() == rows.size());
|
|
|
|
|
|
|
|
// Remove any gaps in keys caused by automation children tracks
|
|
|
|
vector<int> neworder;
|
|
|
|
for (std::map<int,int>::const_iterator i = keys.begin(); i != keys.end(); ++i) {
|
|
|
|
neworder.push_back(i->second);
|
|
|
|
}
|
|
|
|
assert(neworder.size() == rows.size());
|
2007-10-11 18:07:47 -04:00
|
|
|
|
2008-12-08 13:16:12 -05:00
|
|
|
if (changed) {
|
|
|
|
strip_redisplay_does_not_reset_order_keys = true;
|
|
|
|
track_model->reorder (neworder);
|
|
|
|
strip_redisplay_does_not_reset_order_keys = false;
|
|
|
|
}
|
2007-10-11 18:07:47 -04:00
|
|
|
}
|
|
|
|
|
2011-11-15 14:33:09 -05:00
|
|
|
void
|
|
|
|
Mixer_UI::follow_editor_selection ()
|
|
|
|
{
|
|
|
|
if (!Config->get_link_editor_and_mixer_selection() || _following_editor_selection) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
_following_editor_selection = true;
|
|
|
|
_selection.block_routes_changed (true);
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
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)) {
|
|
|
|
|
|
|
|
/* extend selection */
|
|
|
|
|
|
|
|
vector<MixerStrip*> tmp;
|
|
|
|
bool accumulate = false;
|
|
|
|
|
|
|
|
tmp.push_back (strip);
|
|
|
|
|
|
|
|
for (list<MixerStrip*>::iterator i = strips.begin(); i != strips.end(); ++i) {
|
|
|
|
if ((*i) == strip) {
|
|
|
|
/* hit clicked strip, start accumulating till we hit the first
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
if (accumulate) {
|
|
|
|
/* done */
|
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
accumulate = true;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (accumulate) {
|
|
|
|
tmp.push_back (*i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (vector<MixerStrip*>::iterator i = tmp.begin(); i != tmp.end(); ++i) {
|
|
|
|
_selection.add (*i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2006-08-30 16:48:16 -04:00
|
|
|
XMLNode* node = ARDOUR_UI::instance()->mixer_settings();
|
|
|
|
set_state (*node);
|
|
|
|
|
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-04-25 08:58:19 -04:00
|
|
|
_session->RouteAdded.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::add_strip, this, _1), gui_context());
|
|
|
|
_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
|
|
|
|
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();
|
2012-06-07 17:51:25 -04:00
|
|
|
|
|
|
|
/* Bit of a hack; if we're here, we're opening the mixer because of our
|
|
|
|
instant XML state having a show-mixer property. Fix up the corresponding
|
|
|
|
action state.
|
|
|
|
*/
|
|
|
|
ActionManager::check_toggleaction ("<Actions>/Common/toggle-mixer");
|
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
|
|
|
|
2010-03-30 13:19:39 -04:00
|
|
|
if (_monitor_section) {
|
|
|
|
_monitor_section->tearoff().hide_visible ();
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
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;
|
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 ()
|
|
|
|
{
|
2009-12-11 18:29:48 -05:00
|
|
|
fast_screen_update_connection = ARDOUR_UI::instance()->SuperRapidScreenUpdate.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 ()
|
|
|
|
{
|
2009-12-17 13:24:23 -05:00
|
|
|
if (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
|
|
|
|
2006-01-11 22:43:52 -05:00
|
|
|
no_track_list_redisplay = true;
|
2005-11-29 17:48:54 -05:00
|
|
|
|
2006-01-11 22:43:52 -05:00
|
|
|
for (i = rows.begin(); i != rows.end(); ++i) {
|
2005-11-29 17:48:54 -05:00
|
|
|
|
2006-01-11 22:43:52 -05:00
|
|
|
TreeModel::Row row = (*i);
|
2006-03-09 18:44:39 -05:00
|
|
|
MixerStrip* strip = row[track_columns.strip];
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-01-11 22:43:52 -05:00
|
|
|
if (strip == 0) {
|
|
|
|
continue;
|
|
|
|
}
|
2009-10-14 12:10:01 -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
|
|
|
continue;
|
|
|
|
}
|
2005-11-29 17:48:54 -05:00
|
|
|
|
2006-03-09 18:44:39 -05: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
|
|
|
no_track_list_redisplay = false;
|
|
|
|
redisplay_track_list ();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2009-10-14 12:10:01 -04:00
|
|
|
Mixer_UI::set_all_audio_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;
|
|
|
|
|
|
|
|
no_track_list_redisplay = true;
|
|
|
|
|
|
|
|
for (i = rows.begin(); i != rows.end(); ++i) {
|
|
|
|
TreeModel::Row row = (*i);
|
2006-03-09 18:44:39 -05:00
|
|
|
MixerStrip* strip = row[track_columns.strip];
|
2006-01-11 22:43:52 -05:00
|
|
|
|
|
|
|
if (strip == 0) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2007-06-15 18:05:07 -04:00
|
|
|
boost::shared_ptr<AudioTrack> at = strip->audio_track();
|
2006-01-11 22:43:52 -05:00
|
|
|
|
|
|
|
switch (tracks) {
|
|
|
|
case 0:
|
2006-03-09 18:44:39 -05:00
|
|
|
(*i)[track_columns.visible] = yn;
|
2006-01-11 22:43:52 -05:00
|
|
|
break;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-01-11 22:43:52 -05:00
|
|
|
case 1:
|
|
|
|
if (at) { /* track */
|
2006-03-09 18:44:39 -05:00
|
|
|
(*i)[track_columns.visible] = yn;
|
2006-01-11 22:43:52 -05:00
|
|
|
}
|
|
|
|
break;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-01-11 22:43:52 -05:00
|
|
|
case 2:
|
|
|
|
if (!at) { /* bus */
|
2006-03-09 18:44:39 -05:00
|
|
|
(*i)[track_columns.visible] = yn;
|
2006-01-11 22:43:52 -05:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
no_track_list_redisplay = false;
|
|
|
|
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 ()
|
|
|
|
{
|
|
|
|
set_all_audio_visibility (2, true);
|
|
|
|
}
|
|
|
|
void
|
|
|
|
Mixer_UI::hide_all_audiobus ()
|
|
|
|
{
|
|
|
|
set_all_audio_visibility (2, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::show_all_audiotracks()
|
|
|
|
{
|
|
|
|
set_all_audio_visibility (1, true);
|
|
|
|
}
|
|
|
|
void
|
|
|
|
Mixer_UI::hide_all_audiotracks ()
|
|
|
|
{
|
|
|
|
set_all_audio_visibility (1, false);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2008-12-08 13:16:12 -05:00
|
|
|
strip_redisplay_does_not_sync_order_keys = true;
|
2009-12-30 11:48:58 -05:00
|
|
|
_session->set_remote_control_ids();
|
2007-10-11 18:07:47 -04:00
|
|
|
redisplay_track_list ();
|
2008-12-08 13:16:12 -05:00
|
|
|
strip_redisplay_does_not_sync_order_keys = false;
|
2007-10-11 18:07:47 -04:00
|
|
|
}
|
|
|
|
|
2006-01-11 22:43:52 -05:00
|
|
|
void
|
2009-07-21 11:55:17 -04:00
|
|
|
Mixer_UI::track_list_change (const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator&)
|
2006-01-11 22:43:52 -05:00
|
|
|
{
|
2008-12-08 13:16:12 -05:00
|
|
|
// never reset order keys because of a property change
|
2009-10-14 12:10:01 -04:00
|
|
|
strip_redisplay_does_not_reset_order_keys = true;
|
2009-12-30 11:48:58 -05:00
|
|
|
_session->set_remote_control_ids();
|
2006-01-11 22:43:52 -05:00
|
|
|
redisplay_track_list ();
|
2008-12-08 13:16:12 -05:00
|
|
|
strip_redisplay_does_not_reset_order_keys = false;
|
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
|
|
|
{
|
2008-12-08 13:16:12 -05:00
|
|
|
/* this could require an order sync */
|
2009-12-17 13:24:23 -05:00
|
|
|
if (_session && !_session->deletion_in_progress()) {
|
2009-12-30 11:48:58 -05:00
|
|
|
_session->set_remote_control_ids();
|
2009-12-17 13:24:23 -05:00
|
|
|
redisplay_track_list ();
|
|
|
|
}
|
2006-01-11 22:43:52 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::redisplay_track_list ()
|
|
|
|
{
|
2006-03-09 18:44:39 -05:00
|
|
|
TreeModel::Children rows = track_model->children();
|
2006-01-11 22:43:52 -05:00
|
|
|
TreeModel::Children::iterator i;
|
|
|
|
long order;
|
|
|
|
|
|
|
|
if (no_track_list_redisplay) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (order = 0, i = rows.begin(); i != rows.end(); ++i, ++order) {
|
2006-03-09 18:44:39 -05:00
|
|
|
MixerStrip* strip = (*i)[track_columns.strip];
|
2006-01-11 22:43:52 -05:00
|
|
|
|
2006-01-17 11:40:57 -05:00
|
|
|
if (strip == 0) {
|
|
|
|
/* we're in the middle of changing a row, don't worry */
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2011-07-12 07:02:12 -04:00
|
|
|
if (!strip_redisplay_does_not_reset_order_keys) {
|
|
|
|
strip->route()->set_order_key (N_("signal"), order);
|
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
} 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
|
|
|
|
2008-12-08 13:16:12 -05:00
|
|
|
if (!strip_redisplay_does_not_reset_order_keys && !strip_redisplay_does_not_sync_order_keys) {
|
2009-12-17 13:24:23 -05:00
|
|
|
_session->sync_order_keys (N_("signal"));
|
2007-10-11 18:07:47 -04:00
|
|
|
}
|
2008-04-11 10:06:50 -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
|
|
|
|
2009-06-23 19:05:14 -04:00
|
|
|
#ifdef GTKOSX
|
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
|
|
|
|
2006-01-11 22:43:52 -05:00
|
|
|
struct SignalOrderRouteSorter {
|
2006-07-27 12:52:14 -04:00
|
|
|
bool operator() (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b) {
|
2006-01-11 22:43:52 -05:00
|
|
|
/* use of ">" forces the correct sort order */
|
2009-08-01 20:33:16 -04:00
|
|
|
return a->order_key (N_("signal")) < b->order_key (N_("signal"));
|
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);
|
2006-01-11 22:43:52 -05:00
|
|
|
SignalOrderRouteSorter sorter;
|
|
|
|
|
2006-07-27 12:52:14 -04:00
|
|
|
copy.sort (sorter);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-01-11 22:43:52 -05:00
|
|
|
no_track_list_redisplay = true;
|
|
|
|
|
2006-03-09 18:44:39 -05:00
|
|
|
track_model->clear ();
|
2006-01-11 22:43:52 -05:00
|
|
|
|
2006-08-16 22:12:20 -04:00
|
|
|
add_strip (copy);
|
2006-01-11 22:43:52 -05:00
|
|
|
|
|
|
|
no_track_list_redisplay = false;
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
TreeIter iter;
|
|
|
|
TreeModel::Path path;
|
|
|
|
TreeViewColumn* column;
|
|
|
|
int cellx;
|
|
|
|
int celly;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-01-11 22:43:52 -05:00
|
|
|
if (!track_display.get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (GPOINTER_TO_UINT (column->get_data (X_("colnum")))) {
|
|
|
|
case 0:
|
|
|
|
/* allow normal processing to occur */
|
|
|
|
return false;
|
|
|
|
|
|
|
|
case 1: /* visibility */
|
|
|
|
|
2006-03-09 18:44:39 -05:00
|
|
|
if ((iter = track_model->get_iter (path))) {
|
|
|
|
MixerStrip* strip = (*iter)[track_columns.strip];
|
2006-01-11 22:43:52 -05:00
|
|
|
if (strip) {
|
|
|
|
|
2010-03-23 08:19:21 -04:00
|
|
|
if (!strip->route()->is_master() && !strip->route()->is_monitor()) {
|
2006-03-09 18:44:39 -05:00
|
|
|
bool visible = (*iter)[track_columns.visible];
|
|
|
|
(*iter)[track_columns.visible] = !visible;
|
2006-01-11 22:43:52 -05:00
|
|
|
}
|
2008-12-12 09:43:24 -05:00
|
|
|
#ifdef GTKOSX
|
|
|
|
track_display.queue_draw();
|
|
|
|
#endif
|
2006-01-11 22:43:52 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2006-01-11 22:43:52 -05:00
|
|
|
|
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)));
|
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
|
|
|
|
2005-10-01 12:29:37 -04: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)) {
|
|
|
|
return false;
|
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) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
2008-12-12 09:43:24 -05:00
|
|
|
#ifdef GTKOSX
|
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;
|
2008-12-12 09:43:24 -05:00
|
|
|
#ifdef GTKOSX
|
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 ();
|
|
|
|
|
|
|
|
{
|
|
|
|
TreeModel::Row row;
|
|
|
|
row = *(group_model->append());
|
|
|
|
row[group_columns.visible] = true;
|
|
|
|
row[group_columns.text] = (_("-all-"));
|
|
|
|
row[group_columns.group] = 0;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2010-07-19 19:26:40 -04:00
|
|
|
_group_tabs->run_new_group_dialog (rl);
|
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
|
|
|
}
|
|
|
|
|
|
|
|
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)) {
|
2007-04-11 09:07:51 -04:00
|
|
|
ARDOUR_UI::instance()->add_route (this);
|
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
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::set_strip_width (Width w)
|
|
|
|
{
|
|
|
|
_strip_width = w;
|
|
|
|
|
|
|
|
for (list<MixerStrip*>::iterator i = strips.begin(); i != strips.end(); ++i) {
|
2009-06-20 13:15:33 -04:00
|
|
|
(*i)->set_width_enum (w, this);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-07-17 22:27:07 -04:00
|
|
|
void
|
|
|
|
Mixer_UI::set_window_pos_and_size ()
|
|
|
|
{
|
|
|
|
resize (m_width, m_height);
|
|
|
|
move (m_root_x, m_root_y);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::get_window_pos_and_size ()
|
|
|
|
{
|
|
|
|
get_position(m_root_x, m_root_y);
|
|
|
|
get_size(m_width, m_height);
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
int
|
|
|
|
Mixer_UI::set_state (const XMLNode& node)
|
|
|
|
{
|
|
|
|
const XMLProperty* prop;
|
|
|
|
XMLNode* geometry;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-12-12 09:43:24 -05:00
|
|
|
m_width = default_width;
|
|
|
|
m_height = default_height;
|
|
|
|
m_root_x = 1;
|
|
|
|
m_root_y = 1;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-12-12 09:43:24 -05:00
|
|
|
if ((geometry = find_named_node (node, "geometry")) != 0) {
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2008-12-12 09:43:24 -05:00
|
|
|
XMLProperty* prop;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2008-12-12 09:43:24 -05:00
|
|
|
if ((prop = geometry->property("x_size")) == 0) {
|
|
|
|
prop = geometry->property ("x-size");
|
|
|
|
}
|
|
|
|
if (prop) {
|
|
|
|
m_width = atoi(prop->value());
|
|
|
|
}
|
|
|
|
if ((prop = geometry->property("y_size")) == 0) {
|
|
|
|
prop = geometry->property ("y-size");
|
|
|
|
}
|
|
|
|
if (prop) {
|
|
|
|
m_height = atoi(prop->value());
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2008-12-12 09:43:24 -05:00
|
|
|
if ((prop = geometry->property ("x_pos")) == 0) {
|
|
|
|
prop = geometry->property ("x-pos");
|
|
|
|
}
|
|
|
|
if (prop) {
|
|
|
|
m_root_x = atoi (prop->value());
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-12-12 09:43:24 -05:00
|
|
|
}
|
|
|
|
if ((prop = geometry->property ("y_pos")) == 0) {
|
|
|
|
prop = geometry->property ("y-pos");
|
|
|
|
}
|
|
|
|
if (prop) {
|
|
|
|
m_root_y = atoi (prop->value());
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2006-01-17 11:40:57 -05:00
|
|
|
|
2007-07-17 22:27:07 -04:00
|
|
|
set_window_pos_and_size ();
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
XMLNode&
|
|
|
|
Mixer_UI::get_state (void)
|
|
|
|
{
|
|
|
|
XMLNode* node = new XMLNode ("Mixer");
|
|
|
|
|
|
|
|
if (is_realized()) {
|
2005-10-05 09:48:09 -04:00
|
|
|
Glib::RefPtr<Gdk::Window> win = get_window();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2007-07-17 22:27:07 -04:00
|
|
|
get_window_pos_and_size ();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
XMLNode* geometry = new XMLNode ("geometry");
|
|
|
|
char buf[32];
|
2007-07-17 22:27:07 -04:00
|
|
|
snprintf(buf, sizeof(buf), "%d", m_width);
|
2005-09-25 14:42:24 -04:00
|
|
|
geometry->add_property(X_("x_size"), string(buf));
|
2007-07-17 22:27:07 -04:00
|
|
|
snprintf(buf, sizeof(buf), "%d", m_height);
|
2005-09-25 14:42:24 -04:00
|
|
|
geometry->add_property(X_("y_size"), string(buf));
|
2007-07-17 22:27:07 -04:00
|
|
|
snprintf(buf, sizeof(buf), "%d", m_root_x);
|
2005-09-25 14:42:24 -04:00
|
|
|
geometry->add_property(X_("x_pos"), string(buf));
|
2007-07-17 22:27:07 -04:00
|
|
|
snprintf(buf, sizeof(buf), "%d", m_root_y);
|
2005-09-25 14:42:24 -04:00
|
|
|
geometry->add_property(X_("y_pos"), string(buf));
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2007-07-17 22:27:07 -04:00
|
|
|
// written only for compatibility, they are not used.
|
|
|
|
snprintf(buf, sizeof(buf), "%d", 0);
|
2005-09-25 14:42:24 -04:00
|
|
|
geometry->add_property(X_("x_off"), string(buf));
|
2007-07-17 22:27:07 -04:00
|
|
|
snprintf(buf, sizeof(buf), "%d", 0);
|
2005-09-25 14:42:24 -04:00
|
|
|
geometry->add_property(X_("y_off"), string(buf));
|
|
|
|
|
2005-09-25 16:33:00 -04:00
|
|
|
snprintf(buf,sizeof(buf), "%d",gtk_paned_get_position (static_cast<Paned*>(&rhs_pane1)->gobj()));
|
2005-09-25 14:42:24 -04:00
|
|
|
geometry->add_property(X_("mixer_rhs_pane1_pos"), string(buf));
|
2005-09-25 16:33:00 -04:00
|
|
|
snprintf(buf,sizeof(buf), "%d",gtk_paned_get_position (static_cast<Paned*>(&list_hpane)->gobj()));
|
2005-09-25 14:42:24 -04:00
|
|
|
geometry->add_property(X_("mixer_list_hpane_pos"), string(buf));
|
|
|
|
|
|
|
|
node->add_child_nocopy (*geometry);
|
|
|
|
}
|
|
|
|
|
|
|
|
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");
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
return *node;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-10-14 12:10:01 -04:00
|
|
|
void
|
2009-07-21 11:55:17 -04:00
|
|
|
Mixer_UI::pane_allocation_handler (Allocation&, Gtk::Paned* which)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
int pos;
|
|
|
|
XMLProperty* prop = 0;
|
|
|
|
char buf[32];
|
|
|
|
XMLNode* node = ARDOUR_UI::instance()->mixer_settings();
|
|
|
|
XMLNode* geometry;
|
2011-07-02 13:16:46 -04:00
|
|
|
int height;
|
2005-09-25 14:42:24 -04:00
|
|
|
static int32_t done[3] = { 0, 0, 0 };
|
|
|
|
|
2008-12-12 09:43:24 -05:00
|
|
|
height = default_height;
|
|
|
|
|
|
|
|
if ((geometry = find_named_node (*node, "geometry")) != 0) {
|
|
|
|
|
|
|
|
if ((prop = geometry->property ("y_size")) == 0) {
|
|
|
|
prop = geometry->property ("y-size");
|
|
|
|
}
|
|
|
|
if (prop) {
|
|
|
|
height = atoi (prop->value());
|
|
|
|
}
|
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) {
|
2005-09-25 14:42:24 -04:00
|
|
|
pos = height / 3;
|
|
|
|
snprintf (buf, sizeof(buf), "%d", pos);
|
|
|
|
} else {
|
|
|
|
pos = atoi (prop->value());
|
|
|
|
}
|
|
|
|
|
2005-09-25 16:33:00 -04:00
|
|
|
if ((done[0] = GTK_WIDGET(rhs_pane1.gobj())->allocation.height > pos)) {
|
2005-09-25 14:42:24 -04:00
|
|
|
rhs_pane1.set_position (pos);
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (which == static_cast<Gtk::Paned*> (&list_hpane)) {
|
|
|
|
|
|
|
|
if (done[2]) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-10-05 19:14:48 -04:00
|
|
|
if (!geometry || (prop = geometry->property("mixer-list-hpane-pos")) == 0) {
|
2005-09-25 14:42:24 -04:00
|
|
|
pos = 75;
|
|
|
|
snprintf (buf, sizeof(buf), "%d", pos);
|
|
|
|
} else {
|
|
|
|
pos = atoi (prop->value());
|
|
|
|
}
|
|
|
|
|
2005-09-25 16:33:00 -04:00
|
|
|
if ((done[2] = GTK_WIDGET(list_hpane.gobj())->allocation.width > pos)) {
|
2005-09-25 14:42:24 -04:00
|
|
|
list_hpane.set_position (pos);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
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
|
|
|
{
|
|
|
|
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 ()
|
|
|
|
{
|
|
|
|
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
|
|
|
|
2006-03-09 18:44:39 -05:00
|
|
|
bool
|
|
|
|
Mixer_UI::on_key_press_event (GdkEventKey* ev)
|
|
|
|
{
|
2011-11-04 13:53:21 -04:00
|
|
|
/* focus widget gets first shot, then bindings, otherwise
|
|
|
|
forward to main window
|
|
|
|
*/
|
2009-10-28 17:36:40 -04:00
|
|
|
|
2011-11-04 13:53:21 -04:00
|
|
|
if (gtk_window_propagate_key_event (GTK_WINDOW(gobj()), ev)) {
|
2009-10-28 17:36:40 -04:00
|
|
|
return true;
|
|
|
|
}
|
2011-11-04 13:53:21 -04:00
|
|
|
|
|
|
|
KeyboardKey k (ev->state, ev->keyval);
|
2012-06-13 17:18:00 -04:00
|
|
|
|
|
|
|
GtkAccelKey key;
|
|
|
|
|
|
|
|
/* Handle toggle-mixer-on-top here, so it can do a different thing if the
|
|
|
|
mixer is already on top and received this key press.
|
|
|
|
*/
|
|
|
|
if (gtk_accel_map_lookup_entry("<Actions>/Common/toggle-mixer-on-top", &key)) {
|
|
|
|
if (int (k.state()) == key.accel_mods && k.key() == key.accel_key) {
|
|
|
|
ARDOUR_UI::instance()->goto_editor_window();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2011-11-04 13:53:21 -04:00
|
|
|
|
|
|
|
if (bindings.activate (k, Bindings::Press)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return forward_key_press (ev);
|
2006-03-09 18:44:39 -05:00
|
|
|
}
|
2009-06-20 13:15:33 -04:00
|
|
|
|
2009-07-13 19:09:16 -04:00
|
|
|
bool
|
|
|
|
Mixer_UI::on_key_release_event (GdkEventKey* ev)
|
|
|
|
{
|
2011-11-04 13:53:21 -04:00
|
|
|
if (gtk_window_propagate_key_event (GTK_WINDOW(gobj()), ev)) {
|
|
|
|
return true;
|
|
|
|
}
|
2009-07-13 19:09:16 -04:00
|
|
|
|
2011-11-04 13:53:21 -04:00
|
|
|
KeyboardKey k (ev->state, ev->keyval);
|
|
|
|
|
|
|
|
if (bindings.activate (k, Bindings::Release)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* don't forward releases */
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
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") {
|
|
|
|
bool const s = Config->get_default_narrow_ms ();
|
|
|
|
for (list<MixerStrip*>::iterator i = strips.begin(); i != strips.end(); ++i) {
|
|
|
|
(*i)->set_width_enum (s ? Narrow : Wide, this);
|
|
|
|
}
|
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);
|
|
|
|
track_display.set_name (X_("MixerTrackDisplayList"));
|
|
|
|
track_display.get_selection()->set_mode (Gtk::SELECTION_NONE);
|
|
|
|
track_display.set_reorderable (true);
|
|
|
|
track_display.set_headers_visible (true);
|
|
|
|
|
|
|
|
track_model->signal_row_deleted().connect (sigc::mem_fun (*this, &Mixer_UI::track_list_delete));
|
|
|
|
track_model->signal_row_changed().connect (sigc::mem_fun (*this, &Mixer_UI::track_list_change));
|
|
|
|
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;
|
|
|
|
|
|
|
|
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 ()
|
|
|
|
{
|
|
|
|
ARDOUR_UI::instance()->add_route (this);
|
|
|
|
}
|
2011-04-19 11:46:47 -04:00
|
|
|
|
2011-09-07 11:07:02 -04:00
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::update_title ()
|
|
|
|
{
|
|
|
|
if (_session) {
|
|
|
|
string n;
|
|
|
|
|
|
|
|
if (_session->snap_name() != _session->name()) {
|
|
|
|
n = _session->snap_name ();
|
|
|
|
} else {
|
|
|
|
n = _session->name ();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_session->dirty ()) {
|
|
|
|
n = "*" + n;
|
|
|
|
}
|
|
|
|
|
|
|
|
WindowTitle title (n);
|
2011-11-28 14:46:30 -05:00
|
|
|
title += S_("Window|Mixer");
|
2011-09-07 11:07:02 -04:00
|
|
|
title += Glib::get_application_name ();
|
|
|
|
set_title (title.get_string());
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
2011-11-28 14:46:30 -05:00
|
|
|
WindowTitle title (S_("Window|Mixer"));
|
2011-09-07 11:07:02 -04:00
|
|
|
title += Glib::get_application_name ();
|
|
|
|
set_title (title.get_string());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
(*i)->translate_coordinates (*this, 0, 0, x1, y);
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* try to get mixer strip at mouse */
|
|
|
|
|
|
|
|
int x, y;
|
|
|
|
get_pointer (x, y);
|
|
|
|
|
|
|
|
MixerStrip* ms = strip_by_x (x);
|
|
|
|
|
|
|
|
if (ms) {
|
|
|
|
_route_targets.insert (ms);
|
|
|
|
}
|
|
|
|
}
|
2012-01-17 20:30:44 -05:00
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::monitor_section_going_away ()
|
|
|
|
{
|
|
|
|
if (_monitor_section) {
|
|
|
|
out_packer.remove (_monitor_section->tearoff());
|
|
|
|
_monitor_section->set_session (0);
|
|
|
|
}
|
|
|
|
}
|