Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-07-10 03:40:53 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-07-10 03:40:53 +0400
commita3643ee3d67a823b328b60a0cf08b335be0e147c (patch)
tree47411ae4c0fe7dfc50913cccb7f5c007927a8a05
parent795034c17d76bef2a15e576ac9c70ae2268a823b (diff)
fix [#36073] Changing list items misses undo push
-rw-r--r--source/blender/editors/include/UI_interface.h4
-rw-r--r--source/blender/editors/interface/interface.c2
-rw-r--r--source/blender/editors/interface/interface_handlers.c16
-rw-r--r--source/blender/editors/interface/interface_layout.c5
-rw-r--r--source/blender/editors/interface/interface_templates.c4
5 files changed, 21 insertions, 10 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index b566fd360b6..e5cc0dd8ea7 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -236,6 +236,8 @@ typedef enum {
BUT_NORMAL = (31 << 9),
BUT_CURVE = (32 << 9),
ICONTOGN = (34 << 9),
+ LISTBOX = (35 << 9),
+ LISTROW = (36 << 9),
TOGBUT = (37 << 9),
OPTION = (38 << 9),
OPTIONN = (39 << 9),
@@ -244,8 +246,6 @@ typedef enum {
SEARCH_MENU = (41 << 9),
BUT_EXTRA = (42 << 9),
HSVCIRCLE = (43 << 9),
- LISTBOX = (44 << 9),
- LISTROW = (45 << 9),
HOTKEYEVT = (46 << 9),
BUT_IMAGE = (47 << 9),
HISTOGRAM = (48 << 9),
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index c3bc87ac647..898e653d562 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -2861,7 +2861,7 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
}
/* keep track of UI_interface.h */
- if (ELEM9(but->type, BLOCK, BUT, LABEL, PULLDOWN, ROUNDBOX, LISTBOX, BUTM, SCROLL, SEPR /* , FTPREVIEW */)) {}
+ if (ELEM8(but->type, BLOCK, BUT, LABEL, PULLDOWN, ROUNDBOX, BUTM, SCROLL, SEPR)) {}
else if (but->type >= SEARCH_MENU) {}
else but->flag |= UI_BUT_UNDO;
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 8782076798e..c0a05953156 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -6419,7 +6419,6 @@ static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *ar)
{
uiBut *but = ui_list_find_mouse_over(ar, event->x, event->y);
int retval = WM_UI_HANDLER_CONTINUE;
- int value, min, max;
int type = event->type, val = event->val;
if (but) {
@@ -6442,8 +6441,11 @@ static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *ar)
if (ELEM(type, UPARROWKEY, DOWNARROWKEY) ||
((ELEM(type, WHEELUPMOUSE, WHEELDOWNMOUSE) && event->alt)))
{
+ const int value_orig = RNA_property_int_get(&but->rnapoin, but->rnaprop);
+ int value, min, max;
+
/* activate up/down the list */
- value = RNA_property_int_get(&but->rnapoin, but->rnaprop);
+ value = value_orig;
if (ELEM(type, UPARROWKEY, WHEELUPMOUSE))
value--;
@@ -6460,9 +6462,13 @@ static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *ar)
RNA_property_int_range(&but->rnapoin, but->rnaprop, &min, &max);
value = CLAMPIS(value, min, max);
- RNA_property_int_set(&but->rnapoin, but->rnaprop, value);
- RNA_property_update(C, &but->rnapoin, but->rnaprop);
- ED_region_tag_redraw(ar);
+ if (value != value_orig) {
+ RNA_property_int_set(&but->rnapoin, but->rnaprop, value);
+ RNA_property_update(C, &but->rnapoin, but->rnaprop);
+
+ ui_apply_undo(but);
+ ED_region_tag_redraw(ar);
+ }
retval = WM_UI_HANDLER_BREAK;
}
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 2a6a9600582..461d0b24d57 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -2429,6 +2429,11 @@ uiLayout *uiLayoutListBox(uiLayout *layout, uiList *ui_list, PointerRNA *ptr, Pr
but->rnapoin = *actptr;
but->rnaprop = actprop;
+ /* only for the undo string */
+ if (but->flag & UI_BUT_UNDO) {
+ but->tip = RNA_property_description(actprop);
+ }
+
return (uiLayout *)box;
}
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index e061ff35025..910d284e86b 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -2646,7 +2646,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co
sub = uiLayoutRow(overlap, FALSE);
but = uiDefButR_prop(subblock, LISTROW, 0, "", 0, 0, UI_UNIT_X * 10, UI_UNIT_Y,
- active_dataptr, activeprop, 0, 0, i, 0, 0, "");
+ active_dataptr, activeprop, 0, 0, i, 0, 0, NULL);
uiButSetFlag(but, UI_BUT_NO_TOOLTIP);
sub = uiLayoutRow(overlap, FALSE);
@@ -2734,7 +2734,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co
sub = uiLayoutRow(overlap, FALSE);
but = uiDefButR_prop(subblock, LISTROW, 0, "", 0, 0, UI_UNIT_X * 10, UI_UNIT_Y,
- active_dataptr, activeprop, 0, 0, i, 0, 0, "");
+ active_dataptr, activeprop, 0, 0, i, 0, 0, NULL);
uiButSetFlag(but, UI_BUT_NO_TOOLTIP);
sub = uiLayoutRow(overlap, FALSE);