Fix for collapse ignoring pinned panels
authorCampbell Barton <ideasman42@gmail.com>
Sun, 2 Mar 2014 01:15:09 +0000 (12:15 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 2 Mar 2014 01:49:30 +0000 (12:49 +1100)
source/blender/editors/interface/interface_panel.c

index cb1f59cfd68a78ff45bd507a41201db5c416abb4..f5e2bfb6c29843d146dfe9645b4ab57e330868d1 100644 (file)
@@ -170,20 +170,21 @@ static int panels_re_align(ScrArea *sa, ARegion *ar, Panel **r_pa)
 
 /****************************** panels ******************************/
 
 
 /****************************** 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;
        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) {
 
        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)) {
 
                /* 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;
                                }
                                        pa->flag &= ~PNL_CLOSED;
                                        pa->flag |= flag;
                                }