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
00f0e278
Commit
00f0e278
authored
Apr 05, 2013
by
Lorenzo Marcantonio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Factored layer utility functions: classification, layer flip and mask flip
parent
db09deed
Changes
24
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
185 additions
and
348 deletions
+185
-348
CMakeLists.txt
common/CMakeLists.txt
+0
-1
pcbcommon.cpp
common/pcbcommon.cpp
+112
-0
layers_id_colors_and_visibility.h
include/layers_id_colors_and_visibility.h
+25
-0
class_board.h
pcbnew/class_board.h
+0
-8
class_dimension.cpp
pcbnew/class_dimension.cpp
+1
-1
class_drawsegment.cpp
pcbnew/class_drawsegment.cpp
+1
-1
class_mire.cpp
pcbnew/class_mire.cpp
+1
-1
class_module.cpp
pcbnew/class_module.cpp
+8
-14
class_module_transform_functions.cpp
pcbnew/class_module_transform_functions.cpp
+0
-130
class_pad.cpp
pcbnew/class_pad.cpp
+12
-57
class_pad_draw_functions.cpp
pcbnew/class_pad_draw_functions.cpp
+13
-79
class_pcb_text.cpp
pcbnew/class_pcb_text.cpp
+1
-1
class_track.cpp
pcbnew/class_track.cpp
+1
-1
class_zone.cpp
pcbnew/class_zone.cpp
+1
-1
dialog_pad_properties.cpp
pcbnew/dialogs/dialog_pad_properties.cpp
+2
-2
dialog_plot.cpp
pcbnew/dialogs/dialog_plot.cpp
+1
-1
pcb_arc.cpp
pcbnew/pcad2kicadpcb_plugin/pcb_arc.cpp
+1
-1
pcb_component.cpp
pcbnew/pcad2kicadpcb_plugin/pcb_component.cpp
+1
-36
pcb_component.h
pcbnew/pcad2kicadpcb_plugin/pcb_component.h
+0
-2
pcb_line.cpp
pcbnew/pcad2kicadpcb_plugin/pcb_line.cpp
+1
-1
pcb_module.cpp
pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp
+1
-1
pcb_pad.cpp
pcbnew/pcad2kicadpcb_plugin/pcb_pad.cpp
+1
-1
protos.h
pcbnew/protos.h
+0
-7
PolyLine.cpp
polygon/PolyLine.cpp
+1
-1
No files found.
common/CMakeLists.txt
View file @
00f0e278
...
...
@@ -106,7 +106,6 @@ set(PCB_COMMON_SRCS
../pcbnew/class_marker_pcb.cpp
../pcbnew/class_mire.cpp
../pcbnew/class_module.cpp
../pcbnew/class_module_transform_functions.cpp
../pcbnew/class_pad.cpp
../pcbnew/class_pad_draw_functions.cpp
../pcbnew/class_pcb_text.cpp
...
...
common/pcbcommon.cpp
View file @
00f0e278
...
...
@@ -72,3 +72,115 @@ int g_PadCMPColor = RED;
*/
DLIST
<
TRACK
>
g_CurrentTrackList
;
LAYER_NUM
FlipLayer
(
LAYER_NUM
oldlayer
)
{
switch
(
oldlayer
)
{
case
LAYER_N_BACK
:
return
LAYER_N_FRONT
;
case
LAYER_N_FRONT
:
return
LAYER_N_BACK
;
case
SILKSCREEN_N_BACK
:
return
SILKSCREEN_N_FRONT
;
case
SILKSCREEN_N_FRONT
:
return
SILKSCREEN_N_BACK
;
case
ADHESIVE_N_BACK
:
return
ADHESIVE_N_FRONT
;
case
ADHESIVE_N_FRONT
:
return
ADHESIVE_N_BACK
;
case
SOLDERMASK_N_BACK
:
return
SOLDERMASK_N_FRONT
;
case
SOLDERMASK_N_FRONT
:
return
SOLDERMASK_N_BACK
;
case
SOLDERPASTE_N_BACK
:
return
SOLDERPASTE_N_FRONT
;
case
SOLDERPASTE_N_FRONT
:
return
SOLDERPASTE_N_BACK
;
// No change for the other layers
default:
return
oldlayer
;
}
}
LAYER_MSK
FlipLayerMask
(
LAYER_MSK
aMask
)
{
LAYER_MSK
newMask
;
newMask
=
aMask
&
~
(
LAYER_BACK
|
LAYER_FRONT
|
SILKSCREEN_LAYER_BACK
|
SILKSCREEN_LAYER_FRONT
|
ADHESIVE_LAYER_BACK
|
ADHESIVE_LAYER_FRONT
|
SOLDERMASK_LAYER_BACK
|
SOLDERMASK_LAYER_FRONT
|
SOLDERPASTE_LAYER_BACK
|
SOLDERPASTE_LAYER_FRONT
|
ADHESIVE_LAYER_BACK
|
ADHESIVE_LAYER_FRONT
);
if
(
aMask
&
LAYER_BACK
)
newMask
|=
LAYER_FRONT
;
if
(
aMask
&
LAYER_FRONT
)
newMask
|=
LAYER_BACK
;
if
(
aMask
&
SILKSCREEN_LAYER_BACK
)
newMask
|=
SILKSCREEN_LAYER_FRONT
;
if
(
aMask
&
SILKSCREEN_LAYER_FRONT
)
newMask
|=
SILKSCREEN_LAYER_BACK
;
if
(
aMask
&
ADHESIVE_LAYER_BACK
)
newMask
|=
ADHESIVE_LAYER_FRONT
;
if
(
aMask
&
ADHESIVE_LAYER_FRONT
)
newMask
|=
ADHESIVE_LAYER_BACK
;
if
(
aMask
&
SOLDERMASK_LAYER_BACK
)
newMask
|=
SOLDERMASK_LAYER_FRONT
;
if
(
aMask
&
SOLDERMASK_LAYER_FRONT
)
newMask
|=
SOLDERMASK_LAYER_BACK
;
if
(
aMask
&
SOLDERPASTE_LAYER_BACK
)
newMask
|=
SOLDERPASTE_LAYER_FRONT
;
if
(
aMask
&
SOLDERPASTE_LAYER_FRONT
)
newMask
|=
SOLDERPASTE_LAYER_BACK
;
if
(
aMask
&
ADHESIVE_LAYER_BACK
)
newMask
|=
ADHESIVE_LAYER_FRONT
;
if
(
aMask
&
ADHESIVE_LAYER_FRONT
)
newMask
|=
ADHESIVE_LAYER_BACK
;
return
newMask
;
}
LAYER_NUM
ExtractLayer
(
LAYER_MSK
aMask
)
{
if
(
aMask
==
NO_LAYERS
)
return
UNSELECTED_LAYER
;
LAYER_NUM
candidate
=
UNDEFINED_LAYER
;
// Scan all the layers and take note of the first set; if other are
// then found return UNDEFINED_LAYER
for
(
LAYER_NUM
i
=
FIRST_LAYER
;
i
<
NB_LAYERS
;
++
i
)
{
if
(
aMask
&
GetLayerMask
(
i
)
)
{
if
(
candidate
==
UNDEFINED_LAYER
)
candidate
=
i
;
else
return
UNDEFINED_LAYER
;
}
}
return
candidate
;
}
include/layers_id_colors_and_visibility.h
View file @
00f0e278
...
...
@@ -124,6 +124,12 @@ typedef unsigned LAYER_MSK;
#define ALL_CU_LAYERS 0x0000FFFF
#define INTERNAL_LAYERS 0x00007FFE
#define EXTERNAL_LAYERS 0x00008001
#define BACK_LAYERS (LAYER_BACK | ADHESIVE_LAYER_BACK | \
SOLDERPASTE_LAYER_BACK | SILKSCREEN_LAYER_BACK | \
SOLDERMASK_LAYER_BACK)
#define FRONT_LAYERS (LAYER_FRONT | ADHESIVE_LAYER_FRONT | \
SOLDERPASTE_LAYER_FRONT | SILKSCREEN_LAYER_FRONT | \
SOLDERMASK_LAYER_FRONT)
#define NO_LAYERS 0x00000000
/** return a one bit layer mask from a layer number
...
...
@@ -271,5 +277,24 @@ inline bool IsBackLayer( LAYER_NUM aLayer )
aLayer
==
SOLDERPASTE_N_BACK
);
}
/**
* Function ReturnFlippedLayerNumber
* @return the layer number after flipping an item
* some (not all) layers: external copper, Mask, Paste, and solder
* are swapped between front and back sides
*/
LAYER_NUM
FlipLayer
(
LAYER_NUM
oldlayer
);
/**
* Calculate the mask layer when flipping a footprint
* BACK and FRONT copper layers, mask, paste, solder layers are swapped
*/
LAYER_MSK
FlipLayerMask
(
LAYER_MSK
aMask
);
/**
* Extract the set layer from a mask. Returns UNDEFINED_LAYER if more
* than one is set or UNSELECTED_LAYER if none is
*/
LAYER_NUM
ExtractLayer
(
LAYER_MSK
aMask
);
#endif // _LAYERS_ID_AND_VISIBILITY_H_
pcbnew/class_board.h
View file @
00f0e278
...
...
@@ -656,14 +656,6 @@ public:
*/
EDA_COLOR_T
GetLayerColor
(
LAYER_NUM
aLayer
)
const
;
/**
* Function ReturnFlippedLayerNumber
* @return the layer number after flipping an item
* some (not all) layers: external copper, Mask, Paste, and solder
* are swapped between front and back sides
*/
static
LAYER_NUM
ReturnFlippedLayerNumber
(
LAYER_NUM
oldlayer
);
/** Functions to get some items count */
int
GetNumSegmTrack
()
const
;
...
...
pcbnew/class_dimension.cpp
View file @
00f0e278
...
...
@@ -176,7 +176,7 @@ void DIMENSION::Rotate( const wxPoint& aRotCentre, double aAngle )
void
DIMENSION
::
Flip
(
const
wxPoint
&
aCentre
)
{
Mirror
(
aCentre
);
SetLayer
(
BOARD
::
ReturnFlippedLayerNumb
er
(
GetLayer
()
)
);
SetLayer
(
FlipLay
er
(
GetLayer
()
)
);
}
...
...
pcbnew/class_drawsegment.cpp
View file @
00f0e278
...
...
@@ -111,7 +111,7 @@ void DRAWSEGMENT::Flip( const wxPoint& aCentre )
NEGATE
(
m_Angle
);
}
SetLayer
(
BOARD
::
ReturnFlippedLayerNumb
er
(
GetLayer
()
)
);
SetLayer
(
FlipLay
er
(
GetLayer
()
)
);
}
const
wxPoint
DRAWSEGMENT
::
GetArcEnd
()
const
...
...
pcbnew/class_mire.cpp
View file @
00f0e278
...
...
@@ -194,7 +194,7 @@ void PCB_TARGET::Rotate(const wxPoint& aRotCentre, double aAngle)
void
PCB_TARGET
::
Flip
(
const
wxPoint
&
aCentre
)
{
m_Pos
.
y
=
aCentre
.
y
-
(
m_Pos
.
y
-
aCentre
.
y
);
SetLayer
(
BOARD
::
ReturnFlippedLayerNumb
er
(
GetLayer
()
)
);
SetLayer
(
FlipLay
er
(
GetLayer
()
)
);
}
...
...
pcbnew/class_module.cpp
View file @
00f0e278
...
...
@@ -758,7 +758,7 @@ void MODULE::Flip( const wxPoint& aCentre )
SetPosition
(
finalPos
);
// Flip layer
SetLayer
(
BOARD
::
ReturnFlippedLayerNumb
er
(
GetLayer
()
)
);
SetLayer
(
FlipLay
er
(
GetLayer
()
)
);
// Reverse mirror orientation.
NEGATE
(
m_Orient
);
...
...
@@ -777,7 +777,7 @@ void MODULE::Flip( const wxPoint& aCentre )
text
->
m_Mirror
=
false
;
NEGATE_AND_NORMALIZE_ANGLE_POS
(
text
->
m_Orient
);
text
->
SetLayer
(
GetLayer
()
);
text
->
SetLayer
(
BOARD
::
ReturnFlippedLayerNumb
er
(
text
->
GetLayer
()
)
);
text
->
SetLayer
(
FlipLay
er
(
text
->
GetLayer
()
)
);
if
(
GetLayer
()
==
LAYER_N_BACK
)
text
->
SetLayer
(
SILKSCREEN_N_BACK
);
...
...
@@ -785,8 +785,7 @@ void MODULE::Flip( const wxPoint& aCentre )
if
(
GetLayer
()
==
LAYER_N_FRONT
)
text
->
SetLayer
(
SILKSCREEN_N_FRONT
);
if
(
(
GetLayer
()
==
SILKSCREEN_N_BACK
)
||
(
GetLayer
()
==
ADHESIVE_N_BACK
)
||
(
GetLayer
()
==
LAYER_N_BACK
)
)
if
(
IsBackLayer
(
GetLayer
()
)
)
text
->
m_Mirror
=
true
;
// Mirror value.
...
...
@@ -798,7 +797,7 @@ void MODULE::Flip( const wxPoint& aCentre )
text
->
m_Mirror
=
false
;
NEGATE_AND_NORMALIZE_ANGLE_POS
(
text
->
m_Orient
);
text
->
SetLayer
(
GetLayer
()
);
text
->
SetLayer
(
BOARD
::
ReturnFlippedLayerNumb
er
(
text
->
GetLayer
()
)
);
text
->
SetLayer
(
FlipLay
er
(
text
->
GetLayer
()
)
);
if
(
GetLayer
()
==
LAYER_N_BACK
)
text
->
SetLayer
(
SILKSCREEN_N_BACK
);
...
...
@@ -806,8 +805,7 @@ void MODULE::Flip( const wxPoint& aCentre )
if
(
GetLayer
()
==
LAYER_N_FRONT
)
text
->
SetLayer
(
SILKSCREEN_N_FRONT
);
if
(
(
GetLayer
()
==
SILKSCREEN_N_BACK
)
||
(
GetLayer
()
==
ADHESIVE_N_BACK
)
||
(
GetLayer
()
==
LAYER_N_BACK
)
)
if
(
IsBackLayer
(
GetLayer
()
)
)
text
->
m_Mirror
=
true
;
// Reverse mirror module graphics and texts.
...
...
@@ -839,7 +837,7 @@ void MODULE::Flip( const wxPoint& aCentre )
em
->
SetAngle
(
-
em
->
GetAngle
()
);
}
em
->
SetLayer
(
BOARD
::
ReturnFlippedLayerNumb
er
(
em
->
GetLayer
()
)
);
em
->
SetLayer
(
FlipLay
er
(
em
->
GetLayer
()
)
);
}
break
;
...
...
@@ -854,7 +852,7 @@ void MODULE::Flip( const wxPoint& aCentre )
NEGATE_AND_NORMALIZE_ANGLE_POS
(
text
->
m_Orient
);
text
->
SetLayer
(
GetLayer
()
);
text
->
SetLayer
(
BOARD
::
ReturnFlippedLayerNumb
er
(
text
->
GetLayer
()
)
);
text
->
SetLayer
(
FlipLay
er
(
text
->
GetLayer
()
)
);
if
(
GetLayer
()
==
LAYER_N_BACK
)
text
->
SetLayer
(
SILKSCREEN_N_BACK
);
...
...
@@ -862,12 +860,8 @@ void MODULE::Flip( const wxPoint& aCentre )
if
(
GetLayer
()
==
LAYER_N_FRONT
)
text
->
SetLayer
(
SILKSCREEN_N_FRONT
);
if
(
GetLayer
()
==
SILKSCREEN_N_BACK
||
GetLayer
()
==
ADHESIVE_N_BACK
||
GetLayer
()
==
LAYER_N_BACK
)
{
if
(
IsBackLayer
(
GetLayer
()
)
)
text
->
m_Mirror
=
true
;
}
break
;
...
...
pcbnew/class_module_transform_functions.cpp
deleted
100644 → 0
View file @
db09deed
/**
* @file class_module_transform_functions.cpp
* @brief Functions of class MODULE to handle some geometric changes such as move, rotate ...
*/
#include <fctsys.h>
#include <wxstruct.h>
#include <trigo.h>
#include <pcbcommon.h>
#include <pcbnew.h>
#include <macros.h>
#include <protos.h>
#include <class_board.h>
#include <class_pad.h>
#include <class_edge_mod.h>
#include <class_module.h>
/* Returns the layer number after flipping an item
* some layers: external copper, Mask, Paste, and solder
* are swapped between front and back sides
*/
LAYER_NUM
BOARD
::
ReturnFlippedLayerNumber
(
LAYER_NUM
oldlayer
)
{
LAYER_NUM
newlayer
;
switch
(
oldlayer
)
{
case
LAYER_N_BACK
:
newlayer
=
LAYER_N_FRONT
;
break
;
case
LAYER_N_FRONT
:
newlayer
=
LAYER_N_BACK
;
break
;
case
SILKSCREEN_N_BACK
:
newlayer
=
SILKSCREEN_N_FRONT
;
break
;
case
SILKSCREEN_N_FRONT
:
newlayer
=
SILKSCREEN_N_BACK
;
break
;
case
ADHESIVE_N_BACK
:
newlayer
=
ADHESIVE_N_FRONT
;
break
;
case
ADHESIVE_N_FRONT
:
newlayer
=
ADHESIVE_N_BACK
;
break
;
case
SOLDERMASK_N_BACK
:
newlayer
=
SOLDERMASK_N_FRONT
;
break
;
case
SOLDERMASK_N_FRONT
:
newlayer
=
SOLDERMASK_N_BACK
;
break
;
case
SOLDERPASTE_N_BACK
:
newlayer
=
SOLDERPASTE_N_FRONT
;
break
;
case
SOLDERPASTE_N_FRONT
:
newlayer
=
SOLDERPASTE_N_BACK
;
break
;
default
:
newlayer
=
oldlayer
;
}
return
newlayer
;
}
/* Calculate the mask layer when flipping a footprint
* BACK and FRONT copper layers , mask, paste, solder layers are swapped
*/
LAYER_MSK
ChangeSideMaskLayer
(
LAYER_MSK
aMask
)
{
LAYER_MSK
newMask
;
newMask
=
aMask
&
~
(
LAYER_BACK
|
LAYER_FRONT
|
SILKSCREEN_LAYER_BACK
|
SILKSCREEN_LAYER_FRONT
|
ADHESIVE_LAYER_BACK
|
ADHESIVE_LAYER_FRONT
|
SOLDERMASK_LAYER_BACK
|
SOLDERMASK_LAYER_FRONT
|
SOLDERPASTE_LAYER_BACK
|
SOLDERPASTE_LAYER_FRONT
|
ADHESIVE_LAYER_BACK
|
ADHESIVE_LAYER_FRONT
);
if
(
aMask
&
LAYER_BACK
)
newMask
|=
LAYER_FRONT
;
if
(
aMask
&
LAYER_FRONT
)
newMask
|=
LAYER_BACK
;
if
(
aMask
&
SILKSCREEN_LAYER_BACK
)
newMask
|=
SILKSCREEN_LAYER_FRONT
;
if
(
aMask
&
SILKSCREEN_LAYER_FRONT
)
newMask
|=
SILKSCREEN_LAYER_BACK
;
if
(
aMask
&
ADHESIVE_LAYER_BACK
)
newMask
|=
ADHESIVE_LAYER_FRONT
;
if
(
aMask
&
ADHESIVE_LAYER_FRONT
)
newMask
|=
ADHESIVE_LAYER_BACK
;
if
(
aMask
&
SOLDERMASK_LAYER_BACK
)
newMask
|=
SOLDERMASK_LAYER_FRONT
;
if
(
aMask
&
SOLDERMASK_LAYER_FRONT
)
newMask
|=
SOLDERMASK_LAYER_BACK
;
if
(
aMask
&
SOLDERPASTE_LAYER_BACK
)
newMask
|=
SOLDERPASTE_LAYER_FRONT
;
if
(
aMask
&
SOLDERPASTE_LAYER_FRONT
)
newMask
|=
SOLDERPASTE_LAYER_BACK
;
if
(
aMask
&
ADHESIVE_LAYER_BACK
)
newMask
|=
ADHESIVE_LAYER_FRONT
;
if
(
aMask
&
ADHESIVE_LAYER_FRONT
)
newMask
|=
ADHESIVE_LAYER_BACK
;
return
newMask
;
}
pcbnew/class_pad.cpp
View file @
00f0e278
...
...
@@ -168,7 +168,7 @@ void D_PAD::Flip( int aTranslationY )
SetOrientation
(
-
GetOrientation
()
);
// flip pads layers
SetLayerMask
(
ChangeSideMaskLayer
(
m_layerMask
)
);
SetLayerMask
(
FlipLayerMask
(
m_layerMask
)
);
// m_boundingRadius = -1; the shape has not been changed
}
...
...
@@ -542,76 +542,31 @@ void D_PAD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM>& aList )
if
(
(
m_layerMask
&
ALL_CU_LAYERS
)
==
0
)
// pad is not on any copper layers
{
switch
(
m_layerMask
&
~
ALL_CU_LAYERS
)
LAYER_NUM
pad_layer
=
ExtractLayer
(
m_layerMask
&
~
ALL_CU_LAYERS
);
switch
(
pad_layer
)
{
case
ADHESIVE_LAYER_BACK
:
layerInfo
=
board
->
GetLayerName
(
ADHESIVE_N_BACK
);
case
UNSELECTED_LAYER
:
layerInfo
=
_
(
"No layers"
);
break
;
case
ADHESIVE_LAYER_FRONT
:
layerInfo
=
board
->
GetLayerName
(
ADHESIVE_N_FRONT
);
break
;
case
SOLDERPASTE_LAYER_BACK
:
layerInfo
=
board
->
GetLayerName
(
SOLDERPASTE_N_BACK
);
break
;
case
SOLDERPASTE_LAYER_FRONT
:
layerInfo
=
board
->
GetLayerName
(
SOLDERPASTE_N_FRONT
);
break
;
case
SILKSCREEN_LAYER_BACK
:
layerInfo
=
board
->
GetLayerName
(
SILKSCREEN_N_BACK
);
break
;
case
SILKSCREEN_LAYER_FRONT
:
layerInfo
=
board
->
GetLayerName
(
SILKSCREEN_N_FRONT
);
break
;
case
SOLDERMASK_LAYER_BACK
:
layerInfo
=
board
->
GetLayerName
(
SOLDERMASK_N_BACK
);
break
;
case
SOLDERMASK_LAYER_FRONT
:
layerInfo
=
board
->
GetLayerName
(
SOLDERMASK_N_FRONT
);
break
;
case
DRAW_LAYER
:
layerInfo
=
board
->
GetLayerName
(
DRAW_N
);
break
;
case
COMMENT_LAYER
:
layerInfo
=
board
->
GetLayerName
(
COMMENT_N
);
break
;
case
ECO1_LAYER
:
layerInfo
=
board
->
GetLayerName
(
ECO1_N
);
break
;
case
ECO2_LAYER
:
layerInfo
=
board
->
GetLayerName
(
ECO2_N
);
break
;
case
EDGE_LAYER
:
layerInfo
=
board
->
GetLayerName
(
EDGE_N
);
case
UNDEFINED_LAYER
:
layerInfo
=
_
(
"Non-copper"
);
break
;
default
:
layerInfo
=
_
(
"Non-copper"
);
layerInfo
=
board
->
GetLayerName
(
pad_layer
);
break
;
}
}
else
{
#define INTERIOR_COPPER (ALL_CU_LAYERS & ~(LAYER_BACK | LAYER_FRONT))
static
const
wxChar
*
andInternal
=
_
(
" & int"
);
if
(
(
m_layerMask
&
(
LAYER_BACK
|
LAYER_FRONT
))
==
LAYER_BACK
)
{
layerInfo
=
board
->
GetLayerName
(
LAYER_N_BACK
);
if
(
m_layerMask
&
INTER
IOR_COPPER
)
if
(
m_layerMask
&
INTER
NAL_LAYERS
)
layerInfo
+=
andInternal
;
}
...
...
@@ -620,7 +575,7 @@ void D_PAD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM>& aList )
layerInfo
=
board
->
GetLayerName
(
LAYER_N_BACK
)
+
wxT
(
", "
)
+
board
->
GetLayerName
(
LAYER_N_FRONT
);
if
(
m_layerMask
&
INTER
IOR_COPPER
)
if
(
m_layerMask
&
INTER
NAL_LAYERS
)
layerInfo
+=
andInternal
;
}
...
...
@@ -628,10 +583,10 @@ void D_PAD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM>& aList )
{
layerInfo
=
board
->
GetLayerName
(
LAYER_N_FRONT
);
if
(
m_layerMask
&
INTER
IOR_COPPER
)
if
(
m_layerMask
&
INTER
NAL_LAYERS
)
layerInfo
+=
andInternal
;
}
else
// necessarily true: if( m_layerMask & INTER
IOR_COPPER
)
else
// necessarily true: if( m_layerMask & INTER
NAL_LAYERS
)
{
layerInfo
=
_
(
"internal"
);
}
...
...
pcbnew/class_pad_draw_functions.cpp
View file @
00f0e278
...
...
@@ -100,16 +100,6 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
* ECO, edge and Draw layers and not considered
*/
// Mask layers for Back side of board
#define BACK_SIDE_LAYERS \
(LAYER_BACK | ADHESIVE_LAYER_BACK | SOLDERPASTE_LAYER_BACK \
| SILKSCREEN_LAYER_BACK | SOLDERMASK_LAYER_BACK)
// Mask layers for Front side of board
#define FRONT_SIDE_LAYERS \
(LAYER_FRONT | ADHESIVE_LAYER_FRONT | SOLDERPASTE_LAYER_FRONT \
| SILKSCREEN_LAYER_FRONT | SOLDERMASK_LAYER_FRONT)
BOARD
*
brd
=
GetBoard
();
bool
frontVisible
=
brd
->
IsElementVisible
(
PCB_VISIBLE
(
PAD_FR_VISIBLE
)
);
bool
backVisible
=
brd
->
IsElementVisible
(
PCB_VISIBLE
(
PAD_BK_VISIBLE
)
);
...
...
@@ -120,13 +110,13 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
/* If pad are only on front side (no layer on back side)
* and if hide front side pads is enabled, do not draw
*/
if
(
!
frontVisible
&&
(
(
m_layerMask
&
BACK_
SIDE_
LAYERS
)
==
0
)
)
if
(
!
frontVisible
&&
(
(
m_layerMask
&
BACK_LAYERS
)
==
0
)
)
return
;
/* If pad are only on back side (no layer on front side)
* and if hide back side pads is enabled, do not draw
*/
if
(
!
backVisible
&&
(
(
m_layerMask
&
FRONT_
SIDE_
LAYERS
)
==
0
)
)
if
(
!
backVisible
&&
(
(
m_layerMask
&
FRONT_LAYERS
)
==
0
)
)
return
;
...
...
@@ -152,86 +142,29 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
if
(
color
==
BLACK
)
// Not on a visible copper layer (i.e. still nothing to show)
{
// If the pad is on only one tech layer, use the layer color else use DARKGRAY
int
mask_non_copper_layers
=
m_layerMask
&
~
ALL_CU_LAYERS
;
LAYER_MSK
mask_non_copper_layers
=
m_layerMask
&
~
ALL_CU_LAYERS
;
#ifdef SHOW_PADMASK_REAL_SIZE_AND_COLOR
mask_non_copper_layers
&=
brd
->
GetVisibleLayers
();
#endif
switch
(
mask_non_copper_layers
)
LAYER_NUM
pad_layer
=
ExtractLayer
(
mask_non_copper_layers
);
switch
(
pad_layer
)
{
case
0
:
break
;
case
ADHESIVE_LAYER_BACK
:
color
=
brd
->
GetLayerColor
(
ADHESIVE_N_BACK
);
break
;
case
ADHESIVE_LAYER_FRONT
:
color
=
brd
->
GetLayerColor
(
ADHESIVE_N_FRONT
);
break
;
case
SOLDERPASTE_LAYER_BACK
:
color
=
brd
->
GetLayerColor
(
SOLDERPASTE_N_BACK
);
#ifdef SHOW_PADMASK_REAL_SIZE_AND_COLOR
showActualMaskSize
=
SOLDERPASTE_N_BACK
;
#endif
break
;
case
SOLDERPASTE_LAYER_FRONT
:
color
=
brd
->
GetLayerColor
(
SOLDERPASTE_N_FRONT
);
#ifdef SHOW_PADMASK_REAL_SIZE_AND_COLOR
showActualMaskSize
=
SOLDERPASTE_N_FRONT
;
#endif
break
;
case
SILKSCREEN_LAYER_BACK
:
color
=
brd
->
GetLayerColor
(
SILKSCREEN_N_BACK
);
case
UNDEFINED_LAYER
:
// More than one layer
color
=
DARKGRAY
;
break
;
case
SILKSCREEN_LAYER_FRONT
:
color
=
brd
->
GetLayerColor
(
SILKSCREEN_N_FRONT
);
case
UNSELECTED_LAYER
:
// Shouldn't really happen...
break
;
case
SOLDERMASK_LAYER_BACK
:
color
=
brd
->
GetLayerColor
(
SOLDERMASK_N_BACK
);
#ifdef SHOW_PADMASK_REAL_SIZE_AND_COLOR
showActualMaskSize
=
SOLDERMASK_N_BACK
;
#endif
break
;
case
SOLDERMASK_LAYER_FRONT
:
color
=
brd
->
GetLayerColor
(
SOLDERMASK_N_FRONT
);
default
:
color
=
brd
->
GetLayerColor
(
pad_layer
);
#ifdef SHOW_PADMASK_REAL_SIZE_AND_COLOR
showActualMaskSize
=
SOLDERMASK_N_FRONT
;
showActualMaskSize
=
pad_layer
;
#endif
break
;
case
DRAW_LAYER
:
color
=
brd
->
GetLayerColor
(
DRAW_N
);
break
;
case
COMMENT_LAYER
:
color
=
brd
->
GetLayerColor
(
COMMENT_N
);
break
;
case
ECO1_LAYER
:
color
=
brd
->
GetLayerColor
(
ECO1_N
);
break
;
case
ECO2_LAYER
:
color
=
brd
->
GetLayerColor
(
ECO2_N
);
break
;
case
EDGE_LAYER
:
color
=
brd
->
GetLayerColor
(
EDGE_N
);
break
;
default
:
color
=
DARKGRAY
;
break
;
}
}
// if
PAD_SMD
pad and high contrast mode
// if
SMD or connector
pad and high contrast mode
if
(
(
aDraw_mode
&
GR_ALLOW_HIGHCONTRAST
)
&&
(
GetAttribute
()
==
PAD_SMD
||
GetAttribute
()
==
PAD_CONN
)
&&
DisplayOpt
.
ContrastModeDisplay
)
...
...
@@ -286,6 +219,7 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
break
;
default
:
// Another layer which has no margin to handle
break
;
}
}
...
...
pcbnew/class_pcb_text.cpp
View file @
00f0e278
...
...
@@ -169,7 +169,7 @@ void TEXTE_PCB::Flip(const wxPoint& aCentre )
{
m_Mirror
=
not
m_Mirror
;
/* inverse mirror */
}
SetLayer
(
BOARD
::
ReturnFlippedLayerNumb
er
(
GetLayer
()
)
);
SetLayer
(
FlipLay
er
(
GetLayer
()
)
);
}
...
...
pcbnew/class_track.cpp
View file @
00f0e278
...
...
@@ -390,7 +390,7 @@ void TRACK::Flip( const wxPoint& aCentre )
}
else
{
SetLayer
(
BOARD
::
ReturnFlippedLayerNumb
er
(
GetLayer
()
)
);
SetLayer
(
FlipLay
er
(
GetLayer
()
)
);
}
}
...
...
pcbnew/class_zone.cpp
View file @
00f0e278
...
...
@@ -826,7 +826,7 @@ void ZONE_CONTAINER::Rotate( const wxPoint& centre, double angle )
void
ZONE_CONTAINER
::
Flip
(
const
wxPoint
&
aCentre
)
{
Mirror
(
aCentre
);
SetLayer
(
BOARD
::
ReturnFlippedLayerNumb
er
(
GetLayer
()
)
);
SetLayer
(
FlipLay
er
(
GetLayer
()
)
);
}
...
...
pcbnew/dialogs/dialog_pad_properties.cpp
View file @
00f0e278
...
...
@@ -294,7 +294,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
m_dummyPad
->
SetDelta
(
sz
);
// flip pad's layers
m_dummyPad
->
SetLayerMask
(
ChangeSideMaskLayer
(
m_dummyPad
->
GetLayerMask
()
)
);
m_dummyPad
->
SetLayerMask
(
FlipLayerMask
(
m_dummyPad
->
GetLayerMask
()
)
);
}
m_staticTextWarningPadFlipped
->
Show
(
m_isFlipped
);
...
...
@@ -799,7 +799,7 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event )
}
if
(
m_isFlipped
)
m_currentPad
->
SetLayerMask
(
ChangeSideMaskLayer
(
m_currentPad
->
GetLayerMask
()
)
);
m_currentPad
->
SetLayerMask
(
FlipLayerMask
(
m_currentPad
->
GetLayerMask
()
)
);
m_currentPad
->
SetPadName
(
m_padMaster
.
GetPadName
()
);
...
...
pcbnew/dialogs/dialog_plot.cpp
View file @
00f0e278
...
...
@@ -238,7 +238,7 @@ void DIALOG_PLOT::OnPopUpLayers( wxCommandEvent& event )
switch
(
event
.
GetId
()
)
{
case
ID_LAYER_FAB
:
// Select layers usually neede
d to build a board
case
ID_LAYER_FAB
:
// Select layers usually needed to build a board
for
(
i
=
0
;
i
<
m_layerList
.
size
();
i
++
)
{
LAYER_MSK
layermask
=
GetLayerMask
(
m_layerList
[
i
]
);
...
...
pcbnew/pcad2kicadpcb_plugin/pcb_arc.cpp
View file @
00f0e278
...
...
@@ -144,7 +144,7 @@ void PCB_ARC::Flip()
m_startX
=
-
m_startX
;
m_angle
=
-
m_angle
;
m_KiCadLayer
=
FlipLayer
s
(
m_KiCadLayer
);
m_KiCadLayer
=
FlipLayer
(
m_KiCadLayer
);
}
...
...
pcbnew/pcad2kicadpcb_plugin/pcb_component.cpp
View file @
00f0e278
...
...
@@ -43,7 +43,7 @@ PCB_COMPONENT::PCB_COMPONENT( PCB_CALLBACKS* aCallbacks,
m_tag
=
0
;
m_objType
=
wxT
(
'?'
);
m_PCadLayer
=
0
;
m_KiCadLayer
=
NO_LAYER
;
m_KiCadLayer
=
LAYER_N_FRONT
;
// It *has* to be somewhere...
m_timestamp
=
0
;
m_positionX
=
0
;
m_positionY
=
0
;
...
...
@@ -77,39 +77,4 @@ void PCB_COMPONENT::Flip()
m_positionX
=
-
m_positionX
;
}
LAYER_NUM
PCB_COMPONENT
::
FlipLayers
(
LAYER_NUM
aLayer
)
{
LAYER_NUM
result
=
aLayer
;
// dafault is no swap
// routed layers
if
(
aLayer
==
LAYER_N_BACK
)
result
=
LAYER_N_FRONT
;
if
(
aLayer
==
LAYER_N_FRONT
)
result
=
LAYER_N_BACK
;
// Silk
if
(
aLayer
==
SILKSCREEN_N_FRONT
)
result
=
SILKSCREEN_N_BACK
;
if
(
aLayer
==
SILKSCREEN_N_BACK
)
result
=
SILKSCREEN_N_FRONT
;
// Paste
if
(
aLayer
==
SOLDERPASTE_N_FRONT
)
result
=
SOLDERPASTE_N_BACK
;
if
(
aLayer
==
SOLDERPASTE_N_BACK
)
result
=
SOLDERPASTE_N_FRONT
;
// Mask
if
(
aLayer
==
SOLDERMASK_N_FRONT
)
result
=
SOLDERMASK_N_BACK
;
if
(
aLayer
==
SOLDERMASK_N_BACK
)
result
=
SOLDERMASK_N_FRONT
;
return
result
;
}
}
// namespace PCAD2KICAD
pcbnew/pcad2kicadpcb_plugin/pcb_component.h
View file @
00f0e278
...
...
@@ -77,8 +77,6 @@ public:
protected
:
PCB_CALLBACKS
*
m_callbacks
;
BOARD
*
m_board
;
LAYER_NUM
FlipLayers
(
LAYER_NUM
aLayer
);
};
WX_DEFINE_ARRAY
(
PCB_COMPONENT
*
,
PCB_COMPONENTS_ARRAY
);
...
...
pcbnew/pcad2kicadpcb_plugin/pcb_line.cpp
View file @
00f0e278
...
...
@@ -110,7 +110,7 @@ void PCB_LINE::Flip()
PCB_COMPONENT
::
Flip
();
m_toX
=
-
m_toX
;
m_KiCadLayer
=
FlipLayer
s
(
m_KiCadLayer
);
m_KiCadLayer
=
FlipLayer
(
m_KiCadLayer
);
}
...
...
pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp
View file @
00f0e278
...
...
@@ -606,7 +606,7 @@ void PCB_MODULE::Flip()
if
(
m_mirror
==
1
)
{
// Flipped
m_KiCadLayer
=
FlipLayer
s
(
m_KiCadLayer
);
m_KiCadLayer
=
FlipLayer
(
m_KiCadLayer
);
m_rotation
=
-
m_rotation
;
m_name
.
textPositionX
=
-
m_name
.
textPositionX
;
m_name
.
mirror
=
m_mirror
;
...
...
pcbnew/pcad2kicadpcb_plugin/pcb_pad.cpp
View file @
00f0e278
...
...
@@ -180,7 +180,7 @@ void PCB_PAD::Flip()
m_rotation
=
-
m_rotation
;
for
(
i
=
0
;
i
<
(
int
)
m_shapes
.
GetCount
();
i
++
)
m_shapes
[
i
]
->
m_KiCadLayer
=
FlipLayer
s
(
m_shapes
[
i
]
->
m_KiCadLayer
);
m_shapes
[
i
]
->
m_KiCadLayer
=
FlipLayer
(
m_shapes
[
i
]
->
m_KiCadLayer
);
}
...
...
pcbnew/protos.h
View file @
00f0e278
...
...
@@ -51,13 +51,6 @@ void DrawTraces( EDA_DRAW_PANEL* panel,
/* MODULES.C */
/*************/
/**
* Function ChangeSideMaskLayer
* calculates the mask layer when flipping a footprint.
* BACK and FRONT copper layers , mask, paste, solder layers are swapped.
*/
LAYER_MSK
ChangeSideMaskLayer
(
LAYER_MSK
aMask
);
void
DrawModuleOutlines
(
EDA_DRAW_PANEL
*
panel
,
wxDC
*
DC
,
MODULE
*
module
);
...
...
polygon/PolyLine.cpp
View file @
00f0e278
...
...
@@ -21,7 +21,7 @@ CPolyLine::CPolyLine()
{
m_hatchStyle
=
NO_HATCH
;
m_hatchPitch
=
0
;
m_layer
=
NO_LAYER
;
m_layer
=
LAYER_N_FRONT
;
m_utility
=
0
;
}
...
...
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