diff options
author | David Robillard <d@drobilla.net> | 2007-04-22 18:01:10 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-04-22 18:01:10 +0000 |
commit | 490e18d80a22dda07bdf88dd440f7100897822de (patch) | |
tree | 21fd0236156d108bd4b7acc119e8c66f3adad492 /gtk2_ardour | |
parent | a9f5e379d27f74a1895a3b9d0fd8ef98c3b22e53 (diff) |
Merged with trunk R1736.
git-svn-id: svn://localhost/ardour2/branches/midi@1737 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/actions.cc | 13 | ||||
-rw-r--r-- | gtk2_ardour/ardour.menus | 1 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui.cc | 33 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui.h | 6 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui_dialogs.cc | 4 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui_ed.cc | 1 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui_options.cc | 10 | ||||
-rw-r--r-- | gtk2_ardour/editor.cc | 8 | ||||
-rw-r--r-- | gtk2_ardour/editor.h | 1 | ||||
-rw-r--r-- | gtk2_ardour/editor_actions.cc | 6 | ||||
-rw-r--r-- | gtk2_ardour/editor_ops.cc | 18 | ||||
-rw-r--r-- | gtk2_ardour/po/sv_SE.po | 4 | ||||
-rw-r--r-- | gtk2_ardour/time_axis_view.cc | 3 |
13 files changed, 101 insertions, 7 deletions
diff --git a/gtk2_ardour/actions.cc b/gtk2_ardour/actions.cc index 6e4a525ba7..40af880f9c 100644 --- a/gtk2_ardour/actions.cc +++ b/gtk2_ardour/actions.cc @@ -256,6 +256,13 @@ ActionManager::uncheck_toggleaction (const char * name) 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) { @@ -285,6 +292,12 @@ ActionManager::toggle_config_state (const char* group, const char* action, sigc: } } + +/** 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) { diff --git a/gtk2_ardour/ardour.menus b/gtk2_ardour/ardour.menus index c01195f4f4..635def7794 100644 --- a/gtk2_ardour/ardour.menus +++ b/gtk2_ardour/ardour.menus @@ -348,6 +348,7 @@ <menuitem action='LatchedRecordEnable'/> <menuitem action='RegionEquivalentsOverlap'/> <separator/> + <menuitem action='PeriodicSafetyBackups'/> <menuitem action='VerifyRemoveLastCapture'/> <menuitem action='StopRecordingOnXrun'/> <menuitem action='StopTransportAtEndOfSession'/> diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index adea076f7f..e990f5ce20 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -432,6 +432,39 @@ ARDOUR_UI::save_ardour_state () 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 () { diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 8b1304ef2a..0b5016ea28 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -297,6 +297,11 @@ class ARDOUR_UI : public Gtkmm2ext::UI 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 (); @@ -675,6 +680,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI void toggle_StopPluginsWithTransport(); void toggle_DoNotRunPluginsWhileRecording(); void toggle_VerifyRemoveLastCapture(); + void toggle_PeriodicSafetyBackups(); void toggle_StopRecordingOnXrun(); void toggle_StopTransportAtEndOfSession(); void toggle_GainReduceFastTransport(); diff --git a/gtk2_ardour/ardour_ui_dialogs.cc b/gtk2_ardour/ardour_ui_dialogs.cc index c3b82c74a8..8a50697e85 100644 --- a/gtk2_ardour/ardour_ui_dialogs.cc +++ b/gtk2_ardour/ardour_ui_dialogs.cc @@ -126,6 +126,10 @@ ARDOUR_UI::connect_to_session (Session *s) 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); diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index c889eea0f7..2cf6750812 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -406,6 +406,7 @@ ARDOUR_UI::install_actions () 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)); diff --git a/gtk2_ardour/ardour_ui_options.cc b/gtk2_ardour/ardour_ui_options.cc index 9565c46e40..34431aeafb 100644 --- a/gtk2_ardour/ardour_ui_options.cc +++ b/gtk2_ardour/ardour_ui_options.cc @@ -399,6 +399,12 @@ ARDOUR_UI::toggle_VerifyRemoveLastCapture() } 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::toggle_config_state ("options", "StopRecordingOnXrun", &Configuration::set_stop_recording_on_xrun, &Configuration::get_stop_recording_on_xrun); @@ -891,6 +897,8 @@ ARDOUR_UI::parameter_changed (const char* parameter_name) 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")) { @@ -944,8 +952,6 @@ ARDOUR_UI::parameter_changed (const char* parameter_name) 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); diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 2fc4488fab..8ea8aaf87d 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -2105,16 +2105,16 @@ Editor::set_state (const XMLNode& node) 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())); diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 327a2d2e8e..8748816c31 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -305,6 +305,7 @@ class Editor : public PublicEditor 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); diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index 4ce9be20bd..3525910250 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -1065,9 +1065,12 @@ Editor::toggle_xfades_active () 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) { @@ -1092,6 +1095,7 @@ 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")) { diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index b098815208..917f93243e 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -3535,3 +3535,21 @@ Editor::set_fade_out_active (bool yn) } } + +/** 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 (); + } + } + } +} diff --git a/gtk2_ardour/po/sv_SE.po b/gtk2_ardour/po/sv_SE.po index cc567f3fb9..2bf641b089 100644 --- a/gtk2_ardour/po/sv_SE.po +++ b/gtk2_ardour/po/sv_SE.po @@ -1350,6 +1350,10 @@ msgstr "Stoppa insticksprogram vid stopp" 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" diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc index d46c457fea..1351ef9105 100644 --- a/gtk2_ardour/time_axis_view.cc +++ b/gtk2_ardour/time_axis_view.cc @@ -221,6 +221,9 @@ TimeAxisView::show_at (double y, int& nth, VBox *parent) 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 */ |