Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_file/file_draw.c
| Show First 20 Lines • Show All 457 Lines • ▼ Show 20 Lines | if (is_current_main_data) { | ||||
| icon_y = yco + ey - UI_UNIT_Y; | icon_y = yco + ey - UI_UNIT_Y; | ||||
| UI_icon_draw_ex(icon_x, icon_y, ICON_CURRENT_FILE, 1.0f / U.dpi_fac, 0.6f, 0.0f, light, false); | UI_icon_draw_ex(icon_x, icon_y, ICON_CURRENT_FILE, 1.0f / U.dpi_fac, 0.6f, 0.0f, light, false); | ||||
| } | } | ||||
| /* Contrasting outline around some preview types. */ | /* Contrasting outline around some preview types. */ | ||||
| if (show_outline) { | if (show_outline) { | ||||
| 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); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| float border_color[4] = {1.0f, 1.0f, 1.0f, 0.4f}; | float border_color[4] = {1.0f, 1.0f, 1.0f, 0.4f}; | ||||
| float bgcolor[4]; | float bgcolor[4]; | ||||
| UI_GetThemeColor4fv(TH_BACK, bgcolor); | UI_GetThemeColor4fv(TH_BACK, bgcolor); | ||||
| if (rgb_to_grayscale(bgcolor) > 0.5f) { | if (rgb_to_grayscale(bgcolor) > 0.5f) { | ||||
| border_color[0] = 0.0f; | border_color[0] = 0.0f; | ||||
| border_color[1] = 0.0f; | border_color[1] = 0.0f; | ||||
| border_color[2] = 0.0f; | border_color[2] = 0.0f; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 101 Lines • ▼ Show 20 Lines | |||||
| static void draw_background(FileLayout *layout, View2D *v2d) | static void draw_background(FileLayout *layout, View2D *v2d) | ||||
| { | { | ||||
| const int item_height = layout->tile_h + (2 * layout->tile_border_y); | const int item_height = layout->tile_h + (2 * layout->tile_border_y); | ||||
| int i; | int i; | ||||
| int sy; | int sy; | ||||
| uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| float col_alternating[4]; | float col_alternating[4]; | ||||
| UI_GetThemeColor4fv(TH_ROW_ALTERNATE, col_alternating); | UI_GetThemeColor4fv(TH_ROW_ALTERNATE, col_alternating); | ||||
| immUniformThemeColorBlend(TH_BACK, TH_ROW_ALTERNATE, col_alternating[3]); | immUniformThemeColorBlend(TH_BACK, TH_ROW_ALTERNATE, col_alternating[3]); | ||||
| /* alternating flat shade background */ | /* alternating flat shade background */ | ||||
| for (i = 2; (i <= layout->rows + 1); i += 2) { | for (i = 2; (i <= layout->rows + 1); i += 2) { | ||||
| sy = (int)v2d->cur.ymax - layout->offset_top - i * item_height - layout->tile_border_y; | sy = (int)v2d->cur.ymax - layout->offset_top - i * item_height - layout->tile_border_y; | ||||
| ▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | if (vertex_len > 0) { | ||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| } | } | ||||
| } | } | ||||
| static void draw_columnheader_background(const FileLayout *layout, const View2D *v2d) | static void draw_columnheader_background(const FileLayout *layout, const View2D *v2d) | ||||
| { | { | ||||
| uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| immUniformThemeColorShade(TH_BACK, 11); | immUniformThemeColorShade(TH_BACK, 11); | ||||
| immRectf(pos, | immRectf(pos, | ||||
| v2d->cur.xmin, | v2d->cur.xmin, | ||||
| v2d->cur.ymax - layout->attribute_column_header_h, | v2d->cur.ymax - layout->attribute_column_header_h, | ||||
| v2d->cur.xmax, | v2d->cur.xmax, | ||||
| v2d->cur.ymax); | v2d->cur.ymax); | ||||
| Show All 35 Lines | file_draw_string(sx + ATTRIBUTE_COLUMN_PADDING, | ||||
| UI_STYLE_TEXT_LEFT, | UI_STYLE_TEXT_LEFT, | ||||
| text_col); | text_col); | ||||
| /* Separator line */ | /* Separator line */ | ||||
| if (column_type != COLUMN_NAME) { | if (column_type != COLUMN_NAME) { | ||||
| uint pos = GPU_vertformat_attr_add( | uint pos = GPU_vertformat_attr_add( | ||||
| immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| immUniformThemeColorShade(TH_BACK, -10); | immUniformThemeColorShade(TH_BACK, -10); | ||||
| immBegin(GPU_PRIM_LINES, 2); | immBegin(GPU_PRIM_LINES, 2); | ||||
| immVertex2f(pos, sx - 1, sy - divider_pad); | immVertex2f(pos, sx - 1, sy - divider_pad); | ||||
| immVertex2f(pos, sx - 1, sy - layout->attribute_column_header_h + divider_pad); | immVertex2f(pos, sx - 1, sy - layout->attribute_column_header_h + divider_pad); | ||||
| immEnd(); | immEnd(); | ||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| } | } | ||||
| sx += column->width; | sx += column->width; | ||||
| } | } | ||||
| /* Vertical separator lines line */ | /* Vertical separator lines line */ | ||||
| { | { | ||||
| uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| immUniformThemeColorShade(TH_BACK, -10); | immUniformThemeColorShade(TH_BACK, -10); | ||||
| immBegin(GPU_PRIM_LINES, 4); | immBegin(GPU_PRIM_LINES, 4); | ||||
| immVertex2f(pos, v2d->cur.xmin, sy); | immVertex2f(pos, v2d->cur.xmin, sy); | ||||
| immVertex2f(pos, v2d->cur.xmax, sy); | immVertex2f(pos, v2d->cur.xmax, sy); | ||||
| immVertex2f(pos, v2d->cur.xmin, sy - layout->attribute_column_header_h); | immVertex2f(pos, v2d->cur.xmin, sy - layout->attribute_column_header_h); | ||||
| immVertex2f(pos, v2d->cur.xmax, sy - layout->attribute_column_header_h); | immVertex2f(pos, v2d->cur.xmax, sy - layout->attribute_column_header_h); | ||||
| immEnd(); | immEnd(); | ||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| ▲ Show 20 Lines • Show All 425 Lines • Show Last 20 Lines | |||||