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:
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r--source/blender/editors/interface/interface.c792
-rw-r--r--source/blender/editors/interface/interface_draw.c170
-rw-r--r--source/blender/editors/interface/interface_handlers.c1676
-rw-r--r--source/blender/editors/interface/interface_icons.c104
-rw-r--r--source/blender/editors/interface/interface_layout.c536
-rw-r--r--source/blender/editors/interface/interface_ops.c46
-rw-r--r--source/blender/editors/interface/interface_panel.c410
-rw-r--r--source/blender/editors/interface/interface_regions.c549
-rw-r--r--source/blender/editors/interface/interface_style.c28
-rw-r--r--source/blender/editors/interface/interface_templates.c452
-rw-r--r--source/blender/editors/interface/interface_utils.c40
-rw-r--r--source/blender/editors/interface/interface_widgets.c382
-rw-r--r--source/blender/editors/interface/resources.c156
-rw-r--r--source/blender/editors/interface/view2d.c90
-rw-r--r--source/blender/editors/interface/view2d_ops.c10
15 files changed, 2737 insertions, 2704 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 229a9dea471..b9002648709 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -107,7 +107,7 @@ void ui_block_to_window_fl(const ARegion *ar, uiBlock *block, float *x, float *y
gx= *x;
gy= *y;
- if(block->panel) {
+ if (block->panel) {
gx += block->panel->ofsx;
gy += block->panel->ofsy;
}
@@ -167,7 +167,7 @@ void ui_window_to_block_fl(const ARegion *ar, uiBlock *block, float *x, float *y
*y= (a*(py-f) + d*(c-px))/(a*e-d*b);
*x= (px- b*(*y)- c)/a;
- if(block->panel) {
+ if (block->panel) {
*x -= block->panel->ofsx;
*y -= block->panel->ofsy;
}
@@ -198,7 +198,7 @@ void ui_block_translate(uiBlock *block, int x, int y)
{
uiBut *bt;
- for(bt= block->buttons.first; bt; bt=bt->next) {
+ for (bt= block->buttons.first; bt; bt=bt->next) {
bt->x1 += x;
bt->y1 += y;
bt->x2 += x;
@@ -220,21 +220,21 @@ static void ui_text_bounds_block(uiBlock *block, float offset)
uiStyleFontSet(&style->widget);
- for(bt= block->buttons.first; bt; bt= bt->next) {
- if(bt->type!=SEPR) {
+ for (bt= block->buttons.first; bt; bt= bt->next) {
+ if (bt->type!=SEPR) {
j= BLF_width(style->widget.uifont_id, bt->drawstr);
- if(j > i) i = j;
+ if (j > i) i = j;
}
- if(bt->next && bt->x1 < bt->next->x1)
+ if (bt->next && bt->x1 < bt->next->x1)
lastcol++;
}
/* cope with multi collumns */
bt= block->buttons.first;
- while(bt) {
- if(bt->next && bt->x1 < bt->next->x1) {
+ while (bt) {
+ if (bt->next && bt->x1 < bt->next->x1) {
nextcol= 1;
col++;
}
@@ -243,12 +243,12 @@ static void ui_text_bounds_block(uiBlock *block, float offset)
bt->x1 = x1addval;
bt->x2 = bt->x1 + i + block->bounds;
- if(col == lastcol)
+ if (col == lastcol)
bt->x2= MAX2(bt->x2, offset + block->minbounds);
ui_check_but(bt); // clips text again
- if(nextcol)
+ if (nextcol)
x1addval+= i + block->bounds;
bt= bt->next;
@@ -260,8 +260,8 @@ void ui_bounds_block(uiBlock *block)
uiBut *bt;
int xof;
- if(block->buttons.first==NULL) {
- if(block->panel) {
+ if (block->buttons.first==NULL) {
+ if (block->panel) {
block->minx= 0.0; block->maxx= block->panel->sizex;
block->miny= 0.0; block->maxy= block->panel->sizey;
}
@@ -272,12 +272,12 @@ void ui_bounds_block(uiBlock *block)
block->maxx= block->maxy= -10000;
bt= block->buttons.first;
- while(bt) {
- if(bt->x1 < block->minx) block->minx= bt->x1;
- if(bt->y1 < block->miny) block->miny= bt->y1;
+ while (bt) {
+ if (bt->x1 < block->minx) block->minx= bt->x1;
+ if (bt->y1 < block->miny) block->miny= bt->y1;
- if(bt->x2 > block->maxx) block->maxx= bt->x2;
- if(bt->y2 > block->maxy) block->maxy= bt->y2;
+ if (bt->x2 > block->maxx) block->maxx= bt->x2;
+ if (bt->y2 > block->maxy) block->maxy= bt->y2;
bt= bt->next;
}
@@ -292,7 +292,7 @@ void ui_bounds_block(uiBlock *block)
/* hardcoded exception... but that one is annoying with larger safety */
bt= block->buttons.first;
- if(bt && strncmp(bt->str, "ERROR", 5)==0) xof= 10;
+ if (bt && strncmp(bt->str, "ERROR", 5)==0) xof= 10;
else xof= 40;
block->safety.xmin = block->minx-xof;
@@ -345,8 +345,8 @@ static void ui_popup_bounds_block(const bContext *C, uiBlock *block, int bounds_
oldheight= block->maxy - block->miny;
/* first we ensure wide enough text bounds */
- if(bounds_calc==UI_BLOCK_BOUNDS_POPUP_MENU) {
- if(block->flag & UI_BLOCK_LOOP) {
+ if (bounds_calc==UI_BLOCK_BOUNDS_POPUP_MENU) {
+ if (block->flag & UI_BLOCK_LOOP) {
block->bounds= 50;
ui_text_bounds_block(block, block->minx);
}
@@ -369,19 +369,19 @@ static void ui_popup_bounds_block(const bContext *C, uiBlock *block, int bounds_
startx= window->eventstate->x + block->minx + (block->mx*width)/oldwidth;
starty= window->eventstate->y + block->miny + (block->my*height)/oldheight;
- if(startx<10)
+ if (startx<10)
startx= 10;
- if(starty<10)
+ if (starty<10)
starty= 10;
endx= startx+width;
endy= starty+height;
- if(endx>xmax) {
+ if (endx>xmax) {
endx= xmax-10;
startx= endx-width;
}
- if(endy>ymax-20) {
+ if (endy>ymax-20) {
endy= ymax-20;
starty= endy-height;
}
@@ -395,7 +395,7 @@ static void ui_popup_bounds_block(const bContext *C, uiBlock *block, int bounds_
/* used for various cases */
void uiBoundsBlock(uiBlock *block, int addval)
{
- if(block==NULL)
+ if (block==NULL)
return;
block->bounds= addval;
@@ -452,7 +452,7 @@ static int ui_but_float_precision(uiBut *but, double value)
int prec;
/* first check if prec is 0 and fallback to a simple default */
- if((prec= (int)but->a2) == 0) {
+ if ((prec= (int)but->a2) == 0) {
prec= (but->hardmax < 10.001f) ? 3 : 2;
}
@@ -460,16 +460,16 @@ static int ui_but_float_precision(uiBut *but, double value)
* the number, this is so 0.00001 is not displayed as 0.00,
* _but_, this is only for small values si 10.0001 will not get
* the same treatment */
- if(value != 0.0 && (value= ABS(value)) < 0.1) {
+ if (value != 0.0 && (value= ABS(value)) < 0.1) {
int value_i= (int)((value * PRECISION_FLOAT_MAX_POW) + 0.5);
- if(value_i != 0) {
+ if (value_i != 0) {
const int prec_span= 3; /* show: 0.01001, 5 would allow 0.0100001 for eg. */
int test_prec;
int prec_min= -1;
int dec_flag= 0;
int i= PRECISION_FLOAT_MAX;
- while(i && value_i) {
- if(value_i % 10) {
+ while (i && value_i) {
+ if (value_i % 10) {
dec_flag |= 1<<i;
prec_min= i;
}
@@ -482,12 +482,12 @@ static int ui_but_float_precision(uiBut *but, double value)
dec_flag= (dec_flag >> (prec_min + 1)) & ((1 << prec_span) - 1);
- while(dec_flag) {
+ while (dec_flag) {
test_prec++;
dec_flag = dec_flag >> 1;
}
- if(test_prec > prec) {
+ if (test_prec > prec) {
prec= test_prec;
}
}
@@ -502,14 +502,14 @@ static void ui_draw_linkline(uiLinkLine *line)
{
rcti rect;
- if(line->from==NULL || line->to==NULL) return;
+ if (line->from==NULL || line->to==NULL) return;
rect.xmin = (line->from->x1+line->from->x2)/2.0f;
rect.ymin = (line->from->y1+line->from->y2)/2.0f;
rect.xmax = (line->to->x1+line->to->x2)/2.0f;
rect.ymax = (line->to->y1+line->to->y2)/2.0f;
- if(line->flag & UI_SELECT)
+ if (line->flag & UI_SELECT)
glColor3ub(100,100,100);
else
glColor3ub(0,0,0);
@@ -523,10 +523,10 @@ static void ui_draw_links(uiBlock *block)
uiLinkLine *line;
but= block->buttons.first;
- while(but) {
- if(but->type==LINK && but->link) {
+ while (but) {
+ if (but->type==LINK && but->link) {
line= but->link->lines.first;
- while(line) {
+ while (line) {
ui_draw_linkline(line);
line= line->next;
}
@@ -542,16 +542,16 @@ static int ui_but_equals_old(uiBut *but, uiBut *oldbut)
{
/* various properties are being compared here, hopefully sufficient
* to catch all cases, but it is simple to add more checks later */
- if(but->retval != oldbut->retval) return 0;
- if(but->rnapoin.data != oldbut->rnapoin.data) return 0;
- if(but->rnaprop != oldbut->rnaprop)
- if(but->rnaindex != oldbut->rnaindex) return 0;
- if(but->func != oldbut->func) return 0;
- if(but->funcN != oldbut->funcN) return 0;
- if(oldbut->func_arg1 != oldbut && but->func_arg1 != oldbut->func_arg1) return 0;
- if(oldbut->func_arg2 != oldbut && but->func_arg2 != oldbut->func_arg2) return 0;
- if(!but->funcN && ((but->poin != oldbut->poin && (uiBut*)oldbut->poin != oldbut) || but->pointype != oldbut->pointype)) return 0;
- if(but->optype != oldbut->optype) return 0;
+ if (but->retval != oldbut->retval) return 0;
+ if (but->rnapoin.data != oldbut->rnapoin.data) return 0;
+ if (but->rnaprop != oldbut->rnaprop)
+ if (but->rnaindex != oldbut->rnaindex) return 0;
+ if (but->func != oldbut->func) return 0;
+ if (but->funcN != oldbut->funcN) return 0;
+ if (oldbut->func_arg1 != oldbut && but->func_arg1 != oldbut->func_arg1) return 0;
+ if (oldbut->func_arg2 != oldbut && but->func_arg2 != oldbut->func_arg2) return 0;
+ if (!but->funcN && ((but->poin != oldbut->poin && (uiBut*)oldbut->poin != oldbut) || but->pointype != oldbut->pointype)) return 0;
+ if (but->optype != oldbut->optype) return 0;
return 1;
}
@@ -563,25 +563,25 @@ static void ui_but_update_linklines(uiBlock *block, uiBut *oldbut, uiBut *newbut
uiBut *but;
/* if active button is LINK */
- if(newbut->type==LINK && newbut->link) {
+ if (newbut->type==LINK && newbut->link) {
SWAP(uiLink *, oldbut->link, newbut->link);
- for(line= oldbut->link->lines.first; line; line= line->next) {
- if(line->to==newbut)
+ for (line= oldbut->link->lines.first; line; line= line->next) {
+ if (line->to==newbut)
line->to= oldbut;
- if(line->from==newbut)
+ if (line->from==newbut)
line->from= oldbut;
}
}
/* check all other button links */
- for(but= block->buttons.first; but; but= but->next) {
- if(but!=newbut && but->type==LINK && but->link) {
- for(line= but->link->lines.first; line; line= line->next) {
- if(line->to==newbut)
+ for (but= block->buttons.first; but; but= but->next) {
+ if (but!=newbut && but->type==LINK && but->link) {
+ for (line= but->link->lines.first; line; line= line->next) {
+ if (line->to==newbut)
line->to= oldbut;
- if(line->from==newbut)
+ if (line->from==newbut)
line->from= oldbut;
}
}
@@ -595,12 +595,12 @@ static int ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBut
int found= 0;
oldblock= block->oldblock;
- if(!oldblock)
+ if (!oldblock)
return found;
- for(oldbut=oldblock->buttons.first; oldbut; oldbut=oldbut->next) {
- if(ui_but_equals_old(oldbut, but)) {
- if(oldbut->active) {
+ for (oldbut=oldblock->buttons.first; oldbut; oldbut=oldbut->next) {
+ if (ui_but_equals_old(oldbut, but)) {
+ if (oldbut->active) {
#if 0
// but->flag= oldbut->flag;
#else
@@ -638,14 +638,14 @@ static int ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBut
/* typically the same pointers, but not on undo/redo */
/* XXX some menu buttons store button itself in but->poin. Ugly */
- if(oldbut->poin != (char *)oldbut) {
+ if (oldbut->poin != (char *)oldbut) {
SWAP(char *, oldbut->poin, but->poin)
SWAP(void *, oldbut->func_argN, but->func_argN)
}
/* copy hardmin for list rows to prevent 'sticking' highlight to mouse position
* when scrolling without moving mouse (see [#28432]) */
- if(ELEM(oldbut->type, ROW, LISTROW))
+ if (ELEM(oldbut->type, ROW, LISTROW))
oldbut->hardmax= but->hardmax;
ui_but_update_linklines(block, oldbut, but);
@@ -679,24 +679,24 @@ int uiButActiveOnly(const bContext *C, uiBlock *block, uiBut *but)
int activate= 0, found= 0, isactive= 0;
oldblock= block->oldblock;
- if(!oldblock)
+ if (!oldblock)
activate= 1;
else {
- for(oldbut=oldblock->buttons.first; oldbut; oldbut=oldbut->next) {
- if(ui_but_equals_old(oldbut, but)) {
+ for (oldbut=oldblock->buttons.first; oldbut; oldbut=oldbut->next) {
+ if (ui_but_equals_old(oldbut, but)) {
found= 1;
- if(oldbut->active)
+ if (oldbut->active)
isactive= 1;
break;
}
}
}
- if(activate || found==0) {
+ if (activate || found==0) {
ui_button_activate_do( (bContext *)C, CTX_wm_region(C), but);
}
- else if(found && isactive==0) {
+ else if (found && isactive==0) {
BLI_remlink(&block->buttons, but);
ui_free_but(C, but);
@@ -710,13 +710,13 @@ int uiButActiveOnly(const bContext *C, uiBlock *block, uiBut *but)
* returns FALSE if undo needs to be disabled. */
static int ui_but_is_rna_undo(uiBut *but)
{
- if(but->rnapoin.id.data) {
+ if (but->rnapoin.id.data) {
/* avoid undo push for buttons who's ID are screen or wm level
* we could disable undo for buttons with no ID too but may have
* unforeseen consequences, so best check for ID's we _know_ are not
* handled by undo - campbell */
ID *id= but->rnapoin.id.data;
- if(ID_CHECK_UNDO(id) == FALSE) {
+ if (ID_CHECK_UNDO(id) == FALSE) {
return FALSE;
}
else {
@@ -743,32 +743,32 @@ static void ui_menu_block_set_keyaccels(uiBlock *block)
int tot_missing= 0;
/* only do it before bounding */
- if(block->minx != block->maxx)
+ if (block->minx != block->maxx)
return;
- for(pass=0; pass<2; pass++) {
+ for (pass=0; pass<2; pass++) {
/* 2 Passes, on for first letter only, second for any letter if first fails
* fun first pass on all buttons so first word chars always get first priority */
- for(but=block->buttons.first; but; but=but->next) {
- if(!ELEM4(but->type, BUT, MENU, BLOCK, PULLDOWN) || (but->flag & UI_HIDDEN)) {
+ for (but=block->buttons.first; but; but=but->next) {
+ if (!ELEM4(but->type, BUT, MENU, BLOCK, PULLDOWN) || (but->flag & UI_HIDDEN)) {
/* pass */
}
- else if(but->menu_key=='\0') {
- if(but->str) {
- for(str_pt= but->str; *str_pt; ) {
+ else if (but->menu_key=='\0') {
+ if (but->str) {
+ for (str_pt= but->str; *str_pt; ) {
menu_key= tolower(*str_pt);
- if((menu_key >= 'a' && menu_key <= 'z') && !(menu_key_mask & 1<<(menu_key-'a'))) {
+ if ((menu_key >= 'a' && menu_key <= 'z') && !(menu_key_mask & 1<<(menu_key-'a'))) {
menu_key_mask |= 1<<(menu_key-'a');
break;
}
- if(pass==0) {
+ if (pass==0) {
/* Skip to next delimiter on first pass (be picky) */
- while(isalpha(*str_pt))
+ while (isalpha(*str_pt))
str_pt++;
- if(*str_pt)
+ if (*str_pt)
str_pt++;
}
else {
@@ -777,7 +777,7 @@ static void ui_menu_block_set_keyaccels(uiBlock *block)
}
}
- if(*str_pt) {
+ if (*str_pt) {
but->menu_key= menu_key;
}
else {
@@ -786,7 +786,7 @@ static void ui_menu_block_set_keyaccels(uiBlock *block)
}
/* if all keys have been used just exit, unlikely */
- if(menu_key_mask == (1<<26)-1) {
+ if (menu_key_mask == (1<<26)-1) {
return;
}
}
@@ -794,7 +794,7 @@ static void ui_menu_block_set_keyaccels(uiBlock *block)
}
/* check if second pass is needed */
- if(!tot_missing) {
+ if (!tot_missing) {
break;
}
}
@@ -808,7 +808,7 @@ void ui_but_add_shortcut(uiBut *but, const char *shortcut_str, const short do_st
if (do_strip) {
char *cpoin= strchr(but->str, '|');
- if(cpoin) {
+ if (cpoin) {
*cpoin= '\0';
}
}
@@ -844,14 +844,14 @@ static void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block)
IDProperty *prop_menu_name= NULL;
/* only do it before bounding */
- if(block->minx != block->maxx)
+ if (block->minx != block->maxx)
return;
- for(but=block->buttons.first; but; but=but->next) {
- if(but->optype) {
+ for (but=block->buttons.first; but; but=but->next) {
+ if (but->optype) {
IDProperty *prop= (but->opptr)? but->opptr->data: NULL;
- if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, TRUE,
+ if (WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, TRUE,
buf, sizeof(buf)))
{
ui_but_add_shortcut(but, buf, FALSE);
@@ -868,7 +868,7 @@ static void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block)
IDP_AssignString(prop_menu_name, mt->idname, sizeof(mt->idname));
- if(WM_key_event_operator_string(C, "WM_OT_call_menu", WM_OP_INVOKE_REGION_WIN, prop_menu, FALSE,
+ if (WM_key_event_operator_string(C, "WM_OT_call_menu", WM_OP_INVOKE_REGION_WIN, prop_menu, FALSE,
buf, sizeof(buf)))
{
ui_but_add_shortcut(but, buf, FALSE);
@@ -894,30 +894,30 @@ void uiEndBlock(const bContext *C, uiBlock *block)
* on matching buttons, we need this to make button event handling non
* blocking, while still allowing buttons to be remade each redraw as it
* is expected by blender code */
- for(but=block->buttons.first; but; but=but->next) {
- if(ui_but_update_from_old_block(C, block, &but))
+ for (but=block->buttons.first; but; but=but->next) {
+ if (ui_but_update_from_old_block(C, block, &but))
ui_check_but(but);
/* temp? Proper check for greying out */
- if(but->optype) {
+ if (but->optype) {
wmOperatorType *ot= but->optype;
- if(but->context)
+ if (but->context)
CTX_store_set((bContext*)C, but->context);
- if(ot == NULL || WM_operator_poll_context((bContext*)C, ot, but->opcontext)==0) {
+ if (ot == NULL || WM_operator_poll_context((bContext*)C, ot, but->opcontext)==0) {
but->flag |= UI_BUT_DISABLED;
but->lock = 1;
}
- if(but->context)
+ if (but->context)
CTX_store_set((bContext*)C, NULL);
}
ui_but_anim_flag(but, (scene)? scene->r.cfra: 0.0f);
}
- if(block->oldblock) {
+ if (block->oldblock) {
block->auto_open= block->oldblock->auto_open;
block->auto_open_last= block->oldblock->auto_open_last;
block->tooltipdisabled= block->oldblock->tooltipdisabled;
@@ -926,21 +926,21 @@ void uiEndBlock(const bContext *C, uiBlock *block)
}
/* handle pending stuff */
- if(block->layouts.first) uiBlockLayoutResolve(block, NULL, NULL);
+ if (block->layouts.first) uiBlockLayoutResolve(block, NULL, NULL);
ui_block_do_align(block);
- if((block->flag & UI_BLOCK_LOOP) && (block->flag & UI_BLOCK_NUMSELECT)) {
+ if ((block->flag & UI_BLOCK_LOOP) && (block->flag & UI_BLOCK_NUMSELECT)) {
ui_menu_block_set_keyaccels(block); /* could use a different flag to check */
}
- if(block->flag & UI_BLOCK_LOOP) ui_menu_block_set_keymaps(C, block);
+ if (block->flag & UI_BLOCK_LOOP) ui_menu_block_set_keymaps(C, block);
/* after keymaps! */
- if(block->dobounds == UI_BLOCK_BOUNDS) ui_bounds_block(block);
- else if(block->dobounds == UI_BLOCK_BOUNDS_TEXT) ui_text_bounds_block(block, 0.0f);
- else if(block->dobounds == UI_BLOCK_BOUNDS_POPUP_CENTER) ui_centered_bounds_block(C, block);
- else if(block->dobounds) ui_popup_bounds_block(C, block, block->dobounds);
+ if (block->dobounds == UI_BLOCK_BOUNDS) ui_bounds_block(block);
+ else if (block->dobounds == UI_BLOCK_BOUNDS_TEXT) ui_text_bounds_block(block, 0.0f);
+ else if (block->dobounds == UI_BLOCK_BOUNDS_POPUP_CENTER) ui_centered_bounds_block(C, block);
+ else if (block->dobounds) ui_popup_bounds_block(C, block, block->dobounds);
- if(block->minx==0.0f && block->maxx==0.0f) uiBoundsBlock(block, 0);
- if(block->flag & UI_BUT_ALIGN) uiBlockEndAlign(block);
+ if (block->minx==0.0f && block->maxx==0.0f) uiBoundsBlock(block, 0);
+ if (block->flag & UI_BUT_ALIGN) uiBlockEndAlign(block);
block->endblock= 1;
}
@@ -949,14 +949,14 @@ void uiEndBlock(const bContext *C, uiBlock *block)
void ui_fontscale(short *points, float aspect)
{
- if(aspect < 0.9f || aspect > 1.1f) {
+ if (aspect < 0.9f || aspect > 1.1f) {
float pointsf= *points;
/* for some reason scaling fonts goes too fast compared to widget size */
aspect= sqrt(aspect);
pointsf /= aspect;
- if(aspect > 1.0f)
+ if (aspect > 1.0f)
*points= ceilf(pointsf);
else
*points= floorf(pointsf);
@@ -997,15 +997,15 @@ void uiDrawBlock(const bContext *C, uiBlock *block)
/* get menu region or area region */
ar= CTX_wm_menu(C);
- if(!ar)
+ if (!ar)
ar= CTX_wm_region(C);
- if(!block->endblock)
+ if (!block->endblock)
uiEndBlock(C, block);
/* disable AA, makes widgets too blurry */
multisample_enabled= glIsEnabled(GL_MULTISAMPLE_ARB);
- if(multisample_enabled)
+ if (multisample_enabled)
glDisable(GL_MULTISAMPLE_ARB);
/* we set this only once */
@@ -1030,19 +1030,19 @@ void uiDrawBlock(const bContext *C, uiBlock *block)
wmOrtho2(-0.01f, ar->winx-0.01f, -0.01f, ar->winy-0.01f);
/* back */
- if(block->flag & UI_BLOCK_LOOP)
+ if (block->flag & UI_BLOCK_LOOP)
ui_draw_menu_back(&style, block, &rect);
- else if(block->panel)
+ else if (block->panel)
ui_draw_aligned_panel(&style, block, &rect);
/* widgets */
- for(but= block->buttons.first; but; but= but->next) {
- if(!(but->flag & (UI_HIDDEN|UI_SCROLLED))) {
+ for (but= block->buttons.first; but; but= but->next) {
+ if (!(but->flag & (UI_HIDDEN|UI_SCROLLED))) {
ui_but_to_pixelrect(&rect, ar, block, but);
/* XXX: figure out why invalid coordinates happen when closing render window */
/* and material preview is redrawn in main window (temp fix for bug #23848) */
- if(rect.xmin < rect.xmax && rect.ymin < rect.ymax)
+ if (rect.xmin < rect.xmax && rect.ymin < rect.ymax)
ui_draw_but(C, ar, &style, but, &rect);
}
}
@@ -1053,7 +1053,7 @@ void uiDrawBlock(const bContext *C, uiBlock *block)
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
- if(multisample_enabled)
+ if (multisample_enabled)
glEnable(GL_MULTISAMPLE_ARB);
ui_draw_links(block);
@@ -1065,13 +1065,13 @@ static void ui_is_but_sel(uiBut *but, double *value)
{
short is_push=0, is_true=1;
- if(ELEM3(but->type, TOGN, ICONTOGN, OPTIONN)) is_true= 0;
+ if (ELEM3(but->type, TOGN, ICONTOGN, OPTIONN)) is_true= 0;
- if( but->bit ) {
+ if ( but->bit ) {
int lvalue;
UI_GET_BUT_VALUE_INIT(but, *value)
lvalue= (int)*value;
- if( BTST(lvalue, (but->bitnr)) ) is_push= is_true;
+ if ( BTST(lvalue, (but->bitnr)) ) is_push= is_true;
else is_push= !is_true;
}
else {
@@ -1091,23 +1091,23 @@ static void ui_is_but_sel(uiBut *but, double *value)
case ICONTOG:
case OPTION:
UI_GET_BUT_VALUE_INIT(but, *value)
- if(*value != (double)but->hardmin) is_push= 1;
+ if (*value != (double)but->hardmin) is_push= 1;
break;
case ICONTOGN:
case TOGN:
case OPTIONN:
UI_GET_BUT_VALUE_INIT(but, *value)
- if(*value==0.0) is_push= 1;
+ if (*value==0.0) is_push= 1;
break;
case ROW:
case LISTROW:
UI_GET_BUT_VALUE_INIT(but, *value)
/* support for rna enum buts */
- if(but->rnaprop && (RNA_property_flag(but->rnaprop) & PROP_ENUM_FLAG)) {
- if((int)*value & (int)but->hardmax) is_push= 1;
+ if (but->rnaprop && (RNA_property_flag(but->rnaprop) & PROP_ENUM_FLAG)) {
+ if ((int)*value & (int)but->hardmax) is_push= 1;
}
else {
- if(*value == (double)but->hardmax) is_push= 1;
+ if (*value == (double)but->hardmax) is_push= 1;
}
break;
case COL:
@@ -1119,8 +1119,8 @@ static void ui_is_but_sel(uiBut *but, double *value)
}
}
- if(is_push==2);
- else if(is_push==1) but->flag |= UI_SELECT;
+ if (is_push==2);
+ else if (is_push==1) but->flag |= UI_SELECT;
else but->flag &= ~UI_SELECT;
}
@@ -1129,9 +1129,9 @@ static uiBut *ui_find_inlink(uiBlock *block, void *poin)
uiBut *but;
but= block->buttons.first;
- while(but) {
- if(but->type==INLINK) {
- if(but->poin == poin) return but;
+ while (but) {
+ if (but->type==INLINK) {
+ if (but->poin == poin) return but;
}
but= but->next;
}
@@ -1161,24 +1161,24 @@ void uiComposeLinks(uiBlock *block)
int a;
but= block->buttons.first;
- while(but) {
- if(but->type==LINK) {
+ while (but) {
+ if (but->type==LINK) {
link= but->link;
/* for all pointers in the array */
- if(link) {
- if(link->ppoin) {
+ if (link) {
+ if (link->ppoin) {
ppoin= link->ppoin;
- for(a=0; a < *(link->totlink); a++) {
+ for (a=0; a < *(link->totlink); a++) {
bt= ui_find_inlink(block, (*ppoin)[a] );
- if(bt) {
+ if (bt) {
ui_add_link_line(&link->lines, but, bt);
}
}
}
- else if(link->poin) {
+ else if (link->poin) {
bt= ui_find_inlink(block, *(link->poin) );
- if(bt) {
+ if (bt) {
ui_add_link_line(&link->lines, but, bt);
}
}
@@ -1193,7 +1193,7 @@ void uiComposeLinks(uiBlock *block)
void uiBlockSetButLock(uiBlock *block, int val, const char *lockstr)
{
- if(val) {
+ if (val) {
block->lock= val ? 1:0;
block->lockstr= lockstr;
}
@@ -1217,18 +1217,18 @@ void ui_delete_linkline(uiLinkLine *line, uiBut *but)
link= line->from->link;
/* are there more pointers allowed? */
- if(link->ppoin) {
+ if (link->ppoin) {
- if(*(link->totlink)==1) {
+ if (*(link->totlink)==1) {
*(link->totlink)= 0;
MEM_freeN(*(link->ppoin));
*(link->ppoin)= NULL;
}
else {
b= 0;
- for(a=0; a< (*(link->totlink)); a++) {
+ for (a=0; a< (*(link->totlink)); a++) {
- if( (*(link->ppoin))[a] != line->to->poin ) {
+ if ( (*(link->ppoin))[a] != line->to->poin ) {
(*(link->ppoin))[b]= (*(link->ppoin))[a];
b++;
}
@@ -1254,30 +1254,30 @@ void ui_get_but_vectorf(uiBut *but, float vec[3])
PropertyRNA *prop;
int a, tot;
- if(but->editvec) {
+ if (but->editvec) {
copy_v3_v3(vec, but->editvec);
}
- if(but->rnaprop) {
+ if (but->rnaprop) {
prop= but->rnaprop;
vec[0]= vec[1]= vec[2]= 0.0f;
- if(RNA_property_type(prop) == PROP_FLOAT) {
+ if (RNA_property_type(prop) == PROP_FLOAT) {
tot= RNA_property_array_length(&but->rnapoin, prop);
tot= MIN2(tot, 3);
- for(a=0; a<tot; a++)
+ for (a=0; a<tot; a++)
vec[a]= RNA_property_float_get_index(&but->rnapoin, prop, a);
}
}
- else if(but->pointype == CHA) {
+ else if (but->pointype == CHA) {
char *cp= (char *)but->poin;
vec[0]= ((float)cp[0])/255.0f;
vec[1]= ((float)cp[1])/255.0f;
vec[2]= ((float)cp[2])/255.0f;
}
- else if(but->pointype == FLO) {
+ else if (but->pointype == FLO) {
float *fp= (float *)but->poin;
copy_v3_v3(vec, fp);
}
@@ -1298,14 +1298,14 @@ void ui_set_but_vectorf(uiBut *but, const float vec[3])
{
PropertyRNA *prop;
- if(but->editvec) {
+ if (but->editvec) {
copy_v3_v3(but->editvec, vec);
}
- if(but->rnaprop) {
+ if (but->rnaprop) {
prop= but->rnaprop;
- if(RNA_property_type(prop) == PROP_FLOAT) {
+ if (RNA_property_type(prop) == PROP_FLOAT) {
int tot;
int a;
@@ -1317,13 +1317,13 @@ void ui_set_but_vectorf(uiBut *but, const float vec[3])
}
}
}
- else if(but->pointype == CHA) {
+ else if (but->pointype == CHA) {
char *cp= (char *)but->poin;
cp[0]= (char)(0.5f + vec[0]*255.0f);
cp[1]= (char)(0.5f + vec[1]*255.0f);
cp[2]= (char)(0.5f + vec[2]*255.0f);
}
- else if(but->pointype == FLO) {
+ else if (but->pointype == FLO) {
float *fp= (float *)but->poin;
copy_v3_v3(fp, vec);
}
@@ -1331,10 +1331,10 @@ void ui_set_but_vectorf(uiBut *but, const float vec[3])
int ui_is_but_float(uiBut *but)
{
- if(but->pointype==FLO && but->poin)
+ if (but->pointype==FLO && but->poin)
return 1;
- if(but->rnaprop && RNA_property_type(but->rnaprop) == PROP_FLOAT)
+ if (but->rnaprop && RNA_property_type(but->rnaprop) == PROP_FLOAT)
return 1;
return 0;
@@ -1345,7 +1345,7 @@ int ui_is_but_unit(uiBut *but)
UnitSettings *unit= but->block->unit;
const int unit_type= uiButGetUnitType(but);
- if(unit_type == PROP_UNIT_NONE)
+ if (unit_type == PROP_UNIT_NONE)
return 0;
#if 1 // removed so angle buttons get correct snapping
@@ -1382,27 +1382,27 @@ double ui_get_but_val(uiBut *but)
PropertyRNA *prop;
double value = 0.0;
- if(but->editval) { return *(but->editval); }
- if(but->poin==NULL && but->rnapoin.data==NULL) return 0.0;
+ if (but->editval) { return *(but->editval); }
+ if (but->poin==NULL && but->rnapoin.data==NULL) return 0.0;
- if(but->rnaprop) {
+ if (but->rnaprop) {
prop= but->rnaprop;
switch(RNA_property_type(prop)) {
case PROP_BOOLEAN:
- if(RNA_property_array_check(prop))
+ if (RNA_property_array_check(prop))
value= RNA_property_boolean_get_index(&but->rnapoin, prop, but->rnaindex);
else
value= RNA_property_boolean_get(&but->rnapoin, prop);
break;
case PROP_INT:
- if(RNA_property_array_check(prop))
+ if (RNA_property_array_check(prop))
value= RNA_property_int_get_index(&but->rnapoin, prop, but->rnaindex);
else
value= RNA_property_int_get(&but->rnapoin, prop);
break;
case PROP_FLOAT:
- if(RNA_property_array_check(prop))
+ if (RNA_property_array_check(prop))
value= RNA_property_float_get_index(&but->rnapoin, prop, but->rnaindex);
else
value= RNA_property_float_get(&but->rnapoin, prop);
@@ -1415,7 +1415,7 @@ double ui_get_but_val(uiBut *but)
break;
}
}
- else if(but->type== HSVSLI) {
+ else if (but->type== HSVSLI) {
float h, s, v, *fp;
fp= (but->editvec)? but->editvec: (float *)but->poin;
@@ -1427,16 +1427,16 @@ double ui_get_but_val(uiBut *but)
case 'V': value= v; break;
}
}
- else if( but->pointype == CHA ) {
+ else if ( but->pointype == CHA ) {
value= *(char *)but->poin;
}
- else if( but->pointype == SHO ) {
+ else if ( but->pointype == SHO ) {
value= *(short *)but->poin;
}
- else if( but->pointype == INT ) {
+ else if ( but->pointype == INT ) {
value= *(int *)but->poin;
}
- else if( but->pointype == FLO ) {
+ else if ( but->pointype == FLO ) {
value= *(float *)but->poin;
}
@@ -1448,31 +1448,31 @@ void ui_set_but_val(uiBut *but, double value)
PropertyRNA *prop;
/* value is a hsv value: convert to rgb */
- if(but->rnaprop) {
+ if (but->rnaprop) {
prop= but->rnaprop;
- if(RNA_property_editable(&but->rnapoin, prop)) {
+ if (RNA_property_editable(&but->rnapoin, prop)) {
switch(RNA_property_type(prop)) {
case PROP_BOOLEAN:
- if(RNA_property_array_length(&but->rnapoin, prop))
+ if (RNA_property_array_length(&but->rnapoin, prop))
RNA_property_boolean_set_index(&but->rnapoin, prop, but->rnaindex, value);
else
RNA_property_boolean_set(&but->rnapoin, prop, value);
break;
case PROP_INT:
- if(RNA_property_array_length(&but->rnapoin, prop))
+ if (RNA_property_array_length(&but->rnapoin, prop))
RNA_property_int_set_index(&but->rnapoin, prop, but->rnaindex, (int)value);
else
RNA_property_int_set(&but->rnapoin, prop, (int)value);
break;
case PROP_FLOAT:
- if(RNA_property_array_length(&but->rnapoin, prop))
+ if (RNA_property_array_length(&but->rnapoin, prop))
RNA_property_float_set_index(&but->rnapoin, prop, but->rnaindex, value);
else
RNA_property_float_set(&but->rnapoin, prop, value);
break;
case PROP_ENUM:
- if(RNA_property_flag(prop) & PROP_ENUM_FLAG) {
+ if (RNA_property_flag(prop) & PROP_ENUM_FLAG) {
int ivalue= (int)value;
ivalue ^= RNA_property_enum_get(&but->rnapoin, prop); /* toggle for enum/flag buttons */
RNA_property_enum_set(&but->rnapoin, prop, ivalue);
@@ -1490,8 +1490,8 @@ void ui_set_but_val(uiBut *but, double value)
* so leave this unset */
value= UI_BUT_VALUE_UNSET;
}
- else if(but->pointype==0);
- else if(but->type==HSVSLI ) {
+ else if (but->pointype==0);
+ else if (but->type==HSVSLI ) {
float h, s, v, *fp;
fp= (but->editvec)? but->editvec: (float *)but->poin;
@@ -1508,9 +1508,9 @@ void ui_set_but_val(uiBut *but, double value)
}
else {
/* first do rounding */
- if(but->pointype==CHA)
+ if (but->pointype==CHA)
value= (char)floor(value+0.5);
- else if(but->pointype==SHO ) {
+ else if (but->pointype==SHO ) {
/* gcc 3.2.1 seems to have problems
* casting a double like 32772.0 to
* a short so we cast to an int, then
@@ -1519,24 +1519,24 @@ void ui_set_but_val(uiBut *but, double value)
gcckludge = (int) floor(value+0.5);
value= (short)gcckludge;
}
- else if(but->pointype==INT )
+ else if (but->pointype==INT )
value= (int)floor(value+0.5);
- else if(but->pointype==FLO ) {
+ else if (but->pointype==FLO ) {
float fval= (float)value;
- if(fval>= -0.00001f && fval<= 0.00001f) fval= 0.0f; /* prevent negative zero */
+ if (fval>= -0.00001f && fval<= 0.00001f) fval= 0.0f; /* prevent negative zero */
value= fval;
}
/* then set value with possible edit override */
- if(but->editval)
+ if (but->editval)
value= *but->editval= value;
- else if(but->pointype==CHA)
+ else if (but->pointype==CHA)
value= *((char *)but->poin)= (char)value;
- else if(but->pointype==SHO)
+ else if (but->pointype==SHO)
value= *((short *)but->poin)= (short)value;
- else if(but->pointype==INT)
+ else if (but->pointype==INT)
value= *((int *)but->poin)= (int)value;
- else if(but->pointype==FLO)
+ else if (but->pointype==FLO)
value= *((float *)but->poin)= (float)value;
}
@@ -1546,9 +1546,9 @@ void ui_set_but_val(uiBut *but, double value)
int ui_get_but_string_max_length(uiBut *but)
{
- if(ELEM(but->type, TEX, SEARCH_MENU))
+ if (ELEM(but->type, TEX, SEARCH_MENU))
return but->hardmax;
- else if(but->type == IDPOIN)
+ else if (but->type == IDPOIN)
return MAX_ID_NAME-2;
else
return UI_MAX_DRAW_STR;
@@ -1559,16 +1559,16 @@ static double ui_get_but_scale_unit(uiBut *but, double value)
UnitSettings *unit= but->block->unit;
int unit_type= uiButGetUnitType(but);
- if(unit_type == PROP_UNIT_LENGTH) {
+ if (unit_type == PROP_UNIT_LENGTH) {
return value * (double)unit->scale_length;
}
- else if(unit_type == PROP_UNIT_AREA) {
+ else if (unit_type == PROP_UNIT_AREA) {
return value * pow(unit->scale_length, 2);
}
- else if(unit_type == PROP_UNIT_VOLUME) {
+ else if (unit_type == PROP_UNIT_VOLUME) {
return value * pow(unit->scale_length, 3);
}
- else if(unit_type == PROP_UNIT_TIME) { /* WARNING - using evil_C :| */
+ else if (unit_type == PROP_UNIT_TIME) { /* WARNING - using evil_C :| */
Scene *scene= CTX_data_scene(but->block->evil_C);
return FRA2TIME(value);
}
@@ -1580,7 +1580,7 @@ static double ui_get_but_scale_unit(uiBut *but, double value)
/* str will be overwritten */
void ui_convert_to_unit_alt_name(uiBut *but, char *str, size_t maxlen)
{
- if(ui_is_but_unit(but)) {
+ if (ui_is_but_unit(but)) {
UnitSettings *unit= but->block->unit;
int unit_type= uiButGetUnitType(but);
char *orig_str;
@@ -1601,11 +1601,11 @@ static void ui_get_but_string_unit(uiBut *but, char *str, int len_max, double va
int unit_type= uiButGetUnitType(but);
int precision= but->a2;
- if(unit->scale_length<0.0001f) unit->scale_length= 1.0f; // XXX do_versions
+ if (unit->scale_length<0.0001f) unit->scale_length= 1.0f; // XXX do_versions
/* Sanity checks */
- if(precision > PRECISION_FLOAT_MAX) precision= PRECISION_FLOAT_MAX;
- else if(precision==0) precision= 2;
+ if (precision > PRECISION_FLOAT_MAX) precision= PRECISION_FLOAT_MAX;
+ else if (precision==0) precision= 2;
bUnit_AsString(str, len_max, ui_get_but_scale_unit(but, value), precision, unit->system, unit_type>>16, do_split, pad);
}
@@ -1617,7 +1617,7 @@ static float ui_get_but_step_unit(uiBut *but, float step_default)
step = bUnit_ClosestScalar(ui_get_but_scale_unit(but, step_default), but->block->unit->system, unit_type);
- if(step > 0.0f) { /* -1 is an error value */
+ if (step > 0.0f) { /* -1 is an error value */
return (float)((double)step/ui_get_but_scale_unit(but, 1.0))*100.0f;
}
else {
@@ -1628,37 +1628,37 @@ static float ui_get_but_step_unit(uiBut *but, float step_default)
void ui_get_but_string(uiBut *but, char *str, size_t maxlen)
{
- if(but->rnaprop && ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) {
+ if (but->rnaprop && ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) {
PropertyType type;
char *buf= NULL;
int buf_len;
type= RNA_property_type(but->rnaprop);
- if(type == PROP_STRING) {
+ if (type == PROP_STRING) {
/* RNA string */
buf= RNA_property_string_get_alloc(&but->rnapoin, but->rnaprop, str, maxlen, &buf_len);
}
- else if(type == PROP_POINTER) {
+ else if (type == PROP_POINTER) {
/* RNA pointer */
PointerRNA ptr= RNA_property_pointer_get(&but->rnapoin, but->rnaprop);
buf= RNA_struct_name_get_alloc(&ptr, str, maxlen, &buf_len);
}
- if(!buf) {
+ if (!buf) {
str[0] = '\0';
}
- else if(buf && buf != str) {
+ else if (buf && buf != str) {
/* string was too long, we have to truncate */
memcpy(str, buf, MIN2(maxlen, buf_len+1));
MEM_freeN(buf);
}
}
- else if(but->type == IDPOIN) {
+ else if (but->type == IDPOIN) {
/* ID pointer */
- if(but->idpoin_idpp) { /* Can be NULL for ID properties by python */
+ if (but->idpoin_idpp) { /* Can be NULL for ID properties by python */
ID *id= *(but->idpoin_idpp);
- if(id) {
+ if (id) {
BLI_strncpy(str, id->name+2, maxlen);
return;
}
@@ -1666,17 +1666,17 @@ void ui_get_but_string(uiBut *but, char *str, size_t maxlen)
str[0] = '\0';
return;
}
- else if(but->type == TEX) {
+ else if (but->type == TEX) {
/* string */
BLI_strncpy(str, but->poin, maxlen);
return;
}
- else if(but->type == SEARCH_MENU) {
+ else if (but->type == SEARCH_MENU) {
/* string */
BLI_strncpy(str, but->poin, maxlen);
return;
}
- else if(ui_but_anim_expression_get(but, str, maxlen))
+ else if (ui_but_anim_expression_get(but, str, maxlen))
; /* driver expression */
else {
/* number editing */
@@ -1684,8 +1684,8 @@ void ui_get_but_string(uiBut *but, char *str, size_t maxlen)
value= ui_get_but_val(but);
- if(ui_is_but_float(but)) {
- if(ui_is_but_unit(but)) {
+ if (ui_is_but_float(but)) {
+ if (ui_is_but_unit(but)) {
ui_get_but_string_unit(but, str, maxlen, value, 0);
}
else {
@@ -1722,12 +1722,12 @@ int ui_set_but_string_eval_num(bContext *C, uiBut *but, const char *str, double
#ifdef WITH_PYTHON
- if(str[0] != '\0') {
+ if (str[0] != '\0') {
int is_unit_but= ui_is_but_unit(but);
/* only enable verbose if we won't run again with units */
- if(BPY_button_exec(C, str, value, is_unit_but==FALSE) != -1) {
+ if (BPY_button_exec(C, str, value, is_unit_but==FALSE) != -1) {
/* if the value parsed ok without unit conversion this button may still need a unit multiplier */
- if(is_unit_but) {
+ if (is_unit_but) {
char str_new[128];
BLI_snprintf(str_new, sizeof(str_new), "%f", *value);
@@ -1737,7 +1737,7 @@ int ui_set_but_string_eval_num(bContext *C, uiBut *but, const char *str, double
ok= TRUE; /* parse normal string via py (no unit conversion needed) */
}
}
- else if(is_unit_but) {
+ else if (is_unit_but) {
/* parse failed, this is a unit but so run replacements and parse again */
ok= ui_set_but_string_eval_num_unit(C, but, str, value);
}
@@ -1759,23 +1759,23 @@ int ui_set_but_string_eval_num(bContext *C, uiBut *but, const char *str, double
int ui_set_but_string(bContext *C, uiBut *but, const char *str)
{
- if(but->rnaprop && ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) {
- if(RNA_property_editable(&but->rnapoin, but->rnaprop)) {
+ if (but->rnaprop && ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) {
+ if (RNA_property_editable(&but->rnapoin, but->rnaprop)) {
PropertyType type;
type= RNA_property_type(but->rnaprop);
- if(type == PROP_STRING) {
+ if (type == PROP_STRING) {
/* RNA string */
RNA_property_string_set(&but->rnapoin, but->rnaprop, str);
return 1;
}
- else if(type == PROP_POINTER) {
+ else if (type == PROP_POINTER) {
/* RNA pointer */
PointerRNA ptr, rptr;
PropertyRNA *prop;
- if(str == NULL || str[0] == '\0') {
+ if (str == NULL || str[0] == '\0') {
RNA_property_pointer_set(&but->rnapoin, but->rnaprop, PointerRNA_NULL);
return 1;
}
@@ -1783,7 +1783,7 @@ int ui_set_but_string(bContext *C, uiBut *but, const char *str)
ptr= but->rnasearchpoin;
prop= but->rnasearchprop;
- if(prop && RNA_property_collection_lookup_string(&ptr, prop, str, &rptr))
+ if (prop && RNA_property_collection_lookup_string(&ptr, prop, str, &rptr))
RNA_property_pointer_set(&but->rnapoin, but->rnaprop, rptr);
return 1;
@@ -1793,28 +1793,28 @@ int ui_set_but_string(bContext *C, uiBut *but, const char *str)
}
}
}
- else if(but->type == IDPOIN) {
+ else if (but->type == IDPOIN) {
/* ID pointer */
but->idpoin_func(C, str, but->idpoin_idpp);
return 1;
}
- else if(but->type == TEX) {
+ else if (but->type == TEX) {
/* string */
- if(ui_is_but_utf8(but)) BLI_strncpy_utf8(but->poin, str, but->hardmax);
+ if (ui_is_but_utf8(but)) BLI_strncpy_utf8(but->poin, str, but->hardmax);
else BLI_strncpy(but->poin, str, but->hardmax);
return 1;
}
- else if(but->type == SEARCH_MENU) {
+ else if (but->type == SEARCH_MENU) {
/* string */
BLI_strncpy(but->poin, str, but->hardmax);
return 1;
}
- else if(ui_but_anim_expression_set(but, str)) {
+ else if (ui_but_anim_expression_set(but, str)) {
/* driver expression */
return 1;
}
- else if(str[0]=='#') {
+ else if (str[0]=='#') {
/* shortcut to create new driver expression (versus immediate Py-execution) */
return ui_but_anim_expression_create(but, str+1);
}
@@ -1822,16 +1822,16 @@ int ui_set_but_string(bContext *C, uiBut *but, const char *str)
/* number editing */
double value;
- if(ui_set_but_string_eval_num(C, but, str, &value) == FALSE) {
+ if (ui_set_but_string_eval_num(C, but, str, &value) == FALSE) {
return 0;
}
- if(!ui_is_but_float(but)) value= (int)floor(value + 0.5);
- if(but->type==NUMABS) value= fabs(value);
+ if (!ui_is_but_float(but)) value= (int)floor(value + 0.5);
+ if (but->type==NUMABS) value= fabs(value);
/* not that we use hard limits here */
- if(value < (double)but->hardmin) value= but->hardmin;
- if(value > (double)but->hardmax) value= but->hardmax;
+ if (value < (double)but->hardmin) value= but->hardmin;
+ if (value > (double)but->hardmax) value= but->hardmax;
ui_set_but_val(but, value);
return 1;
@@ -1855,9 +1855,9 @@ static double soft_range_round_up(double value, double max)
/* round up to .., 0.1, 0.2, 0.5, 1, 2, 5, 10, 20, 50, .. */
double newmax= pow(10.0, ceil(log(value)/M_LN10));
- if(newmax*0.2 >= max && newmax*0.2 >= value)
+ if (newmax*0.2 >= max && newmax*0.2 >= value)
return newmax*0.2;
- else if(newmax*0.5 >= max && newmax*0.5 >= value)
+ else if (newmax*0.5 >= max && newmax*0.5 >= value)
return newmax*0.5;
else
return newmax;
@@ -1868,9 +1868,9 @@ static double soft_range_round_down(double value, double max)
/* round down to .., 0.1, 0.2, 0.5, 1, 2, 5, 10, 20, 50, .. */
double newmax= pow(10.0, floor(log(value)/M_LN10));
- if(newmax*5.0 <= max && newmax*5.0 <= value)
+ if (newmax*5.0 <= max && newmax*5.0 <= value)
return newmax*5.0;
- else if(newmax*2.0 <= max && newmax*2.0 <= value)
+ else if (newmax*2.0 <= max && newmax*2.0 <= value)
return newmax*2.0;
else
return newmax;
@@ -1882,7 +1882,7 @@ void ui_set_but_soft_range(uiBut *but, double value)
* enough worst case is very long vectors wont use a smart soft-range
* which isn't so bad. */
- if(but->rnaprop) {
+ if (but->rnaprop) {
const PropertyType type= RNA_property_type(but->rnaprop);
double softmin, softmax /*, step, precision*/;
double value_min= value;
@@ -1890,7 +1890,7 @@ void ui_set_but_soft_range(uiBut *but, double value)
/* clamp button range to something reasonable in case
* we get -inf/inf from RNA properties */
- if(type == PROP_INT) {
+ if (type == PROP_INT) {
int imin, imax, istep;
const int array_len= RNA_property_array_length(&but->rnapoin, but->rnaprop);
@@ -1900,14 +1900,14 @@ void ui_set_but_soft_range(uiBut *but, double value)
/*step= istep;*/ /*UNUSED*/
/*precision= 1;*/ /*UNUSED*/
- if(array_len >= 2) {
+ if (array_len >= 2) {
int value_range[2];
RNA_property_int_get_array_range(&but->rnapoin, but->rnaprop, value_range);
value_min= (double)value_range[0];
value_max= (double)value_range[1];
}
}
- else if(type == PROP_FLOAT) {
+ else if (type == PROP_FLOAT) {
float fmin, fmax, fstep, fprecision;
const int array_len= RNA_property_array_length(&but->rnapoin, but->rnaprop);
@@ -1917,7 +1917,7 @@ void ui_set_but_soft_range(uiBut *but, double value)
/*step= fstep;*/ /*UNUSED*/
/*precision= fprecision;*/ /*UNUSED*/
- if(array_len >= 2) {
+ if (array_len >= 2) {
float value_range[2];
RNA_property_float_get_array_range(&but->rnapoin, but->rnaprop, value_range);
value_min= (double)value_range[0];
@@ -1928,22 +1928,22 @@ void ui_set_but_soft_range(uiBut *but, double value)
return;
/* if the value goes out of the soft/max range, adapt the range */
- if(value_min+1e-10 < softmin) {
- if(value_min < 0.0)
+ if (value_min+1e-10 < softmin) {
+ if (value_min < 0.0)
softmin= -soft_range_round_up(-value_min, -softmin);
else
softmin= soft_range_round_down(value_min, softmin);
- if(softmin < (double)but->hardmin)
+ if (softmin < (double)but->hardmin)
softmin= (double)but->hardmin;
}
- if(value_max-1e-10 > softmax) {
- if(value_max < 0.0)
+ if (value_max-1e-10 > softmax) {
+ if (value_max < 0.0)
softmax= -soft_range_round_down(-value_max, -softmax);
else
softmax= soft_range_round_up(value_max, softmax);
- if(softmax > (double)but->hardmax)
+ if (softmax > (double)but->hardmax)
softmax= but->hardmax;
}
@@ -1956,7 +1956,7 @@ void ui_set_but_soft_range(uiBut *but, double value)
static void ui_free_link(uiLink *link)
{
- if(link) {
+ if (link) {
BLI_freelistN(&link->lines);
MEM_freeN(link);
}
@@ -1965,16 +1965,16 @@ static void ui_free_link(uiLink *link)
/* can be called with C==NULL */
static void ui_free_but(const bContext *C, uiBut *but)
{
- if(but->opptr) {
+ if (but->opptr) {
WM_operator_properties_free(but->opptr);
MEM_freeN(but->opptr);
}
- if(but->func_argN) {
+ if (but->func_argN) {
MEM_freeN(but->func_argN);
}
- if(but->active) {
+ if (but->active) {
/* XXX solve later, buttons should be free-able without context ideally,
* however they may have open tooltips or popup windows, which need to
* be closed using a context pointer */
@@ -1982,7 +1982,7 @@ static void ui_free_but(const bContext *C, uiBut *but)
ui_button_active_free(C, but);
}
else {
- if(but->active) {
+ if (but->active) {
MEM_freeN(but->active);
}
}
@@ -2004,7 +2004,7 @@ void uiFreeBlock(const bContext *C, uiBlock *block)
{
uiBut *but;
- while( (but= block->buttons.first) ) {
+ while ( (but= block->buttons.first) ) {
BLI_remlink(&block->buttons, but);
ui_free_but(C, but);
}
@@ -2029,7 +2029,7 @@ void uiFreeBlocks(const bContext *C, ListBase *lb)
{
uiBlock *block;
- while( (block= lb->first) ) {
+ while ( (block= lb->first) ) {
BLI_remlink(lb, block);
uiFreeBlock(C, block);
}
@@ -2039,11 +2039,11 @@ void uiFreeInactiveBlocks(const bContext *C, ListBase *lb)
{
uiBlock *block, *nextblock;
- for(block=lb->first; block; block=nextblock) {
+ for (block=lb->first; block; block=nextblock) {
nextblock= block->next;
- if(!block->handle) {
- if(!block->active) {
+ if (!block->handle) {
+ if (!block->active) {
BLI_remlink(lb, block);
uiFreeBlock(C, block);
}
@@ -2060,7 +2060,7 @@ void uiBlockSetRegion(uiBlock *block, ARegion *region)
/* each listbase only has one block with this name, free block
* if is already there so it can be rebuilt from scratch */
- if(lb) {
+ if (lb) {
oldblock= BLI_findstring(lb, block->name, offsetof(uiBlock, name));
if (oldblock) {
@@ -2100,11 +2100,11 @@ uiBlock *uiBeginBlock(const bContext *C, ARegion *region, const char *name, shor
BLI_strncpy(block->name, name, sizeof(block->name));
- if(region)
+ if (region)
uiBlockSetRegion(block, region);
/* window matrix and aspect */
- if(region && region->swinid) {
+ if (region && region->swinid) {
wm_subwindow_getmatrix(window, region->swinid, block->winmat);
wm_subwindow_getsize(window, region->swinid, &getsizex, &getsizey);
@@ -2146,7 +2146,7 @@ void ui_check_but(uiBut *but)
ui_is_but_sel(but, &value);
/* only update soft range while not editing */
- if(but->rnaprop && !(but->editval || but->editstr || but->editvec)) {
+ if (but->rnaprop && !(but->editval || but->editstr || but->editvec)) {
UI_GET_BUT_VALUE_INIT(but, value)
ui_set_but_soft_range(but, value);
}
@@ -2159,8 +2159,8 @@ void ui_check_but(uiBut *but)
case NUMSLI:
case HSVSLI:
UI_GET_BUT_VALUE_INIT(but, value)
- if(value < (double)but->hardmin) ui_set_but_val(but, but->hardmin);
- else if(value > (double)but->hardmax) ui_set_but_val(but, but->hardmax);
+ if (value < (double)but->hardmin) ui_set_but_val(but, but->hardmin);
+ else if (value > (double)but->hardmax) ui_set_but_val(but, but->hardmax);
break;
case NUMABS:
@@ -2168,27 +2168,27 @@ void ui_check_but(uiBut *but)
double value_abs;
UI_GET_BUT_VALUE_INIT(but, value)
value_abs= fabs(value);
- if(value_abs < (double)but->hardmin) ui_set_but_val(but, but->hardmin);
- else if(value_abs > (double)but->hardmax) ui_set_but_val(but, but->hardmax);
+ if (value_abs < (double)but->hardmin) ui_set_but_val(but, but->hardmin);
+ else if (value_abs > (double)but->hardmax) ui_set_but_val(but, but->hardmax);
break;
}
case ICONTOG:
case ICONTOGN:
- if(!but->rnaprop || (RNA_property_flag(but->rnaprop) & PROP_ICONS_CONSECUTIVE)) {
- if(but->flag & UI_SELECT) but->iconadd= 1;
+ if (!but->rnaprop || (RNA_property_flag(but->rnaprop) & PROP_ICONS_CONSECUTIVE)) {
+ if (but->flag & UI_SELECT) but->iconadd= 1;
else but->iconadd= 0;
}
break;
case ICONROW:
- if(!but->rnaprop || (RNA_property_flag(but->rnaprop) & PROP_ICONS_CONSECUTIVE)) {
+ if (!but->rnaprop || (RNA_property_flag(but->rnaprop) & PROP_ICONS_CONSECUTIVE)) {
UI_GET_BUT_VALUE_INIT(but, value)
but->iconadd= (int)value- (int)(but->hardmin);
}
break;
case ICONTEXTROW:
- if(!but->rnaprop || (RNA_property_flag(but->rnaprop) & PROP_ICONS_CONSECUTIVE)) {
+ if (!but->rnaprop || (RNA_property_flag(but->rnaprop) & PROP_ICONS_CONSECUTIVE)) {
UI_GET_BUT_VALUE_INIT(but, value)
but->iconadd= (int)value- (int)(but->hardmin);
}
@@ -2205,7 +2205,7 @@ void ui_check_but(uiBut *but)
case MENU:
case ICONTEXTROW:
- if(but->x2 - but->x1 > 24) {
+ if (but->x2 - but->x1 > 24) {
UI_GET_BUT_VALUE_INIT(but, value)
ui_set_name_menu(but, (int)value);
}
@@ -2218,11 +2218,11 @@ void ui_check_but(uiBut *but)
UI_GET_BUT_VALUE_INIT(but, value)
- if(ui_is_but_float(but)) {
- if(value == (double) FLT_MAX) BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%sinf", but->str);
- else if(value == (double) -FLT_MAX) BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s-inf", but->str);
+ if (ui_is_but_float(but)) {
+ if (value == (double) FLT_MAX) BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%sinf", but->str);
+ else if (value == (double) -FLT_MAX) BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s-inf", but->str);
/* support length type buttons */
- else if(ui_is_but_unit(but)) {
+ else if (ui_is_but_unit(but)) {
char new_str[sizeof(but->drawstr)];
ui_get_but_string_unit(but, new_str, sizeof(new_str), value, TRUE);
BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%s", but->str, new_str);
@@ -2236,7 +2236,7 @@ void ui_check_but(uiBut *but)
BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%d", but->str, (int)value);
}
- if(but->rnaprop) {
+ if (but->rnaprop) {
PropertySubType pstype = RNA_property_subtype(but->rnaprop);
if (pstype == PROP_PERCENTAGE)
@@ -2245,7 +2245,7 @@ void ui_check_but(uiBut *but)
break;
case LABEL:
- if(ui_is_but_float(but)) {
+ if (ui_is_but_float(but)) {
int prec;
UI_GET_BUT_VALUE_INIT(but, value)
prec= ui_but_float_precision(but, value);
@@ -2260,7 +2260,7 @@ void ui_check_but(uiBut *but)
case IDPOIN:
case TEX:
case SEARCH_MENU:
- if(!but->editstr) {
+ if (!but->editstr) {
char str[UI_MAX_DRAW_STR];
ui_get_but_string(but, str, UI_MAX_DRAW_STR-strlen(but->str));
@@ -2284,16 +2284,16 @@ void ui_check_but(uiBut *but)
if (but->flag & UI_SELECT) {
but->drawstr[0]= '\0';
- if(but->modifier_key) {
+ if (but->modifier_key) {
char *str= but->drawstr;
- if(but->modifier_key & KM_SHIFT)
+ if (but->modifier_key & KM_SHIFT)
str= strcat(str, "Shift ");
- if(but->modifier_key & KM_CTRL)
+ if (but->modifier_key & KM_CTRL)
str= strcat(str, "Ctrl ");
- if(but->modifier_key & KM_ALT)
+ if (but->modifier_key & KM_ALT)
str= strcat(str, "Alt ");
- if(but->modifier_key & KM_OSKEY)
+ if (but->modifier_key & KM_OSKEY)
str= strcat(str, "Cmd ");
(void)str; /* UNUSED */
@@ -2308,7 +2308,7 @@ void ui_check_but(uiBut *but)
case BUT_TOGDUAL:
/* trying to get the dual-icon to left of text... not very nice */
- if(but->str[0]) {
+ if (but->str[0]) {
BLI_strncpy(but->drawstr, " ", UI_MAX_DRAW_STR);
BLI_strncpy(but->drawstr+2, but->str, UI_MAX_DRAW_STR-2);
}
@@ -2323,7 +2323,7 @@ void ui_check_but(uiBut *but)
}
/* if we are doing text editing, this will override the drawstr */
- if(but->editstr)
+ if (but->editstr)
BLI_strncpy(but->drawstr, but->editstr, UI_MAX_DRAW_STR);
/* text clipping moved to widget drawing code itself */
@@ -2333,7 +2333,7 @@ void ui_check_but(uiBut *but)
void uiBlockBeginAlign(uiBlock *block)
{
/* if other align was active, end it */
- if(block->flag & UI_BUT_ALIGN) uiBlockEndAlign(block);
+ if (block->flag & UI_BUT_ALIGN) uiBlockEndAlign(block);
block->flag |= UI_BUT_ALIGN_DOWN;
block->alignnr++;
@@ -2348,7 +2348,7 @@ static int buts_are_horiz(uiBut *but1, uiBut *but2)
dx= fabs( but1->x2 - but2->x1);
dy= fabs( but1->y1 - but2->y2);
- if(dx > dy) return 0;
+ if (dx > dy) return 0;
return 1;
}
@@ -2369,9 +2369,9 @@ static void ui_block_do_align_but(uiBut *first, short nr)
/* auto align */
- for(but=first; but && but->alignnr == nr; but=but->next) {
- if(but->next && but->next->alignnr == nr) {
- if(buts_are_horiz(but, but->next)) cols++;
+ for (but=first; but && but->alignnr == nr; but=but->next) {
+ if (but->next && but->next->alignnr == nr) {
+ if (buts_are_horiz(but, but->next)) cols++;
else rows++;
}
}
@@ -2379,18 +2379,18 @@ static void ui_block_do_align_but(uiBut *first, short nr)
/* rows==0: 1 row, cols==0: 1 column */
/* note; how it uses 'flag' in loop below (either set it, or OR it) is confusing */
- for(but=first, prev=NULL; but && but->alignnr == nr; prev=but, but=but->next) {
+ for (but=first, prev=NULL; but && but->alignnr == nr; prev=but, but=but->next) {
next= but->next;
- if(next && next->alignnr != nr)
+ if (next && next->alignnr != nr)
next= NULL;
/* clear old flag */
but->flag &= ~UI_BUT_ALIGN;
- if(flag==0) { /* first case */
- if(next) {
- if(buts_are_horiz(but, next)) {
- if(rows==0)
+ if (flag==0) { /* first case */
+ if (next) {
+ if (buts_are_horiz(but, next)) {
+ if (rows==0)
flag= UI_BUT_ALIGN_RIGHT;
else
flag= UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_RIGHT;
@@ -2400,10 +2400,10 @@ static void ui_block_do_align_but(uiBut *first, short nr)
}
}
}
- else if(next==NULL) { /* last case */
- if(prev) {
- if(buts_are_horiz(prev, but)) {
- if(rows==0)
+ else if (next==NULL) { /* last case */
+ if (prev) {
+ if (buts_are_horiz(prev, but)) {
+ if (rows==0)
flag= UI_BUT_ALIGN_LEFT;
else
flag= UI_BUT_ALIGN_TOP|UI_BUT_ALIGN_LEFT;
@@ -2411,39 +2411,39 @@ static void ui_block_do_align_but(uiBut *first, short nr)
else flag= UI_BUT_ALIGN_TOP;
}
}
- else if(buts_are_horiz(but, next)) {
+ else if (buts_are_horiz(but, next)) {
/* check if this is already second row */
- if( prev && buts_are_horiz(prev, but)==0) {
+ if ( prev && buts_are_horiz(prev, but)==0) {
flag &= ~UI_BUT_ALIGN_LEFT;
flag |= UI_BUT_ALIGN_TOP;
/* exception case: bottom row */
- if(rows>0) {
+ if (rows>0) {
uiBut *bt= but;
- while(bt && bt->alignnr == nr) {
- if(bt->next && bt->next->alignnr == nr && buts_are_horiz(bt, bt->next)==0 ) break;
+ while (bt && bt->alignnr == nr) {
+ if (bt->next && bt->next->alignnr == nr && buts_are_horiz(bt, bt->next)==0 ) break;
bt= bt->next;
}
- if(bt==NULL || bt->alignnr != nr) flag= UI_BUT_ALIGN_TOP|UI_BUT_ALIGN_RIGHT;
+ if (bt==NULL || bt->alignnr != nr) flag= UI_BUT_ALIGN_TOP|UI_BUT_ALIGN_RIGHT;
}
}
else flag |= UI_BUT_ALIGN_LEFT;
}
else {
- if(cols==0) {
+ if (cols==0) {
flag |= UI_BUT_ALIGN_TOP;
}
else { /* next button switches to new row */
- if(prev && buts_are_horiz(prev, but))
+ if (prev && buts_are_horiz(prev, but))
flag |= UI_BUT_ALIGN_LEFT;
else {
flag &= ~UI_BUT_ALIGN_LEFT;
flag |= UI_BUT_ALIGN_TOP;
}
- if( (flag & UI_BUT_ALIGN_TOP)==0) { /* stil top row */
- if(prev) {
- if(next && buts_are_horiz(but, next))
+ if ( (flag & UI_BUT_ALIGN_TOP)==0) { /* stil top row */
+ if (prev) {
+ if (next && buts_are_horiz(but, next))
flag = UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_LEFT|UI_BUT_ALIGN_RIGHT;
else {
/* last button in top row */
@@ -2461,30 +2461,30 @@ static void ui_block_do_align_but(uiBut *first, short nr)
but->flag |= flag;
/* merge coordinates */
- if(prev) {
+ if (prev) {
// simple cases
- if(rows==0) {
+ if (rows==0) {
but->x1= (prev->x2+but->x1)/2.0f;
prev->x2= but->x1;
}
- else if(cols==0) {
+ else if (cols==0) {
but->y2= (prev->y1+but->y2)/2.0f;
prev->y1= but->y2;
}
else {
- if(buts_are_horiz(prev, but)) {
+ if (buts_are_horiz(prev, but)) {
but->x1= (prev->x2+but->x1)/2.0f;
prev->x2= but->x1;
/* copy height too */
but->y2= prev->y2;
}
- else if(prev->prev && buts_are_horiz(prev->prev, prev)==0) {
+ else if (prev->prev && buts_are_horiz(prev->prev, prev)==0) {
/* the previous button is a single one in its row */
but->y2= (prev->y1+but->y2)/2.0f;
prev->y1= but->y2;
but->x1= prev->x1;
- if(next && buts_are_horiz(but, next)==0)
+ if (next && buts_are_horiz(but, next)==0)
but->x2= prev->x2;
}
else {
@@ -2502,15 +2502,15 @@ void ui_block_do_align(uiBlock *block)
short nr;
/* align buttons with same align nr */
- for(but=block->buttons.first; but;) {
- if(but->alignnr) {
+ for (but=block->buttons.first; but;) {
+ if (but->alignnr) {
nr= but->alignnr;
ui_block_do_align_but(but, nr);
/* skip with same number */
- for(; but && but->alignnr == nr; but=but->next);
+ for (; but && but->alignnr == nr; but=but->next);
- if(!but)
+ if (!but)
break;
}
else
@@ -2531,8 +2531,8 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
uiBut *but;
int slen;
- if(type & BUTPOIN) { /* a pointer is required */
- if(poin==NULL)
+ if (type & BUTPOIN) { /* a pointer is required */
+ if (poin==NULL)
return NULL;
}
@@ -2548,7 +2548,7 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
but->retval= retval;
slen= strlen(str);
- if(slen >= UI_MAX_NAME_STR-1) {
+ if (slen >= UI_MAX_NAME_STR-1) {
but->str= MEM_mallocN(slen+2, "ui_def_but str"); /* why +2 ? */
}
else {
@@ -2575,7 +2575,7 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
but->aspect= 1.0f; //XXX block->aspect;
but->block= block; // pointer back, used for frontbuffer status, and picker
- if((block->flag & UI_BUT_ALIGN) && ui_but_can_align(but))
+ if ((block->flag & UI_BUT_ALIGN) && ui_but_can_align(but))
but->alignnr= block->alignnr;
but->func= block->func;
@@ -2583,24 +2583,24 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
but->func_arg2= block->func_arg2;
but->funcN= block->funcN;
- if(block->func_argN)
+ if (block->func_argN)
but->func_argN= MEM_dupallocN(block->func_argN);
but->pos= -1; /* cursor invisible */
- if(ELEM4(but->type, NUM, NUMABS, NUMSLI, HSVSLI)) { /* add a space to name */
+ if (ELEM4(but->type, NUM, NUMABS, NUMSLI, HSVSLI)) { /* add a space to name */
/* slen remains unchanged from previous assignment, ensure this stays true */
- if(slen>0 && slen<UI_MAX_NAME_STR-2) {
- if(but->str[slen-1]!=' ') {
+ if (slen>0 && slen<UI_MAX_NAME_STR-2) {
+ if (but->str[slen-1]!=' ') {
but->str[slen]= ' ';
but->str[slen+1]= 0;
}
}
}
- if((block->flag & UI_BLOCK_LOOP) || ELEM8(but->type, MENU, TEX, LABEL, IDPOIN, BLOCK, BUTM, SEARCH_MENU, PROGRESSBAR))
+ if ((block->flag & UI_BLOCK_LOOP) || ELEM8(but->type, MENU, TEX, LABEL, IDPOIN, BLOCK, BUTM, SEARCH_MENU, PROGRESSBAR))
but->flag |= (UI_TEXT_LEFT|UI_ICON_LEFT);
- else if(but->type==BUT_TOGDUAL)
+ else if (but->type==BUT_TOGDUAL)
but->flag |= UI_ICON_LEFT;
but->flag |= (block->flag & UI_BUT_ALIGN);
@@ -2612,14 +2612,14 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
}
/* keep track of UI_interface.h */
- if(ELEM7(but->type, BLOCK, BUT, LABEL, PULLDOWN, ROUNDBOX, LISTBOX, BUTM));
- else if(ELEM3(but->type, SCROLL, SEPR, FTPREVIEW));
- else if(but->type >= SEARCH_MENU);
+ if (ELEM7(but->type, BLOCK, BUT, LABEL, PULLDOWN, ROUNDBOX, LISTBOX, BUTM));
+ else if (ELEM3(but->type, SCROLL, SEPR, FTPREVIEW));
+ else if (but->type >= SEARCH_MENU);
else but->flag |= UI_BUT_UNDO;
BLI_addtail(&block->buttons, but);
- if(block->curlayout)
+ if (block->curlayout)
ui_layout_add_but(block->curlayout, but);
#ifdef WITH_PYTHON
@@ -2653,8 +2653,8 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s
int freestr= 0, icon= 0;
/* use rna values if parameters are not specified */
- if(!str) {
- if(type == MENU && proptype == PROP_ENUM) {
+ if (!str) {
+ if (type == MENU && proptype == PROP_ENUM) {
EnumPropertyItem *item;
DynStr *dynstr;
int i, totitem, value, free;
@@ -2664,19 +2664,19 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s
dynstr= BLI_dynstr_new();
BLI_dynstr_appendf(dynstr, "%s%%t", RNA_property_ui_name(prop));
- for(i=0; i<totitem; i++) {
- if(!item[i].identifier[0]) {
- if(item[i].name)
+ for (i=0; i<totitem; i++) {
+ if (!item[i].identifier[0]) {
+ if (item[i].name)
BLI_dynstr_appendf(dynstr, "|%s%%l", item[i].name);
else
BLI_dynstr_append(dynstr, "|%l");
}
- else if(item[i].icon)
+ else if (item[i].icon)
BLI_dynstr_appendf(dynstr, "|%s %%i%d %%x%d", item[i].name, item[i].icon, item[i].value);
else
BLI_dynstr_appendf(dynstr, "|%s %%x%d", item[i].name, item[i].value);
- if(value == item[i].value)
+ if (value == item[i].value)
icon= item[i].icon;
}
str= BLI_dynstr_get_cstring(dynstr);
@@ -2688,13 +2688,13 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s
freestr= 1;
}
- else if(ELEM(type, ROW, LISTROW) && proptype == PROP_ENUM) {
+ else if (ELEM(type, ROW, LISTROW) && proptype == PROP_ENUM) {
EnumPropertyItem *item;
int i, totitem, free;
RNA_property_enum_items_gettexted(block->evil_C, ptr, prop, &item, &totitem, &free);
- for(i=0; i<totitem; i++) {
- if(item[i].identifier[0] && item[i].value == (int)max) {
+ for (i=0; i<totitem; i++) {
+ if (item[i].identifier[0] && item[i].value == (int)max) {
str= item[i].name;
icon= item[i].icon;
}
@@ -2713,44 +2713,44 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s
}
}
- if(!tip && proptype != PROP_ENUM)
+ if (!tip && proptype != PROP_ENUM)
tip= RNA_property_ui_description(prop);
- if(min == max || a1 == -1 || a2 == -1) {
- if(proptype == PROP_INT) {
+ if (min == max || a1 == -1 || a2 == -1) {
+ if (proptype == PROP_INT) {
int hardmin, hardmax, softmin, softmax, step;
RNA_property_int_range(ptr, prop, &hardmin, &hardmax);
RNA_property_int_ui_range(ptr, prop, &softmin, &softmax, &step);
- if(!ELEM(type, ROW, LISTROW) && min == max) {
+ if (!ELEM(type, ROW, LISTROW) && min == max) {
min= hardmin;
max= hardmax;
}
- if(a1 == -1)
+ if (a1 == -1)
a1= step;
- if(a2 == -1)
+ if (a2 == -1)
a2= 0;
}
- else if(proptype == PROP_FLOAT) {
+ else if (proptype == PROP_FLOAT) {
float hardmin, hardmax, softmin, softmax, step, precision;
RNA_property_float_range(ptr, prop, &hardmin, &hardmax);
RNA_property_float_ui_range(ptr, prop, &softmin, &softmax, &step, &precision);
- if(!ELEM(type, ROW, LISTROW) && min == max) {
+ if (!ELEM(type, ROW, LISTROW) && min == max) {
min= hardmin;
max= hardmax;
}
- if(a1 == -1)
+ if (a1 == -1)
a1= step;
- if(a2 == -1)
+ if (a2 == -1)
a2= precision;
}
- else if(proptype == PROP_STRING) {
+ else if (proptype == PROP_STRING) {
min= 0;
max= RNA_property_string_maxlength(prop);
- if(max == 0) /* interface code should ideally support unlimited length */
+ if (max == 0) /* interface code should ideally support unlimited length */
max= UI_MAX_DRAW_STR;
}
}
@@ -2761,12 +2761,12 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s
but->rnapoin= *ptr;
but->rnaprop= prop;
- if(RNA_property_array_length(&but->rnapoin, but->rnaprop))
+ if (RNA_property_array_length(&but->rnapoin, but->rnaprop))
but->rnaindex= index;
else
but->rnaindex= 0;
- if(icon) {
+ if (icon) {
but->icon= (BIFIconID)icon;
but->flag |= UI_HAS_ICON;
but->flag|= UI_ICON_LEFT;
@@ -2781,7 +2781,7 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s
}
/* If this button uses units, calculate the step from this */
- if((proptype == PROP_FLOAT) && ui_is_but_unit(but)) {
+ if ((proptype == PROP_FLOAT) && ui_is_but_unit(but)) {
but->a1= ui_get_but_step_unit(but, but->a1);
}
@@ -2797,7 +2797,7 @@ static uiBut *ui_def_but_rna_propname(uiBlock *block, int type, int retval, cons
PropertyRNA *prop= RNA_struct_find_property(ptr, propname);
uiBut *but;
- if(prop) {
+ if (prop) {
but= ui_def_but_rna(block, type, retval, str, x1, y1, x2, y2, ptr, prop, index, min, max, a1, a2, tip);
}
else {
@@ -2813,7 +2813,7 @@ static uiBut *ui_def_but_operator_ptr(uiBlock *block, int type, wmOperatorType *
{
uiBut *but;
- if(!str) {
+ if (!str) {
if (ot && ot->srna)
str = RNA_struct_ui_name(ot->srna);
else
@@ -2829,7 +2829,7 @@ static uiBut *ui_def_but_operator_ptr(uiBlock *block, int type, wmOperatorType *
but->opcontext= opcontext;
but->flag &= ~UI_BUT_UNDO; /* no need for ui_but_is_undo(), we never need undo here */
- if(!ot) {
+ if (!ot) {
but->flag |= UI_BUT_DISABLED;
but->lock = 1;
but->lockstr = "";
@@ -2854,8 +2854,8 @@ static uiBut *ui_def_but_operator_text(uiBlock *block, int type, const char *opn
ot= WM_operatortype_find(opname, 0);
- if(!str) {
- if(ot) str= ot->name;
+ if (!str) {
+ if (ot) str= ot->name;
else str= opname;
}
@@ -2868,7 +2868,7 @@ static uiBut *ui_def_but_operator_text(uiBlock *block, int type, const char *opn
but->opcontext= opcontext;
but->flag &= ~UI_BUT_UNDO; /* no need for ui_but_is_undo(), we never need undo here */
- if(!ot) {
+ if (!ot) {
but->flag |= UI_BUT_DISABLED;
but->lock = 1;
but->lockstr = "";
@@ -2894,7 +2894,8 @@ static int findBitIndex(unsigned int x)
{
if (!x || !is_power_of_2_i(x)) { /* is_power_of_2_i(x) strips lowest bit */
return -1;
- } else {
+ }
+ else {
int idx= 0;
if (x&0xFFFF0000) idx+=16, x>>=16;
@@ -2932,23 +2933,23 @@ void autocomplete_do_name(AutoComplete *autocpl, const char *name)
const char *startname= autocpl->startname;
int a;
- for(a=0; a<autocpl->maxlen-1; a++) {
- if(startname[a]==0 || startname[a]!=name[a])
+ for (a=0; a<autocpl->maxlen-1; a++) {
+ if (startname[a]==0 || startname[a]!=name[a])
break;
}
/* found a match */
- if(startname[a]==0) {
+ if (startname[a]==0) {
/* first match */
- if(truncate[0]==0)
+ if (truncate[0]==0)
BLI_strncpy(truncate, name, autocpl->maxlen);
else {
/* remove from truncate what is not in bone->name */
- for(a=0; a<autocpl->maxlen-1; a++) {
- if(name[a] == 0) {
+ for (a=0; a<autocpl->maxlen-1; a++) {
+ if (name[a] == 0) {
truncate[a]= 0;
break;
}
- else if(truncate[a]!=name[a])
+ else if (truncate[a]!=name[a])
truncate[a]= 0;
}
}
@@ -2957,7 +2958,7 @@ void autocomplete_do_name(AutoComplete *autocpl, const char *name)
void autocomplete_end(AutoComplete *autocpl, char *autoname)
{
- if(autocpl->truncate[0])
+ if (autocpl->truncate[0])
BLI_strncpy(autoname, autocpl->truncate, autocpl->maxlen);
else {
if (autoname != autocpl->startname) /* don't copy a string over its self */
@@ -2973,14 +2974,14 @@ static void autocomplete_id(bContext *C, char *str, void *arg_v)
int blocktype= (intptr_t)arg_v;
ListBase *listb= which_libbase(CTX_data_main(C), blocktype);
- if(listb==NULL) return;
+ if (listb==NULL) return;
/* search if str matches the beginning of an ID struct */
- if(str[0]) {
+ if (str[0]) {
AutoComplete *autocpl= autocomplete_begin(str, MAX_ID_NAME-2);
ID *id;
- for(id= listb->first; id; id= id->next)
+ for (id= listb->first; id; id= id->next)
autocomplete_do_name(autocpl, id->name+2);
autocomplete_end(autocpl, str);
@@ -2989,7 +2990,7 @@ static void autocomplete_id(bContext *C, char *str, void *arg_v)
static void ui_check_but_and_iconize(uiBut *but, int icon)
{
- if(icon) {
+ if (icon) {
but->icon= (BIFIconID) icon;
but->flag|= UI_HAS_ICON;
}
@@ -3002,7 +3003,8 @@ static uiBut *uiDefButBit(uiBlock *block, int type, int bit, int retval, const c
int bitIdx= findBitIndex(bit);
if (bitIdx==-1) {
return NULL;
- } else {
+ }
+ else {
return uiDefBut(block, type|BIT|bitIdx, retval, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
}
}
@@ -3086,7 +3088,8 @@ static uiBut *uiDefIconButBit(uiBlock *block, int type, int bit, int retval, int
int bitIdx= findBitIndex(bit);
if (bitIdx==-1) {
return NULL;
- } else {
+ }
+ else {
return uiDefIconBut(block, type|BIT|bitIdx, retval, icon, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
}
}
@@ -3164,7 +3167,8 @@ static uiBut *uiDefIconTextButBit(uiBlock *block, int type, int bit, int retval,
int bitIdx= findBitIndex(bit);
if (bitIdx==-1) {
return NULL;
- } else {
+ }
+ else {
return uiDefIconTextBut(block, type|BIT|bitIdx, retval, icon, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
}
}
@@ -3272,19 +3276,19 @@ void uiBlockFlipOrder(uiBlock *block)
uiBut *but, *next;
float centy, miny=10000, maxy= -10000;
- if(U.uiflag & USER_MENUFIXEDORDER)
+ if (U.uiflag & USER_MENUFIXEDORDER)
return;
- else if(block->flag & UI_BLOCK_NO_FLIP)
+ else if (block->flag & UI_BLOCK_NO_FLIP)
return;
- for(but= block->buttons.first; but; but= but->next) {
- if(but->flag & UI_BUT_ALIGN) return;
- if(but->y1 < miny) miny= but->y1;
- if(but->y2 > maxy) maxy= but->y2;
+ for (but= block->buttons.first; but; but= but->next) {
+ if (but->flag & UI_BUT_ALIGN) return;
+ if (but->y1 < miny) miny= but->y1;
+ if (but->y2 > maxy) maxy= but->y2;
}
/* mirror trick */
centy= (miny+maxy)/2.0f;
- for(but= block->buttons.first; but; but= but->next) {
+ 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);
@@ -3293,7 +3297,7 @@ void uiBlockFlipOrder(uiBlock *block)
/* also flip order in block itself, for example for arrowkey */
lb.first= lb.last= NULL;
but= block->buttons.first;
- while(but) {
+ while (but) {
next= but->next;
BLI_remlink(&block->buttons, but);
BLI_addtail(&lb, but);
@@ -3374,7 +3378,7 @@ void uiButSetDragImage(uiBut *but, const char *path, int icon, struct ImBuf *imb
PointerRNA *uiButGetOperatorPtrRNA(uiBut *but)
{
- if(but->optype && !but->opptr) {
+ if (but->optype && !but->opptr) {
but->opptr= MEM_callocN(sizeof(PointerRNA), "uiButOpPtr");
WM_operator_properties_create_ptr(but->opptr, but->optype);
}
@@ -3477,7 +3481,7 @@ uiBut *uiDefIDPoinBut(uiBlock *block, uiIDPoinFuncFP func, short blocktype, int
but->idpoin_idpp= (ID**) idpp;
ui_check_but(but);
- if(blocktype)
+ if (blocktype)
uiButSetCompleteFunc(but, autocomplete_id, (void *)(intptr_t)blocktype);
return but;
@@ -3556,7 +3560,7 @@ uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg,
uiBut *but= ui_def_but(block, BLOCK, 0, str, x1, y1, x2, y2, arg, 0.0, 0.0, 0.0, 0.0, tip);
/* XXX temp, old menu calls pass on icon arrow, which is now UI_ICON_SUBMENU flag */
- if(icon!=ICON_RIGHTARROW_THIN) {
+ if (icon!=ICON_RIGHTARROW_THIN) {
but->icon= (BIFIconID) icon;
but->flag|= UI_ICON_LEFT;
}
@@ -3630,9 +3634,9 @@ void uiButSetSearchFunc(uiBut *but, uiButSearchFunc sfunc, void *arg, uiButHandl
uiButSetFunc(but, bfunc, arg, active);
/* search buttons show red-alert if item doesn't exist, not for menus */
- if(0==(but->block->flag & UI_BLOCK_LOOP)) {
+ if (0==(but->block->flag & UI_BLOCK_LOOP)) {
/* skip empty buttons, not all buttons need input, we only show invalid */
- if(but->drawstr[0])
+ if (but->drawstr[0])
ui_but_search_test(but);
}
}
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index c8fbda8c28a..25c616cc67e 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -83,16 +83,16 @@ void uiDrawBox(int mode, float minx, float miny, float maxx, float maxy, float r
int a;
/* mult */
- for(a=0; a<7; a++) {
+ for (a=0; a<7; a++) {
vec[a][0]*= rad; vec[a][1]*= rad;
}
glBegin(mode);
/* start with corner right-bottom */
- if(roundboxtype & UI_CNR_BOTTOM_RIGHT) {
+ if (roundboxtype & UI_CNR_BOTTOM_RIGHT) {
glVertex2f(maxx-rad, miny);
- for(a=0; a<7; a++) {
+ for (a=0; a<7; a++) {
glVertex2f(maxx-rad+vec[a][0], miny+vec[a][1]);
}
glVertex2f(maxx, miny+rad);
@@ -100,9 +100,9 @@ void uiDrawBox(int mode, float minx, float miny, float maxx, float maxy, float r
else glVertex2f(maxx, miny);
/* corner right-top */
- if(roundboxtype & UI_CNR_TOP_RIGHT) {
+ if (roundboxtype & UI_CNR_TOP_RIGHT) {
glVertex2f(maxx, maxy-rad);
- for(a=0; a<7; a++) {
+ for (a=0; a<7; a++) {
glVertex2f(maxx-vec[a][1], maxy-rad+vec[a][0]);
}
glVertex2f(maxx-rad, maxy);
@@ -110,9 +110,9 @@ void uiDrawBox(int mode, float minx, float miny, float maxx, float maxy, float r
else glVertex2f(maxx, maxy);
/* corner left-top */
- if(roundboxtype & UI_CNR_TOP_LEFT) {
+ if (roundboxtype & UI_CNR_TOP_LEFT) {
glVertex2f(minx+rad, maxy);
- for(a=0; a<7; a++) {
+ for (a=0; a<7; a++) {
glVertex2f(minx+rad-vec[a][0], maxy-vec[a][1]);
}
glVertex2f(minx, maxy-rad);
@@ -120,9 +120,9 @@ void uiDrawBox(int mode, float minx, float miny, float maxx, float maxy, float r
else glVertex2f(minx, maxy);
/* corner left-bottom */
- if(roundboxtype & UI_CNR_BOTTOM_LEFT) {
+ if (roundboxtype & UI_CNR_BOTTOM_LEFT) {
glVertex2f(minx, miny+rad);
- for(a=0; a<7; a++) {
+ for (a=0; a<7; a++) {
glVertex2f(minx+vec[a][1], miny+rad-vec[a][0]);
}
glVertex2f(minx+rad, miny);
@@ -154,7 +154,7 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl
int a;
/* mult */
- for(a=0; a<7; a++) {
+ for (a=0; a<7; a++) {
vec[a][0]*= rad; vec[a][1]*= rad;
}
/* get current color, needs to be outside of glBegin/End */
@@ -172,12 +172,12 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl
glBegin(mode);
/* start with corner right-bottom */
- if(roundboxtype & UI_CNR_BOTTOM_RIGHT) {
+ if (roundboxtype & UI_CNR_BOTTOM_RIGHT) {
round_box_shade_col(coltop, coldown, 0.0);
glVertex2f(maxx-rad, miny);
- for(a=0; a<7; a++) {
+ for (a=0; a<7; a++) {
round_box_shade_col(coltop, coldown, vec[a][1]*idiv);
glVertex2f(maxx-rad+vec[a][0], miny+vec[a][1]);
}
@@ -191,12 +191,12 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl
}
/* corner right-top */
- if(roundboxtype & UI_CNR_TOP_RIGHT) {
+ if (roundboxtype & UI_CNR_TOP_RIGHT) {
round_box_shade_col(coltop, coldown, (div-rad)*idiv);
glVertex2f(maxx, maxy-rad);
- for(a=0; a<7; a++) {
+ for (a=0; a<7; a++) {
round_box_shade_col(coltop, coldown, (div-rad+vec[a][1])*idiv);
glVertex2f(maxx-vec[a][1], maxy-rad+vec[a][0]);
}
@@ -209,12 +209,12 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl
}
/* corner left-top */
- if(roundboxtype & UI_CNR_TOP_LEFT) {
+ if (roundboxtype & UI_CNR_TOP_LEFT) {
round_box_shade_col(coltop, coldown, 1.0);
glVertex2f(minx+rad, maxy);
- for(a=0; a<7; a++) {
+ for (a=0; a<7; a++) {
round_box_shade_col(coltop, coldown, (div-vec[a][1])*idiv);
glVertex2f(minx+rad-vec[a][0], maxy-vec[a][1]);
}
@@ -228,12 +228,12 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl
}
/* corner left-bottom */
- if(roundboxtype & UI_CNR_BOTTOM_LEFT) {
+ if (roundboxtype & UI_CNR_BOTTOM_LEFT) {
round_box_shade_col(coltop, coldown, rad*idiv);
glVertex2f(minx, miny+rad);
- for(a=0; a<7; a++) {
+ for (a=0; a<7; a++) {
round_box_shade_col(coltop, coldown, (rad-vec[a][1])*idiv);
glVertex2f(minx+vec[a][1], miny+rad-vec[a][0]);
}
@@ -262,7 +262,7 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float
int a;
/* mult */
- for(a=0; a<7; a++) {
+ for (a=0; a<7; a++) {
vec[a][0]*= rad; vec[a][1]*= rad;
}
/* get current color, needs to be outside of glBegin/End */
@@ -280,11 +280,11 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float
glBegin(mode);
/* start with corner right-bottom */
- if(roundboxtype & UI_CNR_BOTTOM_RIGHT) {
+ if (roundboxtype & UI_CNR_BOTTOM_RIGHT) {
round_box_shade_col(colLeft, colRight, 0.0);
glVertex2f(maxx-rad, miny);
- for(a=0; a<7; a++) {
+ for (a=0; a<7; a++) {
round_box_shade_col(colLeft, colRight, vec[a][0]*idiv);
glVertex2f(maxx-rad+vec[a][0], miny+vec[a][1]);
}
@@ -298,11 +298,11 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float
}
/* corner right-top */
- if(roundboxtype & UI_CNR_TOP_RIGHT) {
+ if (roundboxtype & UI_CNR_TOP_RIGHT) {
round_box_shade_col(colLeft, colRight, 0.0);
glVertex2f(maxx, maxy-rad);
- for(a=0; a<7; a++) {
+ for (a=0; a<7; a++) {
round_box_shade_col(colLeft, colRight, (div-rad-vec[a][0])*idiv);
glVertex2f(maxx-vec[a][1], maxy-rad+vec[a][0]);
@@ -316,11 +316,11 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float
}
/* corner left-top */
- if(roundboxtype & UI_CNR_TOP_LEFT) {
+ if (roundboxtype & UI_CNR_TOP_LEFT) {
round_box_shade_col(colLeft, colRight, (div-rad)*idiv);
glVertex2f(minx+rad, maxy);
- for(a=0; a<7; a++) {
+ for (a=0; a<7; a++) {
round_box_shade_col(colLeft, colRight, (div-rad+vec[a][0])*idiv);
glVertex2f(minx+rad-vec[a][0], maxy-vec[a][1]);
}
@@ -334,11 +334,11 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float
}
/* corner left-bottom */
- if(roundboxtype & UI_CNR_BOTTOM_LEFT) {
+ if (roundboxtype & UI_CNR_BOTTOM_LEFT) {
round_box_shade_col(colLeft, colRight, 1.0);
glVertex2f(minx, miny+rad);
- for(a=0; a<7; a++) {
+ for (a=0; a<7; a++) {
round_box_shade_col(colLeft, colRight, (vec[a][0])*idiv);
glVertex2f(minx+vec[a][1], miny+rad-vec[a][0]);
}
@@ -360,7 +360,7 @@ void uiRoundRect(float minx, float miny, float maxx, float maxy, float rad)
{
float color[4];
- if(roundboxtype & UI_RB_ALPHA) {
+ if (roundboxtype & UI_RB_ALPHA) {
glGetFloatv(GL_CURRENT_COLOR, color);
color[3]= 0.5;
glColor4fv(color);
@@ -382,7 +382,7 @@ void uiRoundBox(float minx, float miny, float maxx, float maxy, float rad)
{
float color[4];
- if(roundboxtype & UI_RB_ALPHA) {
+ if (roundboxtype & UI_RB_ALPHA) {
glGetFloatv(GL_CURRENT_COLOR, color);
color[3]= 0.5;
glColor4fv(color);
@@ -401,7 +401,7 @@ void uiEmboss(float x1, float y1, float x2, float y2, int sel)
{
/* below */
- if(sel) glColor3ub(200,200,200);
+ if (sel) glColor3ub(200,200,200);
else glColor3ub(50,50,50);
fdrawline(x1, y1, x2, y1);
@@ -409,7 +409,7 @@ void uiEmboss(float x1, float y1, float x2, float y2, int sel)
fdrawline(x2, y1, x2, y2);
/* top */
- if(sel) glColor3ub(50,50,50);
+ if (sel) glColor3ub(50,50,50);
else glColor3ub(200,200,200);
fdrawline(x1, y2, x2, y2);
@@ -477,8 +477,8 @@ static void ui_draw_but_CHARTAB(uiBut *but)
int charmax = G.charmax;
/* FO_BUILTIN_NAME font in use. There are TTF FO_BUILTIN_NAME and non-TTF FO_BUILTIN_NAME fonts */
- if(!strcmp(G.selfont->name, FO_BUILTIN_NAME)) {
- if(G.ui_international == TRUE) {
+ if (!strcmp(G.selfont->name, FO_BUILTIN_NAME)) {
+ if (G.ui_international == TRUE) {
charmax = 0xff;
}
else {
@@ -487,7 +487,7 @@ static void ui_draw_but_CHARTAB(uiBut *but)
}
/* Category list exited without selecting the area */
- if(G.charmax == 0)
+ if (G.charmax == 0)
charmax = G.charmax = 0xffff;
/* Calculate the size of the button */
@@ -506,9 +506,9 @@ static void ui_draw_but_CHARTAB(uiBut *but)
cs = G.charstart;
/* Set the font, in case it is not FO_BUILTIN_NAME font */
- if(G.selfont && strcmp(G.selfont->name, FO_BUILTIN_NAME)) {
+ if (G.selfont && strcmp(G.selfont->name, FO_BUILTIN_NAME)) {
// Is the font file packed, if so then use the packed file
- if(G.selfont->packedfile) {
+ if (G.selfont->packedfile) {
pf = G.selfont->packedfile;
FTF_SetFont(pf->data, pf->size, 14.0);
}
@@ -522,7 +522,7 @@ static void ui_draw_but_CHARTAB(uiBut *but)
}
}
else {
- if(G.ui_international == TRUE) {
+ if (G.ui_international == TRUE) {
FTF_SetFont((unsigned char *) datatoc_bfont_ttf, datatoc_bfont_ttf_size, 14.0);
}
}
@@ -534,14 +534,14 @@ static void ui_draw_but_CHARTAB(uiBut *but)
glRectf((rect->xmin), (rect->ymin), (rect->xmax), (rect->ymax));
glColor3ub(0, 0, 0);
- for(y = 0; y < 6; y++) {
+ for (y = 0; y < 6; y++) {
// Do not draw more than the category allows
- if(cs > charmax) break;
+ if (cs > charmax) break;
- for(x = 0; x < 12; x++)
+ for (x = 0; x < 12; x++)
{
// Do not draw more than the category allows
- if(cs > charmax) break;
+ if (cs > charmax) break;
// Draw one grid cell
glBegin(GL_LINE_LOOP);
@@ -610,7 +610,7 @@ static void ui_draw_but_CHARTAB(uiBut *but)
glShadeModel(GL_FLAT);
/* Return Font Settings to original */
- if(U.fontsize && U.fontname[0]) {
+ if (U.fontsize && U.fontname[0]) {
result = FTF_SetFont((unsigned char *)U.fontname, 0, U.fontsize);
}
else if (U.fontsize) {
@@ -622,7 +622,7 @@ static void ui_draw_but_CHARTAB(uiBut *but)
}
/* resets the font size */
- if(G.ui_international == TRUE) {
+ if (G.ui_international == TRUE) {
// uiSetCurFont(but->block, UI_HELV);
}
}
@@ -769,8 +769,8 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol),
/* log scale for alpha */
alpha = scopes->wavefrm_alpha*scopes->wavefrm_alpha;
- for(c=0; c<3; c++) {
- for(i=0; i<3; i++) {
+ for (c=0; c<3; c++) {
+ for (i=0; i<3; i++) {
colors_alpha[c][i] = colors[c][i] * alpha;
colorsycc_alpha[c][i] = colorsycc[c][i] * alpha;
}
@@ -811,7 +811,7 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol),
fdrawline(rect.xmin+w, rect.ymin, rect.xmin+w, rect.ymax);
/* 16-235-240 level in case of ITU-R BT601/709 */
glColor4f(1.f, 0.4f, 0.f, 0.2f);
- if (ELEM(scopes->wavefrm_mode, SCOPES_WAVEFRM_YCC_601, SCOPES_WAVEFRM_YCC_709)){
+ if (ELEM(scopes->wavefrm_mode, SCOPES_WAVEFRM_YCC_601, SCOPES_WAVEFRM_YCC_709)) {
fdrawline(rect.xmin+22, yofs+h*16.0f/255.0f, rect.xmax+1, yofs+h*16.0f/255.0f);
fdrawline(rect.xmin+22, yofs+h*235.0f/255.0f, rect.xmin+w3, yofs+h*235.0f/255.0f);
fdrawline(rect.xmin+3*w3, yofs+h*235.0f/255.0f, rect.xmax+1, yofs+h*235.0f/255.0f);
@@ -826,7 +826,7 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol),
/* LUMA (1 channel) */
glBlendFunc(GL_ONE,GL_ONE);
glColor3f(alpha, alpha, alpha);
- if (scopes->wavefrm_mode == SCOPES_WAVEFRM_LUMA){
+ if (scopes->wavefrm_mode == SCOPES_WAVEFRM_LUMA) {
glBlendFunc(GL_ONE,GL_ONE);
@@ -1004,9 +1004,9 @@ void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wco
fdrawline(centerx - (diam/2)-5, centery, centerx + (diam/2)+5, centery);
fdrawline(centerx, centery - (diam/2)-5, centerx, centery + (diam/2)+5);
/* circles */
- for(j=0; j<5; j++) {
+ for (j=0; j<5; j++) {
glBegin(GL_LINE_STRIP);
- for(i=0; i<=360; i=i+15) {
+ for (i=0; i<=360; i=i+15) {
const float a= DEG2RADF((float)i);
const float r= (j+1)/10.0f;
glVertex2f(polar_to_x(centerx,diam,r,a), polar_to_y(centery,diam,r,a));
@@ -1018,7 +1018,7 @@ void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wco
fdrawline(polar_to_x(centerx, diam, 0.5f, skin_rad), polar_to_y(centery,diam,0.5,skin_rad),
polar_to_x(centerx, diam, 0.1f, skin_rad), polar_to_y(centery,diam,0.1,skin_rad));
/* saturation points */
- for(i=0; i<6; i++)
+ for (i=0; i<6; i++)
vectorscope_draw_target(centerx, centery, diam, colors[i]);
if (scopes->ok && scopes->vecscope != NULL) {
@@ -1055,7 +1055,7 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect)
float pos, colf[4]= {0,0,0,0}; /* initialize in case the colorband isn't valid */
coba= (ColorBand *)(but->editcoba? but->editcoba: but->poin);
- if(coba==NULL) return;
+ if (coba==NULL) return;
x1= rect->xmin;
y1= rect->ymin;
@@ -1086,7 +1086,7 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect)
glColor4fv( &cbd->r );
glVertex2fv(v1); glVertex2fv(v2);
- for( a = 1; a <= sizex; a++ ) {
+ for ( a = 1; a <= sizex; a++ ) {
pos = ((float)a) / (sizex-1);
do_colorband(coba, pos, colf);
if (but->block->color_profile != BLI_PR_NONE)
@@ -1117,10 +1117,10 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect)
cbd= coba->data;
glBegin(GL_LINES);
- for(a=0; a<coba->tot; a++, cbd++) {
+ for (a=0; a<coba->tot; a++, cbd++) {
v1[0]=v2[0]=v3[0]=v1a[0]=v2a[0]= x1+ cbd->pos*sizex;
- if(a==coba->cur) {
+ if (a==coba->cur) {
glColor3ub(0, 0, 0);
glVertex2fv(v1);
glVertex2fv(v3);
@@ -1185,7 +1185,7 @@ void ui_draw_but_NORMAL(uiBut *but, uiWidgetColors *wcol, rcti *rect)
glCullFace(GL_BACK); glEnable(GL_CULL_FACE);
/* disable blender light */
- for(a=0; a<8; a++) {
+ for (a=0; a<8; a++) {
old[a]= glIsEnabled(GL_LIGHT0+a);
glDisable(GL_LIGHT0+a);
}
@@ -1207,14 +1207,14 @@ void ui_draw_but_NORMAL(uiBut *but, uiWidgetColors *wcol, rcti *rect)
glPushMatrix();
glTranslatef(rect->xmin + 0.5f*(rect->xmax-rect->xmin), rect->ymin+ 0.5f*(rect->ymax-rect->ymin), 0.0f);
- if( rect->xmax-rect->xmin < rect->ymax-rect->ymin)
+ if ( rect->xmax-rect->xmin < rect->ymax-rect->ymin)
size= (rect->xmax-rect->xmin)/200.f;
else
size= (rect->ymax-rect->ymin)/200.f;
glScalef(size, size, size);
- if(displist==0) {
+ if (displist==0) {
GLUquadricObj *qobj;
displist= glGenLists(1);
@@ -1249,8 +1249,8 @@ void ui_draw_but_NORMAL(uiBut *but, uiWidgetColors *wcol, rcti *rect)
glPopMatrix();
/* enable blender light */
- for(a=0; a<8; a++) {
- if(old[a])
+ for (a=0; a<8; a++) {
+ if (old[a])
glEnable(GL_LIGHT0+a);
}
}
@@ -1262,8 +1262,8 @@ static void ui_draw_but_curve_grid(rcti *rect, float zoomx, float zoomy, float o
glBegin(GL_LINES);
dx= step*zoomx;
fx= rect->xmin + zoomx*(-offsx);
- if(fx > rect->xmin) fx -= dx*(floorf(fx-rect->xmin));
- while(fx < rect->xmax) {
+ if (fx > rect->xmin) fx -= dx*(floorf(fx-rect->xmin));
+ while (fx < rect->xmax) {
glVertex2f(fx, rect->ymin);
glVertex2f(fx, rect->ymax);
fx+= dx;
@@ -1271,8 +1271,8 @@ static void ui_draw_but_curve_grid(rcti *rect, float zoomx, float zoomy, float o
dy= step*zoomy;
fy= rect->ymin + zoomy*(-offsy);
- if(fy > rect->ymin) fy -= dy*(floorf(fy-rect->ymin));
- while(fy < rect->ymax) {
+ if (fy > rect->ymin) fy -= dy*(floorf(fy-rect->ymin));
+ while (fy < rect->ymax) {
glVertex2f(rect->xmin, fy);
glVertex2f(rect->xmax, fy);
fy+= dy;
@@ -1317,7 +1317,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
offsy= cumap->curr.ymin-but->aspect/zoomy;
/* backdrop */
- if(cumap->flag & CUMA_DO_CLIP) {
+ if (cumap->flag & CUMA_DO_CLIP) {
glColor3ubvShade((unsigned char *)wcol->inner, -20);
glRectf(rect->xmin, rect->ymin, rect->xmax, rect->ymax);
glColor3ubv((unsigned char*)wcol->inner);
@@ -1367,7 +1367,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
/* cfra option */
/* XXX 2.48 */
#if 0
- if(cumap->flag & CUMA_DRAW_CFRA) {
+ if (cumap->flag & CUMA_DRAW_CFRA) {
glColor3ub(0x60, 0xc0, 0x40);
glBegin(GL_LINES);
glVertex2f(rect->xmin + zoomx*(cumap->sample[0]-offsx), rect->ymin);
@@ -1379,8 +1379,8 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
/* XXX 2.48 */
#if 0
- if(cumap->flag & CUMA_DRAW_SAMPLE) {
- if(cumap->cur==3) {
+ if (cumap->flag & CUMA_DRAW_SAMPLE) {
+ if (cumap->cur==3) {
float lum= cumap->sample[0]*0.35f + cumap->sample[1]*0.45f + cumap->sample[2]*0.2f;
glColor3ub(240, 240, 240);
@@ -1390,9 +1390,9 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
glEnd();
}
else {
- if(cumap->cur==0)
+ if (cumap->cur==0)
glColor3ub(240, 100, 100);
- else if(cumap->cur==1)
+ else if (cumap->cur==1)
glColor3ub(100, 240, 100);
else
glColor3ub(100, 100, 240);
@@ -1411,25 +1411,25 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
glEnable(GL_BLEND);
glBegin(GL_LINE_STRIP);
- if(cuma->table==NULL)
+ if (cuma->table==NULL)
curvemapping_changed(cumap, 0); /* 0 = no remove doubles */
cmp= cuma->table;
/* first point */
- if((cuma->flag & CUMA_EXTEND_EXTRAPOLATE)==0)
+ if ((cuma->flag & CUMA_EXTEND_EXTRAPOLATE)==0)
glVertex2f(rect->xmin, rect->ymin + zoomy*(cmp[0].y-offsy));
else {
fx= rect->xmin + zoomx*(cmp[0].x-offsx + cuma->ext_in[0]);
fy= rect->ymin + zoomy*(cmp[0].y-offsy + cuma->ext_in[1]);
glVertex2f(fx, fy);
}
- for(a=0; a<=CM_TABLE; a++) {
+ for (a=0; a<=CM_TABLE; a++) {
fx= rect->xmin + zoomx*(cmp[a].x-offsx);
fy= rect->ymin + zoomy*(cmp[a].y-offsy);
glVertex2f(fx, fy);
}
/* last point */
- if((cuma->flag & CUMA_EXTEND_EXTRAPOLATE)==0)
+ if ((cuma->flag & CUMA_EXTEND_EXTRAPOLATE)==0)
glVertex2f(rect->xmax, rect->ymin + zoomy*(cmp[CM_TABLE].y-offsy));
else {
fx= rect->xmin + zoomx*(cmp[CM_TABLE].x-offsx - cuma->ext_out[0]);
@@ -1444,8 +1444,8 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
cmp= cuma->curve;
glPointSize(3.0f);
bglBegin(GL_POINTS);
- for(a=0; a<cuma->totpoint; a++) {
- if(cmp[a].flag & SELECT)
+ for (a=0; a<cuma->totpoint; a++) {
+ if (cmp[a].flag & SELECT)
UI_ThemeColor(TH_TEXT_HI);
else
UI_ThemeColor(TH_TEXT);
@@ -1475,7 +1475,7 @@ static ImBuf *scale_trackpreview_ibuf(ImBuf *ibuf, float track_pos[2], int width
scaleibuf= IMB_allocImBuf(width, height, 32, IB_rect);
- for(y= 0; y<height; y++) {
+ for (y= 0; y<height; y++) {
for (x= 0; x<width; x++) {
float src_x= scalex*(x)+margin-off_x;
float src_y= scaley*(y)+margin-off_y;
@@ -1506,14 +1506,14 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc
glGetIntegerv(GL_VIEWPORT, scissor);
glScissor(ar->winrct.xmin + (rect.xmin-1), ar->winrct.ymin+(rect.ymin-1), (rect.xmax+1)-(rect.xmin-1), (rect.ymax+1)-(rect.ymin-1));
- if(scopes->track_disabled) {
+ if (scopes->track_disabled) {
glColor4f(0.7f, 0.3f, 0.3f, 0.3f);
uiSetRoundBox(15);
uiDrawBox(GL_POLYGON, rect.xmin-1, rect.ymin, rect.xmax+1, rect.ymax+1, 3.0f);
ok= 1;
}
- else if(scopes->track_preview) {
+ else if (scopes->track_preview) {
/* additional margin around image */
/* NOTE: should be kept in sync with value from BKE_movieclip_update_scopes */
const int margin= 3;
@@ -1532,7 +1532,7 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc
width= rect.xmax-rect.xmin+1;
height = rect.ymax-rect.ymin;
- if(width > 0 && height > 0) {
+ if (width > 0 && height > 0) {
zoomx= (float)width / (scopes->track_preview->x-2*margin);
zoomy= (float)height / (scopes->track_preview->y-2*margin);
@@ -1549,8 +1549,8 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc
glTranslatef(off_x+rect.xmin+track_pos[0]*zoomx, off_y+rect.ymin+track_pos[1]*zoomy, 0.f);
glScissor(ar->winrct.xmin + rect.xmin, ar->winrct.ymin+rect.ymin, rect.xmax-rect.xmin, rect.ymax-rect.ymin);
- for(a= 0; a< 2; a++) {
- if(a==1) {
+ for (a= 0; a< 2; a++) {
+ if (a==1) {
glLineStipple(3, 0xaaaa);
glEnable(GL_LINE_STIPPLE);
UI_ThemeColor(TH_SEL_MARKER);
@@ -1574,7 +1574,7 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc
ok= 1;
}
- if(!ok) {
+ if (!ok) {
glColor4f(0.f, 0.f, 0.f, 0.3f);
uiSetRoundBox(15);
uiDrawBox(GL_POLYGON, rect.xmin-1, rect.ymin, rect.xmax+1, rect.ymax+1, 3.0f);
@@ -1647,14 +1647,14 @@ void ui_dropshadow(rctf *rct, float radius, float aspect, int UNUSED(select))
glEnable(GL_BLEND);
- if(radius > (rct->ymax-rct->ymin-10.0f)/2.0f)
+ if (radius > (rct->ymax-rct->ymin-10.0f)/2.0f)
rad= (rct->ymax-rct->ymin-10.0f)/2.0f;
else
rad= radius;
i= 12;
#if 0
- if(select) {
+ if (select) {
a= i*aspect; /* same as below */
}
else
@@ -1663,7 +1663,7 @@ void ui_dropshadow(rctf *rct, float radius, float aspect, int UNUSED(select))
a= i*aspect;
}
- for(; i--; a-=aspect) {
+ for (; i--; a-=aspect) {
/* alpha ranges from 2 to 20 or so */
glColor4ub(0, 0, 0, alpha);
alpha+= 2;
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index de5f12d597e..21c3f4ca038 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -212,18 +212,18 @@ static int ui_but_editable(uiBut *but)
static uiBut *ui_but_prev(uiBut *but)
{
- while(but->prev) {
+ while (but->prev) {
but= but->prev;
- if(!ui_but_editable(but)) return but;
+ if (!ui_but_editable(but)) return but;
}
return NULL;
}
static uiBut *ui_but_next(uiBut *but)
{
- while(but->next) {
+ while (but->next) {
but= but->next;
- if(!ui_but_editable(but)) return but;
+ if (!ui_but_editable(but)) return but;
}
return NULL;
}
@@ -233,8 +233,8 @@ static uiBut *ui_but_first(uiBlock *block)
uiBut *but;
but= block->buttons.first;
- while(but) {
- if(!ui_but_editable(but)) return but;
+ while (but) {
+ if (!ui_but_editable(but)) return but;
but= but->next;
}
return NULL;
@@ -245,8 +245,8 @@ static uiBut *ui_but_last(uiBlock *block)
uiBut *but;
but= block->buttons.last;
- while(but) {
- if(!ui_but_editable(but)) return but;
+ while (but) {
+ if (!ui_but_editable(but)) return but;
but= but->prev;
}
return NULL;
@@ -254,8 +254,8 @@ static uiBut *ui_but_last(uiBlock *block)
static int ui_is_a_warp_but(uiBut *but)
{
- if(U.uiflag & USER_CONTINUOUS_MOUSE)
- if(ELEM4(but->type, NUM, NUMABS, HSVCIRCLE, TRACKPREVIEW))
+ if (U.uiflag & USER_CONTINUOUS_MOUSE)
+ if (ELEM4(but->type, NUM, NUMABS, HSVCIRCLE, TRACKPREVIEW))
return TRUE;
return FALSE;
@@ -286,10 +286,10 @@ static void ui_apply_but_func(bContext *C, uiBut *but)
* handling is done, i.e. menus are closed, in order to avoid conflicts
* with these functions removing the buttons we are working with */
- if(but->func || but->funcN || block->handle_func || but->rename_func || (but->type == BUTM && block->butm_func) || but->optype || but->rnaprop) {
+ if (but->func || but->funcN || block->handle_func || but->rename_func || (but->type == BUTM && block->butm_func) || but->optype || but->rnaprop) {
after= MEM_callocN(sizeof(uiAfterFunc), "uiAfterFunc");
- if(but->func && ELEM(but, but->func_arg1, but->func_arg2)) {
+ if (but->func && ELEM(but, but->func_arg1, but->func_arg2)) {
/* exception, this will crash due to removed button otherwise */
but->func(C, but->func_arg1, but->func_arg2);
}
@@ -311,7 +311,7 @@ static void ui_apply_but_func(bContext *C, uiBut *but)
after->handle_func_arg= block->handle_func_arg;
after->retval= but->retval;
- if(but->type == BUTM) {
+ if (but->type == BUTM) {
after->butm_func= block->butm_func;
after->butm_func_arg= block->butm_func_arg;
after->a2= but->a2;
@@ -324,7 +324,7 @@ static void ui_apply_but_func(bContext *C, uiBut *but)
after->rnapoin= but->rnapoin;
after->rnaprop= but->rnaprop;
- if(but->context)
+ if (but->context)
after->context= CTX_store_copy(but->context);
but->optype= NULL;
@@ -340,17 +340,17 @@ static void ui_apply_autokey_undo(bContext *C, uiBut *but)
Scene *scene= CTX_data_scene(C);
uiAfterFunc *after;
- if(but->flag & UI_BUT_UNDO) {
+ if (but->flag & UI_BUT_UNDO) {
const char *str= NULL;
/* define which string to use for undo */
if ELEM(but->type, LINK, INLINK) str= "Add button link";
else if ELEM(but->type, MENU, ICONTEXTROW) str= but->drawstr;
- else if(but->drawstr[0]) str= but->drawstr;
+ else if (but->drawstr[0]) str= but->drawstr;
else str= but->tip;
/* fallback, else we don't get an undo! */
- if(str == NULL || str[0] == '\0') {
+ if (str == NULL || str[0] == '\0') {
str= "Unknown Action";
}
@@ -374,51 +374,51 @@ static void ui_apply_but_funcs_after(bContext *C)
funcs= UIAfterFuncs;
UIAfterFuncs.first= UIAfterFuncs.last= NULL;
- for(afterf=funcs.first; afterf; afterf=after.next) {
+ for (afterf=funcs.first; afterf; afterf=after.next) {
after= *afterf; /* copy to avoid memleak on exit() */
BLI_freelinkN(&funcs, afterf);
- if(after.context)
+ if (after.context)
CTX_store_set(C, after.context);
- if(after.opptr) {
+ if (after.opptr) {
/* free in advance to avoid leak on exit */
opptr= *after.opptr,
MEM_freeN(after.opptr);
}
- if(after.optype)
+ if (after.optype)
WM_operator_name_call(C, after.optype->idname, after.opcontext, (after.opptr)? &opptr: NULL);
- if(after.opptr)
+ if (after.opptr)
WM_operator_properties_free(&opptr);
- if(after.rnapoin.data)
+ if (after.rnapoin.data)
RNA_property_update(C, &after.rnapoin, after.rnaprop);
- if(after.context) {
+ if (after.context) {
CTX_store_set(C, NULL);
CTX_store_free(after.context);
}
- if(after.func)
+ if (after.func)
after.func(C, after.func_arg1, after.func_arg2);
- if(after.funcN)
+ if (after.funcN)
after.funcN(C, after.func_argN, after.func_arg2);
- if(after.func_argN)
+ if (after.func_argN)
MEM_freeN(after.func_argN);
- if(after.handle_func)
+ if (after.handle_func)
after.handle_func(C, after.handle_func_arg, after.retval);
- if(after.butm_func)
+ if (after.butm_func)
after.butm_func(C, after.butm_func_arg, after.a2);
- if(after.rename_func)
+ if (after.rename_func)
after.rename_func(C, after.rename_arg1, after.rename_orig);
- if(after.rename_orig)
+ if (after.rename_orig)
MEM_freeN(after.rename_orig);
- if(after.undostr[0])
+ if (after.undostr[0])
ED_undo_push(C, after.undostr);
}
}
@@ -442,7 +442,7 @@ static void ui_apply_but_BUTM(bContext *C, uiBut *but, uiHandleButtonData *data)
static void ui_apply_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data)
{
- if(ELEM3(but->type, MENU, ICONROW, ICONTEXTROW))
+ if (ELEM3(but->type, MENU, ICONROW, ICONTEXTROW))
ui_set_but_val(but, data->value);
ui_check_but(but);
@@ -457,50 +457,50 @@ static void ui_apply_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data)
int w, lvalue, push;
/* local hack... */
- if(but->type==BUT_TOGDUAL && data->togdual) {
- if(but->pointype==SHO)
+ if (but->type==BUT_TOGDUAL && data->togdual) {
+ if (but->pointype==SHO)
but->poin += 2;
- else if(but->pointype==INT)
+ else if (but->pointype==INT)
but->poin += 4;
}
value= ui_get_but_val(but);
lvalue= (int)value;
- if(but->bit) {
+ if (but->bit) {
w= BTST(lvalue, but->bitnr);
- if(w) lvalue = BCLR(lvalue, but->bitnr);
+ if (w) lvalue = BCLR(lvalue, but->bitnr);
else lvalue = BSET(lvalue, but->bitnr);
- if(but->type==TOGR) {
- if(!data->togonly) {
+ if (but->type==TOGR) {
+ if (!data->togonly) {
lvalue= 1<<(but->bitnr);
ui_set_but_val(but, (double)lvalue);
}
else {
- if(lvalue==0) lvalue= 1<<(but->bitnr);
+ if (lvalue==0) lvalue= 1<<(but->bitnr);
}
}
ui_set_but_val(but, (double)lvalue);
- if(but->type==ICONTOG || but->type==ICONTOGN) ui_check_but(but);
+ if (but->type==ICONTOG || but->type==ICONTOGN) ui_check_but(but);
}
else {
- if(value==0.0) push= 1;
+ if (value==0.0) push= 1;
else push= 0;
- if(ELEM3(but->type, TOGN, ICONTOGN, OPTIONN)) push= !push;
+ if (ELEM3(but->type, TOGN, ICONTOGN, OPTIONN)) push= !push;
ui_set_but_val(but, (double)push);
- if(but->type==ICONTOG || but->type==ICONTOGN) ui_check_but(but);
+ if (but->type==ICONTOG || but->type==ICONTOGN) ui_check_but(but);
}
/* end local hack... */
- if(but->type==BUT_TOGDUAL && data->togdual) {
- if(but->pointype==SHO)
+ if (but->type==BUT_TOGDUAL && data->togdual) {
+ if (but->pointype==SHO)
but->poin -= 2;
- else if(but->pointype==INT)
+ else if (but->pointype==INT)
but->poin -= 4;
}
@@ -517,8 +517,8 @@ static void ui_apply_but_ROW(bContext *C, uiBlock *block, uiBut *but, uiHandleBu
ui_set_but_val(but, but->hardmax);
/* states of other row buttons */
- for(bt= block->buttons.first; bt; bt= bt->next)
- if(bt!=but && bt->poin==but->poin && ELEM(bt->type, ROW, LISTROW))
+ for (bt= block->buttons.first; bt; bt= bt->next)
+ if (bt!=but && bt->poin==but->poin && ELEM(bt->type, ROW, LISTROW))
ui_check_but(bt);
ui_apply_but_func(C, but);
@@ -529,7 +529,7 @@ static void ui_apply_but_ROW(bContext *C, uiBlock *block, uiBut *but, uiHandleBu
static void ui_apply_but_TEX(bContext *C, uiBut *but, uiHandleButtonData *data)
{
- if(!data->str)
+ if (!data->str)
return;
ui_set_but_string(C, but, data->str);
@@ -548,8 +548,8 @@ static void ui_apply_but_TEX(bContext *C, uiBut *but, uiHandleButtonData *data)
static void ui_apply_but_NUM(bContext *C, uiBut *but, uiHandleButtonData *data)
{
- if(data->str) {
- if(ui_set_but_string(C, but, data->str)) {
+ if (data->str) {
+ if (ui_set_but_string(C, but, data->str)) {
data->value= ui_get_but_val(but);
}
else {
@@ -569,27 +569,29 @@ static void ui_apply_but_NUM(bContext *C, uiBut *but, uiHandleButtonData *data)
static void ui_apply_but_TOG3(bContext *C, uiBut *but, uiHandleButtonData *data)
{
- if(but->pointype==SHO ) {
+ if (but->pointype==SHO ) {
short *sp= (short *)but->poin;
- if( BTST(sp[1], but->bitnr)) {
+ if ( BTST(sp[1], but->bitnr)) {
sp[1]= BCLR(sp[1], but->bitnr);
sp[0]= BCLR(sp[0], but->bitnr);
}
- else if( BTST(sp[0], but->bitnr)) {
+ else if ( BTST(sp[0], but->bitnr)) {
sp[1]= BSET(sp[1], but->bitnr);
- } else {
+ }
+ else {
sp[0]= BSET(sp[0], but->bitnr);
}
}
else {
- if( BTST(*(but->poin+2), but->bitnr)) {
+ if ( BTST(*(but->poin+2), but->bitnr)) {
*(but->poin+2)= BCLR(*(but->poin+2), but->bitnr);
*(but->poin)= BCLR(*(but->poin), but->bitnr);
}
- else if( BTST(*(but->poin), but->bitnr)) {
+ else if ( BTST(*(but->poin), but->bitnr)) {
*(but->poin+2)= BSET(*(but->poin+2), but->bitnr);
- } else {
+ }
+ else {
*(but->poin)= BSET(*(but->poin), but->bitnr);
}
}
@@ -654,8 +656,8 @@ static int ui_but_mouse_inside_icon(uiBut *but, ARegion *ar, wmEvent *event)
rect.xmin = but->x1; rect.xmax = but->x2;
rect.ymin = but->y1; rect.ymax = but->y2;
- if(but->imb); /* use button size itself */
- else if(but->flag & UI_ICON_LEFT) {
+ if (but->imb); /* use button size itself */
+ else if (but->flag & UI_ICON_LEFT) {
rect.xmax = rect.xmin + (rect.ymax-rect.ymin);
}
else {
@@ -672,14 +674,14 @@ static int ui_but_start_drag(bContext *C, uiBut *but, uiHandleButtonData *data,
/* prevent other WM gestures to start while we try to drag */
WM_gestures_remove(C);
- if( ABS(data->dragstartx - event->x) + ABS(data->dragstarty - event->y) > U.dragthreshold ) {
+ if ( ABS(data->dragstartx - event->x) + ABS(data->dragstarty - event->y) > U.dragthreshold ) {
wmDrag *drag;
button_activate_state(C, but, BUTTON_STATE_EXIT);
data->cancel= 1;
drag= WM_event_start_drag(C, but->icon, but->dragtype, but->dragpoin, ui_get_but_val(but));
- if(but->imb)
+ if (but->imb)
WM_event_drag_image(drag, but->imb, but->imb_scale, but->x2-but->x1, but->y2-but->y1);
return 1;
}
@@ -697,31 +699,31 @@ static void ui_delete_active_linkline(uiBlock *block)
int a, b;
but= block->buttons.first;
- while(but) {
- if(but->type==LINK && but->link) {
+ while (but) {
+ if (but->type==LINK && but->link) {
line= but->link->lines.first;
- while(line) {
+ while (line) {
nline= line->next;
- if(line->flag & UI_SELECT) {
+ if (line->flag & UI_SELECT) {
BLI_remlink(&but->link->lines, line);
link= line->from->link;
/* are there more pointers allowed? */
- if(link->ppoin) {
+ if (link->ppoin) {
- if(*(link->totlink)==1) {
+ if (*(link->totlink)==1) {
*(link->totlink)= 0;
MEM_freeN(*(link->ppoin));
*(link->ppoin)= NULL;
}
else {
b= 0;
- for(a=0; a< (*(link->totlink)); a++) {
+ for (a=0; a< (*(link->totlink)); a++) {
- if( (*(link->ppoin))[a] != line->to->poin ) {
+ if ( (*(link->ppoin))[a] != line->to->poin ) {
(*(link->ppoin))[b]= (*(link->ppoin))[a];
b++;
}
@@ -749,10 +751,10 @@ static uiLinkLine *ui_is_a_link(uiBut *from, uiBut *to)
uiLink *link;
link= from->link;
- if(link) {
+ if (link) {
line= link->lines.first;
- while(line) {
- if(line->from==from && line->to==to) return line;
+ while (line) {
+ if (line->from==from && line->to==to) return line;
line= line->next;
}
}
@@ -772,7 +774,7 @@ static void ui_add_smart_controller(bContext *C, uiBut *from, uiBut *to)
uiLink *link= from->link;
- if(link->ppoin)
+ if (link->ppoin)
sens_from_links= (bController ***)(link->ppoin);
else return;
@@ -790,7 +792,7 @@ static void ui_add_smart_controller(bContext *C, uiBut *from, uiBut *to)
if (ob) break;
} CTX_DATA_END;
- if(!ob) return;
+ if (!ob) return;
/* (2) check if the sensor and the actuator are from the same object */
for (act_iter= ob->actuators.first; act_iter; act_iter= (bActuator *)act_iter->next) {
@@ -799,7 +801,7 @@ static void ui_add_smart_controller(bContext *C, uiBut *from, uiBut *to)
}
// only works if the sensor and the actuator are from the same object
- if(!act_iter) return;
+ if (!act_iter) return;
/* (3) add a new controller */
if (WM_operator_name_call(C, "LOGIC_OT_controller_add", WM_OP_EXEC_DEFAULT, NULL) & OPERATOR_FINISHED) {
@@ -831,7 +833,7 @@ static void ui_add_link(bContext *C, uiBut *from, uiBut *to)
void **oldppoin;
int a;
- if( (line= ui_is_a_link(from, to)) ) {
+ if ( (line= ui_is_a_link(from, to)) ) {
line->flag |= UI_SELECT;
ui_delete_active_linkline(from->block);
return;
@@ -841,13 +843,13 @@ static void ui_add_link(bContext *C, uiBut *from, uiBut *to)
return;
}
else if (from->type==LINK && to->type==INLINK) {
- if( from->link->tocode != (int)to->hardmin ) {
+ if ( from->link->tocode != (int)to->hardmin ) {
ui_add_smart_controller(C, from, to);
return;
}
}
- else if(from->type==INLINK && to->type==LINK) {
- if( to->link->tocode == (int)from->hardmin ) {
+ else if (from->type==INLINK && to->type==LINK) {
+ if ( to->link->tocode == (int)from->hardmin ) {
return;
}
}
@@ -855,18 +857,18 @@ static void ui_add_link(bContext *C, uiBut *from, uiBut *to)
link= from->link;
/* are there more pointers allowed? */
- if(link->ppoin) {
+ if (link->ppoin) {
oldppoin= *(link->ppoin);
(*(link->totlink))++;
*(link->ppoin)= MEM_callocN( *(link->totlink)*sizeof(void *), "new link");
- for(a=0; a< (*(link->totlink))-1; a++) {
+ for (a=0; a< (*(link->totlink))-1; a++) {
(*(link->ppoin))[a]= oldppoin[a];
}
(*(link->ppoin))[a]= to->poin;
- if(oldppoin) MEM_freeN(oldppoin);
+ if (oldppoin) MEM_freeN(oldppoin);
}
else {
*(link->poin)= to->poin;
@@ -880,15 +882,15 @@ static void ui_apply_but_LINK(bContext *C, uiBut *but, uiHandleButtonData *data)
ARegion *ar= CTX_wm_region(C);
uiBut *bt;
- for(bt= but->block->buttons.first; bt; bt= bt->next) {
- if( ui_mouse_inside_button(ar, bt, but->linkto[0]+ar->winrct.xmin, but->linkto[1]+ar->winrct.ymin) )
+ for (bt= but->block->buttons.first; bt; bt= bt->next) {
+ if ( ui_mouse_inside_button(ar, bt, but->linkto[0]+ar->winrct.xmin, but->linkto[1]+ar->winrct.ymin) )
break;
}
- if(bt && bt!=but) {
+ if (bt && bt!=but) {
if (!ELEM(bt->type, LINK, INLINK) || !ELEM(but->type, LINK, INLINK))
return;
- if(but->type==LINK) ui_add_link(C, but, bt);
+ if (but->type==LINK) ui_add_link(C, but, bt);
else ui_add_link(C, bt, but);
ui_apply_but_func(C, but);
@@ -938,11 +940,11 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
/* if we cancel and have not applied yet, there is nothing to do,
* otherwise we have to restore the original value again */
- if(data->cancel) {
- if(!data->applied)
+ if (data->cancel) {
+ if (!data->applied)
return;
- if(data->str) MEM_freeN(data->str);
+ if (data->str) MEM_freeN(data->str);
data->str= data->origstr;
data->origstr= NULL;
data->value= data->origvalue;
@@ -953,9 +955,9 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
else {
/* we avoid applying interactive edits a second time
* at the end with the appliedinteractive flag */
- if(interactive)
+ if (interactive)
data->appliedinteractive= 1;
- else if(data->appliedinteractive)
+ else if (data->appliedinteractive)
return;
}
@@ -1076,13 +1078,13 @@ static void ui_but_drop(bContext *C, wmEvent *event, uiBut *but, uiHandleButtonD
wmDrag *wmd;
ListBase *drags= event->customdata; /* drop event type has listbase customdata by default */
- for(wmd= drags->first; wmd; wmd= wmd->next) {
- if(wmd->type==WM_DRAG_ID) {
+ for (wmd= drags->first; wmd; wmd= wmd->next) {
+ if (wmd->type==WM_DRAG_ID) {
/* align these types with UI_but_active_drop_name */
- if(ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) {
+ if (ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) {
ID *id= (ID *)wmd->poin;
- if(but->poin==NULL && but->rnapoin.data==NULL) {}
+ if (but->poin==NULL && but->rnapoin.data==NULL) {}
button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
BLI_strncpy(data->str, id->name+2, data->maxlen);
button_activate_state(C, but, BUTTON_STATE_EXIT);
@@ -1100,14 +1102,14 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
static ColorBand but_copypaste_coba = {0};
char buf[UI_MAX_DRAW_STR+1]= {0};
- if(mode=='v' && but->lock)
+ if (mode=='v' && but->lock)
return;
- if(mode=='v') {
+ if (mode=='v') {
/* extract first line from clipboard in case of multi-line copies */
char *p, *pbuf= WM_clipboard_text_get(0);
p= pbuf;
- if(p) {
+ if (p) {
int i = 0;
while (*p && *p!='\r' && *p!='\n' && i<UI_MAX_DRAW_STR) {
buf[i++]=*p;
@@ -1121,8 +1123,8 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
/* numeric value */
if ELEM4(but->type, NUM, NUMABS, NUMSLI, HSVSLI) {
- if(but->poin==NULL && but->rnapoin.data==NULL);
- else if(mode=='c') {
+ if (but->poin==NULL && but->rnapoin.data==NULL);
+ else if (mode=='c') {
ui_get_but_string(but, buf, sizeof(buf));
WM_clipboard_text_set(buf, 0);
}
@@ -1139,11 +1141,11 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
}
/* RGB triple */
- else if(but->type==COL) {
+ else if (but->type==COL) {
float rgb[3];
- if(but->poin==NULL && but->rnapoin.data==NULL);
- else if(mode=='c') {
+ if (but->poin==NULL && but->rnapoin.data==NULL);
+ else if (mode=='c') {
ui_get_but_vectorf(but, rgb);
BLI_snprintf(buf, sizeof(buf), "[%f, %f, %f]", rgb[0], rgb[1], rgb[2]);
@@ -1160,11 +1162,11 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
}
/* text/string and ID data */
- else if(ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) {
+ else if (ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) {
uiHandleButtonData *active_data= but->active;
- if(but->poin==NULL && but->rnapoin.data==NULL);
- else if(mode=='c') {
+ if (but->poin==NULL && but->rnapoin.data==NULL);
+ else if (mode=='c') {
button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
BLI_strncpy(buf, active_data->str, UI_MAX_DRAW_STR);
WM_clipboard_text_set(active_data->str, 0);
@@ -1174,10 +1176,10 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
else {
button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
- if(ui_is_but_utf8(but)) BLI_strncpy_utf8(active_data->str, buf, active_data->maxlen);
+ if (ui_is_but_utf8(but)) BLI_strncpy_utf8(active_data->str, buf, active_data->maxlen);
else BLI_strncpy(active_data->str, buf, active_data->maxlen);
- if(but->type == SEARCH_MENU) {
+ if (but->type == SEARCH_MENU) {
/* else uiSearchboxData.active member is not updated [#26856] */
ui_searchbox_update(C, data->searchbox, but, 1);
}
@@ -1185,18 +1187,18 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
}
}
/* colorband (not supported by system clipboard) */
- else if(but->type==BUT_COLORBAND) {
- if(mode=='c') {
- if(but->poin==NULL)
+ else if (but->type==BUT_COLORBAND) {
+ if (mode=='c') {
+ if (but->poin==NULL)
return;
memcpy(&but_copypaste_coba, but->poin, sizeof(ColorBand));
}
else {
- if(but_copypaste_coba.tot==0)
+ if (but_copypaste_coba.tot==0)
return;
- if(!but->poin)
+ if (!but->poin)
but->poin= MEM_callocN(sizeof(ColorBand), "colorband");
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
@@ -1206,7 +1208,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
}
/* operator button (any type) */
else if (but->optype) {
- if(mode=='c') {
+ if (mode=='c') {
PointerRNA *opptr;
char *str;
opptr= uiButGetOperatorPtrRNA(but); /* allocated when needed, the button owns it */
@@ -1228,7 +1230,7 @@ static int ui_textedit_delete_selection(uiBut *but, uiHandleButtonData *data)
char *str= data->str;
int len= strlen(str);
int change= 0;
- if(but->selsta != but->selend && len) {
+ if (but->selsta != but->selend && len) {
memmove(str + but->selsta, str + but->selend, (len - but->selend) + 1);
change= 1;
}
@@ -1255,9 +1257,9 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, sho
BLI_strncpy(origstr, but->drawstr, data->maxlen);
/* XXX solve generic */
- if(but->type==NUM || but->type==NUMSLI)
+ if (but->type==NUM || but->type==NUMSLI)
startx += (int)(0.5f*(but->y2 - but->y1));
- else if(ELEM(but->type, TEX, SEARCH_MENU)) {
+ else if (ELEM(but->type, TEX, SEARCH_MENU)) {
startx += 5;
if (but->flag & UI_HAS_ICON)
startx += UI_DPI_ICON_SIZE;
@@ -1319,7 +1321,7 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, sho
}
}
but->pos += but->ofs;
- if(but->pos<0) but->pos= 0;
+ if (but->pos<0) but->pos= 0;
}
if (fstyle->kerning == 1)
@@ -1353,7 +1355,7 @@ static int ui_textedit_type_buf(uiBut *but, uiHandleButtonData *data,
str= data->str;
len= strlen(str);
- if(len-(but->selend - but->selsta)+1 <= data->maxlen) {
+ if (len-(but->selend - but->selsta)+1 <= data->maxlen) {
int step= utf8_buf_len;
/* type over the current selection */
@@ -1362,7 +1364,7 @@ static int ui_textedit_type_buf(uiBut *but, uiHandleButtonData *data,
len= strlen(str);
}
- if(len + step < data->maxlen) {
+ if (len + step < data->maxlen) {
memmove(&str[but->pos + step], &str[but->pos], (len + 1) - but->pos);
memcpy(&str[but->pos], utf8_buf, step * sizeof(char));
but->pos += step;
@@ -1417,11 +1419,11 @@ static void ui_textedit_move(uiBut *but, uiHandleButtonData *data, strCursorJump
BLI_str_cursor_step_utf8(str, len, &pos_i, direction, jump);
but->pos = pos_i;
- if(select) {
+ if (select) {
/* existing selection */
if (has_sel) {
- if(data->selextend == 0) {
+ if (data->selextend == 0) {
data->selextend= EXTEND_RIGHT;
}
@@ -1472,11 +1474,11 @@ static int ui_textedit_delete(uiBut *but, uiHandleButtonData *data, int directio
int changed= 0;
if (jump == STRCUR_JUMP_ALL) {
- if(len) changed=1;
+ if (len) changed=1;
str[0]= '\0';
but->pos= 0;
}
- else if(direction) { /* delete */
+ else if (direction) { /* delete */
if ((but->selend - but->selsta) > 0) {
changed= ui_textedit_delete_selection(but, data);
}
@@ -1494,7 +1496,7 @@ static int ui_textedit_delete(uiBut *but, uiHandleButtonData *data, int directio
if ((but->selend - but->selsta) > 0) {
changed= ui_textedit_delete_selection(but, data);
}
- else if(but->pos>0) {
+ else if (but->pos>0) {
int pos = but->pos;
int step;
@@ -1517,7 +1519,7 @@ static int ui_textedit_autocomplete(bContext *C, uiBut *but, uiHandleButtonData
str= data->str;
- if(data->searchbox)
+ if (data->searchbox)
ui_searchbox_autocomplete(C, data->searchbox, but, data->str);
else
but->autocomplete_func(C, str, but->autofunc_arg);
@@ -1542,7 +1544,7 @@ static int ui_textedit_copypaste(uiBut *but, uiHandleButtonData *data, int paste
/* extract the first line from the clipboard */
p = pbuf= WM_clipboard_text_get(0);
- if(p && p[0]) {
+ if (p && p[0]) {
unsigned int y;
i= 0;
while (*p && *p!='\r' && *p!='\n' && i<UI_MAX_DRAW_STR-1) {
@@ -1560,8 +1562,8 @@ static int ui_textedit_copypaste(uiBut *but, uiHandleButtonData *data, int paste
for (y=0; y<strlen(buf); y++)
{
/* add contents of buffer */
- if(len+1 < data->maxlen) {
- for(x= data->maxlen; x>but->pos; x--)
+ if (len+1 < data->maxlen) {
+ for (x= data->maxlen; x>but->pos; x--)
str[x]= str[x-1];
str[but->pos]= buf[y];
but->pos++;
@@ -1580,7 +1582,7 @@ static int ui_textedit_copypaste(uiBut *but, uiHandleButtonData *data, int paste
/* cut & copy */
else if (copy || cut) {
/* copy the contents to the copypaste buffer */
- for(x= but->selsta; x <= but->selend; x++) {
+ for (x= but->selsta; x <= but->selend; x++) {
if (x==but->selend)
buf[x] = '\0';
else
@@ -1590,8 +1592,8 @@ static int ui_textedit_copypaste(uiBut *but, uiHandleButtonData *data, int paste
WM_clipboard_text_set(buf, 0);
/* for cut only, delete the selection afterwards */
- if(cut)
- if((but->selend - but->selsta) > 0)
+ if (cut)
+ if ((but->selend - but->selsta) > 0)
changed= ui_textedit_delete_selection(but, data);
}
@@ -1602,7 +1604,7 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data)
{
int len;
- if(data->str) {
+ if (data->str) {
MEM_freeN(data->str);
data->str= NULL;
}
@@ -1612,7 +1614,7 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data)
data->str= MEM_callocN(sizeof(char)*data->maxlen + 1, "textedit str");
ui_get_but_string(but, data->str, data->maxlen);
- if(ELEM3(but->type, NUM, NUMABS, NUMSLI)) {
+ if (ELEM3(but->type, NUM, NUMABS, NUMSLI)) {
ui_convert_to_unit_alt_name(but, data->str, data->maxlen);
}
@@ -1630,7 +1632,7 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data)
but->selend = len;
/* optional searchbox */
- if(but->type==SEARCH_MENU) {
+ if (but->type==SEARCH_MENU) {
data->searchbox= ui_searchbox_create(C, data->region, but);
ui_searchbox_update(C, data->searchbox, but, 1); /* 1= reset */
}
@@ -1642,18 +1644,18 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data)
static void ui_textedit_end(bContext *C, uiBut *but, uiHandleButtonData *data)
{
- if(but) {
- if(ui_is_but_utf8(but)) {
+ if (but) {
+ if (ui_is_but_utf8(but)) {
int strip= BLI_utf8_invalid_strip(but->editstr, strlen(but->editstr));
/* not a file?, strip non utf-8 chars */
- if(strip) {
+ if (strip) {
/* wont happen often so isn't that annoying to keep it here for a while */
printf("%s: invalid utf8 - stripped chars %d\n", __func__, strip);
}
}
- if(data->searchbox) {
- if(data->cancel==0)
+ if (data->searchbox) {
+ if (data->cancel==0)
ui_searchbox_apply(but, data->searchbox);
ui_searchbox_free(C, data->searchbox);
@@ -1672,21 +1674,21 @@ static void ui_textedit_next_but(uiBlock *block, uiBut *actbut, uiHandleButtonDa
uiBut *but;
/* label and roundbox can overlap real buttons (backdrops...) */
- if(ELEM4(actbut->type, LABEL, SEPR, ROUNDBOX, LISTBOX))
+ if (ELEM4(actbut->type, LABEL, SEPR, ROUNDBOX, LISTBOX))
return;
- for(but= actbut->next; but; but= but->next) {
- if(ELEM7(but->type, TEX, NUM, NUMABS, NUMSLI, HSVSLI, IDPOIN, SEARCH_MENU)) {
- if(!(but->flag & UI_BUT_DISABLED)) {
+ for (but= actbut->next; but; but= but->next) {
+ if (ELEM7(but->type, TEX, NUM, NUMABS, NUMSLI, HSVSLI, IDPOIN, SEARCH_MENU)) {
+ if (!(but->flag & UI_BUT_DISABLED)) {
data->postbut= but;
data->posttype= BUTTON_ACTIVATE_TEXT_EDITING;
return;
}
}
}
- for(but= block->buttons.first; but!=actbut; but= but->next) {
- if(ELEM7(but->type, TEX, NUM, NUMABS, NUMSLI, HSVSLI, IDPOIN, SEARCH_MENU)) {
- if(!(but->flag & UI_BUT_DISABLED)) {
+ for (but= block->buttons.first; but!=actbut; but= but->next) {
+ if (ELEM7(but->type, TEX, NUM, NUMABS, NUMSLI, HSVSLI, IDPOIN, SEARCH_MENU)) {
+ if (!(but->flag & UI_BUT_DISABLED)) {
data->postbut= but;
data->posttype= BUTTON_ACTIVATE_TEXT_EDITING;
return;
@@ -1700,21 +1702,21 @@ static void ui_textedit_prev_but(uiBlock *block, uiBut *actbut, uiHandleButtonDa
uiBut *but;
/* label and roundbox can overlap real buttons (backdrops...) */
- if(ELEM4(actbut->type, LABEL, SEPR, ROUNDBOX, LISTBOX))
+ if (ELEM4(actbut->type, LABEL, SEPR, ROUNDBOX, LISTBOX))
return;
- for(but= actbut->prev; but; but= but->prev) {
- if(ELEM7(but->type, TEX, NUM, NUMABS, NUMSLI, HSVSLI, IDPOIN, SEARCH_MENU)) {
- if(!(but->flag & UI_BUT_DISABLED)) {
+ for (but= actbut->prev; but; but= but->prev) {
+ if (ELEM7(but->type, TEX, NUM, NUMABS, NUMSLI, HSVSLI, IDPOIN, SEARCH_MENU)) {
+ if (!(but->flag & UI_BUT_DISABLED)) {
data->postbut= but;
data->posttype= BUTTON_ACTIVATE_TEXT_EDITING;
return;
}
}
}
- for(but= block->buttons.last; but!=actbut; but= but->prev) {
- if(ELEM7(but->type, TEX, NUM, NUMABS, NUMSLI, HSVSLI, IDPOIN, SEARCH_MENU)) {
- if(!(but->flag & UI_BUT_DISABLED)) {
+ for (but= block->buttons.last; but!=actbut; but= but->prev) {
+ if (ELEM7(but->type, TEX, NUM, NUMABS, NUMSLI, HSVSLI, IDPOIN, SEARCH_MENU)) {
+ if (!(but->flag & UI_BUT_DISABLED)) {
data->postbut= but;
data->posttype= BUTTON_ACTIVATE_TEXT_EDITING;
return;
@@ -1732,7 +1734,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
case WHEELUPMOUSE:
case WHEELDOWNMOUSE:
case MOUSEMOVE:
- if(data->searchbox)
+ if (data->searchbox)
ui_searchbox_event(C, data->searchbox, but, event);
break;
@@ -1746,10 +1748,10 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
case LEFTMOUSE: {
/* exit on LMB only on RELEASE for searchbox, to mimic other popups, and allow multiple menu levels */
- if(data->searchbox)
+ if (data->searchbox)
inbox= ui_searchbox_inside(data->searchbox, event->x, event->y);
- if(event->val==KM_PRESS) {
+ if (event->val==KM_PRESS) {
mx= event->x;
my= event->y;
ui_window_to_block(data->region, block, &mx, &my);
@@ -1762,15 +1764,15 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
button_activate_state(C, but, BUTTON_STATE_TEXT_SELECTING);
retval= WM_UI_HANDLER_BREAK;
}
- else if(inbox==0) {
+ else if (inbox==0) {
/* if searchbox, click outside will cancel */
- if(data->searchbox)
+ if (data->searchbox)
data->cancel= data->escapecancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
retval= WM_UI_HANDLER_BREAK;
}
}
- else if(inbox) {
+ else if (inbox) {
button_activate_state(C, but, BUTTON_STATE_EXIT);
retval= WM_UI_HANDLER_BREAK;
}
@@ -1778,17 +1780,17 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
}
}
- if(event->val==KM_PRESS) {
+ if (event->val==KM_PRESS) {
switch (event->type) {
case VKEY:
case XKEY:
case CKEY:
- if(event->ctrl || event->oskey) {
- if(event->type == VKEY)
+ if (event->ctrl || event->oskey) {
+ if (event->type == VKEY)
changed= ui_textedit_copypaste(but, data, 1, 0, 0);
- else if(event->type == CKEY)
+ else if (event->type == CKEY)
changed= ui_textedit_copypaste(but, data, 0, 1, 0);
- else if(event->type == XKEY)
+ else if (event->type == XKEY)
changed= ui_textedit_copypaste(but, data, 0, 0, 1);
retval= WM_UI_HANDLER_BREAK;
@@ -1803,7 +1805,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
retval= WM_UI_HANDLER_BREAK;
break;
case DOWNARROWKEY:
- if(data->searchbox) {
+ if (data->searchbox) {
ui_searchbox_event(C, data->searchbox, but, event);
break;
}
@@ -1813,7 +1815,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
retval= WM_UI_HANDLER_BREAK;
break;
case UPARROWKEY:
- if(data->searchbox) {
+ if (data->searchbox) {
ui_searchbox_event(C, data->searchbox, but, event);
break;
}
@@ -1839,12 +1841,12 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
case TABKEY:
/* there is a key conflict here, we can't tab with autocomplete */
- if(but->autocomplete_func || data->searchbox) {
+ if (but->autocomplete_func || data->searchbox) {
changed= ui_textedit_autocomplete(C, but, data);
update= 1; /* do live update for tab key */
}
/* the hotkey here is not well defined, was G.qual so we check all */
- else if(event->shift || event->ctrl || event->alt || event->oskey) {
+ else if (event->shift || event->ctrl || event->alt || event->oskey) {
ui_textedit_prev_but(block, but, data);
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
@@ -1856,20 +1858,20 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
break;
}
- if((event->ascii || event->utf8_buf[0]) && (retval == WM_UI_HANDLER_CONTINUE)) {
+ if ((event->ascii || event->utf8_buf[0]) && (retval == WM_UI_HANDLER_CONTINUE)) {
char ascii = event->ascii;
const char *utf8_buf= event->utf8_buf;
/* exception that's useful for number buttons, some keyboard
* numpads have a comma instead of a period */
- if(ELEM3(but->type, NUM, NUMABS, NUMSLI)) { /* could use data->min*/
- if(event->type == PADPERIOD && ascii == ',') {
+ if (ELEM3(but->type, NUM, NUMABS, NUMSLI)) { /* could use data->min*/
+ if (event->type == PADPERIOD && ascii == ',') {
ascii = '.';
utf8_buf= NULL; /* force ascii fallback */
}
}
- if(utf8_buf && utf8_buf[0]) {
+ if (utf8_buf && utf8_buf[0]) {
int utf8_buf_len= BLI_str_utf8_size(utf8_buf);
/* keep this printf until utf8 is well tested */
if (utf8_buf_len != 1) {
@@ -1887,21 +1889,21 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
}
/* textbutton with magnifier icon: do live update for search button */
- if(but->icon==ICON_VIEWZOOM)
+ if (but->icon==ICON_VIEWZOOM)
update= 1;
}
- if(changed) {
+ if (changed) {
/* only update when typing for TAB key */
- if(update && data->interactive) ui_apply_button(C, block, but, data, 1);
+ if (update && data->interactive) ui_apply_button(C, block, but, data, 1);
else ui_check_but(but);
but->changed= TRUE;
- if(data->searchbox)
+ if (data->searchbox)
ui_searchbox_update(C, data->searchbox, but, 1); /* 1 = reset */
}
- if(changed || (retval == WM_UI_HANDLER_BREAK))
+ if (changed || (retval == WM_UI_HANDLER_BREAK))
ED_region_tag_redraw(data->region);
}
@@ -1920,13 +1922,13 @@ static void ui_do_but_textedit_select(bContext *C, uiBlock *block, uiBut *but, u
break;
}
case LEFTMOUSE:
- if(event->val == KM_RELEASE)
+ if (event->val == KM_RELEASE)
button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
retval= WM_UI_HANDLER_BREAK;
break;
}
- if(retval == WM_UI_HANDLER_BREAK) {
+ if (retval == WM_UI_HANDLER_BREAK) {
ui_check_but(but);
ED_region_tag_redraw(data->region);
}
@@ -1936,14 +1938,14 @@ static void ui_do_but_textedit_select(bContext *C, uiBlock *block, uiBut *but, u
static void ui_numedit_begin(uiBut *but, uiHandleButtonData *data)
{
- if(but->type == BUT_CURVE) {
+ if (but->type == BUT_CURVE) {
but->editcumap= (CurveMapping*)but->poin;
}
- else if(but->type == BUT_COLORBAND) {
+ else if (but->type == BUT_COLORBAND) {
data->coba= (ColorBand*)but->poin;
but->editcoba= data->coba;
}
- else if(ELEM3(but->type, BUT_NORMAL, HSVCUBE, HSVCIRCLE)) {
+ else if (ELEM3(but->type, BUT_NORMAL, HSVCUBE, HSVCIRCLE)) {
ui_get_but_vectorf(but, data->origvec);
copy_v3_v3(data->vec, data->origvec);
but->editvec= data->vec;
@@ -1984,7 +1986,7 @@ static void ui_numedit_end(uiBut *but, uiHandleButtonData *data)
static void ui_numedit_apply(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data)
{
- if(data->interactive) ui_apply_button(C, block, but, data, 1);
+ if (data->interactive) ui_apply_button(C, block, but, data, 1);
else ui_check_but(but);
ED_region_tag_redraw(data->region);
@@ -2003,7 +2005,7 @@ static void ui_blockopen_begin(bContext *C, uiBut *but, uiHandleButtonData *data
switch(but->type) {
case BLOCK:
case PULLDOWN:
- if(but->menu_create_func) {
+ if (but->menu_create_func) {
menufunc= but->menu_create_func;
arg= but->poin;
}
@@ -2013,7 +2015,7 @@ static void ui_blockopen_begin(bContext *C, uiBut *but, uiHandleButtonData *data
}
break;
case MENU:
- if(but->menu_create_func) {
+ if (but->menu_create_func) {
menufunc= but->menu_create_func;
arg= but->poin;
}
@@ -2043,14 +2045,14 @@ static void ui_blockopen_begin(bContext *C, uiBut *but, uiHandleButtonData *data
break;
}
- if(func || handlefunc) {
+ if (func || handlefunc) {
data->menu= ui_popup_block_create(C, data->region, but, func, handlefunc, arg);
- if(but->block->handle)
+ if (but->block->handle)
data->menu->popup= but->block->handle->popup;
}
- else if(menufunc || menustr) {
+ else if (menufunc || menustr) {
data->menu= ui_popup_menu_create(C, data->region, but, menufunc, arg, menustr);
- if(but->block->handle)
+ if (but->block->handle)
data->menu->popup= but->block->handle->popup;
}
@@ -2060,14 +2062,14 @@ static void ui_blockopen_begin(bContext *C, uiBut *but, uiHandleButtonData *data
static void ui_blockopen_end(bContext *C, uiBut *but, uiHandleButtonData *data)
{
- if(but) {
+ if (but) {
but->editval= NULL;
but->editvec= NULL;
but->block->auto_open_last= PIL_check_seconds_timer();
}
- if(data->menu) {
+ if (data->menu) {
ui_popup_block_free(C, data->menu);
data->menu= NULL;
}
@@ -2077,23 +2079,23 @@ static void ui_blockopen_end(bContext *C, uiBut *but, uiHandleButtonData *data)
static int ui_do_but_BUT(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
{
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
- if(event->type == LEFTMOUSE && event->val==KM_PRESS) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (event->type == LEFTMOUSE && event->val==KM_PRESS) {
button_activate_state(C, but, BUTTON_STATE_WAIT_RELEASE);
return WM_UI_HANDLER_BREAK;
}
- else if(event->type == LEFTMOUSE && but->block->handle) {
+ else if (event->type == LEFTMOUSE && but->block->handle) {
button_activate_state(C, but, BUTTON_STATE_EXIT);
return WM_UI_HANDLER_BREAK;
}
- else if(ELEM(event->type, PADENTER, RETKEY) && event->val==KM_PRESS) {
+ else if (ELEM(event->type, PADENTER, RETKEY) && event->val==KM_PRESS) {
button_activate_state(C, but, BUTTON_STATE_WAIT_FLASH);
return WM_UI_HANDLER_BREAK;
}
}
- else if(data->state == BUTTON_STATE_WAIT_RELEASE) {
- if(event->type == LEFTMOUSE && event->val!=KM_PRESS) {
- if(!(but->flag & UI_SELECT))
+ else if (data->state == BUTTON_STATE_WAIT_RELEASE) {
+ if (event->type == LEFTMOUSE && event->val!=KM_PRESS) {
+ if (!(but->flag & UI_SELECT))
data->cancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
return WM_UI_HANDLER_BREAK;
@@ -2105,24 +2107,24 @@ static int ui_do_but_BUT(bContext *C, uiBut *but, uiHandleButtonData *data, wmEv
static int ui_do_but_HOTKEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
{
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
- if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
but->drawstr[0]= 0;
but->modifier_key= 0;
button_activate_state(C, but, BUTTON_STATE_WAIT_KEY_EVENT);
return WM_UI_HANDLER_BREAK;
}
}
- else if(data->state == BUTTON_STATE_WAIT_KEY_EVENT) {
+ else if (data->state == BUTTON_STATE_WAIT_KEY_EVENT) {
- if(event->type == MOUSEMOVE)
+ if (event->type == MOUSEMOVE)
return WM_UI_HANDLER_CONTINUE;
- if(event->type == LEFTMOUSE && event->val==KM_PRESS) {
+ if (event->type == LEFTMOUSE && event->val==KM_PRESS) {
/* only cancel if click outside the button */
- if(ui_mouse_inside_button(but->active->region, but, event->x, event->y) == 0) {
+ if (ui_mouse_inside_button(but->active->region, but, event->x, event->y) == 0) {
/* data->cancel doesnt work, this button opens immediate */
- if(but->flag & UI_BUT_IMMEDIATE)
+ if (but->flag & UI_BUT_IMMEDIATE)
ui_set_but_val(but, 0);
else
data->cancel= 1;
@@ -2133,18 +2135,18 @@ static int ui_do_but_HOTKEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data
/* always set */
but->modifier_key = 0;
- if(event->shift) but->modifier_key |= KM_SHIFT;
- if(event->alt) but->modifier_key |= KM_ALT;
- if(event->ctrl) but->modifier_key |= KM_CTRL;
- if(event->oskey) but->modifier_key |= KM_OSKEY;
+ if (event->shift) but->modifier_key |= KM_SHIFT;
+ if (event->alt) but->modifier_key |= KM_ALT;
+ if (event->ctrl) but->modifier_key |= KM_CTRL;
+ if (event->oskey) but->modifier_key |= KM_OSKEY;
ui_check_but(but);
ED_region_tag_redraw(data->region);
- if(event->val==KM_PRESS) {
- if(ISHOTKEY(event->type)) {
+ if (event->val==KM_PRESS) {
+ if (ISHOTKEY(event->type)) {
- if(WM_key_event_string(event->type)[0])
+ if (WM_key_event_string(event->type)[0])
ui_set_but_val(but, event->type);
else
data->cancel= 1;
@@ -2152,7 +2154,7 @@ static int ui_do_but_HOTKEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data
button_activate_state(C, but, BUTTON_STATE_EXIT);
return WM_UI_HANDLER_BREAK;
}
- else if(event->type == ESCKEY) {
+ else if (event->type == ESCKEY) {
data->cancel= 1;
data->escapecancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
@@ -2166,18 +2168,18 @@ static int ui_do_but_HOTKEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data
static int ui_do_but_KEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
{
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
- if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
button_activate_state(C, but, BUTTON_STATE_WAIT_KEY_EVENT);
return WM_UI_HANDLER_BREAK;
}
}
- else if(data->state == BUTTON_STATE_WAIT_KEY_EVENT) {
- if(event->type == MOUSEMOVE)
+ else if (data->state == BUTTON_STATE_WAIT_KEY_EVENT) {
+ if (event->type == MOUSEMOVE)
return WM_UI_HANDLER_CONTINUE;
- if(event->val==KM_PRESS) {
- if(WM_key_event_string(event->type)[0])
+ if (event->val==KM_PRESS) {
+ if (WM_key_event_string(event->type)[0])
ui_set_but_val(but, event->type);
else
data->cancel= 1;
@@ -2191,20 +2193,20 @@ static int ui_do_but_KEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data, w
static int ui_do_but_TEX(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event)
{
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
- if(ELEM(event->type, LEFTMOUSE, EVT_BUT_OPEN) && event->val==KM_PRESS) {
- if(but->dt == UI_EMBOSSN && !event->ctrl);
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (ELEM(event->type, LEFTMOUSE, EVT_BUT_OPEN) && event->val==KM_PRESS) {
+ if (but->dt == UI_EMBOSSN && !event->ctrl);
else {
button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
return WM_UI_HANDLER_BREAK;
}
}
}
- else if(data->state == BUTTON_STATE_TEXT_EDITING) {
+ else if (data->state == BUTTON_STATE_TEXT_EDITING) {
ui_do_but_textedit(C, block, but, data, event);
return WM_UI_HANDLER_BREAK;
}
- else if(data->state == BUTTON_STATE_TEXT_SELECTING) {
+ else if (data->state == BUTTON_STATE_TEXT_SELECTING) {
ui_do_but_textedit_select(C, block, but, data, event);
return WM_UI_HANDLER_BREAK;
}
@@ -2214,8 +2216,8 @@ static int ui_do_but_TEX(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
static int ui_do_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
{
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
- if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
data->togdual= event->ctrl;
data->togonly= !event->shift;
button_activate_state(C, but, BUTTON_STATE_EXIT);
@@ -2228,11 +2230,11 @@ static int ui_do_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data, wmEv
static int ui_do_but_EXIT(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
{
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
/* first handle click on icondrag type button */
- if(event->type==LEFTMOUSE && but->dragpoin) {
- if(ui_but_mouse_inside_icon(but, data->region, event)) {
+ if (event->type==LEFTMOUSE && but->dragpoin) {
+ if (ui_but_mouse_inside_icon(but, data->region, event)) {
/* tell the button to wait and keep checking further events to
* see if it should start dragging */
@@ -2243,27 +2245,27 @@ static int ui_do_but_EXIT(bContext *C, uiBut *but, uiHandleButtonData *data, wmE
}
}
- if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
+ if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
int ret = WM_UI_HANDLER_BREAK;
/* XXX (a bit ugly) Special case handling for filebrowser drag button */
- if(but->dragpoin && but->imb && ui_but_mouse_inside_icon(but, data->region, event)) {
+ if (but->dragpoin && but->imb && ui_but_mouse_inside_icon(but, data->region, event)) {
ret = WM_UI_HANDLER_CONTINUE;
}
button_activate_state(C, but, BUTTON_STATE_EXIT);
return ret;
}
}
- else if(data->state == BUTTON_STATE_WAIT_DRAG) {
+ else if (data->state == BUTTON_STATE_WAIT_DRAG) {
/* this function also ends state */
- if(ui_but_start_drag(C, but, data, event)) {
+ if (ui_but_start_drag(C, but, data, event)) {
return WM_UI_HANDLER_BREAK;
}
/* If the mouse has been pressed and released, getting to
* this point without triggering a drag, then clear the
* drag state for this button and continue to pass on the event */
- if(event->type==LEFTMOUSE && event->val==KM_RELEASE) {
+ if (event->type==LEFTMOUSE && event->val==KM_RELEASE) {
button_activate_state(C, but, BUTTON_STATE_EXIT);
return WM_UI_HANDLER_CONTINUE;
}
@@ -2279,25 +2281,25 @@ static int ui_do_but_EXIT(bContext *C, uiBut *but, uiHandleButtonData *data, wmE
/* var names match ui_numedit_but_NUM */
static float ui_numedit_apply_snapf(uiBut *but, float tempf, float softmin, float softmax, float softrange, int snap)
{
- if(tempf==softmin || tempf==softmax || snap==0) {
+ if (tempf==softmin || tempf==softmax || snap==0) {
/* pass */
}
else {
float fac= 1.0f;
- if(ui_is_but_unit(but)) {
+ if (ui_is_but_unit(but)) {
UnitSettings *unit= but->block->unit;
int unit_type= uiButGetUnitType(but)>>16;
- if(bUnit_IsValid(unit->system, unit_type)) {
+ if (bUnit_IsValid(unit->system, unit_type)) {
fac= (float)bUnit_BaseScalar(unit->system, unit_type);
- if(ELEM3(unit_type, B_UNIT_LENGTH, B_UNIT_AREA, B_UNIT_VOLUME)) {
+ if (ELEM3(unit_type, B_UNIT_LENGTH, B_UNIT_AREA, B_UNIT_VOLUME)) {
fac /= unit->scale_length;
}
}
}
- if(fac != 1.0f) {
+ if (fac != 1.0f) {
/* snap in unit-space */
tempf /= fac;
/* softmin /= fac; */ /* UNUSED */
@@ -2305,18 +2307,18 @@ static float ui_numedit_apply_snapf(uiBut *but, float tempf, float softmin, floa
softrange /= fac;
}
- if(snap==1) {
- if(softrange < 2.10f) tempf= 0.1f*floorf(10.0f*tempf);
- else if(softrange < 21.0f) tempf= floorf(tempf);
+ if (snap==1) {
+ if (softrange < 2.10f) tempf= 0.1f*floorf(10.0f*tempf);
+ else if (softrange < 21.0f) tempf= floorf(tempf);
else tempf= 10.0f*floorf(tempf/10.0f);
}
- else if(snap==2) {
- if(softrange < 2.10f) tempf= 0.01f*floorf(100.0f*tempf);
- else if(softrange < 21.0f) tempf= 0.1f*floorf(10.0f*tempf);
+ else if (snap==2) {
+ if (softrange < 2.10f) tempf= 0.01f*floorf(100.0f*tempf);
+ else if (softrange < 21.0f) tempf= 0.1f*floorf(10.0f*tempf);
else tempf= floor(tempf);
}
- if(fac != 1.0f)
+ if (fac != 1.0f)
tempf *= fac;
}
@@ -2325,7 +2327,7 @@ static float ui_numedit_apply_snapf(uiBut *but, float tempf, float softmin, floa
static float ui_numedit_apply_snap(int temp, float softmin, float softmax, int snap)
{
- if(temp==softmin || temp==softmax)
+ if (temp==softmin || temp==softmax)
return temp;
switch(snap) {
@@ -2347,13 +2349,13 @@ static int ui_numedit_but_NUM(uiBut *but, uiHandleButtonData *data, float fac, i
float deler, tempf, softmin, softmax, softrange;
int lvalue, temp, changed= 0;
- if(mx == data->draglastx)
+ if (mx == data->draglastx)
return changed;
/* drag-lock - prevent unwanted scroll adjustments */
/* change value (now 3) to adjust threshold in pixels */
- if(data->draglock) {
- if(abs(mx-data->dragstartx) <= 3)
+ if (data->draglock) {
+ if (abs(mx-data->dragstartx) <= 3)
return changed;
data->draglock= 0;
@@ -2364,19 +2366,20 @@ static int ui_numedit_but_NUM(uiBut *but, uiHandleButtonData *data, float fac, i
softmax= but->softmax;
softrange= softmax - softmin;
- if(ui_is_a_warp_but(but)) {
+ if (ui_is_a_warp_but(but)) {
/* Mouse location isn't screen clamped to the screen so use a linear mapping
* 2px == 1-int, or 1px == 1-ClickStep */
- if(ui_is_but_float(but)) {
+ if (ui_is_but_float(but)) {
fac *= 0.01f*but->a1;
tempf = (float)data->startvalue + ((float)(mx - data->dragstartx) * fac);
tempf= ui_numedit_apply_snapf(but, tempf, softmin, softmax, softrange, snap);
#if 1 /* fake moving the click start, nicer for dragging back after passing the limit */
- if(tempf < softmin) {
+ if (tempf < softmin) {
data->dragstartx -= (softmin-tempf) / fac;
tempf= softmin;
- } else if (tempf > softmax) {
+ }
+ else if (tempf > softmax) {
data->dragstartx += (tempf-softmax) / fac;
tempf= softmax;
}
@@ -2384,25 +2387,26 @@ static int ui_numedit_but_NUM(uiBut *but, uiHandleButtonData *data, float fac, i
CLAMP(tempf, softmin, softmax);
#endif
- if(tempf != (float)data->value) {
+ if (tempf != (float)data->value) {
data->dragchange= 1;
data->value= tempf;
changed= 1;
}
}
else {
- if(softrange > 256) fac= 1.0; /* 1px == 1 */
- else if(softrange > 32) fac= 1.0/2.0; /* 2px == 1 */
+ if (softrange > 256) fac= 1.0; /* 1px == 1 */
+ else if (softrange > 32) fac= 1.0/2.0; /* 2px == 1 */
else fac= 1.0/16.0; /* 16px == 1? */
temp= data->startvalue + (((double)mx - data->dragstartx) * (double)fac);
temp= ui_numedit_apply_snap(temp, softmin, softmax, snap);
#if 1 /* fake moving the click start, nicer for dragging back after passing the limit */
- if(temp < softmin) {
+ if (temp < softmin) {
data->dragstartx -= (softmin-temp) / fac;
temp= softmin;
- } else if (temp > softmax) {
+ }
+ else if (temp > softmax) {
data->dragstartx += (temp-softmax) / fac;
temp= softmax;
}
@@ -2410,7 +2414,7 @@ static int ui_numedit_but_NUM(uiBut *but, uiHandleButtonData *data, float fac, i
CLAMP(temp, softmin, softmax);
#endif
- if(temp != data->value) {
+ if (temp != data->value) {
data->dragchange= 1;
data->value= temp;
changed= 1;
@@ -2422,7 +2426,7 @@ static int ui_numedit_but_NUM(uiBut *but, uiHandleButtonData *data, float fac, i
else {
/* Use a non-linear mapping of the mouse drag especially for large floats (normal behavior) */
deler= 500;
- if(!ui_is_but_float(but)) {
+ if (!ui_is_but_float(but)) {
/* prevent large ranges from getting too out of control */
if (softrange > 600) deler = powf(softrange, 0.75);
@@ -2431,13 +2435,15 @@ static int ui_numedit_but_NUM(uiBut *but, uiHandleButtonData *data, float fac, i
}
deler /= fac;
- if(softrange > 11) {
+ if (softrange > 11) {
/* non linear change in mouse input- good for high precicsion */
data->dragf+= (((float)(mx-data->draglastx))/deler) * (fabsf(data->dragstartx-mx)*0.002f);
- } else if (softrange > 129) { /* only scale large int buttons */
+ }
+ else if (softrange > 129) { /* only scale large int buttons */
/* non linear change in mouse input- good for high precicsionm ints need less fine tuning */
data->dragf+= (((float)(mx-data->draglastx))/deler) * (fabsf(data->dragstartx-mx)*0.004f);
- } else {
+ }
+ else {
/*no scaling */
data->dragf += ((float)(mx - data->draglastx)) / deler;
}
@@ -2447,7 +2453,7 @@ static int ui_numedit_but_NUM(uiBut *but, uiHandleButtonData *data, float fac, i
tempf= (softmin + data->dragf*softrange);
- if(!ui_is_but_float(but)) {
+ if (!ui_is_but_float(but)) {
temp= floorf(tempf + 0.5f);
temp= ui_numedit_apply_snap(temp, softmin, softmax, snap);
@@ -2455,7 +2461,7 @@ static int ui_numedit_but_NUM(uiBut *but, uiHandleButtonData *data, float fac, i
CLAMP(temp, softmin, softmax);
lvalue= (int)data->value;
- if(temp != lvalue) {
+ if (temp != lvalue) {
data->dragchange= 1;
data->value= (double)temp;
changed= 1;
@@ -2467,7 +2473,7 @@ static int ui_numedit_but_NUM(uiBut *but, uiHandleButtonData *data, float fac, i
CLAMP(tempf, softmin, softmax);
- if(tempf != (float)data->value) {
+ if (tempf != (float)data->value) {
data->dragchange= 1;
data->value= tempf;
changed= 1;
@@ -2491,27 +2497,27 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
ui_window_to_block(data->region, block, &mx, &my);
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
/* XXX hardcoded keymap check.... */
- if(event->type == WHEELDOWNMOUSE && event->alt) {
+ if (event->type == WHEELDOWNMOUSE && event->alt) {
mx= but->x1;
click= 1;
}
- else if(event->type == WHEELUPMOUSE && event->alt) {
+ else if (event->type == WHEELUPMOUSE && event->alt) {
mx= but->x2;
click= 1;
}
- else if(event->val==KM_PRESS) {
- if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->ctrl) {
+ else if (event->val==KM_PRESS) {
+ if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->ctrl) {
button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
retval= WM_UI_HANDLER_BREAK;
}
- else if(event->type == LEFTMOUSE) {
+ else if (event->type == LEFTMOUSE) {
data->dragstartx= data->draglastx= ui_is_a_warp_but(but) ? screen_mx:mx;
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
retval= WM_UI_HANDLER_BREAK;
}
- else if(ELEM(event->type, PADENTER, RETKEY) && event->val==KM_PRESS)
+ else if (ELEM(event->type, PADENTER, RETKEY) && event->val==KM_PRESS)
click= 1;
else if (event->type == MINUSKEY && event->val==KM_PRESS) {
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
@@ -2522,43 +2528,43 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
}
}
- else if(data->state == BUTTON_STATE_NUM_EDITING) {
- if(event->type == ESCKEY) {
+ else if (data->state == BUTTON_STATE_NUM_EDITING) {
+ if (event->type == ESCKEY) {
data->cancel= 1;
data->escapecancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
- else if(event->type == LEFTMOUSE && event->val!=KM_PRESS) {
- if(data->dragchange)
+ else if (event->type == LEFTMOUSE && event->val!=KM_PRESS) {
+ if (data->dragchange)
button_activate_state(C, but, BUTTON_STATE_EXIT);
else
click= 1;
}
- else if(event->type == MOUSEMOVE) {
+ else if (event->type == MOUSEMOVE) {
float fac;
int snap;
fac= 1.0f;
- if(event->shift) fac /= 10.0f;
- if(event->alt) fac /= 20.0f;
+ if (event->shift) fac /= 10.0f;
+ if (event->alt) fac /= 20.0f;
snap= (event->ctrl)? (event->shift)? 2: 1: 0;
- if(ui_numedit_but_NUM(but, data, fac, snap, (ui_is_a_warp_but(but) ? screen_mx:mx)))
+ if (ui_numedit_but_NUM(but, data, fac, snap, (ui_is_a_warp_but(but) ? screen_mx:mx)))
ui_numedit_apply(C, block, but, data);
}
retval= WM_UI_HANDLER_BREAK;
}
- else if(data->state == BUTTON_STATE_TEXT_EDITING) {
+ else if (data->state == BUTTON_STATE_TEXT_EDITING) {
ui_do_but_textedit(C, block, but, data, event);
retval= WM_UI_HANDLER_BREAK;
}
- else if(data->state == BUTTON_STATE_TEXT_SELECTING) {
+ else if (data->state == BUTTON_STATE_TEXT_SELECTING) {
ui_do_but_textedit_select(C, block, but, data, event);
retval= WM_UI_HANDLER_BREAK;
}
- if(click) {
+ if (click) {
/* we can click on the side arrows to increment/decrement,
* or click inside to edit the value directly */
float tempf, softmin, softmax;
@@ -2567,23 +2573,23 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
softmin= but->softmin;
softmax= but->softmax;
- if(!ui_is_but_float(but)) {
- if(mx < (but->x1 + (but->x2 - but->x1)/3 - 3)) {
+ if (!ui_is_but_float(but)) {
+ if (mx < (but->x1 + (but->x2 - but->x1)/3 - 3)) {
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
temp= (int)data->value - 1;
- if(temp>=softmin && temp<=softmax)
+ if (temp>=softmin && temp<=softmax)
data->value= (double)temp;
else
data->cancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
- else if(mx > (but->x1 + (2*(but->x2 - but->x1)/3) + 3)) {
+ else if (mx > (but->x1 + (2*(but->x2 - but->x1)/3) + 3)) {
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
temp= (int)data->value + 1;
- if(temp>=softmin && temp<=softmax)
+ if (temp>=softmin && temp<=softmax)
data->value= (double)temp;
else
data->cancel= 1;
@@ -2594,7 +2600,7 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
}
else {
- if(mx < (but->x1 + (but->x2 - but->x1)/3 - 3)) {
+ if (mx < (but->x1 + (but->x2 - but->x1)/3 - 3)) {
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
tempf= (float)data->value - 0.01f * but->a1;
@@ -2603,7 +2609,7 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
- else if(mx > but->x1 + (2*((but->x2 - but->x1)/3) + 3)) {
+ else if (mx > but->x1 + (2*((but->x2 - but->x1)/3) + 3)) {
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
tempf= (float)data->value + 0.01f * but->a1;
@@ -2631,9 +2637,9 @@ static int ui_numedit_but_SLI(uiBut *but, uiHandleButtonData *data, int shift, i
softmax= but->softmax;
softrange= softmax - softmin;
- if(but->type==NUMSLI) deler= ((but->x2-but->x1) - 5.0f*but->aspect);
- else if(but->type==HSVSLI) deler= ((but->x2-but->x1)/2.0f - 5.0f*but->aspect);
- else if(but->type==SCROLL) {
+ if (but->type==NUMSLI) deler= ((but->x2-but->x1) - 5.0f*but->aspect);
+ else if (but->type==HSVSLI) deler= ((but->x2-but->x1)/2.0f - 5.0f*but->aspect);
+ else if (but->type==SCROLL) {
int horizontal= (but->x2 - but->x1 > but->y2 - but->y1);
float size= (horizontal)? (but->x2-but->x1): -(but->y2-but->y1);
deler= size*(but->softmax - but->softmin)/(but->softmax - but->softmin + but->a1);
@@ -2642,26 +2648,26 @@ static int ui_numedit_but_SLI(uiBut *but, uiHandleButtonData *data, int shift, i
f= (float)(mx-data->dragstartx)/deler + data->dragfstart;
- if(shift)
+ if (shift)
f= (f-data->dragfstart)/10.0f + data->dragfstart;
CLAMP(f, 0.0f, 1.0f);
tempf= softmin + f*softrange;
temp= floorf(tempf+0.5f);
- if(ctrl) {
- if(tempf==softmin || tempf==softmax);
- else if(ui_is_but_float(but)) {
+ if (ctrl) {
+ if (tempf==softmin || tempf==softmax);
+ else if (ui_is_but_float(but)) {
- if(shift) {
- if(tempf==softmin || tempf==softmax);
- else if(softmax-softmin < 2.10f) tempf= 0.01f * floorf(100.0f*tempf);
- else if(softmax-softmin < 21.0f) tempf= 0.1f * floorf(10.0f*tempf);
+ if (shift) {
+ if (tempf==softmin || tempf==softmax);
+ else if (softmax-softmin < 2.10f) tempf= 0.01f * floorf(100.0f*tempf);
+ else if (softmax-softmin < 21.0f) tempf= 0.1f * floorf(10.0f*tempf);
else tempf= floorf(tempf);
}
else {
- if(softmax-softmin < 2.10f) tempf= 0.1f * floorf(10.0f*tempf);
- else if(softmax-softmin < 21.0f) tempf= floorf(tempf);
+ if (softmax-softmin < 2.10f) tempf= 0.1f * floorf(10.0f*tempf);
+ else if (softmax-softmin < 21.0f) tempf= floorf(tempf);
else tempf= 10.0f*floorf(tempf/10.0f);
}
}
@@ -2671,12 +2677,12 @@ static int ui_numedit_but_SLI(uiBut *but, uiHandleButtonData *data, int shift, i
}
}
- if(!ui_is_but_float(but)) {
+ if (!ui_is_but_float(but)) {
lvalue= floor(data->value+0.5);
CLAMP(temp, softmin, softmax);
- if(temp != lvalue) {
+ if (temp != lvalue) {
data->value= temp;
data->dragchange= 1;
changed= 1;
@@ -2685,7 +2691,7 @@ static int ui_numedit_but_SLI(uiBut *but, uiHandleButtonData *data, int shift, i
else {
CLAMP(tempf, softmin, softmax);
- if(tempf != (float)data->value) {
+ if (tempf != (float)data->value) {
data->value= tempf;
data->dragchange= 1;
changed= 1;
@@ -2704,23 +2710,23 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
my= event->y;
ui_window_to_block(data->region, block, &mx, &my);
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
/* XXX hardcoded keymap check.... */
- if(event->type == WHEELDOWNMOUSE && event->alt) {
+ if (event->type == WHEELDOWNMOUSE && event->alt) {
mx= but->x1;
click= 2;
}
- else if(event->type == WHEELUPMOUSE && event->alt) {
+ else if (event->type == WHEELUPMOUSE && event->alt) {
mx= but->x2;
click= 2;
}
- else if(event->val==KM_PRESS) {
- if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->ctrl) {
+ else if (event->val==KM_PRESS) {
+ if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->ctrl) {
button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
retval= WM_UI_HANDLER_BREAK;
}
/* alt-click on sides to get "arrows" like in NUM buttons, and match wheel usage above */
- else if(event->type == LEFTMOUSE && event->alt) {
+ else if (event->type == LEFTMOUSE && event->alt) {
int halfpos = (but->x1 + but->x2) / 2;
click = 2;
if (mx < halfpos)
@@ -2728,13 +2734,13 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
else
mx = but->x2;
}
- else if(event->type == LEFTMOUSE) {
+ else if (event->type == LEFTMOUSE) {
data->dragstartx= mx;
data->draglastx= mx;
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
retval= WM_UI_HANDLER_BREAK;
}
- else if(ELEM(event->type, PADENTER, RETKEY) && event->val==KM_PRESS)
+ else if (ELEM(event->type, PADENTER, RETKEY) && event->val==KM_PRESS)
click= 1;
else if (event->type == MINUSKEY && event->val==KM_PRESS) {
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
@@ -2744,34 +2750,34 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
}
}
}
- else if(data->state == BUTTON_STATE_NUM_EDITING) {
- if(event->type == ESCKEY) {
+ else if (data->state == BUTTON_STATE_NUM_EDITING) {
+ if (event->type == ESCKEY) {
data->cancel= 1;
data->escapecancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
- else if(event->type == LEFTMOUSE && event->val!=KM_PRESS) {
- if(data->dragchange)
+ else if (event->type == LEFTMOUSE && event->val!=KM_PRESS) {
+ if (data->dragchange)
button_activate_state(C, but, BUTTON_STATE_EXIT);
else
click= 1;
}
- else if(event->type == MOUSEMOVE) {
- if(ui_numedit_but_SLI(but, data, event->shift, event->ctrl, mx))
+ else if (event->type == MOUSEMOVE) {
+ if (ui_numedit_but_SLI(but, data, event->shift, event->ctrl, mx))
ui_numedit_apply(C, block, but, data);
}
retval= WM_UI_HANDLER_BREAK;
}
- else if(data->state == BUTTON_STATE_TEXT_EDITING) {
+ else if (data->state == BUTTON_STATE_TEXT_EDITING) {
ui_do_but_textedit(C, block, but, data, event);
retval= WM_UI_HANDLER_BREAK;
}
- else if(data->state == BUTTON_STATE_TEXT_SELECTING) {
+ else if (data->state == BUTTON_STATE_TEXT_SELECTING) {
ui_do_but_textedit_select(C, block, but, data, event);
retval= WM_UI_HANDLER_BREAK;
}
- if(click) {
+ if (click) {
if (click==2) {
/* nudge slider to the left or right */
float f, tempf, softmin, softmax, softrange;
@@ -2787,7 +2793,7 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
temp= (int)data->value;
#if 0
- if(but->type==SLI) {
+ if (but->type==SLI) {
f= (float)(mx-but->x1)/(but->x2-but->x1); /* same as below */
}
else
@@ -2798,20 +2804,20 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
f= softmin + f*softrange;
- if(!ui_is_but_float(but)) {
- if(f<temp) temp--;
+ if (!ui_is_but_float(but)) {
+ if (f<temp) temp--;
else temp++;
- if(temp>=softmin && temp<=softmax)
+ if (temp>=softmin && temp<=softmax)
data->value= temp;
else
data->cancel= 1;
}
else {
- if(f<tempf) tempf -= 0.01f;
+ if (f<tempf) tempf -= 0.01f;
else tempf += 0.01f;
- if(tempf>=softmin && tempf<=softmax)
+ if (tempf>=softmin && tempf<=softmax)
data->value= tempf;
else
data->cancel= 1;
@@ -2840,10 +2846,10 @@ static int ui_do_but_SCROLL(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
my= event->y;
ui_window_to_block(data->region, block, &mx, &my);
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
- if(event->val==KM_PRESS) {
- if(event->type == LEFTMOUSE) {
- if(horizontal) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (event->val==KM_PRESS) {
+ if (event->type == LEFTMOUSE) {
+ if (horizontal) {
data->dragstartx= mx;
data->draglastx= mx;
}
@@ -2856,22 +2862,22 @@ static int ui_do_but_SCROLL(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
}
/* UNUSED - otherwise code is ok, add back if needed */
#if 0
- else if(ELEM(event->type, PADENTER, RETKEY) && event->val==KM_PRESS)
+ else if (ELEM(event->type, PADENTER, RETKEY) && event->val==KM_PRESS)
click= 1;
#endif
}
}
- else if(data->state == BUTTON_STATE_NUM_EDITING) {
- if(event->type == ESCKEY) {
+ else if (data->state == BUTTON_STATE_NUM_EDITING) {
+ if (event->type == ESCKEY) {
data->cancel= 1;
data->escapecancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
- else if(event->type == LEFTMOUSE && event->val!=KM_PRESS) {
+ else if (event->type == LEFTMOUSE && event->val!=KM_PRESS) {
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
- else if(event->type == MOUSEMOVE) {
- if(ui_numedit_but_SLI(but, data, 0, 0, (horizontal)? mx: my))
+ else if (event->type == MOUSEMOVE) {
+ if (ui_numedit_but_SLI(but, data, 0, 0, (horizontal)? mx: my))
ui_numedit_apply(C, block, but, data);
}
@@ -2885,11 +2891,11 @@ static int ui_do_but_SCROLL(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
{
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
/* first handle click on icondrag type button */
- if(event->type==LEFTMOUSE && but->dragpoin && event->val==KM_PRESS) {
- if(ui_but_mouse_inside_icon(but, data->region, event)) {
+ if (event->type==LEFTMOUSE && but->dragpoin && event->val==KM_PRESS) {
+ if (ui_but_mouse_inside_icon(but, data->region, event)) {
button_activate_state(C, but, BUTTON_STATE_WAIT_DRAG);
data->dragstartx= event->x;
data->dragstarty= event->y;
@@ -2898,13 +2904,13 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, wm
}
/* regular open menu */
- if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
+ if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
button_activate_state(C, but, BUTTON_STATE_MENU_OPEN);
return WM_UI_HANDLER_BREAK;
}
- else if(ELEM3(but->type, MENU, ICONROW, ICONTEXTROW)) {
+ else if (ELEM3(but->type, MENU, ICONROW, ICONTEXTROW)) {
- if(event->type == WHEELDOWNMOUSE && event->alt) {
+ if (event->type == WHEELDOWNMOUSE && event->alt) {
data->value= ui_step_name_menu(but, -1);
button_activate_state(C, but, BUTTON_STATE_EXIT);
ui_apply_button(C, but->block, but, data, 1);
@@ -2921,7 +2927,7 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, wm
return WM_UI_HANDLER_BREAK;
}
- else if(event->type == WHEELUPMOUSE && event->alt) {
+ else if (event->type == WHEELUPMOUSE && event->alt) {
data->value= ui_step_name_menu(but, 1);
button_activate_state(C, but, BUTTON_STATE_EXIT);
ui_apply_button(C, but->block, but, data, 1);
@@ -2933,15 +2939,15 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, wm
return WM_UI_HANDLER_BREAK;
}
}
- else if(but->type==COL) {
- if( ELEM(event->type, WHEELDOWNMOUSE, WHEELUPMOUSE) && event->alt) {
+ else if (but->type==COL) {
+ if ( ELEM(event->type, WHEELDOWNMOUSE, WHEELUPMOUSE) && event->alt) {
float *hsv= ui_block_hsv_get(but->block);
float col[3];
ui_get_but_vectorf(but, col);
rgb_to_hsv_compat(col[0], col[1], col[2], hsv, hsv+1, hsv+2);
- if(event->type==WHEELDOWNMOUSE)
+ if (event->type==WHEELDOWNMOUSE)
hsv[2]= CLAMPIS(hsv[2]-0.05f, 0.0f, 1.0f);
else
hsv[2]= CLAMPIS(hsv[2]+0.05f, 0.0f, 1.0f);
@@ -2955,21 +2961,21 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, wm
}
}
}
- else if(data->state == BUTTON_STATE_WAIT_DRAG) {
+ else if (data->state == BUTTON_STATE_WAIT_DRAG) {
/* this function also ends state */
- if(ui_but_start_drag(C, but, data, event)) {
+ if (ui_but_start_drag(C, but, data, event)) {
return WM_UI_HANDLER_BREAK;
}
/* outside icon quit, not needed if drag activated */
- if(0==ui_but_mouse_inside_icon(but, data->region, event)) {
+ if (0==ui_but_mouse_inside_icon(but, data->region, event)) {
button_activate_state(C, but, BUTTON_STATE_EXIT);
data->cancel= 1;
return WM_UI_HANDLER_BREAK;
}
- if(event->type==LEFTMOUSE && event->val==KM_RELEASE) {
+ if (event->type==LEFTMOUSE && event->val==KM_RELEASE) {
button_activate_state(C, but, BUTTON_STATE_MENU_OPEN);
return WM_UI_HANDLER_BREAK;
}
@@ -2994,11 +3000,11 @@ static int ui_numedit_but_NORMAL(uiBut *but, uiHandleButtonData *data, int mx, i
rad= (but->x2 - but->x1);
radsq= rad*rad;
- if(fp[2]>0.0f) {
+ if (fp[2]>0.0f) {
mdx= (rad*fp[0]);
mdy= (rad*fp[1]);
}
- else if(fp[2]> -1.0f) {
+ else if (fp[2]> -1.0f) {
mrad= rad/sqrtf(fp[0]*fp[0] + fp[1]*fp[1]);
mdx= 2.0f*mrad*fp[0] - (rad*fp[0]);
@@ -3011,7 +3017,7 @@ static int ui_numedit_but_NORMAL(uiBut *but, uiHandleButtonData *data, int mx, i
fp= data->vec;
mrad= dx*dx+dy*dy;
- if(mrad < radsq) { /* inner circle */
+ if (mrad < radsq) { /* inner circle */
fp[0]= dx;
fp[1]= dy;
fp[2]= sqrt( radsq-dx*dx-dy*dy );
@@ -3024,7 +3030,7 @@ static int ui_numedit_but_NORMAL(uiBut *but, uiHandleButtonData *data, int mx, i
dy*= (2.0f*mrad - 1.0f);
mrad= dx*dx+dy*dy;
- if(mrad < radsq) {
+ if (mrad < radsq) {
fp[0]= dx;
fp[1]= dy;
fp[2]= -sqrt( radsq-dx*dx-dy*dy );
@@ -3046,8 +3052,8 @@ static int ui_do_but_NORMAL(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
my= event->y;
ui_window_to_block(data->region, block, &mx, &my);
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
- if(event->type==LEFTMOUSE && event->val==KM_PRESS) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (event->type==LEFTMOUSE && event->val==KM_PRESS) {
data->dragstartx= mx;
data->dragstarty= my;
data->draglastx= mx;
@@ -3055,20 +3061,20 @@ static int ui_do_but_NORMAL(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
/* also do drag the first time */
- if(ui_numedit_but_NORMAL(but, data, mx, my))
+ if (ui_numedit_but_NORMAL(but, data, mx, my))
ui_numedit_apply(C, block, but, data);
return WM_UI_HANDLER_BREAK;
}
}
- else if(data->state == BUTTON_STATE_NUM_EDITING) {
- if(event->type == MOUSEMOVE) {
- if(mx!=data->draglastx || my!=data->draglasty) {
- if(ui_numedit_but_NORMAL(but, data, mx, my))
+ else if (data->state == BUTTON_STATE_NUM_EDITING) {
+ if (event->type == MOUSEMOVE) {
+ if (mx!=data->draglastx || my!=data->draglasty) {
+ if (ui_numedit_but_NORMAL(but, data, mx, my))
ui_numedit_apply(C, block, but, data);
}
}
- else if(event->type==LEFTMOUSE && event->val!=KM_PRESS)
+ else if (event->type==LEFTMOUSE && event->val!=KM_PRESS)
button_activate_state(C, but, BUTTON_STATE_EXIT);
return WM_UI_HANDLER_BREAK;
@@ -3212,8 +3218,8 @@ static int ui_do_but_HSVCUBE(bContext *C, uiBlock *block, uiBut *but, uiHandleBu
my= event->y;
ui_window_to_block(data->region, block, &mx, &my);
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
- if(event->type==LEFTMOUSE && event->val==KM_PRESS) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (event->type==LEFTMOUSE && event->val==KM_PRESS) {
data->dragstartx= mx;
data->dragstarty= my;
data->draglastx= mx;
@@ -3221,7 +3227,7 @@ static int ui_do_but_HSVCUBE(bContext *C, uiBlock *block, uiBut *but, uiHandleBu
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
/* also do drag the first time */
- if(ui_numedit_but_HSVCUBE(but, data, mx, my))
+ if (ui_numedit_but_HSVCUBE(but, data, mx, my))
ui_numedit_apply(C, block, but, data);
return WM_UI_HANDLER_BREAK;
@@ -3238,7 +3244,7 @@ static int ui_do_but_HSVCUBE(bContext *C, uiBlock *block, uiBut *but, uiHandleBu
}
/* XXX hardcoded keymap check.... */
else if (event->type == BACKSPACEKEY && event->val == KM_PRESS) {
- if (but->a1==UI_GRAD_V_ALT){
+ if (but->a1==UI_GRAD_V_ALT) {
int len;
/* reset only value */
@@ -3267,19 +3273,19 @@ static int ui_do_but_HSVCUBE(bContext *C, uiBlock *block, uiBut *but, uiHandleBu
}
}
}
- else if(data->state == BUTTON_STATE_NUM_EDITING) {
- if(event->type == ESCKEY) {
+ else if (data->state == BUTTON_STATE_NUM_EDITING) {
+ if (event->type == ESCKEY) {
data->cancel= 1;
data->escapecancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
- else if(event->type == MOUSEMOVE) {
- if(mx!=data->draglastx || my!=data->draglasty) {
- if(ui_numedit_but_HSVCUBE(but, data, mx, my))
+ else if (event->type == MOUSEMOVE) {
+ if (mx!=data->draglastx || my!=data->draglasty) {
+ if (ui_numedit_but_HSVCUBE(but, data, mx, my))
ui_numedit_apply(C, block, but, data);
}
}
- else if(event->type==LEFTMOUSE && event->val!=KM_PRESS)
+ else if (event->type==LEFTMOUSE && event->val!=KM_PRESS)
button_activate_state(C, but, BUTTON_STATE_EXIT);
return WM_UI_HANDLER_BREAK;
@@ -3308,7 +3314,7 @@ static int ui_numedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, int mx
if (hsv[2] == 0.f) hsv[2] = 0.0001f;
}
- if(U.uiflag & USER_CONTINUOUS_MOUSE) {
+ if (U.uiflag & USER_CONTINUOUS_MOUSE) {
float fac= shift ? 0.05f : 1.0f;
/* slow down the mouse, this is fairly picky */
mx = (data->dragstartx*(1.0f-fac) + mx*fac);
@@ -3317,12 +3323,12 @@ static int ui_numedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, int mx
ui_hsvcircle_vals_from_pos(hsv, hsv+1, &rect, (float)mx, (float)my);
- if(but->flag & UI_BUT_COLOR_CUBIC)
+ if (but->flag & UI_BUT_COLOR_CUBIC)
hsv[1]= 1.0f - sqrt3f(1.0f - hsv[1]);
hsv_to_rgb(hsv[0], hsv[1], hsv[2], rgb, rgb+1, rgb+2);
- if((but->flag & UI_BUT_VEC_SIZE_LOCK) && (rgb[0] || rgb[1] || rgb[2])) {
+ if ((but->flag & UI_BUT_VEC_SIZE_LOCK) && (rgb[0] || rgb[1] || rgb[2])) {
normalize_v3(rgb);
mul_v3_fl(rgb, but->a2);
}
@@ -3379,7 +3385,7 @@ static void ui_ndofedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, wmND
hsv_to_rgb(hsv[0], hsv[1], hsv[2], data->vec, data->vec+1, data->vec+2);
- if((but->flag & UI_BUT_VEC_SIZE_LOCK) && (data->vec[0] || data->vec[1] || data->vec[2])) {
+ if ((but->flag & UI_BUT_VEC_SIZE_LOCK) && (data->vec[0] || data->vec[1] || data->vec[2])) {
normalize_v3(data->vec);
mul_v3_fl(data->vec, but->a2);
}
@@ -3395,8 +3401,8 @@ static int ui_do_but_HSVCIRCLE(bContext *C, uiBlock *block, uiBut *but, uiHandle
my= event->y;
ui_window_to_block(data->region, block, &mx, &my);
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
- if(event->type==LEFTMOUSE && event->val==KM_PRESS) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (event->type==LEFTMOUSE && event->val==KM_PRESS) {
data->dragstartx= mx;
data->dragstarty= my;
data->draglastx= mx;
@@ -3404,7 +3410,7 @@ static int ui_do_but_HSVCIRCLE(bContext *C, uiBlock *block, uiBut *but, uiHandle
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
/* also do drag the first time */
- if(ui_numedit_but_HSVCIRCLE(but, data, mx, my, event->shift))
+ if (ui_numedit_but_HSVCIRCLE(but, data, mx, my, event->shift))
ui_numedit_apply(C, block, but, data);
return WM_UI_HANDLER_BREAK;
@@ -3448,32 +3454,32 @@ static int ui_do_but_HSVCIRCLE(bContext *C, uiBlock *block, uiBut *but, uiHandle
return WM_UI_HANDLER_BREAK;
}
}
- else if(data->state == BUTTON_STATE_NUM_EDITING) {
- if(event->type == ESCKEY) {
+ else if (data->state == BUTTON_STATE_NUM_EDITING) {
+ if (event->type == ESCKEY) {
data->cancel= 1;
data->escapecancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
/* XXX hardcoded keymap check.... */
- else if(event->type == WHEELDOWNMOUSE) {
+ else if (event->type == WHEELDOWNMOUSE) {
float *hsv= ui_block_hsv_get(but->block);
hsv[2]= CLAMPIS(hsv[2]-0.05f, 0.0f, 1.0f);
ui_set_but_hsv(but); // converts to rgb
ui_numedit_apply(C, block, but, data);
}
- else if(event->type == WHEELUPMOUSE) {
+ else if (event->type == WHEELUPMOUSE) {
float *hsv= ui_block_hsv_get(but->block);
hsv[2]= CLAMPIS(hsv[2]+0.05f, 0.0f, 1.0f);
ui_set_but_hsv(but); // converts to rgb
ui_numedit_apply(C, block, but, data);
}
- else if(event->type == MOUSEMOVE) {
- if(mx!=data->draglastx || my!=data->draglasty) {
- if(ui_numedit_but_HSVCIRCLE(but, data, mx, my, event->shift))
+ else if (event->type == MOUSEMOVE) {
+ if (mx!=data->draglastx || my!=data->draglasty) {
+ if (ui_numedit_but_HSVCIRCLE(but, data, mx, my, event->shift))
ui_numedit_apply(C, block, but, data);
}
}
- else if(event->type==LEFTMOUSE && event->val!=KM_PRESS) {
+ else if (event->type==LEFTMOUSE && event->val!=KM_PRESS) {
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
return WM_UI_HANDLER_BREAK;
@@ -3488,7 +3494,7 @@ static int ui_numedit_but_COLORBAND(uiBut *but, uiHandleButtonData *data, int mx
float dx;
int changed= 0;
- if(data->draglastx == mx)
+ if (data->draglastx == mx)
return changed;
dx= ((float)(mx - data->draglastx))/(but->x2-but->x1);
@@ -3514,11 +3520,11 @@ static int ui_do_but_COLORBAND(bContext *C, uiBlock *block, uiBut *but, uiHandle
my= event->y;
ui_window_to_block(data->region, block, &mx, &my);
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
- if(event->type==LEFTMOUSE && event->val==KM_PRESS) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (event->type==LEFTMOUSE && event->val==KM_PRESS) {
coba= (ColorBand*)but->poin;
- if(event->ctrl) {
+ if (event->ctrl) {
/* insert new key on mouse location */
float pos= ((float)(mx - but->x1))/(but->x2-but->x1);
colorband_element_add(coba, pos);
@@ -3531,11 +3537,11 @@ static int ui_do_but_COLORBAND(bContext *C, uiBlock *block, uiBut *but, uiHandle
data->draglasty= my;
/* activate new key when mouse is close */
- for(a=0, cbd= coba->data; a<coba->tot; a++, cbd++) {
+ for (a=0, cbd= coba->data; a<coba->tot; a++, cbd++) {
xco= but->x1 + (cbd->pos*(but->x2-but->x1));
xco= ABS(xco-mx);
- if(a==coba->cur) xco+= 5; // selected one disadvantage
- if(xco<mindist) {
+ if (a==coba->cur) xco+= 5; // selected one disadvantage
+ if (xco<mindist) {
coba->cur= a;
mindist= xco;
}
@@ -3548,14 +3554,14 @@ static int ui_do_but_COLORBAND(bContext *C, uiBlock *block, uiBut *but, uiHandle
return WM_UI_HANDLER_BREAK;
}
}
- else if(data->state == BUTTON_STATE_NUM_EDITING) {
- if(event->type == MOUSEMOVE) {
- if(mx!=data->draglastx || my!=data->draglasty) {
- if(ui_numedit_but_COLORBAND(but, data, mx))
+ else if (data->state == BUTTON_STATE_NUM_EDITING) {
+ if (event->type == MOUSEMOVE) {
+ if (mx!=data->draglastx || my!=data->draglasty) {
+ if (ui_numedit_but_COLORBAND(but, data, mx))
ui_numedit_apply(C, block, but, data);
}
}
- else if(event->type==LEFTMOUSE && event->val!=KM_PRESS)
+ else if (event->type==LEFTMOUSE && event->val!=KM_PRESS)
button_activate_state(C, but, BUTTON_STATE_EXIT);
return WM_UI_HANDLER_BREAK;
@@ -3577,38 +3583,38 @@ static int ui_numedit_but_CURVE(uiBut *but, uiHandleButtonData *data, int snap,
/* offsx= cumap->curr.xmin; */
/* offsy= cumap->curr.ymin; */
- if(snap) {
+ if (snap) {
float d[2];
d[0]= mx - data->dragstartx;
d[1]= my - data->dragstarty;
- if(len_v2(d) < 3.0f)
+ if (len_v2(d) < 3.0f)
snap= 0;
}
- if(data->dragsel != -1) {
+ if (data->dragsel != -1) {
int moved_point= 0; /* for ctrl grid, can't use orig coords because of sorting */
fx= (mx-data->draglastx)/zoomx;
fy= (my-data->draglasty)/zoomy;
- for(a=0; a<cuma->totpoint; a++) {
- if(cmp[a].flag & SELECT) {
+ for (a=0; a<cuma->totpoint; a++) {
+ if (cmp[a].flag & SELECT) {
float origx= cmp[a].x, origy= cmp[a].y;
cmp[a].x+= fx;
cmp[a].y+= fy;
- if(snap) {
+ if (snap) {
cmp[a].x= 0.125f*floorf(0.5f + 8.0f*cmp[a].x);
cmp[a].y= 0.125f*floorf(0.5f + 8.0f*cmp[a].y);
}
- if(cmp[a].x!=origx || cmp[a].y!=origy)
+ if (cmp[a].x!=origx || cmp[a].y!=origy)
moved_point= 1;
}
}
curvemapping_changed(cumap, 0); /* no remove doubles */
- if(moved_point) {
+ if (moved_point) {
data->draglastx= mx;
data->draglasty= my;
changed= 1;
@@ -3621,14 +3627,14 @@ static int ui_numedit_but_CURVE(uiBut *but, uiHandleButtonData *data, int snap,
fy= (my-data->draglasty)/zoomy;
/* clamp for clip */
- if(cumap->flag & CUMA_DO_CLIP) {
- if(cumap->curr.xmin-fx < cumap->clipr.xmin)
+ if (cumap->flag & CUMA_DO_CLIP) {
+ if (cumap->curr.xmin-fx < cumap->clipr.xmin)
fx= cumap->curr.xmin - cumap->clipr.xmin;
- else if(cumap->curr.xmax-fx > cumap->clipr.xmax)
+ else if (cumap->curr.xmax-fx > cumap->clipr.xmax)
fx= cumap->curr.xmax - cumap->clipr.xmax;
- if(cumap->curr.ymin-fy < cumap->clipr.ymin)
+ if (cumap->curr.ymin-fy < cumap->clipr.ymin)
fy= cumap->curr.ymin - cumap->clipr.ymin;
- else if(cumap->curr.ymax-fy > cumap->clipr.ymax)
+ else if (cumap->curr.ymax-fy > cumap->clipr.ymax)
fy= cumap->curr.ymax - cumap->clipr.ymax;
}
@@ -3654,8 +3660,8 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt
my= event->y;
ui_window_to_block(data->region, block, &mx, &my);
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
- if(event->type==LEFTMOUSE && event->val==KM_PRESS) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (event->type==LEFTMOUSE && event->val==KM_PRESS) {
CurveMapping *cumap= (CurveMapping*)but->poin;
CurveMap *cuma= cumap->cm+cumap->cur;
CurveMapPoint *cmp;
@@ -3668,7 +3674,7 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt
offsx= cumap->curr.xmin;
offsy= cumap->curr.ymin;
- if(event->ctrl) {
+ if (event->ctrl) {
fx= ((float)my - but->x1)/zoomx + offsx;
fy= ((float)my - but->y1)/zoomy + offsy;
@@ -3679,11 +3685,11 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt
/* check for selecting of a point */
cmp= cuma->curve; /* ctrl adds point, new malloc */
- for(a=0; a<cuma->totpoint; a++) {
+ for (a=0; a<cuma->totpoint; a++) {
fx= but->x1 + zoomx*(cmp[a].x-offsx);
fy= but->y1 + zoomy*(cmp[a].y-offsy);
dist= (fx-mx)*(fx-mx) + (fy-my)*(fy-my);
- if(dist < mindist) {
+ if (dist < mindist) {
sel= a;
mindist= dist;
}
@@ -3701,7 +3707,7 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt
/* loop through the curve segment table and find what's near the mouse.
* 0.05 is kinda arbitrary, but seems to be what works nicely. */
- for(i=0; i<=CM_TABLE; i++) {
+ for (i=0; i<=CM_TABLE; i++) {
if ( (fabsf(fx - cmp[i].x) < 0.05f) &&
(fabsf(fy - cmp[i].y) < 0.05f))
{
@@ -3715,8 +3721,8 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt
cmp= cuma->curve;
/* find newly added point and make it 'sel' */
- for(a=0; a<cuma->totpoint; a++)
- if(cmp[a].x == fx)
+ for (a=0; a<cuma->totpoint; a++)
+ if (cmp[a].x == fx)
sel = a;
break;
@@ -3724,11 +3730,11 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt
}
}
- if(sel!= -1) {
+ if (sel!= -1) {
/* ok, we move a point */
/* deselect all if this one is deselect. except if we hold shift */
- if(event->shift == FALSE) {
- for(a=0; a<cuma->totpoint; a++)
+ if (event->shift == FALSE) {
+ for (a=0; a<cuma->totpoint; a++)
cmp[a].flag &= ~SELECT;
cmp[sel].flag |= SELECT;
}
@@ -3751,23 +3757,23 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt
return WM_UI_HANDLER_BREAK;
}
}
- else if(data->state == BUTTON_STATE_NUM_EDITING) {
- if(event->type == MOUSEMOVE) {
- if(mx!=data->draglastx || my!=data->draglasty) {
- if(ui_numedit_but_CURVE(but, data, event->ctrl, mx, my))
+ else if (data->state == BUTTON_STATE_NUM_EDITING) {
+ if (event->type == MOUSEMOVE) {
+ if (mx!=data->draglastx || my!=data->draglasty) {
+ if (ui_numedit_but_CURVE(but, data, event->ctrl, mx, my))
ui_numedit_apply(C, block, but, data);
}
}
- else if(event->type==LEFTMOUSE && event->val!=KM_PRESS) {
- if(data->dragsel != -1) {
+ else if (event->type==LEFTMOUSE && event->val!=KM_PRESS) {
+ if (data->dragsel != -1) {
CurveMapping *cumap= (CurveMapping*)but->poin;
CurveMap *cuma= cumap->cm+cumap->cur;
CurveMapPoint *cmp= cuma->curve;
- if(!data->dragchange) {
+ if (!data->dragchange) {
/* deselect all, select one */
- if(event->shift == FALSE) {
- for(a=0; a<cuma->totpoint; a++)
+ if (event->shift == FALSE) {
+ for (a=0; a<cuma->totpoint; a++)
cmp[a].flag &= ~SELECT;
cmp[data->dragsel].flag |= SELECT;
}
@@ -3811,7 +3817,8 @@ static int ui_numedit_but_HISTOGRAM(uiBut *but, uiHandleButtonData *data, int mx
if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) {
/* resize histogram widget itself */
hist->height = (but->y2 - but->y1) + (data->dragstarty - my);
- } else {
+ }
+ else {
/* scale histogram values */
yfac = MIN2(powf(hist->ymax, 2.f), 1.f) * 0.5f;
hist->ymax += dy * yfac;
@@ -3833,8 +3840,8 @@ static int ui_do_but_HISTOGRAM(bContext *C, uiBlock *block, uiBut *but, uiHandle
my= event->y;
ui_window_to_block(data->region, block, &mx, &my);
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
- if(event->type==LEFTMOUSE && event->val==KM_PRESS) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (event->type==LEFTMOUSE && event->val==KM_PRESS) {
data->dragstartx= mx;
data->dragstarty= my;
data->draglastx= mx;
@@ -3842,7 +3849,7 @@ static int ui_do_but_HISTOGRAM(bContext *C, uiBlock *block, uiBut *but, uiHandle
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
/* also do drag the first time */
- if(ui_numedit_but_HISTOGRAM(but, data, mx, my))
+ if (ui_numedit_but_HISTOGRAM(but, data, mx, my))
ui_numedit_apply(C, block, but, data);
return WM_UI_HANDLER_BREAK;
@@ -3856,19 +3863,19 @@ static int ui_do_but_HISTOGRAM(bContext *C, uiBlock *block, uiBut *but, uiHandle
return WM_UI_HANDLER_BREAK;
}
}
- else if(data->state == BUTTON_STATE_NUM_EDITING) {
- if(event->type == ESCKEY) {
+ else if (data->state == BUTTON_STATE_NUM_EDITING) {
+ if (event->type == ESCKEY) {
data->cancel= 1;
data->escapecancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
- else if(event->type == MOUSEMOVE) {
- if(mx!=data->draglastx || my!=data->draglasty) {
- if(ui_numedit_but_HISTOGRAM(but, data, mx, my))
+ else if (event->type == MOUSEMOVE) {
+ if (mx!=data->draglastx || my!=data->draglasty) {
+ if (ui_numedit_but_HISTOGRAM(but, data, mx, my))
ui_numedit_apply(C, block, but, data);
}
}
- else if(event->type==LEFTMOUSE && event->val!=KM_PRESS) {
+ else if (event->type==LEFTMOUSE && event->val!=KM_PRESS) {
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
return WM_UI_HANDLER_BREAK;
@@ -3894,7 +3901,8 @@ static int ui_numedit_but_WAVEFORM(uiBut *but, uiHandleButtonData *data, int mx,
if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) {
/* resize waveform widget itself */
scopes->wavefrm_height = (but->y2 - but->y1) + (data->dragstarty - my);
- } else {
+ }
+ else {
/* scale waveform values */
/* yfac = scopes->wavefrm_yfac; */ /* UNUSED */
scopes->wavefrm_yfac += dy/200.0f;
@@ -3916,8 +3924,8 @@ static int ui_do_but_WAVEFORM(bContext *C, uiBlock *block, uiBut *but, uiHandleB
my= event->y;
ui_window_to_block(data->region, block, &mx, &my);
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
- if(event->type==LEFTMOUSE && event->val==KM_PRESS) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (event->type==LEFTMOUSE && event->val==KM_PRESS) {
data->dragstartx= mx;
data->dragstarty= my;
data->draglastx= mx;
@@ -3925,7 +3933,7 @@ static int ui_do_but_WAVEFORM(bContext *C, uiBlock *block, uiBut *but, uiHandleB
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
/* also do drag the first time */
- if(ui_numedit_but_WAVEFORM(but, data, mx, my))
+ if (ui_numedit_but_WAVEFORM(but, data, mx, my))
ui_numedit_apply(C, block, but, data);
return WM_UI_HANDLER_BREAK;
@@ -3939,19 +3947,19 @@ static int ui_do_but_WAVEFORM(bContext *C, uiBlock *block, uiBut *but, uiHandleB
return WM_UI_HANDLER_BREAK;
}
}
- else if(data->state == BUTTON_STATE_NUM_EDITING) {
- if(event->type == ESCKEY) {
+ else if (data->state == BUTTON_STATE_NUM_EDITING) {
+ if (event->type == ESCKEY) {
data->cancel= 1;
data->escapecancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
- else if(event->type == MOUSEMOVE) {
- if(mx!=data->draglastx || my!=data->draglasty) {
- if(ui_numedit_but_WAVEFORM(but, data, mx, my))
+ else if (event->type == MOUSEMOVE) {
+ if (mx!=data->draglastx || my!=data->draglasty) {
+ if (ui_numedit_but_WAVEFORM(but, data, mx, my))
ui_numedit_apply(C, block, but, data);
}
}
- else if(event->type==LEFTMOUSE && event->val!=KM_PRESS) {
+ else if (event->type==LEFTMOUSE && event->val!=KM_PRESS) {
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
return WM_UI_HANDLER_BREAK;
@@ -3992,8 +4000,8 @@ static int ui_do_but_VECTORSCOPE(bContext *C, uiBlock *block, uiBut *but, uiHand
my= event->y;
ui_window_to_block(data->region, block, &mx, &my);
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
- if(event->type==LEFTMOUSE && event->val==KM_PRESS) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (event->type==LEFTMOUSE && event->val==KM_PRESS) {
data->dragstartx= mx;
data->dragstarty= my;
data->draglastx= mx;
@@ -4001,25 +4009,25 @@ static int ui_do_but_VECTORSCOPE(bContext *C, uiBlock *block, uiBut *but, uiHand
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
/* also do drag the first time */
- if(ui_numedit_but_VECTORSCOPE(but, data, mx, my))
+ if (ui_numedit_but_VECTORSCOPE(but, data, mx, my))
ui_numedit_apply(C, block, but, data);
return WM_UI_HANDLER_BREAK;
}
}
- else if(data->state == BUTTON_STATE_NUM_EDITING) {
- if(event->type == ESCKEY) {
+ else if (data->state == BUTTON_STATE_NUM_EDITING) {
+ if (event->type == ESCKEY) {
data->cancel= 1;
data->escapecancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
- else if(event->type == MOUSEMOVE) {
- if(mx!=data->draglastx || my!=data->draglasty) {
- if(ui_numedit_but_VECTORSCOPE(but, data, mx, my))
+ else if (event->type == MOUSEMOVE) {
+ if (mx!=data->draglastx || my!=data->draglasty) {
+ if (ui_numedit_but_VECTORSCOPE(but, data, mx, my))
ui_numedit_apply(C, block, but, data);
}
}
- else if(event->type==LEFTMOUSE && event->val!=KM_PRESS) {
+ else if (event->type==LEFTMOUSE && event->val!=KM_PRESS) {
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
return WM_UI_HANDLER_BREAK;
@@ -4042,8 +4050,8 @@ static int ui_do_but_CHARTAB(bContext *UNUSED(C), uiBlock *UNUSED(block), uiBut
my= event->y;
ui_window_to_block(data->region, block, &mx, &my);
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
- if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
/* Calculate the size of the button */
width = abs(but->x2 - but->x1);
height = abs(but->y2 - but->y1);
@@ -4065,30 +4073,30 @@ static int ui_do_but_CHARTAB(bContext *UNUSED(C), uiBlock *UNUSED(block), uiBut
che = cs + (y*12) + x;
- if(che > G.charmax)
+ if (che > G.charmax)
che = 0;
- if(G.obedit) {
+ if (G.obedit) {
do_textedit(0,0,che);
}
button_activate_state(C, but, BUTTON_STATE_EXIT);
return WM_UI_HANDLER_BREAK;
}
- else if(ELEM(event->type, WHEELUPMOUSE, PAGEUPKEY)) {
- for(but= block->buttons.first; but; but= but->next) {
- if(but->type == CHARTAB) {
+ else if (ELEM(event->type, WHEELUPMOUSE, PAGEUPKEY)) {
+ for (but= block->buttons.first; but; but= but->next) {
+ if (but->type == CHARTAB) {
G.charstart = G.charstart - (12*6);
- if(G.charstart < 0)
+ if (G.charstart < 0)
G.charstart = 0;
- if(G.charstart < G.charmin)
+ if (G.charstart < G.charmin)
G.charstart = G.charmin;
ui_draw_but(but);
//Really nasty... to update the num button from the same butblock
- for(bt= block->buttons.first; bt; bt= bt->next)
+ for (bt= block->buttons.first; bt; bt= bt->next)
{
- if(ELEM(bt->type, NUM, NUMABS)) {
+ if (ELEM(bt->type, NUM, NUMABS)) {
ui_check_but(bt);
ui_draw_but(bt);
}
@@ -4100,19 +4108,19 @@ static int ui_do_but_CHARTAB(bContext *UNUSED(C), uiBlock *UNUSED(block), uiBut
return WM_UI_HANDLER_BREAK;
}
- else if(ELEM(event->type, WHEELDOWNMOUSE, PAGEDOWNKEY)) {
- for(but= block->buttons.first; but; but= but->next) {
- if(but->type == CHARTAB) {
+ else if (ELEM(event->type, WHEELDOWNMOUSE, PAGEDOWNKEY)) {
+ for (but= block->buttons.first; but; but= but->next) {
+ if (but->type == CHARTAB) {
G.charstart = G.charstart + (12*6);
- if(G.charstart > (0xffff - 12*6))
+ if (G.charstart > (0xffff - 12*6))
G.charstart = 0xffff - (12*6);
- if(G.charstart > G.charmax - 12*6)
+ if (G.charstart > G.charmax - 12*6)
G.charstart = G.charmax - 12*6;
ui_draw_but(but);
- for(bt= block->buttons.first; bt; bt= bt->next)
+ for (bt= block->buttons.first; bt; bt= bt->next)
{
- if(ELEM(bt->type, NUM, NUMABS)) {
+ if (ELEM(bt->type, NUM, NUMABS)) {
ui_check_but(bt);
ui_draw_but(bt);
}
@@ -4138,20 +4146,20 @@ static int ui_do_but_LINK(bContext *C, uiBut *but, uiHandleButtonData *data, wmE
{
VECCOPY2D(but->linkto, event->mval);
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
- if(event->type == LEFTMOUSE && event->val==KM_PRESS) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (event->type == LEFTMOUSE && event->val==KM_PRESS) {
button_activate_state(C, but, BUTTON_STATE_WAIT_RELEASE);
return WM_UI_HANDLER_BREAK;
}
- else if(event->type == LEFTMOUSE && but->block->handle) {
+ else if (event->type == LEFTMOUSE && but->block->handle) {
button_activate_state(C, but, BUTTON_STATE_EXIT);
return WM_UI_HANDLER_BREAK;
}
}
- else if(data->state == BUTTON_STATE_WAIT_RELEASE) {
+ else if (data->state == BUTTON_STATE_WAIT_RELEASE) {
- if(event->type == LEFTMOUSE && event->val!=KM_PRESS) {
- if(!(but->flag & UI_SELECT))
+ if (event->type == LEFTMOUSE && event->val!=KM_PRESS) {
+ if (!(but->flag & UI_SELECT))
data->cancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
return WM_UI_HANDLER_BREAK;
@@ -4170,7 +4178,7 @@ static int ui_numedit_but_TRACKPREVIEW(bContext *C, uiBut *but, uiHandleButtonDa
dx = mx - data->draglastx;
dy = my - data->draglasty;
- if(shift) {
+ if (shift) {
dx /= 5.0f;
dy /= 5.0f;
}
@@ -4178,9 +4186,10 @@ static int ui_numedit_but_TRACKPREVIEW(bContext *C, uiBut *but, uiHandleButtonDa
if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) {
/* resize preview widget itself */
scopes->track_preview_height = (but->y2 - but->y1) + (data->dragstarty - my);
- } else {
- if(scopes->marker) {
- if(scopes->marker->framenr!=scopes->framenr)
+ }
+ else {
+ if (scopes->marker) {
+ if (scopes->marker->framenr!=scopes->framenr)
scopes->marker= BKE_tracking_ensure_marker(scopes->track, scopes->framenr);
scopes->marker->flag&= ~(MARKER_DISABLED|MARKER_TRACKED);
@@ -4207,8 +4216,8 @@ static int ui_do_but_TRACKPREVIEW(bContext *C, uiBlock *block, uiBut *but, uiHan
my= event->y;
ui_window_to_block(data->region, block, &mx, &my);
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
- if(event->type==LEFTMOUSE && event->val==KM_PRESS) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (event->type==LEFTMOUSE && event->val==KM_PRESS) {
data->dragstartx= mx;
data->dragstarty= my;
data->draglastx= mx;
@@ -4216,25 +4225,25 @@ static int ui_do_but_TRACKPREVIEW(bContext *C, uiBlock *block, uiBut *but, uiHan
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
/* also do drag the first time */
- if(ui_numedit_but_TRACKPREVIEW(C, but, data, mx, my, event->shift))
+ if (ui_numedit_but_TRACKPREVIEW(C, but, data, mx, my, event->shift))
ui_numedit_apply(C, block, but, data);
return WM_UI_HANDLER_BREAK;
}
}
- else if(data->state == BUTTON_STATE_NUM_EDITING) {
- if(event->type == ESCKEY) {
+ else if (data->state == BUTTON_STATE_NUM_EDITING) {
+ if (event->type == ESCKEY) {
data->cancel= 1;
data->escapecancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
- else if(event->type == MOUSEMOVE) {
- if(mx!=data->draglastx || my!=data->draglasty) {
- if(ui_numedit_but_TRACKPREVIEW(C, but, data, mx, my, event->shift))
+ else if (event->type == MOUSEMOVE) {
+ if (mx!=data->draglastx || my!=data->draglasty) {
+ if (ui_numedit_but_TRACKPREVIEW(C, but, data, mx, my, event->shift))
ui_numedit_apply(C, block, but, data);
}
}
- else if(event->type==LEFTMOUSE && event->val!=KM_PRESS) {
+ else if (event->type==LEFTMOUSE && event->val!=KM_PRESS) {
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
return WM_UI_HANDLER_BREAK;
@@ -4253,7 +4262,7 @@ static void but_shortcut_name_func(bContext *C, void *arg1, int UNUSED(event))
IDProperty *prop= (but->opptr)? but->opptr->data: NULL;
/* complex code to change name of button */
- if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, TRUE,
+ if (WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, TRUE,
shortcut_str, sizeof(shortcut_str)))
{
ui_but_add_shortcut(but, shortcut_str, TRUE);
@@ -4316,7 +4325,7 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg)
kmi_id = kmi->id;
/* copy properties, prop can be NULL for reset */
- if(prop)
+ if (prop)
prop= IDP_CopyProperty(prop);
WM_keymap_properties_reset(kmi, prop);
@@ -4379,12 +4388,12 @@ static int ui_but_menu(bContext *C, uiBut *but)
int length;
const char *name;
- if((but->rnapoin.data && but->rnaprop)==0 && but->optype==NULL)
+ if ((but->rnapoin.data && but->rnaprop)==0 && but->optype==NULL)
return 0;
button_timers_tooltip_remove(C, but);
- if(but->rnaprop)
+ if (but->rnaprop)
name= RNA_property_ui_name(but->rnaprop);
else if (but->optype)
name= but->optype->name;
@@ -4396,19 +4405,19 @@ static int ui_but_menu(bContext *C, uiBut *but)
uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_DEFAULT);
- if(but->rnapoin.data && but->rnaprop) {
+ if (but->rnapoin.data && but->rnaprop) {
short is_anim= RNA_property_animateable(&but->rnapoin, but->rnaprop);
/* second slower test, saved people finding keyframe items in menus when its not possible */
- if(is_anim)
+ if (is_anim)
is_anim= RNA_property_path_from_ID_check(&but->rnapoin, but->rnaprop);
length= RNA_property_array_length(&but->rnapoin, but->rnaprop);
/* Keyframes */
- if(but->flag & UI_BUT_ANIMATED_KEY) {
+ if (but->flag & UI_BUT_ANIMATED_KEY) {
/* replace/delete keyfraemes */
- if(length) {
+ if (length) {
uiItemBooleanO(layout, "Replace Keyframes", ICON_NONE, "ANIM_OT_keyframe_insert_button", "all", 1);
uiItemBooleanO(layout, "Replace Single Keyframe", ICON_NONE, "ANIM_OT_keyframe_insert_button", "all", 0);
uiItemBooleanO(layout, "Delete Keyframes", ICON_NONE, "ANIM_OT_keyframe_delete_button", "all", 1);
@@ -4424,9 +4433,9 @@ static int ui_but_menu(bContext *C, uiBut *but)
}
- else if(but->flag & UI_BUT_DRIVEN);
- else if(is_anim) {
- if(length) {
+ else if (but->flag & UI_BUT_DRIVEN);
+ else if (is_anim) {
+ if (length) {
uiItemBooleanO(layout, "Insert Keyframes", ICON_NONE, "ANIM_OT_keyframe_insert_button", "all", 1);
uiItemBooleanO(layout, "Insert Single Keyframe", ICON_NONE, "ANIM_OT_keyframe_insert_button", "all", 0);
}
@@ -4435,10 +4444,10 @@ static int ui_but_menu(bContext *C, uiBut *but)
}
/* Drivers */
- if(but->flag & UI_BUT_DRIVEN) {
+ if (but->flag & UI_BUT_DRIVEN) {
uiItemS(layout);
- if(length) {
+ if (length) {
uiItemBooleanO(layout, "Delete Drivers", ICON_NONE, "ANIM_OT_driver_button_remove", "all", 1);
uiItemBooleanO(layout, "Delete Single Driver", ICON_NONE, "ANIM_OT_driver_button_remove", "all", 0);
}
@@ -4449,11 +4458,11 @@ static int ui_but_menu(bContext *C, uiBut *but)
if (ANIM_driver_can_paste())
uiItemO(layout, "Paste Driver", ICON_NONE, "ANIM_OT_paste_driver_button");
}
- else if(but->flag & (UI_BUT_ANIMATED_KEY|UI_BUT_ANIMATED));
- else if(is_anim) {
+ else if (but->flag & (UI_BUT_ANIMATED_KEY|UI_BUT_ANIMATED));
+ else if (is_anim) {
uiItemS(layout);
- if(length) {
+ if (length) {
uiItemBooleanO(layout, "Add Drivers", ICON_NONE, "ANIM_OT_driver_button_add", "all", 1);
uiItemBooleanO(layout, "Add Single Driver", ICON_NONE, "ANIM_OT_driver_button_add", "all", 0);
}
@@ -4466,10 +4475,10 @@ static int ui_but_menu(bContext *C, uiBut *but)
/* Keying Sets */
// TODO: check on modifyability of Keying Set when doing this
- if(is_anim) {
+ if (is_anim) {
uiItemS(layout);
- if(length) {
+ if (length) {
uiItemBooleanO(layout, "Add All to Keying Set", ICON_NONE, "ANIM_OT_keyingset_button_add", "all", 1);
uiItemBooleanO(layout, "Add Single to Keying Set", ICON_NONE, "ANIM_OT_keyingset_button_add", "all", 0);
uiItemO(layout, "Remove from Keying Set", ICON_NONE, "ANIM_OT_keyingset_button_remove");
@@ -4487,7 +4496,7 @@ static int ui_but_menu(bContext *C, uiBut *but)
//Copy Property Value
//Paste Property Value
- if(length) {
+ if (length) {
uiItemBooleanO(layout, "Reset All to Default Values", ICON_NONE, "UI_OT_reset_default_button", "all", 1);
uiItemBooleanO(layout, "Reset Single to Default Value", ICON_NONE, "UI_OT_reset_default_button", "all", 0);
}
@@ -4501,7 +4510,7 @@ static int ui_but_menu(bContext *C, uiBut *but)
}
/* Operator buttons */
- if(but->optype) {
+ if (but->optype) {
uiBlock *block = uiLayoutGetBlock(layout);
uiBut *but2;
IDProperty *prop= (but->opptr)? but->opptr->data: NULL;
@@ -4539,7 +4548,7 @@ static int ui_but_menu(bContext *C, uiBut *but)
char buf[512];
PointerRNA ptr_props;
- if(but->rnapoin.data && but->rnaprop) {
+ if (but->rnapoin.data && but->rnaprop) {
BLI_snprintf(buf, sizeof(buf), "%s.%s", RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop));
WM_operator_properties_create(&ptr_props, "WM_OT_doc_view");
@@ -4588,27 +4597,27 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
data= but->active;
retval= WM_UI_HANDLER_CONTINUE;
- if(but->flag & UI_BUT_DISABLED)
+ if (but->flag & UI_BUT_DISABLED)
return WM_UI_HANDLER_CONTINUE;
- if( (data->state == BUTTON_STATE_HIGHLIGHT) &&
+ if ( (data->state == BUTTON_STATE_HIGHLIGHT) &&
/* check prevval because of modal operators [#24016],
* modifier check is to allow Ctrl+C for copy.
* if this causes other problems, remove this check and suffer the bug :) - campbell */
((event->prevval != KM_PRESS) || (ISKEYMODIFIER(event->prevtype)) || (event->type == EVT_DROP))
) {
/* handle copy-paste */
- if(ELEM(event->type, CKEY, VKEY) && event->val==KM_PRESS && (event->ctrl || event->oskey)) {
+ if (ELEM(event->type, CKEY, VKEY) && event->val==KM_PRESS && (event->ctrl || event->oskey)) {
ui_but_copy_paste(C, but, data, (event->type == CKEY)? 'c': 'v');
return WM_UI_HANDLER_BREAK;
}
/* handle drop */
- else if(event->type == EVT_DROP) {
+ else if (event->type == EVT_DROP) {
ui_but_drop (C, event, but, data);
}
/* handle keyframing */
- else if(event->type == IKEY && !ELEM3(KM_MOD_FIRST, event->ctrl, event->oskey, event->shift) && event->val == KM_PRESS) {
- if(event->alt)
+ else if (event->type == IKEY && !ELEM3(KM_MOD_FIRST, event->ctrl, event->oskey, event->shift) && event->val == KM_PRESS) {
+ if (event->alt)
ui_but_anim_delete_keyframe(C);
else
ui_but_anim_insert_keyframe(C);
@@ -4618,8 +4627,8 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
return WM_UI_HANDLER_BREAK;
}
/* handle drivers */
- else if(event->type == DKEY && !ELEM3(KM_MOD_FIRST, event->ctrl, event->oskey, event->shift) && event->val == KM_PRESS) {
- if(event->alt)
+ else if (event->type == DKEY && !ELEM3(KM_MOD_FIRST, event->ctrl, event->oskey, event->shift) && event->val == KM_PRESS) {
+ if (event->alt)
ui_but_anim_remove_driver(C);
else
ui_but_anim_add_driver(C);
@@ -4629,8 +4638,8 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
return WM_UI_HANDLER_BREAK;
}
/* handle keyingsets */
- else if(event->type == KKEY && !ELEM3(KM_MOD_FIRST, event->ctrl, event->oskey, event->shift) && event->val == KM_PRESS) {
- if(event->alt)
+ else if (event->type == KKEY && !ELEM3(KM_MOD_FIRST, event->ctrl, event->oskey, event->shift) && event->val == KM_PRESS) {
+ if (event->alt)
ui_but_anim_remove_keyingset(C);
else
ui_but_anim_add_keyingset(C);
@@ -4641,13 +4650,13 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
}
/* reset to default */
/* XXX hardcoded keymap check.... */
- else if(event->type == BACKSPACEKEY && event->val == KM_PRESS) {
+ else if (event->type == BACKSPACEKEY && event->val == KM_PRESS) {
/* ctrl+backspace = reset active button; backspace = reset a whole array*/
if (!(ELEM3(but->type, HSVCIRCLE, HSVCUBE, HISTOGRAM)))
ui_set_but_default(C, !event->ctrl);
}
/* handle menu */
- else if(event->type == RIGHTMOUSE && event->val == KM_PRESS) {
+ else if (event->type == RIGHTMOUSE && event->val == KM_PRESS) {
/* RMB has two options now */
if (ui_but_menu(C, but)) {
return WM_UI_HANDLER_BREAK;
@@ -4656,16 +4665,16 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
}
/* verify if we can edit this button */
- if(ELEM(event->type, LEFTMOUSE, RETKEY)) {
+ if (ELEM(event->type, LEFTMOUSE, RETKEY)) {
/* this should become disabled button .. */
- if(but->lock) {
- if(but->lockstr) {
+ if (but->lock) {
+ if (but->lockstr) {
BKE_report(NULL, RPT_WARNING, but->lockstr);
button_activate_state(C, but, BUTTON_STATE_EXIT);
return WM_UI_HANDLER_BREAK;
}
}
- else if(but->pointype && but->poin==NULL) {
+ else if (but->pointype && but->poin==NULL) {
/* there's a pointer needed */
BKE_reportf(NULL, RPT_WARNING, "DoButton pointer error: %s", but->str);
button_activate_state(C, but, BUTTON_STATE_EXIT);
@@ -4741,7 +4750,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
retval= ui_do_but_BUT(C, but, data, event);
break;
case COL:
- if(but->a1 == UI_GRAD_V_ALT) // signal to prevent calling up color picker
+ if (but->a1 == UI_GRAD_V_ALT) // signal to prevent calling up color picker
retval= ui_do_but_EXIT(C, but, data, event);
else
retval= ui_do_but_BLOCK(C, but, data, event);
@@ -4791,9 +4800,9 @@ static uiBut *ui_but_find_activated(ARegion *ar)
uiBlock *block;
uiBut *but;
- for(block=ar->uiblocks.first; block; block=block->next)
- for(but=block->buttons.first; but; but= but->next)
- if(but->active)
+ for (block=ar->uiblocks.first; block; block=block->next)
+ for (but=block->buttons.first; but; but= but->next)
+ if (but->active)
return but;
return NULL;
@@ -4809,15 +4818,15 @@ void uiFreeActiveButtons(const bContext *C, bScreen *screen)
{
ScrArea *sa= screen->areabase.first;
- for(;sa; sa= sa->next) {
+ for (;sa; sa= sa->next) {
ARegion *ar= sa->regionbase.first;
- for(;ar; ar= ar->next) {
+ for (;ar; ar= ar->next) {
uiBut *but= ui_but_find_activated(ar);
- if(but) {
+ if (but) {
uiHandleButtonData *data= but->active;
- if(data->menu==NULL && data->searchbox==NULL)
- if(data->state == BUTTON_STATE_HIGHLIGHT)
+ if (data->menu==NULL && data->searchbox==NULL)
+ if (data->state == BUTTON_STATE_HIGHLIGHT)
ui_button_active_free(C, but);
}
}
@@ -4833,8 +4842,8 @@ int UI_but_active_drop_name(bContext *C)
ARegion *ar= CTX_wm_region(C);
uiBut *but= ui_but_find_activated(ar);
- if(but) {
- if(ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU))
+ if (but) {
+ if (ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU))
return 1;
}
@@ -4845,12 +4854,12 @@ static void ui_blocks_set_tooltips(ARegion *ar, int enable)
{
uiBlock *block;
- if(!ar)
+ if (!ar)
return;
/* we disabled buttons when when they were already shown, and
* re-enable them on mouse move */
- for(block=ar->uiblocks.first; block; block=block->next)
+ for (block=ar->uiblocks.first; block; block=block->next)
block->tooltipdisabled= !enable;
}
@@ -4859,8 +4868,8 @@ static int ui_mouse_inside_region(ARegion *ar, int x, int y)
uiBlock *block;
/* check if the mouse is in the region */
- if(!BLI_in_rcti(&ar->winrct, x, y)) {
- for(block=ar->uiblocks.first; block; block=block->next)
+ if (!BLI_in_rcti(&ar->winrct, x, y)) {
+ for (block=ar->uiblocks.first; block; block=block->next)
block->auto_open= FALSE;
return 0;
@@ -4871,7 +4880,7 @@ static int ui_mouse_inside_region(ARegion *ar, int x, int y)
* even when they are not visible, so we need to make a copy of the mask to
* use to check
*/
- if(ar->v2d.mask.xmin!=ar->v2d.mask.xmax) {
+ if (ar->v2d.mask.xmin!=ar->v2d.mask.xmax) {
View2D *v2d= &ar->v2d;
rcti mask_rct;
int mx, my;
@@ -4901,7 +4910,7 @@ static int ui_mouse_inside_region(ARegion *ar, int x, int y)
}
/* check if in the rect */
- if(!BLI_in_rcti(&mask_rct, mx, my))
+ if (!BLI_in_rcti(&mask_rct, mx, my))
return 0;
}
@@ -4910,12 +4919,12 @@ static int ui_mouse_inside_region(ARegion *ar, int x, int y)
static int ui_mouse_inside_button(ARegion *ar, uiBut *but, int x, int y)
{
- if(!ui_mouse_inside_region(ar, x, y))
+ if (!ui_mouse_inside_region(ar, x, y))
return 0;
ui_window_to_block(ar, but->block, &x, &y);
- if(!ui_but_contains_pt(but, x, y))
+ if (!ui_but_contains_pt(but, x, y))
return 0;
return 1;
@@ -4927,34 +4936,34 @@ static uiBut *ui_but_find_mouse_over(ARegion *ar, int x, int y)
uiBut *but, *butover= NULL;
int mx, my;
-// if(!win->active)
+// if (!win->active)
// return NULL;
- if(!ui_mouse_inside_region(ar, x, y))
+ if (!ui_mouse_inside_region(ar, x, y))
return NULL;
- for(block=ar->uiblocks.first; block; block=block->next) {
+ for (block=ar->uiblocks.first; block; block=block->next) {
mx= x;
my= y;
ui_window_to_block(ar, block, &mx, &my);
- for(but=block->buttons.first; but; but= but->next) {
+ for (but=block->buttons.first; but; but= but->next) {
/* note, LABEL is included for hilights, this allows drags */
- if(but->type==LABEL && but->dragpoin==NULL)
+ if (but->type==LABEL && but->dragpoin==NULL)
continue;
- if(ELEM3(but->type, ROUNDBOX, SEPR, LISTBOX))
+ if (ELEM3(but->type, ROUNDBOX, SEPR, LISTBOX))
continue;
- if(but->flag & UI_HIDDEN)
+ if (but->flag & UI_HIDDEN)
continue;
- if(but->flag & UI_SCROLLED)
+ if (but->flag & UI_SCROLLED)
continue;
- if(ui_but_contains_pt(but, mx, my))
+ if (ui_but_contains_pt(but, mx, my))
butover= but;
}
/* CLIP_EVENTS prevents the event from reaching other blocks */
if (block->flag & UI_BLOCK_CLIP_EVENTS) {
/* check if mouse is inside block */
- if(block->minx <= mx && block->maxx >= mx &&
+ if (block->minx <= mx && block->maxx >= mx &&
block->miny <= my && block->maxy >= my)
break;
}
@@ -4969,18 +4978,18 @@ static uiBut *ui_list_find_mouse_over(ARegion *ar, int x, int y)
uiBut *but;
int mx, my;
-// if(!win->active)
+// if (!win->active)
// return NULL;
- if(!ui_mouse_inside_region(ar, x, y))
+ if (!ui_mouse_inside_region(ar, x, y))
return NULL;
- for(block=ar->uiblocks.first; block; block=block->next) {
+ for (block=ar->uiblocks.first; block; block=block->next) {
mx= x;
my= y;
ui_window_to_block(ar, block, &mx, &my);
- for(but=block->buttons.last; but; but= but->prev)
- if(but->type == LISTBOX && ui_but_contains_pt(but, mx, my))
+ for (but=block->buttons.last; but; but= but->prev)
+ if (but->type == LISTBOX && ui_but_contains_pt(but, mx, my))
return but;
}
@@ -5001,18 +5010,18 @@ static void button_timers_tooltip_remove(bContext *C, uiBut *but)
uiHandleButtonData *data;
data= but->active;
- if(data) {
+ if (data) {
- if(data->tooltiptimer) {
+ if (data->tooltiptimer) {
WM_event_remove_timer(data->wm, data->window, data->tooltiptimer);
data->tooltiptimer= NULL;
}
- if(data->tooltip) {
+ if (data->tooltip) {
ui_tooltip_free(C, data->tooltip);
data->tooltip= NULL;
}
- if(data->autoopentimer) {
+ if (data->autoopentimer) {
WM_event_remove_timer(data->wm, data->window, data->autoopentimer);
data->autoopentimer= NULL;
}
@@ -5026,14 +5035,14 @@ static void button_tooltip_timer_reset(bContext *C, uiBut *but)
data= but->active;
- if(data->tooltiptimer) {
+ if (data->tooltiptimer) {
WM_event_remove_timer(data->wm, data->window, data->tooltiptimer);
data->tooltiptimer= NULL;
}
- if(U.flag & USER_TOOLTIPS)
- if(!but->block->tooltipdisabled)
- if(!wm->drags.first)
+ if (U.flag & USER_TOOLTIPS)
+ if (!but->block->tooltipdisabled)
+ if (!wm->drags.first)
data->tooltiptimer= WM_event_add_timer(data->wm, data->window, TIMER, BUTTON_TOOLTIP_DELAY);
}
@@ -5042,26 +5051,26 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s
uiHandleButtonData *data;
data= but->active;
- if(data->state == state)
+ if (data->state == state)
return;
/* highlight has timers for tooltips and auto open */
- if(state == BUTTON_STATE_HIGHLIGHT) {
+ if (state == BUTTON_STATE_HIGHLIGHT) {
but->flag &= ~UI_SELECT;
button_tooltip_timer_reset(C, but);
/* automatic open pulldown block timer */
- if(ELEM3(but->type, BLOCK, PULLDOWN, ICONTEXTROW)) {
- if(data->used_mouse && !data->autoopentimer) {
+ if (ELEM3(but->type, BLOCK, PULLDOWN, ICONTEXTROW)) {
+ if (data->used_mouse && !data->autoopentimer) {
int time;
- if(but->block->auto_open==TRUE) time= 1; // test for toolbox
- else if((but->block->flag & UI_BLOCK_LOOP && but->type != BLOCK) || but->block->auto_open==TRUE) time= 5*U.menuthreshold2;
- else if(U.uiflag & USER_MENUOPENAUTO) time= 5*U.menuthreshold1;
+ if (but->block->auto_open==TRUE) time= 1; // test for toolbox
+ else if ((but->block->flag & UI_BLOCK_LOOP && but->type != BLOCK) || but->block->auto_open==TRUE) time= 5*U.menuthreshold2;
+ else if (U.uiflag & USER_MENUOPENAUTO) time= 5*U.menuthreshold1;
else time= -1;
- if(time >= 0)
+ if (time >= 0)
data->autoopentimer= WM_event_add_timer(data->wm, data->window, TIMER, 0.02*(double)time);
}
}
@@ -5072,65 +5081,66 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s
}
/* text editing */
- if(state == BUTTON_STATE_TEXT_EDITING && data->state != BUTTON_STATE_TEXT_SELECTING)
+ if (state == BUTTON_STATE_TEXT_EDITING && data->state != BUTTON_STATE_TEXT_SELECTING)
ui_textedit_begin(C, but, data);
- else if(data->state == BUTTON_STATE_TEXT_EDITING && state != BUTTON_STATE_TEXT_SELECTING)
+ else if (data->state == BUTTON_STATE_TEXT_EDITING && state != BUTTON_STATE_TEXT_SELECTING)
ui_textedit_end(C, but, data);
- else if(data->state == BUTTON_STATE_TEXT_SELECTING && state != BUTTON_STATE_TEXT_EDITING)
+ else if (data->state == BUTTON_STATE_TEXT_SELECTING && state != BUTTON_STATE_TEXT_EDITING)
ui_textedit_end(C, but, data);
/* number editing */
- if(state == BUTTON_STATE_NUM_EDITING) {
- if(ui_is_a_warp_but(but))
+ if (state == BUTTON_STATE_NUM_EDITING) {
+ if (ui_is_a_warp_but(but))
WM_cursor_grab(CTX_wm_window(C), TRUE, TRUE, NULL);
ui_numedit_begin(but, data);
- } else if(data->state == BUTTON_STATE_NUM_EDITING) {
+ }
+ else if (data->state == BUTTON_STATE_NUM_EDITING) {
ui_numedit_end(but, data);
- if(ui_is_a_warp_but(but))
+ if (ui_is_a_warp_but(but))
WM_cursor_ungrab(CTX_wm_window(C));
}
/* menu open */
- if(state == BUTTON_STATE_MENU_OPEN)
+ if (state == BUTTON_STATE_MENU_OPEN)
ui_blockopen_begin(C, but, data);
- else if(data->state == BUTTON_STATE_MENU_OPEN)
+ else if (data->state == BUTTON_STATE_MENU_OPEN)
ui_blockopen_end(C, but, data);
/* add a short delay before exiting, to ensure there is some feedback */
- if(state == BUTTON_STATE_WAIT_FLASH) {
+ if (state == BUTTON_STATE_WAIT_FLASH) {
data->flashtimer= WM_event_add_timer(data->wm, data->window, TIMER, BUTTON_FLASH_DELAY);
}
- else if(data->flashtimer) {
+ else if (data->flashtimer) {
WM_event_remove_timer(data->wm, data->window, data->flashtimer);
data->flashtimer= NULL;
}
/* add a blocking ui handler at the window handler for blocking, modal states
* but not for popups, because we already have a window level handler*/
- if(!(but->block->handle && but->block->handle->popup)) {
- if(button_modal_state(state)) {
- if(!button_modal_state(data->state))
+ if (!(but->block->handle && but->block->handle->popup)) {
+ if (button_modal_state(state)) {
+ if (!button_modal_state(data->state))
WM_event_add_ui_handler(C, &data->window->modalhandlers, ui_handler_region_menu, NULL, data);
}
else {
- if(button_modal_state(data->state))
+ if (button_modal_state(data->state))
WM_event_remove_ui_handler(&data->window->modalhandlers, ui_handler_region_menu, NULL, data, 1); /* 1 = postpone free */
}
}
/* wait for mousemove to enable drag */
- if(state == BUTTON_STATE_WAIT_DRAG) {
+ if (state == BUTTON_STATE_WAIT_DRAG) {
but->flag &= ~UI_SELECT;
}
data->state= state;
- if(state != BUTTON_STATE_EXIT) {
+ if (state != BUTTON_STATE_EXIT) {
/* When objects for eg. are removed, running ui_check_but() can access
* the removed data - so disable update on exit. Also in case of
* highlight when not in a popup menu, we remove because data used in
* button below popup might have been removed by action of popup. Needs
* a more reliable solution... */
- if(state != BUTTON_STATE_HIGHLIGHT || (but->block->flag & UI_BLOCK_LOOP))
+ if (state != BUTTON_STATE_HIGHLIGHT || (but->block->flag & UI_BLOCK_LOOP))
ui_check_but(but);
}
@@ -5147,7 +5157,7 @@ static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonA
data->wm= CTX_wm_manager(C);
data->window= CTX_wm_window(C);
data->region= ar;
- if( ELEM(but->type, BUT_CURVE, SEARCH_MENU) ); // XXX curve is temp
+ if ( ELEM(but->type, BUT_CURVE, SEARCH_MENU) ); // XXX curve is temp
else data->interactive= 1;
data->state = BUTTON_STATE_INIT;
@@ -5159,42 +5169,42 @@ static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonA
/* we disable auto_open in the block after a threshold, because we still
* want to allow auto opening adjacent menus even if no button is activated
* in between going over to the other button, but only for a short while */
- if(type == BUTTON_ACTIVATE_OVER && but->block->auto_open==TRUE)
- if(but->block->auto_open_last+BUTTON_AUTO_OPEN_THRESH < PIL_check_seconds_timer())
+ if (type == BUTTON_ACTIVATE_OVER && but->block->auto_open==TRUE)
+ if (but->block->auto_open_last+BUTTON_AUTO_OPEN_THRESH < PIL_check_seconds_timer())
but->block->auto_open= FALSE;
- if(type == BUTTON_ACTIVATE_OVER) {
+ if (type == BUTTON_ACTIVATE_OVER) {
data->used_mouse= 1;
}
button_activate_state(C, but, BUTTON_STATE_HIGHLIGHT);
/* activate right away */
- if(but->flag & UI_BUT_IMMEDIATE) {
- if(but->type==HOTKEYEVT)
+ if (but->flag & UI_BUT_IMMEDIATE) {
+ if (but->type==HOTKEYEVT)
button_activate_state(C, but, BUTTON_STATE_WAIT_KEY_EVENT);
/* .. more to be added here */
}
- if(type == BUTTON_ACTIVATE_OPEN) {
+ if (type == BUTTON_ACTIVATE_OPEN) {
button_activate_state(C, but, BUTTON_STATE_MENU_OPEN);
/* activate first button in submenu */
- if(data->menu && data->menu->region) {
+ if (data->menu && data->menu->region) {
ARegion *subar= data->menu->region;
uiBlock *subblock= subar->uiblocks.first;
uiBut *subbut;
- if(subblock) {
+ if (subblock) {
subbut= ui_but_first(subblock);
- if(subbut)
+ if (subbut)
ui_handle_button_activate(C, subar, subbut, BUTTON_ACTIVATE);
}
}
}
- else if(type == BUTTON_ACTIVATE_TEXT_EDITING)
+ else if (type == BUTTON_ACTIVATE_TEXT_EDITING)
button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
- else if(type == BUTTON_ACTIVATE_APPLY)
+ else if (type == BUTTON_ACTIVATE_APPLY)
button_activate_state(C, but, BUTTON_STATE_WAIT_FLASH);
}
@@ -5204,18 +5214,18 @@ static void button_activate_exit(bContext *C, uiHandleButtonData *data, uiBut *b
uiBut *bt;
/* ensure we are in the exit state */
- if(data->state != BUTTON_STATE_EXIT)
+ if (data->state != BUTTON_STATE_EXIT)
button_activate_state(C, but, BUTTON_STATE_EXIT);
/* apply the button action or value */
- if(!onfree)
+ if (!onfree)
ui_apply_button(C, block, but, data, 0);
/* if this button is in a menu, this will set the button return
* value to the button value and the menu return value to ok, the
* menu return value will be picked up and the menu will close */
- if(block->handle && !(block->flag & UI_BLOCK_KEEP_OPEN)) {
- if(!data->cancel || data->escapecancel) {
+ if (block->handle && !(block->flag & UI_BLOCK_KEEP_OPEN)) {
+ if (!data->cancel || data->escapecancel) {
uiPopupBlockHandle *menu;
menu= block->handle;
@@ -5224,18 +5234,18 @@ static void button_activate_exit(bContext *C, uiHandleButtonData *data, uiBut *b
}
}
- if(!onfree && !data->cancel) {
+ if (!onfree && !data->cancel) {
/* autokey & undo push */
ui_apply_autokey_undo(C, but);
/* popup menu memory */
- if(block->flag & UI_BLOCK_POPUP_MEMORY)
+ if (block->flag & UI_BLOCK_POPUP_MEMORY)
ui_popup_menu_memory(block, but);
}
/* disable tooltips until mousemove + last active flag */
- for(block=data->region->uiblocks.first; block; block=block->next) {
- for(bt=block->buttons.first; bt; bt=bt->next)
+ for (block=data->region->uiblocks.first; block; block=block->next) {
+ for (bt=block->buttons.first; bt; bt=bt->next)
bt->flag &= ~UI_BUT_LAST_ACTIVE;
block->tooltipdisabled= 1;
@@ -5244,9 +5254,9 @@ static void button_activate_exit(bContext *C, uiHandleButtonData *data, uiBut *b
ui_blocks_set_tooltips(data->region, 0);
/* clean up */
- if(data->str)
+ if (data->str)
MEM_freeN(data->str);
- if(data->origstr)
+ if (data->origstr)
MEM_freeN(data->origstr);
/* redraw (data is but->active!) */
@@ -5257,13 +5267,13 @@ static void button_activate_exit(bContext *C, uiHandleButtonData *data, uiBut *b
but->active= NULL;
but->flag &= ~(UI_ACTIVE|UI_SELECT);
but->flag |= UI_BUT_LAST_ACTIVE;
- if(!onfree)
+ if (!onfree)
ui_check_but(but);
/* adds empty mousemove in queue for re-init handler, in case mouse is
* still over a button. we cannot just check for this ourselfs because
* at this point the mouse may be over a button in another region */
- if(mousemove)
+ if (mousemove)
WM_event_add_mousemove(C);
}
@@ -5274,7 +5284,7 @@ void ui_button_active_free(const bContext *C, uiBut *but)
/* this gets called when the button somehow disappears while it is still
* active, this is bad for user interaction, but we need to handle this
* case cleanly anyway in case it happens */
- if(but->active) {
+ if (but->active) {
data= but->active;
data->cancel= 1;
button_activate_exit((bContext*)C, data, but, 0, 1);
@@ -5288,27 +5298,27 @@ static uiBut *ui_context_button_active(const bContext *C, int (*but_check_cb)(ui
ARegion *ar= CTX_wm_region(C);
- while(ar) {
+ while (ar) {
uiBlock *block;
uiBut *but, *activebut= NULL;
/* find active button */
- for(block=ar->uiblocks.first; block; block=block->next) {
- for(but=block->buttons.first; but; but= but->next) {
- if(but->active)
+ for (block=ar->uiblocks.first; block; block=block->next) {
+ for (but=block->buttons.first; but; but= but->next) {
+ if (but->active)
activebut= but;
- else if(!activebut && (but->flag & UI_BUT_LAST_ACTIVE))
+ else if (!activebut && (but->flag & UI_BUT_LAST_ACTIVE))
activebut= but;
}
}
- if(activebut && (but_check_cb == NULL || but_check_cb(activebut))) {
+ if (activebut && (but_check_cb == NULL || but_check_cb(activebut))) {
uiHandleButtonData *data= activebut->active;
but_found= activebut;
/* recurse into opened menu, like colorpicker case */
- if(data && data->menu && (ar != data->menu->region)) {
+ if (data && data->menu && (ar != data->menu->region)) {
ar = data->menu->region;
}
else {
@@ -5345,7 +5355,7 @@ void uiContextActiveProperty(const bContext *C, struct PointerRNA *ptr, struct P
memset(ptr, 0, sizeof(*ptr));
- if(activebut && activebut->rnapoin.data) {
+ if (activebut && activebut->rnapoin.data) {
*ptr= activebut->rnapoin;
*prop= activebut->rnaprop;
*index= activebut->rnaindex;
@@ -5359,7 +5369,7 @@ void uiContextActiveProperty(const bContext *C, struct PointerRNA *ptr, struct P
void uiContextActivePropertyHandle(bContext *C)
{
uiBut *activebut= ui_context_rna_button_active(C);
- if(activebut) {
+ if (activebut) {
/* TODO, look into a better way to handle the button change
* currently this is mainly so reset defaults works for the
* operator redo panel - campbell */
@@ -5381,7 +5391,7 @@ wmOperator *uiContextActiveOperator(const struct bContext *C)
}
/* scan active regions ui */
- for(block=ar_ctx->uiblocks.first; block; block=block->next) {
+ for (block=ar_ctx->uiblocks.first; block; block=block->next) {
if (block->ui_operator) {
return block->ui_operator;
}
@@ -5396,7 +5406,7 @@ wmOperator *uiContextActiveOperator(const struct bContext *C)
if (ar == ar_ctx) {
continue;
}
- for(block=ar->uiblocks.first; block; block=block->next) {
+ for (block=ar->uiblocks.first; block; block=block->next) {
if (block->ui_operator) {
return block->ui_operator;
}
@@ -5415,26 +5425,26 @@ void uiContextAnimUpdate(const bContext *C)
uiBlock *block;
uiBut *but, *activebut;
- while(ar) {
+ while (ar) {
/* find active button */
activebut= NULL;
- for(block=ar->uiblocks.first; block; block=block->next) {
- for(but=block->buttons.first; but; but= but->next) {
+ for (block=ar->uiblocks.first; block; block=block->next) {
+ for (but=block->buttons.first; but; but= but->next) {
ui_but_anim_flag(but, (scene)? scene->r.cfra: 0.0f);
ED_region_tag_redraw(ar);
- if(but->active)
+ if (but->active)
activebut= but;
- else if(!activebut && (but->flag & UI_BUT_LAST_ACTIVE))
+ else if (!activebut && (but->flag & UI_BUT_LAST_ACTIVE))
activebut= but;
}
}
- if(activebut) {
+ if (activebut) {
/* always recurse into opened menu, so all buttons update (like colorpicker) */
uiHandleButtonData *data= activebut->active;
- if(data && data->menu)
+ if (data && data->menu)
ar = data->menu->region;
else
return;
@@ -5453,9 +5463,9 @@ static uiBut *uit_but_find_open_event(ARegion *ar, wmEvent *event)
uiBlock *block;
uiBut *but;
- for(block=ar->uiblocks.first; block; block=block->next) {
- for(but=block->buttons.first; but; but= but->next)
- if(but==event->customdata)
+ for (block=ar->uiblocks.first; block; block=block->next) {
+ for (but=block->buttons.first; but; but= but->next)
+ if (but==event->customdata)
return but;
}
return NULL;
@@ -5465,14 +5475,14 @@ static int ui_handle_button_over(bContext *C, wmEvent *event, ARegion *ar)
{
uiBut *but;
- if(event->type == MOUSEMOVE) {
+ if (event->type == MOUSEMOVE) {
but= ui_but_find_mouse_over(ar, event->x, event->y);
- if(but)
+ if (but)
button_activate_init(C, ar, but, BUTTON_ACTIVATE_OVER);
}
- else if(event->type == EVT_BUT_OPEN) {
+ else if (event->type == EVT_BUT_OPEN) {
but= uit_but_find_open_event(ar, event);
- if(but) {
+ if (but) {
button_activate_init(C, ar, but, BUTTON_ACTIVATE_OVER);
ui_do_button(C, but->block, but, event);
}
@@ -5504,7 +5514,7 @@ static void ui_handle_button_activate(bContext *C, ARegion *ar, uiBut *but, uiBu
uiHandleButtonData *data;
oldbut= ui_but_find_activated(ar);
- if(oldbut) {
+ if (oldbut) {
data= oldbut->active;
data->cancel= 1;
button_activate_exit(C, data, oldbut, 0, 0);
@@ -5530,7 +5540,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
retval= WM_UI_HANDLER_CONTINUE;
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
+ if (data->state == BUTTON_STATE_HIGHLIGHT) {
switch(event->type) {
case WINDEACTIVATE:
case EVT_BUT_CANCEL:
@@ -5540,15 +5550,15 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
break;
case MOUSEMOVE:
/* verify if we are still over the button, if not exit */
- if(!ui_mouse_inside_button(ar, but, event->x, event->y)) {
+ if (!ui_mouse_inside_button(ar, but, event->x, event->y)) {
data->cancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
- else if(ui_but_find_mouse_over(ar, event->x, event->y) != but) {
+ else if (ui_but_find_mouse_over(ar, event->x, event->y) != but) {
data->cancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
- else if(event->x!=event->prevx || event->y!=event->prevy) {
+ else if (event->x!=event->prevx || event->y!=event->prevy) {
/* re-enable tooltip on mouse move */
ui_blocks_set_tooltips(ar, 1);
button_tooltip_timer_reset(C, but);
@@ -5557,19 +5567,19 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
break;
case TIMER: {
/* handle tooltip timer */
- if(event->customdata == data->tooltiptimer) {
+ if (event->customdata == data->tooltiptimer) {
WM_event_remove_timer(data->wm, data->window, data->tooltiptimer);
data->tooltiptimer= NULL;
- if(!data->tooltip)
+ if (!data->tooltip)
data->tooltip= ui_tooltip_create(C, data->region, but);
}
/* handle menu auto open timer */
- else if(event->customdata == data->autoopentimer) {
+ else if (event->customdata == data->autoopentimer) {
WM_event_remove_timer(data->wm, data->window, data->autoopentimer);
data->autoopentimer= NULL;
- if(ui_mouse_inside_button(ar, but, event->x, event->y))
+ if (ui_mouse_inside_button(ar, but, event->x, event->y))
button_activate_state(C, but, BUTTON_STATE_MENU_OPEN);
}
@@ -5579,7 +5589,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
case WHEELDOWNMOUSE:
case MIDDLEMOUSE:
/* XXX hardcoded keymap check... but anyway, while view changes, tooltips should be removed */
- if(data->tooltiptimer) {
+ if (data->tooltiptimer) {
WM_event_remove_timer(data->wm, data->window, data->tooltiptimer);
data->tooltiptimer= NULL;
}
@@ -5590,7 +5600,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
}
}
}
- else if(data->state == BUTTON_STATE_WAIT_RELEASE) {
+ else if (data->state == BUTTON_STATE_WAIT_RELEASE) {
switch(event->type) {
case WINDEACTIVATE:
data->cancel= 1;
@@ -5598,7 +5608,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
break;
case MOUSEMOVE:
- if(ELEM(but->type,LINK, INLINK)) {
+ if (ELEM(but->type,LINK, INLINK)) {
but->flag |= UI_SELECT;
ui_do_button(C, block, but, event);
ED_region_tag_redraw(data->region);
@@ -5606,15 +5616,15 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
else {
/* deselect the button when moving the mouse away */
/* also de-activate for buttons that only show higlights */
- if(ui_mouse_inside_button(ar, but, event->x, event->y)) {
- if(!(but->flag & UI_SELECT)) {
+ if (ui_mouse_inside_button(ar, but, event->x, event->y)) {
+ if (!(but->flag & UI_SELECT)) {
but->flag |= (UI_SELECT|UI_ACTIVE);
data->cancel= 0;
ED_region_tag_redraw(data->region);
}
}
else {
- if(but->flag & UI_SELECT) {
+ if (but->flag & UI_SELECT) {
but->flag &= ~(UI_SELECT|UI_ACTIVE);
data->cancel= 1;
ED_region_tag_redraw(data->region);
@@ -5630,30 +5640,30 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
retval= WM_UI_HANDLER_BREAK;
}
- else if(data->state == BUTTON_STATE_WAIT_FLASH) {
+ else if (data->state == BUTTON_STATE_WAIT_FLASH) {
switch(event->type) {
case TIMER: {
- if(event->customdata == data->flashtimer)
+ if (event->customdata == data->flashtimer)
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
}
retval= WM_UI_HANDLER_CONTINUE;
}
- else if(data->state == BUTTON_STATE_MENU_OPEN) {
+ else if (data->state == BUTTON_STATE_MENU_OPEN) {
/* check for exit because of mouse-over another button */
switch(event->type) {
case MOUSEMOVE:
- if(data->menu && data->menu->region)
- if(ui_mouse_inside_region(data->menu->region, event->x, event->y))
+ if (data->menu && data->menu->region)
+ if (ui_mouse_inside_region(data->menu->region, event->x, event->y))
break;
{
uiBut *bt= ui_but_find_mouse_over(ar, event->x, event->y);
- if(bt && bt->active != data) {
- if(but->type != COL) /* exception */
+ if (bt && bt->active != data) {
+ if (but->type != COL) /* exception */
data->cancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
@@ -5669,14 +5679,14 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
// retval= WM_UI_HANDLER_BREAK; XXX why ?
}
- if(data->state == BUTTON_STATE_EXIT) {
+ if (data->state == BUTTON_STATE_EXIT) {
postbut= data->postbut;
posttype= data->posttype;
button_activate_exit(C, data, but, (postbut == NULL), 0);
/* for jumping to the next button with tab while text editing */
- if(postbut)
+ if (postbut)
button_activate_init(C, ar, postbut, posttype);
}
@@ -5689,22 +5699,22 @@ static int ui_handle_list_event(bContext *C, wmEvent *event, ARegion *ar)
int retval= WM_UI_HANDLER_CONTINUE;
int value, min, max;
- if(but && (event->val == KM_PRESS)) {
+ if (but && (event->val == KM_PRESS)) {
Panel *pa= but->block->panel;
- if(ELEM(event->type, UPARROWKEY, DOWNARROWKEY) ||
+ if (ELEM(event->type, UPARROWKEY, DOWNARROWKEY) ||
((ELEM(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE) && event->alt))) {
/* activate up/down the list */
value= RNA_property_int_get(&but->rnapoin, but->rnaprop);
- if(ELEM(event->type, UPARROWKEY, WHEELUPMOUSE))
+ if (ELEM(event->type, UPARROWKEY, WHEELUPMOUSE))
value--;
else
value++;
- if(value < pa->list_scroll)
+ if (value < pa->list_scroll)
pa->list_scroll= value;
- else if(value >= pa->list_scroll+pa->list_size)
+ else if (value >= pa->list_scroll+pa->list_size)
pa->list_scroll= value - pa->list_size + 1;
RNA_property_int_range(&but->rnapoin, but->rnaprop, &min, &max);
@@ -5716,12 +5726,12 @@ static int ui_handle_list_event(bContext *C, wmEvent *event, ARegion *ar)
retval= WM_UI_HANDLER_BREAK;
}
- else if(ELEM(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE) && event->shift) {
+ else if (ELEM(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE) && event->shift) {
/* silly replacement for proper grip */
- if(pa->list_grip_size == 0)
+ if (pa->list_grip_size == 0)
pa->list_grip_size= pa->list_size;
- if(event->type == WHEELUPMOUSE)
+ if (event->type == WHEELUPMOUSE)
pa->list_grip_size--;
else
pa->list_grip_size++;
@@ -5732,10 +5742,10 @@ static int ui_handle_list_event(bContext *C, wmEvent *event, ARegion *ar)
retval= WM_UI_HANDLER_BREAK;
}
- else if(ELEM(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE)) {
- if(pa->list_last_len > pa->list_size) {
+ else if (ELEM(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE)) {
+ if (pa->list_last_len > pa->list_size) {
/* list template will clamp */
- if(event->type == WHEELUPMOUSE)
+ if (event->type == WHEELUPMOUSE)
pa->list_scroll--;
else
pa->list_scroll++;
@@ -5759,29 +5769,29 @@ static void ui_handle_button_return_submenu(bContext *C, wmEvent *event, uiBut *
menu= data->menu;
/* copy over return values from the closing menu */
- if((menu->menuretval & UI_RETURN_OK) || (menu->menuretval & UI_RETURN_UPDATE)) {
- if(but->type == COL)
+ if ((menu->menuretval & UI_RETURN_OK) || (menu->menuretval & UI_RETURN_UPDATE)) {
+ if (but->type == COL)
copy_v3_v3(data->vec, menu->retvec);
- else if(ELEM3(but->type, MENU, ICONROW, ICONTEXTROW))
+ else if (ELEM3(but->type, MENU, ICONROW, ICONTEXTROW))
data->value= menu->retvalue;
}
- if(menu->menuretval & UI_RETURN_UPDATE) {
- if(data->interactive) ui_apply_button(C, but->block, but, data, 1);
+ if (menu->menuretval & UI_RETURN_UPDATE) {
+ if (data->interactive) ui_apply_button(C, but->block, but, data, 1);
else ui_check_but(but);
menu->menuretval= 0;
}
/* now change button state or exit, which will close the submenu */
- if((menu->menuretval & UI_RETURN_OK) || (menu->menuretval & UI_RETURN_CANCEL)) {
- if(menu->menuretval != UI_RETURN_OK)
+ if ((menu->menuretval & UI_RETURN_OK) || (menu->menuretval & UI_RETURN_CANCEL)) {
+ if (menu->menuretval != UI_RETURN_OK)
data->cancel= 1;
button_activate_exit(C, data, but, 1, 0);
}
- else if(menu->menuretval & UI_RETURN_OUT) {
- if(event->type==MOUSEMOVE && ui_mouse_inside_button(data->region, but, event->x, event->y)) {
+ else if (menu->menuretval & UI_RETURN_OUT) {
+ if (event->type==MOUSEMOVE && ui_mouse_inside_button(data->region, but, event->x, event->y)) {
button_activate_state(C, but, BUTTON_STATE_HIGHLIGHT);
}
else {
@@ -5811,12 +5821,12 @@ static void ui_handle_button_return_submenu(bContext *C, wmEvent *event, uiBut *
static void ui_mouse_motion_towards_init(uiPopupBlockHandle *menu, int mx, int my, int force)
{
- if(!menu->dotowards || force) {
+ if (!menu->dotowards || force) {
menu->dotowards= 1;
menu->towardsx= mx;
menu->towardsy= my;
- if(force)
+ if (force)
menu->towardstime= DBL_MAX; /* unlimited time */
else
menu->towardstime= PIL_check_seconds_timer();
@@ -5828,7 +5838,7 @@ static int ui_mouse_motion_towards_check(uiBlock *block, uiPopupBlockHandle *men
float p1[2], p2[2], p3[2], p4[2], oldp[2], newp[2];
int closer;
- if(!menu->dotowards) return 0;
+ if (!menu->dotowards) return 0;
/* verify that we are moving towards one of the edges of the
* menu block, in other words, in the triangle formed by the
@@ -5851,7 +5861,7 @@ static int ui_mouse_motion_towards_check(uiBlock *block, uiPopupBlockHandle *men
newp[0]= mx;
newp[1]= my;
- if(len_v2v2(oldp, newp) < 4.0f)
+ if (len_v2v2(oldp, newp) < 4.0f)
return menu->dotowards;
closer= 0;
@@ -5860,11 +5870,11 @@ static int ui_mouse_motion_towards_check(uiBlock *block, uiPopupBlockHandle *men
closer |= isect_point_tri_v2(newp, oldp, p3, p4);
closer |= isect_point_tri_v2(newp, oldp, p4, p1);
- if(!closer)
+ if (!closer)
menu->dotowards= 0;
/* 1 second timer */
- if(PIL_check_seconds_timer() - menu->towardstime > BUTTON_MOUSE_TOWARDS_THRESH)
+ if (PIL_check_seconds_timer() - menu->towardstime > BUTTON_MOUSE_TOWARDS_THRESH)
menu->dotowards= 0;
return menu->dotowards;
@@ -5872,12 +5882,12 @@ static int ui_mouse_motion_towards_check(uiBlock *block, uiPopupBlockHandle *men
static char ui_menu_scroll_test(uiBlock *block, int my)
{
- if(block->flag & (UI_BLOCK_CLIPTOP|UI_BLOCK_CLIPBOTTOM)) {
- if(block->flag & UI_BLOCK_CLIPTOP)
- if(my > block->maxy-14)
+ if (block->flag & (UI_BLOCK_CLIPTOP|UI_BLOCK_CLIPBOTTOM)) {
+ if (block->flag & UI_BLOCK_CLIPTOP)
+ if (my > block->maxy-14)
return 't';
- if(block->flag & UI_BLOCK_CLIPBOTTOM)
- if(my < block->miny+14)
+ if (block->flag & UI_BLOCK_CLIPBOTTOM)
+ if (my < block->miny+14)
return 'b';
}
return 0;
@@ -5887,7 +5897,7 @@ static int ui_menu_scroll(ARegion *ar, uiBlock *block, int my)
{
char test= ui_menu_scroll_test(block, my);
- if(test) {
+ if (test) {
uiBut *b1= block->buttons.first;
uiBut *b2= block->buttons.last;
uiBut *bnext;
@@ -5895,36 +5905,36 @@ static int ui_menu_scroll(ARegion *ar, uiBlock *block, int my)
int dy= 0;
/* get first and last visible buttons */
- while(b1 && ui_but_next(b1) && (b1->flag & UI_SCROLLED))
+ while (b1 && ui_but_next(b1) && (b1->flag & UI_SCROLLED))
b1= ui_but_next(b1);
- while(b2 && ui_but_prev(b2) && (b2->flag & UI_SCROLLED))
+ while (b2 && ui_but_prev(b2) && (b2->flag & UI_SCROLLED))
b2= ui_but_prev(b2);
/* skips separators */
bnext= ui_but_next(b1);
bprev= ui_but_prev(b2);
- if(bnext==NULL || bprev==NULL)
+ if (bnext==NULL || bprev==NULL)
return 0;
- if(test=='t') {
+ if (test=='t') {
/* bottom button is first button */
- if(b1->y1 < b2->y1)
+ if (b1->y1 < b2->y1)
dy= bnext->y1 - b1->y1;
/* bottom button is last button */
else
dy= bprev->y1 - b2->y1;
}
- else if(test=='b') {
+ else if (test=='b') {
/* bottom button is first button */
- if(b1->y1 < b2->y1)
+ if (b1->y1 < b2->y1)
dy= b1->y1 - bnext->y1;
/* bottom button is last button */
else
dy= b2->y1 - bprev->y1;
}
- if(dy) {
+ if (dy) {
- for(b1= block->buttons.first; b1; b1= b1->next) {
+ for (b1= block->buttons.first; b1; b1= b1->next) {
b1->y1 -= dy;
b1->y2 -= dy;
}
@@ -5959,43 +5969,43 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
/* check if mouse is inside block */
inside= 0;
- if(block->minx <= mx && block->maxx >= mx)
- if(block->miny <= my && block->maxy >= my)
+ if (block->minx <= mx && block->maxx >= mx)
+ if (block->miny <= my && block->maxy >= my)
inside= 1;
/* if there's an active modal button, don't check events or outside, except for search menu */
but= ui_but_find_activated(ar);
- if(but && button_modal_state(but->active->state) && but->type!=SEARCH_MENU) {
+ if (but && button_modal_state(but->active->state) && but->type!=SEARCH_MENU) {
/* if a button is activated modal, always reset the start mouse
* position of the towards mechanism to avoid loosing focus,
* and don't handle events */
ui_mouse_motion_towards_init(menu, mx, my, 1);
}
- else if(event->type == TIMER) {
- if(event->customdata == menu->scrolltimer)
+ else if (event->type == TIMER) {
+ if (event->customdata == menu->scrolltimer)
ui_menu_scroll(ar, block, my);
}
else {
/* for ui_mouse_motion_towards_block */
- if(event->type == MOUSEMOVE) {
+ if (event->type == MOUSEMOVE) {
ui_mouse_motion_towards_init(menu, mx, my, 0);
/* add menu scroll timer, if needed */
- if(ui_menu_scroll_test(block, my))
- if(menu->scrolltimer==NULL)
+ if (ui_menu_scroll_test(block, my))
+ if (menu->scrolltimer==NULL)
menu->scrolltimer=
WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, MENU_SCROLL_INTERVAL);
}
/* first block own event func */
- if(block->block_event_func && block->block_event_func(C, block, event));
+ if (block->block_event_func && block->block_event_func(C, block, event));
/* events not for active search menu button */
- else if(but==NULL || but->type!=SEARCH_MENU) {
+ else if (but==NULL || but->type!=SEARCH_MENU) {
switch(event->type) {
/* closing sublevels of pulldowns */
case LEFTARROWKEY:
- if(event->val==KM_PRESS && (block->flag & UI_BLOCK_LOOP))
- if(block->saferct.first)
+ if (event->val==KM_PRESS && (block->flag & UI_BLOCK_LOOP))
+ if (block->saferct.first)
menu->menuretval= UI_RETURN_OUT;
retval= WM_UI_HANDLER_BREAK;
@@ -6003,16 +6013,16 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
/* opening sublevels of pulldowns */
case RIGHTARROWKEY:
- if(event->val==KM_PRESS && (block->flag & UI_BLOCK_LOOP)) {
+ if (event->val==KM_PRESS && (block->flag & UI_BLOCK_LOOP)) {
but= ui_but_find_activated(ar);
- if(!but) {
+ if (!but) {
/* no item active, we make first active */
- if(block->direction & UI_TOP) but= ui_but_last(block);
+ if (block->direction & UI_TOP) but= ui_but_last(block);
else but= ui_but_first(block);
}
- if(but && ELEM(but->type, BLOCK, PULLDOWN))
+ if (but && ELEM(but->type, BLOCK, PULLDOWN))
ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE_OPEN);
}
@@ -6024,40 +6034,40 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
case WHEELUPMOUSE:
case WHEELDOWNMOUSE:
/* arrowkeys: only handle for block_loop blocks */
- if(event->alt || event->shift || event->ctrl || event->oskey);
- else if(inside || (block->flag & UI_BLOCK_LOOP)) {
- if(event->val==KM_PRESS) {
+ if (event->alt || event->shift || event->ctrl || event->oskey);
+ else if (inside || (block->flag & UI_BLOCK_LOOP)) {
+ if (event->val==KM_PRESS) {
but= ui_but_find_activated(ar);
- if(but) {
+ if (but) {
/* is there a situation where UI_LEFT or UI_RIGHT would also change navigation direction? */
- if( ((ELEM(event->type, DOWNARROWKEY, WHEELDOWNMOUSE)) && (block->direction & UI_DOWN)) ||
+ if ( ((ELEM(event->type, DOWNARROWKEY, WHEELDOWNMOUSE)) && (block->direction & UI_DOWN)) ||
((ELEM(event->type, DOWNARROWKEY, WHEELDOWNMOUSE)) && (block->direction & UI_RIGHT)) ||
((ELEM(event->type, UPARROWKEY, WHEELUPMOUSE)) && (block->direction & UI_TOP))
) {
/* the following is just a hack - uiBut->type set to BUT and BUTM have there menus built
* opposite ways - this should be changed so that all popup-menus use the same uiBlock->direction */
- if(but->type & BUT)
+ if (but->type & BUT)
but= ui_but_next(but);
else
but= ui_but_prev(but);
}
else {
- if(but->type & BUT)
+ if (but->type & BUT)
but= ui_but_prev(but);
else
but= ui_but_next(but);
}
- if(but)
+ if (but)
ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE);
}
- if(!but) {
- if( ((ELEM(event->type, UPARROWKEY, WHEELUPMOUSE)) && (block->direction & UI_DOWN)) ||
+ if (!but) {
+ if ( ((ELEM(event->type, UPARROWKEY, WHEELUPMOUSE)) && (block->direction & UI_DOWN)) ||
((ELEM(event->type, UPARROWKEY, WHEELUPMOUSE)) && (block->direction & UI_RIGHT)) ||
((ELEM(event->type, DOWNARROWKEY, WHEELDOWNMOUSE)) && (block->direction & UI_TOP))
) {
- if((bt= ui_but_first(block)) && (bt->type & BUT)) {
+ if ((bt= ui_but_first(block)) && (bt->type & BUT)) {
bt= ui_but_last(block);
}
else {
@@ -6065,7 +6075,7 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
}
}
else {
- if((bt= ui_but_first(block)) && (bt->type & BUT)) {
+ if ((bt= ui_but_first(block)) && (bt->type & BUT)) {
/* keep ui_but_first() */
}
else {
@@ -6073,7 +6083,7 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
}
}
- if(bt)
+ if (bt)
ui_handle_button_activate(C, ar, bt, BUTTON_ACTIVATE);
}
}
@@ -6086,50 +6096,50 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
case ONEKEY: case PAD1:
act= 1;
case TWOKEY: case PAD2:
- if(act==0) act= 2;
+ if (act==0) act= 2;
case THREEKEY: case PAD3:
- if(act==0) act= 3;
+ if (act==0) act= 3;
case FOURKEY: case PAD4:
- if(act==0) act= 4;
+ if (act==0) act= 4;
case FIVEKEY: case PAD5:
- if(act==0) act= 5;
+ if (act==0) act= 5;
case SIXKEY: case PAD6:
- if(act==0) act= 6;
+ if (act==0) act= 6;
case SEVENKEY: case PAD7:
- if(act==0) act= 7;
+ if (act==0) act= 7;
case EIGHTKEY: case PAD8:
- if(act==0) act= 8;
+ if (act==0) act= 8;
case NINEKEY: case PAD9:
- if(act==0) act= 9;
+ if (act==0) act= 9;
case ZEROKEY: case PAD0:
- if(act==0) act= 10;
+ if (act==0) act= 10;
- if((block->flag & UI_BLOCK_NUMSELECT) && event->val==KM_PRESS) {
- if(event->alt) act+= 10;
+ if ((block->flag & UI_BLOCK_NUMSELECT) && event->val==KM_PRESS) {
+ if (event->alt) act+= 10;
count= 0;
- for(but= block->buttons.first; but; but= but->next) {
+ for (but= block->buttons.first; but; but= but->next) {
int doit= 0;
- if(but->type!=LABEL && but->type!=SEPR)
+ if (but->type!=LABEL && but->type!=SEPR)
count++;
/* exception for rna layer buts */
- if(but->rnapoin.data && but->rnaprop) {
+ if (but->rnapoin.data && but->rnaprop) {
if (ELEM(RNA_property_subtype(but->rnaprop), PROP_LAYER, PROP_LAYER_MEMBER)) {
if (but->rnaindex== act-1)
doit=1;
}
}
/* exception for menus like layer buts, with button aligning they're not drawn in order */
- else if(but->type==TOGR) {
- if(but->bitnr==act-1)
+ else if (but->type==TOGR) {
+ if (but->bitnr==act-1)
doit= 1;
}
- else if(count==act)
+ else if (count==act)
doit=1;
- if(doit) {
+ if (doit) {
ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE_APPLY);
break;
}
@@ -6167,19 +6177,19 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
case YKEY:
case ZKEY:
{
- if( (event->val == KM_PRESS) &&
+ if ( (event->val == KM_PRESS) &&
(event->shift == FALSE) &&
(event->ctrl == FALSE) &&
(event->oskey == FALSE)
) {
- for(but= block->buttons.first; but; but= but->next) {
+ for (but= block->buttons.first; but; but= but->next) {
- if(but->menu_key==event->type) {
- if(but->type == BUT) {
+ if (but->menu_key==event->type) {
+ if (but->type == BUT) {
/* mainly for operator buttons */
ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE_APPLY);
}
- else if(ELEM(but->type, BLOCK, PULLDOWN)) {
+ else if (ELEM(but->type, BLOCK, PULLDOWN)) {
/* open submenus (like right arrow key) */
ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE_OPEN);
}
@@ -6203,15 +6213,15 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
}
/* here we check return conditions for menus */
- if(block->flag & UI_BLOCK_LOOP) {
+ if (block->flag & UI_BLOCK_LOOP) {
/* if we click outside the block, verify if we clicked on the
* button that opened us, otherwise we need to close */
- if(inside==0) {
+ if (inside==0) {
uiSafetyRct *saferct= block->saferct.first;
- if(ELEM3(event->type, LEFTMOUSE, MIDDLEMOUSE, RIGHTMOUSE) && event->val==KM_PRESS) {
- if(saferct && !BLI_in_rctf(&saferct->parent, event->x, event->y)) {
- if(block->flag & (UI_BLOCK_OUT_1))
+ if (ELEM3(event->type, LEFTMOUSE, MIDDLEMOUSE, RIGHTMOUSE) && event->val==KM_PRESS) {
+ if (saferct && !BLI_in_rctf(&saferct->parent, event->x, event->y)) {
+ if (block->flag & (UI_BLOCK_OUT_1))
menu->menuretval= UI_RETURN_OK;
else
menu->menuretval= UI_RETURN_OUT;
@@ -6219,45 +6229,45 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
}
}
- if(menu->menuretval);
- else if(event->type==ESCKEY && event->val==KM_PRESS) {
+ if (menu->menuretval);
+ else if (event->type==ESCKEY && event->val==KM_PRESS) {
/* esc cancels this and all preceding menus */
menu->menuretval= UI_RETURN_CANCEL;
}
- else if(ELEM(event->type, RETKEY, PADENTER) && event->val==KM_PRESS) {
+ else if (ELEM(event->type, RETKEY, PADENTER) && event->val==KM_PRESS) {
/* enter will always close this block, we let the event
* get handled by the button if it is activated, otherwise we cancel */
- if(!ui_but_find_activated(ar))
+ if (!ui_but_find_activated(ar))
menu->menuretval= UI_RETURN_CANCEL | UI_RETURN_POPUP_OK;
}
else {
ui_mouse_motion_towards_check(block, menu, mx, my);
/* check mouse moving outside of the menu */
- if(inside==0 && (block->flag & UI_BLOCK_MOVEMOUSE_QUIT)) {
+ if (inside==0 && (block->flag & UI_BLOCK_MOVEMOUSE_QUIT)) {
uiSafetyRct *saferct;
/* check for all parent rects, enables arrowkeys to be used */
- for(saferct=block->saferct.first; saferct; saferct= saferct->next) {
+ for (saferct=block->saferct.first; saferct; saferct= saferct->next) {
/* for mouse move we only check our own rect, for other
* events we check all preceding block rects too to make
* arrow keys navigation work */
- if(event->type!=MOUSEMOVE || saferct==block->saferct.first) {
- if(BLI_in_rctf(&saferct->parent, (float)event->x, (float)event->y))
+ if (event->type!=MOUSEMOVE || saferct==block->saferct.first) {
+ if (BLI_in_rctf(&saferct->parent, (float)event->x, (float)event->y))
break;
- if(BLI_in_rctf(&saferct->safety, (float)event->x, (float)event->y))
+ if (BLI_in_rctf(&saferct->safety, (float)event->x, (float)event->y))
break;
}
}
/* strict check, and include the parent rect */
- if(!menu->dotowards && !saferct) {
- if(block->flag & (UI_BLOCK_OUT_1))
+ if (!menu->dotowards && !saferct) {
+ if (block->flag & (UI_BLOCK_OUT_1))
menu->menuretval= UI_RETURN_OK;
else
menu->menuretval= UI_RETURN_OUT;
}
- else if(menu->dotowards && event->type==MOUSEMOVE)
+ else if (menu->dotowards && event->type==MOUSEMOVE)
retval= WM_UI_HANDLER_BREAK;
}
}
@@ -6268,20 +6278,20 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
* buttons inside this region. disabled inside check .. not sure
* anymore why it was there? but it meant enter didn't work
* for example when mouse was not over submenu */
- if((/*inside &&*/ (!menu->menuretval || (menu->menuretval & UI_RETURN_UPDATE)) && retval == WM_UI_HANDLER_CONTINUE) || event->type == TIMER) {
+ if ((/*inside &&*/ (!menu->menuretval || (menu->menuretval & UI_RETURN_UPDATE)) && retval == WM_UI_HANDLER_CONTINUE) || event->type == TIMER) {
but= ui_but_find_activated(ar);
- if(but) {
+ if (but) {
ScrArea *ctx_area= CTX_wm_area(C);
ARegion *ctx_region= CTX_wm_region(C);
- if(menu->ctx_area) CTX_wm_area_set(C, menu->ctx_area);
- if(menu->ctx_region) CTX_wm_region_set(C, menu->ctx_region);
+ if (menu->ctx_area) CTX_wm_area_set(C, menu->ctx_area);
+ if (menu->ctx_region) CTX_wm_region_set(C, menu->ctx_region);
retval= ui_handle_button_event(C, event, but);
- if(menu->ctx_area) CTX_wm_area_set(C, ctx_area);
- if(menu->ctx_region) CTX_wm_region_set(C, ctx_region);
+ if (menu->ctx_area) CTX_wm_area_set(C, ctx_area);
+ if (menu->ctx_region) CTX_wm_region_set(C, ctx_region);
}
else
retval= ui_handle_button_over(C, event, ar);
@@ -6290,9 +6300,9 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
/* if we set a menu return value, ensure we continue passing this on to
* lower menus and buttons, so always set continue then, and if we are
* inside the region otherwise, ensure we swallow the event */
- if(menu->menuretval)
+ if (menu->menuretval)
return WM_UI_HANDLER_CONTINUE;
- else if(inside)
+ else if (inside)
return WM_UI_HANDLER_BREAK;
else
return retval;
@@ -6314,11 +6324,11 @@ static int ui_handle_menu_return_submenu(bContext *C, wmEvent *event, uiPopupBlo
data= but->active;
submenu= data->menu;
- if(submenu->menuretval) {
+ if (submenu->menuretval) {
/* first decide if we want to close our own menu cascading, if
* so pass on the sub menu return value to our own menu handle */
- if((submenu->menuretval & UI_RETURN_OK) || (submenu->menuretval & UI_RETURN_CANCEL)) {
- if(!(block->flag & UI_BLOCK_KEEP_OPEN)) {
+ if ((submenu->menuretval & UI_RETURN_OK) || (submenu->menuretval & UI_RETURN_CANCEL)) {
+ if (!(block->flag & UI_BLOCK_KEEP_OPEN)) {
menu->menuretval= submenu->menuretval;
menu->butretval= data->retval;
}
@@ -6330,7 +6340,7 @@ static int ui_handle_menu_return_submenu(bContext *C, wmEvent *event, uiPopupBlo
* will actually close the submenu too */
ui_handle_button_return_submenu(C, event, but);
- if(update)
+ if (update)
submenu->menuretval = 0;
}
@@ -6341,7 +6351,7 @@ static int ui_handle_menu_return_submenu(bContext *C, wmEvent *event, uiPopupBlo
ui_window_to_block(ar, block, &mx, &my);
ui_mouse_motion_towards_init(menu, mx, my, 1);
- if(menu->menuretval)
+ if (menu->menuretval)
return WM_UI_HANDLER_CONTINUE;
else
return WM_UI_HANDLER_BREAK;
@@ -6359,12 +6369,12 @@ static int ui_handle_menus_recursive(bContext *C, wmEvent *event, uiPopupBlockHa
data= (but)? but->active: NULL;
submenu= (data)? data->menu: NULL;
- if(submenu)
+ if (submenu)
retval= ui_handle_menus_recursive(C, event, submenu);
/* now handle events for our own menu */
- if(retval == WM_UI_HANDLER_CONTINUE || event->type == TIMER) {
- if(submenu && submenu->menuretval)
+ if (retval == WM_UI_HANDLER_CONTINUE || event->type == TIMER) {
+ if (submenu && submenu->menuretval)
retval= ui_handle_menu_return_submenu(C, event, menu);
else
retval= ui_handle_menu_event(C, event, menu, (submenu == NULL));
@@ -6385,26 +6395,26 @@ static int ui_handler_region(bContext *C, wmEvent *event, void *UNUSED(userdata)
ar= CTX_wm_region(C);
retval= WM_UI_HANDLER_CONTINUE;
- if(ar==NULL) return retval;
- if(ar->uiblocks.first==NULL) return retval;
+ if (ar==NULL) return retval;
+ if (ar->uiblocks.first==NULL) return retval;
/* either handle events for already activated button or try to activate */
but= ui_but_find_activated(ar);
retval= ui_handler_panel_region(C, event);
- if(retval == WM_UI_HANDLER_CONTINUE)
+ if (retval == WM_UI_HANDLER_CONTINUE)
retval= ui_handle_list_event(C, event, ar);
- if(retval == WM_UI_HANDLER_CONTINUE) {
- if(but)
+ if (retval == WM_UI_HANDLER_CONTINUE) {
+ if (but)
retval= ui_handle_button_event(C, event, but);
else
retval= ui_handle_button_over(C, event, ar);
}
/* re-enable tooltips */
- if(event->type == MOUSEMOVE && (event->x!=event->prevx || event->y!=event->prevy))
+ if (event->type == MOUSEMOVE && (event->x!=event->prevx || event->y!=event->prevy))
ui_blocks_set_tooltips(ar, 1);
/* delayed apply callbacks */
@@ -6419,17 +6429,17 @@ static void ui_handler_remove_region(bContext *C, void *UNUSED(userdata))
ARegion *ar;
ar= CTX_wm_region(C);
- if(ar == NULL) return;
+ if (ar == NULL) return;
uiFreeBlocks(C, &ar->uiblocks);
sc= CTX_wm_screen(C);
- if(sc == NULL) return;
+ if (sc == NULL) return;
/* delayed apply callbacks, but not for screen level regions, those
* we rather do at the very end after closing them all, which will
* be done in ui_handler_region/window */
- if(BLI_findindex(&sc->regionbase, ar) == -1)
+ if (BLI_findindex(&sc->regionbase, ar) == -1)
ui_apply_but_funcs_after(C);
}
@@ -6443,23 +6453,23 @@ static int ui_handler_region_menu(bContext *C, wmEvent *event, void *UNUSED(user
/* here we handle buttons at the window level, modal, for example
* while number sliding, text editing, or when a menu block is open */
ar= CTX_wm_menu(C);
- if(!ar)
+ if (!ar)
ar= CTX_wm_region(C);
but= ui_but_find_activated(ar);
- if(but) {
+ if (but) {
/* handle activated button events */
data= but->active;
- if(data->state == BUTTON_STATE_MENU_OPEN) {
+ if (data->state == BUTTON_STATE_MENU_OPEN) {
/* handle events for menus and their buttons recursively,
* this will handle events from the top to the bottom menu */
retval= ui_handle_menus_recursive(C, event, data->menu);
/* handle events for the activated button */
- if(retval == WM_UI_HANDLER_CONTINUE || event->type == TIMER) {
- if(data->menu->menuretval)
+ if (retval == WM_UI_HANDLER_CONTINUE || event->type == TIMER) {
+ if (data->menu->menuretval)
ui_handle_button_return_submenu(C, event, but);
else
ui_handle_button_event(C, event, but);
@@ -6472,7 +6482,7 @@ static int ui_handler_region_menu(bContext *C, wmEvent *event, void *UNUSED(user
}
/* re-enable tooltips */
- if(event->type == MOUSEMOVE && (event->x!=event->prevx || event->y!=event->prevy))
+ if (event->type == MOUSEMOVE && (event->x!=event->prevx || event->y!=event->prevy))
ui_blocks_set_tooltips(ar, 1);
/* delayed apply callbacks */
@@ -6490,25 +6500,25 @@ static int ui_handler_popup(bContext *C, wmEvent *event, void *userdata)
ui_handle_menus_recursive(C, event, menu);
/* free if done, does not free handle itself */
- if(menu->menuretval) {
+ if (menu->menuretval) {
/* copy values, we have to free first (closes region) */
uiPopupBlockHandle temp= *menu;
ui_popup_block_free(C, menu);
UI_remove_popup_handlers(&CTX_wm_window(C)->modalhandlers, menu);
- if((temp.menuretval & UI_RETURN_OK) || (temp.menuretval & UI_RETURN_POPUP_OK)) {
- if(temp.popup_func)
+ if ((temp.menuretval & UI_RETURN_OK) || (temp.menuretval & UI_RETURN_POPUP_OK)) {
+ if (temp.popup_func)
temp.popup_func(C, temp.popup_arg, temp.retvalue);
- if(temp.optype)
+ if (temp.optype)
WM_operator_name_call(C, temp.optype->idname, temp.opcontext, NULL);
}
- else if(temp.cancel_func)
+ else if (temp.cancel_func)
temp.cancel_func(temp.popup_arg);
}
else {
/* re-enable tooltips */
- if(event->type == MOUSEMOVE && (event->x!=event->prevx || event->y!=event->prevy))
+ if (event->type == MOUSEMOVE && (event->x!=event->prevx || event->y!=event->prevy))
ui_blocks_set_tooltips(menu->region, 1);
}
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 403df8acbee..4b5612c6408 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -147,13 +147,13 @@ static void def_internal_icon(ImBuf *bbuf, int icon_id, int xofs, int yofs, int
di = MEM_callocN(sizeof(DrawInfo), "drawinfo");
di->type= type;
- if(type == ICON_TYPE_TEXTURE) {
+ if (type == ICON_TYPE_TEXTURE) {
di->data.texture.x= xofs;
di->data.texture.y= yofs;
di->data.texture.w= size;
di->data.texture.h= size;
}
- else if(type == ICON_TYPE_BUFFER) {
+ else if (type == ICON_TYPE_BUFFER) {
iimg = MEM_mallocN(sizeof(IconImage), "icon_img");
iimg->rect = MEM_mallocN(size*size*sizeof(unsigned int), "icon_rect");
iimg->w = size;
@@ -517,7 +517,7 @@ static void init_internal_icons(void)
if (icondir) {
BLI_join_dirfile(iconfilestr, sizeof(iconfilestr), icondir, btheme->tui.iconfile);
bbuf = IMB_loadiffname(iconfilestr, IB_rect); /* if the image is missing bbuf will just be NULL */
- if(bbuf && (bbuf->x < ICON_IMAGE_W || bbuf->y < ICON_IMAGE_H)) {
+ if (bbuf && (bbuf->x < ICON_IMAGE_W || bbuf->y < ICON_IMAGE_H)) {
printf("\n***WARNING***\nIcons file %s too small.\nUsing built-in Icons instead\n", iconfilestr);
IMB_freeImBuf(bbuf);
bbuf= NULL;
@@ -527,21 +527,21 @@ static void init_internal_icons(void)
printf("%s: 'icons' data path not found, continuing\n", __func__);
}
}
- if(bbuf==NULL)
+ if (bbuf==NULL)
bbuf = IMB_ibImageFromMemory((unsigned char*)datatoc_blender_icons_png, datatoc_blender_icons_png_size, IB_rect, "<blender icons>");
- if(bbuf) {
+ if (bbuf) {
/* free existing texture if any */
- if(icongltex.id) {
+ if (icongltex.id) {
glDeleteTextures(1, &icongltex.id);
icongltex.id= 0;
}
/* we only use a texture for cards with non-power of two */
- if(GPU_non_power_of_two_support()) {
+ if (GPU_non_power_of_two_support()) {
glGenTextures(1, &icongltex.id);
- if(icongltex.id) {
+ if (icongltex.id) {
icongltex.w = bbuf->x;
icongltex.h = bbuf->y;
icongltex.invw = 1.0f/bbuf->x;
@@ -553,7 +553,7 @@ static void init_internal_icons(void)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glBindTexture(GL_TEXTURE_2D, 0);
- if(glGetError() == GL_OUT_OF_MEMORY) {
+ if (glGetError() == GL_OUT_OF_MEMORY) {
glDeleteTextures(1, &icongltex.id);
icongltex.id= 0;
}
@@ -561,12 +561,12 @@ static void init_internal_icons(void)
}
}
- if(icongltex.id)
+ if (icongltex.id)
icontype= ICON_TYPE_TEXTURE;
else
icontype= ICON_TYPE_BUFFER;
- if(bbuf) {
+ if (bbuf) {
for (y=0; y<ICON_GRID_ROWS; y++) {
for (x=0; x<ICON_GRID_COLS; x++) {
def_internal_icon(bbuf, BIFICONID_FIRST + y*ICON_GRID_COLS + x,
@@ -604,21 +604,21 @@ static void init_iconfile_list(struct ListBase *list)
list->first = list->last = NULL;
icondir = BLI_get_folder(BLENDER_DATAFILES, "icons");
- if(icondir==NULL)
+ if (icondir==NULL)
return;
/* since BLI_dir_contents changes the current working directory, restore it
* back to old value afterwards */
- if(!BLI_current_working_dir(olddir, sizeof(olddir)))
+ if (!BLI_current_working_dir(olddir, sizeof(olddir)))
restoredir = 0;
totfile = BLI_dir_contents(icondir, &dir);
if (restoredir && !chdir(olddir)) {} /* fix warning about checking return value */
- for(i=0; i<totfile; i++) {
- if( (dir[i].type & S_IFREG) ) {
+ for (i=0; i<totfile; i++) {
+ if ( (dir[i].type & S_IFREG) ) {
char *filename = dir[i].relname;
- if(BLI_testextensie(filename, ".png")) {
+ if (BLI_testextensie(filename, ".png")) {
/* loading all icons on file start is overkill & slows startup
* its possible they change size after blender load anyway. */
#if 0
@@ -631,7 +631,7 @@ static void init_iconfile_list(struct ListBase *list)
BLI_join_dirfile(iconfilestr, sizeof(iconfilestr), icondir, filename);
bbuf= IMB_loadiffname(iconfilestr, IB_rect);
- if(bbuf) {
+ if (bbuf) {
ifilex = bbuf->x;
ifiley = bbuf->y;
IMB_freeImBuf(bbuf);
@@ -678,7 +678,7 @@ static void free_iconfile_list(struct ListBase *list)
{
IconFile *ifile=NULL, *next_ifile=NULL;
- for(ifile=list->first; ifile; ifile=next_ifile) {
+ for (ifile=list->first; ifile; ifile=next_ifile) {
next_ifile = ifile->next;
BLI_freelinkN(list, ifile);
}
@@ -689,7 +689,7 @@ int UI_iconfile_get_index(const char *filename)
IconFile *ifile;
ListBase *list=&(iconfilelist);
- for(ifile=list->first; ifile; ifile=ifile->next) {
+ for (ifile=list->first; ifile; ifile=ifile->next) {
if (BLI_path_cmp(filename, ifile->filename) == 0) {
return ifile->index;
}
@@ -709,7 +709,7 @@ ListBase *UI_iconfile_list(void)
void UI_icons_free(void)
{
#ifndef WITH_HEADLESS
- if(icongltex.id) {
+ if (icongltex.id) {
glDeleteTextures(1, &icongltex.id);
icongltex.id= 0;
}
@@ -723,9 +723,9 @@ void UI_icons_free_drawinfo(void *drawinfo)
{
DrawInfo *di = drawinfo;
- if(di) {
- if(di->type == ICON_TYPE_BUFFER) {
- if(di->data.buffer.image) {
+ if (di) {
+ if (di->type == ICON_TYPE_BUFFER) {
+ if (di->data.buffer.image) {
MEM_freeN(di->data.buffer.image->rect);
MEM_freeN(di->data.buffer.image);
}
@@ -860,24 +860,24 @@ static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect),
ImBuf *ima= NULL;
/* sanity check */
- if(w<=0 || h<=0 || w>2000 || h>2000) {
+ if (w<=0 || h<=0 || w>2000 || h>2000) {
printf("%s: icons are %i x %i pixels?\n", __func__, w, h);
BLI_assert(!"invalid icon size");
return;
}
/* modulate color */
- if(alpha != 1.0f)
+ if (alpha != 1.0f)
glPixelTransferf(GL_ALPHA_SCALE, alpha);
- if(rgb) {
+ if (rgb) {
glPixelTransferf(GL_RED_SCALE, rgb[0]);
glPixelTransferf(GL_GREEN_SCALE, rgb[1]);
glPixelTransferf(GL_BLUE_SCALE, rgb[2]);
}
/* rect contains image in 'rendersize', we only scale if needed */
- if(rw!=w && rh!=h) {
+ if (rw!=w && rh!=h) {
/* first allocate imbuf for scaling and copy preview into it */
ima = IMB_allocImBuf(rw, rh, 32, IB_rect);
memcpy(ima->rect, rect, rw*rh*sizeof(unsigned int));
@@ -886,7 +886,7 @@ static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect),
}
/* draw */
- if(is_preview) {
+ if (is_preview) {
glaDrawPixelsSafe(x, y, w, h, w, GL_RGBA, GL_UNSIGNED_BYTE, rect);
}
else {
@@ -894,14 +894,14 @@ static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect),
glDrawPixels(w, h, GL_RGBA, GL_UNSIGNED_BYTE, rect);
}
- if(ima)
+ if (ima)
IMB_freeImBuf(ima);
/* restore color */
- if(alpha != 0.0f)
+ if (alpha != 0.0f)
glPixelTransferf(GL_ALPHA_SCALE, 1.0f);
- if(rgb) {
+ if (rgb) {
glPixelTransferf(GL_RED_SCALE, 1.0f);
glPixelTransferf(GL_GREEN_SCALE, 1.0f);
glPixelTransferf(GL_BLUE_SCALE, 1.0f);
@@ -912,7 +912,7 @@ static void icon_draw_texture(float x, float y, float w, float h, int ix, int iy
{
float x1, x2, y1, y2;
- if(rgb) glColor4f(rgb[0], rgb[1], rgb[2], alpha);
+ if (rgb) glColor4f(rgb[0], rgb[1], rgb[2], alpha);
else glColor4f(1.0f, 1.0f, 1.0f, alpha);
x1= ix*icongltex.invw;
@@ -982,29 +982,29 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al
w = (int)(fdraw_size/aspect + 0.5f);
h = (int)(fdraw_size/aspect + 0.5f);
- if(di->type == ICON_TYPE_VECTOR) {
+ if (di->type == ICON_TYPE_VECTOR) {
/* vector icons use the uiBlock transformation, they are not drawn
* with untransformed coordinates like the other icons */
di->data.vector.func((int)x, (int)y, ICON_DEFAULT_HEIGHT, ICON_DEFAULT_HEIGHT, 1.0f);
}
- else if(di->type == ICON_TYPE_TEXTURE) {
+ else if (di->type == ICON_TYPE_TEXTURE) {
icon_draw_texture(x, y, (float)w, (float)h, di->data.texture.x, di->data.texture.y,
di->data.texture.w, di->data.texture.h, alpha, rgb);
}
- else if(di->type == ICON_TYPE_BUFFER) {
+ else if (di->type == ICON_TYPE_BUFFER) {
/* it is a builtin icon */
iimg= di->data.buffer.image;
- if(!iimg->rect) return; /* something has gone wrong! */
+ if (!iimg->rect) return; /* something has gone wrong! */
icon_draw_rect(x, y, w, h, aspect, iimg->w, iimg->h, iimg->rect, alpha, rgb, is_preview);
}
- else if(di->type == ICON_TYPE_PREVIEW) {
+ else if (di->type == ICON_TYPE_PREVIEW) {
PreviewImage* pi = BKE_previewimg_get((ID*)icon->obj);
- if(pi) {
+ if (pi) {
/* no create icon on this level in code */
- if(!pi->rect[size]) return; /* something has gone wrong! */
+ if (!pi->rect[size]) return; /* something has gone wrong! */
/* preview images use premul alpha ... */
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
@@ -1041,13 +1041,13 @@ static void ui_id_brush_render(bContext *C, ID *id)
PreviewImage *pi = BKE_previewimg_get(id);
enum eIconSizes i;
- if(!pi)
+ if (!pi)
return;
- for(i = 0; i < NUM_ICON_SIZES; i++) {
+ for (i = 0; i < NUM_ICON_SIZES; i++) {
/* check if rect needs to be created; changed
* only set by dynamic icons */
- if((pi->changed[i] || !pi->rect[i])) {
+ if ((pi->changed[i] || !pi->rect[i])) {
icon_set_image(C, id, pi, i);
pi->changed[i] = 0;
}
@@ -1059,7 +1059,7 @@ static int ui_id_brush_get_icon(bContext *C, ID *id)
{
Brush *br = (Brush*)id;
- if(br->flag & BRUSH_CUSTOM_ICON) {
+ if (br->flag & BRUSH_CUSTOM_ICON) {
BKE_icon_getid(id);
ui_id_brush_render(C, id);
}
@@ -1073,34 +1073,34 @@ static int ui_id_brush_get_icon(bContext *C, ID *id)
* be strictly in one paint mode only to avoid
* checking various context stuff here */
- if(CTX_wm_view3d(C) && ob) {
- if(ob->mode & OB_MODE_SCULPT)
+ if (CTX_wm_view3d(C) && ob) {
+ if (ob->mode & OB_MODE_SCULPT)
mode = OB_MODE_SCULPT;
- else if(ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT))
+ else if (ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT))
mode = OB_MODE_VERTEX_PAINT;
- else if(ob->mode & OB_MODE_TEXTURE_PAINT)
+ else if (ob->mode & OB_MODE_TEXTURE_PAINT)
mode = OB_MODE_TEXTURE_PAINT;
}
- else if((sima = CTX_wm_space_image(C)) &&
+ else if ((sima = CTX_wm_space_image(C)) &&
(sima->flag & SI_DRAWTOOL)) {
mode = OB_MODE_TEXTURE_PAINT;
}
/* reset the icon */
- if(mode == OB_MODE_SCULPT) {
+ if (mode == OB_MODE_SCULPT) {
items = brush_sculpt_tool_items;
tool = br->sculpt_tool;
}
- else if(mode == OB_MODE_VERTEX_PAINT) {
+ else if (mode == OB_MODE_VERTEX_PAINT) {
items = brush_vertex_tool_items;
tool = br->vertexpaint_tool;
}
- else if(mode == OB_MODE_TEXTURE_PAINT) {
+ else if (mode == OB_MODE_TEXTURE_PAINT) {
items = brush_image_tool_items;
tool = br->imagepaint_tool;
}
- if(!items || !RNA_enum_icon_from_value(items, tool, &id->icon_id))
+ if (!items || !RNA_enum_icon_from_value(items, tool, &id->icon_id))
id->icon_id = 0;
}
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 1c2f2cacf62..88db06c5ec3 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -172,7 +172,7 @@ static const char *ui_item_name_add_colon(const char *name, char namestr[UI_MAX_
{
int len= strlen(name);
- if(len != 0 && len+1 < UI_MAX_NAME_STR) {
+ if (len != 0 && len+1 < UI_MAX_NAME_STR) {
BLI_strncpy(namestr, name, UI_MAX_NAME_STR);
namestr[len]= ':';
namestr[len+1]= '\0';
@@ -185,23 +185,23 @@ static const char *ui_item_name_add_colon(const char *name, char namestr[UI_MAX_
static int ui_item_fit(int item, int pos, int all, int available, int last, int alignment, int *offset)
{
/* available == 0 is unlimited */
- if(available == 0)
+ if (available == 0)
return item;
- if(offset)
+ if (offset)
*offset= 0;
- if(all > available) {
+ if (all > available) {
/* contents is bigger than available space */
- if(last)
+ if (last)
return available-pos;
else
return (item*available)/all;
}
else {
/* contents is smaller or equal to available space */
- if(alignment == UI_LAYOUT_ALIGN_EXPAND) {
- if(last)
+ if (alignment == UI_LAYOUT_ALIGN_EXPAND) {
+ if (last)
return available-pos;
else
return (item*available)/all;
@@ -225,9 +225,9 @@ static int ui_text_icon_width(uiLayout *layout, const char *name, int icon, int
{
int variable = ui_layout_vary_direction(layout) == UI_ITEM_VARY_X;
- if(icon && !name[0])
+ if (icon && !name[0])
return UI_UNIT_X; /* icon only */
- else if(icon)
+ else if (icon)
return (variable)? UI_GetStringWidth(name) + (compact? 5: 10) + UI_UNIT_X: 10*UI_UNIT_X; /* icon + text */
else
return (variable)? UI_GetStringWidth(name) + (compact? 5: 10) + UI_UNIT_X: 10*UI_UNIT_X; /* text only */
@@ -235,37 +235,37 @@ static int ui_text_icon_width(uiLayout *layout, const char *name, int icon, int
static void ui_item_size(uiItem *item, int *r_w, int *r_h)
{
- if(item->type == ITEM_BUTTON) {
+ if (item->type == ITEM_BUTTON) {
uiButtonItem *bitem= (uiButtonItem*)item;
- if(r_w) *r_w= bitem->but->x2 - bitem->but->x1;
- if(r_h) *r_h= bitem->but->y2 - bitem->but->y1;
+ if (r_w) *r_w= bitem->but->x2 - bitem->but->x1;
+ if (r_h) *r_h= bitem->but->y2 - bitem->but->y1;
}
else {
uiLayout *litem= (uiLayout*)item;
- if(r_w) *r_w= litem->w;
- if(r_h) *r_h= litem->h;
+ if (r_w) *r_w= litem->w;
+ if (r_h) *r_h= litem->h;
}
}
static void ui_item_offset(uiItem *item, int *r_x, int *r_y)
{
- if(item->type == ITEM_BUTTON) {
+ if (item->type == ITEM_BUTTON) {
uiButtonItem *bitem= (uiButtonItem*)item;
- if(r_x) *r_x= bitem->but->x1;
- if(r_y) *r_y= bitem->but->y1;
+ if (r_x) *r_x= bitem->but->x1;
+ if (r_y) *r_y= bitem->but->y1;
}
else {
- if(r_x) *r_x= 0;
- if(r_y) *r_y= 0;
+ if (r_x) *r_x= 0;
+ if (r_y) *r_y= 0;
}
}
static void ui_item_position(uiItem *item, int x, int y, int w, int h)
{
- if(item->type == ITEM_BUTTON) {
+ if (item->type == ITEM_BUTTON) {
uiButtonItem *bitem= (uiButtonItem*)item;
bitem->but->x1= x;
@@ -308,7 +308,7 @@ static uiLayout *ui_item_local_sublayout(uiLayout *test, uiLayout *layout, int a
{
uiLayout *sub;
- if(ui_layout_local_dir(test) == UI_LAYOUT_HORIZONTAL)
+ if (ui_layout_local_dir(test) == UI_LAYOUT_HORIZONTAL)
sub= uiLayoutRow(layout, align);
else
sub= uiLayoutColumn(layout, align);
@@ -327,16 +327,16 @@ static void ui_layer_but_cb(bContext *C, void *arg_but, void *arg_index)
int shift= win->eventstate->shift;
int len= RNA_property_array_length(ptr, prop);
- if(!shift) {
+ if (!shift) {
RNA_property_boolean_set_index(ptr, prop, index, TRUE);
- for(i=0; i<len; i++)
- if(i != index)
+ for (i=0; i<len; i++)
+ if (i != index)
RNA_property_boolean_set_index(ptr, prop, i, 0);
RNA_property_update(C, ptr, prop);
- for(cbut=but->block->buttons.first; cbut; cbut=cbut->next)
+ for (cbut=but->block->buttons.first; cbut; cbut=cbut->next)
ui_check_but(cbut);
}
}
@@ -359,11 +359,11 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in
uiBlockSetCurLayout(block, sub);
/* create label */
- if(name[0])
+ if (name[0])
uiDefBut(block, LABEL, 0, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
/* create buttons */
- if(type == PROP_BOOLEAN && ELEM(subtype, PROP_LAYER, PROP_LAYER_MEMBER)) {
+ if (type == PROP_BOOLEAN && ELEM(subtype, PROP_LAYER, PROP_LAYER_MEMBER)) {
/* special check for layer layout */
int butw, buth, unit;
int cols= (len >= 20)? 2: 1;
@@ -376,28 +376,28 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in
butw= unit;
buth= unit;
- if(ptr->type == &RNA_Armature) {
+ if (ptr->type == &RNA_Armature) {
bArmature *arm= (bArmature *)ptr->data;
layer_used= arm->layer_used;
}
- for(b=0; b<cols; b++) {
+ for (b=0; b<cols; b++) {
uiBlockBeginAlign(block);
- for(a=0; a<colbuts; a++) {
- if(layer_used & (1<<(a+b*colbuts))) icon= ICON_LAYER_USED;
+ for (a=0; a<colbuts; a++) {
+ if (layer_used & (1<<(a+b*colbuts))) icon= ICON_LAYER_USED;
else icon= ICON_BLANK1;
but = uiDefAutoButR(block, ptr, prop, a+b*colbuts, "", icon, x + butw*a, y+buth, butw, buth);
- if(subtype == PROP_LAYER_MEMBER)
+ if (subtype == PROP_LAYER_MEMBER)
uiButSetFunc(but, ui_layer_but_cb, but, SET_INT_IN_POINTER(a+b*colbuts));
}
- for(a=0; a<colbuts; a++) {
- if(layer_used & (1<<(a+len/2+b*colbuts))) icon= ICON_LAYER_USED;
+ for (a=0; a<colbuts; a++) {
+ if (layer_used & (1<<(a+len/2+b*colbuts))) icon= ICON_LAYER_USED;
else icon= ICON_BLANK1;
but = uiDefAutoButR(block, ptr, prop, a+len/2+b*colbuts, "", icon, x + butw*a, y, butw, buth);
- if(subtype == PROP_LAYER_MEMBER)
+ if (subtype == PROP_LAYER_MEMBER)
uiButSetFunc(but, ui_layer_but_cb, but, SET_INT_IN_POINTER(a+len/2+b*colbuts));
}
uiBlockEndAlign(block);
@@ -405,7 +405,7 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in
x += colbuts*butw + style->buttonspacex;
}
}
- else if(subtype == PROP_MATRIX) {
+ else if (subtype == PROP_MATRIX) {
int totdim, dim_size[3]; /* 3 == RNA_MAX_ARRAY_DIMENSION */
int row, col;
@@ -417,16 +417,16 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in
w /= dim_size[0];
/* h /= dim_size[1]; */ /* UNUSED */
- for(a=0; a<len; a++) {
+ for (a=0; a<len; a++) {
col= a % dim_size[0];
row= a / dim_size[0];
but = uiDefAutoButR(block, ptr, prop, a, "", ICON_NONE, x + w*col, y+(dim_size[1]*UI_UNIT_Y)-(row*UI_UNIT_Y), w, UI_UNIT_Y);
- if(slider && but->type==NUM)
+ if (slider && but->type==NUM)
but->type= NUMSLI;
}
}
- else if(subtype == PROP_DIRECTION) {
+ else if (subtype == PROP_DIRECTION) {
uiDefButR_prop(block, BUT_NORMAL, 0, name, x, y, UI_UNIT_X*3, UI_UNIT_Y*3, ptr, prop, 0, 0, 0, -1, -1, NULL);
}
else {
@@ -434,7 +434,7 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in
* to work with common cases, but may need to be re-worked */
/* special case, boolean array in a menu, this could be used in a more generic way too */
- if(ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA) && !expand) {
+ if (ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA) && !expand) {
uiDefAutoButR(block, ptr, prop, -1, "", ICON_NONE, 0, 0, w, UI_UNIT_Y);
}
else {
@@ -445,29 +445,29 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in
/* layout for known array subtypes */
char str[3]= {'\0'};
- if(!icon_only) {
- if(type != PROP_BOOLEAN) {
+ if (!icon_only) {
+ if (type != PROP_BOOLEAN) {
str[1]= ':';
}
}
/* show checkboxes for rna on a non-emboss block (menu for eg) */
- if(type == PROP_BOOLEAN && ELEM(layout->root->block->dt, UI_EMBOSSN, UI_EMBOSSP)) {
+ if (type == PROP_BOOLEAN && ELEM(layout->root->block->dt, UI_EMBOSSN, UI_EMBOSSP)) {
boolarr= MEM_callocN(sizeof(int)*len, "ui_item_array");
RNA_property_boolean_get_array(ptr, prop, boolarr);
}
- for(a=0; a<len; a++) {
- if(!icon_only) str[0]= RNA_property_array_item_char(prop, a);
- if(boolarr) icon= boolarr[a] ? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT;
+ for (a=0; a<len; a++) {
+ if (!icon_only) str[0]= RNA_property_array_item_char(prop, a);
+ if (boolarr) icon= boolarr[a] ? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT;
but = uiDefAutoButR(block, ptr, prop, a, str, icon, 0, 0, w, UI_UNIT_Y);
- if(slider && but->type==NUM)
+ if (slider && but->type==NUM)
but->type= NUMSLI;
- if(toggle && but->type==OPTION)
+ if (toggle && but->type==OPTION)
but->type= TOG;
}
- if(boolarr) {
+ if (boolarr) {
MEM_freeN(boolarr);
}
}
@@ -486,8 +486,8 @@ static void ui_item_enum_expand(uiLayout *layout, uiBlock *block, PointerRNA *pt
RNA_property_enum_items_gettexted(block->evil_C, ptr, prop, &item, &totitem, &free);
uiBlockSetCurLayout(block, ui_item_local_sublayout(layout, layout, 1));
- for(a=0; a<totitem; a++) {
- if(!item[a].identifier[0])
+ for (a=0; a<totitem; a++) {
+ if (!item[a].identifier[0])
continue;
name= (!uiname || uiname[0])? item[a].name: "";
@@ -495,14 +495,14 @@ static void ui_item_enum_expand(uiLayout *layout, uiBlock *block, PointerRNA *pt
value= item[a].value;
itemw= ui_text_icon_width(block->curlayout, name, icon, 0);
- if(icon && name[0] && !icon_only)
+ if (icon && name[0] && !icon_only)
but = uiDefIconTextButR_prop(block, ROW, 0, icon, name, 0, 0, itemw, h, ptr, prop, -1, 0, value, -1, -1, NULL);
- else if(icon)
+ else if (icon)
but = uiDefIconButR_prop(block, ROW, 0, icon, 0, 0, itemw, h, ptr, prop, -1, 0, value, -1, -1, NULL);
else
but = uiDefButR_prop(block, ROW, 0, name, 0, 0, itemw, h, ptr, prop, -1, 0, value, -1, -1, NULL);
- if(ui_layout_local_dir(layout) != UI_LAYOUT_HORIZONTAL)
+ if (ui_layout_local_dir(layout) != UI_LAYOUT_HORIZONTAL)
but->flag |= UI_TEXT_LEFT;
}
uiBlockSetCurLayout(block, layout);
@@ -535,7 +535,7 @@ static uiBut *ui_item_with_label(uiLayout *layout, uiBlock *block, const char *n
sub= uiLayoutRow(layout, 0);
uiBlockSetCurLayout(block, sub);
- if(name[0]) {
+ if (name[0]) {
/* XXX UI_GetStringWidth is not accurate */
#if 0
labelw = UI_GetStringWidth(name);
@@ -549,7 +549,7 @@ static uiBut *ui_item_with_label(uiLayout *layout, uiBlock *block, const char *n
type= RNA_property_type(prop);
subtype= RNA_property_subtype(prop);
- if(subtype == PROP_FILEPATH || subtype == PROP_DIRPATH) {
+ if (subtype == PROP_FILEPATH || subtype == PROP_DIRPATH) {
uiBlockSetCurLayout(block, uiLayoutRow(sub, 1));
uiDefAutoButR(block, ptr, prop, index, "", icon, x, y, w-UI_UNIT_X, h);
@@ -559,11 +559,11 @@ static uiBut *ui_item_with_label(uiLayout *layout, uiBlock *block, const char *n
"BUTTONS_OT_file_browse",
WM_OP_INVOKE_DEFAULT, ICON_FILESEL, x, y, UI_UNIT_X, h, NULL);
}
- else if(flag & UI_ITEM_R_EVENT) {
+ else if (flag & UI_ITEM_R_EVENT) {
uiDefButR_prop(block, KEYEVT, 0, name, x, y, w, h, ptr, prop, index, 0, 0, -1, -1, NULL);
}
- else if(flag & UI_ITEM_R_FULL_EVENT) {
- if(RNA_struct_is_a(ptr->type, &RNA_KeyMapItem)) {
+ else if (flag & UI_ITEM_R_FULL_EVENT) {
+ if (RNA_struct_is_a(ptr->type, &RNA_KeyMapItem)) {
char buf[128];
WM_keymap_item_to_string(ptr->data, buf, sizeof(buf));
@@ -590,16 +590,16 @@ void uiFileBrowseContextProperty(const bContext *C, PointerRNA *ptr, PropertyRNA
memset(ptr, 0, sizeof(*ptr));
*prop= NULL;
- if(!ar)
+ if (!ar)
return;
- for(block=ar->uiblocks.first; block; block=block->next) {
- for(but=block->buttons.first; but; but= but->next) {
+ for (block=ar->uiblocks.first; block; block=block->next) {
+ for (but=block->buttons.first; but; but= but->next) {
prevbut= but->prev;
/* find the button before the active one */
- if((but->flag & UI_BUT_LAST_ACTIVE) && prevbut && prevbut->rnapoin.data) {
- if(RNA_property_type(prevbut->rnaprop) == PROP_STRING) {
+ if ((but->flag & UI_BUT_LAST_ACTIVE) && prevbut && prevbut->rnapoin.data) {
+ if (RNA_property_type(prevbut->rnaprop) == PROP_STRING) {
*ptr= prevbut->rnapoin;
*prop= prevbut->rnaprop;
return;
@@ -620,7 +620,7 @@ static void ui_item_disabled(uiLayout *layout, const char *name)
uiBlockSetCurLayout(block, layout);
- if(!name)
+ if (!name)
name= "";
w= ui_text_icon_width(layout, name, 0, 0);
@@ -638,14 +638,14 @@ PointerRNA uiItemFullO_ptr(uiLayout *layout, wmOperatorType *ot, const char *nam
uiBut *but;
int w;
- if(!name) {
+ if (!name) {
if (ot && ot->srna)
name = RNA_struct_ui_name(ot->srna);
else
name = "";
}
- if(layout->root->type == UI_LAYOUT_MENU && !icon)
+ if (layout->root->type == UI_LAYOUT_MENU && !icon)
icon= ICON_BLANK1;
/* create button */
@@ -657,7 +657,7 @@ PointerRNA uiItemFullO_ptr(uiLayout *layout, wmOperatorType *ot, const char *nam
uiBlockSetEmboss(block, UI_EMBOSSN);
/* create the button */
- if(icon) {
+ if (icon) {
if (name[0]) {
but = uiDefIconTextButO_ptr(block, BUT, ot, context, icon, name, 0, 0, w, UI_UNIT_Y, NULL);
}
@@ -672,20 +672,20 @@ PointerRNA uiItemFullO_ptr(uiLayout *layout, wmOperatorType *ot, const char *nam
assert(but->optype != NULL);
/* text alignment for toolbar buttons */
- if((layout->root->type == UI_LAYOUT_TOOLBAR) && !icon)
+ if ((layout->root->type == UI_LAYOUT_TOOLBAR) && !icon)
but->flag |= UI_TEXT_LEFT;
if (flag & UI_ITEM_R_NO_BG)
uiBlockSetEmboss(block, UI_EMBOSS);
- if(layout->redalert)
+ if (layout->redalert)
uiButSetFlag(but, UI_BUT_REDALERT);
/* assign properties */
- if(properties || (flag & UI_ITEM_O_RETURN_PROPS)) {
+ if (properties || (flag & UI_ITEM_O_RETURN_PROPS)) {
PointerRNA *opptr= uiButGetOperatorPtrRNA(but);
- if(properties) {
+ if (properties) {
opptr->data= properties;
}
else {
@@ -733,7 +733,7 @@ static void uiItemEnumO_ptr__internal(uiLayout *layout, wmOperatorType *ot, cons
WM_operator_properties_create_ptr(&ptr, ot);
RNA_property_enum_set(&ptr, prop, value);
- if(!name)
+ if (!name)
name = ui_menu_enumpropname(layout, &ptr, prop, value);
uiItemFullO_ptr(layout, ot, name, icon, ptr.data, layout->root->opcontext, 0);
@@ -755,7 +755,7 @@ void uiItemEnumO_ptr(uiLayout *layout, wmOperatorType *ot, const char *name, int
RNA_property_enum_set(&ptr, prop, value);
- if(!name)
+ if (!name)
name = ui_menu_enumpropname(layout, &ptr, prop, value);
uiItemFullO_ptr(layout, ot, name, icon, ptr.data, layout->root->opcontext, 0);
@@ -764,7 +764,7 @@ void uiItemEnumO(uiLayout *layout, const char *opname, const char *name, int ico
{
wmOperatorType *ot = WM_operatortype_find(opname, 0); /* print error next */
- if(ot) {
+ if (ot) {
uiItemEnumO_ptr(layout, ot, name, icon, propname, value);
}
else {
@@ -783,7 +783,7 @@ void uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname
uiBut *bt;
uiBlock *block= layout->root->block;
- if(!ot || !ot->srna) {
+ if (!ot || !ot->srna) {
ui_item_disabled(layout, opname);
RNA_warning("%s '%s'", ot ? "unknown operator" : "operator missing srna", opname);
return;
@@ -795,7 +795,7 @@ void uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname
/* don't let bad properties slip through */
BLI_assert((prop == NULL) || (RNA_property_type(prop) == PROP_ENUM));
- if(prop && RNA_property_type(prop) == PROP_ENUM) {
+ if (prop && RNA_property_type(prop) == PROP_ENUM) {
EnumPropertyItem *item;
int totitem, i, free;
uiLayout *split= uiLayoutSplit(layout, 0, 0);
@@ -803,13 +803,13 @@ void uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname
RNA_property_enum_items_gettexted(block->evil_C, &ptr, prop, &item, &totitem, &free);
- for(i=0; i<totitem; i++) {
- if(item[i].identifier[0]) {
- if(properties) {
+ for (i=0; i<totitem; i++) {
+ if (item[i].identifier[0]) {
+ if (properties) {
PointerRNA tptr;
WM_operator_properties_create_ptr(&tptr, ot);
- if(tptr.data) {
+ if (tptr.data) {
IDP_FreeProperty(tptr.data);
MEM_freeN(tptr.data);
}
@@ -823,8 +823,8 @@ void uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname
}
}
else {
- if(item[i].name) {
- if(i != 0) {
+ if (item[i].name) {
+ if (i != 0) {
column= uiLayoutColumn(split, 0);
/* inconsistent, but menus with labels do not look good flipped */
block->flag |= UI_BLOCK_NO_FLIP;
@@ -873,7 +873,7 @@ void uiItemEnumO_value(uiLayout *layout, const char *name, int icon, const char
RNA_property_enum_set(&ptr, prop, value);
/* same as uiItemEnumO */
- if(!name)
+ if (!name)
name = ui_menu_enumpropname(layout, &ptr, prop, value);
uiItemFullO_ptr(layout, ot, name, icon, ptr.data, layout->root->opcontext, 0);
@@ -893,10 +893,10 @@ void uiItemEnumO_string(uiLayout *layout, const char *name, int icon, const char
WM_operator_properties_create_ptr(&ptr, ot);
/* enum lookup */
- if((prop= RNA_struct_find_property(&ptr, propname))) {
+ if ((prop= RNA_struct_find_property(&ptr, propname))) {
RNA_property_enum_items_gettexted(layout->root->block->evil_C, &ptr, prop, &item, NULL, &free);
- if(item==NULL || RNA_enum_value_from_id(item, value_str, &value)==0) {
- if(free) {
+ if (item==NULL || RNA_enum_value_from_id(item, value_str, &value)==0) {
+ if (free) {
MEM_freeN(item);
}
RNA_warning("%s.%s, enum %s not found", RNA_struct_identifier(ptr.type), propname, value_str);
@@ -915,7 +915,7 @@ void uiItemEnumO_string(uiLayout *layout, const char *name, int icon, const char
RNA_property_enum_set(&ptr, prop, value);
/* same as uiItemEnumO */
- if(!name)
+ if (!name)
name = ui_menu_enumpropname(layout, &ptr, prop, value);
uiItemFullO_ptr(layout, ot, name, icon, ptr.data, layout->root->opcontext, 0);
@@ -991,32 +991,32 @@ static void ui_item_rna_size(uiLayout *layout, const char *name, int icon, Point
subtype= RNA_property_subtype(prop);
len= RNA_property_array_length(ptr, prop);
- if(ELEM3(type, PROP_STRING, PROP_POINTER, PROP_ENUM) && !name[0] && !icon_only)
+ if (ELEM3(type, PROP_STRING, PROP_POINTER, PROP_ENUM) && !name[0] && !icon_only)
name= "non-empty text";
- else if(type == PROP_BOOLEAN && !name[0] && !icon_only)
+ else if (type == PROP_BOOLEAN && !name[0] && !icon_only)
icon= ICON_DOT;
w= ui_text_icon_width(layout, name, icon, 0);
h= UI_UNIT_Y;
/* increase height for arrays */
- if(index == RNA_NO_INDEX && len > 0) {
- if(!name[0] && icon == ICON_NONE)
+ if (index == RNA_NO_INDEX && len > 0) {
+ if (!name[0] && icon == ICON_NONE)
h= 0;
- if(ELEM(subtype, PROP_LAYER, PROP_LAYER_MEMBER))
+ if (ELEM(subtype, PROP_LAYER, PROP_LAYER_MEMBER))
h += 2*UI_UNIT_Y;
- else if(subtype == PROP_MATRIX)
+ else if (subtype == PROP_MATRIX)
h += ceil(sqrt(len))*UI_UNIT_Y;
else
h += len*UI_UNIT_Y;
}
- else if(ui_layout_vary_direction(layout) == UI_ITEM_VARY_X) {
- if(type == PROP_BOOLEAN && name[0])
+ else if (ui_layout_vary_direction(layout) == UI_ITEM_VARY_X) {
+ if (type == PROP_BOOLEAN && name[0])
w += UI_UNIT_X/5;
- else if(type == PROP_ENUM)
+ else if (type == PROP_ENUM)
w += UI_UNIT_X/4;
- else if(type == PROP_FLOAT || type == PROP_INT)
+ else if (type == PROP_FLOAT || type == PROP_INT)
w += UI_UNIT_X*3;
}
@@ -1040,26 +1040,26 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
len= (is_array) ? RNA_property_array_length(ptr, prop) : 0;
/* set name and icon */
- if(!name)
+ if (!name)
name= RNA_property_ui_name(prop);
- if(icon == ICON_NONE)
+ if (icon == ICON_NONE)
icon= RNA_property_ui_icon(prop);
- if(ELEM4(type, PROP_INT, PROP_FLOAT, PROP_STRING, PROP_POINTER))
+ if (ELEM4(type, PROP_INT, PROP_FLOAT, PROP_STRING, PROP_POINTER))
name= ui_item_name_add_colon(name, namestr);
- else if(type == PROP_BOOLEAN && is_array && index == RNA_NO_INDEX)
+ else if (type == PROP_BOOLEAN && is_array && index == RNA_NO_INDEX)
name= ui_item_name_add_colon(name, namestr);
- else if(type == PROP_ENUM && index != RNA_ENUM_VALUE)
+ else if (type == PROP_ENUM && index != RNA_ENUM_VALUE)
name= ui_item_name_add_colon(name, namestr);
- if(layout->root->type == UI_LAYOUT_MENU) {
- if(type == PROP_BOOLEAN && ((is_array == FALSE) || (index != RNA_NO_INDEX))) {
- if(is_array) icon= (RNA_property_boolean_get_index(ptr, prop, index)) ? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT;
+ if (layout->root->type == UI_LAYOUT_MENU) {
+ if (type == PROP_BOOLEAN && ((is_array == FALSE) || (index != RNA_NO_INDEX))) {
+ if (is_array) icon= (RNA_property_boolean_get_index(ptr, prop, index)) ? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT;
else icon= (RNA_property_boolean_get(ptr, prop)) ? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT;
}
- else if(type == PROP_ENUM && index == RNA_ENUM_VALUE) {
+ else if (type == PROP_ENUM && index == RNA_ENUM_VALUE) {
int enum_value= RNA_property_enum_get(ptr, prop);
- if(RNA_property_flag(prop) & PROP_ENUM_FLAG) {
+ if (RNA_property_flag(prop) & PROP_ENUM_FLAG) {
icon= (enum_value & value)? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT;
}
else {
@@ -1081,39 +1081,39 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
uiBlockSetEmboss(block, UI_EMBOSSN);
/* array property */
- if(index == RNA_NO_INDEX && is_array)
+ if (index == RNA_NO_INDEX && is_array)
ui_item_array(layout, block, name, icon, ptr, prop, len, 0, 0, w, h, expand, slider, toggle, icon_only);
/* enum item */
- else if(type == PROP_ENUM && index == RNA_ENUM_VALUE) {
- if(icon && name[0] && !icon_only)
+ else if (type == PROP_ENUM && index == RNA_ENUM_VALUE) {
+ if (icon && name[0] && !icon_only)
uiDefIconTextButR_prop(block, ROW, 0, icon, name, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL);
- else if(icon)
+ else if (icon)
uiDefIconButR_prop(block, ROW, 0, icon, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL);
else
uiDefButR_prop(block, ROW, 0, name, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL);
}
/* expanded enum */
- else if(type == PROP_ENUM && (expand || RNA_property_flag(prop) & PROP_ENUM_FLAG))
+ else if (type == PROP_ENUM && (expand || RNA_property_flag(prop) & PROP_ENUM_FLAG))
ui_item_enum_expand(layout, block, ptr, prop, name, h, icon_only);
/* property with separate label */
- else if(type == PROP_ENUM || type == PROP_STRING || type == PROP_POINTER) {
+ else if (type == PROP_ENUM || type == PROP_STRING || type == PROP_POINTER) {
but= ui_item_with_label(layout, block, name, icon, ptr, prop, index, 0, 0, w, h, flag);
ui_but_add_search(but, ptr, prop, NULL, NULL);
- if(layout->redalert)
+ if (layout->redalert)
uiButSetFlag(but, UI_BUT_REDALERT);
}
/* single button */
else {
but = uiDefAutoButR(block, ptr, prop, index, name, icon, 0, 0, w, h);
- if(slider && but->type==NUM)
+ if (slider && but->type==NUM)
but->type= NUMSLI;
- if(toggle && but->type==OPTION)
+ if (toggle && but->type==OPTION)
but->type= TOG;
- if(layout->redalert)
+ if (layout->redalert)
uiButSetFlag(but, UI_BUT_REDALERT);
}
@@ -1125,7 +1125,7 @@ void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, int flag,
{
PropertyRNA *prop= RNA_struct_find_property(ptr, propname);
- if(!prop) {
+ if (!prop) {
ui_item_disabled(layout, propname);
RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
@@ -1138,7 +1138,7 @@ void uiItemEnumR(uiLayout *layout, const char *name, int icon, struct PointerRNA
{
PropertyRNA *prop= RNA_struct_find_property(ptr, propname);
- if(!prop || RNA_property_type(prop) != PROP_ENUM) {
+ if (!prop || RNA_property_type(prop) != PROP_ENUM) {
ui_item_disabled(layout, propname);
RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
@@ -1153,7 +1153,7 @@ void uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, const char *pr
EnumPropertyItem *item;
int ivalue, a, free;
- if(!prop || RNA_property_type(prop) != PROP_ENUM) {
+ if (!prop || RNA_property_type(prop) != PROP_ENUM) {
ui_item_disabled(layout, propname);
RNA_warning("enum property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
@@ -1161,7 +1161,7 @@ void uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, const char *pr
RNA_property_enum_items_gettexted(layout->root->block->evil_C, ptr, prop, &item, NULL, &free);
- if(!RNA_enum_value_from_id(item, value, &ivalue)) {
+ if (!RNA_enum_value_from_id(item, value, &ivalue)) {
if (free) {
MEM_freeN(item);
}
@@ -1170,8 +1170,8 @@ void uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, const char *pr
return;
}
- for(a=0; item[a].identifier; a++) {
- if(item[a].value == ivalue) {
+ for (a=0; item[a].identifier; a++) {
+ if (item[a].value == ivalue) {
uiItemFullR(layout, ptr, prop, RNA_ENUM_VALUE, ivalue, 0, name ? name : item[a].name, icon ? icon : item[a].icon);
break;
}
@@ -1190,13 +1190,13 @@ void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname
prop= RNA_struct_find_property(ptr, propname);
- if(!prop) {
+ if (!prop) {
ui_item_disabled(layout, propname);
RNA_warning("enum property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
- if(RNA_property_type(prop) != PROP_ENUM) {
+ if (RNA_property_type(prop) != PROP_ENUM) {
RNA_warning("not an enum property: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
@@ -1208,13 +1208,13 @@ void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname
RNA_property_enum_items_gettexted(block->evil_C, ptr, prop, &item, &totitem, &free);
- for(i=0; i<totitem; i++) {
- if(item[i].identifier[0]) {
+ for (i=0; i<totitem; i++) {
+ if (item[i].identifier[0]) {
uiItemEnumR(column, item[i].name, ICON_NONE, ptr, propname, item[i].value);
}
else {
- if(item[i].name) {
- if(i != 0) {
+ if (item[i].name) {
+ if (i != 0) {
column= uiLayoutColumn(split, 0);
/* inconsistent, but menus with labels do not look good flipped */
block->flag |= UI_BLOCK_NO_FLIP;
@@ -1266,17 +1266,17 @@ static void rna_search_cb(const struct bContext *C, void *arg_but, const char *s
/* build a temporary list of relevant items first */
RNA_PROP_BEGIN(&but->rnasearchpoin, itemptr, but->rnasearchprop) {
- if(flag & PROP_ID_SELF_CHECK)
- if(itemptr.data == but->rnapoin.id.data)
+ if (flag & PROP_ID_SELF_CHECK)
+ if (itemptr.data == but->rnapoin.id.data)
continue;
/* use filter */
- if(RNA_property_type(but->rnaprop)==PROP_POINTER) {
- if(RNA_property_pointer_poll(&but->rnapoin, but->rnaprop, &itemptr)==0)
+ if (RNA_property_type(but->rnaprop)==PROP_POINTER) {
+ if (RNA_property_pointer_poll(&but->rnapoin, but->rnaprop, &itemptr)==0)
continue;
}
- if(itemptr.type && RNA_struct_is_ID(itemptr.type)) {
+ if (itemptr.type && RNA_struct_is_ID(itemptr.type)) {
ID *id= itemptr.data;
char name_ui[MAX_ID_NAME];
@@ -1293,8 +1293,8 @@ static void rna_search_cb(const struct bContext *C, void *arg_but, const char *s
iconid = 0;
}
- if(name) {
- if(skip_filter || BLI_strcasestr(name, str)) {
+ if (name) {
+ if (skip_filter || BLI_strcasestr(name, str)) {
cis = MEM_callocN(sizeof(CollItemSearch), "CollectionItemSearch");
cis->name = MEM_dupallocN(name);
cis->index = i;
@@ -1335,10 +1335,10 @@ static void search_id_collection(StructRNA *ptype, PointerRNA *ptr, PropertyRNA
RNA_STRUCT_BEGIN(ptr, iprop) {
/* if it's a collection and has same pointer type, we've got it */
- if(RNA_property_type(iprop) == PROP_COLLECTION) {
+ if (RNA_property_type(iprop) == PROP_COLLECTION) {
srna= RNA_property_pointer_type(ptr, iprop);
- if(ptype == srna) {
+ if (ptype == srna) {
*prop= iprop;
break;
}
@@ -1353,8 +1353,8 @@ void ui_but_add_search(uiBut *but, PointerRNA *ptr, PropertyRNA *prop, PointerRN
PointerRNA sptr;
/* for ID's we do automatic lookup */
- if(!searchprop) {
- if(RNA_property_type(prop) == PROP_POINTER) {
+ if (!searchprop) {
+ if (RNA_property_type(prop) == PROP_POINTER) {
ptype= RNA_property_pointer_type(ptr, prop);
search_id_collection(ptype, &sptr, &searchprop);
searchptr= &sptr;
@@ -1362,7 +1362,7 @@ void ui_but_add_search(uiBut *but, PointerRNA *ptr, PropertyRNA *prop, PointerRN
}
/* turn button into search button */
- if(searchprop) {
+ if (searchprop) {
but->type= SEARCH_MENU;
but->hardmax= MAX2(but->hardmax, 256);
but->rnasearchpoin= *searchptr;
@@ -1385,13 +1385,13 @@ void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propna
/* validate arguments */
prop= RNA_struct_find_property(ptr, propname);
- if(!prop) {
+ if (!prop) {
RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
type= RNA_property_type(prop);
- if(!ELEM(type, PROP_POINTER, PROP_STRING)) {
+ if (!ELEM(type, PROP_POINTER, PROP_STRING)) {
RNA_warning("Property %s must be a pointer or string", propname);
return;
}
@@ -1399,7 +1399,7 @@ void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propna
searchprop= RNA_struct_find_property(searchptr, searchpropname);
- if(!searchprop) {
+ if (!searchprop) {
RNA_warning("search collection property not found: %s.%s", RNA_struct_identifier(ptr->type), searchpropname);
return;
}
@@ -1409,15 +1409,15 @@ void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propna
}
/* get icon & name */
- if(icon==ICON_NONE) {
- if(type == PROP_POINTER)
+ if (icon==ICON_NONE) {
+ if (type == PROP_POINTER)
icontype= RNA_property_pointer_type(ptr, prop);
else
icontype= RNA_property_pointer_type(searchptr, searchprop);
icon= RNA_struct_ui_icon(icontype);
}
- if(!name)
+ if (!name)
name= RNA_property_ui_name(prop);
/* create button */
@@ -1448,35 +1448,35 @@ static void ui_item_menu(uiLayout *layout, const char *name, int icon, uiMenuCre
uiBlockSetCurLayout(block, layout);
- if(layout->root->type == UI_LAYOUT_HEADER)
+ if (layout->root->type == UI_LAYOUT_HEADER)
uiBlockSetEmboss(block, UI_EMBOSS);
- if(!name)
+ if (!name)
name= "";
- if(layout->root->type == UI_LAYOUT_MENU && !icon)
+ if (layout->root->type == UI_LAYOUT_MENU && !icon)
icon= ICON_BLANK1;
w= ui_text_icon_width(layout, name, icon, 1);
h= UI_UNIT_Y;
- if(layout->root->type == UI_LAYOUT_HEADER) /* ugly .. */
+ if (layout->root->type == UI_LAYOUT_HEADER) /* ugly .. */
w -= 10;
- if(name[0] && icon)
+ if (name[0] && icon)
but = uiDefIconTextMenuBut(block, func, arg, icon, name, 0, 0, w, h, tip);
- else if(icon)
+ else if (icon)
but = uiDefIconMenuBut(block, func, arg, icon, 0, 0, w, h, tip);
else
but = uiDefMenuBut(block, func, arg, name, 0, 0, w, h, tip);
- if(argN) { /* ugly .. */
+ if (argN) { /* ugly .. */
but->poin= (char*)but;
but->func_argN= argN;
}
- if(layout->root->type == UI_LAYOUT_HEADER)
+ if (layout->root->type == UI_LAYOUT_HEADER)
uiBlockSetEmboss(block, UI_EMBOSS);
- else if(ELEM(layout->root->type, UI_LAYOUT_PANEL, UI_LAYOUT_TOOLBAR)) {
+ else if (ELEM(layout->root->type, UI_LAYOUT_PANEL, UI_LAYOUT_TOOLBAR)) {
but->type= MENU;
but->flag |= UI_TEXT_LEFT;
}
@@ -1488,16 +1488,16 @@ void uiItemM(uiLayout *layout, bContext *UNUSED(C), const char *menuname, const
mt = WM_menutype_find(menuname, FALSE);
- if(mt==NULL) {
+ if (mt==NULL) {
RNA_warning("not found %s", menuname);
return;
}
- if(!name) {
+ if (!name) {
name = IFACE_(mt->label);
}
- if(layout->root->type == UI_LAYOUT_MENU && !icon)
+ if (layout->root->type == UI_LAYOUT_MENU && !icon)
icon= ICON_BLANK1;
ui_item_menu(layout, name, icon, ui_item_menutype_func, mt, NULL, mt->description);
@@ -1512,16 +1512,16 @@ static uiBut *uiItemL_(uiLayout *layout, const char *name, int icon)
uiBlockSetCurLayout(block, layout);
- if(!name)
+ if (!name)
name= "";
- if(layout->root->type == UI_LAYOUT_MENU && !icon)
+ if (layout->root->type == UI_LAYOUT_MENU && !icon)
icon= ICON_BLANK1;
w= ui_text_icon_width(layout, name, icon, 0);
- if(icon && name[0])
+ if (icon && name[0])
but = uiDefIconTextBut(block, LABEL, 0, icon, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
- else if(icon)
+ else if (icon)
but = uiDefIconBut(block, LABEL, 0, icon, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
else
but = uiDefBut(block, LABEL, 0, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
@@ -1538,8 +1538,8 @@ void uiItemLDrag(uiLayout *layout, PointerRNA *ptr, const char *name, int icon)
{
uiBut *but= uiItemL_(layout, name, icon);
- if(ptr && ptr->type)
- if(RNA_struct_is_ID(ptr->type))
+ if (ptr && ptr->type)
+ if (RNA_struct_is_ID(ptr->type))
uiButSetDragID(but, ptr->id.data);
}
@@ -1554,16 +1554,16 @@ void uiItemV(uiLayout *layout, const char *name, int icon, int argval)
uiBlockSetCurLayout(block, layout);
- if(!name)
+ if (!name)
name= "";
- if(layout->root->type == UI_LAYOUT_MENU && !icon)
+ if (layout->root->type == UI_LAYOUT_MENU && !icon)
icon= ICON_BLANK1;
w= ui_text_icon_width(layout, name, icon, 0);
- if(icon && name[0])
+ if (icon && name[0])
uiDefIconTextButF(block, BUT, argval, icon, name, 0, 0, w, UI_UNIT_Y, retvalue, 0.0, 0.0, 0, 0, "");
- else if(icon)
+ else if (icon)
uiDefIconButF(block, BUT, argval, icon, 0, 0, w, UI_UNIT_Y, retvalue, 0.0, 0.0, 0, 0, "");
else
uiDefButF(block, BUT, argval, name, 0, 0, w, UI_UNIT_Y, retvalue, 0.0, 0.0, 0, 0, "");
@@ -1581,7 +1581,7 @@ void uiItemS(uiLayout *layout)
/* level items */
void uiItemMenuF(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc func, void *arg)
{
- if(!func)
+ if (!func)
return;
ui_item_menu(layout, name, icon, func, arg, NULL, "");
@@ -1611,15 +1611,15 @@ void uiItemMenuEnumO(uiLayout *layout, const char *opname, const char *propname,
UI_OPERATOR_ERROR_RET(ot, opname, return);
- if(!ot->srna) {
+ if (!ot->srna) {
ui_item_disabled(layout, opname);
RNA_warning("operator missing srna '%s'", opname);
return;
}
- if(!name)
+ if (!name)
name= ot->name;
- if(layout->root->type == UI_LAYOUT_MENU && !icon)
+ if (layout->root->type == UI_LAYOUT_MENU && !icon)
icon= ICON_BLANK1;
lvl= MEM_callocN(sizeof(MenuItemLevel), "MenuItemLevel");
@@ -1644,15 +1644,15 @@ void uiItemMenuEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propn
PropertyRNA *prop;
prop= RNA_struct_find_property(ptr, propname);
- if(!prop) {
+ if (!prop) {
ui_item_disabled(layout, propname);
RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
- if(!name)
+ if (!name)
name= RNA_property_ui_name(prop);
- if(layout->root->type == UI_LAYOUT_MENU && !icon)
+ if (layout->root->type == UI_LAYOUT_MENU && !icon)
icon= ICON_BLANK1;
lvl= MEM_callocN(sizeof(MenuItemLevel), "MenuItemLevel");
@@ -1674,13 +1674,13 @@ static void ui_litem_estimate_row(uiLayout *litem)
litem->w= 0;
litem->h= 0;
- for(item=litem->items.first; item; item=item->next) {
+ for (item=litem->items.first; item; item=item->next) {
ui_item_size(item, &itemw, &itemh);
litem->w += itemw;
litem->h= MAX2(itemh, litem->h);
- if(item->next)
+ if (item->next)
litem->w += litem->space;
}
}
@@ -1702,16 +1702,16 @@ static void ui_litem_layout_row(uiLayout *litem)
totw= 0;
tot= 0;
- for(item=litem->items.first; item; item=item->next) {
+ for (item=litem->items.first; item; item=item->next) {
ui_item_size(item, &itemw, &itemh);
totw += itemw;
tot++;
}
- if(totw == 0)
+ if (totw == 0)
return;
- if(w != 0)
+ if (w != 0)
w -= (tot-1)*litem->space;
fixedw= 0;
@@ -1721,21 +1721,21 @@ static void ui_litem_layout_row(uiLayout *litem)
x= 0;
flag= 0;
- for(item=litem->items.first; item; item=item->next) {
- if(item->flag)
+ for (item=litem->items.first; item; item=item->next) {
+ if (item->flag)
continue;
ui_item_size(item, &itemw, &itemh);
minw= ui_litem_min_width(itemw);
- if(w - lastw > 0)
+ if (w - lastw > 0)
neww= ui_item_fit(itemw, x, totw, w-lastw, !item->next, litem->alignment, NULL);
else
neww= 0; /* no space left, all will need clamping to minimum size */
x += neww;
- if((neww < minw || itemw == minw) && w != 0) {
+ if ((neww < minw || itemw == minw) && w != 0) {
/* fixed size */
item->flag= 1;
fixedw += minw;
@@ -1750,17 +1750,17 @@ static void ui_litem_layout_row(uiLayout *litem)
}
lastw= fixedw;
- } while(flag);
+ } while (flag);
freex= 0;
fixedx= 0;
x= litem->x;
- for(item=litem->items.first; item; item=item->next) {
+ for (item=litem->items.first; item; item=item->next) {
ui_item_size(item, &itemw, &itemh);
minw= ui_litem_min_width(itemw);
- if(item->flag) {
+ if (item->flag) {
/* fixed minimum size items */
itemw= ui_item_fit(minw, fixedx, fixedw, MIN2(w, fixedw), !item->next, litem->alignment, NULL);
fixedx += itemw;
@@ -1773,12 +1773,12 @@ static void ui_litem_layout_row(uiLayout *litem)
/* align right/center */
offset= 0;
- if(litem->alignment == UI_LAYOUT_ALIGN_RIGHT) {
- if(freew > 0 && freew < w-fixedw)
+ if (litem->alignment == UI_LAYOUT_ALIGN_RIGHT) {
+ if (freew > 0 && freew < w-fixedw)
offset= (w - fixedw) - freew;
}
- else if(litem->alignment == UI_LAYOUT_ALIGN_CENTER) {
- if(freew > 0 && freew < w-fixedw)
+ else if (litem->alignment == UI_LAYOUT_ALIGN_CENTER) {
+ if (freew > 0 && freew < w-fixedw)
offset= ((w - fixedw) - freew)/2;
}
@@ -1786,7 +1786,7 @@ static void ui_litem_layout_row(uiLayout *litem)
ui_item_position(item, x+offset, y-itemh, itemw, itemh);
x += itemw;
- if(item->next)
+ if (item->next)
x += litem->space;
}
@@ -1805,13 +1805,13 @@ static void ui_litem_estimate_column(uiLayout *litem)
litem->w= 0;
litem->h= 0;
- for(item=litem->items.first; item; item=item->next) {
+ for (item=litem->items.first; item; item=item->next) {
ui_item_size(item, &itemw, &itemh);
litem->w= MAX2(litem->w, itemw);
litem->h += itemh;
- if(item->next)
+ if (item->next)
litem->h += litem->space;
}
}
@@ -1824,13 +1824,13 @@ static void ui_litem_layout_column(uiLayout *litem)
x= litem->x;
y= litem->y;
- for(item=litem->items.first; item; item=item->next) {
+ for (item=litem->items.first; item; item=item->next) {
ui_item_size(item, NULL, &itemh);
y -= itemh;
ui_item_position(item, x, y, litem->w, itemh);
- if(item->next)
+ if (item->next)
y -= litem->space;
}
@@ -1847,7 +1847,7 @@ static void ui_litem_estimate_root(uiLayout *UNUSED(litem))
static void ui_litem_layout_root(uiLayout *litem)
{
- if(litem->root->type == UI_LAYOUT_HEADER)
+ if (litem->root->type == UI_LAYOUT_HEADER)
ui_litem_layout_row(litem);
else
ui_litem_layout_column(litem);
@@ -1875,16 +1875,16 @@ static void ui_litem_layout_box(uiLayout *litem)
litem->x += style->boxspace;
- if(w != 0) litem->w -= 2*style->boxspace;
- if(h != 0) litem->h -= 2*style->boxspace;
+ if (w != 0) litem->w -= 2*style->boxspace;
+ if (h != 0) litem->h -= 2*style->boxspace;
ui_litem_layout_column(litem);
litem->x -= style->boxspace;
litem->y -= style->boxspace;
- if(w != 0) litem->w += 2*style->boxspace;
- if(h != 0) litem->h += style->boxspace;
+ if (w != 0) litem->w += 2*style->boxspace;
+ if (h != 0) litem->h += style->boxspace;
/* roundbox around the sublayout */
but= box->roundbox;
@@ -1906,16 +1906,16 @@ static void ui_litem_estimate_column_flow(uiLayout *litem)
/* compute max needed width and total height */
toth= 0;
totitem= 0;
- for(item=litem->items.first; item; item=item->next) {
+ for (item=litem->items.first; item; item=item->next) {
ui_item_size(item, &itemw, &itemh);
maxw= MAX2(maxw, itemw);
toth += itemh;
totitem++;
}
- if(flow->number <= 0) {
+ if (flow->number <= 0) {
/* auto compute number of columns, not very good */
- if(maxw == 0) {
+ if (maxw == 0) {
flow->totcol= 1;
return;
}
@@ -1937,7 +1937,7 @@ static void ui_litem_estimate_column_flow(uiLayout *litem)
/* create column per column */
col= 0;
- for(item=litem->items.first; item; item=item->next) {
+ for (item=litem->items.first; item; item=item->next) {
ui_item_size(item, &itemw, &itemh);
y -= itemh + style->buttonspacey;
@@ -1946,7 +1946,7 @@ static void ui_litem_estimate_column_flow(uiLayout *litem)
maxw= MAX2(itemw, maxw);
/* decide to go to next one */
- if(col < flow->totcol-1 && emy <= -emh) {
+ if (col < flow->totcol-1 && emy <= -emh) {
x += maxw + litem->space;
maxw= 0;
y= 0;
@@ -1969,7 +1969,7 @@ static void ui_litem_layout_column_flow(uiLayout *litem)
/* compute max needed width and total height */
toth= 0;
totitem= 0;
- for(item=litem->items.first; item; item=item->next) {
+ for (item=litem->items.first; item; item=item->next) {
ui_item_size(item, &itemw, &itemh);
toth += itemh;
totitem++;
@@ -1986,7 +1986,7 @@ static void ui_litem_layout_column_flow(uiLayout *litem)
/* create column per column */
col= 0;
- for(item=litem->items.first; item; item=item->next) {
+ for (item=litem->items.first; item; item=item->next) {
ui_item_size(item, NULL, &itemh);
itemw= ui_item_fit(1, x-litem->x, flow->totcol, w, col == flow->totcol-1, litem->alignment, &offset);
@@ -1997,7 +1997,7 @@ static void ui_litem_layout_column_flow(uiLayout *litem)
miny= MIN2(miny, y);
/* decide to go to next one */
- if(col < flow->totcol-1 && emy <= -emh) {
+ if (col < flow->totcol-1 && emy <= -emh) {
x += itemw + style->columnspace;
y= litem->y;
col++;
@@ -2020,7 +2020,7 @@ static void ui_litem_estimate_absolute(uiLayout *litem)
litem->w= 0;
litem->h= 0;
- for(item=litem->items.first; item; item=item->next) {
+ for (item=litem->items.first; item; item=item->next) {
ui_item_offset(item, &itemx, &itemy);
ui_item_size(item, &itemw, &itemh);
@@ -2046,7 +2046,7 @@ static void ui_litem_layout_absolute(uiLayout *litem)
totw= 0;
toth= 0;
- for(item=litem->items.first; item; item=item->next) {
+ for (item=litem->items.first; item; item=item->next) {
ui_item_offset(item, &itemx, &itemy);
ui_item_size(item, &itemw, &itemh);
@@ -2060,25 +2060,25 @@ static void ui_litem_layout_absolute(uiLayout *litem)
totw -= minx;
toth -= miny;
- if(litem->w && totw > 0)
+ if (litem->w && totw > 0)
scalex= (float)litem->w/(float)totw;
- if(litem->h && toth > 0)
+ if (litem->h && toth > 0)
scaley= (float)litem->h/(float)toth;
x= litem->x;
y= litem->y - scaley*toth;
- for(item=litem->items.first; item; item=item->next) {
+ for (item=litem->items.first; item; item=item->next) {
ui_item_offset(item, &itemx, &itemy);
ui_item_size(item, &itemw, &itemh);
- if(scalex != 1.0f) {
+ if (scalex != 1.0f) {
newx= (itemx - minx)*scalex;
itemw= (itemx - minx + itemw)*scalex - newx;
itemx= minx + newx;
}
- if(scaley != 1.0f) {
+ if (scaley != 1.0f) {
newy= (itemy - miny)*scaley;
itemh= (itemy - miny + itemh)*scaley - newy;
itemy= miny + newy;
@@ -2107,7 +2107,7 @@ static void ui_litem_layout_split(uiLayout *litem)
const int tot= BLI_countlist(&litem->items);
int itemh, x, y, w, colw=0;
- if(tot == 0)
+ if (tot == 0)
return;
x= litem->x;
@@ -2119,13 +2119,13 @@ static void ui_litem_layout_split(uiLayout *litem)
colw= w*percentage;
colw= MAX2(colw, 0);
- for(item=litem->items.first; item; item=item->next) {
+ for (item=litem->items.first; item; item=item->next) {
ui_item_size(item, NULL, &itemh);
ui_item_position(item, x, y-itemh, colw, itemh);
x += colw;
- if(item->next) {
+ if (item->next) {
colw= (w - (int)(w*percentage))/(tot-1);
colw= MAX2(colw, 0);
@@ -2148,7 +2148,7 @@ static void ui_litem_estimate_overlap(uiLayout *litem)
litem->w= 0;
litem->h= 0;
- for(item=litem->items.first; item; item=item->next) {
+ for (item=litem->items.first; item; item=item->next) {
ui_item_size(item, &itemw, &itemh);
litem->w= MAX2(itemw, litem->w);
@@ -2164,7 +2164,7 @@ static void ui_litem_layout_overlap(uiLayout *litem)
x= litem->x;
y= litem->y;
- for(item=litem->items.first; item; item=item->next) {
+ for (item=litem->items.first; item; item=item->next) {
ui_item_size(item, &itemw, &itemh);
ui_item_position(item, x, y-itemh, litem->w, itemh);
@@ -2424,16 +2424,16 @@ static void ui_item_scale(uiLayout *litem, float scale[2])
uiItem *item;
int x, y, w, h;
- for(item=litem->items.last; item; item=item->prev) {
+ for (item=litem->items.last; item; item=item->prev) {
ui_item_size(item, &w, &h);
ui_item_offset(item, &x, &y);
- if(scale[0] != 0.0f) {
+ if (scale[0] != 0.0f) {
x *= scale[0];
w *= scale[0];
}
- if(scale[1] != 0.0f) {
+ if (scale[1] != 0.0f) {
y *= scale[1];
h *= scale[1];
}
@@ -2446,16 +2446,16 @@ static void ui_item_estimate(uiItem *item)
{
uiItem *subitem;
- if(item->type != ITEM_BUTTON) {
+ if (item->type != ITEM_BUTTON) {
uiLayout *litem= (uiLayout*)item;
- for(subitem=litem->items.first; subitem; subitem=subitem->next)
+ for (subitem=litem->items.first; subitem; subitem=subitem->next)
ui_item_estimate(subitem);
- if(litem->items.first == NULL)
+ if (litem->items.first == NULL)
return;
- if(litem->scale[0] != 0.0f || litem->scale[1] != 0.0f)
+ if (litem->scale[0] != 0.0f || litem->scale[1] != 0.0f)
ui_item_scale(litem, litem->scale);
switch(litem->item.type) {
@@ -2495,16 +2495,16 @@ static void ui_item_align(uiLayout *litem, short nr)
uiButtonItem *bitem;
uiLayoutItemBx *box;
- for(item=litem->items.last; item; item=item->prev) {
- if(item->type == ITEM_BUTTON) {
+ for (item=litem->items.last; item; item=item->prev) {
+ if (item->type == ITEM_BUTTON) {
bitem= (uiButtonItem*)item;
- if(ui_but_can_align(bitem->but))
- if(!bitem->but->alignnr)
+ if (ui_but_can_align(bitem->but))
+ if (!bitem->but->alignnr)
bitem->but->alignnr= nr;
}
- else if(item->type == ITEM_LAYOUT_ABSOLUTE);
- else if(item->type == ITEM_LAYOUT_OVERLAP);
- else if(item->type == ITEM_LAYOUT_BOX) {
+ else if (item->type == ITEM_LAYOUT_ABSOLUTE);
+ else if (item->type == ITEM_LAYOUT_OVERLAP);
+ else if (item->type == ITEM_LAYOUT_BOX) {
box= (uiLayoutItemBx*)item;
box->roundbox->alignnr= nr;
BLI_remlink(&litem->root->block->buttons, box->roundbox);
@@ -2520,8 +2520,8 @@ static void ui_item_flag(uiLayout *litem, int flag)
uiItem *item;
uiButtonItem *bitem;
- for(item=litem->items.last; item; item=item->prev) {
- if(item->type == ITEM_BUTTON) {
+ for (item=litem->items.last; item; item=item->prev) {
+ if (item->type == ITEM_BUTTON) {
bitem= (uiButtonItem*)item;
bitem->but->flag |= flag;
}
@@ -2534,17 +2534,17 @@ static void ui_item_layout(uiItem *item)
{
uiItem *subitem;
- if(item->type != ITEM_BUTTON) {
+ if (item->type != ITEM_BUTTON) {
uiLayout *litem= (uiLayout*)item;
- if(litem->items.first == NULL)
+ if (litem->items.first == NULL)
return;
- if(litem->align)
+ if (litem->align)
ui_item_align(litem, ++litem->root->block->alignnr);
- if(!litem->active)
+ if (!litem->active)
ui_item_flag(litem, UI_BUT_INACTIVE);
- if(!litem->enabled)
+ if (!litem->enabled)
ui_item_flag(litem, UI_BUT_DISABLED);
switch(litem->item.type) {
@@ -2576,31 +2576,31 @@ static void ui_item_layout(uiItem *item)
break;
}
- for(subitem=litem->items.first; subitem; subitem=subitem->next)
+ for (subitem=litem->items.first; subitem; subitem=subitem->next)
ui_item_layout(subitem);
}
}
static void ui_layout_end(uiBlock *block, uiLayout *layout, int *x, int *y)
{
- if(layout->root->handlefunc)
+ if (layout->root->handlefunc)
uiBlockSetHandleFunc(block, layout->root->handlefunc, layout->root->argv);
ui_item_estimate(&layout->item);
ui_item_layout(&layout->item);
- if(x) *x= layout->x;
- if(y) *y= layout->y;
+ if (x) *x= layout->x;
+ if (y) *y= layout->y;
}
static void ui_layout_free(uiLayout *layout)
{
uiItem *item, *next;
- for(item=layout->items.first; item; item=next) {
+ for (item=layout->items.first; item; item=next) {
next= item->next;
- if(item->type == ITEM_BUTTON)
+ if (item->type == ITEM_BUTTON)
MEM_freeN(item);
else
ui_layout_free((uiLayout*)item);
@@ -2631,10 +2631,10 @@ uiLayout *uiBlockLayout(uiBlock *block, int dir, int type, int x, int y, int siz
layout->enabled= 1;
layout->context= NULL;
- if(type == UI_LAYOUT_MENU)
+ if (type == UI_LAYOUT_MENU)
layout->space= 0;
- if(dir == UI_LAYOUT_HORIZONTAL) {
+ if (dir == UI_LAYOUT_HORIZONTAL) {
layout->h= size;
layout->root->emh= em*UI_UNIT_Y;
}
@@ -2675,7 +2675,7 @@ void ui_layout_add_but(uiLayout *layout, uiBut *but)
bitem->but= but;
BLI_addtail(&layout->items, bitem);
- if(layout->context) {
+ if (layout->context) {
but->context= layout->context;
but->context->used= 1;
}
@@ -2696,12 +2696,12 @@ void uiBlockLayoutResolve(uiBlock *block, int *x, int *y)
{
uiLayoutRoot *root;
- if(x) *x= 0;
- if(y) *y= 0;
+ if (x) *x= 0;
+ if (y) *y= 0;
block->curlayout= NULL;
- for(root=block->layouts.first; root; root=root->next) {
+ for (root=block->layouts.first; root; root=root->next) {
/* NULL in advance so we don't interfere when adding button */
ui_layout_end(block, root->layout, x, y);
ui_layout_free(root->layout);
@@ -2733,13 +2733,13 @@ static void ui_intro_button(DynStr *ds, uiButtonItem *bitem)
BLI_dynstr_appendf(ds, "'draw_string':'''%s''', ", but->drawstr);
BLI_dynstr_appendf(ds, "'tip':'''%s''', ", but->tip ? but->tip : ""); // not exactly needed, rna has this
- if(but->optype) {
+ if (but->optype) {
char *opstr = WM_operator_pystring(but->block->evil_C, but->optype, but->opptr, 0);
BLI_dynstr_appendf(ds, "'operator':'''%s''', ", opstr ? opstr : "");
MEM_freeN(opstr);
}
- if(but->rnaprop) {
+ if (but->rnaprop) {
BLI_dynstr_appendf(ds, "'rna':'%s.%s[%d]', ", RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop), but->rnaindex);
}
@@ -2751,7 +2751,7 @@ static void ui_intro_items(DynStr *ds, ListBase *lb)
BLI_dynstr_append(ds, "[");
- for(item=lb->first; item; item=item->next) {
+ for (item=lb->first; item; item=item->next) {
BLI_dynstr_append(ds, "{");
@@ -2782,7 +2782,7 @@ static void ui_intro_items(DynStr *ds, ListBase *lb)
BLI_dynstr_append(ds, "}");
- if(item != lb->last)
+ if (item != lb->last)
BLI_dynstr_append(ds, ", ");
}
BLI_dynstr_append(ds, "], ");
@@ -2818,24 +2818,24 @@ static void ui_layout_operator_buts__reset_cb(bContext *UNUSED(C), void *op_pt,
/* this function does not initialize the layout, functions can be called on the layout before and after */
void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op,int (*check_prop)(struct PointerRNA *, struct PropertyRNA *), const char label_align, const short flag)
{
- if(!op->properties) {
+ if (!op->properties) {
IDPropertyTemplate val = {0};
op->properties= IDP_New(IDP_GROUP, &val, "wmOperatorProperties");
}
- if(flag & UI_LAYOUT_OP_SHOW_TITLE) {
+ if (flag & UI_LAYOUT_OP_SHOW_TITLE) {
uiItemL(layout, op->type->name, ICON_NONE);
}
/* poll() on this operator may still fail, at the moment there is no nice feedback when this happens
* just fails silently */
- if(!WM_operator_repeat_check(C, op)) {
+ if (!WM_operator_repeat_check(C, op)) {
uiBlockSetButLock(uiLayoutGetBlock(layout), TRUE, "Operator cannot redo");
uiItemL(layout, "* Redo Unsupported *", ICON_NONE); // XXX, could give some nicer feedback or not show redo panel at all?
}
/* menu */
- if(op->type->flag & OPTYPE_PRESET) {
+ if (op->type->flag & OPTYPE_PRESET) {
/* XXX, no simple way to get WM_MT_operator_presets.bl_label from python! Label remains the same always! */
PointerRNA op_ptr;
uiLayout *row;
@@ -2855,7 +2855,7 @@ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op,in
op_ptr= uiItemFullO(row, "WM_OT_operator_preset_add", "", ICON_ZOOMOUT, op_ptr.data, WM_OP_INVOKE_DEFAULT, 0);
}
- if(op->type->ui) {
+ if (op->type->ui) {
op->layout= layout;
op->type->ui((bContext*)C, op);
op->layout= NULL;
@@ -2872,7 +2872,7 @@ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op,in
/* main draw call */
empty= uiDefAutoButsRNA(layout, &ptr, check_prop, label_align) == 0;
- if(empty && (flag & UI_LAYOUT_OP_SHOW_EMPTY)) {
+ if (empty && (flag & UI_LAYOUT_OP_SHOW_EMPTY)) {
uiItemL(layout, IFACE_("No Properties"), ICON_NONE);
}
}
@@ -2896,7 +2896,7 @@ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op,in
{
uiBut *but;
- for(but= uiLayoutGetBlock(layout)->buttons.first; but; but= but->next) {
+ for (but= uiLayoutGetBlock(layout)->buttons.first; but; but= but->next) {
/* no undo for buttons for operator redo panels */
uiButClearFlag(but, UI_BUT_UNDO);
@@ -2913,7 +2913,7 @@ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op,in
/* this is a bit of a hack but best keep it in one place at least */
MenuType *uiButGetMenuType(uiBut *but)
{
- if(but->menu_create_func == ui_item_menutype_func) {
+ if (but->menu_create_func == ui_item_menutype_func) {
return (MenuType *)but->poin;
}
else {
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index e389612507d..4e97a38fe25 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -89,7 +89,7 @@ static void eyedropper_exit(bContext *C, wmOperator *op)
{
WM_cursor_restore(CTX_wm_window(C));
- if(op->customdata)
+ if (op->customdata)
MEM_freeN(op->customdata);
op->customdata= NULL;
}
@@ -102,7 +102,7 @@ static int eyedropper_cancel(bContext *C, wmOperator *op)
static void eyedropper_sample(bContext *C, Eyedropper *eye, int mx, int my)
{
- if(RNA_property_type(eye->prop) == PROP_FLOAT) {
+ if (RNA_property_type(eye->prop) == PROP_FLOAT) {
Scene *scene = CTX_data_scene(C);
const int color_manage = scene->r.color_mgt_flag & R_COLOR_MANAGEMENT;
float col[4];
@@ -135,7 +135,7 @@ static int eyedropper_modal(bContext *C, wmOperator *op, wmEvent *event)
case RIGHTMOUSE:
return eyedropper_cancel(C, op);
case LEFTMOUSE:
- if(event->val==KM_RELEASE) {
+ if (event->val==KM_RELEASE) {
eyedropper_sample(C, eye, event->x, event->y);
eyedropper_exit(C, op);
return OPERATOR_FINISHED;
@@ -157,7 +157,8 @@ static int eyedropper_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)
WM_event_add_modal_handler(C, op);
return OPERATOR_RUNNING_MODAL;
- } else {
+ }
+ else {
eyedropper_exit(C, op);
return OPERATOR_CANCELLED;
}
@@ -175,7 +176,8 @@ static int eyedropper_exec (bContext *C, wmOperator *op)
eyedropper_exit(C, op);
return OPERATOR_FINISHED;
- } else {
+ }
+ else {
return OPERATOR_CANCELLED;
}
}
@@ -296,7 +298,7 @@ static int reset_default_button_exec(bContext *C, wmOperator *op)
/* if there is a valid property that is editable... */
if (ptr.data && prop && RNA_property_editable(&ptr, prop)) {
- if(RNA_property_reset(&ptr, prop, (all)? -1: index)) {
+ if (RNA_property_reset(&ptr, prop, (all)? -1: index)) {
/* perform updates required for this property */
RNA_property_update(C, &ptr, prop);
@@ -310,9 +312,9 @@ static int reset_default_button_exec(bContext *C, wmOperator *op)
/* Since we don't want to undo _all_ edits to settings, eg window
* edits on the screen or on operator settings.
* it might be better to move undo's inline - campbell */
- if(success) {
+ if (success) {
ID *id= ptr.id.data;
- if(id && ID_CHECK_UNDO(id)) {
+ if (id && ID_CHECK_UNDO(id)) {
/* do nothing, go ahead with undo */
}
else {
@@ -346,13 +348,13 @@ static void UI_OT_reset_default_button(wmOperatorType *ot)
static int copy_to_selected_list(bContext *C, PointerRNA *ptr, ListBase *lb)
{
- if(RNA_struct_is_a(ptr->type, &RNA_Object))
+ if (RNA_struct_is_a(ptr->type, &RNA_Object))
*lb = CTX_data_collection_get(C, "selected_editable_objects");
- else if(RNA_struct_is_a(ptr->type, &RNA_EditBone))
+ else if (RNA_struct_is_a(ptr->type, &RNA_EditBone))
*lb = CTX_data_collection_get(C, "selected_editable_bones");
- else if(RNA_struct_is_a(ptr->type, &RNA_PoseBone))
+ else if (RNA_struct_is_a(ptr->type, &RNA_PoseBone))
*lb = CTX_data_collection_get(C, "selected_pose_bones");
- else if(RNA_struct_is_a(ptr->type, &RNA_Sequence))
+ else if (RNA_struct_is_a(ptr->type, &RNA_Sequence))
*lb = CTX_data_collection_get(C, "selected_editable_sequences");
else
return 0;
@@ -372,9 +374,9 @@ static int copy_to_selected_button_poll(bContext *C)
CollectionPointerLink *link;
ListBase lb;
- if(copy_to_selected_list(C, &ptr, &lb)) {
- for(link= lb.first; link; link=link->next)
- if(link->ptr.data != ptr.data && RNA_property_editable(&link->ptr, prop))
+ if (copy_to_selected_list(C, &ptr, &lb)) {
+ for (link= lb.first; link; link=link->next)
+ if (link->ptr.data != ptr.data && RNA_property_editable(&link->ptr, prop))
success= 1;
BLI_freelistN(&lb);
@@ -399,10 +401,10 @@ static int copy_to_selected_button_exec(bContext *C, wmOperator *op)
CollectionPointerLink *link;
ListBase lb;
- if(copy_to_selected_list(C, &ptr, &lb)) {
- for(link= lb.first; link; link=link->next) {
- if(link->ptr.data != ptr.data && RNA_property_editable(&link->ptr, prop)) {
- if(RNA_property_copy(&link->ptr, &ptr, prop, (all)? -1: index)) {
+ if (copy_to_selected_list(C, &ptr, &lb)) {
+ for (link= lb.first; link; link=link->next) {
+ if (link->ptr.data != ptr.data && RNA_property_editable(&link->ptr, prop)) {
+ if (RNA_property_copy(&link->ptr, &ptr, prop, (all)? -1: index)) {
RNA_property_update(C, &link->ptr, prop);
success= 1;
}
@@ -536,7 +538,7 @@ static int ui_editsource_uibut_match(uiBut *but_a, uiBut *but_b)
/* this just needs to be a 'good-enough' comparison so we can know beyond
* reasonable doubt that these buttons are the same between redraws.
* if this fails it only means edit-source fails - campbell */
- if( (but_a->x1 == but_b->x1) &&
+ if ( (but_a->x1 == but_b->x1) &&
(but_a->x2 == but_b->x2) &&
(but_a->y1 == but_b->y1) &&
(but_a->y2 == but_b->y2) &&
@@ -609,7 +611,7 @@ static int editsource_text_edit(bContext *C, wmOperator *op,
/* naughty!, find text area to set, not good behavior
* but since this is a dev tool lets allow it - campbell */
ScrArea *sa= BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_TEXT, 0);
- if(sa) {
+ if (sa) {
SpaceText *st= sa->spacedata.first;
st->text= text;
}
@@ -647,7 +649,7 @@ static int editsource_exec(bContext *C, wmOperator *op)
/* redraw and get active button python info */
ED_region_do_draw(C, ar);
- for(BLI_ghashIterator_init(&ghi, ui_editsource_info->hash);
+ for (BLI_ghashIterator_init(&ghi, ui_editsource_info->hash);
!BLI_ghashIterator_isDone(&ghi);
BLI_ghashIterator_step(&ghi))
{
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index ffb8b0acf37..08c96aaf0fb 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -103,17 +103,17 @@ static void panel_activate_state(const bContext *C, Panel *pa, uiHandlePanelStat
static int panel_aligned(ScrArea *sa, ARegion *ar)
{
- if(sa->spacetype==SPACE_BUTS && ar->regiontype == RGN_TYPE_WINDOW) {
+ if (sa->spacetype==SPACE_BUTS && ar->regiontype == RGN_TYPE_WINDOW) {
SpaceButs *sbuts= sa->spacedata.first;
return sbuts->align;
}
- else if(sa->spacetype==SPACE_USERPREF && ar->regiontype == RGN_TYPE_WINDOW)
+ else if (sa->spacetype==SPACE_USERPREF && ar->regiontype == RGN_TYPE_WINDOW)
return BUT_VERTICAL;
- else if(sa->spacetype==SPACE_FILE && ar->regiontype == RGN_TYPE_CHANNELS)
+ else if (sa->spacetype==SPACE_FILE && ar->regiontype == RGN_TYPE_CHANNELS)
return BUT_VERTICAL;
- else if(sa->spacetype==SPACE_IMAGE && ar->regiontype == RGN_TYPE_PREVIEW)
+ else if (sa->spacetype==SPACE_IMAGE && ar->regiontype == RGN_TYPE_PREVIEW)
return BUT_VERTICAL;
- else if(ELEM3(ar->regiontype, RGN_TYPE_UI, RGN_TYPE_TOOLS, RGN_TYPE_TOOL_PROPS))
+ else if (ELEM3(ar->regiontype, RGN_TYPE_UI, RGN_TYPE_TOOLS, RGN_TYPE_TOOL_PROPS))
return BUT_VERTICAL;
return 0;
@@ -126,34 +126,34 @@ static int panels_re_align(ScrArea *sa, ARegion *ar, Panel **r_pa)
*r_pa= NULL;
- if(sa->spacetype==SPACE_BUTS && ar->regiontype == RGN_TYPE_WINDOW) {
+ if (sa->spacetype==SPACE_BUTS && ar->regiontype == RGN_TYPE_WINDOW) {
SpaceButs *sbuts= sa->spacedata.first;
- if(sbuts->align)
- if(sbuts->re_align || sbuts->mainbo!=sbuts->mainb)
+ if (sbuts->align)
+ if (sbuts->re_align || sbuts->mainbo!=sbuts->mainb)
return 1;
}
- else if(ar->regiontype==RGN_TYPE_UI)
+ else if (ar->regiontype==RGN_TYPE_UI)
return 1;
- else if(sa->spacetype==SPACE_IMAGE && ar->regiontype == RGN_TYPE_PREVIEW)
+ else if (sa->spacetype==SPACE_IMAGE && ar->regiontype == RGN_TYPE_PREVIEW)
return 1;
- else if(sa->spacetype==SPACE_FILE && ar->regiontype == RGN_TYPE_CHANNELS)
+ else if (sa->spacetype==SPACE_FILE && ar->regiontype == RGN_TYPE_CHANNELS)
return 1;
/* in case panel is added or disappears */
- for(pa=ar->panels.first; pa; pa=pa->next) {
- if((pa->runtime_flag & PNL_WAS_ACTIVE) && !(pa->runtime_flag & PNL_ACTIVE))
+ for (pa=ar->panels.first; pa; pa=pa->next) {
+ if ((pa->runtime_flag & PNL_WAS_ACTIVE) && !(pa->runtime_flag & PNL_ACTIVE))
return 1;
- if(!(pa->runtime_flag & PNL_WAS_ACTIVE) && (pa->runtime_flag & PNL_ACTIVE))
+ if (!(pa->runtime_flag & PNL_WAS_ACTIVE) && (pa->runtime_flag & PNL_ACTIVE))
return 1;
- if(pa->activedata)
+ if (pa->activedata)
active= 1;
}
/* in case we need to do an animation (size changes) */
- for(pa=ar->panels.first; pa; pa=pa->next) {
- if(pa->runtime_flag & PNL_ANIM_ALIGN) {
- if(!active)
+ for (pa=ar->panels.first; pa; pa=pa->next) {
+ if (pa->runtime_flag & PNL_ANIM_ALIGN) {
+ if (!active)
*r_pa= pa;
return 1;
}
@@ -183,14 +183,14 @@ Panel *uiBeginPanel(ScrArea *sa, ARegion *ar, uiBlock *block, PanelType *pt, int
int align= panel_aligned(sa, ar);
/* check if Panel exists, then use that one */
- for(pa=ar->panels.first; pa; pa=pa->next)
- if(strncmp(pa->panelname, idname, UI_MAX_NAME_STR)==0)
- if(strncmp(pa->tabname, tabname, UI_MAX_NAME_STR)==0)
+ for (pa=ar->panels.first; pa; pa=pa->next)
+ if (strncmp(pa->panelname, idname, UI_MAX_NAME_STR)==0)
+ if (strncmp(pa->tabname, tabname, UI_MAX_NAME_STR)==0)
break;
newpanel= (pa == NULL);
- if(!newpanel) {
+ if (!newpanel) {
pa->type= pt;
}
else {
@@ -200,8 +200,8 @@ Panel *uiBeginPanel(ScrArea *sa, ARegion *ar, uiBlock *block, PanelType *pt, int
BLI_strncpy(pa->panelname, idname, UI_MAX_NAME_STR);
BLI_strncpy(pa->tabname, tabname, UI_MAX_NAME_STR);
- if(pt->flag & PNL_DEFAULT_CLOSED) {
- if(align == BUT_VERTICAL)
+ if (pt->flag & PNL_DEFAULT_CLOSED) {
+ if (align == BUT_VERTICAL)
pa->flag |= PNL_CLOSEDY;
else
pa->flag |= PNL_CLOSEDX;
@@ -216,11 +216,11 @@ Panel *uiBeginPanel(ScrArea *sa, ARegion *ar, uiBlock *block, PanelType *pt, int
BLI_addtail(&ar->panels, pa);
/* make new Panel tabbed? */
- if(hookname) {
- for(patab= ar->panels.first; patab; patab= patab->next) {
- if((patab->runtime_flag & PNL_ACTIVE) && patab->paneltab==NULL) {
- if(strncmp(hookname, patab->panelname, UI_MAX_NAME_STR)==0) {
- if(strncmp(tabname, patab->tabname, UI_MAX_NAME_STR)==0) {
+ if (hookname) {
+ for (patab= ar->panels.first; patab; patab= patab->next) {
+ if ((patab->runtime_flag & PNL_ACTIVE) && patab->paneltab==NULL) {
+ if (strncmp(hookname, patab->panelname, UI_MAX_NAME_STR)==0) {
+ if (strncmp(tabname, patab->tabname, UI_MAX_NAME_STR)==0) {
pa->paneltab= patab;
ui_panel_copy_offset(pa, patab);
break;
@@ -236,19 +236,19 @@ Panel *uiBeginPanel(ScrArea *sa, ARegion *ar, uiBlock *block, PanelType *pt, int
/* if a new panel is added, we insert it right after the panel
* that was last added. this way new panels are inserted in the
* right place between versions */
- for(palast=ar->panels.first; palast; palast=palast->next)
- if(palast->runtime_flag & PNL_LAST_ADDED)
+ for (palast=ar->panels.first; palast; palast=palast->next)
+ if (palast->runtime_flag & PNL_LAST_ADDED)
break;
- if(newpanel) {
+ if (newpanel) {
pa->sortorder= (palast)? palast->sortorder+1: 0;
- for(panext=ar->panels.first; panext; panext=panext->next)
- if(panext != pa && panext->sortorder >= pa->sortorder)
+ for (panext=ar->panels.first; panext; panext=panext->next)
+ if (panext != pa && panext->sortorder >= pa->sortorder)
panext->sortorder++;
}
- if(palast)
+ if (palast)
palast->runtime_flag &= ~PNL_LAST_ADDED;
/* assign to block */
@@ -257,8 +257,8 @@ Panel *uiBeginPanel(ScrArea *sa, ARegion *ar, uiBlock *block, PanelType *pt, int
*open= 0;
- if(pa->paneltab) return pa;
- if(pa->flag & PNL_CLOSED) return pa;
+ if (pa->paneltab) return pa;
+ if (pa->flag & PNL_CLOSED) return pa;
*open= 1;
@@ -269,23 +269,23 @@ void uiEndPanel(uiBlock *block, int width, int height)
{
Panel *pa= block->panel;
- if(pa->runtime_flag & PNL_NEW_ADDED) {
+ if (pa->runtime_flag & PNL_NEW_ADDED) {
pa->runtime_flag &= ~PNL_NEW_ADDED;
pa->sizex= width;
pa->sizey= height;
}
else {
/* check if we need to do an animation */
- if(!ELEM(width, 0, pa->sizex) || !ELEM(height, 0, pa->sizey)) {
+ if (!ELEM(width, 0, pa->sizex) || !ELEM(height, 0, pa->sizey)) {
pa->runtime_flag |= PNL_ANIM_ALIGN;
- if(height != 0)
+ if (height != 0)
pa->ofsy += pa->sizey-height;
}
/* update width/height if non-zero */
- if(width != 0)
+ if (width != 0)
pa->sizex= width;
- if(height != 0)
+ if (height != 0)
pa->sizey= height;
}
}
@@ -301,7 +301,7 @@ static void ui_offset_panel_block(uiBlock *block)
ofsy= block->panel->sizey - style->panelspace;
- for(but= block->buttons.first; but; but=but->next) {
+ for (but= block->buttons.first; but; but=but->next) {
but->y1 += ofsy;
but->y2 += ofsy;
}
@@ -319,7 +319,7 @@ static void uiPanelPush(uiBlock *block)
{
glPushMatrix();
- if(block->panel)
+ if (block->panel)
glTranslatef((float)block->panel->ofsx, (float)block->panel->ofsy, 0.0);
}
@@ -332,10 +332,10 @@ static void uiPanelPop(uiBlock *UNUSED(block))
/* triangle 'icon' for panel header */
void UI_DrawTriIcon(float x, float y, char dir)
{
- if(dir=='h') {
+ if (dir=='h') {
ui_draw_anti_tria( x-3, y-5, x-3, y+5, x+7,y );
}
- else if(dir=='t') {
+ else if (dir=='t') {
ui_draw_anti_tria( x-5, y-7, x+5, y-7, x, y+3);
}
else { /* 'v' = vertical, down */
@@ -346,7 +346,7 @@ void UI_DrawTriIcon(float x, float y, char dir)
/* triangle 'icon' inside rect */
static void ui_draw_tria_rect(rctf *rect, char dir)
{
- if(dir=='h') {
+ if (dir=='h') {
float half= 0.5f*(rect->ymax - rect->ymin);
ui_draw_anti_tria(rect->xmin, rect->ymin, rect->xmin, rect->ymax, rect->xmax, rect->ymin+half);
}
@@ -444,7 +444,7 @@ static void ui_draw_aligned_panel_header(uiStyle *style, uiBlock *block, rcti *r
const char *activename = IFACE_(panel->drawname[0] ? panel->drawname : panel->panelname);
/* + 0.001f to avoid flirting with float inaccuracy */
- if(panel->control & UI_PNL_CLOSE) pnl_icons=(panel->labelofs+2*PNL_ICON+5)/block->aspect + 0.001f;
+ if (panel->control & UI_PNL_CLOSE) pnl_icons=(panel->labelofs+2*PNL_ICON+5)/block->aspect + 0.001f;
else pnl_icons= (panel->labelofs+PNL_ICON+5)/block->aspect + 0.001f;
/* active tab */
@@ -452,7 +452,7 @@ static void ui_draw_aligned_panel_header(uiStyle *style, uiBlock *block, rcti *r
UI_ThemeColor(TH_TITLE);
hrect= *rect;
- if(dir == 'h') {
+ if (dir == 'h') {
hrect.xmin = rect->xmin+pnl_icons;
hrect.ymin += 2.0f/block->aspect;
uiStyleFontDraw(&style->paneltitle, &hrect, activename);
@@ -488,8 +488,8 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
rctf itemrect;
int ofsx;
- if(panel->paneltab) return;
- if(panel->type && (panel->type->flag & PNL_NO_HEADER)) return;
+ if (panel->paneltab) return;
+ if (panel->type && (panel->type->flag & PNL_NO_HEADER)) return;
/* calculate header rect */
/* + 0.001f to prevent flicker due to float inaccuracy */
@@ -504,7 +504,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
glEnable(GL_BLEND);
- if(btheme->tui.panel.show_header) {
+ if (btheme->tui.panel.show_header) {
/* draw with background color */
glEnable(GL_BLEND);
glColor4ubv((unsigned char*)btheme->tui.panel.header);
@@ -513,7 +513,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
fdrawline(minx, y, maxx, y);
fdrawline(minx, y, maxx, y);
}
- else if(!(panel->runtime_flag & PNL_FIRST)) {
+ else if (!(panel->runtime_flag & PNL_FIRST)) {
/* draw embossed separator */
minx += 5.0f/block->aspect;
maxx -= 5.0f/block->aspect;
@@ -529,7 +529,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
}
/* horizontal title */
- if(!(panel->flag & PNL_CLOSEDX)) {
+ if (!(panel->flag & PNL_CLOSEDX)) {
ui_draw_aligned_panel_header(style, block, &headrect, 'h');
/* itemrect smaller */
@@ -545,10 +545,10 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
/* if the panel is minimized vertically:
* (------)
*/
- if(panel->flag & PNL_CLOSEDY) {
+ if (panel->flag & PNL_CLOSEDY) {
}
- else if(panel->flag & PNL_CLOSEDX) {
+ else if (panel->flag & PNL_CLOSEDX) {
/* draw vertical title */
ui_draw_aligned_panel_header(style, block, &headrect, 'v');
}
@@ -556,22 +556,22 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
else {
/* in some occasions, draw a border */
- if(panel->flag & PNL_SELECT) {
- if(panel->control & UI_PNL_SOLID) uiSetRoundBox(UI_CNR_ALL);
+ if (panel->flag & PNL_SELECT) {
+ if (panel->control & UI_PNL_SOLID) uiSetRoundBox(UI_CNR_ALL);
else uiSetRoundBox(UI_CNR_NONE);
UI_ThemeColorShade(TH_BACK, -120);
uiRoundRect(0.5f + rect->xmin, 0.5f + rect->ymin, 0.5f + rect->xmax, 0.5f + headrect.ymax+1, 8);
}
- if(panel->control & UI_PNL_SCALE)
+ if (panel->control & UI_PNL_SCALE)
ui_draw_panel_scalewidget(rect);
}
/* draw optional close icon */
ofsx= 6;
- if(panel->control & UI_PNL_CLOSE) {
+ if (panel->control & UI_PNL_CLOSE) {
UI_ThemeColor(TH_TEXT);
ui_draw_x_icon(rect->xmin+2+ofsx, rect->ymax+2);
@@ -589,9 +589,9 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
rectf_scale(&itemrect, 0.35f);
- if(panel->flag & PNL_CLOSEDY)
+ if (panel->flag & PNL_CLOSEDY)
ui_draw_tria_rect(&itemrect, 'h');
- else if(panel->flag & PNL_CLOSEDX)
+ else if (panel->flag & PNL_CLOSEDX)
ui_draw_tria_rect(&itemrect, 'h');
else
ui_draw_tria_rect(&itemrect, 'v');
@@ -603,7 +603,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
static int get_panel_header(Panel *pa)
{
- if(pa->type && (pa->type->flag & PNL_NO_HEADER))
+ if (pa->type && (pa->type->flag & PNL_NO_HEADER))
return 0;
return PNL_HEADER;
@@ -611,7 +611,7 @@ static int get_panel_header(Panel *pa)
static int get_panel_size_y(Panel *pa)
{
- if(pa->type && (pa->type->flag & PNL_NO_HEADER))
+ if (pa->type && (pa->type->flag & PNL_NO_HEADER))
return pa->sizey;
return PNL_HEADER + pa->sizey;
@@ -621,16 +621,16 @@ static int get_panel_size_y(Panel *pa)
* change sizey or location when closed */
static int get_panel_real_ofsy(Panel *pa)
{
- if(pa->flag & PNL_CLOSEDY) return pa->ofsy+pa->sizey;
- else if(pa->paneltab && (pa->paneltab->flag & PNL_CLOSEDY)) return pa->ofsy+pa->sizey;
- else if(pa->paneltab) return pa->paneltab->ofsy;
+ if (pa->flag & PNL_CLOSEDY) return pa->ofsy+pa->sizey;
+ else if (pa->paneltab && (pa->paneltab->flag & PNL_CLOSEDY)) return pa->ofsy+pa->sizey;
+ else if (pa->paneltab) return pa->paneltab->ofsy;
else return pa->ofsy;
}
static int get_panel_real_ofsx(Panel *pa)
{
- if(pa->flag & PNL_CLOSEDX) return pa->ofsx+get_panel_header(pa);
- else if(pa->paneltab && (pa->paneltab->flag & PNL_CLOSEDX)) return pa->ofsx+get_panel_header(pa);
+ if (pa->flag & PNL_CLOSEDX) return pa->ofsx+get_panel_header(pa);
+ else if (pa->paneltab && (pa->paneltab->flag & PNL_CLOSEDX)) return pa->ofsx+get_panel_header(pa);
else return pa->ofsx+pa->sizex;
}
@@ -648,10 +648,10 @@ static int find_leftmost_panel(const void *a1, const void *a2)
{
const PanelSort *ps1=a1, *ps2=a2;
- if(ps1->pa->ofsx > ps2->pa->ofsx) return 1;
- else if(ps1->pa->ofsx < ps2->pa->ofsx) return -1;
- else if(ps1->pa->sortorder > ps2->pa->sortorder) return 1;
- else if(ps1->pa->sortorder < ps2->pa->sortorder) return -1;
+ if (ps1->pa->ofsx > ps2->pa->ofsx) return 1;
+ else if (ps1->pa->ofsx < ps2->pa->ofsx) return -1;
+ else if (ps1->pa->sortorder > ps2->pa->sortorder) return 1;
+ else if (ps1->pa->sortorder < ps2->pa->sortorder) return -1;
return 0;
}
@@ -665,10 +665,10 @@ static int find_highest_panel(const void *a1, const void *a2)
* prevent them from being sorted */
if (ps1->pa->sortorder < ps2->pa->sortorder && ps1->pa->type->flag & PNL_NO_HEADER) return -1;
- if(ps1->pa->ofsy+ps1->pa->sizey < ps2->pa->ofsy+ps2->pa->sizey) return 1;
- else if(ps1->pa->ofsy+ps1->pa->sizey > ps2->pa->ofsy+ps2->pa->sizey) return -1;
- else if(ps1->pa->sortorder > ps2->pa->sortorder) return 1;
- else if(ps1->pa->sortorder < ps2->pa->sortorder) return -1;
+ if (ps1->pa->ofsy+ps1->pa->sizey < ps2->pa->ofsy+ps2->pa->sizey) return 1;
+ else if (ps1->pa->ofsy+ps1->pa->sizey > ps2->pa->ofsy+ps2->pa->sizey) return -1;
+ else if (ps1->pa->sortorder > ps2->pa->sortorder) return 1;
+ else if (ps1->pa->sortorder < ps2->pa->sortorder) return -1;
return 0;
}
@@ -677,8 +677,8 @@ static int compare_panel(const void *a1, const void *a2)
{
const PanelSort *ps1=a1, *ps2=a2;
- if(ps1->pa->sortorder > ps2->pa->sortorder) return 1;
- else if(ps1->pa->sortorder < ps2->pa->sortorder) return -1;
+ if (ps1->pa->sortorder > ps2->pa->sortorder) return 1;
+ else if (ps1->pa->sortorder < ps2->pa->sortorder) return -1;
return 0;
}
@@ -693,18 +693,18 @@ static int uiAlignPanelStep(ScrArea *sa, ARegion *ar, float fac, int drag)
int align= panel_aligned(sa, ar);
/* count active, not tabbed panels */
- for(pa= ar->panels.first; pa; pa= pa->next)
- if((pa->runtime_flag & PNL_ACTIVE) && pa->paneltab==NULL)
+ for (pa= ar->panels.first; pa; pa= pa->next)
+ if ((pa->runtime_flag & PNL_ACTIVE) && pa->paneltab==NULL)
tot++;
- if(tot==0) return 0;
+ if (tot==0) return 0;
/* extra; change close direction? */
- for(pa= ar->panels.first; pa; pa= pa->next) {
- if((pa->runtime_flag & PNL_ACTIVE) && pa->paneltab==NULL) {
- if((pa->flag & PNL_CLOSEDX) && (align==BUT_VERTICAL))
+ for (pa= ar->panels.first; pa; pa= pa->next) {
+ if ((pa->runtime_flag & PNL_ACTIVE) && pa->paneltab==NULL) {
+ if ((pa->flag & PNL_CLOSEDX) && (align==BUT_VERTICAL))
pa->flag ^= PNL_CLOSED;
- else if((pa->flag & PNL_CLOSEDY) && (align==BUT_HORIZONTAL))
+ else if ((pa->flag & PNL_CLOSEDY) && (align==BUT_HORIZONTAL))
pa->flag ^= PNL_CLOSED;
}
}
@@ -713,22 +713,22 @@ static int uiAlignPanelStep(ScrArea *sa, ARegion *ar, float fac, int drag)
panelsort= MEM_callocN(tot*sizeof(PanelSort), "panelsort");
ps= panelsort;
- for(pa= ar->panels.first; pa; pa= pa->next) {
- if((pa->runtime_flag & PNL_ACTIVE) && pa->paneltab==NULL) {
+ for (pa= ar->panels.first; pa; pa= pa->next) {
+ if ((pa->runtime_flag & PNL_ACTIVE) && pa->paneltab==NULL) {
ps->pa= MEM_dupallocN(pa);
ps->orig= pa;
ps++;
}
}
- if(drag) {
+ if (drag) {
/* while we are dragging, we sort on location and update sortorder */
- if(align==BUT_VERTICAL)
+ if (align==BUT_VERTICAL)
qsort(panelsort, tot, sizeof(PanelSort), find_highest_panel);
else
qsort(panelsort, tot, sizeof(PanelSort), find_leftmost_panel);
- for(ps=panelsort, a=0; a<tot; a++, ps++)
+ for (ps=panelsort, a=0; a<tot; a++, ps++)
ps->orig->sortorder= a;
}
else
@@ -740,10 +740,10 @@ static int uiAlignPanelStep(ScrArea *sa, ARegion *ar, float fac, int drag)
ps->pa->ofsx= 0;
ps->pa->ofsy= -get_panel_size_y(ps->pa);
- for(a=0; a<tot-1; a++, ps++) {
+ for (a=0; a<tot-1; a++, ps++) {
psnext= ps+1;
- if(align==BUT_VERTICAL) {
+ if (align==BUT_VERTICAL) {
psnext->pa->ofsx= ps->pa->ofsx;
psnext->pa->ofsy= get_panel_real_ofsy(ps->pa) - get_panel_size_y(psnext->pa);
}
@@ -756,9 +756,9 @@ static int uiAlignPanelStep(ScrArea *sa, ARegion *ar, float fac, int drag)
/* we interpolate */
done= 0;
ps= panelsort;
- for(a=0; a<tot; a++, ps++) {
- if((ps->pa->flag & PNL_SELECT)==0) {
- if((ps->orig->ofsx != ps->pa->ofsx) || (ps->orig->ofsy != ps->pa->ofsy)) {
+ for (a=0; a<tot; a++, ps++) {
+ if ((ps->pa->flag & PNL_SELECT)==0) {
+ if ((ps->orig->ofsx != ps->pa->ofsx) || (ps->orig->ofsy != ps->pa->ofsy)) {
ps->orig->ofsx= floorf(0.5f + fac*(float)ps->pa->ofsx + (1.0f-fac)*(float)ps->orig->ofsx);
ps->orig->ofsy= floorf(0.5f + fac*(float)ps->pa->ofsy + (1.0f-fac)*(float)ps->orig->ofsy);
done= 1;
@@ -767,8 +767,8 @@ static int uiAlignPanelStep(ScrArea *sa, ARegion *ar, float fac, int drag)
}
/* copy locations to tabs */
- for(pa= ar->panels.first; pa; pa= pa->next)
- if(pa->paneltab && (pa->runtime_flag & PNL_ACTIVE))
+ for (pa= ar->panels.first; pa; pa= pa->next)
+ if (pa->paneltab && (pa->runtime_flag & PNL_ACTIVE))
ui_panel_copy_offset(pa, pa->paneltab);
/* free panelsort array */
@@ -788,11 +788,11 @@ static void ui_panels_size(ScrArea *sa, ARegion *ar, int *x, int *y)
int sizey = UI_PANEL_WIDTH;
/* compute size taken up by panels, for setting in view2d */
- for(pa= ar->panels.first; pa; pa= pa->next) {
- if(pa->runtime_flag & PNL_ACTIVE) {
+ for (pa= ar->panels.first; pa; pa= pa->next) {
+ if (pa->runtime_flag & PNL_ACTIVE) {
int pa_sizex, pa_sizey;
- if(align==BUT_VERTICAL) {
+ if (align==BUT_VERTICAL) {
pa_sizex= pa->ofsx + pa->sizex;
pa_sizey= get_panel_real_ofsy(pa);
}
@@ -822,12 +822,12 @@ static void ui_do_animate(const bContext *C, Panel *panel)
fac= MIN2(fac, 1.0f);
/* for max 1 second, interpolate positions */
- if(uiAlignPanelStep(sa, ar, fac, 0))
+ if (uiAlignPanelStep(sa, ar, fac, 0))
ED_region_tag_redraw(ar);
else
fac= 1.0f;
- if(fac >= 1.0f) {
+ if (fac >= 1.0f) {
panel_activate_state(C, panel, PANEL_STATE_EXIT);
return;
}
@@ -839,8 +839,8 @@ void uiBeginPanels(const bContext *UNUSED(C), ARegion *ar)
/* set all panels as inactive, so that at the end we know
* which ones were used */
- for(pa=ar->panels.first; pa; pa=pa->next) {
- if(pa->runtime_flag & PNL_ACTIVE)
+ for (pa=ar->panels.first; pa; pa=pa->next) {
+ if (pa->runtime_flag & PNL_ACTIVE)
pa->runtime_flag= PNL_WAS_ACTIVE;
else
pa->runtime_flag= 0;
@@ -855,25 +855,25 @@ void uiEndPanels(const bContext *C, ARegion *ar, int *x, int *y)
Panel *panot, *panew, *patest, *pa, *firstpa;
/* offset contents */
- for(block= ar->uiblocks.first; block; block= block->next)
- if(block->active && block->panel)
+ for (block= ar->uiblocks.first; block; block= block->next)
+ if (block->active && block->panel)
ui_offset_panel_block(block);
/* consistency; are panels not made, whilst they have tabs */
- for(panot= ar->panels.first; panot; panot= panot->next) {
- if((panot->runtime_flag & PNL_ACTIVE)==0) { // not made
+ for (panot= ar->panels.first; panot; panot= panot->next) {
+ if ((panot->runtime_flag & PNL_ACTIVE)==0) { // not made
- for(panew= ar->panels.first; panew; panew= panew->next) {
- if((panew->runtime_flag & PNL_ACTIVE)) {
- if(panew->paneltab==panot) { // panew is tab in notmade pa
+ for (panew= ar->panels.first; panew; panew= panew->next) {
+ if ((panew->runtime_flag & PNL_ACTIVE)) {
+ if (panew->paneltab==panot) { // panew is tab in notmade pa
break;
}
}
}
/* now panew can become the new parent, check all other tabs */
- if(panew) {
- for(patest= ar->panels.first; patest; patest= patest->next) {
- if(patest->paneltab == panot) {
+ if (panew) {
+ for (patest= ar->panels.first; patest; patest= patest->next) {
+ if (patest->paneltab == panot) {
patest->paneltab= panew;
}
}
@@ -885,8 +885,8 @@ void uiEndPanels(const bContext *C, ARegion *ar, int *x, int *y)
}
/* re-align, possibly with animation */
- if(panels_re_align(sa, ar, &pa)) {
- if(pa)
+ if (panels_re_align(sa, ar, &pa)) {
+ if (pa)
panel_activate_state(C, pa, PANEL_STATE_ANIMATION);
else
uiAlignPanelStep(sa, ar, 1.0, 0);
@@ -894,12 +894,12 @@ void uiEndPanels(const bContext *C, ARegion *ar, int *x, int *y)
/* tag first panel */
firstpa= NULL;
- for(block= ar->uiblocks.first; block; block=block->next)
- if(block->active && block->panel)
- if(!firstpa || block->panel->sortorder < firstpa->sortorder)
+ for (block= ar->uiblocks.first; block; block=block->next)
+ if (block->active && block->panel)
+ if (!firstpa || block->panel->sortorder < firstpa->sortorder)
firstpa= block->panel;
- if(firstpa)
+ if (firstpa)
firstpa->runtime_flag |= PNL_FIRST;
/* compute size taken up by panel */
@@ -913,14 +913,14 @@ void uiDrawPanels(const bContext *C, ARegion *ar)
UI_ThemeClearColor(TH_BACK);
/* draw panels, selected on top */
- for(block= ar->uiblocks.first; block; block=block->next) {
- if(block->active && block->panel && !(block->panel->flag & PNL_SELECT)) {
+ for (block= ar->uiblocks.first; block; block=block->next) {
+ if (block->active && block->panel && !(block->panel->flag & PNL_SELECT)) {
uiDrawBlock(C, block);
}
}
- for(block= ar->uiblocks.first; block; block=block->next) {
- if(block->active && block->panel && (block->panel->flag & PNL_SELECT)) {
+ for (block= ar->uiblocks.first; block; block=block->next) {
+ if (block->active && block->panel && (block->panel->flag & PNL_SELECT)) {
uiDrawBlock(C, block);
}
}
@@ -934,21 +934,21 @@ static void check_panel_overlap(ARegion *ar, Panel *panel)
/* also called with panel==NULL for clear */
- for(pa=ar->panels.first; pa; pa=pa->next) {
+ for (pa=ar->panels.first; pa; pa=pa->next) {
pa->flag &= ~PNL_OVERLAP;
- if(panel && (pa != panel)) {
- if(pa->paneltab==NULL && (pa->runtime_flag & PNL_ACTIVE)) {
+ if (panel && (pa != panel)) {
+ if (pa->paneltab==NULL && (pa->runtime_flag & PNL_ACTIVE)) {
float safex= 0.2, safey= 0.2;
- if(pa->flag & PNL_CLOSEDX) safex= 0.05;
- else if(pa->flag & PNL_CLOSEDY) safey= 0.05;
- else if(panel->flag & PNL_CLOSEDX) safex= 0.05;
- else if(panel->flag & PNL_CLOSEDY) safey= 0.05;
+ if (pa->flag & PNL_CLOSEDX) safex= 0.05;
+ else if (pa->flag & PNL_CLOSEDY) safey= 0.05;
+ else if (panel->flag & PNL_CLOSEDX) safex= 0.05;
+ else if (panel->flag & PNL_CLOSEDY) safey= 0.05;
- if(pa->ofsx > panel->ofsx- safex*panel->sizex)
- if(pa->ofsx+pa->sizex < panel->ofsx+ (1.0f+safex)*panel->sizex)
- if(pa->ofsy > panel->ofsy- safey*panel->sizey)
- if(pa->ofsy+pa->sizey < panel->ofsy+ (1.0f+safey)*panel->sizey)
+ if (pa->ofsx > panel->ofsx- safex*panel->sizex)
+ if (pa->ofsx+pa->sizex < panel->ofsx+ (1.0f+safex)*panel->sizex)
+ if (pa->ofsy > panel->ofsy- safey*panel->sizey)
+ if (pa->ofsy+pa->sizey < panel->ofsy+ (1.0f+safey)*panel->sizey)
pa->flag |= PNL_OVERLAP;
}
}
@@ -965,7 +965,7 @@ static void ui_do_drag(const bContext *C, wmEvent *event, Panel *panel)
short align= panel_aligned(sa, ar), dx=0, dy=0;
/* first clip for window, no dragging outside */
- if(!BLI_in_rcti(&ar->winrct, event->x, event->y))
+ if (!BLI_in_rcti(&ar->winrct, event->x, event->y))
return;
dx= (event->x-data->startx) & ~(PNL_GRID-1);
@@ -974,10 +974,10 @@ static void ui_do_drag(const bContext *C, wmEvent *event, Panel *panel)
dx *= (float)(ar->v2d.cur.xmax - ar->v2d.cur.xmin)/(float)(ar->winrct.xmax - ar->winrct.xmin);
dy *= (float)(ar->v2d.cur.ymax - ar->v2d.cur.ymin)/(float)(ar->winrct.ymax - ar->winrct.ymin);
- if(data->state == PANEL_STATE_DRAG_SCALE) {
+ if (data->state == PANEL_STATE_DRAG_SCALE) {
panel->sizex = MAX2(data->startsizex+dx, UI_PANEL_MINX);
- if(data->startsizey-dy < UI_PANEL_MINY)
+ if (data->startsizey-dy < UI_PANEL_MINY)
dy= -UI_PANEL_MINY+data->startsizey;
panel->sizey= data->startsizey-dy;
@@ -991,7 +991,7 @@ static void ui_do_drag(const bContext *C, wmEvent *event, Panel *panel)
panel->ofsy = data->startofsy+dy;
check_panel_overlap(ar, panel);
- if(align) uiAlignPanelStep(sa, ar, 0.2, 1);
+ if (align) uiAlignPanelStep(sa, ar, 0.2, 1);
}
ED_region_tag_redraw(ar);
@@ -1014,34 +1014,34 @@ static void ui_handle_panel_header(const bContext *C, uiBlock *block, int mx, in
/* XXX weak code, currently it assumes layout style for location of widgets */
/* check open/collapsed button */
- if(event==RETKEY)
+ if (event==RETKEY)
button= 1;
- else if(event==AKEY)
+ else if (event==AKEY)
button= 1;
- else if(block->panel->flag & PNL_CLOSEDX) {
- if(my >= block->maxy) button= 1;
+ else if (block->panel->flag & PNL_CLOSEDX) {
+ if (my >= block->maxy) button= 1;
}
- else if(block->panel->control & UI_PNL_CLOSE) {
+ else if (block->panel->control & UI_PNL_CLOSE) {
/* whole of header can be used to collapse panel (except top-right corner) */
- if(mx <= block->maxx-8-PNL_ICON) button= 2;
- //else if(mx <= block->minx+10+2*PNL_ICON+2) button= 1;
+ if (mx <= block->maxx-8-PNL_ICON) button= 2;
+ //else if (mx <= block->minx+10+2*PNL_ICON+2) button= 1;
}
- else if(mx <= block->maxx-PNL_ICON-12) {
+ else if (mx <= block->maxx-PNL_ICON-12) {
button= 1;
}
- if(button) {
- if(button==2) { // close
+ if (button) {
+ if (button==2) { // close
ED_region_tag_redraw(ar);
}
else { // collapse
- if(block->panel->flag & PNL_CLOSED) {
+ if (block->panel->flag & PNL_CLOSED) {
block->panel->flag &= ~PNL_CLOSED;
/* snap back up so full panel aligns with screen edge */
if (block->panel->snap & PNL_SNAP_BOTTOM)
block->panel->ofsy= 0;
}
- else if(align==BUT_HORIZONTAL) {
+ else if (align==BUT_HORIZONTAL) {
block->panel->flag |= PNL_CLOSEDX;
}
else {
@@ -1051,20 +1051,20 @@ static void ui_handle_panel_header(const bContext *C, uiBlock *block, int mx, in
block->panel->ofsy= -block->panel->sizey;
}
- for(pa= ar->panels.first; pa; pa= pa->next) {
- if(pa->paneltab==block->panel) {
- if(block->panel->flag & PNL_CLOSED) pa->flag |= PNL_CLOSED;
+ for (pa= ar->panels.first; pa; pa= pa->next) {
+ if (pa->paneltab==block->panel) {
+ if (block->panel->flag & PNL_CLOSED) pa->flag |= PNL_CLOSED;
else pa->flag &= ~PNL_CLOSED;
}
}
}
- if(align)
+ if (align)
panel_activate_state(C, block->panel, PANEL_STATE_ANIMATION);
else
ED_region_tag_redraw(ar);
}
- else if(mx <= (block->maxx-PNL_ICON-12)+PNL_ICON+2) {
+ else if (mx <= (block->maxx-PNL_ICON-12)+PNL_ICON+2) {
panel_activate_state(C, block->panel, PANEL_STATE_DRAG);
}
}
@@ -1080,7 +1080,7 @@ int ui_handler_panel_region(bContext *C, wmEvent *event)
int retval, mx, my, inside_header= 0, inside_scale= 0, inside;
retval= WM_UI_HANDLER_CONTINUE;
- for(block=ar->uiblocks.last; block; block=block->prev) {
+ for (block=ar->uiblocks.last; block; block=block->prev) {
mx= event->x;
my= event->y;
ui_window_to_block(ar, block, &mx, &my);
@@ -1089,20 +1089,20 @@ int ui_handler_panel_region(bContext *C, wmEvent *event)
inside= 0;
pa= block->panel;
- if(!pa || pa->paneltab!=NULL)
+ if (!pa || pa->paneltab!=NULL)
continue;
- if(pa->type && pa->type->flag & PNL_NO_HEADER) // XXX - accessed freed panels when scripts reload, need to fix.
+ if (pa->type && pa->type->flag & PNL_NO_HEADER) // XXX - accessed freed panels when scripts reload, need to fix.
continue;
- if(block->minx <= mx && block->maxx >= mx)
- if(block->miny <= my && block->maxy+PNL_HEADER >= my)
+ if (block->minx <= mx && block->maxx >= mx)
+ if (block->miny <= my && block->maxy+PNL_HEADER >= my)
inside= 1;
- if(inside && event->val==KM_PRESS) {
- if(event->type == AKEY && !ELEM4(KM_MOD_FIRST, event->ctrl, event->oskey, event->shift, event->alt)) {
+ if (inside && event->val==KM_PRESS) {
+ if (event->type == AKEY && !ELEM4(KM_MOD_FIRST, event->ctrl, event->oskey, event->shift, event->alt)) {
- if(pa->flag & PNL_CLOSEDY) {
- if((block->maxy <= my) && (block->maxy+PNL_HEADER >= my))
+ if (pa->flag & PNL_CLOSEDY) {
+ if ((block->maxy <= my) && (block->maxy+PNL_HEADER >= my))
ui_handle_panel_header(C, block, mx, my, event->type);
}
else
@@ -1113,53 +1113,53 @@ int ui_handler_panel_region(bContext *C, wmEvent *event)
}
/* on active button, do not handle panels */
- if(ui_button_is_active(ar))
+ if (ui_button_is_active(ar))
continue;
- if(inside) {
+ if (inside) {
/* clicked at panel header? */
- if(pa->flag & PNL_CLOSEDX) {
- if(block->minx <= mx && block->minx+PNL_HEADER >= mx)
+ if (pa->flag & PNL_CLOSEDX) {
+ if (block->minx <= mx && block->minx+PNL_HEADER >= mx)
inside_header= 1;
}
- else if((block->maxy <= my) && (block->maxy+PNL_HEADER >= my)) {
+ else if ((block->maxy <= my) && (block->maxy+PNL_HEADER >= my)) {
inside_header= 1;
}
- else if(pa->control & UI_PNL_SCALE) {
- if(block->maxx-PNL_HEADER <= mx)
- if(block->miny+PNL_HEADER >= my)
+ else if (pa->control & UI_PNL_SCALE) {
+ if (block->maxx-PNL_HEADER <= mx)
+ if (block->miny+PNL_HEADER >= my)
inside_scale= 1;
}
- if(event->val==KM_PRESS) {
+ if (event->val==KM_PRESS) {
/* open close on header */
- if(ELEM(event->type, RETKEY, PADENTER)) {
- if(inside_header) {
+ if (ELEM(event->type, RETKEY, PADENTER)) {
+ if (inside_header) {
ui_handle_panel_header(C, block, mx, my, RETKEY);
break;
}
}
- else if(event->type == LEFTMOUSE) {
- if(inside_header) {
+ else if (event->type == LEFTMOUSE) {
+ if (inside_header) {
ui_handle_panel_header(C, block, mx, my, 0);
break;
}
- else if(inside_scale && !(pa->flag & PNL_CLOSED)) {
+ else if (inside_scale && !(pa->flag & PNL_CLOSED)) {
panel_activate_state(C, pa, PANEL_STATE_DRAG_SCALE);
break;
}
}
- else if(event->type == ESCKEY) {
+ else if (event->type == ESCKEY) {
/*XXX 2.50*/
#if 0
- if(block->handler) {
+ if (block->handler) {
rem_blockhandler(sa, block->handler);
ED_region_tag_redraw(ar);
retval= WM_UI_HANDLER_BREAK;
}
#endif
}
- else if(event->type==PADPLUSKEY || event->type==PADMINUS) {
+ else if (event->type==PADPLUSKEY || event->type==PADMINUS) {
#if 0 // XXX make float panel exception?
int zoom=0;
@@ -1171,13 +1171,13 @@ int ui_handler_panel_region(bContext *C, wmEvent *event)
else
zoom=1;
- if(zoom) {
+ if (zoom) {
ScrArea *sa= CTX_wm_area(C);
SpaceLink *sl= sa->spacedata.first;
- if(sa->spacetype!=SPACE_BUTS) {
- if(!(pa->control & UI_PNL_SCALE)) {
- if(event->type==PADPLUSKEY) sl->blockscale+= 0.1;
+ if (sa->spacetype!=SPACE_BUTS) {
+ if (!(pa->control & UI_PNL_SCALE)) {
+ if (event->type==PADPLUSKEY) sl->blockscale+= 0.1;
else sl->blockscale-= 0.1;
CLAMP(sl->blockscale, 0.6, 1.0);
@@ -1204,30 +1204,30 @@ static int ui_handler_panel(bContext *C, wmEvent *event, void *userdata)
uiHandlePanelData *data= panel->activedata;
/* verify if we can stop */
- if(event->type == LEFTMOUSE && event->val!=KM_PRESS) {
+ if (event->type == LEFTMOUSE && event->val!=KM_PRESS) {
ScrArea *sa= CTX_wm_area(C);
ARegion *ar= CTX_wm_region(C);
int align= panel_aligned(sa, ar);
- if(align)
+ if (align)
panel_activate_state(C, panel, PANEL_STATE_ANIMATION);
else
panel_activate_state(C, panel, PANEL_STATE_EXIT);
}
- else if(event->type == MOUSEMOVE) {
- if(data->state == PANEL_STATE_DRAG)
+ else if (event->type == MOUSEMOVE) {
+ if (data->state == PANEL_STATE_DRAG)
ui_do_drag(C, event, panel);
}
- else if(event->type == TIMER && event->customdata == data->animtimer) {
- if(data->state == PANEL_STATE_ANIMATION)
+ else if (event->type == TIMER && event->customdata == data->animtimer) {
+ if (data->state == PANEL_STATE_ANIMATION)
ui_do_animate(C, panel);
- else if(data->state == PANEL_STATE_DRAG)
+ else if (data->state == PANEL_STATE_DRAG)
ui_do_drag(C, event, panel);
}
data= panel->activedata;
- if(data && data->state == PANEL_STATE_ANIMATION)
+ if (data && data->state == PANEL_STATE_ANIMATION)
return WM_UI_HANDLER_CONTINUE;
else
return WM_UI_HANDLER_BREAK;
@@ -1246,11 +1246,11 @@ static void panel_activate_state(const bContext *C, Panel *pa, uiHandlePanelStat
wmWindow *win= CTX_wm_window(C);
ARegion *ar= CTX_wm_region(C);
- if(data && data->state == state)
+ if (data && data->state == state)
return;
- if(state == PANEL_STATE_EXIT || state == PANEL_STATE_ANIMATION) {
- if(data && data->state != PANEL_STATE_ANIMATION) {
+ if (state == PANEL_STATE_EXIT || state == PANEL_STATE_ANIMATION) {
+ if (data && data->state != PANEL_STATE_ANIMATION) {
/* XXX:
* - the panel tabbing function call below (test_add_new_tabs()) has been commented out
* "It is too easy to do by accident when reordering panels, is very hard to control and use, and has no real benefit." - BillRey
@@ -1265,26 +1265,26 @@ static void panel_activate_state(const bContext *C, Panel *pa, uiHandlePanelStat
else
pa->flag |= PNL_SELECT;
- if(data && data->animtimer) {
+ if (data && data->animtimer) {
WM_event_remove_timer(CTX_wm_manager(C), win, data->animtimer);
data->animtimer= NULL;
}
- if(state == PANEL_STATE_EXIT) {
+ if (state == PANEL_STATE_EXIT) {
MEM_freeN(data);
pa->activedata= NULL;
WM_event_remove_ui_handler(&win->modalhandlers, ui_handler_panel, ui_handler_remove_panel, pa, 0);
}
else {
- if(!data) {
+ if (!data) {
data= MEM_callocN(sizeof(uiHandlePanelData), "uiHandlePanelData");
pa->activedata= data;
WM_event_add_ui_handler(C, &win->modalhandlers, ui_handler_panel, ui_handler_remove_panel, pa);
}
- if(ELEM(state, PANEL_STATE_ANIMATION, PANEL_STATE_DRAG))
+ if (ELEM(state, PANEL_STATE_ANIMATION, PANEL_STATE_DRAG))
data->animtimer= WM_event_add_timer(CTX_wm_manager(C), win, TIMER, ANIMATION_INTERVAL);
data->state= state;
@@ -1301,15 +1301,15 @@ static void panel_activate_state(const bContext *C, Panel *pa, uiHandlePanelStat
/* XXX exception handling, 3d window preview panel */
#if 0
- if(block->drawextra==BIF_view3d_previewdraw)
+ if (block->drawextra==BIF_view3d_previewdraw)
BIF_view3d_previewrender_clear(curarea);
#endif
/* XXX exception handling, 3d window preview panel */
#if 0
- if(block->drawextra==BIF_view3d_previewdraw)
+ if (block->drawextra==BIF_view3d_previewdraw)
BIF_view3d_previewrender_signal(curarea, PR_DISPRECT);
- else if(strcmp(block->name, "image_panel_preview")==0)
+ else if (strcmp(block->name, "image_panel_preview")==0)
image_preview_event(2);
#endif
}
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index b375b8d154f..ef6cbc9ae48 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -174,32 +174,36 @@ static MenuData *decompose_menu_string(const char *str)
*s= '\0';
s++;
- } else if (s[1]=='t') {
+ }
+ else if (s[1]=='t') {
nitem_is_title= (s != instr); /* check for empty title */
*s= '\0';
s++;
- } else if (s[1]=='l') {
+ }
+ else if (s[1]=='l') {
nitem_is_sepr= 1;
- if(!nitem) nitem= "";
+ if (!nitem) nitem= "";
*s= '\0';
s++;
- } else if (s[1]=='i') {
+ }
+ else if (s[1]=='i') {
nicon= atoi(s+2);
*s= '\0';
s++;
}
- } else if (c=='|' || c == '\n' || c=='\0') {
+ }
+ else if (c=='|' || c == '\n' || c=='\0') {
if (nitem) {
*s= '\0';
- if(nitem_is_title) {
+ if (nitem_is_title) {
menudata_set_title(md, nitem, nicon);
nitem_is_title= 0;
}
- else if(nitem_is_sepr) {
+ else if (nitem_is_sepr) {
/* prevent separator to get a value */
menudata_add_item(md, nitem, -1, nicon, 1);
nretval= md->nitems+1;
@@ -217,7 +221,8 @@ static MenuData *decompose_menu_string(const char *str)
if (c=='\0') {
break;
}
- } else if (!nitem) {
+ }
+ else if (!nitem) {
nitem= s;
}
@@ -254,20 +259,20 @@ int ui_step_name_menu(uiBut *but, int step)
if (md->items[i].retval==value)
break;
- if(step==1) {
+ if (step==1) {
/* skip separators */
- for(; i<md->nitems-1; i++) {
- if(md->items[i+1].retval != -1) {
+ for (; i<md->nitems-1; i++) {
+ if (md->items[i+1].retval != -1) {
value= md->items[i+1].retval;
break;
}
}
}
else {
- if(i>0) {
+ if (i>0) {
/* skip separators */
- for(; i>0; i--) {
- if(md->items[i-1].retval != -1) {
+ for (; i>0; i--) {
+ if (md->items[i-1].retval != -1) {
value= md->items[i-1].retval;
break;
}
@@ -298,7 +303,7 @@ static ARegion *ui_add_temporary_region(bScreen *sc)
static void ui_remove_temporary_region(bContext *C, bScreen *sc, ARegion *ar)
{
- if(CTX_wm_window(C))
+ if (CTX_wm_window(C))
wm_draw_region_clear(CTX_wm_window(C), ar);
ED_region_exit(C, ar);
@@ -418,31 +423,31 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
float x1f, x2f, y1f, y2f;
int x1, x2, y1, y2, winx, winy, ofsx, ofsy, w, h, a;
- if(but->flag & UI_BUT_NO_TOOLTIP)
+ if (but->flag & UI_BUT_NO_TOOLTIP)
return NULL;
/* create tooltip data */
data= MEM_callocN(sizeof(uiTooltipData), "uiTooltipData");
/* special case, enum rna buttons only have enum item description, use general enum description too before the specific one */
- if(but->rnaprop && RNA_property_type(but->rnaprop) == PROP_ENUM) {
+ if (but->rnaprop && RNA_property_type(but->rnaprop) == PROP_ENUM) {
const char *descr= RNA_property_description(but->rnaprop);
- if(descr && descr[0]) {
+ if (descr && descr[0]) {
BLI_strncpy(data->lines[data->totline], descr, sizeof(data->lines[0]));
data->color_id[data->totline] = UI_TIP_LC_MAIN;
data->totline++;
}
- if(ELEM(but->type, ROW, MENU)) {
+ if (ELEM(but->type, ROW, MENU)) {
EnumPropertyItem *item;
int i, totitem, free;
int value = (but->type == ROW)? but->hardmax: ui_get_but_val(but);
RNA_property_enum_items_gettexted(C, &but->rnapoin, but->rnaprop, &item, &totitem, &free);
- for(i=0; i<totitem; i++) {
- if(item[i].identifier[0] && item[i].value == value) {
- if(item[i].description && item[i].description[0]) {
+ for (i=0; i<totitem; i++) {
+ if (item[i].identifier[0] && item[i].value == value) {
+ if (item[i].description && item[i].description[0]) {
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "%s: %s", item[i].name, item[i].description);
data->color_id[data->totline] = UI_TIP_LC_SUBMENU;
data->totline++;
@@ -457,17 +462,17 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
}
}
- if(but->tip && but->tip[0] != '\0') {
+ if (but->tip && but->tip[0] != '\0') {
BLI_strncpy(data->lines[data->totline], but->tip, sizeof(data->lines[0]));
data->color_id[data->totline] = UI_TIP_LC_MAIN;
data->totline++;
}
- if(but->optype && !(but->block->flag & UI_BLOCK_LOOP)) {
+ if (but->optype && !(but->block->flag & UI_BLOCK_LOOP)) {
/* operator keymap (not menus, they already have it) */
prop= (but->opptr)? but->opptr->data: NULL;
- if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, TRUE,
+ if (WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, TRUE,
buf, sizeof(buf)))
{
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Shortcut: %s"), buf);
@@ -476,17 +481,17 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
}
}
- if(ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) {
+ if (ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) {
/* full string */
ui_get_but_string(but, buf, sizeof(buf));
- if(buf[0]) {
+ if (buf[0]) {
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Value: %s"), buf);
data->color_id[data->totline] = UI_TIP_LC_NORMAL;
data->totline++;
}
}
- if(but->rnaprop) {
+ if (but->rnaprop) {
int unit_type= uiButGetUnitType(but);
if (unit_type == PROP_UNIT_ROTATION) {
@@ -498,8 +503,8 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
}
}
- if(but->flag & UI_BUT_DRIVEN) {
- if(ui_but_anim_expression_get(but, buf, sizeof(buf))) {
+ if (but->flag & UI_BUT_DRIVEN) {
+ if (ui_but_anim_expression_get(but, buf, sizeof(buf))) {
/* expression */
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Expression: %s"), buf);
data->color_id[data->totline] = UI_TIP_LC_NORMAL;
@@ -514,9 +519,9 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
data->totline++;
}
- if(but->rnapoin.id.data) {
+ if (but->rnapoin.id.data) {
ID *id= but->rnapoin.id.data;
- if(id->lib && id->lib->name) {
+ if (id->lib && id->lib->name) {
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Library: %s"), id->lib->name);
data->color_id[data->totline] = UI_TIP_LC_NORMAL;
data->totline++;
@@ -540,12 +545,12 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
MEM_freeN(str);
/* second check if we are disabled - why */
- if(but->flag & UI_BUT_DISABLED) {
+ if (but->flag & UI_BUT_DISABLED) {
const char *poll_msg;
CTX_wm_operator_poll_msg_set(C, NULL);
WM_operator_poll_context(C, but->optype, but->opcontext);
poll_msg= CTX_wm_operator_poll_msg_get(C);
- if(poll_msg) {
+ if (poll_msg) {
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Disabled: %s"), poll_msg);
data->color_id[data->totline] = UI_TIP_LC_ALERT; /* alert */
data->totline++;
@@ -566,7 +571,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
assert(data->totline < MAX_TOOLTIP_LINES);
- if(data->totline == 0) {
+ if (data->totline == 0) {
MEM_freeN(data);
return NULL;
}
@@ -591,7 +596,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
h= BLF_height_max(data->fstyle.uifont_id);
- for(a=0, fontw=0, fonth=0; a<data->totline; a++) {
+ for (a=0, fontw=0, fonth=0; a<data->totline; a++) {
w= BLF_width(data->fstyle.uifont_id, data->lines[a]);
fontw= MAX2(fontw, w);
fonth += (a == 0)? h: h+TIP_MARGIN_Y;
@@ -622,9 +627,9 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
/* copy to int, gets projected if possible too */
x1= x1f; y1= y1f; x2= x2f; y2= y2f;
- if(butregion) {
+ if (butregion) {
/* XXX temp, region v2ds can be empty still */
- if(butregion->v2d.cur.xmin != butregion->v2d.cur.xmax) {
+ if (butregion->v2d.cur.xmin != butregion->v2d.cur.xmax) {
UI_view2d_to_region_no_clip(&butregion->v2d, x1f, y1f, &x1, &y1);
UI_view2d_to_region_no_clip(&butregion->v2d, x2f, y2f, &x2, &y2);
}
@@ -637,9 +642,9 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
wm_window_get_size(CTX_wm_window(C), &winx, &winy);
- if(x2 > winx) {
+ if (x2 > winx) {
/* super size */
- if(x2 > winx + x1) {
+ if (x2 > winx + x1) {
x2= winx;
x1= 0;
}
@@ -650,7 +655,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
}
/* ensure at least 5 px above screen bounds
* 25 is just a guess to be above the menu item */
- if(y1 < 5) {
+ if (y1 < 5) {
y2 += (-y1) + 30;
y1 = 30;
}
@@ -715,35 +720,35 @@ typedef struct uiSearchboxData {
int uiSearchItemAdd(uiSearchItems *items, const char *name, void *poin, int iconid)
{
/* hijack for autocomplete */
- if(items->autocpl) {
+ if (items->autocpl) {
autocomplete_do_name(items->autocpl, name);
return 1;
}
/* hijack for finding active item */
- if(items->active) {
- if(poin==items->active)
+ if (items->active) {
+ if (poin==items->active)
items->offset_i= items->totitem;
items->totitem++;
return 1;
}
- if(items->totitem>=items->maxitem) {
+ if (items->totitem>=items->maxitem) {
items->more= 1;
return 0;
}
/* skip first items in list */
- if(items->offset_i > 0) {
+ if (items->offset_i > 0) {
items->offset_i--;
return 1;
}
- if(items->names)
+ if (items->names)
BLI_strncpy(items->names[items->totitem], name, items->maxstrlen);
- if(items->pointers)
+ if (items->pointers)
items->pointers[items->totitem]= poin;
- if(items->icons)
+ if (items->icons)
items->icons[items->totitem]= iconid;
items->totitem++;
@@ -764,10 +769,10 @@ static void ui_searchbox_select(bContext *C, ARegion *ar, uiBut *but, int step)
/* apply step */
data->active+= step;
- if(data->items.totitem==0)
+ if (data->items.totitem==0)
data->active= 0;
- else if(data->active > data->items.totitem) {
- if(data->items.more) {
+ else if (data->active > data->items.totitem) {
+ if (data->items.more) {
data->items.offset++;
data->active= data->items.totitem;
ui_searchbox_update(C, ar, but, 0);
@@ -775,13 +780,13 @@ static void ui_searchbox_select(bContext *C, ARegion *ar, uiBut *but, int step)
else
data->active= data->items.totitem;
}
- else if(data->active < 1) {
- if(data->items.offset) {
+ else if (data->active < 1) {
+ if (data->items.offset) {
data->items.offset--;
data->active= 1;
ui_searchbox_update(C, ar, but, 0);
}
- else if(data->active < 0)
+ else if (data->active < 0)
data->active= 0;
}
@@ -836,13 +841,13 @@ void ui_searchbox_apply(uiBut *but, ARegion *ar)
but->func_arg2= NULL;
- if(data->active) {
+ if (data->active) {
char *name= data->items.names[data->active-1];
char *cpoin= strchr(name, '|');
- if(cpoin) cpoin[0]= 0;
+ if (cpoin) cpoin[0]= 0;
BLI_strncpy(but->editstr, name, data->items.maxstrlen);
- if(cpoin) cpoin[0]= '|';
+ if (cpoin) cpoin[0]= '|';
but->func_arg2= data->items.pointers[data->active-1];
}
@@ -862,14 +867,14 @@ void ui_searchbox_event(bContext *C, ARegion *ar, uiBut *but, wmEvent *event)
ui_searchbox_select(C, ar, but, 1);
break;
case MOUSEMOVE:
- if(BLI_in_rcti(&ar->winrct, event->x, event->y)) {
+ if (BLI_in_rcti(&ar->winrct, event->x, event->y)) {
rcti rect;
int a;
- for(a=0; a<data->items.totitem; a++) {
+ for (a=0; a<data->items.totitem; a++) {
ui_searchbox_butrect(&rect, data, a);
- if(BLI_in_rcti(&rect, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin)) {
- if( data->active!= a+1) {
+ if (BLI_in_rcti(&rect, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin)) {
+ if ( data->active!= a+1) {
data->active= a+1;
ui_searchbox_select(C, ar, but, 0);
break;
@@ -889,7 +894,7 @@ void ui_searchbox_update(bContext *C, ARegion *ar, uiBut *but, int reset)
/* reset vars */
data->items.totitem= 0;
data->items.more= 0;
- if(reset==0) {
+ if (reset==0) {
data->items.offset_i= data->items.offset;
}
else {
@@ -897,21 +902,21 @@ void ui_searchbox_update(bContext *C, ARegion *ar, uiBut *but, int reset)
data->active= 0;
/* handle active */
- if(but->search_func && but->func_arg2) {
+ if (but->search_func && but->func_arg2) {
data->items.active= but->func_arg2;
but->search_func(C, but->search_arg, but->editstr, &data->items);
data->items.active= NULL;
/* found active item, calculate real offset by centering it */
- if(data->items.totitem) {
+ if (data->items.totitem) {
/* first case, begin of list */
- if(data->items.offset_i < data->items.maxitem) {
+ if (data->items.offset_i < data->items.maxitem) {
data->active= data->items.offset_i+1;
data->items.offset_i= 0;
}
else {
/* second case, end of list */
- if(data->items.totitem - data->items.offset_i <= data->items.maxitem) {
+ if (data->items.totitem - data->items.offset_i <= data->items.maxitem) {
data->active= 1 + data->items.offset_i - data->items.totitem + data->items.maxitem;
data->items.offset_i= data->items.totitem - data->items.maxitem;
}
@@ -928,22 +933,22 @@ void ui_searchbox_update(bContext *C, ARegion *ar, uiBut *but, int reset)
}
/* callback */
- if(but->search_func)
+ if (but->search_func)
but->search_func(C, but->search_arg, but->editstr, &data->items);
/* handle case where editstr is equal to one of items */
- if(reset && data->active==0) {
+ if (reset && data->active==0) {
int a;
- for(a=0; a<data->items.totitem; a++) {
+ for (a=0; a<data->items.totitem; a++) {
char *cpoin= strchr(data->items.names[a], '|');
- if(cpoin) cpoin[0]= 0;
- if(0==strcmp(but->editstr, data->items.names[a]))
+ if (cpoin) cpoin[0]= 0;
+ if (0==strcmp(but->editstr, data->items.names[a]))
data->active= a+1;
- if(cpoin) cpoin[0]= '|';
+ if (cpoin) cpoin[0]= '|';
}
- if(data->items.totitem==1 && but->editstr[0])
+ if (data->items.totitem==1 && but->editstr[0])
data->active= 1;
}
@@ -957,7 +962,7 @@ void ui_searchbox_autocomplete(bContext *C, ARegion *ar, uiBut *but, char *str)
{
uiSearchboxData *data= ar->regiondata;
- if(str[0]) {
+ if (str[0]) {
data->items.autocpl= autocomplete_begin(str, ui_get_but_string_max_length(but));
but->search_func(C, but->search_arg, but->editstr, &data->items);
@@ -974,17 +979,17 @@ static void ui_searchbox_region_draw_cb(const bContext *UNUSED(C), ARegion *ar)
/* pixel space */
wmOrtho2(-0.01f, ar->winx-0.01f, -0.01f, ar->winy-0.01f);
- if(!data->noback)
+ if (!data->noback)
ui_draw_search_back(NULL, NULL, &data->bbox); /* style not used yet */
/* draw text */
- if(data->items.totitem) {
+ if (data->items.totitem) {
rcti rect;
int a;
if (data->preview) {
/* draw items */
- for(a=0; a<data->items.totitem; a++) {
+ for (a=0; a<data->items.totitem; a++) {
ui_searchbox_butrect(&rect, data, a);
/* widget itself */
@@ -995,22 +1000,23 @@ static void ui_searchbox_region_draw_cb(const bContext *UNUSED(C), ARegion *ar)
}
/* indicate more */
- if(data->items.more) {
+ if (data->items.more) {
ui_searchbox_butrect(&rect, data, data->items.maxitem-1);
glEnable(GL_BLEND);
UI_icon_draw(rect.xmax-18, rect.ymin-7, ICON_TRIA_DOWN);
glDisable(GL_BLEND);
}
- if(data->items.offset) {
+ if (data->items.offset) {
ui_searchbox_butrect(&rect, data, 0);
glEnable(GL_BLEND);
UI_icon_draw(rect.xmin, rect.ymax-9, ICON_TRIA_UP);
glDisable(GL_BLEND);
}
- } else {
+ }
+ else {
/* draw items */
- for(a=0; a<data->items.totitem; a++) {
+ for (a=0; a<data->items.totitem; a++) {
ui_searchbox_butrect(&rect, data, a);
/* widget itself */
@@ -1018,13 +1024,13 @@ static void ui_searchbox_region_draw_cb(const bContext *UNUSED(C), ARegion *ar)
}
/* indicate more */
- if(data->items.more) {
+ if (data->items.more) {
ui_searchbox_butrect(&rect, data, data->items.maxitem-1);
glEnable(GL_BLEND);
UI_icon_draw((rect.xmax-rect.xmin)/2, rect.ymin-9, ICON_TRIA_DOWN);
glDisable(GL_BLEND);
}
- if(data->items.offset) {
+ if (data->items.offset) {
ui_searchbox_butrect(&rect, data, 0);
glEnable(GL_BLEND);
UI_icon_draw((rect.xmax-rect.xmin)/2, rect.ymax-7, ICON_TRIA_UP);
@@ -1082,7 +1088,7 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
/* special case, hardcoded feature, not draw backdrop when called from menus,
* assume for design that popup already added it */
- if(but->block->flag & UI_BLOCK_LOOP)
+ if (but->block->flag & UI_BLOCK_LOOP)
data->noback= 1;
if (but->a1 > 0 && but->a2 > 0) {
@@ -1092,7 +1098,7 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
}
/* compute position */
- if(but->block->flag & UI_BLOCK_LOOP) {
+ if (but->block->flag & UI_BLOCK_LOOP) {
/* this case is search menu inside other menu */
/* we copy region size */
@@ -1105,7 +1111,7 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
data->bbox.ymax = (ar->winrct.ymax-ar->winrct.ymin) - MENU_SHADOW_BOTTOM;
/* check if button is lower half */
- if( but->y2 < (but->block->miny+but->block->maxy)/2 ) {
+ if ( but->y2 < (but->block->miny+but->block->maxy)/2 ) {
data->bbox.ymin += (but->y2-but->y1);
}
else {
@@ -1127,12 +1133,12 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
y2f += ofsy;
/* minimal width */
- if(x2f - x1f < 150) x2f= x1f+150; // XXX arbitrary
+ if (x2f - x1f < 150) x2f= x1f+150; // XXX arbitrary
/* copy to int, gets projected if possible too */
x1= x1f; y1= y1f; x2= x2f; y2= y2f;
- if(butregion->v2d.cur.xmin != butregion->v2d.cur.xmax) {
+ if (butregion->v2d.cur.xmin != butregion->v2d.cur.xmax) {
UI_view2d_to_region_no_clip(&butregion->v2d, x1f, y1f, &x1, &y1);
UI_view2d_to_region_no_clip(&butregion->v2d, x2f, y2f, &x2, &y2);
}
@@ -1144,9 +1150,9 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
wm_window_get_size(CTX_wm_window(C), &winx, &winy);
- if(x2 > winx) {
+ if (x2 > winx) {
/* super size */
- if(x2 > winx + x1) {
+ if (x2 > winx + x1) {
x2= winx;
x1= 0;
}
@@ -1156,7 +1162,7 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
}
}
- if(y1 < 0) {
+ if (y1 < 0) {
int newy1;
UI_view2d_to_region_no_clip(&butregion->v2d, 0, but->y2 + ofsy, NULL, &newy1);
newy1 += butregion->winrct.ymin;
@@ -1187,7 +1193,8 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
/* prepare search data */
if (data->preview) {
data->items.maxitem= data->prv_rows * data->prv_cols;
- } else {
+ }
+ else {
data->items.maxitem= SEARCH_ITEMS;
}
data->items.maxstrlen= but->hardmax;
@@ -1195,7 +1202,7 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
data->items.names= MEM_callocN(data->items.maxitem*sizeof(void *), "search names");
data->items.pointers= MEM_callocN(data->items.maxitem*sizeof(void *), "search pointers");
data->items.icons= MEM_callocN(data->items.maxitem*sizeof(int), "search icons");
- for(x1=0; x1<data->items.maxitem; x1++)
+ for (x1=0; x1<data->items.maxitem; x1++)
data->items.names[x1]= MEM_callocN(but->hardmax+1, "search pointers");
return ar;
@@ -1215,7 +1222,7 @@ void ui_but_search_test(uiBut *but)
/* possibly very large lists (such as ID datablocks) only
* only validate string RNA buts (not pointers) */
- if(but->rnaprop && RNA_property_type(but->rnaprop) != PROP_STRING) {
+ if (but->rnaprop && RNA_property_type(but->rnaprop) != PROP_STRING) {
return;
}
@@ -1225,19 +1232,19 @@ void ui_but_search_test(uiBut *but)
items->maxitem= 10;
items->maxstrlen= 256;
items->names= MEM_callocN(items->maxitem*sizeof(void *), "search names");
- for(x1=0; x1<items->maxitem; x1++)
+ for (x1=0; x1<items->maxitem; x1++)
items->names[x1]= MEM_callocN(but->hardmax+1, "search names");
but->search_func(but->block->evil_C, but->search_arg, but->drawstr, items);
/* only redalert when we are sure of it, this can miss cases when >10 matches */
- if(items->totitem==0)
+ if (items->totitem==0)
uiButSetFlag(but, UI_BUT_REDALERT);
- else if(items->more==0) {
- for(x1= 0; x1<items->totitem; x1++)
- if(strcmp(but->drawstr, items->names[x1])==0)
+ else if (items->more==0) {
+ for (x1= 0; x1<items->totitem; x1++)
+ if (strcmp(but->drawstr, items->names[x1])==0)
break;
- if(x1==items->totitem)
+ if (x1==items->totitem)
uiButSetFlag(but, UI_BUT_REDALERT);
}
@@ -1269,18 +1276,18 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
ui_block_to_window_fl(butregion, but->block, &butrct.xmax, &butrct.ymax);
/* calc block rect */
- if(block->minx == 0.0f && block->maxx == 0.0f) {
- if(block->buttons.first) {
+ if (block->minx == 0.0f && block->maxx == 0.0f) {
+ if (block->buttons.first) {
block->minx= block->miny= 10000;
block->maxx= block->maxy= -10000;
bt= block->buttons.first;
- while(bt) {
- if(bt->x1 < block->minx) block->minx= bt->x1;
- if(bt->y1 < block->miny) block->miny= bt->y1;
+ while (bt) {
+ if (bt->x1 < block->minx) block->minx= bt->x1;
+ if (bt->y1 < block->miny) block->miny= bt->y1;
- if(bt->x2 > block->maxx) block->maxx= bt->x2;
- if(bt->y2 > block->maxy) block->maxy= bt->y2;
+ if (bt->x2 > block->maxx) block->maxx= bt->x2;
+ if (bt->y2 > block->maxy) block->maxy= bt->y2;
bt= bt->next;
}
@@ -1310,16 +1317,16 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
wm_window_get_size(window, &winx, &winy);
- if(block->direction & UI_CENTER) center= ysize/2;
+ if (block->direction & UI_CENTER) center= ysize/2;
else center= 0;
/* check if there's space at all */
- if( butrct.xmin-xsize > 0.0f) left= 1;
- if( butrct.xmax+xsize < winx) right= 1;
- if( butrct.ymin-ysize+center > 0.0f) down= 1;
- if( butrct.ymax+ysize-center < winy) top= 1;
+ if ( butrct.xmin-xsize > 0.0f) left= 1;
+ if ( butrct.xmax+xsize < winx) right= 1;
+ if ( butrct.ymin-ysize+center > 0.0f) down= 1;
+ if ( butrct.ymax+ysize-center < winy) top= 1;
- if(top==0 && down==0) {
+ if (top==0 && down==0) {
if (butrct.ymin-ysize < winy-butrct.ymax-ysize)
top= 1;
else
@@ -1329,74 +1336,74 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
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;
+ 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;
+ 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? don't change */
- if(left || right) {
- if(dir1==UI_LEFT && left==0) dir1= UI_RIGHT;
- if(dir1==UI_RIGHT && right==0) dir1= UI_LEFT;
+ 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 (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 (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) {
+ if (dir1==UI_LEFT) {
xof= butrct.xmin - block->maxx;
- if(dir2==UI_TOP) yof= butrct.ymin - block->miny-center;
+ if (dir2==UI_TOP) yof= butrct.ymin - block->miny-center;
else yof= butrct.ymax - block->maxy+center;
}
- else if(dir1==UI_RIGHT) {
+ else if (dir1==UI_RIGHT) {
xof= butrct.xmax - block->minx;
- if(dir2==UI_TOP) yof= butrct.ymin - block->miny-center;
+ if (dir2==UI_TOP) yof= butrct.ymin - block->miny-center;
else yof= butrct.ymax - block->maxy+center;
}
- else if(dir1==UI_TOP) {
+ else if (dir1==UI_TOP) {
yof= butrct.ymax - block->miny;
- if(dir2==UI_RIGHT) xof= butrct.xmax - block->maxx;
+ 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)
+ if ((dir1 & block->direction)==0) {
+ if (block->direction & UI_SHIFT_FLIPPED)
xof+= dir2==UI_LEFT?25:-25;
uiBlockFlipOrder(block);
}
}
- else if(dir1==UI_DOWN) {
+ else if (dir1==UI_DOWN) {
yof= butrct.ymin - block->maxy;
- if(dir2==UI_RIGHT) xof= butrct.xmax - block->maxx;
+ 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)
+ if ((dir1 & block->direction)==0) {
+ if (block->direction & UI_SHIFT_FLIPPED)
xof+= dir2==UI_LEFT?25:-25;
uiBlockFlipOrder(block);
}
}
/* and now we handle the exception; no space below or to top */
- if(top==0 && down==0) {
- if(dir1==UI_LEFT || dir1==UI_RIGHT) {
+ if (top==0 && down==0) {
+ if (dir1==UI_LEFT || dir1==UI_RIGHT) {
// align with bottom of screen
// yof= ysize; (not with menu scrolls)
}
}
/* or no space left or right */
- if(left==0 && right==0) {
- if(dir1==UI_TOP || dir1==UI_DOWN) {
+ if (left==0 && right==0) {
+ if (dir1==UI_TOP || dir1==UI_DOWN) {
// align with left size of screen
xof= -block->minx+5;
}
@@ -1407,16 +1414,16 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
yof += block->yofs/block->aspect;
#if 0
/* clamp to window bounds, could be made into an option if its ever annoying */
- if( (offscreen= (block->miny+yof)) < 0) yof -= offscreen; /* bottom */
- else if((offscreen= (block->maxy+yof)-winy) > 0) yof -= offscreen; /* top */
- if( (offscreen= (block->minx+xof)) < 0) xof -= offscreen; /* left */
- else if((offscreen= (block->maxx+xof)-winx) > 0) xof -= offscreen; /* right */
+ if ( (offscreen= (block->miny+yof)) < 0) yof -= offscreen; /* bottom */
+ else if ((offscreen= (block->maxy+yof)-winy) > 0) yof -= offscreen; /* top */
+ if ( (offscreen= (block->minx+xof)) < 0) xof -= offscreen; /* left */
+ else if ((offscreen= (block->maxx+xof)-winx) > 0) xof -= offscreen; /* right */
#endif
}
/* apply offset, buttons in window coords */
- for(bt= block->buttons.first; bt; bt= bt->next) {
+ for (bt= block->buttons.first; bt; bt= bt->next) {
ui_block_to_window_fl(butregion, but->block, &bt->x1, &bt->y1);
ui_block_to_window_fl(butregion, but->block, &bt->x2, &bt->y2);
@@ -1436,30 +1443,30 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
block->maxy += yof;
/* safety calculus */
- if(but) {
+ if (but) {
float midx= (butrct.xmin+butrct.xmax)/2.0f;
float midy= (butrct.ymin+butrct.ymax)/2.0f;
/* 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;
+ 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;
+ 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;
+ 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;
+ 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;
+ 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;
}
block->direction= dir1;
}
@@ -1475,7 +1482,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
saferct->parent= butrct;
saferct->safety= block->safety;
BLI_freelistN(&block->saferct);
- if(but)
+ if (but)
BLI_duplicatelist(&block->saferct, &but->block->saferct);
BLI_addhead(&block->saferct, saferct);
}
@@ -1484,7 +1491,7 @@ static void ui_block_region_draw(const bContext *C, ARegion *ar)
{
uiBlock *block;
- for(block=ar->uiblocks.first; block; block=block->next)
+ for (block=ar->uiblocks.first; block; block=block->next)
uiDrawBlock(C, block);
}
@@ -1494,14 +1501,14 @@ static void ui_popup_block_clip(wmWindow *window, uiBlock *block)
wm_window_get_size(window, &winx, &winy);
- if(block->minx < MENU_SHADOW_SIDE)
+ if (block->minx < MENU_SHADOW_SIDE)
block->minx= MENU_SHADOW_SIDE;
- if(block->maxx > winx-MENU_SHADOW_SIDE)
+ if (block->maxx > winx-MENU_SHADOW_SIDE)
block->maxx= winx-MENU_SHADOW_SIDE;
- if(block->miny < MENU_SHADOW_BOTTOM)
+ if (block->miny < MENU_SHADOW_BOTTOM)
block->miny= MENU_SHADOW_BOTTOM;
- if(block->maxy > winy-MENU_TOP)
+ if (block->maxy > winy-MENU_TOP)
block->maxy= winy-MENU_TOP;
}
@@ -1513,33 +1520,33 @@ void ui_popup_block_scrolltest(uiBlock *block)
block->flag &= ~(UI_BLOCK_CLIPBOTTOM|UI_BLOCK_CLIPTOP);
- for(bt= block->buttons.first; bt; bt= bt->next)
+ for (bt= block->buttons.first; bt; bt= bt->next)
bt->flag &= ~UI_SCROLLED;
- if(block->buttons.first==block->buttons.last)
+ if (block->buttons.first==block->buttons.last)
return;
/* mark buttons that are outside boundary and the ones next to it for arrow(s) */
- for(bt= block->buttons.first; bt; bt= bt->next) {
- if(bt->y1 < block->miny) {
+ for (bt= block->buttons.first; bt; bt= bt->next) {
+ if (bt->y1 < block->miny) {
bt->flag |= UI_SCROLLED;
block->flag |= UI_BLOCK_CLIPBOTTOM;
/* make space for arrow */
- if(bt->y2 < block->miny +10) {
- if(is_flip && bt->next && bt->next->y1 > bt->y1)
+ if (bt->y2 < block->miny +10) {
+ if (is_flip && bt->next && bt->next->y1 > bt->y1)
bt->next->flag |= UI_SCROLLED;
- else if(!is_flip && bt->prev && bt->prev->y1 > bt->y1)
+ else if (!is_flip && bt->prev && bt->prev->y1 > bt->y1)
bt->prev->flag |= UI_SCROLLED;
}
}
- if(bt->y2 > block->maxy) {
+ if (bt->y2 > block->maxy) {
bt->flag |= UI_SCROLLED;
block->flag |= UI_BLOCK_CLIPTOP;
/* make space for arrow */
- if(bt->y1 > block->maxy -10) {
- if(!is_flip && bt->next && bt->next->y2 < bt->y2)
+ if (bt->y1 > block->maxy -10) {
+ if (!is_flip && bt->next && bt->next->y2 < bt->y2)
bt->next->flag |= UI_SCROLLED;
- else if(is_flip && bt->prev && bt->prev->y2 < bt->y2)
+ else if (is_flip && bt->prev && bt->prev->y2 < bt->y2)
bt->prev->flag |= UI_SCROLLED;
}
}
@@ -1574,12 +1581,12 @@ uiPopupBlockHandle *ui_popup_block_create(bContext *C, ARegion *butregion, uiBut
UI_add_region_handlers(&ar->handlers);
/* create ui block */
- if(create_func)
+ if (create_func)
block= create_func(C, handle->region, arg);
else
block= handle_create_func(C, handle, arg);
- if(block->handle) {
+ if (block->handle) {
memcpy(block->handle, handle, sizeof(uiPopupBlockHandle));
MEM_freeN(handle);
handle= block->handle;
@@ -1589,12 +1596,12 @@ uiPopupBlockHandle *ui_popup_block_create(bContext *C, ARegion *butregion, uiBut
ar->regiondata= handle;
- if(!block->endblock)
+ if (!block->endblock)
uiEndBlock(C, block);
/* if this is being created from a button */
- if(but) {
- if(ELEM(but->type, BLOCK, PULLDOWN))
+ if (but) {
+ if (ELEM(but->type, BLOCK, PULLDOWN))
block->xofs = -2; /* for proper alignment */
block->aspect = but->block->aspect;
@@ -1625,7 +1632,7 @@ uiPopupBlockHandle *ui_popup_block_create(bContext *C, ARegion *butregion, uiBut
block->miny -= ar->winrct.ymin;
block->maxy -= ar->winrct.ymin;
- for(bt= block->buttons.first; bt; bt= bt->next) {
+ for (bt= block->buttons.first; bt; bt= bt->next) {
bt->x1 -= ar->winrct.xmin;
bt->x2 -= ar->winrct.xmin;
bt->y1 -= ar->winrct.ymin;
@@ -1655,7 +1662,7 @@ void ui_popup_block_free(bContext *C, uiPopupBlockHandle *handle)
{
ui_remove_temporary_region(C, CTX_wm_screen(C), handle->region);
- if(handle->scrolltimer)
+ if (handle->scrolltimer)
WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), handle->scrolltimer);
MEM_freeN(handle);
@@ -1682,20 +1689,20 @@ static void ui_block_func_MENUSTR(bContext *UNUSED(C), uiLayout *layout, void *a
/* columns and row estimation */
columns= (md->nitems+20)/20;
- if(columns<1)
+ if (columns<1)
columns= 1;
- if(columns>8)
+ if (columns>8)
columns= (md->nitems+25)/25;
rows= md->nitems/columns;
- if(rows<1)
+ if (rows<1)
rows= 1;
- while(rows*columns<md->nitems)
+ while (rows*columns<md->nitems)
rows++;
/* create title */
- if(md->title) {
- if(md->titleicon) {
+ if (md->title) {
+ if (md->titleicon) {
uiItemL(layout, md->title, md->titleicon);
}
else {
@@ -1707,8 +1714,8 @@ static void ui_block_func_MENUSTR(bContext *UNUSED(C), uiLayout *layout, void *a
/* inconsistent, but menus with labels do not look good flipped */
entry= md->items;
- for(a=0; a<md->nitems; a++, entry++) {
- if(entry->sepr && entry->str[0]) {
+ for (a=0; a<md->nitems; a++, entry++) {
+ if (entry->sepr && entry->str[0]) {
block->flag |= UI_BLOCK_NO_FLIP;
break;
}
@@ -1717,18 +1724,18 @@ static void ui_block_func_MENUSTR(bContext *UNUSED(C), uiLayout *layout, void *a
/* create items */
split= uiLayoutSplit(layout, 0, 0);
- for(a=0; a<md->nitems; a++) {
- if(a == column_end) {
+ for (a=0; a<md->nitems; a++) {
+ if (a == column_end) {
/* start new column, and find out where it ends in advance, so we
* can flip the order of items properly per column */
column_start= a;
column_end= md->nitems;
- for(b=a+1; b<md->nitems; b++) {
+ for (b=a+1; b<md->nitems; b++) {
entry= &md->items[b];
/* new column on N rows or on separation label */
- if(((b-a) % rows == 0) || (entry->sepr && entry->str[0])) {
+ if (((b-a) % rows == 0) || (entry->sepr && entry->str[0])) {
column_end = b;
break;
}
@@ -1737,17 +1744,17 @@ static void ui_block_func_MENUSTR(bContext *UNUSED(C), uiLayout *layout, void *a
column= uiLayoutColumn(split, 0);
}
- if(block->flag & UI_BLOCK_NO_FLIP)
+ if (block->flag & UI_BLOCK_NO_FLIP)
entry= &md->items[a];
else
entry= &md->items[column_start + column_end-1-a];
- if(entry->sepr) {
+ if (entry->sepr) {
uiItemL(column, entry->str, entry->icon);
bt= block->buttons.last;
bt->flag= UI_TEXT_LEFT;
}
- else if(entry->icon) {
+ else if (entry->icon) {
uiDefIconTextButF(block, BUTM|FLO, B_NOP, entry->icon, entry->str, 0, 0,
UI_UNIT_X*5, UI_UNIT_Y, &handle->retvalue, (float) entry->retval, 0.0, 0, 0, "");
}
@@ -1769,7 +1776,7 @@ void ui_block_func_ICONROW(bContext *UNUSED(C), uiLayout *layout, void *arg_but)
uiBlockSetFlag(block, UI_BLOCK_MOVEMOUSE_QUIT);
- for(a=(int)but->hardmin; a<=(int)but->hardmax; a++)
+ for (a=(int)but->hardmin; a<=(int)but->hardmax; a++)
uiDefIconButF(block, BUTM|FLO, B_NOP, but->icon+(a-but->hardmin), 0, 0, UI_UNIT_X*5, UI_UNIT_Y,
&handle->retvalue, (float)a, 0.0, 0, 0, "");
}
@@ -1788,16 +1795,16 @@ void ui_block_func_ICONTEXTROW(bContext *UNUSED(C), uiLayout *layout, void *arg_
md= decompose_menu_string(but->str);
/* title */
- if(md->title) {
+ if (md->title) {
bt= uiDefBut(block, LABEL, 0, md->title, 0, 0, UI_UNIT_X*5, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
bt->flag= UI_TEXT_LEFT;
}
/* loop through the menu options and draw them out with icons & text labels */
- for(a=0; a<md->nitems; a++) {
+ for (a=0; a<md->nitems; a++) {
entry= &md->items[md->nitems-a-1];
- if(entry->sepr)
+ if (entry->sepr)
uiItemS(layout);
else
uiDefIconTextButF(block, BUTM|FLO, B_NOP, (short)((but->icon)+(entry->retval-but->hardmin)), entry->str,
@@ -1849,13 +1856,13 @@ static void ui_update_block_buts_rgb(uiBlock *block, float *rgb)
rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
// this updates button strings, is hackish... but button pointers are on stack of caller function
- for(bt= block->buttons.first; bt; bt= bt->next) {
+ for (bt= block->buttons.first; bt; bt= bt->next) {
if (bt->rnaprop) {
ui_set_but_vectorf(bt, rgb);
}
- else if(strcmp(bt->str, "Hex: ")==0) {
+ else if (strcmp(bt->str, "Hex: ")==0) {
float rgb_gamma[3];
double intpart;
char col[16];
@@ -1864,7 +1871,8 @@ static void ui_update_block_buts_rgb(uiBlock *block, float *rgb)
if (block->color_profile == BLI_PR_NONE) {
copy_v3_v3(rgb_gamma, rgb);
- } else {
+ }
+ else {
/* make an sRGB version, for Hex code */
linearrgb_to_srgb_v3_v3(rgb_gamma, rgb);
}
@@ -1877,23 +1885,23 @@ static void ui_update_block_buts_rgb(uiBlock *block, float *rgb)
strcpy(bt->poin, col);
}
- else if(bt->str[1]==' ') {
- if(bt->str[0]=='R') {
+ else if (bt->str[1]==' ') {
+ if (bt->str[0]=='R') {
ui_set_but_val(bt, rgb[0]);
}
- else if(bt->str[0]=='G') {
+ else if (bt->str[0]=='G') {
ui_set_but_val(bt, rgb[1]);
}
- else if(bt->str[0]=='B') {
+ else if (bt->str[0]=='B') {
ui_set_but_val(bt, rgb[2]);
}
- else if(bt->str[0]=='H') {
+ else if (bt->str[0]=='H') {
ui_set_but_val(bt, hsv[0]);
}
- else if(bt->str[0]=='S') {
+ else if (bt->str[0]=='S') {
ui_set_but_val(bt, hsv[1]);
}
- else if(bt->str[0]=='V') {
+ else if (bt->str[0]=='V') {
ui_set_but_val(bt, hsv[2]);
}
}
@@ -1915,7 +1923,7 @@ static void do_picker_rna_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg))
ui_update_block_buts_rgb(but->block, rgb);
}
- if(popup)
+ if (popup)
popup->menuretval= UI_RETURN_UPDATE;
}
@@ -1930,7 +1938,7 @@ static void do_hsv_rna_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg))
ui_update_block_buts_rgb(but->block, rgb);
- if(popup)
+ if (popup)
popup->menuretval= UI_RETURN_UPDATE;
}
@@ -1951,7 +1959,7 @@ static void do_hex_rna_cb(bContext *UNUSED(C), void *bt1, void *hexcl)
ui_update_block_buts_rgb(but->block, rgb);
- if(popup)
+ if (popup)
popup->menuretval= UI_RETURN_UPDATE;
}
@@ -1960,7 +1968,7 @@ static void close_popup_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg))
uiBut *but= (uiBut *)bt1;
uiPopupBlockHandle *popup= but->block->handle;
- if(popup)
+ if (popup)
popup->menuretval= UI_RETURN_OK;
}
@@ -1969,26 +1977,26 @@ static void picker_new_hide_reveal(uiBlock *block, short colormode)
uiBut *bt;
/* tag buttons */
- for(bt= block->buttons.first; bt; bt= bt->next) {
+ for (bt= block->buttons.first; bt; bt= bt->next) {
if (bt->type == LABEL) {
- if( bt->str[1]=='G') {
- if(colormode==2) bt->flag &= ~UI_HIDDEN;
+ if ( bt->str[1]=='G') {
+ if (colormode==2) bt->flag &= ~UI_HIDDEN;
else bt->flag |= UI_HIDDEN;
}
}
- if(bt->type==NUMSLI || bt->type==TEX) {
- if( bt->str[1]=='e') {
- if(colormode==2) bt->flag &= ~UI_HIDDEN;
+ if (bt->type==NUMSLI || bt->type==TEX) {
+ if ( bt->str[1]=='e') {
+ if (colormode==2) bt->flag &= ~UI_HIDDEN;
else bt->flag |= UI_HIDDEN;
}
- else if( ELEM3(bt->str[0], 'R', 'G', 'B')) {
- if(colormode==0) bt->flag &= ~UI_HIDDEN;
+ else if ( ELEM3(bt->str[0], 'R', 'G', 'B')) {
+ if (colormode==0) bt->flag &= ~UI_HIDDEN;
else bt->flag |= UI_HIDDEN;
}
- else if( ELEM3(bt->str[0], 'H', 'S', 'V')) {
- if(colormode==1) bt->flag &= ~UI_HIDDEN;
+ else if ( ELEM3(bt->str[0], 'H', 'S', 'V')) {
+ if (colormode==1) bt->flag &= ~UI_HIDDEN;
else bt->flag |= UI_HIDDEN;
}
}
@@ -2063,7 +2071,8 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR
if (block->color_profile == BLI_PR_NONE) {
BLI_strncpy(tip, "Value in Display Color Space", sizeof(tip));
copy_v3_v3(rgb_gamma, rgb);
- } else {
+ }
+ else {
BLI_strncpy(tip, "Value in Linear RGB Color Space", sizeof(tip));
/* make an sRGB version, for Hex code */
linearrgb_to_srgb_v3_v3(rgb_gamma, rgb);
@@ -2125,7 +2134,7 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR
uiButSetFunc(bt, do_hsv_rna_cb, bt, hsv);
uiBlockEndAlign(block);
- if(rgb[3] != FLT_MAX) {
+ if (rgb[3] != FLT_MAX) {
bt= uiDefButR_prop(block, NUMSLI, 0, "A ", 0, -120, butwidth, UI_UNIT_Y, ptr, prop, 3, 0.0, 0.0, 0, 0, "Alpha");
uiButSetFunc(bt, do_picker_rna_cb, bt, NULL);
}
@@ -2149,16 +2158,16 @@ static int ui_picker_small_wheel_cb(const bContext *UNUSED(C), uiBlock *block, w
{
float add= 0.0f;
- if(event->type==WHEELUPMOUSE)
+ if (event->type==WHEELUPMOUSE)
add= 0.05f;
- else if(event->type==WHEELDOWNMOUSE)
+ else if (event->type==WHEELDOWNMOUSE)
add= -0.05f;
- if(add!=0.0f) {
+ if (add!=0.0f) {
uiBut *but;
- for(but= block->buttons.first; but; but= but->next) {
- if(but->type==HSVCUBE && but->active==NULL) {
+ for (but= block->buttons.first; but; but= but->next) {
+ if (but->type==HSVCUBE && but->active==NULL) {
uiPopupBlockHandle *popup= block->handle;
float col[3];
float *hsv= ui_block_hsv_get(block);
@@ -2172,7 +2181,7 @@ static int ui_picker_small_wheel_cb(const bContext *UNUSED(C), uiBlock *block, w
ui_set_but_vectorf(but, col);
ui_update_block_buts_rgb(block, col);
- if(popup)
+ if (popup)
popup->menuretval= UI_RETURN_UPDATE;
return 1;
@@ -2220,9 +2229,9 @@ static int ui_popup_string_hash(char *str)
int hash;
char *delimit= strchr(str, '|');
- if(delimit) *delimit= 0;
+ if (delimit) *delimit= 0;
hash= BLI_ghashutil_strhash(str);
- if(delimit) *delimit= '|';
+ if (delimit) *delimit= '|';
return hash;
}
@@ -2238,21 +2247,21 @@ uiBut *ui_popup_menu_memory(uiBlock *block, uiBut *but)
static int mem[256], first=1;
int hash= block->puphash;
- if(first) {
+ if (first) {
/* init */
memset(mem, -1, sizeof(mem));
first= 0;
}
- if(but) {
+ if (but) {
/* set */
mem[hash & 255 ]= ui_popup_string_hash(but->str);
return NULL;
}
else {
/* get */
- for(but=block->buttons.first; but; but=but->next)
- if(ui_popup_string_hash(but->str) == mem[hash & 255])
+ for (but=block->buttons.first; but; but=but->next)
+ if (ui_popup_string_hash(but->str) == mem[hash & 255])
return but;
return NULL;
@@ -2280,17 +2289,17 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
uiPopupMenu *pup= arg_pup;
int offset[2], direction, minwidth, width, height, flip;
- if(pup->menu_func) {
+ if (pup->menu_func) {
pup->block->handle= handle;
pup->menu_func(C, pup->layout, pup->menu_arg);
pup->block->handle= NULL;
}
- if(pup->but) {
+ if (pup->but) {
/* minimum width to enforece */
minwidth= pup->but->x2 - pup->but->x1;
- if(pup->but->type == PULLDOWN || pup->but->menu_create_func) {
+ if (pup->but->type == PULLDOWN || pup->but->menu_create_func) {
direction= UI_DOWN;
flip= 1;
}
@@ -2309,7 +2318,7 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
/* in some cases we create the block before the region,
* so we set it delayed here if necessary */
- if(BLI_findindex(&handle->region->uiblocks, block) == -1)
+ if (BLI_findindex(&handle->region->uiblocks, block) == -1)
uiBlockSetRegion(block, handle->region);
block->direction= direction;
@@ -2318,12 +2327,12 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
uiBlockSetFlag(block, UI_BLOCK_MOVEMOUSE_QUIT);
- if(pup->popup) {
+ if (pup->popup) {
uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_NUMSELECT|UI_BLOCK_RET_1);
uiBlockSetDirection(block, direction);
/* offset the mouse position, possibly based on earlier selection */
- if((block->flag & UI_BLOCK_POPUP_MEMORY) &&
+ if ((block->flag & UI_BLOCK_POPUP_MEMORY) &&
(bt= ui_popup_menu_memory(block, NULL))) {
/* position mouse on last clicked item, at 0.8*width of the
* button, so it doesn't overlap the text too much, also note
@@ -2336,7 +2345,7 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
/* position mouse at 0.8*width of the button and below the tile
* on the first item */
offset[0]= 0;
- for(bt=block->buttons.first; bt; bt=bt->next)
+ for (bt=block->buttons.first; bt; bt=bt->next)
offset[0]= MIN2(offset[0], -(bt->x1 + 0.8f*(bt->x2 - bt->x1)));
offset[1]= 1.5*UI_UNIT_Y;
@@ -2347,11 +2356,11 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
}
else {
/* for a header menu we set the direction automatic */
- if(!pup->slideout && flip) {
+ if (!pup->slideout && flip) {
ScrArea *sa= CTX_wm_area(C);
- if(sa && sa->headertype==HEADERDOWN) {
+ if (sa && sa->headertype==HEADERDOWN) {
ARegion *ar= CTX_wm_region(C);
- if(ar && ar->regiontype == RGN_TYPE_HEADER) {
+ if (ar && ar->regiontype == RGN_TYPE_HEADER) {
uiBlockSetDirection(block, UI_TOP);
uiBlockFlipOrder(block);
}
@@ -2363,7 +2372,7 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
}
/* if menu slides out of other menu, override direction */
- if(pup->slideout)
+ if (pup->slideout)
uiBlockSetDirection(block, UI_RIGHT);
uiEndBlock(C, block);
@@ -2384,7 +2393,7 @@ uiPopupBlockHandle *ui_popup_menu_create(bContext *C, ARegion *butregion, uiBut
pup->but= but;
uiLayoutSetOperatorContext(pup->layout, WM_OP_INVOKE_REGION_WIN);
- if(!but) {
+ if (!but) {
/* no button to start from, means we are a popup */
pup->mx= window->eventstate->x;
pup->my= window->eventstate->y;
@@ -2399,13 +2408,13 @@ uiPopupBlockHandle *ui_popup_menu_create(bContext *C, ARegion *butregion, uiBut
/* if this is an rna button then we can assume its an enum
* flipping enums is generally not good since the order can be
* important [#28786] */
- if(but->rnaprop && RNA_property_type(but->rnaprop) == PROP_ENUM) {
+ if (but->rnaprop && RNA_property_type(but->rnaprop) == PROP_ENUM) {
pup->block->flag |= UI_BLOCK_NO_FLIP;
}
}
#endif
- if(str) {
+ if (str) {
/* menu is created from a string */
pup->menu_func= ui_block_func_MENUSTR;
pup->menu_arg= str;
@@ -2418,7 +2427,7 @@ uiPopupBlockHandle *ui_popup_menu_create(bContext *C, ARegion *butregion, uiBut
handle= ui_popup_block_create(C, butregion, but, NULL, ui_block_func_POPUP, pup);
- if(!but) {
+ if (!but) {
handle->popup= 1;
UI_add_popup_handlers(C, &window->modalhandlers, handle);
@@ -2449,10 +2458,10 @@ uiPopupMenu *uiPupMenuBegin(bContext *C, const char *title, int icon)
pup->block->handle= MEM_callocN(sizeof(uiPopupBlockHandle), "uiPopupBlockHandle");
/* create title button */
- if(title && title[0]) {
+ if (title && title[0]) {
char titlestr[256];
- if(icon) {
+ if (icon) {
BLI_snprintf(titlestr, sizeof(titlestr), " %s", title);
uiDefIconTextBut(pup->block, LABEL, 0, icon, titlestr, 0, 0, 200, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
}
@@ -2495,7 +2504,7 @@ static void operator_name_cb(bContext *C, void *arg, int retval)
{
const char *opname= arg;
- if(opname && retval > 0)
+ if (opname && retval > 0)
WM_operator_name_call(C, opname, WM_OP_EXEC_DEFAULT, NULL);
}
@@ -2503,7 +2512,7 @@ static void operator_cb(bContext *C, void *arg, int retval)
{
wmOperator *op= arg;
- if(op && retval > 0)
+ if (op && retval > 0)
WM_operator_call(C, op);
else
WM_operator_free(op);
@@ -2598,26 +2607,26 @@ void uiPupMenuReports(bContext *C, ReportList *reports)
DynStr *ds;
char *str;
- if(!reports || !reports->list.first)
+ if (!reports || !reports->list.first)
return;
- if(!CTX_wm_window(C))
+ if (!CTX_wm_window(C))
return;
ds= BLI_dynstr_new();
- for(report=reports->list.first; report; report=report->next) {
- if(report->type < reports->printlevel)
+ for (report=reports->list.first; report; report=report->next) {
+ if (report->type < reports->printlevel)
; /* pass */
- else if(report->type >= RPT_ERROR)
+ else if (report->type >= RPT_ERROR)
BLI_dynstr_appendf(ds, "Error %%i%d%%t|%s", ICON_ERROR, report->message);
- else if(report->type >= RPT_WARNING)
+ else if (report->type >= RPT_WARNING)
BLI_dynstr_appendf(ds, "Warning %%i%d%%t|%s", ICON_ERROR, report->message);
- else if(report->type >= RPT_INFO)
+ else if (report->type >= RPT_INFO)
BLI_dynstr_appendf(ds, "Info %%i%d%%t|%s", ICON_INFO, report->message);
}
str= BLI_dynstr_get_cstring(ds);
- if(str[0] != '\0')
+ if (str[0] != '\0')
ui_popup_menu_create(C, NULL, NULL, NULL, NULL, str);
MEM_freeN(str);
@@ -2631,12 +2640,12 @@ void uiPupMenuInvoke(bContext *C, const char *idname)
Menu menu;
MenuType *mt = WM_menutype_find(idname, TRUE);
- if(mt==NULL) {
+ if (mt==NULL) {
printf("%s: named menu \"%s\" not found\n", __func__, idname);
return;
}
- if(mt->poll && mt->poll(C, mt)==0)
+ if (mt->poll && mt->poll(C, mt)==0)
return;
pup= uiPupMenuBegin(C, mt->label, ICON_NONE);
@@ -2712,11 +2721,11 @@ void uiPupBlockOperator(bContext *C, uiBlockCreateFunc func, wmOperator *op, int
void uiPupBlockClose(bContext *C, uiBlock *block)
{
- if(block->handle) {
+ if (block->handle) {
wmWindow *win = CTX_wm_window(C);
/* if loading new .blend while popup is open, window will be NULL */
- if(win) {
+ if (win) {
UI_remove_popup_handlers(&win->modalhandlers, block->handle);
ui_popup_block_free(C, block->handle);
}
diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c
index 580b0ff05dc..6a2038b18bc 100644
--- a/source/blender/editors/interface/interface_style.c
+++ b/source/blender/editors/interface/interface_style.c
@@ -132,8 +132,8 @@ static uiFont *uifont_to_blfont(int id)
{
uiFont *font= U.uifonts.first;
- for(; font; font= font->next) {
- if(font->uifont_id==id) {
+ for (; font; font= font->next) {
+ if (font->uifont_id==id) {
return font;
}
}
@@ -154,14 +154,14 @@ void uiStyleFontDrawExt(uiFontStyle *fs, rcti *rect, const char *str,
height= BLF_ascender(fs->uifont_id);
yofs= ceil( 0.5f*(rect->ymax - rect->ymin - height));
- if(fs->align==UI_STYLE_TEXT_CENTER) {
+ if (fs->align==UI_STYLE_TEXT_CENTER) {
xofs= floor( 0.5f*(rect->xmax - rect->xmin - BLF_width(fs->uifont_id, str)));
/* don't center text if it chops off the start of the text, 2 gives some margin */
- if(xofs < 2) {
+ if (xofs < 2) {
xofs= 2;
}
}
- else if(fs->align==UI_STYLE_TEXT_RIGHT) {
+ else if (fs->align==UI_STYLE_TEXT_RIGHT) {
xofs= rect->xmax - rect->xmin - BLF_width(fs->uifont_id, str) - 1;
}
@@ -306,12 +306,12 @@ void uiStyleInit(void)
uiStyle *style= U.uistyles.first;
/* recover from uninitialized dpi */
- if(U.dpi == 0)
+ if (U.dpi == 0)
U.dpi= 72;
CLAMP(U.dpi, 48, 128);
/* default builtin */
- if(font==NULL) {
+ if (font==NULL) {
font= MEM_callocN(sizeof(uiFont), "ui font");
BLI_addtail(&U.uifonts, font);
@@ -319,19 +319,19 @@ void uiStyleInit(void)
font->uifont_id= UIFONT_DEFAULT;
}
- for(font= U.uifonts.first; font; font= font->next) {
+ for (font= U.uifonts.first; font; font= font->next) {
- if(font->uifont_id==UIFONT_DEFAULT) {
+ if (font->uifont_id==UIFONT_DEFAULT) {
#ifdef WITH_INTERNATIONAL
int font_size= datatoc_bfont_ttf_size;
unsigned char *font_ttf= (unsigned char*)datatoc_bfont_ttf;
static int last_font_size = 0;
/* use unicode font for translation */
- if(U.transopts & USER_DOTRANSLATE) {
+ if (U.transopts & USER_DOTRANSLATE) {
font_ttf= BLF_get_unifont(&font_size);
- if(!font_ttf) {
+ if (!font_ttf) {
/* fall back if not found */
font_size= datatoc_bfont_ttf_size;
font_ttf= (unsigned char*)datatoc_bfont_ttf;
@@ -339,7 +339,7 @@ void uiStyleInit(void)
}
/* relload only if needed */
- if(last_font_size != font_size) {
+ if (last_font_size != font_size) {
BLF_unload("default");
last_font_size = font_size;
}
@@ -351,7 +351,7 @@ void uiStyleInit(void)
}
else {
font->blf_id= BLF_load(font->filename);
- if(font->blf_id == -1)
+ if (font->blf_id == -1)
font->blf_id= BLF_load_mem("default", (unsigned char*)datatoc_bfont_ttf, datatoc_bfont_ttf_size);
}
@@ -370,7 +370,7 @@ void uiStyleInit(void)
}
}
- if(style==NULL) {
+ if (style==NULL) {
ui_style_new(&U.uistyles, "Default Style", UIFONT_DEFAULT );
}
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index ca6b37f9013..d47bd44d8f7 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -84,7 +84,7 @@ void uiTemplateHeader(uiLayout *layout, bContext *C, int menus)
uiBlock *block;
block= uiLayoutAbsoluteBlock(layout);
- if(menus) ED_area_header_standardbuttons(C, block, 0);
+ if (menus) ED_area_header_standardbuttons(C, block, 0);
else ED_area_header_switchbutton(C, block, 0);
}
@@ -105,7 +105,7 @@ static void id_search_call_cb(bContext *C, void *arg_template, void *item)
TemplateID *template= (TemplateID*)arg_template;
/* ID */
- if(item) {
+ if (item) {
PointerRNA idptr;
RNA_id_pointer_create(item, &idptr);
@@ -124,29 +124,29 @@ static void id_search_cb(const bContext *C, void *arg_template, const char *str,
int flag= RNA_property_flag(template->prop);
/* ID listbase */
- for(id= lb->first; id; id= id->next) {
- if(!((flag & PROP_ID_SELF_CHECK) && id == id_from)) {
+ for (id= lb->first; id; id= id->next) {
+ if (!((flag & PROP_ID_SELF_CHECK) && id == id_from)) {
/* use filter */
- if(RNA_property_type(template->prop)==PROP_POINTER) {
+ if (RNA_property_type(template->prop)==PROP_POINTER) {
PointerRNA ptr;
RNA_id_pointer_create(id, &ptr);
- if(RNA_property_pointer_poll(&template->ptr, template->prop, &ptr)==0)
+ if (RNA_property_pointer_poll(&template->ptr, template->prop, &ptr)==0)
continue;
}
/* hide dot-datablocks, but only if filter does not force it visible */
- if(U.uiflag & USER_HIDE_DOT)
+ if (U.uiflag & USER_HIDE_DOT)
if ((id->name[2]=='.') && (str[0] != '.'))
continue;
- if(BLI_strcasestr(id->name+2, str)) {
+ if (BLI_strcasestr(id->name+2, str)) {
char name_ui[MAX_ID_NAME];
name_uiprefix_id(name_ui, id);
iconid= ui_id_icon_get((bContext*)C, id, template->preview);
- if(!uiSearchItemAdd(items, name_ui, id, iconid))
+ if (!uiSearchItemAdd(items, name_ui, id, iconid))
break;
}
}
@@ -221,14 +221,14 @@ void uiIDContextProperty(bContext *C, PointerRNA *ptr, PropertyRNA **prop)
memset(ptr, 0, sizeof(*ptr));
*prop= NULL;
- if(!ar)
+ if (!ar)
return;
- for(block=ar->uiblocks.first; block; block=block->next) {
- for(but=block->buttons.first; but; but= but->next) {
+ for (block=ar->uiblocks.first; block; block=block->next) {
+ for (but=block->buttons.first; but; but= but->next) {
/* find the button before the active one */
- if((but->flag & (UI_BUT_LAST_ACTIVE|UI_ACTIVE))) {
- if(but->func_argN) {
+ if ((but->flag & (UI_BUT_LAST_ACTIVE|UI_ACTIVE))) {
+ if (but->func_argN) {
template= but->func_argN;
*ptr= template->ptr;
*prop= template->prop;
@@ -261,20 +261,20 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event)
RNA_property_pointer_set(&template->ptr, template->prop, idptr);
RNA_property_update(C, &template->ptr, template->prop);
- if(id && CTX_wm_window(C)->eventstate->shift) /* useful hidden functionality, */
+ if (id && CTX_wm_window(C)->eventstate->shift) /* useful hidden functionality, */
id->us= 0;
break;
case UI_ID_FAKE_USER:
- if(id) {
- if(id->flag & LIB_FAKEUSER) id_us_plus(id);
+ if (id) {
+ if (id->flag & LIB_FAKEUSER) id_us_plus(id);
else id_us_min(id);
}
else return;
break;
case UI_ID_LOCAL:
- if(id) {
- if(id_make_local(id, 0)) {
+ if (id) {
+ if (id_make_local(id, 0)) {
/* reassign to get get proper updates/notifiers */
idptr= RNA_property_pointer_get(&template->ptr, template->prop);
RNA_property_pointer_set(&template->ptr, template->prop, idptr);
@@ -283,18 +283,18 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event)
}
break;
case UI_ID_ALONE:
- if(id) {
+ if (id) {
const int do_scene_obj= (GS(id->name) == ID_OB) &&
(template->ptr.type == &RNA_SceneObjects);
/* make copy */
- if(do_scene_obj) {
+ if (do_scene_obj) {
Scene *scene= CTX_data_scene(C);
ED_object_single_user(scene, (struct Object *)id);
WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, scene);
}
else {
- if(id) {
+ if (id) {
id_single_user(C, id, &template->ptr, template->prop);
}
}
@@ -309,7 +309,7 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event)
static const char *template_id_browse_tip(StructRNA *type)
{
- if(type) {
+ if (type) {
switch(RNA_type_to_ID_code(type)) {
case ID_SCE: return N_("Browse Scene to be linked");
case ID_OB: return N_("Browse Object to be linked");
@@ -355,40 +355,40 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
block= uiLayoutGetBlock(layout);
uiBlockBeginAlign(block);
- if(idptr.type)
+ if (idptr.type)
type= idptr.type;
- if(flag & UI_ID_PREVIEWS) {
+ if (flag & UI_ID_PREVIEWS) {
but = uiDefBlockButN(block, id_search_menu, MEM_dupallocN(template), "", 0, 0, UI_UNIT_X*6, UI_UNIT_Y*6,
TIP_(template_id_browse_tip(type)));
- if(type) {
+ if (type) {
but->icon= RNA_struct_ui_icon(type);
if (id) but->icon = ui_id_icon_get(C, id, 1);
uiButSetFlag(but, UI_HAS_ICON|UI_ICON_PREVIEW);
}
- if((idfrom && idfrom->lib) || !editable)
+ if ((idfrom && idfrom->lib) || !editable)
uiButSetFlag(but, UI_BUT_DISABLED);
uiLayoutRow(layout, 1);
template->preview= 1;
}
- else if(flag & UI_ID_BROWSE) {
+ else if (flag & UI_ID_BROWSE) {
but = uiDefBlockButN(block, id_search_menu, MEM_dupallocN(template), "", 0, 0, UI_UNIT_X*1.6, UI_UNIT_Y,
TIP_(template_id_browse_tip(type)));
- if(type) {
+ if (type) {
but->icon= RNA_struct_ui_icon(type);
/* default dragging of icon for id browse buttons */
uiButSetDragID(but, id);
uiButSetFlag(but, UI_HAS_ICON|UI_ICON_LEFT);
}
- if((idfrom && idfrom->lib) || !editable)
+ if ((idfrom && idfrom->lib) || !editable)
uiButSetFlag(but, UI_BUT_DISABLED);
}
/* text button with name */
- if(id) {
+ if (id) {
char name[UI_MAX_NAME_STR];
const short user_alert= (id->us <= 0);
@@ -396,10 +396,10 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
name[0]= '\0';
but = uiDefButR(block, TEX, 0, name, 0, 0, UI_UNIT_X*6, UI_UNIT_Y, &idptr, "name", -1, 0, 0, -1, -1, NULL);
uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_RENAME));
- if(user_alert) uiButSetFlag(but, UI_BUT_REDALERT);
+ if (user_alert) uiButSetFlag(but, UI_BUT_REDALERT);
- if(id->lib) {
- if(id->flag & LIB_INDIRECT) {
+ if (id->lib) {
+ if (id->flag & LIB_INDIRECT) {
but = uiDefIconBut(block, BUT, 0, ICON_LIBRARY_DATA_INDIRECT, 0,0,UI_UNIT_X,UI_UNIT_Y, NULL, 0, 0, 0, 0,
TIP_("Indirect library datablock, cannot change"));
uiButSetFlag(but, UI_BUT_DISABLED);
@@ -407,14 +407,14 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
else {
but = uiDefIconBut(block, BUT, 0, ICON_LIBRARY_DATA_DIRECT, 0,0,UI_UNIT_X,UI_UNIT_Y, NULL, 0, 0, 0, 0,
TIP_("Direct linked library datablock, click to make local"));
- if(!id_make_local(id, 1 /* test */) || (idfrom && idfrom->lib))
+ if (!id_make_local(id, 1 /* test */) || (idfrom && idfrom->lib))
uiButSetFlag(but, UI_BUT_DISABLED);
}
uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_LOCAL));
}
- if(id->us > 1) {
+ if (id->us > 1) {
char numstr[32];
BLI_snprintf(numstr, sizeof(numstr), "%d", id->us);
@@ -423,21 +423,21 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
TIP_("Display number of users of this data (click to make a single-user copy)"));
uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_ALONE));
- if(!id_copy(id, NULL, 1 /* test only */) || (idfrom && idfrom->lib) || !editable)
+ if (!id_copy(id, NULL, 1 /* test only */) || (idfrom && idfrom->lib) || !editable)
uiButSetFlag(but, UI_BUT_DISABLED);
}
- if(user_alert) uiButSetFlag(but, UI_BUT_REDALERT);
+ if (user_alert) uiButSetFlag(but, UI_BUT_REDALERT);
- if(id->lib == NULL && !(ELEM5(GS(id->name), ID_GR, ID_SCE, ID_SCR, ID_TXT, ID_OB))) {
+ if (id->lib == NULL && !(ELEM5(GS(id->name), ID_GR, ID_SCE, ID_SCR, ID_TXT, ID_OB))) {
uiDefButR(block, TOG, 0, "F", 0, 0, UI_UNIT_X, UI_UNIT_Y, &idptr, "use_fake_user", -1, 0, 0, -1, -1, NULL);
}
}
- if(flag & UI_ID_ADD_NEW) {
+ if (flag & UI_ID_ADD_NEW) {
int w= id?UI_UNIT_X: (flag & UI_ID_OPEN)? UI_UNIT_X*3: UI_UNIT_X*6;
- if(newop) {
+ if (newop) {
but = uiDefIconTextButO(block, BUT, newop, WM_OP_INVOKE_DEFAULT, ICON_ZOOMIN, (id)? "": IFACE_("New"), 0, 0, w, UI_UNIT_Y, NULL);
uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_ADD_NEW));
}
@@ -446,14 +446,14 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_ADD_NEW));
}
- if((idfrom && idfrom->lib) || !editable)
+ if ((idfrom && idfrom->lib) || !editable)
uiButSetFlag(but, UI_BUT_DISABLED);
}
- if(flag & UI_ID_OPEN) {
+ if (flag & UI_ID_OPEN) {
int w= id?UI_UNIT_X: (flag & UI_ID_ADD_NEW)? UI_UNIT_X*3: UI_UNIT_X*6;
- if(openop) {
+ if (openop) {
but = uiDefIconTextButO(block, BUT, openop, WM_OP_INVOKE_DEFAULT, ICON_FILESEL, (id)? "": IFACE_("Open"), 0, 0, w, UI_UNIT_Y, NULL);
uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_OPEN));
}
@@ -462,13 +462,13 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_OPEN));
}
- if((idfrom && idfrom->lib) || !editable)
+ if ((idfrom && idfrom->lib) || !editable)
uiButSetFlag(but, UI_BUT_DISABLED);
}
/* delete button */
- if(id && (flag & UI_ID_DELETE) && (RNA_property_flag(template->prop) & PROP_NEVER_UNLINK)==0) {
- if(unlinkop) {
+ if (id && (flag & UI_ID_DELETE) && (RNA_property_flag(template->prop) & PROP_NEVER_UNLINK)==0) {
+ if (unlinkop) {
but = uiDefIconButO(block, BUT, unlinkop, WM_OP_INVOKE_REGION_WIN, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL);
/* so we can access the template from operators, font unlinking needs this */
uiButSetNFunc(but, NULL, MEM_dupallocN(template), NULL);
@@ -478,15 +478,15 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
TIP_("Unlink datablock. Shift + Click to set users to zero, data will then not be saved"));
uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_DELETE));
- if(RNA_property_flag(template->prop) & PROP_NEVER_NULL)
+ if (RNA_property_flag(template->prop) & PROP_NEVER_NULL)
uiButSetFlag(but, UI_BUT_DISABLED);
}
- if((idfrom && idfrom->lib) || !editable)
+ if ((idfrom && idfrom->lib) || !editable)
uiButSetFlag(but, UI_BUT_DISABLED);
}
- if(idcode == ID_TE)
+ if (idcode == ID_TE)
uiTemplateTextureShow(layout, C, &template->ptr, template->prop);
uiBlockEndAlign(block);
@@ -501,7 +501,7 @@ static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, const
prop= RNA_struct_find_property(ptr, propname);
- if(!prop || RNA_property_type(prop) != PROP_POINTER) {
+ if (!prop || RNA_property_type(prop) != PROP_POINTER) {
RNA_warning("pointer property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
@@ -512,9 +512,9 @@ static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, const
template->prv_rows = prv_rows;
template->prv_cols = prv_cols;
- if(newop)
+ if (newop)
flag |= UI_ID_ADD_NEW;
- if(openop)
+ if (openop)
flag |= UI_ID_OPEN;
type= RNA_property_pointer_type(ptr, prop);
@@ -524,7 +524,7 @@ static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, const
/* create UI elements for this template
* - template_ID makes a copy of the template data and assigns it to the relevant buttons
*/
- if(template->idlb) {
+ if (template->idlb) {
uiLayoutRow(layout, 1);
template_ID(C, layout, template, type, idcode, flag, newop, openop, unlinkop);
}
@@ -649,9 +649,9 @@ static void modifiers_setOnCage(bContext *C, void *ob_v, void *md_v)
/* undo button operation */
md->mode ^= eModifierMode_OnCage;
- for(i = 0, md=ob->modifiers.first; md; ++i, md=md->next) {
- if(md == md_v) {
- if(i >= cageIndex)
+ for (i = 0, md=ob->modifiers.first; md; ++i, md=md->next) {
+ if (md == md_v) {
+ if (i >= cageIndex)
md->mode ^= eModifierMode_OnCage;
break;
}
@@ -685,8 +685,8 @@ static void modifiers_convertToReal(bContext *C, void *ob_v, void *md_v)
static int modifier_can_delete(ModifierData *md)
{
/* fluid particle modifier can't be deleted here */
- if(md->type == eModifierType_ParticleSystem)
- if(((ParticleSystemModifierData *)md)->psys->part->type == PART_FLUID)
+ if (md->type == eModifierType_ParticleSystem)
+ if (((ParticleSystemModifierData *)md)->psys->part->type == PART_FLUID)
return 0;
return 1;
@@ -800,7 +800,8 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob,
but = uiDefIconButBitI(block, TOG, eModifierMode_ApplyOnSpline, 0, ICON_SURFACE_DATA, 0, 0, UI_UNIT_X-2, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0,
TIP_("This modifier could be applied on splines' points only"));
uiButSetFlag(but, UI_BUT_DISABLED);
- } else if (mti->type != eModifierTypeType_Constructive) {
+ }
+ else if (mti->type != eModifierTypeType_Constructive) {
/* constructive modifiers tessellates curve before applying */
uiItemR(row, &ptr, "use_apply_on_spline", 0, "", ICON_NONE);
}
@@ -840,9 +841,9 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob,
ParticleSystem *psys= ((ParticleSystemModifierData *)md)->psys;
if (!(ob->mode & OB_MODE_PARTICLE_EDIT) && psys->pathcache) {
- if(ELEM(psys->part->ren_as, PART_DRAW_GR, PART_DRAW_OB))
+ if (ELEM(psys->part->ren_as, PART_DRAW_GR, PART_DRAW_OB))
uiItemO(row, "Convert", ICON_NONE, "OBJECT_OT_duplicates_make_real");
- else if(psys->part->ren_as == PART_DRAW_PATH)
+ else if (psys->part->ren_as == PART_DRAW_PATH)
uiItemO(row, "Convert", ICON_NONE, "OBJECT_OT_modifier_convert");
}
}
@@ -867,7 +868,7 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob,
}
/* error messages */
- if(md->error) {
+ if (md->error) {
box = uiLayoutBox(column);
row = uiLayoutRow(box, 0);
uiItemL(row, md->error, ICON_ERROR);
@@ -884,7 +885,7 @@ uiLayout *uiTemplateModifier(uiLayout *layout, bContext *C, PointerRNA *ptr)
int i, lastCageIndex, cageIndex;
/* verify we have valid data */
- if(!RNA_struct_is_a(ptr->type, &RNA_Modifier)) {
+ if (!RNA_struct_is_a(ptr->type, &RNA_Modifier)) {
RNA_warning("Expected modifier on object");
return NULL;
}
@@ -892,7 +893,7 @@ uiLayout *uiTemplateModifier(uiLayout *layout, bContext *C, PointerRNA *ptr)
ob= ptr->id.data;
md= ptr->data;
- if(!ob || !(GS(ob->id.name) == ID_OB)) {
+ if (!ob || !(GS(ob->id.name) == ID_OB)) {
RNA_warning("Expected modifier on object");
return NULL;
}
@@ -905,10 +906,10 @@ uiLayout *uiTemplateModifier(uiLayout *layout, bContext *C, PointerRNA *ptr)
// XXX virtual modifiers are not accesible for python
vmd = modifiers_getVirtualModifierList(ob);
- for(i=0; vmd; i++, vmd=vmd->next) {
- if(md == vmd)
+ for (i=0; vmd; i++, vmd=vmd->next) {
+ if (md == vmd)
return draw_modifier(layout, scene, ob, md, i, cageIndex, lastCageIndex);
- else if(vmd->mode & eModifierMode_Virtual)
+ else if (vmd->mode & eModifierMode_Virtual)
i--;
}
@@ -954,7 +955,7 @@ static void do_constraint_panels(bContext *C, void *ob_pt, int event)
// object_test_constraints(ob);
// if(ob->pose) update_pose_constraint_flags(ob->pose);
- if(ob->type==OB_ARMATURE) DAG_id_tag_update(&ob->id, OB_RECALC_DATA|OB_RECALC_OB);
+ if (ob->type==OB_ARMATURE) DAG_id_tag_update(&ob->id, OB_RECALC_DATA|OB_RECALC_OB);
else DAG_id_tag_update(&ob->id, OB_RECALC_OB);
WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, ob);
@@ -1019,7 +1020,7 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
if (con->flag & CONSTRAINT_DISABLE)
uiLayoutSetRedAlert(row, 1);
- if(proxy_protected == 0) {
+ if (proxy_protected == 0) {
uiItemR(row, &ptr, "name", 0, "", ICON_NONE);
}
else
@@ -1110,7 +1111,7 @@ uiLayout *uiTemplateConstraint(uiLayout *layout, PointerRNA *ptr)
bConstraint *con;
/* verify we have valid data */
- if(!RNA_struct_is_a(ptr->type, &RNA_Constraint)) {
+ if (!RNA_struct_is_a(ptr->type, &RNA_Constraint)) {
RNA_warning("Expected constraint on object");
return NULL;
}
@@ -1118,7 +1119,7 @@ uiLayout *uiTemplateConstraint(uiLayout *layout, PointerRNA *ptr)
ob= ptr->id.data;
con= ptr->data;
- if(!ob || !(GS(ob->id.name) == ID_OB)) {
+ if (!ob || !(GS(ob->id.name) == ID_OB)) {
RNA_warning("Expected constraint on object");
return NULL;
}
@@ -1126,9 +1127,9 @@ uiLayout *uiTemplateConstraint(uiLayout *layout, PointerRNA *ptr)
uiBlockSetButLock(uiLayoutGetBlock(layout), (ob && ob->id.lib), ERROR_LIBDATA_MESSAGE);
/* hrms, the temporal constraint should not draw! */
- if(con->type==CONSTRAINT_TYPE_KINEMATIC) {
+ if (con->type==CONSTRAINT_TYPE_KINEMATIC) {
bKinematicConstraint *data= con->data;
- if(data->flag & CONSTRAINT_IK_TEMP)
+ if (data->flag & CONSTRAINT_IK_TEMP)
return NULL;
}
@@ -1164,7 +1165,7 @@ void uiTemplatePreview(uiLayout *layout, ID *id, int show_buttons, ID *parent, M
PointerRNA material_ptr;
PointerRNA texture_ptr;
- if(id && !ELEM4(GS(id->name), ID_MA, ID_TE, ID_WO, ID_LA)) {
+ if (id && !ELEM4(GS(id->name), ID_MA, ID_TE, ID_WO, ID_LA)) {
RNA_warning("Expected ID of type material, texture, lamp or world");
return;
}
@@ -1173,18 +1174,18 @@ void uiTemplatePreview(uiLayout *layout, ID *id, int show_buttons, ID *parent, M
pid= id;
pparent= NULL;
- if(id && (GS(id->name) == ID_TE)) {
- if(parent && (GS(parent->name) == ID_MA))
+ if (id && (GS(id->name) == ID_TE)) {
+ if (parent && (GS(parent->name) == ID_MA))
pr_texture= &((Material*)parent)->pr_texture;
- else if(parent && (GS(parent->name) == ID_WO))
+ else if (parent && (GS(parent->name) == ID_WO))
pr_texture= &((World*)parent)->pr_texture;
- else if(parent && (GS(parent->name) == ID_LA))
+ else if (parent && (GS(parent->name) == ID_LA))
pr_texture= &((Lamp*)parent)->pr_texture;
- if(pr_texture) {
- if(*pr_texture == TEX_PR_OTHER)
+ if (pr_texture) {
+ if (*pr_texture == TEX_PR_OTHER)
pid= parent;
- else if(*pr_texture == TEX_PR_BOTH)
+ else if (*pr_texture == TEX_PR_BOTH)
pparent= parent;
}
}
@@ -1202,8 +1203,8 @@ void uiTemplatePreview(uiLayout *layout, ID *id, int show_buttons, ID *parent, M
/* add buttons */
if (pid && show_buttons) {
- if(GS(pid->name) == ID_MA || (pparent && GS(pparent->name) == ID_MA)) {
- if(GS(pid->name) == ID_MA) ma= (Material*)pid;
+ if (GS(pid->name) == ID_MA || (pparent && GS(pparent->name) == ID_MA)) {
+ if (GS(pid->name) == ID_MA) ma= (Material*)pid;
else ma= (Material*)pparent;
/* Create RNA Pointer */
@@ -1214,22 +1215,22 @@ void uiTemplatePreview(uiLayout *layout, ID *id, int show_buttons, ID *parent, M
uiItemR(col, &material_ptr, "preview_render_type", UI_ITEM_R_EXPAND, "", ICON_NONE);
}
- if(pr_texture) {
+ if (pr_texture) {
/* Create RNA Pointer */
RNA_pointer_create(id, &RNA_Texture, tex, &texture_ptr);
uiLayoutRow(layout, 1);
uiDefButS(block, ROW, B_MATPRV, IFACE_("Texture"), 0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_TEXTURE, 0, 0, "");
- if(GS(parent->name) == ID_MA)
+ if (GS(parent->name) == ID_MA)
uiDefButS(block, ROW, B_MATPRV, IFACE_("Material"), 0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_OTHER, 0, 0, "");
- else if(GS(parent->name) == ID_LA)
+ else if (GS(parent->name) == ID_LA)
uiDefButS(block, ROW, B_MATPRV, IFACE_("Lamp"), 0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_OTHER, 0, 0, "");
- else if(GS(parent->name) == ID_WO)
+ else if (GS(parent->name) == ID_WO)
uiDefButS(block, ROW, B_MATPRV, IFACE_("World"), 0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_OTHER, 0, 0, "");
uiDefButS(block, ROW, B_MATPRV, IFACE_("Both"), 0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_BOTH, 0, 0, "");
/* Alpha button for texture preview */
- if(*pr_texture!=TEX_PR_OTHER) {
+ if (*pr_texture!=TEX_PR_OTHER) {
row = uiLayoutRow(layout, 0);
uiItemR(row, &texture_ptr, "use_preview_alpha", 0, NULL, ICON_NONE);
}
@@ -1262,12 +1263,12 @@ static void colorband_add_cb(bContext *C, void *cb_v, void *coba_v)
ColorBand *coba= coba_v;
float pos= 0.5f;
- if(coba->tot > 1) {
- if(coba->cur > 0) pos= (coba->data[coba->cur-1].pos + coba->data[coba->cur].pos) * 0.5f;
+ if (coba->tot > 1) {
+ if (coba->cur > 0) pos= (coba->data[coba->cur-1].pos + coba->data[coba->cur].pos) * 0.5f;
else pos= (coba->data[coba->cur+1].pos + coba->data[coba->cur].pos) * 0.5f;
}
- if(colorband_element_add(coba, pos)) {
+ if (colorband_element_add(coba, pos)) {
rna_update_cb(C, cb_v, NULL);
ED_undo_push(C, "Add colorband");
}
@@ -1277,7 +1278,7 @@ static void colorband_del_cb(bContext *C, void *cb_v, void *coba_v)
{
ColorBand *coba= coba_v;
- if(colorband_element_remove(coba, coba->cur)) {
+ if (colorband_element_remove(coba, coba->cur)) {
ED_undo_push(C, "Delete colorband");
rna_update_cb(C, cb_v, NULL);
}
@@ -1290,10 +1291,10 @@ static void colorband_flip_cb(bContext *C, void *cb_v, void *coba_v)
ColorBand *coba= coba_v;
int a;
- for(a=0; a<coba->tot; a++) {
+ for (a=0; a<coba->tot; a++) {
data_tmp[a]= coba->data[coba->tot - (a + 1)];
}
- for(a=0; a<coba->tot; a++) {
+ for (a=0; a<coba->tot; a++) {
data_tmp[a].pos = 1.0f - data_tmp[a].pos;
coba->data[a]= data_tmp[a];
}
@@ -1325,7 +1326,7 @@ static void colorband_buttons_large(uiLayout *layout, uiBlock *block, ColorBand
const int line1_y= yoffs + 65 + UI_UNIT_Y + 2; /* 2 for some space between the buttons */
const int line2_y= yoffs + 65;
- if(coba==NULL) return;
+ if (coba==NULL) return;
bt= uiDefBut(block, BUT, 0, IFACE_("Add"), 0+xoffs,line1_y,40,UI_UNIT_Y, NULL, 0, 0, 0, 0,
TIP_("Add a new color stop to the colorband"));
@@ -1352,7 +1353,7 @@ static void colorband_buttons_large(uiLayout *layout, uiBlock *block, ColorBand
- if(coba->tot) {
+ if (coba->tot) {
CBData *cbd= coba->data + coba->cur;
/* better to use rna so we can animate them */
@@ -1386,7 +1387,7 @@ static void colorband_buttons_small(uiLayout *layout, uiBlock *block, ColorBand
uiButSetNFunc(bt, colorband_flip_cb, MEM_dupallocN(cb), coba);
uiBlockEndAlign(block);
- if(coba->tot) {
+ if (coba->tot) {
CBData *cbd= coba->data + coba->cur;
PointerRNA ptr;
RNA_pointer_create(cb->ptr.id.data, &RNA_ColorRampElement, cbd, &ptr);
@@ -1406,7 +1407,7 @@ static void colorband_buttons_small(uiLayout *layout, uiBlock *block, ColorBand
static void colorband_buttons_layout(uiLayout *layout, uiBlock *block, ColorBand *coba, rctf *butr, int small, RNAUpdateCb *cb)
{
- if(small)
+ if (small)
colorband_buttons_small(layout, block, coba, butr, cb);
else
colorband_buttons_large(layout, block, coba, 0, 0, cb);
@@ -1420,11 +1421,11 @@ void uiTemplateColorRamp(uiLayout *layout, PointerRNA *ptr, const char *propname
uiBlock *block;
rctf rect;
- if(!prop || RNA_property_type(prop) != PROP_POINTER)
+ if (!prop || RNA_property_type(prop) != PROP_POINTER)
return;
cptr= RNA_property_pointer_get(ptr, prop);
- if(!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_ColorRamp))
+ if (!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_ColorRamp))
return;
cb= MEM_callocN(sizeof(RNAUpdateCb), "RNAUpdateCb");
@@ -1452,11 +1453,11 @@ void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, const char *propname
Histogram *hist;
rctf rect;
- if(!prop || RNA_property_type(prop) != PROP_POINTER)
+ if (!prop || RNA_property_type(prop) != PROP_POINTER)
return;
cptr= RNA_property_pointer_get(ptr, prop);
- if(!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_Histogram))
+ if (!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_Histogram))
return;
cb= MEM_callocN(sizeof(RNAUpdateCb), "RNAUpdateCb");
@@ -1491,11 +1492,11 @@ void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, const char *propname)
Scopes *scopes;
rctf rect;
- if(!prop || RNA_property_type(prop) != PROP_POINTER)
+ if (!prop || RNA_property_type(prop) != PROP_POINTER)
return;
cptr= RNA_property_pointer_get(ptr, prop);
- if(!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_Scopes))
+ if (!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_Scopes))
return;
scopes = (Scopes *)cptr.data;
@@ -1528,11 +1529,11 @@ void uiTemplateVectorscope(uiLayout *layout, PointerRNA *ptr, const char *propna
Scopes *scopes;
rctf rect;
- if(!prop || RNA_property_type(prop) != PROP_POINTER)
+ if (!prop || RNA_property_type(prop) != PROP_POINTER)
return;
cptr= RNA_property_pointer_get(ptr, prop);
- if(!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_Scopes))
+ if (!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_Scopes))
return;
scopes = (Scopes *)cptr.data;
@@ -1562,7 +1563,7 @@ static void curvemap_buttons_zoom_in(bContext *C, void *cumap_v, void *UNUSED(ar
float d;
/* we allow 20 times zoom */
- if( (cumap->curr.xmax - cumap->curr.xmin) > 0.04f*(cumap->clipr.xmax - cumap->clipr.xmin) ) {
+ if ( (cumap->curr.xmax - cumap->curr.xmin) > 0.04f*(cumap->clipr.xmax - cumap->clipr.xmin) ) {
d= 0.1154f*(cumap->curr.xmax - cumap->curr.xmin);
cumap->curr.xmin+= d;
cumap->curr.xmax-= d;
@@ -1580,30 +1581,30 @@ static void curvemap_buttons_zoom_out(bContext *C, void *cumap_v, void *UNUSED(u
float d, d1;
/* we allow 20 times zoom, but don't view outside clip */
- if( (cumap->curr.xmax - cumap->curr.xmin) < 20.0f*(cumap->clipr.xmax - cumap->clipr.xmin) ) {
+ if ( (cumap->curr.xmax - cumap->curr.xmin) < 20.0f*(cumap->clipr.xmax - cumap->clipr.xmin) ) {
d= d1= 0.15f*(cumap->curr.xmax - cumap->curr.xmin);
- if(cumap->flag & CUMA_DO_CLIP)
- if(cumap->curr.xmin-d < cumap->clipr.xmin)
+ if (cumap->flag & CUMA_DO_CLIP)
+ if (cumap->curr.xmin-d < cumap->clipr.xmin)
d1= cumap->curr.xmin - cumap->clipr.xmin;
cumap->curr.xmin-= d1;
d1= d;
- if(cumap->flag & CUMA_DO_CLIP)
- if(cumap->curr.xmax+d > cumap->clipr.xmax)
+ if (cumap->flag & CUMA_DO_CLIP)
+ if (cumap->curr.xmax+d > cumap->clipr.xmax)
d1= -cumap->curr.xmax + cumap->clipr.xmax;
cumap->curr.xmax+= d1;
d= d1= 0.15f*(cumap->curr.ymax - cumap->curr.ymin);
- if(cumap->flag & CUMA_DO_CLIP)
- if(cumap->curr.ymin-d < cumap->clipr.ymin)
+ if (cumap->flag & CUMA_DO_CLIP)
+ if (cumap->curr.ymin-d < cumap->clipr.ymin)
d1= cumap->curr.ymin - cumap->clipr.ymin;
cumap->curr.ymin-= d1;
d1= d;
- if(cumap->flag & CUMA_DO_CLIP)
- if(cumap->curr.ymax+d > cumap->clipr.ymax)
+ if (cumap->flag & CUMA_DO_CLIP)
+ if (cumap->curr.ymax+d > cumap->clipr.ymax)
d1= -cumap->curr.ymax + cumap->clipr.ymax;
cumap->curr.ymax+= d1;
}
@@ -1743,7 +1744,7 @@ static void curvemap_buttons_reset(bContext *C, void *cb_v, void *cumap_v)
int a;
cumap->preset = CURVE_PRESET_LINE;
- for(a=0; a<CM_TOT; a++)
+ for (a=0; a<CM_TOT; a++)
curvemap_reset(cumap->cm+a, &cumap->clipr, cumap->preset, CURVEMAP_SLOPE_POSITIVE);
cumap->black[0]=cumap->black[1]=cumap->black[2]= 0.0f;
@@ -1771,42 +1772,42 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe
/* curve chooser */
row= uiLayoutRow(layout, 0);
- if(labeltype=='v') {
+ if (labeltype=='v') {
/* vector */
sub= uiLayoutRow(row, 1);
uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT);
- if(cumap->cm[0].curve) {
+ if (cumap->cm[0].curve) {
bt= uiDefButI(block, ROW, 0, "X", 0, 0, dx, dx, &cumap->cur, 0.0, 0.0, 0.0, 0.0, "");
uiButSetFunc(bt, curvemap_buttons_redraw, NULL, NULL);
}
- if(cumap->cm[1].curve) {
+ if (cumap->cm[1].curve) {
bt= uiDefButI(block, ROW, 0, "Y", 0, 0, dx, dx, &cumap->cur, 0.0, 1.0, 0.0, 0.0, "");
uiButSetFunc(bt, curvemap_buttons_redraw, NULL, NULL);
}
- if(cumap->cm[2].curve) {
+ if (cumap->cm[2].curve) {
bt= uiDefButI(block, ROW, 0, "Z", 0, 0, dx, dx, &cumap->cur, 0.0, 2.0, 0.0, 0.0, "");
uiButSetFunc(bt, curvemap_buttons_redraw, NULL, NULL);
}
}
- else if(labeltype=='c') {
+ else if (labeltype=='c') {
/* color */
sub= uiLayoutRow(row, 1);
uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT);
- if(cumap->cm[3].curve) {
+ if (cumap->cm[3].curve) {
bt= uiDefButI(block, ROW, 0, "C", 0, 0, dx, dx, &cumap->cur, 0.0, 3.0, 0.0, 0.0, "");
uiButSetFunc(bt, curvemap_buttons_redraw, NULL, NULL);
}
- if(cumap->cm[0].curve) {
+ if (cumap->cm[0].curve) {
bt= uiDefButI(block, ROW, 0, "R", 0, 0, dx, dx, &cumap->cur, 0.0, 0.0, 0.0, 0.0, "");
uiButSetFunc(bt, curvemap_buttons_redraw, NULL, NULL);
}
- if(cumap->cm[1].curve) {
+ if (cumap->cm[1].curve) {
bt= uiDefButI(block, ROW, 0, "G", 0, 0, dx, dx, &cumap->cur, 0.0, 1.0, 0.0, 0.0, "");
uiButSetFunc(bt, curvemap_buttons_redraw, NULL, NULL);
}
- if(cumap->cm[2].curve) {
+ if (cumap->cm[2].curve) {
bt= uiDefButI(block, ROW, 0, "B", 0, 0, dx, dx, &cumap->cur, 0.0, 2.0, 0.0, 0.0, "");
uiButSetFunc(bt, curvemap_buttons_redraw, NULL, NULL);
}
@@ -1816,15 +1817,15 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe
sub= uiLayoutRow(row, 1);
uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT);
- if(cumap->cm[0].curve) {
+ if (cumap->cm[0].curve) {
bt= uiDefButI(block, ROW, 0, "H", 0, 0, dx, dx, &cumap->cur, 0.0, 0.0, 0.0, 0.0, "");
uiButSetFunc(bt, curvemap_buttons_redraw, NULL, NULL);
}
- if(cumap->cm[1].curve) {
+ if (cumap->cm[1].curve) {
bt= uiDefButI(block, ROW, 0, "S", 0, 0, dx, dx, &cumap->cur, 0.0, 1.0, 0.0, 0.0, "");
uiButSetFunc(bt, curvemap_buttons_redraw, NULL, NULL);
}
- if(cumap->cm[2].curve) {
+ if (cumap->cm[2].curve) {
bt= uiDefButI(block, ROW, 0, "V", 0, 0, dx, dx, &cumap->cur, 0.0, 2.0, 0.0, 0.0, "");
uiButSetFunc(bt, curvemap_buttons_redraw, NULL, NULL);
}
@@ -1846,14 +1847,14 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe
bt= uiDefIconBut(block, BUT, 0, ICON_ZOOMOUT, 0, 0, dx, dx, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Zoom out"));
uiButSetFunc(bt, curvemap_buttons_zoom_out, cumap, NULL);
- if(brush)
+ if (brush)
bt= uiDefIconBlockBut(block, curvemap_brush_tools_func, cumap, 0, ICON_MODIFIER, 0, 0, dx, dx, TIP_("Tools"));
else
bt= uiDefIconBlockBut(block, curvemap_tools_func, cumap, 0, ICON_MODIFIER, 0, 0, dx, dx, TIP_("Tools"));
uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
- if(cumap->flag & CUMA_DO_CLIP) icon= ICON_CLIPUV_HLT; else icon= ICON_CLIPUV_DEHLT;
+ if (cumap->flag & CUMA_DO_CLIP) icon= ICON_CLIPUV_HLT; else icon= ICON_CLIPUV_DEHLT;
bt= uiDefIconBlockBut(block, curvemap_clipping_func, cumap, 0, icon, 0, 0, dx, dx, TIP_("Clipping Options"));
uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
@@ -1870,7 +1871,7 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe
uiDefBut(block, BUT_CURVE, 0, "", 0, 0, size, MIN2(size, 200), cumap, 0.0f, 1.0f, bg, 0, "");
/* black/white levels */
- if(levels) {
+ if (levels) {
split= uiLayoutSplit(layout, 0, 0);
uiItemR(uiLayoutColumn(split, 0), ptr, "black_level", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
uiItemR(uiLayoutColumn(split, 0), ptr, "white_level", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
@@ -1890,20 +1891,20 @@ void uiTemplateCurveMapping(uiLayout *layout, PointerRNA *ptr, const char *propn
PropertyRNA *prop= RNA_struct_find_property(ptr, propname);
PointerRNA cptr;
- if(!prop) {
+ if (!prop) {
RNA_warning("curve property not found: %s.%s",
RNA_struct_identifier(ptr->type), propname);
return;
}
- if(RNA_property_type(prop) != PROP_POINTER) {
+ if (RNA_property_type(prop) != PROP_POINTER) {
RNA_warning("curve is not a pointer: %s.%s",
RNA_struct_identifier(ptr->type), propname);
return;
}
cptr= RNA_property_pointer_get(ptr, prop);
- if(!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_CurveMapping))
+ if (!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_CurveMapping))
return;
cb= MEM_callocN(sizeof(RNAUpdateCb), "RNAUpdateCb");
@@ -1939,18 +1940,18 @@ void uiTemplateColorWheel(uiLayout *layout, PointerRNA *ptr, const char *propnam
but = uiDefButR_prop(block, HSVCIRCLE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop, -1, 0.0, 0.0, 0, 0, "");
- if(lock) {
+ if (lock) {
but->flag |= UI_BUT_COLOR_LOCK;
}
- if(lock_luminosity) {
+ if (lock_luminosity) {
float color[4]; /* in case of alpha */
but->flag |= UI_BUT_VEC_SIZE_LOCK;
RNA_property_float_get_array(ptr, prop, color);
but->a2= len_v3(color);
}
- if(cubic)
+ if (cubic)
but->flag |= UI_BUT_COLOR_CUBIC;
uiItemS(row);
@@ -1968,13 +1969,13 @@ static void handle_layer_buttons(bContext *C, void *arg1, void *arg2)
wmWindow *win= CTX_wm_window(C);
int i, tot, shift= win->eventstate->shift;
- if(!shift) {
+ if (!shift) {
tot= RNA_property_array_length(&but->rnapoin, but->rnaprop);
/* Normally clicking only selects one layer */
RNA_property_boolean_set_index(&but->rnapoin, but->rnaprop, cur, TRUE);
- for(i = 0; i < tot; ++i) {
- if(i != cur)
+ for (i = 0; i < tot; ++i) {
+ if (i != cur)
RNA_property_boolean_set_index(&but->rnapoin, but->rnaprop, i, FALSE);
}
}
@@ -2012,14 +2013,14 @@ void uiTemplateLayers(uiLayout *layout, PointerRNA *ptr, const char *propname,
cols= (layers / 2) + (layers % 2);
groups= ((cols / 2) < cols_per_group) ? (1) : (cols / cols_per_group);
- if(used_ptr && used_propname) {
+ if (used_ptr && used_propname) {
used_prop= RNA_struct_find_property(used_ptr, used_propname);
if (!used_prop) {
RNA_warning("used layers property not found: %s.%s", RNA_struct_identifier(ptr->type), used_propname);
return;
}
- if(RNA_property_array_length(used_ptr, used_prop) < layers)
+ if (RNA_property_array_length(used_ptr, used_prop) < layers)
used_prop = NULL;
}
@@ -2041,9 +2042,9 @@ void uiTemplateLayers(uiLayout *layout, PointerRNA *ptr, const char *propname,
int icon = 0;
int butlay = 1 << layer;
- if(active_layer & butlay)
+ if (active_layer & butlay)
icon = ICON_LAYER_ACTIVE;
- else if(used_prop && RNA_property_boolean_get_index(used_ptr, used_prop, layer))
+ else if (used_prop && RNA_property_boolean_get_index(used_ptr, used_prop, layer))
icon = ICON_LAYER_USED;
but = uiDefAutoButR(block, ptr, prop, layer, "", icon, 0, 0, UI_UNIT_X/2, UI_UNIT_Y/2);
@@ -2062,20 +2063,20 @@ static int list_item_icon_get(bContext *C, PointerRNA *itemptr, int rnaicon, int
ID *id= NULL;
int icon;
- if(!itemptr->data)
+ if (!itemptr->data)
return rnaicon;
/* try ID, material or texture slot */
- if(RNA_struct_is_ID(itemptr->type)) {
+ if (RNA_struct_is_ID(itemptr->type)) {
id= itemptr->id.data;
}
- else if(RNA_struct_is_a(itemptr->type, &RNA_MaterialSlot)) {
+ else if (RNA_struct_is_a(itemptr->type, &RNA_MaterialSlot)) {
id= RNA_pointer_get(itemptr, "material").data;
}
- else if(RNA_struct_is_a(itemptr->type, &RNA_TextureSlot)) {
+ else if (RNA_struct_is_a(itemptr->type, &RNA_TextureSlot)) {
id= RNA_pointer_get(itemptr, "texture").data;
}
- else if(RNA_struct_is_a(itemptr->type, &RNA_DynamicPaintSurface)) {
+ else if (RNA_struct_is_a(itemptr->type, &RNA_DynamicPaintSurface)) {
DynamicPaintSurface *surface= (DynamicPaintSurface*)itemptr->data;
if (surface->format == MOD_DPAINT_SURFACE_F_PTEX) return ICON_TEXTURE_SHADED;
@@ -2084,10 +2085,10 @@ static int list_item_icon_get(bContext *C, PointerRNA *itemptr, int rnaicon, int
}
/* get icon from ID */
- if(id) {
+ if (id) {
icon= ui_id_icon_get(C, id, big);
- if(icon)
+ if (icon)
return icon;
}
@@ -2115,30 +2116,30 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
/* retrieve icon and name */
icon= list_item_icon_get(C, itemptr, rnaicon, 0);
- if(icon == ICON_NONE || icon == ICON_DOT)
+ if (icon == ICON_NONE || icon == ICON_DOT)
icon= 0;
namebuf= RNA_struct_name_get_alloc(itemptr, NULL, 0, NULL);
name= (namebuf)? namebuf: "";
/* hardcoded types */
- if(itemptr->type == &RNA_MeshTexturePolyLayer || itemptr->type == &RNA_MeshLoopColorLayer) {
+ if (itemptr->type == &RNA_MeshTexturePolyLayer || itemptr->type == &RNA_MeshLoopColorLayer) {
uiItemL(sub, name, icon);
uiBlockSetEmboss(block, UI_EMBOSSN);
uiDefIconButR(block, TOG, 0, ICON_SCENE, 0, 0, UI_UNIT_X, UI_UNIT_Y, itemptr, "active_render", 0, 0, 0, 0, 0, NULL);
uiBlockSetEmboss(block, UI_EMBOSS);
}
- else if(RNA_struct_is_a(itemptr->type, &RNA_MaterialTextureSlot)) {
+ else if (RNA_struct_is_a(itemptr->type, &RNA_MaterialTextureSlot)) {
uiItemL(sub, name, icon);
uiBlockSetEmboss(block, UI_EMBOSS);
uiDefButR(block, OPTION, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y, ptr, "use_textures", i, 0, 0, 0, 0, NULL);
}
- else if(RNA_struct_is_a(itemptr->type, &RNA_SceneRenderLayer)) {
+ else if (RNA_struct_is_a(itemptr->type, &RNA_SceneRenderLayer)) {
uiItemL(sub, name, icon);
uiBlockSetEmboss(block, UI_EMBOSS);
uiDefButR(block, OPTION, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y, itemptr, "use", 0, 0, 0, 0, 0, NULL);
}
- else if(RNA_struct_is_a(itemptr->type, &RNA_MaterialSlot)) {
+ else if (RNA_struct_is_a(itemptr->type, &RNA_MaterialSlot)) {
/* provision to draw active node name */
Material *ma, *manode;
Scene *scene= CTX_data_scene(C);
@@ -2149,19 +2150,19 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
uiItemL(sub, name, icon);
ma= give_current_material(ob, index+1);
- if (ma && !scene_use_new_shading_nodes(scene)){
+ if (ma && !scene_use_new_shading_nodes(scene)) {
manode= give_node_material(ma);
- if(manode) {
+ if (manode) {
char str[MAX_ID_NAME + 12];
BLI_snprintf(str, sizeof(str), "Node %s", manode->id.name+2);
uiItemL(sub, str, ui_id_icon_get(C, &manode->id, 1));
}
- else if(ma->use_nodes) {
+ else if (ma->use_nodes) {
uiItemL(sub, "Node <none>", ICON_NONE);
}
}
}
- else if(itemptr->type == &RNA_ShapeKey) {
+ else if (itemptr->type == &RNA_ShapeKey) {
Object *ob= (Object*)activeptr->data;
Key *key= (Key*)itemptr->id.data;
@@ -2171,18 +2172,18 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
uiBlockSetEmboss(block, UI_EMBOSSN);
row= uiLayoutRow(split, 1);
- if(i == 0 || (key->type != KEY_RELATIVE)) uiItemL(row, "", ICON_NONE);
+ if (i == 0 || (key->type != KEY_RELATIVE)) uiItemL(row, "", ICON_NONE);
else uiItemR(row, itemptr, "value", 0, "", ICON_NONE);
uiItemR(row, itemptr, "mute", 0, "", 0);
- if( (key->flag & KEYBLOCK_MUTE) ||
+ if ( (key->flag & KEYBLOCK_MUTE) ||
(ob->mode == OB_MODE_EDIT && !((ob->shapeflag & OB_SHAPE_EDIT_MODE) && ob->type == OB_MESH)) )
{
uiLayoutSetActive(row, 0);
}
uiBlockSetEmboss(block, UI_EMBOSS);
}
- else if(itemptr->type == &RNA_VertexGroup) {
+ else if (itemptr->type == &RNA_VertexGroup) {
bDeformGroup *dg= (bDeformGroup *)itemptr->data;
uiItemL(sub, name, icon);
/* RNA does not allow nice lock icons, use lower level buttons */
@@ -2194,7 +2195,7 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
uiBlockSetEmboss(block, UI_EMBOSS);
#endif
}
- else if(itemptr->type == &RNA_KeyingSetPath) {
+ else if (itemptr->type == &RNA_KeyingSetPath) {
KS_Path *ksp = (KS_Path*)itemptr->data;
/* icon needs to be the type of ID which is currently active */
@@ -2203,7 +2204,7 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
/* nothing else special to do... */
uiItemL(sub, name, icon); /* fails, backdrop LISTROW... */
}
- else if(itemptr->type == &RNA_DynamicPaintSurface) {
+ else if (itemptr->type == &RNA_DynamicPaintSurface) {
char name_final[96];
const char *enum_name;
PropertyRNA *prop = RNA_struct_find_property(itemptr, "surface_type");
@@ -2221,11 +2222,11 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
}
uiDefButR(block, OPTION, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y, itemptr, "is_active", i, 0, 0, 0, 0, NULL);
}
- else if(itemptr->type == &RNA_MovieTrackingObject) {
+ else if (itemptr->type == &RNA_MovieTrackingObject) {
MovieTrackingObject *tracking_object= (MovieTrackingObject*)itemptr->data;
split= uiLayoutSplit(sub, 0.75f, 0);
- if(tracking_object->flag&TRACKING_OBJECT_CAMERA) {
+ if (tracking_object->flag&TRACKING_OBJECT_CAMERA) {
uiItemL(split, name, ICON_CAMERA_DATA);
}
else {
@@ -2264,7 +2265,7 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
/* If the special property is set for the item, and it is a collection... */
PropertyRNA *prop_list= RNA_struct_find_property(itemptr, prop_list_id);
- if(prop_list && RNA_property_type(prop_list) == PROP_STRING) {
+ if (prop_list && RNA_property_type(prop_list) == PROP_STRING) {
int prop_names_len;
char *prop_names = RNA_property_string_get_alloc(itemptr, prop_list, NULL, 0, &prop_names_len);
char *prop_names_end= prop_names + prop_names_len;
@@ -2308,44 +2309,44 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
block= uiLayoutGetBlock(layout);
pa= block->panel;
- if(!pa) {
+ if (!pa) {
RNA_warning("Only works inside a panel");
return;
}
- if(!activeptr->data)
+ if (!activeptr->data)
return;
- if(ptr->data) {
+ if (ptr->data) {
prop= RNA_struct_find_property(ptr, propname);
- if(!prop) {
+ if (!prop) {
RNA_warning("Property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
}
activeprop= RNA_struct_find_property(activeptr, activepropname);
- if(!activeprop) {
+ if (!activeprop) {
RNA_warning("Property not found: %s.%s", RNA_struct_identifier(ptr->type), activepropname);
return;
}
- if(prop) {
+ if (prop) {
type= RNA_property_type(prop);
- if(type != PROP_COLLECTION) {
+ if (type != PROP_COLLECTION) {
RNA_warning("uiExpected collection property");
return;
}
}
activetype= RNA_property_type(activeprop);
- if(activetype != PROP_INT) {
+ if (activetype != PROP_INT) {
RNA_warning("Expected integer property");
return;
}
/* get icon */
- if(ptr->data && prop) {
+ if (ptr->data && prop) {
ptype= RNA_property_pointer_type(ptr, prop);
rnaicon= RNA_struct_ui_icon(ptype);
}
@@ -2353,16 +2354,16 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
/* get active data */
activei= RNA_property_int_get(activeptr, activeprop);
- if(listtype == 'i') {
+ if (listtype == 'i') {
box= uiLayoutListBox(layout, ptr, prop, activeptr, activeprop);
col= uiLayoutColumn(box, 1);
row= uiLayoutRow(col, 0);
- if(ptr->data && prop) {
+ if (ptr->data && prop) {
/* create list items */
RNA_PROP_BEGIN(ptr, itemptr, prop) {
/* create button */
- if(!(i % 9))
+ if (!(i % 9))
row= uiLayoutRow(col, 0);
icon= list_item_icon_get(C, &itemptr, rnaicon, 1);
@@ -2375,17 +2376,17 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
RNA_PROP_END;
}
}
- else if(listtype == 'c') {
+ else if (listtype == 'c') {
/* compact layout */
row= uiLayoutRow(layout, 1);
- if(ptr->data && prop) {
+ if (ptr->data && prop) {
/* create list items */
RNA_PROP_BEGIN(ptr, itemptr, prop) {
found= (activei == i);
- if(found) {
+ if (found) {
/* create button */
name= RNA_struct_name_get_alloc(&itemptr, NULL, 0, NULL);
icon= list_item_icon_get(C, &itemptr, rnaicon, 0);
@@ -2402,22 +2403,22 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
}
/* if not found, add in dummy button */
- if(i == 0)
+ if (i == 0)
uiItemL(row, "", ICON_NONE);
/* next/prev button */
BLI_snprintf(numstr, sizeof(numstr), "%d :", i);
but = uiDefIconTextButR_prop(block, NUM, 0, 0, numstr, 0,0,UI_UNIT_X*5,UI_UNIT_Y, activeptr, activeprop, 0, 0, 0, 0, 0, "");
- if(i == 0)
+ if (i == 0)
uiButSetFlag(but, UI_BUT_DISABLED);
}
else {
/* default rows */
- if(rows == 0)
+ if (rows == 0)
rows= 5;
if (maxrows == 0)
maxrows = 5;
- if(pa->list_grip_size != 0)
+ if (pa->list_grip_size != 0)
rows= pa->list_grip_size;
/* layout */
@@ -2428,13 +2429,13 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
/* init numbers */
RNA_property_int_range(activeptr, activeprop, &min, &max);
- if(prop)
+ if (prop)
len= RNA_property_collection_length(ptr, prop);
items= CLAMPIS(len, rows, MAX2(rows, maxrows));
/* if list length changes and active is out of view, scroll to it */
- if(pa->list_last_len != len)
- if((activei < pa->list_scroll || activei >= pa->list_scroll+items))
+ if (pa->list_last_len != len)
+ if ((activei < pa->list_scroll || activei >= pa->list_scroll+items))
pa->list_scroll= activei;
pa->list_scroll= MIN2(pa->list_scroll, len-items);
@@ -2442,10 +2443,10 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
pa->list_size= items;
pa->list_last_len= len;
- if(ptr->data && prop) {
+ if (ptr->data && prop) {
/* create list items */
RNA_PROP_BEGIN(ptr, itemptr, prop) {
- if(i >= pa->list_scroll && i<pa->list_scroll+items)
+ if (i >= pa->list_scroll && i<pa->list_scroll+items)
list_item_row(C, col, ptr, &itemptr, i, rnaicon, activeptr, activeprop, prop_list);
i++;
@@ -2454,14 +2455,14 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
}
/* add dummy buttons to fill space */
- while(i < pa->list_scroll+items) {
- if(i >= pa->list_scroll)
+ while (i < pa->list_scroll+items) {
+ if (i >= pa->list_scroll)
uiItemL(col, "", ICON_NONE);
i++;
}
/* add scrollbar */
- if(len > items) {
+ if (len > items) {
col= uiLayoutColumn(row, 0);
uiDefButI(block, SCROLL, 0, "", 0,0,UI_UNIT_X*0.75,UI_UNIT_Y*items, &pa->list_scroll, 0, len-items, items, 0, "");
}
@@ -2474,7 +2475,7 @@ static void operator_call_cb(bContext *C, void *UNUSED(arg1), void *arg2)
{
wmOperatorType *ot= arg2;
- if(ot)
+ if (ot)
WM_operator_name_call(C, ot->idname, WM_OP_INVOKE_DEFAULT, NULL);
}
@@ -2482,11 +2483,11 @@ static void operator_search_cb(const bContext *C, void *UNUSED(arg), const char
{
GHashIterator *iter= WM_operatortype_iter();
- for( ; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
+ for ( ; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
wmOperatorType *ot= BLI_ghashIterator_getValue(iter);
- if(BLI_strcasestr(ot->name, str)) {
- if(WM_operator_poll((bContext*)C, ot)) {
+ if (BLI_strcasestr(ot->name, str)) {
+ if (WM_operator_poll((bContext*)C, ot)) {
char name[256];
int len= strlen(ot->name);
@@ -2494,7 +2495,7 @@ static void operator_search_cb(const bContext *C, void *UNUSED(arg), const char
BLI_strncpy(name, ot->name, sizeof(name));
/* check for hotkey */
- if(len < sizeof(name)-6) {
+ if (len < sizeof(name)-6) {
if (WM_key_event_operator_string(C, ot->idname, WM_OP_EXEC_DEFAULT, NULL, TRUE,
&name[len+1], sizeof(name)-len-1))
{
@@ -2502,7 +2503,7 @@ static void operator_search_cb(const bContext *C, void *UNUSED(arg), const char
}
}
- if(0==uiSearchItemAdd(items, name, ot, 0))
+ if (0==uiSearchItemAdd(items, name, ot, 0))
break;
}
}
@@ -2570,29 +2571,32 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
uiBlockSetHandleFunc(block, do_running_jobs, NULL);
- if(sa->spacetype==SPACE_NODE) {
- if(WM_jobs_test(wm, sa))
+ if (sa->spacetype==SPACE_NODE) {
+ if (WM_jobs_test(wm, sa))
owner = sa;
handle_event= B_STOPCOMPO;
- } else if (sa->spacetype==SPACE_SEQ) {
- if(WM_jobs_test(wm, sa))
+ }
+ else if (sa->spacetype==SPACE_SEQ) {
+ if (WM_jobs_test(wm, sa))
owner = sa;
handle_event = B_STOPSEQ;
- } else if(sa->spacetype==SPACE_CLIP) {
- if(WM_jobs_test(wm, sa))
+ }
+ else if (sa->spacetype==SPACE_CLIP) {
+ if (WM_jobs_test(wm, sa))
owner = sa;
handle_event= B_STOPCLIP;
- } else {
+ }
+ else {
Scene *scene;
/* another scene can be rendering too, for example via compositor */
- for(scene= CTX_data_main(C)->scene.first; scene; scene= scene->id.next)
- if(WM_jobs_test(wm, scene))
+ for (scene= CTX_data_main(C)->scene.first; scene; scene= scene->id.next)
+ if (WM_jobs_test(wm, scene))
break;
owner = scene;
handle_event= B_STOPRENDER;
}
- if(owner) {
+ if (owner) {
uiLayout *ui_abs;
ui_abs= uiLayoutAbsolute(layout, 0);
@@ -2605,10 +2609,10 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
uiLayoutRow(layout, 0);
}
- if(WM_jobs_test(wm, screen))
+ if (WM_jobs_test(wm, screen))
uiDefIconTextBut(block, BUT, B_STOPCAST, ICON_CANCEL, IFACE_("Capture"), 0,0,85,UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0,
TIP_("Stop screencast"));
- if(screen->animtimer)
+ if (screen->animtimer)
uiDefIconTextBut(block, BUT, B_STOPANIM, ICON_CANCEL, TIP_("Anim Player"), 0,0,100,UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0,
TIP_("Stop animation playback"));
}
@@ -2657,11 +2661,11 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C)
/* icon and report message on top */
- if(report->type & RPT_ERROR_ALL)
+ if (report->type & RPT_ERROR_ALL)
icon = ICON_ERROR;
- else if(report->type & RPT_WARNING_ALL)
+ else if (report->type & RPT_WARNING_ALL)
icon = ICON_ERROR;
- else if(report->type & RPT_INFO_ALL)
+ else if (report->type & RPT_INFO_ALL)
icon = ICON_INFO;
/* XXX: temporary operator to dump all reports to a text block, but only if more than 1 report
@@ -2693,7 +2697,7 @@ static void template_keymap_item_properties(uiLayout *layout, const char *title,
uiItemS(layout);
- if(title)
+ if (title)
uiItemL(layout, title, ICON_NONE);
flow= uiLayoutColumnFlow(layout, 2, 0);
@@ -2701,15 +2705,15 @@ static void template_keymap_item_properties(uiLayout *layout, const char *title,
RNA_STRUCT_BEGIN(ptr, prop) {
int flag= RNA_property_flag(prop);
- if(flag & PROP_HIDDEN)
+ if (flag & PROP_HIDDEN)
continue;
/* recurse for nested properties */
- if(RNA_property_type(prop) == PROP_POINTER) {
+ if (RNA_property_type(prop) == PROP_POINTER) {
PointerRNA propptr= RNA_property_pointer_get(ptr, prop);
const char *name= RNA_property_ui_name(prop);
- if(propptr.data && RNA_struct_is_a(propptr.type, &RNA_OperatorProperties)) {
+ if (propptr.data && RNA_struct_is_a(propptr.type, &RNA_OperatorProperties)) {
template_keymap_item_properties(layout, name, &propptr);
continue;
}
@@ -2725,14 +2729,14 @@ void uiTemplateKeymapItemProperties(uiLayout *layout, PointerRNA *ptr)
{
PointerRNA propptr= RNA_pointer_get(ptr, "properties");
- if(propptr.data) {
+ if (propptr.data) {
uiBut *but= uiLayoutGetBlock(layout)->buttons.last;
template_keymap_item_properties(layout, NULL, &propptr);
/* attach callbacks to compensate for missing properties update,
* we don't know which keymap (item) is being modified there */
- for(; but; but=but->next)
+ for (; but; but=but->next)
uiButSetFunc(but, keymap_item_modified, ptr->data, NULL);
}
}
diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c
index 6692bd7bea8..91b37896e66 100644
--- a/source/blender/editors/interface/interface_utils.c
+++ b/source/blender/editors/interface/interface_utils.c
@@ -60,12 +60,12 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind
{
int arraylen= RNA_property_array_length(ptr, prop);
- if(arraylen && index == -1)
+ if (arraylen && index == -1)
return NULL;
- if(icon && name && name[0] == '\0')
+ if (icon && name && name[0] == '\0')
but = uiDefIconButR_prop(block, ICONTOG, 0, icon, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
- else if(icon)
+ else if (icon)
but = uiDefIconTextButR_prop(block, ICONTOG, 0, icon, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
else
but = uiDefButR_prop(block, OPTION, 0, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
@@ -76,28 +76,28 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind
{
int arraylen= RNA_property_array_length(ptr, prop);
- if(arraylen && index == -1) {
- if(ELEM(RNA_property_subtype(prop), PROP_COLOR, PROP_COLOR_GAMMA))
+ if (arraylen && index == -1) {
+ if (ELEM(RNA_property_subtype(prop), PROP_COLOR, PROP_COLOR_GAMMA))
but = uiDefButR_prop(block, COL, 0, name, x1, y1, x2, y2, ptr, prop, 0, 0, 0, -1, -1, NULL);
}
- else if(RNA_property_subtype(prop) == PROP_PERCENTAGE || RNA_property_subtype(prop) == PROP_FACTOR)
+ else if (RNA_property_subtype(prop) == PROP_PERCENTAGE || RNA_property_subtype(prop) == PROP_FACTOR)
but = uiDefButR_prop(block, NUMSLI, 0, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
else
but = uiDefButR_prop(block, NUM, 0, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
break;
}
case PROP_ENUM:
- if(icon && name && name[0] == '\0')
+ if (icon && name && name[0] == '\0')
but = uiDefIconButR_prop(block, MENU, 0, icon, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
- else if(icon)
+ else if (icon)
but = uiDefIconTextButR_prop(block, MENU, 0, icon, NULL, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
else
but = uiDefButR_prop(block, MENU, 0, NULL, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
break;
case PROP_STRING:
- if(icon && name && name[0] == '\0')
+ if (icon && name && name[0] == '\0')
but = uiDefIconButR_prop(block, TEX, 0, icon, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
- else if(icon)
+ else if (icon)
but = uiDefIconTextButR_prop(block, TEX, 0, icon, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
else
but = uiDefButR_prop(block, TEX, 0, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
@@ -106,10 +106,10 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind
PointerRNA pptr;
pptr= RNA_property_pointer_get(ptr, prop);
- if(!pptr.type)
+ if (!pptr.type)
pptr.type= RNA_property_pointer_type(ptr, prop);
icon= RNA_struct_ui_icon(pptr.type);
- if(icon == ICON_DOT)
+ if (icon == ICON_DOT)
icon= 0;
but = uiDefIconTextButR_prop(block, IDPOIN, 0, icon, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
@@ -141,22 +141,22 @@ int uiDefAutoButsRNA(uiLayout *layout, PointerRNA *ptr, int (*check_prop)(Pointe
RNA_STRUCT_BEGIN(ptr, prop) {
flag= RNA_property_flag(prop);
- if(flag & PROP_HIDDEN || (check_prop && check_prop(ptr, prop)==FALSE))
+ if (flag & PROP_HIDDEN || (check_prop && check_prop(ptr, prop)==FALSE))
continue;
- if(label_align != '\0') {
+ if (label_align != '\0') {
PropertyType type = RNA_property_type(prop);
int is_boolean = (type == PROP_BOOLEAN && !RNA_property_array_check(prop));
name= RNA_property_ui_name(prop);
- if(label_align=='V') {
+ if (label_align=='V') {
col= uiLayoutColumn(layout, 1);
- if(!is_boolean)
+ if (!is_boolean)
uiItemL(col, name, ICON_NONE);
}
- else if(label_align=='H') {
+ else if (label_align=='H') {
split = uiLayoutSplit(layout, 0.5f, 0);
col= uiLayoutColumn(split, 0);
@@ -194,16 +194,16 @@ int uiIconFromID(ID *id)
PointerRNA ptr;
short idcode;
- if(id==NULL)
+ if (id==NULL)
return ICON_NONE;
idcode= GS(id->name);
/* exception for objects */
- if(idcode == ID_OB) {
+ if (idcode == ID_OB) {
ob= (Object*)id;
- if(ob->type == OB_EMPTY)
+ if (ob->type == OB_EMPTY)
return ICON_EMPTY_DATA;
else
return uiIconFromID(ob->data);
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 32cb3f94ee7..3baa672e42d 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -246,7 +246,7 @@ static int round_box_shadow_edges(float (*vert)[2], rcti *rect, float rad, int r
rad+= step;
- if(2.0f*rad > rect->ymax-rect->ymin)
+ if (2.0f*rad > rect->ymax-rect->ymin)
rad= 0.5f*(rect->ymax-rect->ymin);
minx= rect->xmin-step;
@@ -255,59 +255,59 @@ static int round_box_shadow_edges(float (*vert)[2], rcti *rect, float rad, int r
maxy= rect->ymax+step;
/* mult */
- for(a=0; a < WIDGET_CURVE_RESOLU; a++) {
+ for (a=0; a < WIDGET_CURVE_RESOLU; a++) {
vec[a][0]= rad*cornervec[a][0];
vec[a][1]= rad*cornervec[a][1];
}
/* start with left-top, anti clockwise */
- if(roundboxalign & UI_CNR_TOP_LEFT) {
- for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
+ if (roundboxalign & UI_CNR_TOP_LEFT) {
+ for (a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
vert[tot][0]= minx+rad-vec[a][0];
vert[tot][1]= maxy-vec[a][1];
}
}
else {
- for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
+ for (a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
vert[tot][0]= minx;
vert[tot][1]= maxy;
}
}
- if(roundboxalign & UI_CNR_BOTTOM_LEFT) {
- for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
+ if (roundboxalign & UI_CNR_BOTTOM_LEFT) {
+ for (a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
vert[tot][0]= minx+vec[a][1];
vert[tot][1]= miny+rad-vec[a][0];
}
}
else {
- for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
+ for (a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
vert[tot][0]= minx;
vert[tot][1]= miny;
}
}
- if(roundboxalign & UI_CNR_BOTTOM_RIGHT) {
- for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
+ if (roundboxalign & UI_CNR_BOTTOM_RIGHT) {
+ for (a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
vert[tot][0]= maxx-rad+vec[a][0];
vert[tot][1]= miny+vec[a][1];
}
}
else {
- for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
+ for (a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
vert[tot][0]= maxx;
vert[tot][1]= miny;
}
}
- if(roundboxalign & UI_CNR_TOP_RIGHT) {
- for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
+ if (roundboxalign & UI_CNR_TOP_RIGHT) {
+ for (a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
vert[tot][0]= maxx-vec[a][1];
vert[tot][1]= maxy-rad+vec[a][0];
}
}
else {
- for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
+ for (a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
vert[tot][0]= maxx;
vert[tot][1]= maxy;
}
@@ -334,14 +334,14 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, fl
minsize= MIN2((rect->xmax-rect->xmin)*hnum, (rect->ymax-rect->ymin)*vnum);
- if(2.0f*rad > minsize)
+ if (2.0f*rad > minsize)
rad= 0.5f*minsize;
- if(2.0f*(radi+1.0f) > minsize)
+ if (2.0f*(radi+1.0f) > minsize)
radi= 0.5f*minsize - 1.0f;
/* mult */
- for(a=0; a < WIDGET_CURVE_RESOLU; a++) {
+ for (a=0; a < WIDGET_CURVE_RESOLU; a++) {
veci[a][0]= radi*cornervec[a][0];
veci[a][1]= radi*cornervec[a][1];
vec[a][0]= rad*cornervec[a][0];
@@ -349,9 +349,9 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, fl
}
/* corner left-bottom */
- if(roundboxalign & UI_CNR_BOTTOM_LEFT) {
+ if (roundboxalign & UI_CNR_BOTTOM_LEFT) {
- for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
+ for (a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
wt->inner_v[tot][0]= minxi+veci[a][1];
wt->inner_v[tot][1]= minyi+radi-veci[a][0];
@@ -376,9 +376,9 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, fl
}
/* corner right-bottom */
- if(roundboxalign & UI_CNR_BOTTOM_RIGHT) {
+ if (roundboxalign & UI_CNR_BOTTOM_RIGHT) {
- for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
+ for (a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
wt->inner_v[tot][0]= maxxi-radi+veci[a][0];
wt->inner_v[tot][1]= minyi+veci[a][1];
@@ -405,9 +405,9 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, fl
wt->halfwayvert= tot;
/* corner right-top */
- if(roundboxalign & UI_CNR_TOP_RIGHT) {
+ if (roundboxalign & UI_CNR_TOP_RIGHT) {
- for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
+ for (a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
wt->inner_v[tot][0]= maxxi-veci[a][1];
wt->inner_v[tot][1]= maxyi-radi+veci[a][0];
@@ -432,9 +432,9 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, fl
}
/* corner left-top */
- if(roundboxalign & UI_CNR_TOP_LEFT) {
+ if (roundboxalign & UI_CNR_TOP_LEFT) {
- for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
+ for (a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
wt->inner_v[tot][0]= minxi+radi-veci[a][0];
wt->inner_v[tot][1]= maxyi-veci[a][1];
@@ -484,21 +484,21 @@ static void widget_num_tria(uiWidgetTrias *tria, rcti *rect, float triasize, cha
centy= (float)rect->ymin + 0.5f*minsize;
sizex= sizey= -0.5f*triasize*minsize;
- if(where=='r') {
+ if (where=='r') {
centx= (float)rect->xmax - 0.5f*minsize;
sizex= -sizex;
}
- else if(where=='t') {
+ else if (where=='t') {
centy= (float)rect->ymax - 0.5f*minsize;
sizey= -sizey;
i2=0; i1= 1;
}
- else if(where=='b') {
+ else if (where=='b') {
sizex= -sizex;
i2=0; i1= 1;
}
- for(a=0; a<3; a++) {
+ for (a=0; a<3; a++) {
tria->vec[a][0]= sizex*num_tria_vert[a][i1] + centx;
tria->vec[a][1]= sizey*num_tria_vert[a][i2] + centy;
}
@@ -519,21 +519,21 @@ static void widget_scroll_circle(uiWidgetTrias *tria, rcti *rect, float triasize
centy= (float)rect->ymin + 0.5f*minsize;
sizex= sizey= -0.5f*triasize*minsize;
- if(where=='r') {
+ if (where=='r') {
centx= (float)rect->xmax - 0.5f*minsize;
sizex= -sizex;
}
- else if(where=='t') {
+ else if (where=='t') {
centy= (float)rect->ymax - 0.5f*minsize;
sizey= -sizey;
i2=0; i1= 1;
}
- else if(where=='b') {
+ else if (where=='b') {
sizex= -sizex;
i2=0; i1= 1;
}
- for(a=0; a<16; a++) {
+ for (a=0; a<16; a++) {
tria->vec[a][0]= sizex*scroll_circle_vert[a][i1] + centx;
tria->vec[a][1]= sizey*scroll_circle_vert[a][i2] + centy;
}
@@ -562,10 +562,10 @@ static void widget_menu_trias(uiWidgetTrias *tria, rcti *rect)
/* XXX exception */
asp= ((float)rect->xmax-rect->xmin)/((float)rect->ymax-rect->ymin);
- if(asp > 1.2f && asp < 2.6f)
+ if (asp > 1.2f && asp < 2.6f)
centx= rect->xmax - 0.3f*(rect->ymax-rect->ymin);
- for(a=0; a<6; a++) {
+ for (a=0; a<6; a++) {
tria->vec[a][0]= size*menu_tria_vert[a][0] + centx;
tria->vec[a][1]= size*menu_tria_vert[a][1] + centy;
}
@@ -584,7 +584,7 @@ static void widget_check_trias(uiWidgetTrias *tria, rcti *rect)
centy= rect->ymin + 0.5f*(rect->ymax-rect->ymin);
size= 0.5f*(rect->ymax-rect->ymin);
- for(a=0; a<6; a++) {
+ for (a=0; a<6; a++) {
tria->vec[a][0]= size*check_tria_vert[a][0] + centx;
tria->vec[a][1]= size*check_tria_vert[a][1] + centy;
}
@@ -623,7 +623,7 @@ static void round_box_shade_col4_r(unsigned char col_r[4], const char col1[4], c
static void widget_verts_to_quad_strip(uiWidgetBase *wtb, const int totvert, float quad_strip[WIDGET_SIZE_MAX*2+2][2])
{
int a;
- for(a=0; a<totvert; a++) {
+ for (a=0; a<totvert; a++) {
copy_v2_v2(quad_strip[a*2], wtb->outer_v[a]);
copy_v2_v2(quad_strip[a*2+1], wtb->inner_v[a]);
}
@@ -634,7 +634,7 @@ static void widget_verts_to_quad_strip(uiWidgetBase *wtb, const int totvert, flo
static void widget_verts_to_quad_strip_open(uiWidgetBase *wtb, const int totvert, float quad_strip[WIDGET_SIZE_MAX*2][2])
{
int a;
- for(a=0; a<totvert; a++) {
+ for (a=0; a<totvert; a++) {
quad_strip[a*2][0]= wtb->outer_v[a][0];
quad_strip[a*2][1]= wtb->outer_v[a][1];
quad_strip[a*2+1][0]= wtb->outer_v[a][0];
@@ -660,8 +660,8 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
glEnable(GL_BLEND);
/* backdrop non AA */
- if(wtb->inner) {
- if(wcol->shaded==0) {
+ if (wtb->inner) {
+ if (wcol->shaded==0) {
if (wcol->alpha_check) {
float inner_v_half[WIDGET_SIZE_MAX][2];
float x_mid= 0.0f; /* used for dumb clamping of values */
@@ -691,7 +691,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
glColor4ubv((unsigned char*)wcol->inner);
glEnableClientState(GL_VERTEX_ARRAY);
- for(a=0; a<wtb->totvert; a++) {
+ for (a=0; a<wtb->totvert; a++) {
x_mid += wtb->inner_v[a][0];
}
x_mid /= wtb->totvert;
@@ -703,7 +703,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
/* 1/2 solid color */
glColor4ub(wcol->inner[0], wcol->inner[1], wcol->inner[2], 255);
- for(a=0; a<wtb->totvert; a++) {
+ for (a=0; a<wtb->totvert; a++) {
inner_v_half[a][0]= MIN2(wtb->inner_v[a][0], x_mid);
inner_v_half[a][1]= wtb->inner_v[a][1];
}
@@ -731,7 +731,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
shadecolors4(col1, col2, wcol->inner, wcol->shadetop, wcol->shadedown);
glShadeModel(GL_SMOOTH);
- for(a=0; a<wtb->totvert; a++, col_pt += 4) {
+ for (a=0; a<wtb->totvert; a++, col_pt += 4) {
round_box_shade_col4_r(col_pt, col1, col2, wtb->inner_uv[a][wtb->shadedir]);
}
@@ -748,7 +748,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
}
/* for each AA step */
- if(wtb->outline) {
+ if (wtb->outline) {
float quad_strip[WIDGET_SIZE_MAX*2+2][2]; /* + 2 because the last pair is wrapped */
float quad_strip_emboss[WIDGET_SIZE_MAX*2][2]; /* only for emboss */
@@ -759,7 +759,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
widget_verts_to_quad_strip(wtb, wtb->totvert, quad_strip);
- if(wtb->emboss) {
+ if (wtb->emboss) {
widget_verts_to_quad_strip_open(wtb, wtb->halfwayvert, quad_strip_emboss);
}
@@ -775,7 +775,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
glDrawArrays(GL_QUAD_STRIP, 0, wtb->totvert*2 + 2);
/* emboss bottom shadow */
- if(wtb->emboss) {
+ if (wtb->emboss) {
glColor4f(1.0f, 1.0f, 1.0f, 0.02f);
glVertexPointer(2, GL_FLOAT, 0, quad_strip_emboss);
@@ -789,7 +789,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
}
/* decoration */
- if(wtb->tria1.tot || wtb->tria2.tot) {
+ if (wtb->tria1.tot || wtb->tria2.tot) {
const unsigned char tcol[4] = {wcol->item[0],
wcol->item[1],
wcol->item[2],
@@ -798,11 +798,11 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
for (j = 0; j < WIDGET_AA_JITTER; j++) {
glTranslatef(1.0f * jit[j][0], 1.0f * jit[j][1], 0.0f);
- if(wtb->tria1.tot) {
+ if (wtb->tria1.tot) {
glColor4ubv(tcol);
widget_trias_draw(&wtb->tria1);
}
- if(wtb->tria2.tot) {
+ if (wtb->tria2.tot) {
glColor4ubv(tcol);
widget_trias_draw(&wtb->tria2);
}
@@ -823,7 +823,7 @@ static void widget_draw_preview(BIFIconID icon, float UNUSED(alpha), rcti *rect)
{
int w, h, size;
- if(icon==ICON_NONE)
+ if (icon==ICON_NONE)
return;
w = rect->xmax - rect->xmin;
@@ -831,7 +831,7 @@ static void widget_draw_preview(BIFIconID icon, float UNUSED(alpha), rcti *rect)
size = MIN2(w, h);
size -= PREVIEW_PAD*2; /* padding */
- if(size > 0) {
+ if (size > 0) {
int x = rect->xmin + w/2 - size/2;
int y = rect->ymin + h/2 - size/2;
@@ -858,11 +858,11 @@ static void widget_draw_icon(uiBut *but, BIFIconID icon, float alpha, rcti *rect
}
/* this icon doesn't need draw... */
- if(icon==ICON_BLANK1 && (but->flag & UI_ICON_SUBMENU)==0) return;
+ if (icon==ICON_BLANK1 && (but->flag & UI_ICON_SUBMENU)==0) return;
/* we need aspect from block, for menus... these buttons are scaled in uiPositionBlock() */
aspect= but->block->aspect;
- if(aspect != but->aspect) {
+ if (aspect != but->aspect) {
/* prevent scaling up icon in pupmenu */
if (aspect < 1.0f) {
height= UI_DPI_ICON_SIZE;
@@ -877,27 +877,28 @@ static void widget_draw_icon(uiBut *but, BIFIconID icon, float alpha, rcti *rect
/* calculate blend color */
if ELEM4(but->type, TOG, ROW, TOGN, LISTROW) {
- if(but->flag & UI_SELECT);
- else if(but->flag & UI_ACTIVE);
+ if (but->flag & UI_SELECT);
+ else if (but->flag & UI_ACTIVE);
else alpha= 0.5f;
}
/* extra feature allows more alpha blending */
- if(but->type==LABEL && but->a1==1.0f) alpha *= but->a2;
+ if (but->type==LABEL && but->a1==1.0f) alpha *= but->a2;
glEnable(GL_BLEND);
- if(icon && icon!=ICON_BLANK1) {
- if(but->flag & UI_ICON_LEFT) {
+ if (icon && icon!=ICON_BLANK1) {
+ if (but->flag & UI_ICON_LEFT) {
if (but->type==BUT_TOGDUAL) {
if (but->drawstr[0]) {
xs= rect->xmin-1;
- } else {
+ }
+ else {
xs= (rect->xmin+rect->xmax- height)/2;
}
}
else if (but->block->flag & UI_BLOCK_LOOP) {
- if(but->type==SEARCH_MENU)
+ if (but->type==SEARCH_MENU)
xs= rect->xmin+4;
else
xs= rect->xmin+1;
@@ -916,7 +917,7 @@ static void widget_draw_icon(uiBut *but, BIFIconID icon, float alpha, rcti *rect
}
/* to indicate draggable */
- if(but->dragpoin && (but->flag & UI_ACTIVE)) {
+ if (but->dragpoin && (but->flag & UI_ACTIVE)) {
float rgb[3]= {1.25f, 1.25f, 1.25f};
UI_icon_draw_aspect_color(xs, ys, icon, aspect, rgb);
}
@@ -965,21 +966,21 @@ static void ui_text_leftclip(uiFontStyle *fstyle, uiBut *but, rcti *rect)
BLF_enable(fstyle->uifont_id, BLF_KERNING_DEFAULT);
/* if text editing we define ofs dynamically */
- if(but->editstr && but->pos >= 0) {
- if(but->ofs > but->pos)
+ if (but->editstr && but->pos >= 0) {
+ if (but->ofs > but->pos)
but->ofs= but->pos;
- if(BLF_width(fstyle->uifont_id, but->drawstr) <= okwidth)
+ if (BLF_width(fstyle->uifont_id, but->drawstr) <= okwidth)
but->ofs = 0;
}
else but->ofs= 0;
but->strwidth= BLF_width(fstyle->uifont_id, but->drawstr + but->ofs);
- while(but->strwidth > okwidth) {
+ while (but->strwidth > okwidth) {
/* textbut exception, clip right when... */
- if(but->editstr && but->pos >= 0) {
+ if (but->editstr && but->pos >= 0) {
float width;
char buf[UI_MAX_DRAW_STR];
@@ -990,12 +991,12 @@ static void ui_text_leftclip(uiFontStyle *fstyle, uiBut *but, rcti *rect)
width= BLF_width(fstyle->uifont_id, buf+but->ofs);
/* if cursor is at 20 pixels of right side button we clip left */
- if(width > okwidth-20)
+ if (width > okwidth-20)
ui_text_clip_give_next_off(but);
else {
int len, bytes;
/* shift string to the left */
- if(width < 20 && but->ofs > 0)
+ if (width < 20 && but->ofs > 0)
ui_text_clip_give_prev_off(but);
len= strlen(but->drawstr);
bytes= BLI_str_utf8_size(BLI_str_find_prev_char_utf8(but->drawstr, but->drawstr + len));
@@ -1007,7 +1008,7 @@ static void ui_text_leftclip(uiFontStyle *fstyle, uiBut *but, rcti *rect)
but->strwidth= BLF_width(fstyle->uifont_id, but->drawstr+but->ofs);
- if(but->strwidth < 10) break;
+ if (but->strwidth < 10) break;
}
if (fstyle->kerning==1)
@@ -1047,7 +1048,7 @@ static void ui_text_label_rightclip(uiFontStyle *fstyle, uiBut *but, rcti *rect)
cp2-=bytes;
but->strwidth= BLF_width(fstyle->uifont_id, but->drawstr+but->ofs);
- if(but->strwidth < 10) break;
+ if (but->strwidth < 10) break;
}
@@ -1056,13 +1057,13 @@ static void ui_text_label_rightclip(uiFontStyle *fstyle, uiBut *but, rcti *rect)
{
ui_text_clip_give_next_off(but);
but->strwidth= BLF_width(fstyle->uifont_id, but->drawstr+but->ofs);
- if(but->strwidth < 10) break;
+ if (but->strwidth < 10) break;
}
}
/* once the label's gone, chop off the least significant digits */
- while(but->strwidth > okwidth ) {
+ while (but->strwidth > okwidth ) {
int len= strlen(but->drawstr);
int bytes= BLI_str_utf8_size(BLI_str_find_prev_char_utf8(but->drawstr, but->drawstr + len));
if (bytes < 0)
@@ -1071,7 +1072,7 @@ static void ui_text_label_rightclip(uiFontStyle *fstyle, uiBut *but, rcti *rect)
but->drawstr[ len-bytes ]= 0;
but->strwidth= BLF_width(fstyle->uifont_id, but->drawstr+but->ofs);
- if(but->strwidth < 10) break;
+ if (but->strwidth < 10) break;
}
if (fstyle->kerning==1)
@@ -1089,7 +1090,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
uiStyleFontSet(fstyle);
- if(but->editstr || (but->flag & UI_TEXT_LEFT))
+ if (but->editstr || (but->flag & UI_TEXT_LEFT))
fstyle->align= UI_STYLE_TEXT_LEFT;
else
fstyle->align= UI_STYLE_TEXT_CENTER;
@@ -1098,7 +1099,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
BLF_enable(fstyle->uifont_id, BLF_KERNING_DEFAULT);
/* text button selection and cursor */
- if(but->editstr && but->pos != -1) {
+ if (but->editstr && but->pos != -1) {
short t=0, pos=0, ch;
short selsta_tmp, selend_tmp, selsta_draw, selwidth_draw;
@@ -1107,7 +1108,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
selsta_tmp = but->selsta;
selend_tmp = but->selend;
- if(but->drawstr[0]!=0) {
+ if (but->drawstr[0]!=0) {
if (but->selsta >= but->ofs) {
ch= but->drawstr[selsta_tmp];
@@ -1116,8 +1117,10 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
selsta_draw = BLF_width(fstyle->uifont_id, but->drawstr+but->ofs);
but->drawstr[selsta_tmp]= ch;
- } else
+ }
+ else {
selsta_draw = 0;
+ }
ch= but->drawstr[selend_tmp];
but->drawstr[selend_tmp]= 0;
@@ -1129,11 +1132,12 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
glColor3ubv((unsigned char*)wcol->item);
glRects(rect->xmin+selsta_draw, rect->ymin+2, rect->xmin+selwidth_draw, rect->ymax-2);
}
- } else {
+ }
+ else {
/* text cursor */
pos= but->pos;
- if(pos >= but->ofs) {
- if(but->drawstr[0]!=0) {
+ if (pos >= but->ofs) {
+ if (but->drawstr[0]!=0) {
ch= but->drawstr[pos];
but->drawstr[pos]= 0;
@@ -1152,14 +1156,14 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
BLF_disable(fstyle->uifont_id, BLF_KERNING_DEFAULT);
// ui_rasterpos_safe(x, y, but->aspect);
-// if(but->type==IDPOIN) transopts= 0; // no translation, of course!
+// if (but->type==IDPOIN) transopts= 0; // no translation, of course!
// else transopts= ui_translate_buttons();
/* cut string in 2 parts - only for menu entries */
- if((but->block->flag & UI_BLOCK_LOOP)) {
- if(ELEM5(but->type, SLI, NUM, TEX, NUMSLI, NUMABS)==0) {
+ if ((but->block->flag & UI_BLOCK_LOOP)) {
+ if (ELEM5(but->type, SLI, NUM, TEX, NUMSLI, NUMABS)==0) {
cpoin= strchr(but->drawstr, '|');
- if(cpoin) *cpoin= 0;
+ if (cpoin) *cpoin= 0;
}
}
@@ -1167,17 +1171,17 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
uiStyleFontDrawExt(fstyle, rect, but->drawstr+but->ofs, &font_xofs, &font_yofs);
- if(but->menu_key != '\0') {
+ if (but->menu_key != '\0') {
char fixedbuf[128];
char *str;
BLI_strncpy(fixedbuf, but->drawstr + but->ofs, sizeof(fixedbuf));
str= strchr(fixedbuf, but->menu_key-32); /* upper case */
- if(str==NULL)
+ if (str==NULL)
str= strchr(fixedbuf, but->menu_key);
- if(str) {
+ if (str) {
int ul_index= -1;
float ul_advance;
@@ -1200,7 +1204,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
}
/* part text right aligned */
- if(cpoin) {
+ if (cpoin) {
fstyle->align= UI_STYLE_TEXT_RIGHT;
rect->xmax -= ui_but_draw_menu_icon(but) ? UI_DPI_ICON_SIZE : 5;
uiStyleFontDraw(fstyle, rect, cpoin+1);
@@ -1212,7 +1216,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *but, rcti *rect)
{
- if(but==NULL) return;
+ if (but==NULL) return;
/* clip but->drawstr to fit in available space */
if (but->editstr && but->pos >= 0) {
@@ -1235,16 +1239,16 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB
}
else {
- if(but->type==BUT_TOGDUAL) {
+ if (but->type==BUT_TOGDUAL) {
int dualset= 0;
- if(but->pointype==SHO)
+ if (but->pointype==SHO)
dualset= BTST( *(((short *)but->poin)+1), but->bitnr);
- else if(but->pointype==INT)
+ else if (but->pointype==INT)
dualset= BTST( *(((int *)but->poin)+1), but->bitnr);
widget_draw_icon(but, ICON_DOT, dualset?1.0f:0.25f, rect);
}
- else if(but->type==MENU && (but->flag & UI_BUT_NODE_LINK)) {
+ else if (but->type==MENU && (but->flag & UI_BUT_NODE_LINK)) {
int tmp = rect->xmin;
rect->xmin = rect->xmax - (rect->ymax - rect->ymin) - 1;
widget_draw_icon(but, ICON_LAYER_USED, 1.0f, rect);
@@ -1259,10 +1263,10 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB
rect->xmin += (int)((float)UI_icon_get_width(but->icon+but->iconadd) * UI_DPI_ICON_FAC);
- if(but->editstr || (but->flag & UI_TEXT_LEFT))
+ if (but->editstr || (but->flag & UI_TEXT_LEFT))
rect->xmin += 5;
}
- else if((but->flag & UI_TEXT_LEFT))
+ else if ((but->flag & UI_TEXT_LEFT))
rect->xmin += 5;
/* always draw text for textbutton cursor */
@@ -1577,7 +1581,7 @@ void ui_widget_color_init(ThemeUI *tui)
static void widget_state_blend(char cp[3], const char cpstate[3], const float fac)
{
- if(fac != 0.0f) {
+ if (fac != 0.0f) {
cp[0]= (int)((1.0f-fac)*cp[0] + fac*cpstate[0]);
cp[1]= (int)((1.0f-fac)*cp[1] + fac*cpstate[1]);
cp[2]= (int)((1.0f-fac)*cp[2] + fac*cpstate[2]);
@@ -1591,41 +1595,41 @@ static void widget_state(uiWidgetType *wt, int state)
wt->wcol= *(wt->wcol_theme);
- if(state & UI_SELECT) {
+ if (state & UI_SELECT) {
copy_v4_v4_char(wt->wcol.inner, wt->wcol.inner_sel);
- if(state & UI_BUT_ANIMATED_KEY)
+ if (state & UI_BUT_ANIMATED_KEY)
widget_state_blend(wt->wcol.inner, wcol_state->inner_key_sel, wcol_state->blend);
- else if(state & UI_BUT_ANIMATED)
+ else if (state & UI_BUT_ANIMATED)
widget_state_blend(wt->wcol.inner, wcol_state->inner_anim_sel, wcol_state->blend);
- else if(state & UI_BUT_DRIVEN)
+ else if (state & UI_BUT_DRIVEN)
widget_state_blend(wt->wcol.inner, wcol_state->inner_driven_sel, wcol_state->blend);
copy_v3_v3_char(wt->wcol.text, wt->wcol.text_sel);
- if(state & UI_SELECT)
+ if (state & UI_SELECT)
SWAP(short, wt->wcol.shadetop, wt->wcol.shadedown);
}
else {
- if(state & UI_BUT_ANIMATED_KEY)
+ if (state & UI_BUT_ANIMATED_KEY)
widget_state_blend(wt->wcol.inner, wcol_state->inner_key, wcol_state->blend);
- else if(state & UI_BUT_ANIMATED)
+ else if (state & UI_BUT_ANIMATED)
widget_state_blend(wt->wcol.inner, wcol_state->inner_anim, wcol_state->blend);
- else if(state & UI_BUT_DRIVEN)
+ else if (state & UI_BUT_DRIVEN)
widget_state_blend(wt->wcol.inner, wcol_state->inner_driven, wcol_state->blend);
- if(state & UI_ACTIVE) { /* mouse over? */
+ if (state & UI_ACTIVE) { /* mouse over? */
wt->wcol.inner[0]= wt->wcol.inner[0]>=240? 255 : wt->wcol.inner[0]+15;
wt->wcol.inner[1]= wt->wcol.inner[1]>=240? 255 : wt->wcol.inner[1]+15;
wt->wcol.inner[2]= wt->wcol.inner[2]>=240? 255 : wt->wcol.inner[2]+15;
}
}
- if(state & UI_BUT_REDALERT) {
+ if (state & UI_BUT_REDALERT) {
char red[4]= {255, 0, 0};
widget_state_blend(wt->wcol.inner, red, 0.4f);
}
- if(state & UI_BUT_NODE_ACTIVE) {
+ if (state & UI_BUT_NODE_ACTIVE) {
char blue[4]= {86, 128, 194};
widget_state_blend(wt->wcol.inner, blue, 0.3f);
}
@@ -1642,24 +1646,24 @@ static void widget_state_numslider(uiWidgetType *wt, int state)
/* now, set the inner-part so that it reflects state settings too */
// TODO: maybe we should have separate settings for the blending colors used for this case?
- if(state & UI_SELECT) {
+ if (state & UI_SELECT) {
- if(state & UI_BUT_ANIMATED_KEY)
+ if (state & UI_BUT_ANIMATED_KEY)
widget_state_blend(wt->wcol.item, wcol_state->inner_key_sel, blend);
- else if(state & UI_BUT_ANIMATED)
+ else if (state & UI_BUT_ANIMATED)
widget_state_blend(wt->wcol.item, wcol_state->inner_anim_sel, blend);
- else if(state & UI_BUT_DRIVEN)
+ else if (state & UI_BUT_DRIVEN)
widget_state_blend(wt->wcol.item, wcol_state->inner_driven_sel, blend);
- if(state & UI_SELECT)
+ if (state & UI_SELECT)
SWAP(short, wt->wcol.shadetop, wt->wcol.shadedown);
}
else {
- if(state & UI_BUT_ANIMATED_KEY)
+ if (state & UI_BUT_ANIMATED_KEY)
widget_state_blend(wt->wcol.item, wcol_state->inner_key, blend);
- else if(state & UI_BUT_ANIMATED)
+ else if (state & UI_BUT_ANIMATED)
widget_state_blend(wt->wcol.item, wcol_state->inner_anim, blend);
- else if(state & UI_BUT_DRIVEN)
+ else if (state & UI_BUT_DRIVEN)
widget_state_blend(wt->wcol.item, wcol_state->inner_driven, blend);
}
}
@@ -1670,7 +1674,7 @@ static void widget_state_label(uiWidgetType *wt, int state)
/* call this for option button */
widget_state(wt, state);
- if(state & UI_SELECT)
+ if (state & UI_SELECT)
UI_GetThemeColor4ubv(TH_TEXT_HI, (unsigned char *)wt->wcol.text);
else
UI_GetThemeColor4ubv(TH_TEXT, (unsigned char *)wt->wcol.text);
@@ -1685,7 +1689,7 @@ static void widget_state_option_menu(uiWidgetType *wt, int state)
widget_state(wt, state);
/* if not selected we get theme from menu back */
- if(state & UI_SELECT)
+ if (state & UI_SELECT)
UI_GetThemeColor4ubv(TH_TEXT_HI, (unsigned char *)wt->wcol.text);
else {
bTheme *btheme= UI_GetTheme(); /* XXX */
@@ -1708,7 +1712,7 @@ static void widget_state_pulldown(uiWidgetType *wt, int state)
copy_v4_v4_char(wt->wcol.inner, wt->wcol.inner_sel);
copy_v3_v3_char(wt->wcol.outline, wt->wcol.inner);
- if(state & UI_ACTIVE)
+ if (state & UI_ACTIVE)
copy_v3_v3_char(wt->wcol.text, wt->wcol.text_sel);
}
@@ -1717,12 +1721,12 @@ static void widget_state_menu_item(uiWidgetType *wt, int state)
{
wt->wcol= *(wt->wcol_theme);
- if(state & (UI_BUT_DISABLED|UI_BUT_INACTIVE)) {
+ if (state & (UI_BUT_DISABLED|UI_BUT_INACTIVE)) {
wt->wcol.text[0]= 0.5f*(wt->wcol.text[0]+wt->wcol.text_sel[0]);
wt->wcol.text[1]= 0.5f*(wt->wcol.text[1]+wt->wcol.text_sel[1]);
wt->wcol.text[2]= 0.5f*(wt->wcol.text[2]+wt->wcol.text_sel[2]);
}
- else if(state & UI_ACTIVE) {
+ else if (state & UI_ACTIVE) {
copy_v4_v4_char(wt->wcol.inner, wt->wcol.inner_sel);
copy_v3_v3_char(wt->wcol.text, wt->wcol.text_sel);
}
@@ -1741,7 +1745,7 @@ static void widget_softshadow(rcti *rect, int roundboxalign, float radin, float
float quad_strip[WIDGET_SIZE_MAX*2][2];
/* prevent tooltips to not show round shadow */
- if( 2.0f*radout > 0.2f*(rect1.ymax-rect1.ymin) )
+ if ( 2.0f*radout > 0.2f*(rect1.ymax-rect1.ymin) )
rect1.ymax -= 0.2f*(rect1.ymax-rect1.ymin);
else
rect1.ymax -= 2.0f*radout;
@@ -1755,7 +1759,7 @@ static void widget_softshadow(rcti *rect, int roundboxalign, float radin, float
glEnableClientState(GL_VERTEX_ARRAY);
- for(step= 1; step<=radout; step++, alpha*=alphastep) {
+ for (step= 1; step<=radout; step++, alpha*=alphastep) {
round_box_shadow_edges(wtb.outer_v, &rect1, radin, UI_CNR_ALL, (float)step);
glColor4f(0.0f, 0.0f, 0.0f, alpha);
@@ -1828,7 +1832,7 @@ void ui_hsvcircle_vals_from_pos(float *valrad, float *valdist, rcti *rect, float
float centy= (float)(rect->ymin + rect->ymax)/2;
float radius, dist;
- if( rect->xmax-rect->xmin > rect->ymax-rect->ymin )
+ if ( rect->xmax-rect->xmin > rect->ymax-rect->ymin )
radius= (float)(rect->ymax - rect->ymin)/2;
else
radius= (float)(rect->xmax - rect->xmin)/2;
@@ -1836,7 +1840,7 @@ void ui_hsvcircle_vals_from_pos(float *valrad, float *valdist, rcti *rect, float
mx-= centx;
my-= centy;
dist= sqrt( mx*mx + my*my);
- if(dist < radius)
+ if (dist < radius)
*valdist= dist/radius;
else
*valdist= 1.0f;
@@ -1860,7 +1864,7 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
centx= (float)(rect->xmin + rect->xmax)/2;
centy= (float)(rect->ymin + rect->ymax)/2;
- if( rect->xmax-rect->xmin > rect->ymax-rect->ymin )
+ if ( rect->xmax-rect->xmin > rect->ymax-rect->ymin )
radius= (float)(rect->ymax - rect->ymin)/2;
else
radius= (float)(rect->xmax - rect->xmin)/2;
@@ -1887,7 +1891,7 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
glColor3fv(colcent);
glVertex2f( centx, centy);
- for(a=0; a<=tot; a++, ang+=radstep) {
+ for (a=0; a<=tot; a++, ang+=radstep) {
float si= sin(ang);
float co= cos(ang);
@@ -1916,7 +1920,7 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
/* cursor */
ang= 2.0f*(float)M_PI*hsvo[0] + 0.5f*(float)M_PI;
- if(but->flag & UI_BUT_COLOR_CUBIC)
+ if (but->flag & UI_BUT_COLOR_CUBIC)
cursor_radius = (1.0f - powf(1.0f - hsvo[1], 3.0f));
else
cursor_radius = hsvo[1];
@@ -1986,7 +1990,7 @@ void ui_draw_gradient(rcti *rect, const float hsv[3], int type, float alpha)
/* old below */
- for(dx=0.0f; dx<1.0f; dx+= 0.05f) {
+ for (dx=0.0f; dx<1.0f; dx+= 0.05f) {
// previous color
copy_v3_v3(col0[0], col1[0]);
copy_v3_v3(col0[1], col1[1]);
@@ -2040,7 +2044,7 @@ void ui_draw_gradient(rcti *rect, const float hsv[3], int type, float alpha)
dy= (rect->ymax-rect->ymin)/3.0;
glBegin(GL_QUADS);
- for(a=0; a<3; a++, sy+=dy) {
+ for (a=0; a<3; a++, sy+=dy) {
glColor4f(col0[a][0], col0[a][1], col0[a][2], alpha);
glVertex2f(sx1, sy);
@@ -2182,7 +2186,7 @@ static void widget_numbut(uiWidgetColors *wcol, rcti *rect, int state, int round
float rad= 0.5f*(rect->ymax - rect->ymin);
float textofs = rad*0.75f;
- if(state & UI_SELECT)
+ if (state & UI_SELECT)
SWAP(short, wcol->shadetop, wcol->shadedown);
widget_init(&wtb);
@@ -2191,7 +2195,7 @@ static void widget_numbut(uiWidgetColors *wcol, rcti *rect, int state, int round
round_box_edges(&wtb, roundboxalign, rect, rad);
/* decoration */
- if(!(state & UI_TEXTINPUT)) {
+ if (!(state & UI_TEXTINPUT)) {
widget_num_tria(&wtb.tria1, rect, 0.6f, 'l');
widget_num_tria(&wtb.tria2, rect, 0.6f, 'r');
}
@@ -2232,7 +2236,7 @@ void ui_draw_link_bezier(rcti *rect)
{
float coord_array[LINK_RESOL+1][2];
- if(ui_link_bezier_points(rect, coord_array, LINK_RESOL)) {
+ if (ui_link_bezier_points(rect, coord_array, LINK_RESOL)) {
/* we can reuse the dist variable here to increment the GL curve eval amount*/
// const float dist= 1.0f/(float)LINK_RESOL; // UNUSED
@@ -2263,7 +2267,7 @@ void uiWidgetScrollDraw(uiWidgetColors *wcol, rcti *rect, rcti *slider, int stat
/* determine horizontal/vertical */
horizontal= (rect->xmax - rect->xmin > rect->ymax - rect->ymin);
- if(horizontal)
+ if (horizontal)
rad= 0.5f*(rect->ymax - rect->ymin);
else
rad= 0.5f*(rect->xmax - rect->xmin);
@@ -2271,25 +2275,25 @@ void uiWidgetScrollDraw(uiWidgetColors *wcol, rcti *rect, rcti *slider, int stat
wtb.shadedir= (horizontal)? 1: 0;
/* draw back part, colors swapped and shading inverted */
- if(horizontal)
+ if (horizontal)
SWAP(short, wcol->shadetop, wcol->shadedown);
round_box_edges(&wtb, UI_CNR_ALL, rect, rad);
widgetbase_draw(&wtb, wcol);
/* slider */
- if(slider->xmax-slider->xmin<2 || slider->ymax-slider->ymin<2);
+ if (slider->xmax-slider->xmin<2 || slider->ymax-slider->ymin<2);
else {
SWAP(short, wcol->shadetop, wcol->shadedown);
copy_v4_v4_char(wcol->inner, wcol->item);
- if(wcol->shadetop>wcol->shadedown)
+ if (wcol->shadetop>wcol->shadedown)
wcol->shadetop+= 20; /* XXX violates themes... */
else wcol->shadedown+= 20;
- if(state & UI_SCROLL_PRESSED) {
+ if (state & UI_SCROLL_PRESSED) {
wcol->inner[0]= wcol->inner[0]>=250? 255 : wcol->inner[0]+5;
wcol->inner[1]= wcol->inner[1]>=250? 255 : wcol->inner[1]+5;
wcol->inner[2]= wcol->inner[2]>=250? 255 : wcol->inner[2]+5;
@@ -2304,13 +2308,13 @@ void uiWidgetScrollDraw(uiWidgetColors *wcol, rcti *rect, rcti *slider, int stat
round_box_edges(&wtb, UI_CNR_ALL, slider, rad);
- if(state & UI_SCROLL_ARROWS) {
- if(wcol->item[0] > 48) wcol->item[0]-= 48;
- if(wcol->item[1] > 48) wcol->item[1]-= 48;
- if(wcol->item[2] > 48) wcol->item[2]-= 48;
+ if (state & UI_SCROLL_ARROWS) {
+ if (wcol->item[0] > 48) wcol->item[0]-= 48;
+ if (wcol->item[1] > 48) wcol->item[1]-= 48;
+ if (wcol->item[2] > 48) wcol->item[2]-= 48;
wcol->item[3]= 255;
- if(horizontal) {
+ if (horizontal) {
widget_scroll_circle(&wtb.tria1, slider, 0.6f, 'l');
widget_scroll_circle(&wtb.tria2, slider, 0.6f, 'r');
}
@@ -2345,7 +2349,7 @@ static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat
/* determine horizontal/vertical */
horizontal= (rect->xmax - rect->xmin > rect->ymax - rect->ymin);
- if(horizontal) {
+ if (horizontal) {
fac= (rect->xmax - rect->xmin)/(size);
rect1.xmin = rect1.xmin + ceilf(fac*((float)value - but->softmin));
rect1.xmax = rect1.xmin + ceilf(fac*(but->a1 - but->softmin));
@@ -2353,10 +2357,10 @@ static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat
/* ensure minimium size */
min= rect->ymax - rect->ymin;
- if(rect1.xmax - rect1.xmin < min) {
+ if (rect1.xmax - rect1.xmin < min) {
rect1.xmax = rect1.xmin + min;
- if(rect1.xmax > rect->xmax) {
+ if (rect1.xmax > rect->xmax) {
rect1.xmax = rect->xmax;
rect1.xmin = MAX2(rect1.xmax - min, rect->xmin);
}
@@ -2370,17 +2374,17 @@ static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat
/* ensure minimium size */
min= rect->xmax - rect->xmin;
- if(rect1.ymax - rect1.ymin < min) {
+ if (rect1.ymax - rect1.ymin < min) {
rect1.ymax = rect1.ymin + min;
- if(rect1.ymax > rect->ymax) {
+ if (rect1.ymax > rect->ymax) {
rect1.ymax = rect->ymax;
rect1.ymin = MAX2(rect1.ymax - min, rect->ymin);
}
}
}
- if(state & UI_SELECT)
+ if (state & UI_SELECT)
state= UI_SCROLL_PRESSED;
else
state= 0;
@@ -2416,7 +2420,7 @@ static void widget_progressbar(uiBut *but, uiWidgetColors *wcol, rcti *rect, int
static void widget_link(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect, int UNUSED(state), int UNUSED(roundboxalign))
{
- if(but->flag & UI_SELECT) {
+ if (but->flag & UI_SELECT) {
rcti rectlink;
UI_ThemeColor(TH_TEXT_HI);
@@ -2452,14 +2456,14 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s
widgetbase_draw(&wtb, wcol);
/* draw left/right parts only when not in text editing */
- if(!(state & UI_TEXTINPUT)) {
+ if (!(state & UI_TEXTINPUT)) {
/* slider part */
copy_v3_v3_char(outline, wcol->outline);
copy_v3_v3_char(wcol->outline, wcol->item);
copy_v3_v3_char(wcol->inner, wcol->item);
- if(!(state & UI_SELECT))
+ if (!(state & UI_SELECT))
SWAP(short, wcol->shadetop, wcol->shadedown);
rect1= *rect;
@@ -2476,7 +2480,7 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s
/* right part of slider, interpolate roundness */
rect1.xmax = rect1.xmin + fac + offs;
rect1.xmin+= floor(offs-1.0f);
- if(rect1.xmax + offs > rect->xmax)
+ if (rect1.xmax + offs > rect->xmax)
offs*= (rect1.xmax + offs - rect->xmax)/offs;
else
offs= 0.0f;
@@ -2485,7 +2489,7 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s
widgetbase_draw(&wtb1, wcol);
copy_v3_v3_char(wcol->outline, outline);
- if(!(state & UI_SELECT))
+ if (!(state & UI_SELECT))
SWAP(short, wcol->shadetop, wcol->shadedown);
}
@@ -2514,7 +2518,7 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat
if (RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA)
color_profile = BLI_PR_NONE;
- if(RNA_property_array_length(&but->rnapoin, but->rnaprop)==4) {
+ if (RNA_property_array_length(&but->rnapoin, but->rnaprop)==4) {
col[3]= RNA_property_float_get_index(&but->rnapoin, but->rnaprop, 3);
}
}
@@ -2526,7 +2530,7 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat
ui_get_but_vectorf(but, col);
- if(state & (UI_BUT_ANIMATED|UI_BUT_ANIMATED_KEY|UI_BUT_DRIVEN|UI_BUT_REDALERT)) {
+ if (state & (UI_BUT_ANIMATED|UI_BUT_ANIMATED_KEY|UI_BUT_DRIVEN|UI_BUT_REDALERT)) {
// draw based on state - color for keyed etc
widgetbase_draw(&wtb, wcol);
@@ -2553,7 +2557,7 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat
static void widget_icon_has_anim(uiBut *UNUSED(but), uiWidgetColors *wcol, rcti *rect, int state, int UNUSED(roundboxalign))
{
- if(state & (UI_BUT_ANIMATED|UI_BUT_ANIMATED_KEY|UI_BUT_DRIVEN|UI_BUT_REDALERT)) {
+ if (state & (UI_BUT_ANIMATED|UI_BUT_ANIMATED_KEY|UI_BUT_DRIVEN|UI_BUT_REDALERT)) {
uiWidgetBase wtb;
widget_init(&wtb);
@@ -2570,7 +2574,7 @@ static void widget_textbut(uiWidgetColors *wcol, rcti *rect, int state, int roun
{
uiWidgetBase wtb;
- if(state & UI_SELECT)
+ if (state & UI_SELECT)
SWAP(short, wcol->shadetop, wcol->shadedown);
widget_init(&wtb);
@@ -2639,7 +2643,7 @@ static void widget_menunodebut(uiWidgetColors *wcol, rcti *rect, int UNUSED(stat
static void widget_pulldownbut(uiWidgetColors *wcol, rcti *rect, int state, int UNUSED(roundboxalign))
{
- if(state & UI_ACTIVE) {
+ if (state & UI_ACTIVE) {
uiWidgetBase wtb;
float rad= 0.5f*(rect->ymax - rect->ymin); // 4.0f
@@ -2700,7 +2704,7 @@ static void widget_optionbut(uiWidgetColors *wcol, rcti *rect, int state, int UN
round_box_edges(&wtb, UI_CNR_ALL, &recttemp, 4.0f);
/* decoration */
- if(state & UI_SELECT) {
+ if (state & UI_SELECT) {
widget_check_trias(&wtb.tria1, &recttemp);
}
@@ -2789,7 +2793,7 @@ static void widget_draw_extra_mask(const bContext *C, uiBut *but, uiWidgetType *
widget_init(&wtb);
- if(but->block->drawextra) {
+ if (but->block->drawextra) {
/* note: drawextra can change rect +1 or -1, to match round errors of existing previews */
but->block->drawextra(C, but->poin, but->block->drawextra_arg1, but->block->drawextra_arg2, rect);
@@ -2984,11 +2988,11 @@ static uiWidgetType *widget_type(uiWidgetTypeEnum type)
static int widget_roundbox_set(uiBut *but, rcti *rect)
{
/* alignment */
- if(but->flag & UI_BUT_ALIGN) {
+ if (but->flag & UI_BUT_ALIGN) {
- if(but->flag & UI_BUT_ALIGN_TOP)
+ if (but->flag & UI_BUT_ALIGN_TOP)
rect->ymax+= 1;
- if(but->flag & UI_BUT_ALIGN_LEFT)
+ if (but->flag & UI_BUT_ALIGN_LEFT)
rect->xmin-= 1;
switch(but->flag & UI_BUT_ALIGN) {
@@ -3025,7 +3029,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
uiWidgetType *wt= NULL;
/* handle menus separately */
- if(but->dt==UI_EMBOSSP) {
+ if (but->dt==UI_EMBOSSP) {
switch (but->type) {
case LABEL:
widget_draw_text_icon(&style->widgetlabel, &tui->wcol_menu_back, but, rect);
@@ -3038,7 +3042,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
wt= widget_type(UI_WTYPE_MENU_ITEM);
}
}
- else if(but->dt==UI_EMBOSSN) {
+ else if (but->dt==UI_EMBOSSN) {
/* "nothing" */
wt= widget_type(UI_WTYPE_ICON);
}
@@ -3046,7 +3050,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
switch (but->type) {
case LABEL:
- if(but->block->flag & UI_BLOCK_LOOP)
+ if (but->block->flag & UI_BLOCK_LOOP)
widget_draw_text_icon(&style->widgetlabel, &tui->wcol_menu_back, but, rect);
else {
wt= widget_type(UI_WTYPE_LABEL);
@@ -3084,7 +3088,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
case SEARCH_MENU:
wt= widget_type(UI_WTYPE_NAME);
- if(but->block->flag & UI_BLOCK_LOOP)
+ if (but->block->flag & UI_BLOCK_LOOP)
wt->wcol_theme= &btheme->tui.wcol_menu_back;
break;
@@ -3105,7 +3109,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
wt= widget_type(UI_WTYPE_TOGGLE);
/* option buttons have strings outside, on menus use different colors */
- if(but->block->flag & UI_BLOCK_LOOP)
+ if (but->block->flag & UI_BLOCK_LOOP)
wt->state= widget_state_option_menu;
break;
@@ -3113,9 +3117,9 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
case MENU:
case BLOCK:
case ICONTEXTROW:
- if(but->flag & UI_BUT_NODE_LINK)
+ if (but->flag & UI_BUT_NODE_LINK)
wt= widget_type(UI_WTYPE_MENU_NODE_LINK);
- else if(!but->str[0] && but->icon)
+ else if (!but->str[0] && but->icon)
wt= widget_type(UI_WTYPE_MENU_ICON_RADIO);
else
wt= widget_type(UI_WTYPE_MENU_RADIO);
@@ -3150,7 +3154,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
break;
case HSVCUBE:
- if(but->a1 == UI_GRAD_V_ALT) // vertical V slider, uses new widget draw now
+ if (but->a1 == UI_GRAD_V_ALT) // vertical V slider, uses new widget draw now
ui_draw_but_HSV_v(but, rect);
else // other HSV pickers...
ui_draw_but_HSVCUBE(but, rect);
@@ -3206,24 +3210,24 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
}
}
- if(wt) {
+ if (wt) {
rcti disablerect= *rect; /* rect gets clipped smaller for text */
int roundboxalign, state;
roundboxalign= widget_roundbox_set(but, rect);
state= but->flag;
- if(but->editstr) state |= UI_TEXTINPUT;
+ if (but->editstr) state |= UI_TEXTINPUT;
wt->state(wt, state);
- if(wt->custom)
+ if (wt->custom)
wt->custom(but, &wt->wcol, rect, state, roundboxalign);
- else if(wt->draw)
+ else if (wt->draw)
wt->draw(&wt->wcol, rect, state, roundboxalign);
wt->text(fstyle, &wt->wcol, but, rect);
- if(state & (UI_BUT_DISABLED|UI_BUT_INACTIVE))
- if(but->dt!=UI_EMBOSSP)
+ if (state & (UI_BUT_DISABLED|UI_BUT_INACTIVE))
+ if (but->dt!=UI_EMBOSSP)
widget_disabled(&disablerect);
}
}
@@ -3233,18 +3237,18 @@ void ui_draw_menu_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect)
uiWidgetType *wt= widget_type(UI_WTYPE_MENU_BACK);
wt->state(wt, 0);
- if(block)
+ if (block)
wt->draw(&wt->wcol, rect, block->flag, block->direction);
else
wt->draw(&wt->wcol, rect, 0, 0);
- if(block) {
- if(block->flag & UI_BLOCK_CLIPTOP) {
+ if (block) {
+ if (block->flag & UI_BLOCK_CLIPTOP) {
/* XXX no scaling for UI here yet */
glColor3ubv((unsigned char*)wt->wcol.text);
UI_DrawTriIcon((rect->xmax+rect->xmin)/2, rect->ymax-8, 't');
}
- if(block->flag & UI_BLOCK_CLIPBOTTOM) {
+ if (block->flag & UI_BLOCK_CLIPBOTTOM) {
/* XXX no scaling for UI here yet */
glColor3ubv((unsigned char*)wt->wcol.text);
UI_DrawTriIcon((rect->xmax+rect->xmin)/2, rect->ymin+10, 'v');
@@ -3252,7 +3256,7 @@ void ui_draw_menu_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect)
}
}
-uiWidgetColors* ui_tooltip_get_theme(void){
+uiWidgetColors* ui_tooltip_get_theme(void) {
uiWidgetType *wt = widget_type(UI_WTYPE_TOOLTIP);
return wt->wcol_theme;
}
@@ -3274,7 +3278,7 @@ void ui_draw_search_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect)
glDisable(GL_BLEND);
wt->state(wt, 0);
- if(block)
+ if (block)
wt->draw(&wt->wcol, rect, block->flag, UI_CNR_ALL);
else
wt->draw(&wt->wcol, rect, 0, UI_CNR_ALL);
@@ -3298,11 +3302,11 @@ void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, const char *name, int ic
/* text location offset */
rect->xmin+=5;
- if(iconid) rect->xmin+= UI_DPI_ICON_SIZE;
+ if (iconid) rect->xmin+= UI_DPI_ICON_SIZE;
/* cut string in 2 parts? */
cpoin= strchr(name, '|');
- if(cpoin) {
+ if (cpoin) {
*cpoin= 0;
rect->xmax -= BLF_width(fstyle->uifont_id, cpoin+1) + 10;
}
@@ -3311,7 +3315,7 @@ void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, const char *name, int ic
uiStyleFontDraw(fstyle, rect, name);
/* part text right aligned */
- if(cpoin) {
+ if (cpoin) {
fstyle->align= UI_STYLE_TEXT_RIGHT;
rect->xmax = _rect.xmax - 5;
uiStyleFontDraw(fstyle, rect, cpoin+1);
@@ -3321,7 +3325,7 @@ void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, const char *name, int ic
/* restore rect, was messed with */
*rect= _rect;
- if(iconid) {
+ if (iconid) {
int xs= rect->xmin+4;
int ys= 1 + (rect->ymin+rect->ymax- UI_DPI_ICON_SIZE)/2;
glEnable(GL_BLEND);
@@ -3349,7 +3353,7 @@ void ui_draw_preview_item(uiFontStyle *fstyle, rcti *rect, const char *name, int
trect.xmax = trect.xmin + font_dims[0] + 10;
trect.ymin += 10;
trect.ymax = trect.ymin + font_dims[1];
- if(trect.xmax > rect->xmax - PREVIEW_PAD)
+ if (trect.xmax > rect->xmax - PREVIEW_PAD)
trect.xmax = rect->xmax - PREVIEW_PAD;
bg_rect = trect;
@@ -3358,7 +3362,7 @@ void ui_draw_preview_item(uiFontStyle *fstyle, rcti *rect, const char *name, int
bg_rect.xmax = rect->xmax - PREVIEW_PAD;
bg_rect.ymax += PREVIEW_PAD / 2;
- if(bg_rect.xmax > rect->xmax - PREVIEW_PAD)
+ if (bg_rect.xmax > rect->xmax - PREVIEW_PAD)
bg_rect.xmax = rect->xmax - PREVIEW_PAD;
UI_GetThemeColor3ubv(TH_BUTBACK, bg_col);
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index a534fe11856..3cfb429383a 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -89,10 +89,10 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
const char *cp= error;
- if(btheme) {
+ if (btheme) {
// first check for ui buttons theme
- if(colorid < TH_THEMEUI) {
+ if (colorid < TH_THEMEUI) {
switch(colorid) {
@@ -161,41 +161,41 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
switch(colorid) {
case TH_BACK:
- if(theme_regionid==RGN_TYPE_WINDOW)
+ if (theme_regionid==RGN_TYPE_WINDOW)
cp= ts->back;
- else if(theme_regionid==RGN_TYPE_CHANNELS)
+ else if (theme_regionid==RGN_TYPE_CHANNELS)
cp= ts->list;
- else if(theme_regionid==RGN_TYPE_HEADER)
+ else if (theme_regionid==RGN_TYPE_HEADER)
cp= ts->header;
else
cp= ts->button;
break;
case TH_TEXT:
- if(theme_regionid==RGN_TYPE_WINDOW)
+ if (theme_regionid==RGN_TYPE_WINDOW)
cp= ts->text;
- else if(theme_regionid==RGN_TYPE_CHANNELS)
+ else if (theme_regionid==RGN_TYPE_CHANNELS)
cp= ts->list_text;
- else if(theme_regionid==RGN_TYPE_HEADER)
+ else if (theme_regionid==RGN_TYPE_HEADER)
cp= ts->header_text;
else
cp= ts->button_text;
break;
case TH_TEXT_HI:
- if(theme_regionid==RGN_TYPE_WINDOW)
+ if (theme_regionid==RGN_TYPE_WINDOW)
cp= ts->text_hi;
- else if(theme_regionid==RGN_TYPE_CHANNELS)
+ else if (theme_regionid==RGN_TYPE_CHANNELS)
cp= ts->list_text_hi;
- else if(theme_regionid==RGN_TYPE_HEADER)
+ else if (theme_regionid==RGN_TYPE_HEADER)
cp= ts->header_text_hi;
else
cp= ts->button_text_hi;
break;
case TH_TITLE:
- if(theme_regionid==RGN_TYPE_WINDOW)
+ if (theme_regionid==RGN_TYPE_WINDOW)
cp= ts->title;
- else if(theme_regionid==RGN_TYPE_CHANNELS)
+ else if (theme_regionid==RGN_TYPE_CHANNELS)
cp= ts->list_title;
- else if(theme_regionid==RGN_TYPE_HEADER)
+ else if (theme_regionid==RGN_TYPE_HEADER)
cp= ts->header_title;
else
cp= ts->button_title;
@@ -602,11 +602,11 @@ void ui_theme_init_default(void)
bTheme *btheme;
/* we search for the theme with name Default */
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
- if(strcmp("Default", btheme->name)==0) break;
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
+ if (strcmp("Default", btheme->name)==0) break;
}
- if(btheme==NULL) {
+ if (btheme==NULL) {
btheme= MEM_callocN(sizeof(bTheme), "theme");
BLI_addtail(&U.themes, btheme);
strcpy(btheme->name, "Default");
@@ -870,7 +870,7 @@ void ui_theme_init_default(void)
void UI_SetTheme(int spacetype, int regionid)
{
- if(spacetype==0) { // called for safety, when delete themes
+ if (spacetype==0) { // called for safety, when delete themes
theme_active= U.themes.first;
theme_spacetype= SPACE_VIEW3D;
theme_regionid= RGN_TYPE_WINDOW;
@@ -1182,16 +1182,16 @@ void init_userdef_do_versions(void)
// countall();
/* the UserDef struct is not corrected with do_versions() .... ugh! */
- if(U.wheellinescroll == 0) U.wheellinescroll = 3;
- if(U.menuthreshold1==0) {
+ if (U.wheellinescroll == 0) U.wheellinescroll = 3;
+ if (U.menuthreshold1==0) {
U.menuthreshold1= 5;
U.menuthreshold2= 2;
}
- if(U.tb_leftmouse==0) {
+ if (U.tb_leftmouse==0) {
U.tb_leftmouse= 5;
U.tb_rightmouse= 5;
}
- if(U.mixbufsize==0) U.mixbufsize= 2048;
+ if (U.mixbufsize==0) U.mixbufsize= 2048;
if (strcmp(U.tempdir, "/") == 0) {
BLI_system_temporary_dir(U.tempdir);
}
@@ -1204,12 +1204,12 @@ void init_userdef_do_versions(void)
// XXX error(STRINGIFY(BLENDER_STARTUP_FILE)" is buggy, please consider removing it.\n");
}
/* transform widget settings */
- if(U.tw_hotspot==0) {
+ if (U.tw_hotspot==0) {
U.tw_hotspot= 14;
U.tw_size= 20; // percentage of window size
U.tw_handlesize= 16; // percentage of widget radius
}
- if(U.pad_rot_angle==0)
+ if (U.pad_rot_angle==0)
U.pad_rot_angle= 15;
/* graph editor - unselected F-Curve visibility */
if (U.fcu_inactive_alpha == 0) {
@@ -1237,18 +1237,18 @@ void init_userdef_do_versions(void)
U.uiflag |= USER_GLOBALUNDO;
if (U.undosteps==0) U.undosteps=32;
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
/* check for alpha==0 is safe, then color was never set */
- if(btheme->tv3d.edge_seam[3]==0) {
+ if (btheme->tv3d.edge_seam[3]==0) {
rgba_char_args_set(btheme->tv3d.edge_seam, 230, 150, 50, 255);
}
- if(btheme->tv3d.normal[3]==0) {
+ if (btheme->tv3d.normal[3]==0) {
rgba_char_args_set(btheme->tv3d.normal, 0x22, 0xDD, 0xDD, 255);
}
- if(btheme->tv3d.vertex_normal[3]==0) {
+ if (btheme->tv3d.vertex_normal[3]==0) {
rgba_char_args_set(btheme->tv3d.vertex_normal, 0x23, 0x61, 0xDD, 255);
}
- if(btheme->tv3d.face_dot[3]==0) {
+ if (btheme->tv3d.face_dot[3]==0) {
rgba_char_args_set(btheme->tv3d.face_dot, 255, 138, 48, 255);
btheme->tv3d.facedot_size= 4;
}
@@ -1262,16 +1262,16 @@ void init_userdef_do_versions(void)
if (bmain->versionfile <= 236) {
bTheme *btheme;
/* new space type */
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
/* check for alpha==0 is safe, then color was never set */
- if(btheme->ttime.back[3]==0) {
+ if (btheme->ttime.back[3]==0) {
// copied from ui_theme_init_default
btheme->ttime= btheme->tv3d;
rgba_char_args_set_fl(btheme->ttime.back, 0.45, 0.45, 0.45, 1.0);
rgba_char_args_set_fl(btheme->ttime.grid, 0.36, 0.36, 0.36, 1.0);
rgba_char_args_set(btheme->ttime.shade1, 173, 173, 173, 255); // sliders
}
- if(btheme->text.syntaxn[3]==0) {
+ if (btheme->text.syntaxn[3]==0) {
rgba_char_args_set(btheme->text.syntaxn, 0, 0, 200, 255); /* Numbers Blue*/
rgba_char_args_set(btheme->text.syntaxl, 100, 0, 0, 255); /* Strings red */
rgba_char_args_set(btheme->text.syntaxc, 0, 100, 50, 255); /* Comments greenish */
@@ -1283,9 +1283,9 @@ void init_userdef_do_versions(void)
if (bmain->versionfile <= 237) {
bTheme *btheme;
/* bone colors */
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
/* check for alpha==0 is safe, then color was never set */
- if(btheme->tv3d.bone_solid[3]==0) {
+ if (btheme->tv3d.bone_solid[3]==0) {
rgba_char_args_set(btheme->tv3d.bone_solid, 200, 200, 200, 255);
rgba_char_args_set(btheme->tv3d.bone_pose, 80, 200, 255, 80);
}
@@ -1294,9 +1294,9 @@ void init_userdef_do_versions(void)
if (bmain->versionfile <= 238) {
bTheme *btheme;
/* bone colors */
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
/* check for alpha==0 is safe, then color was never set */
- if(btheme->tnla.strip[3]==0) {
+ if (btheme->tnla.strip[3]==0) {
rgba_char_args_set(btheme->tnla.strip_select, 0xff, 0xff, 0xaa, 255);
rgba_char_args_set(btheme->tnla.strip, 0xe4, 0x9c, 0xc6, 255);
}
@@ -1305,22 +1305,22 @@ void init_userdef_do_versions(void)
if (bmain->versionfile <= 239) {
bTheme *btheme;
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
/* Lamp theme, check for alpha==0 is safe, then color was never set */
- if(btheme->tv3d.lamp[3]==0) {
+ if (btheme->tv3d.lamp[3]==0) {
rgba_char_args_set(btheme->tv3d.lamp, 0, 0, 0, 40);
/* TEMPORAL, remove me! (ton) */
U.uiflag |= USER_PLAINMENUS;
}
}
- if(U.obcenter_dia==0) U.obcenter_dia= 6;
+ if (U.obcenter_dia==0) U.obcenter_dia= 6;
}
if (bmain->versionfile <= 241) {
bTheme *btheme;
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
/* Node editor theme, check for alpha==0 is safe, then color was never set */
- if(btheme->tnode.syntaxn[3]==0) {
+ if (btheme->tnode.syntaxn[3]==0) {
/* re-uses syntax color storage */
btheme->tnode= btheme->tv3d;
rgba_char_args_set(btheme->tnode.edge_select, 255, 255, 255, 255);
@@ -1331,12 +1331,12 @@ void init_userdef_do_versions(void)
rgba_char_args_set(btheme->tnode.syntaxc, 120, 145, 120, 255); /* group */
}
/* Group theme colors */
- if(btheme->tv3d.group[3]==0) {
+ if (btheme->tv3d.group[3]==0) {
rgba_char_args_set(btheme->tv3d.group, 0x0C, 0x30, 0x0C, 255);
rgba_char_args_set(btheme->tv3d.group_active, 0x66, 0xFF, 0x66, 255);
}
/* Sequence editor theme*/
- if(btheme->tseq.movie[3]==0) {
+ if (btheme->tseq.movie[3]==0) {
rgba_char_args_set(btheme->tseq.movie, 81, 105, 135, 255);
rgba_char_args_set(btheme->tseq.image, 109, 88, 129, 255);
rgba_char_args_set(btheme->tseq.scene, 78, 152, 62, 255);
@@ -1360,17 +1360,17 @@ void init_userdef_do_versions(void)
if (bmain->versionfile <= 242) {
bTheme *btheme;
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
/* long keyframe color */
/* check for alpha==0 is safe, then color was never set */
- if(btheme->tact.strip[3]==0) {
+ if (btheme->tact.strip[3]==0) {
rgba_char_args_set(btheme->tv3d.edge_sharp, 255, 32, 32, 255);
rgba_char_args_set(btheme->tact.strip_select, 0xff, 0xff, 0xaa, 204);
rgba_char_args_set(btheme->tact.strip, 0xe4, 0x9c, 0xc6, 204);
}
/* IPO-Editor - Vertex Size*/
- if(btheme->tipo.vertex_size == 0) {
+ if (btheme->tipo.vertex_size == 0) {
btheme->tipo.vertex_size= 3;
}
}
@@ -1381,10 +1381,10 @@ void init_userdef_do_versions(void)
}
if (bmain->versionfile < 245 || (bmain->versionfile == 245 && bmain->subversionfile < 3)) {
bTheme *btheme;
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
rgba_char_args_set(btheme->tv3d.editmesh_active, 255, 255, 255, 128);
}
- if(U.coba_weight.tot==0)
+ if (U.coba_weight.tot==0)
init_colorband(&U.coba_weight, 1);
}
if ((bmain->versionfile < 245) || (bmain->versionfile == 245 && bmain->subversionfile < 11)) {
@@ -1440,9 +1440,9 @@ void init_userdef_do_versions(void)
if (bmain->versionfile < 250) {
bTheme *btheme;
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
/* this was not properly initialized in 2.45 */
- if(btheme->tima.face_dot[3]==0) {
+ if (btheme->tima.face_dot[3]==0) {
rgba_char_args_set(btheme->tima.editmesh_active, 255, 255, 255, 128);
rgba_char_args_set(btheme->tima.face_dot, 255, 133, 0, 255);
btheme->tima.facedot_size= 2;
@@ -1481,16 +1481,16 @@ void init_userdef_do_versions(void)
if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 1)) {
bTheme *btheme;
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
/* common (new) variables, it checks for alpha==0 */
ui_theme_init_new(btheme);
- if(btheme->tui.wcol_num.outline[3]==0)
+ if (btheme->tui.wcol_num.outline[3]==0)
ui_widget_color_init(&btheme->tui);
/* Logic editor theme, check for alpha==0 is safe, then color was never set */
- if(btheme->tlogic.syntaxn[3]==0) {
+ if (btheme->tlogic.syntaxn[3]==0) {
/* re-uses syntax color storage */
btheme->tlogic= btheme->tv3d;
rgba_char_args_set(btheme->tlogic.back, 100, 100, 100, 255);
@@ -1503,9 +1503,9 @@ void init_userdef_do_versions(void)
if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 3)) {
/* new audio system */
- if(U.audiochannels == 0)
+ if (U.audiochannels == 0)
U.audiochannels = 2;
- if(U.audiodevice == 0) {
+ if (U.audiodevice == 0) {
#ifdef WITH_OPENAL
U.audiodevice = 2;
#endif
@@ -1513,9 +1513,9 @@ void init_userdef_do_versions(void)
U.audiodevice = 1;
#endif
}
- if(U.audioformat == 0)
+ if (U.audioformat == 0)
U.audioformat = 0x24;
- if(U.audiorate == 0)
+ if (U.audiorate == 0)
U.audiorate = 44100;
}
@@ -1525,7 +1525,7 @@ void init_userdef_do_versions(void)
if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 8)) {
wmKeyMap *km;
- for(km=U.user_keymaps.first; km; km=km->next) {
+ for (km=U.user_keymaps.first; km; km=km->next) {
if (strcmp(km->idname, "Armature_Sketch")==0)
strcpy(km->idname, "Armature Sketch");
else if (strcmp(km->idname, "View3D")==0)
@@ -1563,7 +1563,7 @@ void init_userdef_do_versions(void)
}
}
if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 16)) {
- if(U.wmdrawmethod == USER_DRAW_TRIPLE)
+ if (U.wmdrawmethod == USER_DRAW_TRIPLE)
U.wmdrawmethod = USER_DRAW_AUTOMATIC;
}
@@ -1578,7 +1578,7 @@ void init_userdef_do_versions(void)
U.keyhandles_new = HD_AUTO;
/* init new curve colors */
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
/* init colors used for handles in 3D-View */
rgba_char_args_set(btheme->tv3d.handle_free, 0, 0, 0, 255);
rgba_char_args_set(btheme->tv3d.handle_auto, 0x90, 0x90, 0x00, 255);
@@ -1608,7 +1608,7 @@ void init_userdef_do_versions(void)
bTheme *btheme;
/* init new curve colors */
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
if (btheme->tv3d.lastsel_point[3] == 0)
rgba_char_args_set(btheme->tv3d.lastsel_point, 0xff, 0xff, 0xff, 255);
}
@@ -1630,7 +1630,7 @@ void init_userdef_do_versions(void)
5, -5
};
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
/* init progress bar theme */
btheme->tui.wcol_progress= wcol_progress;
}
@@ -1638,7 +1638,7 @@ void init_userdef_do_versions(void)
if (bmain->versionfile < 255 || (bmain->versionfile == 255 && bmain->subversionfile < 2)) {
bTheme *btheme;
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
rgba_char_args_set(btheme->tv3d.extra_edge_len, 32, 0, 0, 255);
rgba_char_args_set(btheme->tv3d.extra_face_angle, 0, 32, 0, 255);
rgba_char_args_set(btheme->tv3d.extra_face_area, 0, 0, 128, 255);
@@ -1647,8 +1647,8 @@ void init_userdef_do_versions(void)
if (bmain->versionfile < 256 || (bmain->versionfile == 256 && bmain->subversionfile < 4)) {
bTheme *btheme;
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
- if((btheme->tv3d.outline_width) == 0) btheme->tv3d.outline_width= 1;
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
+ if ((btheme->tv3d.outline_width) == 0) btheme->tv3d.outline_width= 1;
}
}
@@ -1659,7 +1659,7 @@ void init_userdef_do_versions(void)
if (bmain->versionfile < 258 || (bmain->versionfile == 258 && bmain->subversionfile < 2)) {
bTheme *btheme;
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
btheme->tnode.noodle_curving = 5;
}
}
@@ -1667,7 +1667,7 @@ void init_userdef_do_versions(void)
if (bmain->versionfile < 259 || (bmain->versionfile == 259 && bmain->subversionfile < 1)) {
bTheme *btheme;
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
btheme->tv3d.speaker[3] = 255;
}
}
@@ -1681,14 +1681,14 @@ void init_userdef_do_versions(void)
if (U.keyhandles_new == HD_AUTO)
U.keyhandles_new = HD_AUTO_ANIM;
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
- if(btheme->tv3d.bundle_solid[3] == 0)
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
+ if (btheme->tv3d.bundle_solid[3] == 0)
rgba_char_args_set(btheme->tv3d.bundle_solid, 200, 200, 200, 255);
- if(btheme->tv3d.camera_path[3] == 0)
+ if (btheme->tv3d.camera_path[3] == 0)
rgba_char_args_set(btheme->tv3d.camera_path, 0x00, 0x00, 0x00, 255);
- if((btheme->tclip.back[3]) == 0) {
+ if ((btheme->tclip.back[3]) == 0) {
btheme->tclip= btheme->tv3d;
rgba_char_args_set(btheme->tclip.marker_outline, 0x00, 0x00, 0x00, 255);
@@ -1707,14 +1707,14 @@ void init_userdef_do_versions(void)
}
/* auto-clamped handles -> based on auto */
- if(btheme->tipo.handle_auto_clamped[3] == 0)
+ if (btheme->tipo.handle_auto_clamped[3] == 0)
rgba_char_args_set(btheme->tipo.handle_auto_clamped, 0x99, 0x40, 0x30, 255);
- if(btheme->tipo.handle_sel_auto_clamped[3] == 0)
+ if (btheme->tipo.handle_sel_auto_clamped[3] == 0)
rgba_char_args_set(btheme->tipo.handle_sel_auto_clamped, 0xf0, 0xaf, 0x90, 255);
}
/* enable (Cycles) addon by default */
- if(!BLI_findstring(&U.addons, "cycles", offsetof(bAddon, module))) {
+ if (!BLI_findstring(&U.addons, "cycles", offsetof(bAddon, module))) {
bAddon *baddon= MEM_callocN(sizeof(bAddon), "bAddon");
BLI_strncpy(baddon->module, "cycles", sizeof(baddon->module));
BLI_addtail(&U.addons, baddon);
@@ -1724,7 +1724,7 @@ void init_userdef_do_versions(void)
if (bmain->versionfile < 260 || (bmain->versionfile == 260 && bmain->subversionfile < 5)) {
bTheme *btheme;
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
rgba_char_args_set(btheme->tui.panel.header, 0, 0, 0, 25);
btheme->tui.icon_alpha= 1.0;
}
@@ -1732,7 +1732,7 @@ void init_userdef_do_versions(void)
if (bmain->versionfile < 261 || (bmain->versionfile == 261 && bmain->subversionfile < 4)) {
bTheme *btheme;
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
rgba_char_args_set_fl(btheme->tima.preview_stitch_face, 0.071, 0.259, 0.694, 0.150);
rgba_char_args_set_fl(btheme->tima.preview_stitch_edge, 1.0, 0.522, 0.0, 0.7);
rgba_char_args_set_fl(btheme->tima.preview_stitch_vert, 1.0, 0.522, 0.0, 0.5);
@@ -1749,7 +1749,7 @@ void init_userdef_do_versions(void)
if (bmain->versionfile < 262 || (bmain->versionfile == 262 && bmain->subversionfile < 2)) {
bTheme *btheme;
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
if (btheme->tui.wcol_menu_item.item[3] == 255)
rgba_char_args_set(btheme->tui.wcol_menu_item.item, 172, 172, 172, 128);
}
@@ -1757,7 +1757,7 @@ void init_userdef_do_versions(void)
if (bmain->versionfile < 262 || (bmain->versionfile == 262 && bmain->subversionfile < 3)) {
bTheme *btheme;
- for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
if (btheme->tui.wcol_tooltip.inner[3] == 0) {
btheme->tui.wcol_tooltip = btheme->tui.wcol_menu_back;
}
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index 8c67502978a..9072db77b6f 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -73,9 +73,9 @@
*/
static int view2d_scroll_mapped(int scroll)
{
- if(scroll & V2D_SCROLL_HORIZONTAL_HIDE)
+ if (scroll & V2D_SCROLL_HORIZONTAL_HIDE)
scroll &= ~(V2D_SCROLL_HORIZONTAL);
- if(scroll & V2D_SCROLL_VERTICAL_HIDE)
+ if (scroll & V2D_SCROLL_VERTICAL_HIDE)
scroll &= ~(V2D_SCROLL_VERTICAL);
return scroll;
}
@@ -95,11 +95,11 @@ static void view2d_masks(View2D *v2d)
v2d->scroll &= ~(V2D_SCROLL_HORIZONTAL_HIDE|V2D_SCROLL_VERTICAL_HIDE);
/* check size if: */
if (v2d->scroll & V2D_SCROLL_HORIZONTAL)
- if(!(v2d->scroll & V2D_SCROLL_SCALE_HORIZONTAL))
+ if (!(v2d->scroll & V2D_SCROLL_SCALE_HORIZONTAL))
if (v2d->tot.xmax-v2d->tot.xmin <= v2d->cur.xmax-v2d->cur.xmin)
v2d->scroll |= V2D_SCROLL_HORIZONTAL_HIDE;
if (v2d->scroll & V2D_SCROLL_VERTICAL)
- if(!(v2d->scroll & V2D_SCROLL_SCALE_VERTICAL))
+ if (!(v2d->scroll & V2D_SCROLL_SCALE_VERTICAL))
if (v2d->tot.ymax-v2d->tot.ymin <= v2d->cur.ymax-v2d->cur.ymin)
v2d->scroll |= V2D_SCROLL_VERTICAL_HIDE;
#endif
@@ -362,10 +362,10 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
* NOTE: width and height must use FLT_MIN instead of 1, otherwise it is impossible to
* get enough resolution in Graph Editor for editing some curves
*/
- if(width < FLT_MIN) width= 1;
- if(height < FLT_MIN) height= 1;
- if(winx < 1) winx= 1;
- if(winy < 1) winy= 1;
+ if (width < FLT_MIN) width= 1;
+ if (height < FLT_MIN) height= 1;
+ if (winx < 1) winx= 1;
+ if (winy < 1) winy= 1;
/* V2D_LIMITZOOM indicates that zoom level should be preserved when the window size changes */
if (resize && (v2d->keepzoom & V2D_KEEPZOOM)) {
@@ -375,7 +375,7 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
zoom= winx / width;
oldzoom= v2d->oldwinx / curwidth;
- if(oldzoom != zoom)
+ if (oldzoom != zoom)
width *= zoom/oldzoom;
}
@@ -383,7 +383,7 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
zoom= winy / height;
oldzoom= v2d->oldwiny / curheight;
- if(oldzoom != zoom)
+ if (oldzoom != zoom)
height *= zoom/oldzoom;
}
}
@@ -502,7 +502,7 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
cur->xmax += width - (cur->xmax - cur->xmin);
}
else if (v2d->keepofs & V2D_KEEPOFS_X) {
- if(v2d->align & V2D_ALIGN_NO_POS_X)
+ if (v2d->align & V2D_ALIGN_NO_POS_X)
cur->xmin -= width - (cur->xmax - cur->xmin);
else
cur->xmax += width - (cur->xmax - cur->xmin);
@@ -520,7 +520,7 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
cur->ymax += height - (cur->ymax - cur->ymin);
}
else if (v2d->keepofs & V2D_KEEPOFS_Y) {
- if(v2d->align & V2D_ALIGN_NO_POS_Y)
+ if (v2d->align & V2D_ALIGN_NO_POS_Y)
cur->ymin -= height - (cur->ymax - cur->ymin);
else
cur->ymax += height - (cur->ymax - cur->ymin);
@@ -846,9 +846,9 @@ void UI_view2d_totRect_set_resize (View2D *v2d, int width, int height, int resiz
/* hrumf! */
/* XXX: there are work arounds for this in the panel and file browse code. */
- if(scroll & V2D_SCROLL_HORIZONTAL)
+ if (scroll & V2D_SCROLL_HORIZONTAL)
width -= V2D_SCROLL_WIDTH;
- if(scroll & V2D_SCROLL_VERTICAL)
+ if (scroll & V2D_SCROLL_VERTICAL)
height -= V2D_SCROLL_HEIGHT;
if (ELEM3(0, v2d, width, height)) {
@@ -911,8 +911,8 @@ int UI_view2d_tab_set(View2D *v2d, int tab)
int changed= 0;
/* if tab changed, change offset */
- if(tab != v2d->tab_cur && v2d->tab_offset) {
- if(tab < v2d->tab_num)
+ if (tab != v2d->tab_cur && v2d->tab_offset) {
+ if (tab < v2d->tab_num)
offset= &v2d->tab_offset[tab*2];
else
offset= default_offset;
@@ -929,10 +929,10 @@ int UI_view2d_tab_set(View2D *v2d, int tab)
}
/* resize array if needed */
- if(tab >= v2d->tab_num) {
+ if (tab >= v2d->tab_num) {
new_offset= MEM_callocN(sizeof(float)*(tab+1)*2, "view2d tab offset");
- if(v2d->tab_offset) {
+ if (v2d->tab_offset) {
memcpy(new_offset, v2d->tab_offset, sizeof(float)*v2d->tab_num*2);
MEM_freeN(v2d->tab_offset);
}
@@ -995,11 +995,11 @@ void UI_view2d_view_ortho(View2D *v2d)
curmasked.ymin-= yofs; curmasked.ymax-=yofs;
/* XXX ton: this flag set by outliner, for icons */
- if(v2d->flag & V2D_PIXELOFS_X) {
+ if (v2d->flag & V2D_PIXELOFS_X) {
curmasked.xmin = floorf(curmasked.xmin) - 0.001f;
curmasked.xmax = floorf(curmasked.xmax) - 0.001f;
}
- if(v2d->flag & V2D_PIXELOFS_Y) {
+ if (v2d->flag & V2D_PIXELOFS_Y) {
curmasked.ymin = floorf(curmasked.ymin) - 0.001f;
curmasked.ymax = floorf(curmasked.ymax) - 0.001f;
}
@@ -1078,7 +1078,7 @@ static void step_to_grid(float *step, int *power, int unit)
if (loga < 0.0f) {
if (rem < 0.2f) rem= 0.2f;
- else if(rem < 0.5f) rem= 0.5f;
+ else if (rem < 0.5f) rem= 0.5f;
else rem= 1.0f;
*step= rem * (float)pow(10.0, (*power));
@@ -1094,7 +1094,7 @@ static void step_to_grid(float *step, int *power, int unit)
}
else {
if (rem < 2.0f) rem= 2.0f;
- else if(rem < 5.0f) rem= 5.0f;
+ else if (rem < 5.0f) rem= 5.0f;
else rem= 10.0f;
*step= rem * (float)pow(10.0, (*power));
@@ -1143,7 +1143,7 @@ View2DGrid *UI_view2d_grid_calc(Scene *scene, View2D *v2d, short xunits, short x
space= v2d->cur.xmax - v2d->cur.xmin;
pixels= (float)(v2d->mask.xmax - v2d->mask.xmin);
- if(pixels!=0.0f) {
+ if (pixels!=0.0f) {
grid->dx= (U.v2d_min_gridsize * space) / (seconddiv * pixels);
step_to_grid(&grid->dx, &grid->powerx, xunits);
grid->dx *= seconddiv;
@@ -1307,13 +1307,13 @@ void UI_view2d_constant_grid_draw(View2D *v2d)
start= v2d->cur.xmin - (float)fmod(v2d->cur.xmin, step);
glBegin(GL_LINES);
- for(; start<v2d->cur.xmax; start+=step) {
+ for (; start<v2d->cur.xmax; start+=step) {
glVertex2f(start, v2d->cur.ymin);
glVertex2f(start, v2d->cur.ymax);
}
start= v2d->cur.ymin - (float)fmod(v2d->cur.ymin, step);
- for(; start<v2d->cur.ymax; start+=step) {
+ for (; start<v2d->cur.ymax; start+=step) {
glVertex2f(v2d->cur.xmin, start);
glVertex2f(v2d->cur.xmax, start);
}
@@ -1411,16 +1411,16 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short
/* scroller 'button' extents */
totsize= v2d->tot.xmax - v2d->tot.xmin;
scrollsize= (float)(hor.xmax - hor.xmin);
- if(totsize==0.0f) totsize = 1.0f; /* avoid divide by zero */
+ if (totsize==0.0f) totsize = 1.0f; /* avoid divide by zero */
fac1= (v2d->cur.xmin - v2d->tot.xmin) / totsize;
- if(fac1<=0.0f)
+ if (fac1<=0.0f)
scrollers->hor_min= hor.xmin;
else
scrollers->hor_min= (int)(hor.xmin + (fac1 * scrollsize));
fac2= (v2d->cur.xmax - v2d->tot.xmin) / totsize;
- if(fac2>=1.0f)
+ if (fac2>=1.0f)
scrollers->hor_max= hor.xmax;
else
scrollers->hor_max= (int)(hor.xmin + (fac2 * scrollsize));
@@ -1437,7 +1437,7 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short
}
/* check whether sliders can disappear due to the full-range being used */
- if(v2d->keeptot) {
+ if (v2d->keeptot) {
if ((fac1 <= 0.0f) && (fac2 >= 1.0f)) {
v2d->scroll |= V2D_SCROLL_HORIZONTAL_FULLR;
scrollers->horfull= 1;
@@ -1452,16 +1452,16 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short
/* scroller 'button' extents */
totsize= v2d->tot.ymax - v2d->tot.ymin;
scrollsize= (float)(vert.ymax - vert.ymin);
- if(totsize==0.0f) totsize = 1.0f; /* avoid divide by zero */
+ if (totsize==0.0f) totsize = 1.0f; /* avoid divide by zero */
fac1= (v2d->cur.ymin- v2d->tot.ymin) / totsize;
- if(fac1<=0.0f)
+ if (fac1<=0.0f)
scrollers->vert_min= vert.ymin;
else
scrollers->vert_min= (int)(vert.ymin + (fac1 * scrollsize));
fac2= (v2d->cur.ymax - v2d->tot.ymin) / totsize;
- if(fac2>=1.0f)
+ if (fac2>=1.0f)
scrollers->vert_max= vert.ymax;
else
scrollers->vert_max= (int)(vert.ymin + (fac2 * scrollsize));
@@ -1479,7 +1479,7 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short
}
/* check whether sliders can disappear due to the full-range being used */
- if(v2d->keeptot) {
+ if (v2d->keeptot) {
if ((fac1 <= 0.0f) && (fac2 >= 1.0f)) {
v2d->scroll |= V2D_SCROLL_VERTICAL_FULLR;
scrollers->vertfull= 1;
@@ -1559,7 +1559,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
/* horizontal scrollbar */
if (scroll & V2D_SCROLL_HORIZONTAL) {
/* only draw scrollbar when it doesn't fill the entire space */
- if(vs->horfull==0) {
+ if (vs->horfull==0) {
bTheme *btheme= UI_GetTheme();
uiWidgetColors wcol= btheme->tui.wcol_scroll;
rcti slider;
@@ -1628,7 +1628,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
for (; fac < hor.xmax-10; fac+=dfac, val+=grid->dx) {
/* make prints look nicer for scrollers */
- if(fac < hor.xmin+10)
+ if (fac < hor.xmin+10)
continue;
switch (vs->xunits) {
@@ -1670,7 +1670,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
/* vertical scrollbar */
if (scroll & V2D_SCROLL_VERTICAL) {
/* only draw scrollbar when it doesn't fill the entire space */
- if(vs->vertfull==0) {
+ if (vs->vertfull==0) {
bTheme *btheme= UI_GetTheme();
uiWidgetColors wcol= btheme->tui.wcol_scroll;
rcti slider;
@@ -1738,7 +1738,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
for (; fac < vert.ymax-10; fac+= dfac, val += grid->dy) {
/* make prints look nicer for scrollers */
- if(fac < vert.ymin+10)
+ if (fac < vert.ymin+10)
continue;
scroll_printstr(scene, (float)(vert.xmax)-2.0f, fac, val, grid->powery, vs->yunits, 'v');
@@ -1935,12 +1935,12 @@ void UI_view2d_to_region_no_clip(View2D *v2d, float x, float y, int *regionx, in
/* although we don't clamp to lie within region bounds, we must avoid exceeding size of ints */
if (regionx) {
if (x < INT_MIN) *regionx= INT_MIN;
- else if(x > INT_MAX) *regionx= INT_MAX;
+ else if (x > INT_MAX) *regionx= INT_MAX;
else *regionx= (int)x;
}
if (regiony) {
if (y < INT_MIN) *regiony= INT_MIN;
- else if(y > INT_MAX) *regiony= INT_MAX;
+ else if (y > INT_MAX) *regiony= INT_MAX;
else *regiony= (int)y;
}
}
@@ -2039,7 +2039,7 @@ void UI_view2d_text_cache_add(View2D *v2d, float x, float y, const char *str, co
UI_view2d_view_to_region(v2d, x, y, mval, mval+1);
- if(mval[0]!=V2D_IS_CLIPPED && mval[1]!=V2D_IS_CLIPPED) {
+ if (mval[0]!=V2D_IS_CLIPPED && mval[1]!=V2D_IS_CLIPPED) {
int len= strlen(str)+1;
/* use calloc, rect has to be zeroe'd */
View2DString *v2s= MEM_callocN(sizeof(View2DString)+len, "View2DString");
@@ -2083,19 +2083,19 @@ void UI_view2d_text_cache_draw(ARegion *ar)
// glPushMatrix();
ED_region_pixelspace(ar);
- for(v2s= strings.first; v2s; v2s= v2s->next) {
+ for (v2s= strings.first; v2s; v2s= v2s->next) {
const char *str= (const char *)(v2s+1);
int xofs=0, yofs;
yofs= ceil( 0.5f*(v2s->rect.ymax - v2s->rect.ymin - BLF_height_default("28")));
- if(yofs<1) yofs= 1;
+ if (yofs<1) yofs= 1;
- if(col_pack_prev != v2s->col.pack) {
+ if (col_pack_prev != v2s->col.pack) {
glColor3ubv(v2s->col.ub);
col_pack_prev= v2s->col.pack;
}
- if(v2s->rect.xmin >= v2s->rect.xmax)
+ if (v2s->rect.xmin >= v2s->rect.xmax)
BLF_draw_default((float)v2s->mval[0]+xofs, (float)v2s->mval[1]+yofs, 0.0, str, BLF_DRAW_STR_DUMMY_MAX);
else {
BLF_clipping_default(v2s->rect.xmin-4, v2s->rect.ymin-4, v2s->rect.xmax+4, v2s->rect.ymax+4);
@@ -2110,7 +2110,7 @@ void UI_view2d_text_cache_draw(ARegion *ar)
// glMatrixMode(GL_MODELVIEW);
// glPopMatrix();
- if(strings.first)
+ if (strings.first)
BLI_freelistN(&strings);
}
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c
index 29850c91480..c729e944c62 100644
--- a/source/blender/editors/interface/view2d_ops.c
+++ b/source/blender/editors/interface/view2d_ops.c
@@ -418,7 +418,7 @@ static int view_scrolldown_exec(bContext *C, wmOperator *op)
RNA_int_set(op->ptr, "deltax", 0);
RNA_int_set(op->ptr, "deltay", -40);
- if(RNA_boolean_get(op->ptr, "page")) {
+ if (RNA_boolean_get(op->ptr, "page")) {
ARegion *ar= CTX_wm_region(C);
RNA_int_set(op->ptr, "deltay", ar->v2d.mask.ymin - ar->v2d.mask.ymax);
}
@@ -468,7 +468,7 @@ static int view_scrollup_exec(bContext *C, wmOperator *op)
RNA_int_set(op->ptr, "deltax", 0);
RNA_int_set(op->ptr, "deltay", 40);
- if(RNA_boolean_get(op->ptr, "page")) {
+ if (RNA_boolean_get(op->ptr, "page")) {
ARegion *ar= CTX_wm_region(C);
RNA_int_set(op->ptr, "deltay", ar->v2d.mask.ymax - ar->v2d.mask.ymin);
}
@@ -753,7 +753,7 @@ static int view_zoomout_invoke(bContext *C, wmOperator *op, wmEvent *event)
vzd= op->customdata;
- if(U.uiflag & USER_ZOOM_TO_MOUSEPOS) {
+ if (U.uiflag & USER_ZOOM_TO_MOUSEPOS) {
ARegion *ar= CTX_wm_region(C);
/* store initial mouse position (in view space) */
@@ -867,7 +867,7 @@ static void view_zoomdrag_exit(bContext *C, wmOperator *op)
if (op->customdata) {
v2dViewZoomData *vzd= op->customdata;
- if(vzd->timer)
+ if (vzd->timer)
WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), vzd->timer);
MEM_freeN(op->customdata);
@@ -975,7 +975,7 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, wmEvent *event)
if (event->type == TIMER && event->customdata == vzd->timer) {
view_zoomdrag_apply(C, op);
}
- else if(event->type == MOUSEMOVE) {
+ else if (event->type == MOUSEMOVE) {
float dx, dy;
/* calculate new delta transform, based on zooming mode */