[Bf-blender-cvs] [a1fbb85] pie-menus: Do not align pie menu item text on the left. Also some minor cleanup

Antony Riakiotakis noreply at git.blender.org
Sun May 25 23:08:19 CEST 2014


Commit: a1fbb85c76b5f5cdc845061bcefa87bef662a7ba
Author: Antony Riakiotakis
Date:   Mon May 26 00:08:05 2014 +0300
https://developer.blender.org/rBa1fbb85c76b5f5cdc845061bcefa87bef662a7ba

Do not align pie menu item text on the left. Also some minor cleanup

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

M	source/blender/editors/interface/interface.c
M	source/blender/editors/interface/interface_layout.c
M	source/blender/editors/interface/interface_regions.c

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

diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index aea3739..c565d79 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -3054,7 +3054,10 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
 		}
 	}
 
-	if ((block->flag & UI_BLOCK_LOOP) ||
+	if ((block->flag & UI_BLOCK_RADIAL)) {
+		but->drawflag |= UI_BUT_ICON_LEFT;
+	}
+	else if ((block->flag & UI_BLOCK_LOOP) ||
 	    ELEM8(but->type, MENU, TEX, LABEL, BLOCK, BUTM, SEARCH_MENU, PROGRESSBAR, SEARCH_MENU_UNLINK))
 	{
 		but->drawflag |= (UI_BUT_TEXT_LEFT | UI_BUT_ICON_LEFT);
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 43ee990..7faf5f7 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -2192,7 +2192,7 @@ static void ui_get_radialbut_vec(float *vec, short itemnum, short totitems)
 		angle += aligncorrect/17;	/* 17 == magic number, works nicely */
 	}
 
-	angle = angle/180.0 * M_PI;
+	angle = angle / 180.0f * M_PI;
 
 	vec[0] = sin(angle);
 	vec[1] = cos(angle);
@@ -2220,7 +2220,7 @@ static void ui_litem_layout_radial(uiLayout *litem)
 	 * also the old code at http://developer.blender.org/T5103
 	 */
 
-#define PIE_RADIUS 150
+	int pie_radius = 150;
 
 	x = litem->x;
 	y = litem->y;
@@ -2242,16 +2242,16 @@ static void ui_litem_layout_radial(uiLayout *litem)
 				ui_get_radialbut_vec(vec, itemnum, totitems);
 				/* scale the buttons */
 				bitem->but->rect.ymax *= 1.5;
-				/* XXX Add to avoid clipping of text by icons. There may be a better way to handle this? */
+				/* add a little bit more here */
 				bitem->but->rect.xmax += UI_UNIT_X;
 				ui_item_size(item, &itemw, &itemh);
 
-				ui_item_position(item, x + vec[0] * PIE_RADIUS - itemw/2, y + vec[1] * PIE_RADIUS - itemh/2, itemw, itemh);
+				ui_item_position(item, x + vec[0] * pie_radius - itemw/2, y + vec[1] * pie_radius - itemh/2, itemw, itemh);
 
-				minx = min_ii(minx, x + vec[0] * PIE_RADIUS - itemw/2);
-				maxx = max_ii(maxx, x + vec[0] * PIE_RADIUS + itemw/2);
-				miny = min_ii(miny, y + vec[1] * PIE_RADIUS - itemh/2);
-				maxy = max_ii(maxy, y + vec[1] * PIE_RADIUS + itemh/2);
+				minx = min_ii(minx, x + vec[0] * pie_radius - itemw/2);
+				maxx = max_ii(maxx, x + vec[0] * pie_radius + itemw/2);
+				miny = min_ii(miny, y + vec[1] * pie_radius - itemh/2);
+				maxy = max_ii(maxy, y + vec[1] * pie_radius + itemh/2);
 			}
 		}
 	}
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 1e2f565..a78e19a 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -2435,8 +2435,6 @@ static uiBlock *ui_block_func_PIE(bContext *C, uiPopupBlockHandle *handle, void
 
 	uiBlockLayoutResolve(block, &width, &height);
 
-	uiBlockSetFlag(block, UI_BLOCK_MOVEMOUSE_QUIT);
-
 	uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_NUMSELECT);
 	uiBlockSetDirection(block, direction);
 
@@ -2462,7 +2460,9 @@ static uiBlock *ui_block_func_PIE(bContext *C, uiPopupBlockHandle *handle, void
 	}
 
 	block->minbounds = minwidth;
-	uiMenuPopupBoundsBlock(block, 1, offset[0], offset[1]);
+	block->bounds = 1;
+	block->mx = offset[0];
+	block->my = offset[1];
 	block->bounds_type = UI_BLOCK_BOUNDS_PIE_CENTER;
 
 	/* pies: useful for later, but keep it basic for now
@@ -2499,7 +2499,6 @@ struct uiPieMenu *uiPieMenuBegin(struct bContext *C, const char *title, int icon
 		}
 		else {
 			but = uiDefBut(pie->block, LABEL, 0, title, 0, 0, 200, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
-			but->drawflag = UI_BUT_TEXT_LEFT;
 			/* hack, draw label with default transparent style */
 			but->dt = UI_EMBOSSP;
 		}




More information about the Bf-blender-cvs mailing list