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
047749a8
Commit
047749a8
authored
Sep 02, 2013
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor changes and refinement in class pcb layer box
parent
684bfad0
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
17 deletions
+30
-17
class_layer_box_selector.cpp
common/class_layer_box_selector.cpp
+5
-7
class_layer_box_selector.h
include/class_layer_box_selector.h
+1
-1
class_pcb_layer_box_selector.cpp
pcbnew/class_pcb_layer_box_selector.cpp
+21
-7
class_pcb_layer_box_selector.h
pcbnew/class_pcb_layer_box_selector.h
+3
-2
No files found.
common/class_layer_box_selector.cpp
View file @
047749a8
...
...
@@ -50,15 +50,13 @@ void LAYER_SELECTOR::SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_NUM aLayer )
bmpDC
.
DrawRectangle
(
0
,
0
,
aLayerbmp
.
GetWidth
(),
aLayerbmp
.
GetHeight
()
);
}
/* class to display a layer list.
*
/* class to display a layer list in a wxBitmapComboBox.
*/
LAYER_BOX_SELECTOR
::
LAYER_BOX_SELECTOR
(
wxWindow
*
parent
,
wxWindowID
id
,
const
wxPoint
&
pos
,
const
wxSize
&
size
,
int
n
,
const
wxString
choices
[]
)
:
LAYER_SELECTOR
(
),
wxBitmapComboBox
(
parent
,
id
,
wxEmptyString
,
pos
,
size
,
n
,
choices
,
wxCB_READONLY
)
wxBitmapComboBox
(
parent
,
id
,
wxEmptyString
,
pos
,
size
,
n
,
choices
,
wxCB_READONLY
),
LAYER_SELECTOR
(
)
{
if
(
choices
!=
NULL
)
ResyncBitmapOnly
();
...
...
@@ -68,8 +66,8 @@ LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id,
LAYER_BOX_SELECTOR
::
LAYER_BOX_SELECTOR
(
wxWindow
*
parent
,
wxWindowID
id
,
const
wxPoint
&
pos
,
const
wxSize
&
size
,
const
wxArrayString
&
choices
)
:
LAYER_SELECTOR
(
),
wxBitmapComboBox
(
parent
,
id
,
wxEmptyString
,
pos
,
size
,
choices
,
wxCB_READONLY
)
wxBitmapComboBox
(
parent
,
id
,
wxEmptyString
,
pos
,
size
,
choices
,
wxCB_READONLY
),
LAYER_SELECTOR
(
)
{
if
(
!
choices
.
IsEmpty
()
)
ResyncBitmapOnly
();
...
...
include/class_layer_box_selector.h
View file @
047749a8
...
...
@@ -46,7 +46,7 @@ protected:
/* class to display a layer list in a wxBitmapComboBox.
*/
class
LAYER_BOX_SELECTOR
:
public
LAYER_SELECTOR
,
public
wxBitmapComboBox
class
LAYER_BOX_SELECTOR
:
public
wxBitmapComboBox
,
public
LAYER_SELECTOR
{
public
:
// Hotkey Info
...
...
pcbnew/class_pcb_layer_box_selector.cpp
View file @
047749a8
...
...
@@ -40,10 +40,7 @@
#include <class_pcb_layer_box_selector.h>
/* class to display a layer list.
*
*/
// class to display a layer list in a wxBitmapComboBox.
// Reload the Layers
void
PCB_LAYER_BOX_SELECTOR
::
Resync
()
...
...
@@ -53,9 +50,16 @@ void PCB_LAYER_BOX_SELECTOR::Resync()
static
DECLARE_LAYERS_ORDER_LIST
(
layertranscode
);
static
DECLARE_LAYERS_HOTKEY
(
layerhk
);
// Tray to fix a minimum width fot the BitmapComboBox
int
minwidth
,
h
;
wxClientDC
dc
(
GetParent
()
);
// The DC for "this" is not always initialized
wxString
dummyText
(
wxT
(
"XXXXXXXXXXXX"
)
);
dc
.
GetTextExtent
(
dummyText
,
&
minwidth
,
&
h
);
#define BM_SIZE 14
for
(
LAYER_NUM
i
=
FIRST_LAYER
;
i
<
NB_LAYERS
;
++
i
)
{
wxBitmap
layerbmp
(
14
,
14
);
wxBitmap
layerbmp
(
BM_SIZE
,
BM_SIZE
);
wxString
layername
;
LAYER_NUM
layerid
=
i
;
...
...
@@ -73,10 +77,20 @@ void PCB_LAYER_BOX_SELECTOR::Resync()
layername
=
GetLayerName
(
layerid
);
if
(
m_layerhotkeys
&&
m_hotkeys
!=
NULL
)
layername
=
AddHotkeyName
(
layername
,
m_hotkeys
,
layerhk
[
layerid
],
IS_COMMENT
);
layername
=
AddHotkeyName
(
layername
,
m_hotkeys
,
layerhk
[
layerid
],
IS_COMMENT
);
Append
(
layername
,
layerbmp
,
(
void
*
)(
intptr_t
)
layerid
);
int
w
;
dc
.
GetTextExtent
(
layername
,
&
w
,
&
h
);
minwidth
=
std
::
max
(
minwidth
,
w
);
}
minwidth
+=
BM_SIZE
+
12
;
// Take in account the bitmap size and margins
wxLogMessage
(
"minw %d min %d"
,
minwidth
,
GetMinClientSize
().
x
);
// SetMinClientSize( wxSize( minwidth, -1 ) );
Layout
();
}
...
...
pcbnew/class_pcb_layer_box_selector.h
View file @
047749a8
...
...
@@ -21,7 +21,7 @@ public:
// If you are thinking the constructor is a bit curious,
// just remember it is used by automaticallty generated by wxFormBuilder files,
// and it should mimic the wxBitmapComboBox constructor.
// Therefore, value,
pos, size, n, choices and
style are not yet used,
// Therefore, value, style are not yet used,
// but they are here for compatibility
PCB_LAYER_BOX_SELECTOR
(
wxWindow
*
parent
,
wxWindowID
id
,
const
wxString
&
value
=
wxEmptyString
,
...
...
@@ -49,6 +49,7 @@ public:
// Virtual function
void
Resync
();
private
:
// Returns a color index from the layer id
// Virtual function
EDA_COLOR_T
GetLayerColor
(
LAYER_NUM
aLayer
)
const
;
...
...
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