diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2017-07-17 11:49:00 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2017-07-17 11:57:33 -0400 |
commit | 4f4ed8e1942fa0c4540facbd4271b301b90b29a3 (patch) | |
tree | f745c9bdf76d77da1d34d7e5d6617b0dbc5d7ce5 /gtk2_ardour | |
parent | 2ed15cfc7e22bf78e47a9aee2b0cbd8459beec6c (diff) |
if user has edited name entry in add route dialog, type changes should not reset it.
But using a response button should
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/add_route_dialog.cc | 27 | ||||
-rw-r--r-- | gtk2_ardour/add_route_dialog.h | 9 |
2 files changed, 32 insertions, 4 deletions
diff --git a/gtk2_ardour/add_route_dialog.cc b/gtk2_ardour/add_route_dialog.cc index 8f29044447..718edf3ff6 100644 --- a/gtk2_ardour/add_route_dialog.cc +++ b/gtk2_ardour/add_route_dialog.cc @@ -61,6 +61,7 @@ AddRouteDialog::AddRouteDialog () , configuration_label (_("Configuration:")) , mode_label (_("Record Mode:")) , instrument_label (_("Instrument:")) + , name_edited_by_user (false) { set_name ("AddRouteDialog"); set_skip_taskbar_hint (true); @@ -182,6 +183,8 @@ AddRouteDialog::AddRouteDialog () get_vbox()->pack_start (*vbox, false, false); + name_template_entry.signal_insert_text ().connect (sigc::mem_fun (*this, &AddRouteDialog::name_template_entry_insertion)); + name_template_entry.signal_delete_text ().connect (sigc::mem_fun (*this, &AddRouteDialog::name_template_entry_deletion)); track_bus_combo.signal_changed().connect (sigc::mem_fun (*this, &AddRouteDialog::track_type_chosen)); channel_combo.signal_changed().connect (sigc::mem_fun (*this, &AddRouteDialog::channel_combo_changed)); channel_combo.set_row_separator_func (sigc::mem_fun (*this, &AddRouteDialog::channel_separator)); @@ -207,6 +210,25 @@ AddRouteDialog::~AddRouteDialog () } void +AddRouteDialog::on_response (int r) +{ + name_edited_by_user = false; + ArdourDialog::on_response (r); +} + +void +AddRouteDialog::name_template_entry_insertion (Glib::ustring const &,int*) +{ + name_edited_by_user = true; +} + +void +AddRouteDialog::name_template_entry_deletion (int, int) +{ + name_edited_by_user = true; +} + +void AddRouteDialog::channel_combo_changed () { refill_track_modes (); @@ -234,6 +256,10 @@ AddRouteDialog::type_wanted() const void AddRouteDialog::maybe_update_name_template_entry () { + if (name_edited_by_user) { + return; + } + switch (type_wanted()) { case AudioTrack: name_template_entry.set_text (_("Audio")); @@ -459,6 +485,7 @@ void AddRouteDialog::on_show () { routes_spinner.grab_focus (); + name_edited_by_user = false; refill_channel_setups (); refill_route_groups (); diff --git a/gtk2_ardour/add_route_dialog.h b/gtk2_ardour/add_route_dialog.h index cb6ed66812..718df8842d 100644 --- a/gtk2_ardour/add_route_dialog.h +++ b/gtk2_ardour/add_route_dialog.h @@ -80,10 +80,6 @@ public: RouteDialogs::InsertAt insert_at(); bool use_strict_io(); - void on_response (int response_id) { - Gtk::Dialog::on_response (response_id); - } - private: Gtk::Entry name_template_entry; Gtk::ComboBoxText track_bus_combo; @@ -115,6 +111,7 @@ private: void reset_template_option_visibility (); void new_group_dialog_finished (int, RouteGroupDialog*); void on_show (); + void on_response (int); struct ChannelSetup { std::string name; @@ -127,6 +124,10 @@ private: static std::vector<std::string> channel_combo_strings; static std::vector<std::string> bus_mode_strings; + + bool name_edited_by_user; + void name_template_entry_insertion (Glib::ustring const &,int*); + void name_template_entry_deletion (int, int); }; #endif /* __gtk_ardour_add_route_dialog_h__ */ |