Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2008-12-01 14:37:05 +0300
committerJoshua Leung <aligorith@gmail.com>2008-12-01 14:37:05 +0300
commit1a354bd31097729b3e19b0a4786fcc7248c10ad2 (patch)
treeb34e07e713e7ae91b261c1647850874c6d0e64bf /source
parent3ff7c28e7bcd5790afae0bf40ff9c421af14afd2 (diff)
View2D - Zoom + More Scrollbar work
* Added basic (non-modal) zoom operators that use a uniform scale factor, with zoom centered using the view center as scaling point. Use Scrollwheel up/down and Pad +/- to use this. * Added back the 'button'/bubble for the scrollbars. I've added dark lines on either end of it for some later work on zooming widgets. This is not the final form they'll take. I still need to decide how to handle those scrollbars which act as grid-markers too (showing timescale, etc.), before trying to integrate that with some fancy scrollbar drawing (rounded, etc.) Assorted changes: * Moved vertical scrollbar for Outliner to right hand side * Made Timeline use standard scrollbars, and turned on various clamping options * Fixed ortho-matrix corrections for scrollbars, and added pixel offsets * Made Timeline markers sit more snugly on the scrollbar. They were a bit far out... * Fixed memory leak with view2d keymaps not being freed when Blender exited
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenloader/intern/readfile.c18
-rw-r--r--source/blender/editors/include/UI_view2d.h2
-rw-r--r--source/blender/editors/interface/view2d.c99
-rw-r--r--source/blender/editors/interface/view2d_ops.c172
-rw-r--r--source/blender/editors/space_outliner/space_outliner.c7
-rw-r--r--source/blender/editors/space_time/ed_markers.c2
-rw-r--r--source/blender/editors/space_time/space_time.c6
-rw-r--r--source/blender/makesdna/DNA_screen_types.h12
-rw-r--r--source/blender/makesdna/DNA_view2d_types.h18
-rw-r--r--source/blender/windowmanager/intern/wm.c1
10 files changed, 293 insertions, 44 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index a4038f29c3b..097c654de51 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -5073,12 +5073,26 @@ static void do_versions_windowmanager_2_50(bScreen *screen)
/* if active spacetype has view2d data, copy that over to main region */
switch(sa->spacetype) {
case SPACE_OOPS:
- memcpy(&ar->v2d, &((SpaceOops *)sa->spacedata.first)->v2d, sizeof(View2D));
+ {
+ SpaceOops *soops= sa->spacedata.first;
+
+ memcpy(&ar->v2d, &soops->v2d, sizeof(View2D));
+ ar->v2d.scroll &= ~L_SCROLL;
+ ar->v2d.scroll |= R_SCROLL;
+ }
break;
case SPACE_TIME:
- memcpy(&ar->v2d, &((SpaceTime *)sa->spacedata.first)->v2d, sizeof(View2D));
+ {
+ SpaceTime *stime= sa->spacedata.first;
+ memcpy(&ar->v2d, &stime->v2d, sizeof(View2D));
+
+ ar->v2d.scroll |= (B_SCROLL|BGRID_SCROLL);
+ ar->v2d.keepofs |= V2D_LOCKOFS_Y;
+ }
break;
//case SPACE_XXX: // FIXME... add other ones
+ // memcpy(&ar->v2d, &((SpaceXxx *)sa->spacedata.first)->v2d, sizeof(View2D));
+ // break;
}
}
}
diff --git a/source/blender/editors/include/UI_view2d.h b/source/blender/editors/include/UI_view2d.h
index d70a8e55f63..558c6ca435f 100644
--- a/source/blender/editors/include/UI_view2d.h
+++ b/source/blender/editors/include/UI_view2d.h
@@ -93,7 +93,7 @@ void UI_view2d_free_grid(View2DGrid *grid);
/* scrollbar drawing */
View2DScrollers *UI_view2d_calc_scrollers(const struct bContext *C, struct View2D *v2d, short units, short clamp);
void UI_view2d_draw_scrollers(const struct bContext *C, struct View2D *v2d, View2DScrollers *scrollers, int flag);
-void UI_view2d_free_scrollbars(View2DScrollers *scrollers);
+void UI_view2d_free_scrollers(View2DScrollers *scrollers);
/* coordinate conversion */
void UI_view2d_region_to_view(struct View2D *v2d, short x, short y, float *viewx, float *viewy);
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index 3d8eb06b0b9..b8db6bf5baf 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -48,33 +48,33 @@
/* *********************************************************************** */
/* Setup and Refresh Code */
-
-/* ---------------------- */
-
/* Set view matrices to ortho for View2D drawing */
void UI_view2d_view_ortho(const bContext *C, View2D *v2d)
{
ARegion *region= C->region;
int winx, winy;
- float ofsx, ofsy;
+ float ofsx1, ofsy1, ofsx2, ofsy2;
/* calculate extents of region */
winx= region->winrct.xmax - region->winrct.xmin;
winy= region->winrct.ymax - region->winrct.ymin;
- ofsx= ofsy= 0.0f;
+ ofsx1= ofsy1= ofsx2= ofsy2= 0.0f;
/* these checks here make sure that the region is large-enough to show scrollers */
if ((winx > SCROLLB+10) && (winy > SCROLLH+10)) {
- if (v2d->scroll) {
- if (v2d->scroll & (HOR_SCROLL|HOR_SCROLLO))
- ofsy= (float)-SCROLLB;
- if (v2d->scroll & VERT_SCROLL)
- ofsx= (float)-SCROLLH;
- }
+ /* calculate offset factor required on each axis */
+ if (v2d->scroll & L_SCROLL)
+ ofsy1= (float)SCROLLB;
+ if (v2d->scroll & R_SCROLL)
+ ofsy2= (float)SCROLLB;
+ if (v2d->scroll & T_SCROLL)
+ ofsx1= (float)SCROLLH;
+ if (v2d->scroll & B_SCROLL)
+ ofsx2= (float)SCROLLH;
}
/* note: 0.375 is constant factor to get 1:1 correspondance with pixels */
- wmOrtho2(C->window, v2d->cur.xmin+ofsx-0.375f, v2d->cur.xmax-0.375f, v2d->cur.ymin+ofsy-0.375f, v2d->cur.ymax-0.375f);
+ wmOrtho2(C->window, v2d->cur.xmin-ofsx1-0.375f, v2d->cur.xmax-ofsx2-0.375f, v2d->cur.ymin-ofsy1-0.375f, v2d->cur.ymax-ofsx2-0.375f);
}
/* Restore view matrices after drawing */
@@ -590,18 +590,60 @@ void UI_view2d_free_grid(View2DGrid *grid)
struct View2DScrollers {
View2DGrid *grid; /* grid for coordinate drawing */
- int vertmin, vertmax; /* vertical scrollbar - current 'focus' button */
- int hormin, hormax; /* horizontal scrollbar - current 'focus' button */
+ int vert_min, vert_max; /* vertical scrollbar - current 'focus' button */
+ int hor_min, hor_max; /* horizontal scrollbar - current 'focus' button */
};
+/* Calculate relevant scroller properties */
View2DScrollers *UI_view2d_calc_scrollers(const bContext *C, View2D *v2d, short units, short clamp)
{
View2DScrollers *scrollers;
+ rcti vert, hor;
+ float fac, totsize, scrollsize;
+
+ vert= v2d->vert;
+ hor= v2d->hor;
/* scrollers is allocated here... */
scrollers= MEM_callocN(sizeof(View2DScrollers), "View2DScrollers");
- // ... add some stuff here...
+ /* slider 'buttons':
+ * - These should always remain within the visible region of the scrollbar
+ * - They represent the region of 'tot' that is visible in 'cur'
+ */
+ /* slider 'button' extents - horizontal */
+ if (v2d->scroll & (HOR_SCROLL|HOR_SCROLLO)) {
+ totsize= v2d->tot.xmax - v2d->tot.xmin;
+ scrollsize= hor.xmax - hor.xmin;
+
+ fac= (v2d->cur.xmin- v2d->tot.xmin) / totsize;
+ //if (fac < 0.0f) fac= 0.0f;
+ scrollers->hor_min= hor.xmin + (fac * scrollsize);
+
+ fac= (v2d->cur.xmax - v2d->tot.xmin) / totsize;
+ //if (fac > 1.0f) fac= 1.0f;
+ scrollers->hor_max= hor.xmin + (fac * scrollsize);
+
+ if (scrollers->hor_min > scrollers->hor_max)
+ scrollers->hor_min= scrollers->hor_max;
+ }
+
+ /* slider 'button' extents - vertical */
+ if (v2d->scroll & VERT_SCROLL) {
+ totsize= v2d->tot.ymax - v2d->tot.ymin;
+ scrollsize= vert.ymax - vert.ymin;
+
+ fac= (v2d->cur.ymin- v2d->tot.ymin) / totsize;
+ //if (fac < 0.0f) fac= 0.0f;
+ scrollers->vert_min= vert.ymin + (fac * scrollsize);
+
+ fac= (v2d->cur.ymax - v2d->tot.ymin) / totsize;
+ //if (fac > 1.0f) fac= 1.0f;
+ scrollers->vert_max= vert.ymin + (fac * scrollsize);
+
+ if (scrollers->vert_min > scrollers->vert_max)
+ scrollers->vert_min= scrollers->vert_max;
+ }
return scrollers;
}
@@ -611,19 +653,28 @@ View2DScrollers *UI_view2d_calc_scrollers(const bContext *C, View2D *v2d, short
void UI_view2d_draw_scrollers(const bContext *C, View2D *v2d, View2DScrollers *scrollers, int flag)
{
const int darker= -40, dark= 0, light= 20, lighter= 50;
- float fac, dfac, val, fac2, tim;
rcti vert, hor;
vert= v2d->vert;
hor= v2d->hor;
/* horizontal scrollbar */
- if ((v2d->scroll & HOR_SCROLL) || (v2d->scroll & HOR_SCROLLO)) {
+ if (v2d->scroll & (HOR_SCROLL|HOR_SCROLLO)) {
/* scroller backdrop */
UI_ThemeColorShade(TH_SHADE1, light);
glRecti(hor.xmin, hor.ymin, hor.xmax, hor.ymax);
- // FIXME: add slider bar
+ /* slider 'button' */
+ // FIXME: implement fancy one... but only when we get this working first!
+ UI_ThemeColorShade(TH_SHADE1, dark);
+ glRecti(scrollers->hor_min, hor.ymin, scrollers->hor_max, hor.ymax);
+
+ /* draw lines on either end of 'box' */
+ glLineWidth(2.0);
+ UI_ThemeColorShade(TH_SHADE1, darker);
+ sdrawline(scrollers->hor_min, hor.ymin, scrollers->hor_min, hor.ymax);
+ sdrawline(scrollers->hor_max, hor.ymin, scrollers->hor_max, hor.ymax);
+ glLineWidth(1.0);
/* decoration bright line */
UI_ThemeColorShade(TH_SHADE1, lighter);
@@ -636,6 +687,18 @@ void UI_view2d_draw_scrollers(const bContext *C, View2D *v2d, View2DScrollers *s
UI_ThemeColorShade(TH_SHADE1, light);
glRecti(vert.xmin, vert.ymin, vert.xmax, vert.ymax);
+ /* slider 'button' */
+ // FIXME: implement fancy one... but only when we get this working first!
+ UI_ThemeColorShade(TH_SHADE1, dark);
+ glRecti(vert.xmin, scrollers->vert_min, vert.xmax, scrollers->vert_max);
+
+ /* draw lines on either end of 'box' */
+ glLineWidth(2.0);
+ UI_ThemeColorShade(TH_SHADE1, darker);
+ sdrawline(vert.xmin, scrollers->vert_min, vert.xmax, scrollers->vert_min);
+ sdrawline(vert.xmin, scrollers->vert_max, vert.xmax, scrollers->vert_max);
+ glLineWidth(1.0);
+
/* decoration black line */
UI_ThemeColorShade(TH_SHADE1, darker);
if (v2d->scroll & HOR_SCROLL)
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c
index 945fad83a91..185980e045a 100644
--- a/source/blender/editors/interface/view2d_ops.c
+++ b/source/blender/editors/interface/view2d_ops.c
@@ -54,13 +54,12 @@
/* This group of operators come in several forms:
* 1) Modal 'dragging' with MMB - where movement of mouse dictates amount to pan view by
* 2) Scrollwheel 'steps' - rolling mousewheel by one step moves view by predefined amount
- * 3) Scroller drag - similar to 1), but only while mouse is still in view
*
* In order to make sure this works, each operator must define the following RNA-Operator Props:
* deltax, deltay - define how much to move view by (relative to zoom-correction factor)
*/
- /* ------------------ Shared 'core' stuff ---------------------- */
+/* ------------------ Shared 'core' stuff ---------------------- */
/* temp customdata for operator */
typedef struct v2dViewPanData {
@@ -92,7 +91,7 @@ static int view_pan_init(bContext *C, wmOperator *op)
/* set pointers to owners */
vpd->region= ar= C->region;
- vpd->v2d= v2d= &C->region->v2d;
+ vpd->v2d= v2d= &ar->v2d;
/* calculate translation factor - based on size of view */
winx= (float)(ar->winrct.xmax - ar->winrct.xmin);
@@ -241,8 +240,8 @@ void ED_View2D_OT_view_pan(wmOperatorType *ot)
}
/* ------------------ Scrollwheel Versions (2) ---------------------- */
-// XXX should these be unified a bit?
+// XXX scroll down operator not working yet! (doesn't get called on wheeldownmouse for some reason)
/* this operator only needs this single callback, where it callsthe view_pan_*() methods */
static int view_scrollright_exec(bContext *C, wmOperator *op)
{
@@ -313,7 +312,7 @@ void ED_View2D_OT_view_scrollleft(wmOperatorType *ot)
prop= RNA_def_property(ot->srna, "deltay", PROP_INT, PROP_NONE);
}
-
+// XXX scroll down operator not working yet! (doesn't get called on wheeldownmouse for some reason)
/* this operator only needs this single callback, where it callsthe view_pan_*() methods */
static int view_scrolldown_exec(bContext *C, wmOperator *op)
{
@@ -385,6 +384,161 @@ void ED_View2D_OT_view_scrollup(wmOperatorType *ot)
}
/* ********************************************************* */
+/* VIEW ZOOMING OPERATOR */
+
+/* This group of operators come in several forms:
+ * 1) Modal 'dragging' with MMB - where movement of mouse dictates amount to zoom view by
+ * 2) Scrollwheel 'steps' - rolling mousewheel by one step moves view by predefined amount
+ * 3) Pad +/- Keys - pressing each key moves the zooms the view by a predefined amount
+ *
+ * In order to make sure this works, each operator must define the following RNA-Operator Props:
+ * zoomfacx, zoomfacy - sometimes it's still useful to have non-uniform scaling
+ */
+
+/* ------------------ Shared 'core' stuff ---------------------- */
+
+/* temp customdata for operator */
+typedef struct v2dViewZoomData {
+ ARegion *region; /* region we're operating in */
+ View2D *v2d; /* view2d we're operating in */
+
+ int startx, starty; /* mouse x/y values in window when operator was initiated */
+ int lastx, lasty; /* previous x/y values of mouse in window */
+} v2dViewZoomData;
+
+/* initialise zooming customdata */
+static int view_zoom_init(bContext *C, wmOperator *op)
+{
+ v2dViewZoomData *vzd;
+ ARegion *ar;
+
+ /* regions now have v2d-data by default, so check for region */
+ if (C->region == NULL)
+ return 0;
+
+ /* set custom-data for operator */
+ vzd= MEM_callocN(sizeof(v2dViewZoomData), "v2dViewZoomData");
+ op->customdata= vzd;
+
+ /* set pointers to owners */
+ vzd->region= ar= C->region;
+ vzd->v2d= &ar->v2d;
+
+ return 1;
+}
+
+/* apply transform to view (i.e. adjust 'cur' rect) */
+static void view_zoom_apply(bContext *C, wmOperator *op)
+{
+ v2dViewZoomData *vzd= op->customdata;
+ View2D *v2d= vzd->v2d;
+ float dx, dy;
+
+ /* calculate amount to move view by */
+ dx= (v2d->cur.xmax - v2d->cur.xmin) * (float)RNA_float_get(op->ptr, "zoomfacx");
+ dy= (v2d->cur.ymax - v2d->cur.ymin) * (float)RNA_float_get(op->ptr, "zoomfacy");
+
+ /* only move view on an axis if change is allowed */
+ // FIXME: this still only allows for zooming around 'center' of view... userdefined center is more useful!
+ if ((v2d->keepofs & V2D_LOCKOFS_X)==0) {
+ v2d->cur.xmin += dx;
+ v2d->cur.xmax -= dx;
+ }
+ if ((v2d->keepofs & V2D_LOCKOFS_Y)==0) {
+ v2d->cur.ymin += dy;
+ v2d->cur.ymax -= dy;
+ }
+
+ /* request updates to be done... */
+ WM_event_add_notifier(C->wm, C->window, 0, WM_NOTE_AREA_REDRAW, 0, NULL);
+ /* XXX: add WM_NOTE_TIME_CHANGED? */
+}
+
+/* cleanup temp customdata */
+static void view_zoom_exit(bContext *C, wmOperator *op)
+{
+ if (op->customdata) {
+ MEM_freeN(op->customdata);
+ op->customdata= NULL;
+ }
+}
+
+/* ------------------ Single-step non-modal zoom (2 and 3) ---------------------- */
+
+/* this operator only needs this single callback, where it callsthe view_zoom_*() methods */
+// FIXME: this should be invoke (with event pointer), so that we can do non-modal but require pointer for centerpoint
+static int view_zoomin_exec(bContext *C, wmOperator *op)
+{
+ /* initialise default settings (and validate if ok to run) */
+ if (!view_zoom_init(C, op))
+ return OPERATOR_CANCELLED;
+
+ /* set RNA-Props - zooming in by uniform factor */
+ RNA_float_set(op->ptr, "zoomfacx", 0.0375);
+ RNA_float_set(op->ptr, "zoomfacy", 0.0375);
+
+ /* apply movement, then we're done */
+ view_zoom_apply(C, op);
+ view_zoom_exit(C, op);
+
+ return OPERATOR_FINISHED;
+}
+
+void ED_View2D_OT_view_zoomin(wmOperatorType *ot)
+{
+ PropertyRNA *prop;
+
+ /* identifiers */
+ ot->name= "Zoom In";
+ ot->idname= "ED_View2D_OT_view_zoomin";
+
+ /* api callbacks */
+ ot->exec= view_zoomin_exec;
+
+ /* rna - must keep these in sync with the other operators */
+ prop= RNA_def_property(ot->srna, "zoomfacx", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(ot->srna, "zoomfacy", PROP_FLOAT, PROP_NONE);
+}
+
+
+
+/* this operator only needs this single callback, where it callsthe view_zoom_*() methods */
+// FIXME: this should be invoke (with event pointer), so that we can do non-modal but require pointer for centerpoint
+static int view_zoomout_exec(bContext *C, wmOperator *op)
+{
+ /* initialise default settings (and validate if ok to run) */
+ if (!view_zoom_init(C, op))
+ return OPERATOR_CANCELLED;
+
+ /* set RNA-Props - zooming in by uniform factor */
+ RNA_float_set(op->ptr, "zoomfacx", -0.0375);
+ RNA_float_set(op->ptr, "zoomfacy", -0.0375);
+
+ /* apply movement, then we're done */
+ view_zoom_apply(C, op);
+ view_zoom_exit(C, op);
+
+ return OPERATOR_FINISHED;
+}
+
+void ED_View2D_OT_view_zoomout(wmOperatorType *ot)
+{
+ PropertyRNA *prop;
+
+ /* identifiers */
+ ot->name= "Zoom Out";
+ ot->idname= "ED_View2D_OT_view_zoomout";
+
+ /* api callbacks */
+ ot->exec= view_zoomout_exec;
+
+ /* rna - must keep these in sync with the other operators */
+ prop= RNA_def_property(ot->srna, "zoomfacx", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(ot->srna, "zoomfacy", PROP_FLOAT, PROP_NONE);
+}
+
+
+/* ********************************************************* */
/* Registration */
void ui_view2d_operatortypes(void)
@@ -395,6 +549,9 @@ void ui_view2d_operatortypes(void)
WM_operatortype_append(ED_View2D_OT_view_scrollright);
WM_operatortype_append(ED_View2D_OT_view_scrollup);
WM_operatortype_append(ED_View2D_OT_view_scrolldown);
+
+ WM_operatortype_append(ED_View2D_OT_view_zoomin);
+ WM_operatortype_append(ED_View2D_OT_view_zoomout);
}
void UI_view2d_keymap(wmWindowManager *wm)
@@ -411,6 +568,11 @@ void UI_view2d_keymap(wmWindowManager *wm)
WM_keymap_add_item(&wm->view2dkeymap, "ED_View2D_OT_view_upscroll", WHEELUPMOUSE, KM_PRESS, KM_SHIFT, 0);
/* zoom */
+ WM_keymap_add_item(&wm->view2dkeymap, "ED_View2D_OT_view_zoomout", WHEELUPMOUSE, KM_PRESS, 0, 0);
+ WM_keymap_add_item(&wm->view2dkeymap, "ED_View2D_OT_view_zoomin", WHEELDOWNMOUSE, KM_PRESS, 0, 0);
+ WM_keymap_add_item(&wm->view2dkeymap, "ED_View2D_OT_view_zoomout", PADMINUS, KM_PRESS, 0, 0);
+ WM_keymap_add_item(&wm->view2dkeymap, "ED_View2D_OT_view_zoomin", PADPLUSKEY, KM_PRESS, 0, 0);
+
/* scrollbars */
//WM_keymap_add_item(&wm->view2dkeymap, "ED_V2D_OT_scrollbar_activate", MOUSEMOVE, 0, 0, 0);
diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c
index 80f71fc71c2..6362df7d26c 100644
--- a/source/blender/editors/space_outliner/space_outliner.c
+++ b/source/blender/editors/space_outliner/space_outliner.c
@@ -340,6 +340,7 @@ static void outliner_main_area_draw(const bContext *C, ARegion *ar)
int rows, cols, awidth, aheight, width, height;
SpaceOops *soutliner= C->area->spacedata.first;
View2D *v2d= &ar->v2d;
+ View2DScrollers *scrollers;
/* clear */
UI_GetThemeColor3fv(TH_BACK, col);
@@ -407,7 +408,6 @@ static void outliner_main_area_draw(const bContext *C, ARegion *ar)
rct.ymax= 0;
/* set matrix for 2d-view controls */
- //UI_view2d_view_init(C, v2d);
UI_view2d_view_ortho(C, v2d);
/* create and draw table */
@@ -423,8 +423,9 @@ static void outliner_main_area_draw(const bContext *C, ARegion *ar)
UI_view2d_view_restore(C);
/* scrollers */
- // FIXME: this is just a quick test
- UI_view2d_draw_scrollers(C, &ar->v2d, NULL, (0));
+ scrollers= UI_view2d_calc_scrollers(C, v2d, 0, 0); // XXX last two vars here are useless
+ UI_view2d_draw_scrollers(C, v2d, scrollers, (0));
+ UI_view2d_free_scrollers(scrollers);
}
static void outliner_main_area_free(ARegion *ar)
diff --git a/source/blender/editors/space_time/ed_markers.c b/source/blender/editors/space_time/ed_markers.c
index 1d513d3911b..590b09b886b 100644
--- a/source/blender/editors/space_time/ed_markers.c
+++ b/source/blender/editors/space_time/ed_markers.c
@@ -137,7 +137,7 @@ static void draw_marker(View2D *v2d, TimeMarker *marker, int cfra, int flag)
ICON_MARKER;
}
- UI_icon_draw(xpos*xscale-5.0, 12.0, icon_id);
+ UI_icon_draw(xpos*xscale-5.0, 8.0, icon_id);
glBlendFunc(GL_ONE, GL_ZERO);
glDisable(GL_BLEND);
diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c
index 5a8666d991b..d29af67950b 100644
--- a/source/blender/editors/space_time/space_time.c
+++ b/source/blender/editors/space_time/space_time.c
@@ -114,6 +114,7 @@ static void time_main_area_draw(const bContext *C, ARegion *ar)
SpaceTime *stime= C->area->spacedata.first;
View2D *v2d= &ar->v2d;
View2DGrid *grid;
+ View2DScrollers *scrollers;
float col[3];
int unit, winx, winy;
@@ -148,8 +149,9 @@ static void time_main_area_draw(const bContext *C, ARegion *ar)
UI_view2d_view_restore(C);
/* scrollers */
- // FIXME: this is just a quick test
- UI_view2d_draw_scrollers(C, &ar->v2d, NULL, (0));
+ scrollers= UI_view2d_calc_scrollers(C, v2d, unit, V2D_GRID_CLAMP);
+ UI_view2d_draw_scrollers(C, v2d, scrollers, (0));
+ UI_view2d_free_scrollers(scrollers);
}
static void time_main_area_listener(ARegion *ar, wmNotifier *wmn)
diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h
index 2f25d96f285..28ec73a00d1 100644
--- a/source/blender/makesdna/DNA_screen_types.h
+++ b/source/blender/makesdna/DNA_screen_types.h
@@ -181,18 +181,6 @@ typedef struct ARegion {
#define WIN_BACK_OK 2
#define WIN_EQUAL 3
-/* scrollbar flags for View2D */
- /* left scrollbar */
-#define L_SCROLL 1
-#define R_SCROLL 2
-#define VERT_SCROLL 3
-#define T_SCROLL 4
-#define B_SCROLL 8
-#define HOR_SCROLL 12
- /* special hack for outliner hscroll - prevent hanging older versions of Blender */
-#define B_SCROLLO 16
-#define HOR_SCROLLO 20
-
/* Panel->snap - for snapping to screen edges */
#define PNL_SNAP_NONE 0
#define PNL_SNAP_TOP 1
diff --git a/source/blender/makesdna/DNA_view2d_types.h b/source/blender/makesdna/DNA_view2d_types.h
index 0a44b6b8759..683a40a3682 100644
--- a/source/blender/makesdna/DNA_view2d_types.h
+++ b/source/blender/makesdna/DNA_view2d_types.h
@@ -82,5 +82,23 @@ typedef struct View2D {
/* width */
#define SCROLLB 16
+/* scrollbar flags for View2D */
+ /* left scrollbar */
+#define L_SCROLL (1<<0)
+#define R_SCROLL (1<<1)
+#define VERT_SCROLL (L_SCROLL|R_SCROLL)
+ /* horizontal scrollbar */
+#define T_SCROLL (1<<2)
+#define B_SCROLL (1<<3)
+#define HOR_SCROLL (T_SCROLL|B_SCROLL)
+ /* special hacks for outliner hscroll - prevent hanging older versions of Blender */
+#define B_SCROLLO (1<<4)
+#define HOR_SCROLLO (T_SCROLL|B_SCROLLO)
+ /* scale markings */
+#define LGRID_SCROLL (1<<5)
+#define RGRID_SCROLL (1<<6)
+#define BGRID_SCROLL (1<<7)
+#define TGRID_SCROLL (1<<8)
+
#endif
diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c
index bc7f70d08ef..4a5407b2d66 100644
--- a/source/blender/windowmanager/intern/wm.c
+++ b/source/blender/windowmanager/intern/wm.c
@@ -153,6 +153,7 @@ void wm_close_and_free(bContext *C, wmWindowManager *wm)
}
BLI_freelistN(&wm->timekeymap);
+ BLI_freelistN(&wm->view2dkeymap);
BLI_freelistN(&wm->uikeymap);
BLI_freelistN(&wm->windowkeymap);
BLI_freelistN(&wm->screenkeymap);