Changeset View
Changeset View
Standalone View
Standalone View
source/blender/windowmanager/intern/wm_dragdrop.c
| Show First 20 Lines • Show All 265 Lines • ▼ Show 20 Lines | for (drag = wm->drags.first; drag; drag = drag->next) { | ||||
| wm_drop_operator_options(C, drag, event); | wm_drop_operator_options(C, drag, event); | ||||
| } | } | ||||
| } | } | ||||
| /* ************** draw ***************** */ | /* ************** draw ***************** */ | ||||
| static void wm_drop_operator_draw(const char *name, int x, int y) | static void wm_drop_operator_draw(const char *name, int x, int y) | ||||
| { | { | ||||
| int width = UI_GetStringWidth(name); | int width = UI_fontstyle_string_width(name); | ||||
| int padding = 4 * UI_DPI_FAC; | int padding = 4 * UI_DPI_FAC; | ||||
| glColor4ub(0, 0, 0, 50); | glColor4ub(0, 0, 0, 50); | ||||
| uiSetRoundBox(UI_CNR_ALL | UI_RB_ALPHA); | UI_draw_roundbox_corner_set(UI_CNR_ALL | UI_RB_ALPHA); | ||||
| uiRoundBox(x, y, x + width + 2 * padding, y + 4 * padding, padding); | UI_draw_roundbox(x, y, x + width + 2 * padding, y + 4 * padding, padding); | ||||
| glColor4ub(255, 255, 255, 255); | glColor4ub(255, 255, 255, 255); | ||||
| UI_DrawString(x + padding, y + padding, name); | UI_draw_string(x + padding, y + padding, name); | ||||
| } | } | ||||
| static const char *wm_drag_name(wmDrag *drag) | static const char *wm_drag_name(wmDrag *drag) | ||||
| { | { | ||||
| switch (drag->type) { | switch (drag->type) { | ||||
| case WM_DRAG_ID: | case WM_DRAG_ID: | ||||
| { | { | ||||
| ID *id = (ID *)drag->poin; | ID *id = (ID *)drag->poin; | ||||
| ▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | if (drag->imb) { | ||||
| y = cursory - drag->sy / 2 - iconsize; | y = cursory - drag->sy / 2 - iconsize; | ||||
| } | } | ||||
| else { | else { | ||||
| x = cursorx + 10 * UI_DPI_FAC; | x = cursorx + 10 * UI_DPI_FAC; | ||||
| y = cursory + 1 * UI_DPI_FAC; | y = cursory + 1 * UI_DPI_FAC; | ||||
| } | } | ||||
| if (rect) { | if (rect) { | ||||
| int w = UI_GetStringWidth(wm_drag_name(drag)); | int w = UI_fontstyle_string_width(wm_drag_name(drag)); | ||||
| drag_rect_minmax(rect, x, y, x + w, y + iconsize); | drag_rect_minmax(rect, x, y, x + w, y + iconsize); | ||||
| } | } | ||||
| else { | else { | ||||
| glColor4ub(255, 255, 255, 255); | glColor4ub(255, 255, 255, 255); | ||||
| UI_DrawString(x, y, wm_drag_name(drag)); | UI_draw_string(x, y, wm_drag_name(drag)); | ||||
| } | } | ||||
| /* operator name with roundbox */ | /* operator name with roundbox */ | ||||
| if (drag->opname[0]) { | if (drag->opname[0]) { | ||||
| if (drag->imb) { | if (drag->imb) { | ||||
| x = cursorx - drag->sx / 2; | x = cursorx - drag->sx / 2; | ||||
| if (cursory + drag->sy / 2 + padding + iconsize < winsize_y) | if (cursory + drag->sy / 2 + padding + iconsize < winsize_y) | ||||
| y = cursory + drag->sy / 2 + padding; | y = cursory + drag->sy / 2 + padding; | ||||
| else | else | ||||
| y = cursory - drag->sy / 2 - padding - iconsize - padding - iconsize; | y = cursory - drag->sy / 2 - padding - iconsize - padding - iconsize; | ||||
| } | } | ||||
| else { | else { | ||||
| x = cursorx - 2 * padding; | x = cursorx - 2 * padding; | ||||
| if (cursory + iconsize + iconsize < winsize_y) | if (cursory + iconsize + iconsize < winsize_y) | ||||
| y = cursory + iconsize; | y = cursory + iconsize; | ||||
| else | else | ||||
| y = cursory - iconsize - 2 * UI_DPI_FAC; | y = cursory - iconsize - 2 * UI_DPI_FAC; | ||||
| } | } | ||||
| if (rect) { | if (rect) { | ||||
| int w = UI_GetStringWidth(wm_drag_name(drag)); | int w = UI_fontstyle_string_width(wm_drag_name(drag)); | ||||
| drag_rect_minmax(rect, x, y, x + w, y + iconsize); | drag_rect_minmax(rect, x, y, x + w, y + iconsize); | ||||
| } | } | ||||
| else | else | ||||
| wm_drop_operator_draw(drag->opname, x, y); | wm_drop_operator_draw(drag->opname, x, y); | ||||
| } | } | ||||
| } | } | ||||
| glDisable(GL_BLEND); | glDisable(GL_BLEND); | ||||
| } | } | ||||