make RouteGroupDialog non-modal.
Not really how/why it was modal, but it did run a recursive main event loop, and these are always a bad idea for lots of reasons. So I removed that feature, which makes it non-modal. Not 100% tested yet.
This commit is contained in:
parent
63e6378713
commit
2c44225df2
@ -572,9 +572,7 @@ EditorRouteGroups::set_session (Session* s)
|
||||
void
|
||||
EditorRouteGroups::run_new_group_dialog ()
|
||||
{
|
||||
RouteList rl;
|
||||
|
||||
return _editor->_group_tabs->run_new_group_dialog (rl, false);
|
||||
return _editor->_group_tabs->run_new_group_dialog (0, false);
|
||||
}
|
||||
|
||||
/** Called when a model row is deleted, but also when the model is
|
||||
|
@ -25,6 +25,8 @@
|
||||
#include "ardour/vca_manager.h"
|
||||
#include "ardour/vca.h"
|
||||
|
||||
#include "gtkmm2ext/doi.h"
|
||||
|
||||
#include "gui_thread.h"
|
||||
#include "route_group_dialog.h"
|
||||
#include "group_tabs.h"
|
||||
@ -145,7 +147,7 @@ GroupTabs::on_button_press_event (GdkEventButton* ev)
|
||||
if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier) && g) {
|
||||
/* edit */
|
||||
RouteGroupDialog d (g, false);
|
||||
d.do_run ();
|
||||
d.present ();
|
||||
} else {
|
||||
Menu* m = get_menu (g, true);
|
||||
if (m) {
|
||||
@ -208,12 +210,7 @@ GroupTabs::on_button_release_event (GdkEventButton*)
|
||||
|
||||
if (!routes.empty()) {
|
||||
if (_dragging_new_tab) {
|
||||
RouteGroup* g = create_and_add_group ();
|
||||
if (g) {
|
||||
for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
|
||||
g->add (*i);
|
||||
}
|
||||
}
|
||||
run_new_group_dialog (&routes, false);
|
||||
} else {
|
||||
boost::shared_ptr<RouteList> r = _session->get_routes ();
|
||||
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
|
||||
@ -344,8 +341,8 @@ GroupTabs::get_menu (RouteGroup* g, bool in_tab_area)
|
||||
const VCAList vcas = _session->vca_manager().vcas ();
|
||||
|
||||
if (!in_tab_area) {
|
||||
items.push_back (MenuElem (_("Create New Group ..."), hide_return (sigc::mem_fun(*this, &GroupTabs::create_and_add_group))));
|
||||
items.push_back (MenuElem (_("Create New Group with Control Master ..."), hide_return (sigc::mem_fun(*this, &GroupTabs::create_and_add_group_with_master))));
|
||||
items.push_back (MenuElem (_("Create New Group ..."), sigc::bind (sigc::mem_fun(*this, &GroupTabs::run_new_group_dialog), (RouteList const *) 0, false)));
|
||||
items.push_back (MenuElem (_("Create New Group with Control Master ..."), sigc::bind (sigc::mem_fun(*this, &GroupTabs::run_new_group_dialog), (RouteList const *) 0, true)));
|
||||
|
||||
/* context menu is not for a group tab, show the "create new
|
||||
from" items here
|
||||
@ -436,7 +433,7 @@ GroupTabs::get_menu (RouteGroup* g, bool in_tab_area)
|
||||
}
|
||||
|
||||
void
|
||||
GroupTabs::assign_group_to_master (uint32_t which, RouteGroup* group, bool rename_master)
|
||||
GroupTabs::assign_group_to_master (uint32_t which, RouteGroup* group, bool rename_master) const
|
||||
{
|
||||
if (!_session || !group) {
|
||||
return;
|
||||
@ -569,86 +566,74 @@ GroupTabs::assign_soloed_to_master (uint32_t which)
|
||||
void
|
||||
GroupTabs::new_from_selection (bool with_master)
|
||||
{
|
||||
run_new_group_dialog (selected_routes(), with_master);
|
||||
RouteList rl (selected_routes());
|
||||
run_new_group_dialog (&rl, with_master);
|
||||
}
|
||||
|
||||
void
|
||||
GroupTabs::new_from_rec_enabled (bool with_master)
|
||||
{
|
||||
run_new_group_dialog (get_rec_enabled(), with_master);
|
||||
RouteList rl (get_rec_enabled());
|
||||
run_new_group_dialog (&rl, with_master);
|
||||
}
|
||||
|
||||
void
|
||||
GroupTabs::new_from_soloed (bool with_master)
|
||||
{
|
||||
run_new_group_dialog (get_soloed(), with_master);
|
||||
RouteList rl (get_soloed());
|
||||
run_new_group_dialog (&rl, with_master);
|
||||
}
|
||||
|
||||
void
|
||||
GroupTabs::run_new_group_dialog (RouteList const & rl, bool with_master)
|
||||
GroupTabs::run_new_group_dialog (RouteList const * rl, bool with_master)
|
||||
{
|
||||
if (rl.empty()) {
|
||||
if (rl && rl->empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
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, &GroupTabs::new_group_dialog_finished), d, rl ? new RouteList (*rl): 0, with_master));
|
||||
d->present ();
|
||||
}
|
||||
|
||||
void
|
||||
GroupTabs::new_group_dialog_finished (int r, RouteGroupDialog* d, RouteList const * rl, bool with_master) const
|
||||
{
|
||||
if (r == RESPONSE_OK) {
|
||||
|
||||
_session->add_route_group (d->group());
|
||||
|
||||
if (rl) {
|
||||
for (RouteList::const_iterator i = rl->begin(); i != rl->end(); ++i) {
|
||||
d->group()->add (*i);
|
||||
}
|
||||
|
||||
if (with_master) {
|
||||
assign_group_to_master (0, d->group(), true); /* zero => new master */
|
||||
}
|
||||
}
|
||||
} else {
|
||||
_session->add_route_group (g);
|
||||
for (RouteList::const_iterator i = rl.begin(); i != rl.end(); ++i) {
|
||||
g->add (*i);
|
||||
}
|
||||
|
||||
if (with_master) {
|
||||
assign_group_to_master (0, g, true); /* zero => new master */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RouteGroup *
|
||||
GroupTabs::create_and_add_group () const
|
||||
{
|
||||
RouteGroup* g = new RouteGroup (*_session, "");
|
||||
RouteGroupDialog d (g, true);
|
||||
|
||||
if (d.do_run ()) {
|
||||
delete g;
|
||||
return 0;
|
||||
delete d->group ();
|
||||
}
|
||||
|
||||
_session->add_route_group (g);
|
||||
return g;
|
||||
}
|
||||
|
||||
RouteGroup *
|
||||
GroupTabs::create_and_add_master () const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
RouteGroup *
|
||||
GroupTabs::create_and_add_group_with_master () const
|
||||
{
|
||||
RouteGroup* g = new RouteGroup (*_session, "");
|
||||
RouteGroupDialog d (g, true);
|
||||
|
||||
if (d.do_run ()) {
|
||||
delete g;
|
||||
return 0;
|
||||
}
|
||||
|
||||
_session->add_route_group (g);
|
||||
return g;
|
||||
delete rl;
|
||||
delete_when_idle (d);
|
||||
}
|
||||
|
||||
void
|
||||
GroupTabs::edit_group (RouteGroup* g)
|
||||
{
|
||||
RouteGroupDialog d (g, false);
|
||||
d.do_run ();
|
||||
RouteGroupDialog* d = new RouteGroupDialog (g, false);
|
||||
d->signal_response().connect (sigc::bind (sigc::mem_fun (*this, &GroupTabs::edit_group_dialog_finished), d));
|
||||
d->present ();
|
||||
}
|
||||
|
||||
void
|
||||
GroupTabs::edit_group_dialog_finished (int r, RouteGroupDialog* d) const
|
||||
{
|
||||
delete_when_idle (d);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -27,6 +27,7 @@ namespace ARDOUR {
|
||||
}
|
||||
|
||||
class Editor;
|
||||
class RouteGroupDialog;
|
||||
|
||||
/** Parent class for tabs which represent route groups as colored tabs;
|
||||
* Currently used on the left-hand side of the editor and at the top of the mixer.
|
||||
@ -48,7 +49,7 @@ public:
|
||||
*/
|
||||
Gtk::Menu* get_menu (ARDOUR::RouteGroup* g, bool tabArea = false);
|
||||
|
||||
void run_new_group_dialog (ARDOUR::RouteList const &, bool with_master);
|
||||
void run_new_group_dialog (ARDOUR::RouteList const *, bool with_master);
|
||||
|
||||
static void set_group_color (ARDOUR::RouteGroup *, uint32_t);
|
||||
static std::string group_gui_id (ARDOUR::RouteGroup *);
|
||||
@ -98,9 +99,10 @@ private:
|
||||
void new_from_selection (bool with_master);
|
||||
void new_from_rec_enabled (bool with_master);
|
||||
void new_from_soloed (bool with_master);
|
||||
ARDOUR::RouteGroup* create_and_add_group () const;
|
||||
ARDOUR::RouteGroup* create_and_add_master () const;
|
||||
ARDOUR::RouteGroup* create_and_add_group_with_master () const;
|
||||
|
||||
void new_group_dialog_finished (int, RouteGroupDialog*, ARDOUR::RouteList const *, bool with_master) const;
|
||||
void edit_group_dialog_finished (int, RouteGroupDialog*) const;
|
||||
|
||||
void collect (ARDOUR::RouteGroup *);
|
||||
void set_activation (ARDOUR::RouteGroup *, bool);
|
||||
void edit_group (ARDOUR::RouteGroup *);
|
||||
@ -122,7 +124,7 @@ private:
|
||||
void route_added_to_route_group (ARDOUR::RouteGroup *, boost::weak_ptr<ARDOUR::Route>);
|
||||
void route_removed_from_route_group (ARDOUR::RouteGroup *, boost::weak_ptr<ARDOUR::Route>);
|
||||
|
||||
void assign_group_to_master (uint32_t which, ARDOUR::RouteGroup*, bool rename_master);
|
||||
void assign_group_to_master (uint32_t which, ARDOUR::RouteGroup*, bool rename_master) const;
|
||||
void assign_selection_to_master (uint32_t which);
|
||||
void assign_recenabled_to_master (uint32_t which);
|
||||
void assign_soloed_to_master (uint32_t which);
|
||||
|
@ -1626,9 +1626,7 @@ Mixer_UI::route_groups_changed ()
|
||||
void
|
||||
Mixer_UI::new_route_group ()
|
||||
{
|
||||
RouteList rl;
|
||||
|
||||
_group_tabs->run_new_group_dialog (rl, false);
|
||||
_group_tabs->run_new_group_dialog (0, false);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -33,6 +33,7 @@ public:
|
||||
RouteGroupDialog (ARDOUR::RouteGroup *, bool);
|
||||
|
||||
bool do_run ();
|
||||
ARDOUR::RouteGroup* group() const { return _group; }
|
||||
|
||||
private:
|
||||
ARDOUR::RouteGroup* _group;
|
||||
|
Loading…
Reference in New Issue
Block a user