diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 9c472ed64c6..8c49ce22dea 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -1092,7 +1092,7 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa /* get derived mesh */ dm_mask = CD_MASK_BAREMESH; if (flag & DUPLILIST_FOR_RENDER) - dm_mask |= CD_MASK_ORCO|CD_MASK_MLOOPUV; + dm_mask |= CD_MASK_ORCO | CD_MASK_MLOOPUV; if (em) { dm = editbmesh_get_derived_cage(scene, par, em, dm_mask); diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 08c3796b47b..8cee97ee930 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -1050,6 +1050,7 @@ ID *BKE_libblock_find_name(const short type, const char *name) /* type: "OB return BLI_findstring(lb, name, offsetof(ID, name) + 2); } +#if 0 /* UNUSED */ static void get_flags_for_id(ID *id, char *buf) { int isfake = id->flag & LIB_FAKEUSER; @@ -1130,7 +1131,6 @@ static void IDnames_to_dyn_pupstring(DynStr *pupds, ListBase *lb, ID *link, shor } } -#if 0 /* unused */ /* used by headerbuttons.c buttons.c editobject.c editseq.c */ /* if (nr == NULL) no MAX_IDPUP, this for non-header browsing */ void IDnames_to_pupstring(const char **str, const char *title, const char *extraops, ListBase *lb, ID *link, short *nr) diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 20e867b5c98..7e1bd2b9eb6 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -280,7 +280,6 @@ typedef enum { * Functions to draw various shapes, taking theme settings into account. * Used for code that draws its own UI style elements. */ -void uiEmboss(float x1, float y1, float x2, float y2, int sel); void uiRoundBox(float minx, float miny, float maxx, float maxy, float rad); void uiSetRoundBox(int type); int uiGetRoundBox(void); @@ -398,7 +397,7 @@ void uiFreeActiveButtons(const struct bContext *C, struct bScreen *screen); void uiBlockSetRegion(uiBlock *block, struct ARegion *region); -void uiBlockSetButLock(uiBlock *block, int val, const char *lockstr); +void uiBlockSetButLock(uiBlock *block, bool val, const char *lockstr); void uiBlockClearButLock(uiBlock *block); /* automatic aligning, horiz or verical */ @@ -448,7 +447,7 @@ void uiButSetDrawFlag(uiBut *but, int flag); void uiButClearDrawFlag(uiBut *but, int flag); /* special button case, only draw it when used actively, for outliner etc */ -int uiButActiveOnly(const struct bContext *C, struct ARegion *ar, uiBlock *block, uiBut *but); +bool uiButActiveOnly(const struct bContext *C, struct ARegion *ar, uiBlock *block, uiBut *but); void uiButExecute(const struct bContext *C, uiBut *but); @@ -621,7 +620,7 @@ void uiComposeLinks(uiBlock *block); uiBut *uiFindInlink(uiBlock *block, void *poin); /* use inside searchfunc to add items */ -int uiSearchItemAdd(uiSearchItems *items, const char *name, void *poin, int iconid); +bool uiSearchItemAdd(uiSearchItems *items, const char *name, void *poin, int iconid); /* bfunc gets search item *poin as arg2, or if NULL the old string */ void uiButSetSearchFunc(uiBut *but, uiButSearchFunc sfunc, void *arg1, uiButHandleFunc bfunc, void *active); /* height in pixels, it's using hardcoded values still */ @@ -770,20 +769,20 @@ void uiLayoutOperatorButs(const struct bContext *C, struct uiLayout *layout, str struct MenuType *uiButGetMenuType(uiBut *but); void uiLayoutSetOperatorContext(uiLayout *layout, int opcontext); -void uiLayoutSetActive(uiLayout *layout, int active); -void uiLayoutSetEnabled(uiLayout *layout, int enabled); -void uiLayoutSetRedAlert(uiLayout *layout, int redalert); -void uiLayoutSetAlignment(uiLayout *layout, int alignment); -void uiLayoutSetKeepAspect(uiLayout *layout, int keepaspect); +void uiLayoutSetActive(uiLayout *layout, bool active); +void uiLayoutSetEnabled(uiLayout *layout, bool enabled); +void uiLayoutSetRedAlert(uiLayout *layout, bool redalert); +void uiLayoutSetAlignment(uiLayout *layout, char alignment); +void uiLayoutSetKeepAspect(uiLayout *layout, bool keepaspect); void uiLayoutSetScaleX(uiLayout *layout, float scale); void uiLayoutSetScaleY(uiLayout *layout, float scale); int uiLayoutGetOperatorContext(uiLayout *layout); -int uiLayoutGetActive(uiLayout *layout); -int uiLayoutGetEnabled(uiLayout *layout); -int uiLayoutGetRedAlert(uiLayout *layout); +bool uiLayoutGetActive(uiLayout *layout); +bool uiLayoutGetEnabled(uiLayout *layout); +bool uiLayoutGetRedAlert(uiLayout *layout); int uiLayoutGetAlignment(uiLayout *layout); -int uiLayoutGetKeepAspect(uiLayout *layout); +bool uiLayoutGetKeepAspect(uiLayout *layout); int uiLayoutGetWidth(uiLayout *layout); float uiLayoutGetScaleX(uiLayout *layout); float uiLayoutGetScaleY(uiLayout *layout); @@ -920,7 +919,7 @@ uiStyle *UI_GetStyleDraw(void); /* DPI scaled settings for drawing */ void UI_template_fix_linking(void); /* UI_OT_editsource helpers */ -int UI_editsource_enable_check(void); +bool UI_editsource_enable_check(void); void UI_editsource_active_but_test(uiBut *but); #endif /* __UI_INTERFACE_H__ */ diff --git a/source/blender/editors/include/UI_interface_icons.h b/source/blender/editors/include/UI_interface_icons.h index 10026bbd50f..6104505ef58 100644 --- a/source/blender/editors/include/UI_interface_icons.h +++ b/source/blender/editors/include/UI_interface_icons.h @@ -79,6 +79,6 @@ int UI_iconfile_get_index(const char *filename); struct PreviewImage *UI_icon_to_preview(int icon_id); -int UI_rnaptr_icon_get(struct bContext *C, struct PointerRNA *ptr, int rnaicon, int big); +int UI_rnaptr_icon_get(struct bContext *C, struct PointerRNA *ptr, int rnaicon, const bool big); #endif /* __UI_INTERFACE_ICONS_H__ */ diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index be51651dee7..0c484a82778 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -549,22 +549,22 @@ static void ui_draw_links(uiBlock *block) /* ************** BLOCK ENDING FUNCTION ************* */ /* NOTE: if but->poin is allocated memory for every defbut, things fail... */ -static int ui_but_equals_old(uiBut *but, uiBut *oldbut) +static bool ui_but_equals_old(uiBut *but, uiBut *oldbut) { /* various properties are being compared here, hopefully sufficient * to catch all cases, but it is simple to add more checks later */ - if (but->retval != oldbut->retval) return 0; - if (but->rnapoin.data != oldbut->rnapoin.data) return 0; + if (but->retval != oldbut->retval) return false; + if (but->rnapoin.data != oldbut->rnapoin.data) return false; if (but->rnaprop != oldbut->rnaprop) - if (but->rnaindex != oldbut->rnaindex) return 0; - if (but->func != oldbut->func) return 0; - if (but->funcN != oldbut->funcN) return 0; - if (oldbut->func_arg1 != oldbut && but->func_arg1 != oldbut->func_arg1) return 0; - if (oldbut->func_arg2 != oldbut && but->func_arg2 != oldbut->func_arg2) return 0; - if (!but->funcN && ((but->poin != oldbut->poin && (uiBut *)oldbut->poin != oldbut) || but->pointype != oldbut->pointype)) return 0; - if (but->optype != oldbut->optype) return 0; + if (but->rnaindex != oldbut->rnaindex) return false; + if (but->func != oldbut->func) return false; + if (but->funcN != oldbut->funcN) return false; + if (oldbut->func_arg1 != oldbut && but->func_arg1 != oldbut->func_arg1) return false; + if (oldbut->func_arg2 != oldbut && but->func_arg2 != oldbut->func_arg2) return false; + if (!but->funcN && ((but->poin != oldbut->poin && (uiBut *)oldbut->poin != oldbut) || but->pointype != oldbut->pointype)) return false; + if (but->optype != oldbut->optype) return false; - return 1; + return true; } /* oldbut is being inserted in new block, so we use the lines from new button, and replace button pointers */ @@ -682,37 +682,38 @@ static int ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBut /* needed for temporarily rename buttons, such as in outliner or file-select, * they should keep calling uiDefButs to keep them alive */ /* returns 0 when button removed */ -int uiButActiveOnly(const bContext *C, ARegion *ar, uiBlock *block, uiBut *but) +bool uiButActiveOnly(const bContext *C, ARegion *ar, uiBlock *block, uiBut *but) { uiBlock *oldblock; uiBut *oldbut; - int activate = FALSE, found = FALSE, isactive = FALSE; + bool activate = false, found = false, isactive = false; oldblock = block->oldblock; - if (!oldblock) - activate = TRUE; + if (!oldblock) { + activate = true; + } else { for (oldbut = oldblock->buttons.first; oldbut; oldbut = oldbut->next) { if (ui_but_equals_old(oldbut, but)) { - found = TRUE; + found = true; if (oldbut->active) - isactive = TRUE; + isactive = true; break; } } } - if ((activate == TRUE) || (found == FALSE)) { + if ((activate == true) || (found == false)) { ui_button_activate_do((bContext *)C, ar, but); } - else if ((found == TRUE) && (isactive == FALSE)) { + else if ((found == true) && (isactive == false)) { BLI_remlink(&block->buttons, but); ui_free_but(C, but); - return 0; + return false; } - return 1; + return true; } /* simulate button click */ @@ -1243,17 +1244,17 @@ void uiComposeLinks(uiBlock *block) /* ************************************************ */ -void uiBlockSetButLock(uiBlock *block, int val, const char *lockstr) +void uiBlockSetButLock(uiBlock *block, bool val, const char *lockstr) { if (val) { - block->lock = val ? TRUE : FALSE; + block->lock = val; block->lockstr = lockstr; } } void uiBlockClearButLock(uiBlock *block) { - block->lock = FALSE; + block->lock = false; block->lockstr = NULL; } @@ -1392,63 +1393,63 @@ void ui_set_but_vectorf(uiBut *but, const float vec[3]) } } -int ui_is_but_float(uiBut *but) +bool ui_is_but_float(uiBut *but) { if (but->pointype == UI_BUT_POIN_FLOAT && but->poin) - return 1; + return true; if (but->rnaprop && RNA_property_type(but->rnaprop) == PROP_FLOAT) - return 1; + return true; - return 0; + return false; } -int ui_is_but_bool(uiBut *but) +bool ui_is_but_bool(uiBut *but) { if (ELEM5(but->type, TOG, TOGN, TOGR, ICONTOG, ICONTOGN)) - return 1; + return true; if (but->rnaprop && RNA_property_type(but->rnaprop) == PROP_BOOLEAN) - return 1; + return true; - return 0; + return false; } -int ui_is_but_unit(uiBut *but) +bool ui_is_but_unit(uiBut *but) { UnitSettings *unit = but->block->unit; const int unit_type = uiButGetUnitType(but); if (unit_type == PROP_UNIT_NONE) - return 0; + return false; #if 1 /* removed so angle buttons get correct snapping */ if (unit->system_rotation == USER_UNIT_ROT_RADIANS && unit_type == PROP_UNIT_ROTATION) - return 0; + return false; #endif /* for now disable time unit conversion */ if (unit_type == PROP_UNIT_TIME) - return 0; + return false; if (unit->system == USER_UNIT_NONE) { if (unit_type != PROP_UNIT_ROTATION) { - return 0; + return false; } } - return 1; + return true; } -int ui_is_but_rna_valid(uiBut *but) +bool ui_is_but_rna_valid(uiBut *but) { if (but->rnaprop == NULL || RNA_struct_contains_property(&but->rnapoin, but->rnaprop)) { - return TRUE; + return true; } else { printf("property removed %s: %p\n", but->drawstr, but->rnaprop); - return FALSE; + return false; } } @@ -1789,7 +1790,7 @@ void ui_get_but_string(uiBut *but, char *str, const size_t maxlen) #ifdef WITH_PYTHON -static int ui_set_but_string_eval_num_unit(bContext *C, uiBut *but, const char *str, double *value) +static bool ui_set_but_string_eval_num_unit(bContext *C, uiBut *but, const char *str, double *value) { char str_unit_convert[256]; const int unit_type = uiButGetUnitType(but); @@ -1807,9 +1808,9 @@ static int ui_set_but_string_eval_num_unit(bContext *C, uiBut *but, const char * #endif /* WITH_PYTHON */ -int ui_set_but_string_eval_num(bContext *C, uiBut *but, const char *str, double *value) +bool ui_set_but_string_eval_num(bContext *C, uiBut *but, const char *str, double *value) { - int ok = FALSE; + bool ok = false; #ifdef WITH_PYTHON @@ -1825,7 +1826,7 @@ int ui_set_but_string_eval_num(bContext *C, uiBut *but, const char *str, double ok = ui_set_but_string_eval_num_unit(C, but, str_new, value); } else { - ok = TRUE; /* parse normal string via py (no unit conversion needed) */ + ok = true; /* parse normal string via py (no unit conversion needed) */ } } else if (is_unit_but) { @@ -1848,7 +1849,7 @@ int ui_set_but_string_eval_num(bContext *C, uiBut *but, const char *str, double } -int ui_set_but_string(bContext *C, uiBut *but, const char *str) +bool ui_set_but_string(bContext *C, uiBut *but, const char *str) { if (but->rnaprop && ELEM4(but->type, TEX, IDPOIN, SEARCH_MENU, SEARCH_MENU_UNLINK)) { if (RNA_property_editable(&but->rnapoin, but->rnaprop)) { @@ -1859,7 +1860,7 @@ int ui_set_but_string(bContext *C, uiBut *but, const char *str) if (type == PROP_STRING) { /* RNA string */ RNA_property_string_set(&but->rnapoin, but->rnaprop, str); - return 1; + return true; } else if (type == PROP_POINTER) { /* RNA pointer */ @@ -1868,7 +1869,7 @@ int ui_set_but_string(bContext *C, uiBut *but, const char *str) if (str == NULL || str[0] == '\0') { RNA_property_pointer_set(&but->rnapoin, but->rnaprop, PointerRNA_NULL); - return 1; + return true; } else { ptr = but->rnasearchpoin; @@ -1877,18 +1878,18 @@ int ui_set_but_string(bContext *C, uiBut *but, const char *str) if (prop && RNA_property_collection_lookup_string(&ptr, prop, str, &rptr)) RNA_property_pointer_set(&but->rnapoin, but->rnaprop, rptr); - return 1; + return true; } - return 0; + return false; } else if (type == PROP_ENUM) { int value; if (RNA_property_enum_value(but->block->evil_C, &but->rnapoin, but->rnaprop, str, &value)) { RNA_property_enum_set(&but->rnapoin, but->rnaprop, value); - return 1; + return true; } - return 0; + return false; } else { BLI_assert(0); @@ -1898,23 +1899,23 @@ int ui_set_but_string(bContext *C, uiBut *but, const char *str) else if (but->type == IDPOIN) { /* ID pointer */ but->idpoin_func(C, str, but->idpoin_idpp); - return 1; + return true; } else if (but->type == TEX) { /* string */ if (ui_is_but_utf8(but)) BLI_strncpy_utf8(but->poin, str, but->hardmax); else BLI_strncpy(but->poin, str, but->hardmax); - return 1; + return true; } else if (ELEM(but->type, SEARCH_MENU, SEARCH_MENU_UNLINK)) { /* string */ BLI_strncpy(but->poin, str, but->hardmax); - return 1; + return true; } else if (ui_but_anim_expression_set(but, str)) { /* driver expression */ - return 1; + return true; } else if (str[0] == '#') { /* shortcut to create new driver expression (versus immediate Py-execution) */ @@ -1924,8 +1925,8 @@ int ui_set_but_string(bContext *C, uiBut *but, const char *str) /* number editing */ double value; - if (ui_set_but_string_eval_num(C, but, str, &value) == FALSE) { - return 0; + if (ui_set_but_string_eval_num(C, but, str, &value) == false) { + return false; } if (!ui_is_but_float(but)) value = (int)floor(value + 0.5); @@ -1936,10 +1937,10 @@ int ui_set_but_string(bContext *C, uiBut *but, const char *str) if (value > (double)but->hardmax) value = but->hardmax; ui_set_but_val(but, value); - return 1; + return true; } - return 0; + return false; } void ui_set_but_default(bContext *C, short all) @@ -2464,15 +2465,14 @@ void uiBlockBeginAlign(uiBlock *block) /* buttons declared after this call will get this align nr */ // XXX flag? } -static int buts_are_horiz(uiBut *but1, uiBut *but2) +static bool buts_are_horiz(uiBut *but1, uiBut *but2) { float dx, dy; dx = fabs(but1->rect.xmax - but2->rect.xmin); dy = fabs(but1->rect.ymin - but2->rect.ymax); - if (dx > dy) return 0; - return 1; + return (dx <= dy); } void uiBlockEndAlign(uiBlock *block) diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index c0f1ed28b3f..cd2a2161315 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -393,32 +393,6 @@ void uiRoundBox(float minx, float miny, float maxx, float maxy, float rad) ui_draw_anti_roundbox(GL_POLYGON, minx, miny, maxx, maxy, rad, roundboxtype & UI_RB_ALPHA); } - -/* ************** generic embossed rect, for window sliders etc ************* */ - - -/* text_draw.c uses this */ -void uiEmboss(float x1, float y1, float x2, float y2, int sel) -{ - - /* below */ - if (sel) glColor3ub(200, 200, 200); - else glColor3ub(50, 50, 50); - fdrawline(x1, y1, x2, y1); - - /* right */ - fdrawline(x2, y1, x2, y2); - - /* top */ - if (sel) glColor3ub(50, 50, 50); - else glColor3ub(200, 200, 200); - fdrawline(x1, y2, x2, y2); - - /* left */ - fdrawline(x1, y1, x1, y2); - -} - /* ************** SPECIAL BUTTON DRAWING FUNCTIONS ************* */ void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect) diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 6d30db9c4d6..a644feca080 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -215,8 +215,8 @@ typedef struct uiAfterFunc { int autokey; } uiAfterFunc; -static int ui_but_contains_pt(uiBut *but, int mx, int my); -static int ui_mouse_inside_button(ARegion *ar, uiBut *but, int x, int y); +static bool ui_but_contains_pt(uiBut *but, int mx, int my); +static bool ui_mouse_inside_button(ARegion *ar, uiBut *but, int x, int y); static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState state); static int ui_handler_region_menu(bContext *C, const wmEvent *event, void *userdata); static void ui_handle_button_activate(bContext *C, ARegion *ar, uiBut *but, uiButtonActivateType type); @@ -333,7 +333,7 @@ static void ui_mouse_scale_warp(uiHandleButtonData *data, } /* file selectors are exempt from utf-8 checks */ -int ui_is_but_utf8(uiBut *but) +bool ui_is_but_utf8(uiBut *but) { if (but->rnaprop) { const int subtype = RNA_property_subtype(but->rnaprop); @@ -5507,7 +5507,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent * /* ************************ button utilities *********************** */ -static int ui_but_contains_pt(uiBut *but, int mx, int my) +static bool ui_but_contains_pt(uiBut *but, int mx, int my) { return BLI_rctf_isect_pt(&but->rect, mx, my); } @@ -5525,7 +5525,7 @@ static uiBut *ui_but_find_activated(ARegion *ar) return NULL; } -int ui_button_is_active(ARegion *ar) +bool ui_button_is_active(ARegion *ar) { return (ui_but_find_activated(ar) != NULL); } @@ -5580,7 +5580,7 @@ static void ui_blocks_set_tooltips(ARegion *ar, int enable) block->tooltipdisabled = !enable; } -static int ui_mouse_inside_region(ARegion *ar, int x, int y) +static bool ui_mouse_inside_region(ARegion *ar, int x, int y) { uiBlock *block; @@ -5589,7 +5589,7 @@ static int ui_mouse_inside_region(ARegion *ar, int x, int y) for (block = ar->uiblocks.first; block; block = block->next) block->auto_open = FALSE; - return 0; + return false; } /* also, check that with view2d, that the mouse is not over the scrollbars @@ -5608,23 +5608,23 @@ static int ui_mouse_inside_region(ARegion *ar, int x, int y) /* check if in the rect */ if (!BLI_rcti_isect_pt(&v2d->mask, mx, my)) - return 0; + return false; } - return 1; + return true; } -static int ui_mouse_inside_button(ARegion *ar, uiBut *but, int x, int y) +static bool ui_mouse_inside_button(ARegion *ar, uiBut *but, int x, int y) { if (!ui_mouse_inside_region(ar, x, y)) - return 0; + return false; ui_window_to_block(ar, but->block, &x, &y); if (!ui_but_contains_pt(but, x, y)) - return 0; + return false; - return 1; + return true; } /** diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 09686d7b416..52710a62855 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -1164,7 +1164,7 @@ static void ui_id_preview_image_render_size(bContext *C, ID *id, PreviewImage *p } } -static void ui_id_icon_render(bContext *C, ID *id, int big) +static void ui_id_icon_render(bContext *C, ID *id, const bool big) { PreviewImage *pi = BKE_previewimg_get(id); @@ -1248,7 +1248,7 @@ static int ui_id_brush_get_icon(bContext *C, ID *id) return id->icon_id; } -int ui_id_icon_get(bContext *C, ID *id, int big) +int ui_id_icon_get(bContext *C, ID *id, const bool big) { int iconid = 0; @@ -1273,7 +1273,7 @@ int ui_id_icon_get(bContext *C, ID *id, int big) return iconid; } -int UI_rnaptr_icon_get(bContext *C, PointerRNA *ptr, int rnaicon, int big) +int UI_rnaptr_icon_get(bContext *C, PointerRNA *ptr, int rnaicon, const bool big) { ID *id = NULL; diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index e7b659f99fc..41ceeb141c9 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -391,18 +391,18 @@ extern void ui_hsvcircle_vals_from_pos(float *val_rad, float *val_dist, const rc extern void ui_get_but_string_ex(uiBut *but, char *str, const size_t maxlen, const int float_precision); extern void ui_get_but_string(uiBut *but, char *str, const size_t maxlen); extern void ui_convert_to_unit_alt_name(uiBut *but, char *str, size_t maxlen); -extern int ui_set_but_string(struct bContext *C, uiBut *but, const char *str); -extern int ui_get_but_string_max_length(uiBut *but); -extern int ui_set_but_string_eval_num(struct bContext *C, uiBut *but, const char *str, double *value); +extern bool ui_set_but_string(struct bContext *C, uiBut *but, const char *str); +extern bool ui_set_but_string_eval_num(struct bContext *C, uiBut *but, const char *str, double *value); +extern int ui_get_but_string_max_length(uiBut *but); extern void ui_set_but_default(struct bContext *C, short all); extern void ui_check_but(uiBut *but); -extern int ui_is_but_float(uiBut *but); -extern int ui_is_but_bool(uiBut *but); -extern int ui_is_but_unit(uiBut *but); -extern int ui_is_but_rna_valid(uiBut *but); -extern int ui_is_but_utf8(uiBut *but); +extern bool ui_is_but_float(uiBut *but); +extern bool ui_is_but_bool(uiBut *but); +extern bool ui_is_but_unit(uiBut *but); +extern bool ui_is_but_rna_valid(uiBut *but); +extern bool ui_is_but_utf8(uiBut *but); extern bool ui_is_but_interactive(uiBut *but); extern int ui_is_but_push_ex(uiBut *but, double *value); @@ -464,7 +464,7 @@ void ui_popup_block_scrolltest(struct uiBlock *block); /* searchbox for string button */ ARegion *ui_searchbox_create(struct bContext *C, struct ARegion *butregion, uiBut *but); -int ui_searchbox_inside(struct ARegion *ar, int x, int y); +bool ui_searchbox_inside(struct ARegion *ar, int x, int y); void ui_searchbox_update(struct bContext *C, struct ARegion *ar, uiBut *but, int reset); void ui_searchbox_autocomplete(struct bContext *C, struct ARegion *ar, uiBut *but, char *str); void ui_searchbox_event(struct bContext *C, struct ARegion *ar, uiBut *but, const struct wmEvent *event); @@ -511,7 +511,7 @@ extern void ui_pan_to_scroll(const struct wmEvent *event, int *type, int *val); extern void ui_button_activate_do(struct bContext *C, struct ARegion *ar, uiBut *but); extern void ui_button_execute_do(struct bContext *C, struct ARegion *ar, uiBut *but); extern void ui_button_active_free(const struct bContext *C, uiBut *but); -extern int ui_button_is_active(struct ARegion *ar); +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); @@ -544,7 +544,7 @@ extern unsigned char checker_stipple_sml[32 * 32 / 8]; void uiStyleInit(void); /* interface_icons.c */ -int ui_id_icon_get(struct bContext *C, struct ID *id, int preview); +int ui_id_icon_get(struct bContext *C, struct ID *id, const bool big); /* resources.c */ void init_userdef_do_versions(void); diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 53887163778..4b1b96f7975 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -140,11 +140,11 @@ struct uiLayout { int x, y, w, h; float scale[2]; short space; - char align; - char active; - char enabled; - char redalert; - char keepaspect; + bool align; + bool active; + bool enabled; + bool redalert; + bool keepaspect; char alignment; }; @@ -1333,7 +1333,7 @@ static void rna_search_cb(const struct bContext *C, void *arg_but, const char *s BLI_strncpy(name_ui, id->name + 2, sizeof(name_ui)); #endif name = BLI_strdup(name_ui); - iconid = ui_id_icon_get((bContext *)C, id, 0); + iconid = ui_id_icon_get((bContext *)C, id, false); } else { name = RNA_struct_name_get_alloc(&itemptr, NULL, 0, NULL); /* could use the string length here */ @@ -1359,7 +1359,7 @@ static void rna_search_cb(const struct bContext *C, void *arg_but, const char *s /* add search items from temporary list */ for (cis = items_list->first; cis; cis = cis->next) { - if (!uiSearchItemAdd(items, cis->name, SET_INT_IN_POINTER(cis->index), cis->iconid)) { + if (false == uiSearchItemAdd(items, cis->name, SET_INT_IN_POINTER(cis->index), cis->iconid)) { break; } } @@ -2267,8 +2267,8 @@ uiLayout *uiLayoutRow(uiLayout *layout, int align) litem->item.type = ITEM_LAYOUT_ROW; litem->root = layout->root; litem->align = align; - litem->active = 1; - litem->enabled = 1; + litem->active = true; + litem->enabled = true; litem->context = layout->context; litem->space = (align) ? 0 : layout->root->style->buttonspacex; litem->redalert = layout->redalert; @@ -2288,8 +2288,8 @@ uiLayout *uiLayoutColumn(uiLayout *layout, int align) litem->item.type = ITEM_LAYOUT_COLUMN; litem->root = layout->root; litem->align = align; - litem->active = 1; - litem->enabled = 1; + litem->active = true; + litem->enabled = true; litem->context = layout->context; litem->space = (litem->align) ? 0 : layout->root->style->buttonspacey; litem->redalert = layout->redalert; @@ -2309,8 +2309,8 @@ uiLayout *uiLayoutColumnFlow(uiLayout *layout, int number, int align) flow->litem.item.type = ITEM_LAYOUT_COLUMN_FLOW; flow->litem.root = layout->root; flow->litem.align = align; - flow->litem.active = 1; - flow->litem.enabled = 1; + flow->litem.active = true; + flow->litem.enabled = true; flow->litem.context = layout->context; flow->litem.space = (flow->litem.align) ? 0 : layout->root->style->columnspace; flow->litem.redalert = layout->redalert; @@ -2402,8 +2402,8 @@ uiLayout *uiLayoutOverlap(uiLayout *layout) litem = MEM_callocN(sizeof(uiLayout), "uiLayoutOverlap"); litem->item.type = ITEM_LAYOUT_OVERLAP; litem->root = layout->root; - litem->active = 1; - litem->enabled = 1; + litem->active = true; + litem->enabled = true; litem->context = layout->context; litem->redalert = layout->redalert; BLI_addtail(&layout->items, litem); @@ -2421,8 +2421,8 @@ uiLayout *uiLayoutSplit(uiLayout *layout, float percentage, int align) split->litem.item.type = ITEM_LAYOUT_SPLIT; split->litem.root = layout->root; split->litem.align = align; - split->litem.active = 1; - split->litem.enabled = 1; + split->litem.active = true; + split->litem.enabled = true; split->litem.context = layout->context; split->litem.space = layout->root->style->columnspace; split->litem.redalert = layout->redalert; @@ -2435,27 +2435,27 @@ uiLayout *uiLayoutSplit(uiLayout *layout, float percentage, int align) return &split->litem; } -void uiLayoutSetActive(uiLayout *layout, int active) +void uiLayoutSetActive(uiLayout *layout, bool active) { layout->active = active; } -void uiLayoutSetEnabled(uiLayout *layout, int enabled) +void uiLayoutSetEnabled(uiLayout *layout, bool enabled) { layout->enabled = enabled; } -void uiLayoutSetRedAlert(uiLayout *layout, int redalert) +void uiLayoutSetRedAlert(uiLayout *layout, bool redalert) { layout->redalert = redalert; } -void uiLayoutSetKeepAspect(uiLayout *layout, int keepaspect) +void uiLayoutSetKeepAspect(uiLayout *layout, bool keepaspect) { layout->keepaspect = keepaspect; } -void uiLayoutSetAlignment(uiLayout *layout, int alignment) +void uiLayoutSetAlignment(uiLayout *layout, char alignment) { layout->alignment = alignment; } @@ -2470,22 +2470,22 @@ void uiLayoutSetScaleY(uiLayout *layout, float scale) layout->scale[1] = scale; } -int uiLayoutGetActive(uiLayout *layout) +bool uiLayoutGetActive(uiLayout *layout) { return layout->active; } -int uiLayoutGetEnabled(uiLayout *layout) +bool uiLayoutGetEnabled(uiLayout *layout) { return layout->enabled; } -int uiLayoutGetRedAlert(uiLayout *layout) +bool uiLayoutGetRedAlert(uiLayout *layout) { return layout->redalert; } -int uiLayoutGetKeepAspect(uiLayout *layout) +bool uiLayoutGetKeepAspect(uiLayout *layout) { return layout->keepaspect; } @@ -2937,7 +2937,7 @@ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op, /* poll() on this operator may still fail, at the moment there is no nice feedback when this happens * just fails silently */ if (!WM_operator_repeat_check(C, op)) { - uiBlockSetButLock(uiLayoutGetBlock(layout), TRUE, "Operator can't' redo"); + uiBlockSetButLock(uiLayoutGetBlock(layout), true, "Operator can't' redo"); /* XXX, could give some nicer feedback or not show redo panel at all? */ uiItemL(layout, IFACE_("* Redo Unsupported *"), ICON_NONE); diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 145deb35667..52a26f4f528 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -716,7 +716,7 @@ struct uiEditSourceButStore { /* should only ever be set while the edit source operator is running */ static struct uiEditSourceStore *ui_editsource_info = NULL; -int UI_editsource_enable_check(void) +bool UI_editsource_enable_check(void) { return (ui_editsource_info != NULL); } diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index febd1820e5c..8d7edf1b044 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -514,7 +514,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) opptr = uiButGetOperatorPtrRNA(but); /* allocated when needed, the button owns it */ /* so the context is passed to itemf functions (some py itemf functions use it) */ - WM_operator_properties_sanitize(opptr, FALSE); + WM_operator_properties_sanitize(opptr, false); str = WM_operator_pystring(C, but->optype, opptr, 0); @@ -751,12 +751,12 @@ typedef struct uiSearchboxData { /* exported for use by search callbacks */ /* returns zero if nothing to add */ -int uiSearchItemAdd(uiSearchItems *items, const char *name, void *poin, int iconid) +bool uiSearchItemAdd(uiSearchItems *items, const char *name, void *poin, int iconid) { /* hijack for autocomplete */ if (items->autocpl) { autocomplete_do_name(items->autocpl, name); - return 1; + return true; } /* hijack for finding active item */ @@ -764,18 +764,18 @@ int uiSearchItemAdd(uiSearchItems *items, const char *name, void *poin, int icon if (poin == items->active) items->offset_i = items->totitem; items->totitem++; - return 1; + return true; } if (items->totitem >= items->maxitem) { items->more = 1; - return 0; + return false; } /* skip first items in list */ if (items->offset_i > 0) { items->offset_i--; - return 1; + return true; } if (items->names) @@ -787,7 +787,7 @@ int uiSearchItemAdd(uiSearchItems *items, const char *name, void *poin, int icon items->totitem++; - return 1; + return true; } int uiSearchBoxHeight(void) @@ -867,11 +867,11 @@ static void ui_searchbox_butrect(rcti *rect, uiSearchboxData *data, int itemnr) } /* x and y in screencoords */ -int ui_searchbox_inside(ARegion *ar, int x, int y) +bool ui_searchbox_inside(ARegion *ar, int x, int y) { uiSearchboxData *data = ar->regiondata; - return(BLI_rcti_isect_pt(&data->bbox, x - ar->winrct.xmin, y - ar->winrct.ymin)); + return BLI_rcti_isect_pt(&data->bbox, x - ar->winrct.xmin, y - ar->winrct.ymin); } /* string validated to be of correct length (but->hardmax) */ @@ -2236,7 +2236,7 @@ uiBlock *ui_block_func_COLOR(bContext *C, uiPopupBlockHandle *handle, void *arg_ { uiBut *but = arg_but; uiBlock *block; - int show_picker = TRUE; + bool show_picker = true; block = uiBeginBlock(C, handle->region, __func__, UI_EMBOSS); @@ -2703,7 +2703,7 @@ void uiPupMenuInvoke(bContext *C, const char *idname) uiPopupMenu *pup; uiLayout *layout; Menu menu; - MenuType *mt = WM_menutype_find(idname, TRUE); + MenuType *mt = WM_menutype_find(idname, true); if (mt == NULL) { printf("%s: named menu \"%s\" not found\n", __func__, idname); diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 7d8be7ae9c9..84811dc8366 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -106,7 +106,7 @@ typedef struct TemplateID { ListBase *idlb; int prv_rows, prv_cols; - int preview; + bool preview; } TemplateID; /* Search browse menu, assign */ @@ -156,7 +156,7 @@ static void id_search_cb(const bContext *C, void *arg_template, const char *str, iconid = ui_id_icon_get((bContext *)C, id, template->preview); - if (!uiSearchItemAdd(items, name_ui, id, iconid)) + if (false == uiSearchItemAdd(items, name_ui, id, iconid)) break; } } @@ -411,13 +411,13 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str type = idptr.type; if (flag & UI_ID_PREVIEWS) { - template->preview = TRUE; + template->preview = true; but = uiDefBlockButN(block, id_search_menu, MEM_dupallocN(template), "", 0, 0, UI_UNIT_X * 6, UI_UNIT_Y * 6, TIP_(template_id_browse_tip(type))); if (type) { but->icon = RNA_struct_ui_icon(type); - if (id) but->icon = ui_id_icon_get(C, id, 1); + if (id) but->icon = ui_id_icon_get(C, id, true); uiButSetFlag(but, UI_HAS_ICON | UI_ICON_PREVIEW); } if ((idfrom && idfrom->lib) || !editable) @@ -1214,7 +1214,7 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con) /* Set but-locks for protected settings (magic numbers are used here!) */ if (proxy_protected) - uiBlockSetButLock(block, 1, IFACE_("Cannot edit Proxy-Protected Constraint")); + uiBlockSetButLock(block, true, IFACE_("Cannot edit Proxy-Protected Constraint")); /* Draw constraint data */ if ((con->flag & CONSTRAINT_EXPAND) == 0) { @@ -2628,7 +2628,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co sub = uiLayoutRow(overlap, FALSE); - icon = UI_rnaptr_icon_get(C, &itemptr, rnaicon, FALSE); + icon = UI_rnaptr_icon_get(C, &itemptr, rnaicon, false); if (icon == ICON_DOT) icon = ICON_NONE; draw_item(ui_list, C, sub, dataptr, &itemptr, icon, active_dataptr, active_propname, i); @@ -2662,7 +2662,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co found = (activei == i); if (found) { - icon = UI_rnaptr_icon_get(C, &itemptr, rnaicon, FALSE); + icon = UI_rnaptr_icon_get(C, &itemptr, rnaicon, false); if (icon == ICON_DOT) icon = ICON_NONE; draw_item(ui_list, C, row, dataptr, &itemptr, icon, active_dataptr, active_propname, i); @@ -2709,7 +2709,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co sub = uiLayoutRow(overlap, FALSE); - icon = UI_rnaptr_icon_get(C, &itemptr, rnaicon, FALSE); + icon = UI_rnaptr_icon_get(C, &itemptr, rnaicon, false); draw_item(ui_list, C, sub, dataptr, &itemptr, icon, active_dataptr, active_propname, i); i++; @@ -2757,7 +2757,7 @@ static void operator_search_cb(const bContext *C, void *UNUSED(arg), const char } } - if (0 == uiSearchItemAdd(items, name, ot, 0)) + if (false == uiSearchItemAdd(items, name, ot, 0)) break; } } diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 601c86b3029..4a0665d663e 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -538,7 +538,7 @@ void file_draw_list(const bContext *C, ARegion *ar) uiButSetRenameFunc(but, renamebutton_cb, file); uiButSetFlag(but, UI_BUT_NO_UTF8); /* allow non utf8 names */ uiButClearFlag(but, UI_BUT_UNDO); - if (0 == uiButActiveOnly(C, ar, block, but)) { + if (false == uiButActiveOnly(C, ar, block, but)) { file->selflag &= ~EDITING_FILE; } } diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 5faafe7bdce..25b2180dbb1 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -2005,7 +2005,7 @@ static int node_clipboard_paste_exec(bContext *C, wmOperator *op) for (node = clipboard_nodes_lb->first; node; node = node->next) { if (!node->typeinfo->poll_instance(node, ntree)) { all_nodes_valid = FALSE; - BKE_reportf(op->reports, RPT_ERROR, "Cannot add node %s into node tree %s", node->name, ntree->id.name+2); + BKE_reportf(op->reports, RPT_ERROR, "Cannot add node %s into node tree %s", node->name, ntree->id.name + 2); } } if (!all_nodes_valid) diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c index 002d2197ce8..366fcce3dd5 100644 --- a/source/blender/editors/space_node/node_select.c +++ b/source/blender/editors/space_node/node_select.c @@ -875,7 +875,7 @@ static void node_find_cb(const struct bContext *C, void *UNUSED(arg), const char BLI_snprintf(name, 256, "%s (%s)", node->name, node->label); else BLI_strncpy(name, node->name, 256); - if (0 == uiSearchItemAdd(items, name, node, 0)) + if (false == uiSearchItemAdd(items, name, node, 0)) break; } } diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 418d4ff04a4..d22ea674668 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -754,7 +754,7 @@ static void operator_search_cb(const struct bContext *UNUSED(C), void *UNUSED(ar /* display name for menu */ WM_operator_py_idname(name, ot->idname); - if (0 == uiSearchItemAdd(items, name, ot, 0)) + if (false == uiSearchItemAdd(items, name, ot, 0)) break; } } @@ -1043,8 +1043,9 @@ static void outliner_buttons(const bContext *C, uiBlock *block, ARegion *ar, Spa uiButSetRenameFunc(bt, namebutton_cb, tselem); /* returns false if button got removed */ - if (0 == uiButActiveOnly(C, ar, block, bt) ) + if (false == uiButActiveOnly(C, ar, block, bt)) { tselem->flag &= ~TSE_TEXTBUT; + } } } diff --git a/source/blender/editors/space_view3d/view3d_ruler.c b/source/blender/editors/space_view3d/view3d_ruler.c index b5b64cef850..ad3f941bd17 100644 --- a/source/blender/editors/space_view3d/view3d_ruler.c +++ b/source/blender/editors/space_view3d/view3d_ruler.c @@ -890,7 +890,8 @@ static int view3d_ruler_modal(bContext *C, wmOperator *op, const wmEvent *event) { if (ruler_info->state == RULER_STATE_DRAG) { if (view3d_ruler_item_mousemove(C, ruler_info, event->mval, - event->shift != 0, event->ctrl != 0)) { + event->shift != 0, event->ctrl != 0)) + { do_draw = true; } } diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c index 603d9a1595c..d30c1699d65 100644 --- a/source/blender/editors/space_view3d/view3d_toolbar.c +++ b/source/blender/editors/space_view3d/view3d_toolbar.c @@ -162,7 +162,7 @@ static void operator_search_cb(const struct bContext *C, void *UNUSED(arg), cons if (BLI_strcasestr(ot->name, str)) { if (WM_operator_poll((bContext *)C, ot)) { - if (0 == uiSearchItemAdd(items, ot->name, ot, 0)) + if (false == uiSearchItemAdd(items, ot->name, ot, 0)) break; } } diff --git a/source/blender/imbuf/IMB_colormanagement.h b/source/blender/imbuf/IMB_colormanagement.h index 203d01cab67..58b55b0f137 100644 --- a/source/blender/imbuf/IMB_colormanagement.h +++ b/source/blender/imbuf/IMB_colormanagement.h @@ -28,8 +28,8 @@ * */ -#ifndef IMB_COLORMANAGEMENT_H -#define IMB_COLORMANAGEMENT_H +#ifndef __IMB_COLORMANAGEMENT_H__ +#define __IMB_COLORMANAGEMENT_H__ #define BCM_CONFIG_FILE "config.ocio" @@ -181,4 +181,4 @@ enum { COLOR_ROLE_DEFAULT_FLOAT, }; -#endif /* IMB_COLORMANAGEMENT_H */ +#endif /* __IMB_COLORMANAGEMENT_H__ */ diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c index 1e6fac4f4f0..a74f28e79c9 100644 --- a/source/blender/imbuf/intern/colormanagement.c +++ b/source/blender/imbuf/intern/colormanagement.c @@ -2808,7 +2808,7 @@ int IMB_colormanagement_setup_glsl_draw_from_space(const ColorManagedViewSetting /* Configures GLSL shader for conversion from scene linear to display space */ int IMB_colormanagement_setup_glsl_draw(const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, - int predivide) + int predivide) { return IMB_colormanagement_setup_glsl_draw_from_space(view_settings, display_settings, NULL, predivide); diff --git a/source/blender/imbuf/intern/divers.c b/source/blender/imbuf/intern/divers.c index 20d51fddb35..e69460de040 100644 --- a/source/blender/imbuf/intern/divers.c +++ b/source/blender/imbuf/intern/divers.c @@ -664,13 +664,13 @@ void IMB_float_from_rect(ImBuf *ibuf) /* no profile conversion */ void IMB_color_to_bw(ImBuf *ibuf) { - float *rctf = ibuf->rect_float; + float *rct_fl = ibuf->rect_float; uchar *rct = (uchar *)ibuf->rect; int i; - if (rctf) { - for (i = ibuf->x * ibuf->y; i > 0; i--, rctf += 4) - rctf[0] = rctf[1] = rctf[2] = rgb_to_grayscale(rctf); + if (rct_fl) { + for (i = ibuf->x * ibuf->y; i > 0; i--, rct_fl += 4) + rct_fl[0] = rct_fl[1] = rct_fl[2] = rgb_to_grayscale(rct_fl); } if (rct) { @@ -713,7 +713,7 @@ void IMB_saturation(ImBuf *ibuf, float sat) { int i; unsigned char *rct = (unsigned char *)ibuf->rect; - float *rctf = ibuf->rect_float; + float *rct_fl = ibuf->rect_float; float hsv[3]; if (rct) { @@ -726,10 +726,10 @@ void IMB_saturation(ImBuf *ibuf, float sat) } } - if (rctf) { - for (i = ibuf->x * ibuf->y; i > 0; i--, rctf += 4) { - rgb_to_hsv_v(rctf, hsv); - hsv_to_rgb(hsv[0], hsv[1] * sat, hsv[2], rctf, rctf + 1, rctf + 2); + if (rct_fl) { + for (i = ibuf->x * ibuf->y; i > 0; i--, rct_fl += 4) { + rgb_to_hsv_v(rct_fl, hsv); + hsv_to_rgb(hsv[0], hsv[1] * sat, hsv[2], rct_fl, rct_fl + 1, rct_fl + 2); } } } diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index b2f17bfed8b..9c354e7f70e 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -269,7 +269,7 @@ static void rna_uiTemplatePathBuilder(uiLayout *layout, PointerRNA *ptr, const c static int rna_ui_get_rnaptr_icon(bContext *C, PointerRNA *ptr_icon) { - return UI_rnaptr_icon_get(C, ptr_icon, RNA_struct_ui_icon(ptr_icon->type), FALSE); + return UI_rnaptr_icon_get(C, ptr_icon, RNA_struct_ui_icon(ptr_icon->type), false); } static const char *rna_ui_get_enum_name(bContext *C, PointerRNA *ptr, const char *propname, const char *identifier) diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 25c8c5db0a1..2af513cebe6 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -70,7 +70,7 @@ typedef struct wmJob wmJob; void WM_init_state_size_set (int stax, int stay, int sizx, int sizy); void WM_init_state_fullscreen_set(void); void WM_init_state_normal_set(void); -void WM_init_native_pixels(int do_it); +void WM_init_native_pixels(bool do_it); void WM_init (struct bContext *C, int argc, const char **argv); void WM_exit_ext (struct bContext *C, const short do_python); @@ -87,7 +87,7 @@ __attribute__((noreturn)) #endif ; -int WM_init_game (struct bContext *C); +bool WM_init_game (struct bContext *C); void WM_init_splash (struct bContext *C); @@ -106,7 +106,7 @@ int WM_window_pixels_y (struct wmWindow *win); void WM_window_open_temp (struct bContext *C, struct rcti *position, int type); /* returns true if draw method is triple buffer */ -int WM_is_draw_triple(struct wmWindow *win); +bool WM_is_draw_triple(struct wmWindow *win); @@ -118,7 +118,7 @@ void WM_autosave_init(struct wmWindowManager *wm); void WM_cursor_set (struct wmWindow *win, int curs); void WM_cursor_modal (struct wmWindow *win, int curs); void WM_cursor_restore (struct wmWindow *win); -void WM_cursor_wait (int val); +void WM_cursor_wait (bool val); void WM_cursor_grab_enable(struct wmWindow *win, int wrap, int hide, int bounds[4]); void WM_cursor_grab_disable(struct wmWindow *win, int mouse_ungrab_xy[2]); void WM_cursor_time (struct wmWindow *win, int nr); @@ -204,7 +204,7 @@ void WM_operator_free (struct wmOperator *op); void WM_operator_stack_clear(struct wmWindowManager *wm); void WM_operator_handlers_clear(wmWindowManager *wm, struct wmOperatorType *ot); -struct wmOperatorType *WM_operatortype_find(const char *idnamem, int quiet); +struct wmOperatorType *WM_operatortype_find(const char *idnamem, bool quiet); struct GHashIterator *WM_operatortype_iter(void); void WM_operatortype_append(void (*opfunc)(struct wmOperatorType *)); void WM_operatortype_append_ptr(void (*opfunc)(struct wmOperatorType *, void *), void *userdata); @@ -225,8 +225,8 @@ int WM_operator_name_call (struct bContext *C, const char *opstring, short con int WM_operator_call_py(struct bContext *C, struct wmOperatorType *ot, short context, struct PointerRNA *properties, struct ReportList *reports, short is_undo); void WM_operator_properties_alloc(struct PointerRNA **ptr, struct IDProperty **properties, const char *opstring); /* used for keymap and macro items */ -void WM_operator_properties_sanitize(struct PointerRNA *ptr, const short no_context); /* make props context sensitive or not */ -int WM_operator_properties_default(struct PointerRNA *ptr, const int do_update); +void WM_operator_properties_sanitize(struct PointerRNA *ptr, const bool no_context); /* make props context sensitive or not */ +int WM_operator_properties_default(struct PointerRNA *ptr, const bool do_update); void WM_operator_properties_reset(struct wmOperator *op); void WM_operator_properties_create(struct PointerRNA *ptr, const char *opstring); void WM_operator_properties_create_ptr(struct PointerRNA *ptr, struct wmOperatorType *ot); @@ -239,11 +239,11 @@ void WM_operator_properties_mouse_select(struct wmOperatorType *ot); void WM_operator_properties_gesture_straightline(struct wmOperatorType *ot, bool cursor); void WM_operator_properties_select_all(struct wmOperatorType *ot); -int WM_operator_check_ui_enabled(const struct bContext *C, const char *idname); +bool WM_operator_check_ui_enabled(const struct bContext *C, const char *idname); wmOperator *WM_operator_last_redo(const struct bContext *C); -int WM_operator_last_properties_init(struct wmOperator *op); -int WM_operator_last_properties_store(struct wmOperator *op); +bool WM_operator_last_properties_init(struct wmOperator *op); +bool WM_operator_last_properties_store(struct wmOperator *op); /* MOVE THIS SOMEWHERE ELSE */ #define SEL_TOGGLE 0 @@ -269,14 +269,14 @@ void WM_operator_py_idname(char *to, const char *from); /* *************** uilist types ******************** */ void WM_uilisttype_init(void); -struct uiListType *WM_uilisttype_find(const char *idname, int quiet); +struct uiListType *WM_uilisttype_find(const char *idname, bool quiet); int WM_uilisttype_add(struct uiListType *ult); void WM_uilisttype_freelink(struct uiListType *ult); void WM_uilisttype_free(void); /* *************** menu types ******************** */ void WM_menutype_init(void); -struct MenuType *WM_menutype_find(const char *idname, int quiet); +struct MenuType *WM_menutype_find(const char *idname, bool quiet); int WM_menutype_add(struct MenuType *mt); void WM_menutype_freelink(struct MenuType *mt); void WM_menutype_free(void); diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c index 29e0fcf302f..f7b7aa87cf8 100644 --- a/source/blender/windowmanager/intern/wm.c +++ b/source/blender/windowmanager/intern/wm.c @@ -179,7 +179,7 @@ void WM_operator_handlers_clear(wmWindowManager *wm, wmOperatorType *ot) static GHash *uilisttypes_hash = NULL; -uiListType *WM_uilisttype_find(const char *idname, int quiet) +uiListType *WM_uilisttype_find(const char *idname, bool quiet) { uiListType *ult; @@ -234,7 +234,7 @@ void WM_uilisttype_free(void) static GHash *menutypes_hash = NULL; -MenuType *WM_menutype_find(const char *idname, int quiet) +MenuType *WM_menutype_find(const char *idname, bool quiet) { MenuType *mt; diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c index 2e15d6158e8..f8081cb8012 100644 --- a/source/blender/windowmanager/intern/wm_cursors.c +++ b/source/blender/windowmanager/intern/wm_cursors.c @@ -164,7 +164,7 @@ void WM_cursor_restore(wmWindow *win) } /* to allow usage all over, we do entire WM */ -void WM_cursor_wait(int val) +void WM_cursor_wait(bool val) { if (!G.background) { wmWindowManager *wm = G.main->wm.first; diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c index 173a8237c02..1e3c2479e66 100644 --- a/source/blender/windowmanager/intern/wm_draw.c +++ b/source/blender/windowmanager/intern/wm_draw.c @@ -769,12 +769,12 @@ static int wm_automatic_draw_method(wmWindow *win) return win->drawmethod; } -int WM_is_draw_triple(wmWindow *win) +bool WM_is_draw_triple(wmWindow *win) { /* function can get called before this variable is set in drawing code below */ if (win->drawmethod != U.wmdrawmethod) win->drawmethod = U.wmdrawmethod; - return USER_DRAW_TRIPLE == wm_automatic_draw_method(win); + return (USER_DRAW_TRIPLE == wm_automatic_draw_method(win)); } void wm_tag_redraw_overlay(wmWindow *win, ARegion *ar) diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 6c129ec0a92..d7b642fc5cf 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -796,10 +796,10 @@ static void wm_region_mouse_co(bContext *C, wmEvent *event) } } -#if 1 /* disabling for 2.63 release, since we keep getting reports some menu items are leaving props undefined */ -int WM_operator_last_properties_init(wmOperator *op) +#if 1 /* may want to disable operator remembering previous state for testing */ +bool WM_operator_last_properties_init(wmOperator *op) { - int change = FALSE; + bool change = false; if (op->type->last_properties) { PropertyRNA *iterprop; @@ -825,7 +825,7 @@ int WM_operator_last_properties_init(wmOperator *op) idp_dst->flag |= IDP_FLAG_GHOST; IDP_ReplaceInGroup(op->properties, idp_dst); - change = TRUE; + change = true; } } } @@ -836,7 +836,7 @@ int WM_operator_last_properties_init(wmOperator *op) return change; } -int WM_operator_last_properties_store(wmOperator *op) +bool WM_operator_last_properties_store(wmOperator *op) { if (op->type->last_properties) { IDP_FreeProperty(op->type->last_properties); @@ -849,10 +849,10 @@ int WM_operator_last_properties_store(wmOperator *op) printf("%s: storing properties for '%s'\n", __func__, op->type->idname); } op->type->last_properties = IDP_CopyProperty(op->properties); - return TRUE; + return true; } else { - return FALSE; + return false; } } diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index 193af2f92c6..16afad88069 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -248,7 +248,7 @@ void WM_init_splash(bContext *C) } } -int WM_init_game(bContext *C) +bool WM_init_game(bContext *C) { wmWindowManager *wm = CTX_wm_manager(C); wmWindow *win; @@ -318,7 +318,7 @@ int WM_init_game(bContext *C) sound_exit(); - return 1; + return true; } else { ReportTimerInfo *rti; @@ -333,8 +333,9 @@ int WM_init_game(bContext *C) rti = MEM_callocN(sizeof(ReportTimerInfo), "ReportTimerInfo"); wm->reports.reporttimer->customdata = rti; + + return false; } - return 0; } /* free strings of open recent files */ diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c index 20e715c18d0..ff711c5ca4d 100644 --- a/source/blender/windowmanager/intern/wm_keymap.c +++ b/source/blender/windowmanager/intern/wm_keymap.c @@ -958,7 +958,7 @@ static wmKeyMapItem *wm_keymap_item_find( RNA_pointer_create(NULL, ot->srna, properties_default, &opptr); - if (WM_operator_properties_default(&opptr, TRUE)) { + if (WM_operator_properties_default(&opptr, true)) { found = wm_keymap_item_find_props(C, opname, opcontext, properties_default, 0, hotkey, keymap_r); } diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index b4a4e4612e3..d0f258dc375 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -115,7 +115,7 @@ static GHash *global_ops_hash = NULL; /* ************ operator API, exported ********** */ -wmOperatorType *WM_operatortype_find(const char *idname, int quiet) +wmOperatorType *WM_operatortype_find(const char *idname, bool quiet) { if (idname[0]) { wmOperatorType *ot; @@ -779,7 +779,7 @@ void WM_operator_properties_alloc(PointerRNA **ptr, IDProperty **properties, con } -void WM_operator_properties_sanitize(PointerRNA *ptr, const short no_context) +void WM_operator_properties_sanitize(PointerRNA *ptr, const bool no_context) { RNA_STRUCT_BEGIN(ptr, prop) { @@ -815,7 +815,7 @@ void WM_operator_properties_sanitize(PointerRNA *ptr, const short no_context) * \note, theres nothing specific to operators here. * this could be made a general function. */ -int WM_operator_properties_default(PointerRNA *ptr, const int do_update) +int WM_operator_properties_default(PointerRNA *ptr, const bool do_update) { int is_change = FALSE; RNA_STRUCT_BEGIN(ptr, prop) @@ -831,7 +831,7 @@ int WM_operator_properties_default(PointerRNA *ptr, const int do_update) break; } default: - if ((do_update == FALSE) || (RNA_property_is_set(ptr, prop) == FALSE)) { + if ((do_update == false) || (RNA_property_is_set(ptr, prop) == FALSE)) { if (RNA_property_reset(ptr, prop, -1)) { is_change = 1; } @@ -964,7 +964,7 @@ static void operator_enum_search_cb(const struct bContext *C, void *arg_ot, cons for (item = item_array; item->identifier; item++) { /* note: need to give the index rather than the identifier because the enum can be freed */ if (BLI_strcasestr(item->name, str)) - if (0 == uiSearchItemAdd(items, item->name, SET_INT_IN_POINTER(item->value), 0)) + if (false == uiSearchItemAdd(items, item->name, SET_INT_IN_POINTER(item->value), 0)) break; } @@ -1226,7 +1226,7 @@ int WM_operator_winactive(bContext *C) } /* return FALSE, if the UI should be disabled */ -int WM_operator_check_ui_enabled(const bContext *C, const char *idname) +bool WM_operator_check_ui_enabled(const bContext *C, const char *idname) { wmWindowManager *wm = CTX_wm_manager(C); Scene *scene = CTX_data_scene(C); diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 53698ca7e9e..70cb10476d7 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -97,8 +97,8 @@ static struct WMInitStruct { int windowstate; WinOverrideFlag override_flag; - int native_pixels; -} wm_init_state = {0, 0, 0, 0, GHOST_kWindowStateNormal, 0, 1}; + bool native_pixels; +} wm_init_state = {0, 0, 0, 0, GHOST_kWindowStateNormal, 0, true}; /* ******** win open & close ************ */ @@ -1332,7 +1332,7 @@ void WM_init_state_normal_set(void) wm_init_state.override_flag |= WIN_OVERRIDE_WINSTATE; } -void WM_init_native_pixels(int do_it) +void WM_init_native_pixels(bool do_it) { wm_init_state.native_pixels = do_it; } diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c index 1b5a2b89653..bd516309359 100644 --- a/source/blenderplayer/bad_level_call_stubs/stubs.c +++ b/source/blenderplayer/bad_level_call_stubs/stubs.c @@ -406,11 +406,11 @@ void uiItemR(struct uiLayout *layout, struct PointerRNA *ptr, char *propname, in struct PointerRNA uiItemFullO(struct uiLayout *layout, char *idname, char *name, int icon, struct IDProperty *properties, int context, int flag) {struct PointerRNA a = {{0}}; return a;} PointerRNA uiItemFullO_ptr(struct uiLayout *layout, struct wmOperatorType *ot, const char *name, int icon, struct IDProperty *properties, int context, int flag) {struct PointerRNA a = {{0}}; return a;} -struct uiLayout *uiLayoutRow(struct uiLayout *layout, int align) {return (struct uiLayout *) NULL;} -struct uiLayout *uiLayoutColumn(struct uiLayout *layout, int align) {return (struct uiLayout *) NULL;} -struct uiLayout *uiLayoutColumnFlow(struct uiLayout *layout, int number, int align) {return (struct uiLayout *) NULL;} +struct uiLayout *uiLayoutRow(struct uiLayout *layout, bool align) {return (struct uiLayout *) NULL;} +struct uiLayout *uiLayoutColumn(struct uiLayout *layout, bool align) {return (struct uiLayout *) NULL;} +struct uiLayout *uiLayoutColumnFlow(struct uiLayout *layout, int number, bool align) {return (struct uiLayout *) NULL;} struct uiLayout *uiLayoutBox(struct uiLayout *layout) {return (struct uiLayout *) NULL;} -struct uiLayout *uiLayoutSplit(struct uiLayout *layout, float percentage, int align) {return (struct uiLayout *) NULL;} +struct uiLayout *uiLayoutSplit(struct uiLayout *layout, float percentage, bool align) {return (struct uiLayout *) NULL;} int uiLayoutGetRedAlert(struct uiLayout *layout) {return 0;} void uiLayoutSetRedAlert(struct uiLayout *layout, int redalert) {} void uiItemsEnumR(struct uiLayout *layout, struct PointerRNA *ptr, char *propname) {} @@ -432,7 +432,7 @@ void uiItemFullR(struct uiLayout *layout, struct PointerRNA *ptr, struct Propert void uiLayoutSetContextPointer(struct uiLayout *layout, char *name, struct PointerRNA *ptr) {} char *uiLayoutIntrospect(struct uiLayout *layout) {return (char *)NULL;} void UI_reinit_font(void) {} -int UI_rnaptr_icon_get(struct bContext *C, struct PointerRNA *ptr, int rnaicon, int big) {return 0;} +int UI_rnaptr_icon_get(struct bContext *C, struct PointerRNA *ptr, int rnaicon, const bool big) {return 0;} struct bTheme *UI_GetTheme(void) {return (struct bTheme *) NULL;}; /* rna template */ diff --git a/source/creator/creator.c b/source/creator/creator.c index 768c7458ecd..023ef3d3e8c 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -656,7 +656,7 @@ static int prefsize(int argc, const char **argv, void *UNUSED(data)) static int native_pixels(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data)) { - WM_init_native_pixels(0); + WM_init_native_pixels(false); return 0; }