Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/screen/screen_geometry.c
| Show First 20 Lines • Show All 90 Lines • ▼ Show 20 Lines | ScrEdge *screen_geom_area_map_find_active_scredge(const ScrAreaMap *area_map, | ||||
| const rcti *bounds_rect, | const rcti *bounds_rect, | ||||
| const int mx, | const int mx, | ||||
| const int my) | const int my) | ||||
| { | { | ||||
| int safety = U.widget_unit / 10; | int safety = U.widget_unit / 10; | ||||
| CLAMP_MIN(safety, 2); | CLAMP_MIN(safety, 2); | ||||
| for (ScrEdge *se = area_map->edgebase.first; se; se = se->next) { | LISTBASE_FOREACH (ScrEdge *, se, &area_map->edgebase) { | ||||
| if (screen_geom_edge_is_horizontal(se)) { | if (screen_geom_edge_is_horizontal(se)) { | ||||
| if ((se->v1->vec.y > bounds_rect->ymin) && (se->v1->vec.y < (bounds_rect->ymax - 1))) { | if ((se->v1->vec.y > bounds_rect->ymin) && (se->v1->vec.y < (bounds_rect->ymax - 1))) { | ||||
| short min, max; | short min, max; | ||||
| min = MIN2(se->v1->vec.x, se->v2->vec.x); | min = MIN2(se->v1->vec.x, se->v2->vec.x); | ||||
| max = MAX2(se->v1->vec.x, se->v2->vec.x); | max = MAX2(se->v1->vec.x, se->v2->vec.x); | ||||
| if (abs(my - se->v1->vec.y) <= safety && mx >= min && mx <= max) { | if (abs(my - se->v1->vec.y) <= safety && mx >= min && mx <= max) { | ||||
| return se; | return se; | ||||
| ▲ Show 20 Lines • Show All 85 Lines • ▼ Show 20 Lines | if (screen_size_x_prev != screen_size_x || screen_size_y_prev != screen_size_y) { | ||||
| /* test for collapsed areas. This could happen in some blender version... */ | /* test for collapsed areas. This could happen in some blender version... */ | ||||
| /* ton: removed option now, it needs Context... */ | /* ton: removed option now, it needs Context... */ | ||||
| int headery = ED_area_headersize() + (U.pixelsize * 2); | int headery = ED_area_headersize() + (U.pixelsize * 2); | ||||
| if (facy > 1) { | if (facy > 1) { | ||||
| /* Keep timeline small in video edit workspace. */ | /* Keep timeline small in video edit workspace. */ | ||||
| for (ScrArea *area = sc->areabase.first; area; area = area->next) { | LISTBASE_FOREACH (ScrArea *, area, &sc->areabase) { | ||||
| if (area->spacetype == SPACE_ACTION && area->v1->vec.y == screen_rect.ymin && | if (area->spacetype == SPACE_ACTION && area->v1->vec.y == screen_rect.ymin && | ||||
| screen_geom_area_height(area) <= headery * facy + 1) { | screen_geom_area_height(area) <= headery * facy + 1) { | ||||
| ScrEdge *se = BKE_screen_find_edge(sc, area->v2, area->v3); | ScrEdge *se = BKE_screen_find_edge(sc, area->v2, area->v3); | ||||
| if (se) { | if (se) { | ||||
| const int yval = area->v1->vec.y + headery - 1; | const int yval = area->v1->vec.y + headery - 1; | ||||
| screen_geom_select_connected_edge(win, se); | screen_geom_select_connected_edge(win, se); | ||||
| /* all selected vertices get the right offset */ | /* all selected vertices get the right offset */ | ||||
| for (sv = sc->vertbase.first; sv; sv = sv->next) { | for (sv = sc->vertbase.first; sv; sv = sv->next) { | ||||
| /* if is a collapsed area */ | /* if is a collapsed area */ | ||||
| if (sv != area->v1 && sv != area->v4) { | if (sv != area->v1 && sv != area->v4) { | ||||
| if (sv->flag) { | if (sv->flag) { | ||||
| sv->vec.y = yval; | sv->vec.y = yval; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| if (facy < 1) { | if (facy < 1) { | ||||
| /* make each window at least ED_area_headersize() high */ | /* make each window at least ED_area_headersize() high */ | ||||
| for (ScrArea *area = sc->areabase.first; area; area = area->next) { | LISTBASE_FOREACH (ScrArea *, area, &sc->areabase) { | ||||
| if (screen_geom_area_height(area) < headery) { | if (screen_geom_area_height(area) < headery) { | ||||
| /* lower edge */ | /* lower edge */ | ||||
| ScrEdge *se = BKE_screen_find_edge(sc, area->v4, area->v1); | ScrEdge *se = BKE_screen_find_edge(sc, area->v4, area->v1); | ||||
| if (se && area->v1 != area->v2) { | if (se && area->v1 != area->v2) { | ||||
| const int yval = area->v2->vec.y - headery + 1; | const int yval = area->v2->vec.y - headery + 1; | ||||
| screen_geom_select_connected_edge(win, se); | screen_geom_select_connected_edge(win, se); | ||||
| Show All 9 Lines | if (facy < 1) { | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /* Global areas have a fixed size that only changes with the DPI. | /* Global areas have a fixed size that only changes with the DPI. | ||||
| * Here we ensure that exactly this size is set. */ | * Here we ensure that exactly this size is set. */ | ||||
| for (ScrArea *area = win->global_areas.areabase.first; area; area = area->next) { | LISTBASE_FOREACH (ScrArea *, area, &win->global_areas.areabase) { | ||||
| if (area->global->flag & GLOBAL_AREA_IS_HIDDEN) { | if (area->global->flag & GLOBAL_AREA_IS_HIDDEN) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| int height = ED_area_global_size_y(area) - 1; | int height = ED_area_global_size_y(area) - 1; | ||||
| if (area->v1->vec.y > window_rect.ymin) { | if (area->v1->vec.y > window_rect.ymin) { | ||||
| height += U.pixelsize; | height += U.pixelsize; | ||||
| ▲ Show 20 Lines • Show All 114 Lines • ▼ Show 20 Lines | ED_screen_verts_iter(win, sc, sv) | ||||
| sv->flag = 0; | sv->flag = 0; | ||||
| } | } | ||||
| edge->v1->flag = 1; | edge->v1->flag = 1; | ||||
| edge->v2->flag = 1; | edge->v2->flag = 1; | ||||
| while (oneselected) { | while (oneselected) { | ||||
| oneselected = false; | oneselected = false; | ||||
| for (ScrEdge *se = sc->edgebase.first; se; se = se->next) { | LISTBASE_FOREACH (ScrEdge *, se, &sc->edgebase) { | ||||
| if (se->v1->flag + se->v2->flag == 1) { | if (se->v1->flag + se->v2->flag == 1) { | ||||
| if (dir == 'h') { | if (dir == 'h') { | ||||
| if (se->v1->vec.y == se->v2->vec.y) { | if (se->v1->vec.y == se->v2->vec.y) { | ||||
| se->v1->flag = se->v2->flag = 1; | se->v1->flag = se->v2->flag = 1; | ||||
| oneselected = true; | oneselected = true; | ||||
| } | } | ||||
| } | } | ||||
| if (dir == 'v') { | if (dir == 'v') { | ||||
| Show All 9 Lines | |||||