Changeset View
Changeset View
Standalone View
Standalone View
source/blender/windowmanager/intern/wm_dragdrop.c
| Show First 20 Lines • Show All 198 Lines • ▼ Show 20 Lines | static const char *dropbox_active(bContext *C, | ||||
| ListBase *handlers, | ListBase *handlers, | ||||
| wmDrag *drag, | wmDrag *drag, | ||||
| const wmEvent *event) | const wmEvent *event) | ||||
| { | { | ||||
| LISTBASE_FOREACH (wmEventHandler *, handler_base, handlers) { | LISTBASE_FOREACH (wmEventHandler *, handler_base, handlers) { | ||||
| if (handler_base->type == WM_HANDLER_TYPE_DROPBOX) { | if (handler_base->type == WM_HANDLER_TYPE_DROPBOX) { | ||||
| wmEventHandler_Dropbox *handler = (wmEventHandler_Dropbox *)handler_base; | wmEventHandler_Dropbox *handler = (wmEventHandler_Dropbox *)handler_base; | ||||
| if (handler->dropboxes) { | if (handler->dropboxes) { | ||||
| for (wmDropBox *drop = handler->dropboxes->first; drop; drop = drop->next) { | LISTBASE_FOREACH (wmDropBox *, drop, handler->dropboxes) { | ||||
| const char *tooltip = NULL; | const char *tooltip = NULL; | ||||
| if (drop->poll(C, drag, event, &tooltip)) { | if (drop->poll(C, drag, event, &tooltip)) { | ||||
| /* XXX Doing translation here might not be ideal, but later we have no more | /* XXX Doing translation here might not be ideal, but later we have no more | ||||
| * access to ot (and hence op context)... */ | * access to ot (and hence op context)... */ | ||||
| return (tooltip) ? tooltip : WM_operatortype_name(drop->ot, drop->ptr); | return (tooltip) ? tooltip : WM_operatortype_name(drop->ot, drop->ptr); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | void wm_drags_check_ops(bContext *C, const wmEvent *event) | ||||
| } | } | ||||
| } | } | ||||
| /* ************** IDs ***************** */ | /* ************** IDs ***************** */ | ||||
| void WM_drag_add_ID(wmDrag *drag, ID *id, ID *from_parent) | void WM_drag_add_ID(wmDrag *drag, ID *id, ID *from_parent) | ||||
| { | { | ||||
| /* Don't drag the same ID twice. */ | /* Don't drag the same ID twice. */ | ||||
| for (wmDragID *drag_id = drag->ids.first; drag_id; drag_id = drag_id->next) { | LISTBASE_FOREACH (wmDragID *, drag_id, &drag->ids) { | ||||
| if (drag_id->id == id) { | if (drag_id->id == id) { | ||||
| if (drag_id->from_parent == NULL) { | if (drag_id->from_parent == NULL) { | ||||
| drag_id->from_parent = from_parent; | drag_id->from_parent = from_parent; | ||||
| } | } | ||||
| return; | return; | ||||
| } | } | ||||
| else if (GS(drag_id->id->name) != GS(id->name)) { | else if (GS(drag_id->id->name) != GS(id->name)) { | ||||
| BLI_assert(!"All dragged IDs must have the same type"); | BLI_assert(!"All dragged IDs must have the same type"); | ||||
| ▲ Show 20 Lines • Show All 200 Lines • Show Last 20 Lines | |||||