Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_text/text_draw.c
| Show First 20 Lines • Show All 991 Lines • ▼ Show 20 Lines | static void draw_textscroll(const SpaceText *st, rcti *scroll, rcti *back) | ||||
| bTheme *btheme = UI_GetTheme(); | bTheme *btheme = UI_GetTheme(); | ||||
| uiWidgetColors wcol = btheme->tui.wcol_scroll; | uiWidgetColors wcol = btheme->tui.wcol_scroll; | ||||
| float col[4]; | float col[4]; | ||||
| float rad; | float rad; | ||||
| /* background so highlights don't go behind the scrollbar */ | /* background so highlights don't go behind the scrollbar */ | ||||
| uint pos = GPU_vertformat_attr_add( | uint pos = GPU_vertformat_attr_add( | ||||
| immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); | immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| immUniformThemeColor(TH_BACK); | immUniformThemeColor(TH_BACK); | ||||
| immRecti(pos, back->xmin, back->ymin, back->xmax, back->ymax); | immRecti(pos, back->xmin, back->ymin, back->xmax, back->ymax); | ||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| UI_draw_widget_scroll(&wcol, | UI_draw_widget_scroll(&wcol, | ||||
| scroll, | scroll, | ||||
| &st->runtime.scroll_region_handle, | &st->runtime.scroll_region_handle, | ||||
| (st->flags & ST_SCROLL_SELECT) ? UI_SCROLL_PRESSED : 0); | (st->flags & ST_SCROLL_SELECT) ? UI_SCROLL_PRESSED : 0); | ||||
| ▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | static void draw_documentation(const SpaceText *st, ARegion *region) | ||||
| /* top = */ /* UNUSED */ y = region->winy - st->runtime.lheight_px * l - 2; | /* top = */ /* UNUSED */ y = region->winy - st->runtime.lheight_px * l - 2; | ||||
| boxw = DOC_WIDTH * st->runtime.cwidth_px + 20; | boxw = DOC_WIDTH * st->runtime.cwidth_px + 20; | ||||
| boxh = (DOC_HEIGHT + 1) * TXT_LINE_HEIGHT(st); | boxh = (DOC_HEIGHT + 1) * TXT_LINE_HEIGHT(st); | ||||
| /* Draw panel */ | /* Draw panel */ | ||||
| uint pos = GPU_vertformat_attr_add( | uint pos = GPU_vertformat_attr_add( | ||||
| immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); | immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| immUniformThemeColor(TH_BACK); | immUniformThemeColor(TH_BACK); | ||||
| immRecti(pos, x, y, x + boxw, y - boxh); | immRecti(pos, x, y, x + boxw, y - boxh); | ||||
| immUniformThemeColor(TH_SHADE1); | immUniformThemeColor(TH_SHADE1); | ||||
| immBegin(GPU_PRIM_LINE_LOOP, 4); | immBegin(GPU_PRIM_LINE_LOOP, 4); | ||||
| immVertex2i(pos, x, y); | immVertex2i(pos, x, y); | ||||
| immVertex2i(pos, x + boxw, y); | immVertex2i(pos, x + boxw, y); | ||||
| immVertex2i(pos, x + boxw, y - boxh); | immVertex2i(pos, x + boxw, y - boxh); | ||||
| ▲ Show 20 Lines • Show All 113 Lines • ▼ Show 20 Lines | UI_draw_box_shadow( | ||||
| .xmax = x + boxw, | .xmax = x + boxw, | ||||
| .ymin = y - boxh, | .ymin = y - boxh, | ||||
| .ymax = y, | .ymax = y, | ||||
| }, | }, | ||||
| 220); | 220); | ||||
| uint pos = GPU_vertformat_attr_add( | uint pos = GPU_vertformat_attr_add( | ||||
| immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); | immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| immUniformThemeColor(TH_SHADE1); | immUniformThemeColor(TH_SHADE1); | ||||
| immRecti(pos, x - 1, y + 1, x + boxw + 1, y - boxh - 1); | immRecti(pos, x - 1, y + 1, x + boxw + 1, y - boxh - 1); | ||||
| immUniformThemeColorShade(TH_BACK, 16); | immUniformThemeColorShade(TH_BACK, 16); | ||||
| immRecti(pos, x, y, x + boxw, y - boxh); | immRecti(pos, x, y, x + boxw, y - boxh); | ||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| Show All 9 Lines | for (i = 0; i < SUGG_LIST_SIZE && item; i++, item = item->next) { | ||||
| BLI_strncpy(str, item->name, len + 1); | BLI_strncpy(str, item->name, len + 1); | ||||
| w = st->runtime.cwidth_px * text_get_char_pos(st, str, len); | w = st->runtime.cwidth_px * text_get_char_pos(st, str, len); | ||||
| if (item == sel) { | if (item == sel) { | ||||
| uint posi = GPU_vertformat_attr_add( | uint posi = GPU_vertformat_attr_add( | ||||
| immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); | immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| immUniformThemeColor(TH_SHADE2); | immUniformThemeColor(TH_SHADE2); | ||||
| immRecti(posi, x + margin_x, y - 3, x + margin_x + w, y + lheight - 3); | immRecti(posi, x + margin_x, y - 3, x + margin_x + w, y + lheight - 3); | ||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| } | } | ||||
| format_draw_color(tdc, item->type); | format_draw_color(tdc, item->type); | ||||
| Show All 31 Lines | static void draw_text_decoration(SpaceText *st, ARegion *region) | ||||
| if (text->curl == text->sell && text->curc == text->selc && !st->line_hlight && hidden) { | if (text->curl == text->sell && text->curc == text->selc && !st->line_hlight && hidden) { | ||||
| /* Nothing to draw here */ | /* Nothing to draw here */ | ||||
| return; | return; | ||||
| } | } | ||||
| uint pos = GPU_vertformat_attr_add( | uint pos = GPU_vertformat_attr_add( | ||||
| immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); | immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| /* Draw the selection */ | /* Draw the selection */ | ||||
| if (text->curl != text->sell || text->curc != text->selc) { | if (text->curl != text->sell || text->curc != text->selc) { | ||||
| /* Convert all to view space character coordinates */ | /* Convert all to view space character coordinates */ | ||||
| wrap_offset(st, region, text->curl, text->curc, &offl, &offc); | wrap_offset(st, region, text->curl, text->curc, &offl, &offc); | ||||
| vcurl = txt_get_span(text->lines.first, text->curl) - st->top + offl; | vcurl = txt_get_span(text->lines.first, text->curl) - st->top + offl; | ||||
| vcurc = text_get_char_pos(st, text->curl->line, text->curc) - st->left + offc; | vcurc = text_get_char_pos(st, text->curl->line, text->curc) - st->left + offc; | ||||
| ▲ Show 20 Lines • Show All 366 Lines • ▼ Show 20 Lines | void draw_text_main(SpaceText *st, ARegion *region) | ||||
| tdc.cwidth_px = max_ii((int)BLF_fixed_width(tdc.font_id), 1); | tdc.cwidth_px = max_ii((int)BLF_fixed_width(tdc.font_id), 1); | ||||
| st->runtime.cwidth_px = tdc.cwidth_px; | st->runtime.cwidth_px = tdc.cwidth_px; | ||||
| /* draw line numbers background */ | /* draw line numbers background */ | ||||
| if (st->showlinenrs) { | if (st->showlinenrs) { | ||||
| uint pos = GPU_vertformat_attr_add( | uint pos = GPU_vertformat_attr_add( | ||||
| immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); | immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| immUniformThemeColor(TH_GRID); | immUniformThemeColor(TH_GRID); | ||||
| immRecti(pos, 0, 0, TXT_NUMCOL_WIDTH(st), region->winy); | immRecti(pos, 0, 0, TXT_NUMCOL_WIDTH(st), region->winy); | ||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| } | } | ||||
| else { | else { | ||||
| st->runtime.line_number_display_digits = 0; /* not used */ | st->runtime.line_number_display_digits = 0; /* not used */ | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | for (i = 0; y > clip_min_y && i < viewlines && tmp; i++, tmp = tmp->next) { | ||||
| wrap_skip = 0; | wrap_skip = 0; | ||||
| } | } | ||||
| if (st->flags & ST_SHOW_MARGIN) { | if (st->flags & ST_SHOW_MARGIN) { | ||||
| margin_column_x = x + st->runtime.cwidth_px * (st->margin_column - st->left); | margin_column_x = x + st->runtime.cwidth_px * (st->margin_column - st->left); | ||||
| if (margin_column_x >= x) { | if (margin_column_x >= x) { | ||||
| uint pos = GPU_vertformat_attr_add( | uint pos = GPU_vertformat_attr_add( | ||||
| immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); | immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| float margin_color[4]; | float margin_color[4]; | ||||
| UI_GetThemeColor4fv(TH_TEXT, margin_color); | UI_GetThemeColor4fv(TH_TEXT, margin_color); | ||||
| margin_color[3] = 0.2f; | margin_color[3] = 0.2f; | ||||
| immUniformColor4fv(margin_color); | immUniformColor4fv(margin_color); | ||||
| GPU_blend(GPU_BLEND_ALPHA); | GPU_blend(GPU_BLEND_ALPHA); | ||||
| immRecti(pos, margin_column_x, 0, margin_column_x + U.pixelsize, region->winy); | immRecti(pos, margin_column_x, 0, margin_column_x + U.pixelsize, region->winy); | ||||
| GPU_blend(GPU_BLEND_NONE); | GPU_blend(GPU_BLEND_NONE); | ||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| ▲ Show 20 Lines • Show All 172 Lines • Show Last 20 Lines | |||||