kicad/pcbnew/block.cpp

1289 lines
40 KiB
C++
Raw Normal View History

/*****************************************************************/
/* 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 "class_drawpanel.h"
#include "confirm.h"
#include "block_commande.h"
2007-05-06 16:03:28 +00:00
#include "pcbnew.h"
#include "autorout.h"
#include "pcbplot.h"
#include "trigo.h"
#include "protos.h"
#define BLOCK_COLOR BROWN
/* Routines Locales */
static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
2007-05-06 16:03:28 +00:00
/* Variables locales :*/
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;
static bool Block_Include_PcbTextes = TRUE;
2007-05-06 16:03:28 +00:00
/************************************/
/* class WinEDA_ExecBlockCmdFrame */
/************************************/
2007-05-06 16:03:28 +00:00
class WinEDA_ExecBlockCmdFrame : public wxDialog
2007-05-06 16:03:28 +00:00
{
private:
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:
// Constructor and destructor
WinEDA_ExecBlockCmdFrame( WinEDA_BasePcbFrame* parent,
const wxString& title );
2007-09-01 12:00:30 +00:00
~WinEDA_ExecBlockCmdFrame()
{
}
2007-05-06 16:03:28 +00:00
private:
void ExecuteCommand( wxCommandEvent& event );
void Cancel( wxCommandEvent& event );
2007-05-06 16:03:28 +00:00
DECLARE_EVENT_TABLE()
2007-05-06 16:03:28 +00:00
};
BEGIN_EVENT_TABLE( WinEDA_ExecBlockCmdFrame, wxDialog )
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()
/**************************************************************/
static bool InstallBlockCmdFrame( WinEDA_BasePcbFrame* parent,
const wxString& title )
2007-05-06 16:03:28 +00:00
/**************************************************************/
{
int nocmd;
wxPoint oldpos = parent->GetScreen()->m_Curseur;
2007-05-06 16:03:28 +00:00
parent->DrawPanel->m_IgnoreMouseEvents = TRUE;
WinEDA_ExecBlockCmdFrame* frame = new WinEDA_ExecBlockCmdFrame( parent, title );
2008-04-01 05:21:50 +00:00
nocmd = frame->ShowModal();
2007-10-13 06:18:44 +00:00
frame->Destroy();
2008-04-01 05:21:50 +00:00
2007-10-13 06:18:44 +00:00
parent->GetScreen()->m_Curseur = oldpos;
2008-04-01 05:21:50 +00:00
parent->DrawPanel->MouseToCursorSchema();
parent->DrawPanel->m_IgnoreMouseEvents = FALSE;
2007-05-06 16:03:28 +00:00
parent->DrawPanel->SetCursor(
parent->DrawPanel->m_PanelCursor = parent->DrawPanel->m_PanelDefaultCursor );
2007-05-06 16:03:28 +00:00
return nocmd ? FALSE : TRUE;
2007-05-06 16:03:28 +00:00
}
/******************************************************************************/
WinEDA_ExecBlockCmdFrame::WinEDA_ExecBlockCmdFrame( WinEDA_BasePcbFrame* parent,
const wxString& title ) :
wxDialog( parent, -1, title, wxPoint( -1, -1 ), wxDefaultSize,
DIALOG_STYLE )
2007-05-06 16:03:28 +00:00
/******************************************************************************/
{
wxPoint pos;
wxButton* m_button1;
wxButton* m_button2;
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 ) );
/* Sizer 1 creation */
wxFlexGridSizer* fgSizer1;
fgSizer1 = new wxFlexGridSizer( 1, 1, 0, 0 );
fgSizer1->SetFlexibleDirection( wxBOTH );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
2008-04-01 05:21:50 +00:00
// Selection des options :
m_Include_Modules = new wxCheckBox( this, -1, _( "Include Modules" ), wxDefaultPosition, wxDefaultSize, 0 );
m_Include_Modules->SetValue( Block_Include_Modules );
fgSizer1->Add( m_Include_Modules, 0, wxALL, 5 );
m_Include_Tracks = new wxCheckBox( this, -1, _( "Include tracks" ), wxDefaultPosition, wxDefaultSize, 0 );
m_Include_Tracks->SetValue( Block_Include_Tracks );
fgSizer1->Add( m_Include_Tracks, 0, wxALL, 5 );
m_Include_Zones = new wxCheckBox( this, -1, _( "Include zones" ), wxDefaultPosition, wxDefaultSize, 0 );
m_Include_Zones->SetValue( Block_Include_Zones );
fgSizer1->Add( m_Include_Zones, 0, wxALL, 5 );
m_Include_PcbTextes = new wxCheckBox( this, -1,
_( "Include Text on copper layers" ), wxDefaultPosition, wxDefaultSize, 0 );
m_Include_PcbTextes->SetValue( Block_Include_PcbTextes );
fgSizer1->Add( m_Include_PcbTextes, 0, wxALL, 5 );
m_Include_Draw_Items = new wxCheckBox( this, -1, _( "Include drawings" ), wxDefaultPosition, wxDefaultSize, 0 );
m_Include_Draw_Items->SetValue( Block_Include_Draw_Items );
fgSizer1->Add( m_Include_Draw_Items, 0, wxALL, 5 );
m_Include_Edges_Items = new wxCheckBox( this, -1, _( "Include board outline layer" ), wxDefaultPosition, wxDefaultSize, 0 );
m_Include_Edges_Items->SetValue( Block_Include_Edges_Items );
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 );
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-05-06 16:03:28 +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
}
/*******************************************************************/
void WinEDA_ExecBlockCmdFrame::ExecuteCommand( wxCommandEvent& event )
2007-05-06 16:03:28 +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
}
/*************************************************/
int WinEDA_PcbFrame::ReturnBlockCommand( int key )
2007-05-06 16:03:28 +00:00
/*************************************************/
2007-05-06 16:03:28 +00:00
/* Return the block command (BLOCK_MOVE, BLOCK_COPY...) corresponding to
* the key (ALT, SHIFT ALT ..)
*/
2007-05-06 16:03:28 +00:00
{
int cmd = 0;
2007-05-06 16:03:28 +00:00
switch( key )
{
default:
cmd = key & 0x255;
break;
2007-05-06 16:03:28 +00:00
case 0:
cmd = BLOCK_MOVE;
break;
2007-05-06 16:03:28 +00:00
case GR_KB_SHIFT:
cmd = BLOCK_COPY;
break;
2007-05-06 16:03:28 +00:00
case GR_KB_CTRL:
cmd = BLOCK_ROTATE;
break;
2007-05-06 16:03:28 +00:00
case GR_KB_SHIFTCTRL:
cmd = BLOCK_DELETE;
break;
2007-05-06 16:03:28 +00:00
case GR_KB_ALT:
cmd = BLOCK_INVERT;
break;
2007-05-06 16:03:28 +00:00
case MOUSE_MIDDLE:
cmd = BLOCK_ZOOM;
break;
}
2007-05-06 16:03:28 +00:00
return cmd;
2007-05-06 16:03:28 +00:00
}
/*****************************************************/
void WinEDA_PcbFrame::HandleBlockPlace( wxDC* DC )
2007-05-06 16:03:28 +00:00
/*****************************************************/
/* Routine to handle the BLOCK PLACE commande */
{
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-05-06 16:03:28 +00:00
/**********************************************/
int WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
2007-05-06 16:03:28 +00:00
/**********************************************/
2007-05-06 16:03:28 +00:00
/* Routine de gestion de la commande BLOCK END
* 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
{
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);
}
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
}
/**************************************************************************/
static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
2007-05-06 16:03:28 +00:00
/**************************************************************************/
2007-05-06 16:03:28 +00:00
/* Retrace le contour du block de repositionnement des structures a d<>placer
*/
{
int Color;
BASE_SCREEN* screen = panel->GetScreen();
2008-04-01 05:21:50 +00:00
Color = YELLOW;
2007-09-11 04:14:47 +00:00
GRSetDrawMode( DC, g_XorMode );
/* 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( screen->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
}
/************************************************/
void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
2007-05-06 16:03:28 +00:00
/************************************************/
2007-05-06 16:03:28 +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;
int masque_layer;
if( !InstallBlockCmdFrame( this, _( "Delete Block" ) ) )
return;
GetScreen()->SetModify();
GetScreen()->BlockLocate.Normalize();
SetCurItem( NULL );
/* Effacement des modules */
if( Block_Include_Modules )
{
MODULE* module;
module = m_Pcb->m_Modules;
for( ; module != NULL; module = (MODULE*) NextS )
{
2007-08-23 04:28:46 +00:00
NextS = module->Next();
2008-01-06 12:43:57 +00:00
if( module->HitTest( GetScreen()->BlockLocate ) )
2008-04-01 05:21:50 +00:00
{
module->m_Flags = 0;
module->DeleteStructure();
m_Pcb->m_Status_Pcb = 0;
}
}
}
/* Effacement des Pistes */
if( Block_Include_Tracks )
{
TRACK* pt_segm;
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();
2008-01-06 12:43:57 +00:00
if( pt_segm->HitTest( GetScreen()->BlockLocate ) )
2008-04-01 05:21:50 +00:00
{
2007-08-23 04:28:46 +00:00
/* la piste est ici bonne a etre efface */
pt_segm->DeleteStructure();
}
}
}
/* Effacement des Elements De Dessin */
masque_layer = EDGE_LAYER;
if( Block_Include_Draw_Items )
masque_layer = ALL_LAYERS;
2008-04-01 05:21:50 +00:00
if( !Block_Include_Edges_Items )
masque_layer &= ~EDGE_LAYER;
PtStruct = m_Pcb->m_Drawings;
for( ; PtStruct != NULL; PtStruct = NextS )
{
2007-08-23 04:28:46 +00:00
NextS = PtStruct->Next();
2007-09-01 12:00:30 +00:00
switch( PtStruct->Type() )
{
case TYPE_DRAWSEGMENT:
2008-04-01 06:07:00 +00:00
if( (g_TabOneLayerMask[PtStruct->GetLayer()] & masque_layer) == 0 )
break;
2008-01-06 12:43:57 +00:00
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
break;
2008-04-01 06:07:00 +00:00
/* l'element est ici bon a etre efface */
2008-04-01 06:32:48 +00:00
PtStruct->Draw( DrawPanel, DC, GR_XOR );
PtStruct->DeleteStructure();
break;
case TYPE_TEXTE:
if( !Block_Include_PcbTextes )
break;
2008-01-06 12:43:57 +00:00
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
break;
/* le texte est ici bon a etre efface */
2008-04-01 05:21:50 +00:00
PtStruct->Draw( DrawPanel, DC, GR_XOR );
/* Suppression du texte en Memoire*/
PtStruct->DeleteStructure();
break;
case TYPE_MIRE:
2008-04-01 06:07:00 +00:00
if( (g_TabOneLayerMask[PtStruct->GetLayer()] & masque_layer) == 0 )
break;
2008-01-06 12:43:57 +00:00
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
break;
/* l'element est ici bon a etre efface */
PtStruct->DeleteStructure();
break;
case TYPE_COTATION:
2008-04-01 06:07:00 +00:00
if( (g_TabOneLayerMask[PtStruct->GetLayer()] & masque_layer) == 0 )
break;
2008-01-06 12:43:57 +00:00
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
break;
PtStruct->DeleteStructure();
break;
default:
break;
}
}
/* Effacement des Zones */
if( Block_Include_Zones )
{
SEGZONE* pt_segm, *NextSegZ;
Affiche_Message( _( "Delete zones" ) );
for( pt_segm = m_Pcb->m_Zone; pt_segm != NULL; pt_segm = NextSegZ )
{
NextSegZ = pt_segm->Next();
2008-01-08 13:36:05 +00:00
if( pt_segm->HitTest( GetScreen()->BlockLocate ) )
2008-04-01 05:21:50 +00:00
{
pt_segm->DeleteStructure();
}
}
2008-04-01 05:21:50 +00:00
for ( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
{
2008-01-06 17:19:36 +00:00
if( m_Pcb->GetArea(ii)->HitTest( GetScreen()->BlockLocate ) )
2008-04-01 05:21:50 +00:00
{
m_Pcb->Delete(m_Pcb->GetArea(ii));
ii--; // because the current data was removed, ii points actually the next data
}
}
}
2008-01-06 12:43:57 +00:00
DrawPanel->Refresh( TRUE );
if( g_Show_Ratsnest )
Compile_Ratsnest( DC, TRUE );
2008-04-01 05:21:50 +00:00
else
{
m_Pcb->m_Status_Pcb = 0; /* we need (later) a full ratnest computation */
build_liste_pads();
}
2007-05-06 16:03:28 +00:00
}
/****************************************************/
void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
2007-05-06 16:03:28 +00:00
/****************************************************/
2008-01-06 12:43:57 +00:00
/**
* Function Block_Rotate
* Rotate 90 deg the selected block
* The rotation centre is the centre of the block
*/
2007-05-06 16:03:28 +00:00
{
MODULE* module;
EDA_BaseStruct* PtStruct;
int masque_layer;
wxPoint oldpos;
2008-01-06 12:43:57 +00:00
wxPoint centre; /* rotation centre for the rotation transform */
if( !InstallBlockCmdFrame( this, _( "Rotate Block" ) ) )
return;
oldpos = GetScreen()->m_Curseur;
GetScreen()->BlockLocate.Normalize();
2008-01-06 12:43:57 +00:00
centre = GetScreen()->BlockLocate.Centre(); // This is the rotation centre
GetScreen()->SetModify();
/* Rotation des modules */
if( Block_Include_Modules )
{
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->Next() )
{
2008-01-06 12:43:57 +00:00
if( ! module->HitTest( GetScreen()->BlockLocate ) )
continue;
m_Pcb->m_Status_Pcb = 0;
module->m_Flags = 0;
2008-01-06 12:43:57 +00:00
/* Move the footprint before rotate it */
RotatePoint( &module->m_Pos, centre, 900 );
GetScreen()->m_Curseur = module->m_Pos;
Place_Module( module, NULL );
/* Rotate the footprint */
Rotate_Module( DC, module, Angle_Rot_Module, TRUE );
}
/* regeneration des valeurs originelles */
GetScreen()->m_Curseur = oldpos;
g_Show_Ratsnest = Show_Ratsnest_tmp;
}
2008-01-06 12:43:57 +00:00
/* Move and rotate the track segments */
if( Block_Include_Tracks )
{
TRACK* track;
track = m_Pcb->m_Track;
while( track )
{
2008-01-06 12:43:57 +00:00
if( track->HitTest( GetScreen()->BlockLocate ) )
{ /* la piste est ici bonne a etre deplacee */
m_Pcb->m_Status_Pcb = 0;
2008-01-06 12:43:57 +00:00
RotatePoint( &track->m_Start, centre, 900 );
RotatePoint( &track->m_End, centre, 900 );
}
track = track->Next();
}
}
2008-01-06 12:43:57 +00:00
/* Move and rotate the zone fill segments, and outlines */
if( Block_Include_Zones )
{
TRACK* track;
Affiche_Message( _( "Zone rotation" ) );
track = (TRACK*) m_Pcb->m_Zone;
while( track )
{
2008-01-06 12:43:57 +00:00
if( track->HitTest( GetScreen()->BlockLocate ) )
2008-04-01 05:21:50 +00:00
{
2008-01-06 12:43:57 +00:00
RotatePoint( &track->m_Start, centre, 900 );
RotatePoint( &track->m_End, centre, 900 );
}
track = track->Next();
}
2008-04-01 05:21:50 +00:00
for ( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
{
2008-01-06 17:19:36 +00:00
if( m_Pcb->GetArea(ii)->HitTest( GetScreen()->BlockLocate ) )
2008-04-01 05:21:50 +00:00
{
m_Pcb->GetArea(ii)->Rotate(centre, 900);
}
}
}
masque_layer = EDGE_LAYER;
if( Block_Include_Draw_Items )
masque_layer = ALL_LAYERS;
if( !Block_Include_Edges_Items )
masque_layer &= ~EDGE_LAYER;
2008-01-06 12:43:57 +00:00
/* Move and rotate the graphic items */
PtStruct = m_Pcb->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
{
2007-09-01 12:00:30 +00:00
switch( PtStruct->Type() )
{
case TYPE_DRAWSEGMENT:
#undef STRUCT
#define STRUCT ( (DRAWSEGMENT*) PtStruct )
2007-08-23 04:28:46 +00:00
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
2008-01-06 12:43:57 +00:00
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
break;
2008-01-06 12:43:57 +00:00
RotatePoint( &STRUCT->m_Start, centre, 900 );
RotatePoint( &STRUCT->m_End, centre, 900 );
break;
case TYPE_TEXTE:
#undef STRUCT
#define STRUCT ( (TEXTE_PCB*) PtStruct )
if( !Block_Include_PcbTextes )
break;
2008-01-06 12:43:57 +00:00
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
break;
2008-01-06 12:43:57 +00:00
RotatePoint( &STRUCT->m_Pos, centre, 900 );
STRUCT->m_Orient += 900;
if( STRUCT->m_Orient >= 3600 )
STRUCT->m_Orient -= 3600;
break;
case TYPE_MIRE:
#undef STRUCT
#define STRUCT ( (MIREPCB*) PtStruct )
2007-08-23 04:28:46 +00:00
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
2008-01-06 12:43:57 +00:00
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
break;
/* l'element est ici bon a etre modifie */
2008-01-06 12:43:57 +00:00
RotatePoint( &STRUCT->m_Pos, centre, 900 );
break;
case TYPE_COTATION:
#undef STRUCT
#define STRUCT ( (COTATION*) PtStruct )
2007-08-23 04:28:46 +00:00
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
2008-01-06 12:43:57 +00:00
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
break;
2008-01-06 12:43:57 +00:00
STRUCT->Rotate(centre, 900);
break;
default:
break;
}
}
2008-01-06 12:43:57 +00:00
DrawPanel->Refresh( TRUE );
if( g_Show_Ratsnest )
Compile_Ratsnest( DC, TRUE );
2007-05-06 16:03:28 +00:00
}
/*****************************************************/
void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
2007-05-06 16:03:28 +00:00
/*****************************************************/
2007-05-06 16:03:28 +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
*/
2008-01-06 12:43:57 +00:00
{
#define INVERT( pos ) (pos) = centerY - ( (pos) - centerY )
#define INVERT_ANGLE( phi ) (phi) = -(phi)
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;
module = m_Pcb->m_Modules;
for( ; module != NULL; module = module->Next() )
{
2008-01-06 12:43:57 +00:00
if( ! module->HitTest( GetScreen()->BlockLocate ) )
continue;
/* le module est ici bon a etre efface */
m_Pcb->m_Status_Pcb = 0;
module->m_Flags = 0;
/* 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;
2008-01-06 12:43:57 +00:00
Place_Module( module, NULL );
/* inversion du module */
m_Pcb->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;
track = m_Pcb->m_Track;
while( track )
{
2008-01-06 12:43:57 +00:00
if( track->HitTest( GetScreen()->BlockLocate ) )
{ /* la piste est ici bonne a etre deplacee */
m_Pcb->m_Status_Pcb = 0;
INVERT( track->m_Start.y );
INVERT( track->m_End.y );
if( track->Type() != TYPE_VIA )
{
2007-08-23 04:28:46 +00:00
track->SetLayer( ChangeSideNumLayer( track->GetLayer() ) );
}
}
track = track->Next();
}
}
/* Deplacement des Segments de Zone */
if( Block_Include_Zones )
{
TRACK* track;
track = (TRACK*) m_Pcb->m_Zone;
while( track )
{
2008-01-06 12:43:57 +00:00
if( track->HitTest( GetScreen()->BlockLocate ) )
{ /* la piste est ici bonne a etre deplacee */
INVERT( track->m_Start.y );
INVERT( track->m_End.y );
2007-08-23 04:28:46 +00:00
track->SetLayer( ChangeSideNumLayer( track->GetLayer() ) );
}
track = track->Next();
}
2008-04-01 05:21:50 +00:00
for ( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
{
2008-01-06 17:19:36 +00:00
if( m_Pcb->GetArea(ii)->HitTest( GetScreen()->BlockLocate ) )
2008-04-01 05:21:50 +00:00
{
m_Pcb->GetArea(ii)->Mirror( wxPoint(0, centerY) );
2008-01-06 17:19:36 +00:00
m_Pcb->GetArea(ii)->SetLayer( ChangeSideNumLayer( m_Pcb->GetArea(ii)->GetLayer() ) );
2008-04-01 05:21:50 +00:00
}
}
}
masque_layer = EDGE_LAYER;
if( Block_Include_Draw_Items )
masque_layer = ALL_LAYERS;
if( !Block_Include_Edges_Items )
masque_layer &= ~EDGE_LAYER;
PtStruct = m_Pcb->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
{
2007-09-01 12:00:30 +00:00
switch( PtStruct->Type() )
{
case TYPE_DRAWSEGMENT:
#undef STRUCT
#define STRUCT ( (DRAWSEGMENT*) PtStruct )
2007-08-23 04:28:46 +00:00
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
2008-01-06 12:43:57 +00:00
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
break;
/* l'element est ici bon a etre selectionne */
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() ) );
break;
case TYPE_TEXTE:
#undef STRUCT
#define STRUCT ( (TEXTE_PCB*) PtStruct )
if( !Block_Include_PcbTextes )
break;
2008-01-06 12:43:57 +00:00
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
break;
/* le texte est ici bon a etre selectionne*/
INVERT( STRUCT->m_Pos.y );
INVERT_ANGLE( STRUCT->m_Orient );
if( (STRUCT->GetLayer() == COPPER_LAYER_N) || (STRUCT->GetLayer() == CMP_N) )
{
STRUCT->m_Mirror = not STRUCT->m_Mirror; /* inverse miroir */
}
2007-08-23 04:28:46 +00:00
STRUCT->SetLayer( ChangeSideNumLayer( STRUCT->GetLayer() ) );
break;
case TYPE_MIRE:
#undef STRUCT
#define STRUCT ( (MIREPCB*) PtStruct )
2007-08-23 04:28:46 +00:00
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
2008-01-06 12:43:57 +00:00
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
break;
/* l'element est ici bon a etre modifie */
INVERT( STRUCT->m_Pos.y );
2007-08-23 04:28:46 +00:00
STRUCT->SetLayer( ChangeSideNumLayer( STRUCT->GetLayer() ) );
break;
case TYPE_COTATION:
#undef STRUCT
#define STRUCT ( (COTATION*) PtStruct )
2007-08-23 04:28:46 +00:00
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
2008-01-06 12:43:57 +00:00
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
break;
/* l'element est ici bon a etre modifie */
2008-04-01 05:21:50 +00:00
STRUCT->Mirror( wxPoint(0, centerY) );
2007-08-23 04:28:46 +00:00
STRUCT->SetLayer( ChangeSideNumLayer( STRUCT->GetLayer() ) );
break;
default:
break;
}
}
2008-01-06 12:43:57 +00:00
DrawPanel->Refresh( TRUE );
if( g_Show_Ratsnest )
Compile_Ratsnest( DC, TRUE );
2007-05-06 16:03:28 +00:00
}
/************************************************/
void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
2007-05-06 16:03:28 +00:00
/************************************************/
2007-05-06 16:03:28 +00:00
/*
* Function to move items withing the selected block
*/
2007-05-06 16:03:28 +00:00
{
int masque_layer;
wxPoint oldpos;
2008-01-06 12:43:57 +00:00
wxPoint MoveVector = GetScreen()->BlockLocate.m_MoveVector;
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;
oldpos = GetScreen()->m_Curseur;
for( MODULE* module = m_Pcb->m_Modules; module; module = module->Next() )
{
2008-01-06 12:43:57 +00:00
if( ! module->HitTest( GetScreen()->BlockLocate ) )
continue;
/* le module est ici bon a etre deplace */
m_Pcb->m_Status_Pcb = 0;
module->m_Flags = 0;
2008-01-06 12:43:57 +00:00
GetScreen()->m_Curseur = module->m_Pos + MoveVector;
Place_Module( module, NULL );
}
GetScreen()->m_Curseur = oldpos;
g_Show_Ratsnest = Show_Ratsnest_tmp;
}
/* Deplacement des Segments de piste */
if( Block_Include_Tracks )
{
for( TRACK* track = m_Pcb->m_Track; track; track = track->Next() )
{
2008-01-06 12:43:57 +00:00
if( track->HitTest( GetScreen()->BlockLocate ) )
{ /* la piste est ici bonne a etre deplacee */
m_Pcb->m_Status_Pcb = 0;
2008-01-06 12:43:57 +00:00
track->m_Start += MoveVector;
track->m_End += MoveVector;
}
}
}
/* Deplacement des Segments de Zone */
if( Block_Include_Zones )
{
for( TRACK* track = m_Pcb->m_Zone; track; track = track->Next() )
{
2008-01-06 12:43:57 +00:00
if( track->HitTest( GetScreen()->BlockLocate ) )
{ /* la piste est ici bonne a etre deplacee */
2008-01-06 12:43:57 +00:00
track->m_Start += MoveVector;
track->m_End += MoveVector;
}
}
2008-04-01 05:21:50 +00:00
for ( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
{
2008-01-06 17:19:36 +00:00
if( m_Pcb->GetArea(ii)->HitTest( GetScreen()->BlockLocate ) )
2008-04-01 05:21:50 +00:00
{
m_Pcb->GetArea(ii)->Move( MoveVector );
}
}
}
masque_layer = EDGE_LAYER;
if( Block_Include_Draw_Items )
masque_layer = ALL_LAYERS;
if( !Block_Include_Edges_Items )
masque_layer &= ~EDGE_LAYER;
for( BOARD_ITEM* item = m_Pcb->m_Drawings; item; item = item->Next() )
{
switch( item->Type() )
{
case TYPE_DRAWSEGMENT:
#undef STRUCT
#define STRUCT ( (DRAWSEGMENT*) item )
2007-08-23 04:28:46 +00:00
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
if( ! item->HitTest( GetScreen()->BlockLocate ) )
break;
/* l'element est ici bon a etre efface */
2008-04-01 05:21:50 +00:00
STRUCT->m_Start += MoveVector;
2008-01-06 12:43:57 +00:00
STRUCT->m_End += MoveVector;
break;
case TYPE_TEXTE:
#undef STRUCT
#define STRUCT ( (TEXTE_PCB*) item )
if( !Block_Include_PcbTextes )
break;
if( ! item->HitTest( GetScreen()->BlockLocate ) )
break;
/* le texte est ici bon a etre deplace */
/* Redessin du Texte */
2008-01-06 12:43:57 +00:00
STRUCT->m_Pos += MoveVector;
break;
case TYPE_MIRE:
#undef STRUCT
#define STRUCT ( (MIREPCB*) item )
2007-08-23 04:28:46 +00:00
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
if( ! item->HitTest( GetScreen()->BlockLocate ) )
break;
/* l'element est ici bon a etre efface */
2008-01-06 12:43:57 +00:00
STRUCT->m_Pos += MoveVector;
break;
case TYPE_COTATION:
#undef STRUCT
#define STRUCT ( (COTATION*) item )
2007-08-23 04:28:46 +00:00
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
if( ! item->HitTest( GetScreen()->BlockLocate ) )
break;
/* l'element est ici bon a etre efface */
( (COTATION*) item )->Move( wxPoint(MoveVector) );
break;
default:
break;
}
}
2008-01-06 12:43:57 +00:00
DrawPanel->Refresh( TRUE );
if( g_Show_Ratsnest )
Compile_Ratsnest( DC, TRUE );
2007-05-06 16:03:28 +00:00
}
/**************************************************/
void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
2007-05-06 16:03:28 +00:00
/**************************************************/
2007-05-06 16:03:28 +00:00
/*
* routine de duplication des elements du block deja selectionne
*/
2007-05-06 16:03:28 +00:00
{
int masque_layer;
wxPoint oldpos;
2008-04-01 05:21:50 +00:00
wxPoint MoveVector = GetScreen()->BlockLocate.m_MoveVector;
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 )
{
2008-01-06 12:43:57 +00:00
bool Show_Ratsnest_tmp = g_Show_Ratsnest;
2008-04-01 05:21:50 +00:00
g_Show_Ratsnest = false;
oldpos = GetScreen()->m_Curseur;
for( MODULE* module= m_Pcb->m_Modules; module; module = module->Next() )
{
MODULE* new_module;
2008-01-06 12:43:57 +00:00
if( ! module->HitTest( GetScreen()->BlockLocate ) )
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();
m_Pcb->m_Modules.PushFront( new_module );
2008-04-01 05:21:50 +00:00
GetScreen()->m_Curseur = module->m_Pos + MoveVector;
Place_Module( new_module, DC );
}
GetScreen()->m_Curseur = oldpos;
g_Show_Ratsnest = Show_Ratsnest_tmp;
}
/* Deplacement des Segments de piste */
if( Block_Include_Tracks )
{
TRACK* track, * next_track, * new_track;
track = m_Pcb->m_Track;
while( track )
{
next_track = track->Next();
2008-01-06 12:43:57 +00:00
if( track->HitTest( GetScreen()->BlockLocate ) )
2008-04-01 05:21:50 +00:00
{
2007-09-11 04:14:47 +00:00
/* la piste est ici bonne a etre deplacee */
m_Pcb->m_Status_Pcb = 0;
2007-09-11 04:14:47 +00:00
new_track = track->Copy();
m_Pcb->m_Track.PushFront( new_track );
2008-01-06 12:43:57 +00:00
new_track->m_Start += MoveVector;
new_track->m_End += MoveVector;
new_track->Draw( DrawPanel, DC, GR_OR ); // reaffichage
}
track = next_track;
}
}
2008-01-06 12:43:57 +00:00
/* Duplicate Zones */
if( Block_Include_Zones )
{
for( SEGZONE* segzone = m_Pcb->m_Zone; segzone; segzone = segzone->Next() )
{
2008-01-06 12:43:57 +00:00
if( segzone->HitTest( GetScreen()->BlockLocate ) )
2008-04-01 05:21:50 +00:00
{
SEGZONE* new_segzone = (SEGZONE*) segzone->Copy();
m_Pcb->m_Zone.PushFront( new_segzone );
2008-01-06 12:43:57 +00:00
new_segzone->m_Start += MoveVector;
new_segzone->m_End += MoveVector;
2008-01-06 17:19:36 +00:00
new_segzone->Draw( DrawPanel, DC, GR_OR );
}
}
2008-01-06 12:43:57 +00:00
2008-04-01 05:21:50 +00:00
unsigned imax = m_Pcb->GetAreaCount();
for ( unsigned ii = 0; ii < imax; ii++ )
{
2008-01-06 17:19:36 +00:00
if( m_Pcb->GetArea(ii)->HitTest( GetScreen()->BlockLocate ) )
2008-04-01 05:21:50 +00:00
{
ZONE_CONTAINER * new_zone = new ZONE_CONTAINER(m_Pcb);
new_zone->Copy( m_Pcb->GetArea(ii) );
new_zone->m_TimeStamp = GetTimeStamp();
new_zone->Move( MoveVector );
m_Pcb->Add(new_zone);
new_zone->Draw( DrawPanel, DC, GR_OR );
}
}
}
masque_layer = EDGE_LAYER;
if( Block_Include_Draw_Items )
masque_layer = ALL_LAYERS;
if( !Block_Include_Edges_Items )
masque_layer &= ~EDGE_LAYER;
for( BOARD_ITEM* item = m_Pcb->m_Drawings; item; item = item->Next() )
{
switch( item->Type() )
{
case TYPE_DRAWSEGMENT:
{
#undef STRUCT
#define STRUCT ( (DRAWSEGMENT*) item )
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
if( ! item->HitTest( GetScreen()->BlockLocate ) )
break;
2008-04-01 05:21:50 +00:00
/* l'element est ici bon a etre copie */
DRAWSEGMENT* new_drawsegment = new DRAWSEGMENT( m_Pcb );
new_drawsegment->Copy( STRUCT );
m_Pcb->Add( new_drawsegment );
new_drawsegment->m_Start += MoveVector;
new_drawsegment->m_End += MoveVector;
new_drawsegment->Draw( DrawPanel, DC, GR_OR );
}
break;
case TYPE_TEXTE:
{
#undef STRUCT
#define STRUCT ( (TEXTE_PCB*) item )
if( !Block_Include_PcbTextes )
break;
if( ! item->HitTest( GetScreen()->BlockLocate ) )
break;
/* le texte est ici bon a etre deplace */
TEXTE_PCB* new_pcbtext = new TEXTE_PCB( m_Pcb );
new_pcbtext->Copy( STRUCT );
m_Pcb->Add( new_pcbtext );
/* Redessin du Texte */
new_pcbtext->m_Pos += MoveVector;
new_pcbtext->Draw( DrawPanel, DC, GR_OR );
}
break;
case TYPE_MIRE:
{
#undef STRUCT
#define STRUCT ( (MIREPCB*) item )
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
if( ! item->HitTest( GetScreen()->BlockLocate ) )
break;
/* l'element est ici bon a etre efface */
MIREPCB* new_mire = new MIREPCB( m_Pcb );
new_mire->Copy( STRUCT );
m_Pcb->Add( new_mire );
new_mire->m_Pos += MoveVector;
new_mire->Draw( DrawPanel, DC, GR_OR );
}
break;
case TYPE_COTATION:
{
#undef STRUCT
#define STRUCT ( (COTATION*) item )
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
if( ! item->HitTest( GetScreen()->BlockLocate ) )
break;
/* l'element est ici bon a etre copie */
COTATION* new_cotation = new COTATION( m_Pcb );
new_cotation->Copy( STRUCT );
m_Pcb->Add( new_cotation );
new_cotation->Move( MoveVector );
new_cotation->Draw( DrawPanel, DC, GR_OR );
}
break;
default:
break;
}
}
2007-05-06 16:03:28 +00:00
}