Commit 282995ea authored by Maciej Suminski's avatar Maciej Suminski

Fixed disambiguation menu issue.

parent 402f3c6f
...@@ -37,7 +37,7 @@ public: ...@@ -37,7 +37,7 @@ public:
CMEventHandler( CONTEXT_MENU* aMenu ): CMEventHandler( CONTEXT_MENU* aMenu ):
m_menu(aMenu) {}; m_menu(aMenu) {};
void onEvent( wxEvent & aEvent ) void onEvent( wxEvent& aEvent )
{ {
TOOL_EVENT evt; TOOL_EVENT evt;
wxEventType type = aEvent.GetEventType(); wxEventType type = aEvent.GetEventType();
......
...@@ -61,7 +61,7 @@ void TOOL_INTERACTIVE::Reset() ...@@ -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 ); aMenu->setTool( this );
m_toolMgr->ScheduleContextMenu( this, aMenu, aTrigger ); m_toolMgr->ScheduleContextMenu( this, aMenu, aTrigger );
......
...@@ -68,7 +68,7 @@ TOOL_MANAGER::TOOL_MANAGER() ...@@ -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; ToolState* st = new ToolState;
......
...@@ -40,7 +40,6 @@ class CONTEXT_MENU ...@@ -40,7 +40,6 @@ class CONTEXT_MENU
{ {
public: public:
CONTEXT_MENU(); CONTEXT_MENU();
~CONTEXT_MENU(); ~CONTEXT_MENU();
......
...@@ -156,7 +156,7 @@ class TOOL_MANAGER ...@@ -156,7 +156,7 @@ class TOOL_MANAGER
TOOL_ContextMenuTrigger aTrigger ); TOOL_ContextMenuTrigger aTrigger );
private: private:
void dispatchInternal ( TOOL_EVENT& aEvent ); void dispatchInternal( TOOL_EVENT& aEvent );
struct ToolState; struct ToolState;
typedef std::pair<TOOL_EVENT_LIST, TOOL_STATE_FUNC> Transition; typedef std::pair<TOOL_EVENT_LIST, TOOL_STATE_FUNC> Transition;
......
...@@ -216,11 +216,11 @@ void SELECTION_TOOL::selectMultiple() ...@@ -216,11 +216,11 @@ void SELECTION_TOOL::selectMultiple()
BOARD_ITEM* SELECTION_TOOL::disambiguationMenu( GENERAL_COLLECTOR *aCollector ) BOARD_ITEM* SELECTION_TOOL::disambiguationMenu( GENERAL_COLLECTOR *aCollector )
{ {
CONTEXT_MENU cmenu;
OPT_TOOL_EVENT evt; OPT_TOOL_EVENT evt;
BOARD_ITEM *current = NULL; 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() ); int limit = std::min( 10, aCollector->GetCount() );
...@@ -229,10 +229,10 @@ BOARD_ITEM* SELECTION_TOOL::disambiguationMenu( GENERAL_COLLECTOR *aCollector ) ...@@ -229,10 +229,10 @@ BOARD_ITEM* SELECTION_TOOL::disambiguationMenu( GENERAL_COLLECTOR *aCollector )
wxString text; wxString text;
BOARD_ITEM *item = ( *aCollector )[i]; BOARD_ITEM *item = ( *aCollector )[i];
text = item->GetSelectMenuText(); 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() ) while( evt = Wait() )
{ {
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#define __SELECTION_TOOL_H #define __SELECTION_TOOL_H
#include <set> #include <set>
#include <boost/shared_ptr.hpp>
#include <math/vector2d.h> #include <math/vector2d.h>
#include <tool/tool_interactive.h> #include <tool/tool_interactive.h>
...@@ -66,6 +67,7 @@ private: ...@@ -66,6 +67,7 @@ private:
std::set<BOARD_ITEM*> m_selectedItems; std::set<BOARD_ITEM*> m_selectedItems;
SELECTION_AREA* m_selArea; SELECTION_AREA* m_selArea;
boost::shared_ptr<CONTEXT_MENU> m_menu;
}; };
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment