diff options
Diffstat (limited to 'gtk2_ardour/editor.cc')
-rw-r--r-- | gtk2_ardour/editor.cc | 100 |
1 files changed, 96 insertions, 4 deletions
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 6b8fc782dc..0729533f76 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -700,6 +700,7 @@ Editor::Editor (AudioEngine& eng) ControlProtocol::ZoomIn.connect (bind (mem_fun (*this, &Editor::temporal_zoom_step), false)); ControlProtocol::ZoomOut.connect (bind (mem_fun (*this, &Editor::temporal_zoom_step), true)); ControlProtocol::ScrollTimeline.connect (mem_fun (*this, &Editor::control_scroll)); + constructed = true; instant_save (); @@ -1025,6 +1026,10 @@ Editor::session_control_changed (Session::ControlType t) update_layering_model (); break; + case Session::SmpteMode: + update_smpte_mode (); + break; + default: break; } @@ -1171,6 +1176,9 @@ Editor::connect_to_session (Session *t) session_connections.push_back (session->SMPTEOffsetChanged.connect (mem_fun(*this, &Editor::update_just_smpte))); session_connections.push_back (session->SMPTETypeChanged.connect (mem_fun(*this, &Editor::update_just_smpte))); + session_connections.push_back (session->SMPTETypeChanged.connect (mem_fun(*this, &Editor::update_smpte_mode))); + session_connections.push_back (session->PullupChanged.connect (mem_fun(*this, &Editor::update_video_pullup))); + session_connections.push_back (session->tempo_map().StateChanged.connect (mem_fun(*this, &Editor::tempo_map_changed))); edit_groups_changed (); @@ -1258,9 +1266,12 @@ Editor::connect_to_session (Session *t) } /* xfade visibility state set from editor::set_state() */ - - update_crossfade_model (); - update_layering_model (); + + update_crossfade_model(); + update_layering_model(); + + update_smpte_mode(); + update_video_pullup(); handle_new_duration (); @@ -4084,6 +4095,7 @@ Editor::restore_editing_space () { mouse_mode_tearoff->set_visible (true); tools_tearoff->set_visible (true); + edit_pane.set_position (pre_maximal_pane_position); unfullscreen(); @@ -4138,6 +4150,87 @@ Editor::on_key_press_event (GdkEventKey* ev) } void +Editor::update_smpte_mode () +{ + ENSURE_GUI_THREAD(mem_fun(*this, &Editor::update_smpte_mode)); + + RefPtr<Action> act; + + float frames = session->smpte_frames_per_second; + bool drop = session->smpte_drop_frames; + + if ((frames < 23.976 * 1.0005) && !drop) + act = ActionManager::get_action (X_("Editor"), X_("Smpte23976")); + else if ((frames < 24 * 1.0005) && !drop) + act = ActionManager::get_action (X_("Editor"), X_("Smpte24")); + else if ((frames < 24.976 * 1.0005) && !drop) + act = ActionManager::get_action (X_("Editor"), X_("Smpte24976")); + else if ((frames < 25 * 1.0005) && !drop) + act = ActionManager::get_action (X_("Editor"), X_("Smpte25")); + else if ((frames < 29.97 * 1.0005) && !drop) + act = ActionManager::get_action (X_("Editor"), X_("Smpte2997")); + else if ((frames < 29.97 * 1.0005) && drop) + act = ActionManager::get_action (X_("Editor"), X_("Smpte2997drop")); + else if ((frames < 30 * 1.0005) && !drop) + act = ActionManager::get_action (X_("Editor"), X_("Smpte30")); + else if ((frames < 30 * 1.0005) && drop) + act = ActionManager::get_action (X_("Editor"), X_("Smpte30drop")); + else if ((frames < 59.94 * 1.0005) && !drop) + act = ActionManager::get_action (X_("Editor"), X_("Smpte5994")); + else if ((frames < 60 * 1.0005) && !drop) + act = ActionManager::get_action (X_("Editor"), X_("Smpte60")); + else + cerr << "Unexpected SMPTE value (" << frames << (drop ? "drop" : "") << ") in update_smpte_mode. Menu is probably wrong\n" << endl; + + + if (act) { + RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act); + if (ract && !ract->get_active()) { + ract->set_active (true); + } + } +} + +void +Editor::update_video_pullup () +{ + ENSURE_GUI_THREAD (mem_fun(*this, &Editor::update_video_pullup)); + + RefPtr<Action> act; + + float pullup = session->video_pullup; + + if ( pullup < (-4.1667 - 0.1) * 0.99) { + act = ActionManager::get_action (X_("Editor"), X_("PullupMinus4Minus1")); + } else if ( pullup < (-4.1667) * 0.99 ) { + act = ActionManager::get_action (X_("Editor"), X_("PullupMinus4")); + } else if ( pullup < (-4.1667 + 0.1) * 0.99 ) { + act = ActionManager::get_action (X_("Editor"), X_("PullupMinus4Plus1")); + } else if ( pullup < (-0.1) * 0.99 ) { + act = ActionManager::get_action (X_("Editor"), X_("PullupMinus1")); + } else if (pullup > (4.1667 + 0.1) * 0.99 ) { + act = ActionManager::get_action (X_("Editor"), X_("PullupPlus4Plus1")); + } else if ( pullup > (4.1667) * 0.99 ) { + act = ActionManager::get_action (X_("Editor"), X_("PullupPlus4")); + } else if ( pullup > (4.1667 - 0.1) * 0.99) { + act = ActionManager::get_action (X_("Editor"), X_("PullupPlus4Minus1")); + } else if ( pullup > (0.1) * 0.99 ) { + act = ActionManager::get_action (X_("Editor"), X_("PullupPlus1")); + } else + act = ActionManager::get_action (X_("Editor"), X_("PullupNone")); + + + if (act) { + RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act); + if (ract && !ract->get_active()) { + ract->set_active (true); + } + } + +} + + +void Editor::update_layering_model () { RefPtr<Action> act; @@ -4162,7 +4255,6 @@ Editor::update_layering_model () } } - void Editor::update_crossfade_model () { |