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>
|
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
|
|
|
|
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_routes.h"
|
|
|
|
#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"
|
|
|
|
#include "selection.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;
|
|
|
|
|
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 {
|
|
|
|
sort_track_selection ();
|
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 ();
|
|
|
|
}
|
|
|
|
|
|
|
|
current_mixer_strip->set_route (r);
|
2009-10-19 15:20:48 -04:00
|
|
|
current_mixer_strip->set_width_enum (editor_mixer_strip_width, (void*) this);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
if (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
|
|
|
}
|
|
|
|
|
|
|
|
} 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
|
|
|
|
2008-10-03 14:24:38 -04:00
|
|
|
#ifdef GTKOSX
|
|
|
|
/* XXX gtk problem here */
|
2008-12-08 11:07:28 -05:00
|
|
|
ensure_all_elements_drawn();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef GTKOSX
|
|
|
|
void
|
|
|
|
Editor::ensure_all_elements_drawn ()
|
|
|
|
{
|
|
|
|
controls_layout.queue_draw ();
|
2008-10-03 14:24:38 -04:00
|
|
|
ruler_label_event_box.queue_draw ();
|
|
|
|
time_button_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 ()
|
|
|
|
{
|
|
|
|
current_mixer_strip = new MixerStrip (*ARDOUR_UI::instance()->the_mixer(),
|
2009-12-17 13:24:23 -05:00
|
|
|
_session,
|
2008-12-08 11:07:28 -05:00
|
|
|
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
|
|
|
|
2008-12-08 11:07:28 -05:00
|
|
|
#ifdef GTKOSX
|
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);
|
2009-10-14 12:10:01 -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;
|
|
|
|
}
|
|
|
|
|
2008-12-08 11:07:28 -05:00
|
|
|
Glib::RefPtr<Gtk::Action> act = ActionManager::get_action (X_("Editor"), X_("show-editor-mixer"));
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-12-08 11:07:28 -05:00
|
|
|
if (act) {
|
|
|
|
Glib::RefPtr<Gtk::ToggleAction> tact = Glib::RefPtr<Gtk::ToggleAction>::cast_dynamic(act);
|
|
|
|
if (!tact || !tact->get_active()) {
|
|
|
|
/* not showing mixer strip presently */
|
2005-09-25 14:42:24 -04:00
|
|
|
return;
|
|
|
|
}
|
2008-12-08 11:07:28 -05:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2008-12-08 11:07:28 -05:00
|
|
|
if (current_mixer_strip == 0) {
|
|
|
|
create_editor_mixer ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2009-10-14 12:10:01 -04:00
|
|
|
|
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
|
|
|
|
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 ()
|
|
|
|
{
|
|
|
|
#ifdef GTKOSX
|
|
|
|
ensure_all_elements_drawn ();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
editor_mixer_strip_width = current_mixer_strip->get_width_enum ();
|
|
|
|
}
|