2009-07-03 14:37:15 -04:00
|
|
|
/*
|
2009-10-14 12:10:01 -04:00
|
|
|
Copyright (C) 2000 Paul Davis
|
2009-07-03 14:37:15 -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.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <cmath>
|
|
|
|
|
|
|
|
#include <gtkmm2ext/stop_signal.h>
|
|
|
|
#include <gtkmm2ext/gtk_ui.h>
|
|
|
|
#include "ardour/route_group.h"
|
|
|
|
|
|
|
|
#include "editor.h"
|
|
|
|
#include "keyboard.h"
|
|
|
|
#include "marker.h"
|
|
|
|
#include "time_axis_view.h"
|
|
|
|
#include "prompter.h"
|
|
|
|
#include "gui_thread.h"
|
|
|
|
#include "editor_group_tabs.h"
|
|
|
|
#include "route_group_dialog.h"
|
|
|
|
#include "route_time_axis.h"
|
|
|
|
#include "editor_routes.h"
|
|
|
|
#include "editor_route_groups.h"
|
|
|
|
|
|
|
|
#include "ardour/route.h"
|
2009-10-30 11:30:22 -04:00
|
|
|
#include "ardour/session.h"
|
2009-07-03 14:37:15 -04:00
|
|
|
|
|
|
|
#include "i18n.h"
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
using namespace ARDOUR;
|
|
|
|
using namespace PBD;
|
|
|
|
using namespace Gtk;
|
2009-12-04 17:51:32 -05:00
|
|
|
using Gtkmm2ext::Keyboard;
|
2009-07-03 14:37:15 -04:00
|
|
|
|
|
|
|
EditorRouteGroups::EditorRouteGroups (Editor* e)
|
|
|
|
: EditorComponent (e),
|
|
|
|
_menu (0),
|
|
|
|
_in_row_change (false)
|
|
|
|
|
|
|
|
{
|
|
|
|
_model = ListStore::create (_columns);
|
|
|
|
_display.set_model (_model);
|
|
|
|
|
|
|
|
_display.append_column (_("Name"), _columns.text);
|
|
|
|
|
|
|
|
_display.append_column (_("G"), _columns.gain);
|
|
|
|
_display.append_column (_("R"), _columns.record);
|
|
|
|
_display.append_column (_("M"), _columns.mute);
|
|
|
|
_display.append_column (_("S"), _columns.solo);
|
|
|
|
_display.append_column (_("Sel"), _columns.select);
|
|
|
|
_display.append_column (_("E"), _columns.edits);
|
|
|
|
|
|
|
|
_display.append_column (_("Show"), _columns.is_visible);
|
|
|
|
|
|
|
|
_display.get_column (0)->set_data (X_("colnum"), GUINT_TO_POINTER(0));
|
|
|
|
_display.get_column (1)->set_data (X_("colnum"), GUINT_TO_POINTER(1));
|
|
|
|
_display.get_column (2)->set_data (X_("colnum"), GUINT_TO_POINTER(2));
|
|
|
|
_display.get_column (3)->set_data (X_("colnum"), GUINT_TO_POINTER(3));
|
|
|
|
_display.get_column (4)->set_data (X_("colnum"), GUINT_TO_POINTER(4));
|
|
|
|
_display.get_column (5)->set_data (X_("colnum"), GUINT_TO_POINTER(5));
|
|
|
|
_display.get_column (6)->set_data (X_("colnum"), GUINT_TO_POINTER(6));
|
|
|
|
_display.get_column (7)->set_data (X_("colnum"), GUINT_TO_POINTER(7));
|
|
|
|
|
|
|
|
_display.get_column (0)->set_expand (true);
|
|
|
|
_display.get_column (1)->set_expand (false);
|
|
|
|
_display.get_column (2)->set_expand (false);
|
|
|
|
_display.get_column (3)->set_expand (false);
|
|
|
|
_display.get_column (4)->set_expand (false);
|
|
|
|
_display.get_column (5)->set_expand (false);
|
|
|
|
_display.get_column (6)->set_expand (false);
|
|
|
|
_display.get_column (7)->set_expand (false);
|
|
|
|
|
|
|
|
_display.set_headers_visible (true);
|
|
|
|
|
|
|
|
/* name is directly editable */
|
|
|
|
|
|
|
|
CellRendererText* name_cell = dynamic_cast<CellRendererText*>(_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, &EditorRouteGroups::name_edit));
|
2009-07-03 14:37:15 -04:00
|
|
|
|
|
|
|
/* use checkbox for the active + visible columns */
|
|
|
|
|
|
|
|
CellRendererToggle* active_cell = dynamic_cast<CellRendererToggle*>(_display.get_column_cell_renderer (1));
|
|
|
|
active_cell->property_activatable() = true;
|
|
|
|
active_cell->property_radio() = false;
|
|
|
|
|
|
|
|
active_cell = dynamic_cast<CellRendererToggle*>(_display.get_column_cell_renderer (2));
|
|
|
|
active_cell->property_activatable() = true;
|
|
|
|
active_cell->property_radio() = false;
|
|
|
|
|
|
|
|
active_cell = dynamic_cast<CellRendererToggle*>(_display.get_column_cell_renderer (3));
|
|
|
|
active_cell->property_activatable() = true;
|
|
|
|
active_cell->property_radio() = false;
|
|
|
|
|
|
|
|
active_cell = dynamic_cast<CellRendererToggle*>(_display.get_column_cell_renderer (4));
|
|
|
|
active_cell->property_activatable() = true;
|
|
|
|
active_cell->property_radio() = false;
|
|
|
|
|
|
|
|
active_cell = dynamic_cast<CellRendererToggle*>(_display.get_column_cell_renderer (5));
|
|
|
|
active_cell->property_activatable() = true;
|
|
|
|
active_cell->property_radio() = false;
|
|
|
|
|
|
|
|
active_cell = dynamic_cast<CellRendererToggle*>(_display.get_column_cell_renderer (6));
|
|
|
|
active_cell->property_activatable() = true;
|
|
|
|
active_cell->property_radio() = false;
|
|
|
|
|
|
|
|
active_cell = dynamic_cast<CellRendererToggle*>(_display.get_column_cell_renderer (7));
|
|
|
|
active_cell->property_activatable() = true;
|
|
|
|
active_cell->property_radio() = false;
|
|
|
|
|
2009-12-11 18:29:48 -05:00
|
|
|
_model->signal_row_changed().connect (sigc::mem_fun (*this, &EditorRouteGroups::row_change));
|
2009-07-03 14:37:15 -04:00
|
|
|
|
|
|
|
_display.set_name ("EditGroupList");
|
|
|
|
_display.get_selection()->set_mode (SELECTION_SINGLE);
|
|
|
|
_display.set_headers_visible (true);
|
|
|
|
_display.set_reorderable (false);
|
|
|
|
_display.set_rules_hint (true);
|
|
|
|
_display.set_size_request (75, -1);
|
|
|
|
|
|
|
|
_scroller.add (_display);
|
|
|
|
_scroller.set_policy (POLICY_AUTOMATIC, POLICY_AUTOMATIC);
|
|
|
|
|
2009-12-11 18:29:48 -05:00
|
|
|
_display.signal_button_press_event().connect (sigc::mem_fun(*this, &EditorRouteGroups::button_press_event), false);
|
2009-07-03 14:37:15 -04:00
|
|
|
|
|
|
|
_display_packer = new VBox;
|
|
|
|
HBox* button_box = manage (new HBox());
|
|
|
|
button_box->set_homogeneous (true);
|
|
|
|
|
|
|
|
Button* add_button = manage (new Button ());
|
|
|
|
Button* remove_button = manage (new Button ());
|
|
|
|
|
|
|
|
Widget* w;
|
|
|
|
|
|
|
|
w = manage (new Image (Stock::ADD, ICON_SIZE_BUTTON));
|
|
|
|
w->show();
|
|
|
|
add_button->add (*w);
|
|
|
|
|
|
|
|
w = manage (new Image (Stock::REMOVE, ICON_SIZE_BUTTON));
|
|
|
|
w->show();
|
|
|
|
remove_button->add (*w);
|
|
|
|
|
2009-12-11 18:29:48 -05:00
|
|
|
add_button->signal_clicked().connect (hide_return (sigc::mem_fun (*this, &EditorRouteGroups::new_route_group)));
|
|
|
|
remove_button->signal_clicked().connect (sigc::mem_fun (*this, &EditorRouteGroups::remove_selected));
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-03 14:37:15 -04:00
|
|
|
button_box->pack_start (*add_button);
|
|
|
|
button_box->pack_start (*remove_button);
|
|
|
|
|
|
|
|
_display_packer->pack_start (_scroller, true, true);
|
|
|
|
_display_packer->pack_start (*button_box, false, false);
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-03 14:37:15 -04:00
|
|
|
|
|
|
|
Gtk::Menu*
|
|
|
|
EditorRouteGroups::menu (RouteGroup* g)
|
|
|
|
{
|
|
|
|
using namespace Gtk::Menu_Helpers;
|
|
|
|
|
|
|
|
delete _menu;
|
|
|
|
|
|
|
|
Menu* new_from = new Menu;
|
|
|
|
MenuList& f = new_from->items ();
|
2009-12-11 18:29:48 -05:00
|
|
|
f.push_back (MenuElem (_("Selection..."), sigc::mem_fun (*this, &EditorRouteGroups::new_from_selection)));
|
|
|
|
f.push_back (MenuElem (_("Record Enabled..."), sigc::mem_fun (*this, &EditorRouteGroups::new_from_rec_enabled)));
|
|
|
|
f.push_back (MenuElem (_("Soloed..."), sigc::mem_fun (*this, &EditorRouteGroups::new_from_soloed)));
|
2009-07-03 14:37:15 -04:00
|
|
|
|
|
|
|
_menu = new Menu;
|
|
|
|
_menu->set_name ("ArdourContextMenu");
|
|
|
|
MenuList& items = _menu->items();
|
|
|
|
|
2009-12-11 18:29:48 -05:00
|
|
|
items.push_back (MenuElem (_("New..."), hide_return (sigc::mem_fun(*this, &EditorRouteGroups::new_route_group))));
|
2009-07-03 14:37:15 -04:00
|
|
|
items.push_back (MenuElem (_("New From"), *new_from));
|
|
|
|
if (g) {
|
2009-12-11 18:29:48 -05:00
|
|
|
items.push_back (MenuElem (_("Edit..."), sigc::bind (sigc::mem_fun (*this, &EditorRouteGroups::edit), g)));
|
|
|
|
items.push_back (MenuElem (_("Fit to Window"), sigc::bind (sigc::mem_fun (*_editor, &Editor::fit_route_group), g)));
|
|
|
|
items.push_back (MenuElem (_("Subgroup"), sigc::bind (sigc::mem_fun (*this, &EditorRouteGroups::subgroup), g)));
|
|
|
|
items.push_back (MenuElem (_("Collect"), sigc::bind (sigc::mem_fun (*this, &EditorRouteGroups::collect), g)));
|
2009-07-03 14:37:15 -04:00
|
|
|
}
|
|
|
|
items.push_back (SeparatorElem());
|
2009-12-11 18:29:48 -05:00
|
|
|
items.push_back (MenuElem (_("Activate All"), sigc::mem_fun(*this, &EditorRouteGroups::activate_all)));
|
|
|
|
items.push_back (MenuElem (_("Disable All"), sigc::mem_fun(*this, &EditorRouteGroups::disable_all)));
|
2009-07-03 14:37:15 -04:00
|
|
|
|
|
|
|
return _menu;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
EditorRouteGroups::subgroup (RouteGroup* g)
|
|
|
|
{
|
|
|
|
g->make_subgroup ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
EditorRouteGroups::unsubgroup (RouteGroup* g)
|
|
|
|
{
|
|
|
|
g->destroy_subgroup ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
EditorRouteGroups::activate_all ()
|
|
|
|
{
|
|
|
|
_session->foreach_route_group (
|
2009-12-11 18:29:48 -05:00
|
|
|
sigc::bind (sigc::mem_fun (*this, &EditorRouteGroups::set_activation), true)
|
2009-07-03 14:37:15 -04:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
EditorRouteGroups::disable_all ()
|
|
|
|
{
|
|
|
|
_session->foreach_route_group (
|
2009-12-11 18:29:48 -05:00
|
|
|
sigc::bind (sigc::mem_fun (*this, &EditorRouteGroups::set_activation), false)
|
2009-07-03 14:37:15 -04:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
EditorRouteGroups::set_activation (RouteGroup* g, bool a)
|
|
|
|
{
|
|
|
|
g->set_active (a, this);
|
|
|
|
}
|
|
|
|
|
2009-12-01 10:32:42 -05:00
|
|
|
ARDOUR::RouteGroup *
|
|
|
|
EditorRouteGroups::new_route_group () const
|
2009-07-03 14:37:15 -04:00
|
|
|
{
|
|
|
|
RouteGroup* g = new RouteGroup (
|
|
|
|
*_session,
|
|
|
|
"",
|
|
|
|
RouteGroup::Active,
|
|
|
|
(RouteGroup::Property) (RouteGroup::Mute | RouteGroup::Solo | RouteGroup::Edit)
|
|
|
|
);
|
|
|
|
|
|
|
|
RouteGroupDialog d (g, Gtk::Stock::NEW);
|
|
|
|
int const r = d.do_run ();
|
|
|
|
|
2009-12-01 10:32:42 -05:00
|
|
|
if (r != Gtk::RESPONSE_OK) {
|
2009-07-03 14:37:15 -04:00
|
|
|
delete g;
|
2009-12-01 10:32:42 -05:00
|
|
|
return 0;
|
2009-07-03 14:37:15 -04:00
|
|
|
}
|
2009-12-01 10:32:42 -05:00
|
|
|
|
|
|
|
_session->add_route_group (g);
|
|
|
|
return g;
|
2009-07-03 14:37:15 -04:00
|
|
|
}
|
|
|
|
void
|
2009-11-20 10:26:34 -05:00
|
|
|
EditorRouteGroups::run_new_group_dialog (const RouteList& rl)
|
2009-07-03 14:37:15 -04:00
|
|
|
{
|
|
|
|
RouteGroup* g = new RouteGroup (
|
|
|
|
*_session,
|
|
|
|
"",
|
|
|
|
RouteGroup::Active,
|
2009-11-20 10:26:34 -05:00
|
|
|
(RouteGroup::Property) (RouteGroup::Mute | RouteGroup::Solo | RouteGroup::Edit | RouteGroup::RecEnable)
|
2009-07-03 14:37:15 -04:00
|
|
|
);
|
|
|
|
|
|
|
|
RouteGroupDialog d (g, Gtk::Stock::NEW);
|
|
|
|
int const r = d.do_run ();
|
|
|
|
|
2009-11-20 10:26:34 -05:00
|
|
|
switch (r) {
|
|
|
|
case Gtk::RESPONSE_OK:
|
|
|
|
case Gtk::RESPONSE_ACCEPT:
|
2009-07-03 14:37:15 -04:00
|
|
|
_session->add_route_group (g);
|
2009-11-20 10:26:34 -05:00
|
|
|
for (RouteList::const_iterator i = rl.begin(); i != rl.end(); ++i) {
|
2009-12-09 22:25:32 -05:00
|
|
|
g->add (*i);
|
2009-07-03 14:37:15 -04:00
|
|
|
}
|
2009-11-20 10:26:34 -05:00
|
|
|
break;
|
|
|
|
default:
|
2009-07-03 14:37:15 -04:00
|
|
|
delete g;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-11-20 10:26:34 -05:00
|
|
|
EditorRouteGroups::new_from_selection ()
|
2009-07-03 14:37:15 -04:00
|
|
|
{
|
2009-11-20 10:26:34 -05:00
|
|
|
if (_editor->get_selection().tracks.empty()) {
|
|
|
|
return;
|
|
|
|
}
|
2009-07-03 14:37:15 -04:00
|
|
|
|
2009-11-20 10:26:34 -05:00
|
|
|
RouteList rl;
|
2009-07-03 14:37:15 -04:00
|
|
|
|
2009-11-20 10:26:34 -05:00
|
|
|
for (TrackSelection::iterator i = _editor->get_selection().tracks.begin(); i != _editor->get_selection().tracks.end(); ++i) {
|
|
|
|
RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (*i);
|
|
|
|
if (rtv) {
|
|
|
|
rl.push_back (rtv->route());
|
2009-07-03 14:37:15 -04:00
|
|
|
}
|
2009-11-20 10:26:34 -05:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-11-20 10:26:34 -05:00
|
|
|
if (rl.empty()) {
|
|
|
|
return;
|
2009-07-03 14:37:15 -04:00
|
|
|
}
|
2009-11-20 10:26:34 -05:00
|
|
|
|
|
|
|
run_new_group_dialog (rl);
|
2009-07-03 14:37:15 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-11-20 10:26:34 -05:00
|
|
|
EditorRouteGroups::new_from_rec_enabled ()
|
2009-07-03 14:37:15 -04:00
|
|
|
{
|
2009-11-20 10:26:34 -05:00
|
|
|
RouteList rl;
|
2009-07-03 14:37:15 -04:00
|
|
|
|
2009-12-13 14:09:52 -05:00
|
|
|
for (TrackViewList::const_iterator i = _editor->get_track_views().begin(); i != _editor->get_track_views().end(); ++i) {
|
2009-11-20 10:26:34 -05:00
|
|
|
RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (*i);
|
|
|
|
if (rtv && rtv->route()->record_enabled()) {
|
|
|
|
rl.push_back (rtv->route());
|
|
|
|
}
|
|
|
|
}
|
2009-07-03 14:37:15 -04:00
|
|
|
|
2009-11-20 10:26:34 -05:00
|
|
|
if (rl.empty()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
run_new_group_dialog (rl);
|
|
|
|
}
|
2009-07-03 14:37:15 -04:00
|
|
|
|
2009-11-20 10:26:34 -05:00
|
|
|
void
|
|
|
|
EditorRouteGroups::new_from_soloed ()
|
|
|
|
{
|
|
|
|
RouteList rl;
|
|
|
|
|
2009-12-13 14:09:52 -05:00
|
|
|
for (TrackViewList::const_iterator i = _editor->get_track_views().begin(); i != _editor->get_track_views().end(); ++i) {
|
2009-11-20 10:26:34 -05:00
|
|
|
RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (*i);
|
|
|
|
if (rtv && !rtv->route()->is_master() && rtv->route()->soloed()) {
|
|
|
|
rl.push_back (rtv->route());
|
2009-07-03 14:37:15 -04:00
|
|
|
}
|
2009-11-20 10:26:34 -05:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-11-20 10:26:34 -05:00
|
|
|
if (rl.empty()) {
|
|
|
|
return;
|
2009-07-03 14:37:15 -04:00
|
|
|
}
|
2009-11-20 10:26:34 -05:00
|
|
|
|
|
|
|
run_new_group_dialog (rl);
|
2009-07-03 14:37:15 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
EditorRouteGroups::edit (RouteGroup* g)
|
|
|
|
{
|
|
|
|
RouteGroupDialog d (g, Gtk::Stock::APPLY);
|
|
|
|
d.do_run ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
EditorRouteGroups::remove_selected ()
|
|
|
|
{
|
|
|
|
Glib::RefPtr<TreeSelection> selection = _display.get_selection();
|
|
|
|
TreeView::Selection::ListHandle_Path rows = selection->get_selected_rows ();
|
|
|
|
|
|
|
|
if (rows.empty()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
TreeView::Selection::ListHandle_Path::iterator i = rows.begin();
|
|
|
|
TreeIter iter;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-03 14:37:15 -04:00
|
|
|
/* selection mode is single, so rows.begin() is it */
|
|
|
|
|
|
|
|
if ((iter = _model->get_iter (*i))) {
|
|
|
|
|
|
|
|
RouteGroup* rg = (*iter)[_columns.routegroup];
|
|
|
|
|
|
|
|
if (rg) {
|
|
|
|
_session->remove_route_group (*rg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
EditorRouteGroups::button_clicked ()
|
|
|
|
{
|
|
|
|
new_route_group ();
|
|
|
|
}
|
|
|
|
|
|
|
|
gint
|
|
|
|
EditorRouteGroups::button_press_event (GdkEventButton* ev)
|
|
|
|
{
|
|
|
|
TreeModel::Path path;
|
|
|
|
TreeIter iter;
|
|
|
|
RouteGroup* group = 0;
|
|
|
|
TreeViewColumn* column;
|
|
|
|
int cellx;
|
|
|
|
int celly;
|
|
|
|
|
|
|
|
bool const p = _display.get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly);
|
|
|
|
|
|
|
|
if (p) {
|
|
|
|
iter = _model->get_iter (path);
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-03 14:37:15 -04:00
|
|
|
if (iter) {
|
|
|
|
group = (*iter)[_columns.routegroup];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Keyboard::is_context_menu_event (ev)) {
|
|
|
|
menu(group)->popup (1, ev->time);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!p) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (GPOINTER_TO_UINT (column->get_data (X_("colnum")))) {
|
|
|
|
case 0:
|
|
|
|
if (Keyboard::is_edit_event (ev)) {
|
|
|
|
if ((iter = _model->get_iter (path))) {
|
|
|
|
if ((group = (*iter)[_columns.routegroup]) != 0) {
|
|
|
|
// edit_route_group (group);
|
|
|
|
#ifdef GTKOSX
|
|
|
|
_display.queue_draw();
|
|
|
|
#endif
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
|
|
|
}
|
2009-07-03 14:37:15 -04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
if ((iter = _model->get_iter (path))) {
|
|
|
|
bool gain = (*iter)[_columns.gain];
|
|
|
|
(*iter)[_columns.gain] = !gain;
|
|
|
|
#ifdef GTKOSX
|
|
|
|
_display.queue_draw();
|
|
|
|
#endif
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
if ((iter = _model->get_iter (path))) {
|
|
|
|
bool record = (*iter)[_columns.record];
|
|
|
|
(*iter)[_columns.record] = !record;
|
|
|
|
#ifdef GTKOSX
|
|
|
|
_display.queue_draw();
|
|
|
|
#endif
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
if ((iter = _model->get_iter (path))) {
|
|
|
|
bool mute = (*iter)[_columns.mute];
|
|
|
|
(*iter)[_columns.mute] = !mute;
|
|
|
|
#ifdef GTKOSX
|
|
|
|
_display.queue_draw();
|
|
|
|
#endif
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 4:
|
|
|
|
if ((iter = _model->get_iter (path))) {
|
|
|
|
bool solo = (*iter)[_columns.solo];
|
|
|
|
(*iter)[_columns.solo] = !solo;
|
|
|
|
#ifdef GTKOSX
|
|
|
|
_display.queue_draw();
|
|
|
|
#endif
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 5:
|
|
|
|
if ((iter = _model->get_iter (path))) {
|
|
|
|
bool select = (*iter)[_columns.select];
|
|
|
|
(*iter)[_columns.select] = !select;
|
|
|
|
#ifdef GTKOSX
|
|
|
|
_display.queue_draw();
|
|
|
|
#endif
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 6:
|
|
|
|
if ((iter = _model->get_iter (path))) {
|
|
|
|
bool edits = (*iter)[_columns.edits];
|
|
|
|
(*iter)[_columns.edits] = !edits;
|
|
|
|
#ifdef GTKOSX
|
|
|
|
_display.queue_draw();
|
|
|
|
#endif
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 7:
|
|
|
|
if ((iter = _model->get_iter (path))) {
|
|
|
|
bool visible = (*iter)[_columns.is_visible];
|
|
|
|
(*iter)[_columns.is_visible] = !visible;
|
|
|
|
#ifdef GTKOSX
|
|
|
|
_display.queue_draw();
|
|
|
|
#endif
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-03 14:37:15 -04:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2009-10-14 12:10:01 -04:00
|
|
|
void
|
2009-07-21 11:55:17 -04:00
|
|
|
EditorRouteGroups::row_change (const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator& iter)
|
2009-07-03 14:37:15 -04:00
|
|
|
{
|
|
|
|
RouteGroup* group;
|
|
|
|
|
|
|
|
if (_in_row_change) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((group = (*iter)[_columns.routegroup]) == 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((*iter)[_columns.is_visible]) {
|
2009-12-13 14:09:52 -05:00
|
|
|
for (TrackViewList::const_iterator j = _editor->get_track_views().begin(); j != _editor->get_track_views().end(); ++j) {
|
2009-07-03 14:37:15 -04:00
|
|
|
if ((*j)->route_group() == group) {
|
2009-07-09 13:58:13 -04:00
|
|
|
_editor->_routes->show_track_in_display (**j);
|
2009-07-03 14:37:15 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
2009-12-13 14:09:52 -05:00
|
|
|
for (TrackViewList::const_iterator j = _editor->get_track_views().begin(); j != _editor->get_track_views().end(); ++j) {
|
2009-07-03 14:37:15 -04:00
|
|
|
if ((*j)->route_group() == group) {
|
2009-07-09 13:58:13 -04:00
|
|
|
_editor->hide_track_in_display (**j);
|
2009-07-03 14:37:15 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
group->set_property (RouteGroup::Gain, (*iter)[_columns.gain]);
|
|
|
|
group->set_property (RouteGroup::RecEnable, (*iter)[_columns.record]);
|
|
|
|
group->set_property (RouteGroup::Mute, (*iter)[_columns.mute]);
|
|
|
|
group->set_property (RouteGroup::Solo, (*iter)[_columns.solo]);
|
|
|
|
group->set_property (RouteGroup::Select, (*iter)[_columns.select]);
|
|
|
|
group->set_property (RouteGroup::Edit, (*iter)[_columns.edits]);
|
|
|
|
|
|
|
|
string name = (*iter)[_columns.text];
|
|
|
|
|
|
|
|
if (name != group->name()) {
|
|
|
|
group->set_name (name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
EditorRouteGroups::add (RouteGroup* group)
|
|
|
|
{
|
2009-12-11 18:29:48 -05:00
|
|
|
ENSURE_GUI_THREAD (*this, &EditorRouteGroups::add, group)
|
2009-07-03 14:37:15 -04:00
|
|
|
bool focus = false;
|
|
|
|
|
|
|
|
TreeModel::Row row = *(_model->append());
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-03 14:37:15 -04:00
|
|
|
row[_columns.is_visible] = !group->is_hidden();
|
|
|
|
row[_columns.gain] = group->property(RouteGroup::Gain);
|
|
|
|
row[_columns.record] = group->property(RouteGroup::RecEnable);
|
|
|
|
row[_columns.mute] = group->property(RouteGroup::Mute);
|
|
|
|
row[_columns.solo] = group->property(RouteGroup::Solo);
|
|
|
|
row[_columns.select] = group->property(RouteGroup::Select);
|
|
|
|
row[_columns.edits] = group->property(RouteGroup::Edit);
|
|
|
|
|
|
|
|
_in_row_change = true;
|
|
|
|
|
|
|
|
row[_columns.routegroup] = group;
|
|
|
|
|
|
|
|
if (!group->name().empty()) {
|
|
|
|
row[_columns.text] = group->name();
|
|
|
|
} else {
|
|
|
|
row[_columns.text] = _("unnamed");
|
|
|
|
focus = true;
|
|
|
|
}
|
|
|
|
|
2009-12-21 13:23:07 -05:00
|
|
|
group->FlagsChanged.connect (flags_connection, ui_bind (&EditorRouteGroups::flags_changed, this, _1, group), gui_context());
|
2009-07-03 14:37:15 -04:00
|
|
|
|
2009-10-14 12:10:01 -04:00
|
|
|
if (focus) {
|
2009-07-03 14:37:15 -04:00
|
|
|
TreeViewColumn* col = _display.get_column (0);
|
|
|
|
CellRendererText* name_cell = dynamic_cast<CellRendererText*>(_display.get_column_cell_renderer (0));
|
|
|
|
_display.set_cursor (_model->get_path (row), *col, *name_cell, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
_in_row_change = false;
|
|
|
|
|
|
|
|
_editor->_group_tabs->set_dirty ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
EditorRouteGroups::groups_changed ()
|
|
|
|
{
|
2009-12-11 18:29:48 -05:00
|
|
|
ENSURE_GUI_THREAD (*this, &EditorRouteGroups::groups_changed)
|
2009-07-03 14:37:15 -04:00
|
|
|
|
|
|
|
/* just rebuild the while thing */
|
|
|
|
|
|
|
|
_model->clear ();
|
|
|
|
|
|
|
|
{
|
|
|
|
TreeModel::Row row;
|
|
|
|
row = *(_model->append());
|
|
|
|
row[_columns.is_visible] = true;
|
|
|
|
row[_columns.text] = (_("-all-"));
|
|
|
|
row[_columns.routegroup] = 0;
|
|
|
|
}
|
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
if (_session) {
|
|
|
|
_session->foreach_route_group (sigc::mem_fun (*this, &EditorRouteGroups::add));
|
|
|
|
}
|
2009-07-03 14:37:15 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-12-22 15:21:43 -05:00
|
|
|
EditorRouteGroups::flags_changed (void*, RouteGroup* group)
|
2009-07-03 14:37:15 -04:00
|
|
|
{
|
2009-12-11 18:29:48 -05:00
|
|
|
ENSURE_GUI_THREAD (*this, &EditorRouteGroups::flags_changed, src, group)
|
2009-07-03 14:37:15 -04:00
|
|
|
|
|
|
|
_in_row_change = true;
|
|
|
|
|
|
|
|
Gtk::TreeModel::Children children = _model->children();
|
|
|
|
|
|
|
|
for(Gtk::TreeModel::Children::iterator iter = children.begin(); iter != children.end(); ++iter) {
|
|
|
|
if (group == (*iter)[_columns.routegroup]) {
|
|
|
|
(*iter)[_columns.is_visible] = !group->is_hidden();
|
|
|
|
(*iter)[_columns.text] = group->name();
|
|
|
|
(*iter)[_columns.gain] = group->property(RouteGroup::Gain);
|
|
|
|
(*iter)[_columns.record] = group->property(RouteGroup::RecEnable);
|
|
|
|
(*iter)[_columns.mute] = group->property(RouteGroup::Mute);
|
|
|
|
(*iter)[_columns.solo] = group->property(RouteGroup::Solo);
|
|
|
|
(*iter)[_columns.select] = group->property(RouteGroup::Select);
|
|
|
|
(*iter)[_columns.edits] = group->property(RouteGroup::Edit);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
_in_row_change = false;
|
|
|
|
|
|
|
|
_editor->_group_tabs->set_dirty ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
EditorRouteGroups::name_edit (const Glib::ustring& path, const Glib::ustring& new_text)
|
|
|
|
{
|
|
|
|
RouteGroup* group;
|
|
|
|
TreeIter iter;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-03 14:37:15 -04:00
|
|
|
if ((iter = _model->get_iter (path))) {
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-03 14:37:15 -04:00
|
|
|
if ((group = (*iter)[_columns.routegroup]) == 0) {
|
|
|
|
return;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-03 14:37:15 -04:00
|
|
|
if (new_text != group->name()) {
|
|
|
|
group->set_name (new_text);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
EditorRouteGroups::clear ()
|
|
|
|
{
|
|
|
|
_display.set_model (Glib::RefPtr<Gtk::TreeStore> (0));
|
|
|
|
_model->clear ();
|
|
|
|
_display.set_model (_model);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-12-17 13:24:23 -05:00
|
|
|
EditorRouteGroups::set_session (Session* s)
|
2009-07-03 14:37:15 -04:00
|
|
|
{
|
2009-12-17 13:24:23 -05:00
|
|
|
EditorComponent::set_session (s);
|
2009-07-03 14:37:15 -04:00
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
if (_session) {
|
2009-12-21 13:23:07 -05:00
|
|
|
_session->route_group_added.connect (_session_connections, ui_bind (&EditorRouteGroups::add, this, _1), gui_context());
|
|
|
|
_session->route_group_removed.connect (_session_connections, boost::bind (&EditorRouteGroups::groups_changed, this), gui_context());
|
2009-12-17 13:24:23 -05:00
|
|
|
}
|
2009-07-03 14:37:15 -04:00
|
|
|
|
|
|
|
groups_changed ();
|
|
|
|
}
|
|
|
|
|
2009-07-09 11:43:38 -04:00
|
|
|
struct CollectSorter {
|
2009-12-09 22:25:32 -05:00
|
|
|
bool operator () (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b) {
|
2009-07-09 11:43:38 -04:00
|
|
|
return a->order_key (N_ ("editor")) < b->order_key (N_ ("editor"));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2009-07-04 09:44:01 -04:00
|
|
|
/** Collect all members of a RouteGroup so that they are together in the Editor.
|
|
|
|
* @param g Group to collect.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
EditorRouteGroups::collect (RouteGroup* g)
|
|
|
|
{
|
2009-12-09 22:25:32 -05:00
|
|
|
boost::shared_ptr<RouteList> routes = g->route_list ();
|
|
|
|
routes->sort (CollectSorter ());
|
|
|
|
int const N = routes->size ();
|
2009-07-04 09:44:01 -04:00
|
|
|
|
2009-12-09 22:25:32 -05:00
|
|
|
RouteList::iterator i = routes->begin ();
|
2009-12-13 14:09:52 -05:00
|
|
|
TrackViewList::const_iterator j = _editor->get_track_views().begin();
|
2009-07-04 09:44:01 -04:00
|
|
|
|
|
|
|
int diff = 0;
|
|
|
|
int coll = -1;
|
2009-12-09 22:25:32 -05:00
|
|
|
while (i != routes->end() && j != _editor->get_track_views().end()) {
|
2009-07-03 14:37:15 -04:00
|
|
|
|
2009-07-09 13:58:13 -04:00
|
|
|
RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (*j);
|
2009-07-04 09:44:01 -04:00
|
|
|
if (rtv) {
|
|
|
|
|
|
|
|
boost::shared_ptr<Route> r = rtv->route ();
|
|
|
|
int const k = r->order_key (N_ ("editor"));
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-12-09 22:25:32 -05:00
|
|
|
if (*i == r) {
|
2009-07-09 11:43:38 -04:00
|
|
|
|
2009-07-04 09:44:01 -04:00
|
|
|
if (coll == -1) {
|
|
|
|
coll = k;
|
|
|
|
diff = N - 1;
|
|
|
|
} else {
|
|
|
|
--diff;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-04 09:44:01 -04:00
|
|
|
r->set_order_key (N_ ("editor"), coll);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-04 09:44:01 -04:00
|
|
|
++coll;
|
|
|
|
++i;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-04 09:44:01 -04:00
|
|
|
} else {
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-04 09:44:01 -04:00
|
|
|
r->set_order_key (N_ ("editor"), k + diff);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-04 09:44:01 -04:00
|
|
|
}
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-04 09:44:01 -04:00
|
|
|
++j;
|
|
|
|
}
|
|
|
|
|
2009-08-10 17:13:33 -04:00
|
|
|
_editor->_routes->sync_order_keys ("");
|
2009-07-04 09:44:01 -04:00
|
|
|
}
|