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.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2010-11-13 00:14:48 -05:00
|
|
|
#ifdef WAF_BUILD
|
|
|
|
#include "gtk2ardour-config.h"
|
|
|
|
#endif
|
|
|
|
|
2009-07-03 14:37:15 -04:00
|
|
|
#include <cstdlib>
|
|
|
|
#include <cmath>
|
|
|
|
|
2011-12-29 11:44:49 -05:00
|
|
|
#include "fix_carbon.h"
|
|
|
|
|
2011-12-06 16:43:57 -05:00
|
|
|
#include "gtkmm2ext/gtk_ui.h"
|
|
|
|
#include "gtkmm2ext/cell_renderer_color_selector.h"
|
|
|
|
|
2009-07-03 14:37:15 -04:00
|
|
|
#include "ardour/route_group.h"
|
2014-06-09 23:28:32 -04:00
|
|
|
#include "ardour/route.h"
|
|
|
|
#include "ardour/session.h"
|
2009-07-03 14:37:15 -04:00
|
|
|
|
2014-06-09 23:28:32 -04:00
|
|
|
#include "ardour_ui.h"
|
2009-07-03 14:37:15 -04:00
|
|
|
#include "editor.h"
|
2014-06-09 23:28:32 -04:00
|
|
|
#include "editor_group_tabs.h"
|
|
|
|
#include "editor_route_groups.h"
|
|
|
|
#include "editor_routes.h"
|
|
|
|
#include "gui_thread.h"
|
2009-07-03 14:37:15 -04:00
|
|
|
#include "keyboard.h"
|
|
|
|
#include "marker.h"
|
|
|
|
#include "prompter.h"
|
|
|
|
#include "route_group_dialog.h"
|
|
|
|
#include "route_time_axis.h"
|
2014-06-09 23:28:32 -04:00
|
|
|
#include "time_axis_view.h"
|
2015-01-05 00:32:14 -05:00
|
|
|
#include "tooltips.h"
|
2014-06-09 23:28:32 -04:00
|
|
|
#include "utils.h"
|
2009-07-03 14:37:15 -04:00
|
|
|
|
|
|
|
#include "i18n.h"
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
using namespace ARDOUR;
|
2014-06-25 15:27:37 -04:00
|
|
|
using namespace ARDOUR_UI_UTILS;
|
2009-07-03 14:37:15 -04:00
|
|
|
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
|
|
|
|
2011-12-06 11:03:10 -05:00
|
|
|
struct ColumnInfo {
|
|
|
|
int index;
|
|
|
|
const char* label;
|
|
|
|
const char* tooltip;
|
|
|
|
};
|
|
|
|
|
2009-07-03 14:37:15 -04:00
|
|
|
EditorRouteGroups::EditorRouteGroups (Editor* e)
|
2010-08-26 19:25:44 -04:00
|
|
|
: EditorComponent (e)
|
2010-11-25 15:37:39 -05:00
|
|
|
, _in_row_change (false)
|
2011-04-19 11:46:47 -04:00
|
|
|
, _in_rebuild (false)
|
2009-07-03 14:37:15 -04:00
|
|
|
{
|
|
|
|
_model = ListStore::create (_columns);
|
|
|
|
_display.set_model (_model);
|
|
|
|
|
2011-12-06 17:02:46 -05:00
|
|
|
Gtkmm2ext::CellRendererColorSelector* color_renderer = manage (new Gtkmm2ext::CellRendererColorSelector);
|
|
|
|
TreeViewColumn* color_column = manage (new TreeViewColumn ("", *color_renderer));
|
2014-06-09 23:28:32 -04:00
|
|
|
|
2011-12-06 17:02:46 -05:00
|
|
|
color_column->add_attribute (color_renderer->property_color(), _columns.gdkcolor);
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2011-12-06 17:02:46 -05:00
|
|
|
_display.append_column (*color_column);
|
|
|
|
|
2011-12-06 11:03:10 -05:00
|
|
|
_display.append_column ("", _columns.text);
|
2011-12-06 21:04:36 -05:00
|
|
|
_display.append_column ("", _columns.is_visible);
|
2011-12-06 22:22:35 -05:00
|
|
|
_display.append_column ("", _columns.active_state);
|
2011-12-06 11:03:10 -05:00
|
|
|
_display.append_column ("", _columns.gain);
|
|
|
|
_display.append_column ("", _columns.gain_relative);
|
|
|
|
_display.append_column ("", _columns.mute);
|
|
|
|
_display.append_column ("", _columns.solo);
|
|
|
|
_display.append_column ("", _columns.record);
|
2011-12-06 11:46:50 -05:00
|
|
|
_display.append_column ("", _columns.monitoring);
|
2011-12-06 11:03:10 -05:00
|
|
|
_display.append_column ("", _columns.select);
|
2011-12-06 22:22:35 -05:00
|
|
|
_display.append_column ("", _columns.active_shared);
|
2011-12-06 11:03:10 -05:00
|
|
|
|
|
|
|
TreeViewColumn* col;
|
|
|
|
Gtk::Label* l;
|
|
|
|
|
|
|
|
ColumnInfo ci[] = {
|
2015-04-04 18:44:03 -04:00
|
|
|
{ 0, _("Col"), _("Group Tab Color") },
|
|
|
|
{ 1, _("Name"), _("Name of Group") },
|
|
|
|
{ 2, S_("Visible|V"), _("Group is visible?") },
|
|
|
|
{ 3, _("On"), _("Group is enabled?") },
|
2015-04-04 18:52:07 -04:00
|
|
|
{ 4, S_("Group|G"), _("Sharing Gain?") },
|
|
|
|
{ 5, S_("Relative|Rel"), _("Relative Gain Changes?") },
|
|
|
|
{ 6, S_("Mute|M"), _("Sharing Mute?") },
|
|
|
|
{ 7, S_("Solo|S"), _("Sharing Solo?") },
|
2015-04-04 18:44:03 -04:00
|
|
|
{ 8, _("Rec"), _("Sharing Record-enable Status?") },
|
2015-04-04 18:52:07 -04:00
|
|
|
{ 9, S_("Monitoring|Mon"), _("Sharing Monitoring Choice?") },
|
|
|
|
{ 10, S_("Selection|Sel"), _("Sharing Selected/Editing Status?") },
|
|
|
|
{ 11, S_("Active|A"), _("Sharing Active Status?") },
|
2011-12-06 11:03:10 -05:00
|
|
|
{ -1, 0, 0 }
|
|
|
|
};
|
|
|
|
|
2011-12-06 16:43:57 -05:00
|
|
|
|
2011-12-06 11:03:10 -05:00
|
|
|
for (int i = 0; ci[i].index >= 0; ++i) {
|
|
|
|
col = _display.get_column (ci[i].index);
|
|
|
|
l = manage (new Label (ci[i].label));
|
2015-01-05 00:32:14 -05:00
|
|
|
set_tooltip (*l, ci[i].tooltip);
|
2011-12-06 11:03:10 -05:00
|
|
|
col->set_widget (*l);
|
|
|
|
l->show ();
|
|
|
|
|
|
|
|
col->set_data (X_("colnum"), GUINT_TO_POINTER(i));
|
2011-12-06 17:02:46 -05:00
|
|
|
if (i == 1) {
|
2011-12-06 11:03:10 -05:00
|
|
|
col->set_expand (true);
|
|
|
|
} else {
|
|
|
|
col->set_expand (false);
|
|
|
|
col->set_alignment (ALIGN_CENTER);
|
|
|
|
}
|
2011-07-12 19:41:19 -04:00
|
|
|
}
|
2009-07-03 14:37:15 -04:00
|
|
|
|
|
|
|
_display.set_headers_visible (true);
|
|
|
|
|
2011-12-06 16:43:57 -05:00
|
|
|
color_dialog.get_colorsel()->set_has_opacity_control (false);
|
|
|
|
color_dialog.get_colorsel()->set_has_palette (true);
|
|
|
|
color_dialog.get_ok_button()->signal_clicked().connect (sigc::bind (sigc::mem_fun (color_dialog, &Gtk::Dialog::response), RESPONSE_ACCEPT));
|
|
|
|
color_dialog.get_cancel_button()->signal_clicked().connect (sigc::bind (sigc::mem_fun (color_dialog, &Gtk::Dialog::response), RESPONSE_CANCEL));
|
|
|
|
|
2009-07-03 14:37:15 -04:00
|
|
|
/* name is directly editable */
|
|
|
|
|
2011-12-06 17:02:46 -05:00
|
|
|
CellRendererText* name_cell = dynamic_cast<CellRendererText*>(_display.get_column_cell_renderer (1));
|
2009-07-03 14:37:15 -04:00
|
|
|
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));
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2011-12-06 11:03:10 -05:00
|
|
|
for (int i = 1; ci[i].index >= 0; ++i) {
|
2011-07-12 19:41:19 -04:00
|
|
|
CellRendererToggle* active_cell = dynamic_cast <CellRendererToggle*> (_display.get_column_cell_renderer (i));
|
2011-12-06 16:43:57 -05:00
|
|
|
|
|
|
|
if (active_cell) {
|
|
|
|
active_cell->property_activatable() = true;
|
|
|
|
active_cell->property_radio() = false;
|
|
|
|
}
|
2011-07-12 19:41:19 -04:00
|
|
|
}
|
2009-07-03 14:37:15 -04:00
|
|
|
|
2009-12-11 18:29:48 -05:00
|
|
|
_model->signal_row_changed().connect (sigc::mem_fun (*this, &EditorRouteGroups::row_change));
|
2011-04-19 11:46:47 -04:00
|
|
|
/* What signal would you guess was emitted when the rows of your treeview are reordered
|
|
|
|
by a drag and drop? signal_rows_reordered? That would be far too easy.
|
|
|
|
No, signal_row_deleted().
|
|
|
|
*/
|
|
|
|
_model->signal_row_deleted().connect (sigc::mem_fun (*this, &EditorRouteGroups::row_deleted));
|
2009-07-03 14:37:15 -04:00
|
|
|
|
|
|
|
_display.set_name ("EditGroupList");
|
|
|
|
_display.get_selection()->set_mode (SELECTION_SINGLE);
|
|
|
|
_display.set_headers_visible (true);
|
2011-12-06 16:43:57 -05:00
|
|
|
_display.set_reorderable (false);
|
2009-07-03 14:37:15 -04:00
|
|
|
_display.set_rules_hint (true);
|
|
|
|
|
|
|
|
_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
|
|
|
|
|
|
|
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);
|
|
|
|
|
2010-07-19 17:47:07 -04:00
|
|
|
add_button->signal_clicked().connect (sigc::hide_return (sigc::mem_fun (*this, &EditorRouteGroups::run_new_group_dialog)));
|
2009-12-11 18:29:48 -05:00
|
|
|
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);
|
|
|
|
|
2010-08-26 19:25:44 -04:00
|
|
|
_display_packer.pack_start (_scroller, true, true);
|
|
|
|
_display_packer.pack_start (*button_box, false, false);
|
2009-07-03 14:37:15 -04:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-03 14:37:15 -04:00
|
|
|
void
|
|
|
|
EditorRouteGroups::remove_selected ()
|
|
|
|
{
|
|
|
|
Glib::RefPtr<TreeSelection> selection = _display.get_selection();
|
|
|
|
TreeView::Selection::ListHandle_Path rows = selection->get_selected_rows ();
|
|
|
|
|
2014-09-10 20:32:36 -04:00
|
|
|
if (rows.empty() || _session->deletion_in_progress()) {
|
2009-07-03 14:37:15 -04:00
|
|
|
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 ()
|
|
|
|
{
|
2010-07-19 17:47:07 -04:00
|
|
|
run_new_group_dialog ();
|
2009-07-03 14:37:15 -04:00
|
|
|
}
|
|
|
|
|
2011-12-06 11:46:50 -05:00
|
|
|
bool
|
2009-07-03 14:37:15 -04:00
|
|
|
EditorRouteGroups::button_press_event (GdkEventButton* ev)
|
|
|
|
{
|
|
|
|
TreeModel::Path path;
|
|
|
|
TreeIter iter;
|
2010-11-25 15:37:39 -05:00
|
|
|
RouteGroup* group = 0;
|
2009-07-03 14:37:15 -04:00
|
|
|
TreeViewColumn* column;
|
|
|
|
int cellx;
|
|
|
|
int celly;
|
2011-12-06 11:46:50 -05:00
|
|
|
bool ret = false;
|
2011-12-06 16:43:57 -05:00
|
|
|
Gdk::Color c;
|
2011-12-06 21:04:36 -05:00
|
|
|
bool val;
|
2009-07-03 14:37:15 -04:00
|
|
|
|
|
|
|
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];
|
2015-10-04 14:51:05 -04:00
|
|
|
}
|
2009-07-03 14:37:15 -04:00
|
|
|
|
|
|
|
if (Keyboard::is_context_menu_event (ev)) {
|
2010-07-19 17:47:07 -04:00
|
|
|
_editor->_group_tabs->get_menu(group)->popup (1, ev->time);
|
2009-07-03 14:37:15 -04:00
|
|
|
return true;
|
2015-10-04 14:51:05 -04:00
|
|
|
}
|
2009-07-03 14:37:15 -04:00
|
|
|
|
|
|
|
if (!p) {
|
2011-12-06 11:46:50 -05:00
|
|
|
/* cancel selection */
|
|
|
|
_display.get_selection()->unselect_all ();
|
|
|
|
/* end any editing by grabbing focus */
|
|
|
|
_display.grab_focus ();
|
|
|
|
return true;
|
2009-07-03 14:37:15 -04:00
|
|
|
}
|
|
|
|
|
2011-12-06 21:04:36 -05:00
|
|
|
group = (*iter)[_columns.routegroup];
|
|
|
|
|
2009-07-03 14:37:15 -04:00
|
|
|
switch (GPOINTER_TO_UINT (column->get_data (X_("colnum")))) {
|
2015-10-04 14:51:05 -04:00
|
|
|
case 0:
|
2014-06-09 23:28:32 -04:00
|
|
|
c = (*iter)[_columns.gdkcolor];
|
2011-12-06 18:23:09 -05:00
|
|
|
color_dialog.get_colorsel()->set_previous_color (c);
|
|
|
|
color_dialog.get_colorsel()->set_current_color (c);
|
|
|
|
|
|
|
|
switch (color_dialog.run()) {
|
|
|
|
case RESPONSE_CANCEL:
|
|
|
|
break;
|
|
|
|
case RESPONSE_ACCEPT:
|
|
|
|
c = color_dialog.get_colorsel()->get_current_color();
|
2014-06-09 23:28:32 -04:00
|
|
|
GroupTabs::set_group_color (group, gdk_color_to_rgba (c));
|
2011-12-06 18:23:09 -05:00
|
|
|
break;
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2011-12-06 18:23:09 -05:00
|
|
|
default:
|
|
|
|
break;
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2011-12-06 18:23:09 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
color_dialog.hide ();
|
|
|
|
ret = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
2011-12-06 21:04:36 -05:00
|
|
|
if (Keyboard::is_edit_event (ev) && group) {
|
|
|
|
/* we'll be editing now ... */
|
|
|
|
ret = true;
|
2009-10-14 12:10:01 -04:00
|
|
|
}
|
2009-07-03 14:37:15 -04:00
|
|
|
break;
|
|
|
|
|
2011-12-06 18:23:09 -05:00
|
|
|
case 2:
|
2011-12-06 21:04:36 -05:00
|
|
|
val = (*iter)[_columns.is_visible];
|
|
|
|
/* note subtle logic inverse here: we set the new value with
|
|
|
|
"val", rather than !val, because we're using ::set_hidden()
|
|
|
|
not a (non-existent) ::set_visible() call.
|
|
|
|
*/
|
|
|
|
group->set_hidden (val, this);
|
|
|
|
ret = true;
|
2009-07-03 14:37:15 -04:00
|
|
|
break;
|
|
|
|
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2011-12-06 18:23:09 -05:00
|
|
|
case 3:
|
2011-12-06 22:22:35 -05:00
|
|
|
val = (*iter)[_columns.active_state];
|
|
|
|
group->set_active (!val, this);
|
|
|
|
ret = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 4:
|
2011-12-06 21:04:36 -05:00
|
|
|
val = (*iter)[_columns.gain];
|
|
|
|
group->set_gain (!val);
|
|
|
|
ret = true;
|
2009-07-03 14:37:15 -04:00
|
|
|
break;
|
|
|
|
|
2011-12-06 22:22:35 -05:00
|
|
|
case 5:
|
2011-12-06 21:04:36 -05:00
|
|
|
val = (*iter)[_columns.gain_relative];
|
|
|
|
group->set_relative (!val, this);
|
|
|
|
ret = true;
|
2009-07-03 14:37:15 -04:00
|
|
|
break;
|
|
|
|
|
2011-12-06 22:22:35 -05:00
|
|
|
case 6:
|
2011-12-06 21:04:36 -05:00
|
|
|
val = (*iter)[_columns.mute];
|
|
|
|
group->set_mute (!val);
|
|
|
|
ret = true;
|
2009-07-03 14:37:15 -04:00
|
|
|
break;
|
|
|
|
|
2011-12-06 22:22:35 -05:00
|
|
|
case 7:
|
2011-12-06 21:04:36 -05:00
|
|
|
val = (*iter)[_columns.solo];
|
|
|
|
group->set_solo (!val);
|
|
|
|
ret = true;
|
2011-07-12 19:41:19 -04:00
|
|
|
break;
|
|
|
|
|
2011-12-06 22:22:35 -05:00
|
|
|
case 8:
|
2011-12-06 21:04:36 -05:00
|
|
|
val = (*iter)[_columns.record];
|
|
|
|
group->set_recenable (!val);
|
|
|
|
ret = true;
|
2011-12-06 11:46:50 -05:00
|
|
|
break;
|
|
|
|
|
2011-12-06 22:22:35 -05:00
|
|
|
case 9:
|
2011-12-06 21:04:36 -05:00
|
|
|
val = (*iter)[_columns.monitoring];
|
|
|
|
group->set_monitoring (!val);
|
|
|
|
ret = true;
|
2009-07-03 14:37:15 -04:00
|
|
|
break;
|
|
|
|
|
2011-12-06 22:22:35 -05:00
|
|
|
case 10:
|
2011-12-06 21:04:36 -05:00
|
|
|
val = (*iter)[_columns.select];
|
|
|
|
group->set_select (!val);
|
|
|
|
ret = true;
|
2009-07-03 14:37:15 -04:00
|
|
|
break;
|
|
|
|
|
2011-12-06 22:22:35 -05:00
|
|
|
case 11:
|
|
|
|
val = (*iter)[_columns.active_shared];
|
|
|
|
group->set_route_active (!val);
|
2011-12-06 21:04:36 -05:00
|
|
|
ret = true;
|
2011-07-12 19:41:19 -04:00
|
|
|
break;
|
2011-12-06 16:43:57 -05:00
|
|
|
|
2009-07-03 14:37:15 -04:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2011-12-06 11:46:50 -05:00
|
|
|
return ret;
|
|
|
|
}
|
2009-07-03 14:37:15 -04:00
|
|
|
|
2009-10-14 12:10:01 -04:00
|
|
|
void
|
2012-05-02 16:29:46 -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;
|
|
|
|
}
|
|
|
|
|
2010-02-18 08:59:49 -05:00
|
|
|
PropertyList plist;
|
2011-07-12 19:41:19 -04:00
|
|
|
plist.add (Properties::name, string ((*iter)[_columns.text]));
|
2011-12-06 21:04:36 -05:00
|
|
|
|
2010-02-18 08:59:49 -05:00
|
|
|
bool val = (*iter)[_columns.gain];
|
2016-06-05 15:54:37 -04:00
|
|
|
plist.add (Properties::group_gain, val);
|
2011-07-12 19:41:19 -04:00
|
|
|
val = (*iter)[_columns.gain_relative];
|
2016-06-05 15:54:37 -04:00
|
|
|
plist.add (Properties::group_relative, val);
|
2010-02-18 08:59:49 -05:00
|
|
|
val = (*iter)[_columns.mute];
|
2016-06-05 15:54:37 -04:00
|
|
|
plist.add (Properties::group_mute, val);
|
2010-02-18 08:59:49 -05:00
|
|
|
val = (*iter)[_columns.solo];
|
2016-06-05 15:54:37 -04:00
|
|
|
plist.add (Properties::group_solo, val);
|
2011-07-12 19:41:19 -04:00
|
|
|
val = (*iter)[_columns.record];
|
2016-06-05 15:54:37 -04:00
|
|
|
plist.add (Properties::group_recenable, val);
|
2011-12-06 11:46:50 -05:00
|
|
|
val = (*iter)[_columns.monitoring];
|
2016-06-05 15:54:37 -04:00
|
|
|
plist.add (Properties::group_monitoring, val);
|
2010-02-18 08:59:49 -05:00
|
|
|
val = (*iter)[_columns.select];
|
2016-06-05 15:54:37 -04:00
|
|
|
plist.add (Properties::group_select, val);
|
2011-12-06 22:22:35 -05:00
|
|
|
val = (*iter)[_columns.active_shared];
|
2016-06-05 15:54:37 -04:00
|
|
|
plist.add (Properties::group_route_active, val);
|
|
|
|
|
2011-12-06 22:22:35 -05:00
|
|
|
val = (*iter)[_columns.active_state];
|
|
|
|
plist.add (Properties::active, val);
|
2011-12-06 21:04:36 -05:00
|
|
|
val = (*iter)[_columns.is_visible];
|
|
|
|
plist.add (Properties::hidden, !val);
|
2011-12-06 16:43:57 -05:00
|
|
|
|
2010-08-25 13:31:33 -04:00
|
|
|
group->apply_changes (plist);
|
2011-12-06 21:04:36 -05:00
|
|
|
|
2014-06-09 23:28:32 -04:00
|
|
|
GroupTabs::set_group_color ((*iter)[_columns.routegroup], gdk_color_to_rgba ((*iter)[_columns.gdkcolor]));
|
2009-07-03 14:37:15 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
EditorRouteGroups::add (RouteGroup* group)
|
|
|
|
{
|
2010-11-25 15:37:39 -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
|
|
|
|
2010-02-18 08:59:49 -05:00
|
|
|
row[_columns.gain] = group->is_gain ();
|
2011-07-12 19:41:19 -04:00
|
|
|
row[_columns.gain_relative] = group->is_relative ();
|
2010-02-18 08:59:49 -05:00
|
|
|
row[_columns.mute] = group->is_mute ();
|
|
|
|
row[_columns.solo] = group->is_solo ();
|
2011-07-12 19:41:19 -04:00
|
|
|
row[_columns.record] = group->is_recenable();
|
2011-12-06 11:46:50 -05:00
|
|
|
row[_columns.monitoring] = group->is_monitoring();
|
2010-02-18 08:59:49 -05:00
|
|
|
row[_columns.select] = group->is_select ();
|
2011-12-06 22:22:35 -05:00
|
|
|
row[_columns.active_shared] = group->is_route_active ();
|
|
|
|
row[_columns.active_state] = group->is_active ();
|
2011-07-12 19:41:19 -04:00
|
|
|
row[_columns.is_visible] = !group->is_hidden();
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2014-06-09 23:28:32 -04:00
|
|
|
Gdk::Color c;
|
|
|
|
set_color_from_rgba (c, GroupTabs::group_color (group));
|
|
|
|
row[_columns.gdkcolor] = c;
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2009-07-03 14:37:15 -04:00
|
|
|
_in_row_change = true;
|
|
|
|
|
|
|
|
row[_columns.routegroup] = group;
|
|
|
|
|
|
|
|
if (!group->name().empty()) {
|
|
|
|
row[_columns.text] = group->name();
|
|
|
|
} else {
|
|
|
|
row[_columns.text] = _("unnamed");
|
|
|
|
focus = true;
|
|
|
|
}
|
|
|
|
|
2012-04-25 08:58:19 -04:00
|
|
|
group->PropertyChanged.connect (_property_changed_connections, MISSING_INVALIDATOR, boost::bind (&EditorRouteGroups::property_changed, this, group, _1), 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);
|
2011-12-09 14:56:01 -05:00
|
|
|
CellRendererText* name_cell = dynamic_cast<CellRendererText*>(_display.get_column_cell_renderer (1));
|
2009-07-03 14:37:15 -04:00
|
|
|
_display.set_cursor (_model->get_path (row), *col, *name_cell, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
_in_row_change = false;
|
|
|
|
|
|
|
|
_editor->_group_tabs->set_dirty ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
EditorRouteGroups::groups_changed ()
|
|
|
|
{
|
2011-04-19 11:46:47 -04:00
|
|
|
ENSURE_GUI_THREAD (*this, &EditorRouteGroups::groups_changed);
|
|
|
|
|
|
|
|
_in_rebuild = true;
|
2009-07-03 14:37:15 -04:00
|
|
|
|
|
|
|
/* just rebuild the while thing */
|
|
|
|
|
|
|
|
_model->clear ();
|
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
if (_session) {
|
|
|
|
_session->foreach_route_group (sigc::mem_fun (*this, &EditorRouteGroups::add));
|
|
|
|
}
|
2011-04-19 11:46:47 -04:00
|
|
|
|
|
|
|
_in_rebuild = false;
|
2009-07-03 14:37:15 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-05-02 16:29:46 -04:00
|
|
|
EditorRouteGroups::property_changed (RouteGroup* group, const PropertyChange&)
|
2009-07-03 14:37:15 -04:00
|
|
|
{
|
2014-11-16 21:49:19 -05:00
|
|
|
assert(group);
|
2009-07-03 14:37:15 -04:00
|
|
|
_in_row_change = true;
|
|
|
|
|
2010-11-25 15:37:39 -05:00
|
|
|
Gtk::TreeModel::Children children = _model->children();
|
2009-07-03 14:37:15 -04:00
|
|
|
|
|
|
|
for(Gtk::TreeModel::Children::iterator iter = children.begin(); iter != children.end(); ++iter) {
|
|
|
|
if (group == (*iter)[_columns.routegroup]) {
|
2011-12-06 21:04:36 -05:00
|
|
|
|
|
|
|
/* we could check the PropertyChange and only set
|
|
|
|
* appropriate fields. but the amount of saved by doing
|
|
|
|
* that is pretty minimal, and this is nice and simple.
|
|
|
|
*/
|
|
|
|
|
2009-07-03 14:37:15 -04:00
|
|
|
(*iter)[_columns.text] = group->name();
|
2010-02-18 08:59:49 -05:00
|
|
|
(*iter)[_columns.gain] = group->is_gain ();
|
2011-07-12 19:41:19 -04:00
|
|
|
(*iter)[_columns.gain_relative] = group->is_relative ();
|
2010-02-18 08:59:49 -05:00
|
|
|
(*iter)[_columns.mute] = group->is_mute ();
|
|
|
|
(*iter)[_columns.solo] = group->is_solo ();
|
2011-07-12 19:41:19 -04:00
|
|
|
(*iter)[_columns.record] = group->is_recenable ();
|
2011-12-06 11:46:50 -05:00
|
|
|
(*iter)[_columns.monitoring] = group->is_monitoring ();
|
2010-02-18 08:59:49 -05:00
|
|
|
(*iter)[_columns.select] = group->is_select ();
|
2011-12-06 22:22:35 -05:00
|
|
|
(*iter)[_columns.active_shared] = group->is_route_active ();
|
|
|
|
(*iter)[_columns.active_state] = group->is_active ();
|
2011-07-12 19:41:19 -04:00
|
|
|
(*iter)[_columns.is_visible] = !group->is_hidden();
|
2014-06-09 23:28:32 -04:00
|
|
|
|
|
|
|
Gdk::Color c;
|
|
|
|
set_color_from_rgba (c, GroupTabs::group_color (group));
|
|
|
|
(*iter)[_columns.gdkcolor] = c;
|
2011-12-06 21:04:36 -05:00
|
|
|
|
|
|
|
break;
|
2009-07-03 14:37:15 -04:00
|
|
|
}
|
|
|
|
}
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2009-07-03 14:37:15 -04:00
|
|
|
_in_row_change = false;
|
|
|
|
|
2011-04-05 20:36:36 -04:00
|
|
|
for (TrackViewList::const_iterator i = _editor->get_track_views().begin(); i != _editor->get_track_views().end(); ++i) {
|
|
|
|
if ((*i)->route_group() == group) {
|
|
|
|
if (group->is_hidden ()) {
|
|
|
|
_editor->hide_track_in_display (*i);
|
|
|
|
} else {
|
|
|
|
_editor->_routes->show_track_in_display (**i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-07-03 14:37:15 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2010-09-14 12:51:02 -04:00
|
|
|
EditorRouteGroups::name_edit (const std::string& path, const std::string& new_text)
|
2009-07-03 14:37:15 -04:00
|
|
|
{
|
|
|
|
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
|
|
|
{
|
2010-07-19 17:47:07 -04:00
|
|
|
SessionHandlePtr::set_session (s);
|
2009-07-03 14:37:15 -04:00
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
if (_session) {
|
2010-08-30 14:08:41 -04:00
|
|
|
|
2012-04-25 08:58:19 -04:00
|
|
|
_session->route_group_added.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&EditorRouteGroups::add, this, _1), gui_context());
|
2011-04-19 11:46:47 -04:00
|
|
|
_session->route_group_removed.connect (
|
|
|
|
_session_connections, MISSING_INVALIDATOR, boost::bind (&EditorRouteGroups::groups_changed, this), gui_context()
|
|
|
|
);
|
|
|
|
_session->route_groups_reordered.connect (
|
|
|
|
_session_connections, MISSING_INVALIDATOR, boost::bind (&EditorRouteGroups::groups_changed, this), gui_context()
|
|
|
|
);
|
2009-12-17 13:24:23 -05:00
|
|
|
}
|
2009-07-03 14:37:15 -04:00
|
|
|
|
2010-11-25 15:37:39 -05:00
|
|
|
PBD::PropertyChange pc;
|
2016-06-05 15:54:37 -04:00
|
|
|
pc.add (Properties::group_select);
|
2010-11-25 15:37:39 -05:00
|
|
|
pc.add (Properties::active);
|
2010-08-30 14:08:41 -04:00
|
|
|
|
2009-07-03 14:37:15 -04:00
|
|
|
groups_changed ();
|
|
|
|
}
|
|
|
|
|
2009-07-04 09:44:01 -04:00
|
|
|
void
|
2010-07-19 17:47:07 -04:00
|
|
|
EditorRouteGroups::run_new_group_dialog ()
|
2009-07-04 09:44:01 -04:00
|
|
|
{
|
2016-06-11 15:49:18 -04:00
|
|
|
return _editor->_group_tabs->run_new_group_dialog (0, false);
|
2009-07-04 09:44:01 -04:00
|
|
|
}
|
2010-08-30 13:34:12 -04:00
|
|
|
|
2011-04-19 11:46:47 -04:00
|
|
|
/** Called when a model row is deleted, but also when the model is
|
|
|
|
* reordered by a user drag-and-drop; the latter is what we are
|
|
|
|
* interested in here.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
EditorRouteGroups::row_deleted (Gtk::TreeModel::Path const &)
|
|
|
|
{
|
2014-09-10 20:32:36 -04:00
|
|
|
if (_in_rebuild || !_session || _session->deletion_in_progress()) {
|
2011-04-19 11:46:47 -04:00
|
|
|
/* We need to ignore this in cases where we're not doing a drag-and-drop
|
|
|
|
re-order.
|
|
|
|
*/
|
|
|
|
return;
|
|
|
|
}
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2011-04-19 11:46:47 -04:00
|
|
|
/* Re-write the session's route group list so that the new order is preserved */
|
|
|
|
|
|
|
|
list<RouteGroup*> new_list;
|
|
|
|
|
|
|
|
Gtk::TreeModel::Children children = _model->children();
|
|
|
|
for (Gtk::TreeModel::Children::iterator i = children.begin(); i != children.end(); ++i) {
|
|
|
|
new_list.push_back ((*i)[_columns.routegroup]);
|
|
|
|
}
|
|
|
|
|
|
|
|
_session->reorder_route_groups (new_list);
|
|
|
|
}
|
|
|
|
|
|
|
|
|