diff options
Diffstat (limited to 'source/blender/editors/interface/interface_panel.c')
-rw-r--r-- | source/blender/editors/interface/interface_panel.c | 36 |
1 files changed, 11 insertions, 25 deletions
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 3fe11ad3a6b..9759614dd4c 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -413,7 +413,7 @@ static void ui_draw_x_icon(float x, float y) #define PNL_ICON UI_UNIT_X /* could be UI_UNIT_Y too */ -static void ui_draw_panel_scalewidget(rcti *rect) +static void ui_draw_panel_scalewidget(const rcti *rect) { float xmin, xmax, dx; float ymin, ymax, dy; @@ -464,7 +464,7 @@ static void ui_draw_panel_dragwidget(const rctf *rect) } -static void ui_draw_aligned_panel_header(uiStyle *style, uiBlock *block, rcti *rect, char dir) +static void ui_draw_aligned_panel_header(uiStyle *style, uiBlock *block, const rcti *rect, char dir) { Panel *panel = block->panel; rcti hrect; @@ -496,21 +496,8 @@ 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) +void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect) { Panel *panel = block->panel; rcti headrect; @@ -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,16 +1120,15 @@ 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; retval = WM_UI_HANDLER_CONTINUE; for (block = ar->uiblocks.last; block; block = block->prev) { - int inside = 0, inside_header = 0, inside_scale = 0; + bool inside = false, inside_header = false, inside_scale = false; mx = event->x; my = event->y; @@ -1159,24 +1145,24 @@ int ui_handler_panel_region(bContext *C, const wmEvent *event) /* clicked at panel header? */ if (pa->flag & PNL_CLOSEDX) { if (block->rect.xmin <= mx && block->rect.xmin + PNL_HEADER >= mx) - inside_header = 1; + inside_header = true; } else if (block->rect.xmin > mx || block->rect.xmax < mx) { /* outside left/right side */ } else if ((block->rect.ymax <= my) && (block->rect.ymax + PNL_HEADER >= my)) { - inside_header = 1; + inside_header = true; } else if (!(pa->flag & PNL_CLOSEDY)) { /* open panel */ if (pa->control & UI_PNL_SCALE) { if (block->rect.xmax - PNL_HEADER <= mx) if (block->rect.ymin + PNL_HEADER >= my) - inside_scale = 1; + inside_scale = true; } if (block->rect.xmin <= mx && block->rect.xmax >= mx) if (block->rect.ymin <= my && block->rect.ymax + PNL_HEADER >= my) - inside = 1; + inside = true; } /* XXX hardcoded key warning */ |