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>2014-02-08 02:03:25 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-02-08 02:42:26 +0400
commit2dafd1bfb8294acd996607f2b31961f66b5a3587 (patch)
treee18dfcce4b6057ff0232dca3f91e6a117117f949 /source/blender/editors/interface/interface.c
parentb0c314af9fdbf70a2b77cf409f5d43ed25fbb6ae (diff)
UI: butstore API to generalize button storage for modal handlers
Diffstat (limited to 'source/blender/editors/interface/interface.c')
-rw-r--r--source/blender/editors/interface/interface.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index db2b804363c..40e3b15e191 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -525,7 +525,7 @@ static bool ui_but_equals_old(const uiBut *but, const uiBut *oldbut)
return true;
}
-static uiBut *ui_but_find_old(uiBlock *block_old, const uiBut *but_new)
+uiBut *ui_but_find_old(uiBlock *block_old, const uiBut *but_new)
{
uiBut *but_old;
for (but_old = block_old->buttons.first; but_old; but_old = but_old->next) {
@@ -535,6 +535,16 @@ static uiBut *ui_but_find_old(uiBlock *block_old, const uiBut *but_new)
}
return but_old;
}
+uiBut *ui_but_find_new(uiBlock *block_new, const uiBut *but_old)
+{
+ uiBut *but_new;
+ for (but_new = block_new->buttons.first; but_new; but_new = but_new->next) {
+ if (ui_but_equals_old(but_new, but_old)) {
+ break;
+ }
+ }
+ return but_new;
+}
/* oldbut is being inserted in new block, so we use the lines from new button, and replace button pointers */
static void ui_but_update_linklines(uiBlock *block, uiBut *oldbut, uiBut *newbut)
@@ -1020,6 +1030,11 @@ void uiEndBlock(const bContext *C, uiBlock *block)
uiBut *but;
Scene *scene = CTX_data_scene(C);
+
+ if (has_old && BLI_listbase_is_empty(&block->oldblock->butstore) == false) {
+ UI_butstore_update(block);
+ }
+
/* inherit flags from 'old' buttons that was drawn here previous, based
* on matching buttons, we need this to make button event handling non
* blocking, while still allowing buttons to be remade each redraw as it
@@ -2228,6 +2243,8 @@ static void ui_free_but(const bContext *C, uiBut *but)
IMB_freeImBuf((struct ImBuf *)but->poin);
}
+ BLI_assert(UI_butstore_is_registered(but->block, but) == false);
+
MEM_freeN(but);
}
@@ -2236,6 +2253,8 @@ void uiFreeBlock(const bContext *C, uiBlock *block)
{
uiBut *but;
+ UI_butstore_clear(block);
+
while ((but = BLI_pophead(&block->buttons))) {
ui_free_but(C, but);
}