X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Feditor_actions.cc;h=00ea296e61cce8544c882821c0269a3934739109;hb=c5fd217a4acc83fe3b52824cdc809d0de093f941;hp=2898ea966be4d65a9940067a1a67a85f8d086228;hpb=1362ac2046bae75bd26edae7d6c5f9c94c74b6bf;p=ardour.git diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index 2898ea966b..00ea296e61 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -20,11 +20,16 @@ #include #include +#include "pbd/filesystem.h" +#include "pbd/file_utils.h" +#include "pbd/search_path.h" + #include "gtkmm2ext/tearoff.h" -#include "ardour/ardour.h" +#include "ardour/filesystem_paths.h" #include "ardour/profile.h" #include "ardour/session.h" +#include "ardour/types.h" #include "actions.h" #include "ardour_ui.h" @@ -76,63 +81,66 @@ Editor::register_actions () RefPtr act; editor_actions = ActionGroup::create (X_("Editor")); + editor_menu_actions = ActionGroup::create (X_("EditorMenu")); /* non-operative menu items for menu bar */ - ActionManager::register_action (editor_actions, X_("AlignMenu"), _("Align")); - ActionManager::register_action (editor_actions, X_("Autoconnect"), _("Autoconnect")); - ActionManager::register_action (editor_actions, X_("Crossfades"), _("Crossfades")); - ActionManager::register_action (editor_actions, X_("Edit"), _("Edit")); - ActionManager::register_action (editor_actions, X_("EditCursorMovementOptions"), _("Move Selected Marker")); - ActionManager::register_action (editor_actions, X_("EditSelectRangeOptions"), _("Select Range Operations")); - ActionManager::register_action (editor_actions, X_("EditSelectRegionOptions"), _("Select Regions")); - ActionManager::register_action (editor_actions, X_("EditPointMenu"), _("Edit Point")); - ActionManager::register_action (editor_actions, X_("FadeMenu"), _("Fade")); - ActionManager::register_action (editor_actions, X_("LatchMenu"), _("Latch")); - ActionManager::register_action (editor_actions, X_("RegionMenu"), _("Region")); - ActionManager::register_action (editor_actions, X_("RegionMenuLayering"), _("Layering")); - ActionManager::register_action (editor_actions, X_("RegionMenuNudge"), _("Nudge")); - ActionManager::register_action (editor_actions, X_("RegionMenuTrim"), _("Trim")); - ActionManager::register_action (editor_actions, X_("RegionMenuGain"), _("Gain")); - ActionManager::register_action (editor_actions, X_("RegionMenuRanges"), _("Ranges")); - ActionManager::register_action (editor_actions, X_("RegionMenuFades"), _("Fades")); - ActionManager::register_action (editor_actions, X_("RegionMenuMIDI"), _("MIDI")); - ActionManager::register_action (editor_actions, X_("RegionMenuDuplicate"), _("Duplicate")); - ActionManager::register_action (editor_actions, X_("Link"), _("Link")); - ActionManager::register_action (editor_actions, X_("ZoomFocusMenu"), _("Zoom Focus")); - ActionManager::register_action (editor_actions, X_("LocateToMarker"), _("Locate to Markers")); - ActionManager::register_action (editor_actions, X_("MarkerMenu"), _("Markers")); - ActionManager::register_action (editor_actions, X_("MeterFalloff"), _("Meter falloff")); - ActionManager::register_action (editor_actions, X_("MeterHold"), _("Meter hold")); - ActionManager::register_action (editor_actions, X_("MiscOptions"), _("Misc Options")); - ActionManager::register_action (editor_actions, X_("Monitoring"), _("Monitoring")); - ActionManager::register_action (editor_actions, X_("MoveActiveMarkMenu"), _("Active Mark")); - ActionManager::register_action (editor_actions, X_("MovePlayHeadMenu"), _("Playhead")); - ActionManager::register_action (editor_actions, X_("PlayMenu"), _("Play")); - ActionManager::register_action (editor_actions, X_("PrimaryClockMenu"), _("Primary Clock")); - ActionManager::register_action (editor_actions, X_("Pullup"), _("Pullup / Pulldown")); - ActionManager::register_action (editor_actions, X_("RegionEditOps"), _("Region operations")); - ActionManager::register_action (editor_actions, X_("RegionGainMenu"), _("Gain")); - ActionManager::register_action (editor_actions, X_("RulerMenu"), _("Rulers")); - ActionManager::register_action (editor_actions, X_("SavedViewMenu"), _("Views")); - ActionManager::register_action (editor_actions, X_("ScrollMenu"), _("Scroll")); - ActionManager::register_action (editor_actions, X_("SecondaryClockMenu"), _("Secondary Clock")); - ActionManager::register_action (editor_actions, X_("Select"), _("Select")); - ActionManager::register_action (editor_actions, X_("SelectMenu"), _("Select")); - ActionManager::register_action (editor_actions, X_("SeparateMenu"), _("Separate")); - ActionManager::register_action (editor_actions, X_("SetLoopMenu"), _("Loop")); - ActionManager::register_action (editor_actions, X_("SetPunchMenu"), _("Punch")); - ActionManager::register_action (editor_actions, X_("Solo"), _("Solo")); - ActionManager::register_action (editor_actions, X_("Subframes"), _("Subframes")); - ActionManager::register_action (editor_actions, X_("SyncMenu"), _("Sync")); - ActionManager::register_action (editor_actions, X_("TempoMenu"), _("Tempo")); - ActionManager::register_action (editor_actions, X_("Timecode"), _("Timecode fps")); - ActionManager::register_action (editor_actions, X_("TrackHeightMenu"), _("Height")); - ActionManager::register_action (editor_actions, X_("TrackMenu"), _("Track")); - ActionManager::register_action (editor_actions, X_("Tools"), _("Tools")); - ActionManager::register_action (editor_actions, X_("View"), _("View")); - ActionManager::register_action (editor_actions, X_("ZoomFocus"), _("Zoom Focus")); - ActionManager::register_action (editor_actions, X_("ZoomMenu"), _("Zoom")); + ActionManager::register_action (editor_menu_actions, X_("AlignMenu"), _("Align")); + ActionManager::register_action (editor_menu_actions, X_("Autoconnect"), _("Autoconnect")); + ActionManager::register_action (editor_menu_actions, X_("Crossfades"), _("Crossfades")); + ActionManager::register_action (editor_menu_actions, X_("Edit"), _("Edit")); + ActionManager::register_action (editor_menu_actions, X_("EditCursorMovementOptions"), _("Move Selected Marker")); + ActionManager::register_action (editor_menu_actions, X_("EditSelectRangeOptions"), _("Select Range Operations")); + ActionManager::register_action (editor_menu_actions, X_("EditSelectRegionOptions"), _("Select Regions")); + ActionManager::register_action (editor_menu_actions, X_("EditPointMenu"), _("Edit Point")); + ActionManager::register_action (editor_menu_actions, X_("FadeMenu"), _("Fade")); + ActionManager::register_action (editor_menu_actions, X_("LatchMenu"), _("Latch")); + ActionManager::register_action (editor_menu_actions, X_("RegionMenu"), _("Region")); + ActionManager::register_action (editor_menu_actions, X_("RegionMenuLayering"), _("Layering")); + ActionManager::register_action (editor_menu_actions, X_("RegionMenuPosition"), _("Position")); + ActionManager::register_action (editor_menu_actions, X_("RegionMenuEdit"), _("Edit")); + ActionManager::register_action (editor_menu_actions, X_("RegionMenuTrim"), _("Trim")); + ActionManager::register_action (editor_menu_actions, X_("RegionMenuGain"), _("Gain")); + ActionManager::register_action (editor_menu_actions, X_("RegionMenuRanges"), _("Ranges")); + ActionManager::register_action (editor_menu_actions, X_("RegionMenuFades"), _("Fades")); + ActionManager::register_action (editor_menu_actions, X_("RegionMenuMIDI"), _("MIDI")); + ActionManager::register_action (editor_menu_actions, X_("RegionMenuDuplicate"), _("Duplicate")); + ActionManager::register_action (editor_menu_actions, X_("Link"), _("Link")); + ActionManager::register_action (editor_menu_actions, X_("ZoomFocusMenu"), _("Zoom Focus")); + ActionManager::register_action (editor_menu_actions, X_("LocateToMarker"), _("Locate to Markers")); + ActionManager::register_action (editor_menu_actions, X_("MarkerMenu"), _("Markers")); + ActionManager::register_action (editor_menu_actions, X_("MeterFalloff"), _("Meter falloff")); + ActionManager::register_action (editor_menu_actions, X_("MeterHold"), _("Meter hold")); + ActionManager::register_action (editor_menu_actions, X_("MIDI"), _("MIDI Options")); + ActionManager::register_action (editor_menu_actions, X_("MiscOptions"), _("Misc Options")); + ActionManager::register_action (editor_menu_actions, X_("Monitoring"), _("Monitoring")); + ActionManager::register_action (editor_menu_actions, X_("MoveActiveMarkMenu"), _("Active Mark")); + ActionManager::register_action (editor_menu_actions, X_("MovePlayHeadMenu"), _("Playhead")); + ActionManager::register_action (editor_menu_actions, X_("PlayMenu"), _("Play")); + ActionManager::register_action (editor_menu_actions, X_("PrimaryClockMenu"), _("Primary Clock")); + ActionManager::register_action (editor_menu_actions, X_("Pullup"), _("Pullup / Pulldown")); + ActionManager::register_action (editor_menu_actions, X_("RegionEditOps"), _("Region operations")); + ActionManager::register_action (editor_menu_actions, X_("RegionGainMenu"), _("Gain")); + ActionManager::register_action (editor_menu_actions, X_("RulerMenu"), _("Rulers")); + ActionManager::register_action (editor_menu_actions, X_("SavedViewMenu"), _("Views")); + ActionManager::register_action (editor_menu_actions, X_("ScrollMenu"), _("Scroll")); + ActionManager::register_action (editor_menu_actions, X_("SecondaryClockMenu"), _("Secondary Clock")); + ActionManager::register_action (editor_menu_actions, X_("Select"), _("Select")); + ActionManager::register_action (editor_menu_actions, X_("SelectMenu"), _("Select")); + ActionManager::register_action (editor_menu_actions, X_("SeparateMenu"), _("Separate")); + ActionManager::register_action (editor_menu_actions, X_("SetLoopMenu"), _("Loop")); + ActionManager::register_action (editor_menu_actions, X_("SetPunchMenu"), _("Punch")); + ActionManager::register_action (editor_menu_actions, X_("Solo"), _("Solo")); + ActionManager::register_action (editor_menu_actions, X_("Subframes"), _("Subframes")); + ActionManager::register_action (editor_menu_actions, X_("SyncMenu"), _("Sync")); + ActionManager::register_action (editor_menu_actions, X_("TempoMenu"), _("Tempo")); + ActionManager::register_action (editor_menu_actions, X_("Timecode"), _("Timecode fps")); + ActionManager::register_action (editor_menu_actions, X_("TrackHeightMenu"), _("Height")); + ActionManager::register_action (editor_menu_actions, X_("TrackMenu"), _("Track")); + ActionManager::register_action (editor_menu_actions, X_("Tools"), _("Tools")); + ActionManager::register_action (editor_menu_actions, X_("View"), _("View")); + ActionManager::register_action (editor_menu_actions, X_("ZoomFocus"), _("Zoom Focus")); + ActionManager::register_action (editor_menu_actions, X_("ZoomMenu"), _("Zoom")); register_region_actions (); @@ -159,7 +167,7 @@ Editor::register_actions () reg_sens (editor_actions, "selected-marker-to-next-region-boundary", _("To Next Region Boundary"), sigc::bind (sigc::mem_fun(*this, &Editor::selected_marker_to_next_region_boundary), true)); reg_sens (editor_actions, "selected-marker-to-next-region-boundary-noselection", _("To Next Region Boundary (No Track Selection)"), sigc::bind (sigc::mem_fun(*this, &Editor::selected_marker_to_next_region_boundary), false)); reg_sens (editor_actions, "selected-marker-to-previous-region-boundary", _("To Previous Region Boundary"), sigc::bind (sigc::mem_fun(*this, &Editor::selected_marker_to_previous_region_boundary), true)); - reg_sens (editor_actions, "selected-marker-to-previous-region-boundary-noselection", _("to Previous Region Boundary (No Track Selection)"), sigc::bind (sigc::mem_fun(*this, &Editor::selected_marker_to_previous_region_boundary), false)); + reg_sens (editor_actions, "selected-marker-to-previous-region-boundary-noselection", _("To Previous Region Boundary (No Track Selection)"), sigc::bind (sigc::mem_fun(*this, &Editor::selected_marker_to_previous_region_boundary), false)); reg_sens (editor_actions, "edit-cursor-to-next-region-start", _("To Next Region Start"), sigc::bind (sigc::mem_fun(*this, &Editor::selected_marker_to_next_region_point), RegionPoint (Start))); reg_sens (editor_actions, "edit-cursor-to-next-region-end", _("To Next Region End"), sigc::bind (sigc::mem_fun(*this, &Editor::selected_marker_to_next_region_point), RegionPoint (End))); @@ -219,18 +227,17 @@ Editor::register_actions () reg_sens (editor_actions, a.c_str(), n.c_str(), sigc::bind (sigc::mem_fun (*this, &Editor::goto_nth_marker), i - 1)); } - reg_sens (editor_actions, "jump-forward-to-mark", _("Jump Forward to Mark"), sigc::mem_fun(*this, &Editor::jump_forward_to_mark)); - reg_sens (editor_actions, "jump-backward-to-mark", _("Jump Backward to Mark"), sigc::mem_fun(*this, &Editor::jump_backward_to_mark)); + reg_sens (editor_actions, "jump-forward-to-mark", _("Jump to Next Mark"), sigc::mem_fun(*this, &Editor::jump_forward_to_mark)); + reg_sens (editor_actions, "jump-backward-to-mark", _("Jump to Previous Mark"), sigc::mem_fun(*this, &Editor::jump_backward_to_mark)); reg_sens (editor_actions, "add-location-from-playhead", _("Add Mark from Playhead"), sigc::mem_fun(*this, &Editor::add_location_from_playhead_cursor)); - reg_sens (editor_actions, "nudge-next-forward", _("Nudge Next Forward"), sigc::bind (sigc::mem_fun(*this, &Editor::nudge_forward), true, false)); - reg_sens (editor_actions, "nudge-next-backward", _("Nudge Next Backward"), sigc::bind (sigc::mem_fun(*this, &Editor::nudge_backward), true, false)); + reg_sens (editor_actions, "nudge-next-forward", _("Nudge Next Later"), sigc::bind (sigc::mem_fun(*this, &Editor::nudge_forward), true, false)); + reg_sens (editor_actions, "nudge-next-backward", _("Nudge Next Earlier"), sigc::bind (sigc::mem_fun(*this, &Editor::nudge_backward), true, false)); reg_sens (editor_actions, "nudge-playhead-forward", _("Nudge Playhead Forward"), sigc::bind (sigc::mem_fun(*this, &Editor::nudge_forward), false, true)); reg_sens (editor_actions, "nudge-playhead-backward", _("Nudge Playhead Backward"), sigc::bind (sigc::mem_fun(*this, &Editor::nudge_backward), false, true)); - reg_sens (editor_actions, "playhead-forward-to-grid", _("Forward to Grid"), sigc::mem_fun(*this, &Editor::playhead_forward_to_grid)); - reg_sens (editor_actions, "playhead-backward-to-grid", _("Backward to Grid"), sigc::mem_fun(*this, &Editor::playhead_backward_to_grid)); - + reg_sens (editor_actions, "playhead-forward-to-grid", _("Playhead To Next Grid"), sigc::mem_fun(*this, &Editor::playhead_forward_to_grid)); + reg_sens (editor_actions, "playhead-backward-to-grid", _("Playhead To Previous Grid"), sigc::mem_fun(*this, &Editor::playhead_backward_to_grid)); reg_sens (editor_actions, "temporal-zoom-out", _("Zoom Out"), sigc::bind (sigc::mem_fun(*this, &Editor::temporal_zoom_step), true)); reg_sens (editor_actions, "temporal-zoom-in", _("Zoom In"), sigc::bind (sigc::mem_fun(*this, &Editor::temporal_zoom_step), false)); @@ -282,7 +289,7 @@ Editor::register_actions () reg_sens (editor_actions, "duplicate-range", _("Duplicate Range"), sigc::bind (sigc::mem_fun(*this, &Editor::duplicate_dialog), false)); - undo_action = reg_sens (editor_actions, "undo", _("Undo"), sigc::bind (sigc::mem_fun(*this, &Editor::undo), 1U)); + undo_action = reg_sens (editor_actions, "undo", S_("Command|Undo"), sigc::bind (sigc::mem_fun(*this, &Editor::undo), 1U)); redo_action = reg_sens (editor_actions, "redo", _("Redo"), sigc::bind (sigc::mem_fun(*this, &Editor::redo), 1U)); reg_sens (editor_actions, "export-audio", _("Export Audio"), sigc::mem_fun(*this, &Editor::export_audio)); @@ -311,8 +318,8 @@ Editor::register_actions () toggle_reg_sens (editor_actions, "toggle-log-window", _("Log"), sigc::mem_fun (ARDOUR_UI::instance(), &ARDOUR_UI::toggle_errors)); - reg_sens (editor_actions, "tab-to-transient-forwards", _("Move Forward to Transient"), sigc::bind (sigc::mem_fun(*this, &Editor::tab_to_transient), true)); - reg_sens (editor_actions, "tab-to-transient-backwards", _("Move Backwards to Transient"), sigc::bind (sigc::mem_fun(*this, &Editor::tab_to_transient), false)); + reg_sens (editor_actions, "tab-to-transient-forwards", _("Move Later to Transient"), sigc::bind (sigc::mem_fun(*this, &Editor::tab_to_transient), true)); + reg_sens (editor_actions, "tab-to-transient-backwards", _("Move Earlier to Transient"), sigc::bind (sigc::mem_fun(*this, &Editor::tab_to_transient), false)); reg_sens (editor_actions, "crop", _("Crop"), sigc::mem_fun(*this, &Editor::crop_region_to_selection)); @@ -383,6 +390,8 @@ Editor::register_actions () sigc::mem_fun(*this, &Editor::set_track_height), HeightSmall)); ActionManager::track_selection_sensitive_actions.push_back (act); + toggle_reg_sens (editor_actions, "sound-midi-notes", _("Sound Selected MIDI Notes"), sigc::mem_fun (*this, &Editor::toggle_sound_midi_notes)); + Glib::RefPtr zoom_actions = ActionGroup::create (X_("Zoom")); RadioAction::Group zoom_group; @@ -406,10 +415,13 @@ Editor::register_actions () mouse_select_button.set_image (::get_icon("tool_range")); mouse_select_button.set_name ("mouse mode button"); + act = ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-draw", _("Note Drawing Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseDraw)); + mouse_draw_button.set_related_action (act); + mouse_draw_button.set_image (::get_icon("midi_tool_pencil")); + mouse_draw_button.set_name ("mouse mode button"); + act = ActionManager::register_toggle_action (mouse_mode_actions, "set-mouse-mode-object-range", _("Link Object / Range Tools"), sigc::mem_fun (*this, &Editor::mouse_mode_object_range_toggled)); - join_object_range_button.set_related_action (act); - join_object_range_button.set_image (::get_icon ("tool_object_range")); - join_object_range_button.set_name ("mouse mode button"); + smart_mode_action = Glib::RefPtr::cast_static (act); act = ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-gain", _("Gain Tool"), sigc::bind (mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseGain)); mouse_gain_button.set_related_action (act); @@ -461,7 +473,10 @@ Editor::register_actions () ActionManager::register_radio_action (editor_actions, snap_mode_group, X_("snap-magnetic"), _("Magnetic"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_mode_chosen), Editing::SnapMagnetic))); ActionManager::register_action (editor_actions, X_("cycle-snap-mode"), _("Next Snap Mode"), sigc::mem_fun (*this, &Editor::cycle_snap_mode)); - ActionManager::register_action (editor_actions, X_("cycle-snap-choice"), _("Next Snap Choice"), sigc::mem_fun (*this, &Editor::cycle_snap_choice)); + ActionManager::register_action (editor_actions, X_("next-snap-choice"), _("Next Snap Choice"), sigc::mem_fun (*this, &Editor::next_snap_choice)); + ActionManager::register_action (editor_actions, X_("next-snap-choice-music-only"), _("Next Musical Snap Choice"), sigc::mem_fun (*this, &Editor::next_snap_choice_music_only)); + ActionManager::register_action (editor_actions, X_("prev-snap-choice"), _("Previous Snap Choice"), sigc::mem_fun (*this, &Editor::prev_snap_choice)); + ActionManager::register_action (editor_actions, X_("prev-snap-choice-music-only"), _("Previous Musical Snap Choice"), sigc::mem_fun (*this, &Editor::prev_snap_choice_music_only)); Glib::RefPtr snap_actions = ActionGroup::create (X_("Snap")); RadioAction::Group snap_choice_group; @@ -473,6 +488,8 @@ Editor::register_actions () ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-seconds"), _("Snap to Seconds"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToSeconds))); ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-minutes"), _("Snap to Minutes"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToMinutes))); + ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-onetwentyeighths"), _("Snap to One Twenty Eighths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv128))); + ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-sixtyfourths"), _("Snap to Sixty Fourths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv64))); ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-thirtyseconds"), _("Snap to Thirty Seconds"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv32))); ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-twentyeighths"), _("Snap to Twenty Eighths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv28))); ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-twentyfourths"), _("Snap to Twenty Fourths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv24))); @@ -583,7 +600,7 @@ Editor::register_actions () ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortBySourceFilesystem"), _("By Source Filesystem"), sigc::bind (sigc::mem_fun (*_regions, &EditorRegions::reset_sort_type), BySourceFileFS, false)); - ActionManager::register_action (rl_actions, X_("removeUnusedRegions"), _("Delete Unused"), sigc::mem_fun(*_regions, &EditorRegions::delete_unused_regions)); + ActionManager::register_action (rl_actions, X_("removeUnusedRegions"), _("Remove Unused"), sigc::mem_fun (*_regions, &EditorRegions::remove_unused_regions)); /* the next two are duplicate items with different names for use in two different contexts */ @@ -614,6 +631,24 @@ Editor::register_actions () ActionManager::add_action_group (mouse_mode_actions); ActionManager::add_action_group (snap_actions); ActionManager::add_action_group (editor_actions); + ActionManager::add_action_group (editor_menu_actions); +} + +void +Editor::load_bindings () +{ + /* XXX move this to a better place */ + + key_bindings.set_action_map (editor_action_map); + + sys::path binding_file; + + if (find_file_in_search_path (ardour_config_search_path(), "editor.bindings", binding_file)) { + key_bindings.load (binding_file.to_string()); + info << string_compose (_("Loaded editor bindings from %1"), binding_file.to_string()) << endmsg; + } else { + error << string_compose (_("Could not find editor.bindings in search path %1"), ardour_config_search_path().to_string()) << endmsg; + } } void @@ -739,6 +774,12 @@ Editor::snap_type_action (SnapType type) case Editing::SnapToMinutes: action = "snap-to-minutes"; break; + case Editing::SnapToBeatDiv128: + action = "snap-to-onetwentyeighths"; + break; + case Editing::SnapToBeatDiv64: + action = "snap-to-sixtyfourths"; + break; case Editing::SnapToBeatDiv32: action = "snap-to-thirtyseconds"; break; @@ -823,7 +864,104 @@ Editor::snap_type_action (SnapType type) } void -Editor::cycle_snap_choice() +Editor::next_snap_choice () +{ + switch (_snap_type) { + case Editing::SnapToCDFrame: + set_snap_to (Editing::SnapToTimecodeFrame); + break; + case Editing::SnapToTimecodeFrame: + set_snap_to (Editing::SnapToTimecodeSeconds); + break; + case Editing::SnapToTimecodeSeconds: + set_snap_to (Editing::SnapToTimecodeMinutes); + break; + case Editing::SnapToTimecodeMinutes: + set_snap_to (Editing::SnapToSeconds); + break; + case Editing::SnapToSeconds: + set_snap_to (Editing::SnapToMinutes); + break; + case Editing::SnapToMinutes: + set_snap_to (Editing::SnapToBeatDiv128); + break; + case Editing::SnapToBeatDiv128: + set_snap_to (Editing::SnapToBeatDiv64); + break; + case Editing::SnapToBeatDiv64: + set_snap_to (Editing::SnapToBeatDiv32); + break; + case Editing::SnapToBeatDiv32: + set_snap_to (Editing::SnapToBeatDiv28); + break; + case Editing::SnapToBeatDiv28: + set_snap_to (Editing::SnapToBeatDiv24); + break; + case Editing::SnapToBeatDiv24: + set_snap_to (Editing::SnapToBeatDiv20); + break; + case Editing::SnapToBeatDiv20: + set_snap_to (Editing::SnapToBeatDiv16); + break; + case Editing::SnapToBeatDiv16: + set_snap_to (Editing::SnapToBeatDiv14); + break; + case Editing::SnapToBeatDiv14: + set_snap_to (Editing::SnapToBeatDiv12); + break; + case Editing::SnapToBeatDiv12: + set_snap_to (Editing::SnapToBeatDiv10); + break; + case Editing::SnapToBeatDiv10: + set_snap_to (Editing::SnapToBeatDiv8); + break; + case Editing::SnapToBeatDiv8: + set_snap_to (Editing::SnapToBeatDiv7); + break; + case Editing::SnapToBeatDiv7: + set_snap_to (Editing::SnapToBeatDiv6); + break; + case Editing::SnapToBeatDiv6: + set_snap_to (Editing::SnapToBeatDiv5); + break; + case Editing::SnapToBeatDiv5: + set_snap_to (Editing::SnapToBeatDiv4); + break; + case Editing::SnapToBeatDiv4: + set_snap_to (Editing::SnapToBeatDiv3); + break; + case Editing::SnapToBeatDiv3: + set_snap_to (Editing::SnapToBeatDiv2); + break; + case Editing::SnapToBeatDiv2: + set_snap_to (Editing::SnapToBeat); + break; + case Editing::SnapToBeat: + set_snap_to (Editing::SnapToBar); + break; + case Editing::SnapToBar: + set_snap_to (Editing::SnapToMark); + break; + case Editing::SnapToMark: + set_snap_to (Editing::SnapToRegionStart); + break; + case Editing::SnapToRegionStart: + set_snap_to (Editing::SnapToRegionEnd); + break; + case Editing::SnapToRegionEnd: + set_snap_to (Editing::SnapToRegionSync); + break; + case Editing::SnapToRegionSync: + set_snap_to (Editing::SnapToRegionBoundary); + break; + case Editing::SnapToRegionBoundary: + set_snap_to (Editing::SnapToCDFrame); + break; + } +} + +void +Editor::prev_snap_choice () { switch (_snap_type) { case Editing::SnapToCDFrame: @@ -842,6 +980,12 @@ Editor::cycle_snap_choice() set_snap_to (Editing::SnapToMinutes); break; case Editing::SnapToMinutes: + set_snap_to (Editing::SnapToBeatDiv128); + break; + case Editing::SnapToBeatDiv128: + set_snap_to (Editing::SnapToBeatDiv64); + break; + case Editing::SnapToBeatDiv64: set_snap_to (Editing::SnapToBeatDiv32); break; case Editing::SnapToBeatDiv32: @@ -913,6 +1057,160 @@ Editor::cycle_snap_choice() } } +void +Editor::next_snap_choice_music_only () +{ + switch (_snap_type) { + case Editing::SnapToMark: + case Editing::SnapToRegionStart: + case Editing::SnapToRegionEnd: + case Editing::SnapToRegionSync: + case Editing::SnapToRegionBoundary: + case Editing::SnapToCDFrame: + case Editing::SnapToTimecodeFrame: + case Editing::SnapToTimecodeSeconds: + case Editing::SnapToTimecodeMinutes: + case Editing::SnapToSeconds: + case Editing::SnapToMinutes: + set_snap_to (Editing::SnapToBeatDiv128); + break; + case Editing::SnapToBeatDiv128: + set_snap_to (Editing::SnapToBeatDiv64); + break; + case Editing::SnapToBeatDiv64: + set_snap_to (Editing::SnapToBeatDiv32); + break; + case Editing::SnapToBeatDiv32: + set_snap_to (Editing::SnapToBeatDiv28); + break; + case Editing::SnapToBeatDiv28: + set_snap_to (Editing::SnapToBeatDiv24); + break; + case Editing::SnapToBeatDiv24: + set_snap_to (Editing::SnapToBeatDiv20); + break; + case Editing::SnapToBeatDiv20: + set_snap_to (Editing::SnapToBeatDiv16); + break; + case Editing::SnapToBeatDiv16: + set_snap_to (Editing::SnapToBeatDiv14); + break; + case Editing::SnapToBeatDiv14: + set_snap_to (Editing::SnapToBeatDiv12); + break; + case Editing::SnapToBeatDiv12: + set_snap_to (Editing::SnapToBeatDiv10); + break; + case Editing::SnapToBeatDiv10: + set_snap_to (Editing::SnapToBeatDiv8); + break; + case Editing::SnapToBeatDiv8: + set_snap_to (Editing::SnapToBeatDiv7); + break; + case Editing::SnapToBeatDiv7: + set_snap_to (Editing::SnapToBeatDiv6); + break; + case Editing::SnapToBeatDiv6: + set_snap_to (Editing::SnapToBeatDiv5); + break; + case Editing::SnapToBeatDiv5: + set_snap_to (Editing::SnapToBeatDiv4); + break; + case Editing::SnapToBeatDiv4: + set_snap_to (Editing::SnapToBeatDiv3); + break; + case Editing::SnapToBeatDiv3: + set_snap_to (Editing::SnapToBeatDiv2); + break; + case Editing::SnapToBeatDiv2: + set_snap_to (Editing::SnapToBeat); + break; + case Editing::SnapToBeat: + set_snap_to (Editing::SnapToBar); + break; + case Editing::SnapToBar: + set_snap_to (Editing::SnapToBeatDiv128); + break; + } +} + +void +Editor::prev_snap_choice_music_only () +{ + switch (_snap_type) { + case Editing::SnapToMark: + case Editing::SnapToRegionStart: + case Editing::SnapToRegionEnd: + case Editing::SnapToRegionSync: + case Editing::SnapToRegionBoundary: + case Editing::SnapToCDFrame: + case Editing::SnapToTimecodeFrame: + case Editing::SnapToTimecodeSeconds: + case Editing::SnapToTimecodeMinutes: + case Editing::SnapToSeconds: + case Editing::SnapToMinutes: + set_snap_to (Editing::SnapToBar); + break; + case Editing::SnapToBeatDiv128: + set_snap_to (Editing::SnapToBeat); + break; + case Editing::SnapToBeatDiv64: + set_snap_to (Editing::SnapToBeatDiv128); + break; + case Editing::SnapToBeatDiv32: + set_snap_to (Editing::SnapToBeatDiv64); + break; + case Editing::SnapToBeatDiv28: + set_snap_to (Editing::SnapToBeatDiv32); + break; + case Editing::SnapToBeatDiv24: + set_snap_to (Editing::SnapToBeatDiv28); + break; + case Editing::SnapToBeatDiv20: + set_snap_to (Editing::SnapToBeatDiv24); + break; + case Editing::SnapToBeatDiv16: + set_snap_to (Editing::SnapToBeatDiv20); + break; + case Editing::SnapToBeatDiv14: + set_snap_to (Editing::SnapToBeatDiv16); + break; + case Editing::SnapToBeatDiv12: + set_snap_to (Editing::SnapToBeatDiv14); + break; + case Editing::SnapToBeatDiv10: + set_snap_to (Editing::SnapToBeatDiv12); + break; + case Editing::SnapToBeatDiv8: + set_snap_to (Editing::SnapToBeatDiv10); + break; + case Editing::SnapToBeatDiv7: + set_snap_to (Editing::SnapToBeatDiv8); + break; + case Editing::SnapToBeatDiv6: + set_snap_to (Editing::SnapToBeatDiv7); + break; + case Editing::SnapToBeatDiv5: + set_snap_to (Editing::SnapToBeatDiv6); + break; + case Editing::SnapToBeatDiv4: + set_snap_to (Editing::SnapToBeatDiv5); + break; + case Editing::SnapToBeatDiv3: + set_snap_to (Editing::SnapToBeatDiv4); + break; + case Editing::SnapToBeatDiv2: + set_snap_to (Editing::SnapToBeatDiv3); + break; + case Editing::SnapToBeat: + set_snap_to (Editing::SnapToBeatDiv2); + break; + case Editing::SnapToBar: + set_snap_to (Editing::SnapToBeat); + break; + } +} + void Editor::snap_type_chosen (SnapType type) { @@ -1083,6 +1381,20 @@ Editor::zoom_focus_action (ZoomFocus focus) return RefPtr (); } +void +Editor::toggle_sound_midi_notes () +{ + Glib::RefPtr act = ActionManager::get_action (X_("Editor"), X_("sound-midi-notes")); + + if (act) { + bool s = Config->get_sound_midi_notes(); + Glib::RefPtr tact = Glib::RefPtr::cast_dynamic (act); + if (tact->get_active () != s) { + Config->set_sound_midi_notes (tact->get_active()); + } + } +} + void Editor::zoom_focus_chosen (ZoomFocus focus) { @@ -1114,8 +1426,6 @@ Editor::parameter_changed (std::string p) update_punch_range_view (true); } else if (p == "timecode-format") { update_just_timecode (); - } else if (p == "xfades-visible") { - update_xfade_visibility (); } else if (p == "show-region-fades") { update_region_fade_visibility (); } else if (p == "edit-mode") { @@ -1162,6 +1472,18 @@ Editor::parameter_changed (std::string p) update_just_timecode (); } else if (p == "show-zoom-tools") { _zoom_tearoff->set_visible (Config->get_show_zoom_tools(), true); + } else if (p == "sound-midi-notes") { + Glib::RefPtr act = ActionManager::get_action (X_("Editor"), X_("sound-midi-notes")); + + if (act) { + bool s = Config->get_sound_midi_notes(); + Glib::RefPtr tact = Glib::RefPtr::cast_dynamic (act); + if (tact->get_active () != s) { + tact->set_active (s); + } + } + } else if (p == "show-region-gain") { + set_gain_envelope_visibility (); } } @@ -1194,7 +1516,6 @@ Editor::toggle_internal_editing () } } - void Editor::register_region_actions () { @@ -1305,16 +1626,16 @@ Editor::register_region_actions () /* Add a single range marker around all selected regions */ reg_sens ( - _region_actions, "add-range-marker-from-region", _("Add 1 Range Marker"), sigc::mem_fun (*this, &Editor::add_location_from_region) + _region_actions, "add-range-marker-from-region", _("Add Single Range Marker"), sigc::mem_fun (*this, &Editor::add_location_from_region) ); /* Add a range marker around each selected region */ reg_sens ( - _region_actions, "add-range-markers-from-region", _("Add Range Marker(s)"), sigc::mem_fun (*this, &Editor::add_locations_from_region) + _region_actions, "add-range-markers-from-region", _("Add Range Marker Per Region"), sigc::mem_fun (*this, &Editor::add_locations_from_region) ); /* Snap selected regions to the grid */ - reg_sens (_region_actions, "snap-regions-to-grid", _("Snap to Grid"), sigc::mem_fun (*this, &Editor::snap_regions_to_grid)); + reg_sens (_region_actions, "snap-regions-to-grid", _("Snap Position To Grid"), sigc::mem_fun (*this, &Editor::snap_regions_to_grid)); /* Close gaps in selected regions */ reg_sens (_region_actions, "close-region-gaps", _("Close Gaps"), sigc::mem_fun (*this, &Editor::close_region_gaps)); @@ -1363,13 +1684,6 @@ Editor::register_region_actions () reg_sens (_region_actions, "reset-region-scale-amplitude", _("Reset Gain"), sigc::mem_fun (*this, &Editor::reset_region_scale_amplitude)); - toggle_reg_sens ( - _region_actions, - "toggle-region-gain-envelope-visible", - _("Envelope Visible"), - sigc::mem_fun (*this, &Editor::toggle_gain_envelope_visibility) - ); - toggle_reg_sens ( _region_actions, "toggle-region-gain-envelope-active", @@ -1378,25 +1692,26 @@ Editor::register_region_actions () ); reg_sens (_region_actions, "quantize-region", _("Quantize..."), sigc::mem_fun (*this, &Editor::quantize_region)); - reg_sens (_region_actions, "insert-patch-change", _("Insert Patch Change..."), sigc::mem_fun (*this, &Editor::insert_patch_change)); + reg_sens (_region_actions, "insert-patch-change", _("Insert Patch Change..."), sigc::bind (sigc::mem_fun (*this, &Editor::insert_patch_change), false)); + reg_sens (_region_actions, "insert-patch-change-context", _("Insert Patch Change..."), sigc::bind (sigc::mem_fun (*this, &Editor::insert_patch_change), true)); reg_sens (_region_actions, "fork-region", _("Fork"), sigc::mem_fun (*this, &Editor::fork_region)); reg_sens (_region_actions, "strip-region-silence", _("Strip Silence..."), sigc::mem_fun (*this, &Editor::strip_region_silence)); reg_sens (_region_actions, "set-selection-from-region", _("Set Range Selection"), sigc::mem_fun (*this, &Editor::set_selection_from_region)); - reg_sens (_region_actions, "nudge-forward", _("Nudge Forward"), sigc::bind (sigc::mem_fun (*this, &Editor::nudge_forward), false, false)); - reg_sens (_region_actions, "nudge-backward", _("Nudge Backward"), sigc::bind (sigc::mem_fun (*this, &Editor::nudge_backward), false, false)); + reg_sens (_region_actions, "nudge-forward", _("Nudge Later"), sigc::bind (sigc::mem_fun (*this, &Editor::nudge_forward), false, false)); + reg_sens (_region_actions, "nudge-backward", _("Nudge Earlier"), sigc::bind (sigc::mem_fun (*this, &Editor::nudge_backward), false, false)); reg_sens ( _region_actions, "nudge-forward-by-capture-offset", - _("Nudge Forward by Capture Offset"), + _("Nudge Later by Capture Offset"), sigc::mem_fun (*this, &Editor::nudge_forward_capture_offset) ); reg_sens ( _region_actions, "nudge-backward-by-capture-offset", - _("Nudge Backward by Capture Offset"), + _("Nudge Earlier by Capture Offset"), sigc::mem_fun (*this, &Editor::nudge_backward_capture_offset) ); @@ -1460,7 +1775,10 @@ Editor::register_region_actions () sigc::bind (sigc::mem_fun (*this, &Editor::align_regions_relative), ARDOUR::SyncPoint) ); - Glib::RefPtr a = reg_sens (_region_actions, "choose-top-region", _("Choose Top..."), mem_fun (*this, &Editor::change_region_layering_order)); + Glib::RefPtr a = reg_sens (_region_actions, "choose-top-region", _("Choose Top..."), sigc::bind (sigc::mem_fun (*this, &Editor::change_region_layering_order), false)); + a->set_accel_group (get_accel_group ()); + + a = reg_sens (_region_actions, "choose-top-region-context-menu", _("Choose Top..."), sigc::bind (sigc::mem_fun (*this, &Editor::change_region_layering_order), true)); a->set_accel_group (get_accel_group ()); _all_region_actions_sensitized = true;