2.5 - Scrollbars are now shown when a list of panels can't fit in view
authorJoshua Leung <aligorith@gmail.com>
Tue, 14 Jul 2009 10:59:21 +0000 (10:59 +0000)
committerJoshua Leung <aligorith@gmail.com>
Tue, 14 Jul 2009 10:59:21 +0000 (10:59 +0000)
Notes:
- These may be taking up a bit too much room in some situations. Perhaps an option to turn these on/off is needed?
- I've added a quick hack in area.c -> ED_region_panels_init() to set the flags to make scrollbars show up in regions whose View2D data has already been initialised. This is primarily aimed at the Buttons Window in the 2.5 defaults file, which seems to have been saved in 2.5 or so
- The expand icons on either end of the scrollers don't really seem to be necessary? (or not working yet)

source/blender/blenloader/intern/readfile.c
source/blender/editors/interface/view2d.c
source/blender/editors/interface/view2d_ops.c
source/blender/editors/screen/area.c

index 06092cc97d42a642f65af73632e8f3f7dd525ea0..12d95888c0e6bb332cbf6e134852d3a8ba5253e0 100644 (file)
@@ -5839,6 +5839,8 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
                        {
                                SpaceButs *sbuts= (SpaceButs *)sl;
                                memcpy(&ar->v2d, &sbuts->v2d, sizeof(View2D));
+                               
+                               ar->v2d.scroll |= (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM); 
                                break;
                        }
                        case SPACE_FILE:
index 6df7b1c8e281b970ceaea43629741def1b1d3fee..2f92901c8f55cd6d5ef6192aa8b6e397cff9288f 100644 (file)
@@ -262,6 +262,8 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
                                v2d->align= (V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_POS_Y);
                                v2d->keeptot= V2D_KEEPTOT_BOUNDS;
                                
+                               v2d->scroll |= (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM);
+                               
                                v2d->tot.xmin= 0.0f;
                                v2d->tot.xmax= winx;
                                
@@ -270,10 +272,10 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
                                
                                v2d->cur.xmin= 0.0f;
                                v2d->cur.xmax= winx*style->panelzoom;
-
+                               
                                v2d->cur.ymax= 0.0f;
                                v2d->cur.ymin= -winy*style->panelzoom;
-
+                               
                                v2d->cur.ymax= 0.0f;
                                v2d->cur.ymin= -winy*style->panelzoom;
                        }
index 14872f05f8a16be37b7d5bd69bbfdddaec58d3d9..c6688aea5c5ec5a4e9795b8bd12f2ab15b6a71df 100644 (file)
@@ -1404,5 +1404,6 @@ void UI_view2d_keymap(wmWindowManager *wm)
        WM_keymap_add_item(keymap, "VIEW2D_OT_zoom_out", PADMINUS, KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "VIEW2D_OT_zoom_in", PADPLUSKEY, KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "VIEW2D_OT_reset", HOMEKEY, KM_PRESS, 0, 0);
+       WM_keymap_add_item(keymap, "VIEW2D_OT_scroller_activate", LEFTMOUSE, KM_PRESS, 0, 0);
 }
 
index 69af4fbb45d021cdcb889a6020558d1b14a571fb..e923a3bde612736f2afcc660bb3889127062c74b 100644 (file)
@@ -1116,6 +1116,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, char *contex
        PanelType *pt;
        Panel *panel;
        View2D *v2d= &ar->v2d;
+       View2DScrollers *scrollers;
        float col[3];
        int xco, yco, x, y, miny=0, w, em, header, triangle, open;
 
@@ -1242,12 +1243,20 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, char *contex
        
        /* restore view matrix */
        UI_view2d_view_restore(C);
+       
+       /* scrollers */
+       scrollers= UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
+       UI_view2d_scrollers_draw(C, v2d, scrollers);
+       UI_view2d_scrollers_free(scrollers);
 }
 
 void ED_region_panels_init(wmWindowManager *wm, ARegion *ar)
 {
        ListBase *keymap;
-
+       
+       // XXX quick hack for files saved with 2.5 already (i.e. the builtin defaults file)
+       ar->v2d.scroll |= (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM); 
+       
        UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_PANELS_UI, ar->winx, ar->winy);
 
        keymap= WM_keymap_listbase(wm, "View2D Buttons List", 0, 0);