2009-06-28 21:07:37 -04:00
|
|
|
/*
|
2009-10-14 12:10:01 -04:00
|
|
|
Copyright (C) 2009 Paul Davis
|
2009-06-28 21:07:37 -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.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2014-06-09 23:28:32 -04:00
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
#include "ardour/route_group.h"
|
|
|
|
#include "ardour/session.h"
|
|
|
|
|
2009-06-28 21:07:37 -04:00
|
|
|
#include <gtkmm/table.h>
|
2009-06-20 11:40:26 -04:00
|
|
|
#include <gtkmm/stock.h>
|
2011-01-07 21:35:46 -05:00
|
|
|
#include <gtkmm/messagedialog.h>
|
2014-06-09 23:28:32 -04:00
|
|
|
|
2009-06-20 11:40:26 -04:00
|
|
|
#include "route_group_dialog.h"
|
2011-08-30 05:48:53 -04:00
|
|
|
#include "group_tabs.h"
|
2014-06-09 23:28:32 -04:00
|
|
|
#include "utils.h"
|
|
|
|
|
2016-07-14 14:44:52 -04:00
|
|
|
#include "pbd/i18n.h"
|
2009-06-20 11:40:26 -04:00
|
|
|
|
|
|
|
using namespace Gtk;
|
|
|
|
using namespace ARDOUR;
|
2014-06-25 15:27:37 -04:00
|
|
|
using namespace ARDOUR_UI_UTILS;
|
2009-06-28 20:57:27 -04:00
|
|
|
using namespace std;
|
2010-02-18 08:59:49 -05:00
|
|
|
using namespace PBD;
|
2009-06-20 11:40:26 -04:00
|
|
|
|
2011-01-07 21:35:46 -05:00
|
|
|
RouteGroupDialog::RouteGroupDialog (RouteGroup* g, bool creating_new)
|
2012-04-28 11:25:59 -04:00
|
|
|
: ArdourDialog (_("Track/bus Group"))
|
2011-01-07 21:35:46 -05:00
|
|
|
, _group (g)
|
|
|
|
, _initial_name (g->name ())
|
|
|
|
, _active (_("Active"))
|
|
|
|
, _gain (_("Gain"))
|
|
|
|
, _relative (_("Relative"))
|
|
|
|
, _mute (_("Muting"))
|
|
|
|
, _solo (_("Soloing"))
|
|
|
|
, _rec_enable (_("Record enable"))
|
|
|
|
, _select (_("Selection"))
|
2012-04-28 11:25:59 -04:00
|
|
|
, _route_active (_("Active state"))
|
2011-08-31 15:14:12 -04:00
|
|
|
, _share_color (_("Color"))
|
2011-10-21 11:47:50 -04:00
|
|
|
, _share_monitoring (_("Monitoring"))
|
2009-06-20 11:40:26 -04:00
|
|
|
{
|
2009-06-28 21:07:37 -04:00
|
|
|
set_skip_taskbar_hint (true);
|
2012-03-05 17:34:49 -05:00
|
|
|
set_resizable (true);
|
2009-06-28 21:07:37 -04:00
|
|
|
set_name (N_("RouteGroupDialog"));
|
|
|
|
|
2011-07-12 19:40:57 -04:00
|
|
|
VBox* main_vbox = manage (new VBox);
|
2009-06-28 21:07:37 -04:00
|
|
|
Gtk::Label* l;
|
|
|
|
|
|
|
|
get_vbox()->set_spacing (4);
|
|
|
|
|
2011-07-12 19:40:57 -04:00
|
|
|
main_vbox->set_spacing (18);
|
|
|
|
main_vbox->set_border_width (5);
|
2009-06-28 21:07:37 -04:00
|
|
|
|
|
|
|
HBox* hbox = manage (new HBox);
|
|
|
|
hbox->set_spacing (6);
|
|
|
|
l = manage (new Label (_("Name:"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false ));
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-06-28 21:07:37 -04:00
|
|
|
hbox->pack_start (*l, false, true);
|
|
|
|
hbox->pack_start (_name, true, true);
|
|
|
|
|
2011-07-12 19:40:57 -04:00
|
|
|
VBox* top_vbox = manage (new VBox);
|
|
|
|
top_vbox->set_spacing (4);
|
|
|
|
|
|
|
|
top_vbox->pack_start (*hbox, false, true);
|
|
|
|
top_vbox->pack_start (_active);
|
|
|
|
|
2011-08-30 11:46:39 -04:00
|
|
|
l = manage (new Label (_("Color"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false));
|
|
|
|
hbox = manage (new HBox);
|
|
|
|
hbox->set_spacing (12);
|
|
|
|
hbox->pack_start (*l, false, false);
|
|
|
|
hbox->pack_start (_color, false, false);
|
|
|
|
top_vbox->pack_start (*hbox, false, false);
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2011-07-12 19:40:57 -04:00
|
|
|
main_vbox->pack_start (*top_vbox, false, false);
|
|
|
|
|
|
|
|
_active.set_active (_group->is_active ());
|
2014-06-09 23:28:32 -04:00
|
|
|
|
|
|
|
Gdk::Color c;
|
|
|
|
set_color_from_rgba (c, GroupTabs::group_color (_group));
|
|
|
|
_color.set_color (c);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-06-28 21:07:37 -04:00
|
|
|
VBox* options_box = manage (new VBox);
|
|
|
|
options_box->set_spacing (6);
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2009-06-28 21:07:37 -04:00
|
|
|
l = manage (new Label (_("<b>Sharing</b>"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false ));
|
|
|
|
l->set_use_markup ();
|
|
|
|
options_box->pack_start (*l, false, true);
|
|
|
|
|
2010-02-18 08:59:49 -05:00
|
|
|
_gain.set_active (_group->is_gain());
|
2009-06-23 17:29:39 -04:00
|
|
|
_relative.set_active (_group->is_relative());
|
2010-02-18 08:59:49 -05:00
|
|
|
_mute.set_active (_group->is_mute());
|
|
|
|
_solo.set_active (_group->is_solo());
|
|
|
|
_rec_enable.set_active (_group->is_recenable());
|
|
|
|
_select.set_active (_group->is_select());
|
2011-01-10 18:37:34 -05:00
|
|
|
_route_active.set_active (_group->is_route_active());
|
2011-08-31 15:14:12 -04:00
|
|
|
_share_color.set_active (_group->is_color());
|
2011-10-21 11:47:50 -04:00
|
|
|
_share_monitoring.set_active (_group->is_monitoring());
|
2009-06-28 21:07:37 -04:00
|
|
|
|
2014-06-30 13:01:28 -04:00
|
|
|
if (_group->name ().empty()) {
|
|
|
|
_initial_name = "1";
|
|
|
|
while (!unique_name (_initial_name)) {
|
|
|
|
_initial_name = bump_name_number (_initial_name);
|
|
|
|
}
|
|
|
|
_name.set_text (_initial_name);
|
|
|
|
update();
|
|
|
|
} else {
|
|
|
|
_name.set_text (_initial_name);
|
|
|
|
}
|
|
|
|
|
|
|
|
_name.signal_activate ().connect (sigc::bind (sigc::mem_fun (*this, &Dialog::response), RESPONSE_OK));
|
2011-01-07 21:35:46 -05:00
|
|
|
_name.signal_changed().connect (sigc::mem_fun (*this, &RouteGroupDialog::update));
|
|
|
|
_active.signal_toggled().connect (sigc::mem_fun (*this, &RouteGroupDialog::update));
|
2011-08-31 15:14:12 -04:00
|
|
|
_color.signal_color_set().connect (sigc::mem_fun (*this, &RouteGroupDialog::update));
|
2011-01-07 21:35:46 -05:00
|
|
|
_gain.signal_toggled().connect (sigc::mem_fun (*this, &RouteGroupDialog::update));
|
2016-06-12 14:33:18 -04:00
|
|
|
_relative.signal_toggled().connect (sigc::mem_fun (*this, &RouteGroupDialog::update));
|
|
|
|
_mute.signal_toggled().connect (sigc::mem_fun (*this, &RouteGroupDialog::update));
|
|
|
|
_solo.signal_toggled().connect (sigc::mem_fun (*this, &RouteGroupDialog::update));
|
|
|
|
_rec_enable.signal_toggled().connect (sigc::mem_fun (*this, &RouteGroupDialog::update));
|
|
|
|
_select.signal_toggled().connect (sigc::mem_fun (*this, &RouteGroupDialog::update));
|
|
|
|
_route_active.signal_toggled().connect (sigc::mem_fun (*this, &RouteGroupDialog::update));
|
2011-08-31 15:14:12 -04:00
|
|
|
_share_color.signal_toggled().connect (sigc::mem_fun (*this, &RouteGroupDialog::update));
|
2011-10-21 11:47:50 -04:00
|
|
|
_share_monitoring.signal_toggled().connect (sigc::mem_fun (*this, &RouteGroupDialog::update));
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2009-06-28 21:07:37 -04:00
|
|
|
gain_toggled ();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2012-12-26 12:50:29 -05:00
|
|
|
Table* table = manage (new Table (11, 4, false));
|
2009-06-28 21:07:37 -04:00
|
|
|
table->set_row_spacings (6);
|
|
|
|
|
|
|
|
l = manage (new Label ("", Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false));
|
|
|
|
l->set_padding (8, 0);
|
|
|
|
table->attach (*l, 0, 1, 0, 8, Gtk::FILL, Gtk::FILL, 0, 0);
|
|
|
|
|
|
|
|
table->attach (_gain, 1, 3, 1, 2, Gtk::FILL, Gtk::FILL, 0, 0);
|
2009-06-20 11:40:26 -04:00
|
|
|
|
2009-06-28 21:07:37 -04:00
|
|
|
l = manage (new Label ("", Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false));
|
|
|
|
l->set_padding (0, 0);
|
|
|
|
table->attach (*l, 1, 2, 2, 3, Gtk::FILL, Gtk::FILL, 0, 0);
|
|
|
|
table->attach (_relative, 2, 3, 2, 3, Gtk::FILL, Gtk::FILL, 0, 0);
|
2009-06-23 17:29:39 -04:00
|
|
|
|
2009-06-28 21:07:37 -04:00
|
|
|
table->attach (_mute, 1, 3, 3, 4, Gtk::FILL, Gtk::FILL, 0, 0);
|
|
|
|
table->attach (_solo, 1, 3, 4, 5, Gtk::FILL, Gtk::FILL, 0, 0);
|
|
|
|
table->attach (_rec_enable, 1, 3, 5, 6, Gtk::FILL, Gtk::FILL, 0, 0);
|
|
|
|
table->attach (_select, 1, 3, 6, 7, Gtk::FILL, Gtk::FILL, 0, 0);
|
2012-12-26 12:50:29 -05:00
|
|
|
table->attach (_route_active, 1, 3, 7, 8, Gtk::FILL, Gtk::FILL, 0, 0);
|
|
|
|
table->attach (_share_color, 1, 3, 8, 9, Gtk::FILL, Gtk::FILL, 0, 0);
|
|
|
|
table->attach (_share_monitoring, 1, 3, 9, 10, Gtk::FILL, Gtk::FILL, 0, 0);
|
2011-08-30 05:48:53 -04:00
|
|
|
|
2009-06-28 21:07:37 -04:00
|
|
|
options_box->pack_start (*table, false, true);
|
2011-07-12 19:40:57 -04:00
|
|
|
main_vbox->pack_start (*options_box, false, true);
|
2009-06-21 15:59:56 -04:00
|
|
|
|
2011-07-12 19:40:57 -04:00
|
|
|
get_vbox()->pack_start (*main_vbox, false, false);
|
2009-06-28 21:07:37 -04:00
|
|
|
|
2009-12-11 18:29:48 -05:00
|
|
|
_gain.signal_toggled().connect(sigc::mem_fun (*this, &RouteGroupDialog::gain_toggled));
|
2009-06-20 11:40:26 -04:00
|
|
|
|
2011-01-07 21:35:46 -05:00
|
|
|
if (creating_new) {
|
|
|
|
add_button (Stock::CANCEL, RESPONSE_CANCEL);
|
|
|
|
add_button (Stock::NEW, RESPONSE_OK);
|
|
|
|
set_default_response (RESPONSE_OK);
|
|
|
|
}
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2009-06-28 21:07:37 -04:00
|
|
|
show_all_children ();
|
2009-06-20 11:40:26 -04:00
|
|
|
}
|
|
|
|
|
2011-01-07 21:35:46 -05:00
|
|
|
bool
|
2016-06-12 14:33:18 -04:00
|
|
|
RouteGroupDialog::name_check () const
|
2009-06-20 11:40:26 -04:00
|
|
|
{
|
2016-06-12 14:33:18 -04:00
|
|
|
if (unique_name (_name.get_text())) {
|
|
|
|
/* not cancelled and the name is ok, so all is well */
|
|
|
|
return true;
|
|
|
|
}
|
2016-02-22 00:22:56 -05:00
|
|
|
|
2016-06-12 14:33:18 -04:00
|
|
|
_group->set_name (_initial_name);
|
2011-01-07 21:35:46 -05:00
|
|
|
|
2016-06-12 14:33:18 -04:00
|
|
|
MessageDialog msg (
|
|
|
|
_("The group name is not unique. Please use a different name."),
|
|
|
|
false,
|
|
|
|
Gtk::MESSAGE_ERROR,
|
|
|
|
Gtk::BUTTONS_OK,
|
|
|
|
true
|
|
|
|
);
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2016-06-12 14:33:18 -04:00
|
|
|
msg.set_position (WIN_POS_MOUSE);
|
|
|
|
msg.run ();
|
2009-06-20 11:40:26 -04:00
|
|
|
|
2011-01-07 21:35:46 -05:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
RouteGroupDialog::update ()
|
|
|
|
{
|
|
|
|
PropertyList plist;
|
|
|
|
|
2016-06-05 15:54:37 -04:00
|
|
|
plist.add (Properties::group_gain, _gain.get_active());
|
|
|
|
plist.add (Properties::group_recenable, _rec_enable.get_active());
|
|
|
|
plist.add (Properties::group_mute, _mute.get_active());
|
|
|
|
plist.add (Properties::group_solo, _solo.get_active ());
|
|
|
|
plist.add (Properties::group_select, _select.get_active());
|
|
|
|
plist.add (Properties::group_route_active, _route_active.get_active());
|
|
|
|
plist.add (Properties::group_relative, _relative.get_active());
|
|
|
|
plist.add (Properties::group_color, _share_color.get_active());
|
|
|
|
plist.add (Properties::group_monitoring, _share_monitoring.get_active());
|
2011-01-07 21:35:46 -05:00
|
|
|
plist.add (Properties::active, _active.get_active());
|
|
|
|
plist.add (Properties::name, string (_name.get_text()));
|
|
|
|
|
|
|
|
_group->apply_changes (plist);
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2014-06-09 23:28:32 -04:00
|
|
|
GroupTabs::set_group_color (_group, gdk_color_to_rgba (_color.get_color ()));
|
2009-06-20 11:40:26 -04:00
|
|
|
}
|
2009-06-28 21:07:37 -04:00
|
|
|
|
|
|
|
void
|
|
|
|
RouteGroupDialog::gain_toggled ()
|
|
|
|
{
|
|
|
|
_relative.set_sensitive (_gain.get_active ());
|
|
|
|
}
|
|
|
|
|
2011-01-07 21:35:46 -05:00
|
|
|
/** @return true if the current group's name is unique accross the session */
|
|
|
|
bool
|
2014-06-30 12:25:11 -04:00
|
|
|
RouteGroupDialog::unique_name (std::string const name) const
|
2011-01-07 21:35:46 -05:00
|
|
|
{
|
2014-06-30 12:25:11 -04:00
|
|
|
if (name.empty()) return false; // do not allow empty name, empty means unset.
|
2011-01-07 21:35:46 -05:00
|
|
|
list<RouteGroup*> route_groups = _group->session().route_groups ();
|
|
|
|
list<RouteGroup*>::iterator i = route_groups.begin ();
|
2014-06-30 12:25:11 -04:00
|
|
|
while (i != route_groups.end() && ((*i)->name() != name || *i == _group)) {
|
2011-01-07 21:35:46 -05:00
|
|
|
++i;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (i == route_groups.end ());
|
|
|
|
}
|