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
70a61b80
Commit
70a61b80
authored
Sep 24, 2014
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pcbnew: fix Bug #1373267 (polygons in footprint outlines do not flip correctly)
Minor other fixes.
parent
dda896d5
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
61 additions
and
35 deletions
+61
-35
block_libedit.cpp
eeschema/block_libedit.cpp
+1
-1
block.cpp
pcbnew/block.cpp
+11
-2
block_module_editor.cpp
pcbnew/block_module_editor.cpp
+1
-1
class_edge_mod.cpp
pcbnew/class_edge_mod.cpp
+44
-6
class_edge_mod.h
pcbnew/class_edge_mod.h
+3
-0
class_module.cpp
pcbnew/class_module.cpp
+1
-25
No files found.
eeschema/block_libedit.cpp
View file @
70a61b80
...
@@ -48,7 +48,7 @@ int LIB_EDIT_FRAME::BlockCommand( int key )
...
@@ -48,7 +48,7 @@ int LIB_EDIT_FRAME::BlockCommand( int key )
switch
(
key
)
switch
(
key
)
{
{
default
:
default
:
cmd
=
key
&
0x
255
;
cmd
=
key
&
0x
FF
;
break
;
break
;
case
-
1
:
case
-
1
:
...
...
pcbnew/block.cpp
View file @
70a61b80
...
@@ -185,7 +185,7 @@ int PCB_EDIT_FRAME::BlockCommand( int aKey )
...
@@ -185,7 +185,7 @@ int PCB_EDIT_FRAME::BlockCommand( int aKey )
switch
(
aKey
)
switch
(
aKey
)
{
{
default
:
default
:
cmd
=
aKey
&
0x
255
;
cmd
=
aKey
&
0x
FF
;
break
;
break
;
case
0
:
case
0
:
...
@@ -219,6 +219,8 @@ int PCB_EDIT_FRAME::BlockCommand( int aKey )
...
@@ -219,6 +219,8 @@ int PCB_EDIT_FRAME::BlockCommand( int aKey )
void
PCB_EDIT_FRAME
::
HandleBlockPlace
(
wxDC
*
DC
)
void
PCB_EDIT_FRAME
::
HandleBlockPlace
(
wxDC
*
DC
)
{
{
GetBoard
()
->
m_Status_Pcb
&=
~
DO_NOT_SHOW_GENERAL_RASTNEST
;
if
(
!
m_canvas
->
IsMouseCaptured
()
)
if
(
!
m_canvas
->
IsMouseCaptured
()
)
{
{
DisplayError
(
this
,
wxT
(
"Error in HandleBlockPLace : m_mouseCaptureCallback = NULL"
)
);
DisplayError
(
this
,
wxT
(
"Error in HandleBlockPLace : m_mouseCaptureCallback = NULL"
)
);
...
@@ -274,7 +276,6 @@ bool PCB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
...
@@ -274,7 +276,6 @@ bool PCB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
{
{
bool
nextcmd
=
false
;
// Will be set to true if a block place is needed
bool
nextcmd
=
false
;
// Will be set to true if a block place is needed
bool
cancelCmd
=
false
;
bool
cancelCmd
=
false
;
// If coming here after cancel block, clean up and exit
// If coming here after cancel block, clean up and exit
if
(
GetScreen
()
->
m_BlockLocate
.
GetState
()
==
STATE_NO_BLOCK
)
if
(
GetScreen
()
->
m_BlockLocate
.
GetState
()
==
STATE_NO_BLOCK
)
{
{
...
@@ -369,6 +370,7 @@ bool PCB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
...
@@ -369,6 +370,7 @@ bool PCB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
if
(
!
nextcmd
)
if
(
!
nextcmd
)
{
{
GetBoard
()
->
m_Status_Pcb
|=
DO_NOT_SHOW_GENERAL_RASTNEST
;
GetScreen
()
->
ClearBlockCommand
();
GetScreen
()
->
ClearBlockCommand
();
m_canvas
->
EndMouseCapture
(
GetToolId
(),
m_canvas
->
GetCurrentCursor
(),
wxEmptyString
,
m_canvas
->
EndMouseCapture
(
GetToolId
(),
m_canvas
->
GetCurrentCursor
(),
wxEmptyString
,
false
);
false
);
...
@@ -562,6 +564,10 @@ static void drawMovingBlock( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a
...
@@ -562,6 +564,10 @@ static void drawMovingBlock( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a
{
{
BASE_SCREEN
*
screen
=
aPanel
->
GetScreen
();
BASE_SCREEN
*
screen
=
aPanel
->
GetScreen
();
// do not show local module rastnest in block move, it is not usable.
bool
tmp
=
g_Show_Module_Ratsnest
;
g_Show_Module_Ratsnest
=
false
;
if
(
aErase
)
if
(
aErase
)
{
{
if
(
screen
->
m_BlockLocate
.
GetMoveVector
().
x
||
screen
->
m_BlockLocate
.
GetMoveVector
().
y
)
if
(
screen
->
m_BlockLocate
.
GetMoveVector
().
x
||
screen
->
m_BlockLocate
.
GetMoveVector
().
y
)
...
@@ -589,6 +595,8 @@ static void drawMovingBlock( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a
...
@@ -589,6 +595,8 @@ static void drawMovingBlock( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a
if
(
blockDrawItems
)
if
(
blockDrawItems
)
drawPickedItems
(
aPanel
,
aDC
,
screen
->
m_BlockLocate
.
GetMoveVector
()
);
drawPickedItems
(
aPanel
,
aDC
,
screen
->
m_BlockLocate
.
GetMoveVector
()
);
}
}
g_Show_Module_Ratsnest
=
tmp
;
}
}
...
@@ -795,6 +803,7 @@ void PCB_EDIT_FRAME::Block_Move()
...
@@ -795,6 +803,7 @@ void PCB_EDIT_FRAME::Block_Move()
BOARD_ITEM
*
item
=
(
BOARD_ITEM
*
)
itemsList
->
GetPickedItem
(
ii
);
BOARD_ITEM
*
item
=
(
BOARD_ITEM
*
)
itemsList
->
GetPickedItem
(
ii
);
itemsList
->
SetPickedItemStatus
(
UR_MOVED
,
ii
);
itemsList
->
SetPickedItemStatus
(
UR_MOVED
,
ii
);
item
->
Move
(
MoveVector
);
item
->
Move
(
MoveVector
);
item
->
ClearFlags
(
IS_MOVED
);
switch
(
item
->
Type
()
)
switch
(
item
->
Type
()
)
{
{
...
...
pcbnew/block_module_editor.cpp
View file @
70a61b80
...
@@ -80,7 +80,7 @@ int FOOTPRINT_EDIT_FRAME::BlockCommand( int key )
...
@@ -80,7 +80,7 @@ int FOOTPRINT_EDIT_FRAME::BlockCommand( int key )
switch
(
key
)
switch
(
key
)
{
{
default
:
default
:
cmd
=
key
&
0x
255
;
cmd
=
key
&
0x
FF
;
break
;
break
;
case
-
1
:
case
-
1
:
...
...
pcbnew/class_edge_mod.cpp
View file @
70a61b80
...
@@ -130,7 +130,6 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
...
@@ -130,7 +130,6 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
const
wxPoint
&
offset
)
const
wxPoint
&
offset
)
{
{
int
ux0
,
uy0
,
dx
,
dy
,
radius
,
StAngle
,
EndAngle
;
int
ux0
,
uy0
,
dx
,
dy
,
radius
,
StAngle
,
EndAngle
;
int
type_trace
;
int
typeaff
;
int
typeaff
;
LAYER_ID
curr_layer
=
(
(
PCB_SCREEN
*
)
panel
->
GetScreen
()
)
->
m_Active_Layer
;
LAYER_ID
curr_layer
=
(
(
PCB_SCREEN
*
)
panel
->
GetScreen
()
)
->
m_Active_Layer
;
...
@@ -154,8 +153,6 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
...
@@ -154,8 +153,6 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
PCB_BASE_FRAME
*
frame
=
(
PCB_BASE_FRAME
*
)
panel
->
GetParent
();
PCB_BASE_FRAME
*
frame
=
(
PCB_BASE_FRAME
*
)
panel
->
GetParent
();
type_trace
=
m_Shape
;
ux0
=
m_Start
.
x
-
offset
.
x
;
ux0
=
m_Start
.
x
-
offset
.
x
;
uy0
=
m_Start
.
y
-
offset
.
y
;
uy0
=
m_Start
.
y
-
offset
.
y
;
...
@@ -176,7 +173,7 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
...
@@ -176,7 +173,7 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
if
(
DC
->
LogicalToDeviceXRel
(
m_Width
)
<=
MIN_DRAW_WIDTH
)
if
(
DC
->
LogicalToDeviceXRel
(
m_Width
)
<=
MIN_DRAW_WIDTH
)
typeaff
=
LINE
;
typeaff
=
LINE
;
switch
(
type_trac
e
)
switch
(
m_Shap
e
)
{
{
case
S_SEGMENT
:
case
S_SEGMENT
:
if
(
typeaff
==
LINE
)
if
(
typeaff
==
LINE
)
...
@@ -245,10 +242,9 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
...
@@ -245,10 +242,9 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
break
;
break
;
case
S_POLYGON
:
case
S_POLYGON
:
{
// We must compute true coordinates from m_PolyPoints
// We must compute true coordinates from m_PolyPoints
// which are relative to module position, orientation 0
// which are relative to module position, orientation 0
std
::
vector
<
wxPoint
>
points
=
m_PolyPoints
;
std
::
vector
<
wxPoint
>
points
=
m_PolyPoints
;
for
(
unsigned
ii
=
0
;
ii
<
points
.
size
();
ii
++
)
for
(
unsigned
ii
=
0
;
ii
<
points
.
size
();
ii
++
)
...
@@ -260,6 +256,10 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
...
@@ -260,6 +256,10 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
}
}
GRPoly
(
panel
->
GetClipBox
(),
DC
,
points
.
size
(),
&
points
[
0
],
true
,
m_Width
,
color
,
color
);
GRPoly
(
panel
->
GetClipBox
(),
DC
,
points
.
size
(),
&
points
[
0
],
true
,
m_Width
,
color
,
color
);
}
break
;
default
:
break
;
break
;
}
}
}
}
...
@@ -312,3 +312,41 @@ EDA_ITEM* EDGE_MODULE::Clone() const
...
@@ -312,3 +312,41 @@ EDA_ITEM* EDGE_MODULE::Clone() const
return
new
EDGE_MODULE
(
*
this
);
return
new
EDGE_MODULE
(
*
this
);
}
}
void
EDGE_MODULE
::
Flip
(
const
wxPoint
&
aCentre
)
{
wxPoint
pt
;
switch
(
GetShape
()
)
{
case
S_ARC
:
SetAngle
(
-
GetAngle
()
);
//Fall through
default
:
case
S_SEGMENT
:
pt
=
GetStart
();
pt
.
y
-=
aCentre
.
y
;
pt
.
y
=
-
pt
.
y
;
pt
.
y
+=
aCentre
.
y
;
SetStart
(
pt
);
pt
=
GetEnd
();
pt
.
y
-=
aCentre
.
y
;
pt
.
y
=
-
pt
.
y
;
pt
.
y
+=
aCentre
.
y
;
SetEnd
(
pt
);
NEGATE
(
m_Start0
.
y
);
NEGATE
(
m_End0
.
y
);
break
;
case
S_POLYGON
:
// polygon corners coordinates are always relative to the
// footprint position, orientation 0
for
(
unsigned
ii
=
0
;
ii
<
m_PolyPoints
.
size
();
ii
++
)
NEGATE
(
m_PolyPoints
[
ii
].
y
);
}
SetLayer
(
FlipLayer
(
GetLayer
()
)
);
}
pcbnew/class_edge_mod.h
View file @
70a61b80
...
@@ -68,6 +68,9 @@ public:
...
@@ -68,6 +68,9 @@ public:
SetLocalCoord
();
SetLocalCoord
();
}
}
/// Flip entity relative to aCentre
void
Flip
(
const
wxPoint
&
aCentre
);
void
SetStart0
(
const
wxPoint
&
aPoint
)
{
m_Start0
=
aPoint
;
}
void
SetStart0
(
const
wxPoint
&
aPoint
)
{
m_Start0
=
aPoint
;
}
const
wxPoint
&
GetStart0
()
const
{
return
m_Start0
;
}
const
wxPoint
&
GetStart0
()
const
{
return
m_Start0
;
}
...
...
pcbnew/class_module.cpp
View file @
70a61b80
...
@@ -947,31 +947,7 @@ void MODULE::Flip( const wxPoint& aCentre )
...
@@ -947,31 +947,7 @@ void MODULE::Flip( const wxPoint& aCentre )
switch
(
item
->
Type
()
)
switch
(
item
->
Type
()
)
{
{
case
PCB_MODULE_EDGE_T
:
case
PCB_MODULE_EDGE_T
:
{
(
(
EDGE_MODULE
*
)
item
)
->
Flip
(
m_Pos
);
EDGE_MODULE
*
em
=
(
EDGE_MODULE
*
)
item
;
wxPoint
s
=
em
->
GetStart
();
s
.
y
-=
m_Pos
.
y
;
s
.
y
=
-
s
.
y
;
s
.
y
+=
m_Pos
.
y
;
em
->
SetStart
(
s
);
wxPoint
e
=
em
->
GetEnd
();
e
.
y
-=
m_Pos
.
y
;
e
.
y
=
-
e
.
y
;
e
.
y
+=
m_Pos
.
y
;
em
->
SetEnd
(
e
);
NEGATE
(
em
->
m_Start0
.
y
);
NEGATE
(
em
->
m_End0
.
y
);
if
(
em
->
GetShape
()
==
S_ARC
)
{
em
->
SetAngle
(
-
em
->
GetAngle
()
);
}
em
->
SetLayer
(
FlipLayer
(
em
->
GetLayer
()
)
);
}
break
;
break
;
case
PCB_MODULE_TEXT_T
:
case
PCB_MODULE_TEXT_T
:
...
...
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