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:
authorMaxime Curioni <maxime.curioni@gmail.com>2008-05-08 23:16:40 +0400
committerMaxime Curioni <maxime.curioni@gmail.com>2008-05-08 23:16:40 +0400
commit64e4a3ec9aed6c8abe095e2cd1fe1552f7cde51c (patch)
tree6c77358bd447b6c2d215324ef48fc12d1f5ae5ca /source/blender/src/interface.c
parentcf2e1e2857cfc5b3c2848c7fc6c9d919ac72fabb (diff)
parent106974a9d2d5caa5188322507980e3d57d2e3517 (diff)
soc-2008-mxcurioni: merged changes to revision 14747, cosmetic changes for source/blender/freestyle
Diffstat (limited to 'source/blender/src/interface.c')
-rw-r--r--source/blender/src/interface.c60
1 files changed, 39 insertions, 21 deletions
diff --git a/source/blender/src/interface.c b/source/blender/src/interface.c
index fb5b5e2f187..7af6b67bfa3 100644
--- a/source/blender/src/interface.c
+++ b/source/blender/src/interface.c
@@ -472,7 +472,7 @@ static int ui_but_copy_paste(uiBut *but, char mode)
if(mode=='v' && but->lock) return 0;
poin= but->poin;
- if ELEM3(but->type, NUM, NUMSLI, HSVSLI) {
+ if ELEM4(but->type, NUM, NUMABS, NUMSLI, HSVSLI) {
if(poin==NULL);
else if(mode=='c') {
@@ -2100,7 +2100,8 @@ static int ui_act_as_text_but(uiBut *but)
}
if(but->pointype!=FLO) value= (int)value;
-
+
+ if(but->type==NUMABS) value= fabs(value);
if(value<min) value= min;
if(value>max) value= max;
@@ -2328,6 +2329,7 @@ static int ui_do_but_ICONROW(uiBut *but)
ListBase listb= {NULL, NULL};
uiBlock *block;
int a;
+ short event;
but->flag |= UI_SELECT;
ui_draw_but(but);
@@ -2348,13 +2350,17 @@ static int ui_do_but_ICONROW(uiBut *but)
this is needs better implementation */
block->win= G.curscreen->mainwin;
- uiDoBlocks(&listb, 0, 1);
+ event= uiDoBlocks(&listb, 0, 1);
but->flag &= ~UI_SELECT;
ui_check_but(but);
ui_draw_but(but);
-
- return but->retval;
+
+ if (event & UI_RETURN_OK) {
+ return but->retval;
+ } else {
+ return 0;
+ }
}
static int ui_do_but_ICONTEXTROW(uiBut *but)
@@ -2363,7 +2369,7 @@ static int ui_do_but_ICONTEXTROW(uiBut *but)
ListBase listb={NULL, NULL};
int width, a, xmax, ypos;
MenuData *md;
-
+ short event;
but->flag |= UI_SELECT;
ui_draw_but(but);
ui_block_flush_back(but->block); // flush because this button creates own blocks loop
@@ -2421,7 +2427,7 @@ static int ui_do_but_ICONTEXTROW(uiBut *but)
uiBoundsBlock(block, 3);
- uiDoBlocks(&listb, 0, 1);
+ event = uiDoBlocks(&listb, 0, 1);
menudata_free(md);
@@ -2429,10 +2435,12 @@ static int ui_do_but_ICONTEXTROW(uiBut *but)
ui_check_but(but);
ui_draw_but(but);
- uibut_do_func(but);
-
- return but->retval;
-
+ if (event & UI_RETURN_OK) {
+ uibut_do_func(but);
+ return but->retval;
+ } else {
+ return 0;
+ }
}
static int ui_do_but_IDPOIN(uiBut *but)
@@ -3927,6 +3935,7 @@ static int ui_do_button(uiBlock *block, uiBut *but, uiEvent *uevent)
break;
case NUM:
+ case NUMABS:
if(uevent->val) retval= ui_do_but_NUM(but);
break;
@@ -4246,13 +4255,13 @@ static void ui_but_next_edittext(uiBlock *block)
but->flag &= ~(UI_ACTIVE|UI_SELECT);
for(but= actbut->next; but; but= but->next) {
- if(ELEM4(but->type, TEX, NUM, NUMSLI, HSVSLI)) {
+ if(ELEM5(but->type, TEX, NUM, NUMABS, NUMSLI, HSVSLI)) {
but->flag |= UI_ACTIVE;
return;
}
}
for(but= block->buttons.first; but!=actbut; but= but->next) {
- if(ELEM4(but->type, TEX, NUM, NUMSLI, HSVSLI)) {
+ if(ELEM5(but->type, TEX, NUM, NUMABS, NUMSLI, HSVSLI)) {
but->flag |= UI_ACTIVE;
return;
}
@@ -4275,13 +4284,13 @@ static void ui_but_prev_edittext(uiBlock *block)
but->flag &= ~(UI_ACTIVE|UI_SELECT);
for(but= actbut->prev; but; but= but->prev) {
- if(ELEM4(but->type, TEX, NUM, NUMSLI, HSVSLI)) {
+ if(ELEM5(but->type, TEX, NUM, NUMABS, NUMSLI, HSVSLI)) {
but->flag |= UI_ACTIVE;
return;
}
}
for(but= block->buttons.last; but!=actbut; but= but->prev) {
- if(ELEM4(but->type, TEX, NUM, NUMSLI, HSVSLI)) {
+ if(ELEM5(but->type, TEX, NUM, NUMABS, NUMSLI, HSVSLI)) {
but->flag |= UI_ACTIVE;
return;
}
@@ -4636,7 +4645,7 @@ static int ui_do_block(uiBlock *block, uiEvent *uevent, int movemouse_quit)
//Really nasty... to update the num button from the same butblock
for(bt= block->buttons.first; bt; bt= bt->next)
{
- if(bt->type == NUM) {
+ if(ELEM(bt->type, NUM, NUMABS)) {
ui_check_but(bt);
ui_draw_but(bt);
}
@@ -4662,7 +4671,7 @@ static int ui_do_block(uiBlock *block, uiEvent *uevent, int movemouse_quit)
for(bt= block->buttons.first; bt; bt= bt->next)
{
- if(bt->type == NUM) {
+ if(ELEM(bt->type, NUM, NUMABS)) {
ui_check_but(bt);
ui_draw_but(bt);
}
@@ -5435,8 +5444,15 @@ void ui_check_but(uiBut *but)
case HSVSLI:
value= ui_get_but_val(but);
if(value < but->min) value= but->min;
- if(value > but->max) value= but->max;
- ui_set_but_val(but, value);
+ if(value > but->max) value= but->max;
+ ui_set_but_val(but, value);
+ break;
+
+ case NUMABS:
+ value= fabs( ui_get_but_val(but) );
+ if(value < but->min) value= but->min;
+ if(value > but->max) value= but->max;
+ ui_set_but_val(but, value);
break;
case ICONTOG:
@@ -5478,6 +5494,7 @@ void ui_check_but(uiBut *but)
case NUM:
case NUMSLI:
case HSVSLI:
+ case NUMABS:
value= ui_get_but_val(but);
@@ -5567,7 +5584,7 @@ void ui_check_but(uiBut *but)
but->ofs= 0;
while(but->strwidth > (int)okwidth ) {
- if ELEM(but->type, NUM, TEX) { // only these cut off left
+ if ELEM3(but->type, NUM, NUMABS, TEX) { // only these cut off left
but->ofs++;
but->strwidth= but->aspect*BIF_GetStringWidth(but->font, but->drawstr+but->ofs, transopts);
@@ -5611,6 +5628,7 @@ static int ui_auto_themecol(uiBut *but)
case SLI:
case NUM:
case NUMSLI:
+ case NUMABS:
case HSVSLI:
return TH_BUT_NUM;
case TEX:
@@ -5887,7 +5905,7 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, char *str, short
but->pos= -1; /* cursor invisible */
- if(but->type==NUM) { /* add a space to name */
+ if(ELEM(but->type, NUM, NUMABS)) { /* add a space to name */
slen= strlen(but->str);
if(slen>0 && slen<UI_MAX_NAME_STR-2) {
if(but->str[slen-1]!=' ') {