The term direction was used in 3 different ways in screen editing code,
making it hard to follow:
- 0-3 for as magic numbers mapped to [west,north,east,south].
- h, v characters for [horizontal,vertical] axes.
- Cycle direction SPACE_CONTEXT_CYCLE_PREV, SPACE_CONTEXT_CYCLE_NEXT
The following changes have been made:
- Add eScreenDir for [west,north,east,south], use variable name dir.
- Add eScreenAxis for [horizontal,vertical] values, use variable name dir_axis.
- Add eScreenCycle for existing enum SPACE_CONTEXT_CYCLE_{PREV/NEXT}.
- Add macros SCREEN_DIR_IS_VERTICAL(dir), SCREEN_DIR_IS_HORIZONTAL(dir). Replacing ELEM(dir, 1, 3), ELEM(dir, 0, 2).
- Move ED_screen_draw_join_highlight, ED_screen_draw_split_preview to screen_intern.h.
Notes:
- Some of these choices are arbitrary, we could even make these enums more generic, sharing them between other files.
- The removal of h and v could be extended to view2d code where they're currently used.
- I used the term dir_axis for eScreenAxis instead of axis since the operator settings use "direction" as a property name, and there are existing uses of the variable axis in this code X=0, Y=1.