Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_text/text_ops.c
| Show First 20 Lines • Show All 500 Lines • ▼ Show 20 Lines | static int text_unlink_exec(bContext *C, wmOperator *UNUSED(op)) | ||||
| SpaceText *st = CTX_wm_space_text(C); | SpaceText *st = CTX_wm_space_text(C); | ||||
| Text *text = CTX_data_edit_text(C); | Text *text = CTX_data_edit_text(C); | ||||
| /* make the previous text active, if its not there make the next text active */ | /* make the previous text active, if its not there make the next text active */ | ||||
| if (st) { | if (st) { | ||||
| if (text->id.prev) { | if (text->id.prev) { | ||||
| st->text = text->id.prev; | st->text = text->id.prev; | ||||
| text_update_cursor_moved(C); | text_update_cursor_moved(C); | ||||
| WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, st->text); | |||||
| } | } | ||||
| else if (text->id.next) { | else if (text->id.next) { | ||||
| st->text = text->id.next; | st->text = text->id.next; | ||||
| text_update_cursor_moved(C); | text_update_cursor_moved(C); | ||||
| WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, st->text); | |||||
| } | } | ||||
| } | } | ||||
| BKE_id_delete(bmain, text); | BKE_id_delete(bmain, text); | ||||
| text_drawcache_tag_update(st, 1); | text_drawcache_tag_update(st, 1); | ||||
| WM_event_add_notifier(C, NC_TEXT | NA_REMOVED, NULL); | WM_event_add_notifier(C, NC_TEXT | NA_REMOVED, NULL); | ||||
| ▲ Show 20 Lines • Show All 2,672 Lines • ▼ Show 20 Lines | static void text_cursor_set_apply(bContext *C, wmOperator *op, const wmEvent *event) | ||||
| ARegion *region = CTX_wm_region(C); | ARegion *region = CTX_wm_region(C); | ||||
| SetSelection *ssel = op->customdata; | SetSelection *ssel = op->customdata; | ||||
| if (event->mval[1] < 0 || event->mval[1] > region->winy) { | if (event->mval[1] < 0 || event->mval[1] > region->winy) { | ||||
| text_cursor_timer_ensure(C, ssel); | text_cursor_timer_ensure(C, ssel); | ||||
| if (event->type == TIMER) { | if (event->type == TIMER) { | ||||
| text_cursor_set_to_pos(st, region, event->mval[0], event->mval[1], 1); | text_cursor_set_to_pos(st, region, event->mval[0], event->mval[1], 1); | ||||
| text_scroll_to_cursor(st, region, false); | ED_text_scroll_to_cursor(st, region, false); | ||||
| WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, st->text); | WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, st->text); | ||||
| } | } | ||||
| } | } | ||||
| else if (!st->wordwrap && (event->mval[0] < 0 || event->mval[0] > region->winx)) { | else if (!st->wordwrap && (event->mval[0] < 0 || event->mval[0] > region->winx)) { | ||||
| text_cursor_timer_ensure(C, ssel); | text_cursor_timer_ensure(C, ssel); | ||||
| if (event->type == TIMER) { | if (event->type == TIMER) { | ||||
| text_cursor_set_to_pos( | text_cursor_set_to_pos( | ||||
| st, region, CLAMPIS(event->mval[0], 0, region->winx), event->mval[1], 1); | st, region, CLAMPIS(event->mval[0], 0, region->winx), event->mval[1], 1); | ||||
| text_scroll_to_cursor(st, region, false); | ED_text_scroll_to_cursor(st, region, false); | ||||
| WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, st->text); | WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, st->text); | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| text_cursor_timer_remove(C, ssel); | text_cursor_timer_remove(C, ssel); | ||||
| if (event->type != TIMER) { | if (event->type != TIMER) { | ||||
| text_cursor_set_to_pos(st, region, event->mval[0], event->mval[1], 1); | text_cursor_set_to_pos(st, region, event->mval[0], event->mval[1], 1); | ||||
| text_scroll_to_cursor(st, region, false); | ED_text_scroll_to_cursor(st, region, false); | ||||
| WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, st->text); | WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, st->text); | ||||
| ssel->mval_prev[0] = event->mval[0]; | ssel->mval_prev[0] = event->mval[0]; | ||||
| ssel->mval_prev[1] = event->mval[1]; | ssel->mval_prev[1] = event->mval[1]; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 713 Lines • Show Last 20 Lines | |||||