diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-06-04 10:31:30 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-06-04 10:31:30 +0300 |
commit | 44505b38df557a5711703613685a1dec9fc2c3d9 (patch) | |
tree | 3f05bebcc7bfadf56569f2dcca7f95fc56b1b0d0 /source/blender/editors/space_text/text_draw.c | |
parent | 6654e109df952be3a3128fae2508a02c196ae593 (diff) |
Cleanup: strip trailing space in editors
Diffstat (limited to 'source/blender/editors/space_text/text_draw.c')
-rw-r--r-- | source/blender/editors/space_text/text_draw.c | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index 23f28a91be8..9a3dcddf804 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -111,7 +111,7 @@ static int text_font_draw_character_utf8(const TextDrawContext *tdc, int x, int #if 0 /* Formats every line of the current text */ -static void txt_format_text(SpaceText *st) +static void txt_format_text(SpaceText *st) { TextLine *linep; @@ -189,7 +189,7 @@ int wrap_width(const SpaceText *st, ARegion *ar) { int winx = ar->winx - TXT_SCROLL_WIDTH; int x, max; - + x = st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET; max = st->cwidth ? (winx - x) / st->cwidth : 0; return max > 8 ? max : 8; @@ -356,7 +356,7 @@ void wrap_offset_in_line(const SpaceText *st, ARegion *ar, TextLine *linein, int int text_get_char_pos(const SpaceText *st, const char *line, int cur) { int a = 0, i; - + for (i = 0; i < cur && line[i]; i += BLI_str_utf8_size_safe(line + i)) { if (line[i] == '\t') a += st->tabnumber - a % st->tabnumber; @@ -405,11 +405,11 @@ static int text_draw_wrapped( if (max < 8) max = 8; basex = x; lines = 1; - + fpos = fstart = 0; mstart = 0; mend = txt_utf8_forward_columns(str, max, &padding) - str; end = wrap = max - padding; - + for (i = 0, mi = 0; str[mi]; i += columns, mi += BLI_str_utf8_size_safe(str + mi)) { columns = BLI_str_utf8_char_width_safe(str + mi); if (i + columns > end) { @@ -657,7 +657,7 @@ void text_drawcache_tag_update(SpaceText *st, int full) /* this happens if text editor ops are caled from python */ if (st == NULL) return; - + if (st->drawcache) { DrawCache *drawcache = (DrawCache *)st->drawcache; Text *txt = st->text; @@ -806,17 +806,17 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll, rcti *back) back->xmax = ar->winx; back->ymin = 0; back->ymax = ar->winy; - + scroll->xmin = ar->winx - V2D_SCROLL_WIDTH; scroll->xmax = ar->winx - 5; scroll->ymin = 4; scroll->ymax = 4 + pix_available; - + /* when re-sizing a view-port with the bar at the bottom to a greater height more blank lines will be added */ if (ltexth + blank_lines < st->top + st->viewlines) { blank_lines = st->top + st->viewlines - ltexth; } - + ltexth += blank_lines; barheight = (ltexth > 0) ? (st->viewlines * pix_available) / ltexth : 0; @@ -893,7 +893,7 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll, rcti *back) if (hlend - hlstart < 2) { hlend = hlstart + 2; } - + st->txtscroll = *scroll; st->txtscroll.ymax = ar->winy - pix_top_margin - hlstart; st->txtscroll.ymin = ar->winy - pix_top_margin - hlend; @@ -908,7 +908,7 @@ static void draw_textscroll(const SpaceText *st, rcti *scroll, rcti *back) uiWidgetColors wcol = btheme->tui.wcol_scroll; unsigned char col[4]; float rad; - + UI_ThemeColor(TH_BACK); glRecti(back->xmin, back->ymin, back->xmax, back->ymax); @@ -934,10 +934,10 @@ static void draw_documentation(const SpaceText *st, ARegion *ar) char *docs, buf[DOC_WIDTH + 1], *p; int i, br, lines; int boxw, boxh, l, x, y /* , top */ /* UNUSED */; - + if (!st || !st->text) return; if (!texttool_text_is_active(st->text)) return; - + docs = texttool_docs_get(); if (!docs) return; @@ -947,7 +947,7 @@ static void draw_documentation(const SpaceText *st, ARegion *ar) /* Count the visible lines to the cursor */ for (tmp = st->text->curl, l = -st->top; tmp; tmp = tmp->prev, l++) ; if (l < 0) return; - + if (st->showlinenrs) { x = st->cwidth * (st->text->curc - st->left) + TXT_OFFSET + TEXTXLOC - 4; } @@ -1027,7 +1027,7 @@ static void draw_suggestion_list(const SpaceText *st, const TextDrawContext *tdc int w, boxw = 0, boxh, i, x, y, *top; const int lheight = st->lheight_dpi + TXT_LINE_SPACING; const int margin_x = 2; - + if (!st->text) return; if (!texttool_text_is_active(st->text)) return; @@ -1054,7 +1054,7 @@ static void draw_suggestion_list(const SpaceText *st, const TextDrawContext *tdc boxw = SUGG_LIST_WIDTH * st->cwidth + 20; boxh = SUGG_LIST_SIZE * lheight + 8; - + if (x + boxw > ar->winx) x = MAX2(0, ar->winx - boxw); @@ -1077,7 +1077,7 @@ static void draw_suggestion_list(const SpaceText *st, const TextDrawContext *tdc BLI_strncpy(str, item->name, len + 1); w = st->cwidth * text_get_char_pos(st, str, len); - + if (item == sel) { UI_ThemeColor(TH_SHADE2); glRecti(x + margin_x, y - 3, x + margin_x + w, y + lheight - 3); @@ -1117,7 +1117,7 @@ static void draw_cursor(SpaceText *st, ARegion *ar) vselc = 0; hidden = 1; } - + UI_ThemeColor(TH_SHADE2); x = st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET; y = ar->winy; @@ -1188,27 +1188,27 @@ static void draw_cursor(SpaceText *st, ARegion *ar) x2 = x1 + ar->winx; glColor4ub(255, 255, 255, 32); - + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); glRecti(x1 - 4, y1, x2, y2); glDisable(GL_BLEND); } } - + if (!hidden) { /* Draw the cursor itself (we draw the sel. cursor as this is the leading edge) */ x = st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET; x += vselc * st->cwidth; y = ar->winy - vsell * lheight; - + if (st->overwrite) { char ch = text->sell->line[text->selc]; - + y += TXT_LINE_SPACING; w = st->cwidth; if (ch == '\t') w *= st->tabnumber - (vselc + st->left) % st->tabnumber; - + UI_ThemeColor(TH_HILITE); glRecti(x, y - lheight - 1, x + w, y - lheight + 1); } @@ -1227,7 +1227,7 @@ static void draw_brackets(const SpaceText *st, const TextDrawContext *tdc, ARegi Text *text = st->text; int b, fc, find, stack, viewc, viewl, offl, offc, x, y; int startc, endc, c; - + char ch; // showsyntax must be on or else the format string will be null @@ -1246,7 +1246,7 @@ static void draw_brackets(const SpaceText *st, const TextDrawContext *tdc, ARegi endc = -1; find = -b; stack = 0; - + /* Don't highlight backets if syntax HL is off or bracket in string or comment. */ if (!linep->format || linep->format[fc] == FMT_TYPE_STRING || linep->format[fc] == FMT_TYPE_COMMENT) return; @@ -1371,7 +1371,7 @@ void draw_text_main(SpaceText *st, ARegion *ar) const int clip_min_y = -(int)(st->lheight_dpi - 1); st->viewlines = (st->lheight_dpi) ? (int)(ar->winy - clip_min_y) / (st->lheight_dpi + TXT_LINE_SPACING) : 0; - + text_draw_context_init(st, &tdc); text_update_drawcache(st, ar); @@ -1379,7 +1379,7 @@ void draw_text_main(SpaceText *st, ARegion *ar) /* make sure all the positional pointers exist */ if (!text->curl || !text->sell || !text->lines.first || !text->lines.last) txt_clean_text(text); - + /* update rects for scroll */ calc_text_rcts(st, ar, &scroll, &back); /* scroll will hold the entire bar size */ @@ -1431,7 +1431,7 @@ void draw_text_main(SpaceText *st, ARegion *ar) } y = ar->winy - st->lheight_dpi; winx = ar->winx - TXT_SCROLL_WIDTH; - + /* draw cursor */ draw_cursor(st, ar); @@ -1466,13 +1466,13 @@ void draw_text_main(SpaceText *st, ARegion *ar) text_draw(st, &tdc, tmp->line, st->left, ar->winx / st->cwidth, x, y, tmp->format); y -= st->lheight_dpi + TXT_LINE_SPACING; } - + wrap_skip = 0; } - + if (st->flags & ST_SHOW_MARGIN) { margin_column_x = x + st->cwidth * (st->margin_column - st->left); - + if (margin_column_x >= x) { /* same color as line number background */ UI_ThemeColor(TH_GRID); @@ -1491,7 +1491,7 @@ void draw_text_main(SpaceText *st, ARegion *ar) draw_textscroll(st, &scroll, &back); /* draw_documentation(st, ar); - No longer supported */ draw_suggestion_list(st, &tdc, ar); - + text_font_end(&tdc); } @@ -1542,7 +1542,7 @@ void text_scroll_to_cursor(SpaceText *st, ARegion *ar, const bool center) st->top = i; } } - + if (st->wordwrap) { st->left = 0; } |