From b9114cb609698bdd40175b79c017b8ec8d10b518 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 4 Jan 2014 17:16:19 +1100 Subject: UI: Use bool rather then int/short's where possible --- source/blender/blenkernel/BKE_colortools.h | 2 +- source/blender/blenkernel/BKE_context.h | 2 +- source/blender/blenkernel/BKE_text.h | 24 +-- source/blender/blenkernel/BKE_unit.h | 2 +- source/blender/blenkernel/intern/colortools.c | 2 +- source/blender/blenkernel/intern/text.c | 24 +-- source/blender/blenkernel/intern/unit.c | 6 +- source/blender/editors/interface/interface.c | 57 +++--- source/blender/editors/interface/interface_draw.c | 4 +- .../editors/interface/interface_eyedropper.c | 12 +- .../blender/editors/interface/interface_handlers.c | 66 +++---- source/blender/editors/interface/interface_icons.c | 13 +- .../blender/editors/interface/interface_intern.h | 8 +- .../blender/editors/interface/interface_layout.c | 39 ++-- source/blender/editors/interface/interface_ops.c | 27 +-- source/blender/editors/interface/interface_panel.c | 17 +- .../blender/editors/interface/interface_regions.c | 4 +- .../editors/interface/interface_templates.c | 200 ++++++++++----------- source/blender/editors/interface/interface_utils.c | 10 +- .../blender/editors/interface/interface_widgets.c | 18 +- source/blender/editors/interface/resources.c | 12 +- source/blender/editors/interface/view2d.c | 14 +- source/blender/editors/interface/view2d_ops.c | 28 +-- source/blender/editors/transform/transform.c | 4 +- source/blender/editors/util/numinput.c | 5 +- source/blender/python/BPY_extern.h | 2 +- source/blender/python/intern/bpy_interface.c | 2 +- 27 files changed, 305 insertions(+), 299 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/BKE_colortools.h b/source/blender/blenkernel/BKE_colortools.h index e0b7e68bafc..a69a9601c9a 100644 --- a/source/blender/blenkernel/BKE_colortools.h +++ b/source/blender/blenkernel/BKE_colortools.h @@ -59,7 +59,7 @@ int curvemap_remove_point(struct CurveMap *cuma, struct Curv struct CurveMapPoint *curvemap_insert(struct CurveMap *cuma, float x, float y); void curvemap_sethandle(struct CurveMap *cuma, int type); -void curvemapping_changed(struct CurveMapping *cumap, int rem_doubles); +void curvemapping_changed(struct CurveMapping *cumap, const bool rem_doubles); void curvemapping_changed_all(struct CurveMapping *cumap); /* call before _all_ evaluation functions */ diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h index c6a6b0672d1..2834a37ca7a 100644 --- a/source/blender/blenkernel/BKE_context.h +++ b/source/blender/blenkernel/BKE_context.h @@ -85,7 +85,7 @@ typedef struct bContextStore { struct bContextStore *next, *prev; ListBase entries; - int used; + bool used; } bContextStore; /* for the context's rna mode enum diff --git a/source/blender/blenkernel/BKE_text.h b/source/blender/blenkernel/BKE_text.h index bba209334d4..67c1b6834dd 100644 --- a/source/blender/blenkernel/BKE_text.h +++ b/source/blender/blenkernel/BKE_text.h @@ -66,18 +66,18 @@ int txt_utf8_offset_to_index(const char *str, int offset); int txt_utf8_index_to_offset(const char *str, int index); int txt_utf8_offset_to_column(const char *str, int offset); int txt_utf8_column_to_offset(const char *str, int column); -void txt_move_up (struct Text *text, short sel); -void txt_move_down (struct Text *text, short sel); -void txt_move_left (struct Text *text, short sel); -void txt_move_right (struct Text *text, short sel); -void txt_jump_left (struct Text *text, bool sel, bool use_init_step); -void txt_jump_right (struct Text *text, bool sel, bool use_init_step); -void txt_move_bof (struct Text *text, short sel); -void txt_move_eof (struct Text *text, short sel); -void txt_move_bol (struct Text *text, short sel); -void txt_move_eol (struct Text *text, short sel); -void txt_move_toline (struct Text *text, unsigned int line, short sel); -void txt_move_to (struct Text *text, unsigned int line, unsigned int ch, short sel); +void txt_move_up (struct Text *text, const bool sel); +void txt_move_down (struct Text *text, const bool sel); +void txt_move_left (struct Text *text, const bool sel); +void txt_move_right (struct Text *text, const bool sel); +void txt_jump_left (struct Text *text, const bool sel, const bool use_init_step); +void txt_jump_right (struct Text *text, const bool sel, const bool use_init_step); +void txt_move_bof (struct Text *text, const bool sel); +void txt_move_eof (struct Text *text, const bool sel); +void txt_move_bol (struct Text *text, const bool sel); +void txt_move_eol (struct Text *text, const bool sel); +void txt_move_toline (struct Text *text, unsigned int line, const bool sel); +void txt_move_to (struct Text *text, unsigned int line, unsigned int ch, const bool sel); void txt_pop_sel (struct Text *text); void txt_delete_char (struct Text *text); void txt_delete_word (struct Text *text); diff --git a/source/blender/blenkernel/BKE_unit.h b/source/blender/blenkernel/BKE_unit.h index 133f3d0dfbc..8bccf3511d8 100644 --- a/source/blender/blenkernel/BKE_unit.h +++ b/source/blender/blenkernel/BKE_unit.h @@ -34,7 +34,7 @@ extern "C" { /* in all cases the value is assumed to be scaled by the user preference */ /* humanly readable representation of a value in units (used for button drawing) */ -size_t bUnit_AsString(char *str, int len_max, double value, int prec, int system, int type, int split, int pad); +size_t bUnit_AsString(char *str, int len_max, double value, int prec, int system, int type, int split, bool pad); /* replace units with values, used before python button evaluation */ int bUnit_ReplaceString(char *str, int len_max, const char *str_prev, double scale_pref, int system, int type); diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index 578fa5d348d..c2ce779f03f 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -681,7 +681,7 @@ static int sort_curvepoints(const void *a1, const void *a2) /* ************************ more CurveMapping calls *************** */ /* note; only does current curvemap! */ -void curvemapping_changed(CurveMapping *cumap, int rem_doubles) +void curvemapping_changed(CurveMapping *cumap, const bool rem_doubles) { CurveMap *cuma = cumap->cm + cumap->cur; CurveMapPoint *cmp = cuma->curve; diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 96601985f67..b2c10ca78ae 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -847,7 +847,7 @@ int txt_utf8_column_to_offset(const char *str, int column) return offset; } -void txt_move_up(Text *text, short sel) +void txt_move_up(Text *text, const bool sel) { TextLine **linep; int *charp; @@ -870,7 +870,7 @@ void txt_move_up(Text *text, short sel) if (!sel) txt_pop_sel(text); } -void txt_move_down(Text *text, short sel) +void txt_move_down(Text *text, const bool sel) { TextLine **linep; int *charp; @@ -892,7 +892,7 @@ void txt_move_down(Text *text, short sel) if (!sel) txt_pop_sel(text); } -void txt_move_left(Text *text, short sel) +void txt_move_left(Text *text, const bool sel) { TextLine **linep; int *charp; @@ -937,7 +937,7 @@ void txt_move_left(Text *text, short sel) if (!sel) txt_pop_sel(text); } -void txt_move_right(Text *text, short sel) +void txt_move_right(Text *text, const bool sel) { TextLine **linep; int *charp, do_tab = FALSE, i; @@ -979,7 +979,7 @@ void txt_move_right(Text *text, short sel) if (!sel) txt_pop_sel(text); } -void txt_jump_left(Text *text, bool sel, bool use_init_step) +void txt_jump_left(Text *text, const bool sel, const bool use_init_step) { TextLine **linep; int *charp; @@ -996,7 +996,7 @@ void txt_jump_left(Text *text, bool sel, bool use_init_step) if (!sel) txt_pop_sel(text); } -void txt_jump_right(Text *text, bool sel, bool use_init_step) +void txt_jump_right(Text *text, const bool sel, const bool use_init_step) { TextLine **linep; int *charp; @@ -1013,7 +1013,7 @@ void txt_jump_right(Text *text, bool sel, bool use_init_step) if (!sel) txt_pop_sel(text); } -void txt_move_bol(Text *text, short sel) +void txt_move_bol(Text *text, const bool sel) { TextLine **linep; int *charp; @@ -1028,7 +1028,7 @@ void txt_move_bol(Text *text, short sel) if (!sel) txt_pop_sel(text); } -void txt_move_eol(Text *text, short sel) +void txt_move_eol(Text *text, const bool sel) { TextLine **linep; int *charp; @@ -1043,7 +1043,7 @@ void txt_move_eol(Text *text, short sel) if (!sel) txt_pop_sel(text); } -void txt_move_bof(Text *text, short sel) +void txt_move_bof(Text *text, const bool sel) { TextLine **linep; int *charp; @@ -1059,7 +1059,7 @@ void txt_move_bof(Text *text, short sel) if (!sel) txt_pop_sel(text); } -void txt_move_eof(Text *text, short sel) +void txt_move_eof(Text *text, const bool sel) { TextLine **linep; int *charp; @@ -1075,13 +1075,13 @@ void txt_move_eof(Text *text, short sel) if (!sel) txt_pop_sel(text); } -void txt_move_toline(Text *text, unsigned int line, short sel) +void txt_move_toline(Text *text, unsigned int line, const bool sel) { txt_move_to(text, line, 0, sel); } /* Moves to a certain byte in a line, not a certain utf8-character! */ -void txt_move_to(Text *text, unsigned int line, unsigned int ch, short sel) +void txt_move_to(Text *text, unsigned int line, unsigned int ch, const bool sel) { TextLine **linep; int *charp; diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c index 11a39752391..a26b579f5e5 100644 --- a/source/blender/blenkernel/intern/unit.c +++ b/source/blender/blenkernel/intern/unit.c @@ -29,12 +29,14 @@ #include #include #include -#include "BKE_unit.h" +#include "BLI_sys_types.h" #include "BLI_math.h" #include "BLI_string.h" #include "BLI_string_utf8.h" +#include "BKE_unit.h" /* own include */ + #ifdef WIN32 # include "BLI_winstuff.h" #endif @@ -421,7 +423,7 @@ static size_t unit_as_string(char *str, int len_max, double value, int prec, bUn /* Used for drawing number buttons, try keep fast. * Return the length of the generated string. */ -size_t bUnit_AsString(char *str, int len_max, double value, int prec, int system, int type, int split, int pad) +size_t bUnit_AsString(char *str, int len_max, double value, int prec, int system, int type, int split, bool pad) { bUnitCollection *usys = unit_get_system(system, type); diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index cf71e18472c..af303e807b6 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -522,30 +522,31 @@ static void ui_draw_links(uiBlock *block) /* Draw the inactive lines (lines with neither button being hovered over). * As we go, remember if we see any active or selected lines. */ - int foundselectline = FALSE; - int foundactiveline = FALSE; + bool found_selectline = false; + bool found_activeline = false; + for (but = block->buttons.first; but; but = but->next) { if (but->type == LINK && but->link) { for (line = but->link->lines.first; line; line = line->next) { if (!(line->from->flag & UI_ACTIVE) && !(line->to->flag & UI_ACTIVE)) ui_draw_linkline(line, 0); else - foundactiveline = TRUE; + found_activeline = true; if ((line->from->flag & UI_SELECT) || (line->to->flag & UI_SELECT)) - foundselectline = TRUE; + found_selectline = true; } } } /* Draw any active lines (lines with either button being hovered over). * Do this last so they appear on top of inactive lines. */ - if (foundactiveline) { + if (found_activeline) { for (but = block->buttons.first; but; but = but->next) { if (but->type == LINK && but->link) { for (line = but->link->lines.first; line; line = line->next) { if ((line->from->flag & UI_ACTIVE) || (line->to->flag & UI_ACTIVE)) - ui_draw_linkline(line, !foundselectline); + ui_draw_linkline(line, !found_selectline); } } } @@ -741,8 +742,8 @@ void uiButExecute(const bContext *C, uiBut *but) } /* use to check if we need to disable undo, but don't make any changes - * returns FALSE if undo needs to be disabled. */ -static int ui_is_but_rna_undo(const uiBut *but) + * returns false if undo needs to be disabled. */ +static bool ui_is_but_rna_undo(const uiBut *but) { if (but->rnapoin.id.data) { /* avoid undo push for buttons who's ID are screen or wm level @@ -750,18 +751,18 @@ static int ui_is_but_rna_undo(const uiBut *but) * 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) { - return FALSE; + if (ID_CHECK_UNDO(id) == false) { + return false; } else { - return TRUE; + return true; } } else if (but->rnapoin.type && !RNA_struct_undo_check(but->rnapoin.type)) { - return FALSE; + return false; } - return TRUE; + return true; } /* assigns automatic keybindings to menu items for fast access @@ -1027,10 +1028,10 @@ static void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block) for (but = block->buttons.first; but; but = but->next) { if (ui_but_event_operator_string(C, but, buf, sizeof(buf))) { - ui_but_add_shortcut(but, buf, FALSE); + ui_but_add_shortcut(but, buf, false); } else if (ui_but_event_property_operator_string(C, but, buf, sizeof(buf))) { - ui_but_add_shortcut(but, buf, FALSE); + ui_but_add_shortcut(but, buf, false); } } } @@ -1057,7 +1058,7 @@ void uiEndBlock(const bContext *C, uiBlock *block) if (ot == NULL || WM_operator_poll_context((bContext *)C, ot, but->opcontext) == 0) { but->flag |= UI_BUT_DISABLED; - but->lock = TRUE; + but->lock = true; } if (but->context) @@ -1789,7 +1790,7 @@ void ui_convert_to_unit_alt_name(uiBut *but, char *str, size_t maxlen) /** * \param float_precision Override the button precision. */ -static void ui_get_but_string_unit(uiBut *but, char *str, int len_max, double value, int pad, int float_precision) +static void ui_get_but_string_unit(uiBut *but, char *str, int len_max, double value, bool pad, int float_precision) { UnitSettings *unit = but->block->unit; int do_split = unit->flag & USER_UNIT_OPT_SPLIT; @@ -1893,7 +1894,7 @@ void ui_get_but_string_ex(uiBut *but, char *str, const size_t maxlen, const int if (ui_is_but_float(but)) { if (ui_is_but_unit(but)) { - ui_get_but_string_unit(but, str, maxlen, value, 0, float_precision); + ui_get_but_string_unit(but, str, maxlen, value, false, float_precision); } else { const int prec = (float_precision == -1) ? ui_but_float_precision(but, value) : float_precision; @@ -1923,7 +1924,7 @@ static bool ui_set_but_string_eval_num_unit(bContext *C, uiBut *but, const char bUnit_ReplaceString(str_unit_convert, sizeof(str_unit_convert), but->drawstr, ui_get_but_scale_unit(but, 1.0), but->block->unit->system, RNA_SUBTYPE_UNIT_VALUE(unit_type)); - return (BPY_button_exec(C, str_unit_convert, value, TRUE) != -1); + return (BPY_button_exec(C, str_unit_convert, value, true) != -1); } #endif /* WITH_PYTHON */ @@ -1959,7 +1960,7 @@ bool ui_set_but_string_eval_num(bContext *C, uiBut *but, const char *str, double #else /* WITH_PYTHON */ *value = atof(str); - ok = TRUE; + ok = true; (void)C; (void)but; @@ -2335,7 +2336,7 @@ uiBlock *uiBeginBlock(const bContext *C, ARegion *region, const char *name, shor block->evil_C = (void *)C; /* XXX */ if (scn) { - block->color_profile = TRUE; + block->color_profile = true; /* store display device name, don't lookup for transformations yet * block could be used for non-color displays where looking up for transformation @@ -2369,7 +2370,7 @@ uiBlock *uiBeginBlock(const bContext *C, ARegion *region, const char *name, shor wm_subwindow_getsize(window, window->screen->mainwin, &getsizex, &getsizey); block->aspect = 2.0f / fabsf(getsizex * block->winmat[0][0]); - block->auto_open = TRUE; + block->auto_open = true; block->flag |= UI_BLOCK_LOOP; /* tag as menu */ } @@ -2462,7 +2463,7 @@ void ui_check_but(uiBut *but) /* support length type buttons */ 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, -1); + ui_get_but_string_unit(but, new_str, sizeof(new_str), value, true, -1); slen += BLI_strncpy_rlen(but->drawstr + slen, new_str, sizeof(but->drawstr) - slen); } else { @@ -2811,7 +2812,7 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str, /* we could do some more error checks here */ if ((type & BUTTYPE) == LABEL) { - BLI_assert((poin != NULL || min != 0.0f || max != 0.0f || (a1 == 0.0f && a2 != 0.0f) || (a1 != 0.0f && a1 != 1.0f)) == FALSE); + BLI_assert((poin != NULL || min != 0.0f || max != 0.0f || (a1 == 0.0f && a2 != 0.0f) || (a1 != 0.0f && a1 != 1.0f)) == false); } if (type & UI_BUT_POIN_TYPES) { /* a pointer is required */ @@ -2896,7 +2897,7 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str, but->drawflag |= (block->flag & UI_BUT_ALIGN); - if (but->lock == TRUE) { + if (but->lock == true) { if (but->lockstr) { but->flag |= UI_BUT_DISABLED; } @@ -3076,7 +3077,7 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s ui_def_but_rna__disable(but); } - if (but->flag & UI_BUT_UNDO && (ui_is_but_rna_undo(but) == FALSE)) { + if (but->flag & UI_BUT_UNDO && (ui_is_but_rna_undo(but) == false)) { but->flag &= ~UI_BUT_UNDO; } @@ -3131,7 +3132,7 @@ static uiBut *ui_def_but_operator_ptr(uiBlock *block, int type, wmOperatorType * if (!ot) { but->flag |= UI_BUT_DISABLED; - but->lock = TRUE; + but->lock = true; but->lockstr = ""; } @@ -3974,7 +3975,7 @@ void uiButSetFocusOnEnter(wmWindow *win, uiBut *but) event.type = EVT_BUT_OPEN; event.val = KM_PRESS; event.customdata = but; - event.customdatafree = FALSE; + event.customdatafree = false; wm_event_add(win, &event); } diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 3301f1f1e5a..4c838136c00 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -1308,7 +1308,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti glBegin(GL_LINE_STRIP); if (cuma->table == NULL) - curvemapping_changed(cumap, FALSE); + curvemapping_changed(cumap, false); cmp = cuma->table; /* first point */ @@ -1405,7 +1405,7 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc tmpibuf = BKE_tracking_sample_pattern(scopes->frame_width, scopes->frame_height, scopes->track_search, scopes->track, - &scopes->undist_marker, TRUE, scopes->use_track_mask, + &scopes->undist_marker, true, scopes->use_track_mask, width, height, scopes->track_pos); if (tmpibuf) { diff --git a/source/blender/editors/interface/interface_eyedropper.c b/source/blender/editors/interface/interface_eyedropper.c index a01c7eecda1..023a0cd6fcb 100644 --- a/source/blender/editors/interface/interface_eyedropper.c +++ b/source/blender/editors/interface/interface_eyedropper.c @@ -79,12 +79,12 @@ typedef struct Eyedropper { PropertyRNA *prop; int index; - int accum_start; /* has mouse been presed */ + bool accum_start; /* has mouse been presed */ float accum_col[3]; int accum_tot; } Eyedropper; -static int eyedropper_init(bContext *C, wmOperator *op) +static bool eyedropper_init(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); Eyedropper *eye; @@ -95,11 +95,11 @@ static int eyedropper_init(bContext *C, wmOperator *op) if ((eye->ptr.data == NULL) || (eye->prop == NULL) || - (RNA_property_editable(&eye->ptr, eye->prop) == FALSE) || + (RNA_property_editable(&eye->ptr, eye->prop) == false) || (RNA_property_array_length(&eye->ptr, eye->prop) < 3) || (RNA_property_type(eye->prop) != PROP_FLOAT)) { - return FALSE; + return false; } if (RNA_property_subtype(eye->prop) == PROP_COLOR) { @@ -109,7 +109,7 @@ static int eyedropper_init(bContext *C, wmOperator *op) eye->display = IMB_colormanagement_display_get_named(display_device); } - return TRUE; + return true; } static void eyedropper_exit(bContext *C, wmOperator *op) @@ -257,7 +257,7 @@ static int eyedropper_modal(bContext *C, wmOperator *op, const wmEvent *event) } else if (event->val == KM_PRESS) { /* enable accum and make first sample */ - eye->accum_start = TRUE; + eye->accum_start = true; eyedropper_color_sample_accum(C, eye, event->x, event->y); } break; diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 9ea1d147328..634d67e8398 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -1396,7 +1396,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data, { char buf[UI_MAX_DRAW_STR + 1] = {0}; - if (mode == 'v' && but->lock == TRUE) { + if (mode == 'v' && but->lock == true) { return; } @@ -1628,7 +1628,7 @@ static int ui_text_position_to_hidden(uiBut *but, int pos) return BLI_strnlen_utf8(but->drawstr, pos); } -void ui_button_text_password_hide(char password_str[UI_MAX_DRAW_STR], uiBut *but, int restore) +void ui_button_text_password_hide(char password_str[UI_MAX_DRAW_STR], uiBut *but, const bool restore) { if (!(but->rnaprop && RNA_property_subtype(but->rnaprop) == PROP_PASSWORD)) return; @@ -1699,7 +1699,7 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, con if (fstyle->kerning == 1) /* for BLF_width */ BLF_enable(fstyle->uifont_id, BLF_KERNING_DEFAULT); - ui_button_text_password_hide(password_str, but, FALSE); + ui_button_text_password_hide(password_str, but, false); origstr = MEM_mallocN(sizeof(char) * data->maxlen, "ui_textedit origstr"); @@ -1779,7 +1779,7 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, con if (fstyle->kerning == 1) BLF_disable(fstyle->uifont_id, BLF_KERNING_DEFAULT); - ui_button_text_password_hide(password_str, but, TRUE); + ui_button_text_password_hide(password_str, but, true); MEM_freeN(origstr); @@ -3461,8 +3461,8 @@ 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 || event->type == RIGHTMOUSE) { if (event->val == KM_PRESS) { - data->cancel = TRUE; - data->escapecancel = TRUE; + data->cancel = true; + data->escapecancel = true; button_activate_state(C, but, BUTTON_STATE_EXIT); } } @@ -4623,7 +4623,7 @@ static bool ui_numedit_but_CURVE(uiBlock *block, uiBut *but, uiHandleButtonData } } - curvemapping_changed(cumap, FALSE); + curvemapping_changed(cumap, false); if (moved_point) { data->draglastx = evtx; @@ -4704,7 +4704,7 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt fy = ((float)my - but->rect.ymin) / zoomy + offsy; curvemap_insert(cuma, fx, fy); - curvemapping_changed(cumap, FALSE); + curvemapping_changed(cumap, false); changed = true; } @@ -4738,7 +4738,7 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt { curvemap_insert(cuma, fx, fy); - curvemapping_changed(cumap, FALSE); + curvemapping_changed(cumap, false); changed = true; @@ -4758,7 +4758,7 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt if (sel != -1) { /* ok, we move a point */ /* deselect all if this one is deselect. except if we hold shift */ - if (event->shift == FALSE) { + if (!event->shift) { for (a = 0; a < cuma->totpoint; a++) { cmp[a].flag &= ~CUMA_SELECT; } @@ -4800,7 +4800,7 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt if (data->dragchange == false) { /* deselect all, select one */ - if (event->shift == FALSE) { + if (!event->shift) { for (a = 0; a < cuma->totpoint; a++) cmp[a].flag &= ~CUMA_SELECT; cmp[data->dragsel].flag |= CUMA_SELECT; @@ -5963,7 +5963,7 @@ static bool ui_mouse_inside_region(ARegion *ar, int x, int y) /* check if the mouse is in the region */ if (!BLI_rcti_isect_pt(&ar->winrct, x, y)) { for (block = ar->uiblocks.first; block; block = block->next) - block->auto_open = FALSE; + block->auto_open = false; return false; } @@ -6313,7 +6313,7 @@ static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonA * 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()) - but->block->auto_open = FALSE; + but->block->auto_open = false; if (type == BUTTON_ACTIVATE_OVER) { data->used_mouse = true; @@ -6433,7 +6433,7 @@ void ui_button_active_free(const bContext *C, uiBut *but) * case cleanly anyway in case it happens */ if (but->active) { data = but->active; - data->cancel = TRUE; + data->cancel = true; button_activate_exit((bContext *)C, but, data, false, true); } } @@ -6655,7 +6655,7 @@ void ui_button_activate_do(bContext *C, ARegion *ar, uiBut *but) event.type = EVT_BUT_OPEN; event.val = KM_PRESS; event.customdata = but; - event.customdatafree = FALSE; + event.customdatafree = false; ui_do_button(C, but->block, but, &event); } @@ -6683,7 +6683,7 @@ static void ui_handle_button_activate(bContext *C, ARegion *ar, uiBut *but, uiBu oldbut = ui_but_find_activated(ar); if (oldbut) { data = oldbut->active; - data->cancel = TRUE; + data->cancel = true; button_activate_exit(C, oldbut, data, false, false); } @@ -6709,18 +6709,18 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but) switch (event->type) { case WINDEACTIVATE: case EVT_BUT_CANCEL: - data->cancel = TRUE; + data->cancel = true; button_activate_state(C, but, BUTTON_STATE_EXIT); retval = WM_UI_HANDLER_CONTINUE; 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)) { - data->cancel = TRUE; + data->cancel = true; button_activate_state(C, but, BUTTON_STATE_EXIT); } else if (ui_but_find_mouse_over(ar, event) != but) { - data->cancel = TRUE; + data->cancel = true; button_activate_state(C, but, BUTTON_STATE_EXIT); } else if (event->x != event->prevx || event->y != event->prevy) { @@ -6768,7 +6768,7 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but) else if (data->state == BUTTON_STATE_WAIT_RELEASE) { switch (event->type) { case WINDEACTIVATE: - data->cancel = TRUE; + data->cancel = true; button_activate_state(C, but, BUTTON_STATE_EXIT); break; @@ -6785,14 +6785,14 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but) if (ui_mouse_inside_button(ar, but, event->x, event->y)) { if (!(but->flag & UI_SELECT)) { but->flag |= (UI_SELECT | UI_ACTIVE); - data->cancel = FALSE; + data->cancel = false; ED_region_tag_redraw(data->region); } } else { if (but->flag & UI_SELECT) { but->flag &= ~(UI_SELECT | UI_ACTIVE); - data->cancel = TRUE; + data->cancel = true; ED_region_tag_redraw(data->region); } } @@ -6836,7 +6836,7 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but) if (bt && bt->active != data) { if (but->type != COLOR) { /* exception */ - data->cancel = TRUE; + data->cancel = true; } button_activate_state(C, but, BUTTON_STATE_EXIT); } @@ -7082,7 +7082,7 @@ static void ui_handle_button_return_submenu(bContext *C, const wmEvent *event, u /* 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) - data->cancel = TRUE; + data->cancel = true; button_activate_exit(C, but, data, true, false); } @@ -7097,7 +7097,7 @@ static void ui_handle_button_return_submenu(bContext *C, const wmEvent *event, u button_activate_state(C, but, BUTTON_STATE_HIGHLIGHT); } else { - data->cancel = TRUE; + data->cancel = true; button_activate_exit(C, but, data, true, false); } } @@ -7577,7 +7577,7 @@ static int ui_handle_menu_event(bContext *C, const wmEvent *event, uiPopupBlockH count = 0; for (but = block->buttons.first; but; but = but->next) { - int doit = FALSE; + bool doit = false; if (!ELEM(but->type, LABEL, SEPR)) count++; @@ -7586,11 +7586,11 @@ static int ui_handle_menu_event(bContext *C, const wmEvent *event, uiPopupBlockH if (but->rnapoin.data && but->rnaprop) { if (ELEM(RNA_property_subtype(but->rnaprop), PROP_LAYER, PROP_LAYER_MEMBER)) { if (but->rnaindex == act - 1) - doit = TRUE; + doit = true; } } else if (count == act) { - doit = TRUE; + doit = true; } if (doit) { @@ -7641,9 +7641,9 @@ static int ui_handle_menu_event(bContext *C, const wmEvent *event, uiPopupBlockH case ZKEY: { if ((event->val == KM_PRESS || event->val == KM_DBL_CLICK) && - (event->shift == FALSE) && - (event->ctrl == FALSE) && - (event->oskey == FALSE)) + (event->shift == 0) && + (event->ctrl == 0) && + (event->oskey == 0)) { if (ui_menu_pass_event_to_parent_if_nonactive(menu, but, level, retval)) break; @@ -8077,7 +8077,7 @@ static void ui_handler_remove_popup(bContext *C, void *userdata) void UI_add_region_handlers(ListBase *handlers) { - WM_event_remove_ui_handler(handlers, ui_handler_region, ui_handler_remove_region, NULL, FALSE); + WM_event_remove_ui_handler(handlers, ui_handler_region, ui_handler_remove_region, NULL, false); WM_event_add_ui_handler(NULL, handlers, ui_handler_region, ui_handler_remove_region, NULL); } @@ -8088,7 +8088,7 @@ void UI_add_popup_handlers(bContext *C, ListBase *handlers, uiPopupBlockHandle * void UI_remove_popup_handlers(ListBase *handlers, uiPopupBlockHandle *popup) { - WM_event_remove_ui_handler(handlers, ui_handler_popup, ui_handler_remove_popup, popup, FALSE); + WM_event_remove_ui_handler(handlers, ui_handler_popup, ui_handler_remove_popup, popup, false); } void UI_remove_popup_handlers_all(bContext *C, ListBase *handlers) diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 8009cafadea..cc6d0348ab6 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -1086,7 +1086,7 @@ static int get_draw_size(enum eIconSizes size) static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, const float rgb[3], - enum eIconSizes size, int draw_size, int UNUSED(nocreate), short is_preview) + enum eIconSizes size, int draw_size, const bool UNUSED(nocreate), const bool is_preview) { bTheme *btheme = UI_GetTheme(); Icon *icon = NULL; @@ -1313,10 +1313,11 @@ int UI_rnaptr_icon_get(bContext *C, PointerRNA *ptr, int rnaicon, const bool big return rnaicon; } -static void icon_draw_at_size(float x, float y, int icon_id, float aspect, float alpha, enum eIconSizes size, int nocreate) +static void icon_draw_at_size(float x, float y, int icon_id, float aspect, float alpha, + enum eIconSizes size, const bool nocreate) { int draw_size = get_draw_size(size); - icon_draw_size(x, y, icon_id, aspect, alpha, NULL, size, draw_size, nocreate, FALSE); + icon_draw_size(x, y, icon_id, aspect, alpha, NULL, size, draw_size, nocreate, false); } void UI_icon_draw_aspect(float x, float y, int icon_id, float aspect, float alpha) @@ -1327,7 +1328,7 @@ void UI_icon_draw_aspect(float x, float y, int icon_id, float aspect, float alph void UI_icon_draw_aspect_color(float x, float y, int icon_id, float aspect, const float rgb[3]) { int draw_size = get_draw_size(ICON_SIZE_ICON); - icon_draw_size(x, y, icon_id, aspect, 1.0f, rgb, ICON_SIZE_ICON, draw_size, FALSE, FALSE); + icon_draw_size(x, y, icon_id, aspect, 1.0f, rgb, ICON_SIZE_ICON, draw_size, false, false); } /* draws icon with dpi scale factor */ @@ -1338,7 +1339,7 @@ void UI_icon_draw(float x, float y, int icon_id) void UI_icon_draw_size(float x, float y, int size, int icon_id, float alpha) { - icon_draw_size(x, y, icon_id, 1.0f, alpha, NULL, ICON_SIZE_ICON, size, TRUE, FALSE); + icon_draw_size(x, y, icon_id, 1.0f, alpha, NULL, ICON_SIZE_ICON, size, true, false); } void UI_icon_draw_preview(float x, float y, int icon_id) @@ -1353,6 +1354,6 @@ void UI_icon_draw_preview_aspect(float x, float y, int icon_id, float aspect) void UI_icon_draw_preview_aspect_size(float x, float y, int icon_id, float aspect, int size) { - icon_draw_size(x, y, icon_id, aspect, 1.0f, NULL, ICON_SIZE_PREVIEW, size, FALSE, TRUE); + icon_draw_size(x, y, icon_id, aspect, 1.0f, NULL, ICON_SIZE_PREVIEW, size, false, true); } diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 5500df624cf..b871325fc9b 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -223,7 +223,7 @@ struct uiBut { const char *tip, *lockstr; BIFIconID icon; - char lock; + bool lock; char dt; /* drawtype: UI_EMBOSS, UI_EMBOSSN ... etc, copied from the block */ char changed; /* could be made into a single flag */ unsigned char unit_type; /* so buttons can support unit systems which are not RNA */ @@ -319,7 +319,7 @@ struct uiBlock { char direction; char dt; /* drawtype: UI_EMBOSS, UI_EMBOSSN ... etc, copied to buttons */ - char auto_open; + bool auto_open; char _pad[7]; double auto_open_last; @@ -347,7 +347,7 @@ struct uiBlock { struct UnitSettings *unit; /* unit system, used a lot for numeric buttons so include here rather then fetching through the scene every time. */ float _hsv[3]; /* XXX, only access via ui_block_hsv_get() */ - char color_profile; /* color profile for correcting linear colors for display */ + bool color_profile; /* color profile for correcting linear colors for display */ const char *display_device; /* display device name used to display this block, * used by color widgets to transform colors from/to scene linear @@ -522,7 +522,7 @@ extern void ui_button_execute_do(struct bContext *C, struct ARegion *ar, uiBut * extern void ui_button_active_free(const struct bContext *C, uiBut *but); extern bool ui_button_is_active(struct ARegion *ar); extern int ui_button_open_menu_direction(uiBut *but); -extern void ui_button_text_password_hide(char password_str[UI_MAX_DRAW_STR], uiBut *but, int restore); +extern void ui_button_text_password_hide(char password_str[UI_MAX_DRAW_STR], uiBut *but, const bool restore); void ui_button_clipboard_free(void); void ui_panel_menu(struct bContext *C, ARegion *ar, Panel *pa); diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 85068998d9c..9944f72da8f 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -330,7 +330,7 @@ static void ui_layer_but_cb(bContext *C, void *arg_but, void *arg_index) int len = RNA_property_array_length(ptr, prop); if (!shift) { - RNA_property_boolean_set_index(ptr, prop, index, TRUE); + RNA_property_boolean_set_index(ptr, prop, index, true); for (i = 0; i < len; i++) if (i != index) @@ -375,7 +375,7 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in unsigned int layer_used = 0; unsigned int layer_active = 0; - uiBlockSetCurLayout(block, uiLayoutAbsolute(layout, FALSE)); + uiBlockSetCurLayout(block, uiLayoutAbsolute(layout, false)); unit = UI_UNIT_X * 0.75; butw = unit; @@ -446,7 +446,7 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in int totdim, dim_size[3]; /* 3 == RNA_MAX_ARRAY_DIMENSION */ int row, col; - uiBlockSetCurLayout(block, uiLayoutAbsolute(layout, TRUE)); + uiBlockSetCurLayout(block, uiLayoutAbsolute(layout, true)); totdim = RNA_property_array_dimension(ptr, prop, dim_size); if (totdim != 2) return; /* only 2D matrices supported in UI so far */ @@ -627,7 +627,7 @@ static uiBut *ui_item_with_label(uiLayout *layout, uiBlock *block, const char *n subtype = RNA_property_subtype(prop); if (subtype == PROP_FILEPATH || subtype == PROP_DIRPATH) { - uiBlockSetCurLayout(block, uiLayoutRow(sub, TRUE)); + uiBlockSetCurLayout(block, uiLayoutRow(sub, true)); but = uiDefAutoButR(block, ptr, prop, index, "", icon, x, y, w - UI_UNIT_X, h); /* BUTTONS_OT_file_browse calls uiFileBrowseContextProperty */ @@ -714,7 +714,7 @@ static void ui_item_disabled(uiLayout *layout, const char *name) but = uiDefBut(block, LABEL, 0, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); but->flag |= UI_BUT_DISABLED; - but->lock = TRUE; + but->lock = true; but->lockstr = ""; } @@ -878,8 +878,8 @@ void uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname if (prop && RNA_property_type(prop) == PROP_ENUM) { EnumPropertyItem *item, *item_array = NULL; int free; - uiLayout *split = uiLayoutSplit(layout, 0.0f, FALSE); - uiLayout *column = uiLayoutColumn(split, FALSE); + uiLayout *split = uiLayoutSplit(layout, 0.0f, false); + uiLayout *column = uiLayoutColumn(split, false); RNA_property_enum_items_gettexted(block->evil_C, &ptr, prop, &item_array, NULL, &free); for (item = item_array; item->identifier; item++) { @@ -903,7 +903,7 @@ void uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname if (item->name) { uiBut *but; if (item != item_array) { - column = uiLayoutColumn(split, FALSE); + column = uiLayoutColumn(split, false); /* inconsistent, but menus with labels do not look good flipped */ block->flag |= UI_BLOCK_NO_FLIP; } @@ -1145,7 +1145,8 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index uiBut *but = NULL; PropertyType type; char namestr[UI_MAX_NAME_STR]; - int len, is_array, w, h, slider, toggle, expand, icon_only, no_bg; + int len, w, h, slider, toggle, expand, icon_only, no_bg; + bool is_array; uiBlockSetCurLayout(block, layout); @@ -1168,7 +1169,7 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index 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 (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; } @@ -1325,8 +1326,8 @@ void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname else { EnumPropertyItem *item; int totitem, i, free; - uiLayout *split = uiLayoutSplit(layout, 0.0f, FALSE); - uiLayout *column = uiLayoutColumn(split, FALSE); + uiLayout *split = uiLayoutSplit(layout, 0.0f, false); + uiLayout *column = uiLayoutColumn(split, false); RNA_property_enum_items_gettexted(block->evil_C, ptr, prop, &item, &totitem, &free); @@ -1338,7 +1339,7 @@ void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname else { if (item[i].name) { if (i != 0) { - column = uiLayoutColumn(split, FALSE); + column = uiLayoutColumn(split, false); /* inconsistent, but menus with labels do not look good flipped */ block->flag |= UI_BLOCK_NO_FLIP; } @@ -1646,7 +1647,7 @@ void uiItemM(uiLayout *layout, bContext *UNUSED(C), const char *menuname, const { MenuType *mt; - mt = WM_menutype_find(menuname, FALSE); + mt = WM_menutype_find(menuname, false); if (mt == NULL) { RNA_warning("not found %s", menuname); @@ -2529,7 +2530,7 @@ uiBlock *uiLayoutAbsoluteBlock(uiLayout *layout) uiBlock *block; block = uiLayoutGetBlock(layout); - uiLayoutAbsolute(layout, FALSE); + uiLayoutAbsolute(layout, false); return block; } @@ -2914,7 +2915,7 @@ void ui_layout_add_but(uiLayout *layout, uiBut *but) if (layout->context) { but->context = layout->context; - but->context->used = TRUE; + but->context->used = true; } } @@ -3091,7 +3092,7 @@ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op, uiLayoutGetBlock(layout)->ui_operator = op; - row = uiLayoutRow(layout, TRUE); + row = uiLayoutRow(layout, true); uiItemM(row, (bContext *)C, "WM_MT_operator_presets", NULL, ICON_NONE); WM_operator_properties_create(&op_ptr, "WM_OT_operator_preset_add"); @@ -3100,7 +3101,7 @@ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op, WM_operator_properties_create(&op_ptr, "WM_OT_operator_preset_add"); RNA_string_set(&op_ptr, "operator", op->type->idname); - RNA_boolean_set(&op_ptr, "remove_active", TRUE); + RNA_boolean_set(&op_ptr, "remove_active", true); uiItemFullO(row, "WM_OT_operator_preset_add", "", ICON_ZOOMOUT, op_ptr.data, WM_OP_INVOKE_DEFAULT, 0); } @@ -3135,7 +3136,7 @@ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op, uiBut *but; uiLayout *col; /* needed to avoid alignment errors with previous buttons */ - col = uiLayoutColumn(layout, FALSE); + col = uiLayoutColumn(layout, false); block = uiLayoutGetBlock(col); but = uiDefIconTextBut(block, BUT, 0, ICON_FILE_REFRESH, IFACE_("Reset"), 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Reset operator defaults")); diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 36e965e13d2..593f6e1dbe0 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -122,7 +122,7 @@ static int copy_data_path_button_exec(bContext *C, wmOperator *UNUSED(op)) path = RNA_path_from_ID_to_property(&ptr, prop); if (path) { - WM_clipboard_text_set(path, FALSE); + WM_clipboard_text_set(path, false); MEM_freeN(path); return OPERATOR_FINISHED; } @@ -256,9 +256,9 @@ static void UI_OT_unset_property_button(wmOperatorType *ot) /* Copy To Selected Operator ------------------------ */ -static int copy_to_selected_list(bContext *C, PointerRNA *ptr, ListBase *lb, int *use_path) +static bool copy_to_selected_list(bContext *C, PointerRNA *ptr, ListBase *lb, bool *use_path) { - *use_path = FALSE; + *use_path = false; if (RNA_struct_is_a(ptr->type, &RNA_EditBone)) *lb = CTX_data_collection_get(C, "selected_editable_bones"); @@ -271,13 +271,14 @@ static int copy_to_selected_list(bContext *C, PointerRNA *ptr, ListBase *lb, int if (id && GS(id->name) == ID_OB) { *lb = CTX_data_collection_get(C, "selected_editable_objects"); - *use_path = TRUE; + *use_path = true; + } + else { + return false; } - else - return 0; } - return 1; + return true; } static int copy_to_selected_button_poll(bContext *C) @@ -290,7 +291,7 @@ static int copy_to_selected_button_poll(bContext *C) if (ptr.data && prop) { char *path = NULL; - int use_path; + bool use_path; CollectionPointerLink *link; ListBase lb; @@ -340,7 +341,7 @@ static int copy_to_selected_button_exec(bContext *C, wmOperator *op) /* if there is a valid property that is editable... */ if (ptr.data && prop) { char *path = NULL; - int use_path; + bool use_path; CollectionPointerLink *link; ListBase lb; @@ -490,7 +491,7 @@ static void ui_editsource_active_but_clear(void) ui_editsource_info = NULL; } -static int ui_editsource_uibut_match(uiBut *but_a, uiBut *but_b) +static bool ui_editsource_uibut_match(uiBut *but_a, uiBut *but_b) { #if 0 printf("matching buttons: '%s' == '%s'\n", @@ -507,10 +508,10 @@ static int ui_editsource_uibut_match(uiBut *but_a, uiBut *but_b) (but_a->unit_type == but_b->unit_type) && (strncmp(but_a->drawstr, but_b->drawstr, UI_MAX_DRAW_STR) == 0)) { - return TRUE; + return true; } else { - return FALSE; + return false; } } @@ -575,7 +576,7 @@ static int editsource_text_edit(bContext *C, wmOperator *op, BKE_reportf(op->reports, RPT_INFO, "See '%s' in the text editor", text->id.name + 2); } - txt_move_toline(text, line - 1, FALSE); + txt_move_toline(text, line - 1, false); WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, text); } diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 13930b5a7e7..1ea9e728409 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -739,11 +739,12 @@ static int compare_panel(const void *a1, const void *a2) /* this doesnt draw */ /* returns 1 when it did something */ -static int uiAlignPanelStep(ScrArea *sa, ARegion *ar, float fac, int drag) +static bool uiAlignPanelStep(ScrArea *sa, ARegion *ar, const float fac, const bool drag) { Panel *pa; PanelSort *ps, *panelsort, *psnext; - int a, tot = 0, done; + int a, tot = 0; + bool done; int align = panel_aligned(sa, ar); bool has_category_tabs = UI_panel_category_is_visible(ar); @@ -815,14 +816,14 @@ static int uiAlignPanelStep(ScrArea *sa, ARegion *ar, float fac, int drag) } /* we interpolate */ - done = FALSE; + done = false; 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)) { 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 = TRUE; + done = true; } } } @@ -887,7 +888,7 @@ static void ui_do_animate(const bContext *C, Panel *panel) fac = min_ff(sqrt(fac), 1.0f); /* for max 1 second, interpolate positions */ - if (uiAlignPanelStep(sa, ar, fac, 0)) { + if (uiAlignPanelStep(sa, ar, fac, false)) { ED_region_tag_redraw(ar); } else { @@ -957,7 +958,7 @@ void uiEndPanels(const bContext *C, ARegion *ar, int *x, int *y) if (pa) panel_activate_state(C, pa, PANEL_STATE_ANIMATION); else - uiAlignPanelStep(sa, ar, 1.0, 0); + uiAlignPanelStep(sa, ar, 1.0, false); } /* tag first panel */ @@ -1078,7 +1079,7 @@ static void ui_do_drag(const bContext *C, const 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, true); } ED_region_tag_redraw(ar); @@ -1834,7 +1835,7 @@ static void panel_activate_state(const bContext *C, Panel *pa, uiHandlePanelStat MEM_freeN(data); pa->activedata = NULL; - WM_event_remove_ui_handler(&win->modalhandlers, ui_handler_panel, ui_handler_remove_panel, pa, FALSE); + WM_event_remove_ui_handler(&win->modalhandlers, ui_handler_panel, ui_handler_remove_panel, pa, false); } else { if (!data) { diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 31b44df8200..de295f6e789 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -1849,7 +1849,7 @@ static void ui_block_func_MENUSTR(bContext *UNUSED(C), uiLayout *layout, void *a } /* create items */ - split = uiLayoutSplit(layout, 0.0f, FALSE); + split = uiLayoutSplit(layout, 0.0f, false); for (a = 0; a < md->nitems; a++) { if (a == column_end) { @@ -1868,7 +1868,7 @@ static void ui_block_func_MENUSTR(bContext *UNUSED(C), uiLayout *layout, void *a } } - column = uiLayoutColumn(split, FALSE); + column = uiLayoutColumn(split, false); } if (block->flag & UI_BLOCK_NO_FLIP) diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 4f522e3e66e..4ab57e3b4ad 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -405,7 +405,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str PointerRNA idptr; // ListBase *lb; // UNUSED ID *id, *idfrom; - int editable = RNA_property_editable(&template->ptr, template->prop); + const bool editable = RNA_property_editable(&template->ptr, template->prop); idptr = RNA_property_pointer_get(&template->ptr, template->prop); id = idptr.data; @@ -431,7 +431,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str if ((idfrom && idfrom->lib) || !editable) uiButSetFlag(but, UI_BUT_DISABLED); - uiLayoutRow(layout, TRUE); + uiLayoutRow(layout, true); } 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, @@ -492,7 +492,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str if (/* test only */ (id_copy(id, NULL, true) == false) || (idfrom && idfrom->lib) || - (editable == FALSE) || + (!editable) || /* object in editmode - don't change data */ (idfrom && GS(idfrom->name) == ID_OB && (((Object *)idfrom)->mode & OB_MODE_EDIT))) { @@ -644,7 +644,7 @@ static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, const * - template_ID makes a copy of the template data and assigns it to the relevant buttons */ if (template->idlb) { - uiLayoutRow(layout, TRUE); + uiLayoutRow(layout, true); template_ID(C, layout, template, type, idcode, flag, newop, openop, unlinkop); } @@ -698,10 +698,10 @@ void uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, const char *propname, co } /* Start drawing UI Elements using standard defines */ - split = uiLayoutSplit(layout, 0.33f, FALSE); /* NOTE: split amount here needs to be synced with normal labels */ + split = uiLayoutSplit(layout, 0.33f, false); /* NOTE: split amount here needs to be synced with normal labels */ /* FIRST PART ................................................ */ - row = uiLayoutRow(split, FALSE); + row = uiLayoutRow(split, false); /* Label - either use the provided text, or will become "ID-Block:" */ if (text) { @@ -713,16 +713,16 @@ void uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, const char *propname, co } /* SECOND PART ................................................ */ - row = uiLayoutRow(split, TRUE); + row = uiLayoutRow(split, true); /* ID-Type Selector - just have a menu of icons */ - sub = uiLayoutRow(row, TRUE); /* HACK: special group just for the enum, otherwise we */ + sub = uiLayoutRow(row, true); /* HACK: special group just for the enum, otherwise we */ uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT); /* we get ugly layout with text included too... */ uiItemFullR(sub, ptr, propType, 0, 0, UI_ITEM_R_ICON_ONLY, "", ICON_NONE); /* ID-Block Selector - just use pointer widget... */ - sub = uiLayoutRow(row, TRUE); /* HACK: special group to counteract the effects of the previous */ + sub = uiLayoutRow(row, true); /* HACK: special group to counteract the effects of the previous */ uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_EXPAND); /* enum, which now pushes everything too far right */ uiItemFullR(sub, ptr, propID, 0, 0, 0, "", ICON_NONE); @@ -752,7 +752,7 @@ void uiTemplatePathBuilder(uiLayout *layout, PointerRNA *ptr, const char *propna } /* Start drawing UI Elements using standard defines */ - row = uiLayoutRow(layout, TRUE); + row = uiLayoutRow(layout, true); /* Path (existing string) Widget */ uiItemR(row, ptr, propname, 0, text, ICON_RNA); @@ -850,14 +850,14 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, /* create RNA pointer */ RNA_pointer_create(&ob->id, &RNA_Modifier, md, &ptr); - column = uiLayoutColumn(layout, TRUE); + column = uiLayoutColumn(layout, true); uiLayoutSetContextPointer(column, "modifier", &ptr); /* rounded header ------------------------------------------------------------------- */ box = uiLayoutBox(column); if (isVirtual) { - row = uiLayoutRow(box, FALSE); + row = uiLayoutRow(box, false); uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_EXPAND); block = uiLayoutGetBlock(row); /* VIRTUAL MODIFIER */ @@ -871,7 +871,7 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, } else { /* REAL MODIFIER */ - row = uiLayoutRow(box, FALSE); + row = uiLayoutRow(box, false); block = uiLayoutGetBlock(row); uiBlockSetEmboss(block, UI_EMBOSSN); @@ -959,7 +959,7 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, if (!isVirtual && (md->mode & eModifierMode_Expanded)) { /* apply/convert/copy */ box = uiLayoutBox(column); - row = uiLayoutRow(box, FALSE); + row = uiLayoutRow(box, false); if (!ELEM(md->type, eModifierType_Collision, eModifierType_Surface)) { /* only here obdata, the rest of modifiers is ob level */ @@ -1001,14 +1001,14 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, } /* result is the layout block inside the box, that we return so that modifier settings can be drawn */ - result = uiLayoutColumn(box, FALSE); + result = uiLayoutColumn(box, false); block = uiLayoutAbsoluteBlock(box); } /* error messages */ if (md->error) { box = uiLayoutBox(column); - row = uiLayoutRow(box, FALSE); + row = uiLayoutRow(box, false); uiItemL(row, md->error, ICON_ERROR); } @@ -1136,11 +1136,11 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con) RNA_pointer_create(&ob->id, &RNA_Constraint, con, &ptr); - col = uiLayoutColumn(layout, TRUE); + col = uiLayoutColumn(layout, true); uiLayoutSetContextPointer(col, "constraint", &ptr); box = uiLayoutBox(col); - row = uiLayoutRow(box, FALSE); + row = uiLayoutRow(box, false); block = uiLayoutGetBlock(box); /* Draw constraint header */ @@ -1155,7 +1155,7 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con) xco + 0.5f * UI_UNIT_X, yco, 5 * UI_UNIT_X, 0.9f * UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, ""); if (con->flag & CONSTRAINT_DISABLE) - uiLayoutSetRedAlert(row, TRUE); + uiLayoutSetRedAlert(row, true); if (proxy_protected == 0) { uiItemR(row, &ptr, "name", 0, "", ICON_NONE); @@ -1163,7 +1163,7 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con) else uiItemL(row, con->name, ICON_NONE); - uiLayoutSetRedAlert(row, FALSE); + uiLayoutSetRedAlert(row, false); /* proxy-protected constraints cannot be edited, so hide up/down + close buttons */ if (proxy_protected) { @@ -1332,9 +1332,9 @@ void uiTemplatePreview(uiLayout *layout, ID *id, int show_buttons, ID *parent, M /* layout */ block = uiLayoutGetBlock(layout); - row = uiLayoutRow(layout, FALSE); - col = uiLayoutColumn(row, FALSE); - uiLayoutSetKeepAspect(col, TRUE); + row = uiLayoutRow(layout, false); + col = uiLayoutColumn(row, false); + uiLayoutSetKeepAspect(col, true); /* add preview */ uiDefBut(block, BUT_EXTRA, 0, "", 0, 0, UI_UNIT_X * 6, UI_UNIT_Y * 6, pid, 0.0, 0.0, 0, 0, ""); @@ -1350,7 +1350,7 @@ void uiTemplatePreview(uiLayout *layout, ID *id, int show_buttons, ID *parent, M /* Create RNA Pointer */ RNA_pointer_create(&ma->id, &RNA_Material, ma, &material_ptr); - col = uiLayoutColumn(row, TRUE); + col = uiLayoutColumn(row, true); uiLayoutSetScaleX(col, 1.5); uiItemR(col, &material_ptr, "preview_render_type", UI_ITEM_R_EXPAND, "", ICON_NONE); } @@ -1359,7 +1359,7 @@ void uiTemplatePreview(uiLayout *layout, ID *id, int show_buttons, ID *parent, M /* Create RNA Pointer */ RNA_pointer_create(id, &RNA_Texture, tex, &texture_ptr); - uiLayoutRow(layout, TRUE); + uiLayoutRow(layout, true); 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) { @@ -1379,7 +1379,7 @@ void uiTemplatePreview(uiLayout *layout, ID *id, int show_buttons, ID *parent, M /* Alpha button for texture preview */ if (*pr_texture != TEX_PR_OTHER) { - row = uiLayoutRow(layout, FALSE); + row = uiLayoutRow(layout, false); uiItemR(row, &texture_ptr, "use_preview_alpha", 0, NULL, ICON_NONE); } } @@ -1473,11 +1473,11 @@ static void colorband_buttons_layout(uiLayout *layout, uiBlock *block, ColorBand float xs = butr->xmin; float ys = butr->ymin; - split = uiLayoutSplit(layout, 0.4f, FALSE); + split = uiLayoutSplit(layout, 0.4f, false); uiBlockSetEmboss(block, UI_EMBOSSN); uiBlockBeginAlign(block); - row = uiLayoutRow(split, FALSE); + row = uiLayoutRow(split, false); bt = uiDefIconTextBut(block, BUT, 0, ICON_ZOOMIN, "", 0, 0, 2.0f * unit, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Add a new color stop to the colorband")); @@ -1494,18 +1494,18 @@ static void colorband_buttons_layout(uiLayout *layout, uiBlock *block, ColorBand uiBlockEndAlign(block); uiBlockSetEmboss(block, UI_EMBOSS); - row = uiLayoutRow(split, FALSE); + row = uiLayoutRow(split, false); bt = uiDefButS(block, MENU, 0, IFACE_("Interpolation %t|Ease %x1|Cardinal %x3|Linear %x0|B-Spline %x2|Constant %x4"), 0, ys + UI_UNIT_Y, 8.0f * unit, UI_UNIT_Y, &coba->ipotype, 0.0, 0.0, 0, 0, TIP_("Set interpolation between color stops")); uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL); - row = uiLayoutRow(layout, FALSE); + row = uiLayoutRow(layout, false); bt = uiDefBut(block, BUT_COLORBAND, 0, "", xs, ys, BLI_rctf_size_x(butr), UI_UNIT_Y, coba, 0, 0, 0, 0, ""); uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL); - row = uiLayoutRow(layout, FALSE); + row = uiLayoutRow(layout, false); if (coba->tot) { CBData *cbd = coba->data + coba->cur; @@ -1514,32 +1514,32 @@ static void colorband_buttons_layout(uiLayout *layout, uiBlock *block, ColorBand RNA_pointer_create(cb->ptr.id.data, &RNA_ColorRampElement, cbd, &ptr); if (!expand) { - split = uiLayoutSplit(layout, 0.3f, FALSE); + split = uiLayoutSplit(layout, 0.3f, false); - row = uiLayoutRow(split, FALSE); + row = uiLayoutRow(split, false); uiDefButS(block, NUM, 0, "", 0, 0, 5.0f * UI_UNIT_X, UI_UNIT_Y, &coba->cur, 0.0, (float)(MAX2(0, coba->tot - 1)), 0, 0, TIP_("Choose active color stop")); - row = uiLayoutRow(split, FALSE); + row = uiLayoutRow(split, false); uiItemR(row, &ptr, "position", 0, IFACE_("Pos"), ICON_NONE); bt = block->buttons.last; uiButSetFunc(bt, colorband_update_cb, bt, coba); - row = uiLayoutRow(layout, FALSE); + row = uiLayoutRow(layout, false); uiItemR(row, &ptr, "color", 0, "", ICON_NONE); } else { - split = uiLayoutSplit(layout, 0.5f, FALSE); - subsplit = uiLayoutSplit(split, 0.35f, FALSE); + split = uiLayoutSplit(layout, 0.5f, false); + subsplit = uiLayoutSplit(split, 0.35f, false); - row = uiLayoutRow(subsplit, FALSE); + row = uiLayoutRow(subsplit, false); uiDefButS(block, NUM, 0, "", 0, 0, 5.0f * UI_UNIT_X, UI_UNIT_Y, &coba->cur, 0.0, (float)(MAX2(0, coba->tot - 1)), 0, 0, TIP_("Choose active color stop")); - row = uiLayoutRow(subsplit, FALSE); + row = uiLayoutRow(subsplit, false); uiItemR(row, &ptr, "position", 0, IFACE_("Pos"), ICON_NONE); bt = block->buttons.last; uiButSetFunc(bt, colorband_update_cb, bt, coba); - row = uiLayoutRow(split, FALSE); + row = uiLayoutRow(split, false); uiItemR(row, &ptr, "color", 0, "", ICON_NONE); } } @@ -1836,7 +1836,7 @@ static void curvemap_buttons_setclip(bContext *UNUSED(C), void *cumap_v, void *U { CurveMapping *cumap = cumap_v; - curvemapping_changed(cumap, FALSE); + curvemapping_changed(cumap, false); } static void curvemap_buttons_delete(bContext *C, void *cb_v, void *cumap_v) @@ -1844,7 +1844,7 @@ static void curvemap_buttons_delete(bContext *C, void *cb_v, void *cumap_v) CurveMapping *cumap = cumap_v; curvemap_remove(cumap->cm + cumap->cur, SELECT); - curvemapping_changed(cumap, FALSE); + curvemapping_changed(cumap, false); rna_update_cb(C, cb_v, NULL); } @@ -1903,26 +1903,26 @@ static void curvemap_tools_dofunc(bContext *C, void *cumap_v, int event) case UICURVE_FUNC_RESET_POS: /* reset */ curvemap_reset(cuma, &cumap->clipr, cumap->preset, (event == UICURVE_FUNC_RESET_NEG) ? CURVEMAP_SLOPE_NEGATIVE : CURVEMAP_SLOPE_POSITIVE); - curvemapping_changed(cumap, FALSE); + curvemapping_changed(cumap, false); break; case UICURVE_FUNC_RESET_VIEW: cumap->curr = cumap->clipr; break; case UICURVE_FUNC_HANDLE_VECTOR: /* set vector */ curvemap_sethandle(cuma, 1); - curvemapping_changed(cumap, FALSE); + curvemapping_changed(cumap, false); break; case UICURVE_FUNC_HANDLE_AUTO: /* set auto */ curvemap_sethandle(cuma, 0); - curvemapping_changed(cumap, FALSE); + curvemapping_changed(cumap, false); break; case UICURVE_FUNC_EXTEND_HOZ: /* extend horiz */ cuma->flag &= ~CUMA_EXTEND_EXTRAPOLATE; - curvemapping_changed(cumap, FALSE); + curvemapping_changed(cumap, false); break; case UICURVE_FUNC_EXTEND_EXP: /* extend extrapolate */ cuma->flag |= CUMA_EXTEND_EXTRAPOLATE; - curvemapping_changed(cumap, FALSE); + curvemapping_changed(cumap, false); break; } ED_region_tag_redraw(CTX_wm_region(C)); @@ -1988,7 +1988,7 @@ static void curvemap_buttons_redraw(bContext *C, void *UNUSED(arg1), void *UNUSE static void curvemap_buttons_update(bContext *C, void *arg1_v, void *cumap_v) { CurveMapping *cumap = cumap_v; - curvemapping_changed(cumap, TRUE); + curvemapping_changed(cumap, true); rna_update_cb(C, arg1_v, NULL); } @@ -2005,7 +2005,7 @@ static void curvemap_buttons_reset(bContext *C, void *cb_v, void *cumap_v) cumap->white[0] = cumap->white[1] = cumap->white[2] = 1.0f; curvemapping_set_black_white(cumap, NULL, NULL); - curvemapping_changed(cumap, FALSE); + curvemapping_changed(cumap, false); rna_update_cb(C, cb_v, NULL); } @@ -2027,11 +2027,11 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe block = uiLayoutGetBlock(layout); /* curve chooser */ - row = uiLayoutRow(layout, FALSE); + row = uiLayoutRow(layout, false); if (labeltype == 'v') { /* vector */ - sub = uiLayoutRow(row, TRUE); + sub = uiLayoutRow(row, true); uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT); if (cumap->cm[0].curve) { @@ -2049,7 +2049,7 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe } else if (labeltype == 'c') { /* color */ - sub = uiLayoutRow(row, TRUE); + sub = uiLayoutRow(row, true); uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT); if (cumap->cm[3].curve) { @@ -2071,7 +2071,7 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe } else if (labeltype == 'h') { /* HSV */ - sub = uiLayoutRow(row, TRUE); + sub = uiLayoutRow(row, true); uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT); if (cumap->cm[0].curve) { @@ -2094,7 +2094,7 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe bg = UI_GRAD_H; /* operation buttons */ - sub = uiLayoutRow(row, TRUE); + sub = uiLayoutRow(row, true); uiBlockSetEmboss(block, UI_EMBOSSN); @@ -2124,7 +2124,7 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe /* curve itself */ size = uiLayoutGetWidth(layout); - row = uiLayoutRow(layout, FALSE); + row = uiLayoutRow(layout, false); uiDefBut(block, BUT_CURVE, 0, "", 0, 0, size, 8.0f * UI_UNIT_X, cumap, 0.0f, 1.0f, bg, 0, ""); /* sliders for selected point */ @@ -2146,7 +2146,7 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe bounds.xmax = bounds.ymax = 1000.0; } - uiLayoutRow(layout, TRUE); + uiLayoutRow(layout, true); uiBlockSetNFunc(block, curvemap_buttons_update, MEM_dupallocN(cb), cumap); uiDefButF(block, NUM, 0, "X", 0, 2 * UI_UNIT_Y, UI_UNIT_X * 10, UI_UNIT_Y, &cmp->x, bounds.xmin, bounds.xmax, 1, 5, ""); @@ -2156,11 +2156,11 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe /* black/white levels */ if (levels) { - split = uiLayoutSplit(layout, 0.0f, FALSE); - uiItemR(uiLayoutColumn(split, FALSE), ptr, "black_level", UI_ITEM_R_EXPAND, NULL, ICON_NONE); - uiItemR(uiLayoutColumn(split, FALSE), ptr, "white_level", UI_ITEM_R_EXPAND, NULL, ICON_NONE); + split = uiLayoutSplit(layout, 0.0f, false); + uiItemR(uiLayoutColumn(split, false), ptr, "black_level", UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR(uiLayoutColumn(split, false), ptr, "white_level", UI_ITEM_R_EXPAND, NULL, ICON_NONE); - uiLayoutRow(layout, FALSE); + uiLayoutRow(layout, false); bt = uiDefBut(block, BUT, 0, IFACE_("Reset"), 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, TIP_("Reset Black/White point and curves")); uiButSetNFunc(bt, curvemap_buttons_reset, MEM_dupallocN(cb), cumap); @@ -2221,8 +2221,8 @@ void uiTemplateColorPicker(uiLayout *layout, PointerRNA *ptr, const char *propna RNA_property_float_ui_range(ptr, prop, &softmin, &softmax, &step, &precision); - col = uiLayoutColumn(layout, TRUE); - row = uiLayoutRow(col, TRUE); + col = uiLayoutColumn(layout, true); + row = uiLayoutRow(col, true); switch (U.color_picker_type) { case USER_CP_CIRCLE: @@ -2297,10 +2297,10 @@ static void handle_layer_buttons(bContext *C, void *arg1, void *arg2) 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); + RNA_property_boolean_set_index(&but->rnapoin, but->rnaprop, cur, true); for (i = 0; i < tot; ++i) { if (i != cur) - RNA_property_boolean_set_index(&but->rnapoin, but->rnaprop, i, FALSE); + RNA_property_boolean_set_index(&but->rnapoin, but->rnaprop, i, false); } } @@ -2351,13 +2351,13 @@ void uiTemplateLayers(uiLayout *layout, PointerRNA *ptr, const char *propname, /* layers are laid out going across rows, with the columns being divided into groups */ for (group = 0; group < groups; group++) { - uCol = uiLayoutColumn(layout, TRUE); + uCol = uiLayoutColumn(layout, true); for (row = 0; row < 2; row++) { uiBlock *block; uiBut *but; - uRow = uiLayoutRow(uCol, TRUE); + uRow = uiLayoutRow(uCol, true); block = uiLayoutGetBlock(uRow); layer = groups * cols_per_group * row + cols_per_group * group; @@ -2419,13 +2419,13 @@ void uiTemplateGameStates(uiLayout *layout, PointerRNA *ptr, const char *propnam /* layers are laid out going across rows, with the columns being divided into groups */ for (group = 0; group < groups; group++) { - uCol = uiLayoutColumn(layout, TRUE); + uCol = uiLayoutColumn(layout, true); for (row = 0; row < 2; row++) { uiBlock *block; uiBut *but; - uRow = uiLayoutRow(uCol, TRUE); + uRow = uiLayoutRow(uCol, true); block = uiLayoutGetBlock(uRow); state = groups * cols_per_group * row + cols_per_group * group; @@ -2482,14 +2482,14 @@ static void uilist_draw_filter_default(struct uiList *ui_list, struct bContext * RNA_pointer_create(NULL, &RNA_UIList, ui_list, &listptr); - row = uiLayoutRow(layout, FALSE); + row = uiLayoutRow(layout, false); - subrow = uiLayoutRow(row, TRUE); + subrow = uiLayoutRow(row, true); uiItemR(subrow, &listptr, "filter_name", 0, "", ICON_NONE); uiItemR(subrow, &listptr, "use_filter_invert", UI_ITEM_R_TOGGLE | UI_ITEM_R_ICON_ONLY, "", (ui_list->filter_flag & UILST_FLT_EXCLUDE) ? ICON_ZOOM_OUT : ICON_ZOOM_IN); - subrow = uiLayoutRow(row, TRUE); + subrow = uiLayoutRow(row, true); uiItemR(subrow, &listptr, "use_filter_sort_alpha", UI_ITEM_R_TOGGLE | UI_ITEM_R_ICON_ONLY, "", ICON_NONE); uiItemR(subrow, &listptr, "use_filter_sort_reverse", UI_ITEM_R_TOGGLE | UI_ITEM_R_ICON_ONLY, "", (ui_list->filter_sort_flag & UILST_FLT_SORT_REVERSE) ? ICON_TRIA_UP : ICON_TRIA_DOWN); @@ -2771,7 +2771,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co activei = RNA_property_int_get(active_dataptr, activeprop); /* Find the uiList type. */ - ui_list_type = WM_uilisttype_find(listtype_name, FALSE); + ui_list_type = WM_uilisttype_find(listtype_name, false); if (ui_list_type == NULL) { RNA_warning("List type %s not found", listtype_name); @@ -2895,9 +2895,9 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co case UILST_LAYOUT_DEFAULT: /* layout */ box = uiLayoutListBox(layout, ui_list, dataptr, prop, active_dataptr, activeprop); - glob = uiLayoutColumn(box, TRUE); - row = uiLayoutRow(glob, FALSE); - col = uiLayoutColumn(row, TRUE); + glob = uiLayoutColumn(box, true); + row = uiLayoutRow(glob, false); + col = uiLayoutColumn(row, true); /* init numbers */ prepare_list(ui_list, len, activei, rows, maxrows, 1, &layoutdata); @@ -2915,13 +2915,13 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co uiBlockSetFlag(subblock, UI_BLOCK_LIST_ITEM); /* list item behind label & other buttons */ - sub = uiLayoutRow(overlap, FALSE); + sub = uiLayoutRow(overlap, false); but = uiDefButR_prop(subblock, LISTROW, 0, "", 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, active_dataptr, activeprop, 0, 0, org_i, 0, 0, NULL); uiButSetDrawFlag(but, UI_BUT_NO_TOOLTIP); - sub = uiLayoutRow(overlap, FALSE); + sub = uiLayoutRow(overlap, false); icon = UI_rnaptr_icon_get(C, itemptr, rnaicon, false); if (icon == ICON_DOT) @@ -2945,14 +2945,14 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co /* add scrollbar */ if (len > layoutdata.visual_items) { - col = uiLayoutColumn(row, FALSE); + col = uiLayoutColumn(row, false); uiDefButI(block, SCROLL, 0, "", 0, 0, UI_UNIT_X * 0.75, UI_UNIT_Y * dyn_data->visual_height, &ui_list->list_scroll, 0, dyn_data->height - dyn_data->visual_height, dyn_data->visual_height, 0, ""); } break; case UILST_LAYOUT_COMPACT: - row = uiLayoutRow(layout, TRUE); + row = uiLayoutRow(layout, true); if ((dataptr->data && prop) && (dyn_data->items_shown > 0) && (activei >= 0) && (activei < dyn_data->items_shown)) @@ -2979,9 +2979,9 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co break; case UILST_LAYOUT_GRID: box = uiLayoutListBox(layout, ui_list, dataptr, prop, active_dataptr, activeprop); - glob = uiLayoutColumn(box, TRUE); - row = uiLayoutRow(glob, FALSE); - col = uiLayoutColumn(row, TRUE); + glob = uiLayoutColumn(box, true); + row = uiLayoutRow(glob, false); + col = uiLayoutColumn(row, true); subrow = NULL; /* Quite gcc warning! */ prepare_list(ui_list, len, activei, rows, maxrows, columns, &layoutdata); @@ -2995,7 +2995,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co /* create button */ if (!(i % columns)) - subrow = uiLayoutRow(col, FALSE); + subrow = uiLayoutRow(col, false); subblock = uiLayoutGetBlock(subrow); overlap = uiLayoutOverlap(subrow); @@ -3003,13 +3003,13 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co uiBlockSetFlag(subblock, UI_BLOCK_LIST_ITEM); /* list item behind label & other buttons */ - sub = uiLayoutRow(overlap, FALSE); + sub = uiLayoutRow(overlap, false); but = uiDefButR_prop(subblock, LISTROW, 0, "", 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, active_dataptr, activeprop, 0, 0, org_i, 0, 0, NULL); uiButSetDrawFlag(but, UI_BUT_NO_TOOLTIP); - sub = uiLayoutRow(overlap, FALSE); + sub = uiLayoutRow(overlap, false); icon = UI_rnaptr_icon_get(C, itemptr, rnaicon, false); draw_item(ui_list, C, sub, dataptr, itemptr, icon, active_dataptr, active_propname, @@ -3027,14 +3027,14 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co /* add dummy buttons to fill space */ for (; i < layoutdata.start_idx + layoutdata.visual_items; i++) { if (!(i % columns)) { - subrow = uiLayoutRow(col, FALSE); + subrow = uiLayoutRow(col, false); } uiItemL(subrow, "", ICON_NONE); } /* add scrollbar */ if (len > layoutdata.visual_items) { - col = uiLayoutColumn(row, FALSE); + col = uiLayoutColumn(row, false); uiDefButI(block, SCROLL, 0, "", 0, 0, UI_UNIT_X * 0.75, UI_UNIT_Y * dyn_data->visual_height, &ui_list->list_scroll, 0, dyn_data->height - dyn_data->visual_height, dyn_data->visual_height, 0, ""); @@ -3043,7 +3043,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co } if (glob) { - row = uiLayoutRow(glob, TRUE); + row = uiLayoutRow(glob, true); subblock = uiLayoutGetBlock(row); uiBlockSetEmboss(subblock, UI_EMBOSSN); @@ -3059,7 +3059,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co uiBlockSetEmboss(subblock, UI_EMBOSS); - col = uiLayoutColumn(glob, FALSE); + col = uiLayoutColumn(glob, false); subblock = uiLayoutGetBlock(col); uiDefBut(subblock, SEPR, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y * 0.05f, NULL, 0.0, 0.0, 0, 0, ""); @@ -3161,7 +3161,7 @@ static void do_running_jobs(bContext *C, void *UNUSED(arg), int event) { switch (event) { case B_STOPRENDER: - G.is_break = TRUE; + G.is_break = true; break; case B_STOPCAST: WM_jobs_stop(CTX_wm_manager(C), CTX_wm_screen(C), NULL); @@ -3179,7 +3179,7 @@ static void do_running_jobs(bContext *C, void *UNUSED(arg), int event) WM_jobs_stop(CTX_wm_manager(C), CTX_wm_area(C), NULL); break; case B_STOPOTHER: - G.is_break = TRUE; + G.is_break = true; break; } } @@ -3241,7 +3241,7 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C) if (owner) { uiLayout *ui_abs; - ui_abs = uiLayoutAbsolute(layout, FALSE); + ui_abs = uiLayoutAbsolute(layout, false); (void)ui_abs; /* UNUSED */ uiDefIconBut(block, BUT, handle_event, ICON_PANEL_CLOSE, 0, UI_UNIT_Y * 0.1, UI_UNIT_X * 0.8, UI_UNIT_Y * 0.8, @@ -3249,7 +3249,7 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C) uiDefBut(block, PROGRESSBAR, 0, WM_jobs_name(wm, owner), UI_UNIT_X, 0, UI_UNIT_X * 5.0f, UI_UNIT_Y, NULL, 0.0f, 0.0f, WM_jobs_progress(wm, owner), 0, TIP_("Progress")); - uiLayoutRow(layout, FALSE); + uiLayoutRow(layout, false); } if (WM_jobs_test(wm, screen, WM_JOB_TYPE_SCREENCAST)) uiDefIconTextBut(block, BUT, B_STOPCAST, ICON_CANCEL, IFACE_("Capture"), 0, 0, UI_UNIT_X * 4.25f, UI_UNIT_Y, @@ -3281,7 +3281,7 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C) if (!rti || rti->widthfac == 0.0f || !report) return; - ui_abs = uiLayoutAbsolute(layout, FALSE); + ui_abs = uiLayoutAbsolute(layout, false); block = uiLayoutGetBlock(ui_abs); width = BLF_width(style->widget.uifont_id, report->message, report->len); @@ -3345,7 +3345,7 @@ static void template_keymap_item_properties(uiLayout *layout, const char *title, if (title) uiItemL(layout, title, ICON_NONE); - flow = uiLayoutColumnFlow(layout, 2, FALSE); + flow = uiLayoutColumnFlow(layout, 2, false); RNA_STRUCT_BEGIN (ptr, prop) { @@ -3446,21 +3446,21 @@ void uiTemplateColormanagedViewSettings(uiLayout *layout, bContext *UNUSED(C), P view_transform_ptr = RNA_property_pointer_get(ptr, prop); view_settings = view_transform_ptr.data; - col = uiLayoutColumn(layout, FALSE); + col = uiLayoutColumn(layout, false); - row = uiLayoutRow(col, FALSE); + row = uiLayoutRow(col, false); uiItemR(row, &view_transform_ptr, "view_transform", UI_ITEM_R_EXPAND, IFACE_("View"), ICON_NONE); - col = uiLayoutColumn(layout, FALSE); + col = uiLayoutColumn(layout, false); uiItemR(col, &view_transform_ptr, "exposure", 0, NULL, ICON_NONE); uiItemR(col, &view_transform_ptr, "gamma", 0, NULL, ICON_NONE); uiItemR(col, &view_transform_ptr, "look", 0, IFACE_("Look"), ICON_NONE); - col = uiLayoutColumn(layout, FALSE); + col = uiLayoutColumn(layout, false); uiItemR(col, &view_transform_ptr, "use_curve_mapping", 0, NULL, ICON_NONE); if (view_settings->flag & COLORMANAGE_VIEW_USE_CURVES) - uiTemplateCurveMapping(col, &view_transform_ptr, "curve_mapping", 'c', TRUE, 0); + uiTemplateCurveMapping(col, &view_transform_ptr, "curve_mapping", 'c', true, 0); } /********************************* Component Menu *************************************/ diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c index 7da12277372..e1f39b1d556 100644 --- a/source/blender/editors/interface/interface_utils.c +++ b/source/blender/editors/interface/interface_utils.c @@ -150,7 +150,7 @@ int uiDefAutoButsRNA(uiLayout *layout, PointerRNA *ptr, 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) == 0)) continue; if (label_align != '\0') { @@ -160,17 +160,17 @@ int uiDefAutoButsRNA(uiLayout *layout, PointerRNA *ptr, name = RNA_property_ui_name(prop); if (label_align == 'V') { - col = uiLayoutColumn(layout, TRUE); + col = uiLayoutColumn(layout, true); if (!is_boolean) uiItemL(col, name, ICON_NONE); } else if (label_align == 'H') { - split = uiLayoutSplit(layout, 0.5f, FALSE); + split = uiLayoutSplit(layout, 0.5f, false); - col = uiLayoutColumn(split, FALSE); + col = uiLayoutColumn(split, false); uiItemL(col, (is_boolean) ? "" : name, ICON_NONE); - col = uiLayoutColumn(split, FALSE); + col = uiLayoutColumn(split, false); } else { col = NULL; diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 3976034e348..4756303302b 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -1317,7 +1317,7 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB if (but == NULL) return; - ui_button_text_password_hide(password_str, but, FALSE); + ui_button_text_password_hide(password_str, but, false); /* check for button text label */ if (but->type == MENU && (but->flag & UI_BUT_NODE_LINK)) { @@ -1373,7 +1373,7 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB /* always draw text for textbutton cursor */ widget_draw_text(fstyle, wcol, but, rect); - ui_button_text_password_hide(password_str, but, TRUE); + ui_button_text_password_hide(password_str, but, true); } #undef UI_TEXT_CLIP_MARGIN @@ -1981,10 +1981,10 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, const rcti * float xpos, ypos, ang = 0.0f; float rgb[3], hsvo[3], hsv[3], col[3], colcent[3]; int a; - int color_profile = but->block->color_profile; + bool color_profile = but->block->color_profile; if (but->rnaprop && RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) - color_profile = FALSE; + color_profile = false; /* color */ ui_get_but_vectorf(but, rgb); @@ -2197,7 +2197,7 @@ bool ui_hsvcube_use_display_colorspace(uiBut *but) if (but->rnaprop) { if (RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) - color_profile = FALSE; + color_profile = false; } /* SV+H gradient does not use display colorspace */ @@ -2271,10 +2271,10 @@ static void ui_draw_but_HSV_v(uiBut *but, const rcti *rect) const float rad = 0.5f * BLI_rcti_size_x(rect); float x, y; float rgb[3], hsv[3], v, range; - int color_profile = but->block->color_profile; + bool color_profile = but->block->color_profile; if (but->rnaprop && RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) - color_profile = FALSE; + color_profile = false; ui_get_but_vectorf(but, rgb); @@ -2679,7 +2679,7 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat { uiWidgetBase wtb; float rad, col[4]; - int color_profile = but->block->color_profile; + bool color_profile = but->block->color_profile; col[3] = 1.0f; @@ -2687,7 +2687,7 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat BLI_assert(but->rnaindex == -1); if (RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) - color_profile = FALSE; + color_profile = false; if (RNA_property_array_length(&but->rnapoin, but->rnaprop) == 4) { col[3] = RNA_property_float_get_index(&but->rnapoin, but->rnaprop, 3); diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index e9d53320d24..f19a10ae355 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -758,8 +758,8 @@ void ui_theme_init_default(void) ui_widget_color_init(&btheme->tui); btheme->tui.iconfile[0] = 0; - btheme->tui.panel.show_back = FALSE; - btheme->tui.panel.show_header = FALSE; + btheme->tui.panel.show_back = false; + btheme->tui.panel.show_header = false; rgba_char_args_set(btheme->tui.panel.header, 0, 0, 0, 25); rgba_char_args_set(btheme->tui.xaxis, 220, 0, 0, 255); @@ -776,8 +776,8 @@ void ui_theme_init_default(void) ui_theme_init_new(btheme); /* space view3d */ - btheme->tv3d.panelcolors.show_back = FALSE; - btheme->tv3d.panelcolors.show_header = FALSE; + btheme->tv3d.panelcolors.show_back = false; + btheme->tv3d.panelcolors.show_header = false; rgba_char_args_set_fl(btheme->tv3d.panelcolors.back, 0.45, 0.45, 0.45, 0.5); rgba_char_args_set_fl(btheme->tv3d.panelcolors.header, 0, 0, 0, 0.01); rgba_char_args_set_fl(btheme->tv3d.back, 0.225, 0.225, 0.225, 1.0); @@ -866,7 +866,7 @@ void ui_theme_init_default(void) rgba_char_args_set(btheme->tv3d.skin_root, 180, 77, 77, 255); rgba_char_args_set(btheme->tv3d.gradients.gradient, 0, 0, 0, 0); rgba_char_args_set(btheme->tv3d.gradients.high_gradient, 58, 58, 58, 255); - btheme->tv3d.gradients.show_grad = FALSE; + btheme->tv3d.gradients.show_grad = false; /* space buttons */ /* to have something initialized */ @@ -2006,7 +2006,7 @@ void init_userdef_do_versions(void) rgba_char_args_set_fl(btheme->toops.selected_highlight, 0.51, 0.53, 0.55, 0.3); } - U.use_16bit_textures = TRUE; + U.use_16bit_textures = true; } if (bmain->versionfile < 262 || (bmain->versionfile == 262 && bmain->subversionfile < 2)) { diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index 39583551bec..e59106c265a 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -432,14 +432,14 @@ static void ui_view2d_curRect_validate_resize(View2D *v2d, int resize, int mask_ /* check if we should restore aspect ratio (if view size changed) */ if (v2d->keepzoom & V2D_KEEPASPECT) { - short do_x = FALSE, do_y = FALSE, do_cur /* , do_win */ /* UNUSED */; + bool do_x = false, do_y = false, do_cur /* , do_win */ /* UNUSED */; float /* curRatio, */ /* UNUSED */ winRatio; /* when a window edge changes, the aspect ratio can't be used to * find which is the best new 'cur' rect. thats why it stores 'old' */ - if (winx != v2d->oldwinx) do_x = TRUE; - if (winy != v2d->oldwiny) do_y = TRUE; + if (winx != v2d->oldwinx) do_x = true; + if (winy != v2d->oldwiny) do_y = true; /* curRatio = height / width; */ /* UNUSED */ winRatio = winy / winx; @@ -448,14 +448,14 @@ static void ui_view2d_curRect_validate_resize(View2D *v2d, int resize, int mask_ if (do_x == do_y) { if (do_x && do_y) { /* here is 1,1 case, so all others must be 0,0 */ - if (ABS(winx - v2d->oldwinx) > ABS(winy - v2d->oldwiny)) do_y = FALSE; - else do_x = FALSE; + if (fabsf(winx - v2d->oldwinx) > fabsf(winy - v2d->oldwiny)) do_y = false; + else do_x = false; } else if (winRatio > 1.0f) { - do_x = FALSE; + do_x = false; } else { - do_x = TRUE; + do_x = true; } } do_cur = do_x; diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index ce6f77afaac..d39c8340626 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -673,8 +673,8 @@ static void view_zoomstep_exit(wmOperator *op) static int view_zoomin_exec(bContext *C, wmOperator *op) { ScrArea *sa = CTX_wm_area(C); - short do_zoom_x = TRUE; - short do_zoom_y = TRUE; + bool do_zoom_x = true; + bool do_zoom_y = true; /* check that there's an active region, as View2D data resides there */ if (!view_zoom_poll(C)) @@ -685,7 +685,7 @@ static int view_zoomin_exec(bContext *C, wmOperator *op) ARegion *ar = CTX_wm_region(C); if (ar && ar->regiontype != RGN_TYPE_PREVIEW) - do_zoom_y = FALSE; + do_zoom_y = false; } /* set RNA-Props - zooming in by uniform factor */ @@ -742,8 +742,8 @@ static void VIEW2D_OT_zoom_in(wmOperatorType *ot) static int view_zoomout_exec(bContext *C, wmOperator *op) { ScrArea *sa = CTX_wm_area(C); - short do_zoom_x = TRUE; - short do_zoom_y = TRUE; + short do_zoom_x = true; + short do_zoom_y = true; /* check that there's an active region, as View2D data resides there */ if (!view_zoom_poll(C)) @@ -754,7 +754,7 @@ static int view_zoomout_exec(bContext *C, wmOperator *op) ARegion *ar = CTX_wm_region(C); if (ar && ar->regiontype != RGN_TYPE_PREVIEW) - do_zoom_y = FALSE; + do_zoom_y = false; } /* set RNA-Props - zooming in by uniform factor */ @@ -1214,7 +1214,7 @@ static void VIEW2D_OT_zoom_border(wmOperatorType *ot) ot->poll = view_zoom_poll; /* rna */ - WM_operator_properties_gesture_border(ot, FALSE); + WM_operator_properties_gesture_border(ot, false); } /* ********************************************************* */ @@ -1274,7 +1274,7 @@ void UI_view2d_smooth_view(bContext *C, ARegion *ar, View2D *v2d = &ar->v2d; struct SmoothView2DStore sms = {{0}}; - short ok = FALSE; + bool ok = false; float fac = 1.0f; /* initialize sms */ @@ -1290,7 +1290,7 @@ void UI_view2d_smooth_view(bContext *C, ARegion *ar, if (smooth_viewtx && fac > FLT_EPSILON) { bool changed = false; - if (BLI_rctf_compare(&sms.new_cur, &v2d->cur, FLT_EPSILON) == FALSE) + if (BLI_rctf_compare(&sms.new_cur, &v2d->cur, FLT_EPSILON) == false) changed = true; /* The new view is different from the old one @@ -1312,12 +1312,12 @@ void UI_view2d_smooth_view(bContext *C, ARegion *ar, /* TIMER1 is hardcoded in keymap */ v2d->smooth_timer = WM_event_add_timer(wm, win, TIMER1, 1.0 / 100.0); /* max 30 frs/sec */ - ok = TRUE; + ok = true; } } /* if we get here nothing happens */ - if (ok == FALSE) { + if (ok == false) { v2d->cur = sms.new_cur; UI_view2d_curRect_validate(v2d); @@ -1382,7 +1382,7 @@ static void VIEW2D_OT_smoothview(wmOperatorType *ot) ot->flag = OPTYPE_INTERNAL; /* rna */ - WM_operator_properties_gesture_border(ot, FALSE); + WM_operator_properties_gesture_border(ot, false); } /* ********************************************************* */ @@ -1965,9 +1965,9 @@ void UI_view2d_keymap(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "VIEW2D_OT_scroll_up", WHEELUPMOUSE, KM_PRESS, 0, 0); kmi = WM_keymap_add_item(keymap, "VIEW2D_OT_scroll_down", PAGEDOWNKEY, KM_PRESS, 0, 0); - RNA_boolean_set(kmi->ptr, "page", TRUE); + RNA_boolean_set(kmi->ptr, "page", true); kmi = WM_keymap_add_item(keymap, "VIEW2D_OT_scroll_up", PAGEUPKEY, KM_PRESS, 0, 0); - RNA_boolean_set(kmi->ptr, "page", TRUE); + RNA_boolean_set(kmi->ptr, "page", true); WM_keymap_add_item(keymap, "VIEW2D_OT_zoom", MIDDLEMOUSE, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "VIEW2D_OT_zoom", MOUSEZOOM, 0, 0, 0); diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 366613033c0..825a8c973a2 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -4086,7 +4086,7 @@ static void headerTranslation(TransInfo *t, float vec[3], char str[MAX_INFO_LEN] for (i = 0; i < 3; i++) { bUnit_AsString(&tvec[NUM_STR_REP_LEN * i], NUM_STR_REP_LEN, dvec[i] * t->scene->unit.scale_length, - 4, t->scene->unit.system, B_UNIT_LENGTH, do_split, 1); + 4, t->scene->unit.system, B_UNIT_LENGTH, do_split, true); } } else { @@ -4098,7 +4098,7 @@ static void headerTranslation(TransInfo *t, float vec[3], char str[MAX_INFO_LEN] if (!(t->flag & T_2D_EDIT) && t->scene->unit.system) bUnit_AsString(distvec, sizeof(distvec), dist * t->scene->unit.scale_length, 4, t->scene->unit.system, - B_UNIT_LENGTH, t->scene->unit.flag & USER_UNIT_OPT_SPLIT, 0); + B_UNIT_LENGTH, t->scene->unit.flag & USER_UNIT_OPT_SPLIT, false); else if (dist > 1e10f || dist < -1e10f) /* prevent string buffer overflow */ BLI_snprintf(distvec, NUM_STR_REP_LEN, "%.4e", dist); else diff --git a/source/blender/editors/util/numinput.c b/source/blender/editors/util/numinput.c index c69996defd7..57ae95d1305 100644 --- a/source/blender/editors/util/numinput.c +++ b/source/blender/editors/util/numinput.c @@ -166,9 +166,8 @@ void applyNumInput(NumInput *n, float *vec) static void value_to_editstr(NumInput *n, int idx) { const int prec = 6; /* editing, higher precision needed. */ - bUnit_AsString(n->str, NUM_STR_REP_LEN, (double)n->val[idx], prec, - n->unit_sys, n->unit_type[idx], true, false); - n->str_cur = strlen(n->str); + n->str_cur = bUnit_AsString(n->str, NUM_STR_REP_LEN, (double)n->val[idx], prec, + n->unit_sys, n->unit_type[idx], true, false); } static bool editstr_insert_at_cursor(NumInput *n, const char *buf, const int buf_len) diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h index 697fa915293..a5cf0b94c62 100644 --- a/source/blender/python/BPY_extern.h +++ b/source/blender/python/BPY_extern.h @@ -85,7 +85,7 @@ void BPY_app_handlers_reset(const short do_all); void BPY_driver_reset(void); float BPY_driver_exec(struct ChannelDriver *driver, const float evaltime); -int BPY_button_exec(struct bContext *C, const char *expr, double *value, const short verbose); +int BPY_button_exec(struct bContext *C, const char *expr, double *value, const bool verbose); int BPY_string_exec(struct bContext *C, const char *expr); void BPY_DECREF(void *pyob_ptr); /* Py_DECREF() */ diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 7a3d56dc56d..68816b728a7 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -580,7 +580,7 @@ void BPY_DECREF_RNA_INVALIDATE(void *pyob_ptr) /* return -1 on error, else 0 */ -int BPY_button_exec(bContext *C, const char *expr, double *value, const short verbose) +int BPY_button_exec(bContext *C, const char *expr, double *value, const bool verbose) { PyGILState_STATE gilstate; PyObject *py_dict, *mod, *retval; -- cgit v1.2.3