2009-11-09 14:00:22 +00:00
|
|
|
/********************/
|
|
|
|
/* onrightclick.cpp */
|
|
|
|
/********************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "common.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "class_drawpanel.h"
|
|
|
|
#include "confirm.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "gerbview.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2008-04-03 19:38:24 +00:00
|
|
|
/* Prepare the right-click pullup menu.
|
|
|
|
* The menu already has a list of zoom commands.
|
2007-08-20 01:20:48 +00:00
|
|
|
*/
|
2009-11-09 14:00:22 +00:00
|
|
|
bool WinEDA_GerberFrame::OnRightClick( const wxPoint& MousePos,
|
|
|
|
wxMenu* PopMenu )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-11-09 14:00:22 +00:00
|
|
|
BOARD_ITEM* DrawStruct = GetScreen()->GetCurItem();
|
|
|
|
wxString msg;
|
|
|
|
bool BlockActive =
|
|
|
|
(GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE);
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2009-11-09 14:00:22 +00:00
|
|
|
// Do not initiate a start block validation on menu.
|
|
|
|
DrawPanel->m_CanStartBlock = -1;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2009-11-09 14:00:22 +00:00
|
|
|
// Simple location of elements where possible.
|
|
|
|
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
|
|
|
DrawStruct = GerberGeneralLocateAndDisplay();
|
|
|
|
}
|
|
|
|
|
2009-11-09 14:00:22 +00:00
|
|
|
// If command in progress, end command.
|
2007-08-20 01:20:48 +00:00
|
|
|
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" ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
PopMenu->AppendSeparator();
|
|
|
|
PopMenu->Append( ID_POPUP_PLACE_BLOCK, _( "Place Block" ) );
|
2009-11-09 14:00:22 +00:00
|
|
|
PopMenu->Append( ID_POPUP_DELETE_BLOCK,
|
|
|
|
_( "Delete Block (ctrl + drag mouse)" ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
else
|
2009-11-09 14:00:22 +00:00
|
|
|
PopMenu->Append( ID_POPUP_CANCEL_CURRENT_COMMAND,
|
|
|
|
_( "Cancel" ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
PopMenu->AppendSeparator();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( BlockActive )
|
2007-10-07 18:24:15 +00:00
|
|
|
return true;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2009-11-09 14:00:22 +00:00
|
|
|
PopMenu->Append( ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS,
|
|
|
|
_( "Delete Dcode items" ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
if( DrawStruct == NULL )
|
2007-10-07 18:24:15 +00:00
|
|
|
return true;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
GetScreen()->SetCurItem( DrawStruct );
|
|
|
|
|
|
|
|
PopMenu->AppendSeparator();
|
2008-04-17 16:25:29 +00:00
|
|
|
return true;
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|