Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/screen/area.c
| Show All 33 Lines | |||||
| #include "WM_types.h" | #include "WM_types.h" | ||||
| #include "ED_buttons.h" | #include "ED_buttons.h" | ||||
| #include "ED_screen.h" | #include "ED_screen.h" | ||||
| #include "ED_screen_types.h" | #include "ED_screen_types.h" | ||||
| #include "ED_space_api.h" | #include "ED_space_api.h" | ||||
| #include "ED_time_scrub_ui.h" | #include "ED_time_scrub_ui.h" | ||||
| #include "GPU_batch_presets.h" | |||||
| #include "GPU_framebuffer.h" | #include "GPU_framebuffer.h" | ||||
| #include "GPU_immediate.h" | #include "GPU_immediate.h" | ||||
| #include "GPU_immediate_util.h" | #include "GPU_immediate_util.h" | ||||
| #include "GPU_matrix.h" | #include "GPU_matrix.h" | ||||
| #include "GPU_state.h" | #include "GPU_state.h" | ||||
| #include "BLF_api.h" | #include "BLF_api.h" | ||||
| ▲ Show 20 Lines • Show All 139 Lines • ▼ Show 20 Lines | |||||
| NULL, | NULL, | ||||
| false, | false, | ||||
| UI_NO_ICON_OVERLAY_TEXT); | UI_NO_ICON_OVERLAY_TEXT); | ||||
| } | } | ||||
| /** | /** | ||||
| * \brief Corner widgets use for dragging and splitting the view. | * \brief Corner widgets use for dragging and splitting the view. | ||||
| */ | */ | ||||
| static void area_draw_azone(short UNUSED(x1), short UNUSED(y1), short UNUSED(x2), short UNUSED(y2)) | static void area_draw_azone(ScrArea *area, short x1, short y1, short x2, short y2) | ||||
| { | { | ||||
| /* No drawing needed since all corners are action zone, and visually distinguishable. */ | /* Draw gripper at top-left only. */ | ||||
| if (x1 > (area->totrct.xmin + UI_HEADER_OFFSET) || | |||||
| y2 < (area->totrct.ymax - (HEADERY * U.dpi_fac))) { | |||||
| return; | |||||
| } | |||||
| GPU_blend(GPU_BLEND_ALPHA); | |||||
| GPU_matrix_push(); | |||||
| GPU_matrix_translate_2f(x1 - (2.0f * U.dpi_fac), y1); | |||||
| float color_high[4], color_dark[4]; | |||||
| UI_GetThemeColorType3fv(TH_HEADER_TEXT, area->spacetype, color_high); | |||||
| color_high[3] = 0.4f; | |||||
| UI_GetThemeColor4fv(TH_WIDGET_EMBOSS, color_dark); | |||||
| GPUBatch *batch = GPU_batch_preset_panel_drag_widget( | |||||
| U.pixelsize, color_high, color_dark, 17.5 * U.dpi_fac); | |||||
| GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR); | |||||
| GPU_batch_draw(batch); | |||||
| GPU_matrix_pop(); | |||||
| GPU_blend(GPU_BLEND_NONE); | |||||
| } | } | ||||
| /** | /** | ||||
| * \brief Edge widgets to show hidden panels such as the toolbar and headers. | * \brief Edge widgets to show hidden panels such as the toolbar and headers. | ||||
| */ | */ | ||||
| static void draw_azone_arrow(float x1, float y1, float x2, float y2, AZEdge edge) | static void draw_azone_arrow(float x1, float y1, float x2, float y2, AZEdge edge) | ||||
| { | { | ||||
| const float size = 0.2f * U.widget_unit; | const float size = 0.2f * U.widget_unit; | ||||
| ▲ Show 20 Lines • Show All 106 Lines • ▼ Show 20 Lines | |||||
| LISTBASE_FOREACH (AZone *, az, &area->actionzones) { | LISTBASE_FOREACH (AZone *, az, &area->actionzones) { | ||||
| /* test if action zone is over this region */ | /* test if action zone is over this region */ | ||||
| rcti azrct; | rcti azrct; | ||||
| BLI_rcti_init(&azrct, az->x1, az->x2, az->y1, az->y2); | BLI_rcti_init(&azrct, az->x1, az->x2, az->y1, az->y2); | ||||
| if (BLI_rcti_isect(®ion->drawrct, &azrct, NULL)) { | if (BLI_rcti_isect(®ion->drawrct, &azrct, NULL)) { | ||||
| if (az->type == AZONE_AREA) { | if (az->type == AZONE_AREA) { | ||||
| area_draw_azone(az->x1, az->y1, az->x2, az->y2); | area_draw_azone(area, az->x1, az->y1, az->x2, az->y2); | ||||
| } | } | ||||
| else if (az->type == AZONE_REGION) { | else if (az->type == AZONE_REGION) { | ||||
| if (az->region) { | if (az->region) { | ||||
| /* only display tab or icons when the region is hidden */ | /* only display tab or icons when the region is hidden */ | ||||
| if (az->region->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL)) { | if (az->region->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL)) { | ||||
| region_draw_azone_tab_arrow(area, region, az); | region_draw_azone_tab_arrow(area, region, az); | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 184 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| if (screen->temp) { | if (screen->temp) { | ||||
| return; | return; | ||||
| } | } | ||||
| const float coords[4][4] = { | const float coords[4][4] = { | ||||
| /* Bottom-left. */ | /* Bottom-left. */ | ||||
| {area->totrct.xmin - U.pixelsize, | {area->totrct.xmin + U.pixelsize, | ||||
| area->totrct.ymin - U.pixelsize, | area->totrct.ymin + U.pixelsize, | ||||
| area->totrct.xmin + AZONESPOTW, | area->totrct.xmin + AZONESPOTW, | ||||
| area->totrct.ymin + AZONESPOTH}, | area->totrct.ymin + AZONESPOTH}, | ||||
| /* Bottom-right. */ | /* Bottom-right. */ | ||||
| {area->totrct.xmax - AZONESPOTW, | {area->totrct.xmax - AZONESPOTW, | ||||
| area->totrct.ymin - U.pixelsize, | area->totrct.ymin + U.pixelsize, | ||||
| area->totrct.xmax + U.pixelsize, | area->totrct.xmax - U.pixelsize, | ||||
| area->totrct.ymin + AZONESPOTH}, | area->totrct.ymin + AZONESPOTH}, | ||||
| /* Top-left. */ | /* Top-left. */ | ||||
| {area->totrct.xmin - U.pixelsize, | {area->totrct.xmin + U.pixelsize, | ||||
| area->totrct.ymax - AZONESPOTH, | area->totrct.ymax - (HEADERY * U.dpi_fac), | ||||
| area->totrct.xmin + AZONESPOTW, | area->totrct.xmin + UI_HEADER_OFFSET, | ||||
| area->totrct.ymax + U.pixelsize}, | area->totrct.ymax - (3 * U.pixelsize)}, | ||||
| /* Top-right. */ | /* Top-right. */ | ||||
| {area->totrct.xmax - AZONESPOTW, | {area->totrct.xmax - AZONESPOTW, | ||||
| area->totrct.ymax - AZONESPOTH, | area->totrct.ymax - AZONESPOTH, | ||||
| area->totrct.xmax + U.pixelsize, | area->totrct.xmax - U.pixelsize, | ||||
| area->totrct.ymax + U.pixelsize}, | area->totrct.ymax - U.pixelsize}, | ||||
| }; | }; | ||||
| for (int i = 0; i < 4; i++) { | for (int i = 0; i < 4; i++) { | ||||
| /* can't click on bottom corners on OS X, already used for resizing */ | /* can't click on bottom corners on OS X, already used for resizing */ | ||||
| #ifdef __APPLE__ | #ifdef __APPLE__ | ||||
| if (!WM_window_is_fullscreen(win) && | if (!WM_window_is_fullscreen(win) && | ||||
| ((coords[i][0] == 0 && coords[i][1] == 0) || | ((coords[i][0] == 0 && coords[i][1] == 0) || | ||||
| (coords[i][0] == WM_window_pixels_x(win) && coords[i][1] == 0))) { | (coords[i][0] == WM_window_pixels_x(win) && coords[i][1] == 0))) { | ||||
| ▲ Show 20 Lines • Show All 92 Lines • Show Last 20 Lines | |||||