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:
authorCampbell Barton <ideasman42@gmail.com>2020-11-06 04:30:59 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-11-06 04:32:54 +0300
commitaa3a4973a30ff668a62447e18ac41f6c916b4a8b (patch)
tree1b24cc55995ba8b3d72aaabd9400a3e1e030d540 /source/blender/editors/interface
parent7cb20d841da16d0bffb63154403267500e9941f5 (diff)
Cleanup: use ELEM macro
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r--source/blender/editors/interface/interface.c4
-rw-r--r--source/blender/editors/interface/interface_draw.c6
-rw-r--r--source/blender/editors/interface/interface_handlers.c20
-rw-r--r--source/blender/editors/interface/interface_layout.c6
-rw-r--r--source/blender/editors/interface/interface_templates.c2
-rw-r--r--source/blender/editors/interface/interface_widgets.c2
-rw-r--r--source/blender/editors/interface/view2d_ops.c6
7 files changed, 23 insertions, 23 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 3ff65cccc21..a69540613fb 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -702,10 +702,10 @@ static bool ui_but_equals_old(const uiBut *but, const uiBut *oldbut)
if (but->funcN != oldbut->funcN) {
return false;
}
- if (oldbut->func_arg1 != oldbut && but->func_arg1 != oldbut->func_arg1) {
+ if (!ELEM(oldbut->func_arg1, oldbut, but->func_arg1)) {
return false;
}
- if (oldbut->func_arg2 != oldbut && but->func_arg2 != oldbut->func_arg2) {
+ if (!ELEM(oldbut->func_arg2, oldbut, but->func_arg2)) {
return false;
}
if (!but->funcN && ((but->poin != oldbut->poin && (uiBut *)oldbut->poin != oldbut) ||
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index dec1710ac69..d9571dc98bd 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -973,15 +973,15 @@ void ui_draw_but_HISTOGRAM(ARegion *UNUSED(region),
1.0, 1.0, 1.0, 0.75, rect.xmin, rect.ymin, w, h, hist->data_a, res, is_line, pos);
}
else {
- if (hist->mode == HISTO_MODE_RGB || hist->mode == HISTO_MODE_R) {
+ if (ELEM(hist->mode, HISTO_MODE_RGB, HISTO_MODE_R)) {
histogram_draw_one(
1.0, 0.0, 0.0, 0.75, rect.xmin, rect.ymin, w, h, hist->data_r, res, is_line, pos);
}
- if (hist->mode == HISTO_MODE_RGB || hist->mode == HISTO_MODE_G) {
+ if (ELEM(hist->mode, HISTO_MODE_RGB, HISTO_MODE_G)) {
histogram_draw_one(
0.0, 1.0, 0.0, 0.75, rect.xmin, rect.ymin, w, h, hist->data_g, res, is_line, pos);
}
- if (hist->mode == HISTO_MODE_RGB || hist->mode == HISTO_MODE_B) {
+ if (ELEM(hist->mode, HISTO_MODE_RGB, HISTO_MODE_B)) {
histogram_draw_one(
0.0, 0.0, 1.0, 0.75, rect.xmin, rect.ymin, w, h, hist->data_b, res, is_line, pos);
}
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index bbb66a7e0e4..fb5844d24f3 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -1024,7 +1024,7 @@ static void ui_apply_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data)
}
ui_but_value_set(but, (double)value_toggle);
- if (but->type == UI_BTYPE_ICON_TOGGLE || but->type == UI_BTYPE_ICON_TOGGLE_N) {
+ if (ELEM(but->type, UI_BTYPE_ICON_TOGGLE, UI_BTYPE_ICON_TOGGLE_N)) {
ui_but_update_edited(but);
}
@@ -3564,7 +3564,7 @@ static void ui_do_but_textedit(
/* for double click: we do a press again for when you first click on button
* (selects all text, no cursor pos) */
- if (event->val == KM_PRESS || event->val == KM_DBL_CLICK) {
+ if (ELEM(event->val, KM_PRESS, KM_DBL_CLICK)) {
float mx = event->x;
float my = event->y;
ui_window_to_block_fl(data->region, block, &mx, &my);
@@ -4740,7 +4740,7 @@ static float ui_numedit_apply_snap(int temp,
float softmax,
const enum eSnapType snap)
{
- if (temp == softmin || temp == softmax) {
+ if (ELEM(temp, softmin, softmax)) {
return temp;
}
@@ -5052,7 +5052,7 @@ static int ui_do_but_NUM(
}
}
else if (data->state == BUTTON_STATE_NUM_EDITING) {
- if (event->type == EVT_ESCKEY || event->type == RIGHTMOUSE) {
+ if (ELEM(event->type, EVT_ESCKEY, RIGHTMOUSE)) {
if (event->val == KM_PRESS) {
data->cancel = true;
data->escapecancel = true;
@@ -5244,13 +5244,13 @@ static bool ui_numedit_but_SLI(uiBut *but,
temp = round_fl_to_int(tempf);
if (snap) {
- if (tempf == softmin || tempf == softmax) {
+ if (ELEM(tempf, softmin, softmax)) {
/* pass */
}
else if (ui_but_is_float(but)) {
if (shift) {
- if (tempf == softmin || tempf == softmax) {
+ if (ELEM(tempf, softmin, softmax)) {
}
else if (softrange < 2.10f) {
tempf = roundf(tempf * 100.0f) * 0.01f;
@@ -5374,7 +5374,7 @@ static int ui_do_but_SLI(
#endif
}
else if (data->state == BUTTON_STATE_NUM_EDITING) {
- if (event->type == EVT_ESCKEY || event->type == RIGHTMOUSE) {
+ if (ELEM(event->type, EVT_ESCKEY, RIGHTMOUSE)) {
if (event->val == KM_PRESS) {
data->cancel = true;
data->escapecancel = true;
@@ -5997,7 +5997,7 @@ static int ui_do_but_UNITVEC(
}
}
}
- else if (event->type == EVT_ESCKEY || event->type == RIGHTMOUSE) {
+ else if (ELEM(event->type, EVT_ESCKEY, RIGHTMOUSE)) {
if (event->val == KM_PRESS) {
data->cancel = true;
data->escapecancel = true;
@@ -6328,7 +6328,7 @@ static int ui_do_but_HSVCUBE(
}
}
else if (data->state == BUTTON_STATE_NUM_EDITING) {
- if (event->type == EVT_ESCKEY || event->type == RIGHTMOUSE) {
+ if (ELEM(event->type, EVT_ESCKEY, RIGHTMOUSE)) {
if (event->val == KM_PRESS) {
data->cancel = true;
data->escapecancel = true;
@@ -6602,7 +6602,7 @@ static int ui_do_but_HSVCIRCLE(
}
}
else if (data->state == BUTTON_STATE_NUM_EDITING) {
- if (event->type == EVT_ESCKEY || event->type == RIGHTMOUSE) {
+ if (ELEM(event->type, EVT_ESCKEY, RIGHTMOUSE)) {
if (event->val == KM_PRESS) {
data->cancel = true;
data->escapecancel = true;
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index efb29fe75c3..30a73afa94e 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -1002,7 +1002,7 @@ static uiBut *ui_item_with_label(uiLayout *layout,
const PropertySubType subtype = RNA_property_subtype(prop);
uiBut *but;
- if (subtype == PROP_FILEPATH || subtype == PROP_DIRPATH) {
+ if (ELEM(subtype, PROP_FILEPATH, PROP_DIRPATH)) {
UI_block_layout_set_current(block, uiLayoutRow(sub, true));
but = uiDefAutoButR(block, ptr, prop, index, "", icon, x, y, prop_but_width - UI_UNIT_X, h);
@@ -1886,7 +1886,7 @@ static void ui_item_rna_size(uiLayout *layout,
else if (type == PROP_ENUM && !icon_only) {
w += UI_UNIT_X / 4;
}
- else if (type == PROP_FLOAT || type == PROP_INT) {
+ else if (ELEM(type, PROP_FLOAT, PROP_INT)) {
w += UI_UNIT_X * 3;
}
}
@@ -5480,7 +5480,7 @@ uiLayout *UI_block_layout(uiBlock *block,
layout->context = NULL;
layout->emboss = UI_EMBOSS_UNDEFINED;
- if (type == UI_LAYOUT_MENU || type == UI_LAYOUT_PIEMENU) {
+ if (ELEM(type, UI_LAYOUT_MENU, UI_LAYOUT_PIEMENU)) {
layout->space = 0;
}
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 678dbe868e7..83274db9db9 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -4969,7 +4969,7 @@ static void CurveProfile_buttons_layout(uiLayout *layout, PointerRNA *ptr, RNAUp
selection_y = &point->h2_loc[1];
}
}
- if (i == 0 || i == profile->path_len - 1) {
+ if (ELEM(i, 0, profile->path_len - 1)) {
point_last_or_first = true;
}
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index f2afe27f40f..e2c835ac461 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -917,7 +917,7 @@ static void shape_preset_init_trias_ex(uiWidgetTrias *tria,
float centx, centy, sizex, sizey, minsize;
int a, i1 = 0, i2 = 1;
- if (where == 'r' || where == 'l') {
+ if (ELEM(where, 'r', 'l')) {
minsize = BLI_rcti_size_y(rect);
}
else {
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c
index 258516a1c61..a5999962e09 100644
--- a/source/blender/editors/interface/view2d_ops.c
+++ b/source/blender/editors/interface/view2d_ops.c
@@ -293,7 +293,7 @@ static int view_pan_modal(bContext *C, wmOperator *op, const wmEvent *event)
}
#endif
default:
- if (event->type == vpd->invoke_event || event->type == EVT_ESCKEY) {
+ if (ELEM(event->type, vpd->invoke_event, EVT_ESCKEY)) {
if (event->val == KM_RELEASE) {
/* calculate overall delta mouse-movement for redo */
RNA_int_set(op->ptr, "deltax", (vpd->startx - vpd->lastx));
@@ -1241,7 +1241,7 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, const wmEvent *even
vzd->zoom_to_mouse_pos = true;
}
- if (event->type == MOUSEZOOM || event->type == MOUSEPAN) {
+ if (ELEM(event->type, MOUSEZOOM, MOUSEPAN)) {
float dx, dy, fac;
vzd->lastx = event->prevx;
@@ -1413,7 +1413,7 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, const wmEvent *event
/* apply zooming */
view_zoomdrag_apply(C, op);
}
- else if (event->type == vzd->invoke_event || event->type == EVT_ESCKEY) {
+ else if (ELEM(event->type, vzd->invoke_event, EVT_ESCKEY)) {
if (event->val == KM_RELEASE) {
/* for redo, store the overall deltas - need to respect zoom-locks here... */