[Bf-blender-cvs] [2384564149b] master: Cleanup: remove 2.4x panel tabs

Campbell Barton noreply at git.blender.org
Thu May 16 03:15:12 CEST 2019


Commit: 2384564149b54374572ea28f91b5f64dc61143e2
Author: Campbell Barton
Date:   Thu May 16 11:12:41 2019 +1000
Branches: master
https://developer.blender.org/rB2384564149b54374572ea28f91b5f64dc61143e2

Cleanup: remove 2.4x panel tabs

This makes the code confusing since we now have two other kinds of tabs
(navigation bar and panel categories).

===================================================================

M	source/blender/blenkernel/intern/screen.c
M	source/blender/blenloader/intern/readfile.c
M	source/blender/editors/interface/interface_panel.c
M	source/blender/makesdna/DNA_screen_types.h

===================================================================

diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c
index e0ac9fd5a86..5c41048be83 100644
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@ -193,18 +193,6 @@ static void panel_list_copy(ListBase *newlb, const ListBase *lb)
   Panel *pa = lb->first;
   for (; newpa; newpa = newpa->next, pa = pa->next) {
     newpa->activedata = NULL;
-
-    Panel *newpatab = newlb->first;
-    Panel *patab = lb->first;
-    while (newpatab) {
-      if (newpa->paneltab == patab) {
-        newpa->paneltab = newpatab;
-        break;
-      }
-      newpatab = newpatab->next;
-      patab = patab->next;
-    }
-
     panel_list_copy(&newpa->children, &pa->children);
   }
 }
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index f0e70f1be27..51f7ce3adcd 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -7106,7 +7106,6 @@ static void direct_link_panel_list(FileData *fd, ListBase *lb)
   link_list(fd, lb);
 
   for (Panel *pa = lb->first; pa; pa = pa->next) {
-    pa->paneltab = newdataadr(fd, pa->paneltab);
     pa->runtime_flag = 0;
     pa->activedata = NULL;
     pa->type = NULL;
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index c0b8818edc1..46b1279643e 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -258,43 +258,16 @@ static void panels_collapse_all(ScrArea *sa, ARegion *ar, const Panel *from_pa)
   }
 }
 
-static void ui_panel_copy_offset(Panel *pa, Panel *papar)
-{
-  /* with respect to sizes... papar is parent */
-
-  pa->ofsx = papar->ofsx;
-  pa->ofsy = papar->ofsy + papar->sizey - pa->sizey;
-}
-
-/**
- * XXX Disabled paneltab handling for now. Old 2.4x feature,
- * *DO NOT* confuse it with new tool tabs in 2.70. ;)
- * See also T41704.
- */
-/* #define UI_USE_PANELTAB */
-
 Panel *UI_panel_find_by_type(ListBase *lb, PanelType *pt)
 {
   Panel *pa;
   const char *idname = pt->idname;
 
-#ifdef UI_USE_PANELTAB
-  const char *tabname = pt->idname;
-  for (pa = lb->first; pa; pa = pa->next) {
-    if (STREQLEN(pa->panelname, idname, sizeof(pa->panelname))) {
-      if (STREQLEN(pa->tabname, tabname, sizeof(pa->tabname))) {
-        return pa;
-      }
-    }
-  }
-#else
   for (pa = lb->first; pa; pa = pa->next) {
     if (STREQLEN(pa->panelname, idname, sizeof(pa->panelname))) {
       return pa;
     }
   }
-#endif
-
   return NULL;
 }
 
@@ -307,10 +280,6 @@ Panel *UI_panel_begin(
   Panel *palast, *panext;
   const char *drawname = CTX_IFACE_(pt->translation_context, pt->label);
   const char *idname = pt->idname;
-#ifdef UI_USE_PANELTAB
-  const char *tabname = pt->idname;
-  const char *hookname = NULL;
-#endif
   const bool newpanel = (pa == NULL);
   int align = panel_aligned(sa, ar);
 
@@ -341,28 +310,6 @@ Panel *UI_panel_begin(
     pa->runtime_flag |= PNL_NEW_ADDED;
 
     BLI_addtail(lb, pa);
-
-#ifdef UI_USE_PANELTAB
-    BLI_strncpy(pa->tabname, tabname, sizeof(pa->tabname));
-
-    /* make new Panel tabbed? */
-    if (hookname) {
-      Panel *patab;
-      for (patab = lb->first; patab; patab = patab->next) {
-        if ((patab->runtime_flag & PNL_ACTIVE) && patab->paneltab == NULL) {
-          if (STREQLEN(hookname, patab->panelname, sizeof(patab->panelname))) {
-            if (STREQLEN(tabname, patab->tabname, sizeof(patab->tabname))) {
-              pa->paneltab = patab;
-              ui_panel_copy_offset(pa, patab);
-              break;
-            }
-          }
-        }
-      }
-    }
-#else
-    BLI_strncpy(pa->tabname, idname, sizeof(pa->tabname));
-#endif
   }
 
   /* Do not allow closed panels without headers! Else user could get "disappeared" UI! */
@@ -411,9 +358,6 @@ Panel *UI_panel_begin(
 
   *r_open = false;
 
-  if (pa->paneltab) {
-    return pa;
-  }
   if (pa->flag & PNL_CLOSED) {
     return pa;
   }
@@ -706,9 +650,6 @@ void ui_draw_aligned_panel(uiStyle *style,
                            * can't be dragged. This may be changed in future. */
                           show_background);
 
-  if (panel->paneltab) {
-    return;
-  }
   if (panel->type && (panel->type->flag & PNL_NO_HEADER)) {
     return;
   }
@@ -936,12 +877,6 @@ static int get_panel_real_ofsy(Panel *pa)
   if (pa->flag & PNL_CLOSEDY) {
     return pa->ofsy + pa->sizey;
   }
-  else if (pa->paneltab && (pa->paneltab->flag & PNL_CLOSEDY)) {
-    return pa->ofsy + pa->sizey;
-  }
-  else if (pa->paneltab) {
-    return pa->paneltab->ofsy;
-  }
   else {
     return pa->ofsy;
   }
@@ -952,9 +887,6 @@ static int get_panel_real_ofsx(Panel *pa)
   if (pa->flag & PNL_CLOSEDX) {
     return pa->ofsx + get_panel_header(pa);
   }
-  else if (pa->paneltab && (pa->paneltab->flag & PNL_CLOSEDX)) {
-    return pa->ofsx + get_panel_header(pa);
-  }
   else {
     return pa->ofsx + pa->sizex;
   }
@@ -1069,7 +1001,7 @@ static bool uiAlignPanelStep(ScrArea *sa, ARegion *ar, const float fac, const bo
 
   /* count active, not tabbed panels */
   for (pa = ar->panels.first; pa; pa = pa->next) {
-    if ((pa->runtime_flag & PNL_ACTIVE) && pa->paneltab == NULL) {
+    if (pa->runtime_flag & PNL_ACTIVE) {
       tot++;
     }
   }
@@ -1080,7 +1012,7 @@ static bool uiAlignPanelStep(ScrArea *sa, ARegion *ar, const float fac, const bo
 
   /* extra; change close direction? */
   for (pa = ar->panels.first; pa; pa = pa->next) {
-    if ((pa->runtime_flag & PNL_ACTIVE) && pa->paneltab == NULL) {
+    if (pa->runtime_flag & PNL_ACTIVE) {
       if ((pa->flag & PNL_CLOSEDX) && (align == BUT_VERTICAL)) {
         pa->flag ^= PNL_CLOSED;
       }
@@ -1095,7 +1027,7 @@ static bool uiAlignPanelStep(ScrArea *sa, ARegion *ar, const float fac, const bo
 
   ps = panelsort;
   for (pa = ar->panels.first; pa; pa = pa->next) {
-    if ((pa->runtime_flag & PNL_ACTIVE) && pa->paneltab == NULL) {
+    if (pa->runtime_flag & PNL_ACTIVE) {
       ps->pa = MEM_dupallocN(pa);
       ps->orig = pa;
       ps++;
@@ -1162,9 +1094,6 @@ static bool uiAlignPanelStep(ScrArea *sa, ARegion *ar, const float fac, const bo
   /* set locations for tabbed and sub panels */
   for (pa = ar->panels.first; pa; pa = pa->next) {
     if (pa->runtime_flag & PNL_ACTIVE) {
-      if (pa->paneltab) {
-        ui_panel_copy_offset(pa, pa->paneltab);
-      }
       if (pa->children.first) {
         align_sub_panels(pa);
       }
@@ -1267,7 +1196,7 @@ void UI_panels_end(const bContext *C, ARegion *ar, int *r_x, int *r_y)
 {
   ScrArea *sa = CTX_wm_area(C);
   uiBlock *block;
-  Panel *panot, *panew, *patest, *pa, *firstpa;
+  Panel *pa, *firstpa;
 
   /* offset contents */
   for (block = ar->uiblocks.first; block; block = block->next) {
@@ -1276,31 +1205,6 @@ void UI_panels_end(const bContext *C, ARegion *ar, int *r_x, int *r_y)
     }
   }
 
-  /* consistency; are panels not made, whilst they have tabs */
-  for (panot = ar->panels.first; panot; panot = panot->next) {
-    if ((panot->runtime_flag & PNL_ACTIVE) == 0) { /* not made */
-
-      for (panew = ar->panels.first; panew; panew = panew->next) {
-        if ((panew->runtime_flag & PNL_ACTIVE)) {
-          if (panew->paneltab == panot) { /* panew is tab in notmade pa */
-            break;
-          }
-        }
-      }
-      /* now panew can become the new parent, check all other tabs */
-      if (panew) {
-        for (patest = ar->panels.first; patest; patest = patest->next) {
-          if (patest->paneltab == panot) {
-            patest->paneltab = panew;
-          }
-        }
-        panot->paneltab = panew;
-        panew->paneltab = NULL;
-        ED_region_tag_redraw(ar); /* the buttons panew were not made */
-      }
-    }
-  }
-
   /* re-align, possibly with animation */
   if (panels_need_realign(sa, ar, &pa)) {
     if (pa) {
@@ -1382,7 +1286,7 @@ static void check_panel_overlap(ARegion *ar, Panel *panel)
   for (pa = ar->panels.first; pa; pa = pa->next) {
     pa->flag &= ~PNL_OVERLAP;
     if (panel && (pa != panel)) {
-      if (pa->paneltab == NULL && (pa->runtime_flag & PNL_ACTIVE)) {
+      if (pa->runtime_flag & PNL_ACTIVE) {
         float safex = 0.2, safey = 0.2;
 
         if (pa->flag & PNL_CLOSEDX) {
@@ -1724,17 +1628,6 @@ static void ui_handle_panel_header(
           ui_panel_drag_collapse_handler_add(C, true);
         }
       }
-
-      for (Panel *pa = ar->panels.first; pa; pa = pa->next) {
-        if (pa->paneltab == block->panel) {
-          if (block->panel->flag & PNL_CLOSED) {
-            pa->flag |= PNL_CLOSED;
-          }
-          else {
-            pa->flag &= ~PNL_CLOSED;
-          }
-        }
-      }
     }
 
     if (align) {
@@ -2386,7 +2279,7 @@ int ui_handler_panel_region(bContext *C,
     /* checks for mouse position inside */
     pa = block->panel;
 
-    if (!pa || pa->paneltab != NULL) {
+    if (!pa) {
       continue;
     }
     /* XXX - accessed freed panels when scripts reload, need to fix. */
diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h
index e014de183e3..f5c2a518ef6 100644
--- a/source/blender/makesdna/DNA_screen_types.h
+++ b/source/blender/makesdna/DNA_screen_types.h
@@ -139,7 +139,7 @@ typedef struct Panel {
   struct uiLayout *layout;
 
   /** Defined as UI_MAX_NAME_STR. */
-  char panelname[64], tabname[64];
+  char panelname[64];
   /** Panel name is identifier for restoring location. */
   char drawname[64];
   /** Offset within the region. */
@@ -155,8 +155,6 @@ typedef struct Panel {
   short snap;
   /** Panels are aligned according to increasing sort-order. */
   int sortorder;
-  /** This panel is tabbed in *paneltab. */
-  struct Panel *paneltab;
   /** Runtime for panel manipulation. */
   void *activedata;
   /** Sub panels. */



More information about the Bf-blender-cvs mailing list