remove RouteGroupDialog::do_run() and replace its use with code that doesn't rely on a recursive run loop
This commit is contained in:
parent
b3b246b724
commit
0852d05643
@ -30,6 +30,7 @@
|
||||
#include "pbd/convert.h"
|
||||
|
||||
#include "gtkmm2ext/utils.h"
|
||||
#include "gtkmm2ext/doi.h"
|
||||
|
||||
#include "ardour/plugin_manager.h"
|
||||
#include "ardour/profile.h"
|
||||
@ -585,21 +586,36 @@ AddRouteDialog::group_changed ()
|
||||
{
|
||||
if (_session && route_group_combo.get_active_text () == _("New Group...")) {
|
||||
RouteGroup* g = new RouteGroup (*_session, "");
|
||||
RouteGroupDialog d (g, true);
|
||||
RouteGroupDialog* d = new RouteGroupDialog (g, true);
|
||||
|
||||
if (d.do_run ()) {
|
||||
delete g;
|
||||
route_group_combo.set_active (2);
|
||||
} else {
|
||||
if (_session) {
|
||||
_session->add_route_group (g);
|
||||
}
|
||||
add_route_group (g);
|
||||
route_group_combo.set_active (3);
|
||||
}
|
||||
d->signal_response().connect (sigc::bind (sigc::mem_fun (*this, &AddRouteDialog::new_group_dialog_finished), d));
|
||||
d->present();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
AddRouteDialog::new_group_dialog_finished (int r, RouteGroupDialog* d)
|
||||
{
|
||||
if (r == RESPONSE_OK) {
|
||||
|
||||
if (!d->name_check()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (_session) {
|
||||
_session->add_route_group (d->group());
|
||||
}
|
||||
|
||||
add_route_group (d->group());
|
||||
route_group_combo.set_active (3);
|
||||
} else {
|
||||
delete d->group ();
|
||||
route_group_combo.set_active (2);
|
||||
}
|
||||
|
||||
delete_when_idle (d);
|
||||
}
|
||||
|
||||
AddRouteDialog::InsertAt
|
||||
AddRouteDialog::insert_at ()
|
||||
{
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "instrument_selector.h"
|
||||
|
||||
class Editor;
|
||||
class RouteGroupDialog;
|
||||
|
||||
class AddRouteDialog : public ArdourDialog
|
||||
{
|
||||
@ -107,7 +108,7 @@ class AddRouteDialog : public ArdourDialog
|
||||
void maybe_update_name_template_entry ();
|
||||
|
||||
void reset_template_option_visibility ();
|
||||
|
||||
void new_group_dialog_finished (int, RouteGroupDialog*);
|
||||
void on_show ();
|
||||
|
||||
struct ChannelSetup {
|
||||
|
@ -603,6 +603,10 @@ GroupTabs::new_group_dialog_finished (int r, RouteGroupDialog* d, RouteList cons
|
||||
{
|
||||
if (r == RESPONSE_OK) {
|
||||
|
||||
if (!d->name_check()) {
|
||||
return;
|
||||
}
|
||||
|
||||
_session->add_route_group (d->group());
|
||||
|
||||
if (rl) {
|
||||
|
@ -126,12 +126,12 @@ RouteGroupDialog::RouteGroupDialog (RouteGroup* g, bool creating_new)
|
||||
_active.signal_toggled().connect (sigc::mem_fun (*this, &RouteGroupDialog::update));
|
||||
_color.signal_color_set().connect (sigc::mem_fun (*this, &RouteGroupDialog::update));
|
||||
_gain.signal_toggled().connect (sigc::mem_fun (*this, &RouteGroupDialog::update));
|
||||
_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));
|
||||
_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));
|
||||
_share_color.signal_toggled().connect (sigc::mem_fun (*this, &RouteGroupDialog::update));
|
||||
_share_monitoring.signal_toggled().connect (sigc::mem_fun (*this, &RouteGroupDialog::update));
|
||||
|
||||
@ -178,35 +178,27 @@ RouteGroupDialog::RouteGroupDialog (RouteGroup* g, bool creating_new)
|
||||
show_all_children ();
|
||||
}
|
||||
|
||||
/** @return true if the route group edit was cancelled, otherwise false */
|
||||
bool
|
||||
RouteGroupDialog::do_run ()
|
||||
RouteGroupDialog::name_check () const
|
||||
{
|
||||
while (1) {
|
||||
int const r = run ();
|
||||
|
||||
if (r != Gtk::RESPONSE_OK) {
|
||||
return true;
|
||||
}
|
||||
|
||||
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 (
|
||||
_("The group name is not unique. Please use a different name."),
|
||||
false,
|
||||
Gtk::MESSAGE_ERROR,
|
||||
Gtk::BUTTONS_OK,
|
||||
true
|
||||
);
|
||||
|
||||
msg.run ();
|
||||
if (unique_name (_name.get_text())) {
|
||||
/* not cancelled and the name is ok, so all is well */
|
||||
return true;
|
||||
}
|
||||
|
||||
abort(); /* NOTREACHED */
|
||||
_group->set_name (_initial_name);
|
||||
|
||||
MessageDialog msg (
|
||||
_("The group name is not unique. Please use a different name."),
|
||||
false,
|
||||
Gtk::MESSAGE_ERROR,
|
||||
Gtk::BUTTONS_OK,
|
||||
true
|
||||
);
|
||||
|
||||
msg.set_position (WIN_POS_MOUSE);
|
||||
msg.run ();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -32,8 +32,8 @@ class RouteGroupDialog : public ArdourDialog
|
||||
public:
|
||||
RouteGroupDialog (ARDOUR::RouteGroup *, bool);
|
||||
|
||||
bool do_run ();
|
||||
ARDOUR::RouteGroup* group() const { return _group; }
|
||||
bool name_check () const;
|
||||
|
||||
private:
|
||||
ARDOUR::RouteGroup* _group;
|
||||
|
@ -19,12 +19,16 @@
|
||||
|
||||
#include <gtkmm/menu.h>
|
||||
#include <gtkmm/stock.h>
|
||||
|
||||
#include "gtkmm2ext/utils.h"
|
||||
#include "gtkmm2ext/doi.h"
|
||||
|
||||
#include "ardour/session.h"
|
||||
#include "ardour/route_group.h"
|
||||
#include "ardour/route.h"
|
||||
#include "route_group_menu.h"
|
||||
#include "route_group_dialog.h"
|
||||
|
||||
#include "i18n.h"
|
||||
|
||||
using namespace Gtk;
|
||||
@ -158,14 +162,22 @@ RouteGroupMenu::new_group ()
|
||||
}
|
||||
|
||||
RouteGroup* g = new RouteGroup (*_session, "");
|
||||
RouteGroupDialog d (g, true);
|
||||
RouteGroupDialog* d = new RouteGroupDialog (g, true);
|
||||
|
||||
if (d.do_run ()) {
|
||||
delete g;
|
||||
d->signal_response().connect (sigc::bind (sigc::mem_fun (*this, &RouteGroupMenu::new_group_dialog_finished), d));
|
||||
}
|
||||
|
||||
void
|
||||
RouteGroupMenu::new_group_dialog_finished (int r, RouteGroupDialog* d)
|
||||
{
|
||||
if (r == RESPONSE_OK) {
|
||||
_session->add_route_group (d->group());
|
||||
set_group (d->group());
|
||||
} else {
|
||||
_session->add_route_group (g);
|
||||
set_group (g);
|
||||
delete d->group ();
|
||||
}
|
||||
|
||||
delete_when_idle (d);
|
||||
}
|
||||
|
||||
Gtk::Menu *
|
||||
|
@ -23,6 +23,8 @@
|
||||
#include "ardour/route_group.h"
|
||||
#include "ardour/session_handle.h"
|
||||
|
||||
class RouteGroupDialog;
|
||||
|
||||
class RouteGroupMenu : public ARDOUR::SessionHandlePtr
|
||||
{
|
||||
public:
|
||||
@ -37,8 +39,9 @@ public:
|
||||
void add_item (ARDOUR::RouteGroup *, std::set<ARDOUR::RouteGroup*> const &, Gtk::RadioMenuItem::Group*);
|
||||
void new_group ();
|
||||
void set_group (ARDOUR::RouteGroup *);
|
||||
|
||||
void new_group_dialog_finished (int, RouteGroupDialog*);
|
||||
Gtk::Menu* _menu;
|
||||
|
||||
PBD::PropertyList* _default_properties;
|
||||
bool _inhibit_group_selected;
|
||||
ARDOUR::WeakRouteList _subject;
|
||||
|
Loading…
Reference in New Issue
Block a user