Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
811b8936
Commit
811b8936
authored
Feb 23, 2008
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
beautify
parent
2f3df174
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
297 additions
and
269 deletions
+297
-269
move-drag_pads.cpp
pcbnew/move-drag_pads.cpp
+297
-269
No files found.
pcbnew/move-drag_pads.cpp
View file @
811b8936
/*************************/
/*************************/
/* Edition des Pastilles */
/* Edition des Pastilles */
/*************************/
/*************************/
#include "fctsys.h"
#include "fctsys.h"
#include "gr_basic.h"
#include "gr_basic.h"
...
@@ -16,365 +16,393 @@
...
@@ -16,365 +16,393 @@
/* Routines Locales */
/* Routines Locales */
/* Variables locales */
/* Variables locales */
static
D_PAD
*
s_CurrentSelectedPad
;
/* pointeur sur le pad selecte pour edition */
static
D_PAD
*
s_CurrentSelectedPad
;
/* pointeur sur le pad selecte pour edition */
static
wxPoint
Pad_OldPos
;
static
wxPoint
Pad_OldPos
;
/************************************************************/
/************************************************************/
static
void
Exit_Move_Pad
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
)
static
void
Exit_Move_Pad
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
)
/************************************************************/
/************************************************************/
/* Routine de sortie du menu EDIT PADS.
/* Routine de sortie du menu EDIT PADS.
Sortie simple si pad de pad en mouvement
*
Sortie simple si pad de pad en mouvement
Remise en etat des conditions initiales avant move si move en cours
*
Remise en etat des conditions initiales avant move si move en cours
*/
*/
{
{
D_PAD
*
pad
=
s_CurrentSelectedPad
;
D_PAD
*
pad
=
s_CurrentSelectedPad
;
Panel
->
ManageCurseur
=
NULL
;
Panel
->
ManageCurseur
=
NULL
;
Panel
->
ForceCloseManageCurseur
=
NULL
;
Panel
->
ForceCloseManageCurseur
=
NULL
;.
if
(
pad
==
NULL
)
return
;
if
(
pad
==
NULL
)
return
;
pad
->
Draw
(
Panel
,
DC
,
wxPoint
(
0
,
0
),
GR_XOR
);
pad
->
m_Flags
=
0
;
pad
->
Draw
(
Panel
,
DC
,
wxPoint
(
0
,
0
),
GR_XOR
);
pad
->
m_Pos
=
Pad_OldPos
;
pad
->
m_Flags
=
0
;
pad
->
Draw
(
Panel
,
DC
,
wxPoint
(
0
,
0
),
GR_XOR
);
pad
->
m_Pos
=
Pad_OldPos
;
/* Pad Move en cours : remise a l'etat d'origine */
pad
->
Draw
(
Panel
,
DC
,
wxPoint
(
0
,
0
),
GR_XOR
);
if
(
g_Drag_Pistes_On
)
/* Pad Move en cours : remise a l'etat d'origine */
{
if
(
g_Drag_Pistes_On
)
/* Effacement des segments dragges */
{
DRAG_SEGM
*
pt_drag
=
g_DragSegmentList
;
/* Effacement des segments dragges */
for
(
;
pt_drag
!=
NULL
;
pt_drag
=
pt_drag
->
Pnext
)
DRAG_SEGM
*
pt_drag
=
g_DragSegmentList
;
{
for
(
;
pt_drag
!=
NULL
;
pt_drag
=
pt_drag
->
Pnext
)
TRACK
*
Track
=
pt_drag
->
m_Segm
;
{
Track
->
Draw
(
Panel
,
DC
,
GR_XOR
);
TRACK
*
Track
=
pt_drag
->
m_Segm
;
Track
->
SetState
(
EDIT
,
OFF
);
Track
->
Draw
(
Panel
,
DC
,
GR_XOR
);
pt_drag
->
SetInitialValues
();
Track
->
SetState
(
EDIT
,
OFF
);
Track
->
Draw
(
Panel
,
DC
,
GR_OR
);
pt_drag
->
SetInitialValues
();
}
Track
->
Draw
(
Panel
,
DC
,
GR_OR
);
}
}
}
EraseDragListe
();
s_CurrentSelectedPad
=
NULL
;
EraseDragListe
();
g_Drag_Pistes_On
=
FALSE
;
s_CurrentSelectedPad
=
NULL
;
g_Drag_Pistes_On
=
FALSE
;
}
}
/*************************************************************************/
/*************************************************************************/
static
void
Show_Pad_Move
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
)
static
void
Show_Pad_Move
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
)
/*************************************************************************/
/*************************************************************************/
/* Affiche le pad et les pistes en mode drag lors des deplacements du pad */
/* Affiche le pad et les pistes en mode drag lors des deplacements du pad */
{
{
TRACK
*
Track
;
TRACK
*
Track
;
DRAG_SEGM
*
pt_drag
;
DRAG_SEGM
*
pt_drag
;
BASE_SCREEN
*
screen
=
panel
->
GetScreen
();
BASE_SCREEN
*
screen
=
panel
->
GetScreen
();
D_PAD
*
pad
=
s_CurrentSelectedPad
;
D_PAD
*
pad
=
s_CurrentSelectedPad
;
if
(
erase
)
pad
->
Draw
(
panel
,
DC
,
wxPoint
(
0
,
0
),
GR_XOR
);
if
(
erase
)
pad
->
m_Pos
=
screen
->
m_Curseur
;
pad
->
Draw
(
panel
,
DC
,
wxPoint
(
0
,
0
),
GR_XOR
);
pad
->
Draw
(
panel
,
DC
,
wxPoint
(
0
,
0
),
GR_XOR
);
pad
->
m_Pos
=
screen
->
m_Curseur
;
pad
->
Draw
(
panel
,
DC
,
wxPoint
(
0
,
0
),
GR_XOR
);
if
(
!
g_Drag_Pistes_On
)
return
;
if
(
!
g_Drag_Pistes_On
)
/* Tracage des segments dragges */
return
;
pt_drag
=
g_DragSegmentList
;
for
(
;
pt_drag
!=
NULL
;
pt_drag
=
pt_drag
->
Pnext
)
/* Tracage des segments dragges */
{
pt_drag
=
g_DragSegmentList
;
Track
=
pt_drag
->
m_Segm
;
for
(
;
pt_drag
!=
NULL
;
pt_drag
=
pt_drag
->
Pnext
)
if
(
erase
)
Track
->
Draw
(
panel
,
DC
,
GR_XOR
);
{
if
(
pt_drag
->
m_Pad_Start
)
Track
=
pt_drag
->
m_Segm
;
{
if
(
erase
)
Track
->
m_Start
=
pad
->
m_Pos
;
Track
->
Draw
(
panel
,
DC
,
GR_XOR
);
}
if
(
pt_drag
->
m_Pad_Start
)
if
(
pt_drag
->
m_Pad_End
)
{
{
Track
->
m_Start
=
pad
->
m_Pos
;
Track
->
m_End
=
pad
->
m_Pos
;
}
}
if
(
pt_drag
->
m_Pad_End
)
Track
->
Draw
(
panel
,
DC
,
GR_XOR
);
{
}
Track
->
m_End
=
pad
->
m_Pos
;
}
Track
->
Draw
(
panel
,
DC
,
GR_XOR
);
}
}
}
/*************************************************************/
/*************************************************************/
void
WinEDA_BasePcbFrame
::
Export_Pad_Settings
(
D_PAD
*
pt_pad
)
void
WinEDA_BasePcbFrame
::
Export_Pad_Settings
(
D_PAD
*
pt_pad
)
/*************************************************************/
/*************************************************************/
/* Charge en liste des caracteristiques par defaut celles du pad selecte
/* Charge en liste des caracteristiques par defaut celles du pad selecte
*/
*/
{
{
MODULE
*
Module
;
MODULE
*
Module
;
if
(
pt_pad
==
NULL
)
return
;
if
(
pt_pad
==
NULL
)
return
;
Module
=
(
MODULE
*
)
pt_pad
->
m_Parent
;
Module
=
(
MODULE
*
)
pt_pad
->
m_Parent
;
pt_pad
->
Display_Infos
(
this
);
pt_pad
->
Display_Infos
(
this
);
g_Pad_Master
.
m_PadShape
=
pt_pad
->
m_PadShape
;
g_Pad_Master
.
m_PadShape
=
pt_pad
->
m_PadShape
;
g_Pad_Master
.
m_Attribut
=
pt_pad
->
m_Attribut
;
g_Pad_Master
.
m_Attribut
=
pt_pad
->
m_Attribut
;
g_Pad_Master
.
m_Masque_Layer
=
pt_pad
->
m_Masque_Layer
;
g_Pad_Master
.
m_Masque_Layer
=
pt_pad
->
m_Masque_Layer
;
g_Pad_Master
.
m_Orient
=
pt_pad
->
m_Orient
-
g_Pad_Master
.
m_Orient
=
pt_pad
->
m_Orient
-
((
MODULE
*
)
pt_pad
->
m_Parent
)
->
m_Orient
;
(
(
MODULE
*
)
pt_pad
->
m_Parent
)
->
m_Orient
;
g_Pad_Master
.
m_Size
=
pt_pad
->
m_Size
;
g_Pad_Master
.
m_Size
=
pt_pad
->
m_Size
;
g_Pad_Master
.
m_DeltaSize
=
pt_pad
->
m_DeltaSize
;
g_Pad_Master
.
m_DeltaSize
=
pt_pad
->
m_DeltaSize
;
pt_pad
->
ComputeRayon
();
pt_pad
->
ComputeRayon
();
g_Pad_Master
.
m_Offset
=
pt_pad
->
m_Offset
;
g_Pad_Master
.
m_Offset
=
pt_pad
->
m_Offset
;
g_Pad_Master
.
m_Drill
=
pt_pad
->
m_Drill
;
g_Pad_Master
.
m_Drill
=
pt_pad
->
m_Drill
;
g_Pad_Master
.
m_DrillShape
=
pt_pad
->
m_DrillShape
;
g_Pad_Master
.
m_DrillShape
=
pt_pad
->
m_DrillShape
;
}
}
/***********************************************************************/
/***********************************************************************/
void
WinEDA_BasePcbFrame
::
Import_Pad_Settings
(
D_PAD
*
pt_pad
,
wxDC
*
DC
)
void
WinEDA_BasePcbFrame
::
Import_Pad_Settings
(
D_PAD
*
pt_pad
,
wxDC
*
DC
)
/***********************************************************************/
/***********************************************************************/
/* Met a jour les nouvelles valeurs de dimensions du pad pointe par pt_pad
/* Met a jour les nouvelles valeurs de dimensions du pad pointe par pt_pad
- Source : valeurs choisies des caracteristiques generales
*
- Source : valeurs choisies des caracteristiques generales
- les dimensions sont modifiees
*
- les dimensions sont modifiees
- la position et les noms ne sont pas touches
*
- la position et les noms ne sont pas touches
*/
*/
{
{
if
(
DC
)
pt_pad
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_XOR
);
if
(
DC
)
pt_pad
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_XOR
);
pt_pad
->
m_PadShape
=
g_Pad_Master
.
m_PadShape
;
pt_pad
->
m_Masque_Layer
=
g_Pad_Master
.
m_Masque_Layer
;
pt_pad
->
m_PadShape
=
g_Pad_Master
.
m_PadShape
;
pt_pad
->
m_Attribut
=
g_Pad_Master
.
m_Attribut
;
pt_pad
->
m_Masque_Layer
=
g_Pad_Master
.
m_Masque_Layer
;
pt_pad
->
m_Orient
=
g_Pad_Master
.
m_Orient
+
pt_pad
->
m_Attribut
=
g_Pad_Master
.
m_Attribut
;
((
MODULE
*
)
pt_pad
->
m_Parent
)
->
m_Orient
;
pt_pad
->
m_Orient
=
g_Pad_Master
.
m_Orient
+
pt_pad
->
m_Size
=
g_Pad_Master
.
m_Size
;
(
(
MODULE
*
)
pt_pad
->
m_Parent
)
->
m_Orient
;
pt_pad
->
m_DeltaSize
=
wxSize
(
0
,
0
);
pt_pad
->
m_Size
=
g_Pad_Master
.
m_Size
;
pt_pad
->
m_Offset
=
g_Pad_Master
.
m_Offset
;
pt_pad
->
m_DeltaSize
=
wxSize
(
0
,
0
);
pt_pad
->
m_Drill
=
g_Pad_Master
.
m_Drill
;
pt_pad
->
m_Offset
=
g_Pad_Master
.
m_Offset
;
pt_pad
->
m_DrillShape
=
g_Pad_Master
.
m_DrillShape
;
pt_pad
->
m_Drill
=
g_Pad_Master
.
m_Drill
;
pt_pad
->
m_DrillShape
=
g_Pad_Master
.
m_DrillShape
;
/* Traitement des cas particuliers : */
switch
(
g_Pad_Master
.
m_PadShape
)
/* Traitement des cas particuliers : */
{
switch
(
g_Pad_Master
.
m_PadShape
)
case
PAD_TRAPEZOID
:
{
pt_pad
->
m_DeltaSize
=
g_Pad_Master
.
m_DeltaSize
;
case
PAD_TRAPEZOID
:
break
;
pt_pad
->
m_DeltaSize
=
g_Pad_Master
.
m_DeltaSize
;
break
;
case
PAD_CIRCLE
:
pt_pad
->
m_Size
.
y
=
pt_pad
->
m_Size
.
x
;
case
PAD_CIRCLE
:
break
;
pt_pad
->
m_Size
.
y
=
pt_pad
->
m_Size
.
x
;
break
;
}
}
switch
(
g_Pad_Master
.
m_Attribut
&
0x7F
)
switch
(
g_Pad_Master
.
m_Attribut
&
0x7F
)
{
{
case
PAD_SMD
:
case
PAD_SMD
:
case
PAD_CONN
:
case
PAD_CONN
:
pt_pad
->
m_Drill
=
wxSize
(
0
,
0
);
pt_pad
->
m_Drill
=
wxSize
(
0
,
0
);
pt_pad
->
m_Offset
.
x
=
0
;
pt_pad
->
m_Offset
.
x
=
0
;
pt_pad
->
m_Offset
.
y
=
0
;
pt_pad
->
m_Offset
.
y
=
0
;
}
}
pt_pad
->
ComputeRayon
();
pt_pad
->
ComputeRayon
();
if
(
DC
)
pt_pad
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_XOR
);
if
(
DC
)
((
MODULE
*
)
pt_pad
->
m_Parent
)
->
m_LastEdit_Time
=
time
(
NULL
);
pt_pad
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_XOR
);
(
(
MODULE
*
)
pt_pad
->
m_Parent
)
->
m_LastEdit_Time
=
time
(
NULL
);
}
}
/***********************************************************/
/***********************************************************/
void
WinEDA_BasePcbFrame
::
AddPad
(
MODULE
*
Module
,
wxDC
*
DC
)
void
WinEDA_BasePcbFrame
::
AddPad
(
MODULE
*
Module
,
wxDC
*
DC
)
/***********************************************************/
/***********************************************************/
/* Routine d'ajout d'un pad sur l'module selectionnee */
/* Routine d'ajout d'un pad sur l'module selectionnee */
{
{
D_PAD
*
Pad
,
*
ptliste
;
D_PAD
*
Pad
,
*
ptliste
;
int
rX
,
rY
;
int
rX
,
rY
;
m_Pcb
->
m_Status_Pcb
=
0
;
m_Pcb
->
m_Status_Pcb
=
0
;
Module
->
m_LastEdit_Time
=
time
(
NULL
);
Module
->
m_LastEdit_Time
=
time
(
NULL
);
Pad
=
new
D_PAD
(
Module
);
Pad
=
new
D_PAD
(
Module
);
/* Chainage de la structure en fin de liste des pads : */
/* Chainage de la structure en fin de liste des pads : */
ptliste
=
Module
->
m_Pads
;
ptliste
=
Module
->
m_Pads
;
if
(
ptliste
==
NULL
)
/* 1er pad */
if
(
ptliste
==
NULL
)
/* 1er pad */
{
{
Module
->
m_Pads
=
Pad
;
Module
->
m_Pads
=
Pad
;
Pad
->
Pback
=
(
EDA_BaseStruct
*
)
Module
;
Pad
->
Pback
=
(
EDA_BaseStruct
*
)
Module
;
}
}
else
else
{
{
while
(
ptliste
)
while
(
ptliste
)
{
{
if
(
ptliste
->
Pnext
==
NULL
)
break
;
if
(
ptliste
->
Pnext
==
NULL
)
ptliste
=
(
D_PAD
*
)
ptliste
->
Pnext
;
break
;
}
ptliste
=
(
D_PAD
*
)
ptliste
->
Pnext
;
Pad
->
Pback
=
(
EDA_BaseStruct
*
)
ptliste
;
}
ptliste
->
Pnext
=
(
EDA_BaseStruct
*
)
Pad
;
}
Pad
->
Pback
=
(
EDA_BaseStruct
*
)
ptliste
;
ptliste
->
Pnext
=
(
EDA_BaseStruct
*
)
Pad
;
/* Mise a jour des caract de la pastille : */
}
Import_Pad_Settings
(
Pad
,
NULL
);
Pad
->
m_Netname
.
Empty
();
/* Mise a jour des caract de la pastille : */
Import_Pad_Settings
(
Pad
,
NULL
);
Pad
->
m_Pos
=
GetScreen
()
->
m_Curseur
;
Pad
->
m_Netname
.
Empty
();
rX
=
Pad
->
m_Pos
.
x
-
Module
->
m_Pos
.
x
;
rY
=
Pad
->
m_Pos
.
y
-
Module
->
m_Pos
.
y
;
Pad
->
m_Pos
=
GetScreen
()
->
m_Curseur
;
RotatePoint
(
&
rX
,
&
rY
,
-
Module
->
m_Orient
);
Pad
->
m_Pos0
.
x
=
rX
;
Pad
->
m_Pos0
.
y
=
rY
;
rX
=
Pad
->
m_Pos
.
x
-
Module
->
m_Pos
.
x
;
rY
=
Pad
->
m_Pos
.
y
-
Module
->
m_Pos
.
y
;
/* Increment automatique de la reference courante Current_PadName */
long
num
=
0
;
int
ponder
=
1
;
RotatePoint
(
&
rX
,
&
rY
,
-
Module
->
m_Orient
);
while
(
g_Current_PadName
.
Last
()
>=
'0'
&&
g_Current_PadName
.
Last
()
<=
'9'
)
{
Pad
->
m_Pos0
.
x
=
rX
;
num
+=
(
g_Current_PadName
.
Last
()
-
'0'
)
*
ponder
;
Pad
->
m_Pos0
.
y
=
rY
;
g_Current_PadName
.
RemoveLast
();
ponder
*=
10
;
/* Increment automatique de la reference courante Current_PadName */
}
long
num
=
0
;
int
ponder
=
1
;
num
++
;
while
(
g_Current_PadName
.
Len
()
&&
g_Current_PadName
.
Last
()
>=
'0'
&&
g_Current_PadName
<<
num
;
g_Current_PadName
.
Last
()
<=
'9'
)
Pad
->
SetPadName
(
g_Current_PadName
);
{
num
+=
(
g_Current_PadName
.
Last
()
-
'0'
)
*
ponder
;
/* Redessin du module */
g_Current_PadName
.
RemoveLast
();
Module
->
Set_Rectangle_Encadrement
();
ponder
*=
10
;
Pad
->
Display_Infos
(
this
);
}
Module
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_OR
);
num
++
;
g_Current_PadName
<<
num
;
Pad
->
SetPadName
(
g_Current_PadName
);
/* Redessin du module */
Module
->
Set_Rectangle_Encadrement
();
Pad
->
Display_Infos
(
this
);
Module
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_OR
);
}
}
/*********************************************************/
/*********************************************************/
void
WinEDA_BasePcbFrame
::
DeletePad
(
D_PAD
*
Pad
,
wxDC
*
DC
)
void
WinEDA_BasePcbFrame
::
DeletePad
(
D_PAD
*
Pad
,
wxDC
*
DC
)
/*********************************************************/
/*********************************************************/
/* Function to delete the pad "pad" */
/* Function to delete the pad "pad" */
{
{
MODULE
*
Module
;
MODULE
*
Module
;
wxString
line
;
wxString
line
;
if
(
Pad
==
NULL
)
return
;
if
(
Pad
==
NULL
)
return
;
Module
=
(
MODULE
*
)
Pad
->
m_Parent
;
Module
=
(
MODULE
*
)
Pad
->
m_Parent
;
Module
->
m_LastEdit_Time
=
time
(
NULL
);
Module
->
m_LastEdit_Time
=
time
(
NULL
);
line
.
Printf
(
_
(
"Delete Pad (module %s %s) "
),
line
.
Printf
(
_
(
"Delete Pad (module %s %s) "
),
Module
->
m_Reference
->
m_Text
.
GetData
(),
Module
->
m_Value
->
m_Text
.
GetData
()
);
Module
->
m_Reference
->
m_Text
.
GetData
(),
Module
->
m_Value
->
m_Text
.
GetData
()
);
if
(
!
IsOK
(
this
,
line
)
)
return
;
if
(
!
IsOK
(
this
,
line
)
)
return
;
m_Pcb
->
m_Status_Pcb
=
0
;
m_Pcb
->
m_Status_Pcb
=
0
;
if
(
DC
)
Pad
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_XOR
);
if
(
DC
)
Pad
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_XOR
);
Pad
->
DeleteStructure
();
Pad
->
DeleteStructure
();
/* Redessin du module */
/* Redessin du module */
if
(
DC
)
Module
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_OR
);
if
(
DC
)
Module
->
Set_Rectangle_Encadrement
();
Module
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_OR
);
GetScreen
()
->
SetModify
();
Module
->
Set_Rectangle_Encadrement
();
return
;
GetScreen
()
->
SetModify
();
return
;
}
}
/*************************************************************/
/*************************************************************/
void
WinEDA_BasePcbFrame
::
StartMovePad
(
D_PAD
*
Pad
,
wxDC
*
DC
)
void
WinEDA_BasePcbFrame
::
StartMovePad
(
D_PAD
*
Pad
,
wxDC
*
DC
)
/*************************************************************/
/*************************************************************/
/* Function to initialise the "move pad" command */
/* Function to initialise the "move pad" command */
{
{
MODULE
*
Module
;
MODULE
*
Module
;
if
(
Pad
==
NULL
)
return
;
Module
=
(
MODULE
*
)
Pad
->
m_Parent
;
if
(
Pad
==
NULL
)
return
;
s_CurrentSelectedPad
=
Pad
;
Module
=
(
MODULE
*
)
Pad
->
m_Parent
;
Pad_OldPos
=
Pad
->
m_Pos
;
Pad
->
Display_Infos
(
this
);
DrawPanel
->
ManageCurseur
=
Show_Pad_Move
;
DrawPanel
->
ForceCloseManageCurseur
=
Exit_Move_Pad
;
/* Draw the pad (SKETCH mode) */
s_CurrentSelectedPad
=
Pad
;
Pad
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_XOR
);
Pad_OldPos
=
Pad
->
m_Pos
;
Pad
->
m_Flags
|=
IS_MOVED
;
Pad
->
Display_Infos
(
this
);
Pad
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_XOR
);
DrawPanel
->
ManageCurseur
=
Show_Pad_Move
;
DrawPanel
->
ForceCloseManageCurseur
=
Exit_Move_Pad
;
/* Build the list of track segments to drag if the command is a drag pad
*/
/* Draw the pad (SKETCH mode)
*/
if
(
g_Drag_Pistes_On
)
Pad
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_XOR
);
Build_1_Pad_SegmentsToDrag
(
DrawPanel
,
DC
,
Pad
)
;
Pad
->
m_Flags
|=
IS_MOVED
;
else
EraseDragListe
(
);
Pad
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_XOR
);
/* 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
EraseDragListe
();
}
}
/*********************************************************/
/*********************************************************/
void
WinEDA_BasePcbFrame
::
PlacePad
(
D_PAD
*
Pad
,
wxDC
*
DC
)
void
WinEDA_BasePcbFrame
::
PlacePad
(
D_PAD
*
Pad
,
wxDC
*
DC
)
/*********************************************************/
/*********************************************************/
/* Routine to Place a moved pad */
/* Routine to Place a moved pad */
{
{
int
dX
,
dY
;
int
dX
,
dY
;
TRACK
*
Track
;
TRACK
*
Track
;
DRAG_SEGM
*
pt_drag
;
DRAG_SEGM
*
pt_drag
;
MODULE
*
Module
;
MODULE
*
Module
;
if
(
Pad
==
NULL
)
return
;
if
(
Pad
==
NULL
)
return
;
Module
=
(
MODULE
*
)
Pad
->
m_Parent
;
Module
=
(
MODULE
*
)
Pad
->
m_Parent
;
/* Placement du pad */
Pad
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_XOR
);
/* Placement du pad */
/* Save old module */
Pad
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_XOR
);
Pad
->
m_Pos
=
Pad_OldPos
;
SaveCopyInUndoList
(
m_Pcb
->
m_Modules
);
Pad
->
m_Pos
=
GetScreen
()
->
m_Curseur
;
/* Save old module */
/* Compute local coordinates (i.e refer to Module position and for Module orient = 0)*/
Pad
->
m_Pos
=
Pad_OldPos
;
SaveCopyInUndoList
(
m_Pcb
->
m_Modules
);
dX
=
Pad
->
m_Pos
.
x
-
Pad_OldPos
.
x
;
Pad
->
m_Pos
=
GetScreen
()
->
m_Curseur
;
dY
=
Pad
->
m_Pos
.
y
-
Pad_OldPos
.
y
;
RotatePoint
(
&
dX
,
&
dY
,
-
Module
->
m_Orient
);
/* Compute local coordinates (i.e refer to Module position and for Module orient = 0)*/
Pad
->
m_Pos0
.
x
+=
dX
;
dX
=
Pad
->
m_Pos
.
x
-
Pad_OldPos
.
x
;
s_CurrentSelectedPad
->
m_Pos0
.
y
+=
dY
;
dY
=
Pad
->
m_Pos
.
y
-
Pad_OldPos
.
y
;
RotatePoint
(
&
dX
,
&
dY
,
-
Module
->
m_Orient
);
Pad
->
m_Pos0
.
x
+=
dX
;
s_CurrentSelectedPad
->
m_Pos0
.
y
+=
dY
;
Pad
->
m_Flags
=
0
;
Pad
->
m_Flags
=
0
;
Pad
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_OR
);
Pad
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_OR
);
Module
->
Set_Rectangle_Encadrement
();
Module
->
Set_Rectangle_Encadrement
();
Module
->
m_LastEdit_Time
=
time
(
NULL
);
Module
->
m_LastEdit_Time
=
time
(
NULL
);
/* Tracage des segments dragges */
/* Tracage des segments dragges */
pt_drag
=
g_DragSegmentList
;
pt_drag
=
g_DragSegmentList
;
for
(
;
pt_drag
;
pt_drag
=
pt_drag
->
Pnext
)
for
(
;
pt_drag
;
pt_drag
=
pt_drag
->
Pnext
)
{
{
Track
=
pt_drag
->
m_Segm
;
Track
=
pt_drag
->
m_Segm
;
Track
->
SetState
(
EDIT
,
OFF
);
Track
->
SetState
(
EDIT
,
OFF
);
Track
->
Draw
(
DrawPanel
,
DC
,
GR_OR
);
Track
->
Draw
(
DrawPanel
,
DC
,
GR_OR
);
}
}
EraseDragListe
();
GetScreen
()
->
SetModify
();
EraseDragListe
();
DrawPanel
->
ManageCurseur
=
NULL
;
DrawPanel
->
ForceCloseManageCurseur
=
NULL
;
GetScreen
()
->
SetModify
();
m_Pcb
->
m_Status_Pcb
&=
~
(
LISTE_CHEVELU_OK
|
CONNEXION_OK
);
DrawPanel
->
ManageCurseur
=
NULL
;
DrawPanel
->
ForceCloseManageCurseur
=
NULL
;
m_Pcb
->
m_Status_Pcb
&=
~
(
LISTE_CHEVELU_OK
|
CONNEXION_OK
);
}
}
/**********************************************************/
/**********************************************************/
void
WinEDA_BasePcbFrame
::
RotatePad
(
D_PAD
*
Pad
,
wxDC
*
DC
)
void
WinEDA_BasePcbFrame
::
RotatePad
(
D_PAD
*
Pad
,
wxDC
*
DC
)
/**********************************************************/
/**********************************************************/
/* Tourne de 90 degres le pad selectionne :
/* Tourne de 90 degres le pad selectionne :
c.a.d intervertit dim X et Y et offsets
*
c.a.d intervertit dim X et Y et offsets
*/
*/
{
{
MODULE
*
Module
;
MODULE
*
Module
;
if
(
Pad
==
NULL
)
return
;
Module
=
(
MODULE
*
)
Pad
->
m_Parent
;
Module
->
m_LastEdit_Time
=
time
(
NULL
);
GetScreen
()
->
SetModify
();
if
(
Pad
==
NULL
)
return
;
Module
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_XOR
);
Module
=
(
MODULE
*
)
Pad
->
m_Parent
;
Module
->
m_LastEdit_Time
=
time
(
NULL
);
EXCHG
(
Pad
->
m_Size
.
x
,
Pad
->
m_Size
.
y
);
GetScreen
()
->
SetModify
();
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
;
EXCHG
(
Pad
->
m_DeltaSize
.
x
,
Pad
->
m_DeltaSize
.
y
)
;
Module
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_XOR
);
Pad
->
m_DeltaSize
.
x
=
-
Pad
->
m_DeltaSize
.
x
;
/* ceci est la variation
de la dim Y sur l'axe X */
Module
->
Set_Rectangle_Encadrement
();
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
;
Pad
->
Display_Infos
(
this
);
EXCHG
(
Pad
->
m_DeltaSize
.
x
,
Pad
->
m_DeltaSize
.
y
);
Module
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_OR
);
Pad
->
m_DeltaSize
.
x
=
-
Pad
->
m_DeltaSize
.
x
;
/* ceci est la variation
}
* de la dim Y sur l'axe X */
Module
->
Set_Rectangle_Encadrement
();
Pad
->
Display_Infos
(
this
);
Module
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_OR
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment