2009-11-09 14:00:22 +00:00
|
|
|
/**********************************************************/
|
|
|
|
/* Block operations: displacement, rotation, deletion ... */
|
|
|
|
/**********************************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-09-28 14:42:05 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KICAD, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 1992-2010 <Jean-Pierre Charras>
|
|
|
|
* Copyright (C) 1992-2010 Kicad Developers, see change_log.txt for contributors.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "gr_basic.h"
|
|
|
|
#include "common.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "class_drawpanel.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "trigo.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "confirm.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "gerbview.h"
|
2010-09-28 14:42:05 +00:00
|
|
|
#include "class_gerber_draw_item.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
#define BLOCK_COLOR BROWN
|
|
|
|
|
|
|
|
|
2011-02-03 19:27:28 +00:00
|
|
|
static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
|
|
|
|
bool erase );
|
2007-06-05 12:10:51 +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 ..)
|
|
|
|
*/
|
2009-11-09 14:00:22 +00:00
|
|
|
int WinEDA_GerberFrame::ReturnBlockCommand( int key )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
int cmd = 0;
|
|
|
|
|
|
|
|
switch( key )
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
cmd = key & 0x255;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 0:
|
|
|
|
cmd = BLOCK_MOVE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GR_KB_SHIFT:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GR_KB_CTRL:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GR_KB_SHIFTCTRL:
|
|
|
|
cmd = BLOCK_DELETE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GR_KB_ALT:
|
|
|
|
cmd = BLOCK_COPY;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MOUSE_MIDDLE:
|
|
|
|
cmd = BLOCK_ZOOM;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return cmd;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-09 14:00:22 +00:00
|
|
|
/* Routine to handle the BLOCK PLACE command */
|
2007-08-20 01:20:48 +00:00
|
|
|
void WinEDA_GerberFrame::HandleBlockPlace( wxDC* DC )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2010-11-13 11:02:24 +00:00
|
|
|
bool err = false;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-02-11 20:48:13 +00:00
|
|
|
if( !DrawPanel->IsMouseCaptured() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2010-11-13 11:02:24 +00:00
|
|
|
err = true;
|
2009-11-09 14:00:22 +00:00
|
|
|
DisplayError( this,
|
2011-02-11 20:48:13 +00:00
|
|
|
wxT( "Error in HandleBlockPLace : m_mouseCaptureCallback = NULL" ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2009-07-25 04:53:39 +00:00
|
|
|
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2009-07-25 04:53:39 +00:00
|
|
|
switch( GetScreen()->m_BlockLocate.m_Command )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2009-11-09 14:00:22 +00:00
|
|
|
case BLOCK_IDLE:
|
2010-11-13 11:02:24 +00:00
|
|
|
err = true;
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case BLOCK_DRAG: /* Drag */
|
|
|
|
case BLOCK_MOVE: /* Move */
|
|
|
|
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
|
2011-02-11 20:48:13 +00:00
|
|
|
if( DrawPanel->IsMouseCaptured() )
|
|
|
|
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
Block_Move( DC );
|
2009-07-25 04:53:39 +00:00
|
|
|
GetScreen()->m_BlockLocate.ClearItemsList();
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case BLOCK_COPY: /* Copy */
|
2011-02-11 20:48:13 +00:00
|
|
|
if( DrawPanel->IsMouseCaptured() )
|
|
|
|
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
Block_Duplicate( DC );
|
2009-07-25 04:53:39 +00:00
|
|
|
GetScreen()->m_BlockLocate.ClearItemsList();
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case BLOCK_PASTE:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BLOCK_ZOOM: // Handle by HandleBlockEnd()
|
|
|
|
case BLOCK_ROTATE:
|
2009-08-12 10:40:01 +00:00
|
|
|
case BLOCK_FLIP:
|
2007-08-20 01:20:48 +00:00
|
|
|
case BLOCK_DELETE:
|
|
|
|
case BLOCK_SAVE:
|
|
|
|
case BLOCK_ABORT:
|
|
|
|
case BLOCK_SELECT_ITEMS_ONLY:
|
|
|
|
case BLOCK_MIRROR_X:
|
|
|
|
case BLOCK_MIRROR_Y:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->SetMouseCapture( NULL, NULL );
|
2007-08-20 01:20:48 +00:00
|
|
|
GetScreen()->SetModify();
|
2011-02-11 20:48:13 +00:00
|
|
|
GetScreen()->ClearBlockCommand();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2009-07-25 04:53:39 +00:00
|
|
|
if( GetScreen()->m_BlockLocate.GetCount() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2009-07-25 04:53:39 +00:00
|
|
|
DisplayError( this, wxT( "HandleBlockPLace error: some items left" ) );
|
|
|
|
GetScreen()->m_BlockLocate.ClearItemsList();
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
DisplayToolMsg( wxEmptyString );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2010-11-13 11:02:24 +00:00
|
|
|
/**
|
|
|
|
* Function HandleBlockEnd( )
|
|
|
|
* Handle the "end" of a block command,
|
|
|
|
* i.e. is called at the end of the definition of the area of a block.
|
|
|
|
* depending on the current block command, this command is executed
|
|
|
|
* or parameters are initialized to prepare a call to HandleBlockPlace
|
|
|
|
* in GetScreen()->m_BlockLocate
|
|
|
|
* @return false if no item selected, or command finished,
|
|
|
|
* true if some items found and HandleBlockPlace must be called later
|
2007-08-20 01:20:48 +00:00
|
|
|
*/
|
2010-11-13 11:02:24 +00:00
|
|
|
bool WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2010-11-13 11:02:24 +00:00
|
|
|
bool nextcmd = false;
|
|
|
|
bool zoom_command = false;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-02-11 20:48:13 +00:00
|
|
|
if( DrawPanel->IsMouseCaptured() )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2009-07-25 04:53:39 +00:00
|
|
|
switch( GetScreen()->m_BlockLocate.m_Command )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2009-11-09 14:00:22 +00:00
|
|
|
case BLOCK_IDLE:
|
2007-08-20 01:20:48 +00:00
|
|
|
DisplayError( this, wxT( "Error in HandleBlockPLace" ) );
|
|
|
|
break;
|
|
|
|
|
2009-11-09 14:00:22 +00:00
|
|
|
case BLOCK_DRAG: /* Drag (not used, for future
|
|
|
|
* enhancements) */
|
2007-08-20 01:20:48 +00:00
|
|
|
case BLOCK_MOVE: /* Move */
|
|
|
|
case BLOCK_COPY: /* Copy */
|
2009-11-09 14:00:22 +00:00
|
|
|
case BLOCK_PRESELECT_MOVE: /* Move with preselection list */
|
2009-07-25 04:53:39 +00:00
|
|
|
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
|
2010-11-13 11:02:24 +00:00
|
|
|
nextcmd = true;
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
|
|
|
|
DrawPanel->m_mouseCaptureCallback = DrawMovingBlockOutlines;
|
|
|
|
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case BLOCK_DELETE: /* Delete */
|
2009-07-25 04:53:39 +00:00
|
|
|
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
|
2007-08-20 01:20:48 +00:00
|
|
|
Block_Delete( DC );
|
|
|
|
break;
|
|
|
|
|
2010-09-28 14:42:05 +00:00
|
|
|
case BLOCK_MIRROR_X: /* Mirror, unused*/
|
|
|
|
case BLOCK_ROTATE: /* Unused */
|
|
|
|
case BLOCK_FLIP: /* Flip, unused */
|
|
|
|
case BLOCK_SAVE: /* Save (not used)*/
|
2007-08-20 01:20:48 +00:00
|
|
|
case BLOCK_PASTE:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BLOCK_ZOOM: /* Window Zoom */
|
2010-11-13 11:02:24 +00:00
|
|
|
zoom_command = true;
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case BLOCK_ABORT:
|
|
|
|
case BLOCK_SELECT_ITEMS_ONLY:
|
|
|
|
case BLOCK_MIRROR_Y:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-11-13 11:02:24 +00:00
|
|
|
if( ! nextcmd )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-02-11 20:48:13 +00:00
|
|
|
GetScreen()->ClearBlockCommand();
|
|
|
|
DrawPanel->SetMouseCapture( NULL, NULL );
|
2007-08-20 01:20:48 +00:00
|
|
|
DisplayToolMsg( wxEmptyString );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( zoom_command )
|
2009-07-25 04:53:39 +00:00
|
|
|
Window_Zoom( GetScreen()->m_BlockLocate );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2010-11-13 11:02:24 +00:00
|
|
|
return nextcmd ;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-09 14:00:22 +00:00
|
|
|
/* Traces the outline of the block structures of a repositioning move
|
2007-06-05 12:10:51 +00:00
|
|
|
*/
|
2011-02-03 19:27:28 +00:00
|
|
|
static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPositon,
|
|
|
|
bool aErase )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
int Color;
|
2011-02-03 19:27:28 +00:00
|
|
|
BASE_SCREEN* screen = aPanel->GetScreen();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2009-07-25 04:53:39 +00:00
|
|
|
Color = YELLOW;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-02-03 19:27:28 +00:00
|
|
|
if( aErase )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-02-03 19:27:28 +00:00
|
|
|
screen->m_BlockLocate.Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, Color );
|
|
|
|
|
|
|
|
if( screen->m_BlockLocate.m_MoveVector.x|| screen->m_BlockLocate.m_MoveVector.y )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-02-03 19:27:28 +00:00
|
|
|
screen->m_BlockLocate.Draw( aPanel,
|
|
|
|
aDC,
|
2009-11-09 14:00:22 +00:00
|
|
|
screen->m_BlockLocate.m_MoveVector,
|
|
|
|
g_XorMode,
|
|
|
|
Color );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-03 19:27:28 +00:00
|
|
|
if( screen->m_BlockLocate.m_State != STATE_BLOCK_STOP )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-02-11 20:48:13 +00:00
|
|
|
screen->m_BlockLocate.m_MoveVector.x = screen->GetCrossHairPosition().x -
|
2009-11-09 14:00:22 +00:00
|
|
|
screen->m_BlockLocate.GetRight();
|
2011-02-11 20:48:13 +00:00
|
|
|
screen->m_BlockLocate.m_MoveVector.y = screen->GetCrossHairPosition().y -
|
2009-11-09 14:00:22 +00:00
|
|
|
screen->m_BlockLocate.GetBottom();
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
2011-02-03 19:27:28 +00:00
|
|
|
screen->m_BlockLocate.Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, Color );
|
|
|
|
|
|
|
|
if( screen->m_BlockLocate.m_MoveVector.x || screen->m_BlockLocate.m_MoveVector.y )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-02-03 19:27:28 +00:00
|
|
|
screen->m_BlockLocate.Draw( aPanel,
|
|
|
|
aDC,
|
2009-11-09 14:00:22 +00:00
|
|
|
screen->m_BlockLocate.m_MoveVector,
|
|
|
|
g_XorMode,
|
|
|
|
Color );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2009-11-09 14:00:22 +00:00
|
|
|
* Erase the selected block.
|
2007-08-20 01:20:48 +00:00
|
|
|
*/
|
2009-11-09 14:00:22 +00:00
|
|
|
void WinEDA_GerberFrame::Block_Delete( wxDC* DC )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
if( !IsOK( this, _( "Ok to delete block ?" ) ) )
|
|
|
|
return;
|
|
|
|
|
|
|
|
GetScreen()->SetModify();
|
2009-07-25 04:53:39 +00:00
|
|
|
GetScreen()->m_BlockLocate.Normalize();
|
2007-08-20 01:20:48 +00:00
|
|
|
GetScreen()->SetCurItem( NULL );
|
|
|
|
|
2010-09-28 14:42:05 +00:00
|
|
|
BOARD_ITEM* item = GetBoard()->m_Drawings;
|
|
|
|
BOARD_ITEM* nextitem;
|
|
|
|
for( ; item; item = nextitem )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2010-09-28 14:42:05 +00:00
|
|
|
nextitem = item->Next();
|
|
|
|
GERBER_DRAW_ITEM* gerb_item = (GERBER_DRAW_ITEM*) item;
|
2010-10-10 17:57:54 +00:00
|
|
|
if( gerb_item->HitTest( GetScreen()->m_BlockLocate ) )
|
2010-09-28 14:42:05 +00:00
|
|
|
gerb_item->DeleteStructure();
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
2010-01-22 18:13:43 +00:00
|
|
|
Refresh();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2007-09-13 11:28:58 +00:00
|
|
|
* Function to move items in the current selected block
|
2007-08-20 01:20:48 +00:00
|
|
|
*/
|
2009-11-09 14:00:22 +00:00
|
|
|
void WinEDA_GerberFrame::Block_Move( wxDC* DC )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-06-29 18:51:38 +00:00
|
|
|
wxPoint delta;
|
2007-08-20 01:20:48 +00:00
|
|
|
wxPoint oldpos;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2011-02-11 20:48:13 +00:00
|
|
|
oldpos = GetScreen()->GetCrossHairPosition();
|
|
|
|
DrawPanel->m_mouseCaptureCallback = NULL;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2011-02-11 20:48:13 +00:00
|
|
|
GetScreen()->SetCrossHairPosition( oldpos );
|
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-08-20 01:20:48 +00:00
|
|
|
GetScreen()->SetModify();
|
2009-07-25 04:53:39 +00:00
|
|
|
GetScreen()->m_BlockLocate.Normalize();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-11-09 14:00:22 +00:00
|
|
|
/* Calculate displacement vectors. */
|
2009-07-25 04:53:39 +00:00
|
|
|
delta = GetScreen()->m_BlockLocate.m_MoveVector;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-09-28 14:42:05 +00:00
|
|
|
/* Move items in block */
|
|
|
|
BOARD_ITEM* item = GetBoard()->m_Drawings;
|
|
|
|
for( ; item; item = item->Next() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2010-09-28 14:42:05 +00:00
|
|
|
GERBER_DRAW_ITEM* gerb_item = (GERBER_DRAW_ITEM*) item;
|
2010-10-10 17:57:54 +00:00
|
|
|
if( gerb_item->HitTest( GetScreen()->m_BlockLocate ) )
|
2010-10-15 18:59:26 +00:00
|
|
|
gerb_item->MoveAB( delta );
|
2009-05-02 18:53:04 +00:00
|
|
|
}
|
2009-07-25 04:53:39 +00:00
|
|
|
|
2010-11-13 11:02:24 +00:00
|
|
|
DrawPanel->Refresh( true );
|
2009-05-02 18:53:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/*
|
2007-09-13 11:28:58 +00:00
|
|
|
* Function to duplicate items in the current selected block
|
2007-08-20 01:20:48 +00:00
|
|
|
*/
|
2009-11-09 14:00:22 +00:00
|
|
|
void WinEDA_GerberFrame::Block_Duplicate( wxDC* DC )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-11-09 14:00:22 +00:00
|
|
|
wxPoint delta;
|
2007-08-20 01:20:48 +00:00
|
|
|
wxPoint oldpos;
|
|
|
|
|
2011-02-11 20:48:13 +00:00
|
|
|
oldpos = GetScreen()->GetCrossHairPosition();
|
|
|
|
DrawPanel->m_mouseCaptureCallback = NULL;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-02-11 20:48:13 +00:00
|
|
|
GetScreen()->SetCrossHairPosition( oldpos );
|
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-08-20 01:20:48 +00:00
|
|
|
GetScreen()->SetModify();
|
2009-07-25 04:53:39 +00:00
|
|
|
GetScreen()->m_BlockLocate.Normalize();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2009-07-25 04:53:39 +00:00
|
|
|
delta = GetScreen()->m_BlockLocate.m_MoveVector;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2010-09-28 14:42:05 +00:00
|
|
|
/* Copy items in block */
|
|
|
|
BOARD_ITEM* item = GetBoard()->m_Drawings;
|
|
|
|
for( ; item; item = item->Next() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2010-09-28 14:42:05 +00:00
|
|
|
GERBER_DRAW_ITEM* gerb_item = (GERBER_DRAW_ITEM*) item;
|
2010-10-10 17:57:54 +00:00
|
|
|
if( gerb_item->HitTest( GetScreen()->m_BlockLocate ) )
|
2008-04-17 16:25:29 +00:00
|
|
|
{
|
2010-09-28 14:42:05 +00:00
|
|
|
/* this item must be duplicated */
|
2010-10-15 18:59:26 +00:00
|
|
|
GERBER_DRAW_ITEM* new_item = gerb_item->Copy();
|
|
|
|
new_item->MoveAB( delta );
|
2010-09-28 14:42:05 +00:00
|
|
|
GetBoard()->m_Drawings.PushFront( new_item );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-09-28 14:42:05 +00:00
|
|
|
DrawPanel->Refresh();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|