summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtk2_ardour/ardour.menus.in1
-rw-r--r--gtk2_ardour/ardour_ui.cc30
-rw-r--r--gtk2_ardour/ardour_ui.h6
-rw-r--r--gtk2_ardour/ardour_ui_ed.cc8
-rw-r--r--libs/ardour/ardour/session.h2
-rw-r--r--libs/ardour/session_state.cc4
6 files changed, 31 insertions, 20 deletions
diff --git a/gtk2_ardour/ardour.menus.in b/gtk2_ardour/ardour.menus.in
index 8aada68ce9..c4d8d4fbb7 100644
--- a/gtk2_ardour/ardour.menus.in
+++ b/gtk2_ardour/ardour.menus.in
@@ -8,6 +8,7 @@
<menuitem action='Close'/>
<separator/>
<menuitem action='Save'/>
+ <menuitem action='Save As'/>
<menuitem action='Snapshot'/>
<menuitem action='SaveTemplate'/>
<separator/>
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc
index f3aff33872..cef6ed33f8 100644
--- a/gtk2_ardour/ardour_ui.cc
+++ b/gtk2_ardour/ardour_ui.cc
@@ -1969,23 +1969,27 @@ ARDOUR_UI::name_io_setup (AudioEngine& engine,
/** Ask the user for the name of a new shapshot and then take it.
*/
void
-ARDOUR_UI::snapshot_session ()
+ARDOUR_UI::snapshot_session (bool switch_to_it)
{
ArdourPrompter prompter (true);
string snapname;
- char timebuf[128];
- time_t n;
- struct tm local_time;
-
- time (&n);
- localtime_r (&n, &local_time);
- strftime (timebuf, sizeof(timebuf), "%FT%T", &local_time);
prompter.set_name ("Prompter");
prompter.add_button (Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
prompter.set_title (_("Take Snapshot"));
prompter.set_prompt (_("Name of New Snapshot"));
- prompter.set_initial_text (timebuf);
+
+ if (!switch_to_it) {
+ char timebuf[128];
+ time_t n;
+ struct tm local_time;
+
+ time (&n);
+ localtime_r (&n, &local_time);
+ strftime (timebuf, sizeof(timebuf), "%FT%T", &local_time);
+
+ prompter.set_initial_text (timebuf);
+ }
again:
switch (prompter.run()) {
@@ -2004,7 +2008,7 @@ ARDOUR_UI::snapshot_session ()
msg.run ();
goto again;
}
- save_state (snapname);
+ save_state (snapname, switch_to_it);
}
break;
@@ -2014,13 +2018,13 @@ ARDOUR_UI::snapshot_session ()
}
void
-ARDOUR_UI::save_state (const string & name)
+ARDOUR_UI::save_state (const string & name, bool switch_to_it)
{
(void) save_state_canfail (name);
}
int
-ARDOUR_UI::save_state_canfail (string name)
+ARDOUR_UI::save_state_canfail (string name, bool switch_to_it)
{
if (session) {
int ret;
@@ -2029,7 +2033,7 @@ ARDOUR_UI::save_state_canfail (string name)
name = session->snap_name();
}
- if ((ret = session->save_state (name)) != 0) {
+ if ((ret = session->save_state (name, false, switch_to_it)) != 0) {
return ret;
}
}
diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h
index 93e4b4bea9..798f1c0804 100644
--- a/gtk2_ardour/ardour_ui.h
+++ b/gtk2_ardour/ardour_ui.h
@@ -151,8 +151,8 @@ class ARDOUR_UI : public Gtkmm2ext::UI
int unload_session (bool hide_stuff = false);
void close_session();
- int save_state_canfail (string state_name = "");
- void save_state (const string & state_name = "");
+ int save_state_canfail (string state_name = "", bool switch_to_it = false);
+ void save_state (const string & state_name = "", bool switch_to_it = false);
static double gain_to_slider_position (ARDOUR::gain_t g);
static ARDOUR::gain_t slider_position_to_gain (double pos);
@@ -589,7 +589,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI
guint32 last_key_press_time;
- void snapshot_session ();
+ void snapshot_session (bool switch_to_it);
Mixer_UI *mixer;
int create_mixer ();
diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc
index 123a78ac45..fc0fddbb8d 100644
--- a/gtk2_ardour/ardour_ui_ed.cc
+++ b/gtk2_ardour/ardour_ui_ed.cc
@@ -134,7 +134,11 @@ ARDOUR_UI::install_actions ()
/* </CMT Additions> */
- act = ActionManager::register_action (main_actions, X_("Snapshot"), _("Snapshot"), mem_fun(*this, &ARDOUR_UI::snapshot_session));
+ act = ActionManager::register_action (main_actions, X_("Snapshot"), _("Snapshot"), bind (mem_fun(*this, &ARDOUR_UI::snapshot_session), false));
+ ActionManager::session_sensitive_actions.push_back (act);
+ ActionManager::write_sensitive_actions.push_back (act);
+
+ act = ActionManager::register_action (main_actions, X_("Save As"), _("Save As"), bind (mem_fun(*this, &ARDOUR_UI::snapshot_session), true));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::write_sensitive_actions.push_back (act);
@@ -226,7 +230,7 @@ ARDOUR_UI::install_actions ()
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (common_actions, X_("AddAudioBus"), _("Add Audio Bus"), bind (mem_fun(*this, &ARDOUR_UI::session_add_audio_bus), 1, 1, 1));
ActionManager::session_sensitive_actions.push_back (act);
- act = ActionManager::register_action (common_actions, X_("Save"), _("Save"), bind (mem_fun(*this, &ARDOUR_UI::save_state), string("")));
+ act = ActionManager::register_action (common_actions, X_("Save"), _("Save"), bind (mem_fun(*this, &ARDOUR_UI::save_state), string(""), false));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::write_sensitive_actions.push_back (act);
act = ActionManager::register_action (common_actions, X_("RemoveLastCapture"), _("Remove Last Capture"), mem_fun(*this, &ARDOUR_UI::remove_last_capture));
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index 7c074c90f6..ad02c1f6f9 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -443,7 +443,7 @@ class Session : public PBD::StatefulDestructible
nframes_t worst_input_latency () const { return _worst_input_latency; }
nframes_t worst_track_latency () const { return _worst_track_latency; }
- int save_state (string snapshot_name, bool pending = false);
+ int save_state (string snapshot_name, bool pending = false, bool switch_to_snapshot = false);
int restore_state (string snapshot_name);
int save_template (string template_name);
int save_history (string snapshot_name = "");
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index 0abe1b652e..efdac5eae3 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -661,7 +661,7 @@ Session::remove_state (string snapshot_name)
}
int
-Session::save_state (string snapshot_name, bool pending)
+Session::save_state (string snapshot_name, bool pending, bool switch_to_snapshot)
{
XMLTree tree;
string xml_path;
@@ -681,6 +681,8 @@ Session::save_state (string snapshot_name, bool pending)
if (snapshot_name.empty()) {
snapshot_name = _current_snapshot_name;
+ } else if (switch_to_snapshot) {
+ _current_snapshot_name = snapshot_name;
}
if (!pending) {