#include <gtkmm2ext/doi.h>
#include <gtkmm2ext/bindable_button.h>
#include <gtkmm2ext/gtk_ui.h>
+#include <gtkmm2ext/prompter.h>
#include <ardour/route_group.h>
#include <pbd/memento_command.h>
#include <ardour/audio_track.h>
#include <ardour/audio_diskstream.h>
#include <ardour/profile.h>
+#include <ardour/utils.h>
#include "i18n.h"
using namespace sigc;
void
RouteUI::init ()
{
+ self_destruct = true;
xml_node = 0;
mute_menu = 0;
solo_menu = 0;
up when the route is destroyed.
*/
- new PairedShiva<Route,RouteUI> (*_route, *this);
+ if (self_destruct) {
+ new PairedShiva<Route,RouteUI> (*_route, *this);
+ }
mute_button->set_controllable (&_route->mute_control());
mute_button->set_label (m_name);
RouteUI::~RouteUI()
{
- GoingAway (); /* EMIT SIGNAL */
+ /* derived classes should emit GoingAway so that they receive the signal
+ when the object is still a legal derived instance.
+ */
if (solo_menu) {
delete solo_menu;
}
}
+void
+RouteUI::save_as_template ()
+{
+ Glib::ustring path;
+ Glib::ustring safe_name;
+ std::string name;
+
+ path = Session::route_template_dir();
+
+ if (g_mkdir_with_parents (path.c_str(), 0755)) {
+ error << string_compose (_("Cannot create route template directory %1"), path) << endmsg;
+ return;
+ }
+
+ Prompter p (true); // modal
+
+ p.set_prompt (_("Template name:"));
+ switch (p.run()) {
+ case RESPONSE_ACCEPT:
+ break;
+ default:
+ return;
+ }
+
+ p.hide ();
+ p.get_result (name, true);
+
+ safe_name = legalize_for_path (name);
+ safe_name += Session::template_suffix ();
+
+ path = Glib::build_filename (path, safe_name);
+
+ _route->save_as_template (path, name);
+}
+