diff options
author | Joshua Leung <aligorith@gmail.com> | 2008-12-16 14:24:24 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2008-12-16 14:24:24 +0300 |
commit | f518fa8ea76a39078ca43eb06fbfaf5aa9ac31dc (patch) | |
tree | 388b8d054697ff04de0a1f1035a5e2c8f55b93ea /source/blender/editors/space_sound/space_sound.c | |
parent | 998e682fc310aa325e54dfcd7c0a9708803ee790 (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/editors/space_sound/space_sound.c')
-rw-r--r-- | source/blender/editors/space_sound/space_sound.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/editors/space_sound/space_sound.c b/source/blender/editors/space_sound/space_sound.c index 18e2c01a2e8..e02f7f4be12 100644 --- a/source/blender/editors/space_sound/space_sound.c +++ b/source/blender/editors/space_sound/space_sound.c @@ -77,7 +77,6 @@ static SpaceLink *sound_new(void) BLI_addtail(&ssound->regionbase, ar); ar->regiontype= RGN_TYPE_HEADER; ar->alignment= RGN_ALIGN_BOTTOM; - UI_view2d_header_default(&ar->v2d); /* main area */ ar= MEM_callocN(sizeof(ARegion), "main area for sound"); @@ -108,6 +107,7 @@ static SpaceLink *sound_new(void) ar->v2d.scroll |= (V2D_SCROLL_LEFT); ar->v2d.keepzoom= 0; ar->v2d.keeptot= 0; + ar->v2d.keepzoom = V2D_LOCKZOOM_Y; return (SpaceLink *)ssound; @@ -144,7 +144,7 @@ static void sound_main_area_init(wmWindowManager *wm, ARegion *ar) { ListBase *keymap; - UI_view2d_size_update(&ar->v2d, ar->winx, ar->winy); + UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_TIMELINE, ar->winx, ar->winy); /* own keymap */ keymap= WM_keymap_listbase(wm, "Sound", SPACE_SOUND, 0); /* XXX weak? */ @@ -187,7 +187,7 @@ void sound_keymap(struct wmWindowManager *wm) /* add handlers, stuff you only do once or on area/region changes */ static void sound_header_area_init(wmWindowManager *wm, ARegion *ar) { - UI_view2d_size_update(&ar->v2d, ar->winx, ar->winy); + UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_HEADER, ar->winx, ar->winy); } static void sound_header_area_draw(const bContext *C, ARegion *ar) |