forked from bartvdbraak/blender
code cleanup: use bools in interface handlers, dont show translation menu when right clicking on splash, use less confusing args for copy/paste function.
This commit is contained in:
parent
ed88229ebc
commit
677172fd65
@ -819,7 +819,7 @@ static void ui_menu_block_set_keyaccels(uiBlock *block)
|
||||
/* XXX, this code will shorten any allocated string to 'UI_MAX_NAME_STR'
|
||||
* since this is really long its unlikely to be an issue,
|
||||
* but this could be supported */
|
||||
void ui_but_add_shortcut(uiBut *but, const char *shortcut_str, const short do_strip)
|
||||
void ui_but_add_shortcut(uiBut *but, const char *shortcut_str, const bool do_strip)
|
||||
{
|
||||
|
||||
if (do_strip) {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -424,9 +424,9 @@ struct uiPopupBlockHandle {
|
||||
struct ARegion *region;
|
||||
int towardsx, towardsy;
|
||||
double towardstime;
|
||||
int dotowards;
|
||||
bool dotowards;
|
||||
|
||||
int popup;
|
||||
bool popup;
|
||||
void (*popup_func)(struct bContext *C, void *arg, int event);
|
||||
void (*cancel_func)(struct bContext *C, void *arg);
|
||||
void *popup_arg;
|
||||
@ -465,7 +465,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);
|
||||
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_update(struct bContext *C, struct ARegion *ar, uiBut *but, const bool 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);
|
||||
void ui_searchbox_apply(uiBut *but, struct ARegion *ar);
|
||||
@ -556,7 +556,7 @@ void ui_resources_free(void);
|
||||
void ui_layout_add_but(uiLayout *layout, uiBut *but);
|
||||
int ui_but_can_align(uiBut *but);
|
||||
void ui_but_add_search(uiBut *but, PointerRNA *ptr, PropertyRNA *prop, PointerRNA *searchptr, PropertyRNA *searchprop);
|
||||
void ui_but_add_shortcut(uiBut *but, const char *key_str, const short do_strip);
|
||||
void ui_but_add_shortcut(uiBut *but, const char *key_str, const bool do_strip);
|
||||
|
||||
/* interface_anim.c */
|
||||
void ui_but_anim_flag(uiBut *but, float cfra);
|
||||
|
@ -815,7 +815,7 @@ static void ui_searchbox_select(bContext *C, ARegion *ar, uiBut *but, int step)
|
||||
if (data->items.more) {
|
||||
data->items.offset++;
|
||||
data->active = data->items.totitem;
|
||||
ui_searchbox_update(C, ar, but, 0);
|
||||
ui_searchbox_update(C, ar, but, false);
|
||||
}
|
||||
else
|
||||
data->active = data->items.totitem;
|
||||
@ -824,7 +824,7 @@ static void ui_searchbox_select(bContext *C, ARegion *ar, uiBut *but, int step)
|
||||
if (data->items.offset) {
|
||||
data->items.offset--;
|
||||
data->active = 1;
|
||||
ui_searchbox_update(C, ar, but, 0);
|
||||
ui_searchbox_update(C, ar, but, false);
|
||||
}
|
||||
else if (data->active < 0)
|
||||
data->active = 0;
|
||||
@ -931,14 +931,14 @@ void ui_searchbox_event(bContext *C, ARegion *ar, uiBut *but, const wmEvent *eve
|
||||
}
|
||||
|
||||
/* ar is the search box itself */
|
||||
void ui_searchbox_update(bContext *C, ARegion *ar, uiBut *but, int reset)
|
||||
void ui_searchbox_update(bContext *C, ARegion *ar, uiBut *but, const bool reset)
|
||||
{
|
||||
uiSearchboxData *data = ar->regiondata;
|
||||
|
||||
/* reset vars */
|
||||
data->items.totitem = 0;
|
||||
data->items.more = 0;
|
||||
if (reset == 0) {
|
||||
if (reset == false) {
|
||||
data->items.offset_i = data->items.offset;
|
||||
}
|
||||
else {
|
||||
@ -2481,7 +2481,7 @@ uiPopupBlockHandle *ui_popup_menu_create(bContext *C, ARegion *butregion, uiBut
|
||||
handle = ui_popup_block_create(C, butregion, but, NULL, ui_block_func_POPUP, pup);
|
||||
|
||||
if (!but) {
|
||||
handle->popup = 1;
|
||||
handle->popup = true;
|
||||
|
||||
UI_add_popup_handlers(C, &window->modalhandlers, handle);
|
||||
WM_event_add_mousemove(C);
|
||||
@ -2536,12 +2536,12 @@ void uiPupMenuEnd(bContext *C, uiPopupMenu *pup)
|
||||
wmWindow *window = CTX_wm_window(C);
|
||||
uiPopupBlockHandle *menu;
|
||||
|
||||
pup->popup = 1;
|
||||
pup->popup = true;
|
||||
pup->mx = window->eventstate->x;
|
||||
pup->my = window->eventstate->y;
|
||||
|
||||
menu = ui_popup_block_create(C, NULL, NULL, NULL, ui_block_func_POPUP, pup);
|
||||
menu->popup = 1;
|
||||
menu->popup = true;
|
||||
|
||||
UI_add_popup_handlers(C, &window->modalhandlers, menu);
|
||||
WM_event_add_mousemove(C);
|
||||
@ -2737,7 +2737,7 @@ void uiPupBlockO(bContext *C, uiBlockCreateFunc func, void *arg, const char *opn
|
||||
uiPopupBlockHandle *handle;
|
||||
|
||||
handle = ui_popup_block_create(C, NULL, NULL, func, NULL, arg);
|
||||
handle->popup = 1;
|
||||
handle->popup = true;
|
||||
handle->optype = (opname) ? WM_operatortype_find(opname, 0) : NULL;
|
||||
handle->opcontext = opcontext;
|
||||
|
||||
@ -2756,7 +2756,7 @@ void uiPupBlockEx(bContext *C, uiBlockCreateFunc func, uiBlockHandleFunc popup_f
|
||||
uiPopupBlockHandle *handle;
|
||||
|
||||
handle = ui_popup_block_create(C, NULL, NULL, func, NULL, arg);
|
||||
handle->popup = 1;
|
||||
handle->popup = true;
|
||||
handle->retvalue = 1;
|
||||
|
||||
handle->popup_arg = arg;
|
||||
|
@ -119,7 +119,7 @@ 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 (bool val);
|
||||
void WM_cursor_grab_enable(struct wmWindow *win, int wrap, int hide, int bounds[4]);
|
||||
void WM_cursor_grab_enable(struct wmWindow *win, bool wrap, bool 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);
|
||||
|
||||
@ -154,7 +154,7 @@ struct wmEventHandler *WM_event_add_ui_handler(
|
||||
void WM_event_remove_ui_handler(ListBase *handlers,
|
||||
int (*func)(struct bContext *C, const struct wmEvent *event, void *userdata),
|
||||
void (*remove)(struct bContext *C, void *userdata),
|
||||
void *userdata, int postpone);
|
||||
void *userdata, const bool postpone);
|
||||
void WM_event_remove_area_handler(struct ListBase *handlers, void *area);
|
||||
|
||||
struct wmEventHandler *WM_event_add_modal_handler(struct bContext *C, struct wmOperator *op);
|
||||
|
@ -94,7 +94,7 @@ void WM_keymap_restore_item_to_default(struct bContext *C, struct wmKeyMap *key
|
||||
|
||||
const char *WM_key_event_string(short type);
|
||||
int WM_key_event_operator_id(const struct bContext *C, const char *opname, int opcontext, struct IDProperty *properties, int hotkey, struct wmKeyMap **keymap_r);
|
||||
char *WM_key_event_operator_string(const struct bContext *C, const char *opname, int opcontext, struct IDProperty *properties, const short sloppy, char *str, int len);
|
||||
char *WM_key_event_operator_string(const struct bContext *C, const char *opname, int opcontext, struct IDProperty *properties, const bool sloppy, char *str, int len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ void WM_cursor_wait(bool val)
|
||||
/**
|
||||
* \param bounds can be NULL
|
||||
*/
|
||||
void WM_cursor_grab_enable(wmWindow *win, int wrap, int hide, int bounds[4])
|
||||
void WM_cursor_grab_enable(wmWindow *win, bool wrap, bool hide, int bounds[4])
|
||||
{
|
||||
/* Only grab cursor when not running debug.
|
||||
* It helps not to get a stuck WM when hitting a breakpoint
|
||||
|
@ -987,7 +987,7 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event,
|
||||
}
|
||||
}
|
||||
|
||||
WM_cursor_grab_enable(CTX_wm_window(C), wrap, FALSE, bounds);
|
||||
WM_cursor_grab_enable(CTX_wm_window(C), wrap, false, bounds);
|
||||
}
|
||||
|
||||
/* cancel UI handlers, typically tooltips that can hang around
|
||||
@ -2403,9 +2403,17 @@ wmEventHandler *WM_event_add_ui_handler(const bContext *C, ListBase *handlers,
|
||||
handler->ui_handle = func;
|
||||
handler->ui_remove = remove;
|
||||
handler->ui_userdata = userdata;
|
||||
handler->ui_area = (C) ? CTX_wm_area(C) : NULL;
|
||||
handler->ui_region = (C) ? CTX_wm_region(C) : NULL;
|
||||
handler->ui_menu = (C) ? CTX_wm_menu(C) : NULL;
|
||||
if (C) {
|
||||
handler->ui_area = CTX_wm_area(C);
|
||||
handler->ui_region = CTX_wm_region(C);
|
||||
handler->ui_menu = CTX_wm_menu(C);
|
||||
}
|
||||
else {
|
||||
handler->ui_area = NULL;
|
||||
handler->ui_region = NULL;
|
||||
handler->ui_menu = NULL;
|
||||
}
|
||||
|
||||
|
||||
BLI_addhead(handlers, handler);
|
||||
|
||||
@ -2414,7 +2422,7 @@ wmEventHandler *WM_event_add_ui_handler(const bContext *C, ListBase *handlers,
|
||||
|
||||
/* set "postpone" for win->modalhandlers, this is in a running for () loop in wm_handlers_do() */
|
||||
void WM_event_remove_ui_handler(ListBase *handlers,
|
||||
wmUIHandlerFunc func, wmUIHandlerRemoveFunc remove, void *userdata, int postpone)
|
||||
wmUIHandlerFunc func, wmUIHandlerRemoveFunc remove, void *userdata, const bool postpone)
|
||||
{
|
||||
wmEventHandler *handler;
|
||||
|
||||
|
@ -972,7 +972,7 @@ static wmKeyMapItem *wm_keymap_item_find(
|
||||
|
||||
char *WM_key_event_operator_string(
|
||||
const bContext *C, const char *opname, int opcontext,
|
||||
IDProperty *properties, const short sloppy, char *str, int len)
|
||||
IDProperty *properties, const bool sloppy, char *str, int len)
|
||||
{
|
||||
wmKeyMapItem *kmi = wm_keymap_item_find(C, opname, opcontext, properties, 0, sloppy, NULL);
|
||||
|
||||
|
@ -333,7 +333,7 @@ static int wm_macro_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
WM_cursor_grab_enable(CTX_wm_window(C), wrap, FALSE, bounds);
|
||||
WM_cursor_grab_enable(CTX_wm_window(C), wrap, false, bounds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user