From 282995eaee6f92bb6db4c1bb138c528e5aff8399 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Thu, 8 Aug 2013 14:50:32 +0200 Subject: [PATCH] Fixed disambiguation menu issue. --- common/tool/context_menu.cpp | 2 +- common/tool/tool_interactive.cpp | 2 +- common/tool/tool_manager.cpp | 2 +- include/tool/context_menu.h | 1 - include/tool/tool_manager.h | 2 +- pcbnew/tools/selection_tool.cpp | 8 ++++---- pcbnew/tools/selection_tool.h | 2 ++ 7 files changed, 10 insertions(+), 9 deletions(-) diff --git a/common/tool/context_menu.cpp b/common/tool/context_menu.cpp index 7e791d195b..125bb2bffb 100644 --- a/common/tool/context_menu.cpp +++ b/common/tool/context_menu.cpp @@ -37,7 +37,7 @@ public: CMEventHandler( CONTEXT_MENU* aMenu ): m_menu(aMenu) {}; - void onEvent( wxEvent & aEvent ) + void onEvent( wxEvent& aEvent ) { TOOL_EVENT evt; wxEventType type = aEvent.GetEventType(); diff --git a/common/tool/tool_interactive.cpp b/common/tool/tool_interactive.cpp index 4e2d51e562..1158a2625f 100644 --- a/common/tool/tool_interactive.cpp +++ b/common/tool/tool_interactive.cpp @@ -61,7 +61,7 @@ void TOOL_INTERACTIVE::Reset() } -void TOOL_INTERACTIVE::SetContextMenu( CONTEXT_MENU *aMenu, TOOL_ContextMenuTrigger aTrigger ) +void TOOL_INTERACTIVE::SetContextMenu( CONTEXT_MENU* aMenu, TOOL_ContextMenuTrigger aTrigger ) { aMenu->setTool( this ); m_toolMgr->ScheduleContextMenu( this, aMenu, aTrigger ); diff --git a/common/tool/tool_manager.cpp b/common/tool/tool_manager.cpp index 3238100c68..7293c6fb31 100644 --- a/common/tool/tool_manager.cpp +++ b/common/tool/tool_manager.cpp @@ -68,7 +68,7 @@ TOOL_MANAGER::TOOL_MANAGER() { } -void TOOL_MANAGER::RegisterTool ( TOOL_BASE *aTool ) +void TOOL_MANAGER::RegisterTool( TOOL_BASE* aTool ) { ToolState* st = new ToolState; diff --git a/include/tool/context_menu.h b/include/tool/context_menu.h index 63122b5b94..909798534a 100644 --- a/include/tool/context_menu.h +++ b/include/tool/context_menu.h @@ -40,7 +40,6 @@ class CONTEXT_MENU { public: - CONTEXT_MENU(); ~CONTEXT_MENU(); diff --git a/include/tool/tool_manager.h b/include/tool/tool_manager.h index a41200b6e7..8014eded74 100644 --- a/include/tool/tool_manager.h +++ b/include/tool/tool_manager.h @@ -156,7 +156,7 @@ class TOOL_MANAGER TOOL_ContextMenuTrigger aTrigger ); private: - void dispatchInternal ( TOOL_EVENT& aEvent ); + void dispatchInternal( TOOL_EVENT& aEvent ); struct ToolState; typedef std::pair Transition; diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index 97e6c1200a..4605c39185 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -216,11 +216,11 @@ void SELECTION_TOOL::selectMultiple() BOARD_ITEM* SELECTION_TOOL::disambiguationMenu( GENERAL_COLLECTOR *aCollector ) { - CONTEXT_MENU cmenu; OPT_TOOL_EVENT evt; BOARD_ITEM *current = NULL; - cmenu.SetTitle( _( "Clarify selection" ) ); + m_menu.reset( new CONTEXT_MENU() ); + m_menu->SetTitle( _( "Clarify selection" ) ); int limit = std::min( 10, aCollector->GetCount() ); @@ -229,10 +229,10 @@ BOARD_ITEM* SELECTION_TOOL::disambiguationMenu( GENERAL_COLLECTOR *aCollector ) wxString text; BOARD_ITEM *item = ( *aCollector )[i]; text = item->GetSelectMenuText(); - cmenu.Add( text, i ); + m_menu->Add( text, i ); } - SetContextMenu( &cmenu, CMENU_NOW ); + SetContextMenu( m_menu.get(), CMENU_NOW ); while( evt = Wait() ) { diff --git a/pcbnew/tools/selection_tool.h b/pcbnew/tools/selection_tool.h index 8db55dd306..179dc1e88d 100644 --- a/pcbnew/tools/selection_tool.h +++ b/pcbnew/tools/selection_tool.h @@ -26,6 +26,7 @@ #define __SELECTION_TOOL_H #include +#include #include #include @@ -66,6 +67,7 @@ private: std::set m_selectedItems; SELECTION_AREA* m_selArea; + boost::shared_ptr m_menu; }; #endif