diff options
Diffstat (limited to 'source/blender/editors/screen')
-rw-r--r-- | source/blender/editors/screen/area.c | 75 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_edit.c | 2 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 15 |
3 files changed, 62 insertions, 30 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index f42dae6530a..aa0ae22a003 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -470,8 +470,8 @@ void ED_region_tag_redraw(ARegion *ar) * but python scripts can cause this to happen indirectly */ if (ar && !(ar->do_draw & RGN_DRAWING)) { /* zero region means full region redraw */ - ar->do_draw &= ~RGN_DRAW_PARTIAL; /* just incase */ - ar->do_draw = RGN_DRAW; + ar->do_draw &= ~RGN_DRAW_PARTIAL; + ar->do_draw |= RGN_DRAW; memset(&ar->drawrct, 0, sizeof(ar->drawrct)); } } @@ -492,9 +492,9 @@ void ED_region_tag_refresh_ui(ARegion *ar) void ED_region_tag_redraw_partial(ARegion *ar, rcti *rct) { if (ar && !(ar->do_draw & RGN_DRAWING)) { - if (!ar->do_draw) { + if (!(ar->do_draw & RGN_DRAW)) { /* no redraw set yet, set partial region */ - ar->do_draw = RGN_DRAW_PARTIAL; + ar->do_draw |= RGN_DRAW_PARTIAL; ar->drawrct = *rct; } else if (ar->drawrct.xmin != ar->drawrct.xmax) { @@ -889,38 +889,59 @@ static int rct_fits(rcti *rect, char dir, int size) /* function checks if some overlapping region was defined before - on same place */ static void region_overlap_fix(ScrArea *sa, ARegion *ar) { - ARegion *ar1 = ar->prev; - + ARegion *ar1; + const int align = ar->alignment & ~RGN_SPLIT_PREV; + int align1 = 0; + /* find overlapping previous region on same place */ - while (ar1) { - if (ar1->overlap) { - if ((ar1->alignment & RGN_SPLIT_PREV) == 0) - if (BLI_rcti_isect(&ar1->winrct, &ar->winrct, NULL)) - break; + for (ar1 = ar->prev; ar1; ar1 = ar1->prev) { + if (ar1->overlap && ((ar1->alignment & RGN_SPLIT_PREV) == 0)) { + align1 = ar1->alignment; + if (BLI_rcti_isect(&ar1->winrct, &ar->winrct, NULL)) { + if (align1 != align) { + /* Left overlapping right or vice-versa, forbid this! */ + ar->flag |= RGN_FLAG_TOO_SMALL; + return; + } + /* Else, we have our previous region on same side. */ + break; + } } - ar1 = ar1->prev; } - + /* translate or close */ if (ar1) { - int align1 = ar1->alignment & ~RGN_SPLIT_PREV; - if (align1 == RGN_ALIGN_LEFT) { - if (ar->winrct.xmax + ar1->winx > sa->winx - U.widget_unit) + if (ar->winrct.xmax + ar1->winx > sa->winx - U.widget_unit) { ar->flag |= RGN_FLAG_TOO_SMALL; - else + return; + } + else { BLI_rcti_translate(&ar->winrct, ar1->winx, 0); + } } else if (align1 == RGN_ALIGN_RIGHT) { - if (ar->winrct.xmin - ar1->winx < U.widget_unit) + if (ar->winrct.xmin - ar1->winx < U.widget_unit) { ar->flag |= RGN_FLAG_TOO_SMALL; - else + return; + } + else { BLI_rcti_translate(&ar->winrct, -ar1->winx, 0); + } } } - - + /* At this point, 'ar' is in its final position and still open. + * Make a final check it does not overlap any previous 'other side' region. */ + for (ar1 = ar->prev; ar1; ar1 = ar1->prev) { + if (ar1->overlap && (ar1->alignment & RGN_SPLIT_PREV) == 0) { + if ((ar1->alignment != align) && BLI_rcti_isect(&ar1->winrct, &ar->winrct, NULL)) { + /* Left overlapping right or vice-versa, forbid this! */ + ar->flag |= RGN_FLAG_TOO_SMALL; + return; + } + } + } } /* overlapping regions only in the following restricted cases */ @@ -929,11 +950,11 @@ static bool region_is_overlap(wmWindow *win, ScrArea *sa, ARegion *ar) if (U.uiflag2 & USER_REGION_OVERLAP) { if (WM_is_draw_triple(win)) { if (ELEM(sa->spacetype, SPACE_VIEW3D, SPACE_SEQ)) { - if (ELEM3(ar->regiontype, RGN_TYPE_TOOLS, RGN_TYPE_UI, RGN_TYPE_TOOL_PROPS)) + if (ELEM(ar->regiontype, RGN_TYPE_TOOLS, RGN_TYPE_UI, RGN_TYPE_TOOL_PROPS)) return 1; } else if (sa->spacetype == SPACE_IMAGE) { - if (ELEM4(ar->regiontype, RGN_TYPE_TOOLS, RGN_TYPE_UI, RGN_TYPE_TOOL_PROPS, RGN_TYPE_PREVIEW)) + if (ELEM(ar->regiontype, RGN_TYPE_TOOLS, RGN_TYPE_UI, RGN_TYPE_TOOL_PROPS, RGN_TYPE_PREVIEW)) return 1; } } @@ -1232,7 +1253,9 @@ static void ed_default_handlers(wmWindowManager *wm, ScrArea *sa, ListBase *hand /* time space only has this keymap, the others get a boundbox restricted map */ if (sa->spacetype != SPACE_TIME) { ARegion *ar; - static rcti rect = {0, 10000, 0, 30}; /* same local check for all areas */ + /* same local check for all areas */ + static rcti rect = {0, 10000, 0, -1}; + rect.ymax = (30 * UI_DPI_FAC); ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW); if (ar) { WM_event_add_keymap_handler_bb(handlers, keymap, &rect, &ar->winrct); @@ -1764,9 +1787,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char * break; } } - - BLI_SMALLSTACK_FREE(pt_stack); - + /* clear */ if (ar->overlap) { /* view should be in pixelspace */ diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 5d65bdfa11b..290923b2331 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -378,7 +378,7 @@ ScrArea *area_split(bScreen *sc, ScrArea *sa, char dir, float fac, int merge) if (split == 0) return NULL; /* note regarding (fac > 0.5f) checks below. - * notmally it shouldn't matter which is used since the copy should match the original + * normally it shouldn't matter which is used since the copy should match the original * however with viewport rendering and python console this isn't the case. - campbell */ if (dir == 'h') { diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 2ddda19fb28..7c7574b3af3 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -201,7 +201,7 @@ int ED_operator_animview_active(bContext *C) { if (ED_operator_areaactive(C)) { SpaceLink *sl = (SpaceLink *)CTX_wm_space_data(C); - if (sl && (ELEM5(sl->spacetype, SPACE_SEQ, SPACE_ACTION, SPACE_NLA, SPACE_IPO, SPACE_TIME))) + if (sl && (ELEM(sl->spacetype, SPACE_SEQ, SPACE_ACTION, SPACE_NLA, SPACE_IPO, SPACE_TIME))) return true; } @@ -3220,6 +3220,16 @@ static int match_region_with_redraws(int spacetype, int regiontype, int redraws) } } + else if (regiontype == RGN_TYPE_CHANNELS) { + switch (spacetype) { + case SPACE_IPO: + case SPACE_ACTION: + case SPACE_NLA: + if (redraws & TIME_ALL_ANIM_WIN) + return 1; + break; + } + } else if (regiontype == RGN_TYPE_UI) { if (spacetype == SPACE_CLIP) { /* Track Preview button is on Properties Editor in SpaceClip, @@ -4154,7 +4164,8 @@ void ED_keymap_screen(wmKeyConfig *keyconf) /* dropbox for entire window */ lb = WM_dropboxmap_find("Window", 0, 0); WM_dropbox_add(lb, "WM_OT_open_mainfile", open_file_drop_poll, open_file_drop_copy); - + WM_dropbox_add(lb, "UI_OT_drop_color", UI_drop_color_poll, UI_drop_color_copy); + keymap_modal_set(keyconf); } |