mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 23:05:04 +01:00
classify all region actions based on how they get a list of regions to operate on; use this in Editor::sensitize_the_right_region_actions()
There are still problems because actions like trim_front() that use the edit point get the edit point with different results than the code that sensitizes actions
This commit is contained in:
parent
2cc94f8880
commit
0a41daa932
5 changed files with 168 additions and 242 deletions
|
|
@ -221,6 +221,13 @@ enum ZoomAxis {
|
|||
Both
|
||||
};
|
||||
|
||||
enum RegionActionTarget {
|
||||
SelectedRegions = 0x1,
|
||||
EnteredRegions = 0x2,
|
||||
EditPointRegions = 0x4,
|
||||
ListSelection = 0x8
|
||||
};
|
||||
|
||||
} // namespace Editing
|
||||
|
||||
#endif // __gtk_ardour_editing_h__
|
||||
|
|
|
|||
|
|
@ -2262,7 +2262,10 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
|
|||
QuantizeDialog* quantize_dialog;
|
||||
MainMenuDisabler* _main_menu_disabler;
|
||||
|
||||
/* private helper functions to help with registering axis */
|
||||
/* private helper functions to help with registering region actions */
|
||||
|
||||
Glib::RefPtr<Gtk::Action> register_region_action (Glib::RefPtr<Gtk::ActionGroup> group, Editing::RegionActionTarget, char const * name, char const * label, sigc::slot<void> slot);
|
||||
void register_toggle_region_action (Glib::RefPtr<Gtk::ActionGroup> group, Editing::RegionActionTarget, char const * name, char const * label, sigc::slot<void> slot);
|
||||
|
||||
Glib::RefPtr<Gtk::Action> reg_sens (Glib::RefPtr<Gtk::ActionGroup> group, char const * name, char const * label, sigc::slot<void> slot);
|
||||
void toggle_reg_sens (Glib::RefPtr<Gtk::ActionGroup> group, char const * name, char const * label, sigc::slot<void> slot);
|
||||
|
|
|
|||
|
|
@ -60,6 +60,24 @@ using Gtkmm2ext::Bindings;
|
|||
|
||||
/* Convenience functions to slightly reduce verbosity below */
|
||||
|
||||
|
||||
RefPtr<Action>
|
||||
Editor::register_region_action (RefPtr<ActionGroup> group, RegionActionTarget tgt, char const * name, char const * label, sigc::slot<void> slot)
|
||||
{
|
||||
RefPtr<Action> act = myactions.register_action (group, name, label, slot);
|
||||
ActionManager::session_sensitive_actions.push_back (act);
|
||||
region_action_map.insert (make_pair<string,RegionAction> (name, RegionAction (act,tgt)));
|
||||
return act;
|
||||
}
|
||||
|
||||
void
|
||||
Editor::register_toggle_region_action (RefPtr<ActionGroup> group, RegionActionTarget tgt, char const * name, char const * label, sigc::slot<void> slot)
|
||||
{
|
||||
RefPtr<Action> act = myactions.register_toggle_action (group, name, label, slot);
|
||||
ActionManager::session_sensitive_actions.push_back (act);
|
||||
region_action_map.insert (make_pair<string,RegionAction> (name, RegionAction (act,tgt)));
|
||||
}
|
||||
|
||||
RefPtr<Action>
|
||||
Editor::reg_sens (RefPtr<ActionGroup> group, char const * name, char const * label, sigc::slot<void> slot)
|
||||
{
|
||||
|
|
@ -1735,271 +1753,184 @@ Editor::register_region_actions ()
|
|||
/* 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));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "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));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "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));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions), "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));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions), "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));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions), "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));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions), "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));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "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-video-lock", _("Lock to Video"), sigc::mem_fun(*this, &Editor::toggle_region_video_lock));
|
||||
|
||||
toggle_reg_sens (
|
||||
_region_actions,
|
||||
"toggle-region-lock-style",
|
||||
_("Glue to Bars and Beats"),
|
||||
sigc::mem_fun (*this, &Editor::toggle_region_lock_style)
|
||||
);
|
||||
register_toggle_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "toggle-region-lock", _("Lock"), sigc::mem_fun(*this, &Editor::toggle_region_lock));
|
||||
register_toggle_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "toggle-region-video-lock", _("Lock to Video"), sigc::mem_fun(*this, &Editor::toggle_region_video_lock));
|
||||
register_toggle_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "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));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "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));
|
||||
register_toggle_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "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));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "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));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "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));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "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));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "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));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "cut-region-gain", _("Cut Gain"), sigc::bind (sigc::mem_fun(*this, &Editor::adjust_region_gain), false));
|
||||
|
||||
/* Open the pitch shift dialogue for any selected audio regions */
|
||||
reg_sens (_region_actions, "pitch-shift-region", _("Pitch Shift..."), sigc::mem_fun (*this, &Editor::pitch_shift_region));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "pitch-shift-region", _("Pitch Shift..."), sigc::mem_fun (*this, &Editor::pitch_shift_region));
|
||||
|
||||
/* Open the transpose dialogue for any selected MIDI regions */
|
||||
reg_sens (_region_actions, "transpose-region", _("Transpose..."), sigc::mem_fun (*this, &Editor::transpose_region));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "transpose-region", _("Transpose..."), sigc::mem_fun (*this, &Editor::transpose_region));
|
||||
|
||||
/* Toggle selected region opacity */
|
||||
toggle_reg_sens (_region_actions, "toggle-opaque-region", _("Opaque"), sigc::mem_fun (*this, &Editor::toggle_opaque_region));
|
||||
register_toggle_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "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)
|
||||
);
|
||||
register_toggle_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "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)
|
||||
);
|
||||
register_toggle_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "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)
|
||||
);
|
||||
register_toggle_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "toggle-region-fades", _("Fades"), sigc::bind (sigc::mem_fun(*this, &Editor::toggle_region_fades), 0));
|
||||
|
||||
/* Duplicate selected regions */
|
||||
reg_sens (_region_actions, "duplicate-region", _("Duplicate"), sigc::bind (sigc::mem_fun (*this, &Editor::duplicate_regions), 1));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "duplicate-region", _("Duplicate"), sigc::bind (sigc::mem_fun (*this, &Editor::duplicate_regions), 1));
|
||||
|
||||
/* 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_range), true)
|
||||
);
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "multi-duplicate-region", _("Multi-Duplicate..."), sigc::bind (sigc::mem_fun(*this, &Editor::duplicate_range), true));
|
||||
|
||||
/* Fill tracks with selected regions */
|
||||
reg_sens (_region_actions, "region-fill-track", _("Fill Track"), sigc::mem_fun (*this, &Editor::region_fill_track));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "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)
|
||||
);
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "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));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "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));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "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 Single Range Marker"), sigc::mem_fun (*this, &Editor::add_location_from_region)
|
||||
);
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "add-range-marker-from-region", _("Add Single Range Marker"), sigc::mem_fun (*this, &Editor::add_location_from_region));
|
||||
|
||||
/* Add a range marker around each selected region */
|
||||
reg_sens (
|
||||
_region_actions, "add-range-markers-from-region", _("Add Range Marker Per Region"), sigc::mem_fun (*this, &Editor::add_locations_from_region)
|
||||
);
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "add-range-markers-from-region", _("Add Range Marker Per Region"), sigc::mem_fun (*this, &Editor::add_locations_from_region));
|
||||
|
||||
/* Snap selected regions to the grid */
|
||||
reg_sens (_region_actions, "snap-regions-to-grid", _("Snap Position to Grid"), sigc::mem_fun (*this, &Editor::snap_regions_to_grid));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "snap-regions-to-grid", _("Snap Position to Grid"), sigc::mem_fun (*this, &Editor::snap_regions_to_grid));
|
||||
|
||||
/* Close gaps in selected regions */
|
||||
reg_sens (_region_actions, "close-region-gaps", _("Close Gaps"), sigc::mem_fun (*this, &Editor::close_region_gaps));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "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));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions), "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));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions), "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)
|
||||
);
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "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, "alternate-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, "alternate-set-fade-out-length", _("Set Fade Out Length"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_length), false));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "set-fade-in-length", _("Set Fade In Length"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_length), true));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "alternate-set-fade-in-length", _("Set Fade In Length"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_length), true));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "set-fade-out-length", _("Set Fade Out Length"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_length), false));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "alternate-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));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "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)
|
||||
);
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "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));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions), "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));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions), "show-region-properties", _("Properties..."), sigc::mem_fun (*this, &Editor::show_region_properties));
|
||||
|
||||
reg_sens (_region_actions, "play-selected-regions", _("Play selected Regions"), sigc::mem_fun(*this, &Editor::play_selected_region));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "play-selected-regions", _("Play selected Regions"), sigc::mem_fun(*this, &Editor::play_selected_region));
|
||||
|
||||
reg_sens (_region_actions, "bounce-regions-processed", _("Bounce (with processing)"), (sigc::bind (sigc::mem_fun (*this, &Editor::bounce_region_selection), true)));
|
||||
reg_sens (_region_actions, "bounce-regions-unprocessed", _("Bounce (without processing)"), (sigc::bind (sigc::mem_fun (*this, &Editor::bounce_region_selection), false)));
|
||||
reg_sens (_region_actions, "combine-regions", _("Combine"), sigc::mem_fun (*this, &Editor::combine_regions));
|
||||
reg_sens (_region_actions, "uncombine-regions", _("Uncombine"), sigc::mem_fun (*this, &Editor::uncombine_regions));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions), "bounce-regions-processed", _("Bounce (with processing)"), (sigc::bind (sigc::mem_fun (*this, &Editor::bounce_region_selection), true)));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions), "bounce-regions-unprocessed", _("Bounce (without processing)"), (sigc::bind (sigc::mem_fun (*this, &Editor::bounce_region_selection), false)));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions), "combine-regions", _("Combine"), sigc::mem_fun (*this, &Editor::combine_regions));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions), "uncombine-regions", _("Uncombine"), sigc::mem_fun (*this, &Editor::uncombine_regions));
|
||||
|
||||
reg_sens (_region_actions, "loudness-analyze-region", _("Loudness Analysis..."), sigc::mem_fun (*this, &Editor::loudness_analyze_region_selection));
|
||||
reg_sens (_region_actions, "spectral-analyze-region", _("Spectral Analysis..."), sigc::mem_fun (*this, &Editor::spectral_analyze_region_selection));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions), "loudness-analyze-region", _("Loudness Analysis..."), sigc::mem_fun (*this, &Editor::loudness_analyze_region_selection));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions), "spectral-analyze-region", _("Spectral Analysis..."), sigc::mem_fun (*this, &Editor::spectral_analyze_region_selection));
|
||||
|
||||
reg_sens (_region_actions, "reset-region-gain-envelopes", _("Reset Envelope"), sigc::mem_fun (*this, &Editor::reset_region_gain_envelopes));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "reset-region-gain-envelopes", _("Reset Envelope"), sigc::mem_fun (*this, &Editor::reset_region_gain_envelopes));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "reset-region-scale-amplitude", _("Reset Gain"), sigc::mem_fun (*this, &Editor::reset_region_scale_amplitude));
|
||||
|
||||
reg_sens (_region_actions, "reset-region-scale-amplitude", _("Reset Gain"), sigc::mem_fun (*this, &Editor::reset_region_scale_amplitude));
|
||||
register_toggle_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "toggle-region-gain-envelope-active", _("Envelope Active"), sigc::mem_fun (*this, &Editor::toggle_gain_envelope_active));
|
||||
|
||||
toggle_reg_sens (
|
||||
_region_actions,
|
||||
"toggle-region-gain-envelope-active",
|
||||
_("Envelope Active"),
|
||||
sigc::mem_fun (*this, &Editor::toggle_gain_envelope_active)
|
||||
);
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "quantize-region", _("Quantize..."), sigc::mem_fun (*this, &Editor::quantize_region));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "legatize-region", _("Legatize"), sigc::bind(sigc::mem_fun (*this, &Editor::legatize_region), false));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "transform-region", _("Transform..."), sigc::mem_fun (*this, &Editor::transform_region));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "remove-overlap", _("Remove Overlap"), sigc::bind(sigc::mem_fun (*this, &Editor::legatize_region), true));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "insert-patch-change", _("Insert Patch Change..."), sigc::bind (sigc::mem_fun (*this, &Editor::insert_patch_change), false));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "insert-patch-change-context", _("Insert Patch Change..."), sigc::bind (sigc::mem_fun (*this, &Editor::insert_patch_change), true));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "fork-region", _("Unlink from other copies"), sigc::mem_fun (*this, &Editor::fork_region));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "strip-region-silence", _("Strip Silence..."), sigc::mem_fun (*this, &Editor::strip_region_silence));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions), "set-selection-from-region", _("Set Range Selection"), sigc::mem_fun (*this, &Editor::set_selection_from_region));
|
||||
|
||||
reg_sens (_region_actions, "quantize-region", _("Quantize..."), sigc::mem_fun (*this, &Editor::quantize_region));
|
||||
reg_sens (_region_actions, "legatize-region", _("Legatize"), sigc::bind(sigc::mem_fun (*this, &Editor::legatize_region), false));
|
||||
reg_sens (_region_actions, "transform-region", _("Transform..."), sigc::mem_fun (*this, &Editor::transform_region));
|
||||
reg_sens (_region_actions, "remove-overlap", _("Remove Overlap"), sigc::bind(sigc::mem_fun (*this, &Editor::legatize_region), true));
|
||||
reg_sens (_region_actions, "insert-patch-change", _("Insert Patch Change..."), sigc::bind (sigc::mem_fun (*this, &Editor::insert_patch_change), false));
|
||||
reg_sens (_region_actions, "insert-patch-change-context", _("Insert Patch Change..."), sigc::bind (sigc::mem_fun (*this, &Editor::insert_patch_change), true));
|
||||
reg_sens (_region_actions, "fork-region", _("Unlink from other copies"), 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));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "nudge-forward", _("Nudge Later"), sigc::bind (sigc::mem_fun (*this, &Editor::nudge_forward), false, false));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "alternate-nudge-forward", _("Nudge Later"), sigc::bind (sigc::mem_fun (*this, &Editor::nudge_forward), false, false));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "nudge-backward", _("Nudge Earlier"), sigc::bind (sigc::mem_fun (*this, &Editor::nudge_backward), false, false));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "alternate-nudge-backward", _("Nudge Earlier"), sigc::bind (sigc::mem_fun (*this, &Editor::nudge_backward), false, false));
|
||||
|
||||
reg_sens (_region_actions, "nudge-forward", _("Nudge Later"), sigc::bind (sigc::mem_fun (*this, &Editor::nudge_forward), false, false));
|
||||
reg_sens (_region_actions, "alternate-nudge-forward", _("Nudge Later"), sigc::bind (sigc::mem_fun (*this, &Editor::nudge_forward), false, false));
|
||||
reg_sens (_region_actions, "nudge-backward", _("Nudge Earlier"), sigc::bind (sigc::mem_fun (*this, &Editor::nudge_backward), false, false));
|
||||
reg_sens (_region_actions, "alternate-nudge-backward", _("Nudge Earlier"), sigc::bind (sigc::mem_fun (*this, &Editor::nudge_backward), false, false));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "sequence-regions", _("Sequence Regions"), sigc::mem_fun (*this, &Editor::sequence_regions));
|
||||
|
||||
reg_sens (_region_actions, "sequence-regions", _("Sequence Regions"), sigc::mem_fun (*this, &Editor::sequence_regions));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "nudge-forward-by-capture-offset", _("Nudge Later by Capture Offset"), sigc::mem_fun (*this, &Editor::nudge_forward_capture_offset));
|
||||
|
||||
reg_sens (
|
||||
_region_actions,
|
||||
"nudge-forward-by-capture-offset",
|
||||
_("Nudge Later by Capture Offset"),
|
||||
sigc::mem_fun (*this, &Editor::nudge_forward_capture_offset)
|
||||
);
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "nudge-backward-by-capture-offset", _("Nudge Earlier by Capture Offset"), sigc::mem_fun (*this, &Editor::nudge_backward_capture_offset));
|
||||
|
||||
reg_sens (
|
||||
_region_actions,
|
||||
"nudge-backward-by-capture-offset",
|
||||
_("Nudge Earlier by Capture Offset"),
|
||||
sigc::mem_fun (*this, &Editor::nudge_backward_capture_offset)
|
||||
);
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "trim-region-to-loop", _("Trim to Loop"), sigc::mem_fun (*this, &Editor::trim_region_to_loop));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "trim-region-to-punch", _("Trim to Punch"), sigc::mem_fun (*this, &Editor::trim_region_to_punch));
|
||||
|
||||
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));
|
||||
|
||||
reg_sens (_region_actions, "trim-to-previous-region", _("Trim to Previous"), sigc::mem_fun(*this, &Editor::trim_region_to_previous_region_end));
|
||||
reg_sens (_region_actions, "trim-to-next-region", _("Trim to Next"), sigc::mem_fun(*this, &Editor::trim_region_to_next_region_start));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "trim-to-previous-region", _("Trim to Previous"), sigc::mem_fun(*this, &Editor::trim_region_to_previous_region_end));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "trim-to-next-region", _("Trim to Next"), sigc::mem_fun(*this, &Editor::trim_region_to_next_region_start));
|
||||
|
||||
/* 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)
|
||||
);
|
||||
register_region_action (_region_actions, RegionActionTarget (ListSelection), "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, "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..."), sigc::bind (sigc::mem_fun (*this, &Editor::change_region_layering_order), false));
|
||||
reg_sens (_region_actions, "choose-top-region-context-menu", _("Choose Top..."), sigc::bind (sigc::mem_fun (*this, &Editor::change_region_layering_order), true));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EditPointRegions), "set-region-sync-position", _("Set Sync Position"), sigc::mem_fun (*this, &Editor::set_region_sync_position));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EditPointRegions), "place-transient", _("Place Transient"), sigc::mem_fun (*this, &Editor::place_transient));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EditPointRegions), "trim-front", _("Trim Start at Edit Point"), sigc::mem_fun (*this, &Editor::trim_region_front));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EditPointRegions), "trim-back", _("Trim End at Edit Point"), sigc::mem_fun (*this, &Editor::trim_region_back));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EditPointRegions), "align-regions-start", _("Align Start"), sigc::bind (sigc::mem_fun(*this, &Editor::align_regions), ARDOUR::Start));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EditPointRegions), "align-regions-start-relative", _("Align Start Relative"), sigc::bind (sigc::mem_fun (*this, &Editor::align_regions_relative), ARDOUR::Start));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EditPointRegions), "align-regions-end", _("Align End"), sigc::bind (sigc::mem_fun (*this, &Editor::align_regions), ARDOUR::End));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EditPointRegions), "align-regions-end-relative", _("Align End Relative"), sigc::bind (sigc::mem_fun(*this, &Editor::align_regions_relative), ARDOUR::End));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EditPointRegions), "align-regions-sync", _("Align Sync"), sigc::bind (sigc::mem_fun(*this, &Editor::align_regions), ARDOUR::SyncPoint));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EditPointRegions), "align-regions-sync-relative", _("Align Sync Relative"), sigc::bind (sigc::mem_fun (*this, &Editor::align_regions_relative), ARDOUR::SyncPoint));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EditPointRegions), "choose-top-region", _("Choose Top..."), sigc::bind (sigc::mem_fun (*this, &Editor::change_region_layering_order), false));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EditPointRegions), "choose-top-region-context-menu", _("Choose Top..."), sigc::bind (sigc::mem_fun (*this, &Editor::change_region_layering_order), true));
|
||||
|
||||
/* desensitize them all by default. region selection will change this */
|
||||
sensitize_all_region_actions (false);
|
||||
|
|
|
|||
|
|
@ -1098,13 +1098,52 @@ Editor::sensitize_all_region_actions (bool s)
|
|||
void
|
||||
Editor::sensitize_the_right_region_actions (bool from_context_menu, bool from_outside_canvas)
|
||||
{
|
||||
PBD::stacktrace (cerr, 20);
|
||||
RegionSelection rs = get_regions_from_selection_and_edit_point (Editing::EDIT_IGNORE_NONE, from_context_menu, from_outside_canvas);
|
||||
bool have_selection = false;
|
||||
bool have_entered = false;
|
||||
bool have_edit_point = false;
|
||||
RegionSelection rs;
|
||||
|
||||
sensitize_all_region_actions (!rs.empty ());
|
||||
if (!selection->regions.empty()) {
|
||||
have_selection = true;
|
||||
rs = selection->regions;
|
||||
}
|
||||
|
||||
if (entered_regionview) {
|
||||
have_entered = true;
|
||||
rs.add (entered_regionview);
|
||||
}
|
||||
|
||||
if (!selection->tracks.empty()) {
|
||||
RegionSelection at_edit_point;
|
||||
framepos_t const where = get_preferred_edit_position (Editing::EDIT_IGNORE_NONE, from_context_menu, from_outside_canvas);
|
||||
get_regions_at (at_edit_point, where, selection->tracks);
|
||||
if (!at_edit_point.empty()) {
|
||||
have_edit_point = true;
|
||||
}
|
||||
if (rs.empty()) {
|
||||
rs.insert (rs.end(), at_edit_point.begin(), at_edit_point.end());
|
||||
}
|
||||
}
|
||||
|
||||
typedef std::map<std::string,RegionAction> RegionActionMap;
|
||||
|
||||
_ignore_region_action = true;
|
||||
|
||||
for (RegionActionMap::iterator x = region_action_map.begin(); x != region_action_map.end(); ++x) {
|
||||
RegionActionTarget tgt = x->second.target;
|
||||
bool sensitive = false;
|
||||
|
||||
if ((tgt & SelectedRegions) && have_selection) {
|
||||
sensitive = true;
|
||||
} else if ((tgt & EnteredRegions) && have_entered) {
|
||||
sensitive = true;
|
||||
} else if ((tgt & EditPointRegions) && have_edit_point) {
|
||||
sensitive = true;
|
||||
}
|
||||
|
||||
x->second.action->set_sensitive (sensitive);
|
||||
}
|
||||
|
||||
/* Look through the regions that are selected and make notes about what we have got */
|
||||
|
||||
bool have_audio = false;
|
||||
|
|
@ -1254,70 +1293,6 @@ Editor::sensitize_the_right_region_actions (bool from_context_menu, bool from_ou
|
|||
/* others were already marked sensitive */
|
||||
}
|
||||
|
||||
/* these actions all require a single location, taken from the edit
|
||||
* point.
|
||||
*/
|
||||
|
||||
vector<string> edit_point_actions;
|
||||
edit_point_actions.push_back ("set-region-sync-position");
|
||||
edit_point_actions.push_back ("trim-front");
|
||||
edit_point_actions.push_back ("trim-back");
|
||||
edit_point_actions.push_back ("place-transient");
|
||||
edit_point_actions.push_back ("align-regions-start");
|
||||
edit_point_actions.push_back ("align-regions-start-relative");
|
||||
edit_point_actions.push_back ("align-regions-end");
|
||||
edit_point_actions.push_back ("align-regions-end-relative");
|
||||
edit_point_actions.push_back ("align-regions-sync");
|
||||
edit_point_actions.push_back ("align-regions-sync-relative");
|
||||
|
||||
/* They all use Editor::get_regions_from_selection_and_edit_point(),
|
||||
* which is the same method used at the start of this to determine if
|
||||
* any regions are eligible/valid for editing.
|
||||
*
|
||||
* there are two possible reasons why these actions should still
|
||||
* be sensitive.
|
||||
*
|
||||
* 1. regions are selected
|
||||
* 2. the edit point is inside some regions on selected tracks
|
||||
*
|
||||
* the first condition is satisfied if selection->regions is not empty.
|
||||
* the second condition is satisfied if selection->regions is empty,
|
||||
* but @param rs (set above by the call to get_regions_from_selection_and_edit_point()
|
||||
* is not empty.
|
||||
*
|
||||
* if the mouse is the edit point, then whether get_regions_from_selection_and_edit_point()
|
||||
* will have identified any regions will depend on the edit point setting.
|
||||
*
|
||||
* Editing::EditIgnoreOption that we passed to it, which in turn will
|
||||
* depend on whether or not the pointer is still inside the track
|
||||
* canvas. If it was, then the pointer position will determine whether
|
||||
* or not any non-selected regions are considered eligible. If it
|
||||
* wasn't, then we will ignore the pointer position and fallback on a
|
||||
* secondary edit point (at this writing, that will likely be the
|
||||
* playhead but see get_regions_from_selection_and_edit_point() to see
|
||||
* how this works).
|
||||
*
|
||||
* if the edit point is not the mouse, then
|
||||
* get_regions_from_selection_and_edit_point() will just do the right
|
||||
* thing.
|
||||
*
|
||||
* However, the implementation of the actions will still use the edit
|
||||
* point, ...
|
||||
*
|
||||
*/
|
||||
|
||||
bool sensitivity;
|
||||
|
||||
if (!selection->regions.empty() || !rs.empty()) { /* conditions 1 and 2 above */
|
||||
sensitivity = true;
|
||||
} else {
|
||||
sensitivity = false;
|
||||
}
|
||||
|
||||
for (vector<string>::const_iterator a = edit_point_actions.begin(); a != edit_point_actions.end(); ++a) {
|
||||
_region_actions->get_action (*a)->set_sensitive (sensitivity);
|
||||
}
|
||||
|
||||
/* ok, moving along... */
|
||||
|
||||
if (have_compound_regions) {
|
||||
|
|
|
|||
|
|
@ -353,6 +353,16 @@ class PublicEditor : public Gtkmm2ext::Tabbable {
|
|||
|
||||
static sigc::signal<void> DropDownKeys;
|
||||
|
||||
struct RegionAction {
|
||||
Glib::RefPtr<Gtk::Action> action;
|
||||
Editing::RegionActionTarget target;
|
||||
|
||||
RegionAction (Glib::RefPtr<Gtk::Action> a, Editing::RegionActionTarget tgt)
|
||||
: action (a), target (tgt) {}
|
||||
};
|
||||
|
||||
std::map<std::string,RegionAction> region_action_map;
|
||||
|
||||
Glib::RefPtr<Gtk::ActionGroup> editor_actions;
|
||||
Glib::RefPtr<Gtk::ActionGroup> editor_menu_actions;
|
||||
Glib::RefPtr<Gtk::ActionGroup> _region_actions;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue