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
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2008-12-11 06:50:50 +0300
committerJoshua Leung <aligorith@gmail.com>2008-12-11 06:50:50 +0300
commit9fa6b03ea715df85f996c04bfe7ef30e09cfa513 (patch)
tree6f599d604884160891548a6a672b1298d5de0065 /source/blender/blenloader
parentf00a75272e33d2e91a394a7a2336be572e1c92f6 (diff)
View2D: Various Fixes + Header Support
Added support for panning headers using View2D of the header regions (only done for TimeLine, as only that one has buttons on it). Currently, this uses some do_versions magic to initialise the View2D rects required, however, I'm not sure if all the information was safely ported over yet (notably height and position of rects due to alignment issues). In the process, I noticed a few bugs with the current View2D code: * UI_view2d_curRect_validate() is now called after UI_view2d_size_update(), as the size of the 'mask' rect is closely related to the size of the 'cur' rect (especially when zooming is locked). * Fixed a bug in UI_view2d_curRect_validate() which meant that if the 'cur' rect was slightly larger than the 'tot' rect, and keeptot was set, the view would flicker between the two closely related positions.
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/readfile.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index fd56709c822..b49ebe3a775 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -5054,7 +5054,36 @@ static void do_versions_windowmanager_2_50(bScreen *screen)
ar->alignment= RGN_ALIGN_BOTTOM;
else
ar->alignment= RGN_ALIGN_TOP;
- // TODO: add conversion stuff for header scrolling to v2d of header region
+
+ /* initialise view2d data for header region, to allow panning */
+ ar->v2d.keepaspect= 1;
+ ar->v2d.keepzoom = (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_KEEPZOOM);
+ ar->v2d.keepofs = V2D_LOCKOFS_Y;
+ ar->v2d.keeptot = 2; // this keeps the view in place when region size changes...
+ ar->v2d.align = V2D_ALIGN_NO_NEG_X;
+
+ ar->v2d.minzoom= ar->v2d.maxzoom= 1.0f;
+
+ ar->v2d.mask.xmin= ar->v2d.mask.ymin= 0;
+ ar->v2d.mask.xmax= sa->winx;
+ ar->v2d.mask.ymax= HEADERY;
+
+ ar->v2d.cur.xmin= sa->headbutofs;
+ ar->v2d.cur.xmax= sa->winx + sa->headbutofs;
+ ar->v2d.tot.xmin= 0.0f;
+ ar->v2d.tot.xmax= sa->headbutlen;
+
+ if (ar->alignment == RGN_ALIGN_BOTTOM) {
+ ar->v2d.align = V2D_ALIGN_NO_NEG_Y;
+ ar->v2d.tot.ymin= ar->v2d.cur.ymin= 0.0f; // what was area->headrct.ymin?
+ ar->v2d.tot.ymax= ar->v2d.cur.ymax= HEADERY;
+ }
+ else {
+ // XXX what were the extents of the old headers?
+ ar->v2d.align = V2D_ALIGN_NO_NEG_Y;
+ ar->v2d.tot.ymin= ar->v2d.cur.ymin= 0.0f; // what was area->headrct.ymin?
+ ar->v2d.tot.ymax= ar->v2d.cur.ymax= HEADERY;
+ }
}
ar= MEM_callocN(sizeof(ARegion), "area region from do_versions");