Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/space_text/text_draw.c')
-rw-r--r--source/blender/editors/space_text/text_draw.c158
1 files changed, 79 insertions, 79 deletions
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c
index 02914737229..b03c3ca68cb 100644
--- a/source/blender/editors/space_text/text_draw.c
+++ b/source/blender/editors/space_text/text_draw.c
@@ -187,9 +187,9 @@ static void format_draw_color(const TextDrawContext *tdc, char formatchar)
* \encode
*/
-int wrap_width(const SpaceText *st, ARegion *ar)
+int wrap_width(const SpaceText *st, ARegion *region)
{
- int winx = ar->winx - TXT_SCROLL_WIDTH;
+ int winx = region->winx - TXT_SCROLL_WIDTH;
int x, max;
x = TXT_BODY_LEFT(st);
@@ -199,7 +199,7 @@ int wrap_width(const SpaceText *st, ARegion *ar)
/* Sets (offl, offc) for transforming (line, curs) to its wrapped position */
void wrap_offset(
- const SpaceText *st, ARegion *ar, TextLine *linein, int cursin, int *offl, int *offc)
+ const SpaceText *st, ARegion *region, TextLine *linein, int cursin, int *offl, int *offc)
{
Text *text;
TextLine *linep;
@@ -221,7 +221,7 @@ void wrap_offset(
linep = text->lines.first;
i = st->top;
while (i > 0 && linep) {
- int lines = text_get_visible_lines(st, ar, linep->line);
+ int lines = text_get_visible_lines(st, region, linep->line);
/* Line before top */
if (linep == linein) {
@@ -241,7 +241,7 @@ void wrap_offset(
}
}
- max = wrap_width(st, ar);
+ max = wrap_width(st, region);
cursin = BLI_str_utf8_offset_to_column(linein->line, cursin);
while (linep) {
@@ -305,7 +305,7 @@ void wrap_offset(
/* cursin - mem, offc - view */
void wrap_offset_in_line(
- const SpaceText *st, ARegion *ar, TextLine *linein, int cursin, int *offl, int *offc)
+ const SpaceText *st, ARegion *region, TextLine *linein, int cursin, int *offl, int *offc)
{
int i, j, start, end, chars, max, chop;
char ch;
@@ -319,7 +319,7 @@ void wrap_offset_in_line(
return;
}
- max = wrap_width(st, ar);
+ max = wrap_width(st, region);
start = 0;
end = max;
@@ -598,7 +598,7 @@ static void text_drawcache_init(SpaceText *st)
st->runtime.drawcache = drawcache;
}
-static void text_update_drawcache(SpaceText *st, ARegion *ar)
+static void text_update_drawcache(SpaceText *st, ARegion *region)
{
DrawCache *drawcache;
int full_update = 0, nlines = 0;
@@ -616,7 +616,7 @@ static void text_update_drawcache(SpaceText *st, ARegion *ar)
/* check if full cache update is needed */
/* area was resized */
- full_update |= drawcache->winx != ar->winx;
+ full_update |= drawcache->winx != region->winx;
/* word-wrapping option was toggled */
full_update |= drawcache->wordwrap != st->wordwrap;
/* word-wrapping option was toggled */
@@ -673,7 +673,7 @@ static void text_update_drawcache(SpaceText *st, ARegion *ar)
lines_count = fp[lineno];
}
else {
- lines_count = text_get_visible_lines(st, ar, line->line);
+ lines_count = text_get_visible_lines(st, region, line->line);
}
fp[lineno] = lines_count;
@@ -706,7 +706,7 @@ static void text_update_drawcache(SpaceText *st, ARegion *ar)
drawcache->nlines = nlines;
/* store settings */
- drawcache->winx = ar->winx;
+ drawcache->winx = region->winx;
drawcache->wordwrap = st->wordwrap;
drawcache->lheight = st->runtime.lheight_px;
drawcache->cwidth_px = st->runtime.cwidth_px;
@@ -793,12 +793,12 @@ static int text_get_visible_lines_no(const SpaceText *st, int lineno)
return drawcache->line_height[lineno];
}
-int text_get_visible_lines(const SpaceText *st, ARegion *ar, const char *str)
+int text_get_visible_lines(const SpaceText *st, ARegion *region, const char *str)
{
int i, j, start, end, max, lines, chars;
char ch;
- max = wrap_width(st, ar);
+ max = wrap_width(st, region);
lines = 1;
start = 0;
end = max;
@@ -832,7 +832,7 @@ int text_get_visible_lines(const SpaceText *st, ARegion *ar, const char *str)
return lines;
}
-int text_get_span_wrap(const SpaceText *st, ARegion *ar, TextLine *from, TextLine *to)
+int text_get_span_wrap(const SpaceText *st, ARegion *region, TextLine *from, TextLine *to)
{
if (st->wordwrap) {
int ret = 0;
@@ -843,7 +843,7 @@ int text_get_span_wrap(const SpaceText *st, ARegion *ar, TextLine *from, TextLin
if (tmp == to) {
return ret;
}
- ret += text_get_visible_lines(st, ar, tmp->line);
+ ret += text_get_visible_lines(st, region, tmp->line);
tmp = tmp->next;
}
@@ -854,11 +854,11 @@ int text_get_span_wrap(const SpaceText *st, ARegion *ar, TextLine *from, TextLin
}
}
-int text_get_total_lines(SpaceText *st, ARegion *ar)
+int text_get_total_lines(SpaceText *st, ARegion *region)
{
DrawCache *drawcache;
- text_update_drawcache(st, ar);
+ text_update_drawcache(st, region);
drawcache = st->runtime.drawcache;
return drawcache->total_lines;
@@ -866,7 +866,7 @@ int text_get_total_lines(SpaceText *st, ARegion *ar)
/************************ draw scrollbar *****************************/
-static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll, rcti *back)
+static void calc_text_rcts(SpaceText *st, ARegion *region, rcti *scroll, rcti *back)
{
int lhlstart, lhlend, ltexth, sell_off, curl_off;
short barheight, barstart, hlstart, hlend, blank_lines;
@@ -874,17 +874,17 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll, rcti *back)
pix_top_margin = (0.4 * U.widget_unit);
pix_bottom_margin = (0.4 * U.widget_unit);
- pix_available = ar->winy - pix_top_margin - pix_bottom_margin;
- ltexth = text_get_total_lines(st, ar);
+ pix_available = region->winy - pix_top_margin - pix_bottom_margin;
+ ltexth = text_get_total_lines(st, region);
blank_lines = st->runtime.viewlines / 2;
/* nicer code: use scroll rect for entire bar */
- back->xmin = ar->winx - (0.6 * U.widget_unit);
- back->xmax = ar->winx;
+ back->xmin = region->winx - (0.6 * U.widget_unit);
+ back->xmax = region->winx;
back->ymin = 0;
- back->ymax = ar->winy;
+ back->ymax = region->winy;
- scroll->xmax = ar->winx - (0.2 * U.widget_unit);
+ scroll->xmax = region->winx - (0.2 * U.widget_unit);
scroll->xmin = scroll->xmax - (0.4 * U.widget_unit);
scroll->ymin = pix_top_margin;
scroll->ymax = pix_available;
@@ -909,16 +909,16 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll, rcti *back)
st->runtime.scroll_region_handle.ymax -= barstart;
st->runtime.scroll_region_handle.ymin = st->runtime.scroll_region_handle.ymax - barheight;
- CLAMP(st->runtime.scroll_region_handle.ymin, pix_bottom_margin, ar->winy - pix_top_margin);
- CLAMP(st->runtime.scroll_region_handle.ymax, pix_bottom_margin, ar->winy - pix_top_margin);
+ CLAMP(st->runtime.scroll_region_handle.ymin, pix_bottom_margin, region->winy - pix_top_margin);
+ CLAMP(st->runtime.scroll_region_handle.ymax, pix_bottom_margin, region->winy - pix_top_margin);
st->runtime.scroll_px_per_line = (pix_available > 0) ? (float)ltexth / pix_available : 0;
if (st->runtime.scroll_px_per_line < 0.1f) {
st->runtime.scroll_px_per_line = 0.1f;
}
- curl_off = text_get_span_wrap(st, ar, st->text->lines.first, st->text->curl);
- sell_off = text_get_span_wrap(st, ar, st->text->lines.first, st->text->sell);
+ curl_off = text_get_span_wrap(st, region, st->text->lines.first, st->text->curl);
+ sell_off = text_get_span_wrap(st, region, st->text->lines.first, st->text->sell);
lhlstart = MIN2(curl_off, sell_off);
lhlend = MAX2(curl_off, sell_off);
@@ -981,11 +981,11 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll, rcti *back)
}
st->runtime.scroll_region_select = *scroll;
- st->runtime.scroll_region_select.ymax = ar->winy - pix_top_margin - hlstart;
- st->runtime.scroll_region_select.ymin = ar->winy - pix_top_margin - hlend;
+ st->runtime.scroll_region_select.ymax = region->winy - pix_top_margin - hlstart;
+ st->runtime.scroll_region_select.ymin = region->winy - pix_top_margin - hlend;
- CLAMP(st->runtime.scroll_region_select.ymin, pix_bottom_margin, ar->winy - pix_top_margin);
- CLAMP(st->runtime.scroll_region_select.ymax, pix_bottom_margin, ar->winy - pix_top_margin);
+ CLAMP(st->runtime.scroll_region_select.ymin, pix_bottom_margin, region->winy - pix_top_margin);
+ CLAMP(st->runtime.scroll_region_select.ymax, pix_bottom_margin, region->winy - pix_top_margin);
}
static void draw_textscroll(const SpaceText *st, rcti *scroll, rcti *back)
@@ -1025,7 +1025,7 @@ static void draw_textscroll(const SpaceText *st, rcti *scroll, rcti *back)
/*********************** draw documentation *******************************/
#if 0
-static void draw_documentation(const SpaceText *st, ARegion *ar)
+static void draw_documentation(const SpaceText *st, ARegion *region)
{
TextDrawContext tdc = {0};
TextLine *tmp;
@@ -1062,7 +1062,7 @@ static void draw_documentation(const SpaceText *st, ARegion *ar)
x += SUGG_LIST_WIDTH * st->runtime.cwidth_px + 50;
}
- /* top = */ /* UNUSED */ y = ar->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;
boxh = (DOC_HEIGHT + 1) * TXT_LINE_HEIGHT(st);
@@ -1136,7 +1136,7 @@ static void draw_documentation(const SpaceText *st, ARegion *ar)
/*********************** draw suggestion list *******************************/
-static void draw_suggestion_list(const SpaceText *st, const TextDrawContext *tdc, ARegion *ar)
+static void draw_suggestion_list(const SpaceText *st, const TextDrawContext *tdc, ARegion *region)
{
SuggItem *item, *first, *last, *sel;
char str[SUGG_LIST_WIDTH * BLI_UTF8_MAX + 1];
@@ -1163,12 +1163,12 @@ static void draw_suggestion_list(const SpaceText *st, const TextDrawContext *tdc
sel = texttool_suggest_selected();
top = texttool_suggest_top();
- wrap_offset(st, ar, st->text->curl, st->text->curc, &offl, &offc);
+ wrap_offset(st, region, st->text->curl, st->text->curc, &offl, &offc);
vcurl = txt_get_span(st->text->lines.first, st->text->curl) - st->top + offl;
vcurc = text_get_char_pos(st, st->text->curl->line, st->text->curc) - st->left + offc;
x = TXT_BODY_LEFT(st) + (vcurc * st->runtime.cwidth_px);
- y = ar->winy - (vcurl + 1) * lheight - 2;
+ y = region->winy - (vcurl + 1) * lheight - 2;
/* offset back so the start of the text lines up with the suggestions,
* not essential but makes suggestions easier to follow */
@@ -1178,8 +1178,8 @@ static void draw_suggestion_list(const SpaceText *st, const TextDrawContext *tdc
boxw = SUGG_LIST_WIDTH * st->runtime.cwidth_px + 20;
boxh = SUGG_LIST_SIZE * lheight + 8;
- if (x + boxw > ar->winx) {
- x = MAX2(0, ar->winx - boxw);
+ if (x + boxw > region->winx) {
+ x = MAX2(0, region->winx - boxw);
}
/* not needed but stands out nicer */
@@ -1232,7 +1232,7 @@ static void draw_suggestion_list(const SpaceText *st, const TextDrawContext *tdc
/*********************** draw cursor ************************/
-static void draw_text_decoration(SpaceText *st, ARegion *ar)
+static void draw_text_decoration(SpaceText *st, ARegion *region)
{
Text *text = st->text;
int vcurl, vcurc, vsell, vselc, hidden = 0;
@@ -1241,7 +1241,7 @@ static void draw_text_decoration(SpaceText *st, ARegion *ar)
const int lheight = TXT_LINE_HEIGHT(st);
/* Convert to view space character coordinates to determine if cursor is hidden */
- wrap_offset(st, ar, text->sell, text->selc, &offl, &offc);
+ wrap_offset(st, region, text->sell, text->selc, &offl, &offc);
vsell = txt_get_span(text->lines.first, text->sell) - st->top + offl;
vselc = text_get_char_pos(st, text->sell->line, text->selc) - st->left + offc;
@@ -1262,7 +1262,7 @@ static void draw_text_decoration(SpaceText *st, ARegion *ar)
/* Draw the selection */
if (text->curl != text->sell || text->curc != text->selc) {
/* Convert all to view space character coordinates */
- wrap_offset(st, ar, 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;
vcurc = text_get_char_pos(st, text->curl->line, text->curc) - st->left + offc;
@@ -1273,7 +1273,7 @@ static void draw_text_decoration(SpaceText *st, ARegion *ar)
immUniformThemeColor(TH_SHADE2);
x = TXT_BODY_LEFT(st);
- y = ar->winy;
+ y = region->winy;
if (st->flags & ST_SCROLL_SELECT) {
y += st->runtime.scroll_ofs_px[1];
}
@@ -1314,11 +1314,11 @@ static void draw_text_decoration(SpaceText *st, ARegion *ar)
y -= froml * lheight;
- immRecti(pos, x + fromc * st->runtime.cwidth_px - U.pixelsize, y, ar->winx, y - lheight);
+ immRecti(pos, x + fromc * st->runtime.cwidth_px - U.pixelsize, y, region->winx, y - lheight);
y -= lheight;
for (i = froml + 1; i < tol; i++) {
- immRecti(pos, x - U.pixelsize, y, ar->winx, y - lheight);
+ immRecti(pos, x - U.pixelsize, y, region->winx, y - lheight);
y -= lheight;
}
@@ -1333,25 +1333,25 @@ static void draw_text_decoration(SpaceText *st, ARegion *ar)
int y1, y2;
if (st->wordwrap) {
- int visible_lines = text_get_visible_lines(st, ar, text->sell->line);
+ int visible_lines = text_get_visible_lines(st, region, text->sell->line);
- wrap_offset_in_line(st, ar, text->sell, text->selc, &offl, &offc);
+ wrap_offset_in_line(st, region, text->sell, text->selc, &offl, &offc);
- y1 = ar->winy - (vsell - offl) * lheight;
+ y1 = region->winy - (vsell - offl) * lheight;
if (st->flags & ST_SCROLL_SELECT) {
y1 += st->runtime.scroll_ofs_px[1];
}
y2 = y1 - (lheight * visible_lines);
}
else {
- y1 = ar->winy - vsell * lheight;
+ y1 = region->winy - vsell * lheight;
if (st->flags & ST_SCROLL_SELECT) {
y1 += st->runtime.scroll_ofs_px[1];
}
y2 = y1 - (lheight);
}
- if (!(y1 < 0 || y2 > ar->winy)) { /* check we need to draw */
+ if (!(y1 < 0 || y2 > region->winy)) { /* check we need to draw */
float highlight_color[4];
UI_GetThemeColor4fv(TH_TEXT, highlight_color);
highlight_color[3] = 0.1f;
@@ -1359,7 +1359,7 @@ static void draw_text_decoration(SpaceText *st, ARegion *ar)
GPU_blend_set_func_separate(
GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
GPU_blend(true);
- immRecti(pos, 0, y1, ar->winx, y2);
+ immRecti(pos, 0, y1, region->winx, y2);
GPU_blend(false);
}
}
@@ -1367,7 +1367,7 @@ static void draw_text_decoration(SpaceText *st, ARegion *ar)
if (!hidden) {
/* Draw the cursor itself (we draw the sel. cursor as this is the leading edge) */
x = TXT_BODY_LEFT(st) + (vselc * st->runtime.cwidth_px);
- y = ar->winy - vsell * lheight;
+ y = region->winy - vsell * lheight;
if (st->flags & ST_SCROLL_SELECT) {
y += st->runtime.scroll_ofs_px[1];
}
@@ -1396,7 +1396,7 @@ static void draw_text_decoration(SpaceText *st, ARegion *ar)
/******************* draw matching brackets *********************/
-static void draw_brackets(const SpaceText *st, const TextDrawContext *tdc, ARegion *ar)
+static void draw_brackets(const SpaceText *st, const TextDrawContext *tdc, ARegion *region)
{
TextLine *startl, *endl, *linep;
Text *text = st->text;
@@ -1521,14 +1521,14 @@ static void draw_brackets(const SpaceText *st, const TextDrawContext *tdc, ARegi
UI_FontThemeColor(tdc->font_id, TH_HILITE);
x = TXT_BODY_LEFT(st);
- y = ar->winy - st->runtime.lheight_px;
+ y = region->winy - st->runtime.lheight_px;
if (st->flags & ST_SCROLL_SELECT) {
y += st->runtime.scroll_ofs_px[1];
}
/* draw opening bracket */
ch = startl->line[startc];
- wrap_offset(st, ar, startl, startc, &offl, &offc);
+ wrap_offset(st, region, startl, startc, &offl, &offc);
viewc = text_get_char_pos(st, startl->line, startc) - st->left + offc;
if (viewc >= 0) {
@@ -1542,7 +1542,7 @@ static void draw_brackets(const SpaceText *st, const TextDrawContext *tdc, ARegi
/* draw closing bracket */
ch = endl->line[endc];
- wrap_offset(st, ar, endl, endc, &offl, &offc);
+ wrap_offset(st, region, endl, endc, &offl, &offc);
viewc = text_get_char_pos(st, endl->line, endc) - st->left + offc;
if (viewc >= 0) {
@@ -1557,7 +1557,7 @@ static void draw_brackets(const SpaceText *st, const TextDrawContext *tdc, ARegi
/*********************** main region drawing *************************/
-void draw_text_main(SpaceText *st, ARegion *ar)
+void draw_text_main(SpaceText *st, ARegion *region)
{
TextDrawContext tdc = {0};
Text *text = st->text;
@@ -1581,12 +1581,12 @@ void draw_text_main(SpaceText *st, ARegion *ar)
const int clip_min_y = -(int)(st->runtime.lheight_px - 1);
st->runtime.viewlines = (st->runtime.lheight_px) ?
- (int)(ar->winy - clip_min_y) / TXT_LINE_HEIGHT(st) :
+ (int)(region->winy - clip_min_y) / TXT_LINE_HEIGHT(st) :
0;
text_draw_context_init(st, &tdc);
- text_update_drawcache(st, ar);
+ text_update_drawcache(st, region);
/* make sure all the positional pointers exist */
if (!text->curl || !text->sell || !text->lines.first || !text->lines.last) {
@@ -1594,7 +1594,7 @@ void draw_text_main(SpaceText *st, ARegion *ar)
}
/* update rects for scroll */
- calc_text_rcts(st, ar, &scroll, &back); /* scroll will hold the entire bar size */
+ calc_text_rcts(st, region, &scroll, &back); /* scroll will hold the entire bar size */
/* update syntax formatting if needed */
tft = ED_text_format_get(text);
@@ -1637,7 +1637,7 @@ void draw_text_main(SpaceText *st, ARegion *ar)
immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformThemeColor(TH_GRID);
- immRecti(pos, 0, 0, TXT_NUMCOL_WIDTH(st), ar->winy);
+ immRecti(pos, 0, 0, TXT_NUMCOL_WIDTH(st), region->winy);
immUnbindProgram();
}
else {
@@ -1645,17 +1645,17 @@ void draw_text_main(SpaceText *st, ARegion *ar)
}
x = TXT_BODY_LEFT(st);
- y = ar->winy - st->runtime.lheight_px;
+ y = region->winy - st->runtime.lheight_px;
int viewlines = st->runtime.viewlines;
if (st->flags & ST_SCROLL_SELECT) {
y += st->runtime.scroll_ofs_px[1];
viewlines += 1;
}
- winx = ar->winx - TXT_SCROLL_WIDTH;
+ winx = region->winx - TXT_SCROLL_WIDTH;
/* draw cursor, margin, selection and highlight */
- draw_text_decoration(st, ar);
+ draw_text_decoration(st, region);
/* draw the text */
UI_FontThemeColor(tdc.font_id, TH_TEXT);
@@ -1695,7 +1695,7 @@ void draw_text_main(SpaceText *st, ARegion *ar)
else {
/* draw unwrapped text */
text_draw(
- st, &tdc, tmp->line, st->left, ar->winx / st->runtime.cwidth_px, x, y, tmp->format);
+ st, &tdc, tmp->line, st->left, region->winx / st->runtime.cwidth_px, x, y, tmp->format);
y -= TXT_LINE_HEIGHT(st);
}
@@ -1713,17 +1713,17 @@ void draw_text_main(SpaceText *st, ARegion *ar)
margin_color[3] = 0.2f;
immUniformColor4fv(margin_color);
GPU_blend(true);
- immRecti(pos, margin_column_x, 0, margin_column_x + U.pixelsize, ar->winy);
+ immRecti(pos, margin_column_x, 0, margin_column_x + U.pixelsize, region->winy);
GPU_blend(false);
immUnbindProgram();
}
}
/* draw other stuff */
- draw_brackets(st, &tdc, ar);
+ draw_brackets(st, &tdc, region);
draw_textscroll(st, &scroll, &back);
- /* draw_documentation(st, ar); - No longer supported */
- draw_suggestion_list(st, &tdc, ar);
+ /* draw_documentation(st, region); - No longer supported */
+ draw_suggestion_list(st, &tdc, region);
text_font_end(&tdc);
}
@@ -1744,10 +1744,10 @@ void text_update_character_width(SpaceText *st)
/* Moves the view to the cursor location,
* also used to make sure the view isn't outside the file */
-void text_scroll_to_cursor(SpaceText *st, ARegion *ar, const bool center)
+void text_scroll_to_cursor(SpaceText *st, ARegion *region, const bool center)
{
Text *text;
- int i, x, winx = ar->winx;
+ int i, x, winx = region->winx;
if (ELEM(NULL, st, st->text, st->text->curl)) {
return;
@@ -1760,7 +1760,7 @@ void text_scroll_to_cursor(SpaceText *st, ARegion *ar, const bool center)
i = txt_get_span(text->lines.first, text->sell);
if (st->wordwrap) {
int offl, offc;
- wrap_offset(st, ar, text->sell, text->selc, &offl, &offc);
+ wrap_offset(st, region, text->sell, text->selc, &offl, &offc);
i += offl;
}
@@ -1814,16 +1814,16 @@ void text_scroll_to_cursor(SpaceText *st, ARegion *ar, const bool center)
/* takes an area instead of a region, use for listeners */
void text_scroll_to_cursor__area(SpaceText *st, ScrArea *sa, const bool center)
{
- ARegion *ar;
+ ARegion *region;
if (ELEM(NULL, st, st->text, st->text->curl)) {
return;
}
- ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+ region = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
- if (ar) {
- text_scroll_to_cursor(st, ar, center);
+ if (region) {
+ text_scroll_to_cursor(st, region, center);
}
}
@@ -1839,7 +1839,7 @@ void text_update_cursor_moved(bContext *C)
* Takes a cursor (row, character) and returns x,y pixel coords.
*/
bool ED_text_region_location_from_cursor(SpaceText *st,
- ARegion *ar,
+ ARegion *region,
const int cursor_co[2],
int r_pixel_co[2])
{
@@ -1859,10 +1859,10 @@ bool ED_text_region_location_from_cursor(SpaceText *st,
/* handle tabs as well! */
int char_pos = text_get_char_pos(st, line->line, cursor_co[1]);
- wrap_offset(st, ar, line, cursor_co[1], &offl, &offc);
+ wrap_offset(st, region, line, cursor_co[1], &offl, &offc);
r_pixel_co[0] = (char_pos + offc - st->left) * st->runtime.cwidth_px + linenr_offset;
r_pixel_co[1] = (cursor_co[0] + offl - st->top) * TXT_LINE_HEIGHT(st);
- r_pixel_co[1] = (ar->winy - (r_pixel_co[1] + (TXT_BODY_LPAD * st->runtime.cwidth_px))) -
+ r_pixel_co[1] = (region->winy - (r_pixel_co[1] + (TXT_BODY_LPAD * st->runtime.cwidth_px))) -
st->runtime.lheight_px;
}
return true;