diff options
author | Ton Roosendaal <ton@blender.org> | 2012-12-26 17:05:39 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2012-12-26 17:05:39 +0400 |
commit | fa28e50ac2a79e4aa481f659b1457e99f2f17557 (patch) | |
tree | c7633940e05de1a1296aa72c9c941518c7ecddcc /source/blender/editors/space_action | |
parent | 4e604642de11603ad1cff1b5b0e679e8a7c13bd9 (diff) |
Region scrollbar fix!
Now scrollbars correctly hide and show, making space for the actual contents
in a region. It solves several old hacks, and puts view2d code a bit more
back in control as well.
Implementation notes:
- The view2d mask feature is working again
- The #define V2D_SCROLL_HORIZONTAL_HIDE means: "turn on hiding".
- Code for UI_view2d_region_reinit() is enforcing better standard view settings
But... two hack/patches needed to be added:
- Region panel drawing: if after generating the button panels it appears
a scroller hides or reveils, it calls all the generating code again.
(a simple scale doesn't work due to rounding differences in layout code)
- View2d code that maps 'tot' and 'cur' rects: if this code detects that
the mask changes, it calcs the map code again.
Also a bugfix (issue in 2.65)
- The left/bottom area split widget was drawing 1 pixel too large sometimes,
leaving bad trails on moving area dividers.
Diffstat (limited to 'source/blender/editors/space_action')
-rw-r--r-- | source/blender/editors/space_action/action_draw.c | 16 | ||||
-rw-r--r-- | source/blender/editors/space_action/space_action.c | 9 |
2 files changed, 6 insertions, 19 deletions
diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c index 9bd7d2a44ca..4b1954c8889 100644 --- a/source/blender/editors/space_action/action_draw.c +++ b/source/blender/editors/space_action/action_draw.c @@ -82,13 +82,7 @@ void draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar) filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS); items = ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); - /* Update max-extent of channels here (taking into account scrollers): - * - this is done to allow the channel list to be scrollable, but must be done here - * to avoid regenerating the list again and/or also because channels list is drawn first - * - offset of ACHANNEL_HEIGHT*2 is added to the height of the channels, as first is for - * start of list offset, and the second is as a correction for the scrollers. - */ - height = ((items * ACHANNEL_STEP) + (ACHANNEL_HEIGHT * 2)); + height = ((items * ACHANNEL_STEP) + (ACHANNEL_HEIGHT)); if (height > BLI_rcti_size_y(&v2d->mask)) { /* don't use totrect set, as the width stays the same * (NOTE: this is ok here, the configuration is pretty straightforward) @@ -199,13 +193,7 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar) filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS); items = ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); - /* Update max-extent of channels here (taking into account scrollers): - * - this is done to allow the channel list to be scrollable, but must be done here - * to avoid regenerating the list again and/or also because channels list is drawn first - * - offset of ACHANNEL_HEIGHT*2 is added to the height of the channels, as first is for - * start of list offset, and the second is as a correction for the scrollers. - */ - height = ((items * ACHANNEL_STEP) + (ACHANNEL_HEIGHT * 2)); + height = ((items * ACHANNEL_STEP) + (ACHANNEL_HEIGHT)); /* don't use totrect set, as the width stays the same * (NOTE: this is ok here, the configuration is pretty straightforward) */ diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c index c5f3ccee101..e0ca589c1fb 100644 --- a/source/blender/editors/space_action/space_action.c +++ b/source/blender/editors/space_action/space_action.c @@ -219,6 +219,9 @@ static void action_channel_area_init(wmWindowManager *wm, ARegion *ar) { wmKeyMap *keymap; + /* ensure the 2d view sync works - main region has bottom scroller */ + ar->v2d.scroll = V2D_SCROLL_BOTTOM; + UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy); /* own keymap */ @@ -231,7 +234,6 @@ static void action_channel_area_draw(const bContext *C, ARegion *ar) /* draw entirely, view changes should be handled here */ bAnimContext ac; View2D *v2d = &ar->v2d; - View2DScrollers *scrollers; /* clear and setup matrix */ UI_ThemeClearColor(TH_BACK); @@ -247,10 +249,7 @@ static void action_channel_area_draw(const bContext *C, ARegion *ar) /* reset view matrix */ UI_view2d_view_restore(C); - /* scrollers */ - scrollers = UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY); - UI_view2d_scrollers_draw(C, v2d, scrollers); - UI_view2d_scrollers_free(scrollers); + /* no scrollers here */ } |