mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 23:35:03 +01:00
Add route dialog is never a transient window.
Fixes a hack where it's transient parent was used to give an order hint (for the order key of any new tracks). This commit adds a new combobox "insert_at" to let the user tell us where they want new tracks to go.
This commit is contained in:
parent
1644fc1068
commit
73d2d44652
4 changed files with 55 additions and 20 deletions
|
|
@ -80,6 +80,12 @@ AddRouteDialog::AddRouteDialog ()
|
|||
track_bus_combo.append_text (_("Busses"));
|
||||
track_bus_combo.set_active (0);
|
||||
|
||||
insert_at_combo.append_text (_("Editor Selection"));
|
||||
insert_at_combo.append_text (_("Mixer Selection"));
|
||||
insert_at_combo.append_text (_("End"));
|
||||
|
||||
insert_at_combo.set_active (0);
|
||||
|
||||
VBox* vbox = manage (new VBox);
|
||||
Gtk::Label* l;
|
||||
|
||||
|
|
@ -151,6 +157,12 @@ AddRouteDialog::AddRouteDialog ()
|
|||
table2->attach (route_group_combo, 2, 3, n, n + 1, Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
|
||||
++n;
|
||||
|
||||
/* New route will be inserted at.. */
|
||||
l = manage (new Label (_("Insert at:"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false));
|
||||
table2->attach (*l, 1, 2, n, n + 1, Gtk::FILL, Gtk::EXPAND, 0, 0);
|
||||
table2->attach (insert_at_combo, 2, 3, n, n + 1, Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
|
||||
++n;
|
||||
|
||||
options_box->pack_start (*table2, false, true);
|
||||
vbox->pack_start (*options_box, false, true);
|
||||
|
||||
|
|
@ -538,6 +550,20 @@ AddRouteDialog::group_changed ()
|
|||
}
|
||||
}
|
||||
|
||||
AddRouteDialog::InsertAt
|
||||
AddRouteDialog::insert_at ()
|
||||
{
|
||||
std::string str = insert_at_combo.get_active_text();
|
||||
|
||||
if (str == _("Editor Selection")) {
|
||||
return EditorSelection;
|
||||
} else if (str == _("Mixer Selection")){
|
||||
return MixerSelection;
|
||||
}
|
||||
|
||||
return End;
|
||||
}
|
||||
|
||||
bool
|
||||
AddRouteDialog::channel_separator (const Glib::RefPtr<Gtk::TreeModel> &, const Gtk::TreeModel::iterator &i)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -67,6 +67,12 @@ class AddRouteDialog : public ArdourDialog
|
|||
|
||||
ARDOUR::TrackMode mode();
|
||||
ARDOUR::RouteGroup* route_group ();
|
||||
enum InsertAt {
|
||||
EditorSelection,
|
||||
MixerSelection,
|
||||
End
|
||||
};
|
||||
InsertAt insert_at();
|
||||
|
||||
private:
|
||||
Gtk::Entry name_template_entry;
|
||||
|
|
@ -80,6 +86,8 @@ class AddRouteDialog : public ArdourDialog
|
|||
Gtk::ComboBoxText mode_combo;
|
||||
Gtk::ComboBoxText route_group_combo;
|
||||
InstrumentSelector instrument_combo;
|
||||
Gtk::Label insert_at_label;
|
||||
Gtk::ComboBoxText insert_at_combo;
|
||||
|
||||
std::vector<ARDOUR::TemplateInfo> route_templates;
|
||||
|
||||
|
|
|
|||
|
|
@ -3424,7 +3424,7 @@ ARDOUR_UI::flush_trash ()
|
|||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::setup_order_hint ()
|
||||
ARDOUR_UI::setup_order_hint (AddRouteDialog::InsertAt place)
|
||||
{
|
||||
uint32_t order_hint = 0;
|
||||
|
||||
|
|
@ -3432,7 +3432,7 @@ ARDOUR_UI::setup_order_hint ()
|
|||
we want the new routes to have their order keys set starting from
|
||||
the highest order key in the selection + 1 (if available).
|
||||
*/
|
||||
if (add_route_dialog->get_transient_for () == mixer->get_toplevel()) {
|
||||
if (place == AddRouteDialog::MixerSelection) {
|
||||
for (RouteUISelection::iterator s = mixer->selection().routes.begin(); s != mixer->selection().routes.end(); ++s) {
|
||||
if ((*s)->route()->order_key() > order_hint) {
|
||||
order_hint = (*s)->route()->order_key();
|
||||
|
|
@ -3443,7 +3443,7 @@ ARDOUR_UI::setup_order_hint ()
|
|||
order_hint++;
|
||||
}
|
||||
|
||||
} else {
|
||||
} else if (place == AddRouteDialog::EditorSelection){
|
||||
for (TrackSelection::iterator s = editor->get_selection().tracks.begin(); s != editor->get_selection().tracks.end(); ++s) {
|
||||
RouteTimeAxisView* tav = dynamic_cast<RouteTimeAxisView*> (*s);
|
||||
if (tav && tav->route() && tav->route()->order_key() > order_hint) {
|
||||
|
|
@ -3454,28 +3454,34 @@ ARDOUR_UI::setup_order_hint ()
|
|||
if (!editor->get_selection().tracks.empty()) {
|
||||
order_hint++;
|
||||
}
|
||||
} else {
|
||||
/** AddRouteDialog::End
|
||||
* an order hint of '0' means place new routes at the end.
|
||||
* do nothing
|
||||
*/
|
||||
}
|
||||
|
||||
_session->set_order_hint (order_hint);
|
||||
|
||||
/* create a gap in the existing route order keys to accomodate new routes.*/
|
||||
if (order_hint != 0) {
|
||||
boost::shared_ptr <RouteList> rd = _session->get_routes();
|
||||
for (RouteList::iterator ri = rd->begin(); ri != rd->end(); ++ri) {
|
||||
boost::shared_ptr<Route> rt (*ri);
|
||||
|
||||
boost::shared_ptr <RouteList> rd = _session->get_routes();
|
||||
for (RouteList::iterator ri = rd->begin(); ri != rd->end(); ++ri) {
|
||||
boost::shared_ptr<Route> rt (*ri);
|
||||
|
||||
if (rt->is_monitor()) {
|
||||
continue;
|
||||
}
|
||||
if (rt->is_monitor()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (rt->order_key () >= order_hint) {
|
||||
rt->set_order_key (rt->order_key () + add_route_dialog->count());
|
||||
if (rt->order_key () >= order_hint) {
|
||||
rt->set_order_key (rt->order_key () + add_route_dialog->count());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::add_route (Gtk::Window* float_window)
|
||||
ARDOUR_UI::add_route (Gtk::Window* /* ignored */)
|
||||
{
|
||||
int count;
|
||||
|
||||
|
|
@ -3488,11 +3494,6 @@ ARDOUR_UI::add_route (Gtk::Window* float_window)
|
|||
return;
|
||||
}
|
||||
|
||||
if (float_window) {
|
||||
add_route_dialog->unset_transient_for ();
|
||||
add_route_dialog->set_transient_for (*float_window);
|
||||
}
|
||||
|
||||
ResponseType r = (ResponseType) add_route_dialog->run ();
|
||||
|
||||
add_route_dialog->hide();
|
||||
|
|
@ -3509,7 +3510,7 @@ ARDOUR_UI::add_route (Gtk::Window* float_window)
|
|||
return;
|
||||
}
|
||||
|
||||
setup_order_hint();
|
||||
setup_order_hint(add_route_dialog->insert_at());
|
||||
|
||||
string template_path = add_route_dialog->track_template();
|
||||
DisplaySuspender ds;
|
||||
|
|
|
|||
|
|
@ -609,7 +609,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
|
|||
|
||||
void snapshot_session (bool switch_to_it);
|
||||
void rename_session ();
|
||||
void setup_order_hint ();
|
||||
void setup_order_hint (AddRouteDialog::InsertAt);
|
||||
|
||||
int create_mixer ();
|
||||
int create_editor ();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue