code cleanup: use an enum for uiBut->pointype (more useful debug display of members),

and rename COL -> COLOR --- less confusing since the layout engine has row/col's.
This commit is contained in:
2012-09-11 23:10:23 +00:00
parent ed6215bff1
commit 319831d7b8
9 changed files with 28 additions and 28 deletions

View File

@@ -339,7 +339,6 @@ void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op)
goto cleanup;
}
j = 0;
if (vv1[0] == vv1[lenv1 - 1]) {
lenv1--;
}

View File

@@ -187,13 +187,14 @@ typedef struct uiLayout uiLayout;
* - bit 8: for 'bit'
* - bit 9-15: button type (now 6 bits, 64 types)
* */
#define CHA 32
#define SHO 64
#define INT 96
#define FLO 128
/*#define FUN 192*/ /*UNUSED*/
#define BIT 256
typedef enum {
CHA = 32,
SHO = 64,
INT = 96,
FLO = 128,
/* FUN = 192, */ /*UNUSED*/
BIT = 256
} eButPointerType;
/* button reqyires a pointer */
#define BUTPOIN (FLO | SHO | CHA)
@@ -214,7 +215,7 @@ typedef enum {
ICONROW = (12 << 9),
ICONTOG = (13 << 9),
NUMSLI = (14 << 9),
COL = (15 << 9),
COLOR = (15 << 9),
IDPOIN = (16 << 9),
HSVSLI = (17 << 9),
SCROLL = (18 << 9),

View File

@@ -1149,7 +1149,7 @@ static void ui_is_but_sel(uiBut *but, double *value)
if (*value == (double)but->hardmax) is_push = 1;
}
break;
case COL:
case COLOR:
is_push = 2;
break;
default:

View File

@@ -1049,7 +1049,7 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
case PULLDOWN:
ui_apply_but_BLOCK(C, but, data);
break;
case COL:
case COLOR:
if (data->cancel)
ui_apply_but_VEC(C, but, data);
else
@@ -1180,7 +1180,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
}
/* RGB triple */
else if (but->type == COL) {
else if (but->type == COLOR) {
float rgb[3];
if (but->poin == NULL && but->rnapoin.data == NULL) ;
@@ -2092,12 +2092,12 @@ static void ui_blockopen_begin(bContext *C, uiBut *but, uiHandleButtonData *data
menufunc = ui_block_func_ICONTEXTROW;
arg = but;
break;
case COL:
case COLOR:
ui_get_but_vectorf(but, data->origvec);
copy_v3_v3(data->vec, data->origvec);
but->editvec = data->vec;
handlefunc = ui_block_func_COL;
handlefunc = ui_block_func_COLOR;
arg = but;
break;
@@ -3001,7 +3001,7 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, wm
return WM_UI_HANDLER_BREAK;
}
}
else if (but->type == COL) {
else if (but->type == COLOR) {
if (ELEM(event->type, WHEELDOWNMOUSE, WHEELUPMOUSE) && event->alt) {
float *hsv = ui_block_hsv_get(but->block);
float col[3];
@@ -4908,7 +4908,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
case BUTM:
retval = ui_do_but_BUT(C, but, data, event);
break;
case COL:
case COLOR:
if (but->a1 == UI_GRAD_V_ALT) /* signal to prevent calling up color picker */
retval = ui_do_but_EXIT(C, but, data, event);
else
@@ -5874,7 +5874,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
}
}
if (but->type != COL) { /* exception */
if (but->type != COLOR) { /* exception */
data->cancel = TRUE;
}
button_activate_state(C, but, BUTTON_STATE_EXIT);
@@ -5984,7 +5984,7 @@ static void ui_handle_button_return_submenu(bContext *C, wmEvent *event, uiBut *
/* copy over return values from the closing menu */
if ((menu->menuretval & UI_RETURN_OK) || (menu->menuretval & UI_RETURN_UPDATE)) {
if (but->type == COL)
if (but->type == COLOR)
copy_v3_v3(data->vec, menu->retvec);
else if (ELEM3(but->type, MENU, ICONROW, ICONTEXTROW))
data->value = menu->retvalue;

View File

@@ -94,8 +94,7 @@ typedef enum {
UI_WTYPE_BOX,
UI_WTYPE_SCROLL,
UI_WTYPE_LISTITEM,
UI_WTYPE_PROGRESSBAR,
UI_WTYPE_PROGRESSBAR
} uiWidgetTypeEnum;
/* panel limits */
@@ -133,7 +132,7 @@ typedef enum {
/* bit button defines */
/* Bit operations */
#define UI_BITBUT_TEST(a, b) ( ( (a) & 1 << (b) ) != 0)
#define UI_BITBUT_TEST(a, b) ( ( (a) & 1 << (b) ) != 0)
#define UI_BITBUT_SET(a, b) ( (a) | 1 << (b) )
#define UI_BITBUT_CLR(a, b) ( (a) & ~(1 << (b)) )
/* bit-row */
@@ -159,8 +158,9 @@ typedef struct {
struct uiBut {
struct uiBut *next, *prev;
int flag, drawflag;
eButType type;
short pointype, bit, bitnr, retval, strwidth, ofs, pos, selsta, selend, alignnr;
eButType type;
eButPointerType pointype;
short bit, bitnr, retval, strwidth, ofs, pos, selsta, selend, alignnr;
char *str;
char strdata[UI_MAX_NAME_STR];
@@ -421,7 +421,7 @@ struct uiPopupBlockHandle {
float retvec[4];
};
uiBlock *ui_block_func_COL(struct bContext *C, uiPopupBlockHandle *handle, void *arg_but);
uiBlock *ui_block_func_COLOR(struct bContext *C, uiPopupBlockHandle *handle, void *arg_but);
void ui_block_func_ICONROW(struct bContext *C, uiLayout *layout, void *arg_but);
void ui_block_func_ICONTEXTROW(struct bContext *C, uiLayout *layout, void *arg_but);

View File

@@ -2237,7 +2237,7 @@ static int ui_picker_small_wheel_cb(const bContext *UNUSED(C), uiBlock *block, w
return 0;
}
uiBlock *ui_block_func_COL(bContext *C, uiPopupBlockHandle *handle, void *arg_but)
uiBlock *ui_block_func_COLOR(bContext *C, uiPopupBlockHandle *handle, void *arg_but)
{
uiBut *but = arg_but;
uiBlock *block;

View File

@@ -78,7 +78,7 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind
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);
but = uiDefButR_prop(block, COLOR, 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)
but = uiDefButR_prop(block, NUMSLI, 0, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);

View File

@@ -3154,7 +3154,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
wt = widget_type(UI_WTYPE_MENU_ITEM);
break;
case COL:
case COLOR:
wt = widget_type(UI_WTYPE_SWATCH);
break;

View File

@@ -171,7 +171,7 @@ static void node_socket_button_color(const bContext *C, uiBlock *block,
int labelw = width - 40;
RNA_pointer_create(&ntree->id, &RNA_NodeSocket, sock, &ptr);
bt = uiDefButR(block, COL, B_NODE_EXEC, "",
bt = uiDefButR(block, COLOR, B_NODE_EXEC, "",
x, y + 2, (labelw > 0 ? 40 : width), NODE_DY - 2,
&ptr, "default_value", 0, 0, 0, -1, -1, NULL);
if (node)