2009-11-18 12:52:19 +00:00
|
|
|
/************************/
|
|
|
|
/* Edit footprint pads. */
|
|
|
|
/************************/
|
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"
|
|
|
|
#include "confirm.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "pcbnew.h"
|
|
|
|
#include "trigo.h"
|
2009-08-03 18:54:48 +00:00
|
|
|
#include "block_commande.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#include "drag.h"
|
|
|
|
|
|
|
|
#include "protos.h"
|
|
|
|
|
|
|
|
|
2009-11-18 12:52:19 +00:00
|
|
|
static D_PAD* s_CurrentSelectedPad;
|
2007-06-05 12:10:51 +00:00
|
|
|
static wxPoint Pad_OldPos;
|
|
|
|
|
|
|
|
|
2009-11-18 12:52:19 +00:00
|
|
|
/* Cancel move pad command.
|
2008-02-23 01:27:21 +00:00
|
|
|
*/
|
2011-02-12 19:38:55 +00:00
|
|
|
static void Abort_Move_Pad( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-02-23 01:27:21 +00:00
|
|
|
D_PAD* pad = s_CurrentSelectedPad;
|
|
|
|
|
2011-02-13 09:07:30 +00:00
|
|
|
Panel->SetMouseCapture( NULL, NULL );
|
|
|
|
|
2008-02-23 01:27:21 +00:00
|
|
|
if( pad == NULL )
|
|
|
|
return;
|
|
|
|
|
2008-04-01 05:21:50 +00:00
|
|
|
pad->Draw( Panel, DC, GR_XOR );
|
2008-02-23 01:27:21 +00:00
|
|
|
pad->m_Flags = 0;
|
|
|
|
pad->m_Pos = Pad_OldPos;
|
2008-04-01 05:21:50 +00:00
|
|
|
pad->Draw( Panel, DC, GR_XOR );
|
2009-11-18 12:52:19 +00:00
|
|
|
|
|
|
|
/* Pad move in progress: the restore origin. */
|
2008-02-23 01:27:21 +00:00
|
|
|
if( g_Drag_Pistes_On )
|
|
|
|
{
|
2010-08-31 15:54:05 +00:00
|
|
|
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
|
2008-02-23 01:27:21 +00:00
|
|
|
{
|
2010-08-31 15:54:05 +00:00
|
|
|
TRACK* Track = g_DragSegmentList[ii].m_Segm;
|
2008-02-23 01:27:21 +00:00
|
|
|
Track->Draw( Panel, DC, GR_XOR );
|
2011-02-13 17:53:48 +00:00
|
|
|
Track->SetState( IN_EDIT, OFF );
|
2010-08-31 15:54:05 +00:00
|
|
|
g_DragSegmentList[ii].SetInitialValues();
|
2008-02-23 01:27:21 +00:00
|
|
|
Track->Draw( Panel, DC, GR_OR );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-08-31 15:54:05 +00:00
|
|
|
EraseDragList();
|
2008-02-23 01:27:21 +00:00
|
|
|
s_CurrentSelectedPad = NULL;
|
2009-10-14 18:14:58 +00:00
|
|
|
g_Drag_Pistes_On = FALSE;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-18 12:52:19 +00:00
|
|
|
/* Draw in drag mode when moving a pad.
|
|
|
|
*/
|
2011-02-03 19:27:28 +00:00
|
|
|
static void Show_Pad_Move( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
|
|
|
|
bool aErase )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-02-23 01:27:21 +00:00
|
|
|
TRACK* Track;
|
2011-02-03 19:27:28 +00:00
|
|
|
BASE_SCREEN* screen = aPanel->GetScreen();
|
2008-02-23 01:27:21 +00:00
|
|
|
D_PAD* pad = s_CurrentSelectedPad;
|
|
|
|
|
2011-02-12 19:38:55 +00:00
|
|
|
if( pad == NULL ) // Should not occur
|
|
|
|
return;
|
|
|
|
|
2011-02-03 19:27:28 +00:00
|
|
|
if( aErase )
|
|
|
|
pad->Draw( aPanel, aDC, GR_XOR );
|
2008-04-01 05:21:50 +00:00
|
|
|
|
2011-02-11 20:48:13 +00:00
|
|
|
pad->m_Pos = screen->GetCrossHairPosition();
|
2011-02-03 19:27:28 +00:00
|
|
|
pad->Draw( aPanel, aDC, GR_XOR );
|
2008-02-23 01:27:21 +00:00
|
|
|
|
|
|
|
if( !g_Drag_Pistes_On )
|
|
|
|
return;
|
|
|
|
|
2010-08-31 15:54:05 +00:00
|
|
|
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
|
2008-02-23 01:27:21 +00:00
|
|
|
{
|
2010-08-31 15:54:05 +00:00
|
|
|
Track = g_DragSegmentList[ii].m_Segm;
|
2011-02-03 19:27:28 +00:00
|
|
|
|
|
|
|
if( aErase )
|
|
|
|
Track->Draw( aPanel, aDC, GR_XOR );
|
|
|
|
|
2010-08-31 15:54:05 +00:00
|
|
|
if( g_DragSegmentList[ii].m_Pad_Start )
|
2008-02-23 01:27:21 +00:00
|
|
|
{
|
|
|
|
Track->m_Start = pad->m_Pos;
|
|
|
|
}
|
2011-02-03 19:27:28 +00:00
|
|
|
|
2010-08-31 15:54:05 +00:00
|
|
|
if( g_DragSegmentList[ii].m_Pad_End )
|
2008-02-23 01:27:21 +00:00
|
|
|
{
|
|
|
|
Track->m_End = pad->m_Pos;
|
|
|
|
}
|
2011-02-03 19:27:28 +00:00
|
|
|
|
|
|
|
Track->Draw( aPanel, aDC, GR_XOR );
|
2008-02-23 01:27:21 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-18 12:52:19 +00:00
|
|
|
/* Load list of features for default pad selection.
|
2008-02-23 01:27:21 +00:00
|
|
|
*/
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_BASE_FRAME::Export_Pad_Settings( D_PAD* pt_pad )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-02-23 01:27:21 +00:00
|
|
|
if( pt_pad == NULL )
|
|
|
|
return;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-04-17 08:51:02 +00:00
|
|
|
pt_pad->DisplayInfo( this );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-02-23 01:27:21 +00:00
|
|
|
g_Pad_Master.m_PadShape = pt_pad->m_PadShape;
|
|
|
|
g_Pad_Master.m_Attribut = pt_pad->m_Attribut;
|
|
|
|
g_Pad_Master.m_Masque_Layer = pt_pad->m_Masque_Layer;
|
|
|
|
g_Pad_Master.m_Orient = pt_pad->m_Orient -
|
2008-11-24 06:53:43 +00:00
|
|
|
( (MODULE*) pt_pad->GetParent() )->m_Orient;
|
2009-10-14 18:14:58 +00:00
|
|
|
g_Pad_Master.m_Size = pt_pad->m_Size;
|
2008-02-23 01:27:21 +00:00
|
|
|
g_Pad_Master.m_DeltaSize = pt_pad->m_DeltaSize;
|
2010-09-18 17:55:08 +00:00
|
|
|
pt_pad->ComputeShapeMaxRadius();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-02-23 01:27:21 +00:00
|
|
|
g_Pad_Master.m_Offset = pt_pad->m_Offset;
|
|
|
|
g_Pad_Master.m_Drill = pt_pad->m_Drill;
|
|
|
|
g_Pad_Master.m_DrillShape = pt_pad->m_DrillShape;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-18 12:52:19 +00:00
|
|
|
/* Imports the new values of dimensions of the pad edge by pt_pad
|
|
|
|
* - Source: selected values of general characteristics
|
|
|
|
* - Measurements are modified
|
|
|
|
* - The position, names, and keys are not.
|
2008-02-23 01:27:21 +00:00
|
|
|
*/
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_BASE_FRAME::Import_Pad_Settings( D_PAD* aPad, bool aDraw )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-04-18 13:28:56 +00:00
|
|
|
if( aDraw )
|
2008-11-24 06:53:43 +00:00
|
|
|
{
|
|
|
|
aPad->m_Flags |= DO_NOT_DRAW;
|
2011-01-30 22:22:38 +00:00
|
|
|
DrawPanel->RefreshDrawingRect( aPad->GetBoundingBox() );
|
2008-11-24 06:53:43 +00:00
|
|
|
aPad->m_Flags &= ~DO_NOT_DRAW;
|
|
|
|
}
|
2008-04-18 13:28:56 +00:00
|
|
|
|
|
|
|
aPad->m_PadShape = g_Pad_Master.m_PadShape;
|
|
|
|
aPad->m_Masque_Layer = g_Pad_Master.m_Masque_Layer;
|
2009-10-14 18:14:58 +00:00
|
|
|
aPad->m_Attribut = g_Pad_Master.m_Attribut;
|
|
|
|
aPad->m_Orient = g_Pad_Master.m_Orient +
|
|
|
|
( (MODULE*) aPad->GetParent() )->m_Orient;
|
|
|
|
aPad->m_Size = g_Pad_Master.m_Size;
|
2008-04-18 13:28:56 +00:00
|
|
|
aPad->m_DeltaSize = wxSize( 0, 0 );
|
|
|
|
aPad->m_Offset = g_Pad_Master.m_Offset;
|
|
|
|
aPad->m_Drill = g_Pad_Master.m_Drill;
|
|
|
|
aPad->m_DrillShape = g_Pad_Master.m_DrillShape;
|
2008-02-23 01:27:21 +00:00
|
|
|
|
|
|
|
switch( g_Pad_Master.m_PadShape )
|
|
|
|
{
|
|
|
|
case PAD_TRAPEZOID:
|
2008-04-18 13:28:56 +00:00
|
|
|
aPad->m_DeltaSize = g_Pad_Master.m_DeltaSize;
|
2008-02-23 01:27:21 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PAD_CIRCLE:
|
2008-04-18 13:28:56 +00:00
|
|
|
aPad->m_Size.y = aPad->m_Size.x;
|
2008-02-23 01:27:21 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch( g_Pad_Master.m_Attribut & 0x7F )
|
|
|
|
{
|
|
|
|
case PAD_SMD:
|
|
|
|
case PAD_CONN:
|
2008-04-18 13:28:56 +00:00
|
|
|
aPad->m_Drill = wxSize( 0, 0 );
|
|
|
|
aPad->m_Offset.x = 0;
|
|
|
|
aPad->m_Offset.y = 0;
|
2008-02-23 01:27:21 +00:00
|
|
|
}
|
|
|
|
|
2010-09-18 17:55:08 +00:00
|
|
|
aPad->ComputeShapeMaxRadius();
|
2008-02-23 01:27:21 +00:00
|
|
|
|
2008-04-18 13:28:56 +00:00
|
|
|
if( aDraw )
|
2011-01-30 22:22:38 +00:00
|
|
|
DrawPanel->RefreshDrawingRect( aPad->GetBoundingBox() );
|
2009-11-18 12:52:19 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
( (MODULE*) aPad->GetParent() )->m_LastEdit_Time = time( NULL );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-18 12:52:19 +00:00
|
|
|
/* Add a pad on the selected module.
|
|
|
|
*/
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_BASE_FRAME::AddPad( MODULE* Module, bool draw )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2011-04-05 17:49:14 +00:00
|
|
|
wxString lastPadName; // Last used pad name (pad num)
|
|
|
|
lastPadName = g_Pad_Master.ReturnStringPadName();
|
2008-02-23 01:27:21 +00:00
|
|
|
|
|
|
|
m_Pcb->m_Status_Pcb = 0;
|
|
|
|
Module->m_LastEdit_Time = time( NULL );
|
|
|
|
|
2011-04-05 17:49:14 +00:00
|
|
|
D_PAD* Pad = new D_PAD( Module );
|
2008-02-23 01:27:21 +00:00
|
|
|
|
2009-11-18 12:52:19 +00:00
|
|
|
/* Add the new pad to end of the module pad list. */
|
2008-12-04 04:28:11 +00:00
|
|
|
Module->m_Pads.PushBack( Pad );
|
2008-02-23 01:27:21 +00:00
|
|
|
|
2009-11-18 12:52:19 +00:00
|
|
|
/* Update the pad properties. */
|
2008-04-18 13:28:56 +00:00
|
|
|
Import_Pad_Settings( Pad, false );
|
2009-10-14 18:14:58 +00:00
|
|
|
Pad->SetNetname( wxEmptyString );
|
2008-02-23 01:27:21 +00:00
|
|
|
|
2011-02-11 20:48:13 +00:00
|
|
|
Pad->m_Pos = GetScreen()->GetCrossHairPosition();
|
2008-02-23 01:27:21 +00:00
|
|
|
|
2011-04-05 17:49:14 +00:00
|
|
|
// Set the relative pad position
|
|
|
|
// ( pad position for module orient, 0, and relative to the module position)
|
|
|
|
Pad->m_Pos0 = Pad->m_Pos - Module->m_Pos;
|
|
|
|
RotatePoint( &Pad->m_Pos0, -Module->m_Orient );
|
2008-02-23 01:27:21 +00:00
|
|
|
|
2011-04-05 17:49:14 +00:00
|
|
|
/* Automatically increment the current pad number. */
|
2009-11-18 12:52:19 +00:00
|
|
|
long num = 0;
|
|
|
|
int ponder = 1;
|
|
|
|
|
2011-04-05 17:49:14 +00:00
|
|
|
while( lastPadName.Len() && lastPadName.Last() >= '0'
|
|
|
|
&& lastPadName.Last() <= '9' )
|
2008-02-23 01:27:21 +00:00
|
|
|
{
|
2011-04-05 17:49:14 +00:00
|
|
|
num += ( lastPadName.Last() - '0' ) * ponder;
|
|
|
|
lastPadName.RemoveLast();
|
2008-02-23 01:27:21 +00:00
|
|
|
ponder *= 10;
|
|
|
|
}
|
|
|
|
|
2011-04-05 17:49:14 +00:00
|
|
|
num++; // Use next number for the new pad
|
|
|
|
lastPadName << num;
|
|
|
|
Pad->SetPadName( lastPadName );
|
|
|
|
g_Pad_Master.SetPadName(lastPadName);
|
2008-02-23 01:27:21 +00:00
|
|
|
|
|
|
|
Module->Set_Rectangle_Encadrement();
|
2009-04-17 08:51:02 +00:00
|
|
|
Pad->DisplayInfo( this );
|
2009-10-14 18:14:58 +00:00
|
|
|
if( draw )
|
2011-01-30 22:22:38 +00:00
|
|
|
DrawPanel->RefreshDrawingRect( Module->GetBoundingBox() );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-02-23 01:27:21 +00:00
|
|
|
|
2010-11-12 16:36:43 +00:00
|
|
|
/**
|
|
|
|
* Function DeletePad
|
2010-08-11 13:15:30 +00:00
|
|
|
* Delete the pad aPad.
|
|
|
|
* Refresh the modified screen area
|
|
|
|
* Refresh modified parameters of the parent module (bounding box, last date)
|
|
|
|
* @param aPad = the pad to delete
|
|
|
|
* @param aQuery = true to promt for confirmation, false to delete silently
|
|
|
|
*/
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_BASE_FRAME::DeletePad( D_PAD* aPad, bool aQuery )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-02-23 01:27:21 +00:00
|
|
|
MODULE* Module;
|
2010-09-18 17:55:08 +00:00
|
|
|
|
2010-08-11 13:15:30 +00:00
|
|
|
if( aPad == NULL )
|
2008-02-23 01:27:21 +00:00
|
|
|
return;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-08-11 13:15:30 +00:00
|
|
|
Module = (MODULE*) aPad->GetParent();
|
2008-02-23 01:27:21 +00:00
|
|
|
Module->m_LastEdit_Time = time( NULL );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-08-11 13:15:30 +00:00
|
|
|
if( aQuery )
|
|
|
|
{
|
|
|
|
wxString msg;
|
|
|
|
msg.Printf( _( "Delete Pad (module %s %s) " ),
|
|
|
|
GetChars( Module->m_Reference->m_Text ),
|
|
|
|
GetChars( Module->m_Value->m_Text ) );
|
|
|
|
if( !IsOK( this, msg ) )
|
|
|
|
return;
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-02-23 01:27:21 +00:00
|
|
|
m_Pcb->m_Status_Pcb = 0;
|
2010-08-11 13:15:30 +00:00
|
|
|
aPad->DeleteStructure();
|
2011-01-30 22:22:38 +00:00
|
|
|
DrawPanel->RefreshDrawingRect( Module->GetBoundingBox() );
|
2008-02-23 01:27:21 +00:00
|
|
|
Module->Set_Rectangle_Encadrement();
|
2008-03-18 02:52:49 +00:00
|
|
|
|
2010-02-19 13:23:58 +00:00
|
|
|
OnModify();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-02-23 01:27:21 +00:00
|
|
|
|
2009-11-18 12:52:19 +00:00
|
|
|
/* Function to initialize the "move pad" command */
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_BASE_FRAME::StartMovePad( D_PAD* Pad, wxDC* DC )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-02-23 01:27:21 +00:00
|
|
|
if( Pad == NULL )
|
|
|
|
return;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-02-23 01:27:21 +00:00
|
|
|
s_CurrentSelectedPad = Pad;
|
|
|
|
Pad_OldPos = Pad->m_Pos;
|
2009-04-17 08:51:02 +00:00
|
|
|
Pad->DisplayInfo( this );
|
2011-02-12 19:38:55 +00:00
|
|
|
DrawPanel->SetMouseCapture( Show_Pad_Move, Abort_Move_Pad );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-02-23 01:27:21 +00:00
|
|
|
/* Draw the pad (SKETCH mode) */
|
2008-04-01 05:21:50 +00:00
|
|
|
Pad->Draw( DrawPanel, DC, GR_XOR );
|
2008-02-23 01:27:21 +00:00
|
|
|
Pad->m_Flags |= IS_MOVED;
|
2008-04-01 05:21:50 +00:00
|
|
|
Pad->Draw( DrawPanel, DC, GR_XOR );
|
2007-10-07 18:24:15 +00:00
|
|
|
|
2008-02-23 01:27:21 +00:00
|
|
|
/* Build the list of track segments to drag if the command is a drag pad*/
|
|
|
|
if( g_Drag_Pistes_On )
|
|
|
|
Build_1_Pad_SegmentsToDrag( DrawPanel, DC, Pad );
|
|
|
|
else
|
2010-08-31 15:54:05 +00:00
|
|
|
EraseDragList();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-18 12:52:19 +00:00
|
|
|
/* Routine to place a moved pad. */
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_BASE_FRAME::PlacePad( D_PAD* Pad, wxDC* DC )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-10-14 18:14:58 +00:00
|
|
|
int dX, dY;
|
|
|
|
TRACK* Track;
|
|
|
|
MODULE* Module;
|
2008-02-23 01:27:21 +00:00
|
|
|
|
|
|
|
if( Pad == NULL )
|
|
|
|
return;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
Module = (MODULE*) Pad->GetParent();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-10-14 18:14:58 +00:00
|
|
|
ITEM_PICKER picker( NULL, UR_CHANGED );
|
2009-08-03 18:54:48 +00:00
|
|
|
PICKED_ITEMS_LIST pickList;
|
|
|
|
|
2009-11-18 12:52:19 +00:00
|
|
|
/* Save dragged track segments in undo list */
|
2010-08-31 15:54:05 +00:00
|
|
|
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
|
2009-08-03 18:54:48 +00:00
|
|
|
{
|
2010-08-31 15:54:05 +00:00
|
|
|
Track = g_DragSegmentList[ii].m_Segm;
|
2009-10-14 18:14:58 +00:00
|
|
|
|
2009-08-03 18:54:48 +00:00
|
|
|
// Set the old state
|
2010-08-31 15:54:05 +00:00
|
|
|
if( g_DragSegmentList[ii].m_Pad_Start )
|
2009-08-03 18:54:48 +00:00
|
|
|
Track->m_Start = Pad_OldPos;
|
2010-08-31 15:54:05 +00:00
|
|
|
if( g_DragSegmentList[ii].m_Pad_End )
|
2009-08-03 18:54:48 +00:00
|
|
|
Track->m_End = Pad_OldPos;
|
|
|
|
|
|
|
|
picker.m_PickedItem = Track;
|
2009-10-14 18:14:58 +00:00
|
|
|
pickList.PushItem( picker );
|
2009-08-03 18:54:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Save old module and old items values */
|
|
|
|
wxPoint pad_curr_position = Pad->m_Pos;
|
|
|
|
|
|
|
|
Pad->m_Pos = Pad_OldPos;
|
2011-05-13 13:15:28 +00:00
|
|
|
|
2010-08-31 15:54:05 +00:00
|
|
|
if( g_DragSegmentList.size() == 0 )
|
2009-08-03 18:54:48 +00:00
|
|
|
SaveCopyInUndoList( Module, UR_CHANGED );
|
|
|
|
else
|
|
|
|
{
|
|
|
|
picker.m_PickedItem = Module;
|
2009-10-14 18:14:58 +00:00
|
|
|
pickList.PushItem( picker );
|
2009-08-03 18:54:48 +00:00
|
|
|
SaveCopyInUndoList( pickList, UR_CHANGED );
|
2010-08-31 15:54:05 +00:00
|
|
|
}
|
2009-08-03 18:54:48 +00:00
|
|
|
|
|
|
|
Pad->m_Pos = pad_curr_position;
|
2008-04-01 05:21:50 +00:00
|
|
|
Pad->Draw( DrawPanel, DC, GR_XOR );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-08-03 18:54:48 +00:00
|
|
|
/* Redraw dragged track segments */
|
2010-08-31 15:54:05 +00:00
|
|
|
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
|
2009-08-03 18:54:48 +00:00
|
|
|
{
|
2010-08-31 15:54:05 +00:00
|
|
|
Track = g_DragSegmentList[ii].m_Segm;
|
2009-10-14 18:14:58 +00:00
|
|
|
|
2009-08-03 18:54:48 +00:00
|
|
|
// Set the new state
|
2010-08-31 15:54:05 +00:00
|
|
|
if( g_DragSegmentList[ii].m_Pad_Start )
|
2009-08-03 18:54:48 +00:00
|
|
|
Track->m_Start = Pad->m_Pos;
|
2010-08-31 15:54:05 +00:00
|
|
|
if( g_DragSegmentList[ii].m_Pad_End )
|
2009-08-03 18:54:48 +00:00
|
|
|
Track->m_End = Pad->m_Pos;
|
|
|
|
|
2011-02-13 17:53:48 +00:00
|
|
|
Track->SetState( IN_EDIT, OFF );
|
2011-05-13 13:15:28 +00:00
|
|
|
|
2009-10-14 18:14:58 +00:00
|
|
|
if( DC )
|
2009-08-03 18:54:48 +00:00
|
|
|
Track->Draw( DrawPanel, DC, GR_OR );
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-11-18 12:52:19 +00:00
|
|
|
/* Compute local coordinates (i.e refer to Module position and for Module
|
|
|
|
* orient = 0) */
|
2008-02-23 01:27:21 +00:00
|
|
|
dX = Pad->m_Pos.x - Pad_OldPos.x;
|
|
|
|
dY = Pad->m_Pos.y - Pad_OldPos.y;
|
|
|
|
RotatePoint( &dX, &dY, -Module->m_Orient );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-02-23 01:27:21 +00:00
|
|
|
Pad->m_Pos0.x += dX;
|
|
|
|
s_CurrentSelectedPad->m_Pos0.y += dY;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-02-23 01:27:21 +00:00
|
|
|
Pad->m_Flags = 0;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-10-14 18:14:58 +00:00
|
|
|
if( DC )
|
2009-05-21 12:45:21 +00:00
|
|
|
Pad->Draw( DrawPanel, DC, GR_OR );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-02-23 01:27:21 +00:00
|
|
|
Module->Set_Rectangle_Encadrement();
|
|
|
|
Module->m_LastEdit_Time = time( NULL );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-08-31 15:54:05 +00:00
|
|
|
EraseDragList();
|
2008-02-23 01:27:21 +00:00
|
|
|
|
2010-02-19 13:23:58 +00:00
|
|
|
OnModify();
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->SetMouseCapture( NULL, NULL );
|
2009-11-18 12:52:19 +00:00
|
|
|
m_Pcb->m_Status_Pcb &= ~( LISTE_RATSNEST_ITEM_OK | CONNEXION_OK );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-02-23 01:27:21 +00:00
|
|
|
|
2009-11-18 12:52:19 +00:00
|
|
|
/* Rotate selected pad 90 degrees.
|
2007-06-05 12:10:51 +00:00
|
|
|
*/
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_BASE_FRAME::RotatePad( D_PAD* Pad, wxDC* DC )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-02-23 01:27:21 +00:00
|
|
|
MODULE* Module;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-02-23 01:27:21 +00:00
|
|
|
if( Pad == NULL )
|
|
|
|
return;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
Module = (MODULE*) Pad->GetParent();
|
2008-02-23 01:27:21 +00:00
|
|
|
Module->m_LastEdit_Time = time( NULL );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-02-19 13:23:58 +00:00
|
|
|
OnModify();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-10-14 18:14:58 +00:00
|
|
|
if( DC )
|
2009-05-21 12:45:21 +00:00
|
|
|
Module->Draw( DrawPanel, DC, GR_XOR );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-02-23 01:27:21 +00:00
|
|
|
EXCHG( Pad->m_Size.x, Pad->m_Size.y );
|
|
|
|
EXCHG( Pad->m_Drill.x, Pad->m_Drill.y );
|
|
|
|
EXCHG( Pad->m_Offset.x, Pad->m_Offset.y );
|
|
|
|
Pad->m_Offset.y = -Pad->m_Offset.y;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-02-23 01:27:21 +00:00
|
|
|
EXCHG( Pad->m_DeltaSize.x, Pad->m_DeltaSize.y );
|
2009-11-18 12:52:19 +00:00
|
|
|
Pad->m_DeltaSize.x = -Pad->m_DeltaSize.x;
|
2008-02-23 01:27:21 +00:00
|
|
|
Module->Set_Rectangle_Encadrement();
|
2009-04-17 08:51:02 +00:00
|
|
|
Pad->DisplayInfo( this );
|
2009-11-18 12:52:19 +00:00
|
|
|
|
2009-10-14 18:14:58 +00:00
|
|
|
if( DC )
|
2009-05-21 12:45:21 +00:00
|
|
|
Module->Draw( DrawPanel, DC, GR_OR );
|
2008-02-23 01:27:21 +00:00
|
|
|
}
|