2007-08-20 01:20:48 +00:00
|
|
|
/******************************************************/
|
|
|
|
/* edit.cpp: fonctions generales de l'edition du PCB */
|
|
|
|
/******************************************************/
|
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"
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "id.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "confirm.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "gerbview.h"
|
|
|
|
#include "pcbplot.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "protos.h"
|
|
|
|
|
|
|
|
/********************************************************************************/
|
2007-10-07 18:24:15 +00:00
|
|
|
bool WinEDA_GerberFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
|
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
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-04-17 16:25:29 +00:00
|
|
|
BOARD_ITEM* DrawStruct = GetScreen()->GetCurItem();
|
2007-08-20 01:20:48 +00:00
|
|
|
wxString msg;
|
2008-04-17 16:25:29 +00:00
|
|
|
bool BlockActive = (GetScreen()->BlockLocate.m_Command != BLOCK_IDLE);
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
DrawPanel->m_CanStartBlock = -1; // Ne pas engager un debut de bloc sur validation menu
|
|
|
|
|
|
|
|
// Simple localisation des elements si possible
|
|
|
|
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
|
|
|
{
|
|
|
|
DrawStruct = GerberGeneralLocateAndDisplay();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Si commande en cours: affichage fin de commande
|
|
|
|
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 )
|
|
|
|
{
|
|
|
|
PopMenu->Append( ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel Block" ) );
|
2008-04-03 19:38:24 +00:00
|
|
|
PopMenu->Append( ID_POPUP_ZOOM_BLOCK, _( "Zoom Block (drag middle mouse)" ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
PopMenu->AppendSeparator();
|
|
|
|
PopMenu->Append( ID_POPUP_PLACE_BLOCK, _( "Place Block" ) );
|
|
|
|
PopMenu->Append( ID_POPUP_COPY_BLOCK, _( "Copy Block (shift mouse)" ) );
|
|
|
|
PopMenu->Append( ID_POPUP_DELETE_BLOCK, _( "Delete Block (ctrl + drag mouse)" ) );
|
2009-05-02 18:53:04 +00:00
|
|
|
PopMenu->Append( ID_POPUP_MIRROR_X_BLOCK, _( "Mirror Block" ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
PopMenu->Append( ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel" ) );
|
|
|
|
PopMenu->AppendSeparator();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( BlockActive )
|
2007-10-07 18:24:15 +00:00
|
|
|
return true;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
PopMenu->Append( ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS, _( "Delete Dcode items" ) );
|
|
|
|
|
|
|
|
if( DrawStruct == NULL )
|
2007-10-07 18:24:15 +00:00
|
|
|
return true;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
GetScreen()->SetCurItem( DrawStruct );
|
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
switch( DrawStruct->Type() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_TRACK:
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2007-05-28 18:09:49 +00:00
|
|
|
// PopMenu->AppendSeparator();
|
2007-06-05 12:10:51 +00:00
|
|
|
// PopMenu->Append(ID_POPUP_PCB_EDIT_TRACK, _("Edit"));
|
|
|
|
// PopMenu->Append(ID_POPUP_PCB_DELETE_TRACKSEG, _("Delete"));
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
default:
|
|
|
|
msg.Printf(
|
|
|
|
wxT( "WinEDA_GerberFrame::OnRightClick Error: illegal or unknown DrawType %d" ),
|
2007-09-01 12:00:30 +00:00
|
|
|
DrawStruct->Type() );
|
2007-08-20 01:20:48 +00:00
|
|
|
DisplayError( this, msg );
|
|
|
|
break;
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
PopMenu->AppendSeparator();
|
2008-04-17 16:25:29 +00:00
|
|
|
return true;
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|