diff options
author | Joshua Leung <aligorith@gmail.com> | 2008-12-11 06:50:50 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2008-12-11 06:50:50 +0300 |
commit | 9fa6b03ea715df85f996c04bfe7ef30e09cfa513 (patch) | |
tree | 6f599d604884160891548a6a672b1298d5de0065 /source/blender/editors/space_time/space_time.c | |
parent | f00a75272e33d2e91a394a7a2336be572e1c92f6 (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/editors/space_time/space_time.c')
-rw-r--r-- | source/blender/editors/space_time/space_time.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c index 78afe75d013..de7573892aa 100644 --- a/source/blender/editors/space_time/space_time.c +++ b/source/blender/editors/space_time/space_time.c @@ -166,6 +166,12 @@ static void time_main_area_listener(ARegion *ar, wmNotifier *wmn) /* ************************ header time area region *********************** */ +/* add handlers, stuff you only do once or on area/region changes */ +static void time_header_area_init(wmWindowManager *wm, ARegion *ar) +{ + UI_view2d_size_update(&ar->v2d, ar->winx, ar->winy); +} + static void time_header_area_draw(const bContext *C, ARegion *ar) { float col[3]; @@ -178,8 +184,14 @@ static void time_header_area_draw(const bContext *C, ARegion *ar) glClearColor(col[0], col[1], col[2], 0.0); glClear(GL_COLOR_BUFFER_BIT); - + + /* set view2d view matrix for scrolling (without scrollers) */ + UI_view2d_view_ortho(C, &ar->v2d); + time_header_buttons(C, ar); + + /* restore view matrix? */ + UI_view2d_view_restore(C); } static void time_header_area_free(ARegion *ar) @@ -279,8 +291,9 @@ void ED_spacetype_time(void) art= MEM_callocN(sizeof(ARegionType), "spacetype time region"); art->regionid = RGN_TYPE_HEADER; art->minsizey= HEADERY; - art->keymapflag= ED_KEYMAP_UI; + art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D; + art->init= time_header_area_init; art->draw= time_header_area_draw; art->free= time_header_area_free; BLI_addhead(&st->regiontypes, art); |