Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/screen/screen_ops.c
| Show First 20 Lines • Show All 675 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| wmWindow *win = CTX_wm_window(C); | wmWindow *win = CTX_wm_window(C); | ||||
| bScreen *screen = WM_window_get_active_screen(win); | bScreen *screen = WM_window_get_active_screen(win); | ||||
| if (screen && win && win->eventstate) { | if (screen && win && win->eventstate) { | ||||
| const int *xy = &win->eventstate->x; | const int *xy = &win->eventstate->x; | ||||
| AZone *az; | AZone *az; | ||||
| for (ScrArea *area = screen->areabase.first; area; area = area->next) { | LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { | ||||
| for (az = area->actionzones.first; az; az = az->next) { | for (az = area->actionzones.first; az; az = az->next) { | ||||
| if (BLI_rcti_isect_pt_v(&az->rect, xy)) { | if (BLI_rcti_isect_pt_v(&az->rect, xy)) { | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| return 0; | return 0; | ||||
| ▲ Show 20 Lines • Show All 197 Lines • ▼ Show 20 Lines | static AZone *area_actionzone_refresh_xy(ScrArea *area, const int xy[2], const bool test_only) | ||||
| } | } | ||||
| return az; | return az; | ||||
| } | } | ||||
| /* Finds an action-zone by position in entire screen so azones can overlap. */ | /* Finds an action-zone by position in entire screen so azones can overlap. */ | ||||
| static AZone *screen_actionzone_find_xy(bScreen *sc, const int xy[2]) | static AZone *screen_actionzone_find_xy(bScreen *sc, const int xy[2]) | ||||
| { | { | ||||
| for (ScrArea *area = sc->areabase.first; area; area = area->next) { | LISTBASE_FOREACH (ScrArea *, area, &sc->areabase) { | ||||
| AZone *az = area_actionzone_refresh_xy(area, xy, true); | AZone *az = area_actionzone_refresh_xy(area, xy, true); | ||||
| if (az != NULL) { | if (az != NULL) { | ||||
| return az; | return az; | ||||
| } | } | ||||
| } | } | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| /* Returns the area that the azone belongs to */ | /* Returns the area that the azone belongs to */ | ||||
| static ScrArea *screen_actionzone_area(bScreen *sc, const AZone *az) | static ScrArea *screen_actionzone_area(bScreen *sc, const AZone *az) | ||||
| { | { | ||||
| for (ScrArea *area = sc->areabase.first; area; area = area->next) { | LISTBASE_FOREACH (ScrArea *, area, &sc->areabase) { | ||||
| for (AZone *zone = area->actionzones.first; zone; zone = zone->next) { | LISTBASE_FOREACH (AZone *, zone, &area->actionzones) { | ||||
| if (zone == az) { | if (zone == az) { | ||||
| return area; | return area; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 541 Lines • ▼ Show 20 Lines | static void area_move_set_limits( | ||||
| int areaminy = ED_area_headersize(); | int areaminy = ED_area_headersize(); | ||||
| int areamin; | int areamin; | ||||
| /* we check all areas and test for free space with MINSIZE */ | /* we check all areas and test for free space with MINSIZE */ | ||||
| *bigger = *smaller = 100000; | *bigger = *smaller = 100000; | ||||
| if (use_bigger_smaller_snap != NULL) { | if (use_bigger_smaller_snap != NULL) { | ||||
| *use_bigger_smaller_snap = false; | *use_bigger_smaller_snap = false; | ||||
| for (ScrArea *area = win->global_areas.areabase.first; area; area = area->next) { | LISTBASE_FOREACH (ScrArea *, area, &win->global_areas.areabase) { | ||||
| int size_min = ED_area_global_min_size_y(area) - 1; | int size_min = ED_area_global_min_size_y(area) - 1; | ||||
| int size_max = ED_area_global_max_size_y(area) - 1; | int size_max = ED_area_global_max_size_y(area) - 1; | ||||
| size_min = max_ii(size_min, 0); | size_min = max_ii(size_min, 0); | ||||
| BLI_assert(size_min <= size_max); | BLI_assert(size_min <= size_max); | ||||
| /* logic here is only tested for lower edge :) */ | /* logic here is only tested for lower edge :) */ | ||||
| /* left edge */ | /* left edge */ | ||||
| Show All 24 Lines | LISTBASE_FOREACH (ScrArea *, area, &win->global_areas.areabase) { | ||||
| *use_bigger_smaller_snap = true; | *use_bigger_smaller_snap = true; | ||||
| return; | return; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| WM_window_rect_calc(win, &window_rect); | WM_window_rect_calc(win, &window_rect); | ||||
| for (ScrArea *area = sc->areabase.first; area; area = area->next) { | LISTBASE_FOREACH (ScrArea *, area, &sc->areabase) { | ||||
| if (dir == 'h') { | if (dir == 'h') { | ||||
| int y1; | int y1; | ||||
| areamin = areaminy; | areamin = areaminy; | ||||
| if (area->v1->vec.y > window_rect.ymin) { | if (area->v1->vec.y > window_rect.ymin) { | ||||
| areamin += U.pixelsize; | areamin += U.pixelsize; | ||||
| } | } | ||||
| if (area->v2->vec.y < (window_rect.ymax - 1)) { | if (area->v2->vec.y < (window_rect.ymax - 1)) { | ||||
| ▲ Show 20 Lines • Show All 976 Lines • ▼ Show 20 Lines | if (edge == AE_RIGHT_TO_TOPLEFT || edge == AE_LEFT_TO_TOPRIGHT) { | ||||
| dist = BLI_rcti_size_x(&area->totrct); | dist = BLI_rcti_size_x(&area->totrct); | ||||
| } | } | ||||
| else { /* AE_BOTTOM_TO_TOPLEFT, AE_TOP_TO_BOTTOMRIGHT */ | else { /* AE_BOTTOM_TO_TOPLEFT, AE_TOP_TO_BOTTOMRIGHT */ | ||||
| dist = BLI_rcti_size_y(&area->totrct); | dist = BLI_rcti_size_y(&area->totrct); | ||||
| } | } | ||||
| /* subtractwidth of regions on opposite side | /* subtractwidth of regions on opposite side | ||||
| * prevents dragging regions into other opposite regions */ | * prevents dragging regions into other opposite regions */ | ||||
| for (ARegion *region = area->regionbase.first; region; region = region->next) { | LISTBASE_FOREACH (ARegion *, region, &area->regionbase) { | ||||
| if (region == scalear) { | if (region == scalear) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| if (scalear->alignment == RGN_ALIGN_LEFT && region->alignment == RGN_ALIGN_RIGHT) { | if (scalear->alignment == RGN_ALIGN_LEFT && region->alignment == RGN_ALIGN_RIGHT) { | ||||
| dist -= region->winx; | dist -= region->winx; | ||||
| } | } | ||||
| else if (scalear->alignment == RGN_ALIGN_RIGHT && region->alignment == RGN_ALIGN_LEFT) { | else if (scalear->alignment == RGN_ALIGN_RIGHT && region->alignment == RGN_ALIGN_LEFT) { | ||||
| ▲ Show 20 Lines • Show All 280 Lines • ▼ Show 20 Lines | |||||
| /** \name Frame Change Operator | /** \name Frame Change Operator | ||||
| * \{ */ | * \{ */ | ||||
| static void areas_do_frame_follow(bContext *C, bool middle) | static void areas_do_frame_follow(bContext *C, bool middle) | ||||
| { | { | ||||
| bScreen *scr = CTX_wm_screen(C); | bScreen *scr = CTX_wm_screen(C); | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| wmWindowManager *wm = CTX_wm_manager(C); | wmWindowManager *wm = CTX_wm_manager(C); | ||||
| for (wmWindow *window = wm->windows.first; window; window = window->next) { | LISTBASE_FOREACH (wmWindow *, window, &wm->windows) { | ||||
| const bScreen *screen = WM_window_get_active_screen(window); | const bScreen *screen = WM_window_get_active_screen(window); | ||||
| for (ScrArea *area = screen->areabase.first; area; area = area->next) { | LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { | ||||
| for (ARegion *region = area->regionbase.first; region; region = region->next) { | LISTBASE_FOREACH (ARegion *, region, &area->regionbase) { | ||||
| /* do follow here if editor type supports it */ | /* do follow here if editor type supports it */ | ||||
| if ((scr->redraws_flag & TIME_FOLLOW)) { | if ((scr->redraws_flag & TIME_FOLLOW)) { | ||||
| if ((region->regiontype == RGN_TYPE_WINDOW && | if ((region->regiontype == RGN_TYPE_WINDOW && | ||||
| ELEM(area->spacetype, SPACE_SEQ, SPACE_GRAPH, SPACE_ACTION, SPACE_NLA)) || | ELEM(area->spacetype, SPACE_SEQ, SPACE_GRAPH, SPACE_ACTION, SPACE_NLA)) || | ||||
| (area->spacetype == SPACE_CLIP && region->regiontype == RGN_TYPE_PREVIEW)) { | (area->spacetype == SPACE_CLIP && region->regiontype == RGN_TYPE_PREVIEW)) { | ||||
| float w = BLI_rctf_size_x(®ion->v2d.cur); | float w = BLI_rctf_size_x(®ion->v2d.cur); | ||||
| if (middle) { | if (middle) { | ||||
| ▲ Show 20 Lines • Show All 1,773 Lines • ▼ Show 20 Lines | |||||
| /** \name Animation Playback Operator | /** \name Animation Playback Operator | ||||
| * | * | ||||
| * Animation Playback with Timer. | * Animation Playback with Timer. | ||||
| * \{ */ | * \{ */ | ||||
| /* find window that owns the animation timer */ | /* find window that owns the animation timer */ | ||||
| bScreen *ED_screen_animation_playing(const wmWindowManager *wm) | bScreen *ED_screen_animation_playing(const wmWindowManager *wm) | ||||
| { | { | ||||
| for (wmWindow *win = wm->windows.first; win; win = win->next) { | LISTBASE_FOREACH (wmWindow *, win, &wm->windows) { | ||||
| bScreen *screen = WM_window_get_active_screen(win); | bScreen *screen = WM_window_get_active_screen(win); | ||||
| if (screen->animtimer || screen->scrubbing) { | if (screen->animtimer || screen->scrubbing) { | ||||
| return screen; | return screen; | ||||
| } | } | ||||
| } | } | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| bScreen *ED_screen_animation_no_scrub(const wmWindowManager *wm) | bScreen *ED_screen_animation_no_scrub(const wmWindowManager *wm) | ||||
| { | { | ||||
| for (wmWindow *win = wm->windows.first; win; win = win->next) { | LISTBASE_FOREACH (wmWindow *, win, &wm->windows) { | ||||
| bScreen *screen = WM_window_get_active_screen(win); | bScreen *screen = WM_window_get_active_screen(win); | ||||
| if (screen->animtimer) { | if (screen->animtimer) { | ||||
| return screen; | return screen; | ||||
| } | } | ||||
| } | } | ||||
| return NULL; | return NULL; | ||||
| ▲ Show 20 Lines • Show All 763 Lines • ▼ Show 20 Lines | static int space_workspace_cycle_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) | ||||
| Main *bmain = CTX_data_main(C); | Main *bmain = CTX_data_main(C); | ||||
| const int direction = RNA_enum_get(op->ptr, "direction"); | const int direction = RNA_enum_get(op->ptr, "direction"); | ||||
| WorkSpace *workspace_src = WM_window_get_active_workspace(win); | WorkSpace *workspace_src = WM_window_get_active_workspace(win); | ||||
| WorkSpace *workspace_dst = NULL; | WorkSpace *workspace_dst = NULL; | ||||
| ListBase ordered; | ListBase ordered; | ||||
| BKE_id_ordered_list(&ordered, &bmain->workspaces); | BKE_id_ordered_list(&ordered, &bmain->workspaces); | ||||
| for (LinkData *link = ordered.first; link; link = link->next) { | LISTBASE_FOREACH (LinkData *, link, &ordered) { | ||||
| if (link->data == workspace_src) { | if (link->data == workspace_src) { | ||||
| if (direction == SPACE_CONTEXT_CYCLE_PREV) { | if (direction == SPACE_CONTEXT_CYCLE_PREV) { | ||||
| workspace_dst = (link->prev) ? link->prev->data : NULL; | workspace_dst = (link->prev) ? link->prev->data : NULL; | ||||
| } | } | ||||
| else { | else { | ||||
| workspace_dst = (link->next) ? link->next->data : NULL; | workspace_dst = (link->next) ? link->next->data : NULL; | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 175 Lines • Show Last 20 Lines | |||||