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-16 14:24:24 +0300
committerJoshua Leung <aligorith@gmail.com>2008-12-16 14:24:24 +0300
commitf518fa8ea76a39078ca43eb06fbfaf5aa9ac31dc (patch)
tree388b8d054697ff04de0a1f1035a5e2c8f55b93ea /source/blender/blenloader
parent998e682fc310aa325e54dfcd7c0a9708803ee790 (diff)
View2D: Presets for Initialising Views
Improved the View2D API so that initialising View2D data in init() callbacks (called on new regions and also on resizing regions) for regions is easier. Added a few preset view configurations for use when initialising new views. Views with the V2D_IS_INITIALISED flag set will not be reinitialised in the init() callbacks. Currently, some of these configurations will set/override all settings (like V2D_COMMONVIEW_LIST and V2D_COMMONVIEW_HEADER), while other ones serve a more supplimentary role (i.e. V2D_COMMONVIEW_TIMELINE only sets the x-axis settings, relying on the region to have already set the relevant y-axis settings). The future of such supplimentary configurations is yet to be seen, as I'm currently not sure whether they will cause the code to become too confusing, as you'd have to keep track of which settings belong/are set where. So far, only a few areas have been ported to use this. Tomorrow I'll check on a few more. As this commit touches a lot of files, hopefully there aren't any critical bugs I've missed here.
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/readfile.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index adc7c657019..5452429e8ea 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -5061,7 +5061,7 @@ static void area_add_header_region(ScrArea *sa, ListBase *lb)
/* is copy from ui_view2d.c */
ar->v2d.keepzoom = (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_KEEPZOOM|V2D_KEEPASPECT);
ar->v2d.keepofs = V2D_LOCKOFS_Y;
- ar->v2d.keeptot = 2; // this keeps the view in place when region size changes...
+ ar->v2d.keeptot = V2D_KEEPTOT_STRICT;
ar->v2d.align = V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_NEG_Y;
}
@@ -5116,7 +5116,8 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
ar->v2d.scroll |= (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM_O);
ar->v2d.align = (V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_POS_Y);
ar->v2d.keepzoom |= (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_KEEPASPECT);
- ar->v2d.keeptot = 2;
+ ar->v2d.keeptot = V2D_KEEPTOT_STRICT;
+ ar->v2d.flag |= V2D_IS_INITIALISED;
}
break;
case SPACE_TIME:
@@ -5130,6 +5131,7 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
ar->v2d.keepzoom |= V2D_LOCKZOOM_Y;
ar->v2d.tot.ymin= ar->v2d.cur.ymin= -10.0;
ar->v2d.min[1]= ar->v2d.max[1]= 20.0;
+ ar->v2d.flag |= V2D_IS_INITIALISED;
}
break;
case SPACE_IPO:
@@ -5139,6 +5141,7 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
ar->v2d.scroll |= (V2D_SCROLL_LEFT|V2D_SCROLL_SCALE_VERTICAL);
+ ar->v2d.flag |= V2D_IS_INITIALISED;
break;
}
case SPACE_SOUND:
@@ -5148,6 +5151,7 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
ar->v2d.scroll |= (V2D_SCROLL_LEFT);
+ ar->v2d.flag |= V2D_IS_INITIALISED;
break;
}
case SPACE_NLA:
@@ -5157,6 +5161,7 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
+ ar->v2d.flag |= V2D_IS_INITIALISED;
break;
}
case SPACE_ACTION:
@@ -5166,6 +5171,7 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
+ ar->v2d.flag |= V2D_IS_INITIALISED;
break;
}
case SPACE_SEQ:
@@ -5175,12 +5181,14 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
ar->v2d.scroll |= (V2D_SCROLL_LEFT|V2D_SCROLL_SCALE_VERTICAL);
+ ar->v2d.flag |= V2D_IS_INITIALISED;
break;
}
case SPACE_NODE:
{
SpaceNode *snode= (SpaceNode *)sl;
memcpy(&ar->v2d, &snode->v2d, sizeof(View2D));
+ ar->v2d.flag |= V2D_IS_INITIALISED;
break;
}
case SPACE_BUTS:
@@ -5188,6 +5196,7 @@ 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.keepzoom |= V2D_KEEPASPECT;
+ ar->v2d.flag |= V2D_IS_INITIALISED;
break;
}
//case SPACE_XXX: // FIXME... add other ones