X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Froute_group_dialog.cc;h=e7e48f777ecaedc4431c09d0efa22b154b3caa9e;hb=5fef65538040fbac1b9edd1847a269aa925a49c9;hp=3e2c497475422dfa88a0c592bcc6e427e4ca4586;hpb=ecb500572d2ca92983148ab14d74c1ecd7d4f7ba;p=ardour.git diff --git a/gtk2_ardour/route_group_dialog.cc b/gtk2_ardour/route_group_dialog.cc index 3e2c497475..e7e48f777e 100644 --- a/gtk2_ardour/route_group_dialog.cc +++ b/gtk2_ardour/route_group_dialog.cc @@ -17,18 +17,24 @@ */ +#include + +#include "ardour/route_group.h" +#include "ardour/session.h" + #include #include #include -#include "ardour/route_group.h" -#include "ardour/session.h" + #include "route_group_dialog.h" #include "group_tabs.h" +#include "utils.h" + #include "i18n.h" -#include using namespace Gtk; using namespace ARDOUR; +using namespace ARDOUR_UI_UTILS; using namespace std; using namespace PBD; @@ -43,7 +49,6 @@ RouteGroupDialog::RouteGroupDialog (RouteGroup* g, bool creating_new) , _solo (_("Soloing")) , _rec_enable (_("Record enable")) , _select (_("Selection")) - , _edit (_("Editing")) , _route_active (_("Active state")) , _share_color (_("Color")) , _share_monitoring (_("Monitoring")) @@ -51,7 +56,6 @@ RouteGroupDialog::RouteGroupDialog (RouteGroup* g, bool creating_new) set_modal (true); set_skip_taskbar_hint (true); set_resizable (true); - set_position (Gtk::WIN_POS_MOUSE); set_name (N_("RouteGroupDialog")); VBox* main_vbox = manage (new VBox); @@ -84,9 +88,11 @@ RouteGroupDialog::RouteGroupDialog (RouteGroup* g, bool creating_new) main_vbox->pack_start (*top_vbox, false, false); - _name.set_text (_group->name ()); _active.set_active (_group->is_active ()); - _color.set_color (GroupTabs::group_color (_group)); + + Gdk::Color c; + set_color_from_rgba (c, GroupTabs::group_color (_group)); + _color.set_color (c); VBox* options_box = manage (new VBox); options_box->set_spacing (6); @@ -95,19 +101,28 @@ RouteGroupDialog::RouteGroupDialog (RouteGroup* g, bool creating_new) l->set_use_markup (); options_box->pack_start (*l, false, true); - _name.signal_activate ().connect (sigc::bind (sigc::mem_fun (*this, &Dialog::response), RESPONSE_OK)); - _gain.set_active (_group->is_gain()); _relative.set_active (_group->is_relative()); _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()); - _edit.set_active (_group->is_edit()); _route_active.set_active (_group->is_route_active()); _share_color.set_active (_group->is_color()); _share_monitoring.set_active (_group->is_monitoring()); + 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)); _name.signal_changed().connect (sigc::mem_fun (*this, &RouteGroupDialog::update)); _active.signal_toggled().connect (sigc::mem_fun (*this, &RouteGroupDialog::update)); _color.signal_color_set().connect (sigc::mem_fun (*this, &RouteGroupDialog::update)); @@ -117,14 +132,13 @@ RouteGroupDialog::RouteGroupDialog (RouteGroup* g, bool creating_new) _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)); - _edit.signal_toggled().connect (sigc::mem_fun (*this, &RouteGroupDialog::update)); _route_active.signal_toggled().connect (sigc::mem_fun (*this, &RouteGroupDialog::update)); _share_color.signal_toggled().connect (sigc::mem_fun (*this, &RouteGroupDialog::update)); _share_monitoring.signal_toggled().connect (sigc::mem_fun (*this, &RouteGroupDialog::update)); gain_toggled (); - Table* table = manage (new Table (12, 4, false)); + Table* table = manage (new Table (11, 4, false)); table->set_row_spacings (6); l = manage (new Label ("", Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false)); @@ -142,10 +156,9 @@ RouteGroupDialog::RouteGroupDialog (RouteGroup* g, bool creating_new) 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); - table->attach (_edit, 1, 3, 7, 8, Gtk::FILL, Gtk::FILL, 0, 0); - table->attach (_route_active, 1, 3, 8, 9, Gtk::FILL, Gtk::FILL, 0, 0); - table->attach (_share_color, 1, 3, 9, 10, Gtk::FILL, Gtk::FILL, 0, 0); - table->attach (_share_monitoring, 1, 3, 10, 11, Gtk::FILL, Gtk::FILL, 0, 0); + 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); options_box->pack_start (*table, false, true); main_vbox->pack_start (*options_box, false, true); @@ -177,14 +190,14 @@ RouteGroupDialog::do_run () return Gtk::RESPONSE_CANCEL; } - if (unique_name ()) { + if (unique_name (_name.get_text())) { /* not cancelled and the name is ok, so all is well */ return false; } _group->set_name (_initial_name); MessageDialog msg ( - _("A route group of this name already exists. Please use a different name."), + _("The group name is not unique. Please use a different name."), false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, @@ -194,7 +207,7 @@ RouteGroupDialog::do_run () msg.run (); } - /* NOTREACHED */ + abort(); /* NOTREACHED */ return false; } @@ -208,7 +221,6 @@ RouteGroupDialog::update () plist.add (Properties::mute, _mute.get_active()); plist.add (Properties::solo, _solo.get_active ()); plist.add (Properties::select, _select.get_active()); - plist.add (Properties::edit, _edit.get_active()); plist.add (Properties::route_active, _route_active.get_active()); plist.add (Properties::relative, _relative.get_active()); plist.add (Properties::active, _active.get_active()); @@ -218,7 +230,7 @@ RouteGroupDialog::update () _group->apply_changes (plist); - GroupTabs::set_group_color (_group, _color.get_color ()); + GroupTabs::set_group_color (_group, gdk_color_to_rgba (_color.get_color ())); } void @@ -229,11 +241,12 @@ RouteGroupDialog::gain_toggled () /** @return true if the current group's name is unique accross the session */ bool -RouteGroupDialog::unique_name () const +RouteGroupDialog::unique_name (std::string const name) const { + if (name.empty()) return false; // do not allow empty name, empty means unset. list route_groups = _group->session().route_groups (); list::iterator i = route_groups.begin (); - while (i != route_groups.end() && ((*i)->name() != _name.get_text() || *i == _group)) { + while (i != route_groups.end() && ((*i)->name() != name || *i == _group)) { ++i; }