Edit: I reworked the entire patch to have a smaller scope, and to be much simpler.
Motivation
A cleanup of the outliner selection functions is needed to fix T71812: Outliner: Active selection not in sync when navigating with arrow keys, and is also to allow other changes during my 2020 gsoc project. It would be great to have this in master rather than my soc-2020-outliner branch so the mentioned task (from 2.81) can be finished.
Changes
There are no functional changes. The main change is access to the do_outliner_item_activate_tree_element function, which used to have two entry functions. Now all access to the outliner selection/activation functions starts in outliner_item_select.
- Update outliner_item_select to use a bit flag for selection types. This function can be used anywhere from the outliner code to select and activate elements. I chose to use a bit flag over 5-6 booleans because I think it makes the code generally cleaner.
- Remove outliner-item_do_activate_from_tree_element in favor of outliner_item_select.
- Move mode toggling logic to a separate function outliner_item_mode_toggle. This function is still called when activating object data, so no behavior has changed, but this will make it easier to remove from the selection code in the future when T68498: Outliner: Mode Toggling is implemented.
- A few functions were renamed to make purposes more clear.
I'm fairly certain no behavior has changed because the same functions are still used for the actual selection and activation functionality, but additional testing would be nice to verify that. The only thing that might need updating is the naming of functions and enums.