Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2014-01-04 10:16:19 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-01-04 11:10:01 +0400
commitb9114cb609698bdd40175b79c017b8ec8d10b518 (patch)
tree98dc331711dcd06fb69f905ebdaf7937a4d23379 /source/blender/editors/interface/interface_handlers.c
parent091740f858c1b6d3016e38fc3186cce737d9ff2c (diff)
UI: Use bool rather then int/short's where possible
Diffstat (limited to 'source/blender/editors/interface/interface_handlers.c')
-rw-r--r--source/blender/editors/interface/interface_handlers.c66
1 files changed, 33 insertions, 33 deletions
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)