2011-11-10 15:55:05 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
|
|
|
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
|
|
|
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.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
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file block_module_editor.cpp
|
|
|
|
* @brief Footprint editor block handling implementation.
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
|
|
|
#include <appl_wxstruct.h>
|
|
|
|
#include <gr_basic.h>
|
|
|
|
#include <class_drawpanel.h>
|
|
|
|
#include <confirm.h>
|
|
|
|
#include <block_commande.h>
|
|
|
|
#include <macros.h>
|
|
|
|
|
|
|
|
#include <wxPcbStruct.h>
|
|
|
|
#include <module_editor_frame.h>
|
|
|
|
#include <pcbplot.h>
|
|
|
|
#include <trigo.h>
|
|
|
|
|
|
|
|
#include <pcbnew.h>
|
|
|
|
#include <protos.h>
|
|
|
|
|
|
|
|
#include <class_board.h>
|
|
|
|
#include <class_track.h>
|
|
|
|
#include <class_drawsegment.h>
|
|
|
|
#include <class_pcb_text.h>
|
|
|
|
#include <class_mire.h>
|
|
|
|
#include <class_module.h>
|
|
|
|
#include <class_dimension.h>
|
|
|
|
#include <class_edge_mod.h>
|
2011-09-23 13:57:12 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#define BLOCK_COLOR BROWN
|
|
|
|
|
2012-02-19 19:53:11 +00:00
|
|
|
// Functions defined here, but used also in other files
|
|
|
|
// These 2 functions are used in modedit to rotate or mirror the whole footprint
|
|
|
|
// so they are called with force_all = true
|
|
|
|
void MirrorMarkedItems( MODULE* module, wxPoint offset, bool force_all = false );
|
|
|
|
void RotateMarkedItems( MODULE* module, wxPoint offset, bool force_all = false );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-02-19 19:53:11 +00:00
|
|
|
// Local functions:
|
2011-02-03 19:27:28 +00:00
|
|
|
static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
|
|
|
|
bool aErase );
|
2011-03-29 19:33:07 +00:00
|
|
|
static int MarkItemsInBloc( MODULE* module, EDA_RECT& Rect );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
static void ClearMarkItems( MODULE* module );
|
|
|
|
static void CopyMarkedItems( MODULE* module, wxPoint offset );
|
|
|
|
static void MoveMarkedItems( MODULE* module, wxPoint offset );
|
|
|
|
static void DeleteMarkedItems( MODULE* module );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2011-08-26 17:01:17 +00:00
|
|
|
int FOOTPRINT_EDIT_FRAME::ReturnBlockCommand( int key )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
int cmd;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
switch( key )
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
cmd = key & 0x255;
|
|
|
|
break;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
case - 1:
|
|
|
|
cmd = BLOCK_PRESELECT_MOVE;
|
|
|
|
break;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
case 0:
|
|
|
|
cmd = BLOCK_MOVE;
|
|
|
|
break;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
case GR_KB_ALT:
|
|
|
|
cmd = BLOCK_MIRROR_Y;
|
|
|
|
break;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
case GR_KB_SHIFTCTRL:
|
|
|
|
cmd = BLOCK_DELETE;
|
|
|
|
break;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
case GR_KB_SHIFT:
|
|
|
|
cmd = BLOCK_COPY;
|
|
|
|
break;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
case GR_KB_CTRL:
|
|
|
|
cmd = BLOCK_ROTATE;
|
|
|
|
break;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
case MOUSE_MIDDLE:
|
|
|
|
cmd = BLOCK_ZOOM;
|
|
|
|
break;
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
return cmd;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-08-26 17:01:17 +00:00
|
|
|
bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2010-11-13 11:02:24 +00:00
|
|
|
int itemsCount = 0;
|
|
|
|
bool nextcmd = false;
|
|
|
|
MODULE* currentModule = GetBoard()->m_Modules;
|
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
|
|
|
{
|
2012-03-26 23:47:08 +00:00
|
|
|
BLOCK_STATE_T state = GetScreen()->m_BlockLocate.GetState();
|
|
|
|
BLOCK_COMMAND_T command = GetScreen()->m_BlockLocate.GetCommand();
|
2011-12-29 20:11:42 +00:00
|
|
|
m_canvas->CallEndMouseCapture( DC );
|
2012-03-26 23:47:08 +00:00
|
|
|
GetScreen()->m_BlockLocate.SetState( state );
|
|
|
|
GetScreen()->m_BlockLocate.SetCommand( command );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand );
|
2011-02-11 20:48:13 +00:00
|
|
|
GetScreen()->SetCrossHairPosition( wxPoint( GetScreen()->m_BlockLocate.GetRight(),
|
|
|
|
GetScreen()->m_BlockLocate.GetBottom() ) );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
2012-03-26 23:47:08 +00:00
|
|
|
switch( GetScreen()->m_BlockLocate.GetCommand() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
|
|
|
case BLOCK_IDLE:
|
|
|
|
DisplayError( this, wxT( "Error in HandleBlockPLace" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BLOCK_DRAG: /* Drag */
|
|
|
|
case BLOCK_MOVE: /* Move */
|
|
|
|
case BLOCK_COPY: /* Copy */
|
2011-08-26 17:01:17 +00:00
|
|
|
itemsCount = MarkItemsInBloc( currentModule, GetScreen()->m_BlockLocate );
|
|
|
|
|
2010-11-13 11:02:24 +00:00
|
|
|
if( itemsCount )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2010-11-13 11:02:24 +00:00
|
|
|
nextcmd = true;
|
2011-02-11 20:48:13 +00:00
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
if( m_canvas->IsMouseCaptured() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-12-29 20:11:42 +00:00
|
|
|
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
|
|
|
|
m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines );
|
|
|
|
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2011-02-11 20:48:13 +00:00
|
|
|
|
2012-03-26 23:47:08 +00:00
|
|
|
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_MOVE );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->Refresh( true );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2012-03-26 23:47:08 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
|
2010-11-13 11:02:24 +00:00
|
|
|
nextcmd = true;
|
2011-12-29 20:11:42 +00:00
|
|
|
m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines );
|
2012-03-26 23:47:08 +00:00
|
|
|
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_MOVE );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case BLOCK_DELETE: /* Delete */
|
2010-11-13 11:02:24 +00:00
|
|
|
itemsCount = MarkItemsInBloc( currentModule, GetScreen()->m_BlockLocate );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-11-13 11:02:24 +00:00
|
|
|
if( itemsCount )
|
|
|
|
SaveCopyInUndoList( currentModule, UR_MODEDIT );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-11-13 11:02:24 +00:00
|
|
|
DeleteMarkedItems( currentModule );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case BLOCK_SAVE: /* Save */
|
|
|
|
case BLOCK_PASTE:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BLOCK_ROTATE:
|
2010-11-13 11:02:24 +00:00
|
|
|
itemsCount = MarkItemsInBloc( currentModule, GetScreen()->m_BlockLocate );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-11-13 11:02:24 +00:00
|
|
|
if( itemsCount )
|
|
|
|
SaveCopyInUndoList( currentModule, UR_MODEDIT );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-11-13 11:02:24 +00:00
|
|
|
RotateMarkedItems( currentModule, GetScreen()->m_BlockLocate.Centre() );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case BLOCK_MIRROR_X:
|
|
|
|
case BLOCK_MIRROR_Y:
|
2009-08-12 10:40:01 +00:00
|
|
|
case BLOCK_FLIP: /* mirror */
|
2010-11-13 11:02:24 +00:00
|
|
|
itemsCount = MarkItemsInBloc( currentModule, GetScreen()->m_BlockLocate );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-11-13 11:02:24 +00:00
|
|
|
if( itemsCount )
|
|
|
|
SaveCopyInUndoList( currentModule, UR_MODEDIT );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-11-13 11:02:24 +00:00
|
|
|
MirrorMarkedItems( currentModule, GetScreen()->m_BlockLocate.Centre() );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case BLOCK_ZOOM: /* Window Zoom */
|
2009-07-25 04:53:39 +00:00
|
|
|
Window_Zoom( GetScreen()->m_BlockLocate );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case BLOCK_ABORT:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BLOCK_SELECT_ITEMS_ONLY:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-11-13 11:02:24 +00:00
|
|
|
if( !nextcmd )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2012-03-26 23:47:08 +00:00
|
|
|
if( GetScreen()->m_BlockLocate.GetCommand() != BLOCK_SELECT_ITEMS_ONLY )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2010-11-13 11:02:24 +00:00
|
|
|
ClearMarkItems( currentModule );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2011-02-11 20:48:13 +00:00
|
|
|
|
|
|
|
GetScreen()->ClearBlockCommand();
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( NULL );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString,
|
2012-03-26 23:47:08 +00:00
|
|
|
false );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->Refresh( true );
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-08-26 17:01:17 +00:00
|
|
|
void FOOTPRINT_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2010-11-13 11:02:24 +00:00
|
|
|
MODULE* currentModule = GetBoard()->m_Modules;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
if( !m_canvas->IsMouseCaptured() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-02-11 20:48:13 +00:00
|
|
|
DisplayError( this, wxT( "HandleBlockPLace : m_mouseCaptureCallback = NULL" ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
2012-03-26 23:47:08 +00:00
|
|
|
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2012-03-26 23:47:08 +00:00
|
|
|
switch( GetScreen()->m_BlockLocate.GetCommand() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
|
|
|
case BLOCK_IDLE:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BLOCK_DRAG: /* Drag */
|
|
|
|
case BLOCK_MOVE: /* Move */
|
|
|
|
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
|
2009-07-25 04:53:39 +00:00
|
|
|
GetScreen()->m_BlockLocate.ClearItemsList();
|
2010-11-13 11:02:24 +00:00
|
|
|
SaveCopyInUndoList( currentModule, UR_MODEDIT );
|
2012-03-26 23:47:08 +00:00
|
|
|
MoveMarkedItems( currentModule, GetScreen()->m_BlockLocate.GetMoveVector() );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->Refresh( true );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case BLOCK_COPY: /* Copy */
|
2009-07-25 04:53:39 +00:00
|
|
|
GetScreen()->m_BlockLocate.ClearItemsList();
|
2010-11-13 11:02:24 +00:00
|
|
|
SaveCopyInUndoList( currentModule, UR_MODEDIT );
|
2012-03-26 23:47:08 +00:00
|
|
|
CopyMarkedItems( currentModule, GetScreen()->m_BlockLocate.GetMoveVector() );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
case BLOCK_PASTE: /* Paste */
|
2009-07-25 04:53:39 +00:00
|
|
|
GetScreen()->m_BlockLocate.ClearItemsList();
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case BLOCK_MIRROR_X:
|
|
|
|
case BLOCK_MIRROR_Y:
|
2009-08-12 10:40:01 +00:00
|
|
|
case BLOCK_FLIP: /* Mirror by popup menu, from block move */
|
2010-11-13 11:02:24 +00:00
|
|
|
SaveCopyInUndoList( currentModule, UR_MODEDIT );
|
|
|
|
MirrorMarkedItems( currentModule, GetScreen()->m_BlockLocate.Centre() );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case BLOCK_ROTATE:
|
2010-11-13 11:02:24 +00:00
|
|
|
SaveCopyInUndoList( currentModule, UR_MODEDIT );
|
|
|
|
RotateMarkedItems( currentModule, GetScreen()->m_BlockLocate.Centre() );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case BLOCK_ZOOM: // Handled by HandleBlockEnd
|
|
|
|
case BLOCK_DELETE:
|
|
|
|
case BLOCK_SAVE:
|
|
|
|
case BLOCK_ABORT:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-02-19 13:23:58 +00:00
|
|
|
OnModify();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2012-03-26 23:47:08 +00:00
|
|
|
GetScreen()->m_BlockLocate.SetState( STATE_NO_BLOCK );
|
|
|
|
GetScreen()->m_BlockLocate.SetCommand( BLOCK_IDLE );
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( NULL );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString, false );
|
|
|
|
m_canvas->Refresh( true );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
/* Traces the outline of the search block structures
|
|
|
|
* The entire block follows the cursor
|
|
|
|
*/
|
2011-02-03 19:27:28 +00:00
|
|
|
static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
|
|
|
|
bool aErase )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2012-03-26 23:47:08 +00:00
|
|
|
BLOCK_SELECTOR* block;
|
2011-02-03 19:27:28 +00:00
|
|
|
BASE_SCREEN* screen = aPanel->GetScreen();
|
2008-04-01 05:21:50 +00:00
|
|
|
BOARD_ITEM* item;
|
2007-08-20 01:20:48 +00:00
|
|
|
wxPoint move_offset;
|
2010-11-13 11:02:24 +00:00
|
|
|
MODULE* currentModule =
|
2011-03-01 19:26:17 +00:00
|
|
|
( (PCB_BASE_FRAME*) wxGetApp().GetTopWindow() )->m_ModuleEditFrame->GetBoard()->m_Modules;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2012-03-26 23:47:08 +00:00
|
|
|
block = &screen->m_BlockLocate;
|
2011-02-03 19:27:28 +00:00
|
|
|
GRSetDrawMode( aDC, g_XorMode );
|
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
|
|
|
{
|
2012-03-26 23:47:08 +00:00
|
|
|
block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2010-11-13 11:02:24 +00:00
|
|
|
if( currentModule )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2012-03-26 23:47:08 +00:00
|
|
|
move_offset.x = -block->GetMoveVector().x;
|
|
|
|
move_offset.y = -block->GetMoveVector().y;
|
2010-11-13 11:02:24 +00:00
|
|
|
item = currentModule->m_Drawings;
|
2011-02-03 19:27:28 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
for( ; item != NULL; item = item->Next() )
|
|
|
|
{
|
2011-12-21 13:42:02 +00:00
|
|
|
if( !item->IsSelected() )
|
2007-08-20 01:20:48 +00:00
|
|
|
continue;
|
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
switch( item->Type() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_MODULE_TEXT_T:
|
|
|
|
case PCB_MODULE_EDGE_T:
|
2011-02-03 19:27:28 +00:00
|
|
|
item->Draw( aPanel, aDC, g_XorMode, move_offset );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-13 11:02:24 +00:00
|
|
|
D_PAD* pad = currentModule->m_Pads;
|
2011-02-03 19:27:28 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
for( ; pad != NULL; pad = pad->Next() )
|
|
|
|
{
|
2011-12-21 13:42:02 +00:00
|
|
|
if( !pad->IsSelected() )
|
2007-08-20 01:20:48 +00:00
|
|
|
continue;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2011-02-03 19:27:28 +00:00
|
|
|
pad->Draw( aPanel, aDC, g_XorMode, move_offset );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
/* Repaint new view. */
|
2012-03-26 23:47:08 +00:00
|
|
|
block->SetMoveVector( screen->GetCrossHairPosition() - block->GetLastCursorPosition() );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2012-03-26 23:47:08 +00:00
|
|
|
block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2010-11-13 11:02:24 +00:00
|
|
|
if( currentModule )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2010-11-13 11:02:24 +00:00
|
|
|
item = currentModule->m_Drawings;
|
2012-03-26 23:47:08 +00:00
|
|
|
move_offset = - block->GetMoveVector();
|
2011-02-03 19:27:28 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
for( ; item != NULL; item = item->Next() )
|
|
|
|
{
|
2011-12-21 13:42:02 +00:00
|
|
|
if( !item->IsSelected() )
|
2007-08-20 01:20:48 +00:00
|
|
|
continue;
|
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
switch( item->Type() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_MODULE_TEXT_T:
|
|
|
|
case PCB_MODULE_EDGE_T:
|
2011-02-03 19:27:28 +00:00
|
|
|
item->Draw( aPanel, aDC, g_XorMode, move_offset );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-13 11:02:24 +00:00
|
|
|
D_PAD* pad = currentModule->m_Pads;
|
2011-02-03 19:27:28 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
for( ; pad != NULL; pad = pad->Next() )
|
|
|
|
{
|
2011-12-21 13:42:02 +00:00
|
|
|
if( !pad->IsSelected() )
|
2007-08-20 01:20:48 +00:00
|
|
|
continue;
|
2011-02-03 19:27:28 +00:00
|
|
|
|
|
|
|
pad->Draw( aPanel, aDC, g_XorMode, move_offset );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
/* Copy marked items, at new position = old position + offset
|
|
|
|
*/
|
2009-11-12 15:43:38 +00:00
|
|
|
void CopyMarkedItems( MODULE* module, wxPoint offset )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
if( module == NULL )
|
|
|
|
return;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
for( D_PAD* pad = module->m_Pads; pad; pad = pad->Next() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-12-21 13:42:02 +00:00
|
|
|
if( !pad->IsSelected() )
|
2007-08-20 01:20:48 +00:00
|
|
|
continue;
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2011-12-21 13:42:02 +00:00
|
|
|
pad->ClearFlags( SELECTED );
|
2012-01-14 19:50:32 +00:00
|
|
|
D_PAD* NewPad = new D_PAD( *pad );
|
|
|
|
NewPad->SetParent( module );
|
2011-12-21 13:42:02 +00:00
|
|
|
NewPad->SetFlags( SELECTED );
|
2009-02-18 07:37:53 +00:00
|
|
|
module->m_Pads.PushFront( NewPad );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
2012-01-14 19:50:32 +00:00
|
|
|
BOARD_ITEM* newItem;
|
|
|
|
|
2011-12-12 08:37:05 +00:00
|
|
|
for( BOARD_ITEM* item = module->m_Drawings; item; item = item->Next() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-12-21 13:42:02 +00:00
|
|
|
if( !item->IsSelected() )
|
2007-08-20 01:20:48 +00:00
|
|
|
continue;
|
2008-12-04 04:28:11 +00:00
|
|
|
|
2011-12-21 13:42:02 +00:00
|
|
|
item->ClearFlags( SELECTED );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2012-01-14 19:50:32 +00:00
|
|
|
newItem = (BOARD_ITEM*)item->Clone();
|
|
|
|
newItem->SetParent( module );
|
|
|
|
newItem->SetFlags( SELECTED );
|
|
|
|
module->m_Drawings.PushFront( newItem );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MoveMarkedItems( module, offset );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
/* Move marked items, at new position = old position + offset
|
|
|
|
*/
|
2009-11-12 15:43:38 +00:00
|
|
|
void MoveMarkedItems( MODULE* module, wxPoint offset )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2010-12-08 20:12:46 +00:00
|
|
|
EDA_ITEM* item;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
if( module == NULL )
|
|
|
|
return;
|
|
|
|
|
|
|
|
D_PAD* pad = module->m_Pads;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
for( ; pad != NULL; pad = pad->Next() )
|
|
|
|
{
|
2011-12-21 13:42:02 +00:00
|
|
|
if( !pad->IsSelected() )
|
2007-08-20 01:20:48 +00:00
|
|
|
continue;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2009-02-18 07:37:53 +00:00
|
|
|
pad->SetPosition( pad->GetPosition() + offset );
|
2012-02-19 04:02:19 +00:00
|
|
|
pad->SetPos0( pad->GetPos0() + offset );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
item = module->m_Drawings;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
for( ; item != NULL; item = item->Next() )
|
|
|
|
{
|
2011-12-21 13:42:02 +00:00
|
|
|
if( !item->IsSelected() )
|
2007-08-20 01:20:48 +00:00
|
|
|
continue;
|
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
switch( item->Type() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_MODULE_TEXT_T:
|
2011-12-12 08:37:05 +00:00
|
|
|
{
|
|
|
|
TEXTE_MODULE* tm = (TEXTE_MODULE*) item;
|
|
|
|
tm->m_Pos += offset;
|
|
|
|
tm->SetPos0( tm->GetPos0() + offset );
|
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_MODULE_EDGE_T:
|
2011-12-12 08:37:05 +00:00
|
|
|
{
|
|
|
|
EDGE_MODULE* em = (EDGE_MODULE*) item;
|
2011-12-14 04:29:25 +00:00
|
|
|
em->SetStart( em->GetStart() + offset );
|
|
|
|
em->SetEnd( em->GetEnd() + offset );
|
|
|
|
em->SetStart0( em->GetStart0() + offset );
|
|
|
|
em->SetEnd0( em->GetEnd0() + offset );
|
2011-12-12 08:37:05 +00:00
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
2007-08-24 15:10:46 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
;
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
2011-12-21 13:42:02 +00:00
|
|
|
item->ClearFlags();
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
/* Delete marked items
|
|
|
|
*/
|
2009-11-12 15:43:38 +00:00
|
|
|
void DeleteMarkedItems( MODULE* module )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-12-08 15:27:13 +00:00
|
|
|
BOARD_ITEM* item;
|
|
|
|
BOARD_ITEM* next_item;
|
|
|
|
D_PAD* pad;
|
|
|
|
D_PAD* next_pad;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
if( module == NULL )
|
|
|
|
return;
|
|
|
|
|
|
|
|
pad = module->m_Pads;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
for( ; pad != NULL; pad = next_pad )
|
|
|
|
{
|
|
|
|
next_pad = pad->Next();
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2011-12-21 13:42:02 +00:00
|
|
|
if( !pad->IsSelected() )
|
2007-08-20 01:20:48 +00:00
|
|
|
continue;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2007-10-03 15:21:13 +00:00
|
|
|
pad->DeleteStructure();
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
item = module->m_Drawings;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
for( ; item != NULL; item = next_item )
|
|
|
|
{
|
|
|
|
next_item = item->Next();
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2011-12-21 13:42:02 +00:00
|
|
|
if( !item->IsSelected() )
|
2007-08-20 01:20:48 +00:00
|
|
|
continue;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2007-10-03 15:21:13 +00:00
|
|
|
item->DeleteStructure();
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-12-14 04:29:25 +00:00
|
|
|
/** Mirror marked items, refer to a Vertical axis at position offset
|
2012-02-19 19:53:11 +00:00
|
|
|
* Note: because this function is used in global transform,
|
|
|
|
* if force_all is true, all items will be mirrored
|
2007-08-20 01:20:48 +00:00
|
|
|
*/
|
2012-02-19 19:53:11 +00:00
|
|
|
void MirrorMarkedItems( MODULE* module, wxPoint offset, bool force_all )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
#define SETMIRROR( z ) (z) -= offset.x; (z) = -(z); (z) += offset.x;
|
2011-11-29 17:25:30 +00:00
|
|
|
wxPoint tmp;
|
2012-02-19 04:02:19 +00:00
|
|
|
wxSize tmpz;
|
2011-11-24 17:32:51 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
if( module == NULL )
|
|
|
|
return;
|
|
|
|
|
2011-12-14 04:29:25 +00:00
|
|
|
for( D_PAD* pad = module->m_Pads; pad; pad = pad->Next() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2012-02-19 19:53:11 +00:00
|
|
|
// Skip pads not selected, i.e. not inside the block to mirror:
|
|
|
|
if( !pad->IsSelected() && !force_all )
|
2007-08-20 01:20:48 +00:00
|
|
|
continue;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2011-11-29 17:25:30 +00:00
|
|
|
tmp = pad->GetPosition();
|
|
|
|
SETMIRROR( tmp.x );
|
|
|
|
pad->SetPosition( tmp );
|
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
pad->SetX0( pad->GetPosition().x );
|
|
|
|
|
|
|
|
tmp = pad->GetOffset();
|
|
|
|
NEGATE( tmp.x );
|
|
|
|
pad->SetOffset( tmp );
|
|
|
|
|
|
|
|
tmpz = pad->GetDelta();
|
|
|
|
NEGATE( tmpz.x );
|
|
|
|
pad->SetDelta( tmpz );
|
|
|
|
|
|
|
|
pad->SetOrientation( 1800 - pad->GetOrientation() );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
2011-12-14 04:29:25 +00:00
|
|
|
for( EDA_ITEM* item = module->m_Drawings; item; item = item->Next() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2012-02-19 19:53:11 +00:00
|
|
|
// Skip items not selected, i.e. not inside the block to mirror:
|
|
|
|
if( !item->IsSelected() && !force_all )
|
2007-08-20 01:20:48 +00:00
|
|
|
continue;
|
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
switch( item->Type() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_MODULE_EDGE_T:
|
2011-12-12 08:37:05 +00:00
|
|
|
{
|
|
|
|
EDGE_MODULE* em = (EDGE_MODULE*) item;
|
2011-12-14 04:29:25 +00:00
|
|
|
|
|
|
|
tmp = em->GetStart0();
|
|
|
|
SETMIRROR( tmp.x );
|
|
|
|
em->SetStart0( tmp );
|
|
|
|
em->SetStartX( tmp.x );
|
|
|
|
|
|
|
|
tmp = em->GetEnd0();
|
|
|
|
SETMIRROR( tmp.x );
|
|
|
|
em->SetEnd0( tmp );
|
|
|
|
em->SetEndX( tmp.x );
|
|
|
|
|
|
|
|
em->SetAngle( -em->GetAngle() );
|
2011-12-12 08:37:05 +00:00
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_MODULE_TEXT_T:
|
2011-12-12 08:37:05 +00:00
|
|
|
{
|
|
|
|
TEXTE_MODULE* tm = (TEXTE_MODULE*) item;
|
|
|
|
tmp = tm->GetPosition();
|
|
|
|
SETMIRROR( tmp.x );
|
|
|
|
tm->SetPosition( tmp );
|
|
|
|
tmp.y = tm->GetPos0().y;
|
|
|
|
tm->SetPos0( tmp );
|
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
2008-04-01 05:21:50 +00:00
|
|
|
|
2007-08-24 15:10:46 +00:00
|
|
|
default:
|
2009-08-12 10:40:01 +00:00
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
2011-12-21 13:42:02 +00:00
|
|
|
item->ClearFlags();
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2012-02-19 19:53:11 +00:00
|
|
|
/** Rotate marked items, refer to a rotation point at position offset
|
|
|
|
* Note: because this function is used in global transform,
|
|
|
|
* if force_all is true, all items will be rotated
|
2007-08-20 01:20:48 +00:00
|
|
|
*/
|
2012-02-19 19:53:11 +00:00
|
|
|
void RotateMarkedItems( MODULE* module, wxPoint offset, bool force_all )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
#define ROTATE( z ) RotatePoint( (&z), offset, 900 )
|
|
|
|
|
|
|
|
if( module == NULL )
|
|
|
|
return;
|
|
|
|
|
2011-12-14 04:29:25 +00:00
|
|
|
for( D_PAD* pad = module->m_Pads; pad; pad = pad->Next() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2012-02-19 19:53:11 +00:00
|
|
|
if( !pad->IsSelected() && !force_all )
|
2007-08-20 01:20:48 +00:00
|
|
|
continue;
|
2011-11-24 17:32:51 +00:00
|
|
|
|
2011-11-29 17:25:30 +00:00
|
|
|
wxPoint pos = pad->GetPosition();
|
|
|
|
ROTATE( pos );
|
|
|
|
pad->SetPosition( pos );
|
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
pad->SetPos0( pad->GetPosition() );
|
|
|
|
pad->SetOrientation( pad->GetOrientation() + 900 );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
2011-12-14 04:29:25 +00:00
|
|
|
for( EDA_ITEM* item = module->m_Drawings; item; item = item->Next() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2012-02-19 19:53:11 +00:00
|
|
|
if( !item->IsSelected() && !force_all)
|
2007-08-20 01:20:48 +00:00
|
|
|
continue;
|
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
switch( item->Type() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_MODULE_EDGE_T:
|
2011-12-21 13:42:02 +00:00
|
|
|
{
|
|
|
|
EDGE_MODULE* em = (EDGE_MODULE*) item;
|
2011-12-14 04:29:25 +00:00
|
|
|
|
2011-12-21 13:42:02 +00:00
|
|
|
wxPoint tmp = em->GetStart();
|
|
|
|
ROTATE( tmp );
|
|
|
|
em->SetStart( tmp );
|
|
|
|
em->SetStart0( tmp );
|
2011-12-14 04:29:25 +00:00
|
|
|
|
2011-12-21 13:42:02 +00:00
|
|
|
tmp = em->GetEnd();
|
|
|
|
ROTATE( tmp );
|
|
|
|
em->SetEnd( tmp );
|
|
|
|
em->SetEnd0( tmp );
|
|
|
|
}
|
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_MODULE_TEXT_T:
|
2011-12-21 13:42:02 +00:00
|
|
|
{
|
|
|
|
TEXTE_MODULE* tm = (TEXTE_MODULE*) item;
|
|
|
|
wxPoint pos = tm->GetPosition();
|
|
|
|
ROTATE( pos );
|
|
|
|
tm->SetPosition( pos );
|
|
|
|
tm->SetPos0( tm->GetPosition() );
|
|
|
|
tm->SetOrientation( tm->GetOrientation() + 900 );
|
|
|
|
}
|
|
|
|
break;
|
2008-04-01 05:21:50 +00:00
|
|
|
|
2007-08-24 15:10:46 +00:00
|
|
|
default:
|
|
|
|
;
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
2011-12-21 13:42:02 +00:00
|
|
|
item->ClearFlags();
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
void ClearMarkItems( MODULE* module )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2010-12-08 20:12:46 +00:00
|
|
|
EDA_ITEM* item;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
if( module == NULL )
|
|
|
|
return;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
item = module->m_Drawings;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
for( ; item != NULL; item = item->Next() )
|
2011-12-21 13:42:02 +00:00
|
|
|
{
|
|
|
|
item->ClearFlags();
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
item = module->m_Pads;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
for( ; item != NULL; item = item->Next() )
|
2011-12-21 13:42:02 +00:00
|
|
|
{
|
|
|
|
item->ClearFlags();
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/* Mark items inside rect.
|
2007-08-20 01:20:48 +00:00
|
|
|
* Items are inside rect when an end point is inside rect
|
|
|
|
*/
|
2011-03-29 19:33:07 +00:00
|
|
|
int MarkItemsInBloc( MODULE* module, EDA_RECT& Rect )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2010-12-08 20:12:46 +00:00
|
|
|
EDA_ITEM* item;
|
|
|
|
int ItemsCount = 0;
|
|
|
|
wxPoint pos;
|
|
|
|
D_PAD* pad;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
if( module == NULL )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
pad = module->m_Pads;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
for( ; pad != NULL; pad = pad->Next() )
|
|
|
|
{
|
2011-12-21 13:42:02 +00:00
|
|
|
pad->ClearFlags( SELECTED );
|
2007-12-01 03:42:52 +00:00
|
|
|
pos = pad->GetPosition();
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-12-20 17:44:25 +00:00
|
|
|
if( Rect.Contains( pos ) )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-12-21 13:42:02 +00:00
|
|
|
pad->SetFlags( SELECTED );
|
2007-08-20 01:20:48 +00:00
|
|
|
ItemsCount++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
item = module->m_Drawings;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
for( ; item != NULL; item = item->Next() )
|
|
|
|
{
|
2011-12-21 13:42:02 +00:00
|
|
|
item->ClearFlags( SELECTED );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
switch( item->Type() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_MODULE_EDGE_T:
|
2011-02-27 19:54:01 +00:00
|
|
|
if( ((EDGE_MODULE*)item )->HitTest( Rect ) )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-12-21 13:42:02 +00:00
|
|
|
item->SetFlags( SELECTED );
|
2007-08-20 01:20:48 +00:00
|
|
|
ItemsCount++;
|
|
|
|
}
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_MODULE_TEXT_T:
|
2007-12-01 03:42:52 +00:00
|
|
|
pos = ( (TEXTE_MODULE*) item )->GetPosition();
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-12-20 17:44:25 +00:00
|
|
|
if( Rect.Contains( pos ) )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-12-21 13:42:02 +00:00
|
|
|
item->SetFlags( SELECTED );
|
2007-08-20 01:20:48 +00:00
|
|
|
ItemsCount++;
|
|
|
|
}
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ItemsCount;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|