Commit cc63f5f8 authored by jean-pierre charras's avatar jean-pierre charras

Fix Libedit regression.

parent 73985eca
/****************************/ /**
/* EESchema - libedit_onrightclick.cpp */ * @file libedit_onrightclick.cpp
/****************************/ */
/* , In library editor, create the pop menu when clicking on mouse right button /* , In library editor, create the pop menu when clicking on mouse right button
*/ */
...@@ -30,7 +30,7 @@ static void AddMenusForPin( wxMenu* PopMenu, LIB_PIN* Pin, LIB_EDIT_FRAME* frame ...@@ -30,7 +30,7 @@ static void AddMenusForPin( wxMenu* PopMenu, LIB_PIN* Pin, LIB_EDIT_FRAME* frame
bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
{ {
LIB_DRAW_ITEM* DrawEntry = LocateItemUsingCursor( aPosition ); LIB_DRAW_ITEM* DrawEntry = GetDrawItem();
bool BlockActive = GetScreen()->IsBlockActive(); bool BlockActive = GetScreen()->IsBlockActive();
if( BlockActive ) if( BlockActive )
...@@ -44,17 +44,21 @@ bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) ...@@ -44,17 +44,21 @@ bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
return true; return true;
// If Command in progress, put menu "cancel" // If Command in progress, put menu "cancel"
if( DrawEntry && DrawEntry->m_Flags ) if( DrawEntry && DrawEntry->GetFlags() )
{ {
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_CANCEL_EDITING, _( "Cancel" ), cancel_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_CANCEL_EDITING, _( "Cancel" ), cancel_xpm );
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
} }
else if( GetToolId() != ID_NO_TOOL_SELECTED ) else
{ // If a tool is active, put menu "end tool" {
DrawEntry = LocateItemUsingCursor( aPosition );
if( GetToolId() != ID_NO_TOOL_SELECTED )
{
// If a tool is active, put menu "end tool"
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_CANCEL_EDITING, _( "End Tool" ), cancel_tool_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_CANCEL_EDITING, _( "End Tool" ), cancel_tool_xpm );
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
} }
}
if( DrawEntry ) if( DrawEntry )
DrawEntry->DisplayInfo( this ); DrawEntry->DisplayInfo( this );
......
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