Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/screen/screen_edit.c')
-rw-r--r--source/blender/editors/screen/screen_edit.c75
1 files changed, 52 insertions, 23 deletions
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index 60aad14efcf..9a91e9d96cd 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -263,6 +263,9 @@ int scredge_is_horizontal(ScrEdge *se)
ScrEdge *screen_find_active_scredge(bScreen *sc, int mx, int my)
{
ScrEdge *se;
+ int safety = U.widget_unit/10;
+
+ if (safety < 2) safety = 2;
for (se = sc->edgebase.first; se; se = se->next) {
if (scredge_is_horizontal(se)) {
@@ -270,7 +273,7 @@ ScrEdge *screen_find_active_scredge(bScreen *sc, int mx, int my)
min = MIN2(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) <= 2 && mx >= min && mx <= max)
+ if (abs(my - se->v1->vec.y) <= safety && mx >= min && mx <= max)
return se;
}
else {
@@ -278,7 +281,7 @@ ScrEdge *screen_find_active_scredge(bScreen *sc, int mx, int my)
min = MIN2(se->v1->vec.y, se->v2->vec.y);
max = MAX2(se->v1->vec.y, se->v2->vec.y);
- if (abs(mx - se->v1->vec.x) <= 2 && my >= min && my <= max)
+ if (abs(mx - se->v1->vec.x) <= safety && my >= min && my <= max)
return se;
}
}
@@ -428,9 +431,9 @@ bScreen *ED_screen_add(wmWindow *win, Scene *scene, const char *name)
sc->winid = win->winid;
sv1 = screen_addvert(sc, 0, 0);
- sv2 = screen_addvert(sc, 0, win->sizey - 1);
- sv3 = screen_addvert(sc, win->sizex - 1, win->sizey - 1);
- sv4 = screen_addvert(sc, win->sizex - 1, 0);
+ sv2 = screen_addvert(sc, 0, WM_window_pixels_y(win) - 1);
+ sv3 = screen_addvert(sc, WM_window_pixels_x(win) - 1, WM_window_pixels_y(win) - 1);
+ sv4 = screen_addvert(sc, WM_window_pixels_x(win) - 1, 0);
screen_addedge(sc, sv1, sv2);
screen_addedge(sc, sv2, sv3);
@@ -628,7 +631,7 @@ static void screen_test_scale(bScreen *sc, int winsizex, int winsizey)
float facx, facy, tempf, min[2], max[2];
/* calculate size */
- min[0] = min[1] = 10000.0f;
+ min[0] = min[1] = 20000.0f;
max[0] = max[1] = 0.0f;
for (sv = sc->vertbase.first; sv; sv = sv->next) {
@@ -669,6 +672,29 @@ static void screen_test_scale(bScreen *sc, int winsizex, int winsizey)
CLAMP(sv->vec.y, 0, winsizey);
}
+
+ /* scale prefsizes of regions */
+ for (sa = sc->areabase.first; sa; sa = sa->next) {
+ ARegion *ar;
+
+ for (ar = sa->regionbase.first; ar; ar = ar->next) {
+ ar->sizex = (int)((float)ar->sizex * facx);
+ ar->sizey = (int)((float)ar->sizey * facy);
+ ar->winx = (int)((float)ar->winx * facx);
+ ar->winy = (int)((float)ar->winy * facy);
+ }
+ if (sa->spacedata.first) {
+ SpaceLink *sl = sa->spacedata.first;
+ for (sl = sl->next; sl; sl = sl->next) {
+ for (ar = sl->regionbase.first; ar; ar = ar->next) {
+ ar->sizex = (int)((float)ar->sizex * facx);
+ ar->sizey = (int)((float)ar->sizey * facy);
+ ar->winx = (int)((float)ar->winx * facx);
+ ar->winy = (int)((float)ar->winy * facy);
+ }
+ }
+ }
+ }
}
/* test for collapsed areas. This could happen in some blender version... */
@@ -676,7 +702,7 @@ static void screen_test_scale(bScreen *sc, int winsizex, int winsizey)
/* make each window at least ED_area_headersize() high */
for (sa = sc->areabase.first; sa; sa = sa->next) {
- int headery = ED_area_headersize() + 1;
+ int headery = ED_area_headersize() + U.pixelsize;
if (sa->v1->vec.y + headery > sa->v2->vec.y) {
/* lower edge */
@@ -907,18 +933,18 @@ static void drawscredge_area(ScrArea *sa, int sizex, int sizey, int center)
short y1 = sa->v1->vec.y;
short x2 = sa->v3->vec.x;
short y2 = sa->v3->vec.y;
- short a, rt;
-
- rt = 0; // CLAMPIS(G.debug_value, 0, 16);
if (center == 0) {
- cpack(0x505050);
- for (a = -rt; a <= rt; a++)
- if (a != 0)
- drawscredge_area_draw(sizex, sizey, x1, y1, x2, y2, a);
+ if (U.pixelsize > 1.0f) {
+
+ glColor3ub(0x50, 0x50, 0x50);
+ glLineWidth(1.5f * U.pixelsize);
+ drawscredge_area_draw(sizex, sizey, x1, y1, x2, y2, 0);
+ glLineWidth(1.0f);
+ }
}
else {
- cpack(0x0);
+ glColor3ub(0, 0, 0);
drawscredge_area_draw(sizex, sizey, x1, y1, x2, y2, 0);
}
}
@@ -1002,10 +1028,10 @@ void ED_screen_draw(wmWindow *win)
if (sa->flag & AREA_FLAG_DRAWJOINFROM) sa1 = sa;
if (sa->flag & AREA_FLAG_DRAWJOINTO) sa2 = sa;
if (sa->flag & (AREA_FLAG_DRAWSPLIT_H | AREA_FLAG_DRAWSPLIT_V)) sa3 = sa;
- drawscredge_area(sa, win->sizex, win->sizey, 0);
+ drawscredge_area(sa, WM_window_pixels_x(win), WM_window_pixels_y(win), 0);
}
for (sa = win->screen->areabase.first; sa; sa = sa->next)
- drawscredge_area(sa, win->sizex, win->sizey, 1);
+ drawscredge_area(sa, WM_window_pixels_x(win), WM_window_pixels_y(win), 1);
/* blended join arrow */
if (sa1 && sa2) {
@@ -1078,20 +1104,20 @@ void ED_screen_refresh(wmWindowManager *wm, wmWindow *win)
rcti winrct;
winrct.xmin = 0;
- winrct.xmax = win->sizex - 1;
+ winrct.xmax = WM_window_pixels_x(win) - 1;
winrct.ymin = 0;
- winrct.ymax = win->sizey - 1;
+ winrct.ymax = WM_window_pixels_y(win) - 1;
+
+ /* header size depends on DPI, let's verify */
+ screen_refresh_headersizes();
- screen_test_scale(win->screen, win->sizex, win->sizey);
+ screen_test_scale(win->screen, WM_window_pixels_x(win), WM_window_pixels_y(win));
if (win->screen->mainwin == 0)
win->screen->mainwin = wm_subwindow_open(win, &winrct);
else
wm_subwindow_position(win, win->screen->mainwin, &winrct);
- /* header size depends on DPI, let's verify */
- screen_refresh_headersizes();
-
for (sa = win->screen->areabase.first; sa; sa = sa->next) {
/* set spacetype and region callbacks, calls init() */
/* sets subwindows for regions, adds handlers */
@@ -1142,6 +1168,9 @@ void ED_region_exit(bContext *C, ARegion *ar)
MEM_freeN(ar->headerstr);
ar->headerstr = NULL;
+ if (ar->regiontimer)
+ WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), ar->regiontimer);
+
CTX_wm_region_set(C, prevar);
}