Fix for collapse ignoring pinned panels

This commit is contained in:
Campbell Barton 2014-03-02 12:15:09 +11:00
parent f01d19431d
commit e60fb0fd29
1 changed files with 8 additions and 7 deletions

View File

@ -170,20 +170,21 @@ static int panels_re_align(ScrArea *sa, ARegion *ar, Panel **r_pa)
/****************************** panels ******************************/
static void panels_collapse_all(ScrArea *sa, ARegion *ar, Panel *from_pa)
static void panels_collapse_all(ScrArea *sa, ARegion *ar, const Panel *from_pa)
{
const bool has_category_tabs = UI_panel_category_is_visible(ar);
const char *category = has_category_tabs ? UI_panel_category_active_get(ar, false) : NULL;
const int flag = ((panel_aligned(sa, ar) == BUT_HORIZONTAL) ? PNL_CLOSEDX : PNL_CLOSEDY);
const PanelType *from_pt = from_pa->type;
Panel *pa;
PanelType *pt, *from_pt;
int flag = ((panel_aligned(sa, ar) == BUT_HORIZONTAL) ? PNL_CLOSEDX : PNL_CLOSEDY);
for (pa = ar->panels.first; pa; pa = pa->next) {
pt = pa->type;
from_pt = from_pa->type;
PanelType *pt = pa->type;
/* close panels with headers in the same context */
if (pt && from_pt && !(pt->flag & PNL_NO_HEADER)) {
if (!pt->context[0] || strcmp(pt->context, from_pt->context) == 0) {
if (!pt->category[0] || strcmp(pt->category, from_pt->category) == 0) {
if (!pt->context[0] || !from_pt->context[0] || STREQ(pt->context, from_pt->context)) {
if ((pa->flag & PNL_PIN) || !category || !pt->category[0] || STREQ(pt->category, category)) {
pa->flag &= ~PNL_CLOSED;
pa->flag |= flag;
}