From b2ee1770d4c31078518f4ec9edd5196a41345162 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Fri, 6 Mar 2020 16:56:42 +0100 Subject: Cleanup: Rename ARegion variables from ar to region The old convention was easy to confuse with ScrArea. Part of https://developer.blender.org/T74432. This is mostly a batch rename with some manual fixing. Only single word variable names are changed, no prefixed/suffixed names. Brecht van Lommel and Campbell Barton both gave me a green light for this convention change. Also ran clan clang format on affected files. --- source/blender/editors/interface/interface.c | 144 +++++---- source/blender/editors/interface/interface_align.c | 4 +- .../editors/interface/interface_context_menu.c | 22 +- source/blender/editors/interface/interface_draw.c | 18 +- .../editors/interface/interface_eyedropper.c | 12 +- .../editors/interface/interface_eyedropper_color.c | 24 +- .../interface/interface_eyedropper_datablock.c | 18 +- .../editors/interface/interface_eyedropper_depth.c | 22 +- .../interface/interface_eyedropper_intern.h | 2 +- .../blender/editors/interface/interface_handlers.c | 351 +++++++++++---------- .../blender/editors/interface/interface_intern.h | 102 +++--- .../blender/editors/interface/interface_layout.c | 6 +- source/blender/editors/interface/interface_ops.c | 30 +- source/blender/editors/interface/interface_panel.c | 302 +++++++++--------- source/blender/editors/interface/interface_query.c | 80 ++--- .../editors/interface/interface_region_hud.c | 172 +++++----- .../interface/interface_region_menu_popup.c | 16 +- .../editors/interface/interface_region_popover.c | 10 +- .../editors/interface/interface_region_popup.c | 78 ++--- .../editors/interface/interface_region_search.c | 113 +++---- .../editors/interface/interface_region_tooltip.c | 42 +-- .../blender/editors/interface/interface_regions.c | 26 +- .../editors/interface/interface_regions_intern.h | 2 +- .../editors/interface/interface_templates.c | 76 ++--- .../blender/editors/interface/interface_widgets.c | 20 +- source/blender/editors/interface/view2d.c | 72 ++--- source/blender/editors/interface/view2d_draw.c | 42 +-- .../editors/interface/view2d_gizmo_navigate.c | 4 +- source/blender/editors/interface/view2d_ops.c | 153 ++++----- 29 files changed, 1000 insertions(+), 963 deletions(-) (limited to 'source/blender/editors/interface') diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 6a5aa59801c..165a53203f3 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -83,7 +83,7 @@ /* prototypes. */ static void ui_but_to_pixelrect(struct rcti *rect, - const struct ARegion *ar, + const struct ARegion *region, struct uiBlock *block, struct uiBut *but); static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *but_p); @@ -124,15 +124,15 @@ static bool ui_but_is_unit_radians(const uiBut *but) /* ************* window matrix ************** */ -void ui_block_to_window_fl(const ARegion *ar, uiBlock *block, float *x, float *y) +void ui_block_to_window_fl(const ARegion *region, uiBlock *block, float *x, float *y) { float gx, gy; int sx, sy, getsizex, getsizey; - getsizex = BLI_rcti_size_x(&ar->winrct) + 1; - getsizey = BLI_rcti_size_y(&ar->winrct) + 1; - sx = ar->winrct.xmin; - sy = ar->winrct.ymin; + getsizex = BLI_rcti_size_x(®ion->winrct) + 1; + getsizey = BLI_rcti_size_y(®ion->winrct) + 1; + sx = region->winrct.xmin; + sy = region->winrct.ymin; gx = *x; gy = *y; @@ -150,48 +150,51 @@ void ui_block_to_window_fl(const ARegion *ar, uiBlock *block, float *x, float *y block->winmat[3][1])); } -void ui_block_to_window(const ARegion *ar, uiBlock *block, int *x, int *y) +void ui_block_to_window(const ARegion *region, uiBlock *block, int *x, int *y) { float fx, fy; fx = *x; fy = *y; - ui_block_to_window_fl(ar, block, &fx, &fy); + ui_block_to_window_fl(region, block, &fx, &fy); *x = (int)(fx + 0.5f); *y = (int)(fy + 0.5f); } -void ui_block_to_window_rctf(const ARegion *ar, uiBlock *block, rctf *rct_dst, const rctf *rct_src) +void ui_block_to_window_rctf(const ARegion *region, + uiBlock *block, + rctf *rct_dst, + const rctf *rct_src) { *rct_dst = *rct_src; - ui_block_to_window_fl(ar, block, &rct_dst->xmin, &rct_dst->ymin); - ui_block_to_window_fl(ar, block, &rct_dst->xmax, &rct_dst->ymax); + ui_block_to_window_fl(region, block, &rct_dst->xmin, &rct_dst->ymin); + ui_block_to_window_fl(region, block, &rct_dst->xmax, &rct_dst->ymax); } -float ui_block_to_window_scale(const ARegion *ar, uiBlock *block) +float ui_block_to_window_scale(const ARegion *region, uiBlock *block) { /* We could have function for this to avoid dummy arg. */ float dummy_x; float min_y = 0, max_y = 1; dummy_x = 0.0f; - ui_block_to_window_fl(ar, block, &dummy_x, &min_y); + ui_block_to_window_fl(region, block, &dummy_x, &min_y); dummy_x = 0.0f; - ui_block_to_window_fl(ar, block, &dummy_x, &max_y); + ui_block_to_window_fl(region, block, &dummy_x, &max_y); return max_y - min_y; } /* for mouse cursor */ -void ui_window_to_block_fl(const ARegion *ar, uiBlock *block, float *x, float *y) +void ui_window_to_block_fl(const ARegion *region, uiBlock *block, float *x, float *y) { float a, b, c, d, e, f, px, py; int sx, sy, getsizex, getsizey; - getsizex = BLI_rcti_size_x(&ar->winrct) + 1; - getsizey = BLI_rcti_size_y(&ar->winrct) + 1; - sx = ar->winrct.xmin; - sy = ar->winrct.ymin; + getsizex = BLI_rcti_size_x(®ion->winrct) + 1; + getsizey = BLI_rcti_size_y(®ion->winrct) + 1; + sx = region->winrct.xmin; + sy = region->winrct.ymin; a = 0.5f * ((float)getsizex) * block->winmat[0][0]; b = 0.5f * ((float)getsizex) * block->winmat[1][0]; @@ -213,47 +216,47 @@ void ui_window_to_block_fl(const ARegion *ar, uiBlock *block, float *x, float *y } } -void ui_window_to_block_rctf(const struct ARegion *ar, +void ui_window_to_block_rctf(const struct ARegion *region, uiBlock *block, rctf *rct_dst, const rctf *rct_src) { *rct_dst = *rct_src; - ui_window_to_block_fl(ar, block, &rct_dst->xmin, &rct_dst->ymin); - ui_window_to_block_fl(ar, block, &rct_dst->xmax, &rct_dst->ymax); + ui_window_to_block_fl(region, block, &rct_dst->xmin, &rct_dst->ymin); + ui_window_to_block_fl(region, block, &rct_dst->xmax, &rct_dst->ymax); } -void ui_window_to_block(const ARegion *ar, uiBlock *block, int *x, int *y) +void ui_window_to_block(const ARegion *region, uiBlock *block, int *x, int *y) { float fx, fy; fx = *x; fy = *y; - ui_window_to_block_fl(ar, block, &fx, &fy); + ui_window_to_block_fl(region, block, &fx, &fy); *x = (int)(fx + 0.5f); *y = (int)(fy + 0.5f); } -void ui_window_to_region(const ARegion *ar, int *x, int *y) +void ui_window_to_region(const ARegion *region, int *x, int *y) { - *x -= ar->winrct.xmin; - *y -= ar->winrct.ymin; + *x -= region->winrct.xmin; + *y -= region->winrct.ymin; } -void ui_window_to_region_rcti(const ARegion *ar, rcti *rect_dst, const rcti *rct_src) +void ui_window_to_region_rcti(const ARegion *region, rcti *rect_dst, const rcti *rct_src) { - rect_dst->xmin = rct_src->xmin - ar->winrct.xmin; - rect_dst->xmax = rct_src->xmax - ar->winrct.xmin; - rect_dst->ymin = rct_src->ymin - ar->winrct.ymin; - rect_dst->ymax = rct_src->ymax - ar->winrct.ymin; + rect_dst->xmin = rct_src->xmin - region->winrct.xmin; + rect_dst->xmax = rct_src->xmax - region->winrct.xmin; + rect_dst->ymin = rct_src->ymin - region->winrct.ymin; + rect_dst->ymax = rct_src->ymax - region->winrct.ymin; } -void ui_region_to_window(const ARegion *ar, int *x, int *y) +void ui_region_to_window(const ARegion *region, int *x, int *y) { - *x += ar->winrct.xmin; - *y += ar->winrct.ymin; + *x += region->winrct.xmin; + *y += region->winrct.ymin; } static void ui_update_flexible_spacing(const ARegion *region, uiBlock *block) @@ -336,15 +339,15 @@ static void ui_update_window_matrix(const wmWindow *window, const ARegion *regio * Popups will add a margin to #ARegion.winrct for shadow, * for interactivity (point-inside tests for eg), we want the winrct without the margin added. */ -void ui_region_winrct_get_no_margin(const struct ARegion *ar, struct rcti *r_rect) +void ui_region_winrct_get_no_margin(const struct ARegion *region, struct rcti *r_rect) { - uiBlock *block = ar->uiblocks.first; + uiBlock *block = region->uiblocks.first; if (block && (block->flag & UI_BLOCK_LOOP) && (block->flag & UI_BLOCK_RADIAL) == 0) { BLI_rcti_rctf_copy_floor(r_rect, &block->rect); - BLI_rcti_translate(r_rect, ar->winrct.xmin, ar->winrct.ymin); + BLI_rcti_translate(r_rect, region->winrct.xmin, region->winrct.ymin); } else { - *r_rect = ar->winrct; + *r_rect = region->winrct; } } @@ -850,7 +853,7 @@ static bool ui_but_update_from_old_block(const bContext *C, * they should keep calling uiDefButs to keep them alive */ /* returns 0 when button removed */ bool UI_but_active_only_ex( - const bContext *C, ARegion *ar, uiBlock *block, uiBut *but, const bool remove_on_failure) + const bContext *C, ARegion *region, uiBlock *block, uiBut *but, const bool remove_on_failure) { uiBlock *oldblock; uiBut *oldbut; @@ -871,7 +874,7 @@ bool UI_but_active_only_ex( } } if ((activate == true) || (found == false)) { - ui_but_activate_event((bContext *)C, ar, but); + ui_but_activate_event((bContext *)C, region, but); } else if ((found == true) && (isactive == false)) { if (remove_on_failure) { @@ -884,23 +887,23 @@ bool UI_but_active_only_ex( return true; } -bool UI_but_active_only(const bContext *C, ARegion *ar, uiBlock *block, uiBut *but) +bool UI_but_active_only(const bContext *C, ARegion *region, uiBlock *block, uiBut *but) { - return UI_but_active_only_ex(C, ar, block, but, true); + return UI_but_active_only_ex(C, region, block, but, true); } /** * \warning This must run after other handlers have been added, * otherwise the handler wont be removed, see: T71112. */ -bool UI_block_active_only_flagged_buttons(const bContext *C, ARegion *ar, uiBlock *block) +bool UI_block_active_only_flagged_buttons(const bContext *C, ARegion *region, uiBlock *block) { bool done = false; for (uiBut *but = block->buttons.first; but; but = but->next) { if (but->flag & UI_BUT_ACTIVATE_ON_INIT) { but->flag &= ~UI_BUT_ACTIVATE_ON_INIT; if (ui_but_is_editable(but)) { - if (UI_but_active_only_ex(C, ar, block, but, false)) { + if (UI_but_active_only_ex(C, region, block, but, false)) { done = true; break; } @@ -920,12 +923,12 @@ bool UI_block_active_only_flagged_buttons(const bContext *C, ARegion *ar, uiBloc } /* simulate button click */ -void UI_but_execute(const bContext *C, ARegion *ar, uiBut *but) +void UI_but_execute(const bContext *C, ARegion *region, uiBut *but) { void *active_back; - ui_but_execute_begin((bContext *)C, ar, but, &active_back); + ui_but_execute_begin((bContext *)C, region, but, &active_back); /* Value is applied in begin. No further action required. */ - ui_but_execute_end((bContext *)C, ar, but, active_back); + ui_but_execute_end((bContext *)C, region, but, active_back); } /* use to check if we need to disable undo, but don't make any changes @@ -1827,27 +1830,27 @@ void ui_fontscale(short *points, float aspect) } /* project button or block (but==NULL) to pixels in regionspace */ -static void ui_but_to_pixelrect(rcti *rect, const ARegion *ar, uiBlock *block, uiBut *but) +static void ui_but_to_pixelrect(rcti *rect, const ARegion *region, uiBlock *block, uiBut *but) { rctf rectf; - ui_block_to_window_rctf(ar, block, &rectf, (but) ? &but->rect : &block->rect); + ui_block_to_window_rctf(region, block, &rectf, (but) ? &but->rect : &block->rect); BLI_rcti_rctf_copy_round(rect, &rectf); - BLI_rcti_translate(rect, -ar->winrct.xmin, -ar->winrct.ymin); + BLI_rcti_translate(rect, -region->winrct.xmin, -region->winrct.ymin); } /* uses local copy of style, to scale things down, and allow widgets to change stuff */ void UI_block_draw(const bContext *C, uiBlock *block) { uiStyle style = *UI_style_get_dpi(); /* XXX pass on as arg */ - ARegion *ar; + ARegion *region; uiBut *but; rcti rect; /* get menu region or area region */ - ar = CTX_wm_menu(C); - if (!ar) { - ar = CTX_wm_region(C); + region = CTX_wm_menu(C); + if (!region) { + region = CTX_wm_region(C); } if (!block->endblock) { @@ -1865,40 +1868,41 @@ void UI_block_draw(const bContext *C, uiBlock *block) ui_fontscale(&style.widget.points, block->aspect); /* scale block min/max to rect */ - ui_but_to_pixelrect(&rect, ar, block, NULL); + ui_but_to_pixelrect(&rect, region, block, NULL); /* pixel space for AA widgets */ GPU_matrix_push_projection(); GPU_matrix_push(); GPU_matrix_identity_set(); - wmOrtho2_region_pixelspace(ar); + wmOrtho2_region_pixelspace(region); /* back */ if (block->flag & UI_BLOCK_RADIAL) { ui_draw_pie_center(block); } else if (block->flag & UI_BLOCK_POPOVER) { - ui_draw_popover_back(ar, &style, block, &rect); + ui_draw_popover_back(region, &style, block, &rect); } else if (block->flag & UI_BLOCK_LOOP) { ui_draw_menu_back(&style, block, &rect); } else if (block->panel) { - bool show_background = ar->alignment != RGN_ALIGN_FLOAT; + bool show_background = region->alignment != RGN_ALIGN_FLOAT; if (show_background) { if (block->panel->type && (block->panel->type->flag & PNL_NO_HEADER)) { - if (ar->regiontype == RGN_TYPE_TOOLS) { + if (region->regiontype == RGN_TYPE_TOOLS) { /* We never want a background around active tools. */ show_background = false; } else { /* Without a header there is no background except for region overlap. */ - show_background = ar->overlap != 0; + show_background = region->overlap != 0; } } } - ui_draw_aligned_panel(&style, block, &rect, UI_panel_category_is_visible(ar), show_background); + ui_draw_aligned_panel( + &style, block, &rect, UI_panel_category_is_visible(region), show_background); } BLF_batch_draw_begin(); @@ -1908,12 +1912,12 @@ void UI_block_draw(const bContext *C, uiBlock *block) /* widgets */ for (but = block->buttons.first; but; but = but->next) { if (!(but->flag & (UI_HIDDEN | UI_SCROLLED))) { - ui_but_to_pixelrect(&rect, ar, block, but); + ui_but_to_pixelrect(&rect, region, block, but); /* XXX: figure out why invalid coordinates happen when closing render window */ /* and material preview is redrawn in main window (temp fix for bug #23848) */ if (rect.xmin < rect.xmax && rect.ymin < rect.ymax) { - ui_draw_but(C, ar, &style, but, &rect); + ui_draw_but(C, region, &style, but, &rect); } } } @@ -1927,7 +1931,7 @@ void UI_block_draw(const bContext *C, uiBlock *block) GPU_matrix_pop(); } -static void ui_block_message_subscribe(ARegion *ar, struct wmMsgBus *mbus, uiBlock *block) +static void ui_block_message_subscribe(ARegion *region, struct wmMsgBus *mbus, uiBlock *block) { uiBut *but_prev = NULL; /* possibly we should keep the region this block is contained in? */ @@ -1943,8 +1947,8 @@ static void ui_block_message_subscribe(ARegion *ar, struct wmMsgBus *mbus, uiBlo &but->rnapoin, but->rnaprop, &(const wmMsgSubscribeValue){ - .owner = ar, - .user_data = ar, + .owner = region, + .user_data = region, .notify = ED_region_do_msg_notify_tag_redraw, }, __func__); @@ -1954,10 +1958,10 @@ static void ui_block_message_subscribe(ARegion *ar, struct wmMsgBus *mbus, uiBlo } } -void UI_region_message_subscribe(ARegion *ar, struct wmMsgBus *mbus) +void UI_region_message_subscribe(ARegion *region, struct wmMsgBus *mbus) { - for (uiBlock *block = ar->uiblocks.first; block; block = block->next) { - ui_block_message_subscribe(ar, mbus, block); + for (uiBlock *block = region->uiblocks.first; block; block = block->next) { + ui_block_message_subscribe(region, mbus, block); } } diff --git a/source/blender/editors/interface/interface_align.c b/source/blender/editors/interface/interface_align.c index c058fefb4fa..09811fab52d 100644 --- a/source/blender/editors/interface/interface_align.c +++ b/source/blender/editors/interface/interface_align.c @@ -122,9 +122,9 @@ bool ui_but_can_align(const uiBut *but) (BLI_rctf_size_y(&but->rect) > 0.0f)); } -int ui_but_align_opposite_to_area_align_get(const ARegion *ar) +int ui_but_align_opposite_to_area_align_get(const ARegion *region) { - switch (RGN_ALIGN_ENUM_FROM_MASK(ar->alignment)) { + switch (RGN_ALIGN_ENUM_FROM_MASK(region->alignment)) { case RGN_ALIGN_TOP: return UI_BUT_ALIGN_DOWN; case RGN_ALIGN_BOTTOM: diff --git a/source/blender/editors/interface/interface_context_menu.c b/source/blender/editors/interface/interface_context_menu.c index ae6a71f17e6..c9a46e00520 100644 --- a/source/blender/editors/interface/interface_context_menu.c +++ b/source/blender/editors/interface/interface_context_menu.c @@ -160,7 +160,7 @@ static void but_shortcut_name_func(bContext *C, void *arg1, int UNUSED(event)) shortcut_free_operator_property(prop); } -static uiBlock *menu_change_shortcut(bContext *C, ARegion *ar, void *arg) +static uiBlock *menu_change_shortcut(bContext *C, ARegion *region, void *arg) { wmWindowManager *wm = CTX_wm_manager(C); uiBlock *block; @@ -186,7 +186,7 @@ static uiBlock *menu_change_shortcut(bContext *C, ARegion *ar, void *arg) RNA_pointer_create(&wm->id, &RNA_KeyMapItem, kmi, &ptr); - block = UI_block_begin(C, ar, "_popup", UI_EMBOSS); + block = UI_block_begin(C, region, "_popup", UI_EMBOSS); UI_block_func_handle_set(block, but_shortcut_name_func, but); UI_block_flag_enable(block, UI_BLOCK_MOVEMOUSE_QUIT); UI_block_direction_set(block, UI_DIR_CENTER_Y); @@ -216,7 +216,7 @@ static uiBlock *menu_change_shortcut(bContext *C, ARegion *ar, void *arg) static int g_kmi_id_hack; #endif -static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg) +static uiBlock *menu_add_shortcut(bContext *C, ARegion *region, void *arg) { wmWindowManager *wm = CTX_wm_manager(C); uiBlock *block; @@ -248,7 +248,7 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg) RNA_pointer_create(&wm->id, &RNA_KeyMapItem, kmi, &ptr); - block = UI_block_begin(C, ar, "_popup", UI_EMBOSS); + block = UI_block_begin(C, region, "_popup", UI_EMBOSS); UI_block_func_handle_set(block, but_shortcut_name_func, but); UI_block_direction_set(block, UI_DIR_CENTER_Y); @@ -1194,22 +1194,22 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but) /* Show header tools for header buttons. */ if (ui_block_is_popup_any(but->block) == false) { - const ARegion *ar = CTX_wm_region(C); + const ARegion *region = CTX_wm_region(C); - if (!ar) { + if (!region) { /* skip */ } - else if (ELEM(ar->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) { + else if (ELEM(region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) { uiItemMenuF(layout, IFACE_("Header"), ICON_NONE, ED_screens_header_tools_menu_create, NULL); } - else if (ar->regiontype == RGN_TYPE_NAV_BAR) { + else if (region->regiontype == RGN_TYPE_NAV_BAR) { uiItemMenuF(layout, IFACE_("Navigation Bar"), ICON_NONE, ED_screens_navigation_bar_tools_menu_create, NULL); } - else if (ar->regiontype == RGN_TYPE_FOOTER) { + else if (region->regiontype == RGN_TYPE_FOOTER) { uiItemMenuF(layout, IFACE_("Footer"), ICON_NONE, ED_screens_footer_tools_menu_create, NULL); } } @@ -1231,10 +1231,10 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but) /** * menu to show when right clicking on the panel header */ -void ui_popup_context_menu_for_panel(bContext *C, ARegion *ar, Panel *pa) +void ui_popup_context_menu_for_panel(bContext *C, ARegion *region, Panel *pa) { bScreen *sc = CTX_wm_screen(C); - const bool has_panel_category = UI_panel_category_is_visible(ar); + const bool has_panel_category = UI_panel_category_is_visible(region); const bool any_item_visible = has_panel_category; PointerRNA ptr; uiPopupMenu *pup; diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index b6351ac74af..e8e74e77425 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -692,7 +692,7 @@ void ui_draw_but_TAB_outline(const rcti *rect, immUnbindProgram(); } -void ui_draw_but_IMAGE(ARegion *UNUSED(ar), +void ui_draw_but_IMAGE(ARegion *UNUSED(region), uiBut *but, const uiWidgetColors *UNUSED(wcol), const rcti *rect) @@ -872,7 +872,7 @@ static void histogram_draw_one(float r, #define HISTOGRAM_TOT_GRID_LINES 4 -void ui_draw_but_HISTOGRAM(ARegion *UNUSED(ar), +void ui_draw_but_HISTOGRAM(ARegion *UNUSED(region), uiBut *but, const uiWidgetColors *UNUSED(wcol), const rcti *recti) @@ -985,7 +985,7 @@ static void waveform_draw_one(float *waveform, int nbr, const float col[3]) GPU_batch_discard(batch); } -void ui_draw_but_WAVEFORM(ARegion *UNUSED(ar), +void ui_draw_but_WAVEFORM(ARegion *UNUSED(region), uiBut *but, const uiWidgetColors *UNUSED(wcol), const rcti *recti) @@ -1330,7 +1330,7 @@ static void vectorscope_draw_target( immEnd(); } -void ui_draw_but_VECTORSCOPE(ARegion *UNUSED(ar), +void ui_draw_but_VECTORSCOPE(ARegion *UNUSED(region), uiBut *but, const uiWidgetColors *UNUSED(wcol), const rcti *recti) @@ -1848,7 +1848,7 @@ static void gl_shaded_color(const uchar *color, int shade) immUniformColor3ubv(color_shaded); } -void ui_draw_but_CURVE(ARegion *ar, uiBut *but, const uiWidgetColors *wcol, const rcti *rect) +void ui_draw_but_CURVE(ARegion *region, uiBut *but, const uiWidgetColors *wcol, const rcti *rect) { CurveMapping *cumap; @@ -1889,7 +1889,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, const uiWidgetColors *wcol, cons .xmax = rect->xmax, .ymax = rect->ymax, }; - rcti scissor_region = {0, ar->winx, 0, ar->winy}; + rcti scissor_region = {0, region->winx, 0, region->winy}; BLI_rcti_isect(&scissor_new, &scissor_region, &scissor_new); GPU_scissor(scissor_new.xmin, scissor_new.ymin, @@ -2124,7 +2124,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, const uiWidgetColors *wcol, cons } /** Used to draw a curve profile widget. Somewhat similar to ui_draw_but_CURVE */ -void ui_draw_but_CURVEPROFILE(ARegion *ar, +void ui_draw_but_CURVEPROFILE(ARegion *region, uiBut *but, const uiWidgetColors *wcol, const rcti *rect) @@ -2159,7 +2159,7 @@ void ui_draw_but_CURVEPROFILE(ARegion *ar, .xmax = rect->xmax, .ymax = rect->ymax, }; - rcti scissor_region = {0, ar->winx, 0, ar->winy}; + rcti scissor_region = {0, region->winx, 0, region->winy}; BLI_rcti_isect(&scissor_new, &scissor_region, &scissor_new); GPU_scissor(scissor_new.xmin, scissor_new.ymin, @@ -2348,7 +2348,7 @@ void ui_draw_but_CURVEPROFILE(ARegion *ar, immUnbindProgram(); } -void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(ar), +void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(region), uiBut *but, const uiWidgetColors *UNUSED(wcol), const rcti *recti) diff --git a/source/blender/editors/interface/interface_eyedropper.c b/source/blender/editors/interface/interface_eyedropper.c index 988dea270f5..cb7868d2988 100644 --- a/source/blender/editors/interface/interface_eyedropper.c +++ b/source/blender/editors/interface/interface_eyedropper.c @@ -106,7 +106,7 @@ wmKeyMap *eyedropper_colorband_modal_keymap(wmKeyConfig *keyconf) /** \name Generic Shared Functions * \{ */ -void eyedropper_draw_cursor_text(const struct bContext *C, const ARegion *ar, const char *name) +void eyedropper_draw_cursor_text(const struct bContext *C, const ARegion *region, const char *name) { const uiFontStyle *fstyle = UI_FSTYLE_WIDGET; wmWindow *win = CTX_wm_window(C); @@ -115,12 +115,12 @@ void eyedropper_draw_cursor_text(const struct bContext *C, const ARegion *ar, co const float col_fg[4] = {1.0f, 1.0f, 1.0f, 1.0f}; const float col_bg[4] = {0.0f, 0.0f, 0.0f, 0.2f}; - if ((name[0] == '\0') || (BLI_rcti_isect_pt(&ar->winrct, x, y) == false)) { + if ((name[0] == '\0') || (BLI_rcti_isect_pt(®ion->winrct, x, y) == false)) { return; } - x = x - ar->winrct.xmin; - y = y - ar->winrct.ymin; + x = x - region->winrct.xmin; + y = y - region->winrct.ymin; y += U.widget_unit; @@ -140,9 +140,9 @@ uiBut *eyedropper_get_property_button_under_mouse(bContext *C, const wmEvent *ev { bScreen *screen = CTX_wm_screen(C); ScrArea *sa = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, event->x, event->y); - ARegion *ar = BKE_area_find_region_xy(sa, RGN_TYPE_ANY, event->x, event->y); + ARegion *region = BKE_area_find_region_xy(sa, RGN_TYPE_ANY, event->x, event->y); - uiBut *but = ui_but_find_mouse_over(ar, event); + uiBut *but = ui_but_find_mouse_over(region, event); if (ELEM(NULL, but, but->rnapoin.data, but->rnaprop)) { return NULL; diff --git a/source/blender/editors/interface/interface_eyedropper_color.c b/source/blender/editors/interface/interface_eyedropper_color.c index 2b5cf2ed6b9..0dabe453ce4 100644 --- a/source/blender/editors/interface/interface_eyedropper_color.c +++ b/source/blender/editors/interface/interface_eyedropper_color.c @@ -143,34 +143,34 @@ void eyedropper_color_sample_fl(bContext *C, int mx, int my, float r_col[3]) if (sa) { if (sa->spacetype == SPACE_IMAGE) { - ARegion *ar = BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my); - if (ar) { + ARegion *region = BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my); + if (region) { SpaceImage *sima = sa->spacedata.first; - int mval[2] = {mx - ar->winrct.xmin, my - ar->winrct.ymin}; + int mval[2] = {mx - region->winrct.xmin, my - region->winrct.ymin}; - if (ED_space_image_color_sample(sima, ar, mval, r_col)) { + if (ED_space_image_color_sample(sima, region, mval, r_col)) { return; } } } else if (sa->spacetype == SPACE_NODE) { - ARegion *ar = BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my); - if (ar) { + ARegion *region = BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my); + if (region) { SpaceNode *snode = sa->spacedata.first; - int mval[2] = {mx - ar->winrct.xmin, my - ar->winrct.ymin}; + int mval[2] = {mx - region->winrct.xmin, my - region->winrct.ymin}; - if (ED_space_node_color_sample(bmain, snode, ar, mval, r_col)) { + if (ED_space_node_color_sample(bmain, snode, region, mval, r_col)) { return; } } } else if (sa->spacetype == SPACE_CLIP) { - ARegion *ar = BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my); - if (ar) { + ARegion *region = BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my); + if (region) { SpaceClip *sc = sa->spacedata.first; - int mval[2] = {mx - ar->winrct.xmin, my - ar->winrct.ymin}; + int mval[2] = {mx - region->winrct.xmin, my - region->winrct.ymin}; - if (ED_space_clip_color_sample(sc, ar, mval, r_col)) { + if (ED_space_clip_color_sample(sc, region, mval, r_col)) { return; } } diff --git a/source/blender/editors/interface/interface_eyedropper_datablock.c b/source/blender/editors/interface/interface_eyedropper_datablock.c index 0220f3f5afd..5cf1a21d09c 100644 --- a/source/blender/editors/interface/interface_eyedropper_datablock.c +++ b/source/blender/editors/interface/interface_eyedropper_datablock.c @@ -74,10 +74,10 @@ typedef struct DataDropper { char name[200]; } DataDropper; -static void datadropper_draw_cb(const struct bContext *C, ARegion *ar, void *arg) +static void datadropper_draw_cb(const struct bContext *C, ARegion *region, void *arg) { DataDropper *ddr = arg; - eyedropper_draw_cursor_text(C, ar, ddr->name); + eyedropper_draw_cursor_text(C, region, ddr->name); } static int datadropper_init(bContext *C, wmOperator *op) @@ -161,16 +161,16 @@ static void datadropper_id_sample_pt(bContext *C, DataDropper *ddr, int mx, int if (sa) { if (ELEM(sa->spacetype, SPACE_VIEW3D, SPACE_OUTLINER)) { - ARegion *ar = BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my); - if (ar) { - const int mval[2] = {mx - ar->winrct.xmin, my - ar->winrct.ymin}; + ARegion *region = BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my); + if (region) { + const int mval[2] = {mx - region->winrct.xmin, my - region->winrct.ymin}; Base *base; CTX_wm_area_set(C, sa); - CTX_wm_region_set(C, ar); + CTX_wm_region_set(C, region); /* grr, always draw else we leave stale text */ - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); if (sa->spacetype == SPACE_VIEW3D) { base = ED_view3d_give_base_under_cursor(C, mval); @@ -259,8 +259,8 @@ static void datadropper_set_draw_callback_region(bContext *C, ED_region_draw_cb_exit(ddr->art, ddr->draw_handle_pixel); /* Redraw old area */ - ARegion *ar = BKE_area_find_region_type(ddr->cursor_area, RGN_TYPE_WINDOW); - ED_region_tag_redraw(ar); + ARegion *region = BKE_area_find_region_type(ddr->cursor_area, RGN_TYPE_WINDOW); + ED_region_tag_redraw(region); /* Set draw callback in new region */ ARegionType *art = BKE_regiontype_from_id(sa->type, RGN_TYPE_WINDOW); diff --git a/source/blender/editors/interface/interface_eyedropper_depth.c b/source/blender/editors/interface/interface_eyedropper_depth.c index 8a48ca19db2..15a9d2d9f50 100644 --- a/source/blender/editors/interface/interface_eyedropper_depth.c +++ b/source/blender/editors/interface/interface_eyedropper_depth.c @@ -77,10 +77,10 @@ typedef struct DepthDropper { char name[200]; } DepthDropper; -static void depthdropper_draw_cb(const struct bContext *C, ARegion *ar, void *arg) +static void depthdropper_draw_cb(const struct bContext *C, ARegion *region, void *arg) { DepthDropper *ddr = arg; - eyedropper_draw_cursor_text(C, ar, ddr->name); + eyedropper_draw_cursor_text(C, region, ddr->name); } static int depthdropper_init(bContext *C, wmOperator *op) @@ -166,30 +166,30 @@ static void depthdropper_depth_sample_pt( if (sa) { if (sa->spacetype == SPACE_VIEW3D) { - ARegion *ar = BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my); - if (ar) { + ARegion *region = BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my); + if (region) { struct Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); View3D *v3d = sa->spacedata.first; - RegionView3D *rv3d = ar->regiondata; + RegionView3D *rv3d = region->regiondata; /* weak, we could pass in some reference point */ const float *view_co = v3d->camera ? v3d->camera->obmat[3] : rv3d->viewinv[3]; - const int mval[2] = {mx - ar->winrct.xmin, my - ar->winrct.ymin}; + const int mval[2] = {mx - region->winrct.xmin, my - region->winrct.ymin}; float co[3]; CTX_wm_area_set(C, sa); - CTX_wm_region_set(C, ar); + CTX_wm_region_set(C, region); /* grr, always draw else we leave stale text */ - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); view3d_operator_needs_opengl(C); - if (ED_view3d_autodist(depsgraph, ar, v3d, mval, co, true, NULL)) { - const float mval_center_fl[2] = {(float)ar->winx / 2, (float)ar->winy / 2}; + if (ED_view3d_autodist(depsgraph, region, v3d, mval, co, true, NULL)) { + const float mval_center_fl[2] = {(float)region->winx / 2, (float)region->winy / 2}; float co_align[3]; /* quick way to get view-center aligned point */ - ED_view3d_win_to_3d(v3d, ar, co, mval_center_fl, co_align); + ED_view3d_win_to_3d(v3d, region, co, mval_center_fl, co_align); *r_depth = len_v3v3(view_co, co_align); diff --git a/source/blender/editors/interface/interface_eyedropper_intern.h b/source/blender/editors/interface/interface_eyedropper_intern.h index d9ec0657bfe..cabf997b725 100644 --- a/source/blender/editors/interface/interface_eyedropper_intern.h +++ b/source/blender/editors/interface/interface_eyedropper_intern.h @@ -25,7 +25,7 @@ /* interface_eyedropper.c */ void eyedropper_draw_cursor_text(const struct bContext *C, - const struct ARegion *ar, + const struct ARegion *region, const char *name); uiBut *eyedropper_get_property_button_under_mouse(bContext *C, const wmEvent *event); diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index cf736d65596..e2909af47f3 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -425,13 +425,16 @@ typedef struct uiAfterFunc { char undostr[BKE_UNDO_STR_MAX]; } uiAfterFunc; -static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonActivateType type); +static void button_activate_init(bContext *C, + ARegion *region, + uiBut *but, + uiButtonActivateType type); static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState state); static void button_activate_exit( bContext *C, uiBut *but, uiHandleButtonData *data, const bool mousemove, const bool onfree); static int ui_handler_region_menu(bContext *C, const wmEvent *event, void *userdata); static void ui_handle_button_activate(bContext *C, - ARegion *ar, + ARegion *region, uiBut *but, uiButtonActivateType type); @@ -1275,7 +1278,7 @@ static void ui_multibut_states_create(uiBut *but_active, uiHandleButtonData *dat static void ui_multibut_states_apply(bContext *C, uiHandleButtonData *data, uiBlock *block) { - ARegion *ar = data->region; + ARegion *region = data->region; const double value_delta = data->value - data->origvalue; const double value_scale = data->multi_data.is_proportional ? (data->value / data->origvalue) : 0.0; @@ -1292,7 +1295,7 @@ static void ui_multibut_states_apply(bContext *C, uiHandleButtonData *data, uiBl if (mbut_state) { void *active_back; - ui_but_execute_begin(C, ar, but, &active_back); + ui_but_execute_begin(C, region, but, &active_back); # ifdef USE_ALLSELECT if (data->select_others.is_enabled) { @@ -1330,7 +1333,7 @@ static void ui_multibut_states_apply(bContext *C, uiHandleButtonData *data, uiBl /* clamp based on soft limits, see: T40154 */ CLAMP(but->active->value, (double)but->softmin, (double)but->softmax); } - ui_but_execute_end(C, ar, but, active_back); + ui_but_execute_end(C, region, but, active_back); } else { /* highly unlikely */ @@ -1406,21 +1409,21 @@ typedef struct uiDragToggleHandle { } uiDragToggleHandle; static bool ui_drag_toggle_set_xy_xy( - bContext *C, ARegion *ar, const int pushed_state, const int xy_src[2], const int xy_dst[2]) + bContext *C, ARegion *region, const int pushed_state, const int xy_src[2], const int xy_dst[2]) { /* popups such as layers won't re-evaluate on redraw */ - const bool do_check = (ar->regiontype == RGN_TYPE_TEMPORARY); + const bool do_check = (region->regiontype == RGN_TYPE_TEMPORARY); bool changed = false; uiBlock *block; - for (block = ar->uiblocks.first; block; block = block->next) { + for (block = region->uiblocks.first; block; block = block->next) { uiBut *but; float xy_a_block[2] = {UNPACK2(xy_src)}; float xy_b_block[2] = {UNPACK2(xy_dst)}; - ui_window_to_block_fl(ar, block, &xy_a_block[0], &xy_a_block[1]); - ui_window_to_block_fl(ar, block, &xy_b_block[0], &xy_b_block[1]); + ui_window_to_block_fl(region, block, &xy_a_block[0], &xy_a_block[1]); + ui_window_to_block_fl(region, block, &xy_b_block[0], &xy_b_block[1]); for (but = block->buttons.first; but; but = but->next) { /* Note: ctrl is always true here because (at least for now) @@ -1433,7 +1436,7 @@ static bool ui_drag_toggle_set_xy_xy( /* is it pressed? */ int pushed_state_but = ui_drag_toggle_but_pushed_state(C, but); if (pushed_state_but != pushed_state) { - UI_but_execute(C, ar, but); + UI_but_execute(C, region, but); if (do_check) { ui_but_update_edited(but); } @@ -1458,7 +1461,7 @@ static bool ui_drag_toggle_set_xy_xy( static void ui_drag_toggle_set(bContext *C, uiDragToggleHandle *drag_info, const int xy_input[2]) { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); bool do_draw = false; int xy[2]; @@ -1470,7 +1473,7 @@ static void ui_drag_toggle_set(bContext *C, uiDragToggleHandle *drag_info, const */ if (drag_info->is_xy_lock_init == false) { /* first store the buttons original coords */ - uiBut *but = ui_but_find_mouse_over_ex(ar, xy_input[0], xy_input[1], true); + uiBut *but = ui_but_find_mouse_over_ex(region, xy_input[0], xy_input[1], true); if (but) { if (but->flag & UI_BUT_DRAG_LOCK) { @@ -1503,10 +1506,10 @@ static void ui_drag_toggle_set(bContext *C, uiDragToggleHandle *drag_info, const xy[1] = (drag_info->xy_lock[1] == false) ? xy_input[1] : drag_info->xy_last[1]; /* touch all buttons between last mouse coord and this one */ - do_draw = ui_drag_toggle_set_xy_xy(C, ar, drag_info->pushed_state, drag_info->xy_last, xy); + do_draw = ui_drag_toggle_set_xy_xy(C, region, drag_info->pushed_state, drag_info->xy_last, xy); if (do_draw) { - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); } copy_v2_v2_int(drag_info->xy_last, xy); @@ -1538,8 +1541,9 @@ static int ui_handler_region_drag_toggle(bContext *C, const wmEvent *event, void if (done) { wmWindow *win = CTX_wm_window(C); - ARegion *ar = CTX_wm_region(C); - uiBut *but = ui_but_find_mouse_over_ex(ar, drag_info->xy_init[0], drag_info->xy_init[1], true); + ARegion *region = CTX_wm_region(C); + uiBut *but = ui_but_find_mouse_over_ex( + region, drag_info->xy_init[0], drag_info->xy_init[1], true); if (but) { ui_apply_but_undo(but); @@ -4068,8 +4072,8 @@ static uiBut *ui_but_list_row_text_activate(bContext *C, const wmEvent *event, uiButtonActivateType activate_type) { - ARegion *ar = CTX_wm_region(C); - uiBut *labelbut = ui_but_find_mouse_over_ex(ar, event->x, event->y, true); + ARegion *region = CTX_wm_region(C); + uiBut *labelbut = ui_but_find_mouse_over_ex(region, event->x, event->y, true); if (labelbut && labelbut->type == UI_BTYPE_TEXT && !(labelbut->flag & UI_BUT_DISABLED)) { /* exit listrow */ @@ -4077,7 +4081,7 @@ static uiBut *ui_but_list_row_text_activate(bContext *C, button_activate_exit(C, but, data, false, false); /* Activate the text button. */ - button_activate_init(C, ar, labelbut, activate_type); + button_activate_init(C, region, labelbut, activate_type); return labelbut; } @@ -4450,20 +4454,20 @@ static int ui_do_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data, cons if (but_select) { uiBut *but_other = (direction == -1) ? but_select->next : but_select->prev; if (but_other && ui_but_find_select_in_enum__cmp(but, but_other)) { - ARegion *ar = data->region; + ARegion *region = data->region; data->cancel = true; button_activate_exit(C, but, data, false, false); /* Activate the text button. */ - button_activate_init(C, ar, but_other, BUTTON_ACTIVATE_OVER); + button_activate_init(C, region, but_other, BUTTON_ACTIVATE_OVER); data = but_other->active; if (data) { ui_apply_but(C, but->block, but_other, but_other->active, true); button_activate_exit(C, but_other, data, false, false); /* restore active button */ - button_activate_init(C, ar, but, BUTTON_ACTIVATE_OVER); + button_activate_init(C, region, but, BUTTON_ACTIVATE_OVER); } else { /* shouldn't happen */ @@ -7657,17 +7661,17 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent * /** \name Button Tool Tip * \{ */ -static void ui_blocks_set_tooltips(ARegion *ar, const bool enable) +static void ui_blocks_set_tooltips(ARegion *region, const bool enable) { uiBlock *block; - if (!ar) { + if (!region) { return; } /* we disabled buttons when when they were already shown, and * re-enable them on mouse move */ - for (block = ar->uiblocks.first; block; block = block->next) { + for (block = region->uiblocks.first; block; block = block->next) { block->tooltipdisabled = !enable; } } @@ -7708,7 +7712,7 @@ void UI_but_tooltip_timer_remove(bContext *C, uiBut *but) } static ARegion *ui_but_tooltip_init( - bContext *C, ARegion *ar, int *pass, double *r_pass_delay, bool *r_exit_on_event) + bContext *C, ARegion *region, int *pass, double *r_pass_delay, bool *r_exit_on_event) { bool is_label = false; if (*pass == 1) { @@ -7717,10 +7721,10 @@ static ARegion *ui_but_tooltip_init( (*r_pass_delay) = UI_TOOLTIP_DELAY - UI_TOOLTIP_DELAY_LABEL; } - uiBut *but = UI_region_active_but_get(ar); + uiBut *but = UI_region_active_but_get(region); *r_exit_on_event = false; if (but) { - return UI_tooltip_create_from_button(C, ar, but, is_label); + return UI_tooltip_create_from_button(C, region, but, is_label); } return NULL; } @@ -7936,7 +7940,10 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s ED_region_tag_redraw(data->region); } -static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonActivateType type) +static void button_activate_init(bContext *C, + ARegion *region, + uiBut *but, + uiButtonActivateType type) { uiHandleButtonData *data; @@ -7945,8 +7952,8 @@ static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonA data->wm = CTX_wm_manager(C); data->window = CTX_wm_window(C); data->area = CTX_wm_area(C); - BLI_assert(ar != NULL); - data->region = ar; + BLI_assert(region != NULL); + data->region = region; #ifdef USE_CONT_MOUSE_CORRECT copy_v2_fl(data->ungrab_mval, FLT_MAX); @@ -8027,7 +8034,7 @@ static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonA /* Show a label for this button. */ bScreen *sc = WM_window_get_active_screen(data->window); if ((PIL_check_seconds_timer() - WM_tooltip_time_closed()) < 0.1) { - WM_tooltip_immediate_init(C, CTX_wm_window(C), data->area, ar, ui_but_tooltip_init); + WM_tooltip_immediate_init(C, CTX_wm_window(C), data->area, region, ui_but_tooltip_init); if (sc->tool_tip) { sc->tool_tip->pass = 1; } @@ -8179,16 +8186,16 @@ void ui_but_active_free(const bContext *C, uiBut *but) } /* returns the active button with an optional checking function */ -static uiBut *ui_context_button_active(ARegion *ar, bool (*but_check_cb)(uiBut *)) +static uiBut *ui_context_button_active(ARegion *region, bool (*but_check_cb)(uiBut *)) { uiBut *but_found = NULL; - while (ar) { + while (region) { uiBlock *block; uiBut *but, *activebut = NULL; /* find active button */ - for (block = ar->uiblocks.first; block; block = block->next) { + for (block = region->uiblocks.first; block; block = block->next) { for (but = block->buttons.first; but; but = but->next) { if (but->active) { activebut = but; @@ -8205,8 +8212,8 @@ static uiBut *ui_context_button_active(ARegion *ar, bool (*but_check_cb)(uiBut * but_found = activebut; /* recurse into opened menu, like colorpicker case */ - if (data && data->menu && (ar != data->menu->region)) { - ar = data->menu->region; + if (data && data->menu && (region != data->menu->region)) { + region = data->menu->region; } else { return but_found; @@ -8235,14 +8242,14 @@ uiBut *UI_context_active_but_get(const struct bContext *C) return ui_context_button_active(CTX_wm_region(C), NULL); } -uiBut *UI_region_active_but_get(ARegion *ar) +uiBut *UI_region_active_but_get(ARegion *region) { - return ui_context_button_active(ar, NULL); + return ui_context_button_active(region, NULL); } -uiBut *UI_region_but_find_rect_over(const ARegion *ar, const rcti *rect_px) +uiBut *UI_region_but_find_rect_over(const ARegion *region, const rcti *rect_px) { - return ui_but_find_rect_over(ar, rect_px); + return ui_but_find_rect_over(region, rect_px); } /** @@ -8306,13 +8313,13 @@ wmOperator *UI_context_active_operator_get(const struct bContext *C) /* scan popups */ { bScreen *sc = CTX_wm_screen(C); - ARegion *ar; + ARegion *region; - for (ar = sc->regionbase.first; ar; ar = ar->next) { - if (ar == ar_ctx) { + for (region = sc->regionbase.first; region; region = region->next) { + if (region == ar_ctx) { continue; } - for (block = ar->uiblocks.first; block; block = block->next) { + for (block = region->uiblocks.first; block; block = block->next) { if (block->ui_operator) { return block->ui_operator; } @@ -8327,15 +8334,15 @@ wmOperator *UI_context_active_operator_get(const struct bContext *C) void UI_context_update_anim_flag(const bContext *C) { Scene *scene = CTX_data_scene(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); uiBlock *block; uiBut *but, *activebut; - while (ar) { + while (region) { /* find active button */ activebut = NULL; - for (block = ar->uiblocks.first; block; block = block->next) { + for (block = region->uiblocks.first; block; block = block->next) { for (but = block->buttons.first; but; but = but->next) { ui_but_anim_flag(but, (scene) ? scene->r.cfra : 0.0f); ui_but_override_flag(but); @@ -8343,7 +8350,7 @@ void UI_context_update_anim_flag(const bContext *C) ui_but_anim_decorate_update_from_flag(but); } - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); if (but->active) { activebut = but; @@ -8358,7 +8365,7 @@ void UI_context_update_anim_flag(const bContext *C) /* always recurse into opened menu, so all buttons update (like colorpicker) */ uiHandleButtonData *data = activebut->active; if (data && data->menu) { - ar = data->menu->region; + region = data->menu->region; } else { return; @@ -8377,12 +8384,12 @@ void UI_context_update_anim_flag(const bContext *C) /** \name Button Activation Handling * \{ */ -static uiBut *ui_but_find_open_event(ARegion *ar, const wmEvent *event) +static uiBut *ui_but_find_open_event(ARegion *region, const wmEvent *event) { uiBlock *block; uiBut *but; - for (block = ar->uiblocks.first; block; block = block->next) { + for (block = region->uiblocks.first; block; block = block->next) { for (but = block->buttons.first; but; but = but->next) { if (but == event->customdata) { return but; @@ -8392,14 +8399,14 @@ static uiBut *ui_but_find_open_event(ARegion *ar, const wmEvent *event) return NULL; } -static int ui_handle_button_over(bContext *C, const wmEvent *event, ARegion *ar) +static int ui_handle_button_over(bContext *C, const wmEvent *event, ARegion *region) { uiBut *but; if (event->type == MOUSEMOVE) { - but = ui_but_find_mouse_over(ar, event); + but = ui_but_find_mouse_over(region, event); if (but) { - button_activate_init(C, ar, but, BUTTON_ACTIVATE_OVER); + button_activate_init(C, region, but, BUTTON_ACTIVATE_OVER); if (event->alt && but->active) { /* display tooltips if holding alt on mouseover when tooltips are off in prefs */ @@ -8408,9 +8415,9 @@ static int ui_handle_button_over(bContext *C, const wmEvent *event, ARegion *ar) } } else if (event->type == EVT_BUT_OPEN) { - but = ui_but_find_open_event(ar, event); + but = ui_but_find_open_event(region, event); if (but) { - button_activate_init(C, ar, but, BUTTON_ACTIVATE_OVER); + button_activate_init(C, region, but, BUTTON_ACTIVATE_OVER); ui_do_button(C, but->block, but, event); } } @@ -8419,12 +8426,12 @@ static int ui_handle_button_over(bContext *C, const wmEvent *event, ARegion *ar) } /* exported to interface.c: UI_but_active_only() */ -void ui_but_activate_event(bContext *C, ARegion *ar, uiBut *but) +void ui_but_activate_event(bContext *C, ARegion *region, uiBut *but) { wmWindow *win = CTX_wm_window(C); wmEvent event; - button_activate_init(C, ar, but, BUTTON_ACTIVATE_OVER); + button_activate_init(C, region, but, BUTTON_ACTIVATE_OVER); wm_event_init_from_window(win, &event); event.type = EVT_BUT_OPEN; @@ -8433,7 +8440,7 @@ void ui_but_activate_event(bContext *C, ARegion *ar, uiBut *but) event.customdatafree = false; ARegion *ar_ctx = CTX_wm_region(C); - CTX_wm_region_set(C, ar); + CTX_wm_region_set(C, region); ui_do_button(C, but->block, but, &event); CTX_wm_region_set(C, ar_ctx); } @@ -8444,30 +8451,30 @@ void ui_but_activate_event(bContext *C, ARegion *ar, uiBut *but) * exported so menus can start with a highlighted button, * even if the mouse isnt over it */ -void ui_but_activate_over(bContext *C, ARegion *ar, uiBut *but) +void ui_but_activate_over(bContext *C, ARegion *region, uiBut *but) { - button_activate_init(C, ar, but, BUTTON_ACTIVATE_OVER); + button_activate_init(C, region, but, BUTTON_ACTIVATE_OVER); } void ui_but_execute_begin(struct bContext *UNUSED(C), - struct ARegion *ar, + struct ARegion *region, uiBut *but, void **active_back) { - BLI_assert(ar != NULL); - BLI_assert(BLI_findindex(&ar->uiblocks, but->block) != -1); + BLI_assert(region != NULL); + BLI_assert(BLI_findindex(®ion->uiblocks, but->block) != -1); /* note: ideally we would not have to change 'but->active' however * some functions we call don't use data (as they should be doing) */ uiHandleButtonData *data; *active_back = but->active; data = MEM_callocN(sizeof(uiHandleButtonData), "uiHandleButtonData_Fake"); but->active = data; - BLI_assert(ar != NULL); - data->region = ar; + BLI_assert(region != NULL); + data->region = region; } void ui_but_execute_end(struct bContext *C, - struct ARegion *UNUSED(ar), + struct ARegion *UNUSED(region), uiBut *but, void *active_back) { @@ -8482,39 +8489,39 @@ void ui_but_execute_end(struct bContext *C, } static void ui_handle_button_activate(bContext *C, - ARegion *ar, + ARegion *region, uiBut *but, uiButtonActivateType type) { uiBut *oldbut; uiHandleButtonData *data; - oldbut = ui_region_find_active_but(ar); + oldbut = ui_region_find_active_but(region); if (oldbut) { data = oldbut->active; data->cancel = true; button_activate_exit(C, oldbut, data, false, false); } - button_activate_init(C, ar, but, type); + button_activate_init(C, region, but, type); } /** * Use for key accelerator or default key to activate the button even if its not active. */ -static bool ui_handle_button_activate_by_type(bContext *C, ARegion *ar, uiBut *but) +static bool ui_handle_button_activate_by_type(bContext *C, ARegion *region, uiBut *but) { if (but->type == UI_BTYPE_BUT_MENU) { /* mainly for operator buttons */ - ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE_APPLY); + ui_handle_button_activate(C, region, but, BUTTON_ACTIVATE_APPLY); } else if (ELEM(but->type, UI_BTYPE_BLOCK, UI_BTYPE_PULLDOWN)) { /* open sub-menus (like right arrow key) */ - ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE_OPEN); + ui_handle_button_activate(C, region, but, BUTTON_ACTIVATE_OPEN); } else if (but->type == UI_BTYPE_MENU) { /* activate menu items */ - ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE); + ui_handle_button_activate(C, region, but, BUTTON_ACTIVATE); } else { #ifdef DEBUG @@ -8569,11 +8576,11 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but) uiHandleButtonData *data = but->active; const uiHandleButtonState state_orig = data->state; uiBlock *block; - ARegion *ar; + ARegion *region; int retval; block = but->block; - ar = data->region; + region = data->region; retval = WM_UI_HANDLER_CONTINUE; @@ -8600,7 +8607,7 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but) block->handle->menuretval = UI_RETURN_CANCEL; } else if (ui_but_is_editable_as_text(but)) { - ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE_TEXT_EDITING); + ui_handle_button_activate(C, region, but, BUTTON_ACTIVATE_TEXT_EDITING); retval = WM_UI_HANDLER_BREAK; } } @@ -8610,13 +8617,13 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but) } #endif case MOUSEMOVE: { - uiBut *but_other = ui_but_find_mouse_over(ar, event); + uiBut *but_other = ui_but_find_mouse_over(region, event); bool exit = false; /* always deactivate button for pie menus, * else moving to blank space will leave activated */ if ((!ui_block_is_menu(block) || ui_block_is_pie_menu(block)) && - !ui_but_contains_point_px(but, ar, event->x, event->y)) { + !ui_but_contains_point_px(but, region, event->x, event->y)) { exit = true; } else if (but_other && ui_but_is_editable(but_other) && (but_other != but)) { @@ -8629,7 +8636,7 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but) } else if (event->x != event->prevx || event->y != event->prevy) { /* re-enable tooltip on mouse move */ - ui_blocks_set_tooltips(ar, true); + ui_blocks_set_tooltips(region, true); button_tooltip_timer_reset(C, but); } @@ -8641,7 +8648,7 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but) WM_event_remove_timer(data->wm, data->window, data->autoopentimer); data->autoopentimer = NULL; - if (ui_but_contains_point_px(but, ar, event->x, event->y) || but->active) { + if (ui_but_contains_point_px(but, region, event->x, event->y) || but->active) { button_activate_state(C, but, BUTTON_STATE_MENU_OPEN); } } @@ -8691,7 +8698,7 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but) case MOUSEMOVE: { /* deselect the button when moving the mouse away */ /* also de-activate for buttons that only show highlights */ - if (ui_but_contains_point_px(but, ar, event->x, event->y)) { + if (ui_but_contains_point_px(but, region, event->x, event->y)) { /* Drag on a hold button (used in the toolbar) now opens it immediately. */ if (data->hold_action_timer) { @@ -8754,7 +8761,7 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but) } } - bt = ui_but_find_mouse_over(ar, event); + bt = ui_but_find_mouse_over(region, event); if (bt && bt->active != data) { if (but->type != UI_BTYPE_COLOR) { /* exception */ @@ -8766,7 +8773,7 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but) } case RIGHTMOUSE: { if (event->val == KM_PRESS) { - uiBut *bt = ui_but_find_mouse_over(ar, event); + uiBut *bt = ui_but_find_mouse_over(region, event); if (bt && bt->active == data) { button_activate_state(C, bt, BUTTON_STATE_HIGHLIGHT); } @@ -8815,7 +8822,7 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but) /* for jumping to the next button with tab while text editing */ if (post_but) { - button_activate_init(C, ar, post_but, post_type); + button_activate_init(C, region, post_but, post_type); } else { /* XXX issue is because WM_event_add_mousemove(wm) is a bad hack and not reliable, @@ -8825,8 +8832,8 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but) * it stays active while the mouse is over it. * This avoids adding mousemoves, see: [#33466] */ if (ELEM(state_orig, BUTTON_STATE_INIT, BUTTON_STATE_HIGHLIGHT)) { - if (ui_but_find_mouse_over(ar, event) == but) { - button_activate_init(C, ar, but, BUTTON_ACTIVATE_OVER); + if (ui_but_find_mouse_over(region, event) == but) { + button_activate_init(C, region, but, BUTTON_ACTIVATE_OVER); } } } @@ -8835,7 +8842,7 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but) return retval; } -static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *ar, uiBut *listbox) +static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *region, uiBut *listbox) { uiList *ui_list; uiListDyn *dyn_data; @@ -8852,7 +8859,7 @@ static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *ar, mx = event->x; my = event->y; - ui_window_to_block(ar, listbox->block, &mx, &my); + ui_window_to_block(region, listbox->block, &mx, &my); /* convert pan to scrollwheel */ if (type == MOUSEPAN) { @@ -8960,8 +8967,8 @@ static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *ar, } if (redraw) { - ED_region_tag_redraw(ar); - ED_region_tag_refresh_ui(ar); + ED_region_tag_redraw(region); + ED_region_tag_refresh_ui(region); } return retval; @@ -9089,13 +9096,13 @@ static bool ui_mouse_motion_towards_check(uiBlock *block, * if this causes problems we could remove it and check on a different fix - campbell */ if (menu->region->next) { /* am I the last menu (test) */ - ARegion *ar = menu->region->next; + ARegion *region = menu->region->next; do { - uiBlock *block_iter = ar->uiblocks.first; + uiBlock *block_iter = region->uiblocks.first; if (block_iter && ui_block_is_menu(block_iter)) { return true; } - } while ((ar = ar->next)); + } while ((region = region->next)); } /* annoying fix end! */ @@ -9194,7 +9201,7 @@ static char ui_menu_scroll_test(uiBlock *block, int my) return 0; } -static void ui_menu_scroll_apply_offset_y(ARegion *ar, uiBlock *block, float dy) +static void ui_menu_scroll_apply_offset_y(ARegion *region, uiBlock *block, float dy) { BLI_assert(dy != 0.0f); @@ -9233,11 +9240,11 @@ static void ui_menu_scroll_apply_offset_y(ARegion *ar, uiBlock *block, float dy) /* set flags again */ ui_popup_block_scrolltest(block); - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); } /** Scroll to activated button. */ -static bool ui_menu_scroll_to_but(ARegion *ar, uiBlock *block, uiBut *but_target) +static bool ui_menu_scroll_to_but(ARegion *region, uiBlock *block, uiBut *but_target) { float dy = 0.0; if (block->flag & UI_BLOCK_CLIPTOP) { @@ -9251,14 +9258,14 @@ static bool ui_menu_scroll_to_but(ARegion *ar, uiBlock *block, uiBut *but_target } } if (dy != 0.0f) { - ui_menu_scroll_apply_offset_y(ar, block, dy); + ui_menu_scroll_apply_offset_y(region, block, dy); return true; } return false; } /** Scroll to y location (in block space, see #ui_window_to_block). */ -static bool ui_menu_scroll_to_y(ARegion *ar, uiBlock *block, int y) +static bool ui_menu_scroll_to_y(ARegion *region, uiBlock *block, int y) { const char test = ui_menu_scroll_test(block, y); float dy = 0.0f; @@ -9269,13 +9276,13 @@ static bool ui_menu_scroll_to_y(ARegion *ar, uiBlock *block, int y) dy = UI_UNIT_Y; /* scroll to the bottom */ } if (dy != 0.0f) { - ui_menu_scroll_apply_offset_y(ar, block, dy); + ui_menu_scroll_apply_offset_y(region, block, dy); return true; } return false; } -static bool ui_menu_scroll_step(ARegion *ar, uiBlock *block, const int scroll_dir) +static bool ui_menu_scroll_step(ARegion *region, uiBlock *block, const int scroll_dir) { int my; if (scroll_dir == 1) { @@ -9295,7 +9302,7 @@ static bool ui_menu_scroll_step(ARegion *ar, uiBlock *block, const int scroll_di return false; } - return ui_menu_scroll_to_y(ar, block, my); + return ui_menu_scroll_to_y(region, block, my); } /** \} */ @@ -9304,9 +9311,9 @@ static bool ui_menu_scroll_step(ARegion *ar, uiBlock *block, const int scroll_di /** \name Menu Event Handling * \{ */ -static void ui_region_auto_open_clear(ARegion *ar) +static void ui_region_auto_open_clear(ARegion *region) { - for (uiBlock *block = ar->uiblocks.first; block; block = block->next) { + for (uiBlock *block = region->uiblocks.first; block; block = block->next) { block->auto_open = false; } } @@ -9338,8 +9345,8 @@ static bool ui_menu_pass_event_to_parent_if_nonactive(uiPopupBlockHandle *menu, static int ui_handle_menu_button(bContext *C, const wmEvent *event, uiPopupBlockHandle *menu) { - ARegion *ar = menu->region; - uiBut *but = ui_region_find_active_but(ar); + ARegion *region = menu->region; + uiBut *but = ui_region_find_active_but(region); int retval; if (but) { @@ -9384,7 +9391,7 @@ static int ui_handle_menu_button(bContext *C, const wmEvent *event, uiPopupBlock } } else { - retval = ui_handle_button_over(C, event, ar); + retval = ui_handle_button_over(C, event, region); } return retval; @@ -9425,28 +9432,28 @@ static int ui_handle_menu_event(bContext *C, const bool is_parent_menu, const bool is_floating) { - ARegion *ar; + ARegion *region; uiBlock *block; uiBut *but; int mx, my, retval; bool inside; bool inside_title; /* check for title dragging */ - ar = menu->region; - block = ar->uiblocks.first; + region = menu->region; + block = region->uiblocks.first; retval = WM_UI_HANDLER_CONTINUE; mx = event->x; my = event->y; - ui_window_to_block(ar, block, &mx, &my); + ui_window_to_block(region, block, &mx, &my); /* check if mouse is inside block */ inside = BLI_rctf_isect_pt(&block->rect, mx, my); inside_title = inside && ((my + (UI_UNIT_Y * 1.5f)) > block->rect.ymax); /* if there's an active modal button, don't check events or outside, except for search menu */ - but = ui_region_find_active_but(ar); + but = ui_region_find_active_but(region); #ifdef USE_DRAG_POPUP if (menu->is_grab) { @@ -9463,7 +9470,7 @@ static int ui_handle_menu_event(bContext *C, add_v2_v2v2_int(menu->popup_create_vars.event_xy, menu->popup_create_vars.event_xy, mdiff); - ui_popup_translate(ar, mdiff); + ui_popup_translate(region, mdiff); } return retval; @@ -9481,7 +9488,7 @@ static int ui_handle_menu_event(bContext *C, } else if (event->type == TIMER) { if (event->customdata == menu->scrolltimer) { - ui_menu_scroll_to_y(ar, block, my); + ui_menu_scroll_to_y(region, block, my); } } else { @@ -9550,7 +9557,7 @@ static int ui_handle_menu_event(bContext *C, break; } - but = ui_region_find_active_but(ar); + but = ui_region_find_active_but(region); if (!but) { /* no item active, we make first active */ @@ -9563,7 +9570,7 @@ static int ui_handle_menu_event(bContext *C, } if (but && ELEM(but->type, UI_BTYPE_BLOCK, UI_BTYPE_PULLDOWN)) { - ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE_OPEN); + ui_handle_button_activate(C, region, but, BUTTON_ACTIVATE_OPEN); } } @@ -9587,7 +9594,7 @@ static int ui_handle_menu_event(bContext *C, if (type != MOUSEPAN) { const int scroll_dir = (type == WHEELUPMOUSE) ? 1 : -1; - if (ui_menu_scroll_step(ar, block, scroll_dir)) { + if (ui_menu_scroll_step(region, block, scroll_dir)) { if (but) { but->active->cancel = true; button_activate_exit(C, but, but->active, false, false); @@ -9644,7 +9651,7 @@ static int ui_handle_menu_event(bContext *C, ui_mouse_motion_keynav_init(&menu->keynav_state, event); #endif - but = ui_region_find_active_but(ar); + but = ui_region_find_active_but(region); if (but) { /* Apply scroll operation. */ if (scrolltype == MENU_SCROLL_DOWN) { @@ -9668,8 +9675,8 @@ static int ui_handle_menu_event(bContext *C, } if (but) { - ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE); - ui_menu_scroll_to_but(ar, block, but); + ui_handle_button_activate(C, region, but, BUTTON_ACTIVATE); + ui_menu_scroll_to_but(region, block, but); } } @@ -9782,7 +9789,7 @@ static int ui_handle_menu_event(bContext *C, activate = BUTTON_ACTIVATE_APPLY; } - ui_handle_button_activate(C, ar, but, activate); + ui_handle_button_activate(C, region, but, activate); break; } } @@ -9827,10 +9834,10 @@ static int ui_handle_menu_event(bContext *C, for (but = block->buttons.first; but; but = but->next) { if (!(but->flag & UI_BUT_DISABLED) && but->menu_key == event->type) { if (but->type == UI_BTYPE_BUT) { - UI_but_execute(C, ar, but); + UI_but_execute(C, region, but); } else { - ui_handle_button_activate_by_type(C, ar, but); + ui_handle_button_activate_by_type(C, region, but); } break; } @@ -9905,17 +9912,17 @@ static int ui_handle_menu_event(bContext *C, } else if (ELEM(event->type, RETKEY, PADENTER) && event->val == KM_PRESS) { uiBut *but_default = ui_region_find_first_but_test_flag( - ar, UI_BUT_ACTIVE_DEFAULT, UI_HIDDEN); + region, UI_BUT_ACTIVE_DEFAULT, UI_HIDDEN); if ((but_default != NULL) && (but_default->active == NULL)) { if (but_default->type == UI_BTYPE_BUT) { - UI_but_execute(C, ar, but_default); + UI_but_execute(C, region, but_default); } else { - ui_handle_button_activate_by_type(C, ar, but_default); + ui_handle_button_activate_by_type(C, region, but_default); } } else { - uiBut *but_active = ui_region_find_active_but(ar); + uiBut *but_active = ui_region_find_active_but(region); /* enter will always close this block, we let the event * get handled by the button if it is activated, otherwise we cancel */ @@ -9927,7 +9934,7 @@ static int ui_handle_menu_event(bContext *C, #ifdef USE_DRAG_POPUP else if ((event->type == LEFTMOUSE) && (event->val == KM_PRESS) && (inside && is_floating && inside_title)) { - if (!but || !ui_but_contains_point_px(but, ar, event->x, event->y)) { + if (!but || !ui_but_contains_point_px(but, region, event->x, event->y)) { if (but) { UI_but_tooltip_timer_remove(C, but); } @@ -10022,16 +10029,16 @@ static int ui_handle_menu_return_submenu(bContext *C, const wmEvent *event, uiPopupBlockHandle *menu) { - ARegion *ar; + ARegion *region; uiBut *but; uiBlock *block; uiHandleButtonData *data; uiPopupBlockHandle *submenu; - ar = menu->region; - block = ar->uiblocks.first; + region = menu->region; + block = region->uiblocks.first; - but = ui_region_find_active_but(ar); + but = ui_region_find_active_but(region); BLI_assert(but); @@ -10155,7 +10162,7 @@ static int ui_but_pie_button_activate(bContext *C, uiBut *but, uiPopupBlockHandl static int ui_pie_handler(bContext *C, const wmEvent *event, uiPopupBlockHandle *menu) { - ARegion *ar; + ARegion *region; uiBlock *block; uiBut *but; float event_xy[2]; @@ -10173,13 +10180,13 @@ static int ui_pie_handler(bContext *C, const wmEvent *event, uiPopupBlockHandle retval = WM_UI_HANDLER_CONTINUE; } - ar = menu->region; - block = ar->uiblocks.first; + region = menu->region; + block = region->uiblocks.first; is_click_style = (block->pie_data.flags & UI_PIE_CLICK_STYLE); /* if there's an active modal button, don't check events or outside, except for search menu */ - but = ui_region_find_active_but(ar); + but = ui_region_find_active_but(region); if (menu->scrolltimer == NULL) { menu->scrolltimer = WM_event_add_timer( @@ -10192,7 +10199,7 @@ static int ui_pie_handler(bContext *C, const wmEvent *event, uiPopupBlockHandle event_xy[0] = event->x; event_xy[1] = event->y; - ui_window_to_block_fl(ar, block, &event_xy[0], &event_xy[1]); + ui_window_to_block_fl(region, block, &event_xy[0], &event_xy[1]); /* Distance from initial point. */ dist = ui_block_calc_pie_segment(block, event_xy); @@ -10242,7 +10249,7 @@ static int ui_pie_handler(bContext *C, const wmEvent *event, uiPopupBlockHandle } block->pie_data.alphafac = fac; - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); } } @@ -10276,7 +10283,7 @@ static int ui_pie_handler(bContext *C, const wmEvent *event, uiPopupBlockHandle } /* why redraw here? It's simple, we are getting many double click events here. * Those operate like mouse move events almost */ - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); } else { if ((duration < 0.01 * U.pie_tap_timeout) && @@ -10322,7 +10329,7 @@ static int ui_pie_handler(bContext *C, const wmEvent *event, uiPopupBlockHandle ui_handle_menu_button(C, event, menu); /* mouse move should always refresh the area for pie menus */ - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); break; case LEFTMOUSE: @@ -10541,26 +10548,26 @@ void UI_popup_menu_retval_set(const uiBlock *block, const int retval, const bool static int ui_region_handler(bContext *C, const wmEvent *event, void *UNUSED(userdata)) { - ARegion *ar; + ARegion *region; uiBut *but, *listbox; int retval; /* here we handle buttons at the region level, non-modal */ - ar = CTX_wm_region(C); + region = CTX_wm_region(C); retval = WM_UI_HANDLER_CONTINUE; - if (ar == NULL || BLI_listbase_is_empty(&ar->uiblocks)) { + if (region == NULL || BLI_listbase_is_empty(®ion->uiblocks)) { return retval; } /* either handle events for already activated button or try to activate */ - but = ui_region_find_active_but(ar); - listbox = ui_list_find_mouse_over(ar, event); + but = ui_region_find_active_but(region); + listbox = ui_list_find_mouse_over(region, event); - retval = ui_handler_panel_region(C, event, ar, listbox ? listbox : but); + retval = ui_handler_panel_region(C, event, region, listbox ? listbox : but); if (retval == WM_UI_HANDLER_CONTINUE && listbox) { - retval = ui_handle_list_event(C, event, ar, listbox); + retval = ui_handle_list_event(C, event, region, listbox); /* interactions with the listbox should disable tips */ if (retval == WM_UI_HANDLER_BREAK) { @@ -10575,13 +10582,13 @@ static int ui_region_handler(bContext *C, const wmEvent *event, void *UNUSED(use retval = ui_handle_button_event(C, event, but); } else { - retval = ui_handle_button_over(C, event, ar); + retval = ui_handle_button_over(C, event, region); } } /* re-enable tooltips */ if (event->type == MOUSEMOVE && (event->x != event->prevx || event->y != event->prevy)) { - ui_blocks_set_tooltips(ar, true); + ui_blocks_set_tooltips(region, true); } /* delayed apply callbacks */ @@ -10593,14 +10600,14 @@ static int ui_region_handler(bContext *C, const wmEvent *event, void *UNUSED(use static void ui_region_handler_remove(bContext *C, void *UNUSED(userdata)) { bScreen *sc; - ARegion *ar; + ARegion *region; - ar = CTX_wm_region(C); - if (ar == NULL) { + region = CTX_wm_region(C); + if (region == NULL) { return; } - UI_blocklist_free(C, &ar->uiblocks); + UI_blocklist_free(C, ®ion->uiblocks); sc = CTX_wm_screen(C); if (sc == NULL) { @@ -10610,7 +10617,7 @@ static void ui_region_handler_remove(bContext *C, void *UNUSED(userdata)) /* delayed apply callbacks, but not for screen level regions, those * we rather do at the very end after closing them all, which will * be done in ui_region_handler/window */ - if (BLI_findindex(&sc->regionbase, ar) == -1) { + if (BLI_findindex(&sc->regionbase, region) == -1) { ui_apply_but_funcs_after(C); } } @@ -10620,11 +10627,11 @@ static void ui_region_handler_remove(bContext *C, void *UNUSED(userdata)) static int ui_handler_region_menu(bContext *C, const wmEvent *event, void *UNUSED(userdata)) { ARegion *menu_region = CTX_wm_menu(C); - ARegion *ar = menu_region ? menu_region : CTX_wm_region(C); + ARegion *region = menu_region ? menu_region : CTX_wm_region(C); uiBut *but; int retval = WM_UI_HANDLER_CONTINUE; - but = ui_region_find_active_but(ar); + but = ui_region_find_active_but(region); if (but) { bScreen *screen = CTX_wm_screen(C); @@ -10641,7 +10648,7 @@ static int ui_handler_region_menu(bContext *C, const wmEvent *event, void *UNUSE /* make sure mouse isn't inside another menu (see T43247) */ (ui_screen_region_find_mouse_over(screen, event) == NULL) && (ELEM(but->type, UI_BTYPE_PULLDOWN, UI_BTYPE_POPOVER, UI_BTYPE_MENU)) && - (but_other = ui_but_find_mouse_over(ar, event)) && (but != but_other) && + (but_other = ui_but_find_mouse_over(region, event)) && (but != but_other) && (ELEM(but_other->type, UI_BTYPE_PULLDOWN, UI_BTYPE_POPOVER, UI_BTYPE_MENU)) && /* Hover-opening menu's doesn't work well for buttons over one another * along the same axis the menu is opening on (see T71719). */ @@ -10652,7 +10659,7 @@ static int ui_handler_region_menu(bContext *C, const wmEvent *event, void *UNUSE /* if mouse moves to a different root-level menu button, * open it to replace the current menu */ if ((but_other->flag & UI_BUT_DISABLED) == 0) { - ui_handle_button_activate(C, ar, but_other, BUTTON_ACTIVATE_OVER); + ui_handle_button_activate(C, region, but_other, BUTTON_ACTIVATE_OVER); button_activate_state(C, but_other, BUTTON_STATE_MENU_OPEN); retval = WM_UI_HANDLER_BREAK; } @@ -10683,7 +10690,7 @@ static int ui_handler_region_menu(bContext *C, const wmEvent *event, void *UNUSE /* re-enable tooltips */ if (event->type == MOUSEMOVE && (event->x != event->prevx || event->y != event->prevy)) { - ui_blocks_set_tooltips(ar, true); + ui_blocks_set_tooltips(region, true); } if (but && but->active && but->active->menu) { @@ -10865,14 +10872,14 @@ void UI_popup_handlers_remove_all(bContext *C, ListBase *handlers) } bool UI_textbutton_activate_rna(const bContext *C, - ARegion *ar, + ARegion *region, const void *rna_poin_data, const char *rna_prop_id) { uiBlock *block; uiBut *but = NULL; - for (block = ar->uiblocks.first; block; block = block->next) { + for (block = region->uiblocks.first; block; block = block->next) { for (but = block->buttons.first; but; but = but->next) { if (but->type == UI_BTYPE_TEXT) { if (but->rnaprop && but->rnapoin.data == rna_poin_data) { @@ -10888,7 +10895,7 @@ bool UI_textbutton_activate_rna(const bContext *C, } if (but) { - UI_but_active_only(C, ar, block, but); + UI_but_active_only(C, region, block, but); return true; } else { @@ -10898,11 +10905,11 @@ bool UI_textbutton_activate_rna(const bContext *C, bool UI_textbutton_activate_but(const bContext *C, uiBut *actbut) { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); uiBlock *block; uiBut *but = NULL; - for (block = ar->uiblocks.first; block; block = block->next) { + for (block = region->uiblocks.first; block; block = block->next) { for (but = block->buttons.first; but; but = but->next) { if (but == actbut && but->type == UI_BTYPE_TEXT) { break; @@ -10915,7 +10922,7 @@ bool UI_textbutton_activate_but(const bContext *C, uiBut *actbut) } if (but) { - UI_but_active_only(C, ar, block, but); + UI_but_active_only(C, region, block, but); return true; } else { @@ -10955,8 +10962,8 @@ void UI_screen_free_active_but(const bContext *C, bScreen *screen) /* called in region context */ bool UI_but_active_drop_name(bContext *C) { - ARegion *ar = CTX_wm_region(C); - uiBut *but = ui_region_find_active_but(ar); + ARegion *region = CTX_wm_region(C); + uiBut *but = ui_region_find_active_but(region); if (but) { if (ELEM(but->type, UI_BTYPE_TEXT, UI_BTYPE_SEARCH_MENU)) { @@ -10969,10 +10976,10 @@ bool UI_but_active_drop_name(bContext *C) bool UI_but_active_drop_color(bContext *C) { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); - if (ar) { - uiBut *but = ui_region_find_active_but(ar); + if (region) { + uiBut *but = ui_region_find_active_but(region); if (but && but->type == UI_BTYPE_COLOR) { return true; diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 3fe2750e070..248979e1ae7 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -456,23 +456,29 @@ typedef struct uiSafetyRct { void ui_fontscale(short *points, float aspect); -extern void ui_block_to_window_fl(const struct ARegion *ar, uiBlock *block, float *x, float *y); -extern void ui_block_to_window(const struct ARegion *ar, uiBlock *block, int *x, int *y); -extern void ui_block_to_window_rctf(const struct ARegion *ar, +extern void ui_block_to_window_fl(const struct ARegion *region, + uiBlock *block, + float *x, + float *y); +extern void ui_block_to_window(const struct ARegion *region, uiBlock *block, int *x, int *y); +extern void ui_block_to_window_rctf(const struct ARegion *region, uiBlock *block, rctf *rct_dst, const rctf *rct_src); -extern float ui_block_to_window_scale(const struct ARegion *ar, uiBlock *block); -extern void ui_window_to_block_fl(const struct ARegion *ar, uiBlock *block, float *x, float *y); -extern void ui_window_to_block(const struct ARegion *ar, uiBlock *block, int *x, int *y); -extern void ui_window_to_block_rctf(const struct ARegion *ar, +extern float ui_block_to_window_scale(const struct ARegion *region, uiBlock *block); +extern void ui_window_to_block_fl(const struct ARegion *region, + uiBlock *block, + float *x, + float *y); +extern void ui_window_to_block(const struct ARegion *region, uiBlock *block, int *x, int *y); +extern void ui_window_to_block_rctf(const struct ARegion *region, uiBlock *block, rctf *rct_dst, const rctf *rct_src); -extern void ui_window_to_region(const ARegion *ar, int *x, int *y); -extern void ui_window_to_region_rcti(const ARegion *ar, rcti *rect_dst, const rcti *rct_src); -extern void ui_region_to_window(const struct ARegion *ar, int *x, int *y); -extern void ui_region_winrct_get_no_margin(const struct ARegion *ar, struct rcti *r_rect); +extern void ui_window_to_region(const ARegion *region, int *x, int *y); +extern void ui_window_to_region_rcti(const ARegion *region, rcti *rect_dst, const rcti *rct_src); +extern void ui_region_to_window(const struct ARegion *region, int *x, int *y); +extern void ui_region_winrct_get_no_margin(const struct ARegion *region, struct rcti *r_rect); extern double ui_but_value_get(uiBut *but); extern void ui_but_value_set(uiBut *but, double value); @@ -642,16 +648,16 @@ ColorPicker *ui_block_colorpicker_create(struct uiBlock *block); /* Searchbox for string button */ ARegion *ui_searchbox_create_generic(struct bContext *C, struct ARegion *butregion, uiBut *but); ARegion *ui_searchbox_create_operator(struct bContext *C, struct ARegion *butregion, uiBut *but); -bool ui_searchbox_inside(struct ARegion *ar, int x, int y); -int ui_searchbox_find_index(struct ARegion *ar, const char *name); -void ui_searchbox_update(struct bContext *C, struct ARegion *ar, uiBut *but, const bool reset); -int ui_searchbox_autocomplete(struct bContext *C, struct ARegion *ar, uiBut *but, char *str); +bool ui_searchbox_inside(struct ARegion *region, int x, int y); +int ui_searchbox_find_index(struct ARegion *region, const char *name); +void ui_searchbox_update(struct bContext *C, struct ARegion *region, uiBut *but, const bool reset); +int ui_searchbox_autocomplete(struct bContext *C, struct ARegion *region, uiBut *but, char *str); void ui_searchbox_event(struct bContext *C, - struct ARegion *ar, + struct ARegion *region, uiBut *but, const struct wmEvent *event); -bool ui_searchbox_apply(uiBut *but, struct ARegion *ar); -void ui_searchbox_free(struct bContext *C, struct ARegion *ar); +bool ui_searchbox_apply(uiBut *but, struct ARegion *region); +void ui_searchbox_free(struct bContext *C, struct ARegion *region); void ui_but_search_refresh(uiBut *but); /* interface_region_menu_popup.c */ @@ -696,7 +702,7 @@ void ui_pie_menu_level_create(uiBlock *block, int flag); /* interface_region_popup.c */ -void ui_popup_translate(struct ARegion *ar, const int mdiff[2]); +void ui_popup_translate(struct ARegion *region, const int mdiff[2]); void ui_popup_block_free(struct bContext *C, uiPopupBlockHandle *handle); void ui_popup_block_scrolltest(struct uiBlock *block); @@ -705,7 +711,7 @@ void ui_popup_block_scrolltest(struct uiBlock *block); /* interface_panel.c */ extern int ui_handler_panel_region(struct bContext *C, const struct wmEvent *event, - struct ARegion *ar, + struct ARegion *region, const uiBut *active_but); extern void ui_draw_aligned_panel(struct uiStyle *style, uiBlock *block, @@ -723,33 +729,33 @@ void ui_draw_but_TAB_outline(const rcti *rect, float rad, uchar highlight[3], uchar highlight_fade[3]); -void ui_draw_but_HISTOGRAM(ARegion *ar, +void ui_draw_but_HISTOGRAM(ARegion *region, uiBut *but, const struct uiWidgetColors *wcol, const rcti *rect); -void ui_draw_but_WAVEFORM(ARegion *ar, +void ui_draw_but_WAVEFORM(ARegion *region, uiBut *but, const struct uiWidgetColors *wcol, const rcti *rect); -void ui_draw_but_VECTORSCOPE(ARegion *ar, +void ui_draw_but_VECTORSCOPE(ARegion *region, uiBut *but, const struct uiWidgetColors *wcol, const rcti *rect); void ui_draw_but_COLORBAND(uiBut *but, const struct uiWidgetColors *wcol, const rcti *rect); void ui_draw_but_UNITVEC(uiBut *but, const struct uiWidgetColors *wcol, const rcti *rect); -void ui_draw_but_CURVE(ARegion *ar, +void ui_draw_but_CURVE(ARegion *region, uiBut *but, const struct uiWidgetColors *wcol, const rcti *rect); -void ui_draw_but_CURVEPROFILE(ARegion *ar, +void ui_draw_but_CURVEPROFILE(ARegion *region, uiBut *but, const struct uiWidgetColors *wcol, const rcti *rect); -void ui_draw_but_IMAGE(ARegion *ar, +void ui_draw_but_IMAGE(ARegion *region, uiBut *but, const struct uiWidgetColors *wcol, const rcti *rect); -void ui_draw_but_TRACKPREVIEW(ARegion *ar, +void ui_draw_but_TRACKPREVIEW(ARegion *region, uiBut *but, const struct uiWidgetColors *wcol, const rcti *rect); @@ -759,14 +765,14 @@ PointerRNA *ui_handle_afterfunc_add_operator(struct wmOperatorType *ot, int opcontext, bool create_props); extern void ui_pan_to_scroll(const struct wmEvent *event, int *type, int *val); -extern void ui_but_activate_event(struct bContext *C, struct ARegion *ar, uiBut *but); -extern void ui_but_activate_over(struct bContext *C, struct ARegion *ar, uiBut *but); +extern void ui_but_activate_event(struct bContext *C, struct ARegion *region, uiBut *but); +extern void ui_but_activate_over(struct bContext *C, struct ARegion *region, uiBut *but); extern void ui_but_execute_begin(struct bContext *C, - struct ARegion *ar, + struct ARegion *region, uiBut *but, void **active_back); extern void ui_but_execute_end(struct bContext *C, - struct ARegion *ar, + struct ARegion *region, uiBut *but, void *active_back); extern void ui_but_active_free(const struct bContext *C, uiBut *but); @@ -826,7 +832,7 @@ struct GPUBatch *ui_batch_roundbox_shadow_get(void); void ui_draw_anti_tria_rect(const rctf *rect, char dir, const float color[4]); void ui_draw_menu_back(struct uiStyle *style, uiBlock *block, rcti *rect); -void ui_draw_popover_back(ARegion *ar, struct uiStyle *style, uiBlock *block, rcti *rect); +void ui_draw_popover_back(ARegion *region, struct uiStyle *style, uiBlock *block, rcti *rect); void ui_draw_pie_center(uiBlock *block); const struct uiWidgetColors *ui_tooltip_get_theme(void); @@ -835,7 +841,7 @@ void ui_draw_widget_menu_back(const rcti *rect, bool use_shadow); void ui_draw_tooltip_background(struct uiStyle *UNUSED(style), uiBlock *block, rcti *rect); extern void ui_draw_but( - const struct bContext *C, ARegion *ar, struct uiStyle *style, uiBut *but, rcti *rect); + const struct bContext *C, ARegion *region, struct uiStyle *style, uiBut *but, rcti *rect); void ui_draw_menu_item(const struct uiFontStyle *fstyle, rcti *rect, @@ -884,7 +890,7 @@ void ui_item_paneltype_func(struct bContext *C, struct uiLayout *layout, void *a /* interface_align.c */ bool ui_but_can_align(const uiBut *but) ATTR_WARN_UNUSED_RESULT; -int ui_but_align_opposite_to_area_align_get(const ARegion *ar) ATTR_WARN_UNUSED_RESULT; +int ui_but_align_opposite_to_area_align_get(const ARegion *region) ATTR_WARN_UNUSED_RESULT; void ui_block_align_calc(uiBlock *block, const ARegion *region); /* interface_anim.c */ @@ -913,24 +919,24 @@ bool ui_but_is_cursor_warp(const uiBut *but) ATTR_WARN_UNUSED_RESULT; bool ui_but_contains_pt(const uiBut *but, float mx, float my) ATTR_WARN_UNUSED_RESULT; bool ui_but_contains_rect(const uiBut *but, const rctf *rect); bool ui_but_contains_point_px_icon(const uiBut *but, - struct ARegion *ar, + struct ARegion *region, const struct wmEvent *event) ATTR_WARN_UNUSED_RESULT; -bool ui_but_contains_point_px(const uiBut *but, const struct ARegion *ar, int x, int y) +bool ui_but_contains_point_px(const uiBut *but, const struct ARegion *region, int x, int y) ATTR_WARN_UNUSED_RESULT; -uiBut *ui_list_find_mouse_over(struct ARegion *ar, +uiBut *ui_list_find_mouse_over(struct ARegion *region, const struct wmEvent *event) ATTR_WARN_UNUSED_RESULT; -uiBut *ui_but_find_mouse_over_ex(struct ARegion *ar, +uiBut *ui_but_find_mouse_over_ex(struct ARegion *region, const int x, const int y, const bool labeledit) ATTR_WARN_UNUSED_RESULT; -uiBut *ui_but_find_mouse_over(struct ARegion *ar, +uiBut *ui_but_find_mouse_over(struct ARegion *region, const struct wmEvent *event) ATTR_WARN_UNUSED_RESULT; -uiBut *ui_but_find_rect_over(const struct ARegion *ar, +uiBut *ui_but_find_rect_over(const struct ARegion *region, const rcti *rect_px) ATTR_WARN_UNUSED_RESULT; -uiBut *ui_list_find_mouse_over_ex(struct ARegion *ar, int x, int y) ATTR_WARN_UNUSED_RESULT; +uiBut *ui_list_find_mouse_over_ex(struct ARegion *region, int x, int y) ATTR_WARN_UNUSED_RESULT; bool ui_but_contains_password(const uiBut *but) ATTR_WARN_UNUSED_RESULT; @@ -944,17 +950,21 @@ bool ui_block_is_popover(const uiBlock *block) ATTR_WARN_UNUSED_RESULT; bool ui_block_is_pie_menu(const uiBlock *block) ATTR_WARN_UNUSED_RESULT; bool ui_block_is_popup_any(const uiBlock *block) ATTR_WARN_UNUSED_RESULT; -uiBut *ui_region_find_first_but_test_flag(struct ARegion *ar, int flag_include, int flag_exclude); -uiBut *ui_region_find_active_but(struct ARegion *ar) ATTR_WARN_UNUSED_RESULT; -bool ui_region_contains_point_px(const struct ARegion *ar, int x, int y) ATTR_WARN_UNUSED_RESULT; -bool ui_region_contains_rect_px(const struct ARegion *ar, const rcti *rect_px); +uiBut *ui_region_find_first_but_test_flag(struct ARegion *region, + int flag_include, + int flag_exclude); +uiBut *ui_region_find_active_but(struct ARegion *region) ATTR_WARN_UNUSED_RESULT; +bool ui_region_contains_point_px(const struct ARegion *region, + int x, + int y) ATTR_WARN_UNUSED_RESULT; +bool ui_region_contains_rect_px(const struct ARegion *region, const rcti *rect_px); ARegion *ui_screen_region_find_mouse_over_ex(bScreen *screen, int x, int y); ARegion *ui_screen_region_find_mouse_over(bScreen *screen, const struct wmEvent *event); /* interface_context_menu.c */ bool ui_popup_context_menu_for_button(struct bContext *C, uiBut *but); -void ui_popup_context_menu_for_panel(struct bContext *C, struct ARegion *ar, struct Panel *pa); +void ui_popup_context_menu_for_panel(struct bContext *C, struct ARegion *region, struct Panel *pa); /* interface_eyedropper.c */ struct wmKeyMap *eyedropper_modal_keymap(struct wmKeyConfig *keyconf); diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index a797316cc98..8e65b818314 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -1067,7 +1067,7 @@ void UI_context_active_but_prop_get_filebrowser(const bContext *C, PropertyRNA **r_prop, bool *r_is_undo) { - ARegion *ar = CTX_wm_menu(C) ? CTX_wm_menu(C) : CTX_wm_region(C); + ARegion *region = CTX_wm_menu(C) ? CTX_wm_menu(C) : CTX_wm_region(C); uiBlock *block; uiBut *but, *prevbut = NULL; @@ -1075,11 +1075,11 @@ void UI_context_active_but_prop_get_filebrowser(const bContext *C, *r_prop = NULL; *r_is_undo = false; - if (!ar) { + if (!region) { return; } - for (block = ar->uiblocks.first; block; block = block->next) { + for (block = region->uiblocks.first; block; block = block->next) { for (but = block->buttons.first; but; but = but->next) { if (but && but->rnapoin.data) { if (RNA_property_type(but->rnaprop) == PROP_STRING) { diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 9de2824e3a3..dce584b4ae5 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -1329,7 +1329,7 @@ static int editsource_exec(bContext *C, wmOperator *op) GHashIterator ghi; struct uiEditSourceButStore *but_store = NULL; - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); int ret; /* needed else the active button does not get tested */ @@ -1341,9 +1341,9 @@ static int editsource_exec(bContext *C, wmOperator *op) ui_editsource_active_but_set(but); /* redraw and get active button python info */ - ED_region_do_layout(C, ar); - ED_region_do_draw(C, ar); - ar->do_draw = false; + ED_region_do_layout(C, region); + ED_region_do_draw(C, region); + region->do_draw = false; for (BLI_ghashIterator_init(&ghi, ui_editsource_info->hash); BLI_ghashIterator_done(&ghi) == false; @@ -1620,17 +1620,17 @@ static int ui_button_press_invoke(bContext *C, wmOperator *op, const wmEvent *ev bScreen *sc = CTX_wm_screen(C); const bool skip_depressed = RNA_boolean_get(op->ptr, "skip_depressed"); ARegion *ar_prev = CTX_wm_region(C); - ARegion *ar = sc ? BKE_screen_find_region_xy(sc, RGN_TYPE_ANY, event->x, event->y) : NULL; + ARegion *region = sc ? BKE_screen_find_region_xy(sc, RGN_TYPE_ANY, event->x, event->y) : NULL; - if (ar == NULL) { - ar = ar_prev; + if (region == NULL) { + region = ar_prev; } - if (ar == NULL) { + if (region == NULL) { return OPERATOR_PASS_THROUGH; } - CTX_wm_region_set(C, ar); + CTX_wm_region_set(C, region); uiBut *but = UI_context_active_but_get(C); CTX_wm_region_set(C, ar_prev); @@ -1645,7 +1645,7 @@ static int ui_button_press_invoke(bContext *C, wmOperator *op, const wmEvent *ev * having this avoids a minor drawing glitch. */ void *but_optype = but->optype; - UI_but_execute(C, ar, but); + UI_but_execute(C, region, but); but->optype = but_optype; @@ -1709,14 +1709,14 @@ bool UI_drop_color_poll(struct bContext *C, * return true always */ if (drag->type == WM_DRAG_COLOR) { SpaceImage *sima = CTX_wm_space_image(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); if (UI_but_active_drop_color(C)) { return 1; } if (sima && (sima->mode == SI_MODE_PAINT) && sima->image && - (ar && ar->regiontype == RGN_TYPE_WINDOW)) { + (region && region->regiontype == RGN_TYPE_WINDOW)) { return 1; } } @@ -1734,7 +1734,7 @@ void UI_drop_color_copy(wmDrag *drag, wmDropBox *drop) static int drop_color_invoke(bContext *C, wmOperator *op, const wmEvent *event) { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); uiBut *but = NULL; float color[4]; bool gamma; @@ -1744,7 +1744,7 @@ static int drop_color_invoke(bContext *C, wmOperator *op, const wmEvent *event) /* find button under mouse, check if it has RNA color property and * if it does copy the data */ - but = ui_region_find_active_but(ar); + but = ui_region_find_active_but(region); if (but && but->type == UI_BTYPE_COLOR && but->rnaprop) { const int color_len = RNA_property_array_length(&but->rnapoin, but->rnaprop); @@ -1778,7 +1778,7 @@ static int drop_color_invoke(bContext *C, wmOperator *op, const wmEvent *event) ED_imapaint_bucket_fill(C, color, op, event->mval); } - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); return OPERATOR_FINISHED; } diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 17c1455bd81..70d64ff26ab 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -131,21 +131,21 @@ typedef enum eSpaceButtons_Align { BUT_AUTO = 2, } eSpaceButtons_Align; -static int panel_aligned(const ScrArea *sa, const ARegion *ar) +static int panel_aligned(const ScrArea *sa, const ARegion *region) { - if (sa->spacetype == SPACE_PROPERTIES && ar->regiontype == RGN_TYPE_WINDOW) { + if (sa->spacetype == SPACE_PROPERTIES && region->regiontype == RGN_TYPE_WINDOW) { return BUT_VERTICAL; } - else if (sa->spacetype == SPACE_USERPREF && ar->regiontype == RGN_TYPE_WINDOW) { + else if (sa->spacetype == SPACE_USERPREF && region->regiontype == RGN_TYPE_WINDOW) { return BUT_VERTICAL; } - else if (sa->spacetype == SPACE_FILE && ar->regiontype == RGN_TYPE_CHANNELS) { + else if (sa->spacetype == SPACE_FILE && region->regiontype == RGN_TYPE_CHANNELS) { return BUT_VERTICAL; } - else if (sa->spacetype == SPACE_IMAGE && ar->regiontype == RGN_TYPE_PREVIEW) { + else if (sa->spacetype == SPACE_IMAGE && region->regiontype == RGN_TYPE_PREVIEW) { return BUT_VERTICAL; } - else if (ELEM(ar->regiontype, + else if (ELEM(region->regiontype, RGN_TYPE_UI, RGN_TYPE_TOOLS, RGN_TYPE_TOOL_PROPS, @@ -196,28 +196,28 @@ static bool panel_active_animation_changed(ListBase *lb, Panel **pa_animation, b return false; } -static bool panels_need_realign(ScrArea *sa, ARegion *ar, Panel **r_pa_animate) +static bool panels_need_realign(ScrArea *sa, ARegion *region, Panel **r_pa_animate) { *r_pa_animate = NULL; - if (sa->spacetype == SPACE_PROPERTIES && ar->regiontype == RGN_TYPE_WINDOW) { + if (sa->spacetype == SPACE_PROPERTIES && region->regiontype == RGN_TYPE_WINDOW) { SpaceProperties *sbuts = sa->spacedata.first; if (sbuts->mainbo != sbuts->mainb) { return true; } } - else if (sa->spacetype == SPACE_IMAGE && ar->regiontype == RGN_TYPE_PREVIEW) { + else if (sa->spacetype == SPACE_IMAGE && region->regiontype == RGN_TYPE_PREVIEW) { return true; } - else if (sa->spacetype == SPACE_FILE && ar->regiontype == RGN_TYPE_CHANNELS) { + else if (sa->spacetype == SPACE_FILE && region->regiontype == RGN_TYPE_CHANNELS) { return true; } /* Detect if a panel was added or removed. */ Panel *pa_animation = NULL; bool no_animation = false; - if (panel_active_animation_changed(&ar->panels, &pa_animation, &no_animation)) { + if (panel_active_animation_changed(®ion->panels, &pa_animation, &no_animation)) { return true; } @@ -234,15 +234,15 @@ static bool panels_need_realign(ScrArea *sa, ARegion *ar, Panel **r_pa_animate) /****************************** panels ******************************/ -static void panels_collapse_all(ScrArea *sa, ARegion *ar, const Panel *from_pa) +static void panels_collapse_all(ScrArea *sa, ARegion *region, const Panel *from_pa) { - const bool has_category_tabs = UI_panel_category_is_visible(ar); - const char *category = has_category_tabs ? UI_panel_category_active_get(ar, false) : NULL; - const int flag = ((panel_aligned(sa, ar) == BUT_HORIZONTAL) ? PNL_CLOSEDX : PNL_CLOSEDY); + const bool has_category_tabs = UI_panel_category_is_visible(region); + const char *category = has_category_tabs ? UI_panel_category_active_get(region, false) : NULL; + const int flag = ((panel_aligned(sa, region) == BUT_HORIZONTAL) ? PNL_CLOSEDX : PNL_CLOSEDY); const PanelType *from_pt = from_pa->type; Panel *pa; - for (pa = ar->panels.first; pa; pa = pa->next) { + for (pa = region->panels.first; pa; pa = pa->next) { PanelType *pt = pa->type; /* close panels with headers in the same context */ @@ -274,14 +274,19 @@ Panel *UI_panel_find_by_type(ListBase *lb, PanelType *pt) /** * \note \a pa should be return value from #UI_panel_find_by_type and can be NULL. */ -Panel *UI_panel_begin( - ScrArea *sa, ARegion *ar, ListBase *lb, uiBlock *block, PanelType *pt, Panel *pa, bool *r_open) +Panel *UI_panel_begin(ScrArea *sa, + ARegion *region, + ListBase *lb, + uiBlock *block, + PanelType *pt, + Panel *pa, + bool *r_open) { Panel *palast, *panext; const char *drawname = CTX_IFACE_(pt->translation_context, pt->label); const char *idname = pt->idname; const bool newpanel = (pa == NULL); - int align = panel_aligned(sa, ar); + int align = panel_aligned(sa, region); if (!newpanel) { pa->type = pt; @@ -352,7 +357,7 @@ Panel *UI_panel_begin( /* assign to block */ block->panel = pa; pa->runtime_flag |= PNL_ACTIVE | PNL_LAST_ADDED; - if (ar->alignment == RGN_ALIGN_FLOAT) { + if (region->alignment == RGN_ALIGN_FLOAT) { UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP); } @@ -367,10 +372,11 @@ Panel *UI_panel_begin( return pa; } -static float panel_region_offset_x_get(const ARegion *ar, int align) +static float panel_region_offset_x_get(const ARegion *region, int align) { - if (UI_panel_category_is_visible(ar)) { - if (align == BUT_VERTICAL && (RGN_ALIGN_ENUM_FROM_MASK(ar->alignment) != RGN_ALIGN_RIGHT)) { + if (UI_panel_category_is_visible(region)) { + if (align == BUT_VERTICAL && + (RGN_ALIGN_ENUM_FROM_MASK(region->alignment) != RGN_ALIGN_RIGHT)) { return UI_PANEL_CATEGORY_MARGIN_WIDTH; } } @@ -379,7 +385,7 @@ static float panel_region_offset_x_get(const ARegion *ar, int align) } void UI_panel_end( - const ScrArea *sa, const ARegion *ar, uiBlock *block, int width, int height, bool open) + const ScrArea *sa, const ARegion *region, uiBlock *block, int width, int height, bool open) { Panel *pa = block->panel; @@ -419,8 +425,8 @@ void UI_panel_end( pa->ofsy += old_sizey - pa->sizey; } - int align = panel_aligned(sa, ar); - if (old_region_ofsx != panel_region_offset_x_get(ar, align)) { + int align = panel_aligned(sa, region); + if (old_region_ofsx != panel_region_offset_x_get(region, align)) { pa->runtime_flag |= PNL_ANIM_ALIGN; } } @@ -1015,16 +1021,16 @@ static void align_sub_panels(Panel *pa) /* this doesn't draw */ /* returns 1 when it did something */ -static bool uiAlignPanelStep(ScrArea *sa, ARegion *ar, const float fac, const bool drag) +static bool uiAlignPanelStep(ScrArea *sa, ARegion *region, const float fac, const bool drag) { Panel *pa; PanelSort *ps, *panelsort, *psnext; int a, tot = 0; bool done; - int align = panel_aligned(sa, ar); + int align = panel_aligned(sa, region); /* count active, not tabbed panels */ - for (pa = ar->panels.first; pa; pa = pa->next) { + for (pa = region->panels.first; pa; pa = pa->next) { if (pa->runtime_flag & PNL_ACTIVE) { tot++; } @@ -1035,7 +1041,7 @@ static bool uiAlignPanelStep(ScrArea *sa, ARegion *ar, const float fac, const bo } /* extra; change close direction? */ - for (pa = ar->panels.first; pa; pa = pa->next) { + for (pa = region->panels.first; pa; pa = pa->next) { if (pa->runtime_flag & PNL_ACTIVE) { if ((pa->flag & PNL_CLOSEDX) && (align == BUT_VERTICAL)) { pa->flag ^= PNL_CLOSED; @@ -1050,7 +1056,7 @@ static bool uiAlignPanelStep(ScrArea *sa, ARegion *ar, const float fac, const bo panelsort = MEM_callocN(tot * sizeof(PanelSort), "panelsort"); ps = panelsort; - for (pa = ar->panels.first; pa; pa = pa->next) { + for (pa = region->panels.first; pa; pa = pa->next) { if (pa->runtime_flag & PNL_ACTIVE) { ps->pa = MEM_dupallocN(pa); ps->orig = pa; @@ -1078,7 +1084,7 @@ static bool uiAlignPanelStep(ScrArea *sa, ARegion *ar, const float fac, const bo /* no smart other default start loc! this keeps switching f5/f6/etc compatible */ ps = panelsort; - ps->pa->runtime.region_ofsx = panel_region_offset_x_get(ar, align); + ps->pa->runtime.region_ofsx = panel_region_offset_x_get(region, align); ps->pa->ofsx = 0; ps->pa->ofsy = -get_panel_size_y(ps->pa); ps->pa->ofsx += ps->pa->runtime.region_ofsx; @@ -1112,7 +1118,7 @@ static bool uiAlignPanelStep(ScrArea *sa, ARegion *ar, const float fac, const bo } /* set locations for tabbed and sub panels */ - for (pa = ar->panels.first; pa; pa = pa->next) { + for (pa = region->panels.first; pa; pa = pa->next) { if (pa->runtime_flag & PNL_ACTIVE) { if (pa->children.first) { align_sub_panels(pa); @@ -1129,15 +1135,15 @@ static bool uiAlignPanelStep(ScrArea *sa, ARegion *ar, const float fac, const bo return done; } -static void ui_panels_size(ScrArea *sa, ARegion *ar, int *r_x, int *r_y) +static void ui_panels_size(ScrArea *sa, ARegion *region, int *r_x, int *r_y) { Panel *pa; - int align = panel_aligned(sa, ar); + int align = panel_aligned(sa, region); int sizex = 0; int sizey = 0; /* compute size taken up by panels, for setting in view2d */ - for (pa = ar->panels.first; pa; pa = pa->next) { + for (pa = region->panels.first; pa; pa = pa->next) { if (pa->runtime_flag & PNL_ACTIVE) { int pa_sizex, pa_sizey; @@ -1170,15 +1176,15 @@ static void ui_do_animate(const bContext *C, Panel *panel) { uiHandlePanelData *data = panel->activedata; ScrArea *sa = CTX_wm_area(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); float fac; fac = (PIL_check_seconds_timer() - data->starttime) / ANIMATION_TIME; fac = min_ff(sqrtf(fac), 1.0f); /* for max 1 second, interpolate positions */ - if (uiAlignPanelStep(sa, ar, fac, false)) { - ED_region_tag_redraw(ar); + if (uiAlignPanelStep(sa, region, fac, false)) { + ED_region_tag_redraw(region); } else { fac = 1.0f; @@ -1206,38 +1212,38 @@ static void panel_list_clear_active(ListBase *lb) } } -void UI_panels_begin(const bContext *UNUSED(C), ARegion *ar) +void UI_panels_begin(const bContext *UNUSED(C), ARegion *region) { - panel_list_clear_active(&ar->panels); + panel_list_clear_active(®ion->panels); } /* only draws blocks with panels */ -void UI_panels_end(const bContext *C, ARegion *ar, int *r_x, int *r_y) +void UI_panels_end(const bContext *C, ARegion *region, int *r_x, int *r_y) { ScrArea *sa = CTX_wm_area(C); uiBlock *block; Panel *pa, *firstpa; /* offset contents */ - for (block = ar->uiblocks.first; block; block = block->next) { + for (block = region->uiblocks.first; block; block = block->next) { if (block->active && block->panel) { ui_offset_panel_block(block); } } /* re-align, possibly with animation */ - if (panels_need_realign(sa, ar, &pa)) { + if (panels_need_realign(sa, region, &pa)) { if (pa) { panel_activate_state(C, pa, PANEL_STATE_ANIMATION); } else { - uiAlignPanelStep(sa, ar, 1.0, false); + uiAlignPanelStep(sa, region, 1.0, false); } } /* tag first panel */ firstpa = NULL; - for (block = ar->uiblocks.first; block; block = block->next) { + for (block = region->uiblocks.first; block; block = block->next) { if (block->active && block->panel) { if (!firstpa || block->panel->sortorder < firstpa->sortorder) { firstpa = block->panel; @@ -1250,39 +1256,39 @@ void UI_panels_end(const bContext *C, ARegion *ar, int *r_x, int *r_y) } /* compute size taken up by panel */ - ui_panels_size(sa, ar, r_x, r_y); + ui_panels_size(sa, region, r_x, r_y); } -void UI_panels_draw(const bContext *C, ARegion *ar) +void UI_panels_draw(const bContext *C, ARegion *region) { uiBlock *block; - if (ar->alignment != RGN_ALIGN_FLOAT) { + if (region->alignment != RGN_ALIGN_FLOAT) { UI_ThemeClearColor(TH_BACK); } /* Draw panels, selected on top. Also in reverse order, because * UI blocks are added in reverse order and we need child panels * to draw on top. */ - for (block = ar->uiblocks.last; block; block = block->prev) { + for (block = region->uiblocks.last; block; block = block->prev) { if (block->active && block->panel && !(block->panel->flag & PNL_SELECT)) { UI_block_draw(C, block); } } - for (block = ar->uiblocks.last; block; block = block->prev) { + for (block = region->uiblocks.last; block; block = block->prev) { if (block->active && block->panel && (block->panel->flag & PNL_SELECT)) { UI_block_draw(C, block); } } } -void UI_panels_scale(ARegion *ar, float new_width) +void UI_panels_scale(ARegion *region, float new_width) { uiBlock *block; uiBut *but; - for (block = ar->uiblocks.first; block; block = block->next) { + for (block = region->uiblocks.first; block; block = block->next) { if (block->panel) { float fac = new_width / (float)block->panel->sizex; block->panel->sizex = new_width; @@ -1297,13 +1303,13 @@ void UI_panels_scale(ARegion *ar, float new_width) /* ------------ panel merging ---------------- */ -static void check_panel_overlap(ARegion *ar, Panel *panel) +static void check_panel_overlap(ARegion *region, Panel *panel) { Panel *pa; /* also called with (panel == NULL) for clear */ - for (pa = ar->panels.first; pa; pa = pa->next) { + for (pa = region->panels.first; pa; pa = pa->next) { pa->flag &= ~PNL_OVERLAP; if (panel && (pa != panel)) { if (pa->runtime_flag & PNL_ACTIVE) { @@ -1342,19 +1348,19 @@ static void ui_do_drag(const bContext *C, const wmEvent *event, Panel *panel) { uiHandlePanelData *data = panel->activedata; ScrArea *sa = CTX_wm_area(C); - ARegion *ar = CTX_wm_region(C); - short align = panel_aligned(sa, ar), dx = 0, dy = 0; + ARegion *region = CTX_wm_region(C); + short align = panel_aligned(sa, region), dx = 0, dy = 0; /* first clip for window, no dragging outside */ - if (!BLI_rcti_isect_pt_v(&ar->winrct, &event->x)) { + if (!BLI_rcti_isect_pt_v(®ion->winrct, &event->x)) { return; } dx = (event->x - data->startx) & ~(PNL_GRID - 1); dy = (event->y - data->starty) & ~(PNL_GRID - 1); - dx *= (float)BLI_rctf_size_x(&ar->v2d.cur) / (float)BLI_rcti_size_x(&ar->winrct); - dy *= (float)BLI_rctf_size_y(&ar->v2d.cur) / (float)BLI_rcti_size_y(&ar->winrct); + dx *= (float)BLI_rctf_size_x(®ion->v2d.cur) / (float)BLI_rcti_size_x(®ion->winrct); + dy *= (float)BLI_rctf_size_y(®ion->v2d.cur) / (float)BLI_rcti_size_y(®ion->winrct); if (data->state == PANEL_STATE_DRAG_SCALE) { panel->sizex = MAX2(data->startsizex + dx, UI_PANEL_MINX); @@ -1372,14 +1378,14 @@ static void ui_do_drag(const bContext *C, const wmEvent *event, Panel *panel) panel->ofsx = data->startofsx + dx; panel->ofsy = data->startofsy + dy; - check_panel_overlap(ar, panel); + check_panel_overlap(region, panel); if (align) { - uiAlignPanelStep(sa, ar, 0.2, true); + uiAlignPanelStep(sa, region, 0.2, true); } } - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); } /******************* region level panel interaction *****************/ @@ -1436,16 +1442,16 @@ static void ui_panel_drag_collapse(bContext *C, const int xy_dst[2]) { ScrArea *sa = CTX_wm_area(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); uiBlock *block; Panel *pa; - for (block = ar->uiblocks.first; block; block = block->next) { + for (block = region->uiblocks.first; block; block = block->next) { float xy_a_block[2] = {UNPACK2(dragcol_data->xy_init)}; float xy_b_block[2] = {UNPACK2(xy_dst)}; rctf rect = block->rect; int oldflag; - const bool is_horizontal = (panel_aligned(sa, ar) == BUT_HORIZONTAL); + const bool is_horizontal = (panel_aligned(sa, region) == BUT_HORIZONTAL); if ((pa = block->panel) == 0 || (pa->type && (pa->type->flag & PNL_NO_HEADER))) { continue; @@ -1461,8 +1467,8 @@ static void ui_panel_drag_collapse(bContext *C, } /* use cursor coords in block space */ - ui_window_to_block_fl(ar, block, &xy_a_block[0], &xy_a_block[1]); - ui_window_to_block_fl(ar, block, &xy_b_block[0], &xy_b_block[1]); + ui_window_to_block_fl(region, block, &xy_a_block[0], &xy_a_block[1]); + ui_window_to_block_fl(region, block, &xy_b_block[0], &xy_b_block[1]); /* set up rect to match header size */ rect.ymin = rect.ymax; @@ -1548,17 +1554,18 @@ static void ui_handle_panel_header( const bContext *C, uiBlock *block, int mx, int my, int event, short ctrl, short shift) { ScrArea *sa = CTX_wm_area(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); #ifdef USE_PIN_HIDDEN - const bool show_pin = UI_panel_category_is_visible(ar) && (block->panel->type->parent == NULL) && - (block->panel->flag & PNL_PIN); + const bool show_pin = UI_panel_category_is_visible(region) && + (block->panel->type->parent == NULL) && (block->panel->flag & PNL_PIN); #else - const bool show_pin = UI_panel_category_is_visible(ar) && (block->panel->type->parent == NULL); + const bool show_pin = UI_panel_category_is_visible(region) && + (block->panel->type->parent == NULL); #endif const bool is_subpanel = (block->panel->type && block->panel->type->parent); const bool show_drag = !is_subpanel; - int align = panel_aligned(sa, ar), button = 0; + int align = panel_aligned(sa, region), button = 0; rctf rect_drag, rect_pin; float rect_leftmost; @@ -1609,14 +1616,14 @@ static void ui_handle_panel_header( if (button) { if (button == 2) { /* close */ - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); } else { /* collapse */ if (ctrl) { - panels_collapse_all(sa, ar, block->panel); + panels_collapse_all(sa, region, block->panel); /* reset the view - we don't want to display a view without content */ - UI_view2d_offset(&ar->v2d, 0.0f, 1.0f); + UI_view2d_offset(®ion->v2d, 0.0f, 1.0f); } if (block->panel->flag & PNL_CLOSED) { @@ -1657,42 +1664,44 @@ static void ui_handle_panel_header( /* FIXME: this doesn't update the panel drawing, assert to avoid debugging why this is. * We could fix this in the future if it's ever needed. */ BLI_assert(0); - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); } } else if (show_drag && BLI_rctf_isect_x(&rect_drag, mx)) { /* XXX, for now don't allow dragging in floating windows yet. */ - if (ar->alignment == RGN_ALIGN_FLOAT) { + if (region->alignment == RGN_ALIGN_FLOAT) { return; } panel_activate_state(C, block->panel, PANEL_STATE_DRAG); } else if (show_pin && BLI_rctf_isect_x(&rect_pin, mx)) { block->panel->flag ^= PNL_PIN; - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); } } -bool UI_panel_category_is_visible(const ARegion *ar) +bool UI_panel_category_is_visible(const ARegion *region) { /* more than one */ - return ar->panels_category.first && ar->panels_category.first != ar->panels_category.last; + return region->panels_category.first && + region->panels_category.first != region->panels_category.last; } -PanelCategoryDyn *UI_panel_category_find(ARegion *ar, const char *idname) +PanelCategoryDyn *UI_panel_category_find(ARegion *region, const char *idname) { - return BLI_findstring(&ar->panels_category, idname, offsetof(PanelCategoryDyn, idname)); + return BLI_findstring(®ion->panels_category, idname, offsetof(PanelCategoryDyn, idname)); } -PanelCategoryStack *UI_panel_category_active_find(ARegion *ar, const char *idname) +PanelCategoryStack *UI_panel_category_active_find(ARegion *region, const char *idname) { - return BLI_findstring(&ar->panels_category_active, idname, offsetof(PanelCategoryStack, idname)); + return BLI_findstring( + ®ion->panels_category_active, idname, offsetof(PanelCategoryStack, idname)); } -static void ui_panel_category_active_set(ARegion *ar, const char *idname, bool fallback) +static void ui_panel_category_active_set(ARegion *region, const char *idname, bool fallback) { - ListBase *lb = &ar->panels_category_active; - PanelCategoryStack *pc_act = UI_panel_category_active_find(ar, idname); + ListBase *lb = ®ion->panels_category_active; + PanelCategoryStack *pc_act = UI_panel_category_active_find(region, idname); if (pc_act) { BLI_remlink(lb, pc_act); @@ -1719,7 +1728,8 @@ static void ui_panel_category_active_set(ARegion *ar, const char *idname, bool f pc_act_next = pc_act->next; while ((pc_act = pc_act_next)) { pc_act_next = pc_act->next; - if (!BLI_findstring(&ar->type->paneltypes, pc_act->idname, offsetof(PanelType, category))) { + if (!BLI_findstring( + ®ion->type->paneltypes, pc_act->idname, offsetof(PanelType, category))) { BLI_remlink(lb, pc_act); MEM_freeN(pc_act); } @@ -1727,32 +1737,32 @@ static void ui_panel_category_active_set(ARegion *ar, const char *idname, bool f } } -void UI_panel_category_active_set(ARegion *ar, const char *idname) +void UI_panel_category_active_set(ARegion *region, const char *idname) { - ui_panel_category_active_set(ar, idname, false); + ui_panel_category_active_set(region, idname, false); } -void UI_panel_category_active_set_default(ARegion *ar, const char *idname) +void UI_panel_category_active_set_default(ARegion *region, const char *idname) { - if (!UI_panel_category_active_find(ar, idname)) { - ui_panel_category_active_set(ar, idname, true); + if (!UI_panel_category_active_find(region, idname)) { + ui_panel_category_active_set(region, idname, true); } } -const char *UI_panel_category_active_get(ARegion *ar, bool set_fallback) +const char *UI_panel_category_active_get(ARegion *region, bool set_fallback) { PanelCategoryStack *pc_act; - for (pc_act = ar->panels_category_active.first; pc_act; pc_act = pc_act->next) { - if (UI_panel_category_find(ar, pc_act->idname)) { + for (pc_act = region->panels_category_active.first; pc_act; pc_act = pc_act->next) { + if (UI_panel_category_find(region, pc_act->idname)) { return pc_act->idname; } } if (set_fallback) { - PanelCategoryDyn *pc_dyn = ar->panels_category.first; + PanelCategoryDyn *pc_dyn = region->panels_category.first; if (pc_dyn) { - ui_panel_category_active_set(ar, pc_dyn->idname, true); + ui_panel_category_active_set(region, pc_dyn->idname, true); return pc_dyn->idname; } } @@ -1760,11 +1770,11 @@ const char *UI_panel_category_active_get(ARegion *ar, bool set_fallback) return NULL; } -PanelCategoryDyn *UI_panel_category_find_mouse_over_ex(ARegion *ar, const int x, const int y) +PanelCategoryDyn *UI_panel_category_find_mouse_over_ex(ARegion *region, const int x, const int y) { PanelCategoryDyn *ptd; - for (ptd = ar->panels_category.first; ptd; ptd = ptd->next) { + for (ptd = region->panels_category.first; ptd; ptd = ptd->next) { if (BLI_rcti_isect_pt(&ptd->rect, x, y)) { return ptd; } @@ -1773,24 +1783,24 @@ PanelCategoryDyn *UI_panel_category_find_mouse_over_ex(ARegion *ar, const int x, return NULL; } -PanelCategoryDyn *UI_panel_category_find_mouse_over(ARegion *ar, const wmEvent *event) +PanelCategoryDyn *UI_panel_category_find_mouse_over(ARegion *region, const wmEvent *event) { - return UI_panel_category_find_mouse_over_ex(ar, event->mval[0], event->mval[1]); + return UI_panel_category_find_mouse_over_ex(region, event->mval[0], event->mval[1]); } -void UI_panel_category_add(ARegion *ar, const char *name) +void UI_panel_category_add(ARegion *region, const char *name) { PanelCategoryDyn *pc_dyn = MEM_callocN(sizeof(*pc_dyn), __func__); - BLI_addtail(&ar->panels_category, pc_dyn); + BLI_addtail(®ion->panels_category, pc_dyn); BLI_strncpy(pc_dyn->idname, name, sizeof(pc_dyn->idname)); /* 'pc_dyn->rect' must be set on draw */ } -void UI_panel_category_clear_all(ARegion *ar) +void UI_panel_category_clear_all(ARegion *region) { - BLI_freelistN(&ar->panels_category); + BLI_freelistN(®ion->panels_category); } static void imm_buf_append( @@ -1922,18 +1932,18 @@ static void ui_panel_category_draw_tab(bool filled, * Draw vertical tabs on the left side of the region, * one tab per category. */ -void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active) +void UI_panel_category_draw_all(ARegion *region, const char *category_id_active) { /* no tab outlines for */ // #define USE_FLAT_INACTIVE - const bool is_left = RGN_ALIGN_ENUM_FROM_MASK(ar->alignment != RGN_ALIGN_RIGHT); - View2D *v2d = &ar->v2d; + const bool is_left = RGN_ALIGN_ENUM_FROM_MASK(region->alignment != RGN_ALIGN_RIGHT); + View2D *v2d = ®ion->v2d; uiStyle *style = UI_style_get(); const uiFontStyle *fstyle = &style->widget; const int fontid = fstyle->uifont_id; short fstyle_points = fstyle->points; PanelCategoryDyn *pc_dyn; - const float aspect = ((uiBlock *)ar->uiblocks.first)->aspect; + const float aspect = ((uiBlock *)region->uiblocks.first)->aspect; const float zoom = 1.0f / aspect; const int px = max_ii(1, round_fl_to_int(U.pixelsize)); const int px_x_sign = is_left ? px : -px; @@ -1990,7 +2000,7 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active) interp_v3_v3v3_uchar( theme_col_tab_highlight_inactive, theme_col_tab_inactive, theme_col_text_hi, 0.12f); - is_alpha = (ar->overlap && (theme_col_back[3] != 255)); + is_alpha = (region->overlap && (theme_col_back[3] != 255)); if (fstyle->kerning == 1) { BLF_enable(fstyle->uifont_id, BLF_KERNING_DEFAULT); @@ -2004,12 +2014,12 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active) /* Check the region type supports categories to avoid an assert * for showing 3D view panels in the properties space. */ - if ((1 << ar->regiontype) & RGN_TYPE_HAS_CATEGORY_MASK) { - BLI_assert(UI_panel_category_is_visible(ar)); + if ((1 << region->regiontype) & RGN_TYPE_HAS_CATEGORY_MASK) { + BLI_assert(UI_panel_category_is_visible(region)); } /* calculate tab rect's and check if we need to scale down */ - for (pc_dyn = ar->panels_category.first; pc_dyn; pc_dyn = pc_dyn->next) { + for (pc_dyn = region->panels_category.first; pc_dyn; pc_dyn = pc_dyn->next) { rcti *rct = &pc_dyn->rect; const char *category_id = pc_dyn->idname; const char *category_id_draw = IFACE_(category_id); @@ -2027,7 +2037,7 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active) if (y_ofs > BLI_rcti_size_y(&v2d->mask)) { scaletabs = (float)BLI_rcti_size_y(&v2d->mask) / (float)y_ofs; - for (pc_dyn = ar->panels_category.first; pc_dyn; pc_dyn = pc_dyn->next) { + for (pc_dyn = region->panels_category.first; pc_dyn; pc_dyn = pc_dyn->next) { rcti *rct = &pc_dyn->rect; rct->ymin = ((rct->ymin - v2d->mask.ymax) * scaletabs) + v2d->mask.ymax; rct->ymax = ((rct->ymax - v2d->mask.ymax) * scaletabs) + v2d->mask.ymax; @@ -2072,7 +2082,7 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active) const int divider_xmax = is_left ? (v2d->mask.xmin + category_tabs_width) : (v2d->mask.xmax - (category_tabs_width + px)) + px; - for (pc_dyn = ar->panels_category.first; pc_dyn; pc_dyn = pc_dyn->next) { + for (pc_dyn = region->panels_category.first; pc_dyn; pc_dyn = pc_dyn->next) { const rcti *rct = &pc_dyn->rect; const char *category_id = pc_dyn->idname; const char *category_id_draw = IFACE_(category_id); @@ -2209,14 +2219,14 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active) } static int ui_handle_panel_category_cycling(const wmEvent *event, - ARegion *ar, + ARegion *region, const uiBut *active_but) { const bool is_mousewheel = ELEM(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE); const bool inside_tabregion = - ((RGN_ALIGN_ENUM_FROM_MASK(ar->alignment) != RGN_ALIGN_RIGHT) ? - (event->mval[0] < ((PanelCategoryDyn *)ar->panels_category.first)->rect.xmax) : - (event->mval[0] > ((PanelCategoryDyn *)ar->panels_category.first)->rect.xmin)); + ((RGN_ALIGN_ENUM_FROM_MASK(region->alignment) != RGN_ALIGN_RIGHT) ? + (event->mval[0] < ((PanelCategoryDyn *)region->panels_category.first)->rect.xmax) : + (event->mval[0] > ((PanelCategoryDyn *)region->panels_category.first)->rect.xmin)); /* if mouse is inside non-tab region, ctrl key is required */ if (is_mousewheel && !event->ctrl && !inside_tabregion) { @@ -2228,9 +2238,9 @@ static int ui_handle_panel_category_cycling(const wmEvent *event, * using ctrl+mousewheel work in tabbed regions */ } else { - const char *category = UI_panel_category_active_get(ar, false); + const char *category = UI_panel_category_active_get(region, false); if (LIKELY(category)) { - PanelCategoryDyn *pc_dyn = UI_panel_category_find(ar, category); + PanelCategoryDyn *pc_dyn = UI_panel_category_find(region, category); if (LIKELY(pc_dyn)) { if (is_mousewheel) { /* we can probably get rid of this and only allow ctrl+tabbing */ @@ -2242,15 +2252,15 @@ static int ui_handle_panel_category_cycling(const wmEvent *event, if (!pc_dyn) { /* proper cyclic behavior, * back to first/last category (only used for ctrl+tab) */ - pc_dyn = backwards ? ar->panels_category.last : ar->panels_category.first; + pc_dyn = backwards ? region->panels_category.last : region->panels_category.first; } } if (pc_dyn) { /* intentionally don't reset scroll in this case, * this allows for quick browsing between tabs */ - UI_panel_category_active_set(ar, pc_dyn->idname); - ED_region_tag_redraw(ar); + UI_panel_category_active_set(region, pc_dyn->idname); + ED_region_tag_redraw(region); } } } @@ -2265,18 +2275,18 @@ static int ui_handle_panel_category_cycling(const wmEvent *event, int ui_handler_panel_region(bContext *C, const wmEvent *event, - ARegion *ar, + ARegion *region, const uiBut *active_but) { uiBlock *block; Panel *pa; int retval, mx, my; - bool has_category_tabs = UI_panel_category_is_visible(ar); + bool has_category_tabs = UI_panel_category_is_visible(region); retval = WM_UI_HANDLER_CONTINUE; /* Scrollbars can overlap panels now, they have handling priority. */ - if (UI_view2d_mouse_in_scrollers(ar, &ar->v2d, event->x, event->y)) { + if (UI_view2d_mouse_in_scrollers(region, ®ion->v2d, event->x, event->y)) { return retval; } @@ -2284,13 +2294,13 @@ int ui_handler_panel_region(bContext *C, if (has_category_tabs) { if (event->val == KM_PRESS) { if (event->type == LEFTMOUSE) { - PanelCategoryDyn *pc_dyn = UI_panel_category_find_mouse_over(ar, event); + PanelCategoryDyn *pc_dyn = UI_panel_category_find_mouse_over(region, event); if (pc_dyn) { - UI_panel_category_active_set(ar, pc_dyn->idname); - ED_region_tag_redraw(ar); + UI_panel_category_active_set(region, pc_dyn->idname); + ED_region_tag_redraw(region); /* reset scroll to the top [#38348] */ - UI_view2d_offset(&ar->v2d, -1.0f, 1.0f); + UI_view2d_offset(®ion->v2d, -1.0f, 1.0f); retval = WM_UI_HANDLER_BREAK; } @@ -2298,7 +2308,7 @@ int ui_handler_panel_region(bContext *C, else if ((event->type == TABKEY && event->ctrl) || ELEM(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE)) { /* cycle tabs */ - retval = ui_handle_panel_category_cycling(event, ar, active_but); + retval = ui_handle_panel_category_cycling(event, region, active_but); } } } @@ -2307,12 +2317,12 @@ int ui_handler_panel_region(bContext *C, return retval; } - for (block = ar->uiblocks.last; block; block = block->prev) { + for (block = region->uiblocks.last; block; block = block->prev) { uiPanelMouseState mouse_state; mx = event->x; my = event->y; - ui_window_to_block(ar, block, &mx, &my); + ui_window_to_block(region, block, &mx, &my); /* checks for mouse position inside */ pa = block->panel; @@ -2347,7 +2357,7 @@ int ui_handler_panel_region(bContext *C, } /* on active button, do not handle panels */ - if (ui_region_find_active_but(ar) != NULL) { + if (ui_region_find_active_but(region) != NULL) { continue; } @@ -2380,7 +2390,7 @@ int ui_handler_panel_region(bContext *C, } else if (event->type == RIGHTMOUSE) { if (mouse_state == PANEL_MOUSE_INSIDE_HEADER) { - ui_popup_context_menu_for_panel(C, ar, block->panel); + ui_popup_context_menu_for_panel(C, region, block->panel); retval = WM_UI_HANDLER_BREAK; break; } @@ -2390,7 +2400,7 @@ int ui_handler_panel_region(bContext *C, #if 0 if (block->handler) { rem_blockhandler(sa, block->handler); - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); retval = WM_UI_HANDLER_BREAK; } #endif @@ -2423,7 +2433,7 @@ int ui_handler_panel_region(bContext *C, } CLAMP(sl->blockscale, 0.6, 1.0); - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); retval = WM_UI_HANDLER_BREAK; } } @@ -2448,8 +2458,8 @@ static int ui_handler_panel(bContext *C, const wmEvent *event, void *userdata) /* verify if we can stop */ if (event->type == LEFTMOUSE && event->val == KM_RELEASE) { ScrArea *sa = CTX_wm_area(C); - ARegion *ar = CTX_wm_region(C); - int align = panel_aligned(sa, ar); + ARegion *region = CTX_wm_region(C); + int align = panel_aligned(sa, region); if (align) { panel_activate_state(C, panel, PANEL_STATE_ANIMATION); @@ -2493,7 +2503,7 @@ static void panel_activate_state(const bContext *C, Panel *pa, uiHandlePanelStat { uiHandlePanelData *data = pa->activedata; wmWindow *win = CTX_wm_window(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); if (data && data->state == state) { return; @@ -2507,8 +2517,8 @@ static void panel_activate_state(const bContext *C, Panel *pa, uiHandlePanelStat * is very hard to control and use, and has no real benefit." - BillRey * Aligorith, 2009Sep */ - // test_add_new_tabs(ar); // also copies locations of tabs in dragged panel - check_panel_overlap(ar, NULL); /* clears */ + // test_add_new_tabs(region); // also copies locations of tabs in dragged panel + check_panel_overlap(region, NULL); /* clears */ } pa->flag &= ~PNL_SELECT; @@ -2552,7 +2562,7 @@ static void panel_activate_state(const bContext *C, Panel *pa, uiHandlePanelStat data->starttime = PIL_check_seconds_timer(); } - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); } PanelType *UI_paneltype_find(int space_id, int region_id, const char *idname) diff --git a/source/blender/editors/interface/interface_query.c b/source/blender/editors/interface/interface_query.c index ab20b5ac520..03434b12ddb 100644 --- a/source/blender/editors/interface/interface_query.c +++ b/source/blender/editors/interface/interface_query.c @@ -206,15 +206,15 @@ bool ui_but_contains_rect(const uiBut *but, const rctf *rect) return BLI_rctf_isect(&but->rect, rect, NULL); } -bool ui_but_contains_point_px(const uiBut *but, const ARegion *ar, int x, int y) +bool ui_but_contains_point_px(const uiBut *but, const ARegion *region, int x, int y) { uiBlock *block = but->block; - if (!ui_region_contains_point_px(ar, x, y)) { + if (!ui_region_contains_point_px(region, x, y)) { return false; } float mx = x, my = y; - ui_window_to_block_fl(ar, block, &mx, &my); + ui_window_to_block_fl(region, block, &mx, &my); if (but->pie_dir != UI_RADIAL_NONE) { if (!ui_but_isect_pie_seg(block, but)) { @@ -228,12 +228,12 @@ bool ui_but_contains_point_px(const uiBut *but, const ARegion *ar, int x, int y) return true; } -bool ui_but_contains_point_px_icon(const uiBut *but, ARegion *ar, const wmEvent *event) +bool ui_but_contains_point_px_icon(const uiBut *but, ARegion *region, const wmEvent *event) { rcti rect; int x = event->x, y = event->y; - ui_window_to_block(ar, but->block, &x, &y); + ui_window_to_block(region, but->block, &x, &y); BLI_rcti_rctf_copy(&rect, &but->rect); @@ -253,16 +253,16 @@ bool ui_but_contains_point_px_icon(const uiBut *but, ARegion *ar, const wmEvent } /* x and y are only used in case event is NULL... */ -uiBut *ui_but_find_mouse_over_ex(ARegion *ar, const int x, const int y, const bool labeledit) +uiBut *ui_but_find_mouse_over_ex(ARegion *region, const int x, const int y, const bool labeledit) { uiBut *butover = NULL; - if (!ui_region_contains_point_px(ar, x, y)) { + if (!ui_region_contains_point_px(region, x, y)) { return NULL; } - for (uiBlock *block = ar->uiblocks.first; block; block = block->next) { + for (uiBlock *block = region->uiblocks.first; block; block = block->next) { float mx = x, my = y; - ui_window_to_block_fl(ar, block, &mx, &my); + ui_window_to_block_fl(region, block, &mx, &my); for (uiBut *but = block->buttons.last; but; but = but->prev) { if (ui_but_is_interactive(but, labeledit)) { @@ -291,14 +291,14 @@ uiBut *ui_but_find_mouse_over_ex(ARegion *ar, const int x, const int y, const bo return butover; } -uiBut *ui_but_find_mouse_over(ARegion *ar, const wmEvent *event) +uiBut *ui_but_find_mouse_over(ARegion *region, const wmEvent *event) { - return ui_but_find_mouse_over_ex(ar, event->x, event->y, event->ctrl != 0); + return ui_but_find_mouse_over_ex(region, event->x, event->y, event->ctrl != 0); } -uiBut *ui_but_find_rect_over(const struct ARegion *ar, const rcti *rect_px) +uiBut *ui_but_find_rect_over(const struct ARegion *region, const rcti *rect_px) { - if (!ui_region_contains_rect_px(ar, rect_px)) { + if (!ui_region_contains_rect_px(region, rect_px)) { return NULL; } @@ -308,9 +308,9 @@ uiBut *ui_but_find_rect_over(const struct ARegion *ar, const rcti *rect_px) BLI_rctf_rcti_copy(&rect_px_fl, rect_px); uiBut *butover = NULL; - for (uiBlock *block = ar->uiblocks.first; block; block = block->next) { + for (uiBlock *block = region->uiblocks.first; block; block = block->next) { rctf rect_block; - ui_window_to_block_rctf(ar, block, &rect_block, &rect_px_fl); + ui_window_to_block_rctf(region, block, &rect_block, &rect_px_fl); for (uiBut *but = block->buttons.last; but; but = but->prev) { if (ui_but_is_interactive(but, labeledit)) { @@ -334,14 +334,14 @@ uiBut *ui_but_find_rect_over(const struct ARegion *ar, const rcti *rect_px) return butover; } -uiBut *ui_list_find_mouse_over_ex(ARegion *ar, int x, int y) +uiBut *ui_list_find_mouse_over_ex(ARegion *region, int x, int y) { - if (!ui_region_contains_point_px(ar, x, y)) { + if (!ui_region_contains_point_px(region, x, y)) { return NULL; } - for (uiBlock *block = ar->uiblocks.first; block; block = block->next) { + for (uiBlock *block = region->uiblocks.first; block; block = block->next) { float mx = x, my = y; - ui_window_to_block_fl(ar, block, &mx, &my); + ui_window_to_block_fl(region, block, &mx, &my); for (uiBut *but = block->buttons.last; but; but = but->prev) { if (but->type == UI_BTYPE_LISTBOX && ui_but_contains_pt(but, mx, my)) { return but; @@ -352,9 +352,9 @@ uiBut *ui_list_find_mouse_over_ex(ARegion *ar, int x, int y) return NULL; } -uiBut *ui_list_find_mouse_over(ARegion *ar, const wmEvent *event) +uiBut *ui_list_find_mouse_over(ARegion *region, const wmEvent *event) { - return ui_list_find_mouse_over_ex(ar, event->x, event->y); + return ui_list_find_mouse_over_ex(region, event->x, event->y); } /** \} */ @@ -508,9 +508,9 @@ bool UI_block_can_add_separator(const uiBlock *block) /** \name Region (#ARegion) State * \{ */ -uiBut *ui_region_find_active_but(ARegion *ar) +uiBut *ui_region_find_active_but(ARegion *region) { - for (uiBlock *block = ar->uiblocks.first; block; block = block->next) { + for (uiBlock *block = region->uiblocks.first; block; block = block->next) { for (uiBut *but = block->buttons.first; but; but = but->next) { if (but->active) { return but; @@ -521,9 +521,9 @@ uiBut *ui_region_find_active_but(ARegion *ar) return NULL; } -uiBut *ui_region_find_first_but_test_flag(ARegion *ar, int flag_include, int flag_exclude) +uiBut *ui_region_find_first_but_test_flag(ARegion *region, int flag_include, int flag_exclude) { - for (uiBlock *block = ar->uiblocks.first; block; block = block->next) { + for (uiBlock *block = region->uiblocks.first; block; block = block->next) { for (uiBut *but = block->buttons.first; but; but = but->next) { if (((but->flag & flag_include) == flag_include) && ((but->flag & flag_exclude) == 0)) { return but; @@ -540,10 +540,10 @@ uiBut *ui_region_find_first_but_test_flag(ARegion *ar, int flag_include, int fla /** \name Region (#ARegion) Spatial * \{ */ -bool ui_region_contains_point_px(const ARegion *ar, int x, int y) +bool ui_region_contains_point_px(const ARegion *region, int x, int y) { rcti winrct; - ui_region_winrct_get_no_margin(ar, &winrct); + ui_region_winrct_get_no_margin(region, &winrct); if (!BLI_rcti_isect_pt(&winrct, x, y)) { return false; } @@ -553,13 +553,13 @@ bool ui_region_contains_point_px(const ARegion *ar, int x, int y) * even when they are not visible, so we need to make a copy of the mask to * use to check */ - if (ar->v2d.mask.xmin != ar->v2d.mask.xmax) { - const View2D *v2d = &ar->v2d; + if (region->v2d.mask.xmin != region->v2d.mask.xmax) { + const View2D *v2d = ®ion->v2d; int mx = x, my = y; - ui_window_to_region(ar, &mx, &my); + ui_window_to_region(region, &mx, &my); if (!BLI_rcti_isect_pt(&v2d->mask, mx, my) || - UI_view2d_mouse_in_scrollers(ar, &ar->v2d, x, y)) { + UI_view2d_mouse_in_scrollers(region, ®ion->v2d, x, y)) { return false; } } @@ -567,21 +567,21 @@ bool ui_region_contains_point_px(const ARegion *ar, int x, int y) return true; } -bool ui_region_contains_rect_px(const ARegion *ar, const rcti *rect_px) +bool ui_region_contains_rect_px(const ARegion *region, const rcti *rect_px) { rcti winrct; - ui_region_winrct_get_no_margin(ar, &winrct); + ui_region_winrct_get_no_margin(region, &winrct); if (!BLI_rcti_isect(&winrct, rect_px, NULL)) { return false; } /* See comment in 'ui_region_contains_point_px' */ - if (ar->v2d.mask.xmin != ar->v2d.mask.xmax) { - const View2D *v2d = &ar->v2d; + if (region->v2d.mask.xmin != region->v2d.mask.xmax) { + const View2D *v2d = ®ion->v2d; rcti rect_region; - ui_window_to_region_rcti(ar, &rect_region, rect_px); + ui_window_to_region_rcti(region, &rect_region, rect_px); if (!BLI_rcti_isect(&v2d->mask, &rect_region, NULL) || - UI_view2d_rect_in_scrollers(ar, &ar->v2d, rect_px)) { + UI_view2d_rect_in_scrollers(region, ®ion->v2d, rect_px)) { return false; } } @@ -598,13 +598,13 @@ bool ui_region_contains_rect_px(const ARegion *ar, const rcti *rect_px) /** Check if the cursor is over any popups. */ ARegion *ui_screen_region_find_mouse_over_ex(bScreen *screen, int x, int y) { - for (ARegion *ar = screen->regionbase.first; ar; ar = ar->next) { + for (ARegion *region = screen->regionbase.first; region; region = region->next) { rcti winrct; - ui_region_winrct_get_no_margin(ar, &winrct); + ui_region_winrct_get_no_margin(region, &winrct); if (BLI_rcti_isect_pt(&winrct, x, y)) { - return ar; + return region; } } return NULL; diff --git a/source/blender/editors/interface/interface_region_hud.c b/source/blender/editors/interface/interface_region_hud.c index d32cd5c17e2..04e6c5c24c2 100644 --- a/source/blender/editors/interface/interface_region_hud.c +++ b/source/blender/editors/interface/interface_region_hud.c @@ -87,12 +87,12 @@ static bool last_redo_poll(const bContext *C, short region_type) return success; } -static void hud_region_hide(ARegion *ar) +static void hud_region_hide(ARegion *region) { - ar->flag |= RGN_FLAG_HIDDEN; + region->flag |= RGN_FLAG_HIDDEN; /* Avoids setting 'AREA_FLAG_REGION_SIZE_UPDATE' * since other regions don't depend on this. */ - BLI_rcti_init(&ar->winrct, 0, 0, 0, 0); + BLI_rcti_init(®ion->winrct, 0, 0, 0, 0); } /** \} */ @@ -104,9 +104,9 @@ static void hud_region_hide(ARegion *ar) static bool hud_panel_operator_redo_poll(const bContext *C, PanelType *UNUSED(pt)) { ScrArea *sa = CTX_wm_area(C); - ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_HUD); - if (ar != NULL) { - struct HudRegionData *hrd = ar->regiondata; + ARegion *region = BKE_area_find_region_type(sa, RGN_TYPE_HUD); + if (region != NULL) { + struct HudRegionData *hrd = region->regiondata; if (hrd != NULL) { return last_redo_poll(C, hrd->regionid); } @@ -156,76 +156,76 @@ static void hud_panels_register(ARegionType *art, int space_type, int region_typ /** \name Callbacks for Floating Region * \{ */ -static void hud_region_init(wmWindowManager *wm, ARegion *ar) +static void hud_region_init(wmWindowManager *wm, ARegion *region) { - ED_region_panels_init(wm, ar); - UI_region_handlers_add(&ar->handlers); - ar->flag |= RGN_FLAG_TEMP_REGIONDATA; + ED_region_panels_init(wm, region); + UI_region_handlers_add(®ion->handlers); + region->flag |= RGN_FLAG_TEMP_REGIONDATA; } -static void hud_region_free(ARegion *ar) +static void hud_region_free(ARegion *region) { - MEM_SAFE_FREE(ar->regiondata); + MEM_SAFE_FREE(region->regiondata); } -static void hud_region_layout(const bContext *C, ARegion *ar) +static void hud_region_layout(const bContext *C, ARegion *region) { - struct HudRegionData *hrd = ar->regiondata; + struct HudRegionData *hrd = region->regiondata; if (hrd == NULL || !last_redo_poll(C, hrd->regionid)) { - ED_region_tag_redraw(ar); - hud_region_hide(ar); + ED_region_tag_redraw(region); + hud_region_hide(region); return; } - int size_y = ar->sizey; + int size_y = region->sizey; - ED_region_panels_layout(C, ar); + ED_region_panels_layout(C, region); - if (ar->panels.first && (ar->sizey != size_y)) { - int winx_new = UI_DPI_FAC * (ar->sizex + 0.5f); - int winy_new = UI_DPI_FAC * (ar->sizey + 0.5f); - View2D *v2d = &ar->v2d; + if (region->panels.first && (region->sizey != size_y)) { + int winx_new = UI_DPI_FAC * (region->sizex + 0.5f); + int winy_new = UI_DPI_FAC * (region->sizey + 0.5f); + View2D *v2d = ®ion->v2d; - if (ar->flag & RGN_FLAG_SIZE_CLAMP_X) { - CLAMP_MAX(winx_new, ar->winx); + if (region->flag & RGN_FLAG_SIZE_CLAMP_X) { + CLAMP_MAX(winx_new, region->winx); } - if (ar->flag & RGN_FLAG_SIZE_CLAMP_Y) { - CLAMP_MAX(winy_new, ar->winy); + if (region->flag & RGN_FLAG_SIZE_CLAMP_Y) { + CLAMP_MAX(winy_new, region->winy); } - ar->winx = winx_new; - ar->winy = winy_new; + region->winx = winx_new; + region->winy = winy_new; - ar->winrct.xmax = (ar->winrct.xmin + ar->winx) - 1; - ar->winrct.ymax = (ar->winrct.ymin + ar->winy) - 1; + region->winrct.xmax = (region->winrct.xmin + region->winx) - 1; + region->winrct.ymax = (region->winrct.ymin + region->winy) - 1; - UI_view2d_region_reinit(v2d, V2D_COMMONVIEW_PANELS_UI, ar->winx, ar->winy); + UI_view2d_region_reinit(v2d, V2D_COMMONVIEW_PANELS_UI, region->winx, region->winy); /* Weak, but needed to avoid glitches, especially with hi-dpi * (where resizing the view glitches often). * Fortunately this only happens occasionally. */ - ED_region_panels_layout(C, ar); + ED_region_panels_layout(C, region); } /* restore view matrix */ UI_view2d_view_restore(C); } -static void hud_region_draw(const bContext *C, ARegion *ar) +static void hud_region_draw(const bContext *C, ARegion *region) { - UI_view2d_view_ortho(&ar->v2d); - wmOrtho2_region_pixelspace(ar); + UI_view2d_view_ortho(®ion->v2d); + wmOrtho2_region_pixelspace(region); GPU_clear_color(0, 0, 0, 0.0f); GPU_clear(GPU_COLOR_BIT); - if ((ar->flag & RGN_FLAG_HIDDEN) == 0) { + if ((region->flag & RGN_FLAG_HIDDEN) == 0) { ui_draw_menu_back(NULL, NULL, &(rcti){ - .xmax = ar->winx, - .ymax = ar->winy, + .xmax = region->winx, + .ymax = region->winy, }); - ED_region_panels_draw(C, ar); + ED_region_panels_draw(C, region); } } @@ -252,28 +252,28 @@ ARegionType *ED_area_type_hud(int space_type) static ARegion *hud_region_add(ScrArea *sa) { - ARegion *ar = MEM_callocN(sizeof(ARegion), "area region"); + ARegion *region = MEM_callocN(sizeof(ARegion), "area region"); ARegion *ar_win = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW); if (ar_win) { - BLI_insertlinkbefore(&sa->regionbase, ar_win, ar); + BLI_insertlinkbefore(&sa->regionbase, ar_win, region); } else { - BLI_addtail(&sa->regionbase, ar); + BLI_addtail(&sa->regionbase, region); } - ar->regiontype = RGN_TYPE_HUD; - ar->alignment = RGN_ALIGN_FLOAT; - ar->overlap = true; - ar->flag |= RGN_FLAG_DYNAMIC_SIZE; + region->regiontype = RGN_TYPE_HUD; + region->alignment = RGN_ALIGN_FLOAT; + region->overlap = true; + region->flag |= RGN_FLAG_DYNAMIC_SIZE; if (ar_win) { float x, y; UI_view2d_scroller_size_get(&ar_win->v2d, &x, &y); - ar->runtime.offset_x = x; - ar->runtime.offset_y = y; + region->runtime.offset_x = x; + region->runtime.offset_y = y; } - return ar; + return region; } void ED_area_type_hud_clear(wmWindowManager *wm, ScrArea *sa_keep) @@ -282,11 +282,11 @@ void ED_area_type_hud_clear(wmWindowManager *wm, ScrArea *sa_keep) bScreen *screen = WM_window_get_active_screen(win); for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { if (sa != sa_keep) { - for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) { - if (ar->regiontype == RGN_TYPE_HUD) { - if ((ar->flag & RGN_FLAG_HIDDEN) == 0) { - hud_region_hide(ar); - ED_region_tag_redraw(ar); + for (ARegion *region = sa->regionbase.first; region; region = region->next) { + if (region->regiontype == RGN_TYPE_HUD) { + if ((region->flag & RGN_FLAG_HIDDEN) == 0) { + hud_region_hide(region); + ED_region_tag_redraw(region); ED_area_tag_redraw(sa); } } @@ -306,49 +306,49 @@ void ED_area_type_hud_ensure(bContext *C, ScrArea *sa) return; } - ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_HUD); + ARegion *region = BKE_area_find_region_type(sa, RGN_TYPE_HUD); - if (ar && (ar->flag & RGN_FLAG_HIDDEN_BY_USER)) { + if (region && (region->flag & RGN_FLAG_HIDDEN_BY_USER)) { /* The region is intentionally hidden by the user, don't show it. */ - hud_region_hide(ar); + hud_region_hide(region); return; } bool init = false; - bool was_hidden = ar == NULL || ar->visible == false; + bool was_hidden = region == NULL || region->visible == false; ARegion *ar_op = CTX_wm_region(C); BLI_assert((ar_op == NULL) || (ar_op->regiontype != RGN_TYPE_HUD)); if (!last_redo_poll(C, ar_op ? ar_op->regiontype : -1)) { - if (ar) { - ED_region_tag_redraw(ar); - hud_region_hide(ar); + if (region) { + ED_region_tag_redraw(region); + hud_region_hide(region); } return; } - if (ar == NULL) { + if (region == NULL) { init = true; - ar = hud_region_add(sa); - ar->type = art; + region = hud_region_add(sa); + region->type = art; } /* Let 'ED_area_update_region_sizes' do the work of placing the region. - * Otherwise we could set the 'ar->winrct' & 'ar->winx/winy' here. */ + * Otherwise we could set the 'region->winrct' & 'region->winx/winy' here. */ if (init) { sa->flag |= AREA_FLAG_REGION_SIZE_UPDATE; } else { - if (ar->flag & RGN_FLAG_HIDDEN) { + if (region->flag & RGN_FLAG_HIDDEN) { sa->flag |= AREA_FLAG_REGION_SIZE_UPDATE; } - ar->flag &= ~RGN_FLAG_HIDDEN; + region->flag &= ~RGN_FLAG_HIDDEN; } { - struct HudRegionData *hrd = ar->regiondata; + struct HudRegionData *hrd = region->regiondata; if (hrd == NULL) { hrd = MEM_callocN(sizeof(*hrd), __func__); - ar->regiondata = hrd; + region->regiondata = hrd; } if (ar_op) { hrd->regionid = ar_op->regiontype; @@ -364,37 +364,37 @@ void ED_area_type_hud_ensure(bContext *C, ScrArea *sa) ED_area_update_region_sizes(wm, win, sa); } - ED_region_floating_initialize(ar); - ED_region_tag_redraw(ar); + ED_region_floating_initialize(region); + ED_region_tag_redraw(region); /* Reset zoom level (not well supported). */ - ar->v2d.cur = ar->v2d.tot = (rctf){ - .xmax = ar->winx, - .ymax = ar->winy, + region->v2d.cur = region->v2d.tot = (rctf){ + .xmax = region->winx, + .ymax = region->winy, }; - ar->v2d.minzoom = 1.0f; - ar->v2d.maxzoom = 1.0f; + region->v2d.minzoom = 1.0f; + region->v2d.maxzoom = 1.0f; - ar->visible = !(ar->flag & RGN_FLAG_HIDDEN); + region->visible = !(region->flag & RGN_FLAG_HIDDEN); /* We shouldn't need to do this every time :S */ /* XXX, this is evil! - it also makes the menu show on first draw. :( */ - if (ar->visible) { + if (region->visible) { ARegion *ar_prev = CTX_wm_region(C); - CTX_wm_region_set((bContext *)C, ar); - hud_region_layout(C, ar); + CTX_wm_region_set((bContext *)C, region); + hud_region_layout(C, region); if (was_hidden) { - ar->winx = ar->v2d.winx; - ar->winy = ar->v2d.winy; - ar->v2d.cur = ar->v2d.tot = (rctf){ - .xmax = ar->winx, - .ymax = ar->winy, + region->winx = region->v2d.winx; + region->winy = region->v2d.winy; + region->v2d.cur = region->v2d.tot = (rctf){ + .xmax = region->winx, + .ymax = region->winy, }; } CTX_wm_region_set((bContext *)C, ar_prev); } - ar->visible = !((ar->flag & RGN_FLAG_HIDDEN) || (ar->flag & RGN_FLAG_TOO_SMALL)); + region->visible = !((region->flag & RGN_FLAG_HIDDEN) || (region->flag & RGN_FLAG_TOO_SMALL)); } /** \} */ diff --git a/source/blender/editors/interface/interface_region_menu_popup.c b/source/blender/editors/interface/interface_region_menu_popup.c index 2b6125fc193..1d066b6bbb1 100644 --- a/source/blender/editors/interface/interface_region_menu_popup.c +++ b/source/blender/editors/interface/interface_region_menu_popup.c @@ -277,15 +277,15 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi /* for a header menu we set the direction automatic */ if (!pup->slideout && flip) { ScrArea *sa = CTX_wm_area(C); - ARegion *ar = CTX_wm_region(C); - if (sa && ar) { - if (ELEM(ar->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) { + ARegion *region = CTX_wm_region(C); + if (sa && region) { + if (ELEM(region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) { if (RGN_ALIGN_ENUM_FROM_MASK(ED_area_header_alignment(sa)) == RGN_ALIGN_BOTTOM) { UI_block_direction_set(block, UI_DIR_UP); UI_block_order_flip(block); } } - if (ar->regiontype == RGN_TYPE_FOOTER) { + if (region->regiontype == RGN_TYPE_FOOTER) { if (RGN_ALIGN_ENUM_FROM_MASK(ED_area_footer_alignment(sa)) == RGN_ALIGN_BOTTOM) { UI_block_direction_set(block, UI_DIR_UP); UI_block_order_flip(block); @@ -669,8 +669,8 @@ void UI_popup_block_close(bContext *C, wmWindow *win, uiBlock *block) /* In the case we have nested popups, * closing one may need to redraw another, see: T48874 */ - for (ARegion *ar = screen->regionbase.first; ar; ar = ar->next) { - ED_region_tag_refresh_ui(ar); + for (ARegion *region = screen->regionbase.first; region; region = region->next) { + ED_region_tag_refresh_ui(region); } } } @@ -678,8 +678,8 @@ void UI_popup_block_close(bContext *C, wmWindow *win, uiBlock *block) bool UI_popup_block_name_exists(const bScreen *screen, const char *name) { - for (const ARegion *ar = screen->regionbase.first; ar; ar = ar->next) { - for (const uiBlock *block = ar->uiblocks.first; block; block = block->next) { + for (const ARegion *region = screen->regionbase.first; region; region = region->next) { + for (const uiBlock *block = region->uiblocks.first; block; block = block->next) { if (STREQ(block->name, name)) { return true; } diff --git a/source/blender/editors/interface/interface_region_popover.c b/source/blender/editors/interface/interface_region_popover.c index 5e88d48a787..4e4854c8209 100644 --- a/source/blender/editors/interface/interface_region_popover.c +++ b/source/blender/editors/interface/interface_region_popover.c @@ -172,21 +172,21 @@ static uiBlock *ui_block_func_POPOVER(bContext *C, uiPopupBlockHandle *handle, v if (!slideout) { ScrArea *sa = CTX_wm_area(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); - if (ar && ar->panels.first) { + if (region && region->panels.first) { /* For regions with panels, prefer to open to top so we can * see the values of the buttons below changing. */ UI_block_direction_set(block, UI_DIR_UP | UI_DIR_CENTER_X); } /* Prefer popover from header to be positioned into the editor. */ - else if (sa && ar) { - if (ELEM(ar->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) { + else if (sa && region) { + if (ELEM(region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) { if (RGN_ALIGN_ENUM_FROM_MASK(ED_area_header_alignment(sa)) == RGN_ALIGN_BOTTOM) { UI_block_direction_set(block, UI_DIR_UP | UI_DIR_CENTER_X); } } - if (ar->regiontype == RGN_TYPE_FOOTER) { + if (region->regiontype == RGN_TYPE_FOOTER) { if (RGN_ALIGN_ENUM_FROM_MASK(ED_area_footer_alignment(sa)) == RGN_ALIGN_BOTTOM) { UI_block_direction_set(block, UI_DIR_UP | UI_DIR_CENTER_X); } diff --git a/source/blender/editors/interface/interface_region_popup.c b/source/blender/editors/interface/interface_region_popup.c index 462f4871764..8db70d9a1cc 100644 --- a/source/blender/editors/interface/interface_region_popup.c +++ b/source/blender/editors/interface/interface_region_popup.c @@ -57,18 +57,18 @@ /** * Translate any popup regions (so we can drag them). */ -void ui_popup_translate(ARegion *ar, const int mdiff[2]) +void ui_popup_translate(ARegion *region, const int mdiff[2]) { uiBlock *block; - BLI_rcti_translate(&ar->winrct, UNPACK2(mdiff)); + BLI_rcti_translate(®ion->winrct, UNPACK2(mdiff)); - ED_region_update_rect(ar); + ED_region_update_rect(region); - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); /* update blocks */ - for (block = ar->uiblocks.first; block; block = block->next) { + for (block = region->uiblocks.first; block; block = block->next) { uiPopupBlockHandle *handle = block->handle; /* Make empty, will be initialized on next use, see T60608. */ BLI_rctf_init(&handle->prev_block_rect, 0, 0, 0, 0); @@ -369,19 +369,19 @@ static void ui_popup_block_position(wmWindow *window, /** \name Menu Block Creation * \{ */ -static void ui_block_region_refresh(const bContext *C, ARegion *ar) +static void ui_block_region_refresh(const bContext *C, ARegion *region) { ScrArea *ctx_area = CTX_wm_area(C); ARegion *ctx_region = CTX_wm_region(C); uiBlock *block; - if (ar->do_draw & RGN_REFRESH_UI) { + if (region->do_draw & RGN_REFRESH_UI) { ScrArea *handle_ctx_area; ARegion *handle_ctx_region; uiBlock *block_next; - ar->do_draw &= ~RGN_REFRESH_UI; - for (block = ar->uiblocks.first; block; block = block_next) { + region->do_draw &= ~RGN_REFRESH_UI; + for (block = region->uiblocks.first; block; block = block_next) { block_next = block->next; uiPopupBlockHandle *handle = block->handle; @@ -407,11 +407,11 @@ static void ui_block_region_refresh(const bContext *C, ARegion *ar) CTX_wm_region_set((bContext *)C, ctx_region); } -static void ui_block_region_draw(const bContext *C, ARegion *ar) +static void ui_block_region_draw(const bContext *C, ARegion *region) { uiBlock *block; - for (block = ar->uiblocks.first; block; block = block->next) { + for (block = region->uiblocks.first; block; block = block->next) { UI_block_draw(C, block); } } @@ -421,7 +421,7 @@ static void ui_block_region_draw(const bContext *C, ARegion *ar) */ static void ui_block_region_popup_window_listener(wmWindow *UNUSED(win), ScrArea *UNUSED(sa), - ARegion *ar, + ARegion *region, wmNotifier *wmn, const Scene *UNUSED(scene)) { @@ -430,7 +430,7 @@ static void ui_block_region_popup_window_listener(wmWindow *UNUSED(win), switch (wmn->action) { case NA_EDITED: { /* window resize */ - ED_region_tag_refresh_ui(ar); + ED_region_tag_refresh_ui(region); break; } } @@ -573,13 +573,13 @@ uiBlock *ui_popup_block_refresh(bContext *C, { const int margin = UI_POPUP_MARGIN; wmWindow *window = CTX_wm_window(C); - ARegion *ar = handle->region; + ARegion *region = handle->region; uiBlockCreateFunc create_func = handle->popup_create_vars.create_func; uiBlockHandleCreateFunc handle_create_func = handle->popup_create_vars.handle_create_func; void *arg = handle->popup_create_vars.arg; - uiBlock *block_old = ar->uiblocks.first; + uiBlock *block_old = region->uiblocks.first; uiBlock *block; handle->refresh = (block_old != NULL); @@ -592,7 +592,7 @@ uiBlock *ui_popup_block_refresh(bContext *C, /* create ui block */ if (create_func) { - block = create_func(C, ar, arg); + block = create_func(C, region, arg); } else { block = handle_create_func(C, handle, arg); @@ -615,7 +615,7 @@ uiBlock *ui_popup_block_refresh(bContext *C, block->handle = handle; } - ar->regiondata = handle; + region->regiondata = handle; /* set UI_BLOCK_NUMSELECT before UI_block_end() so we get alphanumeric keys assigned */ if (but == NULL) { @@ -689,10 +689,10 @@ uiBlock *ui_popup_block_refresh(bContext *C, } } - ar->winrct.xmin = 0; - ar->winrct.xmax = winx; - ar->winrct.ymin = 0; - ar->winrct.ymax = winy; + region->winrct.xmin = 0; + region->winrct.xmax = winx; + region->winrct.ymin = 0; + region->winrct.ymax = winy; ui_block_calc_pie_segment(block, block->pie_data.pie_center_init); @@ -733,12 +733,12 @@ uiBlock *ui_popup_block_refresh(bContext *C, /* the block and buttons were positioned in window space as in 2.4x, now * these menu blocks are regions so we bring it back to region space. * additionally we add some padding for the menu shadow or rounded menus */ - ar->winrct.xmin = block->rect.xmin - margin; - ar->winrct.xmax = block->rect.xmax + margin; - ar->winrct.ymin = block->rect.ymin - margin; - ar->winrct.ymax = block->rect.ymax + UI_POPUP_MENU_TOP; + region->winrct.xmin = block->rect.xmin - margin; + region->winrct.xmax = block->rect.xmax + margin; + region->winrct.ymin = block->rect.ymin - margin; + region->winrct.ymax = block->rect.ymax + UI_POPUP_MENU_TOP; - UI_block_translate(block, -ar->winrct.xmin, -ar->winrct.ymin); + UI_block_translate(block, -region->winrct.xmin, -region->winrct.ymin); /* apply scroll offset */ if (handle->scrolloffset != 0.0f) { @@ -752,22 +752,22 @@ uiBlock *ui_popup_block_refresh(bContext *C, if (block_old) { block->oldblock = block_old; UI_block_update_from_old(C, block); - UI_blocklist_free_inactive(C, &ar->uiblocks); + UI_blocklist_free_inactive(C, ®ion->uiblocks); } /* checks which buttons are visible, sets flags to prevent draw (do after region init) */ ui_popup_block_scrolltest(block); /* adds subwindow */ - ED_region_floating_initialize(ar); + ED_region_floating_initialize(region); /* get winmat now that we actually have the subwindow */ - wmGetProjectionMatrix(block->winmat, &ar->winrct); + wmGetProjectionMatrix(block->winmat, ®ion->winrct); /* notify change and redraw */ - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); - ED_region_update_rect(ar); + ED_region_update_rect(region); #ifdef DEBUG window->eventstate = event_back; @@ -787,7 +787,7 @@ uiPopupBlockHandle *ui_popup_block_create(bContext *C, wmWindow *window = CTX_wm_window(C); uiBut *activebut = UI_context_active_but_get(C); static ARegionType type; - ARegion *ar; + ARegion *region; uiBlock *block; uiPopupBlockHandle *handle; @@ -818,16 +818,16 @@ uiPopupBlockHandle *ui_popup_block_create(bContext *C, handle->can_refresh = false; /* create area region */ - ar = ui_region_temp_add(CTX_wm_screen(C)); - handle->region = ar; + region = ui_region_temp_add(CTX_wm_screen(C)); + handle->region = region; memset(&type, 0, sizeof(ARegionType)); type.draw = ui_block_region_draw; type.layout = ui_block_region_refresh; type.regionid = RGN_TYPE_TEMPORARY; - ar->type = &type; + region->type = &type; - UI_region_handlers_add(&ar->handlers); + UI_region_handlers_add(®ion->handlers); block = ui_popup_block_refresh(C, handle, butregion, but); handle = block->handle; @@ -844,9 +844,9 @@ void ui_popup_block_free(bContext *C, uiPopupBlockHandle *handle) { /* If this popup is created from a popover which does NOT have keep-open flag set, * then close the popover too. We could extend this to other popup types too. */ - ARegion *ar = handle->popup_create_vars.butregion; - if (ar != NULL) { - for (uiBlock *block = ar->uiblocks.first; block; block = block->next) { + ARegion *region = handle->popup_create_vars.butregion; + if (region != NULL) { + for (uiBlock *block = region->uiblocks.first; block; block = block->next) { if (block->handle && (block->flag & UI_BLOCK_POPOVER) && (block->flag & UI_BLOCK_KEEP_OPEN) == 0) { uiPopupBlockHandle *menu = block->handle; diff --git a/source/blender/editors/interface/interface_region_search.c b/source/blender/editors/interface/interface_region_search.c index 94bcd6ab37d..4481ad54d1a 100644 --- a/source/blender/editors/interface/interface_region_search.c +++ b/source/blender/editors/interface/interface_region_search.c @@ -161,10 +161,10 @@ int UI_search_items_find_index(uiSearchItems *items, const char *name) return -1; } -/* ar is the search box itself */ -static void ui_searchbox_select(bContext *C, ARegion *ar, uiBut *but, int step) +/* region is the search box itself */ +static void ui_searchbox_select(bContext *C, ARegion *region, uiBut *but, int step) { - uiSearchboxData *data = ar->regiondata; + uiSearchboxData *data = region->regiondata; /* apply step */ data->active += step; @@ -176,7 +176,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 - 1; - ui_searchbox_update(C, ar, but, false); + ui_searchbox_update(C, region, but, false); } else { data->active = data->items.totitem - 1; @@ -186,7 +186,7 @@ static void ui_searchbox_select(bContext *C, ARegion *ar, uiBut *but, int step) if (data->items.offset) { data->items.offset--; data->active = 0; - ui_searchbox_update(C, ar, but, false); + ui_searchbox_update(C, region, but, false); } else { /* only let users step into an 'unset' state for unlink buttons */ @@ -194,7 +194,7 @@ static void ui_searchbox_select(bContext *C, ARegion *ar, uiBut *but, int step) } } - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); } static void ui_searchbox_butrect(rcti *r_rect, uiSearchboxData *data, int itemnr) @@ -229,24 +229,24 @@ static void ui_searchbox_butrect(rcti *r_rect, uiSearchboxData *data, int itemnr } } -int ui_searchbox_find_index(ARegion *ar, const char *name) +int ui_searchbox_find_index(ARegion *region, const char *name) { - uiSearchboxData *data = ar->regiondata; + uiSearchboxData *data = region->regiondata; return UI_search_items_find_index(&data->items, name); } /* x and y in screencoords */ -bool ui_searchbox_inside(ARegion *ar, int x, int y) +bool ui_searchbox_inside(ARegion *region, int x, int y) { - uiSearchboxData *data = ar->regiondata; + uiSearchboxData *data = region->regiondata; - return BLI_rcti_isect_pt(&data->bbox, x - ar->winrct.xmin, y - ar->winrct.ymin); + return BLI_rcti_isect_pt(&data->bbox, x - region->winrct.xmin, y - region->winrct.ymin); } /* string validated to be of correct length (but->hardmax) */ -bool ui_searchbox_apply(uiBut *but, ARegion *ar) +bool ui_searchbox_apply(uiBut *but, ARegion *region) { - uiSearchboxData *data = ar->regiondata; + uiSearchboxData *data = region->regiondata; but->func_arg2 = NULL; @@ -272,9 +272,9 @@ bool ui_searchbox_apply(uiBut *but, ARegion *ar) } } -void ui_searchbox_event(bContext *C, ARegion *ar, uiBut *but, const wmEvent *event) +void ui_searchbox_event(bContext *C, ARegion *region, uiBut *but, const wmEvent *event) { - uiSearchboxData *data = ar->regiondata; + uiSearchboxData *data = region->regiondata; int type = event->type, val = event->val; if (type == MOUSEPAN) { @@ -284,23 +284,24 @@ void ui_searchbox_event(bContext *C, ARegion *ar, uiBut *but, const wmEvent *eve switch (type) { case WHEELUPMOUSE: case UPARROWKEY: - ui_searchbox_select(C, ar, but, -1); + ui_searchbox_select(C, region, but, -1); break; case WHEELDOWNMOUSE: case DOWNARROWKEY: - ui_searchbox_select(C, ar, but, 1); + ui_searchbox_select(C, region, but, 1); break; case MOUSEMOVE: - if (BLI_rcti_isect_pt(&ar->winrct, event->x, event->y)) { + if (BLI_rcti_isect_pt(®ion->winrct, event->x, event->y)) { rcti rect; int a; for (a = 0; a < data->items.totitem; a++) { ui_searchbox_butrect(&rect, data, a); - if (BLI_rcti_isect_pt(&rect, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin)) { + if (BLI_rcti_isect_pt( + &rect, event->x - region->winrct.xmin, event->y - region->winrct.ymin)) { if (data->active != a) { data->active = a; - ui_searchbox_select(C, ar, but, 0); + ui_searchbox_select(C, region, but, 0); break; } } @@ -310,10 +311,10 @@ 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, const bool reset) +/* region is the search box itself */ +void ui_searchbox_update(bContext *C, ARegion *region, uiBut *but, const bool reset) { - uiSearchboxData *data = ar->regiondata; + uiSearchboxData *data = region->regiondata; /* reset vars */ data->items.totitem = 0; @@ -379,14 +380,14 @@ void ui_searchbox_update(bContext *C, ARegion *ar, uiBut *but, const bool reset) } /* validate selected item */ - ui_searchbox_select(C, ar, but, 0); + ui_searchbox_select(C, region, but, 0); - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); } -int ui_searchbox_autocomplete(bContext *C, ARegion *ar, uiBut *but, char *str) +int ui_searchbox_autocomplete(bContext *C, ARegion *region, uiBut *but, char *str) { - uiSearchboxData *data = ar->regiondata; + uiSearchboxData *data = region->regiondata; int match = AUTOCOMPLETE_NO_MATCH; if (str[0]) { @@ -401,12 +402,12 @@ int ui_searchbox_autocomplete(bContext *C, ARegion *ar, uiBut *but, char *str) return match; } -static void ui_searchbox_region_draw_cb(const bContext *C, ARegion *ar) +static void ui_searchbox_region_draw_cb(const bContext *C, ARegion *region) { - uiSearchboxData *data = ar->regiondata; + uiSearchboxData *data = region->regiondata; /* pixel space */ - wmOrtho2_region_pixelspace(ar); + wmOrtho2_region_pixelspace(region); if (data->noback == false) { ui_draw_widget_menu_back(&data->bbox, true); @@ -477,9 +478,9 @@ static void ui_searchbox_region_draw_cb(const bContext *C, ARegion *ar) } } -static void ui_searchbox_region_free_cb(ARegion *ar) +static void ui_searchbox_region_free_cb(ARegion *region) { - uiSearchboxData *data = ar->regiondata; + uiSearchboxData *data = region->regiondata; int a; /* free search data */ @@ -491,7 +492,7 @@ static void ui_searchbox_region_free_cb(ARegion *ar) MEM_freeN(data->items.icons); MEM_freeN(data); - ar->regiondata = NULL; + region->regiondata = NULL; } ARegion *ui_searchbox_create_generic(bContext *C, ARegion *butregion, uiBut *but) @@ -499,7 +500,7 @@ ARegion *ui_searchbox_create_generic(bContext *C, ARegion *butregion, uiBut *but wmWindow *win = CTX_wm_window(C); uiStyle *style = UI_style_get(); static ARegionType type; - ARegion *ar; + ARegion *region; uiSearchboxData *data; float aspect = but->block->aspect; rctf rect_fl; @@ -509,13 +510,13 @@ ARegion *ui_searchbox_create_generic(bContext *C, ARegion *butregion, uiBut *but int i; /* create area region */ - ar = ui_region_temp_add(CTX_wm_screen(C)); + region = ui_region_temp_add(CTX_wm_screen(C)); memset(&type, 0, sizeof(ARegionType)); type.draw = ui_searchbox_region_draw_cb; type.free = ui_searchbox_region_free_cb; type.regionid = RGN_TYPE_TEMPORARY; - ar->type = &type; + region->type = &type; /* create searchbox data */ data = MEM_callocN(sizeof(uiSearchboxData), "uiSearchboxData"); @@ -525,7 +526,7 @@ ARegion *ui_searchbox_create_generic(bContext *C, ARegion *butregion, uiBut *but ui_fontscale(&data->fstyle.points, aspect); UI_fontstyle_set(&data->fstyle); - ar->regiondata = data; + region->regiondata = data; /* special case, hardcoded feature, not draw backdrop when called from menus, * assume for design that popup already added it */ @@ -553,13 +554,13 @@ ARegion *ui_searchbox_create_generic(bContext *C, ARegion *butregion, uiBut *but /* this case is search menu inside other menu */ /* we copy region size */ - ar->winrct = butregion->winrct; + region->winrct = butregion->winrct; /* widget rect, in region coords */ data->bbox.xmin = margin; - data->bbox.xmax = BLI_rcti_size_x(&ar->winrct) - margin; + data->bbox.xmax = BLI_rcti_size_x(®ion->winrct) - margin; data->bbox.ymin = margin; - data->bbox.ymax = BLI_rcti_size_y(&ar->winrct) - margin; + data->bbox.ymax = BLI_rcti_size_y(®ion->winrct) - margin; /* check if button is lower half */ if (but->rect.ymax < BLI_rctf_cent_y(&but->block->rect)) { @@ -632,17 +633,17 @@ ARegion *ui_searchbox_create_generic(bContext *C, ARegion *butregion, uiBut *but data->bbox.ymax = BLI_rcti_size_y(&rect_i) + margin; /* region bigger for shadow */ - ar->winrct.xmin = rect_i.xmin - margin; - ar->winrct.xmax = rect_i.xmax + margin; - ar->winrct.ymin = rect_i.ymin - margin; - ar->winrct.ymax = rect_i.ymax; + region->winrct.xmin = rect_i.xmin - margin; + region->winrct.xmax = rect_i.xmax + margin; + region->winrct.ymin = rect_i.ymin - margin; + region->winrct.ymax = rect_i.ymax; } /* adds subwindow */ - ED_region_floating_initialize(ar); + ED_region_floating_initialize(region); /* notify change and redraw */ - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); /* prepare search data */ if (data->preview) { @@ -660,7 +661,7 @@ ARegion *ui_searchbox_create_generic(bContext *C, ARegion *butregion, uiBut *but data->items.names[i] = MEM_callocN(but->hardmax + 1, "search pointers"); } - return ar; + return region; } /** @@ -688,12 +689,12 @@ static void str_tolower_titlecaps_ascii(char *str, const size_t len) } } -static void ui_searchbox_region_draw_cb__operator(const bContext *UNUSED(C), ARegion *ar) +static void ui_searchbox_region_draw_cb__operator(const bContext *UNUSED(C), ARegion *region) { - uiSearchboxData *data = ar->regiondata; + uiSearchboxData *data = region->regiondata; /* pixel space */ - wmOrtho2_region_pixelspace(ar); + wmOrtho2_region_pixelspace(region); if (data->noback == false) { ui_draw_widget_menu_back(&data->bbox, true); @@ -764,19 +765,19 @@ static void ui_searchbox_region_draw_cb__operator(const bContext *UNUSED(C), ARe ARegion *ui_searchbox_create_operator(bContext *C, ARegion *butregion, uiBut *but) { - ARegion *ar; + ARegion *region; UI_but_drawflag_enable(but, UI_BUT_HAS_SHORTCUT); - ar = ui_searchbox_create_generic(C, butregion, but); + region = ui_searchbox_create_generic(C, butregion, but); - ar->type->draw = ui_searchbox_region_draw_cb__operator; + region->type->draw = ui_searchbox_region_draw_cb__operator; - return ar; + return region; } -void ui_searchbox_free(bContext *C, ARegion *ar) +void ui_searchbox_free(bContext *C, ARegion *region) { - ui_region_temp_remove(C, CTX_wm_screen(C), ar); + ui_region_temp_remove(C, CTX_wm_screen(C), region); } /* sets red alert if button holds a string it can't find */ diff --git a/source/blender/editors/interface/interface_region_tooltip.c b/source/blender/editors/interface/interface_region_tooltip.c index 7a0c04be356..c18c78c22a6 100644 --- a/source/blender/editors/interface/interface_region_tooltip.c +++ b/source/blender/editors/interface/interface_region_tooltip.c @@ -148,10 +148,10 @@ static void rgb_tint(float col[3], float h, float h_strength, float v, float v_s hsv_to_rgb_v(col_hsv_to, col); } -static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *ar) +static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *region) { const float pad_px = UI_TIP_PADDING; - uiTooltipData *data = ar->regiondata; + uiTooltipData *data = region->regiondata; const uiWidgetColors *theme = ui_tooltip_get_theme(); rcti bbox = data->bbox; float tip_colors[UI_TIP_LC_MAX][3]; @@ -168,7 +168,7 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *ar) float tone_bg; int i; - wmOrtho2_region_pixelspace(ar); + wmOrtho2_region_pixelspace(region); /* draw background */ ui_draw_tooltip_background(UI_style_get(), NULL, &bbox); @@ -271,11 +271,11 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *ar) BLF_disable(blf_mono_font, BLF_WORD_WRAP); } -static void ui_tooltip_region_free_cb(ARegion *ar) +static void ui_tooltip_region_free_cb(ARegion *region) { uiTooltipData *data; - data = ar->regiondata; + data = region->regiondata; for (int i = 0; i < data->fields_len; i++) { const uiTooltipField *field = &data->fields[i]; @@ -286,7 +286,7 @@ static void ui_tooltip_region_free_cb(ARegion *ar) } MEM_freeN(data->fields); MEM_freeN(data); - ar->regiondata = NULL; + region->regiondata = NULL; } /** \} */ @@ -1160,20 +1160,20 @@ static ARegion *ui_tooltip_create_with_data(bContext *C, const int winy = WM_window_pixels_y(win); uiStyle *style = UI_style_get(); static ARegionType type; - ARegion *ar; + ARegion *region; int fonth, fontw; int h, i; rcti rect_i; int font_flag = 0; /* create area region */ - ar = ui_region_temp_add(CTX_wm_screen(C)); + region = ui_region_temp_add(CTX_wm_screen(C)); memset(&type, 0, sizeof(ARegionType)); type.draw = ui_tooltip_region_draw_cb; type.free = ui_tooltip_region_free_cb; type.regionid = RGN_TYPE_TEMPORARY; - ar->type = &type; + region->type = &type; /* set font, get bb */ data->fstyle = style->widget; /* copy struct */ @@ -1237,7 +1237,7 @@ static ARegion *ui_tooltip_create_with_data(bContext *C, BLF_disable(data->fstyle.uifont_id, font_flag); BLF_disable(blf_mono_font, font_flag); - ar->regiondata = data; + region->regiondata = data; data->toth = fonth; data->lineh = h; @@ -1384,19 +1384,19 @@ static ARegion *ui_tooltip_create_with_data(bContext *C, data->bbox.ymax = BLI_rcti_size_y(&rect_i); /* region bigger for shadow */ - ar->winrct.xmin = rect_i.xmin - margin; - ar->winrct.xmax = rect_i.xmax + margin; - ar->winrct.ymin = rect_i.ymin - margin; - ar->winrct.ymax = rect_i.ymax + margin; + region->winrct.xmin = rect_i.xmin - margin; + region->winrct.xmax = rect_i.xmax + margin; + region->winrct.ymin = rect_i.ymin - margin; + region->winrct.ymax = rect_i.ymax + margin; } /* adds subwindow */ - ED_region_floating_initialize(ar); + ED_region_floating_initialize(region); /* notify change and redraw */ - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); - return ar; + return region; } /** \} */ @@ -1457,10 +1457,10 @@ ARegion *UI_tooltip_create_from_button(bContext *C, ARegion *butregion, uiBut *b } } - ARegion *ar = ui_tooltip_create_with_data( + ARegion *region = ui_tooltip_create_with_data( C, data, init_position, is_no_overlap ? &init_rect : NULL, aspect); - return ar; + return region; } ARegion *UI_tooltip_create_from_gizmo(bContext *C, wmGizmo *gz) @@ -1480,9 +1480,9 @@ ARegion *UI_tooltip_create_from_gizmo(bContext *C, wmGizmo *gz) return ui_tooltip_create_with_data(C, data, init_position, NULL, aspect); } -void UI_tooltip_free(bContext *C, bScreen *sc, ARegion *ar) +void UI_tooltip_free(bContext *C, bScreen *sc, ARegion *region) { - ui_region_temp_remove(C, sc, ar); + ui_region_temp_remove(C, sc, region); } /** \} */ diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 5ba4dcd7439..6150cc43554 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -41,28 +41,28 @@ ARegion *ui_region_temp_add(bScreen *sc) { - ARegion *ar; + ARegion *region; - ar = MEM_callocN(sizeof(ARegion), "area region"); - BLI_addtail(&sc->regionbase, ar); + region = MEM_callocN(sizeof(ARegion), "area region"); + BLI_addtail(&sc->regionbase, region); - ar->regiontype = RGN_TYPE_TEMPORARY; - ar->alignment = RGN_ALIGN_FLOAT; + region->regiontype = RGN_TYPE_TEMPORARY; + region->alignment = RGN_ALIGN_FLOAT; - return ar; + return region; } -void ui_region_temp_remove(bContext *C, bScreen *sc, ARegion *ar) +void ui_region_temp_remove(bContext *C, bScreen *sc, ARegion *region) { wmWindow *win = CTX_wm_window(C); - BLI_assert(ar->regiontype == RGN_TYPE_TEMPORARY); - BLI_assert(BLI_findindex(&sc->regionbase, ar) != -1); + BLI_assert(region->regiontype == RGN_TYPE_TEMPORARY); + BLI_assert(BLI_findindex(&sc->regionbase, region) != -1); if (win) { - wm_draw_region_clear(win, ar); + wm_draw_region_clear(win, region); } - ED_region_exit(C, ar); - BKE_area_region_free(NULL, ar); /* NULL: no spacetype */ - BLI_freelinkN(&sc->regionbase, ar); + ED_region_exit(C, region); + BKE_area_region_free(NULL, region); /* NULL: no spacetype */ + BLI_freelinkN(&sc->regionbase, region); } diff --git a/source/blender/editors/interface/interface_regions_intern.h b/source/blender/editors/interface/interface_regions_intern.h index 31a0a0876a2..329ee3c08dc 100644 --- a/source/blender/editors/interface/interface_regions_intern.h +++ b/source/blender/editors/interface/interface_regions_intern.h @@ -28,6 +28,6 @@ uint ui_popup_menu_hash(const char *str); /* interface_regions_intern.h */ ARegion *ui_region_temp_add(bScreen *sc); -void ui_region_temp_remove(struct bContext *C, bScreen *sc, ARegion *ar); +void ui_region_temp_remove(struct bContext *C, bScreen *sc, ARegion *region); #endif /* __INTERFACE_REGIONS_INTERN_H__ */ diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 1566c9c4e88..c80c5317735 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -444,7 +444,7 @@ static void id_search_cb_objects_from_scene(const bContext *C, } /* ID Search browse menu, open */ -static uiBlock *id_search_menu(bContext *C, ARegion *ar, void *arg_litem) +static uiBlock *id_search_menu(bContext *C, ARegion *region, void *arg_litem) { static TemplateID template_ui; PointerRNA active_item_ptr; @@ -464,7 +464,7 @@ static uiBlock *id_search_menu(bContext *C, ARegion *ar, void *arg_litem) } return template_common_search_menu(C, - ar, + region, id_search_cb_p, &template_ui, template_ID_set_property_cb, @@ -2723,7 +2723,7 @@ void uiTemplatePreview(uiLayout *layout, uiLayout *row, *col; uiBlock *block; uiPreview *ui_preview = NULL; - ARegion *ar; + ARegion *region; Material *ma = NULL; Tex *tex = (Tex *)id; @@ -2774,14 +2774,14 @@ void uiTemplatePreview(uiLayout *layout, } /* Find or add the uiPreview to the current Region. */ - ar = CTX_wm_region(C); - ui_preview = BLI_findstring(&ar->ui_previews, preview_id, offsetof(uiPreview, preview_id)); + region = CTX_wm_region(C); + ui_preview = BLI_findstring(®ion->ui_previews, preview_id, offsetof(uiPreview, preview_id)); if (!ui_preview) { ui_preview = MEM_callocN(sizeof(uiPreview), "uiPreview"); BLI_strncpy(ui_preview->preview_id, preview_id, sizeof(ui_preview->preview_id)); ui_preview->height = (short)(UI_UNIT_Y * 7.6f); - BLI_addtail(&ar->ui_previews, ui_preview); + BLI_addtail(®ion->ui_previews, ui_preview); } if (ui_preview->height < UI_UNIT_Y) { @@ -3047,14 +3047,14 @@ static void colorband_tools_dofunc(bContext *C, void *coba_v, int event) ED_region_tag_redraw(CTX_wm_region(C)); } -static uiBlock *colorband_tools_func(bContext *C, ARegion *ar, void *coba_v) +static uiBlock *colorband_tools_func(bContext *C, ARegion *region, void *coba_v) { uiStyle *style = UI_style_get_dpi(); ColorBand *coba = coba_v; uiBlock *block; short yco = 0, menuwidth = 10 * UI_UNIT_X; - block = UI_block_begin(C, ar, __func__, UI_EMBOSS_PULLDOWN); + block = UI_block_begin(C, region, __func__, UI_EMBOSS_PULLDOWN); UI_block_func_butmenu_set(block, colorband_tools_dofunc, coba); uiLayout *layout = UI_block_layout(block, @@ -3443,7 +3443,7 @@ typedef struct IconViewMenuArgs { } IconViewMenuArgs; /* ID Search browse menu, open */ -static uiBlock *ui_icon_view_menu_cb(bContext *C, ARegion *ar, void *arg_litem) +static uiBlock *ui_icon_view_menu_cb(bContext *C, ARegion *region, void *arg_litem) { static IconViewMenuArgs args; uiBlock *block; @@ -3459,7 +3459,7 @@ static uiBlock *ui_icon_view_menu_cb(bContext *C, ARegion *ar, void *arg_litem) w = UI_UNIT_X * (args.icon_scale); h = UI_UNIT_X * (args.icon_scale + args.show_labels); - block = UI_block_begin(C, ar, "_popup", UI_EMBOSS_PULLDOWN); + block = UI_block_begin(C, region, "_popup", UI_EMBOSS_PULLDOWN); UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_NO_FLIP); UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP); @@ -3867,14 +3867,14 @@ static void curvemap_buttons_delete(bContext *C, void *cb_v, void *cumap_v) } /* NOTE: this is a block-menu, needs 0 events, otherwise the menu closes */ -static uiBlock *curvemap_clipping_func(bContext *C, ARegion *ar, void *cumap_v) +static uiBlock *curvemap_clipping_func(bContext *C, ARegion *region, void *cumap_v) { CurveMapping *cumap = cumap_v; uiBlock *block; uiBut *bt; float width = 8 * UI_UNIT_X; - block = UI_block_begin(C, ar, __func__, UI_EMBOSS); + block = UI_block_begin(C, region, __func__, UI_EMBOSS); UI_block_flag_enable(block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_MOVEMOUSE_QUIT); UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP); @@ -4015,12 +4015,12 @@ static void curvemap_tools_dofunc(bContext *C, void *cumap_v, int event) } static uiBlock *curvemap_tools_func( - bContext *C, ARegion *ar, CurveMapping *cumap, bool show_extend, int reset_mode) + bContext *C, ARegion *region, CurveMapping *cumap, bool show_extend, int reset_mode) { uiBlock *block; short yco = 0, menuwidth = 10 * UI_UNIT_X; - block = UI_block_begin(C, ar, __func__, UI_EMBOSS); + block = UI_block_begin(C, region, __func__, UI_EMBOSS); UI_block_func_butmenu_set(block, curvemap_tools_dofunc, cumap); { @@ -4143,24 +4143,24 @@ static uiBlock *curvemap_tools_func( return block; } -static uiBlock *curvemap_tools_posslope_func(bContext *C, ARegion *ar, void *cumap_v) +static uiBlock *curvemap_tools_posslope_func(bContext *C, ARegion *region, void *cumap_v) { - return curvemap_tools_func(C, ar, cumap_v, true, UICURVE_FUNC_RESET_POS); + return curvemap_tools_func(C, region, cumap_v, true, UICURVE_FUNC_RESET_POS); } -static uiBlock *curvemap_tools_negslope_func(bContext *C, ARegion *ar, void *cumap_v) +static uiBlock *curvemap_tools_negslope_func(bContext *C, ARegion *region, void *cumap_v) { - return curvemap_tools_func(C, ar, cumap_v, true, UICURVE_FUNC_RESET_NEG); + return curvemap_tools_func(C, region, cumap_v, true, UICURVE_FUNC_RESET_NEG); } -static uiBlock *curvemap_brush_tools_func(bContext *C, ARegion *ar, void *cumap_v) +static uiBlock *curvemap_brush_tools_func(bContext *C, ARegion *region, void *cumap_v) { - return curvemap_tools_func(C, ar, cumap_v, false, UICURVE_FUNC_RESET_NEG); + return curvemap_tools_func(C, region, cumap_v, false, UICURVE_FUNC_RESET_NEG); } -static uiBlock *curvemap_brush_tools_negslope_func(bContext *C, ARegion *ar, void *cumap_v) +static uiBlock *curvemap_brush_tools_negslope_func(bContext *C, ARegion *region, void *cumap_v) { - return curvemap_tools_func(C, ar, cumap_v, false, UICURVE_FUNC_RESET_POS); + return curvemap_tools_func(C, region, cumap_v, false, UICURVE_FUNC_RESET_POS); } static void curvemap_buttons_redraw(bContext *C, void *UNUSED(arg1), void *UNUSED(arg2)) @@ -4563,14 +4563,14 @@ static void CurveProfile_presets_dofunc(bContext *C, void *profile_v, int event) ED_region_tag_redraw(CTX_wm_region(C)); } -static uiBlock *CurveProfile_presets_func(bContext *C, ARegion *ar, CurveProfile *profile) +static uiBlock *CurveProfile_presets_func(bContext *C, ARegion *region, CurveProfile *profile) { uiBlock *block; short yco = 0; short menuwidth = 12 * UI_UNIT_X; menuwidth = 0; - block = UI_block_begin(C, ar, __func__, UI_EMBOSS); + block = UI_block_begin(C, region, __func__, UI_EMBOSS); UI_block_func_butmenu_set(block, CurveProfile_presets_dofunc, profile); uiDefIconTextBut(block, @@ -4655,9 +4655,9 @@ static uiBlock *CurveProfile_presets_func(bContext *C, ARegion *ar, CurveProfile return block; } -static uiBlock *CurveProfile_buttons_presets(bContext *C, ARegion *ar, void *profile_v) +static uiBlock *CurveProfile_buttons_presets(bContext *C, ARegion *region, void *profile_v) { - return CurveProfile_presets_func(C, ar, (CurveProfile *)profile_v); + return CurveProfile_presets_func(C, region, (CurveProfile *)profile_v); } /* Only for CurveProfile tools block */ @@ -4683,13 +4683,13 @@ static void CurveProfile_tools_dofunc(bContext *C, void *profile_v, int event) ED_region_tag_redraw(CTX_wm_region(C)); } -static uiBlock *CurveProfile_tools_func(bContext *C, ARegion *ar, CurveProfile *profile) +static uiBlock *CurveProfile_tools_func(bContext *C, ARegion *region, CurveProfile *profile) { uiBlock *block; short yco = 0; short menuwidth = 10 * UI_UNIT_X; - block = UI_block_begin(C, ar, __func__, UI_EMBOSS); + block = UI_block_begin(C, region, __func__, UI_EMBOSS); UI_block_func_butmenu_set(block, CurveProfile_tools_dofunc, profile); uiDefIconTextBut(block, @@ -4729,9 +4729,9 @@ static uiBlock *CurveProfile_tools_func(bContext *C, ARegion *ar, CurveProfile * return block; } -static uiBlock *CurveProfile_buttons_tools(bContext *C, ARegion *ar, void *profile_v) +static uiBlock *CurveProfile_buttons_tools(bContext *C, ARegion *region, void *profile_v) { - return CurveProfile_tools_func(C, ar, (CurveProfile *)profile_v); + return CurveProfile_tools_func(C, region, (CurveProfile *)profile_v); } static void CurveProfile_buttons_zoom_in(bContext *C, void *profile_v, void *UNUSED(arg)) @@ -5934,7 +5934,7 @@ void uiTemplateList(uiLayout *layout, uiListType *ui_list_type; uiList *ui_list = NULL; uiListDyn *dyn_data; - ARegion *ar; + ARegion *region; uiListDrawItemFunc draw_item; uiListDrawFilterFunc draw_filter; uiListFilterItemsFunc filter_items; @@ -6026,16 +6026,16 @@ void uiTemplateList(uiLayout *layout, ui_list_id, sizeof(ui_list_id), "%s_%s", ui_list_type->idname, list_id ? list_id : ""); /* Allows to work in popups. */ - ar = CTX_wm_menu(C); - if (ar == NULL) { - ar = CTX_wm_region(C); + region = CTX_wm_menu(C); + if (region == NULL) { + region = CTX_wm_region(C); } - ui_list = BLI_findstring(&ar->ui_lists, ui_list_id, offsetof(uiList, list_id)); + ui_list = BLI_findstring(®ion->ui_lists, ui_list_id, offsetof(uiList, list_id)); if (!ui_list) { ui_list = MEM_callocN(sizeof(uiList), "uiList"); BLI_strncpy(ui_list->list_id, ui_list_id, sizeof(ui_list->list_id)); - BLI_addtail(&ar->ui_lists, ui_list); + BLI_addtail(®ion->ui_lists, ui_list); ui_list->list_grip = -UI_LIST_AUTO_SIZE_THRESHOLD; /* Force auto size by default. */ if (sort_reverse) { ui_list->filter_sort_flag |= UILST_FLT_SORT_REVERSE; @@ -7416,13 +7416,13 @@ typedef struct ComponentMenuArgs { char propname[64]; /* XXX arbitrary */ } ComponentMenuArgs; /* NOTE: this is a block-menu, needs 0 events, otherwise the menu closes */ -static uiBlock *component_menu(bContext *C, ARegion *ar, void *args_v) +static uiBlock *component_menu(bContext *C, ARegion *region, void *args_v) { ComponentMenuArgs *args = (ComponentMenuArgs *)args_v; uiBlock *block; uiLayout *layout; - block = UI_block_begin(C, ar, __func__, UI_EMBOSS); + block = UI_block_begin(C, region, __func__, UI_EMBOSS); UI_block_flag_enable(block, UI_BLOCK_KEEP_OPEN); layout = uiLayoutColumn(UI_block_layout(block, diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 8c28b29f5ab..31a1c150b12 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -4597,7 +4597,7 @@ static int widget_roundbox_set(uiBut *but, rcti *rect) * \{ */ /* conversion from old to new buttons, so still messy */ -void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rcti *rect) +void ui_draw_but(const bContext *C, ARegion *region, uiStyle *style, uiBut *but, rcti *rect) { bTheme *btheme = UI_GetTheme(); const ThemeUI *tui = &btheme->tui; @@ -4790,30 +4790,30 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct break; case UI_BTYPE_IMAGE: - ui_draw_but_IMAGE(ar, but, &tui->wcol_regular, rect); + ui_draw_but_IMAGE(region, but, &tui->wcol_regular, rect); break; case UI_BTYPE_HISTOGRAM: - ui_draw_but_HISTOGRAM(ar, but, &tui->wcol_regular, rect); + ui_draw_but_HISTOGRAM(region, but, &tui->wcol_regular, rect); break; case UI_BTYPE_WAVEFORM: - ui_draw_but_WAVEFORM(ar, but, &tui->wcol_regular, rect); + ui_draw_but_WAVEFORM(region, but, &tui->wcol_regular, rect); break; case UI_BTYPE_VECTORSCOPE: - ui_draw_but_VECTORSCOPE(ar, but, &tui->wcol_regular, rect); + ui_draw_but_VECTORSCOPE(region, but, &tui->wcol_regular, rect); break; case UI_BTYPE_CURVE: /* do not draw right to edge of rect */ rect->xmin += (0.2f * UI_UNIT_X); rect->xmax -= (0.2f * UI_UNIT_X); - ui_draw_but_CURVE(ar, but, &tui->wcol_regular, rect); + ui_draw_but_CURVE(region, but, &tui->wcol_regular, rect); break; case UI_BTYPE_CURVEPROFILE: - ui_draw_but_CURVEPROFILE(ar, but, &tui->wcol_regular, rect); + ui_draw_but_CURVEPROFILE(region, but, &tui->wcol_regular, rect); break; case UI_BTYPE_PROGRESS_BAR: @@ -4830,7 +4830,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct break; case UI_BTYPE_TRACK_PREVIEW: - ui_draw_but_TRACKPREVIEW(ar, but, &tui->wcol_regular, rect); + ui_draw_but_TRACKPREVIEW(region, but, &tui->wcol_regular, rect); break; case UI_BTYPE_NODE_SOCKET: @@ -5012,13 +5012,13 @@ static void ui_draw_popover_back_impl(const uiWidgetColors *wcol, GPU_blend(false); } -void ui_draw_popover_back(ARegion *ar, uiStyle *UNUSED(style), uiBlock *block, rcti *rect) +void ui_draw_popover_back(ARegion *region, uiStyle *UNUSED(style), uiBlock *block, rcti *rect) { uiWidgetType *wt = widget_type(UI_WTYPE_MENU_BACK); if (block) { float mval_origin[2] = {UNPACK2(block->bounds_offset)}; - ui_window_to_block_fl(ar, block, &mval_origin[0], &mval_origin[1]); + ui_window_to_block_fl(region, block, &mval_origin[0], &mval_origin[1]); ui_draw_popover_back_impl( wt->wcol_theme, rect, block->direction, U.widget_unit / block->aspect, mval_origin); } diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index ac65ce2a28e..af32143df33 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -866,7 +866,7 @@ void UI_view2d_curRect_validate(View2D *v2d) void UI_view2d_sync(bScreen *screen, ScrArea *area, View2D *v2dcur, int flag) { ScrArea *sa; - ARegion *ar; + ARegion *region; /* don't continue if no view syncing to be done */ if ((v2dcur->flag & (V2D_VIEWSYNC_SCREEN_TIME | V2D_VIEWSYNC_AREA_VERTICAL)) == 0) { @@ -875,24 +875,24 @@ void UI_view2d_sync(bScreen *screen, ScrArea *area, View2D *v2dcur, int flag) /* check if doing within area syncing (i.e. channels/vertical) */ if ((v2dcur->flag & V2D_VIEWSYNC_AREA_VERTICAL) && (area)) { - for (ar = area->regionbase.first; ar; ar = ar->next) { + for (region = area->regionbase.first; region; region = region->next) { /* don't operate on self */ - if (v2dcur != &ar->v2d) { + if (v2dcur != ®ion->v2d) { /* only if view has vertical locks enabled */ - if (ar->v2d.flag & V2D_VIEWSYNC_AREA_VERTICAL) { + if (region->v2d.flag & V2D_VIEWSYNC_AREA_VERTICAL) { if (flag == V2D_LOCK_COPY) { /* other views with locks on must copy active */ - ar->v2d.cur.ymin = v2dcur->cur.ymin; - ar->v2d.cur.ymax = v2dcur->cur.ymax; + region->v2d.cur.ymin = v2dcur->cur.ymin; + region->v2d.cur.ymax = v2dcur->cur.ymax; } else { /* V2D_LOCK_SET */ /* active must copy others */ - v2dcur->cur.ymin = ar->v2d.cur.ymin; - v2dcur->cur.ymax = ar->v2d.cur.ymax; + v2dcur->cur.ymin = region->v2d.cur.ymin; + v2dcur->cur.ymax = region->v2d.cur.ymax; } /* region possibly changed, so refresh */ - ED_region_tag_redraw_no_rebuild(ar); + ED_region_tag_redraw_no_rebuild(region); } } } @@ -901,24 +901,24 @@ void UI_view2d_sync(bScreen *screen, ScrArea *area, View2D *v2dcur, int flag) /* check if doing whole screen syncing (i.e. time/horizontal) */ if ((v2dcur->flag & V2D_VIEWSYNC_SCREEN_TIME) && (screen)) { for (sa = screen->areabase.first; sa; sa = sa->next) { - for (ar = sa->regionbase.first; ar; ar = ar->next) { + for (region = sa->regionbase.first; region; region = region->next) { /* don't operate on self */ - if (v2dcur != &ar->v2d) { + if (v2dcur != ®ion->v2d) { /* only if view has horizontal locks enabled */ - if (ar->v2d.flag & V2D_VIEWSYNC_SCREEN_TIME) { + if (region->v2d.flag & V2D_VIEWSYNC_SCREEN_TIME) { if (flag == V2D_LOCK_COPY) { /* other views with locks on must copy active */ - ar->v2d.cur.xmin = v2dcur->cur.xmin; - ar->v2d.cur.xmax = v2dcur->cur.xmax; + region->v2d.cur.xmin = v2dcur->cur.xmin; + region->v2d.cur.xmax = v2dcur->cur.xmax; } else { /* V2D_LOCK_SET */ /* active must copy others */ - v2dcur->cur.xmin = ar->v2d.cur.xmin; - v2dcur->cur.xmax = ar->v2d.cur.xmax; + v2dcur->cur.xmin = region->v2d.cur.xmin; + v2dcur->cur.xmax = region->v2d.cur.xmax; } /* region possibly changed, so refresh */ - ED_region_tag_redraw_no_rebuild(ar); + ED_region_tag_redraw_no_rebuild(region); } } } @@ -1213,7 +1213,7 @@ void UI_view2d_view_ortho(const View2D *v2d) * \param xaxis: if non-zero, only use cur x-axis, * otherwise use cur-yaxis (mostly this will be used for x). */ -void UI_view2d_view_orthoSpecial(ARegion *ar, View2D *v2d, const bool xaxis) +void UI_view2d_view_orthoSpecial(ARegion *region, View2D *v2d, const bool xaxis) { rctf curmasked; float xofs, yofs; @@ -1232,19 +1232,19 @@ void UI_view2d_view_orthoSpecial(ARegion *ar, View2D *v2d, const bool xaxis) /* only set matrix with 'cur' coordinates on relevant axes */ if (xaxis) { - wmOrtho2(curmasked.xmin - xofs, curmasked.xmax - xofs, -yofs, ar->winy - yofs); + wmOrtho2(curmasked.xmin - xofs, curmasked.xmax - xofs, -yofs, region->winy - yofs); } else { - wmOrtho2(-xofs, ar->winx - xofs, curmasked.ymin - yofs, curmasked.ymax - yofs); + wmOrtho2(-xofs, region->winx - xofs, curmasked.ymin - yofs, curmasked.ymax - yofs); } } /* Restore view matrices after drawing */ void UI_view2d_view_restore(const bContext *C) { - ARegion *ar = CTX_wm_region(C); - int width = BLI_rcti_size_x(&ar->winrct) + 1; - int height = BLI_rcti_size_y(&ar->winrct) + 1; + ARegion *region = CTX_wm_region(C); + int width = BLI_rcti_size_x(®ion->winrct) + 1; + int height = BLI_rcti_size_y(®ion->winrct) + 1; wmOrtho2(0.0f, (float)width, 0.0f, (float)height); GPU_matrix_identity_set(); @@ -1925,8 +1925,8 @@ View2D *UI_view2d_fromcontext_rwin(const bContext *C) return NULL; } if (region->regiontype != RGN_TYPE_WINDOW) { - ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW); - return ar ? &(ar->v2d) : NULL; + ARegion *region_win = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW); + return region_win ? &(region_win->v2d) : NULL; } return &(region->v2d); } @@ -2057,7 +2057,7 @@ void UI_view2d_offset(struct View2D *v2d, float xfac, float yfac) * - 0 = not in scroller. */ char UI_view2d_mouse_in_scrollers_ex( - const ARegion *ar, const View2D *v2d, int x, int y, int *r_scroll) + const ARegion *region, const View2D *v2d, int x, int y, int *r_scroll) { const int scroll = view2d_scroll_mapped(v2d->scroll); *r_scroll = scroll; @@ -2065,8 +2065,8 @@ char UI_view2d_mouse_in_scrollers_ex( if (scroll) { /* Move to region-coordinates. */ const int co[2] = { - x - ar->winrct.xmin, - y - ar->winrct.ymin, + x - region->winrct.xmin, + y - region->winrct.ymin, }; if (scroll & V2D_SCROLL_HORIZONTAL) { if (IN_2D_HORIZ_SCROLL(v2d, co)) { @@ -2083,7 +2083,7 @@ char UI_view2d_mouse_in_scrollers_ex( return 0; } -char UI_view2d_rect_in_scrollers_ex(const ARegion *ar, +char UI_view2d_rect_in_scrollers_ex(const ARegion *region, const View2D *v2d, const rcti *rect, int *r_scroll) @@ -2094,7 +2094,7 @@ char UI_view2d_rect_in_scrollers_ex(const ARegion *ar, if (scroll) { /* Move to region-coordinates. */ rcti rect_region = *rect; - BLI_rcti_translate(&rect_region, -ar->winrct.xmin, ar->winrct.ymin); + BLI_rcti_translate(&rect_region, -region->winrct.xmin, region->winrct.ymin); if (scroll & V2D_SCROLL_HORIZONTAL) { if (IN_2D_HORIZ_SCROLL_RECT(v2d, &rect_region)) { return 'h'; @@ -2110,16 +2110,16 @@ char UI_view2d_rect_in_scrollers_ex(const ARegion *ar, return 0; } -char UI_view2d_mouse_in_scrollers(const ARegion *ar, const View2D *v2d, int x, int y) +char UI_view2d_mouse_in_scrollers(const ARegion *region, const View2D *v2d, int x, int y) { int scroll_dummy = 0; - return UI_view2d_mouse_in_scrollers_ex(ar, v2d, x, y, &scroll_dummy); + return UI_view2d_mouse_in_scrollers_ex(region, v2d, x, y, &scroll_dummy); } -char UI_view2d_rect_in_scrollers(const ARegion *ar, const View2D *v2d, const rcti *rect) +char UI_view2d_rect_in_scrollers(const ARegion *region, const View2D *v2d, const rcti *rect) { int scroll_dummy = 0; - return UI_view2d_rect_in_scrollers_ex(ar, v2d, rect, &scroll_dummy); + return UI_view2d_rect_in_scrollers_ex(region, v2d, rect, &scroll_dummy); } /** \} */ @@ -2206,7 +2206,7 @@ void UI_view2d_text_cache_add_rectf( } } -void UI_view2d_text_cache_draw(ARegion *ar) +void UI_view2d_text_cache_draw(ARegion *region) { View2DString *v2s; int col_pack_prev = 0; @@ -2217,7 +2217,7 @@ void UI_view2d_text_cache_draw(ARegion *ar) BLF_set_default(); const float default_height = g_v2d_strings ? BLF_height(font_id, "28", 3) : 0.0f; - wmOrtho2_region_pixelspace(ar); + wmOrtho2_region_pixelspace(region); for (v2s = g_v2d_strings; v2s; v2s = v2s->next) { int xofs = 0, yofs; diff --git a/source/blender/editors/interface/view2d_draw.c b/source/blender/editors/interface/view2d_draw.c index 43b49825219..b95dbe0b59d 100644 --- a/source/blender/editors/interface/view2d_draw.c +++ b/source/blender/editors/interface/view2d_draw.c @@ -259,7 +259,7 @@ static void view2d_draw_lines(const View2D *v2d, typedef void (*PositionToString)( void *user_data, float v2d_pos, float v2d_step, uint max_len, char *r_str); -static void draw_horizontal_scale_indicators(const ARegion *ar, +static void draw_horizontal_scale_indicators(const ARegion *region, const View2D *v2d, float distance, const rcti *rect, @@ -272,7 +272,7 @@ static void draw_horizontal_scale_indicators(const ARegion *ar, } GPU_matrix_push_projection(); - wmOrtho2_region_pixelspace(ar); + wmOrtho2_region_pixelspace(region); float start; uint steps; @@ -313,7 +313,7 @@ static void draw_horizontal_scale_indicators(const ARegion *ar, GPU_matrix_pop_projection(); } -static void draw_vertical_scale_indicators(const ARegion *ar, +static void draw_vertical_scale_indicators(const ARegion *region, const View2D *v2d, float distance, float display_offset, @@ -327,7 +327,7 @@ static void draw_vertical_scale_indicators(const ARegion *ar, } GPU_matrix_push_projection(); - wmOrtho2_region_pixelspace(ar); + wmOrtho2_region_pixelspace(region); float start; uint steps; @@ -479,51 +479,53 @@ void UI_view2d_draw_lines_x__frames_or_seconds(const View2D *v2d, /* Scale indicator text drawing API **************************************************/ -static void UI_view2d_draw_scale_x__discrete_values(const ARegion *ar, +static void UI_view2d_draw_scale_x__discrete_values(const ARegion *region, const View2D *v2d, const rcti *rect, int colorid) { float number_step = view2d_major_step_x__discrete(v2d); draw_horizontal_scale_indicators( - ar, v2d, number_step, rect, view_to_string__frame_number, NULL, colorid); + region, v2d, number_step, rect, view_to_string__frame_number, NULL, colorid); } static void UI_view2d_draw_scale_x__discrete_time( - const ARegion *ar, const View2D *v2d, const rcti *rect, const Scene *scene, int colorid) + const ARegion *region, const View2D *v2d, const rcti *rect, const Scene *scene, int colorid) { float step = view2d_major_step_x__time(v2d, scene); draw_horizontal_scale_indicators( - ar, v2d, step, rect, view_to_string__time, (void *)scene, colorid); + region, v2d, step, rect, view_to_string__time, (void *)scene, colorid); } -static void UI_view2d_draw_scale_x__values(const ARegion *ar, +static void UI_view2d_draw_scale_x__values(const ARegion *region, const View2D *v2d, const rcti *rect, int colorid) { float step = view2d_major_step_x__continuous(v2d); - draw_horizontal_scale_indicators(ar, v2d, step, rect, view_to_string__value, NULL, colorid); + draw_horizontal_scale_indicators(region, v2d, step, rect, view_to_string__value, NULL, colorid); } -void UI_view2d_draw_scale_y__values(const ARegion *ar, +void UI_view2d_draw_scale_y__values(const ARegion *region, const View2D *v2d, const rcti *rect, int colorid) { float step = view2d_major_step_y__continuous(v2d); - draw_vertical_scale_indicators(ar, v2d, step, 0.0f, rect, view_to_string__value, NULL, colorid); + draw_vertical_scale_indicators( + region, v2d, step, 0.0f, rect, view_to_string__value, NULL, colorid); } -void UI_view2d_draw_scale_y__block(const ARegion *ar, +void UI_view2d_draw_scale_y__block(const ARegion *region, const View2D *v2d, const rcti *rect, int colorid) { - draw_vertical_scale_indicators(ar, v2d, 1.0f, 0.5f, rect, view_to_string__value, NULL, colorid); + draw_vertical_scale_indicators( + region, v2d, 1.0f, 0.5f, rect, view_to_string__value, NULL, colorid); } -void UI_view2d_draw_scale_x__discrete_frames_or_seconds(const struct ARegion *ar, +void UI_view2d_draw_scale_x__discrete_frames_or_seconds(const struct ARegion *region, const struct View2D *v2d, const struct rcti *rect, const struct Scene *scene, @@ -531,14 +533,14 @@ void UI_view2d_draw_scale_x__discrete_frames_or_seconds(const struct ARegion *ar int colorid) { if (display_seconds) { - UI_view2d_draw_scale_x__discrete_time(ar, v2d, rect, scene, colorid); + UI_view2d_draw_scale_x__discrete_time(region, v2d, rect, scene, colorid); } else { - UI_view2d_draw_scale_x__discrete_values(ar, v2d, rect, colorid); + UI_view2d_draw_scale_x__discrete_values(region, v2d, rect, colorid); } } -void UI_view2d_draw_scale_x__frames_or_seconds(const struct ARegion *ar, +void UI_view2d_draw_scale_x__frames_or_seconds(const struct ARegion *region, const struct View2D *v2d, const struct rcti *rect, const struct Scene *scene, @@ -546,9 +548,9 @@ void UI_view2d_draw_scale_x__frames_or_seconds(const struct ARegion *ar, int colorid) { if (display_seconds) { - UI_view2d_draw_scale_x__discrete_time(ar, v2d, rect, scene, colorid); + UI_view2d_draw_scale_x__discrete_time(region, v2d, rect, scene, colorid); } else { - UI_view2d_draw_scale_x__values(ar, v2d, rect, colorid); + UI_view2d_draw_scale_x__values(region, v2d, rect, colorid); } } diff --git a/source/blender/editors/interface/view2d_gizmo_navigate.c b/source/blender/editors/interface/view2d_gizmo_navigate.c index 09da9f077d4..a11ba0476e1 100644 --- a/source/blender/editors/interface/view2d_gizmo_navigate.c +++ b/source/blender/editors/interface/view2d_gizmo_navigate.c @@ -200,9 +200,9 @@ static void WIDGETGROUP_navigate_setup(const bContext *UNUSED(C), wmGizmoGroup * static void WIDGETGROUP_navigate_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup) { struct NavigateWidgetGroup *navgroup = gzgroup->customdata; - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); - const rcti *rect_visible = ED_region_visible_rect(ar); + const rcti *rect_visible = ED_region_visible_rect(region); if ((navgroup->state.rect_visible.xmax == rect_visible->xmax) && (navgroup->state.rect_visible.ymax == rect_visible->ymax)) { diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index 10d327cb2ba..7eea9e6a697 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -54,9 +54,9 @@ static bool view2d_poll(bContext *C) { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); - return (ar != NULL) && (ar->v2d.flag & V2D_IS_INITIALISED); + return (region != NULL) && (region->v2d.flag & V2D_IS_INITIALISED); } /** \} */ @@ -83,7 +83,7 @@ typedef struct v2dViewPanData { /** area where view pan was initiated */ ScrArea *sa; /** region where view pan was initiated */ - ARegion *ar; + ARegion *region; /** view2d we're operating in */ View2D *v2d; @@ -105,18 +105,18 @@ typedef struct v2dViewPanData { /* initialize panning customdata */ static int view_pan_init(bContext *C, wmOperator *op) { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); v2dViewPanData *vpd; View2D *v2d; float winx, winy; /* regions now have v2d-data by default, so check for region */ - if (ar == NULL) { + if (region == NULL) { return 0; } /* check if panning is allowed at all */ - v2d = &ar->v2d; + v2d = ®ion->v2d; if ((v2d->keepofs & V2D_LOCKOFS_X) && (v2d->keepofs & V2D_LOCKOFS_Y)) { return 0; } @@ -129,11 +129,11 @@ static int view_pan_init(bContext *C, wmOperator *op) vpd->sc = CTX_wm_screen(C); vpd->sa = CTX_wm_area(C); vpd->v2d = v2d; - vpd->ar = ar; + vpd->region = region; /* calculate translation factor - based on size of view */ - winx = (float)(BLI_rcti_size_x(&ar->winrct) + 1); - winy = (float)(BLI_rcti_size_y(&ar->winrct) + 1); + winx = (float)(BLI_rcti_size_x(®ion->winrct) + 1); + winy = (float)(BLI_rcti_size_y(®ion->winrct) + 1); vpd->facx = (BLI_rctf_size_x(&v2d->cur)) / winx; vpd->facy = (BLI_rctf_size_y(&v2d->cur)) / winy; @@ -143,14 +143,14 @@ static int view_pan_init(bContext *C, wmOperator *op) #ifdef WITH_INPUT_NDOF static bool view_pan_poll(bContext *C) { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); View2D *v2d; /* check if there's a region in context to work with */ - if (ar == NULL) { + if (region == NULL) { return 0; } - v2d = &ar->v2d; + v2d = ®ion->v2d; /* check that 2d-view can pan */ if ((v2d->keepofs & V2D_LOCKOFS_X) && (v2d->keepofs & V2D_LOCKOFS_Y)) { @@ -185,7 +185,7 @@ static void view_pan_apply_ex(bContext *C, v2dViewPanData *vpd, float dx, float UI_view2d_curRect_validate(v2d); /* don't rebuild full tree in outliner, since we're just changing our view */ - ED_region_tag_redraw_no_rebuild(vpd->ar); + ED_region_tag_redraw_no_rebuild(vpd->region); /* request updates to be done... */ WM_event_add_mousemove(CTX_wm_window(C)); @@ -461,8 +461,8 @@ static int view_scrolldown_exec(bContext *C, wmOperator *op) PropertyRNA *prop = RNA_struct_find_property(op->ptr, "page"); if (RNA_property_is_set(op->ptr, prop) && RNA_property_boolean_get(op->ptr, prop)) { - ARegion *ar = CTX_wm_region(C); - RNA_int_set(op->ptr, "deltay", ar->v2d.mask.ymin - ar->v2d.mask.ymax); + ARegion *region = CTX_wm_region(C); + RNA_int_set(op->ptr, "deltay", region->v2d.mask.ymin - region->v2d.mask.ymax); } /* apply movement, then we're done */ @@ -511,8 +511,8 @@ static int view_scrollup_exec(bContext *C, wmOperator *op) PropertyRNA *prop = RNA_struct_find_property(op->ptr, "page"); if (RNA_property_is_set(op->ptr, prop) && RNA_property_boolean_get(op->ptr, prop)) { - ARegion *ar = CTX_wm_region(C); - RNA_int_set(op->ptr, "deltay", BLI_rcti_size_y(&ar->v2d.mask)); + ARegion *region = CTX_wm_region(C); + RNA_int_set(op->ptr, "deltay", BLI_rcti_size_y(®ion->v2d.mask)); } /* apply movement, then we're done */ @@ -563,7 +563,7 @@ static void VIEW2D_OT_scroll_up(wmOperatorType *ot) /* temp customdata for operator */ typedef struct v2dViewZoomData { View2D *v2d; /* view2d we're operating in */ - ARegion *ar; + ARegion *region; /* needed for continuous zoom */ wmTimer *timer; @@ -588,9 +588,9 @@ static void view_zoom_axis_lock_defaults(bContext *C, bool r_do_zoom_xy[2]) /* default not to zoom the sequencer vertically */ if (sa && sa->spacetype == SPACE_SEQ) { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); - if (ar && ar->regiontype == RGN_TYPE_WINDOW) { + if (region && region->regiontype == RGN_TYPE_WINDOW) { r_do_zoom_xy[1] = false; } } @@ -599,15 +599,15 @@ static void view_zoom_axis_lock_defaults(bContext *C, bool r_do_zoom_xy[2]) /* initialize panning customdata */ static int view_zoomdrag_init(bContext *C, wmOperator *op) { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); v2dViewZoomData *vzd; View2D *v2d; /* regions now have v2d-data by default, so check for region */ - if (ar == NULL) { + if (region == NULL) { return 0; } - v2d = &ar->v2d; + v2d = ®ion->v2d; /* check that 2d-view is zoomable */ if ((v2d->keepzoom & V2D_LOCKZOOM_X) && (v2d->keepzoom & V2D_LOCKZOOM_Y)) { @@ -620,7 +620,7 @@ static int view_zoomdrag_init(bContext *C, wmOperator *op) /* set pointers to owners */ vzd->v2d = v2d; - vzd->ar = ar; + vzd->region = region; return 1; } @@ -628,11 +628,11 @@ static int view_zoomdrag_init(bContext *C, wmOperator *op) /* check if step-zoom can be applied */ static bool view_zoom_poll(bContext *C) { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); View2D *v2d; /* check if there's a region in context to work with */ - if (ar == NULL) { + if (region == NULL) { return false; } @@ -641,7 +641,7 @@ static bool view_zoom_poll(bContext *C) return false; } - v2d = &ar->v2d; + v2d = ®ion->v2d; /* check that 2d-view is zoomable */ if ((v2d->keepzoom & V2D_LOCKZOOM_X) && (v2d->keepzoom & V2D_LOCKZOOM_Y)) { @@ -656,11 +656,11 @@ static bool view_zoom_poll(bContext *C) static void view_zoomstep_apply_ex( bContext *C, v2dViewZoomData *vzd, const bool zoom_to_pos, const float facx, const float facy) { - ARegion *ar = CTX_wm_region(C); - View2D *v2d = &ar->v2d; + ARegion *region = CTX_wm_region(C); + View2D *v2d = ®ion->v2d; const rctf cur_old = v2d->cur; float dx, dy; - const int snap_test = ED_region_snap_size_test(ar); + const int snap_test = ED_region_snap_size_test(region); /* calculate amount to move view by, ensuring symmetry so the * old zoom level is restored after zooming back the same amount @@ -749,14 +749,14 @@ static void view_zoomstep_apply_ex( /* validate that view is in valid configuration after this operation */ UI_view2d_curRect_validate(v2d); - if (ED_region_snap_size_apply(ar, snap_test)) { + if (ED_region_snap_size_apply(region, snap_test)) { ScrArea *sa = CTX_wm_area(C); ED_area_tag_redraw(sa); WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL); } /* request updates to be done... */ - ED_region_tag_redraw_no_rebuild(vzd->ar); + ED_region_tag_redraw_no_rebuild(vzd->region); UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY); } @@ -816,10 +816,11 @@ static int view_zoomin_invoke(bContext *C, wmOperator *op, const wmEvent *event) vzd = op->customdata; if (U.uiflag & USER_ZOOM_TO_MOUSEPOS) { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); /* store initial mouse position (in view space) */ - UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &vzd->mx_2d, &vzd->my_2d); + UI_view2d_region_to_view( + ®ion->v2d, event->mval[0], event->mval[1], &vzd->mx_2d, &vzd->my_2d); } return view_zoomin_exec(C, op); @@ -883,10 +884,11 @@ static int view_zoomout_invoke(bContext *C, wmOperator *op, const wmEvent *event vzd = op->customdata; if (U.uiflag & USER_ZOOM_TO_MOUSEPOS) { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); /* store initial mouse position (in view space) */ - UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &vzd->mx_2d, &vzd->my_2d); + UI_view2d_region_to_view( + ®ion->v2d, event->mval[0], event->mval[1], &vzd->mx_2d, &vzd->my_2d); } return view_zoomout_exec(C, op); @@ -934,7 +936,7 @@ static void view_zoomdrag_apply(bContext *C, wmOperator *op) v2dViewZoomData *vzd = op->customdata; View2D *v2d = vzd->v2d; float dx, dy; - const int snap_test = ED_region_snap_size_test(vzd->ar); + const int snap_test = ED_region_snap_size_test(vzd->region); const bool use_cursor_init = RNA_boolean_get(op->ptr, "use_cursor_init"); const bool zoom_to_pos = use_cursor_init && (U.uiflag & USER_ZOOM_TO_MOUSEPOS); @@ -1002,14 +1004,14 @@ static void view_zoomdrag_apply(bContext *C, wmOperator *op) /* validate that view is in valid configuration after this operation */ UI_view2d_curRect_validate(v2d); - if (ED_region_snap_size_apply(vzd->ar, snap_test)) { + if (ED_region_snap_size_apply(vzd->region, snap_test)) { ScrArea *sa = CTX_wm_area(C); ED_area_tag_redraw(sa); WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL); } /* request updates to be done... */ - ED_region_tag_redraw_no_rebuild(vzd->ar); + ED_region_tag_redraw_no_rebuild(vzd->region); UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY); } @@ -1106,10 +1108,11 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, const wmEvent *even vzd->invoke_event = event->type; if (U.uiflag & USER_ZOOM_TO_MOUSEPOS) { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); /* store initial mouse position (in view space) */ - UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &vzd->mx_2d, &vzd->my_2d); + UI_view2d_region_to_view( + ®ion->v2d, event->mval[0], event->mval[1], &vzd->mx_2d, &vzd->my_2d); } if (v2d->keepofs & V2D_LOCKOFS_X) { @@ -1163,16 +1166,16 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, const wmEvent *event /* x-axis transform */ dist = BLI_rcti_size_x(&v2d->mask) / 2.0f; - len_old[0] = fabsf(vzd->lastx - vzd->ar->winrct.xmin - dist); - len_new[0] = fabsf(event->x - vzd->ar->winrct.xmin - dist); + len_old[0] = fabsf(vzd->lastx - vzd->region->winrct.xmin - dist); + len_new[0] = fabsf(event->x - vzd->region->winrct.xmin - dist); len_old[0] *= zoomfac * BLI_rctf_size_x(&v2d->cur); len_new[0] *= zoomfac * BLI_rctf_size_x(&v2d->cur); /* y-axis transform */ dist = BLI_rcti_size_y(&v2d->mask) / 2.0f; - len_old[1] = fabsf(vzd->lasty - vzd->ar->winrct.ymin - dist); - len_new[1] = fabsf(event->y - vzd->ar->winrct.ymin - dist); + len_old[1] = fabsf(vzd->lasty - vzd->region->winrct.ymin - dist); + len_new[1] = fabsf(event->y - vzd->region->winrct.ymin - dist); len_old[1] *= zoomfac * BLI_rctf_size_y(&v2d->cur); len_new[1] *= zoomfac * BLI_rctf_size_y(&v2d->cur); @@ -1317,8 +1320,8 @@ static void VIEW2D_OT_zoom(wmOperatorType *ot) static int view_borderzoom_exec(bContext *C, wmOperator *op) { - ARegion *ar = CTX_wm_region(C); - View2D *v2d = &ar->v2d; + ARegion *region = CTX_wm_region(C); + View2D *v2d = ®ion->v2d; rctf rect; rctf cur_new = v2d->cur; const int smooth_viewtx = WM_operator_smooth_viewtx_get(op); @@ -1373,7 +1376,7 @@ static int view_borderzoom_exec(bContext *C, wmOperator *op) } } - UI_view2d_smooth_view(C, ar, &cur_new, smooth_viewtx); + UI_view2d_smooth_view(C, region, &cur_new, smooth_viewtx); return OPERATOR_FINISHED; } @@ -1524,12 +1527,12 @@ static float smooth_view_rect_to_fac(const rctf *rect_a, const rctf *rect_b) /* will start timer if appropriate */ /* the arguments are the desired situation */ -void UI_view2d_smooth_view(bContext *C, ARegion *ar, const rctf *cur, const int smooth_viewtx) +void UI_view2d_smooth_view(bContext *C, ARegion *region, const rctf *cur, const int smooth_viewtx) { wmWindowManager *wm = CTX_wm_manager(C); wmWindow *win = CTX_wm_window(C); - View2D *v2d = &ar->v2d; + View2D *v2d = ®ion->v2d; struct SmoothView2DStore sms = {{0}}; bool ok = false; float fac = 1.0f; @@ -1584,7 +1587,7 @@ void UI_view2d_smooth_view(bContext *C, ARegion *ar, const rctf *cur, const int v2d->cur = sms.new_cur; UI_view2d_curRect_validate(v2d); - ED_region_tag_redraw_no_rebuild(ar); + ED_region_tag_redraw_no_rebuild(region); UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY); } } @@ -1593,8 +1596,8 @@ void UI_view2d_smooth_view(bContext *C, ARegion *ar, const rctf *cur, const int static int view2d_smoothview_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event) { wmWindow *win = CTX_wm_window(C); - ARegion *ar = CTX_wm_region(C); - View2D *v2d = &ar->v2d; + ARegion *region = CTX_wm_region(C); + View2D *v2d = ®ion->v2d; struct SmoothView2DStore *sms = v2d->sms; float step; @@ -1632,7 +1635,7 @@ static int view2d_smoothview_invoke(bContext *C, wmOperator *UNUSED(op), const w UI_view2d_curRect_validate(v2d); UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY); - ED_region_tag_redraw_no_rebuild(ar); + ED_region_tag_redraw_no_rebuild(region); if (v2d->sms == NULL) { UI_view2d_zoom_cache_reset(); @@ -1679,7 +1682,7 @@ typedef struct v2dScrollerMove { /** View2D data that this operation affects */ View2D *v2d; /** region that the scroller is in */ - ARegion *ar; + ARegion *region; /** scroller that mouse is in ('h' or 'v') */ char scroller; @@ -1793,12 +1796,12 @@ static bool scroller_activate_poll(bContext *C) } wmWindow *win = CTX_wm_window(C); - ARegion *ar = CTX_wm_region(C); - View2D *v2d = &ar->v2d; + ARegion *region = CTX_wm_region(C); + View2D *v2d = ®ion->v2d; wmEvent *event = win->eventstate; /* check if mouse in scrollbars, if they're enabled */ - return (UI_view2d_mouse_in_scrollers(ar, v2d, event->x, event->y) != 0); + return (UI_view2d_mouse_in_scrollers(region, v2d, event->x, event->y) != 0); } /* initialize customdata for scroller manipulation operator */ @@ -1809,8 +1812,8 @@ static void scroller_activate_init(bContext *C, { v2dScrollerMove *vsm; View2DScrollers *scrollers; - ARegion *ar = CTX_wm_region(C); - View2D *v2d = &ar->v2d; + ARegion *region = CTX_wm_region(C); + View2D *v2d = ®ion->v2d; rctf tot_cur_union; float mask_size; @@ -1820,7 +1823,7 @@ static void scroller_activate_init(bContext *C, /* set general data */ vsm->v2d = v2d; - vsm->ar = ar; + vsm->region = region; vsm->scroller = in_scroller; /* store mouse-coordinates, and convert mouse/screen coordinates to region coordinates */ @@ -1842,7 +1845,7 @@ static void scroller_activate_init(bContext *C, vsm->fac = BLI_rctf_size_x(&tot_cur_union) / mask_size; /* pixel rounding */ - vsm->fac_round = (BLI_rctf_size_x(&v2d->cur)) / (float)(BLI_rcti_size_x(&ar->winrct) + 1); + vsm->fac_round = (BLI_rctf_size_x(&v2d->cur)) / (float)(BLI_rcti_size_x(®ion->winrct) + 1); /* get 'zone' (i.e. which part of scroller is activated) */ vsm->zone = mouse_in_scroller_handle( @@ -1854,7 +1857,7 @@ static void scroller_activate_init(bContext *C, } vsm->scrollbarwidth = scrollers->hor_max - scrollers->hor_min; - vsm->scrollbar_orig = ((scrollers->hor_max + scrollers->hor_min) / 2) + ar->winrct.xmin; + vsm->scrollbar_orig = ((scrollers->hor_max + scrollers->hor_min) / 2) + region->winrct.xmin; } else { /* vertical scroller - calculate adjustment factor first */ @@ -1862,7 +1865,7 @@ static void scroller_activate_init(bContext *C, vsm->fac = BLI_rctf_size_y(&tot_cur_union) / mask_size; /* pixel rounding */ - vsm->fac_round = (BLI_rctf_size_y(&v2d->cur)) / (float)(BLI_rcti_size_y(&ar->winrct) + 1); + vsm->fac_round = (BLI_rctf_size_y(&v2d->cur)) / (float)(BLI_rcti_size_y(®ion->winrct) + 1); /* get 'zone' (i.e. which part of scroller is activated) */ vsm->zone = mouse_in_scroller_handle( @@ -1874,11 +1877,11 @@ static void scroller_activate_init(bContext *C, } vsm->scrollbarwidth = scrollers->vert_max - scrollers->vert_min; - vsm->scrollbar_orig = ((scrollers->vert_max + scrollers->vert_min) / 2) + ar->winrct.ymin; + vsm->scrollbar_orig = ((scrollers->vert_max + scrollers->vert_min) / 2) + region->winrct.ymin; } UI_view2d_scrollers_free(scrollers); - ED_region_tag_redraw_no_rebuild(ar); + ED_region_tag_redraw_no_rebuild(region); } /* cleanup temp customdata */ @@ -1957,7 +1960,7 @@ static void scroller_activate_apply(bContext *C, wmOperator *op) UI_view2d_curRect_validate(v2d); /* request updates to be done... */ - ED_region_tag_redraw_no_rebuild(vsm->ar); + ED_region_tag_redraw_no_rebuild(vsm->region); UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY); } @@ -2040,11 +2043,11 @@ static int scroller_activate_modal(bContext *C, wmOperator *op, const wmEvent *e * should have occurred, so check if it happened in scrollbar */ static int scroller_activate_invoke(bContext *C, wmOperator *op, const wmEvent *event) { - ARegion *ar = CTX_wm_region(C); - View2D *v2d = &ar->v2d; + ARegion *region = CTX_wm_region(C); + View2D *v2d = ®ion->v2d; /* check if mouse in scrollbars, if they're enabled */ - const char in_scroller = UI_view2d_mouse_in_scrollers(ar, v2d, event->x, event->y); + const char in_scroller = UI_view2d_mouse_in_scrollers(region, v2d, event->x, event->y); /* if in a scroller, init customdata then set modal handler which will * catch mouse-down to start doing useful stuff */ @@ -2153,10 +2156,10 @@ static void VIEW2D_OT_scroller_activate(wmOperatorType *ot) static int reset_exec(bContext *C, wmOperator *UNUSED(op)) { uiStyle *style = UI_style_get(); - ARegion *ar = CTX_wm_region(C); - View2D *v2d = &ar->v2d; + ARegion *region = CTX_wm_region(C); + View2D *v2d = ®ion->v2d; int winx, winy; - const int snap_test = ED_region_snap_size_test(ar); + const int snap_test = ED_region_snap_size_test(region); /* zoom 1.0 */ winx = (float)(BLI_rcti_size_x(&v2d->mask) + 1); @@ -2191,14 +2194,14 @@ static int reset_exec(bContext *C, wmOperator *UNUSED(op)) /* validate that view is in valid configuration after this operation */ UI_view2d_curRect_validate(v2d); - if (ED_region_snap_size_apply(ar, snap_test)) { + if (ED_region_snap_size_apply(region, snap_test)) { ScrArea *sa = CTX_wm_area(C); ED_area_tag_redraw(sa); WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL); } /* request updates to be done... */ - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY); UI_view2d_zoom_cache_reset(); -- cgit v1.2.3