Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/screen/area.c
| Context not available. | |||||
| /* No drawing needed since all corners are action zone, and visually distinguishable. */ | /* No drawing needed since all corners are action zone, and visually distinguishable. */ | ||||
| } | } | ||||
| static void draw_azone_plus(float x1, float y1, float x2, float y2) | static void draw_azone_arrow(float x1, float y1, float x2, float y2, AZone *az) | ||||
| { | { | ||||
| float width = 0.1f * U.widget_unit; | float size = 0.2f * U.widget_unit; | ||||
| float pad = 0.2f * U.widget_unit; | float l = 1.0f; // arrow length | ||||
| float s = 0.25f; // arrow thickness | |||||
| float hl = l/2.0f; | |||||
| float points[6][2] = {{0,-hl}, {l,hl}, {l-s, hl+s}, {0,s+s-hl}, {s-l,hl+s}, {-l,hl}}; | |||||
| float center[2] = {(x1 + x2) / 2, (y1 + y2) / 2}; | |||||
| bool horizontal = false; | |||||
| int flip = 1.0; | |||||
| /* add code to draw region hidden as 'too small' */ | |||||
| switch (az->edge) { | |||||
| case AE_TOP_TO_BOTTOMRIGHT: | |||||
| flip=-1; | |||||
| horizontal=true; | |||||
| break; | |||||
| case AE_BOTTOM_TO_TOPLEFT: | |||||
| horizontal = true; | |||||
| break; | |||||
| case AE_LEFT_TO_TOPRIGHT: | |||||
| break; | |||||
| case AE_RIGHT_TO_TOPLEFT: | |||||
| flip=-1; | |||||
| break; | |||||
| } | |||||
| GPUVertFormat *format = immVertexFormat(); | GPUVertFormat *format = immVertexFormat(); | ||||
| uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | ||||
| Context not available. | |||||
| GPU_blend(true); | GPU_blend(true); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | ||||
| immUniformColor4f(0.8f, 0.8f, 0.8f, 0.4f); | immUniformColor4f(0.8f, 0.8f, 0.8f, 0.4f); | ||||
| immBegin(GPU_PRIM_TRI_FAN, 6); | |||||
| immRectf(pos, (x1 + x2 - width) * 0.5f, y1 + pad, (x1 + x2 + width) * 0.5f, y2 - pad); | for(int i=0; i<6; ++i) { | ||||
| immRectf(pos, x1 + pad, (y1 + y2 - width) * 0.5f, (x1 + x2 - width) * 0.5f, (y1 + y2 + width) * 0.5f); | if(horizontal) { | ||||
| immRectf(pos, (x1 + x2 + width) * 0.5f, (y1 + y2 - width) * 0.5f, x2 - pad, (y1 + y2 + width) * 0.5f); | immVertex2f(pos, center[0] + points[i][0] * size, center[1] + points[i][1] * flip * size); | ||||
| } | |||||
| else { | |||||
| immVertex2f(pos, center[0] + points[i][1] * flip * size, center[1] + points[i][0] * size); | |||||
| } | |||||
| } | |||||
| immEnd(); | |||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| GPU_blend(false); | GPU_blend(false); | ||||
| } | } | ||||
| static void region_draw_azone_tab_plus(AZone *az) | static void region_draw_azone_tab_arrow(AZone *az) | ||||
| { | { | ||||
| GPU_blend(true); | GPU_blend(true); | ||||
| Context not available. | |||||
| float color[4] = {0.05f, 0.05f, 0.05f, 0.4f}; | float color[4] = {0.05f, 0.05f, 0.05f, 0.4f}; | ||||
| UI_draw_roundbox_aa(true, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, color); | UI_draw_roundbox_aa(true, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, color); | ||||
| draw_azone_plus((float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2); | draw_azone_arrow((float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, az); | ||||
| } | } | ||||
| static void area_azone_tag_update(ScrArea *sa) | static void area_azone_tag_update(ScrArea *sa) | ||||
| Context not available. | |||||
| if (az->ar) { | if (az->ar) { | ||||
| /* only display tab or icons when the region is hidden */ | /* only display tab or icons when the region is hidden */ | ||||
| if (az->ar->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL)) { | if (az->ar->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL)) { | ||||
| region_draw_azone_tab_plus(az); | region_draw_azone_tab_arrow(az); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| float edge_offset = 1.0f; | float edge_offset = 1.0f; | ||||
| const float tab_size_x = 0.7f * U.widget_unit; | const float tab_size_x = 0.7f * U.widget_unit; | ||||
| const float tab_size_y = 0.7f * U.widget_unit; | const float tab_size_y = 0.4f * U.widget_unit; | ||||
| for (azt = sa->actionzones.first; azt; azt = azt->next) { | for (azt = sa->actionzones.first; azt; azt = azt->next) { | ||||
| Context not available. | |||||
| az->y2 = ar->winrct.ymax - (edge_offset * tab_size_x); | az->y2 = ar->winrct.ymax - (edge_offset * tab_size_x); | ||||
| break; | break; | ||||
| case AE_RIGHT_TO_TOPLEFT: | case AE_RIGHT_TO_TOPLEFT: | ||||
| az->x1 = ar->winrct.xmax - 1; | add = (ar->winrct.ymax == sa->totrct.ymin) ? 1 : 0; | ||||
| az->x1 = ar->winrct.xmax - add; | |||||
| az->y1 = ar->winrct.ymax - ((edge_offset + 1.0f) * tab_size_x); | az->y1 = ar->winrct.ymax - ((edge_offset + 1.0f) * tab_size_x); | ||||
| az->x2 = ar->winrct.xmax - 1 + tab_size_y; | az->x2 = ar->winrct.xmax - add + tab_size_y; | ||||
| az->y2 = ar->winrct.ymax - (edge_offset * tab_size_x); | az->y2 = ar->winrct.ymax - (edge_offset * tab_size_x); | ||||
| break; | break; | ||||
| } | } | ||||
| Context not available. | |||||