[Bf-blender-cvs] [f8cf3afb22a] topbar: Minor corrections to tab drawing

Julian Eisel noreply at git.blender.org
Mon Jul 17 17:57:28 CEST 2017


Commit: f8cf3afb22a3f910e75bdc35d32c354032446e2e
Author: Julian Eisel
Date:   Mon Jul 17 17:56:26 2017 +0200
Branches: topbar
https://developer.blender.org/rBf8cf3afb22a3f910e75bdc35d32c354032446e2e

Minor corrections to tab drawing

===================================================================

M	source/blender/editors/interface/interface_align.c
M	source/blender/editors/interface/interface_widgets.c

===================================================================

diff --git a/source/blender/editors/interface/interface_align.c b/source/blender/editors/interface/interface_align.c
index a8cc3f72ede..1fc38a27303 100644
--- a/source/blender/editors/interface/interface_align.c
+++ b/source/blender/editors/interface/interface_align.c
@@ -325,22 +325,23 @@ static void ui_block_align_but_to_region(uiBut *but, const ARegion *region)
 	rctf *rect = &but->rect;
 	const float but_width = BLI_rctf_size_x(rect);
 	const float but_height = BLI_rctf_size_y(rect);
+	const float px = U.pixelsize;
 
 	switch (but->drawflag & UI_BUT_ALIGN) {
 		case UI_BUT_ALIGN_TOP:
-			rect->ymax = region->winy;
+			rect->ymax = region->winy + px;
 			rect->ymin = but->rect.ymax - but_height;
 			break;
 		case UI_BUT_ALIGN_DOWN:
-			rect->ymin = 0;
-			rect->ymax = but_height;
+			rect->ymin = -px;
+			rect->ymax = rect->ymin + but_height;
 			break;
 		case UI_BUT_ALIGN_LEFT:
-			rect->xmin = 0;
-			rect->xmax = but_width;
+			rect->xmin = -px;
+			rect->xmax = rect->xmin + but_width;
 			break;
 		case UI_BUT_ALIGN_RIGHT:
-			rect->xmax = region->winx;
+			rect->xmax = region->winx + px;
 			rect->xmin = rect->xmax - but_width;
 			break;
 		default:
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 2ccb3326fed..4281adf6262 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -3468,12 +3468,12 @@ static void widget_roundbut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state),
 	widgetbase_draw(&wtb, wcol);
 }
 
-static void widget_tab(uiBut *but, uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)
+static void widget_tab(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
 {
 	const uiStyle *style = UI_style_get();
 	const float rad = 0.25f * U.widget_unit;
 	const int fontid = style->widget.uifont_id;
-	const bool is_active = (but->flag & UI_SELECT);
+	const bool is_active = (state & UI_SELECT);
 
 /* Draw shaded outline - Disabled for now, seems incorrect and also looks nicer without it imho ;) */
 //#define USE_TAB_SHADED_HIGHLIGHT
@@ -3607,7 +3607,7 @@ static uiWidgetType *widget_type(uiWidgetTypeEnum type)
 			break;
 
 		case UI_WTYPE_TAB:
-			wt.custom = widget_tab;
+			wt.draw = widget_tab;
 			wt.wcol_theme = &btheme->tui.wcol_tab;
 			break;




More information about the Bf-blender-cvs mailing list