Fixed crash on right click on zone with GAL mode.
This commit is contained in:
parent
5f4423f7af
commit
9c2bcb2f3c
|
@ -194,6 +194,14 @@ void CONTEXT_MENU::UpdateAll()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CONTEXT_MENU::SetTool( TOOL_INTERACTIVE* aTool )
|
||||||
|
{
|
||||||
|
m_tool = aTool;
|
||||||
|
|
||||||
|
runOnSubmenus( boost::bind( &CONTEXT_MENU::SetTool, _1, aTool ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
TOOL_MANAGER* CONTEXT_MENU::getToolManager()
|
TOOL_MANAGER* CONTEXT_MENU::getToolManager()
|
||||||
{
|
{
|
||||||
assert( m_tool );
|
assert( m_tool );
|
||||||
|
@ -293,14 +301,6 @@ void CONTEXT_MENU::onMenuEvent( wxMenuEvent& aEvent )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CONTEXT_MENU::setTool( TOOL_INTERACTIVE* aTool )
|
|
||||||
{
|
|
||||||
m_tool = aTool;
|
|
||||||
|
|
||||||
runOnSubmenus( boost::bind( &CONTEXT_MENU::setTool, _1, aTool ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void CONTEXT_MENU::runEventHandlers( const wxMenuEvent& aMenuEvent, OPT_TOOL_EVENT& aToolEvent )
|
void CONTEXT_MENU::runEventHandlers( const wxMenuEvent& aMenuEvent, OPT_TOOL_EVENT& aToolEvent )
|
||||||
{
|
{
|
||||||
aToolEvent = m_menu_handler( aMenuEvent );
|
aToolEvent = m_menu_handler( aMenuEvent );
|
||||||
|
|
|
@ -66,6 +66,6 @@ void TOOL_INTERACTIVE::goInternal( TOOL_STATE_FUNC& aState, const TOOL_EVENT_LIS
|
||||||
|
|
||||||
void TOOL_INTERACTIVE::SetContextMenu( CONTEXT_MENU* aMenu, CONTEXT_MENU_TRIGGER aTrigger )
|
void TOOL_INTERACTIVE::SetContextMenu( CONTEXT_MENU* aMenu, CONTEXT_MENU_TRIGGER aTrigger )
|
||||||
{
|
{
|
||||||
aMenu->setTool( this );
|
aMenu->SetTool( this );
|
||||||
m_toolMgr->ScheduleContextMenu( this, aMenu, aTrigger );
|
m_toolMgr->ScheduleContextMenu( this, aMenu, aTrigger );
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,6 +147,13 @@ public:
|
||||||
m_update_handler = aUpdateHandler;
|
m_update_handler = aUpdateHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function SetTool()
|
||||||
|
* Sets a tool that is the creator of the menu.
|
||||||
|
* @param aTool is the tool that created the menu.
|
||||||
|
*/
|
||||||
|
void SetTool( TOOL_INTERACTIVE* aTool );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
///> Returns an instance of TOOL_MANAGER class.
|
///> Returns an instance of TOOL_MANAGER class.
|
||||||
TOOL_MANAGER* getToolManager();
|
TOOL_MANAGER* getToolManager();
|
||||||
|
@ -177,13 +184,6 @@ private:
|
||||||
///> The default menu event handler.
|
///> The default menu event handler.
|
||||||
void onMenuEvent( wxMenuEvent& aEvent );
|
void onMenuEvent( wxMenuEvent& aEvent );
|
||||||
|
|
||||||
/**
|
|
||||||
* Function setTool()
|
|
||||||
* Sets a tool that is the creator of the menu.
|
|
||||||
* @param aTool is the tool that created the menu.
|
|
||||||
*/
|
|
||||||
void setTool( TOOL_INTERACTIVE* aTool );
|
|
||||||
|
|
||||||
///> Updates hot key settings for TOOL_ACTIONs in this menu.
|
///> Updates hot key settings for TOOL_ACTIONs in this menu.
|
||||||
void updateHotKeys();
|
void updateHotKeys();
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,7 @@ void CONDITIONAL_MENU::AddSeparator( const SELECTION_CONDITION& aCondition, int
|
||||||
CONTEXT_MENU* CONDITIONAL_MENU::Generate( SELECTION& aSelection )
|
CONTEXT_MENU* CONDITIONAL_MENU::Generate( SELECTION& aSelection )
|
||||||
{
|
{
|
||||||
CONTEXT_MENU* m_menu = new CONTEXT_MENU;
|
CONTEXT_MENU* m_menu = new CONTEXT_MENU;
|
||||||
|
m_menu->SetTool( m_tool );
|
||||||
|
|
||||||
for( std::list<ENTRY>::iterator it = m_entries.begin(); it != m_entries.end(); ++it )
|
for( std::list<ENTRY>::iterator it = m_entries.begin(); it != m_entries.end(); ++it )
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
|
|
||||||
class SELECTION_TOOL;
|
class SELECTION_TOOL;
|
||||||
class TOOL_ACTION;
|
class TOOL_ACTION;
|
||||||
|
class TOOL_INTERACTIVE;
|
||||||
class CONTEXT_MENU;
|
class CONTEXT_MENU;
|
||||||
|
|
||||||
class CONDITIONAL_MENU
|
class CONDITIONAL_MENU
|
||||||
|
@ -39,6 +40,10 @@ public:
|
||||||
///> Constant to indicate that we do not care about an ENTRY location in the menu.
|
///> Constant to indicate that we do not care about an ENTRY location in the menu.
|
||||||
static const int ANY_ORDER = -1;
|
static const int ANY_ORDER = -1;
|
||||||
|
|
||||||
|
CONDITIONAL_MENU( TOOL_INTERACTIVE* aTool ) :
|
||||||
|
m_tool( aTool )
|
||||||
|
{}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function AddItem()
|
* Function AddItem()
|
||||||
*
|
*
|
||||||
|
@ -208,6 +213,9 @@ private:
|
||||||
|
|
||||||
///> List of all menu entries.
|
///> List of all menu entries.
|
||||||
std::list<ENTRY> m_entries;
|
std::list<ENTRY> m_entries;
|
||||||
|
|
||||||
|
///> tool owning the menu
|
||||||
|
TOOL_INTERACTIVE* m_tool;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* CONDITIONAL_MENU_H */
|
#endif /* CONDITIONAL_MENU_H */
|
||||||
|
|
|
@ -117,6 +117,7 @@ bool PCB_EDITOR_CONTROL::Init()
|
||||||
if( selTool )
|
if( selTool )
|
||||||
{
|
{
|
||||||
m_zoneMenu = new ZONE_CONTEXT_MENU;
|
m_zoneMenu = new ZONE_CONTEXT_MENU;
|
||||||
|
m_zoneMenu->SetTool( this );
|
||||||
selTool->GetMenu().AddMenu( m_zoneMenu, _( "Zones" ), false,
|
selTool->GetMenu().AddMenu( m_zoneMenu, _( "Zones" ), false,
|
||||||
SELECTION_CONDITIONS::OnlyType( PCB_ZONE_AREA_T ) );
|
SELECTION_CONDITIONS::OnlyType( PCB_ZONE_AREA_T ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,8 +70,8 @@ public:
|
||||||
|
|
||||||
SELECTION_TOOL::SELECTION_TOOL() :
|
SELECTION_TOOL::SELECTION_TOOL() :
|
||||||
TOOL_INTERACTIVE( "pcbnew.InteractiveSelection" ),
|
TOOL_INTERACTIVE( "pcbnew.InteractiveSelection" ),
|
||||||
m_frame( NULL ), m_additive( false ), m_multiple( false ),
|
m_frame( NULL ), m_additive( false ), m_multiple( false ), m_editModules( false ),
|
||||||
m_editModules( false ), m_locked( true ), m_contextMenu( NULL ), m_selectMenu( NULL )
|
m_locked( true ), m_menu( this ), m_contextMenu( NULL ), m_selectMenu( NULL )
|
||||||
{
|
{
|
||||||
// Do not leave uninitialized members:
|
// Do not leave uninitialized members:
|
||||||
m_preliminary = false;
|
m_preliminary = false;
|
||||||
|
@ -91,6 +91,8 @@ bool SELECTION_TOOL::Init()
|
||||||
m_selection.group = new KIGFX::VIEW_GROUP;
|
m_selection.group = new KIGFX::VIEW_GROUP;
|
||||||
|
|
||||||
m_selectMenu = new SELECT_MENU;
|
m_selectMenu = new SELECT_MENU;
|
||||||
|
m_selectMenu->SetTool( this );
|
||||||
|
|
||||||
m_menu.AddMenu( m_selectMenu, _( "Select..." ), false,
|
m_menu.AddMenu( m_selectMenu, _( "Select..." ), false,
|
||||||
( SELECTION_CONDITIONS::OnlyType( PCB_VIA_T ) || SELECTION_CONDITIONS::OnlyType( PCB_TRACE_T ) ) &&
|
( SELECTION_CONDITIONS::OnlyType( PCB_VIA_T ) || SELECTION_CONDITIONS::OnlyType( PCB_TRACE_T ) ) &&
|
||||||
SELECTION_CONDITIONS::Count( 1 ) );
|
SELECTION_CONDITIONS::Count( 1 ) );
|
||||||
|
|
Loading…
Reference in New Issue