Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_text/space_text.c
| Show First 20 Lines • Show All 306 Lines • ▼ Show 20 Lines | if (st->text && BLI_rcti_isect_pt(&st->runtime.scroll_region_handle, | ||||
| wmcursor = WM_CURSOR_DEFAULT; | wmcursor = WM_CURSOR_DEFAULT; | ||||
| } | } | ||||
| WM_cursor_set(win, wmcursor); | WM_cursor_set(win, wmcursor); | ||||
| } | } | ||||
| /* ************* dropboxes ************* */ | /* ************* dropboxes ************* */ | ||||
| static bool text_drop_poll(bContext *UNUSED(C), | static bool text_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) | ||||
| wmDrag *drag, | |||||
| const wmEvent *UNUSED(event), | |||||
| const char **UNUSED(r_tooltip)) | |||||
| { | { | ||||
| if (drag->type == WM_DRAG_PATH) { | if (drag->type == WM_DRAG_PATH) { | ||||
| /* rule might not work? */ | /* rule might not work? */ | ||||
| if (ELEM(drag->icon, ICON_FILE_SCRIPT, ICON_FILE_TEXT, ICON_FILE_BLANK)) { | if (ELEM(drag->icon, ICON_FILE_SCRIPT, ICON_FILE_TEXT, ICON_FILE_BLANK)) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| } | } | ||||
| return false; | return false; | ||||
| } | } | ||||
| static void text_drop_copy(wmDrag *drag, wmDropBox *drop) | static void text_drop_copy(wmDrag *drag, wmDropBox *drop) | ||||
| { | { | ||||
| /* copy drag path to properties */ | /* copy drag path to properties */ | ||||
| RNA_string_set(drop->ptr, "filepath", drag->path); | RNA_string_set(drop->ptr, "filepath", drag->path); | ||||
| } | } | ||||
| static bool text_drop_paste_poll(bContext *UNUSED(C), | static bool text_drop_paste_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) | ||||
| wmDrag *drag, | |||||
| const wmEvent *UNUSED(event), | |||||
| const char **UNUSED(r_tooltip)) | |||||
| { | { | ||||
| return (drag->type == WM_DRAG_ID); | return (drag->type == WM_DRAG_ID); | ||||
| } | } | ||||
| static void text_drop_paste(wmDrag *drag, wmDropBox *drop) | static void text_drop_paste(wmDrag *drag, wmDropBox *drop) | ||||
| { | { | ||||
| char *text; | char *text; | ||||
| ID *id = WM_drag_get_local_ID(drag, 0); | ID *id = WM_drag_get_local_ID(drag, 0); | ||||
| /* copy drag path to properties */ | /* copy drag path to properties */ | ||||
| text = RNA_path_full_ID_py(G_MAIN, id); | text = RNA_path_full_ID_py(G_MAIN, id); | ||||
| RNA_string_set(drop->ptr, "text", text); | RNA_string_set(drop->ptr, "text", text); | ||||
| MEM_freeN(text); | MEM_freeN(text); | ||||
| } | } | ||||
| /* this region dropbox definition */ | /* this region dropbox definition */ | ||||
| static void text_dropboxes(void) | static void text_dropboxes(void) | ||||
| { | { | ||||
| ListBase *lb = WM_dropboxmap_find("Text", SPACE_TEXT, RGN_TYPE_WINDOW); | ListBase *lb = WM_dropboxmap_find("Text", SPACE_TEXT, RGN_TYPE_WINDOW); | ||||
| WM_dropbox_add(lb, "TEXT_OT_open", text_drop_poll, text_drop_copy, NULL); | WM_dropbox_add(lb, "TEXT_OT_open", text_drop_poll, text_drop_copy, NULL, NULL); | ||||
| WM_dropbox_add(lb, "TEXT_OT_insert", text_drop_paste_poll, text_drop_paste, NULL); | WM_dropbox_add(lb, "TEXT_OT_insert", text_drop_paste_poll, text_drop_paste, NULL, NULL); | ||||
| } | } | ||||
| /* ************* end drop *********** */ | /* ************* end drop *********** */ | ||||
| /****************** header region ******************/ | /****************** header region ******************/ | ||||
| /* add handlers, stuff you only do once or on area/region changes */ | /* add handlers, stuff you only do once or on area/region changes */ | ||||
| static void text_header_region_init(wmWindowManager *UNUSED(wm), ARegion *region) | static void text_header_region_init(wmWindowManager *UNUSED(wm), ARegion *region) | ||||
| ▲ Show 20 Lines • Show All 125 Lines • Show Last 20 Lines | |||||