diff options
author | Hans Goudey <h.goudey@me.com> | 2020-09-20 00:24:10 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2020-09-20 00:24:10 +0300 |
commit | 4115229637c0acdcffbaceae282ccd854bfdb1c8 (patch) | |
tree | e21fff643946041cb397b912bbbee0f0cbbd45c4 /source/blender/editors/interface/interface_panel.c | |
parent | c9c51c07cfb77a96e720b28d01e91c3fecb0aa6d (diff) |
Cleanup: Use shorthand variables
We don't use the other variables in the sorting struct,
so we might as well use the panels directly.
Diffstat (limited to 'source/blender/editors/interface/interface_panel.c')
-rw-r--r-- | source/blender/editors/interface/interface_panel.c | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 5800479874c..a2b9f388759 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -1653,53 +1653,55 @@ bool UI_panel_is_dragging(const struct Panel *panel) } /** - * \note about sorting; - * the #Panel.sortorder has a lower value for new panels being added. + * \note about sorting: + * The #Panel.sortorder has a lower value for new panels being added. * however, that only works to insert a single panel, when more new panels get * added the coordinates of existing panels and the previously stored to-be-inserted - * panels do not match for sorting + * panels do not match for sorting. */ -static int find_highest_panel(const void *a1, const void *a2) +static int find_highest_panel(const void *a, const void *b) { - const PanelSort *ps1 = a1, *ps2 = a2; + const Panel *panel_a = ((PanelSort *)a)->panel; + const Panel *panel_b = ((PanelSort *)b)->panel; - /* stick uppermost header-less panels to the top of the region - - * prevent them from being sorted (multiple header-less panels have to be sorted though) */ - if (ps1->panel->type->flag & PNL_NO_HEADER && ps2->panel->type->flag & PNL_NO_HEADER) { + /* Stick uppermost header-less panels to the top of the region - + * prevent them from being sorted (multiple header-less panels have to be sorted though). */ + if (panel_a->type->flag & PNL_NO_HEADER && panel_b->type->flag & PNL_NO_HEADER) { /* Skip and check for `ofsy` and #Panel.sortorder below. */ } - if (ps1->panel->type->flag & PNL_NO_HEADER) { + if (panel_a->type->flag & PNL_NO_HEADER) { return -1; } - if (ps2->panel->type->flag & PNL_NO_HEADER) { + if (panel_a->type->flag & PNL_NO_HEADER) { return 1; } - if (ps1->panel->ofsy + ps1->panel->sizey < ps2->panel->ofsy + ps2->panel->sizey) { + if (panel_a->ofsy + panel_a->sizey < panel_b->ofsy + panel_b->sizey) { return 1; } - if (ps1->panel->ofsy + ps1->panel->sizey > ps2->panel->ofsy + ps2->panel->sizey) { + if (panel_a->ofsy + panel_a->sizey > panel_b->ofsy + panel_b->sizey) { return -1; } - if (ps1->panel->sortorder > ps2->panel->sortorder) { + if (panel_a->sortorder > panel_b->sortorder) { return 1; } - if (ps1->panel->sortorder < ps2->panel->sortorder) { + if (panel_a->sortorder < panel_b->sortorder) { return -1; } return 0; } -static int compare_panel(const void *a1, const void *a2) +static int compare_panel(const void *a, const void *b) { - const PanelSort *ps1 = a1, *ps2 = a2; + const Panel *panel_a = ((PanelSort *)a)->panel; + const Panel *panel_b = ((PanelSort *)b)->panel; - if (ps1->panel->sortorder > ps2->panel->sortorder) { + if (panel_a->sortorder > panel_b->sortorder) { return 1; } - if (ps1->panel->sortorder < ps2->panel->sortorder) { + if (panel_a->sortorder < panel_b->sortorder) { return -1; } |