Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_console/space_console.c
| Show First 20 Lines • Show All 152 Lines • ▼ Show 20 Lines | if (UI_view2d_mouse_in_scrollers(region, ®ion->v2d, event->x, event->y)) { | ||||
| wmcursor = WM_CURSOR_DEFAULT; | wmcursor = WM_CURSOR_DEFAULT; | ||||
| } | } | ||||
| WM_cursor_set(win, wmcursor); | WM_cursor_set(win, wmcursor); | ||||
| } | } | ||||
| /* ************* dropboxes ************* */ | /* ************* dropboxes ************* */ | ||||
| static bool id_drop_poll(bContext *UNUSED(C), | static bool id_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) | ||||
| wmDrag *drag, | |||||
| const wmEvent *UNUSED(event), | |||||
| const char **UNUSED(tooltip)) | |||||
| { | { | ||||
| return WM_drag_get_local_ID(drag, 0) != NULL; | return WM_drag_get_local_ID(drag, 0) != NULL; | ||||
| } | } | ||||
| static void id_drop_copy(wmDrag *drag, wmDropBox *drop) | static void id_drop_copy(wmDrag *drag, wmDropBox *drop) | ||||
| { | { | ||||
| 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 */ | ||||
| char *text = RNA_path_full_ID_py(G_MAIN, id); | char *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); | ||||
| } | } | ||||
| static bool path_drop_poll(bContext *UNUSED(C), | static bool path_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) | ||||
| wmDrag *drag, | |||||
| const wmEvent *UNUSED(event), | |||||
| const char **UNUSED(tooltip)) | |||||
| { | { | ||||
| return (drag->type == WM_DRAG_PATH); | return (drag->type == WM_DRAG_PATH); | ||||
| } | } | ||||
| static void path_drop_copy(wmDrag *drag, wmDropBox *drop) | static void path_drop_copy(wmDrag *drag, wmDropBox *drop) | ||||
| { | { | ||||
| char pathname[FILE_MAX + 2]; | char pathname[FILE_MAX + 2]; | ||||
| BLI_snprintf(pathname, sizeof(pathname), "\"%s\"", drag->path); | BLI_snprintf(pathname, sizeof(pathname), "\"%s\"", drag->path); | ||||
| RNA_string_set(drop->ptr, "text", pathname); | RNA_string_set(drop->ptr, "text", pathname); | ||||
| } | } | ||||
| /* this region dropbox definition */ | /* this region dropbox definition */ | ||||
| static void console_dropboxes(void) | static void console_dropboxes(void) | ||||
| { | { | ||||
| ListBase *lb = WM_dropboxmap_find("Console", SPACE_CONSOLE, RGN_TYPE_WINDOW); | ListBase *lb = WM_dropboxmap_find("Console", SPACE_CONSOLE, RGN_TYPE_WINDOW); | ||||
| WM_dropbox_add(lb, "CONSOLE_OT_insert", id_drop_poll, id_drop_copy, NULL); | WM_dropbox_add(lb, "CONSOLE_OT_insert", id_drop_poll, id_drop_copy, NULL, NULL); | ||||
| WM_dropbox_add(lb, "CONSOLE_OT_insert", path_drop_poll, path_drop_copy, NULL); | WM_dropbox_add(lb, "CONSOLE_OT_insert", path_drop_poll, path_drop_copy, NULL, NULL); | ||||
| } | } | ||||
| /* ************* end drop *********** */ | /* ************* end drop *********** */ | ||||
| static void console_main_region_draw(const bContext *C, ARegion *region) | static void console_main_region_draw(const bContext *C, ARegion *region) | ||||
| { | { | ||||
| /* draw entirely, view changes should be handled here */ | /* draw entirely, view changes should be handled here */ | ||||
| SpaceConsole *sc = CTX_wm_space_console(C); | SpaceConsole *sc = CTX_wm_space_console(C); | ||||
| ▲ Show 20 Lines • Show All 136 Lines • Show Last 20 Lines | |||||