Tidy up the region menu a bit, and hopefully clarify what regions will be

operated on in different circumstances.  Make the main menubar Region menu
the same as the context one, and use the same logic to sensitize/desensitize
actions for them.


git-svn-id: svn://localhost/ardour2/branches/3.0@7954 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2010-11-03 22:19:29 +00:00
parent f9d6a7329c
commit b5ab2e030b
21 changed files with 1076 additions and 1145 deletions

36
doc/region_ops.txt Normal file
View File

@ -0,0 +1,36 @@
How to choose what regions to perform operations on
---------------------------------------------------
Divide region actions into 3 groups:
1. Actions that operate on the selection, and for which the edit point type and location is irrelevant.
e.g. remove-region, rename-region, boost-region-gain
2. Actions that are not related to the selection, but for which the edit point location is important
e.g. insert-region-from-region-list
3. Actions that operate on the selection, and for which the edit point location is important
e.g. set-region-sync-position, place-transient
For group 1, Editor::get_regions_from_selection_and_entered() is used to decide which regions to operate
on. This method returns the selected regions, unless there are none, in which case it returns the last
region that the mouse entered.
For group 3, Editor::get_regions_from_selection_and_edit_point() is used to decide which regions to operate
on.
If the edit point is `mouse':
if the mouse is over a selected region, or no region, this method returns all selected regions.
if the mouse is over an unselected region, just that region is returned.
For other edit points the method returns the selected regions AND those that are both under the edit position
AND on a selected track, or on a track which is in the same active edit-enabled route group as a selected
region.
The action handlers call the appropriate method to decide which regions to operate on.
In addition, Editor::sensitize_the_right_region_actions() is called when a Region menu is about to be displayed,
and it sensitizes the actions that are appropriate given the current situation. When selecting things from
a menu, group 3 operations are disabled if the edit point is `mouse', as the mouse will be positioned over
the menu and its position is hence meaningless.

View File

@ -39,7 +39,7 @@
(gtk_accel_path "<Actions>/Editor/set-fade-in-length" "q")
(gtk_accel_path "<Actions>/Common/Quit" "<@PRIMARY@>q")
(gtk_accel_path "<Actions>/Editor/toggle-fade-in-active" "<@SECONDARY@>q")
(gtk_accel_path "<Actions>/Editor/toggle-region-fade-in" "<@SECONDARY@>q")
(gtk_accel_path "<Actions>/Editor/set-playhead" "w")
;; note that ctrl-w is special and consumed by the keyboard snooper
@ -47,7 +47,7 @@
(gtk_accel_path "<Actions>/Main/Close" "<@PRIMARY@>w")
(gtk_accel_path "<Actions>/Editor/set-fade-out-length" "e")
(gtk_accel_path "<Actions>/Main/ExportSession" "<@PRIMARY@>e")
(gtk_accel_path "<Actions>/Editor/toggle-fade-out-active" "<@SECONDARY@>e")
(gtk_accel_path "<Actions>/Editor/toggle-region-fade-out" "<@SECONDARY@>e")
(gtk_accel_path "<Actions>/Editor/export-region" "<@PRIMARY@><@TERTIARY@>e")
(gtk_accel_path "<Actions>/Editor/show-editor-mixer" "<@TERTIARY@>e")
; (gtk_accel_path "<Actions>/Common/goto-editor" "<@SECONDARY@>e")
@ -61,7 +61,7 @@
(gtk_accel_path "<Actions>/Editor/pitch-shift-region" "<@LEVEL4@>t")
(gtk_accel_path "<Actions>/Editor/split-region" "y")
(gtk_accel_path "<Actions>/Editor/set-region-sync-position" "u")
(gtk_accel_path "<Actions>/Editor/insert-region" "i")
(gtk_accel_path "<Actions>/Editor/insert-region-from-region-list" "i")
(gtk_accel_path "<Actions>/Editor/addExistingAudioFiles" "<@PRIMARY@>i")
(gtk_accel_path "<Actions>/Editor/invert-selection" "<@TERTIARY@>i")
(gtk_accel_path "<Actions>/Main/Open" "<@PRIMARY@>o")
@ -83,7 +83,7 @@
(gtk_accel_path "<Actions>/Editor/duplicate-region" "<@PRIMARY@>d")
(gtk_accel_path "<Actions>/Editor/multi-duplicate-region" "<@PRIMARY@><@TERTIARY@>d")
(gtk_accel_path "<Actions>/Editor/toggle-follow-playhead" "f")
(gtk_accel_path "<Actions>/Editor/toggle-rhythm-ferret" "<@WINDOW@>f")
(gtk_accel_path "<Actions>/Editor/show-rhythm-ferret" "<@WINDOW@>f")
; (gtk_accel_path "<Actions>/Editor/set-edit-point" "g")
; (gtk_accel_path "<Actions>/MouseMode/set-mouse-mode-gain" "g")
(gtk_accel_path "<Actions>/Editor/nudge-backward" "g")
@ -91,7 +91,7 @@
(gtk_accel_path "<Actions>/Common/ToggleKeyEditor" "<@SECONDARY@>k")
(gtk_accel_path "<Actions>/Common/ToggleLocations" "<@SECONDARY@>l")
(gtk_accel_path "<Actions>/Transport/Loop" "l")
(gtk_accel_path "<Actions>/Editor/lock-region" "<@LEVEL4@>l")
(gtk_accel_path "<Actions>/Editor/toggle-region-lock" "<@LEVEL4@>l")
(gtk_accel_path "<Actions>/Editor/select-all-in-loop-range" "<@TERTIARY@>l")
;; UNTERE ZEILE
@ -113,7 +113,7 @@
(gtk_accel_path "<Actions>/Main/AddTrackBus" "<@PRIMARY@><@TERTIARY@>n")
(gtk_accel_path "<Actions>/Common/toggle-editor-mixer-on-top" "<@SECONDARY@>m")
(gtk_accel_path "<Actions>/Editor/add-location-from-playhead" "KP_Enter")
(gtk_accel_path "<Actions>/Editor/mute-unmute-region" "m")
(gtk_accel_path "<Actions>/Editor/toggle-region-mute" "m")
;; arrow keys, navigation etc.

View File

@ -39,7 +39,7 @@
(gtk_accel_path "<Actions>/Editor/set-fade-in-length" "q")
(gtk_accel_path "<Actions>/Common/Quit" "<@PRIMARY@>q")
(gtk_accel_path "<Actions>/Editor/toggle-fade-in-active" "<@SECONDARY@>q")
(gtk_accel_path "<Actions>/Editor/toggle-region-fade-in" "<@SECONDARY@>q")
(gtk_accel_path "<Actions>/Editor/set-playhead" "w")
;; note that ctrl-w is special and consumed by the keyboard snooper
@ -47,7 +47,7 @@
(gtk_accel_path "<Actions>/Main/Close" "<@PRIMARY@>w")
(gtk_accel_path "<Actions>/Editor/set-fade-out-length" "e")
(gtk_accel_path "<Actions>/Main/ExportSession" "<@PRIMARY@>e")
(gtk_accel_path "<Actions>/Editor/toggle-fade-out-active" "<@SECONDARY@>e")
(gtk_accel_path "<Actions>/Editor/toggle-region-fade-out" "<@SECONDARY@>e")
(gtk_accel_path "<Actions>/Editor/export-region" "<@PRIMARY@><@TERTIARY@>e")
(gtk_accel_path "<Actions>/Editor/show-editor-mixer" "<@TERTIARY@>e")
; (gtk_accel_path "<Actions>/Common/goto-editor" "<@SECONDARY@>e")
@ -61,7 +61,7 @@
(gtk_accel_path "<Actions>/Editor/pitch-shift-region" "<@LEVEL4@>t")
(gtk_accel_path "<Actions>/Editor/split-region" "y")
(gtk_accel_path "<Actions>/Editor/set-region-sync-position" "u")
(gtk_accel_path "<Actions>/Editor/insert-region" "i")
(gtk_accel_path "<Actions>/Editor/insert-region-from-region-list" "i")
(gtk_accel_path "<Actions>/Editor/addExistingAudioFiles" "<@PRIMARY@>i")
(gtk_accel_path "<Actions>/Editor/invert-selection" "<@TERTIARY@>i")
(gtk_accel_path "<Actions>/Main/Open" "<@PRIMARY@>o")
@ -83,7 +83,7 @@
(gtk_accel_path "<Actions>/Editor/duplicate-region" "<@PRIMARY@>d")
(gtk_accel_path "<Actions>/Editor/multi-duplicate-region" "<@PRIMARY@><@TERTIARY@>d")
(gtk_accel_path "<Actions>/Editor/toggle-follow-playhead" "f")
(gtk_accel_path "<Actions>/Editor/toggle-rhythm-ferret" "<@SECONDARY@>f")
(gtk_accel_path "<Actions>/Editor/show-rhythm-ferret" "<@SECONDARY@>f")
; (gtk_accel_path "<Actions>/Editor/set-edit-point" "g")
; (gtk_accel_path "<Actions>/MouseMode/set-mouse-mode-gain" "g")
(gtk_accel_path "<Actions>/Editor/nudge-backward" "g")
@ -91,7 +91,7 @@
(gtk_accel_path "<Actions>/Common/ToggleKeyEditor" "<@SECONDARY@>k")
(gtk_accel_path "<Actions>/Common/ToggleLocations" "<@SECONDARY@>l")
(gtk_accel_path "<Actions>/Transport/Loop" "l")
(gtk_accel_path "<Actions>/Editor/lock-region" "<@LEVEL4@>l")
(gtk_accel_path "<Actions>/Editor/toggle-region-lock" "<@LEVEL4@>l")
(gtk_accel_path "<Actions>/Editor/select-all-in-loop-range" "<@TERTIARY@>l")
;; UNTERE ZEILE
@ -112,7 +112,7 @@
(gtk_accel_path "<Actions>/Main/New" "<@PRIMARY@>n")
(gtk_accel_path "<Actions>/Main/AddTrackBus" "<@PRIMARY@><@TERTIARY@>n")
(gtk_accel_path "<Actions>/Common/toggle-editor-mixer-on-top" "<@SECONDARY@>m")
(gtk_accel_path "<Actions>/Editor/mute-unmute-region" "m")
(gtk_accel_path "<Actions>/Editor/toggle-region-mute" "m")
;; arrow keys, navigation etc.

View File

@ -37,7 +37,7 @@
(gtk_accel_path "<Actions>/Editor/set-fade-in-length" "q")
(gtk_accel_path "<Actions>/Common/Quit" "<@PRIMARY@>q")
(gtk_accel_path "<Actions>/Editor/toggle-fade-in-active" "<@SECONDARY@>q")
(gtk_accel_path "<Actions>/Editor/toggle-region-fade-in" "<@SECONDARY@>q")
(gtk_accel_path "<Actions>/Editor/set-playhead" "w")
;; note that ctrl-w is special and consumed by the keyboard snooper
@ -45,7 +45,7 @@
(gtk_accel_path "<Actions>/Main/Close" "<@PRIMARY@>w")
(gtk_accel_path "<Actions>/Editor/set-fade-out-length" "e")
(gtk_accel_path "<Actions>/Main/ExportSession" "<@PRIMARY@>e")
(gtk_accel_path "<Actions>/Editor/toggle-fade-out-active" "<@SECONDARY@>e")
(gtk_accel_path "<Actions>/Editor/toggle-region-fade-out" "<@SECONDARY@>e")
(gtk_accel_path "<Actions>/Editor/export-region" "<@PRIMARY@><@TERTIARY@>e")
(gtk_accel_path "<Actions>/Editor/show-editor-mixer" "<@TERTIARY@>e")
; (gtk_accel_path "<Actions>/Common/goto-editor" "<@SECONDARY@>e")
@ -59,7 +59,7 @@
(gtk_accel_path "<Actions>/Editor/pitch-shift-region" "<@LEVEL4@>t")
(gtk_accel_path "<Actions>/Editor/split-region" "z")
(gtk_accel_path "<Actions>/Editor/set-region-sync-position" "u")
(gtk_accel_path "<Actions>/Editor/insert-region" "i")
(gtk_accel_path "<Actions>/Editor/insert-region-from-region-list" "i")
(gtk_accel_path "<Actions>/Editor/addExistingAudioFiles" "<@PRIMARY@>i")
(gtk_accel_path "<Actions>/Editor/invert-selection" "<@TERTIARY@>i")
(gtk_accel_path "<Actions>/Main/Open" "<@PRIMARY@>o")
@ -81,7 +81,7 @@
(gtk_accel_path "<Actions>/Editor/duplicate-region" "<@PRIMARY@>d")
(gtk_accel_path "<Actions>/Editor/multi-duplicate-region" "<@PRIMARY@><@TERTIARY@>d")
(gtk_accel_path "<Actions>/Editor/toggle-follow-playhead" "f")
(gtk_accel_path "<Actions>/Editor/toggle-rhythm-ferret" "<@WINDOW@>f")
(gtk_accel_path "<Actions>/Editor/show-rhythm-ferret" "<@WINDOW@>f")
; (gtk_accel_path "<Actions>/Editor/set-edit-point" "g")
; (gtk_accel_path "<Actions>/MouseMode/set-mouse-mode-gain" "g")
(gtk_accel_path "<Actions>/Editor/nudge-backward" "g")
@ -89,7 +89,7 @@
(gtk_accel_path "<Actions>/Common/ToggleKeyEditor" "<@SECONDARY@>k")
(gtk_accel_path "<Actions>/Common/ToggleLocations" "<@SECONDARY@>l")
(gtk_accel_path "<Actions>/Transport/Loop" "l")
(gtk_accel_path "<Actions>/Editor/lock-region" "<@LEVEL4@>l")
(gtk_accel_path "<Actions>/Editor/toggle-region-lock" "<@LEVEL4@>l")
(gtk_accel_path "<Actions>/Editor/select-all-in-loop-range" "<@TERTIARY@>l")
;; UNTERE ZEILE
@ -111,7 +111,7 @@
(gtk_accel_path "<Actions>/Main/AddTrackBus" "<@PRIMARY@><@TERTIARY@>n")
(gtk_accel_path "<Actions>/Common/toggle-editor-mixer-on-top" "<@SECONDARY@>m")
(gtk_accel_path "<Actions>/Editor/add-location-from-playhead" "KP_Enter")
(gtk_accel_path "<Actions>/Editor/mute-unmute-region" "m")
(gtk_accel_path "<Actions>/Editor/toggle-region-mute" "m")
;; arrow keys, navigation etc.

View File

@ -37,7 +37,7 @@
(gtk_accel_path "<Actions>/Editor/set-fade-in-length" "q")
(gtk_accel_path "<Actions>/Common/Quit" "<@PRIMARY@>q")
(gtk_accel_path "<Actions>/Editor/toggle-fade-in-active" "<@SECONDARY@>q")
(gtk_accel_path "<Actions>/Editor/toggle-region-fade-in" "<@SECONDARY@>q")
(gtk_accel_path "<Actions>/Editor/set-playhead" "w")
;; note that ctrl-w is special and consumed by the keyboard snooper
@ -45,7 +45,7 @@
(gtk_accel_path "<Actions>/Main/Close" "<@PRIMARY@>w")
(gtk_accel_path "<Actions>/Editor/set-fade-out-length" "e")
(gtk_accel_path "<Actions>/Main/ExportSession" "<@PRIMARY@>e")
(gtk_accel_path "<Actions>/Editor/toggle-fade-out-active" "<@SECONDARY@>e")
(gtk_accel_path "<Actions>/Editor/toggle-region-fade-out" "<@SECONDARY@>e")
(gtk_accel_path "<Actions>/Editor/export-region" "<@PRIMARY@><@TERTIARY@>e")
(gtk_accel_path "<Actions>/Editor/show-editor-mixer" "<@TERTIARY@>e")
; (gtk_accel_path "<Actions>/Common/goto-editor" "<@SECONDARY@>e")
@ -59,7 +59,7 @@
(gtk_accel_path "<Actions>/Editor/pitch-shift-region" "<@LEVEL4@>t")
(gtk_accel_path "<Actions>/Editor/split-region" "z")
(gtk_accel_path "<Actions>/Editor/set-region-sync-position" "u")
(gtk_accel_path "<Actions>/Editor/insert-region" "i")
(gtk_accel_path "<Actions>/Editor/insert-region-from-region-list" "i")
(gtk_accel_path "<Actions>/Editor/addExistingAudioFiles" "<@PRIMARY@>i")
(gtk_accel_path "<Actions>/Editor/invert-selection" "<@TERTIARY@>i")
(gtk_accel_path "<Actions>/Main/Open" "<@PRIMARY@>o")
@ -81,7 +81,7 @@
(gtk_accel_path "<Actions>/Editor/duplicate-region" "<@PRIMARY@>d")
(gtk_accel_path "<Actions>/Editor/multi-duplicate-region" "<@PRIMARY@><@TERTIARY@>d")
(gtk_accel_path "<Actions>/Editor/toggle-follow-playhead" "f")
(gtk_accel_path "<Actions>/Editor/toggle-rhythm-ferret" "<@SECONDARY@>f")
(gtk_accel_path "<Actions>/Editor/show-rhythm-ferret" "<@SECONDARY@>f")
; (gtk_accel_path "<Actions>/Editor/set-edit-point" "g")
; (gtk_accel_path "<Actions>/MouseMode/set-mouse-mode-gain" "g")
(gtk_accel_path "<Actions>/Editor/nudge-backward" "g")
@ -89,7 +89,7 @@
(gtk_accel_path "<Actions>/Common/ToggleKeyEditor" "<@SECONDARY@>k")
(gtk_accel_path "<Actions>/Common/ToggleLocations" "<@SECONDARY@>l")
(gtk_accel_path "<Actions>/Transport/Loop" "l")
(gtk_accel_path "<Actions>/Editor/lock-region" "<@LEVEL4@>l")
(gtk_accel_path "<Actions>/Editor/toggle-region-lock" "<@LEVEL4@>l")
(gtk_accel_path "<Actions>/Editor/select-all-in-loop-range" "<@TERTIARY@>l")
;; UNTERE ZEILE
@ -110,7 +110,7 @@
(gtk_accel_path "<Actions>/Main/New" "<@PRIMARY@>n")
(gtk_accel_path "<Actions>/Main/AddTrackBus" "<@PRIMARY@><@TERTIARY@>n")
(gtk_accel_path "<Actions>/Common/toggle-editor-mixer-on-top" "<@SECONDARY@>m")
(gtk_accel_path "<Actions>/Editor/mute-unmute-region" "m")
(gtk_accel_path "<Actions>/Editor/toggle-region-mute" "m")
;; arrow keys, navigation etc.

View File

@ -51,7 +51,6 @@ vector<RefPtr<Gtk::Action> > ActionManager::session_sensitive_actions;
vector<RefPtr<Gtk::Action> > ActionManager::write_sensitive_actions;
vector<RefPtr<Gtk::Action> > ActionManager::region_list_selection_sensitive_actions;
vector<RefPtr<Gtk::Action> > ActionManager::plugin_selection_sensitive_actions;
vector<RefPtr<Gtk::Action> > ActionManager::region_selection_sensitive_actions;
vector<RefPtr<Gtk::Action> > ActionManager::track_selection_sensitive_actions;
vector<RefPtr<Gtk::Action> > ActionManager::point_selection_sensitive_actions;
vector<RefPtr<Gtk::Action> > ActionManager::time_selection_sensitive_actions;

View File

@ -36,7 +36,6 @@ namespace ActionManager {
extern std::vector<Glib::RefPtr<Gtk::Action> > region_list_selection_sensitive_actions;
extern std::vector<Glib::RefPtr<Gtk::Action> > plugin_selection_sensitive_actions;
extern std::vector<Glib::RefPtr<Gtk::Action> > region_selection_sensitive_actions;
extern std::vector<Glib::RefPtr<Gtk::Action> > track_selection_sensitive_actions;
extern std::vector<Glib::RefPtr<Gtk::Action> > point_selection_sensitive_actions;
extern std::vector<Glib::RefPtr<Gtk::Action> > time_selection_sensitive_actions;

View File

@ -158,9 +158,9 @@
</menu>
<menu action="FadeMenu">
<menuitem action='set-fade-in-length'/>
<menuitem action='toggle-fade-in-active'/>
<menuitem action='toggle-region-fade-in'/>
<menuitem action='set-fade-out-length'/>
<menuitem action='toggle-fade-out-active'/>
<menuitem action='toggle-region-fade-out'/>
<separator/>
<menuitem action='toggle-selected-region-fades'/>
<menuitem action='toggle-region-fades'/>
@ -203,19 +203,19 @@
</menu>
<menu action='RegionMenu'>
<menuitem action='insert-region'/>
<menuitem action='insert-region-from-region-list'/>
<menuitem action='rename-region'/>
<menuitem action='auto-rename-region'/>
<menuitem action='raise-region'/>
<menuitem action='lower-region'/>
<menuitem action='naturalize-region'/>
<menuitem action='lock-region'/>
<menuitem action='toggle-region-lock'/>
<menuitem action='set-region-sync-position'/>
<menuitem action='remove-region-sync'/>
<menuitem action='mute-unmute-region'/>
<menuitem action='toggle-region-mute'/>
<separator/>
<menuitem action='reverse-region'/>
<menuitem action='monoize-region'/>
<menuitem action='split-multichannel-region'/>
<menuitem action='normalize-region'/>
<menuitem action='boost-region-gain'/>
<menuitem action='cut-region-gain'/>
@ -278,7 +278,7 @@
<menuitem action='ToggleKeyEditor'/>
<menuitem action='ToggleThemeManager'/>
<menuitem action='ToggleBigClock'/>
<menuitem action='toggle-rhythm-ferret'/>
<menuitem action='show-rhythm-ferret'/>
</menu>
<menu name='Options' action='Options'>

View File

@ -183,24 +183,11 @@
<menuitem action='align-regions-sync'/>
<menuitem action='align-regions-sync-relative'/>
</menu>
<menu action="NudgeRegionMenu">
<menuitem action="nudge-forward"/>
<menuitem action="nudge-backward"/>
</menu>
<menu action="TrimMenu">
<menuitem action='trim-front'/>
<menuitem action='trim-back'/>
<menuitem action='crop'/>
<menuitem action='trim-region-to-loop'/>
<menuitem action='trim-region-to-punch'/>
<menuitem action='trim-to-previous-region'/>
<menuitem action='trim-to-next-region'/>
</menu>
<menu action="FadeMenu">
<menuitem action='set-fade-in-length'/>
<menuitem action='toggle-fade-in-active'/>
<menuitem action='toggle-region-fade-in'/>
<menuitem action='set-fade-out-length'/>
<menuitem action='toggle-fade-out-active'/>
<menuitem action='toggle-region-fade-out'/>
</menu>
<separator/>
<menuitem action='remove-last-capture'/>
@ -239,45 +226,80 @@
#endif
</menu>
<menu action='RegionMenu'>
<menuitem action='insert-region'/>
<menu name='RegionMenu' action='RegionMenu'>
<menuitem action='insert-region-from-region-list'/>
<menuitem action='rename-region'/>
<menuitem action='raise-region'/>
<menuitem action='lower-region'/>
<menuitem action='naturalize-region'/>
<menuitem action='lock-region'/>
<menuitem action='show-region-properties'/>
<menuitem action='set-region-sync-position'/>
<menuitem action='remove-region-sync'/>
<menuitem action='mute-unmute-region'/>
<separator/>
<menuitem action='reverse-region'/>
<menuitem action='monoize-region'/>
<menuitem action='normalize-region'/>
<menuitem action='boost-region-gain'/>
<menuitem action='cut-region-gain'/>
<menuitem action='pitch-shift-region'/>
<menuitem action='play-selected-regions'/>
<menuitem action='export-region'/>
<menuitem action='bounce-region'/>
<menuitem action='analyze-region'/>
<menuitem action='toggle-region-lock'/>
<menuitem action='toggle-region-lock-style'/>
<menuitem action='toggle-opaque-region'/>
<menuitem action='toggle-selected-region-fade-in'/>
<menuitem action='toggle-selected-region-fade-out'/>
<menuitem action='toggle-selected-region-fades'/>
<separator/>
<menuitem action='duplicate-region'/>
<menuitem action='multi-duplicate-region'/>
<menuitem action='region-fill-track'/>
<separator/>
<menuitem action='toggle-region-mute'/>
<menuitem action='pitch-shift-region'/>
<menuitem action='naturalize-region'/>
<menuitem action='split-region'/>
<menuitem action='split-multichannel-region'/>
<menuitem action='remove-region'/>
<menuitem action='loop-region'/>
<menuitem action='set-loop-from-region'/>
<menuitem action='set-punch-from-region'/>
<menuitem action='add-range-marker-from-region'/>
<menuitem action='add-range-markers-from-region'/>
<separator/>
<menuitem action='snap-regions-to-grid'/>
<menuitem action='close-region-gaps'/>
<separator/>
<menuitem action='place-transient' />
<menuitem action='toggle-rhythm-ferret'/>
<menuitem action='show-rhythm-ferret'/>
<menuitem action='strip-region-silence'/>
<menuitem action='reverse-region'/>
<menu action='RegionMenuLayering'>
<menuitem action='raise-region-to-top'/>
<menuitem action='raise-region'/>
<menuitem action='lower-region'/>
<menuitem action='lower-region-to-bottom'/>
</menu>
<menu action='RegionMenuMIDI'>
<menuitem action='quantize-region'/>
<menuitem action='fork-region'/>
<menuitem action='show-region-list-editor'/>
</menu>
<menu action='RegionMenuGain'>
<menuitem action='boost-region-gain'/>
<menuitem action='cut-region-gain'/>
<menuitem action='reset-region-gain-envelopes'/>
<menuitem action='toggle-region-gain-envelope-visible'/>
<menuitem action='toggle-region-gain-envelope-active'/>
<menuitem action='normalize-region'/>
</menu>
<menu action='RegionMenuNudge'>
<menuitem action='nudge-forward'/>
<menuitem action='nudge-backward'/>
<menuitem action='nudge-forward-by-capture-offset'/>
<menuitem action='nudge-backward-by-capture-offset'/>
</menu>
<menu action='RegionMenuTrim'>
<menuitem action='trim-front'/>
<menuitem action='trim-back'/>
<menuitem action='trim-region-to-loop'/>
<menuitem action='trim-region-to-punch'/>
</menu>
<menu action='RegionMenuRanges'>
<menuitem action='set-loop-from-region'/>
<menuitem action='set-punch-from-region'/>
<menuitem action='add-range-marker-from-region'/>
<menuitem action='add-range-markers-from-region'/>
<menuitem action='set-selection-from-region'/>
</menu>
<menu action='RegionMenuFades'>
<menuitem action='toggle-region-fade-in'/>
<menuitem action='toggle-region-fade-out'/>
<menuitem action='toggle-region-fades'/>
</menu>
<menu action='RegionMenuDuplicate'>
<menuitem action='duplicate-region'/>
<menuitem action='multi-duplicate-region'/>
<menuitem action='region-fill-track'/>
</menu>
</menu>
<menu action='TrackMenu'>
@ -535,4 +557,81 @@
<separator/>
<menuitem action='addExternalAudioToRegionList'/>
</popup>
<popup name='PopupRegionMenu' action='PopupRegionMenu'>
<menuitem action='rename-region'/>
<menuitem action='show-region-properties'/>
<menuitem action='set-region-sync-position'/>
<menuitem action='remove-region-sync'/>
<menuitem action='play-selected-regions'/>
<menuitem action='export-region'/>
<menuitem action='bounce-region'/>
<menuitem action='analyze-region'/>
<menuitem action='toggle-region-lock'/>
<menuitem action='toggle-region-lock-style'/>
<menuitem action='toggle-opaque-region'/>
<menuitem action='toggle-region-mute'/>
<menuitem action='pitch-shift-region'/>
<menuitem action='naturalize-region'/>
<menuitem action='split-region'/>
<menuitem action='split-multichannel-region'/>
<menuitem action='remove-region'/>
<menuitem action='loop-region'/>
<menuitem action='snap-regions-to-grid'/>
<menuitem action='close-region-gaps'/>
<menuitem action='place-transient' />
<menuitem action='show-rhythm-ferret'/>
<menuitem action='strip-region-silence'/>
<menuitem action='reverse-region'/>
<menu action='RegionMenuLayering'>
<menuitem action='raise-region-to-top'/>
<menuitem action='raise-region'/>
<menuitem action='lower-region'/>
<menuitem action='lower-region-to-bottom'/>
</menu>
<menu action='RegionMenuMIDI'>
<menuitem action='quantize-region'/>
<menuitem action='fork-region'/>
<menuitem action='show-region-list-editor'/>
</menu>
<menu action='RegionMenuGain'>
<menuitem action='boost-region-gain'/>
<menuitem action='cut-region-gain'/>
<menuitem action='reset-region-gain-envelopes'/>
<menuitem action='toggle-region-gain-envelope-visible'/>
<menuitem action='toggle-region-gain-envelope-active'/>
<menuitem action='normalize-region'/>
</menu>
<menu action='RegionMenuNudge'>
<menuitem action='nudge-forward'/>
<menuitem action='nudge-backward'/>
<menuitem action='nudge-forward-by-capture-offset'/>
<menuitem action='nudge-backward-by-capture-offset'/>
</menu>
<menu action='RegionMenuTrim'>
<menuitem action='trim-front'/>
<menuitem action='trim-back'/>
<menuitem action='trim-region-to-loop'/>
<menuitem action='trim-region-to-punch'/>
</menu>
<menu action='RegionMenuRanges'>
<menuitem action='set-loop-from-region'/>
<menuitem action='set-punch-from-region'/>
<menuitem action='add-range-marker-from-region'/>
<menuitem action='add-range-markers-from-region'/>
<menuitem action='set-selection-from-region'/>
</menu>
<menu action='RegionMenuFades'>
<menuitem action='toggle-region-fade-in'/>
<menuitem action='toggle-region-fade-out'/>
<menuitem action='toggle-region-fades'/>
</menu>
<menu action='RegionMenuDuplicate'>
<menuitem action='duplicate-region'/>
<menuitem action='multi-duplicate-region'/>
<menuitem action='region-fill-track'/>
</menu>
</popup>
</ui>

View File

@ -735,6 +735,9 @@ Editor::Editor ()
TimeAxisView::CatchDeletion.connect (*this, invalidator (*this), ui_bind (&Editor::timeaxisview_deleted, this, _1), gui_context());
_ignore_region_action = false;
_popup_region_menu_item = 0;
constructed = true;
instant_save ();
@ -786,6 +789,10 @@ Editor::catch_vanishing_regionview (RegionView *rv)
if (entered_regionview == rv) {
set_entered_regionview (0);
}
if (!_all_region_actions_sensitized) {
sensitize_all_region_actions (true);
}
}
void
@ -802,6 +809,13 @@ Editor::set_entered_regionview (RegionView* rv)
if ((entered_regionview = rv) != 0) {
entered_regionview->entered (internal_editing ());
}
if (!_all_region_actions_sensitized) {
/* This RegionView entry might have changed what region actions
are allowed, so sensitize them all in case a key is pressed.
*/
sensitize_all_region_actions (true);
}
}
void
@ -1079,9 +1093,6 @@ Editor::set_session (Session *t)
compute_fixed_ruler_scale ();
/* there are never any selected regions at startup */
sensitize_the_right_region_actions (false);
XMLNode* node = ARDOUR_UI::instance()->editor_settings();
set_state (*node, Stateful::loading_state_version);
@ -1187,9 +1198,22 @@ Editor::set_session (Session *t)
/* register for undo history */
_session->register_with_memento_command_factory(_id, this);
ActionManager::ui_manager->signal_pre_activate().connect (sigc::mem_fun (*this, &Editor::action_pre_activated));
start_updating_meters ();
}
void
Editor::action_pre_activated (Glib::RefPtr<Action> const & a)
{
if (a->get_name() == "RegionMenu") {
/* When the region menu is opened, we setup the actions so that they look right
in the menu.
*/
sensitize_the_right_region_actions ();
}
}
void
Editor::build_cursors ()
{
@ -1614,24 +1638,7 @@ Editor::build_track_region_context_menu (framepos_t frame)
if ((tr = rtv->track()) && ((pl = tr->playlist())) && !internal_editing()) {
framepos_t framepos = (framepos_t) floor ((double)frame * tr->speed());
uint32_t regions_at = pl->count_regions_at (framepos);
list<boost::shared_ptr<Region> > regions_for_menu;
if (selection->regions.size() > 1) {
// there's already a multiple selection: just add a
// single region context menu that will act on all
// selected regions
for (RegionSelection::iterator i = selection->regions.begin(); i != selection->regions.end(); ++i) {
regions_for_menu.push_back ((*i)->region ());
}
} else {
boost::shared_ptr<Region> top_region = pl->top_region_at (framepos);
if (top_region) {
regions_for_menu.push_back (top_region);
}
}
add_region_context_items (rtv->view(), regions_for_menu, edit_items, framepos, regions_at > 1);
add_region_context_items (edit_items, regions_at > 1);
}
}
@ -1668,24 +1675,7 @@ Editor::build_track_crossfade_context_menu (framepos_t frame)
framepos_t framepos = (framepos_t) floor ((double)frame * tr->speed());
uint32_t regions_at = pl->count_regions_at (framepos);
list<boost::shared_ptr<Region> > regions_for_menu;
if (selection->regions.size() > 1) {
// there's already a multiple selection: just add a
// single region context menu that will act on all
// selected regions
for (RegionSelection::iterator i = selection->regions.begin(); i != selection->regions.end(); ++i) {
regions_for_menu.push_back ((*i)->region ());
}
} else {
boost::shared_ptr<Region> top_region = pl->top_region_at (framepos);
if (top_region) {
regions_for_menu.push_back (top_region);
}
}
add_region_context_items (atv->audio_view(), regions_for_menu, edit_items, framepos, regions_at > 1);
add_region_context_items (edit_items, regions_at > 1);
}
}
@ -1695,7 +1685,7 @@ Editor::build_track_crossfade_context_menu (framepos_t frame)
}
void
Editor::analyze_region_selection()
Editor::analyze_region_selection ()
{
if (analysis_window == 0) {
analysis_window = new AnalysisWindow();
@ -1805,294 +1795,10 @@ Editor::xfade_edit_right_region ()
}
void
Editor::add_region_context_items (StreamView* sv, list<boost::shared_ptr<Region> > regions, Menu_Helpers::MenuList& edit_items,
framepos_t position, bool multiple_regions_at_position)
Editor::add_region_context_items (Menu_Helpers::MenuList& edit_items, bool multiple_regions_at_position)
{
using namespace Menu_Helpers;
Gtk::MenuItem* foo_item;
Menu *region_menu = manage (new Menu);
MenuList& items = region_menu->items();
region_menu->set_name ("ArdourContextMenu");
/* Look through the regions that we are handling and make notes about what we have got */
bool have_audio = false;
bool have_midi = false;
bool have_locked = false;
bool have_unlocked = false;
bool have_position_lock_style_audio = false;
bool have_position_lock_style_music = false;
bool have_muted = false;
bool have_unmuted = false;
bool have_opaque = false;
bool have_non_opaque = false;
bool have_not_at_natural_position = false;
bool have_envelope_visible = false;
bool have_envelope_invisible = false;
bool have_envelope_active = false;
bool have_envelope_inactive = false;
bool have_non_unity_scale_amplitude = false;
for (list<boost::shared_ptr<Region> >::const_iterator i = regions.begin(); i != regions.end(); ++i) {
boost::shared_ptr<AudioRegion> ar = boost::dynamic_pointer_cast<AudioRegion> (*i);
if (ar) {
have_audio = true;
}
if (boost::dynamic_pointer_cast<MidiRegion> (*i)) {
have_midi = true;
}
if ((*i)->locked()) {
have_locked = true;
} else {
have_unlocked = true;
}
if ((*i)->position_lock_style() == MusicTime) {
have_position_lock_style_music = true;
} else {
have_position_lock_style_audio = true;
}
if ((*i)->muted()) {
have_muted = true;
} else {
have_unmuted = true;
}
if ((*i)->opaque()) {
have_opaque = true;
} else {
have_non_opaque = true;
}
if (!(*i)->at_natural_position()) {
have_not_at_natural_position = true;
}
if (ar) {
/* its a bit unfortunate that "envelope visible" is a view-only
property. we have to find the regionview to able to check
its current setting.
*/
RegionView* rv = sv->find_view (ar);
have_envelope_invisible = true;
if (rv) {
AudioRegionView* arv = dynamic_cast<AudioRegionView*> (rv);
if (arv && arv->envelope_visible()) {
have_envelope_visible = true;
}
}
if (ar->envelope_active()) {
have_envelope_active = true;
} else {
have_envelope_inactive = true;
}
if (ar->scale_amplitude() != 1) {
have_non_unity_scale_amplitude = true;
}
}
}
if (regions.size() == 1) {
/* when this particular menu pops up, make the relevant region
become selected.
*/
region_menu->signal_map_event().connect (
sigc::bind (sigc::mem_fun(*this, &Editor::set_selected_regionview_from_map_event), sv, boost::weak_ptr<Region> (regions.front()))
);
items.push_back (MenuElem (_("Rename..."), sigc::mem_fun(*this, &Editor::rename_region)));
if (have_midi) {
items.push_back (MenuElem (_("List Editor..."), sigc::mem_fun(*this, &Editor::show_midi_list_editor)));
}
items.push_back (MenuElem (_("Region Properties..."), sigc::mem_fun(*this, &Editor::edit_region)));
}
items.push_back (MenuElem (_("Raise to Top Layer"), sigc::mem_fun(*this, &Editor::raise_region_to_top)));
items.push_back (MenuElem (_("Lower to Bottom Layer"), sigc::mem_fun (*this, &Editor::lower_region_to_bottom)));
items.push_back (SeparatorElem());
items.push_back (MenuElem (_("Define Sync Point"), sigc::mem_fun(*this, &Editor::set_region_sync_from_edit_point)));
if (_edit_point == EditAtMouse) {
items.back ().set_sensitive (false);
}
items.push_back (MenuElem (_("Remove Sync Point"), sigc::mem_fun(*this, &Editor::remove_region_sync)));
items.push_back (SeparatorElem());
items.push_back (MenuElem (_("Audition"), sigc::mem_fun(*this, &Editor::play_selected_region)));
items.push_back (MenuElem (_("Export..."), sigc::mem_fun(*this, &Editor::export_region)));
items.push_back (MenuElem (_("Bounce"), sigc::mem_fun(*this, &Editor::bounce_region_selection)));
if (have_audio) {
items.push_back (MenuElem (_("Spectral Analysis..."), sigc::mem_fun(*this, &Editor::analyze_region_selection)));
}
items.push_back (SeparatorElem());
items.push_back (CheckMenuElem (_("Lock")));
CheckMenuItem* region_lock_item = static_cast<CheckMenuItem*>(&items.back());
if (have_locked && !have_unlocked) {
region_lock_item->set_active();
} else if (have_locked && have_unlocked) {
region_lock_item->set_inconsistent ();
}
region_lock_item->signal_activate().connect (sigc::mem_fun(*this, &Editor::toggle_region_lock));
items.push_back (CheckMenuElem (_("Glue to Bars and Beats")));
CheckMenuItem* bbt_glue_item = static_cast<CheckMenuItem*>(&items.back());
if (have_position_lock_style_music && !have_position_lock_style_audio) {
bbt_glue_item->set_active ();
} else if (have_position_lock_style_music && have_position_lock_style_audio) {
bbt_glue_item->set_inconsistent ();
}
bbt_glue_item->signal_activate().connect (sigc::mem_fun (*this, &Editor::toggle_region_lock_style));
items.push_back (CheckMenuElem (_("Mute")));
CheckMenuItem* region_mute_item = static_cast<CheckMenuItem*>(&items.back());
if (have_muted && !have_unmuted) {
region_mute_item->set_active();
} else if (have_muted && have_unmuted) {
region_mute_item->set_inconsistent ();
}
region_mute_item->signal_activate().connect (sigc::mem_fun(*this, &Editor::toggle_region_mute));
items.push_back (MenuElem (_("Transpose..."), mem_fun(*this, &Editor::pitch_shift_regions)));
if (!Profile->get_sae()) {
items.push_back (CheckMenuElem (_("Opaque")));
CheckMenuItem* region_opaque_item = static_cast<CheckMenuItem*>(&items.back());
if (have_opaque && !have_non_opaque) {
region_opaque_item->set_active();
} else if (have_opaque && have_non_opaque) {
region_opaque_item->set_inconsistent ();
}
region_opaque_item->signal_activate().connect (sigc::mem_fun(*this, &Editor::toggle_region_opaque));
}
items.push_back (CheckMenuElem (_("Original Position"), sigc::mem_fun(*this, &Editor::naturalize)));
if (!have_not_at_natural_position) {
items.back().set_sensitive (false);
}
items.push_back (SeparatorElem());
if (have_audio) {
if (!Profile->get_sae()) {
items.push_back (MenuElem (_("Reset Envelope"), sigc::mem_fun(*this, &Editor::reset_region_gain_envelopes)));
items.push_back (CheckMenuElem (_("Envelope Visible")));
CheckMenuItem* region_envelope_visible_item = static_cast<CheckMenuItem*> (&items.back());
if (have_envelope_visible && !have_envelope_invisible) {
region_envelope_visible_item->set_active ();
} else if (have_envelope_visible && have_envelope_invisible) {
region_envelope_visible_item->set_inconsistent ();
}
region_envelope_visible_item->signal_activate().connect (sigc::mem_fun(*this, &Editor::toggle_gain_envelope_visibility));
items.push_back (CheckMenuElem (_("Envelope Active")));
CheckMenuItem* region_envelope_active_item = static_cast<CheckMenuItem*> (&items.back());
if (have_envelope_active && !have_envelope_inactive) {
region_envelope_active_item->set_active ();
} else if (have_envelope_active && have_envelope_inactive) {
region_envelope_active_item->set_inconsistent ();
}
region_envelope_active_item->signal_activate().connect (sigc::mem_fun(*this, &Editor::toggle_gain_envelope_active));
items.push_back (SeparatorElem());
}
items.push_back (MenuElem (_("Normalize..."), sigc::mem_fun(*this, &Editor::normalize_region)));
if (have_non_unity_scale_amplitude) {
items.push_back (MenuElem (_("Reset Gain"), sigc::mem_fun(*this, &Editor::reset_region_scale_amplitude)));
}
} else if (have_midi) {
items.push_back (MenuElem (_("Quantize"), sigc::mem_fun(*this, &Editor::quantize_region)));
items.push_back (MenuElem (_("Fork"), sigc::mem_fun(*this, &Editor::fork_region)));
items.push_back (SeparatorElem());
}
items.push_back (MenuElem (_("Strip Silence..."), sigc::mem_fun (*this, &Editor::strip_region_silence)));
items.push_back (MenuElem (_("Reverse"), sigc::mem_fun(*this, &Editor::reverse_region)));
items.push_back (SeparatorElem());
/* range related stuff */
items.push_back (MenuElem (_("Add Single Range"), sigc::mem_fun (*this, &Editor::add_location_from_audio_region)));
items.push_back (MenuElem (_("Add Range Markers"), sigc::mem_fun (*this, &Editor::add_locations_from_audio_region)));
if (selection->regions.size() < 2) {
items.back().set_sensitive (false);
}
items.push_back (MenuElem (_("Set Range Selection"), sigc::mem_fun (*this, &Editor::set_selection_from_region)));
items.push_back (SeparatorElem());
/* Nudge region */
Menu *nudge_menu = manage (new Menu());
MenuList& nudge_items = nudge_menu->items();
nudge_menu->set_name ("ArdourContextMenu");
nudge_items.push_back (MenuElem (_("Nudge Forward"), (sigc::bind (sigc::mem_fun(*this, &Editor::nudge_forward), false, false))));
nudge_items.push_back (MenuElem (_("Nudge Backward"), (sigc::bind (sigc::mem_fun(*this, &Editor::nudge_backward), false, false))));
nudge_items.push_back (MenuElem (_("Nudge Forward by Capture Offset"), (sigc::mem_fun(*this, &Editor::nudge_forward_capture_offset))));
nudge_items.push_back (MenuElem (_("Nudge Backward by Capture Offset"), (sigc::mem_fun(*this, &Editor::nudge_backward_capture_offset))));
items.push_back (MenuElem (_("Nudge"), *nudge_menu));
items.push_back (SeparatorElem());
Menu *trim_menu = manage (new Menu);
MenuList& trim_items = trim_menu->items();
trim_menu->set_name ("ArdourContextMenu");
trim_items.push_back (MenuElem (_("Start to Edit Point"), sigc::mem_fun(*this, &Editor::trim_region_from_edit_point)));
foo_item = &trim_items.back();
if (_edit_point == EditAtMouse) {
foo_item->set_sensitive (false);
}
trim_items.push_back (MenuElem (_("Edit Point to End"), sigc::mem_fun(*this, &Editor::trim_region_to_edit_point)));
foo_item = &trim_items.back();
if (_edit_point == EditAtMouse) {
foo_item->set_sensitive (false);
}
trim_items.push_back (MenuElem (_("Trim to Loop"), sigc::mem_fun(*this, &Editor::trim_region_to_loop)));
trim_items.push_back (MenuElem (_("Trim to Punch"), sigc::mem_fun(*this, &Editor::trim_region_to_punch)));
items.push_back (MenuElem (_("Trim"), *trim_menu));
items.push_back (SeparatorElem());
items.push_back (MenuElem (_("Split"), (sigc::mem_fun(*this, &Editor::split))));
region_edit_menu_split_item = &items.back();
if (_edit_point == EditAtMouse) {
region_edit_menu_split_item->set_sensitive (false);
}
if (have_audio) {
items.push_back (MenuElem (_("Make Mono Regions"), (sigc::mem_fun(*this, &Editor::split_multichannel_region))));
region_edit_menu_split_multichannel_item = &items.back();
}
items.push_back (MenuElem (_("Duplicate"), (sigc::bind (sigc::mem_fun(*this, &Editor::duplicate_dialog), false))));
items.push_back (MenuElem (_("Multi-Duplicate..."), (sigc::bind (sigc::mem_fun(*this, &Editor::duplicate_dialog), true))));
items.push_back (MenuElem (_("Fill Track"), (sigc::mem_fun(*this, &Editor::region_fill_track))));
items.push_back (SeparatorElem());
items.push_back (MenuElem (_("Remove"), sigc::mem_fun(*this, &Editor::remove_selected_regions)));
/* OK, stick the region submenu at the top of the list, and then add
the standard items.
*/
@ -2101,17 +1807,27 @@ Editor::add_region_context_items (StreamView* sv, list<boost::shared_ptr<Region>
meaning for menu titles.
*/
RegionSelection rs = get_regions_from_selection_and_entered ();
string::size_type pos = 0;
string menu_item_name = (regions.size() == 1) ? regions.front()->name() : _("Selected Regions");
string menu_item_name = (rs.size() == 1) ? rs.front()->region()->name() : _("Selected Regions");
while ((pos = menu_item_name.find ("_", pos)) != string::npos) {
menu_item_name.replace (pos, 1, "__");
pos += 2;
}
edit_items.push_back (MenuElem (menu_item_name, *region_menu));
if (_popup_region_menu_item == 0) {
_popup_region_menu_item = new MenuItem (menu_item_name);
_popup_region_menu_item->set_submenu (*dynamic_cast<Menu*> (ActionManager::get_widget (X_("/PopupRegionMenu"))));
_popup_region_menu_item->show ();
} else {
_popup_region_menu_item->set_label (menu_item_name);
}
edit_items.push_back (*_popup_region_menu_item);
if (multiple_regions_at_position && (layering_order_editor == 0 || !layering_order_editor->is_visible ())) {
edit_items.push_back (MenuElem (_("Choose Top Region..."), (bind (mem_fun(*this, &Editor::change_region_layering_order), position))));
edit_items.push_back (action_menu_item ("choose-top-region"));
}
edit_items.push_back (SeparatorElem());
}
@ -2179,7 +1895,7 @@ Editor::add_dstream_context_items (Menu_Helpers::MenuList& edit_items)
play_items.push_back (MenuElem (_("Play From Start"), sigc::mem_fun(*this, &Editor::play_from_start)));
play_items.push_back (MenuElem (_("Play Region"), sigc::mem_fun(*this, &Editor::play_selected_region)));
play_items.push_back (SeparatorElem());
play_items.push_back (MenuElem (_("Loop Region"), sigc::mem_fun(*this, &Editor::loop_selected_region)));
play_items.push_back (MenuElem (_("Loop Region"), sigc::bind (sigc::mem_fun (*this, &Editor::set_loop_from_region), true)));
edit_items.push_back (MenuElem (_("Play"), *play_menu));
@ -2219,8 +1935,8 @@ Editor::add_dstream_context_items (Menu_Helpers::MenuList& edit_items)
cutnpaste_items.push_back (SeparatorElem());
cutnpaste_items.push_back (MenuElem (_("Align"), sigc::bind (sigc::mem_fun(*this, &Editor::align), ARDOUR::SyncPoint)));
cutnpaste_items.push_back (MenuElem (_("Align Relative"), sigc::bind (sigc::mem_fun(*this, &Editor::align_relative), ARDOUR::SyncPoint)));
cutnpaste_items.push_back (MenuElem (_("Align"), sigc::bind (sigc::mem_fun (*this, &Editor::align_regions), ARDOUR::SyncPoint)));
cutnpaste_items.push_back (MenuElem (_("Align Relative"), sigc::bind (sigc::mem_fun (*this, &Editor::align_regions_relative), ARDOUR::SyncPoint)));
edit_items.push_back (MenuElem (_("Edit"), *cutnpaste_menu));
@ -3529,13 +3245,10 @@ Editor::duplicate_dialog (bool with_dialog)
}
}
RegionSelection rs = get_regions_for_action ();
RegionSelection rs = get_regions_from_selection_and_entered ();
if (mouse_mode != MouseRange) {
if (rs.empty()) {
return;
}
if (mouse_mode != MouseRange && rs.empty()) {
return;
}
if (with_dialog) {
@ -4928,8 +4641,6 @@ Editor::get_regions_after (RegionSelection& rs, framepos_t where, const TrackVie
}
/** Get regions using the following conditions:
* If check_edit_position == false, then return the selected regions.
* Otherwise:
* 1. If the edit point is `mouse':
* if the mouse is over a selected region, or no region, return all selected regions.
* if the mouse is over an unselected region, return just that region.
@ -4945,12 +4656,8 @@ Editor::get_regions_after (RegionSelection& rs, framepos_t where, const TrackVie
*/
RegionSelection
Editor::get_regions_for_action (bool check_edit_point)
Editor::get_regions_from_selection_and_edit_point ()
{
if (!check_edit_point) {
return selection->regions;
}
if (_edit_point == EditAtMouse) {
if (entered_regionview == 0 || selection->regions.contains (entered_regionview)) {
return selection->regions;
@ -4990,6 +4697,19 @@ Editor::get_regions_for_action (bool check_edit_point)
return rs;
}
RegionSelection
Editor::get_regions_from_selection_and_entered ()
{
RegionSelection rs = selection->regions;
if (rs.empty() && entered_regionview) {
rs.add (entered_regionview);
}
return rs;
}
void
Editor::get_regions_corresponding_to (boost::shared_ptr<Region> region, vector<RegionView*>& regions)
{
@ -5700,8 +5420,10 @@ Editor::show_editor_list (bool yn)
}
void
Editor::change_region_layering_order (framepos_t position)
Editor::change_region_layering_order ()
{
framepos_t const position = get_preferred_edit_position ();
if (!clicked_routeview) {
if (layering_order_editor) {
layering_order_editor->hide ();
@ -5730,10 +5452,10 @@ Editor::change_region_layering_order (framepos_t position)
}
void
Editor::update_region_layering_order_editor (framepos_t frame)
Editor::update_region_layering_order_editor ()
{
if (layering_order_editor && layering_order_editor->is_visible ()) {
change_region_layering_order (frame);
change_region_layering_order ();
}
}
@ -5753,3 +5475,10 @@ Editor::setup_fade_images ()
_fade_out_images[FadeSlow] = new Gtk::Image (get_icon_path (X_("crossfade-out-long-cut")));
}
/** @return Gtk::manage()d menu item for a given action from `editor_actions' */
Gtk::MenuItem&
Editor::action_menu_item (std::string const & name)
{
return *manage (editor_actions->get_action(name)->create_menu_item ());
}

View File

@ -371,7 +371,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
/* fades/xfades */
void toggle_selected_region_fades (int dir);
void toggle_region_fades (int dir);
void update_region_fade_visibility ();
bool xfade_visibility() const { return _xfade_visibility; }
void update_xfade_visibility ();
@ -678,10 +678,10 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
Gtk::Menu* build_track_selection_context_menu (framepos_t);
void add_dstream_context_items (Gtk::Menu_Helpers::MenuList&);
void add_bus_context_items (Gtk::Menu_Helpers::MenuList&);
void add_region_context_items (StreamView*, std::list<boost::shared_ptr<ARDOUR::Region> >, Gtk::Menu_Helpers::MenuList&,
ARDOUR::framepos_t, bool);
void add_region_context_items (Gtk::Menu_Helpers::MenuList&, bool);
void add_crossfade_context_items (AudioStreamView*, boost::shared_ptr<ARDOUR::Crossfade>, Gtk::Menu_Helpers::MenuList&, bool many);
void add_selection_context_items (Gtk::Menu_Helpers::MenuList&);
Gtk::MenuItem* _popup_region_menu_item;
void handle_new_route (ARDOUR::RouteList&);
void timeaxisview_deleted (TimeAxisView *);
@ -1050,6 +1050,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
/* KEYMAP HANDLING */
void register_actions ();
void register_region_actions ();
int ensure_cursor (framepos_t* pos);
@ -1066,14 +1067,13 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
/* EDITING OPERATIONS */
void reset_point_selection ();
void toggle_region_mute ();
void toggle_region_lock ();
void toggle_region_opaque ();
void toggle_opaque_region ();
void toggle_record_enable ();
void toggle_region_lock_style ();
void raise_region ();
void raise_region_to_top ();
void change_region_layering_order (ARDOUR::framepos_t);
void change_region_layering_order ();
void lower_region ();
void lower_region_to_bottom ();
void split_regions_at (framepos_t, RegionSelection&);
@ -1082,15 +1082,15 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void crop_region_to_selection ();
void crop_region_to (framepos_t start, framepos_t end);
void set_sync_point (framepos_t, const RegionSelection&);
void set_region_sync_from_edit_point ();
void set_region_sync_position ();
void remove_region_sync();
void align_selection (ARDOUR::RegionPoint, framepos_t position, const RegionSelection&);
void align_selection_relative (ARDOUR::RegionPoint point, framepos_t position, const RegionSelection&);
void align_regions (ARDOUR::RegionPoint);
void align_regions_relative (ARDOUR::RegionPoint point);
void align_region (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, framepos_t position);
void align_region_internal (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, framepos_t position);
void remove_selected_regions ();
void remove_clicked_region ();
void edit_region ();
void show_region_properties ();
void show_midi_list_editor ();
void rename_region ();
void duplicate_some_regions (RegionSelection&, float times);
@ -1105,7 +1105,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void strip_region_silence ();
void normalize_region ();
void reset_region_scale_amplitude ();
void adjust_region_scale_amplitude (bool up);
void adjust_region_gain (bool up);
void quantize_region ();
void fork_region ();
@ -1114,7 +1114,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void tab_to_transient (bool forward);
void use_region_as_bar ();
void set_tempo_from_region ();
void use_range_as_bar ();
void define_one_bar (framepos_t start, framepos_t end);
@ -1123,13 +1123,11 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void hide_region_from_region_list ();
void show_region_in_region_list ();
void align (ARDOUR::RegionPoint);
void align_relative (ARDOUR::RegionPoint);
void naturalize ();
void naturalize_region ();
void reset_focus ();
void split ();
void split_region ();
void cut ();
void copy ();
@ -1143,7 +1141,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
int get_prefix (float&, bool&);
void keyboard_paste ();
void keyboard_insert_region_list_selection ();
void region_from_selection ();
void create_region_from_selection (std::vector<boost::shared_ptr<ARDOUR::Region> >&);
@ -1153,7 +1150,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void play_from_edit_point_and_return ();
void play_selected_region ();
void play_edit_range ();
void loop_selected_region ();
void play_location (ARDOUR::Location&);
void loop_location (ARDOUR::Location&);
@ -1268,8 +1264,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void set_selection_from_region ();
void add_location_mark (framepos_t where);
void add_location_from_audio_region ();
void add_locations_from_audio_region ();
void add_location_from_region ();
void add_locations_from_region ();
void add_location_from_selection ();
void set_loop_from_selection (bool play);
void set_punch_from_selection ();
@ -1322,7 +1318,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void set_fade_out_shape (ARDOUR::FadeShape);
void set_fade_length (bool in);
void toggle_fade_active (bool in);
void set_fade_in_active (bool);
void set_fade_out_active (bool);
@ -1423,7 +1418,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void set_playhead_cursor ();
void kbd_driver (sigc::slot<void,GdkEvent*>, bool use_track_canvas = true, bool use_time_canvas = true, bool can_select = true);
void kbd_mute_unmute_region ();
void toggle_region_mute ();
void kbd_brush ();
void kbd_do_brush (GdkEvent*);
@ -1625,16 +1620,19 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void track_selection_changed ();
void region_selection_changed ();
sigc::connection editor_regions_selection_changed_connection;
void sensitize_the_right_region_actions (bool have_selected_regions);
void sensitize_all_region_actions (bool);
void sensitize_the_right_region_actions ();
bool _all_region_actions_sensitized;
/** Flag to block region action handlers from doing what they normally do;
* I tried Gtk::Action::block_activate() but this doesn't work (ie it doesn't
* block) when setting a ToggleAction's active state.
*/
bool _ignore_region_action;
void point_selection_changed ();
void marker_selection_changed ();
void cancel_selection ();
void region_selection_op (void (ARDOUR::Region::*pmf)(void));
void region_selection_op (void (ARDOUR::Region::*pmf)(void*), void*);
void region_selection_op (void (ARDOUR::Region::*pmf)(bool), bool);
bool audio_region_selection_covers (framepos_t where);
/* transport range select process */
@ -1717,8 +1715,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void trim_region_back();
void trim_region (bool front);
void trim_region_to_edit_point ();
void trim_region_from_edit_point ();
void trim_region_to_loop ();
void trim_region_to_punch ();
void trim_region_to_location (const ARDOUR::Location&, const char* cmd);
@ -1835,7 +1831,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
int time_stretch (RegionSelection&, float fraction);
int pitch_shift (RegionSelection&, float cents);
void pitch_shift_regions ();
void pitch_shift_region ();
int time_fx (RegionSelection&, float val, bool pitching);
/* editor-mixer strip */
@ -1992,7 +1988,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void get_regions_at (RegionSelection&, framepos_t where, const TrackViewList& ts) const;
void get_regions_after (RegionSelection&, framepos_t where, const TrackViewList& ts) const;
RegionSelection get_regions_for_action (bool check_edit_point = true);
RegionSelection get_regions_from_selection_and_edit_point ();
RegionSelection get_regions_from_selection_and_entered ();
void start_updating_meters ();
void stop_updating_meters ();
@ -2052,7 +2049,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
double _last_motion_y;
RegionLayeringOrderEditor* layering_order_editor;
void update_region_layering_order_editor (ARDOUR::framepos_t);
void update_region_layering_order_editor ();
/** Track that was the source for the last cut/copy operation. Used as a place
to paste things iff there is no selected track.
@ -2068,6 +2065,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
std::map<ARDOUR::FadeShape, Gtk::Image*> _fade_in_images;
std::map<ARDOUR::FadeShape, Gtk::Image*> _fade_out_images;
Gtk::MenuItem& action_menu_item (std::string const &);
void action_pre_activated (Glib::RefPtr<Gtk::Action> const &);
friend class Drag;
friend class RegionDrag;
friend class RegionMoveDrag;

View File

@ -63,7 +63,15 @@ Editor::register_actions ()
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_("Layering"), _("Layering"));
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_("KeyMouseActions"), _("Key Mouse"));
@ -75,11 +83,9 @@ Editor::register_actions ()
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_("NudgeRegionMenu"), _("Nudge"));
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_("RegionMenu"), _("Region"));
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"));
@ -99,11 +105,12 @@ Editor::register_actions ()
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_("TrimMenu"), _("Trim"));
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"));
register_region_actions ();
/* add named actions for the editor */
ActionManager::register_action (editor_actions, "escape", _("Break drag or deselect all"), sigc::mem_fun (*this, &Editor::escape));
@ -113,13 +120,6 @@ Editor::register_actions ()
act = ActionManager::register_toggle_action (editor_actions, "show-editor-list", _("Show Editor List"), sigc::mem_fun (*this, &Editor::editor_list_button_toggled));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "toggle-selected-region-fade-in", _("Toggle Region Fade In"), sigc::bind (sigc::mem_fun(*this, &Editor::toggle_selected_region_fades), 1));;
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "toggle-selected-region-fade-out", _("Toggle Region Fade Out"), sigc::bind (sigc::mem_fun(*this, &Editor::toggle_selected_region_fades), -1));;
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "toggle-selected-region-fades", _("Toggle Region Fades"), sigc::bind (sigc::mem_fun(*this, &Editor::toggle_selected_region_fades), 0));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "playhead-to-next-region-boundary", _("Playhead to Next Region Boundary"), sigc::bind (sigc::mem_fun(*this, &Editor::cursor_to_next_region_boundary), true ));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "playhead-to-next-region-boundary-noselection", _("Playhead to Next Region Boundary (No Track Selection)"), sigc::bind (sigc::mem_fun(*this, &Editor::cursor_to_next_region_boundary), false ));
@ -237,12 +237,8 @@ Editor::register_actions ()
act = ActionManager::register_action (editor_actions, "add-location-from-playhead", _("Add Mark from Playhead"), sigc::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"), sigc::bind (sigc::mem_fun(*this, &Editor::nudge_forward), false, false));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "nudge-next-forward", _("Nudge Next Forward"), sigc::bind (sigc::mem_fun(*this, &Editor::nudge_forward), true, false));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "nudge-backward", _("Nudge Backward"), sigc::bind (sigc::mem_fun(*this, &Editor::nudge_backward), false, false));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "nudge-next-backward", _("Nudge Next Backward"), sigc::bind (sigc::mem_fun(*this, &Editor::nudge_backward), true, false));
ActionManager::session_sensitive_actions.push_back (act);
@ -310,88 +306,15 @@ Editor::register_actions ()
act = ActionManager::register_action (editor_actions, "edit-to-playhead", _("Active Mark to Playhead"), sigc::bind (sigc::mem_fun(*this, &Editor::cursor_align), false));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "trim-front", _("Trim Start at Edit Point"), sigc::mem_fun(*this, &Editor::trim_region_front));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "trim-back", _("Trim End at Edit Point"), sigc::mem_fun(*this, &Editor::trim_region_back));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "trim-from-start", _("Start to Edit Point"), sigc::mem_fun(*this, &Editor::trim_region_from_edit_point));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "trim-to-end", _("Edit Point to End"), sigc::mem_fun(*this, &Editor::trim_region_to_edit_point));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "trim-region-to-loop", _("Trim to Loop"), sigc::mem_fun(*this, &Editor::trim_region_to_loop));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "trim-region-to-punch", _("Trim to Punch"), sigc::mem_fun(*this, &Editor::trim_region_to_punch));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "trim-to-previous-region", _("Trim to Previous"), sigc::mem_fun(*this, &Editor::trim_region_to_previous_region_end));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "trim-to-next-region", _("Trim to Next"), sigc::mem_fun(*this, &Editor::trim_region_to_next_region_start));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "set-loop-from-edit-range", _("Set Loop from Edit Range"), sigc::bind (sigc::mem_fun(*this, &Editor::set_loop_from_edit_range), false));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "set-loop-from-region", _("Set Loop from Region"), sigc::bind (sigc::mem_fun(*this, &Editor::set_loop_from_region), false));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "loop-region", _("Loop Region"), sigc::bind (sigc::mem_fun(*this, &Editor::set_loop_from_region), true));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "set-punch-from-edit-range", _("Set Punch from Edit Range"), sigc::mem_fun(*this, &Editor::set_punch_from_edit_range));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "set-punch-from-region", _("Set Punch From Region"), sigc::mem_fun(*this, &Editor::set_punch_from_region));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "pitch-shift-region", _("Transpose"), sigc::mem_fun(*this, &Editor::pitch_shift_regions));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "toggle-opaque-region", _("Toggle Opaque"), sigc::mem_fun(*this, &Editor::toggle_region_opaque));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "add-range-marker-from-region", _("Add 1 Range Marker"), sigc::mem_fun(*this, &Editor::add_location_from_audio_region));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "add-range-markers-from-region", _("Add Range Marker(s)"), sigc::mem_fun(*this, &Editor::add_locations_from_audio_region));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "set-fade-in-length", _("Set Fade In Length"), sigc::bind (sigc::mem_fun(*this, &Editor::set_fade_length), true));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "toggle-fade-in-active", _("Toggle Fade In Active"), sigc::bind (sigc::mem_fun(*this, &Editor::toggle_fade_active), true));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "set-fade-out-length", _("Set Fade Out Length"), sigc::bind (sigc::mem_fun(*this, &Editor::set_fade_length), false));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "toggle-fade-out-active", _("Toggle Fade Out Active"), sigc::bind (sigc::mem_fun(*this, &Editor::toggle_fade_active), false));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "align-regions-start", _("Align Regions Start"), sigc::bind (sigc::mem_fun(*this, &Editor::align), ARDOUR::Start));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "align-regions-start-relative", _("Align Regions Start Relative"), sigc::bind (sigc::mem_fun(*this, &Editor::align_relative), ARDOUR::Start));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "align-regions-end", _("Align Regions End"), sigc::bind (sigc::mem_fun(*this, &Editor::align), ARDOUR::End));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "align-regions-end-relative", _("Align Regions End Relative"), sigc::bind (sigc::mem_fun(*this, &Editor::align_relative), ARDOUR::End));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "align-regions-sync", _("Align Regions Sync"), sigc::bind (sigc::mem_fun(*this, &Editor::align), ARDOUR::SyncPoint));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "align-regions-sync-relative", _("Align Regions Sync Relative"), sigc::bind (sigc::mem_fun(*this, &Editor::align_relative), ARDOUR::SyncPoint));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "play-from-edit-point", _("Play From Edit Point"), sigc::mem_fun(*this, &Editor::play_from_edit_point));
ActionManager::session_sensitive_actions.push_back (act);
@ -399,9 +322,6 @@ Editor::register_actions ()
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "play-edit-range", _("Play Edit Range"), sigc::mem_fun(*this, &Editor::play_edit_range));
act = ActionManager::register_action (editor_actions, "play-selected-regions", _("Play Selected Region(s)"), sigc::mem_fun(*this, &Editor::play_selected_region));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "brush-at-mouse", _("Brush at Mouse"), sigc::mem_fun(*this, &Editor::kbd_brush));
ActionManager::session_sensitive_actions.push_back (act);
@ -410,81 +330,8 @@ Editor::register_actions ()
act = ActionManager::register_action (editor_actions, "set-edit-point", _("Active Marker to Mouse"), sigc::mem_fun(*this, &Editor::set_edit_point));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "duplicate-region", _("Duplicate Region"), sigc::bind (sigc::mem_fun(*this, &Editor::duplicate_dialog), false));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "multi-duplicate-region", _("Multi-Duplicate Region..."), sigc::bind (sigc::mem_fun(*this, &Editor::duplicate_dialog), true));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "duplicate-range", _("Duplicate Range"), sigc::bind (sigc::mem_fun(*this, &Editor::duplicate_dialog), false));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "insert-region", _("Insert Region"), sigc::mem_fun(*this, &Editor::keyboard_insert_region_list_selection));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "normalize-region", _("Normalize Region..."), sigc::mem_fun(*this, &Editor::normalize_region));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "rename-region", _("Rename Region..."), sigc::mem_fun(*this, &Editor::rename_region));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "auto-rename-region", _("Auto-Rename Region"), sigc::mem_fun(*this, &Editor::rename_region));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "boost-region-gain", _("Boost Region Gain"), sigc::bind (sigc::mem_fun(*this, &Editor::adjust_region_scale_amplitude), true));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "cut-region-gain", _("Cut Region Gain"), sigc::bind (sigc::mem_fun(*this, &Editor::adjust_region_scale_amplitude), false));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "split-region", _("Split Region"), sigc::mem_fun(*this, &Editor::split));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "set-region-sync-position", _("Set Region Sync Position"), sigc::mem_fun(*this, &Editor::set_region_sync_from_edit_point));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "remove-region-sync", _("Remove Region Sync"), sigc::mem_fun(*this, &Editor::remove_region_sync));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "raise-region", _("Raise Region"), sigc::mem_fun(*this, &Editor::raise_region));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "lower-region", _("Lower Region"), sigc::mem_fun(*this, &Editor::lower_region));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "export-region", _("Export Region"), sigc::mem_fun(*this, &Editor::export_region));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_toggle_action (editor_actions, "lock-region", _("Lock Region"), sigc::mem_fun(*this, &Editor::toggle_region_lock));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_toggle_action (editor_actions, "glue-region", _("Glue Region to Bars and Beats"), sigc::mem_fun (*this, &Editor::toggle_region_lock_style));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "naturalize-region", _("Move to Original Position"), sigc::mem_fun (*this, &Editor::naturalize));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "reverse-region", _("Reverse"), sigc::mem_fun (*this, &Editor::reverse_region));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "monoize-region", _("Make Mono Regions"), (sigc::mem_fun(*this, &Editor::split_multichannel_region)));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "region-fill-track", _("Fill Track"), (sigc::mem_fun(*this, &Editor::region_fill_track)));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "mute-unmute-region", _("Mute/Unmute Region"), sigc::mem_fun(*this, &Editor::kbd_mute_unmute_region));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "snap-regions-to-grid", _("Snap Regions to Grid"), sigc::mem_fun(*this, &Editor::snap_regions_to_grid));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "close-region-gaps", _("Close Region Gaps"), sigc::mem_fun(*this, &Editor::close_region_gaps));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "place-transient", _("Place Transient"), sigc::mem_fun(*this, &Editor::place_transient));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
undo_action = act = ActionManager::register_action (editor_actions, "undo", _("Undo"), sigc::bind (sigc::mem_fun(*this, &Editor::undo), 1U));
ActionManager::session_sensitive_actions.push_back (act);
@ -496,9 +343,6 @@ Editor::register_actions ()
act = ActionManager::register_action (editor_actions, "export-range", _("Export Range"), sigc::mem_fun(*this, &Editor::export_range));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "separate-under-region", _("Separate Under Selected Regions"), sigc::mem_fun(*this, &Editor::separate_under_selected_regions));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "editor-separate", _("Separate"), sigc::mem_fun(*this, &Editor::separate_region_from_selection));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::mouse_edit_point_requires_canvas_actions.push_back (act);
@ -526,22 +370,9 @@ Editor::register_actions ()
act = ActionManager::register_action (editor_actions, "editor-paste", _("Paste"), sigc::mem_fun(*this, &Editor::keyboard_paste));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "quantize-region", _("Quantize Region"), sigc::mem_fun(*this, &Editor::quantize_region));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "set-tempo-from-region", _("Set Tempo from Region=Bar"), sigc::mem_fun(*this, &Editor::use_region_as_bar));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "set-tempo-from-edit-range", _("Set Tempo from Edit Range=Bar"), sigc::mem_fun(*this, &Editor::use_range_as_bar));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "split-region-at-transients", _("Split Regions At Percussion Onsets"), sigc::mem_fun(*this, &Editor::split_region_at_transients));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "toggle-rhythm-ferret", _("Rhythm Ferret..."), sigc::mem_fun(*this, &Editor::show_rhythm_ferret));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_toggle_action (editor_actions, "toggle-log-window", _("Log"),
sigc::mem_fun (ARDOUR_UI::instance(), &ARDOUR_UI::toggle_errors));
ActionManager::session_sensitive_actions.push_back (act);
@ -1444,3 +1275,281 @@ Editor::toggle_internal_editing ()
set_internal_edit (tact->get_active());
}
}
/* Convenience functions to slightly reduce verbosity below */
static void
reg_sens (RefPtr<ActionGroup> group, char const * name, char const * label, sigc::slot<void> slot)
{
RefPtr<Action> act = ActionManager::register_action (group, name, label, slot);
ActionManager::session_sensitive_actions.push_back (act);
}
static void
toggle_reg_sens (RefPtr<ActionGroup> group, char const * name, char const * label, sigc::slot<void> slot)
{
RefPtr<Action> act = ActionManager::register_toggle_action (group, name, label, slot);
ActionManager::session_sensitive_actions.push_back (act);
}
void
Editor::register_region_actions ()
{
_region_actions = ActionGroup::create (X_("Region"));
/* PART 1: actions that operate on the selection, and for which the edit point type and location is irrelevant */
/* Remove selected regions */
reg_sens (_region_actions, "remove-region", _("Remove"), sigc::mem_fun (*this, &Editor::remove_selected_regions));
/* Offer dialogue box to rename the first selected region */
reg_sens (_region_actions, "rename-region", _("Rename..."), sigc::mem_fun (*this, &Editor::rename_region));
/* Raise all selected regions by 1 layer */
reg_sens (_region_actions, "raise-region", _("Raise"), sigc::mem_fun (*this, &Editor::raise_region));
/* Raise all selected regions to the top */
reg_sens (_region_actions, "raise-region-to-top", _("Raise to Top"), sigc::mem_fun (*this, &Editor::raise_region_to_top));
/* Lower all selected regions by 1 layer */
reg_sens (_region_actions, "lower-region", _("Lower"), sigc::mem_fun (*this, &Editor::lower_region));
/* Lower all selected regions to the bottom */
reg_sens (_region_actions, "lower-region-to-bottom", _("Lower to Bottom"), sigc::mem_fun (*this, &Editor::lower_region_to_bottom));
/* Move selected regions to their original (`natural') position */
reg_sens (_region_actions, "naturalize-region", _("Move to Original Position"), sigc::mem_fun (*this, &Editor::naturalize_region));
/* Toggle `locked' status of selected regions */
toggle_reg_sens (_region_actions, "toggle-region-lock", _("Lock"), sigc::mem_fun(*this, &Editor::toggle_region_lock));
toggle_reg_sens (
_region_actions,
"toggle-region-lock-style",
_("Glue to Bars and Beats"),
sigc::mem_fun (*this, &Editor::toggle_region_lock_style)
);
/* Remove sync points from selected regions */
reg_sens (_region_actions, "remove-region-sync", _("Remove Sync"), sigc::mem_fun(*this, &Editor::remove_region_sync));
/* Mute or unmute selected regions */
toggle_reg_sens (_region_actions, "toggle-region-mute", _("Mute"), sigc::mem_fun(*this, &Editor::toggle_region_mute));
/* Open the normalize dialogue to operate on the selected regions */
reg_sens (_region_actions, "normalize-region", _("Normalize..."), sigc::mem_fun(*this, &Editor::normalize_region));
/* Reverse selected regions */
reg_sens (_region_actions, "reverse-region", _("Reverse"), sigc::mem_fun (*this, &Editor::reverse_region));
/* Split selected multi-channel regions into mono regions */
reg_sens (_region_actions, "split-multichannel-region", _("Make Mono Regions"), sigc::mem_fun (*this, &Editor::split_multichannel_region));
/* Boost selected region gain */
reg_sens (_region_actions, "boost-region-gain", _("Boost Gain"), sigc::bind (sigc::mem_fun(*this, &Editor::adjust_region_gain), true));
/* Cut selected region gain */
reg_sens (_region_actions, "cut-region-gain", _("Cut Gain"), sigc::bind (sigc::mem_fun(*this, &Editor::adjust_region_gain), false));
/* Open the pitch shift dialogue for the selected regions */
reg_sens (_region_actions, "pitch-shift-region", _("Transpose"), sigc::mem_fun (*this, &Editor::pitch_shift_region));
/* Toggle selected region opacity */
toggle_reg_sens (_region_actions, "toggle-opaque-region", _("Opaque"), sigc::mem_fun (*this, &Editor::toggle_opaque_region));
/* Toggle active status of selected regions' fade in */
toggle_reg_sens (
_region_actions, "toggle-region-fade-in", _("Fade In"), sigc::bind (sigc::mem_fun (*this, &Editor::toggle_region_fades), 1)
);
/* Toggle active status of selected regions' fade out */
toggle_reg_sens (
_region_actions, "toggle-region-fade-out", _("Fade Out"), sigc::bind (sigc::mem_fun(*this, &Editor::toggle_region_fades), -1)
);
/* Toggle active status of selected regions' fade in and out */
toggle_reg_sens (
_region_actions, "toggle-region-fades", _("Fades"), sigc::bind (sigc::mem_fun(*this, &Editor::toggle_region_fades), 0)
);
/* Open the dialogue to duplicate selected regions */
reg_sens (_region_actions, "duplicate-region", _("Duplicate"), sigc::bind (sigc::mem_fun (*this, &Editor::duplicate_dialog), false));
/* Open the dialogue to duplicate selected regions multiple times */
reg_sens (
_region_actions,
"multi-duplicate-region",
_("Multi-Duplicate..."),
sigc::bind (sigc::mem_fun(*this, &Editor::duplicate_dialog), true)
);
/* Fill tracks with selected regions */
reg_sens (_region_actions, "region-fill-track", _("Fill Track"), sigc::mem_fun (*this, &Editor::region_fill_track));
/* Set up the loop range from the selected regions */
reg_sens (
_region_actions, "set-loop-from-region", _("Set Loop Range"), sigc::bind (sigc::mem_fun (*this, &Editor::set_loop_from_region), false)
);
/* Set up the loop range from the selected regions, and start playback of it */
reg_sens (_region_actions, "loop-region", _("Loop"), sigc::bind (sigc::mem_fun(*this, &Editor::set_loop_from_region), true));
/* Set the punch range from the selected regions */
reg_sens (_region_actions, "set-punch-from-region", _("Set Punch"), sigc::mem_fun (*this, &Editor::set_punch_from_region));
/* 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)
);
/* 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)
);
/* 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));
/* Close gaps in selected regions */
reg_sens (_region_actions, "close-region-gaps", _("Close Gaps"), sigc::mem_fun (*this, &Editor::close_region_gaps));
/* Open the Rhythm Ferret dialogue for the selected regions */
reg_sens (_region_actions, "show-rhythm-ferret", _("Rhythm Ferret..."), sigc::mem_fun (*this, &Editor::show_rhythm_ferret));
/* Export the first selected region */
reg_sens (_region_actions, "export-region", _("Export..."), sigc::mem_fun (*this, &Editor::export_region));
/* Separate under selected regions: XXX not sure what this does */
reg_sens (
_region_actions,
"separate-under-region",
_("Separate Under"),
sigc::mem_fun (*this, &Editor::separate_under_selected_regions)
);
reg_sens (_region_actions, "set-fade-in-length", _("Set Fade In Length"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_length), true));
reg_sens (_region_actions, "set-fade-out-length", _("Set Fade Out Length"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_length), false));
reg_sens (_region_actions, "set-tempo-from-region", _("Set Tempo from Region = Bar"), sigc::mem_fun (*this, &Editor::set_tempo_from_region));
reg_sens (
_region_actions,
"split-region-at-transients",
_("Split at Percussion Onsets"),
sigc::mem_fun(*this, &Editor::split_region_at_transients)
);
/* Open the list editor dialogue for the selected regions */
reg_sens (_region_actions, "show-region-list-editor", _("List Editor..."), sigc::mem_fun (*this, &Editor::show_midi_list_editor));
/* Open the region properties dialogue for the selected regions */
reg_sens (_region_actions, "show-region-properties", _("Properties..."), sigc::mem_fun (*this, &Editor::show_region_properties));
reg_sens (_region_actions, "play-selected-regions", _("Play"), sigc::mem_fun(*this, &Editor::play_selected_region));
reg_sens (_region_actions, "bounce-region", _("Bounce"), sigc::mem_fun (*this, &Editor::bounce_region_selection));
reg_sens (_region_actions, "analyze-region", _("Spectral Analysis..."), sigc::mem_fun (*this, &Editor::analyze_region_selection));
reg_sens (_region_actions, "reset-region-gain-envelopes", _("Reset Envelope"), sigc::mem_fun (*this, &Editor::reset_region_gain_envelopes));
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",
_("Envelope Active"),
sigc::mem_fun (*this, &Editor::toggle_gain_envelope_active)
);
reg_sens (_region_actions, "quantize-region", _("Quantize"), sigc::mem_fun (*this, &Editor::quantize_region));
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-by-capture-offset",
_("Nudge Forward 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"),
sigc::mem_fun (*this, &Editor::nudge_backward_capture_offset)
);
reg_sens (_region_actions, "trim-region-to-loop", _("Trim to Loop"), sigc::mem_fun (*this, &Editor::trim_region_to_loop));
reg_sens (_region_actions, "trim-region-to-punch", _("Trim to Punch"), sigc::mem_fun (*this, &Editor::trim_region_to_punch));
/* PART 2: actions that are not related to the selection, but for which the edit point type and location is important */
reg_sens (
_region_actions,
"insert-region-from-region-list",
_("Insert Region From Region List"),
sigc::bind (sigc::mem_fun (*this, &Editor::insert_region_list_selection), 1)
);
/* PART 3: actions that operate on the selection and also require the edit point location */
reg_sens (_region_actions, "set-region-sync-position", _("Set Sync Position"), sigc::mem_fun (*this, &Editor::set_region_sync_position));
reg_sens (_region_actions, "place-transient", _("Place Transient"), sigc::mem_fun (*this, &Editor::place_transient));
reg_sens (_region_actions, "split-region", _("Split"), sigc::mem_fun (*this, &Editor::split_region));
reg_sens (_region_actions, "trim-front", _("Trim Start at Edit Point"), sigc::mem_fun (*this, &Editor::trim_region_front));
reg_sens (_region_actions, "trim-back", _("Trim End at Edit Point"), sigc::mem_fun (*this, &Editor::trim_region_back));
reg_sens (
_region_actions,
"align-regions-start",
_("Align Start"),
sigc::bind (sigc::mem_fun(*this, &Editor::align_regions), ARDOUR::Start)
);
reg_sens (
_region_actions,
"align-regions-start-relative",
_("Align Start Relative"),
sigc::bind (sigc::mem_fun (*this, &Editor::align_regions_relative), ARDOUR::Start)
);
reg_sens (_region_actions, "align-regions-end", _("Align End"), sigc::bind (sigc::mem_fun (*this, &Editor::align_regions), ARDOUR::End));
reg_sens (
_region_actions,
"align-regions-end-relative",
_("Align End Relative"),
sigc::bind (sigc::mem_fun(*this, &Editor::align_regions_relative), ARDOUR::End)
);
reg_sens (
_region_actions,
"align-regions-sync",
_("Align Sync"),
sigc::bind (sigc::mem_fun(*this, &Editor::align_regions), ARDOUR::SyncPoint)
);
reg_sens (
_region_actions,
"align-regions-sync-relative",
_("Align Sync Relative"),
sigc::bind (sigc::mem_fun (*this, &Editor::align_regions_relative), ARDOUR::SyncPoint)
);
reg_sens (_region_actions, "choose-top-region", _("Choose Top..."), mem_fun (*this, &Editor::change_region_layering_order));
_all_region_actions_sensitized = true;
ActionManager::add_action_group (_region_actions);
}

View File

@ -78,38 +78,6 @@ Editor::kbd_driver (sigc::slot<void,GdkEvent*> theslot, bool use_track_canvas, b
}
}
void
Editor::kbd_mute_unmute_region ()
{
if (!selection->regions.empty ()) {
if (selection->regions.size() > 1) {
begin_reversible_command (_("mute regions"));
} else {
begin_reversible_command (_("mute region"));
}
for (RegionSelection::iterator i = selection->regions.begin(); i != selection->regions.end(); ++i) {
(*i)->region()->playlist()->clear_changes ();
(*i)->region()->set_muted (!(*i)->region()->muted ());
_session->add_command (new StatefulDiffCommand ((*i)->region()->playlist()));
}
commit_reversible_command ();
} else if (entered_regionview) {
begin_reversible_command (_("mute region"));
entered_regionview->region()->playlist()->clear_changes ();
entered_regionview->region()->set_muted (!entered_regionview->region()->muted());
_session->add_command (new StatefulDiffCommand (entered_regionview->region()->playlist()));
commit_reversible_command();
}
}
void
Editor::kbd_do_brush (GdkEvent *ev)
{

View File

@ -91,12 +91,6 @@ Editor::keyboard_paste ()
paste (1);
}
void
Editor::keyboard_insert_region_list_selection ()
{
insert_region_list_selection (1);
}
int
Editor::get_prefix (float& /*val*/, bool& was_floating)
{

View File

@ -1188,14 +1188,14 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
were_dragging = true;
}
update_region_layering_order_editor (where);
update_region_layering_order_editor ();
/* edit events get handled here */
if (!_drags->active () && Keyboard::is_edit_event (&event->button)) {
switch (item_type) {
case RegionItem:
edit_region ();
show_region_properties ();
break;
case TempoMarkerItem:

File diff suppressed because it is too large Load Diff

View File

@ -26,6 +26,7 @@
#include "ardour/playlist.h"
#include "ardour/route_group.h"
#include "ardour/profile.h"
#include "ardour/midi_region.h"
#include "editor.h"
#include "actions.h"
@ -927,27 +928,208 @@ Editor::time_selection_changed ()
}
}
/** Set all region actions to have a given sensitivity */
void
Editor::sensitize_the_right_region_actions (bool have_selected_regions)
Editor::sensitize_all_region_actions (bool s)
{
for (vector<Glib::RefPtr<Action> >::iterator x = ActionManager::region_selection_sensitive_actions.begin();
x != ActionManager::region_selection_sensitive_actions.end(); ++x) {
Glib::ListHandle<Glib::RefPtr<Action> > all = _region_actions->get_actions ();
string accel_path = (*x)->get_accel_path ();
AccelKey key;
for (Glib::ListHandle<Glib::RefPtr<Action> >::iterator i = all.begin(); i != all.end(); ++i) {
(*i)->set_sensitive (s);
}
/* if there is an accelerator, it should always be sensitive
to allow for keyboard ops on entered regions.
*/
_all_region_actions_sensitized = s;
}
bool known = ActionManager::lookup_entry (accel_path, key);
/** Sensitize region-based actions based on the selection ONLY, ignoring the entered_regionview.
* This method should be called just before displaying a Region menu. When a Region menu is not
* currently being shown, all region actions are sensitized so that hotkey-triggered actions
* on entered_regionviews work without having to check sensitivity every time the selection or
* entered_regionview changes.
*
* This method also sets up toggle action state as appropriate.
*/
void
Editor::sensitize_the_right_region_actions ()
{
RegionSelection rs = get_regions_from_selection_and_entered ();
sensitize_all_region_actions (!rs.empty ());
if (known && ((key.get_key() != GDK_VoidSymbol) && (key.get_key() != 0))) {
(*x)->set_sensitive (true);
_ignore_region_action = true;
/* Look through the regions that are selected and make notes about what we have got */
bool have_audio = false;
bool have_midi = false;
bool have_locked = false;
bool have_unlocked = false;
bool have_position_lock_style_audio = false;
bool have_position_lock_style_music = false;
bool have_muted = false;
bool have_unmuted = false;
bool have_opaque = false;
bool have_non_opaque = false;
bool have_not_at_natural_position = false;
bool have_envelope_visible = false;
bool have_envelope_invisible = false;
bool have_envelope_active = false;
bool have_envelope_inactive = false;
bool have_non_unity_scale_amplitude = false;
for (list<RegionView*>::const_iterator i = rs.begin(); i != rs.end(); ++i) {
boost::shared_ptr<Region> r = (*i)->region ();
boost::shared_ptr<AudioRegion> ar = boost::dynamic_pointer_cast<AudioRegion> (r);
if (ar) {
have_audio = true;
}
if (boost::dynamic_pointer_cast<MidiRegion> (r)) {
have_midi = true;
}
if (r->locked()) {
have_locked = true;
} else {
(*x)->set_sensitive (have_selected_regions);
have_unlocked = true;
}
if (r->position_lock_style() == MusicTime) {
have_position_lock_style_music = true;
} else {
have_position_lock_style_audio = true;
}
if (r->muted()) {
have_muted = true;
} else {
have_unmuted = true;
}
if (r->opaque()) {
have_opaque = true;
} else {
have_non_opaque = true;
}
if (!r->at_natural_position()) {
have_not_at_natural_position = true;
}
if (ar) {
/* its a bit unfortunate that "envelope visible" is a view-only
property. we have to find the regionview to able to check
its current setting.
*/
have_envelope_invisible = true;
if (*i) {
AudioRegionView* arv = dynamic_cast<AudioRegionView*> (*i);
if (arv && arv->envelope_visible()) {
have_envelope_visible = true;
}
}
if (ar->envelope_active()) {
have_envelope_active = true;
} else {
have_envelope_inactive = true;
}
if (ar->scale_amplitude() != 1) {
have_non_unity_scale_amplitude = true;
}
}
}
if (rs.size() > 1) {
_region_actions->get_action("show-region-list-editor")->set_sensitive (false);
_region_actions->get_action("show-region-properties")->set_sensitive (false);
_region_actions->get_action("rename-region")->set_sensitive (false);
} else if (rs.size() == 1) {
_region_actions->get_action("add-range-markers-from-region")->set_sensitive (false);
_region_actions->get_action("close-region-gaps")->set_sensitive (false);
}
if (!have_midi) {
_region_actions->get_action("show-region-list-editor")->set_sensitive (false);
_region_actions->get_action("quantize-region")->set_sensitive (false);
_region_actions->get_action("fork-region")->set_sensitive (false);
}
if (_edit_point == EditAtMouse) {
_region_actions->get_action("set-region-sync-position")->set_sensitive (false);
_region_actions->get_action("trim-front")->set_sensitive (false);
_region_actions->get_action("trim-back")->set_sensitive (false);
_region_actions->get_action("split-region")->set_sensitive (false);
_region_actions->get_action("place-transient")->set_sensitive (false);
}
if (have_audio) {
if (have_envelope_visible && !have_envelope_invisible) {
Glib::RefPtr<ToggleAction>::cast_dynamic (_region_actions->get_action("toggle-region-gain-envelope-visible"))->set_active ();
} else if (have_envelope_visible && have_envelope_invisible) {
// _region_actions->get_action("toggle-region-gain-envelope-visible")->set_inconsistent ();
}
if (have_envelope_active && !have_envelope_inactive) {
Glib::RefPtr<ToggleAction>::cast_dynamic (_region_actions->get_action("toggle-region-gain-envelope-active"))->set_active ();
} else if (have_envelope_active && have_envelope_inactive) {
// _region_actions->get_action("toggle-region-gain-envelope-active")->set_inconsistent ();
}
} else {
_region_actions->get_action("analyze-region")->set_sensitive (false);
_region_actions->get_action("reset-region-gain-envelopes")->set_sensitive (false);
_region_actions->get_action("toggle-region-gain-envelope-visible")->set_sensitive (false);
_region_actions->get_action("toggle-region-gain-envelope-active")->set_sensitive (false);
}
if (!have_non_unity_scale_amplitude || !have_audio) {
_region_actions->get_action("reset-region-scale-amplitude")->set_sensitive (false);
}
Glib::RefPtr<ToggleAction>::cast_dynamic (_region_actions->get_action("toggle-region-lock"))->set_active (have_locked && !have_unlocked);
if (have_locked && have_unlocked) {
// _region_actions->get_action("toggle-region-lock")->set_inconsistent ();
}
Glib::RefPtr<ToggleAction>::cast_dynamic (_region_actions->get_action("toggle-region-lock-style"))->set_active (have_position_lock_style_music && !have_position_lock_style_audio);
if (have_position_lock_style_music && have_position_lock_style_audio) {
// _region_actions->get_action("toggle-region-lock-style")->set_inconsistent ();
}
Glib::RefPtr<ToggleAction>::cast_dynamic (_region_actions->get_action("toggle-region-mute"))->set_active (have_muted && !have_unmuted);
if (have_muted && have_unmuted) {
// _region_actions->get_action("toggle-region-mute")->set_inconsistent ();
}
Glib::RefPtr<ToggleAction>::cast_dynamic (_region_actions->get_action("toggle-opaque-region"))->set_active (have_opaque && !have_non_opaque);
if (have_opaque && have_non_opaque) {
// _region_actions->get_action("toggle-opaque-region")->set_inconsistent ();
}
if (!have_not_at_natural_position) {
_region_actions->get_action("naturalize-region")->set_sensitive (false);
}
/* XXX: should also check that there is a track of the appropriate type for the selected region */
if (_edit_point == EditAtMouse || _regions->get_single_selection() == 0 || selection->tracks.empty()) {
_region_actions->get_action("insert-region-from-region-list")->set_sensitive (false);
} else {
_region_actions->get_action("insert-region-from-region-list")->set_sensitive (true);
}
_ignore_region_action = false;
_all_region_actions_sensitized = false;
}
@ -969,10 +1151,15 @@ Editor::region_selection_changed ()
_regions->set_selected (selection->regions);
}
sensitize_the_right_region_actions (!selection->regions.empty());
_regions->block_change_connection (false);
editor_regions_selection_changed_connection.block(false);
if (!_all_region_actions_sensitized) {
/* This selection change might have changed what region actions
are allowed, so sensitize them all in case a key is pressed.
*/
sensitize_all_region_actions (true);
}
}
void

View File

@ -90,7 +90,7 @@
; (gtk_accel_path "<Actions>/options/OutputAutoConnectMaster" "")
; (gtk_accel_path "<Actions>/JACK/JACKLatency64" "")
(gtk_accel_path "<Actions>/Editor/undo" "<@PRIMARY@>z")
(gtk_accel_path "<Actions>/Editor/insert-region" "i")
(gtk_accel_path "<Actions>/Editor/insert-region-from-region-list" "i")
; (gtk_accel_path "<Actions>/Editor/center-playhead" "")
; (gtk_accel_path "<Actions>/Snap/snap-to-region-start" "")
; (gtk_accel_path "<Actions>/Editor/View" "")
@ -302,7 +302,7 @@
(gtk_accel_path "<Actions>/Editor/temporal-zoom-out" "r")
; (gtk_accel_path "<Actions>/options/UseSoftwareMonitoring" "")
; (gtk_accel_path "<Actions>/Editor/Subframes100" "")
(gtk_accel_path "<Actions>/Editor/mute-unmute-region" "<@SECONDARY@>m")
(gtk_accel_path "<Actions>/Editor/toggle-region-mute" "<@SECONDARY@>m")
(gtk_accel_path "<Actions>/Editor/add-location-from-playhead" "m")
; (gtk_accel_path "<Actions>/options/OutputAutoConnectManual" "")
; (gtk_accel_path "<Actions>/Snap/snap-to-region-sync" "")
@ -317,9 +317,9 @@
; (gtk_accel_path "<Actions>/options/MeterHoldLong" "")
; (gtk_accel_path "<Actions>/Snap/snap-to-seconds" "")
(gtk_accel_path "<Actions>/Editor/set-fade-in-length" "q")
(gtk_accel_path "<Actions>/Editor/toggle-fade-in-active" "<@SECONDARY@>q")
(gtk_accel_path "<Actions>/Editor/toggle-region-fade-in" "<@SECONDARY@>q")
(gtk_accel_path "<Actions>/Editor/set-fade-out-length" "e")
(gtk_accel_path "<Actions>/Editor/toggle-fade-out-active" "<@SECONDARY@>e")
(gtk_accel_path "<Actions>/Editor/toggle-region-fade-out" "<@SECONDARY@>e")
(gtk_accel_path "<Actions>/Editor/trim-from-start" "<@TERTIARY@>braceleft")
(gtk_accel_path "<Actions>/Editor/trim-to-end" "<@TERTIARY@>braceright")
(gtk_accel_path "<Actions>/Editor/trim-front" "a")

View File

@ -107,25 +107,25 @@ This mode provides many different operations on both regions and control points,
@trans|Transport/ToggleRollForgetCapture|<@PRIMARY@>space|stop and destroy
@trans|Transport/record-roll|<@TERTIARY@>space|start recording
@rop|Editor/set-fade-in-length|slash|set fade in length
@rop|Editor/set-fade-out-length|<@PRIMARY@>slash|toggle fade in active
@rop|Editor/toggle-fade-out-active|backslash|set fade out length
@rop|Editor/toggle-fade-out-active|<@PRIMARY@>backslash|toggle fade out active
@rop|Region/set-fade-in-length|slash|set fade in length
@rop|Region/toggle-region-fade-out|<@PRIMARY@>slash|toggle fade in active
@rop|Region/set-fade-out-length|backslash|set fade out length
@rop|Region/toggle-region-fade-out|<@PRIMARY@>backslash|toggle fade out active
@eep|Editor/trim-from-start|<@TERTIARY@>braceleft|trim region start to edit point
@eep|Editor/trim-to-end|<@TERTIARY@>braceright|trim region end to edit point
@eep|Region/trim-from-start|<@TERTIARY@>braceleft|trim region start to edit point
@eep|Region/trim-to-end|<@TERTIARY@>braceright|trim region end to edit point
@eep|Editor/trim-to-previous-region|<@PRIMARY@>j|trim region to end of previous region
@eep|Editor/trim-to-next-region|<@PRIMARY@>k|trim region to start of next region
@ranges|Editor/set-loop-from-edit-range|bracketright|set loop range from edit range
@ranges|Editor/set-loop-from-region|<@SECONDARY@>bracketright|set loop range from region(s)
@ranges|Region/set-loop-from-region|<@SECONDARY@>bracketright|set loop range from region(s)
@ranges|Editor/set-punch-from-edit-range|bracketleft|set punch range from edit range
@ranges|Editor/set-punch-from-region|<@SECONDARY@>bracketleft|set punch range from region(s)
@ranges|Region/set-punch-from-region|<@SECONDARY@>bracketleft|set punch range from region(s)
@rop|Editor/boost-region-gain|asciicircum|increase region gain
@rop|Editor/cut-region-gain|ampersand|reduce region gain
@rop|Region/boost-region-gain|asciicircum|increase region gain
@rop|Region/cut-region-gain|ampersand|reduce region gain
;; letters
;; TOP ROW
@ -134,31 +134,31 @@ This mode provides many different operations on both regions and control points,
;; note that ctrl-w is special and consumed by the keyboard snooper
@rop|Editor/set-edit-point|e|set fade out length
@rop|Region/set-edit-point|e|set fade out length
@select|Editor/select-all-before-edit-cursor|<@PRIMARY@>e|select all before EP
@rop|Editor/export-region|<@PRIMARY@><@LEVEL4@>e|export selected region(s)
@rop|Region/export-region|<@PRIMARY@><@LEVEL4@>e|export selected region(s)
@sess|Main/ExportSession|<@LEVEL4@>e|export session
@select|Editor/select-all-after-edit-cursor|<@PRIMARY@><@TERTIARY@>e|select all after EP
@vis|Editor/show-editor-mixer|<@TERTIARY@>e|toggle editor window mixer
@wvis|Common/goto-editor|<@WINDOW@>e|toggle editor window
@mmode|MouseMode/set-mouse-mode-range|r|range mode
@edit|Editor/redo|<@PRIMARY@>r|redo
@rop|Editor/reverse-region|<@SECONDARY@>r|reverse
@rop|Region/reverse-region|<@SECONDARY@>r|reverse
@trans|Transport/Record|<@TERTIARY@>r|engage record
@mmode|MouseMode/set-mouse-mode-timefx|t|timefx mode
@rop|Editor/pitch-shift-region|<@SECONDARY@>t|transpose
@rop|Region/pitch-shift-region|<@SECONDARY@>t|transpose
@eep|Editor/insert-time|<@PRIMARY@>t|insert time
@mmode|MouseMode/set-mouse-mode-object-range|y|link object/range tools
@select|Editor/select-all-between-cursors|<@PRIMARY@>u|all enclosed by edit range
@select|Editor/select-all-within-cursors|u|all present in edit range
@eep|Editor/insert-region|i|insert from region list
@eep|Region/insert-region-from-region-list|i|insert from region list
@select|Editor/invert-selection|<@TERTIARY@>i|invert selection
@sess|Editor/addExistingAudioFiles|<@SECONDARY@>i|import audio files
@mmode|MouseMode/set-mouse-mode-object|o|object mode
@sess|Main/Open|<@PRIMARY@>o|open an existing session
@sess|Main/Recent|<@PRIMARY@><@TERTIARY@>o|open a recent session
@wvis|Common/ToggleOptionsEditor|<@WINDOW@>o|toggle preferences dialog
@rop|Editor/naturalize-region|<@LEVEL4@>o|move to original position
@rop|Region/naturalize-region|<@LEVEL4@>o|move to original position
@trans|Editor/set-playhead|p|toggle auto-punch status
@select|Editor/select-all-before-playhead|<@PRIMARY@>p|all before playhead
@midi|MIDI/panic|<@SECONDARY@>p|MIDI panic (stop all notes etc)
@ -172,17 +172,17 @@ This mode provides many different operations on both regions and control points,
@aep|Editor/align-regions-sync|<@TERTIARY@>a|align sync points
@aep|Editor/align-regions-start|<@PRIMARY@><@LEVEL4@>a|align start(s)
@aep|Editor/align-regions-start-relative|<@LEVEL4@>a|align start(s) relative
@rop|Editor/split-region|s|split
@rop|Region/split-region|s|split
@sess|Common/Save|<@PRIMARY@>s|save session
@sess|Main/Snapshot|<@PRIMARY@><@TERTIARY@>s|snapshot session
@rop|Editor/duplicate-region|d|duplicate region (once)
@rop|Editor/multi-duplicate-region|<@TERTIARY@>d|duplicate region (multi)
@rop|Region/duplicate-region|d|duplicate region (once)
@rop|Region/multi-duplicate-region|<@TERTIARY@>d|duplicate region (multi)
@select|Editor/select-all-in-punch-range|<@PRIMARY@>d|select all in punch range
@vis|Editor/fit-tracks|f|fit tracks vertically
@trans|Editor/toggle-follow-playhead|<@PRIMARY@>f|toggle playhead tracking
@wvis|Editor/toggle-rhythm-ferret|<@WINDOW@>f|toggle rhythm ferret window
@wvis|Region/show-rhythm-ferret|<@WINDOW@>f|show rhythm ferret window
@mmode|MouseMode/set-mouse-mode-gain|g|region gain mode
@epp|Editor/play-selected-regions|h|play selected region(s)
@epp|Region/play-selected-regions|h|play selected region(s)
@eep|Editor/trim-front|j|trim front
@eep|Editor/trim-back|k|trim back
@wvis|Common/ToggleKeyEditor|<@WINDOW@>k|toggle key bindings editor
@ -200,16 +200,16 @@ This mode provides many different operations on both regions and control points,
@edit|Editor/editor-cut|<@PRIMARY@>x|cut
@edit|Editor/editor-copy|<@PRIMARY@>c|copy
@wvis|Common/ToggleColorManager|<@WINDOW@>c|toggle color manager
@rop|Editor/set-region-sync-position|v|set region sync point
@rop|Region/set-region-sync-position|v|set region sync point
@edit|Editor/editor-paste|<@PRIMARY@>v|paste
@-group|Editor/brush-at-mouse|<@PRIMARY@>b|some text
@trans|Editor/track-record-enable-toggle|<@SECONDARY@>b|toggle track rec-enable
@wvis|Common/ToggleBigClock|<@WINDOW@>b|toggle big clock
@rop|Editor/normalize-region|n|normalize
@rop|Region/normalize-region|n|normalize
@sess|Main/AddTrackBus|<@PRIMARY@><@TERTIARY@>n|add track(s) or bus(ses)
@sess|Main/New|<@PRIMARY@>n|open a new session
@mmode|MouseMode/toggle-internal-edit|m|toggle MIDI note editing
@rop|Editor/mute-unmute-region|<@PRIMARY@>m|mute/unmute
@rop|Region/toggle-region-mute|<@PRIMARY@>m|mute/unmute
@wvis|Common/toggle-editor-mixer-on-top|<@WINDOW@>m|rotate editor \& mixer window
;; arrow keys, navigation etc.
@ -256,13 +256,13 @@ This mode provides many different operations on both regions and control points,
;; keypad
@rop|Editor/nudge-backward|KP_Subtract|nudge backward
@rop|Region/nudge-backward|KP_Subtract|nudge backward
@-group|Editor/nudge-next-backward|<@PRIMARY@>KP_Subtract|some text
@movp|Editor/jump-forward-to-mark|<@PRIMARY@>KP_Right|to next mark
@movp|Editor/jump-backward-to-mark|<@PRIMARY@>KP_Left|to previous mark
@rop|Editor/nudge-forward|KP_Add|nudge forward
@rop|Region/nudge-forward|KP_Add|nudge forward
@-group|Editor/nudge-next-forward|<@PRIMARY@>KP_Add|some text
@-group|Editor/start-range|<@PRIMARY@>KP_Down|some text

View File

@ -293,6 +293,7 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible {
static sigc::signal<void> DropDownKeys;
Glib::RefPtr<Gtk::ActionGroup> editor_actions;
Glib::RefPtr<Gtk::ActionGroup> _region_actions;
virtual void reset_focus () = 0;

View File

@ -330,8 +330,8 @@ RhythmFerret::do_action ()
void
RhythmFerret::do_split_action ()
{
RegionSelection regions = editor.get_regions_for_action ();
RegionSelection& regions (editor.get_selection().regions);
if (regions.empty()) {
return;
}