2005-09-25 14:42:24 -04:00
|
|
|
/*
|
2019-08-02 17:26:43 -04:00
|
|
|
* Copyright (C) 2005-2008 Nick Mainsbridge <mainsbridge@gmail.com>
|
|
|
|
* Copyright (C) 2005-2017 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2005 Taybin Rutkin <taybin@taybin.com>
|
|
|
|
* Copyright (C) 2006-2011 David Robillard <d@drobilla.net>
|
|
|
|
* Copyright (C) 2007-2011 Carl Hetherington <carl@carlh.net>
|
|
|
|
* Copyright (C) 2014-2017 Robin Gareus <robin@gareus.org>
|
|
|
|
* Copyright (C) 2014 Ben Loftis <ben@harrisonconsoles.com>
|
|
|
|
* Copyright (C) 2015-2016 Tim Mayberry <mojofunk@gmail.com>
|
|
|
|
*
|
|
|
|
* 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.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2005-09-25 14:42:24 -04:00
|
|
|
|
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"
|
2016-08-27 00:15:18 -04:00
|
|
|
#include "enums_convert.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
|
|
|
|
2016-07-14 14:44:52 -04:00
|
|
|
#include "pbd/i18n.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
|
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)
|
|
|
|
{
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<ARDOUR::Route> r;
|
2008-12-08 11:07:28 -05:00
|
|
|
|
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 );
|
2017-05-05 07:31:49 -04: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
|
|
|
|
}
|
|
|
|
|
2024-02-17 09:01:58 -05:00
|
|
|
std::shared_ptr<ARDOUR::Route>
|
|
|
|
Editor::current_mixer_stripable () const
|
|
|
|
{
|
|
|
|
if (current_mixer_strip) {
|
|
|
|
return current_mixer_strip->route ();
|
|
|
|
}
|
|
|
|
return std::shared_ptr<ARDOUR::Route> ();
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
Fix typos in gtk2_ardour/ directory
Found via `codespell -q 3 -S *.po,./share/patchfiles,./libs -L ba,buss,busses,doubleclick,hsi,ontop,ro,seh,siz,sur,te,trough,ue`
2022-01-26 12:35:38 -05:00
|
|
|
// if this is an automation track, then the mixer strip should
|
2010-11-25 15:37:39 -05:00
|
|
|
// show the parent
|
2010-08-20 17:34:18 -04:00
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<ARDOUR::Stripable> stripable;
|
2010-11-25 15:37:39 -05:00
|
|
|
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) {
|
|
|
|
AudioTimeAxisView *parent = dynamic_cast<AudioTimeAxisView*>(view.get_parent());
|
|
|
|
if (parent) {
|
2017-08-06 17:22:27 -04:00
|
|
|
stripable = parent->stripable ();
|
2010-11-25 15:37:39 -05:00
|
|
|
}
|
|
|
|
} else {
|
2017-08-06 17:22:27 -04:00
|
|
|
StripableTimeAxisView* stav = dynamic_cast<StripableTimeAxisView*> (&view);
|
|
|
|
if (stav) {
|
|
|
|
stripable = stav->stripable();
|
2010-11-25 15:37:39 -05:00
|
|
|
}
|
|
|
|
}
|
2011-06-01 13:00:29 -04:00
|
|
|
|
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 ();
|
|
|
|
}
|
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<ARDOUR::Route> route = std::dynamic_pointer_cast<ARDOUR::Route> (stripable);
|
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
|
2022-04-06 23:56:45 -04:00
|
|
|
Editor::maybe_add_mixer_strip_width (XMLNode& node) const
|
2007-04-29 13:23:11 -04:00
|
|
|
{
|
|
|
|
if (current_mixer_strip) {
|
2016-08-27 00:15:18 -04:00
|
|
|
node.set_property ("mixer-width", 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 ();
|
|
|
|
}
|