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
07c35ed3
Commit
07c35ed3
authored
Jan 30, 2010
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add more public API functions to LAYER_WIDGET
parent
cf7ad0f5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
141 additions
and
2 deletions
+141
-2
layer_widget.cpp
pcbnew/layer_widget.cpp
+103
-2
layer_widget.h
pcbnew/layer_widget.h
+38
-0
No files found.
pcbnew/layer_widget.cpp
View file @
07c35ed3
...
...
@@ -301,9 +301,34 @@ int LAYER_WIDGET::findLayerRow( int aLayer )
for
(
int
row
=
0
;
row
<
count
;
++
row
)
{
// column 0 in the layer scroll window has a wxStaticBitmap, get its ID.
wxStaticBitmap
*
bm
=
(
wxStaticBitmap
*
)
getLayerComp
(
row
*
LYR_COLUMN_COUNT
);
wxWindow
*
w
=
getLayerComp
(
row
*
LYR_COLUMN_COUNT
);
wxASSERT
(
w
);
if
(
aLayer
==
getDecodedId
(
bm
->
GetId
()
))
if
(
aLayer
==
getDecodedId
(
w
->
GetId
()
))
return
row
;
}
return
-
1
;
}
wxWindow
*
LAYER_WIDGET
::
getRenderComp
(
int
aSizerNdx
)
{
if
(
(
unsigned
)
aSizerNdx
<
m_RenderFlexGridSizer
->
GetChildren
().
GetCount
()
)
return
m_RenderFlexGridSizer
->
GetChildren
()[
aSizerNdx
]
->
GetWindow
();
return
NULL
;
}
int
LAYER_WIDGET
::
findRenderRow
(
int
aId
)
{
int
count
=
GetRenderRowCount
();
for
(
int
row
=
0
;
row
<
count
;
++
row
)
{
// column 0 in the layer scroll window has a wxStaticBitmap, get its ID.
wxWindow
*
w
=
getRenderComp
(
row
*
RND_COLUMN_COUNT
);
wxASSERT
(
w
);
if
(
aId
==
getDecodedId
(
w
->
GetId
()
))
return
row
;
}
return
-
1
;
...
...
@@ -675,6 +700,82 @@ void LAYER_WIDGET::SetLayerVisible( int aLayer, bool isVisible )
}
}
bool
LAYER_WIDGET
::
IsLayerVisible
(
int
aLayer
)
{
int
row
=
findLayerRow
(
aLayer
);
if
(
row
>=
0
)
{
wxCheckBox
*
cb
=
(
wxCheckBox
*
)
getLayerComp
(
row
*
LYR_COLUMN_COUNT
+
3
);
wxASSERT
(
cb
);
return
cb
->
GetValue
();
}
return
false
;
}
void
LAYER_WIDGET
::
SetLayerColor
(
int
aLayer
,
int
aColor
)
{
int
row
=
findLayerRow
(
aLayer
);
if
(
row
>=
0
)
{
int
col
=
1
;
// bitmap button is column 1
wxBitmapButton
*
bmb
=
(
wxBitmapButton
*
)
getLayerComp
(
row
*
LYR_COLUMN_COUNT
+
col
);
wxASSERT
(
bmb
);
wxBitmap
bm
=
makeBitmap
(
aColor
);
bmb
->
SetBitmapLabel
(
bm
);
bmb
->
SetName
(
makeColorTxt
(
aColor
)
);
// save color value in name as string
}
}
int
LAYER_WIDGET
::
GetLayerColor
(
int
aLayer
)
{
int
row
=
findLayerRow
(
aLayer
);
if
(
row
>=
0
)
{
int
col
=
1
;
// bitmap button is column 1
wxBitmapButton
*
bmb
=
(
wxBitmapButton
*
)
getLayerComp
(
row
*
LYR_COLUMN_COUNT
+
col
);
wxASSERT
(
bmb
);
wxString
colorTxt
=
bmb
->
GetName
();
int
color
=
strtoul
(
CONV_TO_UTF8
(
colorTxt
),
NULL
,
0
);
return
color
;
}
return
0
;
// it's caller fault, gave me a bad layer
}
void
LAYER_WIDGET
::
SetRenderState
(
int
aId
,
bool
isSet
)
{
int
row
=
findRenderRow
(
aId
);
if
(
row
>=
0
)
{
int
col
=
1
;
// checkbox is column 1
wxCheckBox
*
cb
=
(
wxCheckBox
*
)
getRenderComp
(
row
*
RND_COLUMN_COUNT
+
col
);
wxASSERT
(
cb
);
cb
->
SetValue
(
isSet
);
// does not fire an event
}
}
bool
LAYER_WIDGET
::
GetRenderState
(
int
aId
)
{
int
row
=
findRenderRow
(
aId
);
if
(
row
>=
0
)
{
int
col
=
1
;
// checkbox is column 1
wxCheckBox
*
cb
=
(
wxCheckBox
*
)
getRenderComp
(
row
*
RND_COLUMN_COUNT
+
col
);
wxASSERT
(
cb
);
return
cb
->
GetValue
();
}
return
false
;
// the value of a non-existent row
}
void
LAYER_WIDGET
::
UpdateLayouts
()
{
m_LayersFlexGridSizer
->
Layout
();
...
...
pcbnew/layer_widget.h
View file @
07c35ed3
...
...
@@ -162,12 +162,14 @@ protected:
* been added to the m_LayersFlexGridSizer.
*/
wxWindow
*
getLayerComp
(
int
aSizerNdx
);
wxWindow
*
getRenderComp
(
int
aSizerNdx
);
/**
* Function findLayerRow
* returns the row index that \a aLayer resides in, or -1 if not found.
*/
int
findLayerRow
(
int
aLayer
);
int
findRenderRow
(
int
aId
);
/**
* Function insertLayerRow
...
...
@@ -288,6 +290,42 @@ public:
*/
void
SetLayerVisible
(
int
aLayer
,
bool
isVisible
);
/**
* Function IsLayerVisible
* returns the visible state of the layer ROW associated with \a aLayer id.
*/
bool
IsLayerVisible
(
int
aLayer
);
/**
* Function SetLayerColor
* changes the color of \a aLayer
*/
void
SetLayerColor
(
int
aLayer
,
int
aColor
);
/**
* Function GetLayerColor
* returns the color of the layer ROW associated with \a aLayer id.
*/
int
GetLayerColor
(
int
aLayer
);
/**
* Function SetRenderState
* sets the state of the checkbox associated with \a aId within the
* Render tab group of the widget. Does not fire an event, i.e. does
* not invoke OnRenderEnable().
* @param aId is the same unique id used when adding a ROW to the
* Render tab.
*/
void
SetRenderState
(
int
aId
,
bool
isSet
);
/**
* Function GetRenderState
* returns the state of the checkbox associated with \a aId.
* @return bool - true if checked, else false.
*/
bool
GetRenderState
(
int
aId
);
void
UpdateLayouts
();
/* did not help:
...
...
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