[Bf-blender-cvs] [0c7fd16] pie-menus: Minor changes and sync with master (reduce diff noise)

Campbell Barton noreply at git.blender.org
Sun Jun 15 08:54:19 CEST 2014


Commit: 0c7fd1622a1ca8f0faa1b2c9424dadd76ad8323f
Author: Campbell Barton
Date:   Sun Jun 15 16:53:41 2014 +1000
https://developer.blender.org/rB0c7fd1622a1ca8f0faa1b2c9424dadd76ad8323f

Minor changes and sync with master (reduce diff noise)

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

M	source/blender/editors/interface/interface_handlers.c
M	source/blender/editors/interface/interface_layout.c
M	source/blender/editors/interface/interface_regions.c
M	source/blender/editors/interface/interface_widgets.c
M	source/blender/windowmanager/wm_event_system.h

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

diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 48e921a..5347c70 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -6362,7 +6362,7 @@ static void ui_blocks_set_tooltips(ARegion *ar, const bool enable)
 static bool ui_mouse_inside_region(ARegion *ar, int x, int y)
 {
 	uiBlock *block;
-
+	
 	/* check if the mouse is in the region */
 	if (!BLI_rcti_isect_pt(&ar->winrct, x, y)) {
 		for (block = ar->uiblocks.first; block; block = block->next)
@@ -6393,11 +6393,10 @@ static bool ui_mouse_inside_region(ARegion *ar, int x, int y)
 	return true;
 }
 
-
 static bool ui_mouse_inside_button(ARegion *ar, uiBut *but, int x, int y)
 {
-	float mx, my;
 	uiBlock *block = but->block;
+	float mx, my;
 
 	if (!ui_mouse_inside_region(ar, x, y))
 		return false;
@@ -6412,8 +6411,9 @@ static bool ui_mouse_inside_button(ARegion *ar, uiBut *but, int x, int y)
 			return false;
 		}
 	}
-	else if (!ui_but_contains_pt(but, mx, my))
+	else if (!ui_but_contains_pt(but, mx, my)) {
 		return false;
+	}
 	
 	return true;
 }
@@ -6453,7 +6453,6 @@ static uiBut *ui_but_find_mouse_over_ex(ARegion *ar, const int x, const int y, c
 {
 	uiBlock *block;
 	uiBut *but, *butover = NULL;
-
 	float mx, my;
 
 //	if (!win->active)
@@ -7832,7 +7831,6 @@ static int ui_handle_menu_event(
 
 	mx = event->x;
 	my = event->y;
-
 	ui_window_to_block(ar, block, &mx, &my);
 
 	/* check if mouse is inside block */
@@ -7882,7 +7880,7 @@ static int ui_handle_menu_event(
 			if (block->flag & UI_BLOCK_MOVEMOUSE_QUIT) {
 				ui_mouse_motion_towards_init(menu, &event->x);
 			}
-
+			
 			/* add menu scroll timer, if needed */
 			if (ui_menu_scroll_test(block, my))
 				if (menu->scrolltimer == NULL)
@@ -8317,7 +8315,7 @@ static int ui_handle_menu_return_submenu(bContext *C, const wmEvent *event, uiPo
 }
 
 
-static void ui_pie_menu_apply (bContext *C, uiPopupBlockHandle *menu)
+static void ui_pie_menu_apply(bContext *C, uiPopupBlockHandle *menu)
 {
 	uiBut *but = ui_but_find_activated(menu->region);
 
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index b83addf..8cb5d4e 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -219,7 +219,9 @@ static int ui_item_fit(int item, int pos, int all, int available, int last, int
 
 static int ui_layout_vary_direction(uiLayout *layout)
 {
-	return (ELEM(layout->root->type, UI_LAYOUT_HEADER, UI_LAYOUT_PIEMENU) || layout->alignment != UI_LAYOUT_ALIGN_EXPAND) ? UI_ITEM_VARY_X : UI_ITEM_VARY_Y;
+	return ((ELEM(layout->root->type, UI_LAYOUT_HEADER, UI_LAYOUT_PIEMENU) ||
+	        (layout->alignment != UI_LAYOUT_ALIGN_EXPAND)) ?
+	        UI_ITEM_VARY_X : UI_ITEM_VARY_Y);
 }
 
 /* estimated size of text + icon */
@@ -944,10 +946,12 @@ void uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname
 					ui_but_tip_from_enum_item(but, item);
 				}
 				else {  /* XXX bug here, colums draw bottom item badly */
-					if (radial)
-						;
-					else
+					if (radial) {
+						/* pass */
+					}
+					else {
 						uiItemS(target);
+					}
 				}
 			}
 		}
@@ -2098,27 +2102,27 @@ static RadialDirection ui_get_radialbut_vec(float *vec, short itemnum, short tot
 	RadialDirection dir = UI_RADIAL_NONE;
 
 	/* this goes in a seemingly weird pattern:
-
-		4
-	 5     6
-	1       2
-	 7     8
-		3
-
-	but it's actually quite logical. It's designed to be 'upwards compatible'
-	for muscle memory so that the menu item locations are fixed and don't move
-	as new items are added to the menu later on. It also optimises efficiency -
-	a radial menu is best kept symmetrical, with as large an angle between
-	items as possible, so that the gestural mouse movements can be fast and inexact.
-
-	It starts off with two opposite sides for the first two items
-	then joined by the one below for the third (this way, even with three items,
-	the menu seems to still be 'in order' reading left to right). Then the fourth is
-	added to complete the compass directions. From here, it's just a matter of
-	subdividing the rest of the angles for the last 4 items.
-
-	--Matt 07/2006
-	*/
+	 *
+	 *     4
+	 *  5     6
+	 * 1       2
+	 *  7     8
+	 *     3
+	 *
+	 * but it's actually quite logical. It's designed to be 'upwards compatible'
+	 * for muscle memory so that the menu item locations are fixed and don't move
+	 * as new items are added to the menu later on. It also optimises efficiency -
+	 * a radial menu is best kept symmetrical, with as large an angle between
+	 * items as possible, so that the gestural mouse movements can be fast and inexact.
+
+	 * It starts off with two opposite sides for the first two items
+	 * then joined by the one below for the third (this way, even with three items,
+	 * the menu seems to still be 'in order' reading left to right). Then the fourth is
+	 * added to complete the compass directions. From here, it's just a matter of
+	 * subdividing the rest of the angles for the last 4 items.
+	 *
+	 * --Matt 07/2006
+	 */
 
 	if (itemnum < 5) {
 		switch (itemnum) {
@@ -2207,10 +2211,10 @@ static RadialDirection ui_get_radialbut_vec(float *vec, short itemnum, short tot
 #endif
 	}
 
-	angle = angle / 180.0f * M_PI;
+	angle = DEG2RADF(angle);
 
-	vec[0] = cos(angle);
-	vec[1] = sin(angle);
+	vec[0] = cosf(angle);
+	vec[1] = sinf(angle);
 
 	return dir;
 }
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index f4afcc3..5754708 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -2729,6 +2729,7 @@ bool uiPupMenuInvoke(bContext *C, const char *idname, ReportList *reports)
 	return true;
 }
 
+
 /*************************** Popup Block API **************************/
 
 void uiPupBlockO(bContext *C, uiBlockCreateFunc func, void *arg, const char *opname, int opcontext)
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index c6087b4..0fda5b0 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -1953,7 +1953,7 @@ static void widget_state_pie_menu_item(uiWidgetType *wt, int state)
 static void widget_state_menu_item(uiWidgetType *wt, int state)
 {
 	wt->wcol = *(wt->wcol_theme);
-
+	
 	/* active and disabled (not so common) */
 	if ((state & UI_BUT_DISABLED) && (state & UI_ACTIVE)) {
 		widget_state_blend(wt->wcol.text, wt->wcol.text_sel, 0.5f);
@@ -1973,6 +1973,7 @@ static void widget_state_menu_item(uiWidgetType *wt, int state)
 	}
 }
 
+
 /* ************ menu backdrop ************************* */
 
 /* outside of rect, rad to left/bottom/right */
diff --git a/source/blender/windowmanager/wm_event_system.h b/source/blender/windowmanager/wm_event_system.h
index 6891b2f..0d57351 100644
--- a/source/blender/windowmanager/wm_event_system.h
+++ b/source/blender/windowmanager/wm_event_system.h
@@ -83,7 +83,7 @@ enum {
 enum {
 	WM_HANDLER_BLOCKING         = 1,  /* after this handler all others are ignored */
 	WM_HANDLER_DO_FREE          = 2,  /* handler tagged to be freed in wm_handlers_do() */
-	WM_HANDLER_ACCEPT_DBL_CLICK = 4   /* handler accepts double key press events */
+	WM_HANDLER_ACCEPT_DBL_CLICK = 4,  /* handler accepts double key press events */
 };
 
 /* wm_event_system.c */




More information about the Bf-blender-cvs mailing list