summaryrefslogtreecommitdiff
path: root/gtk2_ardour/add_route_dialog.cc
diff options
context:
space:
mode:
authorJohannes Mueller <github@johannes-mueller.org>2020-03-30 21:49:57 +0200
committerJohannes Mueller <github@johannes-mueller.org>2020-03-31 09:01:59 +0200
commit5774be46fe5dc7e877fa50ef709a16f8ed621c2f (patch)
tree392b783c6bb41bf467b6fcfe27daff4416fac2a7 /gtk2_ardour/add_route_dialog.cc
parentbd92e290c09665c1813c670e33432c36a967777f (diff)
Remember the route count when route lua template sets it by "how_many"
If the user has an audio interface with 32 inputs, there is the danger, that they click through the route template list and hit "Generic Audio Track" which then sets the number of routes to be added to 32. When they click back to e.g. "Audio Tracks" this number remains at 32. So they will accidentally add 32 audio tracks although they wanted just one. Somewhat inconvenient. By this commit we remember the number of routes to be added, when it is set by a lua template and thus can set it back when the user clicks back on a route type that does not set it.
Diffstat (limited to 'gtk2_ardour/add_route_dialog.cc')
-rw-r--r--gtk2_ardour/add_route_dialog.cc18
1 files changed, 15 insertions, 3 deletions
diff --git a/gtk2_ardour/add_route_dialog.cc b/gtk2_ardour/add_route_dialog.cc
index 090a14676e..9ab829e366 100644
--- a/gtk2_ardour/add_route_dialog.cc
+++ b/gtk2_ardour/add_route_dialog.cc
@@ -80,6 +80,8 @@ AddRouteDialog::AddRouteDialog ()
, strict_io_label (_("Pin Mode:"))
, mode_label (_("Record Mode:"))
, instrument_label (_("Instrument:"))
+ , last_route_count (1)
+ , route_count_set_by_template (false)
, name_edited_by_user (false)
{
set_name ("AddRouteDialog");
@@ -380,6 +382,8 @@ AddRouteDialog::trk_template_row_selected ()
const string n = (*iter)[track_template_columns.name];
const string p = (*iter)[track_template_columns.path];
+ bool route_count_now_set_by_template = false;
+
if (p.substr (0, 11) == "urn:ardour:") {
/* lua script - meta-template */
const std::map<std::string, std::string> rs (ARDOUR_UI::instance()->route_setup_info (p.substr (11)));
@@ -420,10 +424,13 @@ AddRouteDialog::trk_template_row_selected ()
name_template_entry.set_text ("");
}
- if ((it = rs.find ("how_many")) != rs.end()) {
- if (atoi (it->second.c_str()) > 0) {
- routes_adjustment.set_value (atoi (it->second.c_str()));
+ if ((it = rs.find ("how_many")) != rs.end() && atoi (it->second.c_str()) > 0) {
+ if (!route_count_set_by_template) {
+ last_route_count = routes_adjustment.get_value();
}
+ routes_adjustment.set_value (atoi (it->second.c_str()));
+ route_count_now_set_by_template = true;
+ route_count_set_by_template = true;
}
if ((it = rs.find ("track_mode")) != rs.end()) {
@@ -489,6 +496,11 @@ AddRouteDialog::trk_template_row_selected ()
name_template_entry.set_sensitive (true);
track_type_chosen ();
}
+
+ if (!route_count_now_set_by_template && route_count_set_by_template) {
+ routes_adjustment.set_value (last_route_count);
+ route_count_set_by_template = false;
+ }
}