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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-01-30 15:18:08 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-01-30 15:18:08 +0300
commit8036342ea8c20ede363d5d3fe5459cc2af58a0f6 (patch)
tree1579a7a80e7d63fa655ebb4c0058b413d30b9c7e /source/blender/editors/space_node
parent445bbdf75d94dbe4db25e9a81f6fed47c59acb5a (diff)
2.5: UI & Menus
* Cleaned up UI_interface.h a bit, and added some comments to organize things a bit and indicate what should be used when. * uiMenu* functions can now be used to create menus for headers too, this is done with a uiDefMenuBut, which takes a pointer to a uiMenuCreateFunc, that will then call uiMenu* functions. * Renamed uiMenuBegin/End to uiPupMenuBegin/End, as these are specific to making popup menus. Will convert the other conformation popup menu functions to use this too so we can remove some code. * Extended uiMenu functions, now there is is also: BooleanO, FloatO, BooleanR, EnumR, LevelEnumR, Separator. * Converted image window headers to use uiMenu functions, simplifies menu code further here. Did not remove the uiDefMenu functions as they are used in sequencer/view3d in some places now (will fix). * Also tried to simplify and fix bounds computation a bit better for popup menus. It tried to find out in advance what the size of the menu was but this is difficult with keymap strings in there, now uiPopupBoundsBlock can figure this out afterwards and ensure the popup is within the window bounds. Will convert some other functions to use this too.
Diffstat (limited to 'source/blender/editors/space_node')
-rw-r--r--source/blender/editors/space_node/node_draw.c4
-rw-r--r--source/blender/editors/space_node/node_header.c64
2 files changed, 34 insertions, 34 deletions
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index 30b4bf86b68..06c4b6bacd1 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -503,7 +503,7 @@ static void socket_vector_menu_cb(bContext *C, void *node_v, void *ntree_v)
}
/* NOTE: this is a block-menu, needs 0 events, otherwise the menu closes */
-static uiBlock *socket_vector_menu(bContext *C, uiMenuBlockHandle *handle, void *socket_v)
+static uiBlock *socket_vector_menu(bContext *C, ARegion *ar, void *socket_v)
{
SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C);
ScrArea *sa= CTX_wm_area(C);
@@ -523,7 +523,7 @@ static uiBlock *socket_vector_menu(bContext *C, uiMenuBlockHandle *handle, void
break;
}
- block= uiBeginBlock(C, handle->region, "socket menu", UI_EMBOSS, UI_HELV);
+ block= uiBeginBlock(C, ar, "socket menu", UI_EMBOSS, UI_HELV);
/* use this for a fake extra empy space around the buttons */
uiDefBut(block, LABEL, 0, "", -4, -4, 188, 68, NULL, 0, 0, 0, 0, "");
diff --git a/source/blender/editors/space_node/node_header.c b/source/blender/editors/space_node/node_header.c
index 8655a7aeac9..451e9631f87 100644
--- a/source/blender/editors/space_node/node_header.c
+++ b/source/blender/editors/space_node/node_header.c
@@ -91,13 +91,13 @@ static void do_node_selectmenu(bContext *C, void *arg, int event)
ED_area_tag_redraw(curarea);
}
-static uiBlock *node_selectmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_selectmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "node_selectmenu",
+ block= uiBeginBlock(C, ar, "node_selectmenu",
UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_selectmenu, NULL);
@@ -218,11 +218,11 @@ static void node_make_addmenu(bContext *C, int nodeclass, uiBlock *block)
}
}
-static uiBlock *node_add_inputmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_add_inputmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
- block= uiBeginBlock(C, handle->region, "node_add_inputmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_add_inputmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_addmenu, NULL);
node_make_addmenu(C, NODE_CLASS_INPUT, block);
@@ -233,11 +233,11 @@ static uiBlock *node_add_inputmenu(bContext *C, uiMenuBlockHandle *handle, void
return block;
}
-static uiBlock *node_add_outputmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_add_outputmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
- block= uiBeginBlock(C, handle->region, "node_add_outputmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_add_outputmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_addmenu, NULL);
node_make_addmenu(C, NODE_CLASS_OUTPUT, block);
@@ -248,11 +248,11 @@ static uiBlock *node_add_outputmenu(bContext *C, uiMenuBlockHandle *handle, void
return block;
}
-static uiBlock *node_add_colormenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_add_colormenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
- block= uiBeginBlock(C, handle->region, "node_add_colormenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_add_colormenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_addmenu, NULL);
node_make_addmenu(C, NODE_CLASS_OP_COLOR, block);
@@ -263,11 +263,11 @@ static uiBlock *node_add_colormenu(bContext *C, uiMenuBlockHandle *handle, void
return block;
}
-static uiBlock *node_add_vectormenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_add_vectormenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
- block= uiBeginBlock(C, handle->region, "node_add_vectormenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_add_vectormenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_addmenu, NULL);
node_make_addmenu(C, NODE_CLASS_OP_VECTOR, block);
@@ -278,11 +278,11 @@ static uiBlock *node_add_vectormenu(bContext *C, uiMenuBlockHandle *handle, void
return block;
}
-static uiBlock *node_add_filtermenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_add_filtermenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
- block= uiBeginBlock(C, handle->region, "node_add_filtermenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_add_filtermenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_addmenu, NULL);
node_make_addmenu(C, NODE_CLASS_OP_FILTER, block);
@@ -293,11 +293,11 @@ static uiBlock *node_add_filtermenu(bContext *C, uiMenuBlockHandle *handle, void
return block;
}
-static uiBlock *node_add_convertermenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_add_convertermenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
- block= uiBeginBlock(C, handle->region, "node_add_convertermenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_add_convertermenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_addmenu, NULL);
node_make_addmenu(C, NODE_CLASS_CONVERTOR, block);
@@ -308,11 +308,11 @@ static uiBlock *node_add_convertermenu(bContext *C, uiMenuBlockHandle *handle, v
return block;
}
-static uiBlock *node_add_mattemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_add_mattemenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
- block= uiBeginBlock(C, handle->region, "node_add_mattemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_add_mattemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_addmenu, NULL);
node_make_addmenu(C, NODE_CLASS_MATTE, block);
@@ -323,11 +323,11 @@ static uiBlock *node_add_mattemenu(bContext *C, uiMenuBlockHandle *handle, void
return block;
}
-static uiBlock *node_add_distortmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_add_distortmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
- block= uiBeginBlock(C, handle->region, "node_add_distortmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_add_distortmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_addmenu, NULL);
node_make_addmenu(C, NODE_CLASS_DISTORT, block);
@@ -338,11 +338,11 @@ static uiBlock *node_add_distortmenu(bContext *C, uiMenuBlockHandle *handle, voi
return block;
}
-static uiBlock *node_add_patternmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_add_patternmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
- block= uiBeginBlock(C, handle->region, "node_add_patternmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_add_patternmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_addmenu, NULL);
node_make_addmenu(C, NODE_CLASS_PATTERN, block);
@@ -353,11 +353,11 @@ static uiBlock *node_add_patternmenu(bContext *C, uiMenuBlockHandle *handle, vo
return block;
}
-static uiBlock *node_add_texturemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_add_texturemenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
- block= uiBeginBlock(C, handle->region, "node_add_texturemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_add_texturemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_addmenu, NULL);
node_make_addmenu(C, NODE_CLASS_TEXTURE, block);
@@ -368,11 +368,11 @@ static uiBlock *node_add_texturemenu(bContext *C, uiMenuBlockHandle *handle, voi
return block;
}
-static uiBlock *node_add_groupmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_add_groupmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
- block= uiBeginBlock(C, handle->region, "node_add_groupmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_add_groupmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_addmenu, NULL);
node_make_addmenu(C, NODE_CLASS_GROUP, block);
@@ -384,11 +384,11 @@ static uiBlock *node_add_groupmenu(bContext *C, uiMenuBlockHandle *handle, void
return block;
}
-static uiBlock *node_add_dynamicmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_add_dynamicmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
- block= uiBeginBlock(C, handle->region, "node_add_dynamicmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_add_dynamicmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_addmenu, NULL);
node_make_addmenu(C, NODE_CLASS_OP_DYNAMIC, block);
@@ -400,14 +400,14 @@ static uiBlock *node_add_dynamicmenu(bContext *C, uiMenuBlockHandle *handle, voi
return block;
}
-static uiBlock *node_addmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_addmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "node_addmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_addmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_addmenu, NULL);
if(snode->treetype==NTREE_SHADER) {
@@ -521,14 +521,14 @@ static void do_node_nodemenu(bContext *C, void *arg, int event)
ED_area_tag_redraw(curarea);
}
-static uiBlock *node_nodemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_nodemenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "node_nodemenu",
+ block= uiBeginBlock(C, ar, "node_nodemenu",
UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_nodemenu, NULL);
@@ -606,14 +606,14 @@ static void do_node_viewmenu(bContext *C, void *arg, int event)
ED_area_tag_redraw(sa);
}
-static uiBlock *node_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "node_viewmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_viewmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_viewmenu, NULL);
if (snode->nodetree) {