[Bf-blender-cvs] [5b5c8af] pie-menus: Attempt to support retina also cleanup on identifier

Antony Riakiotakis noreply at git.blender.org
Sat Aug 2 17:27:06 CEST 2014


Commit: 5b5c8afb602a19352ea0394b97167083327e6f7f
Author: Antony Riakiotakis
Date:   Sat Aug 2 17:26:54 2014 +0200
Branches: pie-menus
https://developer.blender.org/rB5b5c8afb602a19352ea0394b97167083327e6f7f

Attempt to support retina also cleanup on identifier

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

M	source/blender/editors/interface/interface_handlers.c
M	source/blender/editors/interface/interface_intern.h
M	source/blender/editors/interface/interface_layout.c
M	source/blender/editors/interface/interface_widgets.c

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

diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index c35ed75..f129a2c 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -8001,7 +8001,7 @@ void ui_block_calculate_pie_segment(uiBlock *block, const float event_xy[2])
 	len = normalize_v2_v2(block->pie_data.pie_dir, seg2);
 
 	/* ten pixels for now, a bit arbitrary */
-	if (len < U.pie_menu_threshold)
+	if (len < U.pie_menu_threshold * U.pixelsize)
 		block->pie_data.flags |= UI_PIE_INVALID_DIR;
 	else
 		block->pie_data.flags &= ~UI_PIE_INVALID_DIR;
@@ -8648,7 +8648,7 @@ static int ui_handler_pie(bContext *C, const wmEvent *event, uiPopupBlockHandle
 				uiBut *but;
 				double final_time = 0.01 * U.pie_animation_timeout;
 				float fac = duration / final_time;
-				float pie_radius = U.pie_menu_radius * UI_DPI_WINDOW_FAC;
+				float pie_radius = U.pie_menu_radius * UI_DPI_FAC;
 
 				if (fac > 1.0f) {
 					fac = 1.0f;
@@ -8703,7 +8703,7 @@ static int ui_handler_pie(bContext *C, const wmEvent *event, uiPopupBlockHandle
 		}
 		else {
 			/* distance from initial point */
-			if (len_squared_v2v2(event_xy, block->pie_data.pie_center_init) < PIE_CLICK_THRESHOLD) {
+			if (len_squared_v2v2(event_xy, block->pie_data.pie_center_init) < PIE_CLICK_THRESHOLD_SQ) {
 				block->pie_data.flags |= UI_PIE_CLICK_STYLE;
 			}
 			else if (!is_click_style) {
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index 65f533c..73b48e3 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -171,7 +171,7 @@ enum {
 	UI_PIE_ANIMATION_FINISHED   = (1 << 6),  /* pie animation finished, do not calculate any more motio  */
 };
 
-#define PIE_CLICK_THRESHOLD 50.0f
+#define PIE_CLICK_THRESHOLD_SQ 50.0f
 
 typedef struct uiLinkLine {  /* only for draw/edit */
 	struct uiLinkLine *next, *prev;
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 21a676c..fbe5191 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -2218,7 +2218,7 @@ static void ui_litem_layout_radial(uiLayout *litem)
 	 * also the old code at http://developer.blender.org/T5103
 	 */
 
-	int pie_radius = U.pie_menu_radius * UI_DPI_WINDOW_FAC;
+	int pie_radius = U.pie_menu_radius * UI_DPI_FAC;
 
 	x = litem->x;
 	y = litem->y;
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 1ac36fe..433e7a8 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -3795,8 +3795,8 @@ void ui_draw_pie_center(uiBlock *block)
 
 	float *pie_dir = block->pie_data.pie_dir;
 
-	float pie_radius_internal = U.pie_menu_threshold;
-	float pie_radius_external = U.pie_menu_threshold + 7.0f;
+	float pie_radius_internal = U.pixelsize * U.pie_menu_threshold;
+	float pie_radius_external = U.pixelsize * (U.pie_menu_threshold + 7.0f);
 
 	int subd = 40;




More information about the Bf-blender-cvs mailing list