replace ::cast_dynamic() with relevant ActionManager::get_*_action() calls
[ardour.git] / doc / region_ops.txt
1 How to choose what regions to perform operations on
2 ---------------------------------------------------
3
4 Divide region actions into 3 groups:
5
6 1. Actions that operate on the selection, and for which the edit point type and location is irrelevant.
7 e.g. remove-region, rename-region, boost-region-gain
8
9 2. Actions that are not related to the selection, but for which the edit point location is important
10 e.g. insert-region-from-region-list
11
12 3. Actions that operate on the selection, and for which the edit point location is important
13 e.g. set-region-sync-position, place-transient
14
15
16 For group 1, Editor::get_regions_from_selection_and_entered() is used to decide which regions to operate
17 on.  This method returns the selected regions, unless there are none, in which case it returns the last
18 region that the mouse entered.
19
20 For group 3, Editor::get_regions_from_selection_and_edit_point() is used to decide which regions to operate
21 on.
22
23 If the edit point is `mouse':
24      if the mouse is over a selected region, or no region, this method returns all selected regions.
25      if the mouse is over an unselected region, just that region is returned.
26
27 For other edit points the method returns the selected regions. If no regions are selected, it returns 
28 the regions under the edit position on the selected tracks.
29
30 The action handlers call the appropriate method to decide which regions to operate on.
31
32 In addition, Editor::sensitize_the_right_region_actions() is called when a Region menu is about to be displayed,
33 and it sensitizes the actions that are appropriate given the current situation.  When selecting things from
34 a menu, group 3 operations are disabled if the edit point is `mouse', as the mouse will be positioned over
35 the menu and its position is hence meaningless.