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.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c
index 99fcb2092c3..b541b65d676 100644
--- a/source/blender/editors/space_text/text_draw.c
+++ b/source/blender/editors/space_text/text_draw.c
@@ -48,6 +48,9 @@
#include "text_format.h"
#include "text_intern.h"
+#include "WM_api.h"
+#include "WM_types.h"
+
/******************** text font drawing ******************/
typedef struct TextDrawContext {
@@ -1734,6 +1737,23 @@ void text_update_character_width(SpaceText *st)
text_font_end(&tdc);
}
+bool ED_text_activate_in_screen(bContext *C, Text *text)
+{
+ ScrArea *area = BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_TEXT, 0);
+ if (area) {
+ SpaceText *st = area->spacedata.first;
+ ARegion *region = BKE_area_find_region_type(area, RGN_TYPE_WINDOW);
+ st->text = text;
+ if (region) {
+ ED_text_scroll_to_cursor(st, region, true);
+ }
+ WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, text);
+ return true;
+ }
+
+ return false;
+}
+
/* Moves the view to the cursor location,
* also used to make sure the view isn't outside the file */
void ED_text_scroll_to_cursor(SpaceText *st, ARegion *region, const bool center)