Cleanup: remove unused WM_DRAG_VALUE

This commit is contained in:
Campbell Barton
2024-02-16 14:26:56 +11:00
parent 23a8ba3cd3
commit eafecb2bc3
9 changed files with 9 additions and 25 deletions

View File

@@ -1875,10 +1875,6 @@ void UI_but_drag_set_rna(uiBut *but, PointerRNA *ptr);
*/
void UI_but_drag_set_path(uiBut *but, const char *path);
void UI_but_drag_set_name(uiBut *but, const char *name);
/**
* Value from button itself.
*/
void UI_but_drag_set_value(uiBut *but);
/**
* Sets #UI_BUT_DRAG_FULL_BUT so the full button can be dragged.

View File

@@ -78,11 +78,6 @@ void UI_but_drag_set_name(uiBut *but, const char *name)
but->dragpoin = (void *)name;
}
void UI_but_drag_set_value(uiBut *but)
{
but->dragtype = WM_DRAG_VALUE;
}
void UI_but_drag_set_image(uiBut *but, const char *path, int icon, const ImBuf *imb, float scale)
{
ui_def_but_icon(but, icon, 0); /* no flag UI_HAS_ICON, so icon doesn't draw in button */
@@ -108,7 +103,6 @@ void ui_but_drag_start(bContext *C, uiBut *but)
but->icon,
but->dragtype,
but->dragpoin,
ui_but_value_get(but),
(but->dragflag & UI_BUT_DRAGPOIN_FREE) ? WM_DRAG_FREE_DATA :
WM_DRAG_NOP);
/* wmDrag has ownership over dragpoin now, stop messing with it. */
@@ -123,6 +117,6 @@ void ui_but_drag_start(bContext *C, uiBut *but)
/* Special feature for assets: We add another drag item that supports multiple assets. It
* gets the assets from context. */
if (ELEM(but->dragtype, WM_DRAG_ASSET, WM_DRAG_ID)) {
WM_event_start_drag(C, ICON_NONE, WM_DRAG_ASSET_LIST, nullptr, 0, WM_DRAG_NOP);
WM_event_start_drag(C, ICON_NONE, WM_DRAG_ASSET_LIST, nullptr, WM_DRAG_NOP);
}
}

View File

@@ -2171,7 +2171,7 @@ static bool ui_but_drag_init(bContext *C,
}
if (valid) {
WM_event_start_drag(C, ICON_COLOR, WM_DRAG_COLOR, drag_info, 0.0, WM_DRAG_FREE_DATA);
WM_event_start_drag(C, ICON_COLOR, WM_DRAG_COLOR, drag_info, WM_DRAG_FREE_DATA);
}
else {
MEM_freeN(drag_info);

View File

@@ -381,7 +381,6 @@ class ViewItemAPIWrapper {
ICON_NONE,
drag_controller->get_drag_type(),
drag_controller->create_drag_data(),
0,
WM_DRAG_FREE_DATA);
drag_controller->on_drag_start();

View File

@@ -1453,7 +1453,7 @@ static int outliner_item_drag_drop_invoke(bContext *C, wmOperator * /*op*/, cons
TSE_GPENCIL_EFFECT_BASE);
const eWM_DragDataType wm_drag_type = use_datastack_drag ? WM_DRAG_DATASTACK : WM_DRAG_ID;
wmDrag *drag = WM_drag_data_create(C, data.icon, wm_drag_type, nullptr, 0.0, WM_DRAG_NOP);
wmDrag *drag = WM_drag_data_create(C, data.icon, wm_drag_type, nullptr, WM_DRAG_NOP);
if (use_datastack_drag) {
TreeElement *te_bone = nullptr;

View File

@@ -1373,7 +1373,7 @@ int WM_operator_flag_only_pass_through_on_press(int retval, const wmEvent *event
* Note that \a poin should be valid allocated and not on stack.
*/
void WM_event_start_drag(
bContext *C, int icon, eWM_DragDataType type, void *poin, double value, unsigned int flags);
bContext *C, int icon, eWM_DragDataType type, void *poin, unsigned int flags);
/**
* Create and fill the dragging data, but don't start dragging just yet (unlike
* #WM_event_start_drag()). Must be followed up by #WM_event_start_prepared_drag(), otherwise the
@@ -1382,7 +1382,7 @@ void WM_event_start_drag(
* Note that \a poin should be valid allocated and not on stack.
*/
wmDrag *WM_drag_data_create(
bContext *C, int icon, eWM_DragDataType type, void *poin, double value, unsigned int flags);
bContext *C, int icon, eWM_DragDataType type, void *poin, unsigned int flags);
/**
* Invoke dragging using the given \a drag data.
*/

View File

@@ -1143,7 +1143,6 @@ enum eWM_DragDataType {
WM_DRAG_RNA,
WM_DRAG_PATH,
WM_DRAG_NAME,
WM_DRAG_VALUE,
WM_DRAG_COLOR,
WM_DRAG_DATASTACK,
WM_DRAG_ASSET_CATALOG,
@@ -1255,7 +1254,6 @@ struct wmDrag {
int icon;
eWM_DragDataType type;
void *poin;
double value;
/** If no icon but imbuf should be drawn around cursor. */
const ImBuf *imb;

View File

@@ -258,8 +258,7 @@ static void wm_dropbox_invoke(bContext *C, wmDrag *drag)
}
}
wmDrag *WM_drag_data_create(
bContext *C, int icon, eWM_DragDataType type, void *poin, double value, uint flags)
wmDrag *WM_drag_data_create(bContext *C, int icon, eWM_DragDataType type, void *poin, uint flags)
{
wmDrag *drag = MEM_new<wmDrag>(__func__);
@@ -302,7 +301,6 @@ wmDrag *WM_drag_data_create(
drag->poin = poin;
break;
}
drag->value = value;
return drag;
}
@@ -315,10 +313,9 @@ void WM_event_start_prepared_drag(bContext *C, wmDrag *drag)
wm_dropbox_invoke(C, drag);
}
void WM_event_start_drag(
bContext *C, int icon, eWM_DragDataType type, void *poin, double value, uint flags)
void WM_event_start_drag(bContext *C, int icon, eWM_DragDataType type, void *poin, uint flags)
{
wmDrag *drag = WM_drag_data_create(C, icon, type, poin, value, flags);
wmDrag *drag = WM_drag_data_create(C, icon, type, poin, flags);
WM_event_start_prepared_drag(C, drag);
}

View File

@@ -1663,7 +1663,7 @@ static bool ghost_event_proc(GHOST_EventHandle ghost_event, GHOST_TUserDataPtr C
int icon = ED_file_extension_icon((char *)stra->strings[0]);
wmDragPath *path_data = WM_drag_create_path_data(
blender::Span((char **)stra->strings, stra->count));
WM_event_start_drag(C, icon, WM_DRAG_PATH, path_data, 0.0, WM_DRAG_NOP);
WM_event_start_drag(C, icon, WM_DRAG_PATH, path_data, WM_DRAG_NOP);
/* Void pointer should point to string, it makes a copy. */
}
}