<Option name="use-vst" value="yes"/>
<Option name="use-tranzport" value="yes"/>
<Option name="destructive-xfade-msecs" value="20"/>
+ <Option name="periodic-safety-backups" value="1"/>
+ <Option name="periodic-safety-backup-interval" value="120"/>
</Config>
<extra>
<Keyboard edit-button="3" edit-modifier="4" delete-button="3" delete-modifier="1" snap-modifier="32"/>
delete [] group_name;
}
+/** Examine the state of a Configuration setting and a toggle action, and toggle the Configuration
+ * setting if its state doesn't match the toggle action.
+ * @param group Action group.
+ * @param action Action name.
+ * @param Method to set the state of the Configuration setting.
+ * @param Method to get the state of the Configuration setting.
+ */
void
ActionManager::toggle_config_state (const char* group, const char* action, bool (Configuration::*set)(bool), bool (Configuration::*get)(void) const)
{
}
}
+
+/** Set the state of a ToggleAction using a particular Configuration get() method
+ * @param group Action group.
+ * @param action Action name.
+ * @param get Method to obtain the state that the ToggleAction should have.
+ */
void
ActionManager::map_some_state (const char* group, const char* action, bool (Configuration::*get)() const)
{
<menuitem action='LatchedRecordEnable'/>
<menuitem action='RegionEquivalentsOverlap'/>
<separator/>
+ <menuitem action='PeriodicSafetyBackups'/>
<menuitem action='VerifyRemoveLastCapture'/>
<menuitem action='StopRecordingOnXrun'/>
<menuitem action='StopTransportAtEndOfSession'/>
save_keybindings ();
}
+gint
+ARDOUR_UI::autosave_session ()
+{
+ if (!Config->get_periodic_safety_backups())
+ return 1;
+
+ if (session) {
+ session->maybe_write_autosave();
+ }
+
+ return 1;
+}
+
+void
+ARDOUR_UI::update_autosave ()
+{
+ ENSURE_GUI_THREAD (mem_fun (*this, &ARDOUR_UI::update_autosave));
+
+ if (session->dirty()) {
+ if (_autosave_connection.connected()) {
+ _autosave_connection.disconnect();
+ }
+
+ _autosave_connection = Glib::signal_timeout().connect (mem_fun (*this, &ARDOUR_UI::autosave_session),
+ Config->get_periodic_safety_backup_interval() * 1000);
+
+ } else {
+ if (_autosave_connection.connected()) {
+ _autosave_connection.disconnect();
+ }
+ }
+}
+
void
ARDOUR_UI::startup ()
{
int ask_about_saving_session (const string & why);
int save_the_session;
+ /* periodic safety backup, to be precise */
+ gint autosave_session();
+ void update_autosave();
+ sigc::connection _autosave_connection;
+
void queue_transport_change ();
void map_transport_state ();
int32_t do_engine_start ();
void toggle_StopPluginsWithTransport();
void toggle_DoNotRunPluginsWhileRecording();
void toggle_VerifyRemoveLastCapture();
+ void toggle_PeriodicSafetyBackups();
void toggle_StopRecordingOnXrun();
void toggle_StopTransportAtEndOfSession();
void toggle_GainReduceFastTransport();
solo_alert_button.set_active (session->soloing());
+ /* update autochange callback on dirty state changing */
+
+ session->DirtyChanged.connect (mem_fun(*this, &ARDOUR_UI::update_autosave));
+
/* can't be auditioning here */
primary_clock.set_session (s);
ActionManager::register_toggle_action (option_actions, X_("StopPluginsWithTransport"), _("Stop plugins with transport"), mem_fun (*this, &ARDOUR_UI::toggle_StopPluginsWithTransport));
ActionManager::register_toggle_action (option_actions, X_("VerifyRemoveLastCapture"), _("Verify remove last capture"), mem_fun (*this, &ARDOUR_UI::toggle_VerifyRemoveLastCapture));
+ ActionManager::register_toggle_action (option_actions, X_("PeriodicSafetyBackups"), _("Make periodic safety backups"), mem_fun (*this, &ARDOUR_UI::toggle_PeriodicSafetyBackups));
ActionManager::register_toggle_action (option_actions, X_("StopRecordingOnXrun"), _("Stop recording on xrun"), mem_fun (*this, &ARDOUR_UI::toggle_StopRecordingOnXrun));
ActionManager::register_toggle_action (option_actions, X_("StopTransportAtEndOfSession"), _("Stop transport at session end"), mem_fun (*this, &ARDOUR_UI::toggle_StopTransportAtEndOfSession));
ActionManager::register_toggle_action (option_actions, X_("GainReduceFastTransport"), _("-12dB gain reduce ffwd/rewind"), mem_fun (*this, &ARDOUR_UI::toggle_GainReduceFastTransport));
ActionManager::toggle_config_state ("options", "VerifyRemoveLastCapture", &Configuration::set_verify_remove_last_capture, &Configuration::get_verify_remove_last_capture);
}
+void
+ARDOUR_UI::toggle_PeriodicSafetyBackups()
+{
+ ActionManager::toggle_config_state ("options", "PeriodicSafetyBackups", &Configuration::set_periodic_safety_backups, &Configuration::get_periodic_safety_backups);
+}
+
void
ARDOUR_UI::toggle_StopRecordingOnXrun()
{
ActionManager::map_some_state ("options", "LatchedRecordEnable", &Configuration::get_latched_record_enable);
} else if (PARAM_IS ("verify-remove-last-capture")) {
ActionManager::map_some_state ("options", "VerifyRemoveLastCapture", &Configuration::get_verify_remove_last_capture);
+ } else if (PARAM_IS ("periodic-safety-backups")) {
+ ActionManager::map_some_state ("options", "PeriodicSafetyBackups", &Configuration::get_periodic_safety_backups);
} else if (PARAM_IS ("stop-recording-on-xrun")) {
ActionManager::map_some_state ("options", "StopRecordingOnXrun", &Configuration::get_stop_recording_on_xrun);
} else if (PARAM_IS ("stop-at-session-end")) {
map_meter_hold ();
} else if (PARAM_IS ("meter-falloff")) {
map_meter_falloff ();
- } else if (PARAM_IS ("verify-remove-last-capture")) {
- ActionManager::map_some_state ("options", "VerifyRemoveLastCapture", &Configuration::get_verify_remove_last_capture);
} else if (PARAM_IS ("video-pullup") || PARAM_IS ("smpte-format")) {
if (session) {
primary_clock.set (session->audible_frame(), true);
if ((prop = node.property ("follow-playhead"))) {
bool yn = (prop->value() == "yes");
+ set_follow_playhead (yn);
RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-follow-playhead"));
if (act) {
RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
- /* do it twice to force the change */
- tact->set_active (!yn);
- tact->set_active (yn);
+ if (tact->get_active() != yn) {
+ tact->set_active (yn);
+ }
}
}
-
if ((prop = node.property ("region-list-sort-type"))) {
region_list_sort_type = (Editing::RegionListSortType) -1; // force change
reset_region_list_sort_type(str2regionlistsorttype(prop->value()));
void toggle_xfades_active ();
void toggle_xfade_visibility ();
bool xfade_visibility() const { return _xfade_visibility; }
+ void update_xfade_visibility ();
void update_crossfade_model ();
void set_crossfade_model (ARDOUR::CrossfadeModel);
void
Editor::toggle_xfade_visibility ()
{
- ActionManager::toggle_config_state ("Editor", "toggle-xfades-visibility", &Configuration::set_xfades_visible, &Configuration::get_xfades_visible);
+ ActionManager::toggle_config_state ("Editor", "toggle-xfades-visible", &Configuration::set_xfades_visible, &Configuration::get_xfades_visible);
}
+/** A Configuration parameter has changed.
+ * @param parameter_name Name of the changed parameter.
+ */
void
Editor::parameter_changed (const char* parameter_name)
{
ActionManager::map_some_state ("Editor", "toggle-xfades-active", &Configuration::get_xfades_active);
} else if (PARAM_IS ("xfades-visible")) {
ActionManager::map_some_state ("Editor", "toggle-xfades-visible", &Configuration::get_xfades_visible);
+ update_xfade_visibility ();
} else if (PARAM_IS ("auto-xfade")) {
ActionManager::map_some_state ("Editor", "toggle-auto-xfades", &Configuration::get_auto_xfade);
} else if (PARAM_IS ("xfade-model")) {
}
}
+
+/** Update crossfade visibility after its configuration has been changed */
+void
+Editor::update_xfade_visibility ()
+{
+ _xfade_visibility = Config->get_xfades_visible ();
+
+ for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
+ AudioTimeAxisView* v = dynamic_cast<AudioTimeAxisView*>(*i);
+ if (v) {
+ if (_xfade_visibility) {
+ v->show_all_xfades ();
+ } else {
+ v->hide_all_xfades ();
+ }
+ }
+ }
+}
msgid "Verify remove last capture"
msgstr "Bekräfta borttagning av senaste inspelade ljudet"
+#: gtk2_ardour/ardour_ui_ed.cc:405
+msgid "Make periodic safety backups"
+msgstr "Gör periodiska säkerhetskopior"
+
#: ../ardour_ui_ed.cc:411
msgid "Stop recording on xrun"
msgstr "Stanna inspelning vid xrun-förekomst"
order = nth;
_hidden = false;
+ /* height in pixels depends on _order, so update it now we've changed _order */
+ set_height (height_style);
+
effective_height = height;
/* now show children */
CONFIG_VARIABLE (uint32_t, subframes_per_frame, "subframes-per-frame", 100)
CONFIG_VARIABLE (uint32_t, saved_history_depth, "save-history-depth", 100)
CONFIG_VARIABLE (bool, use_overlap_equivalency, "use-overlap-equivalency", false)
+CONFIG_VARIABLE (bool, periodic_safety_backups, "periodic-safety-backups", true)
+CONFIG_VARIABLE (uint32_t, periodic_safety_backup_interval, "periodic-safety-backup-interval", 120)
/* BWAV */
void disable_record (bool rt_context, bool force = false);
void step_back_from_record ();
+ void maybe_write_autosave ();
+
/* Proxy signal for region hidden changes */
sigc::signal<void,boost::shared_ptr<Region> > RegionHiddenChange;
_in = bottom;
_out = top;
- _anchor_point = StartOfIn;
+ _anchor_point = EndOfOut;
if (model == FullCrossfade) {
_position = bottom->first_frame(); // "{"
return 0;
}
+void
+Session::maybe_write_autosave()
+{
+ if (dirty() && record_status() != Recording) {
+ save_state("", true);
+ }
+}
+
void
Session::remove_pending_capture_state ()
{
tmp_path += snapshot_name;
tmp_path += ".tmp";
- cerr << "actually writing state\n";
+ cerr << "actually writing state to " << xml_path << endl;
if (!tree.write (tmp_path)) {
error << string_compose (_("state could not be saved to %1"), tmp_path) << endmsg;