2005-09-25 14:42:24 -04:00
|
|
|
/*
|
2009-10-14 12:10:01 -04:00
|
|
|
Copyright (C) 2003-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
|
|
|
|
|
2007-03-19 03:07:38 -04:00
|
|
|
#include <glibmm/miscutils.h>
|
2012-12-01 20:44:09 -05:00
|
|
|
#include <gtkmm/messagedialog.h>
|
2005-09-25 16:33:00 -04:00
|
|
|
#include <gtkmm2ext/utils.h>
|
2007-03-19 03:07:38 -04:00
|
|
|
#include <gtkmm2ext/window_title.h>
|
2007-04-29 13:23:11 -04:00
|
|
|
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "pbd/enumwriter.h"
|
2007-04-29 13:23:11 -04:00
|
|
|
|
2011-11-15 14:33:09 -05:00
|
|
|
#include "ardour/rc_configuration.h"
|
|
|
|
|
2016-07-06 13:37:30 -04:00
|
|
|
#include "control_protocol/control_protocol.h"
|
|
|
|
|
2010-08-20 17:34:18 -04:00
|
|
|
#include "actions.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
#include "ardour_ui.h"
|
|
|
|
#include "audio_time_axis.h"
|
2010-08-20 17:34:18 -04:00
|
|
|
#include "automation_time_axis.h"
|
|
|
|
#include "editor.h"
|
2009-07-03 14:37:15 -04:00
|
|
|
#include "editor_route_groups.h"
|
2009-07-03 18:42:22 -04:00
|
|
|
#include "editor_regions.h"
|
2009-12-21 13:23:07 -05:00
|
|
|
#include "gui_thread.h"
|
2010-08-20 17:34:18 -04:00
|
|
|
#include "midi_time_axis.h"
|
|
|
|
#include "mixer_strip.h"
|
2011-11-15 14:33:09 -05:00
|
|
|
#include "mixer_ui.h"
|
2010-08-20 17:34:18 -04:00
|
|
|
#include "selection.h"
|
2015-01-02 09:44:54 -05:00
|
|
|
#include "ui_config.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
#include "i18n.h"
|
|
|
|
|
2009-05-12 13:03:42 -04:00
|
|
|
using namespace std;
|
2007-03-19 03:07:38 -04:00
|
|
|
using namespace Gtkmm2ext;
|
2007-04-29 13:23:11 -04:00
|
|
|
using namespace PBD;
|
2007-03-19 03:07:38 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void
|
|
|
|
Editor::editor_mixer_button_toggled ()
|
|
|
|
{
|
2006-01-30 22:27:25 -05:00
|
|
|
Glib::RefPtr<Gtk::Action> act = ActionManager::get_action (X_("Editor"), X_("show-editor-mixer"));
|
|
|
|
if (act) {
|
|
|
|
Glib::RefPtr<Gtk::ToggleAction> tact = Glib::RefPtr<Gtk::ToggleAction>::cast_dynamic(act);
|
|
|
|
show_editor_mixer (tact->get_active());
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2007-06-15 03:39:20 -04:00
|
|
|
void
|
|
|
|
Editor::editor_list_button_toggled ()
|
|
|
|
{
|
|
|
|
Glib::RefPtr<Gtk::Action> act = ActionManager::get_action (X_("Editor"), X_("show-editor-list"));
|
|
|
|
if (act) {
|
|
|
|
Glib::RefPtr<Gtk::ToggleAction> tact = Glib::RefPtr<Gtk::ToggleAction>::cast_dynamic(act);
|
|
|
|
show_editor_list (tact->get_active());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void
|
|
|
|
Editor::show_editor_mixer (bool yn)
|
|
|
|
{
|
2008-12-08 11:07:28 -05:00
|
|
|
boost::shared_ptr<ARDOUR::Route> r;
|
|
|
|
|
2006-11-19 11:45:16 -05:00
|
|
|
show_editor_mixer_when_tracks_arrive = false;
|
|
|
|
|
2012-12-01 20:44:09 -05:00
|
|
|
if (yn) {
|
2015-07-22 17:49:41 -04:00
|
|
|
Gtk::Window* toplevel = current_toplevel();
|
|
|
|
Glib::RefPtr<Gdk::Window> win;
|
2012-12-01 20:44:09 -05:00
|
|
|
Glib::RefPtr<Gdk::Screen> screen;
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2015-07-22 17:49:41 -04:00
|
|
|
if (toplevel) {
|
|
|
|
win = toplevel->get_window();
|
|
|
|
}
|
|
|
|
|
2012-12-10 20:17:23 -05:00
|
|
|
if (win) {
|
2015-07-22 17:49:41 -04:00
|
|
|
screen = win->get_screen();
|
2012-12-01 20:44:09 -05:00
|
|
|
} else {
|
|
|
|
screen = Gdk::Screen::get_default();
|
|
|
|
}
|
|
|
|
|
2013-10-27 20:55:06 -04:00
|
|
|
if (g_getenv ("ARDOUR_LOVES_STUPID_TINY_SCREENS") == 0 && screen && screen->get_height() < 700) {
|
2012-12-01 20:55:48 -05:00
|
|
|
Gtk::MessageDialog msg (_("This screen is not tall enough to display the editor mixer"));
|
2012-12-01 20:44:09 -05:00
|
|
|
msg.run ();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
if (!_session) {
|
2008-12-08 11:07:28 -05:00
|
|
|
show_editor_mixer_when_tracks_arrive = yn;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
if (yn) {
|
|
|
|
|
2008-12-08 11:07:28 -05:00
|
|
|
if (selection->tracks.empty()) {
|
2009-04-21 21:49:48 -04:00
|
|
|
|
2009-10-14 12:10:01 -04:00
|
|
|
if (track_views.empty()) {
|
2008-12-08 11:07:28 -05:00
|
|
|
show_editor_mixer_when_tracks_arrive = true;
|
|
|
|
return;
|
2009-10-14 12:10:01 -04:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2008-12-08 11:07:28 -05:00
|
|
|
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
|
2009-07-09 13:58:13 -04:00
|
|
|
RouteTimeAxisView* atv;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-09 13:58:13 -04:00
|
|
|
if ((atv = dynamic_cast<RouteTimeAxisView*> (*i)) != 0) {
|
2008-12-08 11:07:28 -05:00
|
|
|
r = atv->route();
|
|
|
|
break;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2008-12-08 11:07:28 -05:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2008-12-08 11:07:28 -05:00
|
|
|
} else {
|
2011-12-10 14:20:15 -05:00
|
|
|
sort_track_selection (selection->tracks);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-12-08 11:07:28 -05:00
|
|
|
for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) {
|
2009-07-09 13:58:13 -04:00
|
|
|
RouteTimeAxisView* atv;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-09 13:58:13 -04:00
|
|
|
if ((atv = dynamic_cast<RouteTimeAxisView*> (*i)) != 0) {
|
2008-12-08 11:07:28 -05:00
|
|
|
r = atv->route();
|
|
|
|
break;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
2008-12-08 11:07:28 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if (r) {
|
2005-09-25 14:42:24 -04:00
|
|
|
if (current_mixer_strip == 0) {
|
2008-12-08 11:07:28 -05:00
|
|
|
create_editor_mixer ();
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2014-01-07 21:29:06 -05:00
|
|
|
if (current_mixer_strip && current_mixer_strip->get_parent() == 0) {
|
2005-12-18 08:19:02 -05:00
|
|
|
global_hpacker.pack_start (*current_mixer_strip, Gtk::PACK_SHRINK );
|
2006-02-13 11:08:32 -05:00
|
|
|
global_hpacker.reorder_child (*current_mixer_strip, 0);
|
2011-02-09 21:44:56 -05:00
|
|
|
current_mixer_strip->show ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2014-01-07 21:29:06 -05:00
|
|
|
if (r) {
|
|
|
|
current_mixer_strip->set_route (r);
|
|
|
|
current_mixer_strip->set_width_enum (editor_mixer_strip_width, (void*) this);
|
|
|
|
}
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
} else {
|
|
|
|
|
|
|
|
if (current_mixer_strip) {
|
|
|
|
if (current_mixer_strip->get_parent() != 0) {
|
|
|
|
global_hpacker.remove (*current_mixer_strip);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-12-08 11:07:28 -05:00
|
|
|
|
2015-10-27 13:43:31 -04:00
|
|
|
#ifdef __APPLE__
|
2008-10-03 14:24:38 -04:00
|
|
|
/* XXX gtk problem here */
|
2008-12-08 11:07:28 -05:00
|
|
|
ensure_all_elements_drawn();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2015-10-27 13:43:31 -04:00
|
|
|
#ifdef __APPLE__
|
2008-12-08 11:07:28 -05:00
|
|
|
void
|
|
|
|
Editor::ensure_all_elements_drawn ()
|
|
|
|
{
|
|
|
|
controls_layout.queue_draw ();
|
2013-04-04 00:32:52 -04:00
|
|
|
time_bars_event_box.queue_draw ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2008-12-08 11:07:28 -05:00
|
|
|
#endif
|
|
|
|
|
|
|
|
void
|
|
|
|
Editor::create_editor_mixer ()
|
|
|
|
{
|
2016-06-05 15:58:33 -04:00
|
|
|
current_mixer_strip = new MixerStrip (*ARDOUR_UI::instance()->the_mixer(), _session, false);
|
2009-12-11 18:29:48 -05:00
|
|
|
current_mixer_strip->Hiding.connect (sigc::mem_fun(*this, &Editor::current_mixer_strip_hidden));
|
2010-12-28 16:29:36 -05:00
|
|
|
current_mixer_strip->WidthChanged.connect (sigc::mem_fun (*this, &Editor::mixer_strip_width_changed));
|
2009-12-25 16:06:52 -05:00
|
|
|
|
2015-10-27 13:43:31 -04:00
|
|
|
#ifdef __APPLE__
|
2009-12-11 18:29:48 -05:00
|
|
|
current_mixer_strip->WidthChanged.connect (sigc::mem_fun(*this, &Editor::ensure_all_elements_drawn));
|
2008-12-08 11:07:28 -05:00
|
|
|
#endif
|
|
|
|
current_mixer_strip->set_embedded (true);
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2014-07-23 17:58:43 -04:00
|
|
|
}
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void
|
2009-07-09 13:58:13 -04:00
|
|
|
Editor::set_selected_mixer_strip (TimeAxisView& view)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2010-08-20 17:34:18 -04:00
|
|
|
if (!_session) {
|
2005-09-25 14:42:24 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-11-25 15:37:39 -05:00
|
|
|
// if this is an automation track, then we shold the mixer strip should
|
|
|
|
// show the parent
|
2010-08-20 17:34:18 -04:00
|
|
|
|
2010-11-25 15:37:39 -05:00
|
|
|
boost::shared_ptr<ARDOUR::Route> route;
|
|
|
|
AutomationTimeAxisView* atv;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-11-25 15:37:39 -05:00
|
|
|
if ((atv = dynamic_cast<AutomationTimeAxisView*>(&view)) != 0) {
|
2010-08-20 17:34:18 -04:00
|
|
|
|
2010-11-25 15:37:39 -05:00
|
|
|
AudioTimeAxisView *parent = dynamic_cast<AudioTimeAxisView*>(view.get_parent());
|
2010-08-20 17:34:18 -04:00
|
|
|
|
2010-11-25 15:37:39 -05:00
|
|
|
if (parent) {
|
|
|
|
route = parent->route ();
|
|
|
|
}
|
2010-08-20 17:34:18 -04:00
|
|
|
|
2010-11-25 15:37:39 -05:00
|
|
|
} else {
|
2010-08-20 17:34:18 -04:00
|
|
|
|
2010-11-25 15:37:39 -05:00
|
|
|
AudioTimeAxisView* at = dynamic_cast<AudioTimeAxisView*> (&view);
|
2010-08-20 17:34:18 -04:00
|
|
|
|
2010-11-25 15:37:39 -05:00
|
|
|
if (at) {
|
|
|
|
route = at->route();
|
|
|
|
} else {
|
|
|
|
MidiTimeAxisView* mt = dynamic_cast<MidiTimeAxisView*> (&view);
|
|
|
|
if (mt) {
|
|
|
|
route = mt->route();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2016-07-06 13:37:30 -04:00
|
|
|
/* Typically this is set by changing the TAV selection but if for any
|
|
|
|
reason we decide to show a different strip for some reason, make
|
|
|
|
sure that control surfaces can find it.
|
|
|
|
*/
|
|
|
|
ARDOUR::ControlProtocol::set_first_selected_stripable (route);
|
2016-07-03 21:22:09 -04:00
|
|
|
|
|
|
|
Glib::RefPtr<Gtk::Action> act = ActionManager::get_action (X_("Editor"), X_("show-editor-mixer"));
|
|
|
|
|
|
|
|
if (act) {
|
|
|
|
Glib::RefPtr<Gtk::ToggleAction> tact = Glib::RefPtr<Gtk::ToggleAction>::cast_dynamic(act);
|
|
|
|
if (!tact || !tact->get_active()) {
|
|
|
|
/* not showing mixer strip presently */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (current_mixer_strip == 0) {
|
|
|
|
create_editor_mixer ();
|
|
|
|
}
|
|
|
|
|
2010-08-20 17:34:18 -04:00
|
|
|
if (current_mixer_strip->route() == route) {
|
2008-12-08 11:07:28 -05:00
|
|
|
return;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-11-25 15:37:39 -05:00
|
|
|
if (route) {
|
|
|
|
current_mixer_strip->set_route (route);
|
|
|
|
current_mixer_strip->set_width_enum (editor_mixer_strip_width, (void*) this);
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Editor::current_mixer_strip_hidden ()
|
|
|
|
{
|
2010-11-25 15:37:39 -05:00
|
|
|
Glib::RefPtr<Gtk::Action> act = ActionManager::get_action (X_("Editor"), X_("show-editor-mixer"));
|
2006-01-30 22:27:25 -05:00
|
|
|
if (act) {
|
|
|
|
Glib::RefPtr<Gtk::ToggleAction> tact = Glib::RefPtr<Gtk::ToggleAction>::cast_dynamic(act);
|
|
|
|
tact->set_active (false);
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2007-04-29 13:23:11 -04:00
|
|
|
void
|
|
|
|
Editor::maybe_add_mixer_strip_width (XMLNode& node)
|
|
|
|
{
|
|
|
|
if (current_mixer_strip) {
|
2010-12-28 16:29:36 -05:00
|
|
|
node.add_property ("mixer-width", enum_2_string (editor_mixer_strip_width));
|
2007-04-29 13:23:11 -04:00
|
|
|
}
|
|
|
|
}
|
2007-11-04 18:18:15 -05:00
|
|
|
|
2010-12-28 16:29:36 -05:00
|
|
|
void
|
|
|
|
Editor::mixer_strip_width_changed ()
|
|
|
|
{
|
2015-10-27 13:43:31 -04:00
|
|
|
#ifdef __APPLE__
|
2010-12-28 16:29:36 -05:00
|
|
|
ensure_all_elements_drawn ();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
editor_mixer_strip_width = current_mixer_strip->get_width_enum ();
|
|
|
|
}
|
2011-11-15 14:33:09 -05:00
|
|
|
|
|
|
|
void
|
|
|
|
Editor::track_mixer_selection ()
|
|
|
|
{
|
|
|
|
Mixer_UI::instance()->selection().RoutesChanged.connect (sigc::mem_fun (*this, &Editor::follow_mixer_selection));
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Editor::follow_mixer_selection ()
|
|
|
|
{
|
2015-04-13 21:55:17 -04:00
|
|
|
if (_following_mixer_selection) {
|
2011-11-15 14:33:09 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
_following_mixer_selection = true;
|
|
|
|
selection->block_tracks_changed (true);
|
|
|
|
|
2016-07-06 13:37:30 -04:00
|
|
|
AxisViewSelection& s (Mixer_UI::instance()->selection().axes);
|
2011-11-15 14:33:09 -05:00
|
|
|
|
|
|
|
selection->clear_tracks ();
|
|
|
|
|
2016-07-06 13:37:30 -04:00
|
|
|
for (AxisViewSelection::iterator i = s.begin(); i != s.end(); ++i) {
|
|
|
|
TimeAxisView* tav = axis_view_from_stripable ((*i)->stripable());
|
2011-11-15 14:33:09 -05:00
|
|
|
if (tav) {
|
|
|
|
selection->add (tav);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
_following_mixer_selection = false;
|
|
|
|
selection->block_tracks_changed (false);
|
|
|
|
selection->TracksChanged (); /* EMIT SIGNAL */
|
|
|
|
}
|