Code cleanup: replace rectf_scale with BLI_rctf_scale

and add area arg to ui_handler_panel_region
This commit is contained in:
Campbell Barton 2013-12-03 23:53:21 +11:00
parent 35d89825c1
commit f91187d3c3
3 changed files with 5 additions and 19 deletions

@ -7851,7 +7851,7 @@ static int ui_handler_region(bContext *C, const wmEvent *event, void *UNUSED(use
/* either handle events for already activated button or try to activate */
but = ui_but_find_activated(ar);
retval = ui_handler_panel_region(C, event);
retval = ui_handler_panel_region(C, event, ar);
if (retval == WM_UI_HANDLER_CONTINUE)
retval = ui_handle_list_event(C, event, ar);

@ -501,7 +501,7 @@ int ui_step_name_menu(uiBut *but, int step);
struct AutoComplete;
/* interface_panel.c */
extern int ui_handler_panel_region(struct bContext *C, const struct wmEvent *event);
extern int ui_handler_panel_region(struct bContext *C, const struct wmEvent *event, struct ARegion *ar);
extern void ui_draw_aligned_panel(struct uiStyle *style, uiBlock *block, rcti *rect);
/* interface_draw.c */

@ -496,19 +496,6 @@ static void ui_draw_aligned_panel_header(uiStyle *style, uiBlock *block, rcti *r
}
}
static void rectf_scale(rctf *rect, const float scale)
{
float centx = BLI_rctf_cent_x(rect);
float centy = BLI_rctf_cent_y(rect);
float sizex = BLI_rctf_size_x(rect) * 0.5f * scale;
float sizey = BLI_rctf_size_y(rect) * 0.5f * scale;
rect->xmin = centx - sizex;
rect->xmax = centx + sizex;
rect->ymin = centy - sizey;
rect->ymax = centy + sizey;
}
/* panel integrated in buttonswindow, tool/property lists etc */
void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
{
@ -565,7 +552,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
itemrect.ymin = headrect.ymin;
itemrect.ymax = headrect.ymax;
rectf_scale(&itemrect, 0.7f);
BLI_rctf_scale(&itemrect, 0.7f);
ui_draw_panel_dragwidget(&itemrect);
}
@ -619,7 +606,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
itemrect.ymin = headrect.ymin;
itemrect.ymax = headrect.ymax;
rectf_scale(&itemrect, 0.35f);
BLI_rctf_scale(&itemrect, 0.35f);
if (panel->flag & PNL_CLOSEDY)
ui_draw_tria_rect(&itemrect, 'h');
@ -1133,9 +1120,8 @@ static void ui_handle_panel_header(const bContext *C, uiBlock *block, int mx, in
/* XXX should become modal keymap */
/* AKey is opening/closing panels, independent of button state now */
int ui_handler_panel_region(bContext *C, const wmEvent *event)
int ui_handler_panel_region(bContext *C, const wmEvent *event, ARegion *ar)
{
ARegion *ar = CTX_wm_region(C);
uiBlock *block;
Panel *pa;
int retval, mx, my;