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:
authorTon Roosendaal <ton@blender.org>2003-10-25 04:08:12 +0400
committerTon Roosendaal <ton@blender.org>2003-10-25 04:08:12 +0400
commit513ae61f2beda17faced737c0b9eae45a0548e18 (patch)
treec1a9fea194c88950c14fa9d16ccac7649fd5d89f /source/blender
parent5f26e16c51819f6fb6cfed705fce8f667e1b667c (diff)
First commit of a new toolbox system.
Aim was to find a simple & easy system, script alike, to add and configure a toolbox system, so that others can experiment, but also of course Python. Summary: - spacebar calls it up. SHIFT+A still does old toolbox - hold left or rightmouse for 0.4 second, and it pops up as well this is experimental! Can be tweaked with Userdef var "ThresA" - it is a little bit complete for Object mode only. Needs still work at information desing/structure level - the code works like an engine, interpreting structs like this: static TBitem addmenu_curve[]= { { 0, "Bezier Curve", 0, NULL}, { 0, "Bezier Circle", 1, NULL}, { 0, "NURBS Curve", 2, NULL}, { 0, "NURBS Circle", 3, NULL}, { 0, "Path", 4, NULL}, { -1, "", 0, do_info_add_curvemenu}}; - first value is ICON code, - then name - return value - pointer to optional child last row has -1 to indicate its the last... plus a callback to event function. I also built an old toolbox style callback for this: static TBitem tb_object_select[]= { { 0, "Border Select|B", 'b', NULL}, { 0, "(De)select All|A", 'a', NULL}, { 0, "Linked...|Shift L", 'L', NULL}, { 0, "Grouped...|Shift G", 'G', NULL}, { -1, "", 0, tb_do_hotkey}}; here the return values are put back as hotkeys in mainqueue. A mainloop can do all context switching, and build menus on the fly. Meaning, it also allows other designs such as radials...
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/library.c18
-rw-r--r--source/blender/include/BIF_interface.h18
-rw-r--r--source/blender/include/BIF_resources.h1
-rw-r--r--source/blender/include/BIF_toolbox.h2
-rw-r--r--source/blender/include/BSE_headerbuttons.h7
-rw-r--r--source/blender/include/interface.h2
-rw-r--r--source/blender/src/editobject.c11
-rw-r--r--source/blender/src/editscreen.c12
-rw-r--r--source/blender/src/editview.c20
-rw-r--r--source/blender/src/header_info.c17
-rw-r--r--source/blender/src/header_view3d.c8
-rw-r--r--source/blender/src/interface.c250
-rw-r--r--source/blender/src/toolbox.c327
13 files changed, 546 insertions, 147 deletions
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index c2e94e09bd1..fb7e6ba8fed 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -568,7 +568,9 @@ static void IDnames_to_dyn_pupstring(DynStr *pupds, ListBase *lb, ID *link, shor
BLI_dynstr_append(pupds, buf);
BLI_dynstr_append(pupds, id->name+2);
-
+ sprintf(buf, "%%x%d", i+1);
+ BLI_dynstr_append(pupds, buf);
+
if(id->next)
BLI_dynstr_append(pupds, "|");
}
@@ -607,6 +609,8 @@ static void IPOnames_to_dyn_pupstring(DynStr *pupds, ListBase *lb, ID *link, sho
BLI_dynstr_append(pupds, buf);
BLI_dynstr_append(pupds, id->name+2);
+ sprintf(buf, "%%x%d", i+1);
+ BLI_dynstr_append(pupds, buf);
if(id->next)
BLI_dynstr_append(pupds, "|");
@@ -627,13 +631,13 @@ void IDnames_to_pupstring(char **str, char *title, char *extraops, ListBase *lb,
BLI_dynstr_append(pupds, "%t|");
}
- IDnames_to_dyn_pupstring(pupds, lb, link, nr);
-
if (extraops) {
+ BLI_dynstr_append(pupds, extraops);
if (BLI_dynstr_get_len(pupds))
BLI_dynstr_append(pupds, "|");
- BLI_dynstr_append(pupds, extraops);
}
+
+ IDnames_to_dyn_pupstring(pupds, lb, link, nr);
*str= BLI_dynstr_get_cstring(pupds);
BLI_dynstr_free(pupds);
@@ -649,13 +653,13 @@ void IPOnames_to_pupstring(char **str, char *title, char *extraops, ListBase *lb
BLI_dynstr_append(pupds, "%t|");
}
- IPOnames_to_dyn_pupstring(pupds, lb, link, nr, blocktype);
-
if (extraops) {
+ BLI_dynstr_append(pupds, extraops);
if (BLI_dynstr_get_len(pupds))
BLI_dynstr_append(pupds, "|");
- BLI_dynstr_append(pupds, extraops);
}
+
+ IPOnames_to_dyn_pupstring(pupds, lb, link, nr, blocktype);
*str= BLI_dynstr_get_cstring(pupds);
BLI_dynstr_free(pupds);
diff --git a/source/blender/include/BIF_interface.h b/source/blender/include/BIF_interface.h
index 60c5fab0e06..cd1d75dd13a 100644
--- a/source/blender/include/BIF_interface.h
+++ b/source/blender/include/BIF_interface.h
@@ -46,10 +46,13 @@ struct ScrArea;
#define UI_EMBOSSX 0 /* for a python file, which i can't change.... duh! */
/* uiBlock->direction */
-#define UI_TOP 0
-#define UI_DOWN 1
-#define UI_LEFT 2
-#define UI_RIGHT 3
+#define UI_TOP 1
+#define UI_DOWN 2
+#define UI_LEFT 4
+#define UI_RIGHT 8
+#define UI_DIRECTION 15
+#define UI_CENTRE 16
+#define UI_SHIFT_FLIPPED 32
/* uiBlock->autofill */
#define UI_BLOCK_COLLUMNS 1
@@ -85,11 +88,16 @@ struct ScrArea;
#define UI_PNL_TO_MOUSE 128
#define UI_PNL_UNSTOW 256
-/* definitions for icons (and their alignment) in buttons */
/* warning the first 4 flags are internal */
+/* but->flag */
#define UI_TEXT_LEFT 16
#define UI_ICON_LEFT 32
#define UI_ICON_RIGHT 64
+ /* control for button type block */
+#define UI_MAKE_TOP 128
+#define UI_MAKE_DOWN 256
+#define UI_MAKE_LEFT 512
+#define UI_MAKE_RIGHT 1024
/* Button types */
diff --git a/source/blender/include/BIF_resources.h b/source/blender/include/BIF_resources.h
index ec826035b50..cc3f751bcbc 100644
--- a/source/blender/include/BIF_resources.h
+++ b/source/blender/include/BIF_resources.h
@@ -344,6 +344,7 @@ void BIF_GetThemeColor3fv(int colorid, float *col);
void BIF_GetThemeColor3ubv(int colorid, char *col);
void BIF_GetThemeColor4ubv(int colorid, char *col);
+struct ScrArea;
// internal (blender) usage only, for init and set active
void BIF_InitTheme(void);
diff --git a/source/blender/include/BIF_toolbox.h b/source/blender/include/BIF_toolbox.h
index 1d5d4fb3faf..d4e4a76cbcf 100644
--- a/source/blender/include/BIF_toolbox.h
+++ b/source/blender/include/BIF_toolbox.h
@@ -103,6 +103,8 @@ void tbox_getactive (int *x, int *y);
void drawtoolbox (void);
void toolbox (void);
+void toolbox_n(void);
+
void notice (char *str, ...);
void error (char *fmt, ...);
diff --git a/source/blender/include/BSE_headerbuttons.h b/source/blender/include/BSE_headerbuttons.h
index 85c12437bf1..889ce57fea6 100644
--- a/source/blender/include/BSE_headerbuttons.h
+++ b/source/blender/include/BSE_headerbuttons.h
@@ -105,4 +105,11 @@ void do_view3d_buttons(short event);
void do_headerbuttons(short event);
+/* header_info.c */
+void do_info_add_meshmenu(void *arg, int event);
+void do_info_add_curvemenu(void *arg, int event);
+void do_info_add_surfacemenu(void *arg, int event);
+void do_info_add_metamenu(void *arg, int event);
+void do_info_addmenu(void *arg, int event);
+
#endif /* BSE_HEADERBUTTONS_H */
diff --git a/source/blender/include/interface.h b/source/blender/include/interface.h
index 02fdd9c2e25..614ed0ede65 100644
--- a/source/blender/include/interface.h
+++ b/source/blender/include/interface.h
@@ -183,6 +183,7 @@ struct uiBlock {
int themecol; /* themecolor id */
short but_align; /* aligning buttons, horiz/vertical */
+
short font; /* indices */
int afterval;
void *curfont;
@@ -192,6 +193,7 @@ struct uiBlock {
float xofs, yofs; // offset to parent button
rctf parentrct; // for pulldowns, rect the mouse is allowed outside of menu (parent button)
+ rctf safety; // pulldowns, to detect outside, can differ per case how it is created
int handler; // for panels in other windows than buttonswin... just event code
};
diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c
index 8204507aa97..467e5786178 100644
--- a/source/blender/src/editobject.c
+++ b/source/blender/src/editobject.c
@@ -5451,6 +5451,7 @@ void std_rmouse_transform(void (*xf_func)(int))
{
short mval[2];
short xo, yo;
+ short timer=0;
getmouseco_areawin(mval);
xo= mval[0];
@@ -5463,8 +5464,14 @@ void std_rmouse_transform(void (*xf_func)(int))
while(get_mbut()&R_MOUSE) BIF_wait_for_statechange();
return;
}
-
- BIF_wait_for_statechange();
+ else {
+ PIL_sleep_ms(10);
+ timer++;
+ if(timer>=10*U.menuthreshold1) {
+ toolbox_n();
+ return;
+ }
+ }
}
}
diff --git a/source/blender/src/editscreen.c b/source/blender/src/editscreen.c
index 1076b94d6f5..ed0bfb51c3c 100644
--- a/source/blender/src/editscreen.c
+++ b/source/blender/src/editscreen.c
@@ -1079,7 +1079,7 @@ void screenmain(void)
else if (event==SPACEKEY) {
if((G.obedit && G.obedit->type==OB_FONT && g_activearea->spacetype==SPACE_VIEW3D)||g_activearea->spacetype==SPACE_TEXT);
else {
- if(val) toolbox();
+ if(val) toolbox_n();
towin= 0;
}
}
@@ -2021,7 +2021,7 @@ static void copy_screen(bScreen *to, bScreen *from)
{
ScrVert *s1, *s2;
ScrEdge *se;
- ScrArea *sa;
+ ScrArea *sa, *saf;
ListBase lbase;
/* free 'to' */
@@ -2048,6 +2048,7 @@ static void copy_screen(bScreen *to, bScreen *from)
}
sa= to->areabase.first;
+ saf= from->areabase.first;
while(sa) {
sa->v1= sa->v1->newv;
sa->v2= sa->v2->newv;
@@ -2056,12 +2057,13 @@ static void copy_screen(bScreen *to, bScreen *from)
sa->win= 0;
sa->headwin= 0;
+ sa->spacedata.first= sa->spacedata.last= NULL;
sa->uiblocks.first= sa->uiblocks.last= NULL;
-
- duplicatespacelist(sa, &lbase, &sa->spacedata);
- sa->spacedata= lbase;
+ sa->panels.first= sa->panels.last= NULL;
+ copy_areadata(sa, saf);
sa= sa->next;
+ saf= saf->next;
}
/* put at zero (needed?) */
diff --git a/source/blender/src/editview.c b/source/blender/src/editview.c
index 6feb0343bfb..968ed473648 100644
--- a/source/blender/src/editview.c
+++ b/source/blender/src/editview.c
@@ -49,6 +49,7 @@
#include "BLI_editVert.h"
#include "IMB_imbuf.h"
+#include "PIL_time.h"
#include "DNA_armature_types.h"
#include "DNA_meta_types.h"
@@ -58,6 +59,7 @@
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_view3d_types.h"
+#include "DNA_userdef_types.h"
#include "BKE_utildefines.h"
#include "BKE_global.h"
@@ -76,6 +78,7 @@
#include "BIF_editview.h"
#include "BIF_glutil.h"
#include "BIF_editarmature.h"
+#include "BIF_toolbox.h"
#include "BDR_editobject.h" /* For headerprint */
#include "BDR_vpaint.h"
@@ -231,8 +234,8 @@ int gesture(void)
{
short mcords[MOVES][2];
int i= 1, end= 0, a;
- unsigned short event;
- short mval[2], val;
+ unsigned short event=0;
+ short mval[2], val, timer=0;
glDrawBuffer(GL_FRONT);
persp(0); /* ortho at pixel level */
@@ -244,8 +247,17 @@ int gesture(void)
while(get_mbut()&L_MOUSE) {
- event= extern_qread(&val);
-
+ if(qtest()) event= extern_qread(&val);
+ else if(i==1) {
+ /* not drawing yet... check for toolbox */
+ PIL_sleep_ms(10);
+ timer++;
+ if(timer>=10*U.menuthreshold1) {
+ toolbox_n();
+ return 0;
+ }
+ }
+
switch (event) {
case MOUSEY:
getmouseco_areawin(mval);
diff --git a/source/blender/src/header_info.c b/source/blender/src/header_info.c
index 40986b41575..63a7bfdfad4 100644
--- a/source/blender/src/header_info.c
+++ b/source/blender/src/header_info.c
@@ -880,7 +880,7 @@ static uiBlock *info_filemenu(void *arg_unused)
/**************************** ADD ******************************/
-static void do_info_add_meshmenu(void *arg, int event)
+void do_info_add_meshmenu(void *arg, int event)
{
switch(event) {
@@ -920,6 +920,10 @@ static void do_info_add_meshmenu(void *arg, int event)
/* Grid */
add_primitiveMesh(10);
break;
+ case 9:
+ /* Monkey */
+ add_primitiveMesh(13);
+ break;
default:
break;
}
@@ -945,6 +949,7 @@ static uiBlock *info_add_meshmenu(void *arg_unused)
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Cone|", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 7, "");
uiDefIconTextBut(block, SEPR, 0, ICON_BLANK1, "", 0, yco-=6, 160, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Grid|", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 8, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Monkey|", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 9, "");
uiBlockSetDirection(block, UI_RIGHT);
uiTextBoundsBlock(block, 50);
@@ -952,7 +957,7 @@ static uiBlock *info_add_meshmenu(void *arg_unused)
return block;
}
-static void do_info_add_curvemenu(void *arg, int event)
+void do_info_add_curvemenu(void *arg, int event)
{
switch(event) {
@@ -1004,7 +1009,7 @@ static uiBlock *info_add_curvemenu(void *arg_unused)
}
-static void do_info_add_surfacemenu(void *arg, int event)
+void do_info_add_surfacemenu(void *arg, int event)
{
switch(event) {
@@ -1059,7 +1064,7 @@ static uiBlock *info_add_surfacemenu(void *arg_unused)
return block;
}
-static void do_info_add_metamenu(void *arg, int event)
+void do_info_add_metamenu(void *arg, int event)
{
switch(event) {
@@ -1112,9 +1117,9 @@ static uiBlock *info_add_metamenu(void *arg_unused)
}
-static void do_info_addmenu(void *arg, int event)
+void do_info_addmenu(void *arg, int event)
{
-
+printf("event %d\n", event);
switch(event) {
case 0:
/* Mesh */
diff --git a/source/blender/src/header_view3d.c b/source/blender/src/header_view3d.c
index 582096d1514..06b90e253b1 100644
--- a/source/blender/src/header_view3d.c
+++ b/source/blender/src/header_view3d.c
@@ -1018,7 +1018,7 @@ static void do_view3d_edit_objectmenu(void *arg, int event)
adduplicate(0);
G.qual &= ~LR_ALTKEY;
break;
- case 4: /* make links */
+ case 4: /* copy linkss */
linkmenu();
break;
case 5: /* make single user */
@@ -1089,7 +1089,7 @@ static uiBlock *view3d_edit_objectmenu(void *arg_unused)
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Links...|Ctrl L", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Copy Links...|Ctrl L", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Single User...|U", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Copy Properties...|Ctrl C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
@@ -2577,7 +2577,7 @@ static char *view3d_modeselect_pup(void)
}
-char *drawtype_pup(void)
+static char *drawtype_pup(void)
{
static char string[512];
@@ -2589,7 +2589,7 @@ char *drawtype_pup(void)
strcat(string, "|Textured %x5");
return (string);
}
-char *around_pup(void)
+static char *around_pup(void)
{
static char string[512];
diff --git a/source/blender/src/interface.c b/source/blender/src/interface.c
index f55f041b0bb..4b1f056c8ee 100644
--- a/source/blender/src/interface.c
+++ b/source/blender/src/interface.c
@@ -343,8 +343,21 @@ static void ui_positionblock(uiBlock *block, uiBut *but)
{
/* position block relative to but */
uiBut *bt;
- int xsize, ysize, xof=0, yof=0;
+ rctf butrct;
+ int xsize, ysize, xof=0, yof=0, centre;
+ short dir1= 0, dir2=0;
+ /* first transform to screen coords, assuming matrix is stil OK */
+ /* the UIwinmat is in panelspace */
+
+ butrct.xmin= but->x1; butrct.xmax= but->x2;
+ butrct.ymin= but->y1; butrct.ymax= but->y2;
+
+ ui_graphics_to_window(block->win, &butrct.xmin, &butrct.ymin);
+ ui_graphics_to_window(block->win, &butrct.xmax, &butrct.ymax);
+ block->parentrct= butrct; // will use that for pulldowns later
+
+ /* calc block rect */
block->minx= block->miny= 10000;
block->maxx= block->maxy= -10000;
@@ -359,42 +372,37 @@ static void ui_positionblock(uiBlock *block, uiBut *but)
bt= bt->next;
}
+ ui_graphics_to_window(block->win, &block->minx, &block->miny);
+ ui_graphics_to_window(block->win, &block->maxx, &block->maxy);
+
block->minx-= 2.0; block->miny-= 2.0;
block->maxx+= 2.0; block->maxy+= 2.0;
xsize= block->maxx - block->minx+4; // 4 for shadow
ysize= block->maxy - block->miny+4;
-
+
if(but) {
- rctf butrct;
short left=0, right=0, top=0, down=0;
- short dir1, dir2 = 0;
- butrct.xmin= but->x1; butrct.xmax= but->x2;
- butrct.ymin= but->y1; butrct.ymax= but->y2;
-
- if(but->block->panel) {
- butrct.xmin += but->block->panel->ofsx;
- butrct.ymin += but->block->panel->ofsy;
- butrct.xmax += but->block->panel->ofsx;
- butrct.ymax += but->block->panel->ofsy;
- }
-
- /* added this for submenu's... */
- Mat4CpyMat4(UIwinmat, block->winmat);
-
- ui_graphics_to_window(block->win, &butrct.xmin, &butrct.ymin);
- ui_graphics_to_window(block->win, &butrct.xmax, &butrct.ymax);
- block->parentrct= butrct; // will use that for pulldowns later
+ if(block->direction & UI_CENTRE) centre= ysize/2;
+ else centre= 0;
if( butrct.xmin-xsize > 0.0) left= 1;
if( butrct.xmax+xsize < G.curscreen->sizex) right= 1;
- if( butrct.ymin-ysize > 0.0) down= 1;
- if( butrct.ymax+ysize < G.curscreen->sizey) top= 1;
+ if( butrct.ymin-ysize+centre > 0.0) down= 1;
+ if( butrct.ymax+ysize-centre < G.curscreen->sizey) top= 1;
- dir1= block->direction;
- if(dir1==UI_LEFT || dir1==UI_RIGHT) dir2= UI_DOWN;
- if(dir1==UI_TOP || dir1==UI_DOWN) dir2= UI_LEFT;
+ dir1= block->direction & UI_DIRECTION;
+
+ /* secundary directions */
+ if(dir1 & (UI_TOP|UI_DOWN)) {
+ if(dir1 & UI_LEFT) dir2= UI_LEFT;
+ else if(dir1 & UI_RIGHT) dir2= UI_RIGHT;
+ dir1 &= (UI_TOP|UI_DOWN);
+ }
+
+ if(dir2==0) if(dir1==UI_LEFT || dir1==UI_RIGHT) dir2= UI_DOWN;
+ if(dir2==0) if(dir1==UI_TOP || dir1==UI_DOWN) dir2= UI_LEFT;
/* no space at all? dont change */
if(left || right) {
@@ -412,47 +420,55 @@ static void ui_positionblock(uiBlock *block, uiBut *but)
}
if(dir1==UI_LEFT) {
- xof= but->x1 - block->maxx;
- if(dir2==UI_TOP) yof= but->y1 - block->miny;
- else yof= but->y2 - block->maxy;
+ xof= butrct.xmin - block->maxx;
+ if(dir2==UI_TOP) yof= butrct.ymin - block->miny-centre;
+ else yof= butrct.ymax - block->maxy+centre;
}
else if(dir1==UI_RIGHT) {
- xof= but->x2 - block->minx;
- if(dir2==UI_TOP) yof= but->y1 - block->miny;
- else yof= but->y2 - block->maxy;
+ xof= butrct.xmax - block->minx;
+ if(dir2==UI_TOP) yof= butrct.ymin - block->miny-centre;
+ else yof= butrct.ymax - block->maxy+centre;
}
else if(dir1==UI_TOP) {
- yof= but->y2 - block->miny+1;
- if(dir2==UI_RIGHT) xof= but->x2 - block->maxx;
- else xof= but->x1 - block->minx;
+ yof= butrct.ymax - block->miny-1;
+ if(dir2==UI_RIGHT) xof= butrct.xmax - block->maxx;
+ else xof= butrct.xmin - block->minx;
+ // changed direction?
+ if((dir1 & block->direction)==0) {
+ if(block->direction & UI_SHIFT_FLIPPED)
+ xof+= dir2==UI_LEFT?25:-25;
+ uiBlockFlipOrder(block);
+ }
}
else if(dir1==UI_DOWN) {
- yof= but->y1 - block->maxy-1;
- if(dir2==UI_RIGHT) xof= but->x2 - block->maxx;
- else xof= but->x1 - block->minx;
+ yof= butrct.ymin - block->maxy+1;
+ if(dir2==UI_RIGHT) xof= butrct.xmax - block->maxx;
+ else xof= butrct.xmin - block->minx;
+ // changed direction?
+ if((dir1 & block->direction)==0) {
+ if(block->direction & UI_SHIFT_FLIPPED)
+ xof+= dir2==UI_LEFT?25:-25;
+ uiBlockFlipOrder(block);
+ }
}
// apply requested offset in the block
-
- xof += block->xofs;
- yof += block->yofs;
+ xof += block->xofs/block->aspect;
+ yof += block->yofs/block->aspect;
- if(but->block->panel) {
- xof += but->block->panel->ofsx;
- yof += but->block->panel->ofsy;
- }
}
/* apply */
bt= block->buttons.first;
while(bt) {
+
+ ui_graphics_to_window(block->win, &bt->x1, &bt->y1);
+ ui_graphics_to_window(block->win, &bt->x2, &bt->y2);
+
bt->x1 += xof;
bt->x2 += xof;
bt->y1 += yof;
bt->y2 += yof;
-
- ui_graphics_to_window(block->win, &bt->x1, &bt->y1);
- ui_graphics_to_window(block->win, &bt->x2, &bt->y2);
bt->aspect= 1.0;
@@ -464,8 +480,40 @@ static void ui_positionblock(uiBlock *block, uiBut *but)
block->maxx += xof;
block->maxy += yof;
- ui_graphics_to_window(block->win, &block->minx, &block->miny);
- ui_graphics_to_window(block->win, &block->maxx, &block->maxy);
+ /* safety calculus */
+ if(but) {
+ float midx= (block->parentrct.xmin+block->parentrct.xmax)/2.0;
+ float midy= (block->parentrct.ymin+block->parentrct.ymax)/2.0;
+
+ /* when you are outside parent button, safety there should be smaller */
+
+ // parent button to left
+ if( midx < block->minx ) block->safety.xmin= block->minx-3;
+ else block->safety.xmin= block->minx-40;
+ // parent button to right
+ if( midx > block->maxx ) block->safety.xmax= block->maxx+3;
+ else block->safety.xmax= block->maxx+40;
+
+ // parent button on bottom
+ if( midy < block->miny ) block->safety.ymin= block->miny-3;
+ else block->safety.ymin= block->miny-40;
+ // parent button on top
+ if( midy > block->maxy ) block->safety.ymax= block->maxy+3;
+ else block->safety.ymax= block->maxy+40;
+
+ // exception for switched pulldowns...
+ if(dir1 && (dir1 & block->direction)==0) {
+ if(dir2==UI_RIGHT) block->safety.xmax= block->maxx+3;
+ if(dir2==UI_LEFT) block->safety.xmin= block->minx-3;
+ }
+ }
+ else {
+ block->safety.xmin= block->minx-40;
+ block->safety.ymin= block->miny-40;
+ block->safety.xmax= block->maxx+40;
+ block->safety.ymax= block->maxy+40;
+ }
+
}
@@ -823,22 +871,19 @@ static int ui_do_but_MENU(uiBut *but)
for(a=0; a<md->nitems; a++) {
- x1= but->x1 + width*((int)a/rows);
+ x1= but->x1 + width*((int)(md->nitems-a-1)/rows);
y1= but->y1 - boxh*(a%rows) + (rows-1)*boxh;
- if (strcmp(md->items[a].str, "%l")==0) {
+ if (strcmp(md->items[md->nitems-a-1].str, "%l")==0) {
uiDefBut(block, SEPR, B_NOP, "", x1, y1,(short)(width-(rows>1)), (short)(boxh-1), NULL, 0.0, 0.0, 0, 0, "");
}
else {
- uiBut *bt= uiDefBut(block, BUTM|but->pointype, but->retval, md->items[a].str, x1, y1,(short)(width-(rows>1)), (short)(boxh-1), but->poin, (float) md->items[a].retval, 0.0, 0, 0, "");
+ uiBut *bt= uiDefBut(block, BUTM|but->pointype, but->retval, md->items[md->nitems-a-1].str, x1, y1,(short)(width-(rows>1)), (short)(boxh-1), but->poin, (float) md->items[md->nitems-a-1].retval, 0.0, 0, 0, "");
if(active==a) bt->flag |= UI_ACTIVE;
}
}
- /* fix alignment because of the shadow, etc */
- block->xofs = -2;
- block->yofs = -2;
-
+ block->direction= UI_TOP;
ui_positionblock(block, but);
block->win= G.curscreen->mainwin;
event= uiDoBlocks(&listb, 0);
@@ -1690,6 +1735,7 @@ static int ui_do_but_NUMSLI(uiBut *but)
static int ui_do_but_BLOCK(uiBut *but)
{
uiBlock *block;
+ uiBut *bt;
but->flag |= UI_SELECT;
ui_draw_but(but);
@@ -1697,15 +1743,30 @@ static int ui_do_but_BLOCK(uiBut *but)
block= but->block_func(but->poin);
block->xofs = -2; /* for proper alignment */
+
+ /* only used for automatic toolbox, so can set the shift flag */
+ if(but->flag & UI_MAKE_TOP) {
+ block->direction= UI_TOP|UI_SHIFT_FLIPPED;
+ uiBlockFlipOrder(block);
+ }
+ if(but->flag & UI_MAKE_DOWN) block->direction= UI_DOWN|UI_SHIFT_FLIPPED;
+ if(but->flag & UI_MAKE_LEFT) block->direction |= UI_LEFT;
+ if(but->flag & UI_MAKE_RIGHT) block->direction |= UI_RIGHT;
+
ui_positionblock(block, but);
block->flag |= UI_BLOCK_LOOP;
+
+ /* blocks can come from a normal window, but we go to screenspace */
block->win= G.curscreen->mainwin;
-
+ for(bt= block->buttons.first; bt; bt= bt->next) bt->win= block->win;
+ bwin_getsinglematrix(block->win, block->winmat);
+
/* postpone draw, this will cause a new window matrix, first finish all other buttons */
block->flag |= UI_BLOCK_REDRAW;
but->flag &= ~UI_SELECT;
-
+ uibut_do_func(but);
+
return 0;
}
@@ -2136,7 +2197,7 @@ static int ui_do_button(uiBlock *block, uiBut *but, uiEvent *uevent)
case BLOCK:
if(uevent->val) {
retval= ui_do_but_BLOCK(but);
- block->auto_open= 1;
+ if(block->auto_open==0) block->auto_open= 1;
}
break;
@@ -2288,7 +2349,7 @@ static int ui_mouse_motion_towards_block(uiBlock *block, uiEvent *uevent)
short mvalo[2], dx, dy, domx, domy, x1, y1;
int disto, dist, counter=0;
- if(block->direction==UI_TOP || block->direction==UI_DOWN) return 0;
+ if((block->direction & UI_TOP) || (block->direction & UI_DOWN)) return 0;
if(uevent->event!= MOUSEX && uevent->event!= MOUSEY) return 0;
/* calculate dominant direction */
@@ -2576,15 +2637,20 @@ static int ui_do_block(uiBlock *block, uiEvent *uevent)
else if(but->type==BLOCK || but->type==MENU) { // automatic opens block button (pulldown)
int time;
if(uevent->event!=LEFTMOUSE ) {
- if(block->auto_open) time= 5*U.menuthreshold2;
+ if(block->auto_open==2) time= 2; // test for toolbox
+ else if(block->auto_open) time= 5*U.menuthreshold2;
else if(U.uiflag & MENUOPENAUTO) time= 5*U.menuthreshold1;
else time= -1;
-
+
for (; time>0; time--) {
- if (anyqtest()) break;
+ if (qtest()) break;
else PIL_sleep_ms(20);
}
- if(time==0) ui_do_button(block, but, uevent);
+
+ if(time==0) {
+ uevent->val= 1; // otherwise buttons dont react
+ ui_do_button(block, but, uevent);
+ }
}
}
if(but->flag & UI_ACTIVE) active= 1;
@@ -2640,8 +2706,10 @@ static int ui_do_block(uiBlock *block, uiEvent *uevent)
if(block->flag & UI_BLOCK_LOOP) {
if(inside==0 && uevent->val==1) {
- if ELEM3(uevent->event, LEFTMOUSE, MIDDLEMOUSE, RIGHTMOUSE)
- return UI_RETURN_OUT;
+ if ELEM3(uevent->event, LEFTMOUSE, MIDDLEMOUSE, RIGHTMOUSE) {
+ if(BLI_in_rctf(&block->parentrct, (float)uevent->mval[0], (float)uevent->mval[1]));
+ else return UI_RETURN_OUT;
+ }
}
if(uevent->event==ESCKEY && uevent->val==1) return UI_RETURN_CANCEL;
@@ -2649,37 +2717,12 @@ static int ui_do_block(uiBlock *block, uiEvent *uevent)
if((uevent->event==RETKEY || uevent->event==PADENTER) && uevent->val==1) return UI_RETURN_OK;
/* check outside */
- if(inside==0 && block->parentrct.xmax != 0.0) {
+ if(inside==0) {
/* strict check, and include the parent rect */
if( BLI_in_rctf(&block->parentrct, (float)uevent->mval[0], (float)uevent->mval[1]));
else if( ui_mouse_motion_towards_block(block, uevent));
- else {
- float midx, midy;
- int safety;
-
- midx= (block->parentrct.xmin+block->parentrct.xmax)/2.0;
- midy= (block->parentrct.ymin+block->parentrct.ymax)/2.0;
-
- if( midx < block->minx ) safety = 3; else safety= 40;
- if(uevent->mval[0]<block->minx-safety) return UI_RETURN_OUT;
-
- if( midy < block->miny ) safety = 3; else safety= 40;
- if(uevent->mval[1]<block->miny-safety) return UI_RETURN_OUT;
-
- if( midx > block->maxx ) safety = 3; else safety= 40;
- if(uevent->mval[0]>block->maxx+safety) return UI_RETURN_OUT;
-
- if( midy > block->maxy ) safety = 3; else safety= 40;
- if(uevent->mval[1]>block->maxy+safety) return UI_RETURN_OUT;
- }
- }
- else {
- /* for popups without parent button */
- if(uevent->mval[0]<block->minx-40) return UI_RETURN_OUT;
- if(uevent->mval[1]<block->miny-40) return UI_RETURN_OUT;
-
- if(uevent->mval[0]>block->maxx+40) return UI_RETURN_OUT;
- if(uevent->mval[1]>block->maxy+40) return UI_RETURN_OUT;
+ else if( BLI_in_rctf(&block->safety, (float)uevent->mval[0], (float)uevent->mval[1]));
+ else return UI_RETURN_OUT;
}
}
@@ -2740,24 +2783,10 @@ static uiSaveUnder *ui_draw_but_tip(uiBut *but)
su= ui_bgnpupdraw((int)(x1-1), (int)(y1-1), (int)(x2+4), (int)(y2+4), 0);
- /* bottom */
- //glColor3ub(0,0,0);
- //fdrawline(x1, y1, x2, y1);
- /* right */
- //fdrawline(x2, y1, x2, y2);
- /* top */
- //glColor3ub(255,255,255);
- //fdrawline(x1, y2, x2, y2);
- /* left */
- //fdrawline(x1, y1, x1, y2);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
- /*glColor4ub(0, 0, 0, 100);
- fdrawline(x1+4, y1, x2+1, y1);
- fdrawline(x2+1, y1, x2+1, y2-4);
- */
glColor4ub(0, 0, 0, 60);
fdrawline(x1+3, y1-1, x2, y1-1);
fdrawline(x2+1, y1, x2+1, y2-3);
@@ -2914,7 +2943,7 @@ int uiDoBlocks(ListBase *lb, int event)
if(block==NULL || (block->flag & UI_BLOCK_LOOP)==0) cont= 0;
while( (block= lb->first) && (block->flag & UI_BLOCK_LOOP)) {
- block->auto_open= 1;
+ if(block->auto_open==0) block->auto_open= 1;
/* this here, for menu buts */
if(block->flag & UI_BLOCK_REDRAW) {
@@ -2946,7 +2975,7 @@ int uiDoBlocks(ListBase *lb, int event)
BLI_remlink(lb, block);
uiFreeBlock(block);
}
- if(retval==UI_RETURN_OK) {
+ if(retval & (UI_RETURN_OK|UI_RETURN_CANCEL)) {
/* free other menus */
while( (block= lb->first) && (block->flag & UI_BLOCK_LOOP)) {
ui_endpupdraw(block->saveunder);
@@ -3197,6 +3226,7 @@ uiBlock *uiNewBlock(ListBase *lb, char *name, short dt, short font, short win)
if (win==G.curscreen->mainwin) {
block->aspect= 1.0;
+ block->auto_open= 2;
} else {
int getsizex, getsizey;
diff --git a/source/blender/src/toolbox.c b/source/blender/src/toolbox.c
index ef4a71d670b..3154fb0bc5c 100644
--- a/source/blender/src/toolbox.c
+++ b/source/blender/src/toolbox.c
@@ -54,10 +54,7 @@
#include "BMF_Api.h"
#include "BIF_language.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BLI_editVert.h"
+#include "BIF_resources.h"
#include "DNA_image_types.h"
#include "DNA_object_types.h"
@@ -66,6 +63,10 @@
#include "DNA_userdef_types.h"
#include "DNA_view3d_types.h"
+#include "BLI_blenlib.h"
+#include "BLI_arithb.h"
+#include "BLI_editVert.h"
+
#include "BKE_plugin_types.h"
#include "BKE_utildefines.h"
#include "BKE_global.h"
@@ -96,6 +97,7 @@
#include "BSE_editipo.h"
#include "BSE_buttons.h"
#include "BSE_filesel.h"
+#include "BSE_headerbuttons.h"
#include "IMB_imbuf.h"
@@ -1503,3 +1505,320 @@ void replace_names_but(void)
}
+
+/* ********************** NEW TOOLBOX ********************** */
+
+ListBase tb_listb= {NULL, NULL};
+
+#define TB_TAB 256
+#define TB_ALT 512
+#define TB_CTRL 1024
+
+typedef struct TBitem {
+ int icon;
+ char *name;
+ int retval;
+ void *poin;
+} TBitem;
+
+static void tb_do_hotkey(void *arg, int event)
+{
+ unsigned short key=0, qual1=0, qual2=0;
+
+ if(event & TB_CTRL) {
+ qual1= LEFTCTRLKEY;
+ event &= ~TB_CTRL;
+ }
+ if(event & TB_ALT) {
+ qual1= LEFTALTKEY;
+ event &= ~TB_ALT;
+ }
+
+ if(event & TB_TAB) key= TABKEY;
+ else asciitoraw(event, &key, &qual2);
+
+ if(qual1) mainqenter(qual1, 1);
+ if(qual2) mainqenter(qual2, 1);
+ mainqenter(key, 1);
+ mainqenter(key, 0);
+ mainqenter(EXECUTE, 1);
+ if(qual1) mainqenter(qual1, 0);
+ if(qual2) mainqenter(qual2, 0);
+
+}
+
+/* *************Select ********** */
+
+
+static TBitem tb_object_select[]= {
+{ 0, "Border Select|B", 'b', NULL},
+{ 0, "(De)select All|A", 'a', NULL},
+{ 0, "Linked...|Shift L", 'L', NULL},
+{ 0, "Grouped...|Shift G", 'G', NULL},
+{ -1, "", 0, tb_do_hotkey}};
+
+
+/* *************Edit ********** */
+
+static TBitem tb_object_edit[]= {
+{ 0, "Enter Editmode|Tab", TB_TAB, NULL},
+{ 0, "Insert Keyframe|I", 'i', NULL},
+{ 0, "Boolean...|W", 'w', NULL},
+{ 0, "Join Objects|CTRL J", TB_CTRL|'j', NULL},
+{ 0, "Convert Object...|Alt C", 'i', NULL},
+{ -1, "", 0, tb_do_hotkey}};
+
+
+
+/* *************Object ********** */
+
+static TBitem tb_object[]= {
+{ 0, "Duplicate|Shift D", 'D', NULL},
+{ 0, "Duplicate Linked|Alt D", TB_ALT|'D', NULL},
+{ 0, "Delete|X", 'x', NULL},
+{ 0, "Copy Links...|Ctrl L", TB_CTRL|'l', NULL},
+{ 0, "Make Single User...|U", 'u', NULL},
+{ 0, "SEPR", 0, NULL},
+{ 0, "Make Parent|Ctrl P", TB_CTRL|'p', NULL},
+{ 0, "Clear Parent|Alt P", TB_ALT|'p', NULL},
+{ 0, "Copy Properties...|Ctrl C", TB_CTRL|'c', NULL},
+{ 0, "Move to Layer...|M", 'm', NULL},
+{ -1, "", 0, tb_do_hotkey}};
+
+
+/* *************TRANSFORM ********** */
+
+static void tb_do_view_dt(void *arg, int event){
+ G.vd->drawtype= event;
+ addqueue(curarea->win, REDRAW, 1);
+}
+
+static TBitem tb_view_dt[]= {
+{ ICON_BBOX, "Bounding box", 1, NULL},
+{ ICON_WIRE, "Wireframe", 2, NULL},
+{ ICON_SOLID, "Solid", 3, NULL},
+{ ICON_SMOOTH, "Shaded", 5, NULL},
+{ ICON_POTATO, "Textured", 5, NULL},
+{ -1, "", 0, tb_do_view_dt}};
+
+
+/* *************TRANSFORM ********** */
+
+static TBitem tb_transform[]= {
+{ 0, "Grabber|g", 'g', NULL},
+{ 0, "Rotate|r", 'r', NULL},
+{ 0, "Scale|s", 's', NULL},
+{ 0, "SEPR", 0, NULL},
+{ ICON_MENU_PANEL, "Properties|n", 'n', NULL},
+{ 0, "Snap...|Shift S", 'S', NULL},
+{ 0, "SEPR", 0, NULL},
+{ 0, "Clear Location", TB_ALT|'g', NULL},
+{ 0, "Clear Rotation", TB_ALT|'r', NULL},
+{ 0, "Clear Size", TB_ALT|'s', NULL},
+{ -1, "", 0, tb_do_hotkey}};
+
+/* *************ADD ********** */
+
+static TBitem addmenu_mesh[]= {
+{ 0, "Plane", 0, NULL},
+{ 0, "Cube", 1, NULL},
+{ 0, "Circle", 2, NULL},
+{ 0, "UVsphere", 3, NULL},
+{ 0, "Icosphere", 4, NULL},
+{ 0, "Cylinder", 5, NULL},
+{ 0, "Tube", 6, NULL},
+{ 0, "Cone", 7, NULL},
+{ 0, "Grid", 8, NULL},
+{ 0, "Monkey", 9, NULL},
+{ -1, "", 0, do_info_add_meshmenu}};
+
+static TBitem addmenu_curve[]= {
+{ 0, "Bezier Curve", 0, NULL},
+{ 0, "Bezier Circle", 1, NULL},
+{ 0, "NURBS Curve", 2, NULL},
+{ 0, "NURBS Circle", 3, NULL},
+{ 0, "Path", 4, NULL},
+{ -1, "", 0, do_info_add_curvemenu}};
+
+static TBitem addmenu_surf[]= {
+{ 0, "NURBS Curve", 0, NULL},
+{ 0, "NURBS Circle", 1, NULL},
+{ 0, "NURBS Surface", 2, NULL},
+{ 0, "NURBS Tube", 3, NULL},
+{ 0, "NURBS Sphere", 4, NULL},
+{ 0, "NURBS Donut", 5, NULL},
+{ -1, "", 0, do_info_add_surfacemenu}};
+
+static TBitem addmenu_meta[]= {
+{ 0, "Meta Ball", 0, NULL},
+{ 0, "Meta Tube", 1, NULL},
+{ 0, "Meta Plane", 2, NULL},
+{ 0, "Meta Ellipsoid", 3, NULL},
+{ 0, "Meta Cube", 4, NULL},
+{ -1, "", 0, do_info_add_metamenu}};
+
+
+static TBitem tb_add[]= {
+{ 0, "Mesh", 0, addmenu_mesh},
+{ 0, "Curve", 1, addmenu_curve},
+{ 0, "Surface", 2, addmenu_surf},
+{ 0, "MBall", 3, addmenu_meta},
+{ 0, "Text", 4, NULL},
+{ 0, "Empty", 5, NULL},
+{ 0, "Camera", 6, NULL},
+{ 0, "Lamp", 7, NULL},
+{ 0, "SEPR", 0, NULL},
+{ 0, "Armature", 8, NULL},
+{ 0, "Lattice", 9, NULL},
+{ -1, "", 0, do_info_addmenu}};
+
+static TBitem tb_test[]= {
+{ 0, "test", 0, NULL},
+{ 0, "test", 1, NULL},
+{ 0, "test", 2, NULL},
+{ 0, "test", 3, NULL},
+{ 0, "test", 4, NULL},
+{ -1, "", 0, NULL}};
+
+
+
+static uiBlock *tb_makemenu(void *arg)
+{
+ static int counter=0;
+ TBitem *item= arg, *itemt;
+ uiBlock *block;
+ int yco= 0;
+ char str[10];
+
+ if(arg==NULL) return NULL;
+
+ sprintf(str, "tb %d\n", counter++);
+ block= uiNewBlock(&tb_listb, str, UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
+ uiBlockSetCol(block, TH_MENU_ITEM);
+
+ // last item has do_menu func, has to be stored in each button
+ itemt= item;
+ while(itemt->icon != -1) itemt++;
+ uiBlockSetButmFunc(block, itemt->poin, NULL);
+
+ // now make the buttons
+ while(item->icon != -1) {
+
+ if(strcmp(item->name, "SEPR")==0) {
+ uiDefBut(block, SEPR, 0, "", 0, yco-=6, 50, 6, NULL, 0.0, 0.0, 0, 0, "");
+ }
+ else if(item->icon) {
+ uiDefIconTextBut(block, BUTM, 1, item->icon, item->name, 0, yco-=20, 50, 19, NULL, 0.0, 0.0, 0, item->retval, "");
+ }
+ else if(item->poin) {
+ uiDefIconTextBlockBut(block, tb_makemenu, item->poin, ICON_RIGHTARROW_THIN, item->name, 0, yco-=20, 50, 19, "");
+ }
+ else {
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, item->name, 0, yco-=20, 50, 19, NULL, 0.0, 0.0, 0, item->retval, "");
+ }
+ item++;
+ }
+ uiTextBoundsBlock(block, 50);
+
+ /* direction is also set in the function that calls this */
+ uiBlockSetDirection(block, UI_RIGHT|UI_CENTRE);
+
+ return block;
+}
+
+static int tb_mainx= 0, tb_mainy= -5;
+static void store_main(void *arg1, void *arg2)
+{
+ tb_mainx= (int)arg1;
+ tb_mainy= (int)arg2;
+}
+
+void toolbox_n(void)
+{
+ uiBlock *block;
+ uiBut *but;
+ TBitem *menu1=NULL, *menu2=NULL, *menu3=NULL;
+ TBitem *menu4=NULL, *menu5=NULL, *menu6=NULL;
+ int dx;
+ short event, mval[2], tot=0;
+ char *str1=NULL, *str2=NULL, *str3=NULL, *str4=NULL, *str5=NULL, *str6=NULL;
+
+ mywinset(G.curscreen->mainwin); // we go to screenspace
+
+ block= uiNewBlock(&tb_listb, "toolbox", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
+ uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_RET_1);
+ uiBlockSetCol(block, TH_MENU_ITEM);
+
+ dx= 65;
+
+ /* select context for main items */
+ if(curarea->spacetype==SPACE_VIEW3D) {
+ /* standard menu */
+ menu1= tb_object; str1= "Object";
+ menu2= tb_add; str2= "Add";
+ menu3= tb_object_select; str3= "Select";
+ menu4= tb_object_edit; str4= "Edit";
+ menu5= tb_transform; str5= "Transform";
+ menu6= tb_view_dt; str6= "View";
+
+ if(G.obedit) {
+ if(G.obedit->type==OB_MESH) {
+ menu1= tb_test; str1= "Mesh";
+ menu2= addmenu_mesh; str2= "Add";
+ }
+ else if(G.obedit->type==OB_CURVE) {
+ menu1= tb_test; str1= "Curve";
+ menu2= addmenu_curve; str2= "Add";
+ }
+ else if(G.obedit->type==OB_SURF) {
+ menu1= tb_test; str1= "Surface";
+ menu2= addmenu_surf; str2= "Add";
+ }
+ else if(G.obedit->type==OB_MBALL) {
+ menu1= tb_test; str1= "Meta";
+ menu2= addmenu_meta; str2= "Add";
+ }
+
+ }
+ else {
+ }
+ tot= 6;
+ }
+
+ getmouseco_sc(mval);
+
+ /* create the main buttons menu */
+ if(tot==6) {
+ but=uiDefBlockBut(block, tb_makemenu, menu1, str1, mval[0]-1.5*dx+tb_mainx,mval[1]+tb_mainy, dx, 19, "");
+ uiButSetFlag(but, UI_MAKE_TOP|UI_MAKE_RIGHT);
+ uiButSetFunc(but, store_main, (void *)dx, (void *)-5);
+
+ but=uiDefBlockBut(block, tb_makemenu, menu2, str2, mval[0]-0.5*dx+tb_mainx,mval[1]+tb_mainy, dx, 19, "");
+ uiButSetFlag(but, UI_MAKE_TOP);
+ uiButSetFunc(but, store_main, (void *)0, (void *)-5);
+
+ but=uiDefBlockBut(block, tb_makemenu, menu3, str3, mval[0]+0.5*dx+tb_mainx,mval[1]+tb_mainy, dx, 19, "");
+ uiButSetFlag(but, UI_MAKE_TOP|UI_MAKE_LEFT);
+ uiButSetFunc(but, store_main, (void *)-dx, (void *)-5);
+
+ but=uiDefBlockBut(block, tb_makemenu, menu4, str4, mval[0]-1.5*dx+tb_mainx,mval[1]+tb_mainy-20, dx, 19, "");
+ uiButSetFlag(but, UI_MAKE_DOWN|UI_MAKE_RIGHT);
+ uiButSetFunc(but, store_main, (void *)dx, (void *)5);
+
+ but=uiDefBlockBut(block, tb_makemenu, menu5, str5, mval[0]-0.5*dx+tb_mainx,mval[1]+tb_mainy-20, dx, 19, "");
+ uiButSetFlag(but, UI_MAKE_DOWN);
+ uiButSetFunc(but, store_main, (void *)0, (void *)5);
+
+ but=uiDefBlockBut(block, tb_makemenu, menu6, str6, mval[0]+0.5*dx+tb_mainx,mval[1]+tb_mainy-20, dx, 19, "");
+ uiButSetFlag(but, UI_MAKE_DOWN|UI_MAKE_LEFT);
+ uiButSetFunc(but, store_main, (void *)-dx, (void *)5);
+ }
+
+ uiBoundsBlock(block, 2);
+ event= uiDoBlocks(&tb_listb, 0);
+
+ mywinset(curarea->win);
+}
+
+
+