From 025bac45705e2f45d3b797948e47b8c99a18aa1d Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 27 Aug 2013 18:56:04 +0000 Subject: Small enhancement to grab-resize of uiLists, suggested by plasmasolutions: do not effectively apply auto-size until we stop grabbing, avoid size of uiLists to switch between rows and maxrows while dragging. --- source/blender/editors/interface/interface_handlers.c | 3 +++ source/blender/editors/interface/interface_templates.c | 11 +++++++++-- source/blender/makesdna/DNA_screen_types.h | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index c0c8367eb8c..cad9f6707d5 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -3424,10 +3424,12 @@ static int ui_do_but_LISTBOX(bContext *C, uiBlock *block, uiBut *but, uiHandleBu data->escapecancel = true; *size = (int)data->origvalue; button_activate_state(C, but, BUTTON_STATE_EXIT); + ui_list->flag &= ~UILST_RESIZING; ED_region_tag_redraw(data->region); } else if (event->type == LEFTMOUSE && event->val != KM_PRESS) { button_activate_state(C, but, BUTTON_STATE_EXIT); + ui_list->flag &= ~UILST_RESIZING; ED_region_tag_redraw(data->region); } else if (event->type == MOUSEMOVE) { @@ -6552,6 +6554,7 @@ static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *ar) /* Again, have to override values set by ui_numedit_begin, because our listbox button also has a rnapoin... */ *size = data->origvalue = (double)dyn_data->visual_height; + ui_list->flag |= UILST_RESIZING; retval = WM_UI_HANDLER_BREAK; } diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 5ffb47c4df0..2098d881d4e 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -2517,10 +2517,17 @@ static void prepare_list(uiList *ui_list, int len, int activei, int rows, int ma maxrows = 5; if (columns == 0) columns = 9; - if (ui_list->list_grip >= rows) + + if (ui_list->list_grip >= rows) { maxrows = rows = ui_list->list_grip; - else + } + else { ui_list->list_grip = 0; /* Reset to auto-size mode. */ + /* Prevent auto-size mode to take effect while grab-resizing! */ + if (ui_list->flag & UILST_RESIZING) { + maxrows = rows; + } + } if (columns > 1) { dyn_data->height = (int)ceil((double)len / (double)columns); diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h index c15deaeb137..8e18a84060a 100644 --- a/source/blender/makesdna/DNA_screen_types.h +++ b/source/blender/makesdna/DNA_screen_types.h @@ -256,6 +256,7 @@ enum { /* uiList flag */ enum { UILST_SCROLL_TO_ACTIVE_ITEM = 1 << 0, /* Scroll list to make active item visible. */ + UILST_RESIZING = 1 << 1, /* We are currently resizing, deactivate autosize! */ }; /* regiontype, first two are the default set */ -- cgit v1.2.3