Revert "[1/4] UI Experiment: Hover Increment/Decrement More Button Types"
This reverts commit 5b2fe07f64.
This commti with this patch applied by accident.
This commit is contained in:
@@ -4908,48 +4908,6 @@ static int ui_do_but_TEX(
|
||||
return WM_UI_HANDLER_BREAK;
|
||||
}
|
||||
}
|
||||
else if (ELEM(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE) && (event->modifier & KM_CTRL) &&
|
||||
!but->drawstr.empty())
|
||||
{
|
||||
/* Retrieve the string. */
|
||||
char *but_string;
|
||||
int str_len = ui_but_string_get_maxncpy(but);
|
||||
bool no_zero_strip = false;
|
||||
if (str_len != 0) {
|
||||
but_string = MEM_calloc_arrayN<char>(str_len, __func__);
|
||||
ui_but_string_get_ex(
|
||||
but, but_string, str_len, UI_PRECISION_FLOAT_MAX, true, &no_zero_strip);
|
||||
}
|
||||
else {
|
||||
but_string = ui_but_string_get_dynamic(but, &str_len);
|
||||
}
|
||||
|
||||
/* More space for an added digit. */
|
||||
str_len += 2;
|
||||
char *head = (char *)MEM_callocN(sizeof(char) * str_len, __func__);
|
||||
char *tail = (char *)MEM_callocN(sizeof(char) * str_len, __func__);
|
||||
ushort digits;
|
||||
|
||||
/* Decode the string, parsing head, digits, tail. */
|
||||
int num = BLI_path_sequence_decode(but_string, head, str_len, tail, str_len, &digits);
|
||||
MEM_freeN(but_string);
|
||||
if (num == 0 && digits == 0) {
|
||||
BLI_str_rstrip_digits(head);
|
||||
}
|
||||
|
||||
/* Increase or decrease the value. */
|
||||
num += (event->type == WHEELUPMOUSE) ? 1 : -1;
|
||||
|
||||
/* Encode the new string with the changed value. */
|
||||
char *string = (char *)MEM_callocN(sizeof(char) * str_len, __func__);
|
||||
BLI_path_sequence_encode(string, str_len, head, tail, digits, num);
|
||||
ui_but_set_string_interactive(C, but, string);
|
||||
MEM_freeN(string);
|
||||
MEM_freeN(head);
|
||||
MEM_freeN(tail);
|
||||
|
||||
return WM_UI_HANDLER_BREAK;
|
||||
}
|
||||
}
|
||||
else if (data->state == BUTTON_STATE_TEXT_EDITING) {
|
||||
return ui_do_but_textedit(C, block, but, data, event);
|
||||
@@ -5008,21 +4966,8 @@ static int ui_do_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data, cons
|
||||
return WM_UI_HANDLER_BREAK;
|
||||
}
|
||||
if (ELEM(event->type, MOUSEPAN, WHEELDOWNMOUSE, WHEELUPMOUSE) && (event->modifier & KM_CTRL)) {
|
||||
if (ELEM(but->type,
|
||||
UI_BTYPE_TOGGLE,
|
||||
UI_BTYPE_TOGGLE_N,
|
||||
UI_BTYPE_ICON_TOGGLE,
|
||||
UI_BTYPE_ICON_TOGGLE_N,
|
||||
UI_BTYPE_BUT_TOGGLE,
|
||||
UI_BTYPE_CHECKBOX,
|
||||
UI_BTYPE_CHECKBOX_N))
|
||||
{
|
||||
/* Support Ctrl-Wheel to cycle toggles and checkboxes. */
|
||||
button_activate_state(C, but, BUTTON_STATE_EXIT);
|
||||
return WM_UI_HANDLER_BREAK;
|
||||
}
|
||||
else if (but->type == UI_BTYPE_ROW) {
|
||||
/* Support Ctrl-Wheel to cycle values on expanded enum rows. */
|
||||
/* Support Ctrl-Wheel to cycle values on expanded enum rows. */
|
||||
if (but->type == UI_BTYPE_ROW) {
|
||||
int type = event->type;
|
||||
int val = event->val;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user