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)); @@ -206,6 +209,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 () { @@ -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 channel_combo_strings; static std::vector 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__ */