UI: various panels fixes.
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 2 Apr 2009 01:39:33 +0000 (01:39 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 2 Apr 2009 01:39:33 +0000 (01:39 +0000)
* Fix sometimes non-working close/open button.
* Fix panels being a bit out of the view on startup.
* Fix too large totrct region for view2d.
* Fix wrong panel order when changing vertical <-> horizontal.
* Fix wrong panel positions after switching contexts.
* Fix an access of freed memory when collapsing panels.

* Free align mode works again.
* Animations work again.

source/blender/editors/include/UI_interface.h
source/blender/editors/interface/interface_layout.c
source/blender/editors/interface/interface_panel.c
source/blender/editors/interface/view2d.c
source/blender/editors/space_buttons/buttons_header.c
source/blender/editors/space_buttons/space_buttons.c
source/blender/editors/space_graph/graph_buttons.c
source/blender/editors/space_image/image_panels.c
source/blender/editors/space_view3d/view3d_buttons.c
source/blender/python/intern/bpy_ui.c

index f7d21d0374cf725f9ccd12f765e04eddd174310b..3d85839eeee6738d5e191a583a67edd4124eacc1 100644 (file)
@@ -496,19 +496,15 @@ void autocomplete_end(AutoComplete *autocpl, char *autoname);
 
 extern void uiNewPanelTabbed(char *, char *);
 extern int uiNewPanel(const struct bContext *C, struct ARegion *ar, uiBlock *block, char *panelname, char *tabname, int ofsx, int ofsy, int sizex, int sizey);
+
+extern void uiBeginPanels(const struct bContext *C, struct ARegion *ar);
+extern void uiEndPanels(const struct bContext *C, struct ARegion *ar);
 extern void uiFreePanels(struct ListBase *lb);
-extern void uiDrawPanels(const struct bContext *C, int re_align);
        
-extern void uiSetPanelsView2d(struct ARegion *ar);
-extern void uiMatchPanelsView2d(struct ARegion *ar);
+extern void uiPanelsHome(struct ARegion *ar);
 
 extern void uiNewPanelHeight(struct uiBlock *block, int sizey);
 extern void uiNewPanelTitle(struct uiBlock *block, char *str);
-extern uiBlock *uiFindOpenPanelBlockName(struct ListBase *lb, char *name);
-extern int uiAlignPanelStep(struct ScrArea *sa, struct ARegion *ar, float fac);
-extern void uiPanelControl(int);
-extern void uiSetPanelHandler(int);
-
 struct Panel *uiPanelFromBlock(struct uiBlock *block);
 
 /* Handlers
index 003534062835fd7058849bafdc739dc77be385ea..b83991a5259fb3d5b0fbeaf88779c57ff4bb221e 100644 (file)
@@ -34,6 +34,8 @@
 #include "WM_api.h"
 #include "WM_types.h"
 
+#include "interface_intern.h"
+
 /************************ Structs and Defines *************************/
 
 #define COLUMN_SPACE   5
@@ -918,7 +920,7 @@ void uiRegionPanelLayout(const bContext *C, ARegion *ar, int vertical, char *con
        PanelType *pt;
        Panel *panel;
        float col[3];
-       int xco, yco, x=0, y=0, w;
+       int xco, yco, x=PNL_DIST, y=-PNL_HEADER-PNL_DIST, w;
 
        // XXX this only hides cruft
 
@@ -930,38 +932,43 @@ void uiRegionPanelLayout(const bContext *C, ARegion *ar, int vertical, char *con
        /* set view2d view matrix for scrolling (without scrollers) */
        UI_view2d_view_ortho(C, &ar->v2d);
        
+       uiBeginPanels(C, ar);
+
        for(pt= ar->type->paneltypes.first; pt; pt= pt->next) {
                if(context)
                        if(!pt->context || strcmp(context, pt->context) != 0)
                                continue;
 
                if(pt->draw && (!pt->poll || pt->poll(C))) {
+                       block= uiBeginBlock(C, ar, pt->idname, UI_EMBOSS, UI_HELV);
                        w= (ar->type->minsizex)? ar->type->minsizex-22: UI_PANEL_WIDTH-22;
 
-                       block= uiBeginBlock(C, ar, pt->idname, UI_EMBOSS, UI_HELV);
-                       if(uiNewPanel(C, ar, block, pt->name, pt->name, x, y, w, 0)==0) return;
-                       
-                       panel= uiPanelFromBlock(block);
-                       panel->type= pt;
-                       panel->layout= uiLayoutBegin(UI_LAYOUT_VERTICAL, x, y, w, 0);
+                       if(uiNewPanel(C, ar, block, pt->name, pt->name, x, y, w, 0)) {
+                               panel= uiPanelFromBlock(block);
+                               panel->type= pt;
+                               panel->layout= uiLayoutBegin(UI_LAYOUT_VERTICAL, x, y, w, 0);
 
-                       pt->draw(C, panel);
+                               pt->draw(C, panel);
 
-                       uiLayoutEnd(C, block, panel->layout, &xco, &yco);
-                       uiEndBlock(C, block);
+                               uiLayoutEnd(C, block, panel->layout, &xco, &yco);
+                               panel->layout= NULL;
+                               uiNewPanelHeight(block, y - yco + 6);
+                       }
+                       else {
+                               w= PNL_HEADER;
+                               yco= PNL_HEADER;
+                       }
 
-                       panel->layout= NULL;
-                       uiNewPanelHeight(block, y - yco + 6);
+                       uiEndBlock(C, block);
 
                        if(vertical)
-                               y += yco;
+                               y += yco+PNL_DIST;
                        else
-                               x += xco;
+                               x += w+PNL_DIST;
                }
        }
 
-       uiDrawPanels(C, 1);
-       uiMatchPanelsView2d(ar);
+       uiEndPanels(C, ar);
        
        /* restore view matrix? */
        UI_view2d_view_restore(C);
index 17a58f8b61608b4a9407d5b264cc8b7ecc7c9707..9d823712d4811778a27e255b37173c2222a7ab72 100644 (file)
@@ -100,7 +100,7 @@ static void panel_activate_state(bContext *C, Panel *pa, uiHandlePanelState stat
 
 static int panel_aligned(ScrArea *sa, ARegion *ar)
 {
-       if(sa->spacetype==SPACE_BUTS) {
+       if(sa->spacetype==SPACE_BUTS && ar->regiontype == RGN_TYPE_WINDOW) {
                SpaceButs *sbuts= sa->spacedata.first;
                return sbuts->align;
        }
@@ -110,6 +110,26 @@ static int panel_aligned(ScrArea *sa, ARegion *ar)
        return 0;
 }
 
+static int panels_re_align(ScrArea *sa, ARegion *ar)
+{
+       if(sa->spacetype==SPACE_BUTS && ar->regiontype == RGN_TYPE_WINDOW) {
+               SpaceButs *sbuts= sa->spacedata.first;
+
+               if(sbuts->align) {
+                       if(sbuts->re_align || sbuts->mainbo!=sbuts->mainb || sbuts->tabo!=sbuts->tab[sbuts->mainb]) {
+                               sbuts->re_align= 0;
+                               return 1;
+                       }
+               }
+
+               return 0;
+       }
+       else if(ar->regiontype==RGN_TYPE_UI)
+               return 1;
+       
+       return 0;
+}
+
 /* ************** panels ************* */
 
 static void copy_panel_offset(Panel *pa, Panel *papar)
@@ -317,7 +337,7 @@ static void ui_scale_panel_block(uiBlock *block)
 }
 
 // for 'home' key
-void uiSetPanelsView2d(ARegion *ar)
+void uiPanelsHome(ARegion *ar)
 {
        Panel *pa;
        uiBlock *block;
@@ -362,7 +382,7 @@ void uiSetPanelsView2d(ARegion *ar)
 }
 
 // make sure the panels are not outside 'tot' area
-void uiMatchPanelsView2d(ARegion *ar)
+static void ui_panels_update_totrct(ARegion *ar)
 {
        Panel *pa;
        uiBlock *block;
@@ -370,14 +390,22 @@ void uiMatchPanelsView2d(ARegion *ar)
        int done=0;
        
        v2d= &ar->v2d;
+
+       v2d->tot.xmin= 0.0f;
+       v2d->tot.xmax= ar->winx;
+       v2d->tot.ymax= 0.0f;
+       v2d->tot.ymin= -ar->winy;
        
        for(pa= ar->panels.first; pa; pa=pa->next) {
                if(pa->active && pa->paneltab==NULL) {
                        done= 1;
-                       if(pa->ofsx < v2d->tot.xmin) v2d->tot.xmin= pa->ofsx;
-                       if(pa->ofsx+pa->sizex > v2d->tot.xmax) 
+
+                       if(pa->ofsx < v2d->tot.xmin)
+                               v2d->tot.xmin= pa->ofsx;
+                       if(pa->ofsx+pa->sizex > v2d->tot.xmax)
                                v2d->tot.xmax= pa->ofsx+pa->sizex;
-                       if(pa->ofsy < v2d->tot.ymin) v2d->tot.ymin= pa->ofsy;
+                       if(pa->ofsy < v2d->tot.ymin)
+                               v2d->tot.ymin= pa->ofsy;
                        if(pa->ofsy+pa->sizey+PNL_HEADER > v2d->tot.ymax) 
                                v2d->tot.ymax= pa->ofsy+pa->sizey+PNL_HEADER;
                }
@@ -394,6 +422,8 @@ void uiMatchPanelsView2d(ARegion *ar)
                        //XXX }
                }
        }       
+
+       UI_view2d_totRect_set(v2d, v2d->tot.xmax, v2d->tot.ymin);
 }
 
 /* extern used by previewrender */
@@ -877,8 +907,8 @@ static int find_highest_panel(const void *a1, const void *a2)
 {
        const PanelSort *ps1=a1, *ps2=a2;
        
-       if( ps1->pa->ofsy < ps2->pa->ofsy) return 1;
-       else if( ps1->pa->ofsy > ps2->pa->ofsy) return -1;
+       if( ps1->pa->ofsy+ps1->pa->sizey < ps2->pa->ofsy+ps2->pa->sizey) return 1;
+       else if( ps1->pa->ofsy+ps1->pa->sizey > ps2->pa->ofsy+ps2->pa->sizey) return -1;
        else if( ps1->pa->sortcounter > ps2->pa->sortcounter) return 1;
        else if( ps1->pa->sortcounter < ps2->pa->sortcounter) return -1;
        
@@ -938,7 +968,7 @@ int uiAlignPanelStep(ScrArea *sa, ARegion *ar, float fac)
                ps->pa->ofsy= -ps->pa->sizey-PNL_HEADER-PNL_DIST;
        else
                ps->pa->ofsy= -ps->pa->sizey-PNL_HEADER-PNL_DIST; // XXX was 0;
-       
+
        for(a=0 ; a<tot-1; a++, ps++) {
                psnext= ps+1;
        
@@ -1010,11 +1040,20 @@ static void ui_do_animate(bContext *C, Panel *panel)
        }
 }
 
+void uiBeginPanels(const bContext *C, ARegion *ar)
+{
+       Panel *pa;
+  
+       /* set all panels as inactive, so that at the end we know
+        * which ones were used */
+       for(pa=ar->panels.first; pa; pa=pa->next)
+               pa->active= 0;
+}
+
 /* only draws blocks with panels */
-void uiDrawPanels(const bContext *C, int re_align)
+void uiEndPanels(const bContext *C, ARegion *ar)
 {
        ScrArea *sa= CTX_wm_area(C);
-       ARegion *ar= CTX_wm_region(C);
        uiBlock *block;
        Panel *panot, *panew, *patest;
        
@@ -1049,7 +1088,8 @@ void uiDrawPanels(const bContext *C, int re_align)
        }
 
        /* re-align */
-       if(re_align) uiAlignPanelStep(sa, ar, 1.0);
+       if(panels_re_align(sa, ar))
+               uiAlignPanelStep(sa, ar, 1.0);
        
        if(sa->spacetype!=SPACE_BUTS) {
 #if 0 // XXX make float panel exception
@@ -1133,6 +1173,11 @@ void uiDrawPanels(const bContext *C, int re_align)
 #endif
        }
 
+       /* update v2d->totrct and update view */
+       ui_panels_update_totrct(ar);
+       UI_view2d_view_restore(C);
+       UI_view2d_view_ortho(C, &ar->v2d);
+
        /* draw panels, selected on top */
        for(block= ar->uiblocks.first; block; block=block->next) {
                if(block->active && block->panel && !(block->panel->flag & PNL_SELECT)) {
@@ -1435,7 +1480,7 @@ int ui_handler_panel_region(bContext *C, wmEvent *event)
 {
        ARegion *ar= CTX_wm_region(C);
        uiBlock *block;
-       int retval, mx, my, inside_header= 0, inside_scale= 0;
+       int retval, mx, my, inside_header= 0, inside_scale= 0, inside;
 
        retval= WM_UI_HANDLER_CONTINUE;
 
@@ -1445,72 +1490,73 @@ int ui_handler_panel_region(bContext *C, wmEvent *event)
                ui_window_to_block(ar, block, &mx, &my);
 
                /* check if inside boundbox */
+               inside= 0;
+
                if(block->panel && block->panel->paneltab==NULL)
                        if(block->minx <= mx && block->maxx >= mx)
                                if(block->miny <= my && block->maxy+PNL_HEADER >= my)
-                                       break;
-       }
-
-       if(!block)
-               return retval;
+                                       inside= 1;
 
-       /* clicked at panel header? */
-       if(block->panel->flag & PNL_CLOSEDX) {
-               if(block->minx <= mx && block->minx+PNL_HEADER >= mx) 
-                       inside_header= 1;
-       }
-       else if((block->maxy <= my) && (block->maxy+PNL_HEADER >= my)) {
-               inside_header= 1;
-       }
-       else if(block->panel->control & UI_PNL_SCALE) {
-               if(block->maxx-PNL_HEADER <= mx)
-                       if(block->miny+PNL_HEADER >= my)
-                               inside_scale= 1;
-       }
+               if(inside) {
+                       /* clicked at panel header? */
+                       if(block->panel->flag & PNL_CLOSEDX) {
+                               if(block->minx <= mx && block->minx+PNL_HEADER >= mx) 
+                                       inside_header= 1;
+                       }
+                       else if((block->maxy <= my) && (block->maxy+PNL_HEADER >= my)) {
+                               inside_header= 1;
+                       }
+                       else if(block->panel->control & UI_PNL_SCALE) {
+                               if(block->maxx-PNL_HEADER <= mx)
+                                       if(block->miny+PNL_HEADER >= my)
+                                               inside_scale= 1;
+                       }
 
-       if(event->val!=KM_PRESS)
-               return retval;
+                       if(event->val==KM_PRESS) {
+                               if(event->type == LEFTMOUSE) {
+                                       if(inside_header)
+                                               ui_handle_panel_header(C, block, mx, my);
+                                       else if(inside_scale && !(block->panel->flag & PNL_CLOSED))
+                                               panel_activate_state(C, block->panel, PANEL_STATE_DRAG_SCALE);
+                               }
+                               else if(event->type == ESCKEY) {
+                                       /*XXX 2.50 if(block->handler) {
+                                               rem_blockhandler(sa, block->handler);
+                                               ED_region_tag_redraw(ar);
+                                               retval= WM_UI_HANDLER_BREAK;
+                                       }*/
+                               }
+                               else if(event->type==PADPLUSKEY || event->type==PADMINUS) {
+                                       int zoom=0;
+                               
+                                       /* if panel is closed, only zoom if mouse is over the header */
+                                       if (block->panel->flag & (PNL_CLOSEDX|PNL_CLOSEDY)) {
+                                               if (inside_header)
+                                                       zoom=1;
+                                       }
+                                       else
+                                               zoom=1;
 
-       if(event->type == LEFTMOUSE) {
-               if(inside_header)
-                       ui_handle_panel_header(C, block, mx, my);
-               else if(inside_scale && !(block->panel->flag & PNL_CLOSED))
-                       panel_activate_state(C, block->panel, PANEL_STATE_DRAG_SCALE);
-       }
-       else if(event->type == ESCKEY) {
-               /*XXX 2.50 if(block->handler) {
-                       rem_blockhandler(sa, block->handler);
-                       ED_region_tag_redraw(ar);
-                       retval= WM_UI_HANDLER_BREAK;
-               }*/
-       }
-       else if(event->type==PADPLUSKEY || event->type==PADMINUS) {
-               int zoom=0;
-       
-               /* if panel is closed, only zoom if mouse is over the header */
-               if (block->panel->flag & (PNL_CLOSEDX|PNL_CLOSEDY)) {
-                       if (inside_header)
-                               zoom=1;
-               }
-               else
-                       zoom=1;
 #if 0 // XXX make float panel exception?
-               if(zoom) {
-                       ScrArea *sa= CTX_wm_area(C);
-                       SpaceLink *sl= sa->spacedata.first;
-
-                       if(sa->spacetype!=SPACE_BUTS) {
-                               if(!(block->panel->control & UI_PNL_SCALE)) {
-                                       if(event->type==PADPLUSKEY) sl->blockscale+= 0.1;
-                                       else sl->blockscale-= 0.1;
-                                       CLAMP(sl->blockscale, 0.6, 1.0);
-
-                                       ED_region_tag_redraw(ar);
-                                       retval= WM_UI_HANDLER_BREAK;
-                               }                                               
+                                       if(zoom) {
+                                               ScrArea *sa= CTX_wm_area(C);
+                                               SpaceLink *sl= sa->spacedata.first;
+
+                                               if(sa->spacetype!=SPACE_BUTS) {
+                                                       if(!(block->panel->control & UI_PNL_SCALE)) {
+                                                               if(event->type==PADPLUSKEY) sl->blockscale+= 0.1;
+                                                               else sl->blockscale-= 0.1;
+                                                               CLAMP(sl->blockscale, 0.6, 1.0);
+
+                                                               ED_region_tag_redraw(ar);
+                                                               retval= WM_UI_HANDLER_BREAK;
+                                                       }                                               
+                                               }
+                                       }
+#endif
+                               }
                        }
                }
-#endif
        }
 
        return retval;
@@ -1525,7 +1571,15 @@ static int ui_handler_panel(bContext *C, wmEvent *event, void *userdata)
 
        /* verify if we can stop */
        if(event->type == LEFTMOUSE && event->val!=KM_PRESS) {
-               panel_activate_state(C, panel, PANEL_STATE_ANIMATION);
+               ScrArea *sa= CTX_wm_area(C);
+               ARegion *ar= CTX_wm_region(C);
+               int align= panel_aligned(sa, ar);
+
+               if(align)
+                       panel_activate_state(C, panel, PANEL_STATE_ANIMATION);
+               else
+                       panel_activate_state(C, panel, PANEL_STATE_EXIT);
+
                return WM_UI_HANDLER_BREAK;
        }
        else if(event->type == MOUSEMOVE) {
@@ -1541,7 +1595,9 @@ static int ui_handler_panel(bContext *C, wmEvent *event, void *userdata)
                        ui_do_drag(C, event, panel);
        }
 
-       if(data->state == PANEL_STATE_ANIMATION)
+       data= panel->activedata;
+
+       if(data && data->state == PANEL_STATE_ANIMATION)
                return WM_UI_HANDLER_CONTINUE;
        else
                return WM_UI_HANDLER_BREAK;
index d81d9eb79caa4fd151e912634bf5661e3e8a6011..d6c93bed174b181647de8809afefdc955e1c0212 100644 (file)
@@ -261,7 +261,7 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
                                v2d->maxzoom= 2.0f;
                                
                                v2d->align= (V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_POS_Y);
-                               v2d->keeptot= V2D_KEEPTOT_BOUNDS;
+                               v2d->keeptot= V2D_KEEPTOT_STRICT;
                                
                                v2d->tot.xmin= 0.0f;
                                v2d->tot.xmax= winx;
@@ -421,6 +421,14 @@ void UI_view2d_curRect_validate(View2D *v2d)
                                /* special exception for Outliner (and later channel-lists):
                                 *      - Currently, no actions need to be taken here...
                                 */
+
+                               if (winy < v2d->oldwiny) {
+                                       float temp = v2d->oldwiny - winy;
+                                       
+                                       cur->ymin += temp;
+                                       cur->ymax += temp;
+                               }
+
                        }
                        else {
                                /* landscape window: correct for y */
index 40e3564e69b1eb0b22dd74088f6a998676b098b1..29374d7cb3238cff551e228d473381843219c38d 100644 (file)
@@ -70,10 +70,8 @@ static void do_viewmenu(bContext *C, void *arg, int event)
                case 1:
                case 2:
                        sbuts->align= event;
-                       if(event) {
+                       if(sbuts->align)
                                sbuts->re_align= 1;
-                               // uiAlignPanelStep(sa, 1.0);
-                       }
             break;
     }
 
index 619467441960fa25befed3cbc9a66f0f0676fd43..e514b51e29cbd3f7605d1d54506fecb93e2c34aa 100644 (file)
@@ -176,7 +176,6 @@ static void buttons_main_area_draw(const bContext *C, ARegion *ar)
        else {
                View2D *v2d= &ar->v2d;
                float col[3], fac;
-               //int align= 0;
 
                /* clear and setup matrix */
                UI_GetThemeColor3fv(TH_BACK, col);
@@ -193,15 +192,6 @@ static void buttons_main_area_draw(const bContext *C, ARegion *ar)
                /* panels */
                drawnewstuff();
                
-#if 0
-               if(sbuts->align)
-                       if(sbuts->re_align || sbuts->mainbo!=sbuts->mainb || sbuts->tabo!=sbuts->tab[sbuts->mainb])
-                               align= 1;
-#endif
-
-               uiDrawPanels(C, 1); // XXX align);
-               uiMatchPanelsView2d(ar);
-               
                /* reset view matrix */
                UI_view2d_view_restore(C);
                
index 5207d4843f7bdf86cb73ae2659e99015c767ffed..64771ee547bfcea68497b556f437ecf0389b6db3 100644 (file)
@@ -846,6 +846,8 @@ void graph_region_buttons(const bContext *C, ARegion *ar)
        if (ale == NULL) 
                return; 
                
+       uiBeginPanels(C, ar);
+
        /* for now, the properties panel displays info about the selected channels */
        graph_panel_properties(C, ar, 0, ale);
        
@@ -857,8 +859,7 @@ void graph_region_buttons(const bContext *C, ARegion *ar)
        graph_panel_modifiers(C, ar, 0, ale);
        
 
-       uiDrawPanels(C, 1);             /* 1 = align */
-       uiMatchPanelsView2d(ar); /* sets v2d->totrct */
+       uiEndPanels(C, ar);
        
        /* free temp data */
        MEM_freeN(ale);
index b6da7415f1fbc97e4aea2381c2b2ac8bfa3df917..fa7e54eab99225ee17e4ded90ddce1389c711398 100644 (file)
@@ -1424,7 +1424,8 @@ static void image_panel_properties(const bContext *C, ARegion *ar)
 
 void image_buttons_area_defbuts(const bContext *C, ARegion *ar)
 {
-       
+       uiBeginPanels(C, ar);
+
        image_panel_properties(C, ar);
        image_panel_game_properties(C, ar);
        image_panel_view_properties(C, ar);
@@ -1432,9 +1433,7 @@ void image_buttons_area_defbuts(const bContext *C, ARegion *ar)
        image_panel_paintcolor(C, ar);
        image_panel_curves(C, ar);
                
-       uiDrawPanels(C, 1);             /* 1 = align */
-       uiMatchPanelsView2d(ar); /* sets v2d->totrct */
-       
+       uiEndPanels(C, ar);
 }
 
 
index bbcb8b3601de0787591699fc42f0a18858b62d34..552667d153e7d7701e5994a9195d3d335a3cca77 100644 (file)
@@ -1700,6 +1700,7 @@ static void view3d_panel_bonesketch_spaces(const bContext *C, ARegion *ar, short
 
 void view3d_buttons_area_defbuts(const bContext *C, ARegion *ar)
 {
+       uiBeginPanels(C, ar);
        
        view3d_panel_object(C, ar, 0);
        view3d_panel_properties(C, ar, 0);
@@ -1713,9 +1714,7 @@ void view3d_buttons_area_defbuts(const bContext *C, ARegion *ar)
        
        view3d_panel_bonesketch_spaces(C, ar, 0);
        
-       uiDrawPanels(C, 1);             /* 1 = align */
-       uiMatchPanelsView2d(ar); /* sets v2d->totrct */
-       
+       uiEndPanels(C, ar);
 }
 
 
index 608086843baf5cea3bf1117f031a8d74f992877b..7db9808adf0946780e49991fb4206ddf21f60671 100644 (file)
@@ -191,26 +191,29 @@ static PyObject *Method_drawBlock( PyObject * self, PyObject * args )
        Py_RETURN_NONE;
 }
 
-static PyObject *Method_drawPanels( PyObject * self, PyObject * args )
+static PyObject *Method_beginPanels( PyObject * self, PyObject * args )
 {
+       bContext *C;
        PyObject *py_context;
-       int align;
        
-       if( !PyArg_ParseTuple( args, "O!i:drawPanels", &PyCObject_Type, &py_context, &align) )
+       if( !PyArg_ParseTuple( args, "O!i:beginPanels", &PyCObject_Type, &py_context) )
                return NULL;
        
-       uiDrawPanels(PyCObject_AsVoidPtr(py_context), align);
+       C= PyCObject_AsVoidPtr(py_context);
+       uiBeginPanels(C, CTX_wm_region(C));
        Py_RETURN_NONE;
 }
 
-static PyObject *Method_matchPanelsView2d( PyObject * self, PyObject * args )
+static PyObject *Method_endPanels( PyObject * self, PyObject * args )
 {
-       PyObject *py_ar;
+       bContext *C;
+       PyObject *py_context;
        
-       if( !PyArg_ParseTuple( args, "O!:matchPanelsView2d", &PyCObject_Type, &py_ar) )
+       if( !PyArg_ParseTuple( args, "O!:endPanels", &PyCObject_Type, &py_context) )
                return NULL;
        
-       uiMatchPanelsView2d(PyCObject_AsVoidPtr(py_ar));
+       C= PyCObject_AsVoidPtr(py_context);
+       uiEndPanels(C, CTX_wm_region(C));
        Py_RETURN_NONE;
 }
 
@@ -413,8 +416,8 @@ static struct PyMethodDef ui_methods[] = {
        {"blockEndAlign", (PyCFunction)Method_blockEndAlign, METH_VARARGS, ""},
        {"blockSetFlag", (PyCFunction)Method_blockSetFlag, METH_VARARGS, ""},
        {"newPanel", (PyCFunction)Method_newPanel, METH_VARARGS, ""},
-       {"drawPanels", (PyCFunction)Method_drawPanels, METH_VARARGS, ""},
-       {"matchPanelsView2d", (PyCFunction)Method_matchPanelsView2d, METH_VARARGS, ""},
+       {"beginPanels", (PyCFunction)Method_beginPanels, METH_VARARGS, ""},
+       {"endPanels", (PyCFunction)Method_endPanels, METH_VARARGS, ""},
        
        {"register", (PyCFunction)Method_register, METH_VARARGS, ""}, // XXX not sure about this - registers current script with the ScriptSpace, like Draw.Register()
        {"registerKey", (PyCFunction)Method_registerKey, METH_VARARGS, ""}, // XXX could have this in another place too