kicad/gerbview/onrightclick.cpp

75 lines
2.1 KiB
C++
Raw Normal View History

/********************/
/* onrightclick.cpp */
/********************/
#include "fctsys.h"
#include "common.h"
#include "class_drawpanel.h"
#include "confirm.h"
#include "gerbview.h"
2008-04-03 19:38:24 +00:00
/* Prepare the right-click pullup menu.
* The menu already has a list of zoom commands.
*/
bool WinEDA_GerberFrame::OnRightClick( const wxPoint& MousePos,
wxMenu* PopMenu )
{
BOARD_ITEM* DrawStruct = GetScreen()->GetCurItem();
wxString msg;
bool BlockActive =
(GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE);
// Do not initiate a start block validation on menu.
DrawPanel->m_CanStartBlock = -1;
// Simple location of elements where possible.
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
{
DrawStruct = GerberGeneralLocateAndDisplay();
}
// If command in progress, end command.
if( m_ID_current_state )
{
if( DrawStruct && DrawStruct->m_Flags )
PopMenu->Append( ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel" ) );
else
PopMenu->Append( ID_POPUP_CLOSE_CURRENT_TOOL, _( "End Tool" ) );
PopMenu->AppendSeparator();
}
else
{
if( (DrawStruct && DrawStruct->m_Flags) || BlockActive )
{
if( BlockActive )
{
2010-09-28 14:42:05 +00:00
PopMenu->Append( ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel Block" ) );
PopMenu->AppendSeparator();
PopMenu->Append( ID_POPUP_PLACE_BLOCK, _( "Place Block" ) );
PopMenu->Append( ID_POPUP_DELETE_BLOCK,
_( "Delete Block (ctrl + drag mouse)" ) );
}
else
PopMenu->Append( ID_POPUP_CANCEL_CURRENT_COMMAND,
_( "Cancel" ) );
PopMenu->AppendSeparator();
}
}
if( BlockActive )
return true;
PopMenu->Append( ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS,
_( "Delete Dcode items" ) );
if( DrawStruct == NULL )
return true;
GetScreen()->SetCurItem( DrawStruct );
PopMenu->AppendSeparator();
return true;
}