Fix Libedit regression.

This commit is contained in:
jean-pierre charras 2011-03-21 21:35:16 +01:00
parent 73985ecab1
commit cc63f5f86f
1 changed files with 14 additions and 10 deletions

View File

@ -1,6 +1,6 @@
/****************************/ /**
/* 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
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,18 +44,22 @@ 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" {
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_CANCEL_EDITING, _( "End Tool" ), cancel_tool_xpm ); DrawEntry = LocateItemUsingCursor( aPosition );
PopMenu->AppendSeparator(); 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 );
PopMenu->AppendSeparator();
}
} }
if( DrawEntry ) if( DrawEntry )
DrawEntry->DisplayInfo( this ); DrawEntry->DisplayInfo( this );
else else