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
7e56bf28
Commit
7e56bf28
authored
Aug 31, 2010
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Plain Diff
fixing bug 626875. Cleaning code
Try to fix block selection issue with some windows managers.
parents
fe6591b2
657f62ab
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
227 additions
and
268 deletions
+227
-268
drawpanel.cpp
common/drawpanel.cpp
+6
-9
interf_u.pro
demos/interf_u/interf_u.pro
+4
-0
drag.h
pcbnew/drag.h
+41
-29
dragsegm.cpp
pcbnew/dragsegm.cpp
+72
-103
modules.cpp
pcbnew/modules.cpp
+15
-24
move-drag_pads.cpp
pcbnew/move-drag_pads.cpp
+20
-30
move_or_drag_track.cpp
pcbnew/move_or_drag_track.cpp
+69
-73
No files found.
common/drawpanel.cpp
View file @
7e56bf28
...
@@ -1071,11 +1071,13 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
...
@@ -1071,11 +1071,13 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
#define MIN_DRAG_COUNT_FOR_START_BLOCK_COMMAND 5
#define MIN_DRAG_COUNT_FOR_START_BLOCK_COMMAND 5
/* Count the drag events. Used to filter mouse moves before starting a
/* Count the drag events. Used to filter mouse moves before starting a
* block command. A block command can be started only if MinDragEventCount >
* block command. A block command can be started only if
* MIN_DRAG_COUNT_FOR_START_BLOCK_COMMAND in order to avoid spurious block
* MinDragEventCount > MIN_DRAG_COUNT_FOR_START_BLOCK_COMMAND
* commands. */
* and m_CanStartBlock >= 0
* in order to avoid spurious block commands.
*/
static
int
MinDragEventCount
;
static
int
MinDragEventCount
;
if
(
event
.
Leaving
()
||
event
.
Entering
()
)
if
(
event
.
Leaving
()
/*|| event.Entering()*/
)
{
{
m_CanStartBlock
=
-
1
;
m_CanStartBlock
=
-
1
;
}
}
...
@@ -1118,11 +1120,6 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
...
@@ -1118,11 +1120,6 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
if
(
event
.
MiddleDown
()
)
if
(
event
.
MiddleDown
()
)
localbutt
=
GR_M_MIDDLE_DOWN
;
localbutt
=
GR_M_MIDDLE_DOWN
;
if
(
event
.
ButtonDClick
(
2
)
)
{
}
;
// Unused
localrealbutt
|=
localbutt
;
/* compensation default wxGTK */
localrealbutt
|=
localbutt
;
/* compensation default wxGTK */
/* Compute the cursor position in screen (device) units. */
/* Compute the cursor position in screen (device) units. */
...
...
demos/interf_u/interf_u.pro
View file @
7e56bf28
<<<<<<<
TREE
update
=
31
/
08
/
2010
17
:
56
:
15
=======
update
=
22
/
07
/
2010
13
:
46
:
39
update
=
22
/
07
/
2010
13
:
46
:
39
>>>>>>>
MERGE
-
SOURCE
version
=
1
version
=
1
last_client
=
pcbnew
last_client
=
pcbnew
[
common
]
[
common
]
...
...
pcbnew/drag.h
View file @
7e56bf28
/***************************************************************/
/**************************************************/
/* Edition des Modules: Structures et variables de gestion des */
/* Useful class and functions used to drag tracks */
/* fonctions de "DRAG" des segments de piste */
/**************************************************/
/***************************************************************/
/*** Class to handle a list of track segments to drag ***/
/** Helper class to handle a list of track segments to drag
* and has info to undo/abort the move command
* a DRAG_SEGM manage one track segment or a via
*/
class
DRAG_SEGM
class
DRAG_SEGM
{
{
public
:
public
:
TRACK
*
m_Segm
;
/* pointeur sur le segment a "dragger */
DRAG_SEGM
*
Pnext
;
/* Pointeur de chainage */
D_PAD
*
m_Pad_Start
;
/* pointeur sur le Pad origine si origine segment sur pad */
TRACK
*
m_Segm
;
/* pointeur sur le segment a "dragger */
D_PAD
*
m_Pad_End
;
/* pointeur sur le Pad fin si fin segment sur pad */
D_PAD
*
m_Pad_Start
;
/* pointeur sur le Pad origine si origine segment sur pad */
int
m_Flag
;
/* indicateur divers */
D_PAD
*
m_Pad_End
;
/* pointeur sur le Pad fin si fin segment sur pad */
int
m_Flag
;
/* indicateur divers */
private
:
private
:
wxPoint
m_StartInitialValue
;
wxPoint
m_StartInitialValue
;
wxPoint
m_EndInitialValue
;
/* For abort: initial m_Start and m_End values for m_Segm */
wxPoint
m_EndInitialValue
;
// For abort: initial m_Start and m_End values for m_Segm
public
:
public
:
DRAG_SEGM
(
TRACK
*
segm
);
DRAG_SEGM
(
TRACK
*
segm
);
~
DRAG_SEGM
();
~
DRAG_SEGM
()
{}
;
void
SetInitialValues
();
void
SetInitialValues
()
{
m_Segm
->
m_Start
=
m_StartInitialValue
;
m_Segm
->
m_End
=
m_EndInitialValue
;
}
};
};
/* Variables */
/* Variables */
extern
DRAG_SEGM
*
g_DragSegmentList
;
/* pointe le debut de la liste
// a list of DRAG_SEGM items used to move or drag tracks.
* des structures DRAG_SEGM */
// Each DRAG_SEGM item points a segment to move.
extern
std
::
vector
<
DRAG_SEGM
>
g_DragSegmentList
;
/* routines specifiques */
/* Functions */
void
Dessine_Segments_Dragges
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
);
void
Dessine_Segments_Dragges
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
);
void
Build_Drag_Liste
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
MODULE
*
Module
);
void
Build_Drag_Liste
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
MODULE
*
Module
);
void
Build_1_Pad_SegmentsToDrag
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
D_PAD
*
PtPad
);
void
Build_1_Pad_SegmentsToDrag
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
D_PAD
*
PtPad
);
void
Collect_TrackSegmentsToDrag
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
void
Collect_TrackSegmentsToDrag
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
wxPoint
&
point
,
int
MasqueLayer
,
int
net_code
);
wxPoint
&
point
,
int
MasqueLayer
,
int
net_code
);
void
EraseDragListe
();
/** function EraseDragList
* clear the .m_Flags of all track segments managed by in g_DragSegmentList
* and clear the list.
* In order to avoid useless memory allocation, the memory is not freed
* and will be reused when creating a new list
*/
void
EraseDragList
();
/* Add the segment"Track" to the drag list, and erase it from screen
/* Add the segment"Track" to the drag list, and erase it from screen
* flag = STARTPOINT (if the point to drag is the start point of Track)
* flag = STARTPOINT (if the point to drag is the start point of Track)
* or ENDPOINT
* or ENDPOINT
*/
*/
void
AddSegmentToDragList
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
void
AddSegmentToDragList
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
int
flag
,
TRACK
*
Track
);
int
flag
,
TRACK
*
Track
);
pcbnew/dragsegm.cpp
View file @
7e56bf28
/*********************************
************************
/
/*********************************/
/*
Routines relatives a la gestions des pistes en "DRAG"
*/
/*
functions used to drag tracks
*/
/*********************************
************************
/
/*********************************/
/* Fichier dragsegm.cpp */
/* Fichier dragsegm.cpp */
#include "fctsys.h"
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "common.h"
#include "class_drawpanel.h"
#include "class_drawpanel.h"
#include "pcbnew.h"
#include "pcbnew.h"
#include "autorout.h"
#include "protos.h"
#include "drag.h"
#include "drag.h"
/* a list of DRAG_SEGM items used to move or drag tracks */
std
::
vector
<
DRAG_SEGM
>
g_DragSegmentList
;
DRAG_SEGM
*
g_DragSegmentList
=
NULL
;
/* pointe le debut de la liste
/* helper class to handle a list of track segments to drag or move
* des structures DRAG_SEGM */
*/
DRAG_SEGM
::
DRAG_SEGM
(
TRACK
*
segm
)
DRAG_SEGM
::
DRAG_SEGM
(
TRACK
*
segm
)
{
{
m_Segm
=
segm
;
m_Segm
=
segm
;
m_StartInitialValue
=
m_Segm
->
m_Start
;
m_StartInitialValue
=
m_Segm
->
m_Start
;
m_EndInitialValue
=
m_Segm
->
m_End
;
m_EndInitialValue
=
m_Segm
->
m_End
;
m_Pad_Start
=
m_Pad_End
=
NULL
;
m_Pad_Start
=
m_Pad_End
=
NULL
;
m_Flag
=
0
;
m_Flag
=
0
;
}
}
DRAG_SEGM
::~
DRAG_SEGM
()
{
}
void
DRAG_SEGM
::
SetInitialValues
()
{
m_Segm
->
m_Start
=
m_StartInitialValue
;
m_Segm
->
m_End
=
m_EndInitialValue
;
}
/*******************************************************************/
/*******************************************************************/
void
Dessine_Segments_Dragges
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
)
void
Dessine_Segments_Dragges
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
)
/*******************************************************************/
/*******************************************************************/
/* Redraw the list of segments starting in g_DragSegmentList, while moving a footprint */
/* Redraw the list of segments starting in g_DragSegmentList, while moving a footprint */
{
{
D_PAD
*
pt_pad
;
D_PAD
*
pt_pad
;
TRACK
*
Track
;
TRACK
*
Track
;
DRAG_SEGM
*
pt_drag
;
if
(
g_DragSegmentList
==
NULL
)
if
(
g_DragSegmentList
.
size
()
==
0
)
return
;
return
;
pt_drag
=
g_DragSegmentList
;
for
(
unsigned
ii
=
0
;
ii
<
g_DragSegmentList
.
size
();
ii
++
)
for
(
;
pt_drag
;
pt_drag
=
pt_drag
->
Pnext
)
{
{
int
px
,
py
;
wxPoint
pos
;
Track
=
g_DragSegmentList
[
ii
].
m_Segm
;
Track
=
pt_drag
->
m_Segm
;
Track
->
Draw
(
panel
,
DC
,
GR_XOR
);
// erase from screen at old position
Track
->
Draw
(
panel
,
DC
,
GR_XOR
);
// erase from screen at old position
pt_pad
=
pt_drag
->
m_Pad_Start
;
pt_pad
=
g_DragSegmentList
[
ii
].
m_Pad_Start
;
if
(
pt_pad
)
if
(
pt_pad
)
{
{
px
=
pt_pad
->
m_Pos
.
x
-
g_Offset_Module
.
x
;
pos
=
pt_pad
->
m_Pos
-
g_Offset_Module
;
py
=
pt_pad
->
m_Pos
.
y
-
g_Offset_Module
.
y
;
Track
->
m_Start
=
pos
;
Track
->
m_Start
.
x
=
px
;
Track
->
m_Start
.
y
=
py
;
}
}
pt_pad
=
pt_drag
->
m_Pad_End
;
pt_pad
=
g_DragSegmentList
[
ii
].
m_Pad_End
;
if
(
pt_pad
)
if
(
pt_pad
)
{
{
px
=
pt_pad
->
m_Pos
.
x
-
g_Offset_Module
.
x
;
pos
=
pt_pad
->
m_Pos
-
g_Offset_Module
;
py
=
pt_pad
->
m_Pos
.
y
-
g_Offset_Module
.
y
;
Track
->
m_End
=
pos
;
Track
->
m_End
.
x
=
px
;
Track
->
m_End
.
y
=
py
;
}
}
Track
->
Draw
(
panel
,
DC
,
GR_XOR
);
Track
->
Draw
(
panel
,
DC
,
GR_XOR
);
...
@@ -91,13 +65,10 @@ void Dessine_Segments_Dragges( WinEDA_DrawPanel* panel, wxDC* DC )
...
@@ -91,13 +65,10 @@ void Dessine_Segments_Dragges( WinEDA_DrawPanel* panel, wxDC* DC )
/*************************************************************************/
/*************************************************************************/
void
Build_Drag_Liste
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
MODULE
*
Module
)
void
Build_Drag_Liste
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
MODULE
*
Module
)
/*************************************************************************/
/*************************************************************************/
/** Build the list of track segments connected to pads of a given module
/* Construit la liste des segments connectes aus pads du module Module
* by populate the std::vector<DRAG_SEGM> g_DragSegmentList
* pour le drag de ces segments
* For each selected track segment set the EDIT flag
* la liste est mise a l'adresse pointee par pt_drag.
* and redraw them in EDIT mode (sketch mode)
* la variable globale nb_drag_segment est incrementee du nombre de segments
* Met l'attribut EDIT sur les segments selectionnes
* et les affiche en mode EDIT (sketch)
*/
*/
{
{
D_PAD
*
pt_pad
;
D_PAD
*
pt_pad
;
...
@@ -115,16 +86,18 @@ void Build_Drag_Liste( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* Module )
...
@@ -115,16 +86,18 @@ void Build_Drag_Liste( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* Module )
/**********************************************************************************/
/**********************************************************************************/
void
Build_1_Pad_SegmentsToDrag
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
D_PAD
*
PtPad
)
void
Build_1_Pad_SegmentsToDrag
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
D_PAD
*
PtPad
)
/**********************************************************************************/
/**********************************************************************************/
/** Build the list of track segments connected to a given pad
/* Routine construisant la liste les segments de piste connectes au pad PtPad
* by populate the std::vector<DRAG_SEGM> g_DragSegmentList
* Les net_codes sont supposes a jour.
* For each selected track segment set the EDIT flag
* and redraw them in EDIT mode (sketch mode)
* Net codes must be OK.
*/
*/
{
{
TRACK
*
Track
;
TRACK
*
Track
;
int
net_code
=
PtPad
->
GetNet
();
int
net_code
=
PtPad
->
GetNet
();
int
MasqueLayer
;
int
MasqueLayer
;
wxPoint
pos
;
wxPoint
pos
;
BOARD
*
pcb
=
(
(
WinEDA_BasePcbFrame
*
)
(
panel
->
GetParent
()
)
)
->
GetBoard
();
BOARD
*
pcb
=
(
(
WinEDA_BasePcbFrame
*
)
(
panel
->
GetParent
()
)
)
->
GetBoard
();
Track
=
pcb
->
m_Track
->
GetStartNetCode
(
net_code
);
Track
=
pcb
->
m_Track
->
GetStartNetCode
(
net_code
);
...
@@ -133,21 +106,21 @@ void Build_1_Pad_SegmentsToDrag( WinEDA_DrawPanel* panel, wxDC* DC, D_PAD* PtPad
...
@@ -133,21 +106,21 @@ void Build_1_Pad_SegmentsToDrag( WinEDA_DrawPanel* panel, wxDC* DC, D_PAD* PtPad
for
(
;
Track
;
Track
=
Track
->
Next
()
)
for
(
;
Track
;
Track
=
Track
->
Next
()
)
{
{
if
(
Track
->
GetNet
()
!=
net_code
)
if
(
Track
->
GetNet
()
!=
net_code
)
break
;
/* hors zone */
break
;
if
(
(
MasqueLayer
&
Track
->
ReturnMaskLayer
()
)
==
0
)
if
(
(
MasqueLayer
&
Track
->
ReturnMaskLayer
()
)
==
0
)
continue
;
/* couches differentes */
continue
;
if
(
pos
==
Track
->
m_Start
)
if
(
pos
==
Track
->
m_Start
)
{
{
AddSegmentToDragList
(
panel
,
DC
,
STARTPOINT
,
Track
);
AddSegmentToDragList
(
panel
,
DC
,
STARTPOINT
,
Track
);
g_DragSegmentList
->
m_Pad_Start
=
PtPad
;
g_DragSegmentList
.
back
().
m_Pad_Start
=
PtPad
;
}
}
if
(
pos
==
Track
->
m_End
)
if
(
pos
==
Track
->
m_End
)
{
{
AddSegmentToDragList
(
panel
,
DC
,
ENDPOINT
,
Track
);
AddSegmentToDragList
(
panel
,
DC
,
ENDPOINT
,
Track
);
g_DragSegmentList
->
m_Pad_End
=
PtPad
;
g_DragSegmentList
.
back
().
m_Pad_End
=
PtPad
;
}
}
}
}
}
}
...
@@ -157,23 +130,17 @@ void Build_1_Pad_SegmentsToDrag( WinEDA_DrawPanel* panel, wxDC* DC, D_PAD* PtPad
...
@@ -157,23 +130,17 @@ void Build_1_Pad_SegmentsToDrag( WinEDA_DrawPanel* panel, wxDC* DC, D_PAD* PtPad
void
AddSegmentToDragList
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
void
AddSegmentToDragList
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
int
flag
,
TRACK
*
Track
)
int
flag
,
TRACK
*
Track
)
/******************************************************************/
/******************************************************************/
/* Add the segment"Track" to the drag list, and erase it from screen
/* Add the segment"Track" to the drag list, and erase it from screen
* flag = STARTPOINT (if the point to drag is the start point of Track) or ENDPOINT
* flag = STARTPOINT (if the point to drag is the start point of Track) or ENDPOINT
*/
*/
{
{
DRAG_SEGM
*
pt_drag
;
DRAG_SEGM
wrapper
(
Track
);
pt_drag
=
new
DRAG_SEGM
(
Track
);
pt_drag
->
Pnext
=
g_DragSegmentList
;
g_DragSegmentList
=
pt_drag
;
if
(
(
flag
&
STARTPOINT
)
)
if
(
(
flag
&
STARTPOINT
)
)
pt_drag
->
m_Flag
|=
1
;
wrapper
.
m_Flag
|=
1
;
if
(
(
flag
&
ENDPOINT
)
)
if
(
(
flag
&
ENDPOINT
)
)
pt_drag
->
m_Flag
|=
2
;
wrapper
.
m_Flag
|=
2
;
Track
->
Draw
(
panel
,
DC
,
GR_XOR
);
Track
->
Draw
(
panel
,
DC
,
GR_XOR
);
Track
->
SetState
(
EDIT
,
ON
);
Track
->
SetState
(
EDIT
,
ON
);
...
@@ -185,66 +152,68 @@ void AddSegmentToDragList( WinEDA_DrawPanel* panel, wxDC* DC,
...
@@ -185,66 +152,68 @@ void AddSegmentToDragList( WinEDA_DrawPanel* panel, wxDC* DC,
Track
->
m_Flags
|=
ENDPOINT
;
Track
->
m_Flags
|=
ENDPOINT
;
Track
->
Draw
(
panel
,
DC
,
GR_XOR
);
Track
->
Draw
(
panel
,
DC
,
GR_XOR
);
g_DragSegmentList
.
push_back
(
wrapper
);
}
}
/**********************************************************************************/
/**********************************************************************************/
void
Collect_TrackSegmentsToDrag
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
void
Collect_TrackSegmentsToDrag
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
wxPoint
&
point
,
int
MasqueLayer
,
int
net_code
)
wxPoint
&
aRefPos
,
int
MasqueLayer
,
int
net_code
)
/**********************************************************************************/
/**********************************************************************************/
/* Routine construisant la liste les segments de piste connectes a la via Via
/* Build the list of tracks connected to the ref point
* Les net_codes sont supposes a jour.
* Net codes must be OK.
* @param aRefPos = reference point of connection
*/
*/
{
{
BOARD
*
pcb
=
(
(
WinEDA_BasePcbFrame
*
)
(
panel
->
GetParent
()
)
)
->
GetBoard
();
BOARD
*
pcb
=
(
(
WinEDA_BasePcbFrame
*
)
(
panel
->
GetParent
()
)
)
->
GetBoard
();
TRACK
*
track
=
pcb
->
m_Track
->
GetStartNetCode
(
net_code
);
TRACK
*
track
=
pcb
->
m_Track
->
GetStartNetCode
(
net_code
);
for
(
;
track
;
track
=
track
->
Next
()
)
for
(
;
track
;
track
=
track
->
Next
()
)
{
{
if
(
track
->
GetNet
()
!=
net_code
)
if
(
track
->
GetNet
()
!=
net_code
)
// Bad net, not connected
break
;
/* hors zone */
break
;
if
(
(
MasqueLayer
&
track
->
ReturnMaskLayer
()
)
==
0
)
if
(
(
MasqueLayer
&
track
->
ReturnMaskLayer
()
)
==
0
)
continue
;
/* couches differentes */
continue
;
// Cannot be connected, not on the same layer
if
(
track
->
m_Flags
&
IS_DRAGGED
)
if
(
track
->
m_Flags
&
IS_DRAGGED
)
continue
;
// already
in list
continue
;
// already put
in list
if
(
track
->
m_Start
==
point
)
int
flag
=
0
;
{
AddSegmentToDragList
(
panel
,
DC
,
STARTPOINT
,
track
);
if
(
(
track
->
m_Start
==
aRefPos
)
&&
((
track
->
m_Flags
&
STARTPOINT
)
==
0
)
)
}
flag
|=
STARTPOINT
;
if
(
track
->
m_End
==
aRefPos
&&
((
track
->
m_Flags
&
ENDPOINT
)
==
0
)
)
flag
|=
ENDPOINT
;
if
(
track
->
m_End
==
point
)
// Note: vias will be flagged with both STARTPOINT and ENDPOINT
// and must not be entered twice.
if
(
flag
)
{
{
AddSegmentToDragList
(
panel
,
DC
,
ENDPOINT
,
track
);
AddSegmentToDragList
(
panel
,
DC
,
flag
,
track
);
// If a connected via is found at location aRefPos,
// collect also tracks connected by this via.
if
(
track
->
Type
()
==
TYPE_VIA
)
Collect_TrackSegmentsToDrag
(
panel
,
DC
,
aRefPos
,
track
->
ReturnMaskLayer
(),
net_code
);
}
}
}
}
}
}
/*****************************/
/** function EraseDragList
void
EraseDragListe
()
* clear the .m_Flags of all track segments found in g_DragSegmentList
/*****************************/
* and clear the list.
* the memory is not freed and will be reused when creating a new list
/* Routine de liberation memoire de la liste des structures DRAG_SEGM
* remet a zero le pointeur global g_DragSegmentList
*/
*/
void
EraseDragList
()
{
{
DRAG_SEGM
*
pt_drag
;
for
(
unsigned
ii
=
0
;
ii
<
g_DragSegmentList
.
size
();
ii
++
)
DRAG_SEGM
*
NextStruct
;
g_DragSegmentList
[
ii
].
m_Segm
->
m_Flags
=
0
;
if
(
g_DragSegmentList
==
NULL
)
return
;
pt_drag
=
g_DragSegmentList
;
for
(
;
pt_drag
!=
NULL
;
pt_drag
=
NextStruct
)
{
NextStruct
=
pt_drag
->
Pnext
;
pt_drag
->
m_Segm
->
m_Flags
=
0
;
delete
pt_drag
;
}
g_DragSegmentList
=
NULL
;
g_DragSegmentList
.
clear
()
;
}
}
pcbnew/modules.cpp
View file @
7e56bf28
...
@@ -112,20 +112,15 @@ void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC )
...
@@ -112,20 +112,15 @@ void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC )
if
(
GetBoard
()
->
IsElementVisible
(
RATSNEST_VISIBLE
)
)
if
(
GetBoard
()
->
IsElementVisible
(
RATSNEST_VISIBLE
)
)
DrawGeneralRatsnest
(
DC
);
DrawGeneralRatsnest
(
DC
);
if
(
g_DragSegmentList
)
/* Should not occur ! */
EraseDragList
();
{
EraseDragListe
();
}
if
(
g_Drag_Pistes_On
)
if
(
g_Drag_Pistes_On
)
{
{
Build_Drag_Liste
(
DrawPanel
,
DC
,
module
);
Build_Drag_Liste
(
DrawPanel
,
DC
,
module
);
ITEM_PICKER
itemWrapper
(
NULL
,
UR_CHANGED
);
ITEM_PICKER
itemWrapper
(
NULL
,
UR_CHANGED
);
for
(
DRAG_SEGM
*
pt_drag
=
g_DragSegmentList
;
for
(
unsigned
ii
=
0
;
ii
<
g_DragSegmentList
.
size
();
ii
++
)
pt_drag
!=
NULL
;
pt_drag
=
pt_drag
->
Pnext
)
{
{
TRACK
*
segm
=
pt_drag
->
m_Segm
;
TRACK
*
segm
=
g_DragSegmentList
[
ii
].
m_Segm
;
itemWrapper
.
m_PickedItem
=
segm
;
itemWrapper
.
m_PickedItem
=
segm
;
itemWrapper
.
m_Link
=
segm
->
Copy
();
itemWrapper
.
m_Link
=
segm
->
Copy
();
itemWrapper
.
m_Link
->
SetState
(
EDIT
,
OFF
);
itemWrapper
.
m_Link
->
SetState
(
EDIT
,
OFF
);
...
@@ -155,7 +150,6 @@ void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC )
...
@@ -155,7 +150,6 @@ void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC )
*/
*/
void
Abort_MoveOrCopyModule
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
)
void
Abort_MoveOrCopyModule
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
)
{
{
DRAG_SEGM
*
pt_drag
;
TRACK
*
pt_segm
;
TRACK
*
pt_segm
;
MODULE
*
module
;
MODULE
*
module
;
WinEDA_PcbFrame
*
pcbframe
=
(
WinEDA_PcbFrame
*
)
Panel
->
GetParent
();
WinEDA_PcbFrame
*
pcbframe
=
(
WinEDA_PcbFrame
*
)
Panel
->
GetParent
();
...
@@ -176,24 +170,23 @@ void Abort_MoveOrCopyModule( WinEDA_DrawPanel* Panel, wxDC* DC )
...
@@ -176,24 +170,23 @@ void Abort_MoveOrCopyModule( WinEDA_DrawPanel* Panel, wxDC* DC )
if
(
g_Drag_Pistes_On
)
if
(
g_Drag_Pistes_On
)
{
{
/* Erase on screen dragged tracks */
/* Erase on screen dragged tracks */
pt_drag
=
g_DragSegmentList
;
for
(
unsigned
ii
=
0
;
ii
<
g_DragSegmentList
.
size
();
ii
++
)
for
(
;
pt_drag
!=
NULL
;
pt_drag
=
pt_drag
->
Pnext
)
{
{
pt_segm
=
pt_drag
->
m_Segm
;
pt_segm
=
g_DragSegmentList
[
ii
].
m_Segm
;
pt_segm
->
Draw
(
Panel
,
DC
,
GR_XOR
);
pt_segm
->
Draw
(
Panel
,
DC
,
GR_XOR
);
}
}
}
}
/* Go to old position for dragged tracks */
/* Go to old position for dragged tracks */
pt_drag
=
g_DragSegmentList
;
for
(
unsigned
ii
=
0
;
ii
<
g_DragSegmentList
.
size
();
ii
++
)
for
(
;
pt_drag
!=
NULL
;
pt_drag
=
pt_drag
->
Pnext
)
{
{
pt_segm
=
pt_drag
->
m_Segm
;
pt_segm
->
SetState
(
EDIT
,
OFF
);
pt_segm
=
g_DragSegmentList
[
ii
].
m_Segm
;
pt_drag
->
SetInitialValues
();
pt_segm
->
SetState
(
EDIT
,
OFF
);
g_DragSegmentList
[
ii
].
SetInitialValues
();
pt_segm
->
Draw
(
Panel
,
DC
,
GR_OR
);
pt_segm
->
Draw
(
Panel
,
DC
,
GR_OR
);
}
}
EraseDragList
e
();
EraseDragList
();
module
->
m_Flags
=
0
;
module
->
m_Flags
=
0
;
}
}
...
@@ -466,21 +459,19 @@ void WinEDA_BasePcbFrame::Place_Module( MODULE* module,
...
@@ -466,21 +459,19 @@ void WinEDA_BasePcbFrame::Place_Module( MODULE* module,
if
(
DC
)
if
(
DC
)
module
->
Draw
(
DrawPanel
,
DC
,
GR_OR
);
module
->
Draw
(
DrawPanel
,
DC
,
GR_OR
);
if
(
g_DragSegmentList
)
if
(
g_DragSegmentList
.
size
()
)
{
{
/* Redraw dragged track segments */
/* Redraw dragged track segments */
for
(
DRAG_SEGM
*
pt_drag
=
g_DragSegmentList
;
for
(
unsigned
ii
=
0
;
ii
<
g_DragSegmentList
.
size
();
ii
++
)
pt_drag
!=
NULL
;
pt_drag
=
pt_drag
->
Pnext
)
{
{
pt_segm
=
pt_drag
->
m_Segm
;
pt_segm
=
g_DragSegmentList
[
ii
].
m_Segm
;
pt_segm
->
SetState
(
EDIT
,
OFF
);
pt_segm
->
SetState
(
EDIT
,
OFF
);
if
(
DC
)
if
(
DC
)
pt_segm
->
Draw
(
DrawPanel
,
DC
,
GR_OR
);
pt_segm
->
Draw
(
DrawPanel
,
DC
,
GR_OR
);
}
}
// Delete drag list
// Delete drag list
EraseDragList
e
();
EraseDragList
();
}
}
g_Drag_Pistes_On
=
FALSE
;
g_Drag_Pistes_On
=
FALSE
;
...
...
pcbnew/move-drag_pads.cpp
View file @
7e56bf28
...
@@ -39,18 +39,17 @@ static void Exit_Move_Pad( WinEDA_DrawPanel* Panel, wxDC* DC )
...
@@ -39,18 +39,17 @@ static void Exit_Move_Pad( WinEDA_DrawPanel* Panel, wxDC* DC )
/* Pad move in progress: the restore origin. */
/* Pad move in progress: the restore origin. */
if
(
g_Drag_Pistes_On
)
if
(
g_Drag_Pistes_On
)
{
{
DRAG_SEGM
*
pt_drag
=
g_DragSegmentList
;
for
(
unsigned
ii
=
0
;
ii
<
g_DragSegmentList
.
size
();
ii
++
)
for
(
;
pt_drag
!=
NULL
;
pt_drag
=
pt_drag
->
Pnext
)
{
{
TRACK
*
Track
=
pt_drag
->
m_Segm
;
TRACK
*
Track
=
g_DragSegmentList
[
ii
].
m_Segm
;
Track
->
Draw
(
Panel
,
DC
,
GR_XOR
);
Track
->
Draw
(
Panel
,
DC
,
GR_XOR
);
Track
->
SetState
(
EDIT
,
OFF
);
Track
->
SetState
(
EDIT
,
OFF
);
pt_drag
->
SetInitialValues
();
g_DragSegmentList
[
ii
].
SetInitialValues
();
Track
->
Draw
(
Panel
,
DC
,
GR_OR
);
Track
->
Draw
(
Panel
,
DC
,
GR_OR
);
}
}
}
}
EraseDragList
e
();
EraseDragList
();
s_CurrentSelectedPad
=
NULL
;
s_CurrentSelectedPad
=
NULL
;
g_Drag_Pistes_On
=
FALSE
;
g_Drag_Pistes_On
=
FALSE
;
}
}
...
@@ -61,7 +60,6 @@ static void Exit_Move_Pad( WinEDA_DrawPanel* Panel, wxDC* DC )
...
@@ -61,7 +60,6 @@ static void Exit_Move_Pad( WinEDA_DrawPanel* Panel, wxDC* DC )
static
void
Show_Pad_Move
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
)
static
void
Show_Pad_Move
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
)
{
{
TRACK
*
Track
;
TRACK
*
Track
;
DRAG_SEGM
*
pt_drag
;
BASE_SCREEN
*
screen
=
panel
->
GetScreen
();
BASE_SCREEN
*
screen
=
panel
->
GetScreen
();
D_PAD
*
pad
=
s_CurrentSelectedPad
;
D_PAD
*
pad
=
s_CurrentSelectedPad
;
...
@@ -74,17 +72,16 @@ static void Show_Pad_Move( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
...
@@ -74,17 +72,16 @@ static void Show_Pad_Move( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
if
(
!
g_Drag_Pistes_On
)
if
(
!
g_Drag_Pistes_On
)
return
;
return
;
pt_drag
=
g_DragSegmentList
;
for
(
unsigned
ii
=
0
;
ii
<
g_DragSegmentList
.
size
();
ii
++
)
for
(
;
pt_drag
!=
NULL
;
pt_drag
=
pt_drag
->
Pnext
)
{
{
Track
=
pt_drag
->
m_Segm
;
Track
=
g_DragSegmentList
[
ii
].
m_Segm
;
if
(
erase
)
if
(
erase
)
Track
->
Draw
(
panel
,
DC
,
GR_XOR
);
Track
->
Draw
(
panel
,
DC
,
GR_XOR
);
if
(
pt_drag
->
m_Pad_Start
)
if
(
g_DragSegmentList
[
ii
].
m_Pad_Start
)
{
{
Track
->
m_Start
=
pad
->
m_Pos
;
Track
->
m_Start
=
pad
->
m_Pos
;
}
}
if
(
pt_drag
->
m_Pad_End
)
if
(
g_DragSegmentList
[
ii
].
m_Pad_End
)
{
{
Track
->
m_End
=
pad
->
m_Pos
;
Track
->
m_End
=
pad
->
m_Pos
;
}
}
...
@@ -288,7 +285,7 @@ void WinEDA_BasePcbFrame::StartMovePad( D_PAD* Pad, wxDC* DC )
...
@@ -288,7 +285,7 @@ void WinEDA_BasePcbFrame::StartMovePad( D_PAD* Pad, wxDC* DC )
if
(
g_Drag_Pistes_On
)
if
(
g_Drag_Pistes_On
)
Build_1_Pad_SegmentsToDrag
(
DrawPanel
,
DC
,
Pad
);
Build_1_Pad_SegmentsToDrag
(
DrawPanel
,
DC
,
Pad
);
else
else
EraseDragList
e
();
EraseDragList
();
}
}
...
@@ -308,18 +305,16 @@ void WinEDA_BasePcbFrame::PlacePad( D_PAD* Pad, wxDC* DC )
...
@@ -308,18 +305,16 @@ void WinEDA_BasePcbFrame::PlacePad( D_PAD* Pad, wxDC* DC )
PICKED_ITEMS_LIST
pickList
;
PICKED_ITEMS_LIST
pickList
;
/* Save dragged track segments in undo list */
/* Save dragged track segments in undo list */
for
(
DRAG_SEGM
*
pt_drag
=
g_DragSegmentList
;
for
(
unsigned
ii
=
0
;
ii
<
g_DragSegmentList
.
size
();
ii
++
)
pt_drag
;
pt_drag
=
pt_drag
->
Pnext
)
{
{
Track
=
pt_drag
->
m_Segm
;
Track
=
g_DragSegmentList
[
ii
].
m_Segm
;
// Set the old state
// Set the old state
wxPoint
t_start
=
Track
->
m_Start
;
wxPoint
t_start
=
Track
->
m_Start
;
wxPoint
t_end
=
Track
->
m_End
;
wxPoint
t_end
=
Track
->
m_End
;
if
(
pt_drag
->
m_Pad_Start
)
if
(
g_DragSegmentList
[
ii
].
m_Pad_Start
)
Track
->
m_Start
=
Pad_OldPos
;
Track
->
m_Start
=
Pad_OldPos
;
if
(
pt_drag
->
m_Pad_End
)
if
(
g_DragSegmentList
[
ii
].
m_Pad_End
)
Track
->
m_End
=
Pad_OldPos
;
Track
->
m_End
=
Pad_OldPos
;
picker
.
m_PickedItem
=
Track
;
picker
.
m_PickedItem
=
Track
;
...
@@ -330,32 +325,27 @@ void WinEDA_BasePcbFrame::PlacePad( D_PAD* Pad, wxDC* DC )
...
@@ -330,32 +325,27 @@ void WinEDA_BasePcbFrame::PlacePad( D_PAD* Pad, wxDC* DC )
wxPoint
pad_curr_position
=
Pad
->
m_Pos
;
wxPoint
pad_curr_position
=
Pad
->
m_Pos
;
Pad
->
m_Pos
=
Pad_OldPos
;
Pad
->
m_Pos
=
Pad_OldPos
;
if
(
g_DragSegmentList
==
NULL
)
if
(
g_DragSegmentList
.
size
()
==
0
)
SaveCopyInUndoList
(
Module
,
UR_CHANGED
);
SaveCopyInUndoList
(
Module
,
UR_CHANGED
);
else
else
{
{
picker
.
m_PickedItem
=
Module
;
picker
.
m_PickedItem
=
Module
;
pickList
.
PushItem
(
picker
);
pickList
.
PushItem
(
picker
);
}
if
(
g_DragSegmentList
)
SaveCopyInUndoList
(
pickList
,
UR_CHANGED
);
SaveCopyInUndoList
(
pickList
,
UR_CHANGED
);
}
Pad
->
m_Pos
=
pad_curr_position
;
Pad
->
m_Pos
=
pad_curr_position
;
Pad
->
Draw
(
DrawPanel
,
DC
,
GR_XOR
);
Pad
->
Draw
(
DrawPanel
,
DC
,
GR_XOR
);
/* Redraw dragged track segments */
/* Redraw dragged track segments */
for
(
DRAG_SEGM
*
pt_drag
=
g_DragSegmentList
;
for
(
unsigned
ii
=
0
;
ii
<
g_DragSegmentList
.
size
();
ii
++
)
pt_drag
;
pt_drag
=
pt_drag
->
Pnext
)
{
{
Track
=
pt_drag
->
m_Segm
;
Track
=
g_DragSegmentList
[
ii
].
m_Segm
;
// Set the new state
// Set the new state
if
(
pt_drag
->
m_Pad_Start
)
if
(
g_DragSegmentList
[
ii
].
m_Pad_Start
)
Track
->
m_Start
=
Pad
->
m_Pos
;
Track
->
m_Start
=
Pad
->
m_Pos
;
if
(
pt_drag
->
m_Pad_End
)
if
(
g_DragSegmentList
[
ii
].
m_Pad_End
)
Track
->
m_End
=
Pad
->
m_Pos
;
Track
->
m_End
=
Pad
->
m_Pos
;
Track
->
SetState
(
EDIT
,
OFF
);
Track
->
SetState
(
EDIT
,
OFF
);
...
@@ -380,7 +370,7 @@ void WinEDA_BasePcbFrame::PlacePad( D_PAD* Pad, wxDC* DC )
...
@@ -380,7 +370,7 @@ void WinEDA_BasePcbFrame::PlacePad( D_PAD* Pad, wxDC* DC )
Module
->
Set_Rectangle_Encadrement
();
Module
->
Set_Rectangle_Encadrement
();
Module
->
m_LastEdit_Time
=
time
(
NULL
);
Module
->
m_LastEdit_Time
=
time
(
NULL
);
EraseDragList
e
();
EraseDragList
();
OnModify
();
OnModify
();
DrawPanel
->
ManageCurseur
=
NULL
;
DrawPanel
->
ManageCurseur
=
NULL
;
...
...
pcbnew/move_or_drag_track.cpp
View file @
7e56bf28
...
@@ -61,7 +61,7 @@ static void Abort_MoveTrack( WinEDA_DrawPanel* Panel, wxDC* DC )
...
@@ -61,7 +61,7 @@ static void Abort_MoveTrack( WinEDA_DrawPanel* Panel, wxDC* DC )
Panel
->
ManageCurseur
(
Panel
,
DC
,
true
);
Panel
->
ManageCurseur
(
Panel
,
DC
,
true
);
Panel
->
GetScreen
()
->
m_Curseur
=
oldpos
;
Panel
->
GetScreen
()
->
m_Curseur
=
oldpos
;
g_HighLight_Status
=
FALSE
;
g_HighLight_Status
=
false
;
(
(
WinEDA_PcbFrame
*
)
Panel
->
GetParent
()
)
->
GetBoard
()
->
DrawHighLight
(
(
(
WinEDA_PcbFrame
*
)
Panel
->
GetParent
()
)
->
GetBoard
()
->
DrawHighLight
(
Panel
,
Panel
,
DC
,
DC
,
...
@@ -110,11 +110,10 @@ static void Abort_MoveTrack( WinEDA_DrawPanel* Panel, wxDC* DC )
...
@@ -110,11 +110,10 @@ static void Abort_MoveTrack( WinEDA_DrawPanel* Panel, wxDC* DC )
(
(
WinEDA_PcbFrame
*
)
Panel
->
GetParent
()
)
->
SetCurItem
(
NULL
);
(
(
WinEDA_PcbFrame
*
)
Panel
->
GetParent
()
)
->
SetCurItem
(
NULL
);
/* Undo move and redraw trace segments. */
/* Undo move and redraw trace segments. */
DRAG_SEGM
*
pt_drag
=
g_DragSegmentList
;
for
(
unsigned
jj
=
0
;
jj
<
g_DragSegmentList
.
size
();
jj
++
)
for
(
;
pt_drag
!=
NULL
;
pt_drag
=
pt_drag
->
Pnext
)
{
{
TRACK
*
Track
=
pt_drag
->
m_Segm
;
TRACK
*
Track
=
g_DragSegmentList
[
jj
].
m_Segm
;
pt_drag
->
SetInitialValues
();
g_DragSegmentList
[
jj
].
SetInitialValues
();
Track
->
SetState
(
EDIT
,
OFF
);
Track
->
SetState
(
EDIT
,
OFF
);
Track
->
m_Flags
=
0
;
Track
->
m_Flags
=
0
;
Track
->
Draw
(
Panel
,
DC
,
GR_OR
);
Track
->
Draw
(
Panel
,
DC
,
GR_OR
);
...
@@ -127,11 +126,9 @@ static void Abort_MoveTrack( WinEDA_DrawPanel* Panel, wxDC* DC )
...
@@ -127,11 +126,9 @@ static void Abort_MoveTrack( WinEDA_DrawPanel* Panel, wxDC* DC )
g_HighLight_Status
=
Old_HighLigt_Status
;
g_HighLight_Status
=
Old_HighLigt_Status
;
if
(
g_HighLight_Status
)
if
(
g_HighLight_Status
)
(
(
WinEDA_PcbFrame
*
)
Panel
->
GetParent
()
)
->
GetBoard
()
->
DrawHighLight
(
(
(
WinEDA_PcbFrame
*
)
Panel
->
GetParent
()
)
->
GetBoard
()
->
DrawHighLight
(
Panel
,
Panel
,
DC
,
g_HighLight_NetCode
);
DC
,
g_HighLight_NetCode
);
EraseDragList
e
();
EraseDragList
();
}
}
...
@@ -145,7 +142,7 @@ static void Show_MoveNode( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
...
@@ -145,7 +142,7 @@ static void Show_MoveNode( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
int
track_fill_copy
=
DisplayOpt
.
DisplayPcbTrackFill
;
int
track_fill_copy
=
DisplayOpt
.
DisplayPcbTrackFill
;
int
draw_mode
=
GR_XOR
|
GR_SURBRILL
;
int
draw_mode
=
GR_XOR
|
GR_SURBRILL
;
DisplayOpt
.
DisplayPcbTrackFill
=
FALSE
;
DisplayOpt
.
DisplayPcbTrackFill
=
false
;
erase
=
true
;
erase
=
true
;
...
@@ -175,10 +172,9 @@ static void Show_MoveNode( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
...
@@ -175,10 +172,9 @@ static void Show_MoveNode( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
/* Redraw the current moved track segments */
/* Redraw the current moved track segments */
Trace_Une_Piste
(
panel
,
DC
,
NewTrack
,
NbPtNewTrack
,
draw_mode
);
Trace_Une_Piste
(
panel
,
DC
,
NewTrack
,
NbPtNewTrack
,
draw_mode
);
DRAG_SEGM
*
pt_drag
=
g_DragSegmentList
;
for
(
unsigned
ii
=
0
;
ii
<
g_DragSegmentList
.
size
();
ii
++
)
for
(
;
pt_drag
!=
NULL
;
pt_drag
=
pt_drag
->
Pnext
)
{
{
Track
=
pt_drag
->
m_Segm
;
Track
=
g_DragSegmentList
[
ii
].
m_Segm
;
if
(
erase
)
if
(
erase
)
Track
->
Draw
(
panel
,
DC
,
draw_mode
);
Track
->
Draw
(
panel
,
DC
,
draw_mode
);
...
@@ -250,32 +246,35 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
...
@@ -250,32 +246,35 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
BASE_SCREEN
*
screen
=
panel
->
GetScreen
();
BASE_SCREEN
*
screen
=
panel
->
GetScreen
();
bool
update
=
true
;
bool
update
=
true
;
TRACK
*
Track
;
TRACK
*
Track
;
DRAG_SEGM
*
TrackSegWrapper
=
g_DragSegmentList
;
TRACK
*
tSegmentToStart
=
NULL
,
*
tSegmentToEnd
=
NULL
;
TRACK
*
tSegmentToStart
=
NULL
,
*
tSegmentToEnd
=
NULL
;
if
(
TrackSegWrapper
==
NULL
)
if
(
g_DragSegmentList
.
size
()
==
0
)
return
;
return
;
Track
=
TrackSegWrapper
->
m_Segm
;
/* get the segments :
* from last to first in list are:
* the segment to move
* the segment connected to its end point (if exists)
* the segment connected to its start point (if exists)
*/
int
ii
=
g_DragSegmentList
.
size
()
-
1
;
Track
=
g_DragSegmentList
[
ii
].
m_Segm
;
if
(
Track
==
NULL
)
if
(
Track
==
NULL
)
return
;
return
;
ii
--
;
TrackSegWrapper
=
TrackSegWrapper
->
Pnext
;
if
(
ii
>=
0
)
if
(
TrackSegWrapper
)
{
{
if
(
s_EndSegmentPresent
)
if
(
s_EndSegmentPresent
)
{
{
tSegmentToEnd
=
TrackSegWrapper
->
m_Segm
;
// Get the segment
// Get the segment connected to the end point
// connected to the end
tSegmentToEnd
=
g_DragSegmentList
[
ii
].
m_Segm
;
// point
ii
--
;
TrackSegWrapper
=
TrackSegWrapper
->
Pnext
;
}
}
if
(
s_StartSegmentPresent
)
if
(
s_StartSegmentPresent
)
{
{
if
(
TrackSegWrapper
)
// Get the segment connected to the start point
tSegmentToStart
=
TrackSegWrapper
->
m_Segm
;
// Get the segment
if
(
ii
>=
0
)
// connected to the
tSegmentToStart
=
g_DragSegmentList
[
ii
].
m_Segm
;
// start point
}
}
}
}
...
@@ -461,36 +460,42 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
...
@@ -461,36 +460,42 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
/* Init variables (slope, Y intersect point, flags) for
/* Init variables (slope, Y intersect point, flags) for
* Show_Drag_Track_Segment_With_Cte_Slope()
* Show_Drag_Track_Segment_With_Cte_Slope()
* return true if Ok,
FALSE
if dragging is not possible
* return true if Ok,
false
if dragging is not possible
* (2 colinear segments)
* (2 colinear segments)
*/
*/
bool
InitialiseDragParameters
()
bool
InitialiseDragParameters
()
{
{
double
tx1
,
tx2
,
ty1
,
ty2
;
// temporary storage of points
double
tx1
,
tx2
,
ty1
,
ty2
;
// temporary storage of points
TRACK
*
Track
;
TRACK
*
Track
;
DRAG_SEGM
*
TrackSegWrapper
=
g_DragSegmentList
;
TRACK
*
tSegmentToStart
=
NULL
,
*
tSegmentToEnd
=
NULL
;
TRACK
*
tSegmentToStart
=
NULL
,
*
tSegmentToEnd
=
NULL
;
if
(
TrackSegWrapper
==
NULL
)
if
(
g_DragSegmentList
.
size
()
==
0
)
return
FALSE
;
return
false
;
Track
=
TrackSegWrapper
->
m_Segm
;
if
(
Track
==
NULL
)
return
FALSE
;
TrackSegWrapper
=
TrackSegWrapper
->
Pnext
;
/* get the segments :
if
(
TrackSegWrapper
)
* from last to first in list are:
* the segment to move
* the segment connected to its end point (if exists)
* the segment connected to its start point (if exists)
*/
int
ii
=
g_DragSegmentList
.
size
()
-
1
;
Track
=
g_DragSegmentList
[
ii
].
m_Segm
;
if
(
Track
==
NULL
)
return
false
;
ii
--
;
if
(
ii
>=
0
)
{
{
if
(
s_EndSegmentPresent
)
if
(
s_EndSegmentPresent
)
{
{
tSegmentToEnd
=
TrackSegWrapper
->
m_Segm
;
// Get the segment
tSegmentToEnd
=
g_DragSegmentList
[
ii
].
m_Segm
;
// Get the segment
// connected to the end
// connected to the end
// point
// point
TrackSegWrapper
=
TrackSegWrapper
->
Pnext
;
ii
--
;
}
}
if
(
s_StartSegmentPresent
)
if
(
s_StartSegmentPresent
)
{
{
if
(
TrackSegWrapper
)
if
(
ii
>=
0
)
tSegmentToStart
=
TrackSegWrapper
->
m_Segm
;
// Get the segment
tSegmentToStart
=
g_DragSegmentList
[
ii
].
m_Segm
;
// Get the segment
// connected to the
// connected to the
// start point
// start point
}
}
...
@@ -644,7 +649,7 @@ void WinEDA_PcbFrame::Start_MoveOneNodeOrSegment( TRACK* track,
...
@@ -644,7 +649,7 @@ void WinEDA_PcbFrame::Start_MoveOneNodeOrSegment( TRACK* track,
NewTrack
=
NULL
;
NewTrack
=
NULL
;
NbPtNewTrack
=
0
;
NbPtNewTrack
=
0
;
EraseDragList
e
();
EraseDragList
();
/* Change highlighted net: the new one will be highlighted */
/* Change highlighted net: the new one will be highlighted */
Old_HighLigt_Status
=
g_HighLight_Status
;
Old_HighLigt_Status
=
g_HighLight_Status
;
...
@@ -653,7 +658,7 @@ void WinEDA_PcbFrame::Start_MoveOneNodeOrSegment( TRACK* track,
...
@@ -653,7 +658,7 @@ void WinEDA_PcbFrame::Start_MoveOneNodeOrSegment( TRACK* track,
High_Light
(
DC
);
High_Light
(
DC
);
PosInit
=
GetScreen
()
->
m_Curseur
;
PosInit
=
GetScreen
()
->
m_Curseur
;
if
(
track
->
Type
()
==
TYPE_VIA
)
if
(
track
->
Type
()
==
TYPE_VIA
)
// For a via: always drag it
{
{
track
->
m_Flags
=
IS_DRAGGED
|
STARTPOINT
|
ENDPOINT
;
track
->
m_Flags
=
IS_DRAGGED
|
STARTPOINT
|
ENDPOINT
;
if
(
command
!=
ID_POPUP_PCB_MOVE_TRACK_SEGMENT
)
if
(
command
!=
ID_POPUP_PCB_MOVE_TRACK_SEGMENT
)
...
@@ -673,12 +678,12 @@ void WinEDA_PcbFrame::Start_MoveOneNodeOrSegment( TRACK* track,
...
@@ -673,12 +678,12 @@ void WinEDA_PcbFrame::Start_MoveOneNodeOrSegment( TRACK* track,
switch
(
command
)
switch
(
command
)
{
{
case
ID_POPUP_PCB_MOVE_TRACK_SEGMENT
:
case
ID_POPUP_PCB_MOVE_TRACK_SEGMENT
:
// Move segment
track
->
m_Flags
|=
IS_DRAGGED
|
ENDPOINT
|
STARTPOINT
;
track
->
m_Flags
|=
IS_DRAGGED
|
ENDPOINT
|
STARTPOINT
;
AddSegmentToDragList
(
DrawPanel
,
DC
,
track
->
m_Flags
,
track
);
AddSegmentToDragList
(
DrawPanel
,
DC
,
track
->
m_Flags
,
track
);
break
;
break
;
case
ID_POPUP_PCB_DRAG_TRACK_SEGMENT
:
case
ID_POPUP_PCB_DRAG_TRACK_SEGMENT
:
// drag a segment
pos
=
track
->
m_Start
;
pos
=
track
->
m_Start
;
Collect_TrackSegmentsToDrag
(
DrawPanel
,
DC
,
pos
,
Collect_TrackSegmentsToDrag
(
DrawPanel
,
DC
,
pos
,
track
->
ReturnMaskLayer
(),
track
->
ReturnMaskLayer
(),
...
@@ -690,7 +695,7 @@ void WinEDA_PcbFrame::Start_MoveOneNodeOrSegment( TRACK* track,
...
@@ -690,7 +695,7 @@ void WinEDA_PcbFrame::Start_MoveOneNodeOrSegment( TRACK* track,
track
->
GetNet
()
);
track
->
GetNet
()
);
break
;
break
;
case
ID_POPUP_PCB_MOVE_TRACK_NODE
:
case
ID_POPUP_PCB_MOVE_TRACK_NODE
:
// Drag via or move node
pos
=
(
diag
&
STARTPOINT
)
?
track
->
m_Start
:
track
->
m_End
;
pos
=
(
diag
&
STARTPOINT
)
?
track
->
m_Start
:
track
->
m_End
;
Collect_TrackSegmentsToDrag
(
DrawPanel
,
DC
,
pos
,
Collect_TrackSegmentsToDrag
(
DrawPanel
,
DC
,
pos
,
track
->
ReturnMaskLayer
(),
track
->
ReturnMaskLayer
(),
...
@@ -706,10 +711,9 @@ void WinEDA_PcbFrame::Start_MoveOneNodeOrSegment( TRACK* track,
...
@@ -706,10 +711,9 @@ void WinEDA_PcbFrame::Start_MoveOneNodeOrSegment( TRACK* track,
ITEM_PICKER
picker
(
track
,
UR_CHANGED
);
ITEM_PICKER
picker
(
track
,
UR_CHANGED
);
picker
.
m_Link
=
track
->
Copy
();
picker
.
m_Link
=
track
->
Copy
();
s_ItemsListPicker
.
PushItem
(
picker
);
s_ItemsListPicker
.
PushItem
(
picker
);
DRAG_SEGM
*
pt_drag
=
g_DragSegmentList
;
for
(
unsigned
ii
=
0
;
ii
<
g_DragSegmentList
.
size
();
ii
++
)
for
(
;
pt_drag
!=
NULL
;
pt_drag
=
pt_drag
->
Pnext
)
{
{
TRACK
*
draggedtrack
=
pt_drag
->
m_Segm
;
TRACK
*
draggedtrack
=
g_DragSegmentList
[
ii
].
m_Segm
;
picker
.
m_PickedItem
=
draggedtrack
;
picker
.
m_PickedItem
=
draggedtrack
;
picker
.
m_Link
=
draggedtrack
->
Copy
();
picker
.
m_Link
=
draggedtrack
->
Copy
();
s_ItemsListPicker
.
PushItem
(
picker
);
s_ItemsListPicker
.
PushItem
(
picker
);
...
@@ -824,7 +828,7 @@ void WinEDA_PcbFrame::Start_DragTrackSegmentAndKeepSlope( TRACK* track,
...
@@ -824,7 +828,7 @@ void WinEDA_PcbFrame::Start_DragTrackSegmentAndKeepSlope( TRACK* track,
{
{
TRACK
*
TrackToStartPoint
=
NULL
;
TRACK
*
TrackToStartPoint
=
NULL
;
TRACK
*
TrackToEndPoint
=
NULL
;
TRACK
*
TrackToEndPoint
=
NULL
;
bool
error
=
FALSE
;
bool
error
=
false
;
if
(
!
track
)
if
(
!
track
)
return
;
return
;
...
@@ -835,14 +839,10 @@ void WinEDA_PcbFrame::Start_DragTrackSegmentAndKeepSlope( TRACK* track,
...
@@ -835,14 +839,10 @@ void WinEDA_PcbFrame::Start_DragTrackSegmentAndKeepSlope( TRACK* track,
// Broken functions: see comments
// Broken functions: see comments
while( MergeCollinearTracks( track, DC, START ) )
while( MergeCollinearTracks( track, DC, START ) )
{
{
}
};
;
while( MergeCollinearTracks( track, DC, END ) )
while( MergeCollinearTracks( track, DC, END ) )
{
{
}
};
;
#endif
#endif
s_StartSegmentPresent
=
s_EndSegmentPresent
=
true
;
s_StartSegmentPresent
=
s_EndSegmentPresent
=
true
;
...
@@ -885,10 +885,10 @@ void WinEDA_PcbFrame::Start_DragTrackSegmentAndKeepSlope( TRACK* track,
...
@@ -885,10 +885,10 @@ void WinEDA_PcbFrame::Start_DragTrackSegmentAndKeepSlope( TRACK* track,
}
}
if
(
!
TrackToStartPoint
||
(
TrackToStartPoint
->
Type
()
!=
TYPE_TRACK
)
)
if
(
!
TrackToStartPoint
||
(
TrackToStartPoint
->
Type
()
!=
TYPE_TRACK
)
)
s_StartSegmentPresent
=
FALSE
;
s_StartSegmentPresent
=
false
;
if
(
!
TrackToEndPoint
||
(
TrackToEndPoint
->
Type
()
!=
TYPE_TRACK
)
)
if
(
!
TrackToEndPoint
||
(
TrackToEndPoint
->
Type
()
!=
TYPE_TRACK
)
)
s_EndSegmentPresent
=
FALSE
;
s_EndSegmentPresent
=
false
;
/* Change high light net: the new one will be highlighted */
/* Change high light net: the new one will be highlighted */
Old_HighLigt_Status
=
g_HighLight_Status
;
Old_HighLigt_Status
=
g_HighLight_Status
;
...
@@ -896,7 +896,7 @@ void WinEDA_PcbFrame::Start_DragTrackSegmentAndKeepSlope( TRACK* track,
...
@@ -896,7 +896,7 @@ void WinEDA_PcbFrame::Start_DragTrackSegmentAndKeepSlope( TRACK* track,
if
(
g_HighLight_Status
)
if
(
g_HighLight_Status
)
High_Light
(
DC
);
High_Light
(
DC
);
EraseDragList
e
();
EraseDragList
();
NewTrack
=
NULL
;
NewTrack
=
NULL
;
NbPtNewTrack
=
0
;
NbPtNewTrack
=
0
;
...
@@ -933,11 +933,10 @@ void WinEDA_PcbFrame::Start_DragTrackSegmentAndKeepSlope( TRACK* track,
...
@@ -933,11 +933,10 @@ void WinEDA_PcbFrame::Start_DragTrackSegmentAndKeepSlope( TRACK* track,
GetBoard
()
->
DrawHighLight
(
DrawPanel
,
DC
,
g_HighLight_NetCode
);
GetBoard
()
->
DrawHighLight
(
DrawPanel
,
DC
,
g_HighLight_NetCode
);
// Prepare the Undo command
// Prepare the Undo command
DRAG_SEGM
*
pt_drag
=
g_DragSegmentList
;
ITEM_PICKER
picker
(
NULL
,
UR_CHANGED
);
ITEM_PICKER
picker
(
NULL
,
UR_CHANGED
);
for
(
;
pt_drag
!=
NULL
;
pt_drag
=
pt_drag
->
Pnext
)
for
(
unsigned
ii
=
0
;
ii
<
g_DragSegmentList
.
size
();
ii
++
)
{
{
TRACK
*
draggedtrack
=
pt_drag
->
m_Segm
;
TRACK
*
draggedtrack
=
g_DragSegmentList
[
ii
].
m_Segm
;
picker
.
m_PickedItem
=
draggedtrack
;
picker
.
m_PickedItem
=
draggedtrack
;
picker
.
m_Link
=
draggedtrack
->
Copy
();
picker
.
m_Link
=
draggedtrack
->
Copy
();
s_ItemsListPicker
.
PushItem
(
picker
);
s_ItemsListPicker
.
PushItem
(
picker
);
...
@@ -961,10 +960,9 @@ void WinEDA_PcbFrame::Start_DragTrackSegmentAndKeepSlope( TRACK* track,
...
@@ -961,10 +960,9 @@ void WinEDA_PcbFrame::Start_DragTrackSegmentAndKeepSlope( TRACK* track,
bool
WinEDA_PcbFrame
::
PlaceDraggedOrMovedTrackSegment
(
TRACK
*
Track
,
wxDC
*
DC
)
bool
WinEDA_PcbFrame
::
PlaceDraggedOrMovedTrackSegment
(
TRACK
*
Track
,
wxDC
*
DC
)
{
{
int
errdrc
;
int
errdrc
;
DRAG_SEGM
*
pt_drag
;
if
(
Track
==
NULL
)
if
(
Track
==
NULL
)
return
FALSE
;
return
false
;
int
current_net_code
=
Track
->
GetNet
();
int
current_net_code
=
Track
->
GetNet
();
...
@@ -973,14 +971,13 @@ bool WinEDA_PcbFrame::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC )
...
@@ -973,14 +971,13 @@ bool WinEDA_PcbFrame::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC )
{
{
errdrc
=
m_drc
->
Drc
(
Track
,
GetBoard
()
->
m_Track
);
errdrc
=
m_drc
->
Drc
(
Track
,
GetBoard
()
->
m_Track
);
if
(
errdrc
==
BAD_DRC
)
if
(
errdrc
==
BAD_DRC
)
return
FALSE
;
return
false
;
/* Redraw the dragged segments */
/* Redraw the dragged segments */
pt_drag
=
g_DragSegmentList
;
for
(
unsigned
ii
=
0
;
ii
<
g_DragSegmentList
.
size
();
ii
++
)
for
(
;
pt_drag
!=
NULL
;
pt_drag
=
pt_drag
->
Pnext
)
{
{
errdrc
=
m_drc
->
Drc
(
pt_drag
->
m_Segm
,
GetBoard
()
->
m_Track
);
errdrc
=
m_drc
->
Drc
(
g_DragSegmentList
[
ii
].
m_Segm
,
GetBoard
()
->
m_Track
);
if
(
errdrc
==
BAD_DRC
)
if
(
errdrc
==
BAD_DRC
)
return
FALSE
;
return
false
;
}
}
}
}
...
@@ -992,10 +989,9 @@ bool WinEDA_PcbFrame::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC )
...
@@ -992,10 +989,9 @@ bool WinEDA_PcbFrame::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC )
Track
->
Draw
(
DrawPanel
,
DC
,
draw_mode
);
Track
->
Draw
(
DrawPanel
,
DC
,
draw_mode
);
/* Draw dragged tracks */
/* Draw dragged tracks */
pt_drag
=
g_DragSegmentList
;
for
(
unsigned
ii
=
0
;
ii
<
g_DragSegmentList
.
size
();
ii
++
)
for
(
;
pt_drag
;
pt_drag
=
pt_drag
->
Pnext
)
{
{
Track
=
pt_drag
->
m_Segm
;
Track
=
g_DragSegmentList
[
ii
].
m_Segm
;
Track
->
SetState
(
EDIT
,
OFF
);
Track
->
SetState
(
EDIT
,
OFF
);
Track
->
m_Flags
=
0
;
Track
->
m_Flags
=
0
;
Track
->
Draw
(
DrawPanel
,
DC
,
draw_mode
);
Track
->
Draw
(
DrawPanel
,
DC
,
draw_mode
);
...
@@ -1010,7 +1006,7 @@ bool WinEDA_PcbFrame::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC )
...
@@ -1010,7 +1006,7 @@ bool WinEDA_PcbFrame::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC )
GetBoard
(),
Track
->
m_End
,
masque_layer
);
GetBoard
(),
Track
->
m_End
,
masque_layer
);
}
}
EraseDragList
e
();
EraseDragList
();
SaveCopyInUndoList
(
s_ItemsListPicker
,
UR_UNSPECIFIED
);
SaveCopyInUndoList
(
s_ItemsListPicker
,
UR_UNSPECIFIED
);
s_ItemsListPicker
.
ClearItemsList
();
// s_ItemsListPicker is no more owner
s_ItemsListPicker
.
ClearItemsList
();
// s_ItemsListPicker is no more owner
...
...
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