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
add4d5eb
Commit
add4d5eb
authored
Jun 29, 2014
by
Dick Hollenbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
re-work the LSET(int,...) constructor
parent
0a1665d5
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
80 additions
and
38 deletions
+80
-38
class_layer_box_selector.cpp
common/class_layer_box_selector.cpp
+2
-2
lset.cpp
common/lset.cpp
+27
-11
class_gbr_layer_box_selector.cpp
gerbview/class_gbr_layer_box_selector.cpp
+1
-1
class_layer_box_selector.h
include/class_layer_box_selector.h
+3
-3
layers_id_colors_and_visibility.h
include/layers_id_colors_and_visibility.h
+27
-9
wxBasePcbFrame.h
include/wxBasePcbFrame.h
+1
-1
class_pad.h
pcbnew/class_pad.h
+0
-1
dialog_copper_zones.cpp
pcbnew/dialogs/dialog_copper_zones.cpp
+2
-1
dialog_layers_setup.cpp
pcbnew/dialogs/dialog_layers_setup.cpp
+10
-4
dialog_layers_setup_base.cpp
pcbnew/dialogs/dialog_layers_setup_base.cpp
+1
-1
dialog_layers_setup_base.fbp
pcbnew/dialogs/dialog_layers_setup_base.fbp
+1
-1
pcb_parser.cpp
pcbnew/pcb_parser.cpp
+1
-1
pcbnew_config.cpp
pcbnew/pcbnew_config.cpp
+4
-1
pcbplot.h
pcbnew/pcbplot.h
+0
-1
No files found.
common/class_layer_box_selector.cpp
View file @
add4d5eb
...
...
@@ -25,7 +25,7 @@ bool LAYER_SELECTOR::SetLayersHotkeys( bool value )
}
void
LAYER_SELECTOR
::
SetBitmapLayer
(
wxBitmap
&
aLayerbmp
,
LAYER_
ID
aLayer
)
void
LAYER_SELECTOR
::
SetBitmapLayer
(
wxBitmap
&
aLayerbmp
,
LAYER_
NUM
aLayer
)
{
wxMemoryDC
bmpDC
;
wxBrush
brush
;
...
...
@@ -120,7 +120,7 @@ void LAYER_BOX_SELECTOR::ResyncBitmapOnly()
for
(
LAYER_NUM
i
=
0
;
i
<
elements
;
++
i
)
{
wxBitmap
layerbmp
(
14
,
14
);
SetBitmapLayer
(
layerbmp
,
ToLAYER_ID
(
i
)
);
SetBitmapLayer
(
layerbmp
,
i
);
}
}
common/lset.cpp
View file @
add4d5eb
...
...
@@ -37,13 +37,22 @@ LSET::LSET( const LAYER_ID* aArray, unsigned aCount )
}
LSET
::
LSET
(
size_t
aIdCoun
t
,
...
)
LSET
::
LSET
(
unsigned
aIdCount
,
LAYER_ID
aFirs
t
,
...
)
{
// The constructor, without the mandatory aFirst argument, could have been confused
// by the compiler with the LSET( LAYER_ID ). With aFirst, that ambiguity is not
// present. Therefore aIdCount must always be >=1.
wxASSERT_MSG
(
aIdCount
>
0
,
wxT
(
"aIdCount must be >= 1"
)
);
set
(
aFirst
);
if
(
--
aIdCount
)
{
va_list
ap
;
va_start
(
ap
,
aIdCoun
t
);
va_start
(
ap
,
aFirs
t
);
for
(
size_t
i
=
0
;
i
<
aIdCount
;
++
i
)
for
(
unsigned
i
=
0
;
i
<
aIdCount
;
++
i
)
{
LAYER_ID
id
=
(
LAYER_ID
)
va_arg
(
ap
,
int
);
...
...
@@ -55,6 +64,7 @@ LSET::LSET( size_t aIdCount, ... )
}
va_end
(
ap
);
}
}
...
...
@@ -633,4 +643,10 @@ LSEQ LSET::UIOrder() const
return
Seq
(
order
,
DIM
(
order
)
);
}
LAYER_ID
ToLAYER_ID
(
int
aLayer
);
LAYER_ID
ToLAYER_ID
(
int
aLayer
)
{
wxASSERT
(
unsigned
(
aLayer
)
<
LAYER_ID_COUNT
);
return
LAYER_ID
(
aLayer
);
}
gerbview/class_gbr_layer_box_selector.cpp
View file @
add4d5eb
...
...
@@ -49,7 +49,7 @@ void GBR_LAYER_BOX_SELECTOR::Resync()
continue
;
// Prepare Bitmap
SetBitmapLayer
(
layerbmp
,
ToLAYER_ID
(
layerid
)
);
SetBitmapLayer
(
layerbmp
,
layerid
);
layername
=
GetLayerName
(
layerid
);
...
...
include/class_layer_box_selector.h
View file @
add4d5eb
...
...
@@ -35,12 +35,12 @@ public:
// Virtual function pure because GerbView uses its own functions in a derived class
virtual
bool
IsLayerEnabled
(
LAYER_NUM
aLayer
)
const
=
0
;
bool
SetLayersOrdered
(
bool
value
);
bool
SetLayersHotkeys
(
bool
value
);
bool
SetLayersOrdered
(
bool
value
);
bool
SetLayersHotkeys
(
bool
value
);
protected
:
// Fills the layer bitmap aLayerbmp with the layer color
void
SetBitmapLayer
(
wxBitmap
&
aLayerbmp
,
LAYER_
ID
aLayer
);
void
SetBitmapLayer
(
wxBitmap
&
aLayerbmp
,
LAYER_
NUM
aLayer
);
};
...
...
include/layers_id_colors_and_visibility.h
View file @
add4d5eb
...
...
@@ -149,7 +149,11 @@ typedef std::vector<LAYER_ID> BASE_SEQ;
* <code>
*
* for( LSEQ cu_stack = aSet.CuStack(); cu_stack; ++cu_stack )
* {
* layer_id = *cu_stack;
* :
* things to do with layer_id;
* }
*
* </code>
*/
...
...
@@ -198,13 +202,24 @@ class LSET : public BASE_SET
{
public
:
// The constructor flavors are carefully chosen to prevent LSET( int ) from compiling.
// That excludes "LSET s = 0;" and excludes "LSET s = -1;", etc.
// LSET s = 0; needs to be removed from the code, this accomplishes that.
// Remember LSET( LAYER_ID(0) ) sets bit 0, so "LSET s = 0;" is illegal
// to prevent that surprize. Therefore LSET's constructor suite is significantly
// different than the base class from which it is derived.
// Other member functions (non-constructor functions) are identical to the base
// class's and therefore are re-used from the base class.
/**
* Constructor LSET()
* creates an empty (cleared) set.
*/
LSET
()
:
BASE_SET
()
{}
BASE_SET
()
// all bits are set to zero in BASE_SET()
{
}
LSET
(
const
BASE_SET
&
aOther
)
:
BASE_SET
(
aOther
)
...
...
@@ -214,12 +229,11 @@ public:
/**
* Constructor LSET( LAYER_ID )
* takes a LAYER_ID and sets that bit. This makes the following code into
* a bug
typically
:
* a bug:
*
* <code> LSET s = 0; </code>
*
* since that will call this constructor and set bit zero, probably not what was
* intended. Use
* Instead use:
*
* <code>
* LSET s;
...
...
@@ -239,12 +253,16 @@ public:
LSET
(
const
LAYER_ID
*
aArray
,
unsigned
aCount
);
/**
* Constructor LSET( int, ...)
* takes a variable number of LAYER_IDs in the argument list to construct
* the set. Typically used only in static construction.
* Constructor LSET( unsigned, LAYER_ID, ...)
* takes one or more LAYER_IDs in the argument list to construct
* the set. Typically only used in static construction.
*
* @param aIdCount is the number of LAYER_IDs which follow.
* @param aFirst is the first included in @a aIdCount and must always be present, and can
* be followed by any number of additional LAYER_IDs so long as @a aIdCount accurately
* reflects the count.
*/
LSET
(
size_t
aIdCount
,
...
);
LSET
(
unsigned
aIdCount
,
LAYER_ID
aFirst
,
...
);
// args chosen to prevent LSET( int ) from compiling
/**
* Function Name
...
...
include/wxBasePcbFrame.h
View file @
add4d5eb
...
...
@@ -607,7 +607,7 @@ public:
* @return the selected layer id
*/
LAYER_ID
SelectLayer
(
LAYER_ID
aDefaultLayer
,
LSET
aNotAllowedLayersMask
=
0
,
LSET
aNotAllowedLayersMask
=
LSET
()
,
wxPoint
aDlgPosition
=
wxDefaultPosition
);
/* Display a list of two copper layers to choose a pair of copper layers
...
...
pcbnew/class_pad.h
View file @
add4d5eb
...
...
@@ -363,7 +363,6 @@ public:
int
GetSubRatsnest
()
const
{
return
m_SubRatsnest
;
}
void
SetSubRatsnest
(
int
aSubRatsnest
)
{
m_SubRatsnest
=
aSubRatsnest
;
}
void
GetMsgPanelInfo
(
std
::
vector
<
MSG_PANEL_ITEM
>&
aList
);
bool
IsOnLayer
(
LAYER_ID
aLayer
)
const
...
...
pcbnew/dialogs/dialog_copper_zones.cpp
View file @
add4d5eb
...
...
@@ -268,7 +268,8 @@ void DIALOG_COPPER_ZONE::initDialog()
imageList
->
Add
(
makeLayerBitmap
(
layerColor
)
);
int
itemIndex
=
m_LayerSelectionCtrl
->
InsertItem
(
0
,
msg
,
layer
);
int
itemIndex
=
m_LayerSelectionCtrl
->
InsertItem
(
m_LayerSelectionCtrl
->
GetItemCount
(),
msg
,
layer
);
if
(
m_settings
.
m_CurrentZone_Layer
==
layer
)
m_LayerSelectionCtrl
->
Select
(
itemIndex
);
...
...
pcbnew/dialogs/dialog_layers_setup.cpp
View file @
add4d5eb
...
...
@@ -80,6 +80,7 @@ static LSEQ dlg_layers()
F_Mask
,
F_Cu
,
In1_Cu
,
In2_Cu
,
In3_Cu
,
In4_Cu
,
...
...
@@ -360,14 +361,19 @@ DIALOG_LAYERS_SETUP::DIALOG_LAYERS_SETUP( wxTopLevelWindow* aParent, BOARD* aBoa
void
DIALOG_LAYERS_SETUP
::
showCopperChoice
(
int
copperCount
)
{
static
const
int
copperCounts
[]
=
{
2
,
4
,
6
,
8
,
10
,
12
,
14
,
16
};
if
(
copperCount
>
MAX_CU_LAYERS
)
copperCount
=
MAX_CU_LAYERS
;
for
(
unsigned
i
=
0
;
i
<
sizeof
(
copperCounts
);
++
i
)
if
(
copperCount
<
2
)
copperCount
=
2
;
for
(
int
lyrCnt
=
2
;
lyrCnt
<=
MAX_CU_LAYERS
;
lyrCnt
+=
2
)
{
// note this will change a one layer board to 2:
if
(
copperCount
<=
copperCounts
[
i
]
)
if
(
copperCount
<=
lyrCnt
)
{
m_CopperLayersChoice
->
SetSelection
(
i
);
int
idx
=
lyrCnt
/
2
-
1
;
m_CopperLayersChoice
->
SetSelection
(
idx
);
break
;
}
}
...
...
pcbnew/dialogs/dialog_layers_setup_base.cpp
View file @
add4d5eb
...
...
@@ -42,7 +42,7 @@ DIALOG_LAYERS_SETUP_BASE::DIALOG_LAYERS_SETUP_BASE( wxWindow* parent, wxWindowID
m_staticTextCopperLayers
->
Wrap
(
-
1
);
bCopperLayersSizer
->
Add
(
m_staticTextCopperLayers
,
0
,
wxTOP
|
wxRIGHT
|
wxLEFT
,
5
);
wxString
m_CopperLayersChoiceChoices
[]
=
{
_
(
"2"
),
_
(
"4"
),
_
(
"6"
),
_
(
"8"
),
_
(
"10"
),
_
(
"12"
),
_
(
"14"
),
_
(
"16"
),
_
(
"18"
),
_
(
"20"
),
_
(
"22"
),
_
(
"24"
),
_
(
"26"
),
_
(
"2
7"
),
_
(
"2
8"
),
_
(
"30"
),
_
(
"32"
)
};
wxString
m_CopperLayersChoiceChoices
[]
=
{
_
(
"2"
),
_
(
"4"
),
_
(
"6"
),
_
(
"8"
),
_
(
"10"
),
_
(
"12"
),
_
(
"14"
),
_
(
"16"
),
_
(
"18"
),
_
(
"20"
),
_
(
"22"
),
_
(
"24"
),
_
(
"26"
),
_
(
"28"
),
_
(
"30"
),
_
(
"32"
)
};
int
m_CopperLayersChoiceNChoices
=
sizeof
(
m_CopperLayersChoiceChoices
)
/
sizeof
(
wxString
);
m_CopperLayersChoice
=
new
wxChoice
(
this
,
wxID_ANY
,
wxDefaultPosition
,
wxDefaultSize
,
m_CopperLayersChoiceNChoices
,
m_CopperLayersChoiceChoices
,
0
);
m_CopperLayersChoice
->
SetSelection
(
3
);
...
...
pcbnew/dialogs/dialog_layers_setup_base.fbp
View file @
add4d5eb
...
...
@@ -394,7 +394,7 @@
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="choices">"2" "4" "6" "8" "10" "12" "14" "16" "18" "20" "22" "24" "26" "2
7" "2
8" "30" "32"</property>
<property name="choices">"2" "4" "6" "8" "10" "12" "14" "16" "18" "20" "22" "24" "26" "28" "30" "32"</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
pcbnew/pcb_parser.cpp
View file @
add4d5eb
...
...
@@ -67,7 +67,7 @@ void PCB_PARSER::init()
std
::
string
untranslated
=
TO_UTF8
(
wxString
(
LSET
::
Name
(
LAYER_ID
(
layer
)
)
)
);
m_layerIndices
[
untranslated
]
=
LAYER_ID
(
layer
);
m_layerMasks
[
untranslated
]
=
LSET
(
layer
);
m_layerMasks
[
untranslated
]
=
LSET
(
LAYER_ID
(
layer
)
);
}
m_layerMasks
[
"*.Cu"
]
=
LSET
::
AllCuMask
();
...
...
pcbnew/pcbnew_config.cpp
View file @
add4d5eb
...
...
@@ -366,9 +366,12 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings()
&
DisplayOpt
.
DisplayZonesMode
,
0
,
0
,
2
)
);
// layer colors:
wxASSERT
(
DIM
(
cds
.
m_LayersColors
)
==
LAYER_ID_COUNT
);
for
(
int
i
=
0
;
i
<
LAYER_ID_COUNT
;
++
i
)
{
wxString
vn
=
wxString
::
Format
(
wxT
(
"ColorLayer%dEx"
),
i
);
wxString
vn
=
wxString
::
Format
(
wxT
(
"ColorPCBLayer:%s"
),
LSET
::
Name
(
LAYER_ID
(
i
)
)
);
m_configSettings
.
push_back
(
new
PARAM_CFG_SETCOLOR
(
true
,
vn
,
LOC_COLOR
(
i
),
cds
.
m_LayersColors
[
i
]
)
);
}
...
...
pcbnew/pcbplot.h
View file @
add4d5eb
...
...
@@ -81,7 +81,6 @@ public:
{
m_plotter
=
aPlotter
;
m_board
=
aBoard
;
m_layerMask
=
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