Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_text/space_text.c
| Show First 20 Lines • Show All 284 Lines • ▼ Show 20 Lines | static void text_main_region_init(wmWindowManager *wm, ARegion *ar) | ||||
| WM_event_add_dropbox_handler(&ar->handlers, lb); | WM_event_add_dropbox_handler(&ar->handlers, lb); | ||||
| } | } | ||||
| static void text_main_region_draw(const bContext *C, ARegion *ar) | static void text_main_region_draw(const bContext *C, ARegion *ar) | ||||
| { | { | ||||
| /* draw entirely, view changes should be handled here */ | /* draw entirely, view changes should be handled here */ | ||||
| SpaceText *st = CTX_wm_space_text(C); | SpaceText *st = CTX_wm_space_text(C); | ||||
| //View2D *v2d = &ar->v2d; | //View2D *v2d = &ar->v2d; | ||||
| int cursor_xy[2]; | |||||
| /* clear and setup matrix */ | /* clear and setup matrix */ | ||||
| UI_ThemeClearColor(TH_BACK); | UI_ThemeClearColor(TH_BACK); | ||||
| GPU_clear(GPU_COLOR_BIT); | GPU_clear(GPU_COLOR_BIT); | ||||
| // UI_view2d_view_ortho(v2d); | // UI_view2d_view_ortho(v2d); | ||||
| /* data... */ | /* data... */ | ||||
| draw_text_main(st, ar); | draw_text_main(st, ar, cursor_xy); | ||||
| /* reset view matrix */ | /* reset view matrix */ | ||||
| // UI_view2d_view_restore(C); | // UI_view2d_view_restore(C); | ||||
| /* scrollers? */ | /* scrollers? */ | ||||
| #ifdef WITH_IM_OVERTHESPOT | |||||
| if ((cursor_xy[0] != -1) && (CTX_wm_screen(C)->active_region == ar)) { | |||||
| UI_region_im_spot_set(CTX_wm_window(C), ar, cursor_xy[0], cursor_xy[1], st->lheight_dpi); | |||||
| } | |||||
| #endif | |||||
| } | } | ||||
| static void text_cursor(wmWindow *win, ScrArea *sa, ARegion *ar) | static void text_cursor(wmWindow *win, ScrArea *sa, ARegion *ar) | ||||
| { | { | ||||
| SpaceText *st = sa->spacedata.first; | SpaceText *st = sa->spacedata.first; | ||||
| int wmcursor = BC_TEXTEDITCURSOR; | int wmcursor = BC_TEXTEDITCURSOR; | ||||
| if (st->text && BLI_rcti_isect_pt(&st->txtbar, win->eventstate->x - ar->winrct.xmin, st->txtbar.ymin)) { | if (st->text && BLI_rcti_isect_pt(&st->txtbar, win->eventstate->x - ar->winrct.xmin, st->txtbar.ymin)) { | ||||
| ▲ Show 20 Lines • Show All 136 Lines • ▼ Show 20 Lines | void ED_spacetype_text(void) | ||||
| /* regions: main window */ | /* regions: main window */ | ||||
| art = MEM_callocN(sizeof(ARegionType), "spacetype text region"); | art = MEM_callocN(sizeof(ARegionType), "spacetype text region"); | ||||
| art->regionid = RGN_TYPE_WINDOW; | art->regionid = RGN_TYPE_WINDOW; | ||||
| art->init = text_main_region_init; | art->init = text_main_region_init; | ||||
| art->draw = text_main_region_draw; | art->draw = text_main_region_draw; | ||||
| art->cursor = text_cursor; | art->cursor = text_cursor; | ||||
| art->event_cursor = true; | art->event_cursor = true; | ||||
| #ifdef WITH_IM_OVERTHESPOT | |||||
| art->im_begin = ED_region_generic_im_begin; | |||||
| #endif | |||||
| BLI_addhead(&st->regiontypes, art); | BLI_addhead(&st->regiontypes, art); | ||||
| /* regions: properties */ | /* regions: properties */ | ||||
| art = MEM_callocN(sizeof(ARegionType), "spacetype text region"); | art = MEM_callocN(sizeof(ARegionType), "spacetype text region"); | ||||
| art->regionid = RGN_TYPE_UI; | art->regionid = RGN_TYPE_UI; | ||||
| art->prefsizex = UI_COMPACT_PANEL_WIDTH; | art->prefsizex = UI_COMPACT_PANEL_WIDTH; | ||||
| art->keymapflag = ED_KEYMAP_UI; | art->keymapflag = ED_KEYMAP_UI; | ||||
| Show All 25 Lines | |||||