- changed header from buttonwindow into new type
- changed meaning of F4-F10 keys (as compatible as possible, but we need something!) check UI design doc for proposal - made new call for switching direction of buttons in Y, for when pulldown moves direction - cleaned up all redundant manual switching code from headerbuttons.c
This commit is contained in:
@@ -101,10 +101,9 @@ void uiDefIDPoinBut(struct uiBlock *block,
|
||||
void *idpp, char *tip);
|
||||
|
||||
typedef uiBlock* (*uiBlockFuncFP) (void *arg1);
|
||||
void uiDefBlockBut(uiBlock *block, uiBlockFuncFP func, void *func_arg1, char *str, short x1, short y1, short x2, short y2, char *tip);
|
||||
uiBut *uiDefBlockBut(uiBlock *block, uiBlockFuncFP func, void *func_arg1, char *str, short x1, short y1, short x2, short y2, char *tip);
|
||||
|
||||
void uiDefIconBlockBut(uiBlock *block, uiBlockFuncFP func, void *func_arg1, int icon, short x1, short y1, short x2, short y2, char *tip);
|
||||
void uiDefIconTextBlockBut(uiBlock *block, uiBlockFuncFP func, void *arg, int icon, char *str, short x1, short y1, short x2, short y2, char *tip);
|
||||
uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockFuncFP func, void *arg, int icon, char *str, short x1, short y1, short x2, short y2, char *tip);
|
||||
|
||||
void uiDefKeyevtButS(uiBlock *block, int retval, char *str, short x1, short y1, short x2, short y2, short *spoin, char *tip);
|
||||
|
||||
@@ -124,12 +123,14 @@ void* uiBlockGetCurFont (uiBlock *block);
|
||||
void uiBlockSetCol (uiBlock *block, int col);
|
||||
void uiBlockSetEmboss (uiBlock *block, int emboss);
|
||||
void uiBlockSetDirection (uiBlock *block, int direction);
|
||||
void uiBlockFlipOrder (uiBlock *block);
|
||||
void uiBlockSetFlag (uiBlock *block, int flag);
|
||||
void uiBlockSetXOfs (uiBlock *block, int xofs);
|
||||
|
||||
int uiButGetRetVal (uiBut *but);
|
||||
|
||||
void uiButSetFlag (uiBut *but, int flag);
|
||||
void uiButClearFlag (uiBut *but, int flag);
|
||||
|
||||
void uiBlockSetButmFunc (uiBlock *block, void (*butmfunc)(void *arg, int but_a2), void *arg);
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2469,8 +2469,8 @@ static void ui_positionblock(uiBlock *block, uiBut *but)
|
||||
block->minx-= 2.0; block->miny-= 2.0;
|
||||
block->maxx+= 2.0; block->maxy+= 2.0;
|
||||
|
||||
xsize= block->maxx - block->minx;
|
||||
ysize= block->maxy - block->miny;
|
||||
xsize= block->maxx - block->minx+4; // 4 for shadow
|
||||
ysize= block->maxy - block->miny+4;
|
||||
|
||||
if(but) {
|
||||
rctf butrct;
|
||||
@@ -2503,16 +2503,20 @@ static void ui_positionblock(uiBlock *block, uiBut *but)
|
||||
if(dir1==UI_LEFT || dir1==UI_RIGHT) dir2= UI_DOWN;
|
||||
if(dir1==UI_TOP || dir1==UI_DOWN) dir2= UI_LEFT;
|
||||
|
||||
/* no space at all? dont change */
|
||||
if(left || right) {
|
||||
if(dir1==UI_LEFT && left==0) dir1= UI_RIGHT;
|
||||
if(dir1==UI_RIGHT && right==0) dir1= UI_LEFT;
|
||||
/* this is aligning, not append! */
|
||||
if(dir2==UI_LEFT && right==0) dir2= UI_RIGHT;
|
||||
if(dir2==UI_RIGHT && left==0) dir2= UI_LEFT;
|
||||
|
||||
}
|
||||
if(down || top) {
|
||||
if(dir1==UI_TOP && top==0) dir1= UI_DOWN;
|
||||
if(dir1==UI_DOWN && down==0) dir1= UI_TOP;
|
||||
if(dir2==UI_TOP && top==0) dir2= UI_DOWN;
|
||||
if(dir2==UI_DOWN && down==0) dir2= UI_TOP;
|
||||
}
|
||||
|
||||
if(dir1==UI_LEFT) {
|
||||
xof= but->x1 - block->maxx;
|
||||
@@ -5579,6 +5583,25 @@ void uiBlockSetDirection(uiBlock *block, int direction)
|
||||
{
|
||||
block->direction= direction;
|
||||
}
|
||||
void uiBlockFlipOrder(uiBlock *block)
|
||||
{
|
||||
uiBut *but;
|
||||
float centy, miny=10000, maxy= -10000;
|
||||
|
||||
for(but= block->buttons.first; but; but= but->next) {
|
||||
if(but->y1 < miny) miny= but->y1;
|
||||
if(but->y2 > maxy) maxy= but->y2;
|
||||
}
|
||||
/* mirror trick */
|
||||
centy= (miny+maxy)/2.0;
|
||||
for(but= block->buttons.first; but; but= but->next) {
|
||||
but->y1 = centy-(but->y1-centy);
|
||||
but->y2 = centy-(but->y2-centy);
|
||||
SWAP(float, but->y1, but->y2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void uiBlockSetFlag(uiBlock *block, int flag)
|
||||
{
|
||||
block->flag= flag;
|
||||
@@ -5596,6 +5619,10 @@ void uiButSetFlag(uiBut *but, int flag)
|
||||
{
|
||||
but->flag|= flag;
|
||||
}
|
||||
void uiButClearFlag(uiBut *but, int flag)
|
||||
{
|
||||
but->flag&= ~flag;
|
||||
}
|
||||
|
||||
int uiButGetRetVal(uiBut *but)
|
||||
{
|
||||
@@ -5630,15 +5657,16 @@ void uiDefIDPoinBut(uiBlock *block, uiIDPoinFuncFP func, int retval, char *str,
|
||||
ui_check_but(but);
|
||||
}
|
||||
|
||||
void uiDefBlockBut(uiBlock *block, uiBlockFuncFP func, void *arg, char *str, short x1, short y1, short x2, short y2, char *tip)
|
||||
uiBut *uiDefBlockBut(uiBlock *block, uiBlockFuncFP func, void *arg, char *str, short x1, short y1, short x2, short y2, char *tip)
|
||||
{
|
||||
uiBut *but= ui_def_but(block, BLOCK, 0, str, x1, y1, x2, y2, arg, 0.0, 0.0, 0.0, 0.0, tip);
|
||||
but->block_func= func;
|
||||
ui_check_but(but);
|
||||
return but;
|
||||
}
|
||||
|
||||
/* Block button containing both string label and icon */
|
||||
void uiDefIconTextBlockBut(uiBlock *block, uiBlockFuncFP func, void *arg, int icon, char *str, short x1, short y1, short x2, short y2, char *tip)
|
||||
uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockFuncFP func, void *arg, int icon, char *str, short x1, short y1, short x2, short y2, char *tip)
|
||||
{
|
||||
uiBut *but= ui_def_but(block, BLOCK, 0, str, x1, y1, x2, y2, arg, 0.0, 0.0, 0.0, 0.0, tip);
|
||||
|
||||
@@ -5650,6 +5678,8 @@ void uiDefIconTextBlockBut(uiBlock *block, uiBlockFuncFP func, void *arg, int ic
|
||||
|
||||
but->block_func= func;
|
||||
ui_check_but(but);
|
||||
|
||||
return but;
|
||||
}
|
||||
|
||||
void uiDefKeyevtButS(uiBlock *block, int retval, char *str, short x1, short y1, short x2, short y2, short *spoin, char *tip)
|
||||
|
||||
@@ -2167,13 +2167,13 @@ void extern_set_butspace(int fkey)
|
||||
|
||||
sbuts= sa->spacedata.first;
|
||||
|
||||
if(fkey==F4KEY) sbuts->mainb= BUTS_LAMP;
|
||||
else if(fkey==F5KEY) sbuts->mainb= BUTS_MAT;
|
||||
else if(fkey==F6KEY) sbuts->mainb= BUTS_TEX;
|
||||
else if(fkey==F7KEY) sbuts->mainb= BUTS_ANIM;
|
||||
else if(fkey==F8KEY) sbuts->mainb= BUTS_GAME;
|
||||
else if(fkey==F9KEY) sbuts->mainb= BUTS_EDIT;
|
||||
else if(fkey==F10KEY) sbuts->mainb= BUTS_RENDER;
|
||||
if(fkey==F4KEY) sbuts->mainb= CONTEXT_LOGIC;
|
||||
else if(fkey==F5KEY) sbuts->mainb= CONTEXT_SHADING;
|
||||
else if(fkey==F6KEY) sbuts->mainb= CONTEXT_SCRIPT;
|
||||
else if(fkey==F7KEY) sbuts->mainb= CONTEXT_TYPES;
|
||||
else if(fkey==F8KEY) sbuts->mainb= CONTEXT_OBJECT;
|
||||
else if(fkey==F9KEY) sbuts->mainb= CONTEXT_EDITING;
|
||||
else if(fkey==F10KEY) sbuts->mainb= CONTEXT_SCENE;
|
||||
|
||||
scrarea_queue_headredraw(sa);
|
||||
scrarea_queue_winredraw(sa);
|
||||
|
||||
Reference in New Issue
Block a user