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
b525e3be
Commit
b525e3be
authored
Apr 09, 2013
by
Lorenzo Marcantonio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Factored out text anchor drawing
More layer classification cleanup
parent
0de48234
Changes
49
Hide whitespace changes
Inline
Side-by-side
Showing
49 changed files
with
210 additions
and
223 deletions
+210
-223
class_layer_box_selector.cpp
common/class_layer_box_selector.cpp
+2
-2
dsnlexer.cpp
common/dsnlexer.cpp
+1
-1
eda_text.cpp
common/eda_text.cpp
+4
-14
gr_basic.cpp
common/gr_basic.cpp
+13
-0
wxwineda.cpp
common/wxwineda.cpp
+1
-0
cvpcb.h
cvpcb/cvpcb.h
+0
-1
class_gbr_layer_box_selector.cpp
gerbview/class_gbr_layer_box_selector.cpp
+4
-4
class_gbr_layer_box_selector.h
gerbview/class_gbr_layer_box_selector.h
+3
-3
class_gbr_layout.cpp
gerbview/class_gbr_layout.cpp
+3
-3
class_gbr_layout.h
gerbview/class_gbr_layout.h
+2
-2
dialog_print_using_printer.cpp
gerbview/dialogs/dialog_print_using_printer.cpp
+1
-1
export_to_pcbnew.cpp
gerbview/export_to_pcbnew.cpp
+1
-1
gerbview_frame.cpp
gerbview/gerbview_frame.cpp
+4
-4
gerbview_frame.h
gerbview/gerbview_frame.h
+2
-2
readgerb.cpp
gerbview/readgerb.cpp
+1
-0
select_layers_to_pcb.cpp
gerbview/select_layers_to_pcb.cpp
+2
-2
class_board_design_settings.h
include/class_board_design_settings.h
+8
-12
class_layer_box_selector.h
include/class_layer_box_selector.h
+4
-4
drawtxt.h
include/drawtxt.h
+3
-0
eda_text.h
include/eda_text.h
+1
-0
gr_basic.h
include/gr_basic.h
+3
-0
layers_id_colors_and_visibility.h
include/layers_id_colors_and_visibility.h
+32
-19
prjconfig.cpp
kicad/prjconfig.cpp
+1
-0
basepcbframe.cpp
pcbnew/basepcbframe.cpp
+1
-1
class_board.cpp
pcbnew/class_board.cpp
+19
-19
class_board.h
pcbnew/class_board.h
+17
-17
class_board_design_settings.cpp
pcbnew/class_board_design_settings.cpp
+5
-17
class_marker_pcb.cpp
pcbnew/class_marker_pcb.cpp
+1
-1
class_module.cpp
pcbnew/class_module.cpp
+3
-11
class_pad_draw_functions.cpp
pcbnew/class_pad_draw_functions.cpp
+1
-1
class_pcb_layer_box_selector.cpp
pcbnew/class_pcb_layer_box_selector.cpp
+6
-6
class_pcb_layer_box_selector.h
pcbnew/class_pcb_layer_box_selector.h
+3
-3
class_pcb_layer_widget.cpp
pcbnew/class_pcb_layer_widget.cpp
+22
-22
class_text_mod.cpp
pcbnew/class_text_mod.cpp
+2
-8
class_track.cpp
pcbnew/class_track.cpp
+4
-13
dialog_graphic_item_properties.cpp
pcbnew/dialogs/dialog_graphic_item_properties.cpp
+4
-2
dialog_graphic_item_properties_for_Modedit.cpp
...ew/dialogs/dialog_graphic_item_properties_for_Modedit.cpp
+3
-3
dialog_layers_setup.cpp
pcbnew/dialogs/dialog_layers_setup.cpp
+1
-1
eagle_plugin.cpp
pcbnew/eagle_plugin.cpp
+9
-9
edgemod.cpp
pcbnew/edgemod.cpp
+1
-1
edit.cpp
pcbnew/edit.cpp
+1
-1
onleftclick.cpp
pcbnew/onleftclick.cpp
+3
-3
onrightclick.cpp
pcbnew/onrightclick.cpp
+1
-1
pcb_arc.cpp
pcbnew/pcad2kicadpcb_plugin/pcb_arc.cpp
+1
-1
pcb_line.cpp
pcbnew/pcad2kicadpcb_plugin/pcb_line.cpp
+2
-2
pcb_pad.cpp
pcbnew/pcad2kicadpcb_plugin/pcb_pad.cpp
+1
-1
pcbnew.h
pcbnew/pcbnew.h
+1
-2
swap_layers.cpp
pcbnew/swap_layers.cpp
+1
-1
zones_test_and_combine_areas.cpp
pcbnew/zones_test_and_combine_areas.cpp
+1
-1
No files found.
common/class_layer_box_selector.cpp
View file @
b525e3be
...
...
@@ -106,14 +106,14 @@ void LAYER_BOX_SELECTOR::ResyncBitmapOnly()
}
void
LAYER_BOX_SELECTOR
::
SetBitmapLayer
(
wxBitmap
&
aLayerbmp
,
LAYER_NUM
aLayer
Index
)
void
LAYER_BOX_SELECTOR
::
SetBitmapLayer
(
wxBitmap
&
aLayerbmp
,
LAYER_NUM
aLayer
)
{
wxMemoryDC
bmpDC
;
wxBrush
brush
;
// Prepare Bitmap
bmpDC
.
SelectObject
(
aLayerbmp
);
brush
.
SetColour
(
MakeColour
(
GetLayerColor
(
aLayer
Index
)
)
);
brush
.
SetColour
(
MakeColour
(
GetLayerColor
(
aLayer
)
)
);
brush
.
SetStyle
(
wxSOLID
);
bmpDC
.
SetBrush
(
brush
);
...
...
common/dsnlexer.cpp
View file @
b525e3be
...
...
@@ -29,7 +29,7 @@
#include <cstdlib> // bsearch()
#include <cctype>
#include <macros.h>
#include <dsnlexer.h>
//#include "fctsys.h"
...
...
common/eda_text.cpp
View file @
b525e3be
...
...
@@ -269,22 +269,12 @@ void EDA_TEXT::DrawOneLineOfText( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
if
(
aDrawMode
!=
-
1
)
GRSetDrawMode
(
aDC
,
aDrawMode
);
/
* Draw text anchor, if allowed */
/
/ Draw text anchor, if requested
if
(
aAnchor_color
!=
UNSPECIFIED_COLOR
)
{
int
anchor_size
=
aDC
->
DeviceToLogicalXRel
(
2
);
aAnchor_color
=
(
EDA_COLOR_T
)
(
aAnchor_color
&
MASKCOLOR
);
int
cX
=
aPos
.
x
+
aOffset
.
x
;
int
cY
=
aPos
.
y
+
aOffset
.
y
;
GRLine
(
aPanel
->
GetClipBox
(),
aDC
,
cX
-
anchor_size
,
cY
,
cX
+
anchor_size
,
cY
,
0
,
aAnchor_color
);
GRLine
(
aPanel
->
GetClipBox
(),
aDC
,
cX
,
cY
-
anchor_size
,
cX
,
cY
+
anchor_size
,
0
,
aAnchor_color
);
GRDrawAnchor
(
aPanel
->
GetClipBox
(),
aDC
,
aPos
.
x
+
aOffset
.
x
,
aPos
.
y
+
aOffset
.
y
,
DIM_ANCRE_TEXTE
,
aAnchor_color
);
}
if
(
aFillMode
==
SKETCH
)
...
...
common/gr_basic.cpp
View file @
b525e3be
...
...
@@ -1551,3 +1551,16 @@ EDA_COLOR_T ColorFindNearest( const wxColour &aColor )
return
candidate
;
}
void
GRDrawAnchor
(
EDA_RECT
*
aClipBox
,
wxDC
*
aDC
,
int
x
,
int
y
,
int
aSize
,
EDA_COLOR_T
aColor
)
{
int
anchor_size
=
aDC
->
DeviceToLogicalXRel
(
aSize
);
GRLine
(
aClipBox
,
aDC
,
x
-
anchor_size
,
y
,
x
+
anchor_size
,
y
,
0
,
aColor
);
GRLine
(
aClipBox
,
aDC
,
x
,
y
-
anchor_size
,
x
,
y
+
anchor_size
,
0
,
aColor
);
}
common/wxwineda.cpp
View file @
b525e3be
...
...
@@ -30,6 +30,7 @@
#include <wxstruct.h>
#include <dialog_helpers.h>
#include <base_units.h>
#include <macros.h>
/*******************************************************/
...
...
cvpcb/cvpcb.h
View file @
b525e3be
...
...
@@ -28,7 +28,6 @@ typedef boost::ptr_vector< COMPONENT_INFO > COMPONENT_LIST;
extern
const
wxString
FootprintAliasFileExtension
;
extern
const
wxString
RetroFileExtension
;
extern
const
wxString
RetroFileWildcard
;
extern
const
wxString
FootprintAliasFileWildcard
;
extern
const
wxString
titleLibLoadError
;
...
...
gerbview/class_gbr_layer_box_selector.cpp
View file @
b525e3be
...
...
@@ -65,18 +65,18 @@ void GBR_LAYER_BOX_SELECTOR::Resync()
// Returns a color index from the layer id
EDA_COLOR_T
GBR_LAYER_BOX_SELECTOR
::
GetLayerColor
(
LAYER_NUM
aLayer
Index
)
const
EDA_COLOR_T
GBR_LAYER_BOX_SELECTOR
::
GetLayerColor
(
LAYER_NUM
aLayer
)
const
{
GERBVIEW_FRAME
*
frame
=
(
GERBVIEW_FRAME
*
)
GetParent
()
->
GetParent
();
return
frame
->
GetLayerColor
(
aLayer
Index
);
return
frame
->
GetLayerColor
(
aLayer
);
}
// Returns the name of the layer id
wxString
GBR_LAYER_BOX_SELECTOR
::
GetLayerName
(
LAYER_NUM
aLayer
Index
)
const
wxString
GBR_LAYER_BOX_SELECTOR
::
GetLayerName
(
LAYER_NUM
aLayer
)
const
{
wxString
name
;
name
.
Printf
(
_
(
"Layer %d"
),
aLayer
Index
+
1
);
name
.
Printf
(
_
(
"Layer %d"
),
aLayer
+
1
);
return
name
;
}
gerbview/class_gbr_layer_box_selector.h
View file @
b525e3be
...
...
@@ -37,15 +37,15 @@ public:
// Returns a color index from the layer id
// Virtual function
EDA_COLOR_T
GetLayerColor
(
LAYER_NUM
aLayer
Index
)
const
;
EDA_COLOR_T
GetLayerColor
(
LAYER_NUM
aLayer
)
const
;
// Returns true if the layer id is enabled (i.e. is it should be displayed)
// Virtual function
bool
IsLayerEnabled
(
LAYER_NUM
aLayer
Index
)
const
{
return
true
;
};
bool
IsLayerEnabled
(
LAYER_NUM
aLayer
)
const
{
return
true
;
};
// Returns the name of the layer id
// Virtual function
wxString
GetLayerName
(
LAYER_NUM
aLayer
Index
)
const
;
wxString
GetLayerName
(
LAYER_NUM
aLayer
)
const
;
};
#endif //CLASS_GBR_LAYER_BOX_SELECTOR_H
gerbview/class_gbr_layout.cpp
View file @
b525e3be
...
...
@@ -24,12 +24,12 @@ GBR_LAYOUT::~GBR_LAYOUT()
/* Function IsLayerVisible
* tests whether a given layer is visible
* param aLayer
Index = The index of t
he layer to be tested
* param aLayer
= T
he layer to be tested
* return bool - true if the layer is visible.
*/
bool
GBR_LAYOUT
::
IsLayerVisible
(
LAYER_NUM
aLayer
Index
)
const
bool
GBR_LAYOUT
::
IsLayerVisible
(
LAYER_NUM
aLayer
)
const
{
return
m_printLayersMask
&
GetLayerMask
(
aLayer
Index
);
return
m_printLayersMask
&
GetLayerMask
(
aLayer
);
}
...
...
gerbview/class_gbr_layout.h
View file @
b525e3be
...
...
@@ -99,10 +99,10 @@ public:
/**
* Function IsLayerVisible
* tests whether a given layer is visible
* @param aLayer
Index = The index of t
he layer to be tested
* @param aLayer
= T
he layer to be tested
* @return bool - true if the layer is visible.
*/
bool
IsLayerVisible
(
LAYER_NUM
aLayer
Index
)
const
;
bool
IsLayerVisible
(
LAYER_NUM
aLayer
)
const
;
#if defined(DEBUG)
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
)
const
;
// overload
...
...
gerbview/dialogs/dialog_print_using_printer.cpp
View file @
b525e3be
...
...
@@ -139,7 +139,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
layer_max
=
NB_LAYERS
;
// Create layer list
for
(
LAYER_NUM
ii
=
FIRST_LAYER
;
ii
<
layer_max
;
++
ii
)
for
(
LAYER_NUM
ii
=
FIRST_LAYER
;
ii
<
layer_max
;
++
ii
)
{
LAYER_MSK
mask
=
GetLayerMask
(
ii
);
msg
=
_
(
"Layer"
);
...
...
gerbview/export_to_pcbnew.cpp
View file @
b525e3be
...
...
@@ -195,7 +195,7 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( LAYER_NUM* LayerLookUpTable )
LAYER_NUM
layer
=
gerb_item
->
GetLayer
();
LAYER_NUM
pcb_layer_number
=
LayerLookUpTable
[
layer
];
if
(
pcb_layer_number
<
FIRST_LAYER
||
pcb_layer_number
>
LAST_NON_COPPER_LAYER
)
if
(
!
IsPcbLayer
(
pcb_layer_number
)
)
continue
;
if
(
pcb_layer_number
>
LAST_COPPER_LAYER
)
...
...
gerbview/gerbview_frame.cpp
View file @
b525e3be
...
...
@@ -558,15 +558,15 @@ void GERBVIEW_FRAME::SetVisibleLayers( LAYER_MSK aLayerMask )
/**
* Function IsLayerVisible
* tests whether a given layer is visible
* @param aLayer
Index = The index of t
he layer to be tested
* @param aLayer
= T
he layer to be tested
* @return bool - true if the layer is visible.
*/
bool
GERBVIEW_FRAME
::
IsLayerVisible
(
LAYER_NUM
aLayer
Index
)
const
bool
GERBVIEW_FRAME
::
IsLayerVisible
(
LAYER_NUM
aLayer
)
const
{
if
(
!
m_DisplayOptions
.
m_IsPrinting
)
return
m_LayersManager
->
IsLayerVisible
(
aLayer
Index
);
return
m_LayersManager
->
IsLayerVisible
(
aLayer
);
else
return
GetLayout
()
->
IsLayerVisible
(
aLayer
Index
);
return
GetLayout
()
->
IsLayerVisible
(
aLayer
);
}
...
...
gerbview/gerbview_frame.h
View file @
b525e3be
...
...
@@ -313,10 +313,10 @@ public:
/**
* Function IsLayerVisible
* tests whether a given layer is visible
* @param aLayer
Index = The index of t
he layer to be tested
* @param aLayer
= T
he layer to be tested
* @return bool - true if the layer is visible.
*/
bool
IsLayerVisible
(
LAYER_NUM
aLayer
Index
)
const
;
bool
IsLayerVisible
(
LAYER_NUM
aLayer
)
const
;
/**
* Function GetVisibleElementColor
...
...
gerbview/readgerb.cpp
View file @
b525e3be
...
...
@@ -11,6 +11,7 @@
#include <class_GERBER.h>
#include <html_messagebox.h>
#include <macros.h>
/* Read a gerber file, RS274D or RS274X format.
*/
...
...
gerbview/select_layers_to_pcb.cpp
View file @
b525e3be
...
...
@@ -360,12 +360,12 @@ void LAYERS_MAP_DIALOG::OnSelectLayer( wxCommandEvent& event )
}
LAYER_NUM
jj
=
m_layersLookUpTable
[
m_buttonTable
[
ii
]];
if
(
(
jj
<
FIRST_LAYER
)
||
(
jj
>
NB_LAYERS
)
)
if
(
!
IsValidLayer
(
jj
)
)
jj
=
LAYER_N_BACK
;
// (Defaults to "Copper" layer.)
jj
=
m_Parent
->
SelectPCBLayer
(
jj
,
m_exportBoardCopperLayersCount
,
true
);
if
(
(
jj
<
FIRST_LAYER
)
||
(
jj
>
NB_LAYERS
)
)
if
(
!
IsValidLayer
(
jj
)
)
return
;
if
(
jj
!=
m_layersLookUpTable
[
m_buttonTable
[
ii
]]
)
...
...
include/class_board_design_settings.h
View file @
b525e3be
...
...
@@ -75,26 +75,22 @@ public:
/**
* Function IsLayerVisible
* tests whether a given layer is visible
* @param aLayer
Index = The index of t
he layer to be tested
* @param aLayer
= T
he layer to be tested
* @return bool - true if the layer is visible.
*/
bool
IsLayerVisible
(
LAYER_NUM
aLayer
Index
)
const
bool
IsLayerVisible
(
LAYER_NUM
aLayer
)
const
{
// @@IMB: Altough Pcbnew uses only 29, GerbView uses all 32 layers
if
(
aLayerIndex
<
FIRST_LAYER
||
aLayerIndex
>=
NB_LAYERS
)
return
false
;
// If a layer is disabled, it is automatically invisible
return
bool
(
m_VisibleLayers
&
m_EnabledLayers
&
GetLayerMask
(
aLayerIndex
)
);
return
m_VisibleLayers
&
m_EnabledLayers
&
GetLayerMask
(
aLayer
);
}
/**
* Function SetLayerVisibility
* changes the visibility of a given layer
* @param aLayer
Index = The index of t
he layer to be changed
* @param aLayer
= T
he layer to be changed
* @param aNewState = The new visibility state of the layer
*/
void
SetLayerVisibility
(
LAYER_NUM
aLayer
Index
,
bool
aNewState
);
void
SetLayerVisibility
(
LAYER_NUM
aLayer
,
bool
aNewState
);
/**
* Function GetVisibleElements
...
...
@@ -158,12 +154,12 @@ public:
/**
* Function IsLayerEnabled
* tests whether a given layer is enabled
* @param aLayer
Index = The index
of the layer to be tested
* @param aLayer
= The
of the layer to be tested
* @return bool - true if the layer is enabled
*/
bool
IsLayerEnabled
(
LAYER_NUM
aLayer
Index
)
const
bool
IsLayerEnabled
(
LAYER_NUM
aLayer
)
const
{
return
bool
(
m_EnabledLayers
&
GetLayerMask
(
aLayerIndex
)
);
return
m_EnabledLayers
&
GetLayerMask
(
aLayer
);
}
/**
...
...
include/class_layer_box_selector.h
View file @
b525e3be
...
...
@@ -35,15 +35,15 @@ public:
// Returns a color index from the layer id
// Virtual function because GerbView uses its own functions in a derived class
virtual
EDA_COLOR_T
GetLayerColor
(
LAYER_NUM
aLayer
Index
)
const
=
0
;
virtual
EDA_COLOR_T
GetLayerColor
(
LAYER_NUM
aLayer
)
const
=
0
;
// Returns the name of the layer id
// Virtual pure function because GerbView uses its own functions in a derived class
virtual
wxString
GetLayerName
(
LAYER_NUM
aLayer
Index
)
const
=
0
;
virtual
wxString
GetLayerName
(
LAYER_NUM
aLayer
)
const
=
0
;
// Returns true if the layer id is enabled (i.e. is it should be displayed)
// Virtual function pure because GerbView uses its own functions in a derived class
virtual
bool
IsLayerEnabled
(
LAYER_NUM
aLayer
Index
)
const
=
0
;
virtual
bool
IsLayerEnabled
(
LAYER_NUM
aLayer
)
const
=
0
;
// Get Current Item #
int
GetChoice
();
...
...
@@ -66,7 +66,7 @@ public:
protected
:
// Fills the layer bitmap aLayerbmp with the layer color
void
SetBitmapLayer
(
wxBitmap
&
aLayerbmp
,
LAYER_NUM
aLayer
Index
);
void
SetBitmapLayer
(
wxBitmap
&
aLayerbmp
,
LAYER_NUM
aLayer
);
};
#define DECLARE_LAYERS_HOTKEY(list) int list[NB_LAYERS] = \
...
...
include/drawtxt.h
View file @
b525e3be
...
...
@@ -10,6 +10,9 @@
#include <base_struct.h>
#include <eda_text.h> // EDA_TEXT_HJUSTIFY_T and EDA_TEXT_VJUSTIFY_T
/// Minimum dimension in pixel for drawing text
#define MIN_TEXT_SIZE 5
class
EDA_DRAW_PANEL
;
class
PLOTTER
;
...
...
include/eda_text.h
View file @
b525e3be
...
...
@@ -62,6 +62,7 @@ enum EDA_DRAW_MODE_T {
#define DEFAULT_SIZE_TEXT 60
/* default text height (in mils or 1/1000") */
#define TEXT_NO_VISIBLE 1 //< EDA_TEXT::m_Attribut(e?) visibility flag.
#define DIM_ANCRE_TEXTE 2 // Anchor size for text
/**
...
...
include/gr_basic.h
View file @
b525e3be
...
...
@@ -260,4 +260,7 @@ void GRSFilledRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1,
void
GRLineArray
(
EDA_RECT
*
aClipBox
,
wxDC
*
aDC
,
std
::
vector
<
wxPoint
>&
aLines
,
int
aWidth
,
EDA_COLOR_T
aColor
);
void
GRDrawAnchor
(
EDA_RECT
*
aClipBox
,
wxDC
*
aDC
,
int
x
,
int
y
,
int
aSize
,
EDA_COLOR_T
aColor
);
#endif
/* define GR_BASIC */
include/layers_id_colors_and_visibility.h
View file @
b525e3be
...
...
@@ -216,39 +216,52 @@ enum PCB_VISIBLE
END_PCB_VISIBLE_LIST
// sentinel
};
/**
* Function IsValidPcbLayerIndex
* tests whether a given integer is a valid layer index
* @param aLayerIndex = Layer index to test
* Function IsValidLayer
* tests whether a given integer is a valid layer index, i.e. can
* be safely put in a LAYER_NUM
* @param aLayerIndex = Layer index to test. It can be an int, so its
* useful during I/O
* @return true if aLayerIndex is a valid layer index
*/
inline
bool
IsValidPcbLayerIndex
(
LAYER_NUM
aLayerIndex
)
inline
bool
IsValidLayer
(
int
aLayerIndex
)
{
return
aLayerIndex
>=
FIRST_LAYER
&&
aLayerIndex
<
NB_LAYERS
;
}
/**
* Function IsPcbLayer
* tests whether a layer is a valid layer for pcbnew
* @param aLayer = Layer to test
* @return true if aLayer is a layer valid in pcbnew
*/
inline
bool
IsPcbLayer
(
LAYER_NUM
aLayer
)
{
return
aLayer
Index
>=
FIRST_LAYER
&&
aLayerIndex
<
NB_PCB_LAYERS
;
return
aLayer
>=
FIRST_LAYER
&&
aLayer
<
NB_PCB_LAYERS
;
}
/**
* Function Is
ValidCopperLayerIndex
* tests whether a
n integer is a valid copper layer index
* @param aLayer
Index = Layer index
to test
* @return true if aLayer
Index is a valid copper layer index
* Function Is
CopperLayer
* tests whether a
layer is a copper layer
* @param aLayer
= Layer
to test
* @return true if aLayer
is a valid copper layer
*/
inline
bool
Is
ValidCopperLayerIndex
(
LAYER_NUM
aLayerIndex
)
inline
bool
Is
CopperLayer
(
LAYER_NUM
aLayer
)
{
return
aLayerIndex
>=
FIRST_COPPER_LAYER
&&
aLayerIndex
<=
LAST_COPPER_LAYER
;
return
aLayer
>=
FIRST_COPPER_LAYER
&&
aLayer
<=
LAST_COPPER_LAYER
;
}
/**
* Function Is
ValidNonCopperLayerIndex
* tests whether a
n integer is a valid non copper layer index
* @param aLayer
Index = Layer index
to test
* @return true if aLayer
Index is a valid non copper layer index
* Function Is
NonCopperLayer
* tests whether a
layer is a non copper layer
* @param aLayer
= Layer
to test
* @return true if aLayer
is a non copper layer
*/
inline
bool
Is
ValidNonCopperLayerIndex
(
LAYER_NUM
aLayerIndex
)
inline
bool
Is
NonCopperLayer
(
LAYER_NUM
aLayer
)
{
return
aLayer
Index
>=
FIRST_NON_COPPER_LAYER
&&
aLayer
Index
<=
LAST_NON_COPPER_LAYER
;
return
aLayer
>=
FIRST_NON_COPPER_LAYER
&&
aLayer
<=
LAST_NON_COPPER_LAYER
;
}
/* IMPORTANT: If a layer is not a front layer not necessarily is true
...
...
kicad/prjconfig.cpp
View file @
b525e3be
...
...
@@ -38,6 +38,7 @@
#include <wildcards_and_files_ext.h>
#include <vector>
#include <build_version.h>
#include <macros.h>
#include <wx/dir.h>
#include <wx/filename.h>
...
...
pcbnew/basepcbframe.cpp
View file @
b525e3be
...
...
@@ -315,7 +315,7 @@ void PCB_BASE_FRAME::SwitchLayer( wxDC* DC, LAYER_NUM layer )
// Copper layers cannot be selected unconditionally; how many
// of those layers are currently enabled needs to be checked.
if
(
Is
ValidCopperLayerIndex
(
layer
)
)
if
(
Is
CopperLayer
(
layer
)
)
{
// If only one copper layer is enabled, the only such layer
// that can be selected to is the "Copper" layer (so the
...
...
pcbnew/class_board.cpp
View file @
b525e3be
...
...
@@ -356,23 +356,23 @@ bool BOARD::SetLayer( LAYER_NUM aIndex, const LAYER& aLayer )
}
wxString
BOARD
::
GetLayerName
(
LAYER_NUM
aLayer
Index
)
const
wxString
BOARD
::
GetLayerName
(
LAYER_NUM
aLayer
)
const
{
if
(
!
Is
ValidPcbLayerIndex
(
aLayerIndex
)
)
if
(
!
Is
PcbLayer
(
aLayer
)
)
return
wxEmptyString
;
// All layer names are stored in the BOARD.
if
(
IsLayerEnabled
(
aLayer
Index
)
)
if
(
IsLayerEnabled
(
aLayer
)
)
{
// Standard names were set in BOARD::BOARD() but they may be
// over-ridden by BOARD::SetLayerName().
// For copper layers, return the actual copper layer name,
// otherwise return the Standard English layer name.
if
(
aLayerIndex
<
FIRST_NON_COPPER_LAYER
)
return
m_Layer
[
aLayer
Index
].
m_Name
;
if
(
IsCopperLayer
(
aLayer
)
)
return
m_Layer
[
aLayer
].
m_Name
;
}
return
GetStandardLayerName
(
aLayer
Index
);
return
GetStandardLayerName
(
aLayer
);
}
...
...
@@ -422,9 +422,9 @@ wxString BOARD::GetStandardLayerName( LAYER_NUM aLayerNumber )
}
bool
BOARD
::
SetLayerName
(
LAYER_NUM
aLayer
Index
,
const
wxString
&
aLayerName
)
bool
BOARD
::
SetLayerName
(
LAYER_NUM
aLayer
,
const
wxString
&
aLayerName
)
{
if
(
!
Is
ValidCopperLayerIndex
(
aLayerIndex
)
)
if
(
!
Is
CopperLayer
(
aLayer
)
)
return
false
;
if
(
aLayerName
==
wxEmptyString
||
aLayerName
.
Len
()
>
20
)
...
...
@@ -439,15 +439,15 @@ bool BOARD::SetLayerName( LAYER_NUM aLayerIndex, const wxString& aLayerName )
// replace any spaces with underscores before we do any comparing
NameTemp
.
Replace
(
wxT
(
" "
),
wxT
(
"_"
)
);
if
(
IsLayerEnabled
(
aLayer
Index
)
)
if
(
IsLayerEnabled
(
aLayer
)
)
{
for
(
LAYER_NUM
i
=
FIRST_COPPER_LAYER
;
i
<
NB_COPPER_LAYERS
;
++
i
)
{
if
(
i
!=
aLayer
Index
&&
IsLayerEnabled
(
i
)
&&
NameTemp
==
m_Layer
[
i
].
m_Name
)
if
(
i
!=
aLayer
&&
IsLayerEnabled
(
i
)
&&
NameTemp
==
m_Layer
[
i
].
m_Name
)
return
false
;
}
m_Layer
[
aLayer
Index
].
m_Name
=
NameTemp
;
m_Layer
[
aLayer
].
m_Name
=
NameTemp
;
return
true
;
}
...
...
@@ -456,30 +456,30 @@ bool BOARD::SetLayerName( LAYER_NUM aLayerIndex, const wxString& aLayerName )
}
LAYER_T
BOARD
::
GetLayerType
(
LAYER_NUM
aLayer
Index
)
const
LAYER_T
BOARD
::
GetLayerType
(
LAYER_NUM
aLayer
)
const
{
if
(
!
Is
ValidCopperLayerIndex
(
aLayerIndex
)
)
if
(
!
Is
CopperLayer
(
aLayer
)
)
return
LT_SIGNAL
;
//@@IMB: The original test was broken due to the discontinuity
// in the layer sequence.
if
(
IsLayerEnabled
(
aLayer
Index
)
)
return
m_Layer
[
aLayer
Index
].
m_Type
;
if
(
IsLayerEnabled
(
aLayer
)
)
return
m_Layer
[
aLayer
].
m_Type
;
return
LT_SIGNAL
;
}
bool
BOARD
::
SetLayerType
(
LAYER_NUM
aLayer
Index
,
LAYER_T
aLayerType
)
bool
BOARD
::
SetLayerType
(
LAYER_NUM
aLayer
,
LAYER_T
aLayerType
)
{
if
(
!
Is
ValidCopperLayerIndex
(
aLayerIndex
)
)
if
(
!
Is
CopperLayer
(
aLayer
)
)
return
false
;
//@@IMB: The original test was broken due to the discontinuity
// in the layer sequence.
if
(
IsLayerEnabled
(
aLayer
Index
)
)
if
(
IsLayerEnabled
(
aLayer
)
)
{
m_Layer
[
aLayer
Index
].
m_Type
=
aLayerType
;
m_Layer
[
aLayer
].
m_Type
=
aLayerType
;
return
true
;
}
...
...
pcbnew/class_board.h
View file @
b525e3be
...
...
@@ -451,12 +451,12 @@ public:
* Function IsLayerVisible
* is a proxy function that calls the correspondent function in m_BoardSettings
* tests whether a given layer is visible
* @param aLayer
Index = The index of t
he layer to be tested
* @param aLayer
= T
he layer to be tested
* @return bool - true if the layer is visible.
*/
bool
IsLayerVisible
(
LAYER_NUM
aLayer
Index
)
const
bool
IsLayerVisible
(
LAYER_NUM
aLayer
)
const
{
return
m_designSettings
.
IsLayerVisible
(
aLayer
Index
);
return
m_designSettings
.
IsLayerVisible
(
aLayer
);
}
/**
...
...
@@ -588,26 +588,26 @@ public:
/**
* Function GetLayerName
* returns the name of a layer given by aLayer
Index
. Copper layers may
* returns the name of a layer given by aLayer. Copper layers may
* have custom names.
*
* @param aLayer
Index = A layer index
, like LAYER_N_BACK, etc.
* @param aLayer
= A layer
, like LAYER_N_BACK, etc.
*
* @return wxString - the layer name, which for copper layers may
* be custom, else standard.
*/
wxString
GetLayerName
(
LAYER_NUM
aLayer
Index
)
const
;
wxString
GetLayerName
(
LAYER_NUM
aLayer
)
const
;
/**
* Function SetLayerName
* changes the name of the layer given by aLayer
Index
.
* changes the name of the layer given by aLayer.
*
* @param aLayer
Index A layer index
, like LAYER_N_BACK, etc.
* @param aLayer
A layer
, like LAYER_N_BACK, etc.
* @param aLayerName The new layer name
* @return bool - true if aLayerName was legal and unique among other
* layer names at other layer indices and aLayer
Index
was within range, else false.
* layer names at other layer indices and aLayer was within range, else false.
*/
bool
SetLayerName
(
LAYER_NUM
aLayer
Index
,
const
wxString
&
aLayerName
);
bool
SetLayerName
(
LAYER_NUM
aLayer
,
const
wxString
&
aLayerName
);
/**
* Function GetStandardLayerName
...
...
@@ -626,23 +626,23 @@ public:
/**
* Function GetLayerType
* returns the type of the copper layer given by aLayer
Index
.
* returns the type of the copper layer given by aLayer.
*
* @param aLayer
Index
A layer index, like LAYER_N_BACK, etc.
* @param aLayer A layer index, like LAYER_N_BACK, etc.
* @return LAYER_T - the layer type, or LAYER_T(-1) if the
* index was out of range.
*/
LAYER_T
GetLayerType
(
LAYER_NUM
aLayer
Index
)
const
;
LAYER_T
GetLayerType
(
LAYER_NUM
aLayer
)
const
;
/**
* Function SetLayerType
* changes the type of the layer given by aLayer
Index
.
* changes the type of the layer given by aLayer.
*
* @param aLayer
Index
A layer index, like LAYER_N_BACK, etc.
* @param aLayer A layer index, like LAYER_N_BACK, etc.
* @param aLayerType The new layer type.
* @return bool - true if aLayerType was legal and aLayer
Index
was within range, else false.
* @return bool - true if aLayerType was legal and aLayer was within range, else false.
*/
bool
SetLayerType
(
LAYER_NUM
aLayer
Index
,
LAYER_T
aLayerType
);
bool
SetLayerType
(
LAYER_NUM
aLayer
,
LAYER_T
aLayerType
);
/**
* Function SetLayerColor
...
...
pcbnew/class_board_design_settings.cpp
View file @
b525e3be
...
...
@@ -186,21 +186,16 @@ void BOARD_DESIGN_SETTINGS::SetVisibleAlls()
void
BOARD_DESIGN_SETTINGS
::
SetVisibleLayers
(
LAYER_MSK
aMask
)
{
// Although Pcbnew uses only 29, GerbView uses all 32 layers
m_VisibleLayers
=
aMask
&
m_EnabledLayers
&
FULL_LAYERS
;
}
void
BOARD_DESIGN_SETTINGS
::
SetLayerVisibility
(
LAYER_NUM
aLayer
Index
,
bool
aNewState
)
void
BOARD_DESIGN_SETTINGS
::
SetLayerVisibility
(
LAYER_NUM
aLayer
,
bool
aNewState
)
{
// Altough Pcbnew uses only 29, GerbView uses all 32 layers
if
(
aLayerIndex
<
0
||
aLayerIndex
>=
32
)
return
;
if
(
aNewState
&&
IsLayerEnabled
(
aLayerIndex
)
)
m_VisibleLayers
|=
GetLayerMask
(
aLayerIndex
);
if
(
aNewState
&&
IsLayerEnabled
(
aLayer
)
)
m_VisibleLayers
|=
GetLayerMask
(
aLayer
);
else
m_VisibleLayers
&=
~
GetLayerMask
(
aLayer
Index
);
m_VisibleLayers
&=
~
GetLayerMask
(
aLayer
);
}
...
...
@@ -245,12 +240,5 @@ void BOARD_DESIGN_SETTINGS::SetEnabledLayers( LAYER_MSK aMask )
m_VisibleLayers
&=
aMask
;
// update m_CopperLayerCount to ensure its consistency with m_EnabledLayers
m_CopperLayerCount
=
0
;
unsigned
shiftMask
=
aMask
;
for
(
LAYER_NUM
ii
=
FIRST_LAYER
;
aMask
&&
ii
<
NB_COPPER_LAYERS
;
++
ii
,
shiftMask
>>=
1
)
{
if
(
shiftMask
&
1
)
m_CopperLayerCount
++
;
}
m_CopperLayerCount
=
LayerMaskCountSet
(
aMask
&
ALL_CU_LAYERS
);
}
pcbnew/class_marker_pcb.cpp
View file @
b525e3be
...
...
@@ -88,7 +88,7 @@ MARKER_PCB::~MARKER_PCB()
*/
bool
MARKER_PCB
::
IsOnLayer
(
LAYER_NUM
aLayer
)
const
{
return
Is
ValidCopperLayerIndex
(
aLayer
);
return
Is
CopperLayer
(
aLayer
);
}
void
MARKER_PCB
::
GetMsgPanelInfo
(
std
::
vector
<
MSG_PANEL_ITEM
>&
aList
)
...
...
pcbnew/class_module.cpp
View file @
b525e3be
...
...
@@ -181,21 +181,13 @@ MODULE::~MODULE()
void
MODULE
::
DrawAncre
(
EDA_DRAW_PANEL
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
dim_ancre
,
GR_DRAWMODE
draw_mode
)
{
int
anchor_size
=
DC
->
DeviceToLogicalXRel
(
dim_ancre
);
GRSetDrawMode
(
DC
,
draw_mode
);
if
(
GetBoard
()
->
IsElementVisible
(
ANCHOR_VISIBLE
)
)
{
EDA_COLOR_T
color
=
g_ColorsSettings
.
GetItemColor
(
ANCHOR_VISIBLE
);
GRLine
(
panel
->
GetClipBox
(),
DC
,
m_Pos
.
x
-
offset
.
x
-
anchor_size
,
m_Pos
.
y
-
offset
.
y
,
m_Pos
.
x
-
offset
.
x
+
anchor_size
,
m_Pos
.
y
-
offset
.
y
,
0
,
color
);
GRLine
(
panel
->
GetClipBox
(),
DC
,
m_Pos
.
x
-
offset
.
x
,
m_Pos
.
y
-
offset
.
y
-
anchor_size
,
m_Pos
.
x
-
offset
.
x
,
m_Pos
.
y
-
offset
.
y
+
anchor_size
,
0
,
color
);
GRDrawAnchor
(
panel
->
GetClipBox
(),
DC
,
m_Pos
.
x
,
m_Pos
.
y
,
dim_ancre
,
g_ColorsSettings
.
GetItemColor
(
ANCHOR_VISIBLE
)
);
}
}
...
...
pcbnew/class_pad_draw_functions.cpp
View file @
b525e3be
...
...
@@ -229,7 +229,7 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
// layer so we can see pads on paste or solder layer and the size of the
// mask
if
(
(
aDraw_mode
&
GR_ALLOW_HIGHCONTRAST
)
&&
DisplayOpt
.
ContrastModeDisplay
&&
screen
->
m_Active_Layer
>=
FIRST_NON_COPPER_LAYER
)
DisplayOpt
.
ContrastModeDisplay
&&
!
IsCopperLayer
(
screen
->
m_Active_Layer
)
)
{
if
(
IsOnLayer
(
screen
->
m_Active_Layer
)
)
{
...
...
pcbnew/class_pcb_layer_box_selector.cpp
View file @
b525e3be
...
...
@@ -83,33 +83,33 @@ void PCB_LAYER_BOX_SELECTOR::Resync()
// Returns true if the layer id is enabled (i.e. is it should be displayed)
bool
PCB_LAYER_BOX_SELECTOR
::
IsLayerEnabled
(
LAYER_NUM
aLayer
Index
)
const
bool
PCB_LAYER_BOX_SELECTOR
::
IsLayerEnabled
(
LAYER_NUM
aLayer
)
const
{
PCB_BASE_FRAME
*
pcbFrame
=
(
PCB_BASE_FRAME
*
)
GetParent
()
->
GetParent
();
BOARD
*
board
=
pcbFrame
->
GetBoard
();
wxASSERT
(
board
!=
NULL
);
return
board
->
IsLayerEnabled
(
aLayer
Index
);
return
board
->
IsLayerEnabled
(
aLayer
);
}
// Returns a color index from the layer id
EDA_COLOR_T
PCB_LAYER_BOX_SELECTOR
::
GetLayerColor
(
LAYER_NUM
aLayer
Index
)
const
EDA_COLOR_T
PCB_LAYER_BOX_SELECTOR
::
GetLayerColor
(
LAYER_NUM
aLayer
)
const
{
PCB_BASE_FRAME
*
pcbFrame
=
(
PCB_BASE_FRAME
*
)
GetParent
()
->
GetParent
();
BOARD
*
board
=
pcbFrame
->
GetBoard
();
wxASSERT
(
board
!=
NULL
);
return
board
->
GetLayerColor
(
aLayer
Index
);
return
board
->
GetLayerColor
(
aLayer
);
}
// Returns the name of the layer id
wxString
PCB_LAYER_BOX_SELECTOR
::
GetLayerName
(
LAYER_NUM
aLayer
Index
)
const
wxString
PCB_LAYER_BOX_SELECTOR
::
GetLayerName
(
LAYER_NUM
aLayer
)
const
{
PCB_BASE_FRAME
*
pcbFrame
=
(
PCB_BASE_FRAME
*
)
GetParent
()
->
GetParent
();
BOARD
*
board
=
pcbFrame
->
GetBoard
();
wxASSERT
(
board
!=
NULL
);
return
board
->
GetLayerName
(
aLayer
Index
);
return
board
->
GetLayerName
(
aLayer
);
}
pcbnew/class_pcb_layer_box_selector.h
View file @
b525e3be
...
...
@@ -40,15 +40,15 @@ public:
// Returns a color index from the layer id
// Virtual function
EDA_COLOR_T
GetLayerColor
(
LAYER_NUM
aLayer
Index
)
const
;
EDA_COLOR_T
GetLayerColor
(
LAYER_NUM
aLayer
)
const
;
// Returns true if the layer id is enabled (i.e. is it should be displayed)
// Virtual function
bool
IsLayerEnabled
(
LAYER_NUM
aLayer
Index
)
const
;
bool
IsLayerEnabled
(
LAYER_NUM
aLayer
)
const
;
// Returns the name of the layer id
// Virtual function
wxString
GetLayerName
(
LAYER_NUM
aLayer
Index
)
const
;
wxString
GetLayerName
(
LAYER_NUM
aLayer
)
const
;
};
#endif //CLASS_PCB_PCB_LAYER_BOX_SELECTOR_H
pcbnew/class_pcb_layer_widget.cpp
View file @
b525e3be
...
...
@@ -163,7 +163,7 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
{
wxCheckBox
*
cb
=
(
wxCheckBox
*
)
getLayerComp
(
row
,
3
);
LAYER_NUM
layer
=
getDecodedId
(
cb
->
GetId
()
);
if
(
Is
ValidCopperLayerIndex
(
layer
)
)
if
(
Is
CopperLayer
(
layer
)
)
{
lastCu
=
row
;
break
;
...
...
@@ -176,7 +176,7 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
wxCheckBox
*
cb
=
(
wxCheckBox
*
)
getLayerComp
(
row
,
3
);
LAYER_NUM
layer
=
getDecodedId
(
cb
->
GetId
()
);
if
(
Is
ValidCopperLayerIndex
(
layer
)
)
if
(
Is
CopperLayer
(
layer
)
)
{
bool
loc_visible
=
visible
;
if
(
force_active_layer_visible
&&
(
layer
==
myframe
->
getActiveLayer
()
)
)
...
...
@@ -262,36 +262,36 @@ void PCB_LAYER_WIDGET::SyncLayerVisibilities()
void
PCB_LAYER_WIDGET
::
ReFill
()
{
BOARD
*
brd
=
myframe
->
GetBoard
();
LAYER_NUM
layer
;
int
enabledLayers
=
brd
->
GetEnabledLayers
();
int
enabledLayers
=
brd
->
GetEnabledLayers
();
ClearLayerRows
();
// show all coppers first, with front on top, back on bottom, then technical layers
layer
=
LAYER_N_FRONT
;
if
(
enabledLayers
&
GetLayerMask
(
layer
)
)
{
AppendLayerRow
(
LAYER_WIDGET
::
ROW
(
brd
->
GetLayerName
(
layer
),
layer
,
brd
->
GetLayerColor
(
layer
),
_
(
"Front copper layer"
),
true
)
);
}
for
(
layer
=
LAYER_N_FRONT
-
1
;
layer
>=
1
;
--
layer
)
for
(
LAYER_NUM
layer
=
LAYER_N_FRONT
;
layer
>=
FIRST_LAYER
;
--
layer
)
{
if
(
enabledLayers
&
GetLayerMask
(
layer
)
)
{
const
wxChar
*
dsc
;
switch
(
layer
)
{
case
LAYER_N_FRONT
:
dsc
=
_
(
"Front copper layer"
);
break
;
case
LAYER_N_BACK
:
dsc
=
_
(
"Back copper layer"
);
break
;
default
:
dsc
=
_
(
"Inner copper layer"
);
break
;
}
AppendLayerRow
(
LAYER_WIDGET
::
ROW
(
brd
->
GetLayerName
(
layer
),
layer
,
brd
->
GetLayerColor
(
layer
),
_
(
"An innner copper layer"
)
,
true
)
);
brd
->
GetLayerName
(
layer
),
layer
,
brd
->
GetLayerColor
(
layer
),
dsc
,
true
)
);
}
}
layer
=
LAYER_N_BACK
;
if
(
enabledLayers
&
GetLayerMask
(
layer
)
)
{
AppendLayerRow
(
LAYER_WIDGET
::
ROW
(
brd
->
GetLayerName
(
layer
),
layer
,
brd
->
GetLayerColor
(
layer
),
_
(
"Back copper layer"
),
true
)
);
}
// technical layers are shown in this order:
static
const
struct
{
...
...
@@ -315,7 +315,7 @@ void PCB_LAYER_WIDGET::ReFill()
for
(
unsigned
i
=
0
;
i
<
DIM
(
techLayerSeq
);
++
i
)
{
layer
=
techLayerSeq
[
i
].
layerId
;
LAYER_NUM
layer
=
techLayerSeq
[
i
].
layerId
;
if
(
!
(
enabledLayers
&
GetLayerMask
(
layer
))
)
continue
;
...
...
pcbnew/class_text_mod.cpp
View file @
b525e3be
...
...
@@ -288,14 +288,8 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
if
(
brd
->
IsElementVisible
(
ANCHOR_VISIBLE
)
)
{
EDA_COLOR_T
anchor_color
=
brd
->
GetVisibleElementColor
(
ANCHOR_VISIBLE
);
int
anchor_size
=
DC
->
DeviceToLogicalXRel
(
2
);
GRLine
(
panel
->
GetClipBox
(),
DC
,
pos
.
x
-
anchor_size
,
pos
.
y
,
pos
.
x
+
anchor_size
,
pos
.
y
,
0
,
anchor_color
);
GRLine
(
panel
->
GetClipBox
(),
DC
,
pos
.
x
,
pos
.
y
-
anchor_size
,
pos
.
x
,
pos
.
y
+
anchor_size
,
0
,
anchor_color
);
GRDrawAnchor
(
panel
->
GetClipBox
(),
DC
,
pos
.
x
,
pos
.
y
,
DIM_ANCRE_TEXTE
,
anchor_color
);
}
// Draw the text proper, with the right attributes
...
...
pcbnew/class_track.cpp
View file @
b525e3be
...
...
@@ -55,7 +55,7 @@
static
bool
ShowClearance
(
const
TRACK
*
aTrack
)
{
// maybe return true for tracks and vias, not for zone segments
return
aTrack
->
GetLayer
()
<=
LAST_COPPER_LAYER
return
IsCopperLayer
(
aTrack
->
GetLayer
()
)
&&
(
aTrack
->
Type
()
==
PCB_TRACE_T
||
aTrack
->
Type
()
==
PCB_VIA_T
)
&&
(
(
DisplayOpt
.
ShowTrackClearanceMode
==
SHOW_CLEARANCE_NEW_AND_EDITED_TRACKS_AND_VIA_AREAS
&&
(
aTrack
->
IsDragging
()
||
aTrack
->
IsMoving
()
||
aTrack
->
IsNew
()
)
)
...
...
@@ -87,7 +87,8 @@ inline bool IsNear( wxPoint& p1, wxPoint& p2, int max_dist )
}
TRACK
*
GetTrace
(
TRACK
*
aStartTrace
,
TRACK
*
aEndTrace
,
const
wxPoint
&
aPosition
,
LAYER_MSK
aLayerMask
)
TRACK
*
GetTrace
(
TRACK
*
aStartTrace
,
TRACK
*
aEndTrace
,
const
wxPoint
&
aPosition
,
LAYER_MSK
aLayerMask
)
{
TRACK
*
PtSegm
;
...
...
@@ -389,14 +390,8 @@ void TRACK::Flip( const wxPoint& aCentre )
m_Start
.
y
=
aCentre
.
y
-
(
m_Start
.
y
-
aCentre
.
y
);
m_End
.
y
=
aCentre
.
y
-
(
m_End
.
y
-
aCentre
.
y
);
if
(
Type
()
==
PCB_VIA_T
)
{
// Huh? Wouldn't it be better to us Type() != VIA and get rid of these brackets?
}
else
{
if
(
Type
()
!=
PCB_VIA_T
)
SetLayer
(
FlipLayer
(
GetLayer
()
)
);
}
}
...
...
@@ -406,10 +401,6 @@ SEARCH_RESULT TRACK::Visit( INSPECTOR* inspector, const void* testData,
{
KICAD_T
stype
=
*
scanTypes
;
#if 0 && defined(DEBUG)
std::cout << GetClass().mb_str() << ' ';
#endif
// If caller wants to inspect my type
if
(
stype
==
Type
()
)
{
...
...
pcbnew/dialogs/dialog_graphic_item_properties.cpp
View file @
b525e3be
...
...
@@ -156,13 +156,15 @@ void DIALOG_GRAPHIC_ITEM_PROPERTIES::initDlg( )
PutValueInLocalUnits
(
*
m_DefaultThicknessCtrl
,
thickness
);
for
(
LAYER_NUM
layer
=
FIRST_NON_COPPER_LAYER
;
layer
<=
LAST_NON_COPPER_LAYER
;
++
layer
)
for
(
LAYER_NUM
layer
=
FIRST_NON_COPPER_LAYER
;
layer
<=
LAST_NON_COPPER_LAYER
;
++
layer
)
{
m_LayerSelectionCtrl
->
Append
(
m_parent
->
GetBoard
()
->
GetLayerName
(
layer
)
);
}
LAYER_NUM
layer
=
m_Item
->
GetLayer
();
// Control:
// It has to be an aux layer
if
(
layer
<
FIRST_NON_COPPER_LAYER
)
layer
=
FIRST_NON_COPPER_LAYER
;
if
(
layer
>
LAST_NON_COPPER_LAYER
)
...
...
pcbnew/dialogs/dialog_graphic_item_properties_for_Modedit.cpp
View file @
b525e3be
...
...
@@ -196,10 +196,10 @@ void DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::OnOkClick( wxCommandEvent& event )
}
LAYER_NUM
layer
=
m_layerId
[
idx
];
if
(
Is
ValidCopperLayerIndex
(
layer
)
)
if
(
Is
CopperLayer
(
layer
)
)
{
/* an edge is put on a copper layer
, and
it is very dangerous. a
*confirmation is requested */
/* an edge is put on a copper layer
: this
it is very dangerous. a
*
confirmation is requested */
if
(
!
IsOK
(
NULL
,
_
(
"The graphic item will be on a copper layer. This is very dangerous. Are you sure?"
)
)
)
return
;
...
...
pcbnew/dialogs/dialog_layers_setup.cpp
View file @
b525e3be
...
...
@@ -580,7 +580,7 @@ wxString DIALOG_LAYERS_SETUP::getLayerName( LAYER_NUM aLayer )
{
wxString
ret
;
wxASSERT
(
aLayer
>=
FIRST_COPPER_LAYER
&&
aLayer
<=
LAST_COPPER_LAYER
);
wxASSERT
(
IsCopperLayer
(
aLayer
)
);
wxTextCtrl
*
ctl
=
(
wxTextCtrl
*
)
getName
(
aLayer
);
...
...
pcbnew/eagle_plugin.cpp
View file @
b525e3be
...
...
@@ -1475,7 +1475,7 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics )
ERECT
r
(
gr
->
second
);
LAYER_NUM
layer
=
kicad_layer
(
r
.
layer
);
if
(
Is
ValidCopperLayerIndex
(
layer
)
)
if
(
Is
CopperLayer
(
layer
)
)
{
// use a "netcode = 0" type ZONE:
ZONE_CONTAINER
*
zone
=
new
ZONE_CONTAINER
(
m_board
);
...
...
@@ -1910,7 +1910,7 @@ void EAGLE_PLUGIN::packageWire( MODULE* aModule, CPTREE& aTree ) const
EWIRE
w
(
aTree
);
LAYER_NUM
layer
=
kicad_layer
(
w
.
layer
);
if
(
Is
ValidNonCopperLayerIndex
(
layer
)
)
// skip copper package wires
if
(
Is
NonCopperLayer
(
layer
)
)
// skip copper package wires
{
wxPoint
start
(
kicad_x
(
w
.
x1
),
kicad_y
(
w
.
y1
)
);
wxPoint
end
(
kicad_x
(
w
.
x2
),
kicad_y
(
w
.
y2
)
);
...
...
@@ -2120,7 +2120,7 @@ void EAGLE_PLUGIN::packageRectangle( MODULE* aModule, CPTREE& aTree ) const
ERECT
r
(
aTree
);
LAYER_NUM
layer
=
kicad_layer
(
r
.
layer
);
if
(
Is
ValidNonCopperLayerIndex
(
layer
)
)
// skip copper "package.rectangle"s
if
(
Is
NonCopperLayer
(
layer
)
)
// skip copper "package.rectangle"s
{
EDGE_MODULE
*
dwg
=
new
EDGE_MODULE
(
aModule
,
S_POLYGON
);
aModule
->
GraphicalItems
().
PushBack
(
dwg
);
...
...
@@ -2153,7 +2153,7 @@ void EAGLE_PLUGIN::packagePolygon( MODULE* aModule, CPTREE& aTree ) const
EPOLYGON
p
(
aTree
);
LAYER_NUM
layer
=
kicad_layer
(
p
.
layer
);
if
(
Is
ValidNonCopperLayerIndex
(
layer
)
)
// skip copper "package.rectangle"s
if
(
Is
NonCopperLayer
(
layer
)
)
// skip copper "package.rectangle"s
{
EDGE_MODULE
*
dwg
=
new
EDGE_MODULE
(
aModule
,
S_POLYGON
);
aModule
->
GraphicalItems
().
PushBack
(
dwg
);
...
...
@@ -2259,7 +2259,7 @@ void EAGLE_PLUGIN::packageSMD( MODULE* aModule, CPTREE& aTree ) const
ESMD
e
(
aTree
);
LAYER_NUM
layer
=
kicad_layer
(
e
.
layer
);
if
(
!
Is
ValidCopperLayerIndex
(
layer
)
)
if
(
!
Is
CopperLayer
(
layer
)
)
{
return
;
}
...
...
@@ -2351,7 +2351,7 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals )
EWIRE
w
(
it
->
second
);
LAYER_NUM
layer
=
kicad_layer
(
w
.
layer
);
if
(
Is
ValidCopperLayerIndex
(
layer
)
)
if
(
Is
CopperLayer
(
layer
)
)
{
TRACK
*
t
=
new
TRACK
(
m_board
);
...
...
@@ -2386,8 +2386,8 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals )
LAYER_NUM
layer_front_most
=
kicad_layer
(
v
.
layer_front_most
);
LAYER_NUM
layer_back_most
=
kicad_layer
(
v
.
layer_back_most
);
if
(
Is
ValidCopperLayerIndex
(
layer_front_most
)
&&
Is
ValidCopperLayerIndex
(
layer_back_most
)
)
if
(
Is
CopperLayer
(
layer_front_most
)
&&
Is
CopperLayer
(
layer_back_most
)
)
{
int
kidiam
;
int
drillz
=
kicad
(
v
.
drill
);
...
...
@@ -2464,7 +2464,7 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals )
EPOLYGON
p
(
it
->
second
);
LAYER_NUM
layer
=
kicad_layer
(
p
.
layer
);
if
(
Is
ValidCopperLayerIndex
(
layer
)
)
if
(
Is
CopperLayer
(
layer
)
)
{
// use a "netcode = 0" type ZONE:
ZONE_CONTAINER
*
zone
=
new
ZONE_CONTAINER
(
m_board
);
...
...
pcbnew/edgemod.cpp
View file @
b525e3be
...
...
@@ -202,7 +202,7 @@ void FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer( EDGE_MODULE* aEdge )
if
(
new_layer
<
0
)
return
;
if
(
Is
ValidCopperLayerIndex
(
new_layer
)
)
if
(
Is
CopperLayer
(
new_layer
)
)
{
/* an edge is put on a copper layer, and it is very dangerous. a
*confirmation is requested */
...
...
pcbnew/edit.cpp
View file @
b525e3be
...
...
@@ -1248,7 +1248,7 @@ void PCB_EDIT_FRAME::SwitchLayer( wxDC* DC, LAYER_NUM layer )
// Copper layers cannot be selected unconditionally; how many
// of those layers are currently enabled needs to be checked.
if
(
Is
ValidCopperLayerIndex
(
layer
)
)
if
(
Is
CopperLayer
(
layer
)
)
{
// If only one copper layer is enabled, the only such layer
// that can be selected to is the "Back" layer (so the
...
...
pcbnew/onleftclick.cpp
View file @
b525e3be
...
...
@@ -243,7 +243,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
if
(
GetToolId
()
==
ID_PCB_ARC_BUTT
)
shape
=
S_ARC
;
if
(
getActiveLayer
()
<=
LAST_COPPER_LAYER
)
if
(
IsCopperLayer
(
getActiveLayer
()
)
)
{
DisplayError
(
this
,
_
(
"Graphic not authorized on Copper layers"
)
);
break
;
...
...
@@ -267,7 +267,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
break
;
case
ID_TRACK_BUTT
:
if
(
getActiveLayer
()
>
LAST_COPPER_LAYER
)
if
(
!
IsCopperLayer
(
getActiveLayer
()
)
)
{
DisplayError
(
this
,
_
(
"Tracks on Copper layers only "
)
);
break
;
...
...
@@ -366,7 +366,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
break
;
case
ID_PCB_DIMENSION_BUTT
:
if
(
getActiveLayer
()
<=
LAST_COPPER_LAYER
)
if
(
IsCopperLayer
(
getActiveLayer
()
)
)
{
DisplayError
(
this
,
_
(
"Dimension not authorized on Copper layers"
)
);
break
;
...
...
pcbnew/onrightclick.cpp
View file @
b525e3be
...
...
@@ -204,7 +204,7 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
AddMenuItem
(
aPopMenu
,
ID_POPUP_PCB_DELETE_DRAWING
,
_
(
"Delete Drawing"
),
KiBitmap
(
delete_xpm
)
);
if
(
item
->
GetLayer
()
>
LAST_COPPER_LAYER
)
if
(
!
IsCopperLayer
(
item
->
GetLayer
()
)
)
AddMenuItem
(
aPopMenu
,
ID_POPUP_PCB_DELETE_DRAWING_LAYER
,
_
(
"Delete All Drawings on Layer"
),
KiBitmap
(
delete_xpm
)
);
}
...
...
pcbnew/pcad2kicadpcb_plugin/pcb_arc.cpp
View file @
b525e3be
...
...
@@ -150,7 +150,7 @@ void PCB_ARC::Flip()
void
PCB_ARC
::
AddToModule
(
MODULE
*
aModule
)
{
if
(
Is
ValidNonCopperLayerIndex
(
m_KiCadLayer
)
)
if
(
Is
NonCopperLayer
(
m_KiCadLayer
)
)
{
EDGE_MODULE
*
arc
=
new
EDGE_MODULE
(
aModule
,
S_ARC
);
aModule
->
GraphicalItems
().
PushBack
(
arc
);
...
...
pcbnew/pcad2kicadpcb_plugin/pcb_line.cpp
View file @
b525e3be
...
...
@@ -116,7 +116,7 @@ void PCB_LINE::Flip()
void
PCB_LINE
::
AddToModule
(
MODULE
*
aModule
)
{
if
(
Is
ValidNonCopperLayerIndex
(
m_KiCadLayer
)
)
if
(
Is
NonCopperLayer
(
m_KiCadLayer
)
)
{
EDGE_MODULE
*
segment
=
new
EDGE_MODULE
(
aModule
,
S_SEGMENT
);
aModule
->
GraphicalItems
().
PushBack
(
segment
);
...
...
@@ -134,7 +134,7 @@ void PCB_LINE::AddToModule( MODULE* aModule )
void
PCB_LINE
::
AddToBoard
()
{
if
(
Is
ValidCopperLayerIndex
(
m_KiCadLayer
)
)
if
(
Is
CopperLayer
(
m_KiCadLayer
)
)
{
TRACK
*
track
=
new
TRACK
(
m_board
);
m_board
->
m_Track
.
Append
(
track
);
...
...
pcbnew/pcad2kicadpcb_plugin/pcb_pad.cpp
View file @
b525e3be
...
...
@@ -319,7 +319,7 @@ void PCB_PAD::AddToBoard()
if
(
width
==
0
||
height
==
0
)
THROW_IO_ERROR
(
wxT
(
"pad or via with zero size"
)
);
if
(
Is
ValidCopperLayerIndex
(
m_KiCadLayer
)
)
if
(
Is
CopperLayer
(
m_KiCadLayer
)
)
{
SEGVIA
*
via
=
new
SEGVIA
(
m_board
);
m_board
->
m_Track
.
Append
(
via
);
...
...
pcbnew/pcbnew.h
View file @
b525e3be
...
...
@@ -29,8 +29,7 @@
#define FLG_START 0 // Flag used in locate routines
#define FLG_END 1 // Flag used in locate routines
#define DIM_ANCRE_MODULE 3
/* Anchor size (footprint center) */
#define DIM_ANCRE_TEXTE 2
/* Anchor size (Text center) */
#define DIM_ANCRE_MODULE 3 // Anchor size (footprint center)
#define TEXTS_MIN_SIZE DMils2iu( 50 ) ///< Minimum text size in Pcbnew units value (50 * 0.0001 mils)
...
...
pcbnew/swap_layers.cpp
View file @
b525e3be
...
...
@@ -291,7 +291,7 @@ void WinEDA_SwapLayerFrame::Sel_Layer( wxCommandEvent& event )
jj
=
m_Parent
->
SelectLayer
(
jj
,
UNDEFINED_LAYER
,
UNDEFINED_LAYER
,
true
);
if
(
(
jj
<
FIRST_LAYER
)
||
(
jj
>
NB_PCB_LAYERS
)
)
if
(
!
IsValidLayer
(
jj
)
)
return
;
// No change if the selected layer matches the layer being edited.
...
...
pcbnew/zones_test_and_combine_areas.cpp
View file @
b525e3be
...
...
@@ -62,7 +62,7 @@ bool BOARD::OnAreaPolygonModified( PICKED_ITEMS_LIST* aModifiedZonesList,
CombineAllAreasInNet
(
aModifiedZonesList
,
modified_area
->
GetNet
(),
true
);
}
if
(
layer
>=
FIRST_NON_COPPER_LAYER
)
// Refill non copper zones on this layer
if
(
!
IsCopperLayer
(
layer
)
)
// Refill non copper zones on this layer
{
for
(
unsigned
ia
=
0
;
ia
<
m_ZoneDescriptorList
.
size
();
ia
++
)
if
(
m_ZoneDescriptorList
[
ia
]
->
GetLayer
()
==
layer
)
...
...
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