[Bf-blender-cvs] [b7ad6b4] pie-menus: Minor changes, sync with master

Campbell Barton noreply at git.blender.org
Fri Aug 1 20:13:09 CEST 2014


Commit: b7ad6b4437c3978ab354e34c0763051914f5493e
Author: Campbell Barton
Date:   Sat Aug 2 04:12:47 2014 +1000
Branches: pie-menus
https://developer.blender.org/rBb7ad6b4437c3978ab354e34c0763051914f5493e

Minor changes, sync with master

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

M	intern/ghost/intern/GHOST_SystemX11.cpp
M	intern/ghost/intern/GHOST_SystemX11.h
M	release/scripts/startup/bl_operators/wm.py
M	release/scripts/startup/bl_ui/space_view3d_toolbar.py
M	source/blender/editors/interface/interface.c
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_regions.c
M	source/blender/editors/mesh/mesh_ops.c
M	source/blender/editors/space_view3d/view3d_ops.c
M	source/blender/makesrna/intern/rna_access.c
M	source/blender/makesrna/intern/rna_space.c
M	source/blender/makesrna/intern/rna_userdef.c
M	source/blender/windowmanager/WM_api.h
M	source/blender/windowmanager/WM_keymap.h
M	source/blender/windowmanager/intern/wm_event_system.c
M	source/blender/windowmanager/intern/wm_keymap.c

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

diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index 5cbe408..6d948b2 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -469,10 +469,10 @@ processEvents(
 	 * ghost events and call base class pushEvent() method. */
 	
 	bool anyProcessed = false;
-
+	
 	do {
 		GHOST_TimerManager *timerMgr = getTimerManager();
-
+		
 		if (waitForEvent && m_dirty_windows.empty() && !XPending(m_display)) {
 			GHOST_TUns64 next = timerMgr->nextFireTime();
 			
@@ -486,11 +486,11 @@ processEvents(
 					SleepTillEvent(m_display, next - getMilliSeconds());
 			}
 		}
-
+		
 		if (timerMgr->fireTimers(getMilliSeconds())) {
 			anyProcessed = true;
 		}
-
+		
 		while (XPending(m_display)) {
 			XEvent xevent;
 			XNextEvent(m_display, &xevent);
@@ -525,14 +525,13 @@ processEvents(
 				continue;
 			}
 #endif
-			/* when using autorepeat, some keypress events can actually come -after- the
+			/* when using autorepeat, some keypress events can actually come *after* the
 			 * last keyrelease. The next code takes care of that */
 			if (xevent.type == KeyRelease) {
 				m_last_release_keycode = xevent.xkey.keycode;
 				m_last_release_time = xevent.xkey.time;
 			}
-
-			if (xevent.type == KeyPress) {
+			else if (xevent.type == KeyPress) {
 				if ((xevent.xkey.keycode == m_last_release_keycode) && ((xevent.xkey.time <= m_last_release_time)))
 					continue;
 			}
@@ -805,7 +804,7 @@ GHOST_SystemX11::processEvent(XEvent *xe)
 
 			gkey = convertXKey(key_sym);
 
-			GHOST_TEventType type = (xke->type == KeyPress) ?
+			GHOST_TEventType type = (xke->type == KeyPress) ? 
 			                        GHOST_kEventKeyDown : GHOST_kEventKeyUp;
 			
 			if (!XLookupString(xke, &ascii, 1, NULL, NULL)) {
diff --git a/intern/ghost/intern/GHOST_SystemX11.h b/intern/ghost/intern/GHOST_SystemX11.h
index f6191aa..a21300e 100644
--- a/intern/ghost/intern/GHOST_SystemX11.h
+++ b/intern/ghost/intern/GHOST_SystemX11.h
@@ -356,6 +356,7 @@ private:
 	 *  and stop accumulating all events generated before that */
 	Time m_last_warp;
 
+	/* detect autorepeat glitch */
 	unsigned int m_last_release_keycode;
 	Time m_last_release_time;
 
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py
index c42ab6e..15e482a 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -526,7 +526,7 @@ class WM_OT_context_menu_enum(Operator):
             layout.prop(value_base, prop_string, expand=True)
 
         context.window_manager.popup_menu(draw_func=draw_cb, title=prop.name, icon=prop.icon)
-        
+
         return {'FINISHED'}
 
 
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 6cdd8c4..53de1dc 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -1773,10 +1773,6 @@ class VIEW3D_PT_tools_grease_pencil(GreasePencilPanel, Panel):
     bl_space_type = 'VIEW_3D'
     bl_region_type = 'TOOLS'
     bl_category = "Grease Pencil"
-        
-    @classmethod
-    def poll(cls, context):
-        return (context.sculpt_object and context.tool_settings.sculpt)
 
 
 if __name__ == "__main__":  # only for live edit.
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 1e68de0..9abe890 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -1183,9 +1183,7 @@ void uiEndBlock_ex(const bContext *C, uiBlock *block, const int xy[2])
 	if (block->layouts.first) {
 		uiBlockLayoutResolve(block, NULL, NULL);
 	}
-
 	ui_block_do_align(block);
-
 	if ((block->flag & UI_BLOCK_LOOP) && (block->flag & UI_BLOCK_NUMSELECT)) {
 		ui_menu_block_set_keyaccels(block); /* could use a different flag to check */
 	}
@@ -3075,7 +3073,7 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
 		but->drawflag |= (UI_BUT_TEXT_LEFT | UI_BUT_ICON_LEFT);
 	}
 	else if ((block->flag & UI_BLOCK_LOOP) ||
-	         ELEM(but->type, MENU, TEX, LABEL, BLOCK, BUTM, SEARCH_MENU, PROGRESSBAR, SEARCH_MENU_UNLINK))
+	          ELEM(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_handlers.c b/source/blender/editors/interface/interface_handlers.c
index bb5872f..125c07c 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -6589,7 +6589,6 @@ static bool ui_mouse_inside_button(ARegion *ar, uiBut *but, int x, int y)
 {
 	uiBlock *block = but->block;
 	float mx, my;
-
 	if (!ui_mouse_inside_region(ar, x, y))
 		return false;
 
@@ -8516,8 +8515,10 @@ static int ui_handle_menu_return_submenu(bContext *C, const wmEvent *event, uiPo
 		}
 
 		return WM_UI_HANDLER_CONTINUE;
-	} else
+	}
+	else {
 		return WM_UI_HANDLER_BREAK;
+	}
 }
 
 static bool ui_pie_menu_supported_apply(uiBut *but) {
@@ -9107,7 +9108,6 @@ void UI_add_popup_handlers(bContext *C, ListBase *handlers, uiPopupBlockHandle *
 	WM_event_add_ui_handler(C, handlers, ui_handler_popup, ui_handler_remove_popup, popup, accept_dbl_click);
 }
 
-
 void UI_remove_popup_handlers(ListBase *handlers, uiPopupBlockHandle *popup)
 {
 	WM_event_remove_ui_handler(handlers, ui_handler_popup, ui_handler_remove_popup, popup, false);
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index 6b101aa..71219c8 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -132,7 +132,7 @@ typedef enum RadialDirection {
 	UI_RADIAL_S  = 5,
 	UI_RADIAL_SW = 6,
 	UI_RADIAL_W  = 7,
-	UI_RADIAL_NW = 8
+	UI_RADIAL_NW = 8,
 } RadialDirection;
 
 extern const char ui_radial_dir_to_num[8];
@@ -161,13 +161,15 @@ extern const char ui_radial_dir_to_num[8];
 #define USE_NUMBUTS_LR_ALIGN
 
 /* PieMenuData->flags */
-#define UI_PIE_DEGREES_RANGE_LARGE (1 << 0) /* pie menu item collision is detected at 90 degrees */
-#define UI_PIE_INITIAL_DIRECTION   (1 << 1) /* use initial center of pie menu to calculate direction */
-#define UI_PIE_3_ITEMS             (1 << 2) /* pie menu has only 3 items, careful when centering */
-#define UI_PIE_INVALID_DIR         (1 << 3) /* mouse not far enough from center position  */
-#define UI_PIE_FINISHED            (1 << 4) /* pie menu finished but we still wait for a release event  */
-#define UI_PIE_CLICK_STYLE         (1 << 5) /* pie menu changed to click style, click to confirm  */
-#define UI_PIE_ANIMATION_FINISHED  (1 << 6) /* pie animation finished, do not calculate any more motio  */
+enum {
+	UI_PIE_DEGREES_RANGE_LARGE  = (1 << 0),  /* pie menu item collision is detected at 90 degrees */
+	UI_PIE_INITIAL_DIRECTION    = (1 << 1),  /* use initial center of pie menu to calculate direction */
+	UI_PIE_3_ITEMS              = (1 << 2),  /* pie menu has only 3 items, careful when centering */
+	UI_PIE_INVALID_DIR          = (1 << 3),  /* mouse not far enough from center position  */
+	UI_PIE_FINISHED             = (1 << 4),  /* pie menu finished but we still wait for a release event  */
+	UI_PIE_CLICK_STYLE          = (1 << 5),  /* pie menu changed to click style, click to confirm  */
+	UI_PIE_ANIMATION_FINISHED   = (1 << 6),  /* pie animation finished, do not calculate any more motio  */
+};
 
 #define PIE_CLICK_THRESHOLD 50.0f
 
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 895211a..21a676c 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -884,8 +884,8 @@ void uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname
 	PointerRNA ptr;
 	PropertyRNA *prop;
 	uiBlock *block = layout->root->block;
-	bool radial = (layout->item.type == ITEM_LAYOUT_RADIAL) ||
-	              ((layout->item.type == ITEM_LAYOUT_ROOT) && (layout->root->type == UI_LAYOUT_PIEMENU));
+	const bool radial = (layout->item.type == ITEM_LAYOUT_RADIAL) ||
+	                      ((layout->item.type == ITEM_LAYOUT_ROOT) && (layout->root->type == UI_LAYOUT_PIEMENU));
 
 	if (!ot || !ot->srna) {
 		ui_item_disabled(layout, opname);
@@ -2112,7 +2112,7 @@ static void ui_litem_layout_column(uiLayout *litem)
 
 /* calculates the angle of a specified button in a radial menu,
  * stores a float vector in unit circle */
-static RadialDirection ui_get_radialbut_vec(float *vec, short itemnum)
+static RadialDirection ui_get_radialbut_vec(float vec[2], short itemnum)
 {
 	float angle = 0.0f;
 	RadialDirection dir = UI_RADIAL_NONE;
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index ae14fb3..5f60acc 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -1569,7 +1569,7 @@ static void ui_popup_block_clip(wmWindow *window, uiBlock *block)
 		block->rect.xmin += xofs;
 		block->rect.xmax += xofs;
 	}
-
+	
 	if (block->rect.ymin < width)
 		block->rect.ymin = width;
 	if (block->rect.ymax > winy - MENU_TOP)
@@ -2640,6 +2640,7 @@ uiLayout *uiPupMenuLayout(uiPopupMenu *pup)
 }
 
 /*************************** Pie Menus ***************************************/
+
 static uiBlock *ui_block_func_PIE(bContext *UNUSED(C), uiPopupBlockHandle *handle, void *arg_pie)
 {
 	uiBlock *block;
@@ -2672,8 +2673,8 @@ static uiBlock *ui_block_func_PIE(bContext *UNUSED(C), uiPopupBlockHandle *handl
 
 static float uiPieTitleWidth(const char *name, int icon)
 {
-	return UI_GetStringWidth(name) +
-		        (UI_UNIT_X * (1.50f + (icon ? 0.25f : 0.0f)));
+	return (UI_GetStringWidth(name) +
+	         (UI_UNIT_X * (1.50f + (icon ? 0.25f : 0.0f))));
 }
 
 struct uiPieMenu *uiPieMenuBegin(struct bContext *C, const char *title, int icon, const wmEvent *event)
diff --git a/source/blender/editors/mesh/mesh_ops.c b/so

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list