Safety for frames which don't have an m_viewControls.
This commit is contained in:
parent
3a2dbf7786
commit
d22ea0e201
|
@ -457,7 +457,7 @@ void ACTION_MENU::OnMenuEvent( wxMenuEvent& aEvent )
|
|||
if( type == wxEVT_COMMAND_MENU_SELECTED )
|
||||
evt->SetMousePosition( g_menu_open_position );
|
||||
else
|
||||
evt->SetMousePosition( getToolManager()->GetViewControls()->GetMousePosition() );
|
||||
evt->SetMousePosition( getToolManager()->GetMousePosition() );
|
||||
|
||||
if( g_last_menu_highlighted_id == aEvent.GetId() && !m_isContextMenu )
|
||||
evt->SetHasPosition( false );
|
||||
|
|
|
@ -278,13 +278,31 @@ bool TOOL_MANAGER::RunAction( const std::string& aActionName, bool aNow, void* a
|
|||
}
|
||||
|
||||
|
||||
VECTOR2D TOOL_MANAGER::GetMousePosition()
|
||||
{
|
||||
if( m_viewControls )
|
||||
return m_viewControls->GetMousePosition();
|
||||
else
|
||||
return wxGetMousePosition();
|
||||
}
|
||||
|
||||
|
||||
VECTOR2D TOOL_MANAGER::GetCursorPosition()
|
||||
{
|
||||
if( m_viewControls )
|
||||
return m_viewControls->GetCursorPosition();
|
||||
else
|
||||
return wxGetMousePosition();
|
||||
}
|
||||
|
||||
|
||||
bool TOOL_MANAGER::RunAction( const TOOL_ACTION& aAction, bool aNow, void* aParam )
|
||||
{
|
||||
bool handled = false;
|
||||
TOOL_EVENT event = aAction.MakeEvent();
|
||||
|
||||
if( event.Category() == TC_COMMAND )
|
||||
event.SetMousePosition( m_viewControls->GetCursorPosition() );
|
||||
event.SetMousePosition( GetCursorPosition() );
|
||||
|
||||
// Allow to override the action parameter
|
||||
if( aParam )
|
||||
|
|
|
@ -257,6 +257,9 @@ public:
|
|||
return m_viewControls;
|
||||
}
|
||||
|
||||
VECTOR2D GetMousePosition();
|
||||
VECTOR2D GetCursorPosition();
|
||||
|
||||
inline EDA_ITEM* GetModel() const
|
||||
{
|
||||
return m_model;
|
||||
|
|
Loading…
Reference in New Issue