2005-09-25 14:42:24 -04:00
|
|
|
/*
|
|
|
|
Copyright (C) 2000-2004 Paul Davis
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
$Id$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
#include <sigc++/bind.h>
|
|
|
|
|
2005-11-29 17:48:54 -05:00
|
|
|
#include <gtkmm/accelmap.h>
|
|
|
|
|
2006-04-25 16:23:50 -04:00
|
|
|
#include <pbd/convert.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>
|
|
|
|
#include <gtkmm2ext/stop_signal.h>
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
#include <ardour/audioengine.h>
|
|
|
|
#include <ardour/session.h>
|
2006-01-11 22:43:52 -05:00
|
|
|
#include <ardour/audio_track.h>
|
2005-09-25 14:42:24 -04:00
|
|
|
#include <ardour/session_route.h>
|
2006-06-14 17:17:32 -04:00
|
|
|
#include <ardour/audio_diskstream.h>
|
2005-09-25 14:42:24 -04:00
|
|
|
#include <ardour/plugin_manager.h>
|
|
|
|
|
|
|
|
#include "mixer_ui.h"
|
|
|
|
#include "mixer_strip.h"
|
|
|
|
#include "plugin_selector.h"
|
|
|
|
#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"
|
|
|
|
|
|
|
|
#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;
|
|
|
|
using namespace sigc;
|
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;
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
Mixer_UI::Mixer_UI (AudioEngine& eng)
|
2005-10-01 12:29:37 -04:00
|
|
|
: Window (Gtk::WINDOW_TOPLEVEL),
|
|
|
|
engine (eng)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
_strip_width = Wide;
|
|
|
|
track_menu = 0;
|
2006-03-09 18:44:39 -05:00
|
|
|
mix_group_context_menu = 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;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-10-01 12:29:37 -04:00
|
|
|
scroller_base.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
|
2005-09-25 14:42:24 -04:00
|
|
|
scroller_base.set_name ("MixerWindow");
|
2005-09-26 14:24:59 -04:00
|
|
|
scroller_base.signal_button_release_event().connect (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);
|
|
|
|
|
2005-10-01 12:29:37 -04:00
|
|
|
scroller.add (strip_packer);
|
2005-09-25 16:33:00 -04:00
|
|
|
scroller.set_policy (Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-03-09 18:44:39 -05:00
|
|
|
track_model = ListStore::create (track_columns);
|
|
|
|
track_display.set_model (track_model);
|
|
|
|
track_display.append_column (_("Strips"), track_columns.text);
|
|
|
|
track_display.append_column (_("Visible"), track_columns.visible);
|
2006-01-11 22:43:52 -05:00
|
|
|
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));
|
2006-05-21 06:11:59 -04:00
|
|
|
track_display.get_column (0)->set_expand(true);
|
|
|
|
track_display.get_column (1)->set_expand(false);
|
2005-09-28 12:22:43 -04:00
|
|
|
track_display.set_name (X_("MixerTrackDisplayList"));
|
2006-01-11 22:43:52 -05:00
|
|
|
track_display.get_selection()->set_mode (Gtk::SELECTION_NONE);
|
2005-09-28 12:22:43 -04:00
|
|
|
track_display.set_reorderable (true);
|
|
|
|
track_display.set_headers_visible (true);
|
2006-01-11 22:43:52 -05:00
|
|
|
|
2006-03-09 18:44:39 -05:00
|
|
|
track_model->signal_row_deleted().connect (mem_fun (*this, &Mixer_UI::track_list_delete));
|
|
|
|
track_model->signal_row_changed().connect (mem_fun (*this, &Mixer_UI::track_list_change));
|
2006-01-11 22:43:52 -05:00
|
|
|
|
|
|
|
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 (mem_fun (*this, &Mixer_UI::track_display_button_press), false);
|
|
|
|
|
2005-10-01 12:29:37 -04:00
|
|
|
track_display_scroller.add (track_display);
|
2005-09-25 16:33:00 -04:00
|
|
|
track_display_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
|
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);
|
|
|
|
group_display.append_column (_("Active"), group_columns.active);
|
|
|
|
group_display.append_column (_("Visible"), 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-03-09 18:44:39 -05:00
|
|
|
group_display.get_column (2)->set_data (X_("colnum"), GUINT_TO_POINTER(2));
|
2006-05-21 06:11:59 -04:00
|
|
|
group_display.get_column (0)->set_expand(true);
|
|
|
|
group_display.get_column (1)->set_expand(false);
|
|
|
|
group_display.get_column (2)->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;
|
|
|
|
name_cell->signal_edited().connect (mem_fun (*this, &Mixer_UI::mix_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
|
|
|
|
2006-03-09 18:44:39 -05:00
|
|
|
/* use checkbox for the visible column */
|
|
|
|
|
|
|
|
active_cell = dynamic_cast<CellRendererToggle*>(group_display.get_column_cell_renderer (2));
|
|
|
|
active_cell->property_activatable() = true;
|
|
|
|
active_cell->property_radio() = false;
|
|
|
|
|
|
|
|
group_model->signal_row_changed().connect (mem_fun (*this, &Mixer_UI::mix_group_row_change));
|
|
|
|
|
2006-02-14 14:12:35 -05:00
|
|
|
group_display.signal_button_press_event().connect (mem_fun (*this, &Mixer_UI::group_display_button_press), false);
|
|
|
|
|
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);
|
|
|
|
|
2006-05-19 13:29:05 -04:00
|
|
|
HBox* mix_group_display_button_box = manage (new HBox());
|
2006-03-09 23:05:11 -05:00
|
|
|
|
|
|
|
Button* mix_group_add_button = manage (new Button ());
|
|
|
|
Button* mix_group_remove_button = manage (new Button ());
|
|
|
|
|
|
|
|
Widget* w;
|
|
|
|
|
|
|
|
w = manage (new Image (Stock::ADD, ICON_SIZE_BUTTON));
|
|
|
|
w->show();
|
|
|
|
mix_group_add_button->add (*w);
|
|
|
|
|
|
|
|
w = manage (new Image (Stock::REMOVE, ICON_SIZE_BUTTON));
|
|
|
|
w->show();
|
|
|
|
mix_group_remove_button->add (*w);
|
2006-02-14 14:12:35 -05:00
|
|
|
|
2006-05-19 13:29:05 -04:00
|
|
|
mix_group_display_button_box->set_homogeneous (true);
|
|
|
|
|
2006-03-09 18:44:39 -05:00
|
|
|
mix_group_add_button->signal_clicked().connect (mem_fun (*this, &Mixer_UI::new_mix_group));
|
|
|
|
mix_group_remove_button->signal_clicked().connect (mem_fun (*this, &Mixer_UI::remove_selected_mix_group));
|
|
|
|
|
2006-05-19 13:29:05 -04:00
|
|
|
mix_group_display_button_box->add (*mix_group_remove_button);
|
|
|
|
mix_group_display_button_box->add (*mix_group_add_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);
|
2006-03-10 09:35:57 -05:00
|
|
|
group_display_vbox.pack_start (*mix_group_display_button_box, false, false);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
track_display_frame.set_name("BaseFrame");
|
2005-09-25 16:33:00 -04:00
|
|
|
track_display_frame.set_shadow_type (Gtk::SHADOW_IN);
|
2005-09-25 14:42:24 -04:00
|
|
|
track_display_frame.add(track_display_scroller);
|
|
|
|
|
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);
|
|
|
|
global_hpacker.pack_start (out_packer, false, false);
|
|
|
|
|
2006-05-22 07:12:26 -04:00
|
|
|
list_hpane.add1(list_vpacker);
|
2005-09-25 14:42:24 -04:00
|
|
|
list_hpane.add2(global_hpacker);
|
|
|
|
|
2005-10-05 09:48:09 -04:00
|
|
|
rhs_pane1.signal_size_allocate().connect (bind (mem_fun(*this, &Mixer_UI::pane_allocation_handler),
|
|
|
|
static_cast<Gtk::Paned*> (&rhs_pane1)));
|
|
|
|
list_hpane.signal_size_allocate().connect (bind (mem_fun(*this, &Mixer_UI::pane_allocation_handler),
|
|
|
|
static_cast<Gtk::Paned*> (&list_hpane)));
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
rhs_pane1.set_data ("collapse-direction", (gpointer) 0);
|
|
|
|
list_hpane.set_data ("collapse-direction", (gpointer) 1);
|
|
|
|
|
2006-01-17 11:40:57 -05:00
|
|
|
rhs_pane1.signal_button_release_event().connect (bind (sigc::ptr_fun (pane_handler), static_cast<Paned*>(&rhs_pane1)));
|
|
|
|
list_hpane.signal_button_release_event().connect (bind (sigc::ptr_fun (pane_handler), static_cast<Paned*>(&list_hpane)));
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
global_vpacker.pack_start (list_hpane, true, true);
|
|
|
|
|
|
|
|
add (global_vpacker);
|
|
|
|
set_name ("MixerWindow");
|
|
|
|
set_title (_("ardour: mixer"));
|
|
|
|
set_wmclass (_("ardour_mixer"), "Ardour");
|
|
|
|
|
2005-11-29 17:48:54 -05:00
|
|
|
add_accel_group (ActionManager::ui_manager->get_accel_group());
|
|
|
|
|
2006-08-30 16:48:16 -04:00
|
|
|
signal_delete_event().connect (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
|
|
|
|
|
|
|
_plugin_selector = new PluginSelector (PluginManager::the_manager());
|
|
|
|
|
2005-10-05 09:48:09 -04:00
|
|
|
signal_configure_event().connect (mem_fun (*ARDOUR_UI::instance(), &ARDOUR_UI::configure_handler));
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-09-25 17:19:23 -04:00
|
|
|
_selection.RoutesChanged.connect (mem_fun(*this, &Mixer_UI::follow_strip_selection));
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
Mixer_UI::~Mixer_UI ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::ensure_float (Window& win)
|
|
|
|
{
|
|
|
|
win.set_transient_for (*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::show_window ()
|
|
|
|
{
|
|
|
|
show_all ();
|
|
|
|
|
|
|
|
/* now reset each strips width so the right widgets are shown */
|
|
|
|
MixerStrip* ms;
|
|
|
|
|
2006-03-09 18:44:39 -05:00
|
|
|
TreeModel::Children rows = track_model->children();
|
2005-10-05 09:48:09 -04:00
|
|
|
TreeModel::Children::iterator ri;
|
|
|
|
|
|
|
|
for (ri = rows.begin(); ri != rows.end(); ++ri) {
|
2006-03-09 18:44:39 -05:00
|
|
|
ms = (*ri)[track_columns.strip];
|
2005-09-25 14:42:24 -04:00
|
|
|
ms->set_width (ms->get_width());
|
|
|
|
}
|
2006-08-30 16:48:16 -04:00
|
|
|
_visible = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
Mixer_UI::hide_window (GdkEventAny *ev)
|
|
|
|
{
|
|
|
|
_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
|
2006-08-16 22:12:20 -04:00
|
|
|
Mixer_UI::add_strip (Session::RouteList& routes)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2006-08-16 22:12:20 -04:00
|
|
|
ENSURE_GUI_THREAD(bind (mem_fun(*this, &Mixer_UI::add_strip), routes));
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
MixerStrip* strip;
|
2005-11-29 17:48:54 -05:00
|
|
|
|
2006-08-16 22:12:20 -04:00
|
|
|
for (Session::RouteList::iterator x = routes.begin(); x != routes.end(); ++x) {
|
|
|
|
boost::shared_ptr<Route> route = (*x);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-08-16 22:12:20 -04:00
|
|
|
if (route->hidden()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
strip = new MixerStrip (*this, *session, route);
|
|
|
|
strips.push_back (strip);
|
|
|
|
|
|
|
|
strip->set_width (_strip_width);
|
|
|
|
show_strip (strip);
|
|
|
|
|
|
|
|
no_track_list_redisplay = true;
|
|
|
|
|
|
|
|
TreeModel::Row row = *(track_model->append());
|
|
|
|
row[track_columns.text] = route->name();
|
|
|
|
|
|
|
|
row[track_columns.visible] = true;
|
|
|
|
row[track_columns.route] = route;
|
|
|
|
row[track_columns.strip] = strip;
|
|
|
|
|
|
|
|
no_track_list_redisplay = false;
|
|
|
|
redisplay_track_list ();
|
|
|
|
|
|
|
|
route->name_changed.connect (bind (mem_fun(*this, &Mixer_UI::strip_name_changed), strip));
|
|
|
|
strip->GoingAway.connect (bind (mem_fun(*this, &Mixer_UI::remove_strip), strip));
|
|
|
|
|
|
|
|
strip->signal_button_release_event().connect (bind (mem_fun(*this, &Mixer_UI::strip_button_release_event), strip));
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::remove_strip (MixerStrip* strip)
|
|
|
|
{
|
2005-09-25 17:19:23 -04:00
|
|
|
ENSURE_GUI_THREAD(bind (mem_fun(*this, &Mixer_UI::remove_strip), strip));
|
2005-09-25 14:42:24 -04:00
|
|
|
|
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;
|
|
|
|
|
|
|
|
if ((i = find (strips.begin(), strips.end(), strip)) != strips.end()) {
|
|
|
|
strips.erase (i);
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::follow_strip_selection ()
|
|
|
|
{
|
|
|
|
for (list<MixerStrip *>::iterator i = strips.begin(); i != strips.end(); ++i) {
|
2006-07-27 12:52:14 -04:00
|
|
|
(*i)->set_selected (_selection.selected ((*i)->route()));
|
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) {
|
|
|
|
|
|
|
|
/* this allows the user to click on the strip to terminate comment
|
|
|
|
editing. XXX it needs improving so that we don't select the strip
|
|
|
|
at the same time.
|
|
|
|
*/
|
|
|
|
|
2006-07-27 12:52:14 -04:00
|
|
|
if (_selection.selected (strip->route())) {
|
|
|
|
_selection.remove (strip->route());
|
2005-09-25 14:42:24 -04:00
|
|
|
} else {
|
|
|
|
if (Keyboard::modifier_state_equals (ev->state, Keyboard::Shift)) {
|
2006-07-27 12:52:14 -04:00
|
|
|
_selection.add (strip->route());
|
2005-09-25 14:42:24 -04:00
|
|
|
} else {
|
2006-07-27 12:52:14 -04:00
|
|
|
_selection.set (strip->route());
|
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
|
|
|
|
Mixer_UI::connect_to_session (Session* sess)
|
|
|
|
{
|
2006-08-30 16:48:16 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
session = sess;
|
|
|
|
|
2006-08-30 16:48:16 -04:00
|
|
|
XMLNode* node = ARDOUR_UI::instance()->mixer_settings();
|
|
|
|
set_state (*node);
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
string wintitle = _("ardour: mixer: ");
|
|
|
|
wintitle += session->name();
|
|
|
|
set_title (wintitle);
|
|
|
|
|
2006-01-11 22:43:52 -05:00
|
|
|
initial_track_display ();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-08-24 21:07:15 -04:00
|
|
|
session->GoingAway.connect (mem_fun(*this, &Mixer_UI::disconnect_from_session));
|
2005-09-25 17:19:23 -04:00
|
|
|
session->RouteAdded.connect (mem_fun(*this, &Mixer_UI::add_strip));
|
|
|
|
session->mix_group_added.connect (mem_fun(*this, &Mixer_UI::add_mix_group));
|
2006-03-09 18:44:39 -05:00
|
|
|
session->mix_group_removed.connect (mem_fun(*this, &Mixer_UI::mix_groups_changed));
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-03-09 18:44:39 -05:00
|
|
|
mix_groups_changed ();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
_plugin_selector->set_session (session);
|
|
|
|
|
2006-08-30 16:48:16 -04:00
|
|
|
if (_visible) {
|
|
|
|
show_window();
|
|
|
|
}
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
start_updating ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::disconnect_from_session ()
|
|
|
|
{
|
2005-09-25 17:19:23 -04:00
|
|
|
ENSURE_GUI_THREAD(mem_fun(*this, &Mixer_UI::disconnect_from_session));
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-03-09 18:44:39 -05:00
|
|
|
group_model->clear ();
|
2005-09-25 14:42:24 -04:00
|
|
|
set_title (_("ardour: mixer"));
|
|
|
|
stop_updating ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2006-01-11 22:43:52 -05:00
|
|
|
Mixer_UI::show_strip (MixerStrip* ms)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
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 i;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-09-28 12:22:43 -04:00
|
|
|
for (i = rows.begin(); i != rows.end(); ++i) {
|
2005-09-25 14:42:24 -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-03-09 18:44:39 -05:00
|
|
|
TreeModel::Children rows = track_model->children();
|
2005-09-28 12:22:43 -04:00
|
|
|
TreeModel::Children::iterator i;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-09-28 12:22:43 -04:00
|
|
|
for (i = rows.begin(); i != rows.end(); ++i) {
|
2005-09-25 14:42:24 -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
|
|
|
}
|
2005-11-29 17:48:54 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gint
|
|
|
|
Mixer_UI::start_updating ()
|
|
|
|
{
|
|
|
|
fast_screen_update_connection = ARDOUR_UI::instance()->SuperRapidScreenUpdate.connect (mem_fun(*this, &Mixer_UI::fast_update_strips));
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
gint
|
|
|
|
Mixer_UI::stop_updating ()
|
|
|
|
{
|
|
|
|
fast_screen_update_connection.disconnect();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::fast_update_strips ()
|
|
|
|
{
|
|
|
|
if (is_mapped () && session) {
|
|
|
|
for (list<MixerStrip *>::iterator i = strips.begin(); i != strips.end(); ++i) {
|
|
|
|
(*i)->fast_update ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-11 22:43:52 -05:00
|
|
|
void
|
|
|
|
Mixer_UI::set_all_strips_visibility (bool yn)
|
|
|
|
{
|
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;
|
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];
|
2006-01-11 22:43:52 -05:00
|
|
|
|
|
|
|
if (strip == 0) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2006-07-27 12:52:14 -04:00
|
|
|
if (strip->route()->master() || strip->route()->control()) {
|
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
|
|
|
|
Mixer_UI::set_all_audio_visibility (int tracks, bool yn)
|
|
|
|
{
|
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;
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2006-07-27 12:52:14 -04:00
|
|
|
if (strip->route()->master() || strip->route()->control()) {
|
2006-01-11 22:43:52 -05:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2006-07-27 12:52:14 -04:00
|
|
|
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;
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::track_list_change (const Gtk::TreeModel::Path& path,const Gtk::TreeModel::iterator& iter)
|
|
|
|
{
|
|
|
|
redisplay_track_list ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::track_list_delete (const Gtk::TreeModel::Path& path)
|
|
|
|
{
|
|
|
|
redisplay_track_list ();
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2006-03-09 18:44:39 -05:00
|
|
|
bool visible = (*i)[track_columns.visible];
|
2006-01-11 22:43:52 -05:00
|
|
|
|
|
|
|
if (visible) {
|
|
|
|
strip->set_marked_for_display (true);
|
2006-07-27 12:52:14 -04:00
|
|
|
strip->route()->set_order_key (N_("signal"), order);
|
2006-01-11 22:43:52 -05:00
|
|
|
|
|
|
|
if (strip->packed()) {
|
|
|
|
|
2006-07-27 12:52:14 -04:00
|
|
|
if (strip->route()->master() || strip->route()->control()) {
|
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 {
|
|
|
|
|
2006-07-27 12:52:14 -04:00
|
|
|
if (strip->route()->master() || strip->route()->control()) {
|
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);
|
2006-01-17 11:40:57 -05:00
|
|
|
strip->show_all ();
|
2006-01-11 22:43:52 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
2006-07-27 12:52:14 -04:00
|
|
|
if (strip->route()->master() || strip->route()->control()) {
|
2006-01-11 22:43:52 -05:00
|
|
|
/* do nothing, these cannot be hidden */
|
|
|
|
} else {
|
|
|
|
strip_packer.remove (*strip);
|
|
|
|
strip->set_packed (false);
|
|
|
|
}
|
2005-09-25 14:42:24 -04: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 */
|
2006-02-12 19:49:26 -05:00
|
|
|
return a->order_key ("signal") < b->order_key ("signal");
|
2006-01-11 22:43:52 -05:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::initial_track_display ()
|
|
|
|
{
|
2006-07-27 12:52:14 -04:00
|
|
|
boost::shared_ptr<Session::RouteList> routes = session->get_routes();
|
|
|
|
Session::RouteList copy (*routes);
|
2006-01-11 22:43:52 -05:00
|
|
|
SignalOrderRouteSorter sorter;
|
|
|
|
|
2006-07-27 12:52:14 -04:00
|
|
|
copy.sort (sorter);
|
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-01-11 22:43:52 -05:00
|
|
|
track_menu->popup (1, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
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) {
|
|
|
|
|
2006-07-27 12:52:14 -04:00
|
|
|
if (!strip->route()->master() && !strip->route()->control()) {
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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();
|
|
|
|
|
2006-01-11 22:43:52 -05:00
|
|
|
items.push_back (MenuElem (_("Show All"), mem_fun(*this, &Mixer_UI::show_all_routes)));
|
|
|
|
items.push_back (MenuElem (_("Hide All"), mem_fun(*this, &Mixer_UI::hide_all_routes)));
|
|
|
|
items.push_back (MenuElem (_("Show All Audio Tracks"), mem_fun(*this, &Mixer_UI::show_all_audiotracks)));
|
|
|
|
items.push_back (MenuElem (_("Hide All Audio Tracks"), mem_fun(*this, &Mixer_UI::hide_all_audiotracks)));
|
|
|
|
items.push_back (MenuElem (_("Show All Audio Busses"), mem_fun(*this, &Mixer_UI::show_all_audiobus)));
|
|
|
|
items.push_back (MenuElem (_("Hide All Audio Busses"), mem_fun(*this, &Mixer_UI::hide_all_audiobus)));
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::strip_name_changed (void* src, MixerStrip* mx)
|
|
|
|
{
|
2005-09-25 17:19:23 -04:00
|
|
|
ENSURE_GUI_THREAD(bind (mem_fun(*this, &Mixer_UI::strip_name_changed), src, mx));
|
2005-09-25 14:42:24 -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;
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
2006-03-09 18:44:39 -05:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void
|
2006-03-09 18:44:39 -05:00
|
|
|
Mixer_UI::build_mix_group_context_menu ()
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2006-03-09 18:44:39 -05:00
|
|
|
using namespace Gtk::Menu_Helpers;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-03-09 18:44:39 -05:00
|
|
|
mix_group_context_menu = new Menu;
|
|
|
|
mix_group_context_menu->set_name ("ArdourContextMenu");
|
|
|
|
MenuList& items = mix_group_context_menu->items();
|
|
|
|
|
|
|
|
items.push_back (MenuElem (_("Activate All"), mem_fun(*this, &Mixer_UI::activate_all_mix_groups)));
|
|
|
|
items.push_back (MenuElem (_("Disable All"), mem_fun(*this, &Mixer_UI::disable_all_mix_groups)));
|
|
|
|
items.push_back (SeparatorElem());
|
|
|
|
items.push_back (MenuElem (_("Add group"), mem_fun(*this, &Mixer_UI::new_mix_group)));
|
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
|
|
|
{
|
2006-03-09 18:44:39 -05:00
|
|
|
if (Keyboard::is_context_menu_event (ev)) {
|
|
|
|
if (mix_group_context_menu == 0) {
|
|
|
|
build_mix_group_context_menu ();
|
|
|
|
}
|
|
|
|
mix_group_context_menu->popup (1, 0);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-03-09 18:44:39 -05:00
|
|
|
RouteGroup* group;
|
2005-10-01 12:29:37 -04:00
|
|
|
TreeIter iter;
|
|
|
|
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
|
|
|
|
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)) {
|
2006-03-09 18:44:39 -05:00
|
|
|
if ((iter = group_model->get_iter (path))) {
|
|
|
|
if ((group = (*iter)[group_columns.group]) != 0) {
|
|
|
|
// edit_mix_group (group);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2006-02-14 14:12:35 -05:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
2006-03-09 18:44:39 -05:00
|
|
|
if ((iter = group_model->get_iter (path))) {
|
|
|
|
bool active = (*iter)[group_columns.active];
|
|
|
|
(*iter)[group_columns.active] = !active;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
break;
|
2005-10-01 12:29:37 -04:00
|
|
|
|
2006-03-09 18:44:39 -05:00
|
|
|
case 2:
|
|
|
|
if ((iter = group_model->get_iter (path))) {
|
|
|
|
bool visible = (*iter)[group_columns.visible];
|
|
|
|
(*iter)[group_columns.visible] = !visible;
|
|
|
|
return true;
|
2005-10-01 12:29:37 -04:00
|
|
|
}
|
|
|
|
break;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-03-09 18:44:39 -05:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::activate_all_mix_groups ()
|
|
|
|
{
|
|
|
|
Gtk::TreeModel::Children children = group_model->children();
|
|
|
|
for(Gtk::TreeModel::Children::iterator iter = children.begin(); iter != children.end(); ++iter) {
|
|
|
|
(*iter)[group_columns.active] = true;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2006-03-09 18:44:39 -05:00
|
|
|
Mixer_UI::disable_all_mix_groups ()
|
|
|
|
{
|
|
|
|
Gtk::TreeModel::Children children = group_model->children();
|
|
|
|
for(Gtk::TreeModel::Children::iterator iter = children.begin(); iter != children.end(); ++iter) {
|
|
|
|
(*iter)[group_columns.active] = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::mix_groups_changed ()
|
|
|
|
{
|
|
|
|
ENSURE_GUI_THREAD (mem_fun (*this, &Mixer_UI::mix_groups_changed));
|
|
|
|
|
|
|
|
/* just rebuild the while thing */
|
|
|
|
|
|
|
|
group_model->clear ();
|
|
|
|
|
|
|
|
{
|
|
|
|
TreeModel::Row row;
|
|
|
|
row = *(group_model->append());
|
|
|
|
row[group_columns.active] = false;
|
|
|
|
row[group_columns.visible] = true;
|
|
|
|
row[group_columns.text] = (_("-all-"));
|
|
|
|
row[group_columns.group] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
session->foreach_mix_group (mem_fun (*this, &Mixer_UI::add_mix_group));
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::new_mix_group ()
|
|
|
|
{
|
2006-03-09 23:05:11 -05:00
|
|
|
session->add_mix_group ("");
|
2006-03-09 18:44:39 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::remove_selected_mix_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;
|
|
|
|
|
|
|
|
/* 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) {
|
|
|
|
session->remove_mix_group (*rg);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::group_flags_changed (void* src, RouteGroup* group)
|
|
|
|
{
|
2006-03-09 18:44:39 -05:00
|
|
|
if (in_group_row_change) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2005-09-25 17:19:23 -04:00
|
|
|
ENSURE_GUI_THREAD(bind (mem_fun(*this, &Mixer_UI::group_flags_changed), src, group));
|
2005-09-25 14:42:24 -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;
|
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.active] = group->is_active ();
|
|
|
|
(*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;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::mix_group_name_edit (const Glib::ustring& path, const Glib::ustring& new_text)
|
|
|
|
{
|
|
|
|
RouteGroup* group;
|
|
|
|
TreeIter iter;
|
|
|
|
|
|
|
|
if ((iter = group_model->get_iter (path))) {
|
|
|
|
|
|
|
|
if ((group = (*iter)[group_columns.group]) == 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (new_text != group->name()) {
|
|
|
|
group->set_name (new_text);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::mix_group_row_change (const Gtk::TreeModel::Path& path,const Gtk::TreeModel::iterator& iter)
|
|
|
|
{
|
|
|
|
RouteGroup* group;
|
|
|
|
|
|
|
|
if (in_group_row_change) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((group = (*iter)[group_columns.group]) == 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((*iter)[group_columns.visible]) {
|
|
|
|
for (list<MixerStrip *>::iterator i = strips.begin(); i != strips.end(); ++i) {
|
|
|
|
if ((*i)->mix_group() == group) {
|
|
|
|
show_strip (*i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for (list<MixerStrip *>::iterator i = strips.begin(); i != strips.end(); ++i) {
|
|
|
|
if ((*i)->mix_group() == group) {
|
|
|
|
hide_strip (*i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool active = (*iter)[group_columns.active];
|
|
|
|
group->set_active (active, this);
|
|
|
|
|
|
|
|
Glib::ustring name = (*iter)[group_columns.text];
|
|
|
|
|
|
|
|
if (name != group->name()) {
|
|
|
|
group->set_name (name);
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::add_mix_group (RouteGroup* group)
|
|
|
|
|
|
|
|
{
|
2005-09-25 17:19:23 -04:00
|
|
|
ENSURE_GUI_THREAD(bind (mem_fun(*this, &Mixer_UI::add_mix_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());
|
|
|
|
row[group_columns.active] = group->is_active();
|
|
|
|
row[group_columns.visible] = true;
|
|
|
|
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
|
|
|
|
2005-09-25 17:19:23 -04:00
|
|
|
group->FlagsChanged.connect (bind (mem_fun(*this, &Mixer_UI::group_flags_changed), group));
|
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
|
|
|
|
|
|
|
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)) {
|
|
|
|
ARDOUR_UI::instance()->add_route();
|
2006-01-04 22:18:44 -05:00
|
|
|
return true;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2006-01-04 22:18:44 -05:00
|
|
|
return false;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Mixer_UI::set_strip_width (Width w)
|
|
|
|
{
|
|
|
|
_strip_width = w;
|
|
|
|
|
|
|
|
for (list<MixerStrip*>::iterator i = strips.begin(); i != strips.end(); ++i) {
|
|
|
|
(*i)->set_width (w);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
Mixer_UI::set_state (const XMLNode& node)
|
|
|
|
{
|
|
|
|
const XMLProperty* prop;
|
|
|
|
XMLNode* geometry;
|
2006-01-17 11:40:57 -05:00
|
|
|
Gdk::Geometry g;
|
|
|
|
int x, y, xoff, yoff;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
if ((geometry = find_named_node (node, "geometry")) == 0) {
|
|
|
|
|
2006-01-17 11:40:57 -05:00
|
|
|
g.base_width = default_width;
|
|
|
|
g.base_height = default_height;
|
2005-09-25 14:42:24 -04:00
|
|
|
x = 1;
|
|
|
|
y = 1;
|
|
|
|
xoff = 0;
|
|
|
|
yoff = 21;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
2006-01-17 11:40:57 -05:00
|
|
|
g.base_width = atoi(geometry->property("x_size")->value().c_str());
|
|
|
|
g.base_height = atoi(geometry->property("y_size")->value().c_str());
|
2005-09-25 14:42:24 -04:00
|
|
|
x = atoi(geometry->property("x_pos")->value().c_str());
|
|
|
|
y = atoi(geometry->property("y_pos")->value().c_str());
|
|
|
|
xoff = atoi(geometry->property("x_off")->value().c_str());
|
|
|
|
yoff = atoi(geometry->property("y_off")->value().c_str());
|
|
|
|
}
|
2006-01-17 11:40:57 -05:00
|
|
|
|
|
|
|
set_geometry_hints (global_vpacker, g, Gdk::HINT_BASE_SIZE);
|
|
|
|
set_default_size(g.base_width, g.base_height);
|
|
|
|
move (x, y);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
if ((prop = node.property ("narrow-strips"))) {
|
|
|
|
if (prop->value() == "yes") {
|
|
|
|
set_strip_width (Narrow);
|
|
|
|
} else {
|
|
|
|
set_strip_width (Wide);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-08-30 16:48:16 -04:00
|
|
|
if ((prop = node.property ("show-mixer"))) {
|
|
|
|
if (prop->value() == "yes") {
|
|
|
|
_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();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
int x, y, xoff, yoff, width, height;
|
2005-10-05 09:48:09 -04:00
|
|
|
win->get_root_origin(x, y);
|
|
|
|
win->get_position(xoff, yoff);
|
|
|
|
win->get_size(width, height);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
XMLNode* geometry = new XMLNode ("geometry");
|
|
|
|
char buf[32];
|
|
|
|
snprintf(buf, sizeof(buf), "%d", width);
|
|
|
|
geometry->add_property(X_("x_size"), string(buf));
|
|
|
|
snprintf(buf, sizeof(buf), "%d", height);
|
|
|
|
geometry->add_property(X_("y_size"), string(buf));
|
|
|
|
snprintf(buf, sizeof(buf), "%d", x);
|
|
|
|
geometry->add_property(X_("x_pos"), string(buf));
|
|
|
|
snprintf(buf, sizeof(buf), "%d", y);
|
|
|
|
geometry->add_property(X_("y_pos"), string(buf));
|
|
|
|
snprintf(buf, sizeof(buf), "%d", xoff);
|
|
|
|
geometry->add_property(X_("x_off"), string(buf));
|
|
|
|
snprintf(buf, sizeof(buf), "%d", yoff);
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2005-10-05 09:48:09 -04:00
|
|
|
Mixer_UI::pane_allocation_handler (Allocation& alloc, 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;
|
|
|
|
int width, height;
|
|
|
|
static int32_t done[3] = { 0, 0, 0 };
|
|
|
|
|
|
|
|
if ((geometry = find_named_node (*node, "geometry")) == 0) {
|
|
|
|
width = default_width;
|
|
|
|
height = default_height;
|
|
|
|
} else {
|
|
|
|
width = atoi(geometry->property("x_size")->value());
|
|
|
|
height = atoi(geometry->property("y_size")->value());
|
|
|
|
}
|
|
|
|
|
|
|
|
if (which == static_cast<Gtk::Paned*> (&rhs_pane1)) {
|
|
|
|
|
|
|
|
if (done[0]) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!geometry || (prop = geometry->property("mixer_rhs_pane1_pos")) == 0) {
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!geometry || (prop = geometry->property("mixer_list_hpane_pos")) == 0) {
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-03-09 18:44:39 -05:00
|
|
|
bool
|
|
|
|
Mixer_UI::on_key_press_event (GdkEventKey* ev)
|
|
|
|
{
|
|
|
|
return key_press_focus_accelerator_handler (*this, ev);
|
|
|
|
}
|