+
+void
+Editor::video_pullup_chosen (Session::PullupFormat pullup)
+{
+ /* this is driven by a toggle on a radio group, and so is invoked twice,
+ once for the item that became inactive and once for the one that became
+ active.
+ */
+
+ const char* action = 0;
+
+ RefPtr<Action> act;
+
+ float pull = 0.0;
+
+ switch (pullup) {
+ case Session::pullup_Plus4Plus1:
+ pull = 4.1667 + 0.1;
+ action = X_("PullupPlus4Plus1");
+ break;
+ case Session::pullup_Plus4:
+ pull = 4.1667;
+ action = X_("PullupPlus4");
+ break;
+ case Session::pullup_Plus4Minus1:
+ pull = 4.1667 - 0.1;
+ action = X_("PullupPlus4Minus1");
+ break;
+ case Session::pullup_Plus1:
+ pull = 0.1;
+ action = X_("PullupPlus1");
+ break;
+ case Session::pullup_None:
+ pull = 0.0;
+ action = X_("PullupNone");
+ break;
+ case Session::pullup_Minus1:
+ pull = -0.1;
+ action = X_("PullupMinus1");
+ break;
+ case Session::pullup_Minus4Plus1:
+ pull = -4.1667 + 0.1;
+ action = X_("PullupMinus4Plus1");
+ break;
+ case Session::pullup_Minus4:
+ pull = -4.1667;
+ action = X_("PullupMinus4");
+ break;
+ case Session::pullup_Minus4Minus1:
+ pull = -4.1667 - 0.1;
+ action = X_("PullupMinus4Minus1");
+ break;
+ default:
+ fatal << string_compose (_("programming error: %1"), "Session received unexpected pullup type") << endmsg;
+ /*NOTREACHED*/
+ }
+
+ act = ActionManager::get_action (X_("Editor"), action);
+
+ if (act) {
+ RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
+ if (ract && ract->get_active()) {
+ Config->set_video_pullup ( pull );
+ }
+
+ } else {
+ error << string_compose (_("programming error: %1"), "Editor::video_pullup_chosen could not find action to match pullup.") << endmsg;
+ }
+}
+
+void
+Editor::update_subframes_per_frame ()
+{
+ ENSURE_GUI_THREAD (mem_fun(*this, &Editor::update_subframes_per_frame));
+
+ RefPtr<Action> act;
+ const char* action = 0;
+
+ uint32_t sfpf = Config->get_subframes_per_frame();
+
+ if (sfpf == 80) {
+ action = X_("Subframes80");
+ } else if (sfpf == 100) {
+ action = X_("Subframes100");
+ } else {
+ warning << string_compose (_("Configuraton is using unhandled subframes per frame value: %1"), sfpf) << endmsg;
+ /*NOTREACHED*/
+ return;
+ }
+
+ act = ActionManager::get_action (X_("Editor"), action);
+
+ if (act) {
+ RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
+ if (ract && !ract->get_active()) {
+ ract->set_active (true);
+ }
+ }
+}
+
+void
+Editor::subframes_per_frame_chosen (uint32_t sfpf)
+{
+ /* this is driven by a toggle on a radio group, and so is invoked twice,
+ once for the item that became inactive and once for the one that became
+ active.
+ */
+
+ const char* action = 0;
+
+ RefPtr<Action> act;
+
+ if (sfpf == 80) {
+ action = X_("Subframes80");
+ } else if (sfpf == 100) {
+ action = X_("Subframes100");
+ } else {
+ fatal << string_compose (_("programming error: %1 %2"), "Session received unexpected subframes per frame value: ", sfpf) << endmsg;
+ /*NOTREACHED*/
+ }
+
+ act = ActionManager::get_action (X_("Editor"), action);
+
+ if (act) {
+ RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
+ if (ract && ract->get_active()) {
+ Config->set_subframes_per_frame ((uint32_t) rint (sfpf));
+ }
+
+ } else {
+ error << string_compose (_("programming error: %1"), "Editor::subframes_per_frame_chosen could not find action to match value.") << endmsg;
+ }
+}
+
+void
+Editor::toggle_auto_xfade ()
+{
+ ActionManager::toggle_config_state ("Editor", "toggle-auto-xfades", &Configuration::set_auto_xfade, &Configuration::get_auto_xfade);
+}
+
+void
+Editor::toggle_xfades_active ()
+{
+ ActionManager::toggle_config_state ("Editor", "toggle-xfades-active", &Configuration::set_xfades_active, &Configuration::get_xfades_active);
+}
+
+void
+Editor::toggle_xfade_visibility ()
+{
+ ActionManager::toggle_config_state ("Editor", "toggle-xfades-visible", &Configuration::set_xfades_visible, &Configuration::get_xfades_visible);
+}
+
+void
+Editor::toggle_link_region_and_track_selection ()
+{
+ ActionManager::toggle_config_state ("Editor", "link-region-and-track-selection", &Configuration::set_link_region_and_track_selection, &Configuration::get_link_region_and_track_selection);
+}
+
+/** A Configuration parameter has changed.
+ * @param parameter_name Name of the changed parameter.
+ */
+void
+Editor::parameter_changed (const char* parameter_name)
+{
+#define PARAM_IS(x) (!strcmp (parameter_name, (x)))
+ //cerr << "Editor::parameter_changed: " << parameter_name << endl;
+ ENSURE_GUI_THREAD (bind (mem_fun (*this, &Editor::parameter_changed), parameter_name));
+
+ if (PARAM_IS ("auto-loop")) {
+ update_loop_range_view (true);
+ } else if (PARAM_IS ("punch-in")) {
+ update_punch_range_view (true);
+ } else if (PARAM_IS ("punch-out")) {
+ update_punch_range_view (true);
+ } else if (PARAM_IS ("layer-model")) {
+ update_layering_model ();
+ } else if (PARAM_IS ("smpte-format")) {
+ update_smpte_mode ();
+ update_just_smpte ();
+ } else if (PARAM_IS ("video-pullup")) {
+ update_video_pullup ();
+ } else if (PARAM_IS ("xfades-active")) {
+ 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_model ();
+ } else if (PARAM_IS ("edit-mode")) {
+ edit_mode_selector.set_active_text (edit_mode_to_string (Config->get_edit_mode()));
+ } else if (PARAM_IS ("subframes-per-frame")) {
+ update_subframes_per_frame ();
+ update_just_smpte ();
+ } else if (PARAM_IS ("show-track-meters")) {
+ toggle_meter_updating();
+ } else if (PARAM_IS ("link-region-and-track-selection")) {
+ ActionManager::map_some_state ("Editor", "link-region-and-track-selection", &Configuration::get_link_region_and_track_selection);
+ }
+
+#undef PARAM_IS
+}
+
+void
+Editor::reset_focus ()
+{
+ track_canvas.grab_focus();
+}