2007-08-20 01:20:48 +00:00
|
|
|
|
/*****************************************************************/
|
|
|
|
|
/* Operations sur Blocks : deplacement, rotation, effacement ... */
|
|
|
|
|
/*****************************************************************/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
|
#include "gr_basic.h"
|
|
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
|
#include "pcbnew.h"
|
|
|
|
|
#include "autorout.h"
|
|
|
|
|
#include "pcbplot.h"
|
|
|
|
|
#include "trigo.h"
|
|
|
|
|
|
|
|
|
|
#include "protos.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define BLOCK_COLOR BROWN
|
|
|
|
|
|
|
|
|
|
/* Routines Locales */
|
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
static EDA_BaseStruct* IsStructInBox( DrawBlockStruct& blocklocate, EDA_BaseStruct* PtStruct );
|
|
|
|
|
static TRACK* IsSegmentInBox( DrawBlockStruct& blocklocate, TRACK* PtSegm );
|
|
|
|
|
static MODULE* IsModuleInBox( DrawBlockStruct& blocklocate, MODULE* Module );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
|
|
/* Variables locales :*/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
static bool Block_Include_Modules = TRUE;
|
|
|
|
|
static bool Block_Include_Tracks = TRUE;
|
|
|
|
|
static bool Block_Include_Zones = TRUE;
|
|
|
|
|
static bool Block_Include_Draw_Items = TRUE;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
static bool Block_Include_Edges_Items = TRUE;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
static bool Block_Include_PcbTextes = TRUE;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
/************************************/
|
|
|
|
|
/* class WinEDA_ExecBlockCmdFrame */
|
|
|
|
|
/************************************/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
class WinEDA_ExecBlockCmdFrame : public wxDialog
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
|
|
|
|
private:
|
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
WinEDA_BasePcbFrame* m_Parent;
|
|
|
|
|
wxCheckBox* m_Include_Modules;
|
|
|
|
|
wxCheckBox* m_Include_Tracks;
|
|
|
|
|
wxCheckBox* m_Include_Zones;
|
|
|
|
|
wxCheckBox* m_Include_Draw_Items;
|
|
|
|
|
wxCheckBox* m_Include_Edges_Items;
|
|
|
|
|
wxCheckBox* m_Include_PcbTextes;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
|
|
public:
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
|
|
// Constructor and destructor
|
|
|
|
|
WinEDA_ExecBlockCmdFrame( WinEDA_BasePcbFrame* parent,
|
|
|
|
|
const wxString& title );
|
2007-09-01 12:00:30 +00:00
|
|
|
|
~WinEDA_ExecBlockCmdFrame()
|
2007-08-20 01:20:48 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
|
|
private:
|
2007-08-20 01:20:48 +00:00
|
|
|
|
void ExecuteCommand( wxCommandEvent& event );
|
|
|
|
|
void Cancel( wxCommandEvent& event );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
DECLARE_EVENT_TABLE()
|
2007-05-06 16:03:28 +00:00
|
|
|
|
};
|
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
BEGIN_EVENT_TABLE( WinEDA_ExecBlockCmdFrame, wxDialog )
|
2007-09-29 16:17:35 +00:00
|
|
|
|
EVT_BUTTON( wxID_OK, WinEDA_ExecBlockCmdFrame::ExecuteCommand )
|
|
|
|
|
EVT_BUTTON( wxID_CANCEL, WinEDA_ExecBlockCmdFrame::Cancel )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
static bool InstallBlockCmdFrame( WinEDA_BasePcbFrame* parent,
|
|
|
|
|
const wxString& title )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/**************************************************************/
|
|
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
|
int nocmd;
|
|
|
|
|
wxPoint oldpos = parent->GetScreen()->m_Curseur;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
parent->DrawPanel->m_IgnoreMouseEvents = TRUE;
|
|
|
|
|
WinEDA_ExecBlockCmdFrame* frame = new WinEDA_ExecBlockCmdFrame( parent, title );
|
2007-10-13 06:18:44 +00:00
|
|
|
|
|
|
|
|
|
nocmd = frame->ShowModal();
|
|
|
|
|
frame->Destroy();
|
|
|
|
|
|
|
|
|
|
parent->GetScreen()->m_Curseur = oldpos;
|
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
parent->DrawPanel->MouseToCursorSchema();
|
|
|
|
|
parent->DrawPanel->m_IgnoreMouseEvents = FALSE;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
parent->DrawPanel->SetCursor(
|
|
|
|
|
parent->DrawPanel->m_PanelCursor = parent->DrawPanel->m_PanelDefaultCursor );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
return nocmd ? FALSE : TRUE;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
WinEDA_ExecBlockCmdFrame::WinEDA_ExecBlockCmdFrame( WinEDA_BasePcbFrame* parent,
|
|
|
|
|
const wxString& title ) :
|
2007-09-29 16:17:35 +00:00
|
|
|
|
wxDialog( parent, -1, title, wxPoint( -1, -1 ), wxDefaultSize,
|
2007-08-20 01:20:48 +00:00
|
|
|
|
DIALOG_STYLE )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/******************************************************************************/
|
|
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
|
wxPoint pos;
|
2007-09-29 16:17:35 +00:00
|
|
|
|
wxButton* m_button1;
|
|
|
|
|
wxButton* m_button2;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
|
|
m_Parent = parent;
|
|
|
|
|
SetFont( *g_DialogFont );
|
|
|
|
|
Centre();
|
2007-10-03 19:57:23 +00:00
|
|
|
|
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
|
|
|
|
this->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 90, false, wxEmptyString ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-09-29 16:17:35 +00:00
|
|
|
|
/* Sizer 1 creation */
|
|
|
|
|
wxFlexGridSizer* fgSizer1;
|
|
|
|
|
fgSizer1 = new wxFlexGridSizer( 1, 1, 0, 0 );
|
|
|
|
|
fgSizer1->SetFlexibleDirection( wxBOTH );
|
|
|
|
|
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
// Selection des options :
|
2007-09-29 16:17:35 +00:00
|
|
|
|
m_Include_Modules = new wxCheckBox( this, -1, _( "Include Modules" ), wxDefaultPosition, wxDefaultSize, 0 );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
m_Include_Modules->SetValue( Block_Include_Modules );
|
2007-09-29 16:17:35 +00:00
|
|
|
|
fgSizer1->Add( m_Include_Modules, 0, wxALL, 5 );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-09-29 16:17:35 +00:00
|
|
|
|
m_Include_Tracks = new wxCheckBox( this, -1, _( "Include tracks" ), wxDefaultPosition, wxDefaultSize, 0 );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
m_Include_Tracks->SetValue( Block_Include_Tracks );
|
2007-09-29 16:17:35 +00:00
|
|
|
|
fgSizer1->Add( m_Include_Tracks, 0, wxALL, 5 );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-09-29 16:17:35 +00:00
|
|
|
|
m_Include_Zones = new wxCheckBox( this, -1, _( "Include zones" ), wxDefaultPosition, wxDefaultSize, 0 );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
m_Include_Zones->SetValue( Block_Include_Zones );
|
2007-09-29 16:17:35 +00:00
|
|
|
|
fgSizer1->Add( m_Include_Zones, 0, wxALL, 5 );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
|
|
m_Include_PcbTextes = new wxCheckBox( this, -1,
|
2007-09-29 16:17:35 +00:00
|
|
|
|
_( "Include Text on copper layers" ), wxDefaultPosition, wxDefaultSize, 0 );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
m_Include_PcbTextes->SetValue( Block_Include_PcbTextes );
|
2007-09-29 16:17:35 +00:00
|
|
|
|
fgSizer1->Add( m_Include_PcbTextes, 0, wxALL, 5 );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-09-29 16:17:35 +00:00
|
|
|
|
m_Include_Draw_Items = new wxCheckBox( this, -1, _( "Include drawings" ), wxDefaultPosition, wxDefaultSize, 0 );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
m_Include_Draw_Items->SetValue( Block_Include_Draw_Items );
|
2007-09-29 16:17:35 +00:00
|
|
|
|
fgSizer1->Add( m_Include_Draw_Items, 0, wxALL, 5 );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-09-29 16:17:35 +00:00
|
|
|
|
m_Include_Edges_Items = new wxCheckBox( this, -1, _( "Include egde layer" ), wxDefaultPosition, wxDefaultSize, 0 );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
m_Include_Edges_Items->SetValue( Block_Include_Edges_Items );
|
2007-09-29 16:17:35 +00:00
|
|
|
|
fgSizer1->Add( m_Include_Edges_Items, 0, wxALL, 5 );
|
|
|
|
|
|
|
|
|
|
/* Sizer 2 creation */
|
|
|
|
|
wxFlexGridSizer* fgSizer2;
|
|
|
|
|
fgSizer2 = new wxFlexGridSizer( 1, 2, 0, 0 );
|
|
|
|
|
fgSizer2->SetFlexibleDirection( wxBOTH );
|
|
|
|
|
fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
|
|
|
|
|
|
|
|
|
/* Creation des boutons de commande */
|
|
|
|
|
m_button2 = new wxButton( this, wxID_CANCEL, _( "Cancel" ), wxDefaultPosition, wxDefaultSize, 0 );
|
|
|
|
|
m_button2->SetForegroundColour( *wxBLUE );
|
|
|
|
|
fgSizer2->Add( m_button2, 0, wxALL, 5 );
|
2007-10-07 03:08:24 +00:00
|
|
|
|
m_button1 = new wxButton( this, wxID_OK, _( "OK" ), wxDefaultPosition, wxDefaultSize, 0 );
|
2007-09-29 16:17:35 +00:00
|
|
|
|
m_button1->SetForegroundColour( *wxRED );
|
|
|
|
|
m_button1->SetDefault();
|
|
|
|
|
fgSizer2->Add( m_button1, 0, wxALL, 5 );
|
|
|
|
|
|
|
|
|
|
fgSizer1->Add( fgSizer2, 1, wxALIGN_RIGHT, 5 );
|
|
|
|
|
this->SetSizer( fgSizer1 );
|
|
|
|
|
this->Layout();
|
|
|
|
|
fgSizer1->Fit( this );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/**********************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
void WinEDA_ExecBlockCmdFrame::Cancel( wxCommandEvent& WXUNUSED (event) )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/**********************************************************************/
|
|
|
|
|
{
|
2007-10-07 03:08:24 +00:00
|
|
|
|
EndModal( -1 );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
void WinEDA_ExecBlockCmdFrame::ExecuteCommand( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/*******************************************************************/
|
|
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
|
Block_Include_Modules = m_Include_Modules->GetValue();
|
|
|
|
|
Block_Include_Tracks = m_Include_Tracks->GetValue();
|
|
|
|
|
Block_Include_Zones = m_Include_Zones->GetValue();
|
|
|
|
|
Block_Include_Draw_Items = m_Include_Draw_Items->GetValue();
|
|
|
|
|
Block_Include_Edges_Items = m_Include_Edges_Items->GetValue();
|
|
|
|
|
Block_Include_PcbTextes = m_Include_PcbTextes->GetValue();
|
|
|
|
|
|
|
|
|
|
EndModal( 0 );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
int WinEDA_PcbFrame::ReturnBlockCommand( int key )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/*************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/* Return the block command (BLOCK_MOVE, BLOCK_COPY...) corresponding to
|
2007-08-20 01:20:48 +00:00
|
|
|
|
* the key (ALT, SHIFT ALT ..)
|
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
|
int cmd = 0;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
switch( key )
|
|
|
|
|
{
|
|
|
|
|
default:
|
|
|
|
|
cmd = key & 0x255;
|
|
|
|
|
break;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
case 0:
|
|
|
|
|
cmd = BLOCK_MOVE;
|
|
|
|
|
break;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
case GR_KB_SHIFT:
|
|
|
|
|
cmd = BLOCK_COPY;
|
|
|
|
|
break;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
case GR_KB_CTRL:
|
|
|
|
|
cmd = BLOCK_ROTATE;
|
|
|
|
|
break;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
case GR_KB_SHIFTCTRL:
|
|
|
|
|
cmd = BLOCK_DELETE;
|
|
|
|
|
break;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
case GR_KB_ALT:
|
|
|
|
|
cmd = BLOCK_INVERT;
|
|
|
|
|
break;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
case MOUSE_MIDDLE:
|
|
|
|
|
cmd = BLOCK_ZOOM;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
return cmd;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
void WinEDA_PcbFrame::HandleBlockPlace( wxDC* DC )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/*****************************************************/
|
|
|
|
|
/* Routine to handle the BLOCK PLACE commande */
|
|
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
|
bool err = FALSE;
|
|
|
|
|
|
|
|
|
|
if( DrawPanel->ManageCurseur == NULL )
|
|
|
|
|
{
|
|
|
|
|
err = TRUE;
|
|
|
|
|
DisplayError( this, wxT( "Error in HandleBlockPLace : ManageCurseur = NULL" ) );
|
|
|
|
|
}
|
|
|
|
|
GetScreen()->BlockLocate.m_State = STATE_BLOCK_STOP;
|
|
|
|
|
|
|
|
|
|
switch( GetScreen()->BlockLocate.m_Command )
|
|
|
|
|
{
|
|
|
|
|
case BLOCK_IDLE:
|
|
|
|
|
err = TRUE;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case BLOCK_DRAG: /* Drag */
|
|
|
|
|
case BLOCK_MOVE: /* Move */
|
|
|
|
|
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
|
|
|
|
|
if( DrawPanel->ManageCurseur )
|
|
|
|
|
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
|
|
|
|
Block_Move( DC );
|
|
|
|
|
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case BLOCK_COPY: /* Copy */
|
|
|
|
|
if( DrawPanel->ManageCurseur )
|
|
|
|
|
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
|
|
|
|
Block_Duplicate( DC );
|
|
|
|
|
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case BLOCK_PASTE:
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case BLOCK_ZOOM: // Handled by HandleBlockEnd()
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GetScreen()->SetModify();
|
|
|
|
|
|
|
|
|
|
DrawPanel->ManageCurseur = NULL;
|
|
|
|
|
DrawPanel->ForceCloseManageCurseur = NULL;
|
|
|
|
|
GetScreen()->BlockLocate.m_Flags = 0;
|
|
|
|
|
GetScreen()->BlockLocate.m_State = STATE_NO_BLOCK;
|
|
|
|
|
GetScreen()->BlockLocate.m_Command = BLOCK_IDLE;
|
|
|
|
|
if( GetScreen()->BlockLocate.m_BlockDrawStruct )
|
|
|
|
|
{
|
|
|
|
|
DisplayError( this, wxT( "Error in HandleBlockPLace DrawStruct != NULL" ) );
|
|
|
|
|
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DisplayToolMsg( wxEmptyString );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/**********************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
int WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/**********************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/* Routine de gestion de la commande BLOCK END
|
2007-08-20 01:20:48 +00:00
|
|
|
|
* returne :
|
|
|
|
|
* 0 si aucun compos ant selectionne
|
|
|
|
|
* 1 sinon
|
|
|
|
|
* -1 si commande termin<EFBFBD>e et composants trouv<EFBFBD>s (block delete, block save)
|
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
|
int endcommande = TRUE;
|
|
|
|
|
|
|
|
|
|
if( DrawPanel->ManageCurseur )
|
|
|
|
|
switch( GetScreen()->BlockLocate.m_Command )
|
|
|
|
|
{
|
|
|
|
|
case BLOCK_IDLE:
|
|
|
|
|
DisplayError( this, wxT( "Error in HandleBlockPLace" ) );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case BLOCK_DRAG: /* Drag (not used, for future enhancements)*/
|
|
|
|
|
case BLOCK_MOVE: /* Move */
|
|
|
|
|
case BLOCK_COPY: /* Copy */
|
|
|
|
|
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
|
|
|
|
|
GetScreen()->BlockLocate.m_State = STATE_BLOCK_MOVE;
|
|
|
|
|
endcommande = FALSE;
|
|
|
|
|
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
|
|
|
|
DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
|
|
|
|
|
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case BLOCK_DELETE: /* Delete */
|
|
|
|
|
|
|
|
|
|
// Turn off the block rectangle now so it is not redisplayed
|
|
|
|
|
DrawPanel->ManageCurseur = NULL;
|
|
|
|
|
GetScreen()->BlockLocate.m_State = STATE_BLOCK_STOP;
|
|
|
|
|
DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE );
|
|
|
|
|
Block_Delete( DC );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case BLOCK_ROTATE: /* Rotation */
|
|
|
|
|
|
|
|
|
|
// Turn off the block rectangle now so it is not redisplayed
|
|
|
|
|
DrawPanel->ManageCurseur = NULL;
|
|
|
|
|
GetScreen()->BlockLocate.m_State = STATE_BLOCK_STOP;
|
|
|
|
|
DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE );
|
|
|
|
|
Block_Rotate( DC );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case BLOCK_INVERT: /* Flip */
|
|
|
|
|
|
|
|
|
|
// Turn off the block rectangle now so it is not redisplayed
|
|
|
|
|
DrawPanel->ManageCurseur = NULL;
|
|
|
|
|
GetScreen()->BlockLocate.m_State = STATE_BLOCK_STOP;
|
|
|
|
|
DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE );
|
|
|
|
|
Block_Invert( DC );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case BLOCK_SAVE: /* Save (not used, for future enhancements)*/
|
|
|
|
|
GetScreen()->BlockLocate.m_State = STATE_BLOCK_STOP;
|
|
|
|
|
if( GetScreen()->BlockLocate.m_BlockDrawStruct != NULL )
|
|
|
|
|
{
|
|
|
|
|
DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE );
|
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
// SaveStruct(GetScreen()->BlockLocate.m_BlockDrawStruct);
|
2007-08-20 01:20:48 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case BLOCK_PASTE:
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case BLOCK_ZOOM: /* Window Zoom */
|
|
|
|
|
|
|
|
|
|
//Turn off the redraw block routine now so it is not displayed
|
|
|
|
|
// with one corner at the new center of the screen
|
|
|
|
|
DrawPanel->ManageCurseur = NULL;
|
|
|
|
|
Window_Zoom( GetScreen()->BlockLocate );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( endcommande == TRUE )
|
|
|
|
|
{
|
|
|
|
|
GetScreen()->BlockLocate.m_Flags = 0;
|
|
|
|
|
GetScreen()->BlockLocate.m_State = STATE_NO_BLOCK;
|
|
|
|
|
GetScreen()->BlockLocate.m_Command = BLOCK_IDLE;
|
|
|
|
|
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
|
|
|
|
DrawPanel->ManageCurseur = NULL;
|
|
|
|
|
DrawPanel->ForceCloseManageCurseur = NULL;
|
|
|
|
|
DisplayToolMsg( wxEmptyString );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return endcommande;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/**************************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/* Retrace le contour du block de repositionnement des structures a d<>placer
|
|
|
|
|
*/
|
|
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
|
int Color;
|
|
|
|
|
BASE_SCREEN* screen = panel->GetScreen();
|
|
|
|
|
|
2007-09-11 04:14:47 +00:00
|
|
|
|
Color = YELLOW;
|
|
|
|
|
GRSetDrawMode( DC, g_XorMode );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
|
|
/* Effacement ancien cadre */
|
|
|
|
|
if( erase )
|
|
|
|
|
{
|
|
|
|
|
screen->BlockLocate.Draw( panel, DC );
|
|
|
|
|
if( screen->BlockLocate.m_MoveVector.x || screen->BlockLocate.m_MoveVector.y )
|
|
|
|
|
{
|
|
|
|
|
screen->BlockLocate.Offset( screen->BlockLocate.m_MoveVector );
|
|
|
|
|
screen->BlockLocate.Draw( panel, DC );
|
|
|
|
|
screen->BlockLocate.Offset( -screen->BlockLocate.m_MoveVector.x,
|
|
|
|
|
-screen->BlockLocate.m_MoveVector.y );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( panel->m_Parent->GetScreen()->BlockLocate.m_State != STATE_BLOCK_STOP )
|
|
|
|
|
{
|
|
|
|
|
screen->BlockLocate.m_MoveVector.x = screen->m_Curseur.x - screen->BlockLocate.GetRight();
|
|
|
|
|
screen->BlockLocate.m_MoveVector.y = screen->m_Curseur.y - screen->BlockLocate.GetBottom();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
screen->BlockLocate.Draw( panel, DC );
|
|
|
|
|
if( screen->BlockLocate.m_MoveVector.x || screen->BlockLocate.m_MoveVector.y )
|
|
|
|
|
{
|
|
|
|
|
screen->BlockLocate.Offset( screen->BlockLocate.m_MoveVector );
|
|
|
|
|
screen->BlockLocate.Draw( panel, DC );
|
|
|
|
|
screen->BlockLocate.Offset( -screen->BlockLocate.m_MoveVector.x,
|
|
|
|
|
-screen->BlockLocate.m_MoveVector.y );
|
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/*
|
2007-08-20 01:20:48 +00:00
|
|
|
|
* routine d'effacement du block deja selectionne
|
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2007-08-23 04:28:46 +00:00
|
|
|
|
BOARD_ITEM* PtStruct, * NextS;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
int masque_layer;
|
|
|
|
|
|
|
|
|
|
if( !InstallBlockCmdFrame( this, _( "Delete Block" ) ) )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
GetScreen()->SetModify();
|
|
|
|
|
GetScreen()->BlockLocate.Normalize();
|
2007-09-12 02:14:07 +00:00
|
|
|
|
SetCurItem( NULL );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
|
|
/* Effacement des modules */
|
|
|
|
|
if( Block_Include_Modules )
|
|
|
|
|
{
|
|
|
|
|
MODULE* module;
|
|
|
|
|
Affiche_Message( _( "Delete Footprints" ) );
|
|
|
|
|
module = m_Pcb->m_Modules;
|
|
|
|
|
for( ; module != NULL; module = (MODULE*) NextS )
|
|
|
|
|
{
|
2007-08-23 04:28:46 +00:00
|
|
|
|
NextS = module->Next();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
if( IsModuleInBox( GetScreen()->BlockLocate, module ) == NULL )
|
|
|
|
|
continue;
|
|
|
|
|
/* le module est ici bon a etre efface */
|
|
|
|
|
module->m_Flags = 0;
|
|
|
|
|
module->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
|
2007-10-03 15:21:13 +00:00
|
|
|
|
module->DeleteStructure();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
m_Pcb->m_Status_Pcb = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Effacement des Pistes */
|
|
|
|
|
if( Block_Include_Tracks )
|
|
|
|
|
{
|
|
|
|
|
TRACK* pt_segm;
|
|
|
|
|
|
|
|
|
|
Affiche_Message( _( "Delete tracks" ) );
|
|
|
|
|
for( pt_segm = m_Pcb->m_Track; pt_segm != NULL; pt_segm = (TRACK*) NextS )
|
|
|
|
|
{
|
2007-08-23 04:28:46 +00:00
|
|
|
|
NextS = pt_segm->Next();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
if( IsSegmentInBox( GetScreen()->BlockLocate, pt_segm ) )
|
2007-08-23 04:28:46 +00:00
|
|
|
|
{
|
|
|
|
|
/* la piste est ici bonne a etre efface */
|
2007-08-20 01:20:48 +00:00
|
|
|
|
pt_segm->Draw( DrawPanel, DC, GR_XOR );
|
2007-10-03 15:21:13 +00:00
|
|
|
|
pt_segm->DeleteStructure();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Effacement des Elements De Dessin */
|
|
|
|
|
masque_layer = EDGE_LAYER;
|
|
|
|
|
if( Block_Include_Draw_Items )
|
|
|
|
|
masque_layer = ALL_LAYERS;
|
2007-10-13 06:18:44 +00:00
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
if( !Block_Include_Edges_Items )
|
|
|
|
|
masque_layer &= ~EDGE_LAYER;
|
|
|
|
|
|
|
|
|
|
Affiche_Message( _( "Delete draw layers" ) );
|
|
|
|
|
PtStruct = m_Pcb->m_Drawings;
|
|
|
|
|
for( ; PtStruct != NULL; PtStruct = NextS )
|
|
|
|
|
{
|
2007-08-23 04:28:46 +00:00
|
|
|
|
NextS = PtStruct->Next();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
|
switch( PtStruct->Type() )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
{
|
|
|
|
|
case TYPEDRAWSEGMENT:
|
|
|
|
|
#undef STRUCT
|
|
|
|
|
#define STRUCT ( (DRAWSEGMENT*) PtStruct )
|
2007-08-23 04:28:46 +00:00
|
|
|
|
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
|
|
|
|
|
break;
|
|
|
|
|
/* l'element est ici bon a etre efface */
|
|
|
|
|
Trace_DrawSegmentPcb( DrawPanel, DC, (DRAWSEGMENT*) PtStruct, GR_XOR );
|
2007-10-03 15:21:13 +00:00
|
|
|
|
PtStruct->DeleteStructure();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case TYPETEXTE:
|
|
|
|
|
if( !Block_Include_PcbTextes )
|
|
|
|
|
break;
|
|
|
|
|
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
|
|
|
|
|
break;
|
|
|
|
|
/* le texte est ici bon a etre efface */
|
|
|
|
|
( (TEXTE_PCB*) PtStruct )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
|
|
|
|
|
/* Suppression du texte en Memoire*/
|
2007-10-03 15:21:13 +00:00
|
|
|
|
PtStruct->DeleteStructure();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case TYPEMIRE:
|
|
|
|
|
#undef STRUCT
|
|
|
|
|
#define STRUCT ( (MIREPCB*) PtStruct )
|
2007-08-23 04:28:46 +00:00
|
|
|
|
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
|
|
|
|
|
break;
|
|
|
|
|
/* l'element est ici bon a etre efface */
|
|
|
|
|
( (MIREPCB*) PtStruct )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
|
2007-10-03 15:21:13 +00:00
|
|
|
|
PtStruct->DeleteStructure();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case TYPECOTATION:
|
|
|
|
|
#undef STRUCT
|
|
|
|
|
#define STRUCT ( (COTATION*) PtStruct )
|
2007-08-23 04:28:46 +00:00
|
|
|
|
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
|
|
|
|
|
break;
|
|
|
|
|
/* l'element est ici bon a etre efface */
|
|
|
|
|
( (COTATION*) PtStruct )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
|
2007-10-03 15:21:13 +00:00
|
|
|
|
PtStruct->DeleteStructure();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Effacement des Zones */
|
|
|
|
|
if( Block_Include_Zones )
|
|
|
|
|
{
|
|
|
|
|
TRACK* pt_segm;
|
|
|
|
|
|
|
|
|
|
Affiche_Message( _( "Delete zones" ) );
|
|
|
|
|
for( pt_segm = m_Pcb->m_Zone; pt_segm != NULL; pt_segm = (TRACK*) NextS )
|
|
|
|
|
{
|
2007-08-23 04:28:46 +00:00
|
|
|
|
NextS = pt_segm->Next();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
if( IsSegmentInBox( GetScreen()->BlockLocate, pt_segm ) )
|
2007-10-03 15:21:13 +00:00
|
|
|
|
{
|
|
|
|
|
/* la piste est ici bonne a etre efface */
|
2007-08-20 01:20:48 +00:00
|
|
|
|
pt_segm->Draw( DrawPanel, DC, GR_XOR );
|
2007-10-03 15:21:13 +00:00
|
|
|
|
PtStruct->DeleteStructure();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Rafraichissement de l'ecran : */
|
|
|
|
|
RedrawActiveWindow( DC, TRUE );
|
|
|
|
|
if( g_Show_Ratsnest )
|
|
|
|
|
Compile_Ratsnest( DC, TRUE );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/****************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/*
|
2007-08-20 01:20:48 +00:00
|
|
|
|
* routine de Rotation de 90 deg du block deja selectionne
|
|
|
|
|
* les elements sont tournes autour du centre du block
|
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
|
MODULE* module;
|
|
|
|
|
EDA_BaseStruct* PtStruct;
|
|
|
|
|
int masque_layer;
|
|
|
|
|
wxPoint oldpos;
|
|
|
|
|
int Nx, Ny, centerX, centerY; /* centre de rotation de l'ensemble des elements */
|
|
|
|
|
|
|
|
|
|
if( !InstallBlockCmdFrame( this, _( "Rotate Block" ) ) )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
oldpos = GetScreen()->m_Curseur;
|
|
|
|
|
GetScreen()->BlockLocate.Normalize();
|
|
|
|
|
|
|
|
|
|
/* calcul du centre de Rotation */
|
|
|
|
|
centerX = GetScreen()->BlockLocate.Centre().x;
|
|
|
|
|
centerY = GetScreen()->BlockLocate.Centre().y;
|
|
|
|
|
|
|
|
|
|
GetScreen()->SetModify();
|
|
|
|
|
|
|
|
|
|
/* Rotation des modules */
|
|
|
|
|
if( Block_Include_Modules )
|
|
|
|
|
{
|
|
|
|
|
Affiche_Message( _( "Footprint rotation" ) );
|
|
|
|
|
bool Show_Ratsnest_tmp = g_Show_Ratsnest; g_Show_Ratsnest = false;
|
|
|
|
|
int Angle_Rot_Module = 900;
|
|
|
|
|
module = m_Pcb->m_Modules;
|
|
|
|
|
for( ; module != NULL; module = (MODULE*) module->Pnext )
|
|
|
|
|
{
|
|
|
|
|
if( IsModuleInBox( GetScreen()->BlockLocate, module ) == NULL )
|
|
|
|
|
continue;
|
|
|
|
|
/* le module est ici bon a etre modifie */
|
|
|
|
|
m_Pcb->m_Status_Pcb = 0;
|
|
|
|
|
module->m_Flags = 0;
|
|
|
|
|
module->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
|
|
|
|
|
|
|
|
|
|
/* calcul de la nouvelle position du Module */
|
|
|
|
|
Nx = module->m_Pos.x; Ny = module->m_Pos.y;
|
|
|
|
|
RotatePoint( &Nx, &Ny, centerX, centerY, 900 );
|
|
|
|
|
GetScreen()->m_Curseur.x = Nx;
|
|
|
|
|
GetScreen()->m_Curseur.y = Ny;
|
|
|
|
|
Place_Module( module, DC );
|
|
|
|
|
|
|
|
|
|
/* Rotation du module autour de son ancre */
|
|
|
|
|
Rotate_Module( DC, module, Angle_Rot_Module, TRUE );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* regeneration des valeurs originelles */
|
|
|
|
|
GetScreen()->m_Curseur = oldpos;
|
|
|
|
|
g_Show_Ratsnest = Show_Ratsnest_tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Deplacement des Segments de piste */
|
|
|
|
|
if( Block_Include_Tracks )
|
|
|
|
|
{
|
|
|
|
|
TRACK* track;
|
|
|
|
|
|
|
|
|
|
Affiche_Message( _( "Track rotation" ) );
|
|
|
|
|
track = m_Pcb->m_Track;
|
|
|
|
|
while( track )
|
|
|
|
|
{
|
|
|
|
|
if( IsSegmentInBox( GetScreen()->BlockLocate, track ) )
|
|
|
|
|
{ /* la piste est ici bonne a etre deplacee */
|
|
|
|
|
m_Pcb->m_Status_Pcb = 0;
|
|
|
|
|
track->Draw( DrawPanel, DC, GR_XOR ); // effacement
|
|
|
|
|
RotatePoint( &track->m_Start.x, &track->m_Start.y, centerX, centerY, 900 );
|
|
|
|
|
RotatePoint( &track->m_End.x, &track->m_End.y, centerX, centerY, 900 );
|
|
|
|
|
track->Draw( DrawPanel, DC, GR_OR ); // reaffichage
|
|
|
|
|
}
|
|
|
|
|
track = track->Next();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Deplacement des Segments de Zone */
|
|
|
|
|
if( Block_Include_Zones )
|
|
|
|
|
{
|
|
|
|
|
TRACK* track;
|
|
|
|
|
|
|
|
|
|
Affiche_Message( _( "Zone rotation" ) );
|
|
|
|
|
track = (TRACK*) m_Pcb->m_Zone;
|
|
|
|
|
while( track )
|
|
|
|
|
{
|
|
|
|
|
if( IsSegmentInBox( GetScreen()->BlockLocate, track ) )
|
|
|
|
|
{ /* la piste est ici bonne a etre deplacee */
|
|
|
|
|
track->Draw( DrawPanel, DC, GR_XOR ); // effacement
|
|
|
|
|
RotatePoint( &track->m_Start.x, &track->m_Start.y, centerX, centerY, 900 );
|
|
|
|
|
RotatePoint( &track->m_End.x, &track->m_End.y, centerX, centerY, 900 );
|
|
|
|
|
track->Draw( DrawPanel, DC, GR_OR ); // reaffichage
|
|
|
|
|
}
|
|
|
|
|
track = track->Next();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
masque_layer = EDGE_LAYER;
|
|
|
|
|
if( Block_Include_Draw_Items )
|
|
|
|
|
masque_layer = ALL_LAYERS;
|
|
|
|
|
if( !Block_Include_Edges_Items )
|
|
|
|
|
masque_layer &= ~EDGE_LAYER;
|
|
|
|
|
|
|
|
|
|
Affiche_Message( _( "Draw layers rotation" ) );
|
|
|
|
|
PtStruct = m_Pcb->m_Drawings;
|
|
|
|
|
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext )
|
|
|
|
|
{
|
2007-09-01 12:00:30 +00:00
|
|
|
|
switch( PtStruct->Type() )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
{
|
|
|
|
|
case TYPEDRAWSEGMENT:
|
|
|
|
|
#undef STRUCT
|
|
|
|
|
#define STRUCT ( (DRAWSEGMENT*) PtStruct )
|
2007-08-23 04:28:46 +00:00
|
|
|
|
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
|
|
|
|
|
break;
|
|
|
|
|
/* l'element est ici bon a etre efface */
|
|
|
|
|
Trace_DrawSegmentPcb( DrawPanel, DC, (DRAWSEGMENT*) PtStruct, GR_XOR );
|
|
|
|
|
RotatePoint( &STRUCT->m_Start.x, &STRUCT->m_Start.y, centerX, centerY, 900 );
|
|
|
|
|
RotatePoint( &STRUCT->m_End.x, &STRUCT->m_End.y, centerX, centerY, 900 );
|
|
|
|
|
Trace_DrawSegmentPcb( DrawPanel, DC, (DRAWSEGMENT*) PtStruct, GR_OR );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case TYPETEXTE:
|
|
|
|
|
#undef STRUCT
|
|
|
|
|
#define STRUCT ( (TEXTE_PCB*) PtStruct )
|
|
|
|
|
if( !Block_Include_PcbTextes )
|
|
|
|
|
break;
|
|
|
|
|
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
|
|
|
|
|
break;
|
|
|
|
|
/* le texte est ici bon a etre deplace */
|
|
|
|
|
( (TEXTE_PCB*) PtStruct )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
|
|
|
|
|
/* Redessin du Texte */
|
|
|
|
|
RotatePoint( &STRUCT->m_Pos.x, &STRUCT->m_Pos.y, centerX, centerY, 900 );
|
|
|
|
|
STRUCT->m_Orient += 900;
|
|
|
|
|
if( STRUCT->m_Orient >= 3600 )
|
|
|
|
|
STRUCT->m_Orient -= 3600;
|
|
|
|
|
|
|
|
|
|
STRUCT->CreateDrawData();
|
|
|
|
|
( (TEXTE_PCB*) PtStruct )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case TYPEMIRE:
|
|
|
|
|
#undef STRUCT
|
|
|
|
|
#define STRUCT ( (MIREPCB*) PtStruct )
|
2007-08-23 04:28:46 +00:00
|
|
|
|
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
|
|
|
|
|
break;
|
|
|
|
|
/* l'element est ici bon a etre modifie */
|
|
|
|
|
( (MIREPCB*) PtStruct )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
|
|
|
|
|
RotatePoint( &STRUCT->m_Pos.x, &STRUCT->m_Pos.y, centerX, centerY, 900 );
|
|
|
|
|
( (MIREPCB*) PtStruct )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case TYPECOTATION:
|
|
|
|
|
#undef STRUCT
|
|
|
|
|
#define STRUCT ( (COTATION*) PtStruct )
|
2007-08-23 04:28:46 +00:00
|
|
|
|
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
|
|
|
|
|
break;
|
|
|
|
|
/* l'element est ici bon a etre modifie */
|
|
|
|
|
( (COTATION*) PtStruct )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
|
|
|
|
|
|
|
|
|
|
RotatePoint( &STRUCT->m_Pos.x, &STRUCT->m_Pos.y, centerX, centerY, 900 );
|
|
|
|
|
|
|
|
|
|
RotatePoint( &STRUCT->m_Text->m_Pos.x, &STRUCT->m_Text->m_Pos.y,
|
|
|
|
|
centerX, centerY, 900 );
|
|
|
|
|
STRUCT->m_Text->m_Orient += 900;
|
|
|
|
|
if( STRUCT->m_Text->m_Orient >= 3600 )
|
|
|
|
|
STRUCT->m_Text->m_Orient -= 3600;
|
|
|
|
|
if( (STRUCT->m_Text->m_Orient > 900)
|
|
|
|
|
&& (STRUCT->m_Text->m_Orient <2700) )
|
|
|
|
|
STRUCT->m_Text->m_Orient -= 1800;
|
|
|
|
|
|
|
|
|
|
RotatePoint( &STRUCT->Barre_ox, &STRUCT->Barre_oy, centerX, centerY, 900 );
|
|
|
|
|
RotatePoint( &STRUCT->Barre_fx, &STRUCT->Barre_fy, centerX, centerY, 900 );
|
|
|
|
|
RotatePoint( &STRUCT->TraitG_ox, &STRUCT->TraitG_oy, centerX, centerY, 900 );
|
|
|
|
|
RotatePoint( &STRUCT->TraitG_fx, &STRUCT->TraitG_fy, centerX, centerY, 900 );
|
|
|
|
|
RotatePoint( &STRUCT->TraitD_ox, &STRUCT->TraitD_oy, centerX, centerY, 900 );
|
|
|
|
|
RotatePoint( &STRUCT->TraitD_fx, &STRUCT->TraitD_fy, centerX, centerY, 900 );
|
|
|
|
|
RotatePoint( &STRUCT->FlecheG1_ox, &STRUCT->FlecheG1_oy, centerX, centerY, 900 );
|
|
|
|
|
RotatePoint( &STRUCT->FlecheG1_fx, &STRUCT->FlecheG1_fy, centerX, centerY, 900 );
|
|
|
|
|
RotatePoint( &STRUCT->FlecheG2_ox, &STRUCT->FlecheG2_oy, centerX, centerY, 900 );
|
|
|
|
|
RotatePoint( &STRUCT->FlecheG2_fx, &STRUCT->FlecheG2_fy, centerX, centerY, 900 );
|
|
|
|
|
RotatePoint( &STRUCT->FlecheD1_ox, &STRUCT->FlecheD1_oy, centerX, centerY, 900 );
|
|
|
|
|
RotatePoint( &STRUCT->FlecheD1_fx, &STRUCT->FlecheD1_fy, centerX, centerY, 900 );
|
|
|
|
|
RotatePoint( &STRUCT->FlecheD2_ox, &STRUCT->FlecheD2_oy, centerX, centerY, 900 );
|
|
|
|
|
RotatePoint( &STRUCT->FlecheD2_fx, &STRUCT->FlecheD2_fy, centerX, centerY, 900 );
|
|
|
|
|
( (COTATION*) PtStruct )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RedrawActiveWindow( DC, TRUE );
|
|
|
|
|
if( g_Show_Ratsnest )
|
|
|
|
|
Compile_Ratsnest( DC, TRUE );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/*****************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/*
|
2007-08-20 01:20:48 +00:00
|
|
|
|
* routine d'inversion miroir deg du block deja selectionne
|
|
|
|
|
* les elements sont inverse / axe horizontal,
|
|
|
|
|
* l'axe d'inversion est la mediane horizontale du block
|
|
|
|
|
*/
|
|
|
|
|
#define INVERT( pos ) (pos) = centerY - ( (pos) - centerY )
|
|
|
|
|
#define INVERT_ANGLE( phi ) (phi) = -(phi)
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
|
MODULE* module;
|
|
|
|
|
EDA_BaseStruct* PtStruct;
|
|
|
|
|
int masque_layer;
|
|
|
|
|
wxPoint memo;
|
|
|
|
|
int Ny, centerY;/* position de l'axe d'inversion de l'ensemble des elements */
|
|
|
|
|
|
|
|
|
|
if( !InstallBlockCmdFrame( this, _( "Block mirroring" ) ) )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
memo = GetScreen()->m_Curseur;
|
|
|
|
|
GetScreen()->BlockLocate.Normalize();
|
|
|
|
|
|
|
|
|
|
/* calcul du centre d'inversion */
|
|
|
|
|
centerY = GetScreen()->BlockLocate.Centre().y;
|
|
|
|
|
|
|
|
|
|
GetScreen()->SetModify();
|
|
|
|
|
|
|
|
|
|
/* Inversion des modules */
|
|
|
|
|
if( Block_Include_Modules )
|
|
|
|
|
{
|
|
|
|
|
bool Show_Ratsnest_tmp = g_Show_Ratsnest; g_Show_Ratsnest = false;
|
|
|
|
|
Affiche_Message( _( "Footprint mirroring" ) );
|
|
|
|
|
module = m_Pcb->m_Modules;
|
|
|
|
|
for( ; module != NULL; module = (MODULE*) module->Pnext )
|
|
|
|
|
{
|
|
|
|
|
if( IsModuleInBox( GetScreen()->BlockLocate, module ) == NULL )
|
|
|
|
|
continue;
|
|
|
|
|
/* le module est ici bon a etre efface */
|
|
|
|
|
m_Pcb->m_Status_Pcb = 0;
|
|
|
|
|
module->m_Flags = 0;
|
|
|
|
|
module->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
|
|
|
|
|
|
|
|
|
|
/* calcul de la nouvelle position du Module */
|
|
|
|
|
Ny = module->m_Pos.y;
|
|
|
|
|
INVERT( Ny );
|
|
|
|
|
GetScreen()->m_Curseur.x = module->m_Pos.x;
|
|
|
|
|
GetScreen()->m_Curseur.y = Ny;
|
|
|
|
|
Place_Module( module, DC );
|
|
|
|
|
|
|
|
|
|
/* inversion du module */
|
|
|
|
|
Change_Side_Module( module, DC );
|
|
|
|
|
|
|
|
|
|
/* regeneration des valeurs originelles */
|
|
|
|
|
GetScreen()->m_Curseur = memo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_Show_Ratsnest = Show_Ratsnest_tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Deplacement des Segments de piste */
|
|
|
|
|
if( Block_Include_Tracks )
|
|
|
|
|
{
|
|
|
|
|
TRACK* track;
|
|
|
|
|
|
|
|
|
|
Affiche_Message( _( "Track mirroring" ) );
|
|
|
|
|
track = m_Pcb->m_Track;
|
|
|
|
|
while( track )
|
|
|
|
|
{
|
|
|
|
|
if( IsSegmentInBox( GetScreen()->BlockLocate, track ) )
|
|
|
|
|
{ /* la piste est ici bonne a etre deplacee */
|
|
|
|
|
m_Pcb->m_Status_Pcb = 0;
|
|
|
|
|
track->Draw( DrawPanel, DC, GR_XOR ); // effacement
|
|
|
|
|
INVERT( track->m_Start.y );
|
|
|
|
|
INVERT( track->m_End.y );
|
2007-09-01 12:00:30 +00:00
|
|
|
|
if( track->Type() != TYPEVIA )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
{
|
2007-08-23 04:28:46 +00:00
|
|
|
|
track->SetLayer( ChangeSideNumLayer( track->GetLayer() ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
track->Draw( DrawPanel, DC, GR_OR ); // reaffichage
|
|
|
|
|
}
|
|
|
|
|
track = (TRACK*) track->Pnext;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Deplacement des Segments de Zone */
|
|
|
|
|
if( Block_Include_Zones )
|
|
|
|
|
{
|
|
|
|
|
TRACK* track;
|
|
|
|
|
|
|
|
|
|
Affiche_Message( _( "Zone mirroring" ) );
|
|
|
|
|
track = (TRACK*) m_Pcb->m_Zone;
|
|
|
|
|
while( track )
|
|
|
|
|
{
|
|
|
|
|
if( IsSegmentInBox( GetScreen()->BlockLocate, track ) )
|
|
|
|
|
{ /* la piste est ici bonne a etre deplacee */
|
|
|
|
|
track->Draw( DrawPanel, DC, GR_XOR ); // effacement
|
|
|
|
|
INVERT( track->m_Start.y );
|
|
|
|
|
INVERT( track->m_End.y );
|
2007-08-23 04:28:46 +00:00
|
|
|
|
track->SetLayer( ChangeSideNumLayer( track->GetLayer() ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
track->Draw( DrawPanel, DC, GR_OR ); // reaffichage
|
|
|
|
|
}
|
|
|
|
|
track = (TRACK*) track->Pnext;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
masque_layer = EDGE_LAYER;
|
|
|
|
|
if( Block_Include_Draw_Items )
|
|
|
|
|
masque_layer = ALL_LAYERS;
|
|
|
|
|
if( !Block_Include_Edges_Items )
|
|
|
|
|
masque_layer &= ~EDGE_LAYER;
|
|
|
|
|
|
|
|
|
|
Affiche_Message( _( "Draw layers mirroring" ) );
|
|
|
|
|
PtStruct = m_Pcb->m_Drawings;
|
|
|
|
|
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext )
|
|
|
|
|
{
|
2007-09-01 12:00:30 +00:00
|
|
|
|
switch( PtStruct->Type() )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
{
|
|
|
|
|
case TYPEDRAWSEGMENT:
|
|
|
|
|
#undef STRUCT
|
|
|
|
|
#define STRUCT ( (DRAWSEGMENT*) PtStruct )
|
2007-08-23 04:28:46 +00:00
|
|
|
|
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
|
|
|
|
|
break;
|
|
|
|
|
/* l'element est ici bon a etre selectionne */
|
|
|
|
|
Trace_DrawSegmentPcb( DrawPanel, DC, (DRAWSEGMENT*) PtStruct, GR_XOR );
|
|
|
|
|
if( STRUCT->m_Shape == S_ARC )
|
|
|
|
|
{
|
|
|
|
|
INVERT_ANGLE( STRUCT->m_Angle );
|
|
|
|
|
}
|
|
|
|
|
INVERT( STRUCT->m_Start.y );
|
|
|
|
|
INVERT( STRUCT->m_End.y );
|
2007-08-23 04:28:46 +00:00
|
|
|
|
STRUCT->SetLayer( ChangeSideNumLayer( STRUCT->GetLayer() ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
Trace_DrawSegmentPcb( DrawPanel, DC, (DRAWSEGMENT*) PtStruct, GR_OR );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case TYPETEXTE:
|
|
|
|
|
#undef STRUCT
|
|
|
|
|
#define STRUCT ( (TEXTE_PCB*) PtStruct )
|
|
|
|
|
if( !Block_Include_PcbTextes )
|
|
|
|
|
break;
|
|
|
|
|
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
|
|
|
|
|
break;
|
|
|
|
|
/* le texte est ici bon a etre selectionne*/
|
|
|
|
|
( (TEXTE_PCB*) PtStruct )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
|
|
|
|
|
/* Redessin du Texte */
|
|
|
|
|
INVERT( STRUCT->m_Pos.y );
|
|
|
|
|
INVERT_ANGLE( STRUCT->m_Orient );
|
2007-10-07 18:24:15 +00:00
|
|
|
|
if( (STRUCT->GetLayer() == COPPER_LAYER_N) || (STRUCT->GetLayer() == CMP_N) )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
{
|
|
|
|
|
STRUCT->m_Miroir ^= 1; /* inverse miroir */
|
|
|
|
|
}
|
2007-08-23 04:28:46 +00:00
|
|
|
|
STRUCT->SetLayer( ChangeSideNumLayer( STRUCT->GetLayer() ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
STRUCT->CreateDrawData();
|
|
|
|
|
( (TEXTE_PCB*) PtStruct )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case TYPEMIRE:
|
|
|
|
|
#undef STRUCT
|
|
|
|
|
#define STRUCT ( (MIREPCB*) PtStruct )
|
2007-08-23 04:28:46 +00:00
|
|
|
|
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
|
|
|
|
|
break;
|
|
|
|
|
/* l'element est ici bon a etre modifie */
|
|
|
|
|
( (MIREPCB*) PtStruct )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
|
|
|
|
|
INVERT( STRUCT->m_Pos.y );
|
2007-08-23 04:28:46 +00:00
|
|
|
|
STRUCT->SetLayer( ChangeSideNumLayer( STRUCT->GetLayer() ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
( (MIREPCB*) PtStruct )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case TYPECOTATION:
|
|
|
|
|
#undef STRUCT
|
|
|
|
|
#define STRUCT ( (COTATION*) PtStruct )
|
2007-08-23 04:28:46 +00:00
|
|
|
|
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
|
|
|
|
|
break;
|
|
|
|
|
/* l'element est ici bon a etre modifie */
|
|
|
|
|
( (COTATION*) PtStruct )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
|
|
|
|
|
|
|
|
|
|
INVERT( STRUCT->m_Pos.y );
|
|
|
|
|
INVERT( STRUCT->m_Text->m_Pos.y );
|
|
|
|
|
INVERT_ANGLE( STRUCT->m_Text->m_Orient );
|
|
|
|
|
if( STRUCT->m_Text->m_Orient >= 3600 )
|
|
|
|
|
STRUCT->m_Text->m_Orient -= 3600;
|
|
|
|
|
if( (STRUCT->m_Text->m_Orient > 900)
|
|
|
|
|
&& (STRUCT->m_Text->m_Orient <2700) )
|
|
|
|
|
STRUCT->m_Text->m_Orient -= 1800;
|
|
|
|
|
|
|
|
|
|
INVERT( STRUCT->Barre_oy );
|
|
|
|
|
INVERT( STRUCT->Barre_fy );
|
|
|
|
|
INVERT( STRUCT->TraitG_oy );
|
|
|
|
|
INVERT( STRUCT->TraitG_fy );
|
|
|
|
|
INVERT( STRUCT->TraitD_oy );
|
|
|
|
|
INVERT( STRUCT->TraitD_fy );
|
|
|
|
|
INVERT( STRUCT->FlecheG1_oy );
|
|
|
|
|
INVERT( STRUCT->FlecheG1_fy );
|
|
|
|
|
INVERT( STRUCT->FlecheG2_oy );
|
|
|
|
|
INVERT( STRUCT->FlecheG2_fy );
|
|
|
|
|
INVERT( STRUCT->FlecheD1_oy );
|
|
|
|
|
INVERT( STRUCT->FlecheD1_fy );
|
|
|
|
|
INVERT( STRUCT->FlecheD2_oy );
|
|
|
|
|
INVERT( STRUCT->FlecheD2_fy );
|
|
|
|
|
|
2007-08-23 04:28:46 +00:00
|
|
|
|
STRUCT->SetLayer( ChangeSideNumLayer( STRUCT->GetLayer() ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
|
|
( (COTATION*) PtStruct )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RedrawActiveWindow( DC, TRUE );
|
|
|
|
|
if( g_Show_Ratsnest )
|
|
|
|
|
Compile_Ratsnest( DC, TRUE );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/*
|
2007-08-20 01:20:48 +00:00
|
|
|
|
* Function to move items withing the selected block
|
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
|
MODULE* module;
|
|
|
|
|
EDA_BaseStruct* PtStruct;
|
|
|
|
|
int masque_layer;
|
|
|
|
|
int deltaX, deltaY;
|
|
|
|
|
wxPoint oldpos;
|
|
|
|
|
|
|
|
|
|
oldpos = GetScreen()->m_Curseur;
|
|
|
|
|
DrawPanel->ManageCurseur = NULL;
|
|
|
|
|
|
|
|
|
|
if( !InstallBlockCmdFrame( this, _( "Move Block" ) ) )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
GetScreen()->m_Curseur = oldpos;
|
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
|
GetScreen()->SetModify();
|
|
|
|
|
GetScreen()->BlockLocate.Normalize();
|
|
|
|
|
|
|
|
|
|
/* Deplacement des modules */
|
|
|
|
|
if( Block_Include_Modules )
|
|
|
|
|
{
|
|
|
|
|
bool Show_Ratsnest_tmp = g_Show_Ratsnest; g_Show_Ratsnest = false;
|
|
|
|
|
Affiche_Message( _( "Move footprints" ) );
|
|
|
|
|
module = m_Pcb->m_Modules;
|
|
|
|
|
oldpos = GetScreen()->m_Curseur;
|
|
|
|
|
|
|
|
|
|
for( ; module != NULL; module = (MODULE*) module->Pnext )
|
|
|
|
|
{
|
|
|
|
|
if( IsModuleInBox( GetScreen()->BlockLocate, module ) == NULL )
|
|
|
|
|
continue;
|
|
|
|
|
/* le module est ici bon a etre deplace */
|
|
|
|
|
m_Pcb->m_Status_Pcb = 0;
|
|
|
|
|
module->m_Flags = 0;
|
|
|
|
|
module->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
|
|
|
|
|
|
|
|
|
|
/* calcul du deplacement pour la routine Place_Module */
|
|
|
|
|
/* calcul du vecteur de deplacement */
|
|
|
|
|
GetScreen()->m_Curseur.x = module->m_Pos.x + GetScreen()->BlockLocate.m_MoveVector.x;
|
|
|
|
|
GetScreen()->m_Curseur.y = module->m_Pos.y + GetScreen()->BlockLocate.m_MoveVector.y;
|
|
|
|
|
Place_Module( module, DC );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GetScreen()->m_Curseur = oldpos;
|
|
|
|
|
g_Show_Ratsnest = Show_Ratsnest_tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* calcul du vecteur de deplacement pour les deplacements suivants */
|
|
|
|
|
deltaX = GetScreen()->BlockLocate.m_MoveVector.x;
|
|
|
|
|
deltaY = GetScreen()->BlockLocate.m_MoveVector.y;
|
|
|
|
|
|
|
|
|
|
/* Deplacement des Segments de piste */
|
|
|
|
|
if( Block_Include_Tracks )
|
|
|
|
|
{
|
|
|
|
|
TRACK* track;
|
|
|
|
|
|
|
|
|
|
Affiche_Message( _( "Move tracks" ) );
|
|
|
|
|
track = m_Pcb->m_Track;
|
|
|
|
|
while( track )
|
|
|
|
|
{
|
|
|
|
|
if( IsSegmentInBox( GetScreen()->BlockLocate, track ) )
|
|
|
|
|
{ /* la piste est ici bonne a etre deplacee */
|
|
|
|
|
m_Pcb->m_Status_Pcb = 0;
|
|
|
|
|
track->Draw( DrawPanel, DC, GR_XOR ); // effacement
|
|
|
|
|
track->m_Start.x += deltaX; track->m_Start.y += deltaY;
|
|
|
|
|
track->m_End.x += deltaX; track->m_End.y += deltaY;
|
|
|
|
|
track->Draw( DrawPanel, DC, GR_OR ); // reaffichage
|
|
|
|
|
}
|
|
|
|
|
track = (TRACK*) track->Pnext;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Deplacement des Segments de Zone */
|
|
|
|
|
if( Block_Include_Zones )
|
|
|
|
|
{
|
|
|
|
|
TRACK* track;
|
|
|
|
|
|
|
|
|
|
Affiche_Message( _( "Move zones" ) );
|
|
|
|
|
track = (TRACK*) m_Pcb->m_Zone;
|
|
|
|
|
while( track )
|
|
|
|
|
{
|
|
|
|
|
if( IsSegmentInBox( GetScreen()->BlockLocate, track ) )
|
|
|
|
|
{ /* la piste est ici bonne a etre deplacee */
|
|
|
|
|
track->Draw( DrawPanel, DC, GR_XOR ); // effacement
|
|
|
|
|
track->m_Start.x += deltaX; track->m_Start.y += deltaY;
|
|
|
|
|
track->m_End.x += deltaX; track->m_End.y += deltaY;
|
|
|
|
|
track->Draw( DrawPanel, DC, GR_OR ); // reaffichage
|
|
|
|
|
}
|
|
|
|
|
track = (TRACK*) track->Pnext;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
masque_layer = EDGE_LAYER;
|
|
|
|
|
if( Block_Include_Draw_Items )
|
|
|
|
|
masque_layer = ALL_LAYERS;
|
|
|
|
|
if( !Block_Include_Edges_Items )
|
|
|
|
|
masque_layer &= ~EDGE_LAYER;
|
|
|
|
|
|
|
|
|
|
Affiche_Message( _( "Move draw layers" ) );
|
|
|
|
|
PtStruct = m_Pcb->m_Drawings;
|
|
|
|
|
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext )
|
|
|
|
|
{
|
2007-09-01 12:00:30 +00:00
|
|
|
|
switch( PtStruct->Type() )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
{
|
|
|
|
|
case TYPEDRAWSEGMENT:
|
|
|
|
|
#undef STRUCT
|
|
|
|
|
#define STRUCT ( (DRAWSEGMENT*) PtStruct )
|
2007-08-23 04:28:46 +00:00
|
|
|
|
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
|
|
|
|
|
break;
|
|
|
|
|
/* l'element est ici bon a etre efface */
|
|
|
|
|
Trace_DrawSegmentPcb( DrawPanel, DC, STRUCT, GR_XOR );
|
|
|
|
|
STRUCT->m_Start.x += deltaX; STRUCT->m_Start.y += deltaY;
|
|
|
|
|
STRUCT->m_End.x += deltaX; STRUCT->m_End.y += deltaY;
|
|
|
|
|
Trace_DrawSegmentPcb( DrawPanel, DC, STRUCT, GR_OR );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case TYPETEXTE:
|
|
|
|
|
#undef STRUCT
|
|
|
|
|
#define STRUCT ( (TEXTE_PCB*) PtStruct )
|
|
|
|
|
if( !Block_Include_PcbTextes )
|
|
|
|
|
break;
|
|
|
|
|
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
|
|
|
|
|
break;
|
|
|
|
|
/* le texte est ici bon a etre deplace */
|
|
|
|
|
STRUCT->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
|
|
|
|
|
/* Redessin du Texte */
|
|
|
|
|
STRUCT->m_Pos.x += deltaX; STRUCT->m_Pos.y += deltaY;
|
|
|
|
|
( (TEXTE_PCB*) PtStruct )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case TYPEMIRE:
|
|
|
|
|
#undef STRUCT
|
|
|
|
|
#define STRUCT ( (MIREPCB*) PtStruct )
|
2007-08-23 04:28:46 +00:00
|
|
|
|
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
|
|
|
|
|
break;
|
|
|
|
|
/* l'element est ici bon a etre efface */
|
|
|
|
|
( (MIREPCB*) PtStruct )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
|
|
|
|
|
STRUCT->m_Pos.x += deltaX; STRUCT->m_Pos.y += deltaY;
|
|
|
|
|
( (MIREPCB*) PtStruct )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case TYPECOTATION:
|
|
|
|
|
#undef STRUCT
|
|
|
|
|
#define STRUCT ( (COTATION*) PtStruct )
|
2007-08-23 04:28:46 +00:00
|
|
|
|
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
|
|
|
|
|
break;
|
|
|
|
|
/* l'element est ici bon a etre efface */
|
|
|
|
|
( (COTATION*) PtStruct )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
|
|
|
|
|
STRUCT->m_Pos.x += deltaX;
|
|
|
|
|
STRUCT->m_Pos.y += deltaY;
|
|
|
|
|
STRUCT->m_Text->m_Pos.x += deltaX;
|
|
|
|
|
STRUCT->m_Text->m_Pos.y += deltaY;
|
|
|
|
|
STRUCT->Barre_ox += deltaX; STRUCT->Barre_oy += deltaY;
|
|
|
|
|
STRUCT->Barre_fx += deltaX; STRUCT->Barre_fy += deltaY;
|
|
|
|
|
STRUCT->TraitG_ox += deltaX; STRUCT->TraitG_oy += deltaY;
|
|
|
|
|
STRUCT->TraitG_fx += deltaX; STRUCT->TraitG_fy += deltaY;
|
|
|
|
|
STRUCT->TraitD_ox += deltaX; STRUCT->TraitD_oy += deltaY;
|
|
|
|
|
STRUCT->TraitD_fx += deltaX; STRUCT->TraitD_fy += deltaY;
|
|
|
|
|
STRUCT->FlecheG1_ox += deltaX; STRUCT->FlecheG1_oy += deltaY;
|
|
|
|
|
STRUCT->FlecheG1_fx += deltaX; STRUCT->FlecheG1_fy += deltaY;
|
|
|
|
|
STRUCT->FlecheG2_ox += deltaX; STRUCT->FlecheG2_oy += deltaY;
|
|
|
|
|
STRUCT->FlecheG2_fx += deltaX; STRUCT->FlecheG2_fy += deltaY;
|
|
|
|
|
STRUCT->FlecheD1_ox += deltaX; STRUCT->FlecheD1_oy += deltaY;
|
|
|
|
|
STRUCT->FlecheD1_fx += deltaX; STRUCT->FlecheD1_fy += deltaY;
|
|
|
|
|
STRUCT->FlecheD2_ox += deltaX; STRUCT->FlecheD2_oy += deltaY;
|
|
|
|
|
STRUCT->FlecheD2_fx += deltaX; STRUCT->FlecheD2_fy += deltaY;
|
|
|
|
|
( (COTATION*) PtStruct )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DrawPanel->Refresh( TRUE );;
|
|
|
|
|
if( g_Show_Ratsnest )
|
|
|
|
|
Compile_Ratsnest( DC, TRUE );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/**************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/*
|
2007-08-20 01:20:48 +00:00
|
|
|
|
* routine de duplication des elements du block deja selectionne
|
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
|
MODULE* module;
|
|
|
|
|
EDA_BaseStruct* PtStruct;
|
|
|
|
|
int masque_layer;
|
|
|
|
|
int deltaX, deltaY;
|
|
|
|
|
wxPoint oldpos;
|
|
|
|
|
|
|
|
|
|
oldpos = GetScreen()->m_Curseur;
|
|
|
|
|
DrawPanel->ManageCurseur = NULL;
|
|
|
|
|
|
|
|
|
|
if( !InstallBlockCmdFrame( this, _( "Copy Block" ) ) )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
GetScreen()->m_Curseur = oldpos;
|
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
|
GetScreen()->SetModify();
|
|
|
|
|
GetScreen()->BlockLocate.Normalize();
|
|
|
|
|
|
|
|
|
|
/* Module copy */
|
|
|
|
|
if( Block_Include_Modules )
|
|
|
|
|
{
|
|
|
|
|
bool Show_Ratsnest_tmp = g_Show_Ratsnest; g_Show_Ratsnest = false;
|
|
|
|
|
Affiche_Message( _( "Module copy" ) );
|
|
|
|
|
module = m_Pcb->m_Modules;
|
|
|
|
|
oldpos = GetScreen()->m_Curseur;
|
|
|
|
|
|
|
|
|
|
for( ; module != NULL; module = (MODULE*) module->Pnext )
|
|
|
|
|
{
|
|
|
|
|
MODULE* new_module;
|
|
|
|
|
if( IsModuleInBox( GetScreen()->BlockLocate, module ) == NULL )
|
|
|
|
|
continue;
|
|
|
|
|
/* le module est ici bon a etre deplace */
|
|
|
|
|
m_Pcb->m_Status_Pcb = 0;
|
|
|
|
|
module->m_Flags = 0;
|
|
|
|
|
new_module = new MODULE( m_Pcb );
|
|
|
|
|
new_module->Copy( module );
|
|
|
|
|
new_module->m_TimeStamp = GetTimeStamp();
|
|
|
|
|
new_module->Pnext = m_Pcb->m_Modules;
|
|
|
|
|
new_module->Pback = m_Pcb;
|
|
|
|
|
m_Pcb->m_Modules->Pback = new_module;
|
|
|
|
|
m_Pcb->m_Modules = new_module;
|
|
|
|
|
/* calcul du deplacement pour la routine Place_Module */
|
|
|
|
|
/* calcul du vecteur de deplacement */
|
|
|
|
|
GetScreen()->m_Curseur.x = module->m_Pos.x + GetScreen()->BlockLocate.m_MoveVector.x;
|
|
|
|
|
GetScreen()->m_Curseur.y = module->m_Pos.y + GetScreen()->BlockLocate.m_MoveVector.y;
|
|
|
|
|
Place_Module( new_module, DC );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GetScreen()->m_Curseur = oldpos;
|
|
|
|
|
g_Show_Ratsnest = Show_Ratsnest_tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* calcul du vecteur de deplacement pour les deplacements suivants */
|
|
|
|
|
deltaX = GetScreen()->BlockLocate.m_MoveVector.x;
|
|
|
|
|
deltaY = GetScreen()->BlockLocate.m_MoveVector.y;
|
|
|
|
|
|
|
|
|
|
/* Deplacement des Segments de piste */
|
|
|
|
|
if( Block_Include_Tracks )
|
|
|
|
|
{
|
|
|
|
|
TRACK* track, * next_track, * new_track;
|
|
|
|
|
|
|
|
|
|
Affiche_Message( _( "Track copy" ) );
|
|
|
|
|
track = m_Pcb->m_Track;
|
|
|
|
|
while( track )
|
|
|
|
|
{
|
|
|
|
|
next_track = track->Next();
|
|
|
|
|
if( IsSegmentInBox( GetScreen()->BlockLocate, track ) )
|
2007-09-11 04:14:47 +00:00
|
|
|
|
{
|
|
|
|
|
/* la piste est ici bonne a etre deplacee */
|
2007-08-20 01:20:48 +00:00
|
|
|
|
m_Pcb->m_Status_Pcb = 0;
|
2007-09-11 04:14:47 +00:00
|
|
|
|
new_track = track->Copy();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
new_track->Insert( m_Pcb, NULL );
|
|
|
|
|
new_track->m_Start.x += deltaX; new_track->m_Start.y += deltaY;
|
|
|
|
|
new_track->m_End.x += deltaX; new_track->m_End.y += deltaY;
|
|
|
|
|
new_track->Draw( DrawPanel, DC, GR_OR ); // reaffichage
|
|
|
|
|
}
|
|
|
|
|
track = next_track;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Deplacement des Segments de Zone */
|
|
|
|
|
if( Block_Include_Zones )
|
|
|
|
|
{
|
|
|
|
|
TRACK* track, * next_track, * new_track;
|
|
|
|
|
|
|
|
|
|
Affiche_Message( _( "Zone copy" ) );
|
|
|
|
|
track = (TRACK*) m_Pcb->m_Zone;
|
|
|
|
|
while( track )
|
|
|
|
|
{
|
|
|
|
|
next_track = track->Next();
|
|
|
|
|
if( IsSegmentInBox( GetScreen()->BlockLocate, track ) )
|
2007-08-30 22:20:52 +00:00
|
|
|
|
{
|
|
|
|
|
/* la piste est ici bonne a etre deplacee */
|
2007-08-20 01:20:48 +00:00
|
|
|
|
new_track = new TRACK( m_Pcb );
|
2007-09-11 04:14:47 +00:00
|
|
|
|
new_track = track->Copy();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
new_track->Insert( m_Pcb, NULL );
|
|
|
|
|
new_track->m_Start.x += deltaX; new_track->m_Start.y += deltaY;
|
|
|
|
|
new_track->m_End.x += deltaX; new_track->m_End.y += deltaY;
|
|
|
|
|
new_track->Draw( DrawPanel, DC, GR_OR ); // reaffichage
|
|
|
|
|
}
|
|
|
|
|
track = next_track;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
masque_layer = EDGE_LAYER;
|
|
|
|
|
if( Block_Include_Draw_Items )
|
|
|
|
|
masque_layer = ALL_LAYERS;
|
|
|
|
|
if( !Block_Include_Edges_Items )
|
|
|
|
|
masque_layer &= ~EDGE_LAYER;
|
|
|
|
|
|
|
|
|
|
Affiche_Message( _( "Draw layers copy" ) );
|
|
|
|
|
PtStruct = m_Pcb->m_Drawings;
|
|
|
|
|
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext )
|
|
|
|
|
{
|
2007-09-01 12:00:30 +00:00
|
|
|
|
switch( PtStruct->Type() )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
{
|
|
|
|
|
case TYPEDRAWSEGMENT:
|
|
|
|
|
{
|
2007-09-11 04:14:47 +00:00
|
|
|
|
#undef STRUCT
|
|
|
|
|
#define STRUCT ( (DRAWSEGMENT*) PtStruct )
|
2007-08-23 04:28:46 +00:00
|
|
|
|
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
|
|
|
|
|
break;
|
2007-09-11 04:14:47 +00:00
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
/* l'element est ici bon a etre copie */
|
|
|
|
|
DRAWSEGMENT* new_drawsegment = new DRAWSEGMENT( m_Pcb );
|
|
|
|
|
new_drawsegment->Copy( STRUCT );
|
2007-09-11 04:14:47 +00:00
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
new_drawsegment->Pnext = m_Pcb->m_Drawings;
|
|
|
|
|
new_drawsegment->Pback = m_Pcb;
|
|
|
|
|
m_Pcb->m_Drawings->Pback = new_drawsegment;
|
|
|
|
|
m_Pcb->m_Drawings = new_drawsegment;
|
|
|
|
|
new_drawsegment->m_Start.x += deltaX; new_drawsegment->m_Start.y += deltaY;
|
|
|
|
|
new_drawsegment->m_End.x += deltaX; new_drawsegment->m_End.y += deltaY;
|
|
|
|
|
Trace_DrawSegmentPcb( DrawPanel, DC, new_drawsegment, GR_OR );
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case TYPETEXTE:
|
|
|
|
|
{
|
|
|
|
|
#undef STRUCT
|
|
|
|
|
#define STRUCT ( (TEXTE_PCB*) PtStruct )
|
|
|
|
|
if( !Block_Include_PcbTextes )
|
|
|
|
|
break;
|
|
|
|
|
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
|
|
|
|
|
break;
|
|
|
|
|
/* le texte est ici bon a etre deplace */
|
|
|
|
|
TEXTE_PCB* new_pcbtext = new TEXTE_PCB( m_Pcb );
|
|
|
|
|
new_pcbtext->Copy( STRUCT );
|
|
|
|
|
new_pcbtext->Pnext = m_Pcb->m_Drawings;
|
|
|
|
|
new_pcbtext->Pback = m_Pcb;
|
|
|
|
|
m_Pcb->m_Drawings->Pback = new_pcbtext;
|
|
|
|
|
m_Pcb->m_Drawings = new_pcbtext;
|
|
|
|
|
/* Redessin du Texte */
|
|
|
|
|
new_pcbtext->m_Pos.x += deltaX; new_pcbtext->m_Pos.y += deltaY;
|
|
|
|
|
new_pcbtext->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case TYPEMIRE:
|
|
|
|
|
{
|
|
|
|
|
#undef STRUCT
|
|
|
|
|
#define STRUCT ( (MIREPCB*) PtStruct )
|
2007-08-23 04:28:46 +00:00
|
|
|
|
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
|
|
|
|
|
break;
|
|
|
|
|
/* l'element est ici bon a etre efface */
|
|
|
|
|
MIREPCB* new_mire = new MIREPCB( m_Pcb );
|
|
|
|
|
new_mire->Copy( STRUCT );
|
|
|
|
|
new_mire->Pnext = m_Pcb->m_Drawings;
|
|
|
|
|
new_mire->Pback = m_Pcb;
|
|
|
|
|
m_Pcb->m_Drawings->Pback = new_mire;
|
|
|
|
|
m_Pcb->m_Drawings = new_mire;
|
|
|
|
|
new_mire->m_Pos.x += deltaX; new_mire->m_Pos.y += deltaY;
|
|
|
|
|
new_mire->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case TYPECOTATION:
|
|
|
|
|
{
|
|
|
|
|
#undef STRUCT
|
|
|
|
|
#define STRUCT ( (COTATION*) PtStruct )
|
2007-08-23 04:28:46 +00:00
|
|
|
|
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
|
|
|
|
|
break;
|
|
|
|
|
/* l'element est ici bon a etre copie */
|
|
|
|
|
COTATION* new_cotation = new COTATION( m_Pcb );
|
|
|
|
|
new_cotation->Copy( STRUCT );
|
|
|
|
|
new_cotation->Pnext = m_Pcb->m_Drawings;
|
|
|
|
|
new_cotation->Pback = m_Pcb;
|
|
|
|
|
m_Pcb->m_Drawings->Pback = new_cotation;
|
|
|
|
|
m_Pcb->m_Drawings = new_cotation;
|
|
|
|
|
new_cotation->m_Pos.x += deltaX;
|
|
|
|
|
new_cotation->m_Pos.y += deltaY;
|
|
|
|
|
new_cotation->m_Text->m_Pos.x += deltaX;
|
|
|
|
|
new_cotation->m_Text->m_Pos.y += deltaY;
|
|
|
|
|
new_cotation->Barre_ox += deltaX; new_cotation->Barre_oy += deltaY;
|
|
|
|
|
new_cotation->Barre_fx += deltaX; new_cotation->Barre_fy += deltaY;
|
|
|
|
|
new_cotation->TraitG_ox += deltaX; new_cotation->TraitG_oy += deltaY;
|
|
|
|
|
new_cotation->TraitG_fx += deltaX; new_cotation->TraitG_fy += deltaY;
|
|
|
|
|
new_cotation->TraitD_ox += deltaX; new_cotation->TraitD_oy += deltaY;
|
|
|
|
|
new_cotation->TraitD_fx += deltaX; new_cotation->TraitD_fy += deltaY;
|
|
|
|
|
new_cotation->FlecheG1_ox += deltaX; new_cotation->FlecheG1_oy += deltaY;
|
|
|
|
|
new_cotation->FlecheG1_fx += deltaX; new_cotation->FlecheG1_fy += deltaY;
|
|
|
|
|
new_cotation->FlecheG2_ox += deltaX; new_cotation->FlecheG2_oy += deltaY;
|
|
|
|
|
new_cotation->FlecheG2_fx += deltaX; new_cotation->FlecheG2_fy += deltaY;
|
|
|
|
|
new_cotation->FlecheD1_ox += deltaX; new_cotation->FlecheD1_oy += deltaY;
|
|
|
|
|
new_cotation->FlecheD1_fx += deltaX; new_cotation->FlecheD1_fy += deltaY;
|
|
|
|
|
new_cotation->FlecheD2_ox += deltaX; new_cotation->FlecheD2_oy += deltaY;
|
|
|
|
|
new_cotation->FlecheD2_fx += deltaX; new_cotation->FlecheD2_fy += deltaY;
|
|
|
|
|
new_cotation->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
static EDA_BaseStruct* IsStructInBox( DrawBlockStruct& blocklocate,
|
|
|
|
|
EDA_BaseStruct* PtStruct )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/******************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/* Teste si la structure PtStruct est inscrite dans le block selectionne
|
2007-08-20 01:20:48 +00:00
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2007-09-01 12:00:30 +00:00
|
|
|
|
switch( PtStruct->Type() )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
{
|
|
|
|
|
case TYPEDRAWSEGMENT:
|
|
|
|
|
#undef STRUCT
|
|
|
|
|
#define STRUCT ( (DRAWSEGMENT*) PtStruct )
|
|
|
|
|
if( !blocklocate.Inside( STRUCT->m_Start.x, STRUCT->m_Start.y ) )
|
|
|
|
|
return NULL;
|
|
|
|
|
if( !blocklocate.Inside( STRUCT->m_End.x, STRUCT->m_End.y ) )
|
|
|
|
|
return NULL;
|
|
|
|
|
return PtStruct;
|
|
|
|
|
|
|
|
|
|
case TYPETEXTE:
|
|
|
|
|
#undef STRUCT
|
|
|
|
|
#define STRUCT ( (TEXTE_PCB*) PtStruct )
|
|
|
|
|
if( !blocklocate.Inside( STRUCT->m_Pos.x, STRUCT->m_Pos.y ) )
|
|
|
|
|
return NULL;
|
|
|
|
|
return PtStruct;
|
|
|
|
|
|
|
|
|
|
case TYPEMIRE:
|
|
|
|
|
#undef STRUCT
|
|
|
|
|
#define STRUCT ( (MIREPCB*) PtStruct )
|
|
|
|
|
if( !blocklocate.Inside( STRUCT->m_Pos.x, STRUCT->m_Pos.y ) )
|
|
|
|
|
return NULL;
|
|
|
|
|
return PtStruct;
|
|
|
|
|
|
|
|
|
|
case TYPECOTATION:
|
|
|
|
|
#undef STRUCT
|
|
|
|
|
#define STRUCT ( (COTATION*) PtStruct )
|
|
|
|
|
if( !blocklocate.Inside( STRUCT->m_Pos.x, STRUCT->m_Pos.y ) )
|
|
|
|
|
return NULL;
|
|
|
|
|
return PtStruct;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
static TRACK* IsSegmentInBox( DrawBlockStruct& blocklocate, TRACK* PtSegm )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/**************************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/* Teste si la structure PtStruct est inscrite dans le block selectionne
|
2007-08-20 01:20:48 +00:00
|
|
|
|
* Retourne PtSegm si oui
|
|
|
|
|
* NULL si non
|
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
|
if( blocklocate.Inside( PtSegm->m_Start.x, PtSegm->m_Start.y ) )
|
|
|
|
|
return PtSegm;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
if( blocklocate.Inside( PtSegm->m_End.x, PtSegm->m_End.y ) )
|
|
|
|
|
return PtSegm;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
return NULL;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/****************************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
static MODULE* IsModuleInBox( DrawBlockStruct& blocklocate, MODULE* Module )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/****************************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/* Teste si le Module est inscrit dans le block selectionne
|
2007-08-20 01:20:48 +00:00
|
|
|
|
* Retourne Module si oui
|
|
|
|
|
* NULL si non
|
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
|
bool is_out_of_box = FALSE;
|
|
|
|
|
|
|
|
|
|
Module->SetRectangleExinscrit();
|
|
|
|
|
|
|
|
|
|
if( Module->m_RealBoundaryBox.m_Pos.x < blocklocate.GetX() )
|
|
|
|
|
is_out_of_box = TRUE;
|
|
|
|
|
if( Module->m_RealBoundaryBox.m_Pos.y < blocklocate.GetY() )
|
|
|
|
|
is_out_of_box = TRUE;
|
|
|
|
|
if( Module->m_RealBoundaryBox.GetRight() > blocklocate.GetRight() )
|
|
|
|
|
is_out_of_box = TRUE;
|
|
|
|
|
if( Module->m_RealBoundaryBox.GetBottom() > blocklocate.GetBottom() )
|
|
|
|
|
is_out_of_box = TRUE;
|
|
|
|
|
|
|
|
|
|
if( is_out_of_box )
|
|
|
|
|
return NULL;
|
|
|
|
|
return Module;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|