Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_text/text_draw.c
| Context not available. | |||||
| Text *text; | Text *text; | ||||
| ARegion *ar = NULL; | ARegion *ar = NULL; | ||||
| int i, x, winx = 0; | int i, x, winx = 0; | ||||
| int text_cursor_x, text_cursor_y, index = 0; | |||||
mont29: To be removed? see comment below. | |||||
| if (ELEM(NULL, st, st->text, st->text->curl)) return; | if (ELEM(NULL, st, st->text, st->text->curl)) return; | ||||
| Context not available. | |||||
| st->scroll_accum[0] = 0.0f; | st->scroll_accum[0] = 0.0f; | ||||
| st->scroll_accum[1] = 0.0f; | st->scroll_accum[1] = 0.0f; | ||||
| text_cursor_x = (text->curc - st->left) * st->cwidth; | |||||
| index = txt_get_span(text->lines.first, text->curl); | |||||
| text_cursor_y = sa->winy - ((index - st->top) * st->lheight); | |||||
mont29Unsubmitted Not Done Inline Actionssa is no more available here in master (since 10/11), ar->winy maybe? mont29: sa is no more available here in master (since 10/11), ar->winy maybe? | |||||
| st->text_cursor_pos[0] = text_cursor_x; | |||||
| st->text_cursor_pos[1] = text_cursor_y; | |||||
| #ifndef NDEBUG | |||||
| printf("Left: %d Top: %d \n", st->left, st->top); | |||||
| printf("Row: %d Col: %d \n", x, index); | |||||
Not Done Inline ActionsShould be removed, but maybe it's useful to leave this as a debug option Severin: Should be removed, but maybe it's useful to leave this as a debug option | |||||
| printf("Cursor_x : %d Cursor_y: %d \n", st->text_cursor_pos[0], st->text_cursor_pos[1]); | |||||
| #endif | |||||
mont29Unsubmitted Not Done Inline ActionsDo not really see the point to have intermediate vars here, would just do: i = txt_get_span(text->lines.first, text->curl); st->text_cursor_pos[0] = (text->curc - st->left) * st->cwidth; st->text_cursor_pos[1] = sa->winy - ((i - st->top) * st->lheight); … and remove the debug print in final version too, we do not want that on by default even in debug build. ;) mont29: Do not really see the point to have intermediate vars here, would just do:
i = txt_get_span… | |||||
mont29Unsubmitted Not Done Inline Actionstsst… needless blank lines. :P mont29: tsst… needless blank lines. :P | |||||
| } | } | ||||
| void text_update_cursor_moved(bContext *C) | void text_update_cursor_moved(bContext *C) | ||||
| Context not available. | |||||
Not Done Inline Actionsthis is a reasonably expensive function. Calling it each time on the offchange someone might want to access text_cursor_pos is unnecessary. campbellbarton: this is a reasonably expensive function.
Calling it each time on the offchange someone might… | |||||
To be removed? see comment below.