Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_text/text_draw.c
| Show First 20 Lines • Show All 1,733 Lines • ▼ Show 20 Lines | void text_update_character_width(SpaceText *st) | ||||
| text_font_begin(&tdc); | text_font_begin(&tdc); | ||||
| st->runtime.cwidth_px = BLF_fixed_width(tdc.font_id); | st->runtime.cwidth_px = BLF_fixed_width(tdc.font_id); | ||||
| st->runtime.cwidth_px = MAX2(st->runtime.cwidth_px, (char)1); | st->runtime.cwidth_px = MAX2(st->runtime.cwidth_px, (char)1); | ||||
| text_font_end(&tdc); | text_font_end(&tdc); | ||||
| } | } | ||||
| /* Moves the view to the cursor location, | /* Moves the view to the cursor location, | ||||
| * also used to make sure the view isn't outside the file */ | * also used to make sure the view isn't outside the file */ | ||||
| void text_scroll_to_cursor(SpaceText *st, ARegion *region, const bool center) | void ED_text_scroll_to_cursor(SpaceText *st, ARegion *region, const bool center) | ||||
| { | { | ||||
| Text *text; | Text *text; | ||||
| int i, x, winx = region->winx; | int i, x, winx = region->winx; | ||||
| if (ELEM(NULL, st, st->text, st->text->curl)) { | if (ELEM(NULL, st, st->text, st->text->curl)) { | ||||
| return; | return; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | void text_scroll_to_cursor__area(SpaceText *st, ScrArea *area, const bool center) | ||||
| if (ELEM(NULL, st, st->text, st->text->curl)) { | if (ELEM(NULL, st, st->text, st->text->curl)) { | ||||
| return; | return; | ||||
| } | } | ||||
| region = BKE_area_find_region_type(area, RGN_TYPE_WINDOW); | region = BKE_area_find_region_type(area, RGN_TYPE_WINDOW); | ||||
| if (region) { | if (region) { | ||||
| text_scroll_to_cursor(st, region, center); | ED_text_scroll_to_cursor(st, region, center); | ||||
| } | } | ||||
| } | } | ||||
| void text_update_cursor_moved(bContext *C) | void text_update_cursor_moved(bContext *C) | ||||
| { | { | ||||
| ScrArea *area = CTX_wm_area(C); | ScrArea *area = CTX_wm_area(C); | ||||
| SpaceText *st = CTX_wm_space_text(C); | SpaceText *st = CTX_wm_space_text(C); | ||||
| Show All 39 Lines | |||||