X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Feditor_actions.cc;h=6e0b5f704b3397fe2c6ad0b4928730efb8df0ddf;hb=aa3bb18b173fdd8bc7f9611f3dbe52e36cfe6215;hp=cc45d6b769f9da5386822933560a3fe559f714de;hpb=00afa40d458debc3fc53d25a6c077881678ea53e;p=ardour.git diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index cc45d6b769..6e0b5f704b 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -1,3 +1,22 @@ +/* + Copyright (C) 2000-2007 Paul Davis + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + #include #include "utils.h" @@ -126,7 +145,7 @@ Editor::register_actions () ActionManager::session_sensitive_actions.push_back (act); act = ActionManager::register_action (editor_actions, "jump-backward-to-mark", _("Jump Backward to Mark"), mem_fun(*this, &Editor::jump_backward_to_mark)); ActionManager::session_sensitive_actions.push_back (act); - act = ActionManager::register_action (editor_actions, "add-location-from-playhead", _("Add Location from Playhead"), mem_fun(*this, &Editor::add_location_from_playhead_cursor)); + act = ActionManager::register_action (editor_actions, "add-location-from-playhead", _("Add Mark from Playhead"), mem_fun(*this, &Editor::add_location_from_playhead_cursor)); ActionManager::session_sensitive_actions.push_back (act); act = ActionManager::register_action (editor_actions, "nudge-forward", _("Nudge Forward"), bind (mem_fun(*this, &Editor::nudge_forward), false)); @@ -164,10 +183,12 @@ Editor::register_actions () ActionManager::session_sensitive_actions.push_back (act); act = ActionManager::register_action (editor_actions, "center-edit-cursor", _("Center Edit Cursor"), mem_fun(*this, &Editor::center_edit_cursor)); ActionManager::session_sensitive_actions.push_back (act); - act = ActionManager::register_action (editor_actions, "playhead-forward", _("Playhead Forward"), mem_fun(*this, &Editor::playhead_forward)); + + act = ActionManager::register_action (editor_actions, "scroll-playhead-forward", _("Playhead forward"), bind (mem_fun(*this, &Editor::scroll_playhead), true));; ActionManager::session_sensitive_actions.push_back (act); - act = ActionManager::register_action (editor_actions, "playhead-backward", _("Playhead Backward"), mem_fun(*this, &Editor::playhead_backward)); + act = ActionManager::register_action (editor_actions, "scroll-playhead-backward", _("Playhead Backward"), bind (mem_fun(*this, &Editor::scroll_playhead), false)); ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, "playhead-to-edit", _("Playhead to Edit"), bind (mem_fun(*this, &Editor::cursor_align), true)); ActionManager::session_sensitive_actions.push_back (act); act = ActionManager::register_action (editor_actions, "edit-to-playhead", _("Edit to Playhead"), bind (mem_fun(*this, &Editor::cursor_align), false)); @@ -227,9 +248,9 @@ Editor::register_actions () ActionManager::session_sensitive_actions.push_back (act); act = ActionManager::register_action (editor_actions, "insert-region", _("Insert Region"), mem_fun(*this, &Editor::keyboard_insert_region_list_selection)); ActionManager::session_sensitive_actions.push_back (act); - act = ActionManager::register_action (editor_actions, "reverse-region", _("Reverse Region"), mem_fun(*this, &Editor::reverse_region)); + act = ActionManager::register_action (editor_actions, "reverse-region", _("Reverse Regions"), mem_fun(*this, &Editor::reverse_regions)); ActionManager::session_sensitive_actions.push_back (act); - act = ActionManager::register_action (editor_actions, "normalize-region", _("Normalize Region"), mem_fun(*this, &Editor::normalize_region)); + act = ActionManager::register_action (editor_actions, "normalize-region", _("Normalize Regions"), mem_fun(*this, &Editor::normalize_regions)); ActionManager::session_sensitive_actions.push_back (act); act = ActionManager::register_action (editor_actions, "crop", _("crop"), mem_fun(*this, &Editor::crop_region_to_selection)); ActionManager::session_sensitive_actions.push_back (act); @@ -380,16 +401,16 @@ Editor::register_actions () RadioAction::Group smpte_group; - ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte23976"), _("23.976"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), Session::smpte_23976)); - ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte24"), _("24"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), Session::smpte_24)); - ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte24976"), _("24.976"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), Session::smpte_24976)); - ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte25"), _("25"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), Session::smpte_25)); - ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte2997"), _("29.97"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), Session::smpte_2997)); - ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte2997drop"), _("29.97 drop"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), Session::smpte_2997drop)); - ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte30"), _("30"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), Session::smpte_30)); - ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte30drop"), _("30 drop"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), Session::smpte_30drop)); - ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte5994"), _("59.94"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), Session::smpte_5994)); - ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte60"), _("60"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), Session::smpte_60)); + ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte23976"), _("23.976"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), smpte_23976)); + ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte24"), _("24"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), smpte_24)); + ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte24976"), _("24.976"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), smpte_24976)); + ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte25"), _("25"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), smpte_25)); + ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte2997"), _("29.97"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), smpte_2997)); + ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte2997drop"), _("29.97 drop"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), smpte_2997drop)); + ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte30"), _("30"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), smpte_30)); + ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte30drop"), _("30 drop"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), smpte_30drop)); + ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte5994"), _("59.94"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), smpte_5994)); + ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte60"), _("60"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), smpte_60)); RadioAction::Group pullup_group; @@ -428,7 +449,7 @@ Editor::toggle_waveform_visibility () void Editor::toggle_waveforms_while_recording () { - Glib::RefPtr act = ActionManager::get_action (X_("Editor"), X_("ToggleWaveformVisibility")); + Glib::RefPtr act = ActionManager::get_action (X_("Editor"), X_("ToggleWaveformsWhileRecording")); if (act) { Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); set_show_waveforms_recording (tact->get_active()); @@ -502,33 +523,37 @@ Editor::update_smpte_mode () RefPtr act; const char* action = 0; - float frames = Config->get_smpte_frames_per_second(); - bool drop = Config->get_smpte_drop_frames(); - - if ((frames < 23.976 * 1.0005) && !drop) + switch (Config->get_smpte_format()) { + case smpte_23976: action = X_("Smpte23976"); - else if ((frames < 24 * 1.0005) && !drop) + break; + case smpte_24: action = X_("Smpte24"); - else if ((frames < 24.976 * 1.0005) && !drop) + break; + case smpte_24976: action = X_("Smpte24976"); - else if ((frames < 25 * 1.0005) && !drop) + break; + case smpte_25: action = X_("Smpte25"); - else if ((frames < 29.97 * 1.0005) && !drop) + break; + case smpte_2997: action = X_("Smpte2997"); - else if ((frames < 29.97 * 1.0005) && drop) + break; + case smpte_2997drop: action = X_("Smpte2997drop"); - else if ((frames < 30 * 1.0005) && !drop) + break; + case smpte_30: action = X_("Smpte30"); - else if ((frames < 30 * 1.0005) && drop) + break; + case smpte_30drop: action = X_("Smpte30drop"); - else if ((frames < 59.94 * 1.0005) && !drop) + break; + case smpte_5994: action = X_("Smpte5994"); - else if ((frames < 60 * 1.0005) && !drop) + break; + case smpte_60: action = X_("Smpte60"); - else { - fatal << string_compose (_("programming error: Unexpected SMPTE value (%1, drop = %2) in update_smpte_mode. Menu is probably wrong."), - frames, drop) << endmsg; - /*NOTREACHED*/ + break; } act = ActionManager::get_action (X_("Editor"), action); @@ -837,7 +862,7 @@ Editor::zoom_focus_chosen (ZoomFocus focus) } void -Editor::smpte_fps_chosen (Session::SmpteFormat format) +Editor::smpte_fps_chosen (SmpteFormat format) { /* 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 @@ -846,62 +871,39 @@ Editor::smpte_fps_chosen (Session::SmpteFormat format) if (session) { - float fps = 10; - bool drop = false; - RefPtr act; switch (format) { - case Session::smpte_23976: { - fps=23.976; - drop = false; + case smpte_23976: act = ActionManager::get_action (X_("Editor"), X_("Smpte23976")); - } break; - case Session::smpte_24: { - fps=24; - drop = false; + break; + case smpte_24: act = ActionManager::get_action (X_("Editor"), X_("Smpte24")); - } break; - case Session::smpte_24976: { - fps=24.976; - drop = false; + break; + case smpte_24976: act = ActionManager::get_action (X_("Editor"), X_("Smpte24976")); - } break; - case Session::smpte_25: { - fps=25; - drop = false; + break; + case smpte_25: act = ActionManager::get_action (X_("Editor"), X_("Smpte25")); - } break; - case Session::smpte_2997: { - fps=29.97; - drop = false; + break; + case smpte_2997: act = ActionManager::get_action (X_("Editor"), X_("Smpte2997")); - } break; - case Session::smpte_2997drop: { - fps=29.97; - drop = true; + break; + case smpte_2997drop: act = ActionManager::get_action (X_("Editor"), X_("Smpte2997drop")); - } break; - case Session::smpte_30: { - fps=30; - drop = false; + break; + case smpte_30: act = ActionManager::get_action (X_("Editor"), X_("Smpte30")); - } break; - case Session::smpte_30drop: { - fps=30; - drop = true; + break; + case smpte_30drop: act = ActionManager::get_action (X_("Editor"), X_("Smpte30drop")); - } break; - case Session::smpte_5994: { - fps=59.94; - drop = false; + break; + case smpte_5994: act = ActionManager::get_action (X_("Editor"), X_("Smpte5994")); - } break; - case Session::smpte_60: { - fps=60; - drop = false; + break; + case smpte_60: act = ActionManager::get_action (X_("Editor"), X_("Smpte60")); - } break; + break; default: cerr << "Editor received unexpected smpte type" << endl; } @@ -909,7 +911,7 @@ Editor::smpte_fps_chosen (Session::SmpteFormat format) if (act) { RefPtr ract = RefPtr::cast_dynamic(act); if (ract && ract->get_active()) { - session->set_smpte_type (fps, drop); + session->set_smpte_format (format); } } } @@ -1063,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) { @@ -1081,8 +1086,8 @@ Editor::parameter_changed (const char* parameter_name) update_punch_range_view (true); } else if (PARAM_IS ("layer-model")) { update_layering_model (); - } else if (PARAM_IS ("smpte-frames-per-second") || PARAM_IS ("smpte-drop-frames")) { - update_smpte_mode (); + } else if (PARAM_IS ("smpte-format")) { + update_smpte_mode (); update_just_smpte (); } else if (PARAM_IS ("video-pullup")) { update_video_pullup (); @@ -1090,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")) { @@ -1103,3 +1109,9 @@ Editor::parameter_changed (const char* parameter_name) #undef PARAM_IS } + +void +Editor::reset_focus () +{ + track_canvas.grab_focus(); +}