#include "rgb_macros.h"
#include "route_time_axis.h"
#include "route_ui.h"
+#include "save_template_dialog.h"
#include "timers.h"
#include "ui_config.h"
#include "utils.h"
if (is_track()) {
track()->FreezeChange.connect (*this, invalidator (*this), boost::bind (&RouteUI::map_frozen, this), gui_context());
-#ifdef XXX_OLD_DESTRUCTIVE_API_XXX
- track()->TrackModeChanged.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::track_mode_changed, this), gui_context());
-#endif
track_mode_changed();
}
_mute_release = 0;
}
- _route->mute_control()->stop_touch (false, _session->audible_frame ());
+ _route->mute_control()->stop_touch (_session->audible_frame ());
return false;
}
LatencyDialog dialog (_route->name() + _(" latency"), *(_route->output()), _session->frame_rate(), AudioEngine::instance()->samples_per_cycle());
}
-bool
-RouteUI::process_save_template_prompter (Prompter& prompter, const std::string& dir)
-{
- std::string path;
- std::string safe_name;
- std::string name;
-
- prompter.get_result (name, true);
-
- safe_name = legalize_for_path (name);
- safe_name += template_suffix;
- path = Glib::build_filename (dir, safe_name);
+void
+RouteUI::save_as_template_dialog_response (int response, SaveTemplateDialog* d)
+{
+ if (response == RESPONSE_ACCEPT) {
+ const string name = d->get_template_name ();
+ const string desc = d->get_description ();
+ const string path = Glib::build_filename(ARDOUR::user_route_template_directory (), name);
- if (Glib::file_test (path, Glib::FILE_TEST_EXISTS)) {
- bool overwrite = overwrite_file_dialog (prompter,
- _("Confirm Template Overwrite"),
- _("A template already exists with that name. Do you want to overwrite it?"));
+ if (Glib::file_test (path, Glib::FILE_TEST_EXISTS)) { /* file already exists. */
+ bool overwrite = overwrite_file_dialog (*d,
+ _("Confirm Template Overwrite"),
+ _("A template already exists with that name. Do you want to overwrite it?"));
- if (!overwrite) {
- return false;
+ if (!overwrite) {
+ d->show ();
+ return;
+ }
}
+ _route->save_as_template (path, name, desc);
}
- _route->save_as_template (path, name);
-
- return true;
+ delete d;
}
void
RouteUI::save_as_template ()
{
- std::string dir;
-
- dir = ARDOUR::user_route_template_directory ();
+ const std::string dir = ARDOUR::user_route_template_directory ();
if (g_mkdir_with_parents (dir.c_str(), 0755)) {
error << string_compose (_("Cannot create route template directory %1"), dir) << endmsg;
return;
}
- Prompter prompter (true); // modal
-
- prompter.set_title (_("Save As Template"));
- prompter.set_prompt (_("Template name:"));
- prompter.add_button (Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
-
- bool finished = false;
- while (!finished) {
- switch (prompter.run()) {
- case RESPONSE_ACCEPT:
- finished = process_save_template_prompter (prompter, dir);
- break;
- default:
- finished = true;
- break;
- }
- }
+ SaveTemplateDialog* d = new SaveTemplateDialog (_route->name(), _route->comment());
+ d->signal_response().connect (sigc::bind (sigc::mem_fun (*this, &RouteUI::save_as_template_dialog_response), d));
+ d->show ();
}
void
{
return _route;
}
-