Code Clenaup: use const for button checking functions
This commit is contained in:
@@ -522,7 +522,7 @@ uiBut *uiDefIconTextButO_ptr(uiBlock *block, int type, struct wmOperatorType *ot
|
||||
struct PointerRNA *uiButGetOperatorPtrRNA(uiBut *but);
|
||||
|
||||
void uiButSetUnitType(uiBut *but, const int unit_type);
|
||||
int uiButGetUnitType(uiBut *but);
|
||||
int uiButGetUnitType(const uiBut *but);
|
||||
|
||||
enum {
|
||||
BUT_GET_RNAPROP_IDENTIFIER = 1,
|
||||
|
||||
@@ -746,7 +746,7 @@ 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(uiBut *but)
|
||||
static int 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
|
||||
@@ -1527,7 +1527,7 @@ void ui_set_but_vectorf(uiBut *but, const float vec[3])
|
||||
}
|
||||
}
|
||||
|
||||
bool ui_is_but_float(uiBut *but)
|
||||
bool ui_is_but_float(const uiBut *but)
|
||||
{
|
||||
if (but->pointype == UI_BUT_POIN_FLOAT && but->poin)
|
||||
return true;
|
||||
@@ -1538,7 +1538,7 @@ bool ui_is_but_float(uiBut *but)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ui_is_but_bool(uiBut *but)
|
||||
bool ui_is_but_bool(const uiBut *but)
|
||||
{
|
||||
if (ELEM4(but->type, TOG, TOGN, ICONTOG, ICONTOGN))
|
||||
return true;
|
||||
@@ -1550,7 +1550,7 @@ bool ui_is_but_bool(uiBut *but)
|
||||
}
|
||||
|
||||
|
||||
bool ui_is_but_unit(uiBut *but)
|
||||
bool ui_is_but_unit(const uiBut *but)
|
||||
{
|
||||
UnitSettings *unit = but->block->unit;
|
||||
const int unit_type = uiButGetUnitType(but);
|
||||
@@ -3642,7 +3642,7 @@ void uiButSetUnitType(uiBut *but, const int unit_type)
|
||||
but->unit_type = (unsigned char)(RNA_SUBTYPE_UNIT_VALUE(unit_type));
|
||||
}
|
||||
|
||||
int uiButGetUnitType(uiBut *but)
|
||||
int uiButGetUnitType(const uiBut *but)
|
||||
{
|
||||
int ownUnit = (int)but->unit_type;
|
||||
|
||||
|
||||
@@ -237,7 +237,7 @@ typedef struct uiAfterFunc {
|
||||
|
||||
|
||||
|
||||
static bool ui_is_but_interactive(uiBut *but, const bool labeledit);
|
||||
static bool ui_is_but_interactive(const uiBut *but, const bool labeledit);
|
||||
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 uiBut *ui_but_find_mouse_over_ex(ARegion *ar, int x, int y, bool ctrl);
|
||||
@@ -383,7 +383,7 @@ static void ui_mouse_scale_warp(uiHandleButtonData *data,
|
||||
}
|
||||
|
||||
/* file selectors are exempt from utf-8 checks */
|
||||
bool ui_is_but_utf8(uiBut *but)
|
||||
bool ui_is_but_utf8(const uiBut *but)
|
||||
{
|
||||
if (but->rnaprop) {
|
||||
const int subtype = RNA_property_subtype(but->rnaprop);
|
||||
@@ -869,7 +869,7 @@ static int ui_handler_region_drag_toggle(bContext *C, const wmEvent *event, void
|
||||
}
|
||||
}
|
||||
|
||||
static bool ui_is_but_drag_toggle(uiBut *but)
|
||||
static bool ui_is_but_drag_toggle(const uiBut *but)
|
||||
{
|
||||
return ((ui_is_but_bool(but) == true) &&
|
||||
/* menu check is importnt so the button dragged over isn't removed instantly */
|
||||
@@ -5969,7 +5969,7 @@ static bool ui_mouse_inside_button(ARegion *ar, uiBut *but, int x, int y)
|
||||
* Can we mouse over the button or is it hidden/disabled/layout.
|
||||
* Note: ctrl is kind of a hack currently, so that non-embossed TEX button behaves as a label when ctrl is not pressed.
|
||||
*/
|
||||
static bool ui_is_but_interactive(uiBut *but, const bool labeledit)
|
||||
static bool ui_is_but_interactive(const uiBut *but, const bool labeledit)
|
||||
{
|
||||
/* note, LABEL is included for highlights, this allows drags */
|
||||
if ((but->type == LABEL) && but->dragpoin == NULL)
|
||||
@@ -5988,7 +5988,7 @@ static bool ui_is_but_interactive(uiBut *but, const bool labeledit)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ui_is_but_search_unlink_visible(uiBut *but)
|
||||
bool ui_is_but_search_unlink_visible(const uiBut *but)
|
||||
{
|
||||
BLI_assert(but->type == SEARCH_MENU_UNLINK);
|
||||
return ((but->editstr == NULL) &&
|
||||
|
||||
@@ -396,12 +396,12 @@ extern int ui_get_but_string_max_length(uiBut *but);
|
||||
extern void ui_set_but_default(struct bContext *C, const bool all);
|
||||
|
||||
extern void ui_check_but(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_float(const uiBut *but);
|
||||
extern bool ui_is_but_bool(const uiBut *but);
|
||||
extern bool ui_is_but_unit(const uiBut *but);
|
||||
extern bool ui_is_but_rna_valid(uiBut *but);
|
||||
extern bool ui_is_but_utf8(uiBut *but);
|
||||
extern bool ui_is_but_search_unlink_visible(uiBut *but);
|
||||
extern bool ui_is_but_utf8(const uiBut *but);
|
||||
extern bool ui_is_but_search_unlink_visible(const uiBut *but);
|
||||
|
||||
extern int ui_is_but_push_ex(uiBut *but, double *value);
|
||||
extern int ui_is_but_push(uiBut *but);
|
||||
|
||||
Reference in New Issue
Block a user