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
cd535636
Commit
cd535636
authored
Jan 23, 2010
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
switch to wxAuiNotebook, maker smaller, remove non-visible technical layers
parent
9f062f37
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
197 additions
and
145 deletions
+197
-145
layer_panel_base.cpp
pcbnew/layer_panel_base.cpp
+70
-54
layer_panel_base.h
pcbnew/layer_panel_base.h
+25
-22
layer_widget.cpp
pcbnew/layer_widget.cpp
+83
-53
panel_layer_select.fbp
pcbnew/panel_layer_select.fbp
+10
-10
pcbframe.cpp
pcbnew/pcbframe.cpp
+9
-6
No files found.
pcbnew/layer_panel_base.cpp
View file @
cd535636
...
...
@@ -7,6 +7,8 @@
#include "layer_panel_base.h"
#include <wx/settings.h>
///////////////////////////////////////////////////////////////////////////
LAYER_PANEL_BASE
::
LAYER_PANEL_BASE
(
wxWindow
*
parent
,
wxWindowID
id
,
const
wxPoint
&
pos
,
const
wxSize
&
size
,
long
style
)
:
wxPanel
(
parent
,
id
,
pos
,
size
,
style
)
...
...
@@ -14,33 +16,47 @@ LAYER_PANEL_BASE::LAYER_PANEL_BASE( wxWindow* parent, wxWindowID id, const wxPoi
wxBoxSizer
*
boxSizer
;
boxSizer
=
new
wxBoxSizer
(
wxVERTICAL
);
m_notebook
=
new
wxNotebook
(
this
,
wxID_ANY
,
wxDefaultPosition
,
wxDefaultSize
,
0
);
// m_notebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_notebook
=
new
wxAuiNotebook
(
this
,
wxID_ANY
,
wxDefaultPosition
,
wxDefaultSize
,
wxAUI_NB_TOP
);
// wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
wxFont
font
=
m_notebook
->
GetFont
();
font
.
SetPointSize
(
(
font
.
GetPointSize
()
*
8
)
/
10
);
m_notebook
->
SetFont
(
font
);
m_notebook
->
SetNormalFont
(
font
);
m_notebook
->
SetSelectedFont
(
font
);
m_notebook
->
SetMeasuringFont
(
font
);
m_LayerPanel
=
new
wxPanel
(
m_notebook
,
wxID_ANY
,
wxDefaultPosition
,
wxDefaultSize
,
wxTAB_TRAVERSAL
);
wxBoxSizer
*
bSizer3
;
bSizer3
=
new
wxBoxSizer
(
wxVERTICAL
);
m_LayerScrolledWindow
=
new
wxScrolledWindow
(
m_LayerPanel
,
wxID_ANY
,
wxDefaultPosition
,
wxDefaultSize
,
wxNO_BORDER
);
m_LayerScrolledWindow
->
SetScrollRate
(
5
,
5
);
m_LayersFlexGridSizer
=
new
wxFlexGridSizer
(
0
,
4
,
1
,
3
);
m_LayersFlexGridSizer
=
new
wxFlexGridSizer
(
0
,
4
,
0
,
1
);
m_LayersFlexGridSizer
->
SetFlexibleDirection
(
wxHORIZONTAL
);
m_LayersFlexGridSizer
->
SetNonFlexibleGrowMode
(
wxFLEX_GROWMODE_SPECIFIED
);
m_LayerScrolledWindow
->
SetSizer
(
m_LayersFlexGridSizer
);
m_LayerScrolledWindow
->
Layout
();
m_LayersFlexGridSizer
->
Fit
(
m_LayerScrolledWindow
);
bSizer3
->
Add
(
m_LayerScrolledWindow
,
1
,
wxBOTTOM
|
wxEXPAND
|
wxTOP
,
5
);
bSizer3
->
Add
(
m_LayerScrolledWindow
,
1
,
wxBOTTOM
|
wxEXPAND
|
wxLEFT
|
wxTOP
,
2
);
m_LayerPanel
->
SetSizer
(
bSizer3
);
m_LayerPanel
->
Layout
();
bSizer3
->
Fit
(
m_LayerPanel
);
m_notebook
->
AddPage
(
m_LayerPanel
,
_
(
"Layers
"
),
true
);
m_notebook
->
AddPage
(
m_LayerPanel
,
_
(
"Layer
"
),
true
);
m_RenderingPanel
=
new
wxPanel
(
m_notebook
,
wxID_ANY
,
wxDefaultPosition
,
wxDefaultSize
,
wxTAB_TRAVERSAL
);
wxBoxSizer
*
bSizer4
;
bSizer4
=
new
wxBoxSizer
(
wxVERTICAL
);
m_RenderScrolledWindow
=
new
wxScrolledWindow
(
m_RenderingPanel
,
wxID_ANY
,
wxDefaultPosition
,
wxDefaultSize
,
wxNO_BORDER
);
m_RenderScrolledWindow
->
SetScrollRate
(
5
,
5
);
m_RenderFlexGridSizer
=
new
wxFlexGridSizer
(
0
,
2
,
1
,
3
);
m_RenderFlexGridSizer
=
new
wxFlexGridSizer
(
0
,
2
,
0
,
1
);
m_RenderFlexGridSizer
->
SetFlexibleDirection
(
wxHORIZONTAL
);
m_RenderFlexGridSizer
->
SetNonFlexibleGrowMode
(
wxFLEX_GROWMODE_NONE
);
...
...
@@ -52,7 +68,7 @@ LAYER_PANEL_BASE::LAYER_PANEL_BASE( wxWindow* parent, wxWindowID id, const wxPoi
m_RenderingPanel
->
SetSizer
(
bSizer4
);
m_RenderingPanel
->
Layout
();
bSizer4
->
Fit
(
m_RenderingPanel
);
m_notebook
->
AddPage
(
m_RenderingPanel
,
_
(
"Rendering
"
),
false
);
m_notebook
->
AddPage
(
m_RenderingPanel
,
_
(
"Render
"
),
false
);
boxSizer
->
Add
(
m_notebook
,
1
,
wxEXPAND
|
wxALL
,
5
);
...
...
pcbnew/layer_panel_base.h
View file @
cd535636
...
...
@@ -21,7 +21,8 @@
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/notebook.h>
//#include <wx/notebook.h>
#include <wx/aui/auibook.h>
///////////////////////////////////////////////////////////////////////////
...
...
@@ -34,7 +35,9 @@ class LAYER_PANEL_BASE : public wxPanel
private
:
protected
:
wxNotebook
*
m_notebook
;
// wxNotebook* m_notebook;
wxAuiNotebook
*
m_notebook
;
wxPanel
*
m_LayerPanel
;
wxScrolledWindow
*
m_LayerScrolledWindow
;
wxFlexGridSizer
*
m_LayersFlexGridSizer
;
...
...
pcbnew/layer_widget.cpp
View file @
cd535636
...
...
@@ -49,9 +49,9 @@
#define LYR_COLUMN_COUNT 4 ///< Layer tab column count
#define RND_COLUMN_COUNT 2 ///< Rendering tab column count
#define BUTT_SIZE_X
32
#define BUTT_SIZE_Y
22
#define BUTT_VOID
6
#define BUTT_SIZE_X
20
#define BUTT_SIZE_Y
18
#define BUTT_VOID
4
#define ID_SHOW_ALL_COPPERS wxID_HIGHEST
...
...
@@ -60,7 +60,7 @@
/* XPM */
static
const
char
*
clear_xpm
[]
=
{
"
28
14 1 1"
,
"
10
14 1 1"
,
" c None"
,
" "
,
" "
,
...
...
@@ -79,28 +79,27 @@ static const char * clear_xpm[] = {
/* XPM */
static
const
char
*
rightarrow_xpm
[]
=
{
"
28
14 5 1"
,
"
10
14 5 1"
,
" c None"
,
". c white"
,
"X c #8080ff"
,
"o c BLUE"
,
"O c gray56"
,
"
.
X "
,
"
.
XX "
,
"
.
XXX "
,
"
.
XXXX "
,
"
................
XXXXX "
,
"
XXXXXXXXXXXXXXXX
XXXXXX "
,
"
XXXXXXXXXXXXXXXX
XXXXXXX "
,
"
oooooooooooooooo
oooooooO"
,
"
oooooooooooooooo
ooooooO "
,
"
OOOOOOOOOOOOOOO
oooooO "
,
" X "
,
" XX "
,
" XXX "
,
" XXXX "
,
" XXXXX "
,
" XXXXXX "
,
" XXXXXXX "
,
" oooooooO"
,
" ooooooO "
,
" oooooO "
,
" ooooO "
,
" oooO "
,
" ooO "
,
" oO "
};
/**
* Function encodeId
* is here to allow saving a layer index within a control as its wxControl id,
...
...
@@ -139,6 +138,17 @@ static wxString makeColorTxt( int aColor )
}
/**
* Function shrinkFont
* reduces the size of the wxFont associated with \a aControl
*/
static
void
shrinkFont
(
wxWindow
*
aControl
)
{
wxFont
font
=
aControl
->
GetFont
();
font
.
SetPointSize
(
(
font
.
GetPointSize
()
*
8
)
/
10
);
// go to 80% of original.
aControl
->
SetFont
(
font
);
}
wxBitmap
LAYER_WIDGET
::
makeBitmap
(
int
aColor
)
{
// the bitmap will be BUTT_VOID*2 pixels smaller than the button, leaving a
...
...
@@ -353,10 +363,10 @@ void LAYER_WIDGET::OnRenderCheckBox( wxCommandEvent& event )
void
LAYER_WIDGET
::
OnTabChange
(
wxNotebookEvent
&
event
)
{
//
printf("OnTabChange\n"
);
//
passOnFocus(); // this segfaults, cannot enable it.
// maybe we need to find a way to call the stock tab change event handler
// first, then call passOnFocus() before we consider this event done
.
//
wxFocusEvent event( wxEVT_SET_FOCUS
);
//
m_FocusOwner->AddPendingEvent( event );
passOnFocus
();
// does not work in this context, probably because we have receive control here too early
.
}
...
...
@@ -411,6 +421,7 @@ void LAYER_WIDGET::insertLayerRow( int aRow, const ROW& aSpec )
// column 2
col
=
2
;
wxStaticText
*
st
=
new
wxStaticText
(
m_LayerScrolledWindow
,
encodeId
(
col
,
aSpec
.
id
),
aSpec
.
rowName
);
shrinkFont
(
st
);
st
->
Connect
(
wxEVT_LEFT_DOWN
,
wxMouseEventHandler
(
LAYER_WIDGET
::
OnLeftDownLayers
),
NULL
,
this
);
st
->
Connect
(
wxEVT_RIGHT_DOWN
,
wxMouseEventHandler
(
LAYER_WIDGET
::
OnRightDownLayers
),
NULL
,
this
);
st
->
SetToolTip
(
aSpec
.
tooltip
);
...
...
@@ -456,6 +467,7 @@ void LAYER_WIDGET::insertRenderRow( int aRow, const ROW& aSpec )
col
=
1
;
wxCheckBox
*
cb
=
new
wxCheckBox
(
m_RenderScrolledWindow
,
encodeId
(
col
,
aSpec
.
id
),
aSpec
.
rowName
,
wxDefaultPosition
,
wxDefaultSize
,
wxALIGN_LEFT
);
shrinkFont
(
cb
);
cb
->
SetValue
(
aSpec
.
state
);
cb
->
Connect
(
wxEVT_COMMAND_CHECKBOX_CLICKED
,
wxCommandEventHandler
(
LAYER_WIDGET
::
OnRenderCheckBox
),
NULL
,
this
);
...
...
@@ -496,12 +508,22 @@ LAYER_WIDGET::LAYER_WIDGET( wxWindow* aParent, wxWindow* aFocusOwner ) :
// trap the tab changes so that we can call passOnFocus().
m_notebook
->
Connect
(
-
1
,
wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED
,
wxNotebookEventHandler
(
LAYER_WIDGET
::
OnTabChange
)
);
wxNotebookEventHandler
(
LAYER_WIDGET
::
OnTabChange
)
,
NULL
,
this
);
}
wxSize
LAYER_WIDGET
::
GetBestSize
()
const
{
#if 0
wxSize layerz = m_LayersFlexGridSizer->GetMinSize();
wxSize renderz = m_RenderFlexGridSizer->GetMinSize();
wxSize clientz( max(renderz.x,layerz.x), max(renderz.y,layerz.y) );
return ClientToWindowSize( clientz );
#else
// size of m_LayerScrolledWindow --------------
wxArrayInt
widths
=
m_LayersFlexGridSizer
->
GetColWidths
();
int
totWidth
=
0
;
...
...
@@ -527,7 +549,6 @@ wxSize LAYER_WIDGET::GetBestSize() const
totHeight
+=
heights
[
i
]
+
m_LayersFlexGridSizer
->
GetVGap
();
// printf("heights[%d]:%d\n", i, heights[i] );
}
totHeight
+=
2
*
heights
[
0
];
// use 2 row heights to approximate tab height
}
else
...
...
@@ -535,6 +556,8 @@ wxSize LAYER_WIDGET::GetBestSize() const
wxSize
layerz
(
totWidth
,
totHeight
);
layerz
+=
m_LayerPanel
->
GetWindowBorderSize
();
// size of m_RenderScrolledWindow --------------
widths
=
m_RenderFlexGridSizer
->
GetColWidths
();
...
...
@@ -568,7 +591,17 @@ wxSize LAYER_WIDGET::GetBestSize() const
wxSize
renderz
(
totWidth
,
totHeight
);
return
wxSize
(
max
(
renderz
.
x
,
layerz
.
x
),
max
(
renderz
.
y
,
layerz
.
y
)
);
renderz
+=
m_RenderingPanel
->
GetWindowBorderSize
();
wxSize
clientz
(
max
(
renderz
.
x
,
layerz
.
x
),
max
(
renderz
.
y
,
layerz
.
y
)
);
// wxSize diffz( GetSize() - GetClientSize() );
// clientz += diffz;
return
clientz
;
#endif
}
...
...
@@ -617,7 +650,7 @@ void LAYER_WIDGET::ClearRenderRows()
void
LAYER_WIDGET
::
SelectLayerRow
(
int
aRow
)
{
// enable the layer tab at index 0
m_notebook
->
Change
Selection
(
0
);
m_notebook
->
Set
Selection
(
0
);
int
oldNdx
=
LYR_COLUMN_COUNT
*
m_CurrentRow
;
int
newNdx
=
LYR_COLUMN_COUNT
*
aRow
;
...
...
@@ -699,15 +732,12 @@ class MYFRAME : public wxFrame
// abstract methods.
class
MYLAYERS
:
public
LAYER_WIDGET
{
MYFRAME
*
frame
;
public
:
// your constructor could take a BOARD argument. here I leave it
// out because this source module wants to know nothing of BOARDs
// to maximize re-use.
MYLAYERS
(
wxWindow
*
aParent
,
MYFRAME
*
aFrame
)
:
LAYER_WIDGET
(
aParent
),
frame
(
aFrame
)
MYLAYERS
(
wxWindow
*
aParent
)
:
LAYER_WIDGET
(
aParent
,
aParent
)
{
}
...
...
@@ -755,7 +785,7 @@ public:
// notify wxAUI which frame to use
m_mgr
.
SetManagedWindow
(
this
);
MYLAYERS
*
lw
=
new
MYLAYERS
(
this
,
this
);
MYLAYERS
*
lw
=
new
MYLAYERS
(
this
);
// add some layer rows
static
const
LAYER_WIDGET
::
ROW
layerRows
[]
=
{
...
...
pcbnew/panel_layer_select.fbp
View file @
cd535636
...
...
@@ -117,14 +117,14 @@
<event
name=
"OnUpdateUI"
></event>
<object
class=
"notebookpage"
expanded=
"1"
>
<property
name=
"bitmap"
>
layerbitmap; Load From File
</property>
<property
name=
"label"
>
Layer
s
</property>
<property
name=
"label"
>
Layer
</property>
<property
name=
"select"
>
1
</property>
<object
class=
"wxPanel"
expanded=
"1"
>
<property
name=
"bg"
></property>
<property
name=
"context_help"
></property>
<property
name=
"enabled"
>
1
</property>
<property
name=
"fg"
></property>
<property
name=
"font"
></property>
<property
name=
"font"
>
,90,90,10,70,0
</property>
<property
name=
"hidden"
>
0
</property>
<property
name=
"id"
>
wxID_ANY
</property>
<property
name=
"maximum_size"
></property>
...
...
@@ -167,8 +167,8 @@
<property
name=
"orient"
>
wxVERTICAL
</property>
<property
name=
"permission"
>
none
</property>
<object
class=
"sizeritem"
expanded=
"1"
>
<property
name=
"border"
>
5
</property>
<property
name=
"flag"
>
wxBOTTOM|wxEXPAND|wxTOP
</property>
<property
name=
"border"
>
2
</property>
<property
name=
"flag"
>
wxBOTTOM|wxEXPAND|wx
LEFT|wx
TOP
</property>
<property
name=
"proportion"
>
1
</property>
<object
class=
"wxScrolledWindow"
expanded=
"1"
>
<property
name=
"bg"
></property>
...
...
@@ -219,13 +219,13 @@
<property
name=
"flexible_direction"
>
wxHORIZONTAL
</property>
<property
name=
"growablecols"
></property>
<property
name=
"growablerows"
></property>
<property
name=
"hgap"
>
3
</property>
<property
name=
"hgap"
>
1
</property>
<property
name=
"minimum_size"
></property>
<property
name=
"name"
>
m_LayersFlexGridSizer
</property>
<property
name=
"non_flexible_grow_mode"
>
wxFLEX_GROWMODE_SPECIFIED
</property>
<property
name=
"permission"
>
protected
</property>
<property
name=
"rows"
>
0
</property>
<property
name=
"vgap"
>
1
</property>
<property
name=
"vgap"
>
0
</property>
</object>
</object>
</object>
...
...
@@ -234,14 +234,14 @@
</object>
<object
class=
"notebookpage"
expanded=
"1"
>
<property
name=
"bitmap"
>
; Load From File
</property>
<property
name=
"label"
>
Render
ing
</property>
<property
name=
"label"
>
Render
</property>
<property
name=
"select"
>
0
</property>
<object
class=
"wxPanel"
expanded=
"1"
>
<property
name=
"bg"
></property>
<property
name=
"context_help"
></property>
<property
name=
"enabled"
>
1
</property>
<property
name=
"fg"
></property>
<property
name=
"font"
></property>
<property
name=
"font"
>
,90,90,10,70,0
</property>
<property
name=
"hidden"
>
0
</property>
<property
name=
"id"
>
wxID_ANY
</property>
<property
name=
"maximum_size"
></property>
...
...
@@ -336,13 +336,13 @@
<property
name=
"flexible_direction"
>
wxHORIZONTAL
</property>
<property
name=
"growablecols"
></property>
<property
name=
"growablerows"
></property>
<property
name=
"hgap"
>
3
</property>
<property
name=
"hgap"
>
1
</property>
<property
name=
"minimum_size"
></property>
<property
name=
"name"
>
m_RenderFlexGridSizer
</property>
<property
name=
"non_flexible_grow_mode"
>
wxFLEX_GROWMODE_NONE
</property>
<property
name=
"permission"
>
protected
</property>
<property
name=
"rows"
>
0
</property>
<property
name=
"vgap"
>
1
</property>
<property
name=
"vgap"
>
0
</property>
</object>
</object>
</object>
...
...
pcbnew/pcbframe.cpp
View file @
cd535636
...
...
@@ -327,7 +327,7 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
lyrs
.
MinSize
(
m_Layers
->
GetBestSize
()
);
// updated in ReFillLayerWidget
lyrs
.
BestSize
(
m_Layers
->
GetBestSize
()
);
lyrs
.
CloseButton
(
false
);
lyrs
.
Caption
(
wxT
(
"Layer
s"
)
);
lyrs
.
Caption
(
_
(
"Visible
s"
)
);
lyrs
.
IsFloatable
();
...
...
@@ -520,6 +520,8 @@ void WinEDA_PcbFrame::ReFillLayerWidget()
int
layerId
;
wxString
tooltip
;
}
techLayerSeq
[]
=
{
/* some layers are not visible nor editable, don't show them for now:
{ ADHESIVE_N_FRONT, _("Adhesive on board's front") },
{ ADHESIVE_N_BACK, _("Adhesive on board's back") },
{ SOLDERPASTE_N_FRONT, _("Solder paste on board's front") },
...
...
@@ -528,11 +530,12 @@ void WinEDA_PcbFrame::ReFillLayerWidget()
{ SILKSCREEN_N_BACK, _("Silkscreen on board's back") },
{ SOLDERMASK_N_FRONT, _("Solder mask on board's front") },
{ SOLDERMASK_N_BACK, _("Solder mask on board's back") },
{
DRAW_N
,
_
(
"Explanatory drawings"
)
},
{
COMMENT_N
,
_
(
"Explanatory comments"
)
},
{
ECO1_N
,
_
(
"TDB"
)
},
{
ECO2_N
,
_
(
"TBD"
)
},
{
EDGE_N
,
_
(
"Board's perimeter definition"
)
},
*/
{
DRAW_N
,
_
(
"Explanatory drawings"
)
},
{
COMMENT_N
,
_
(
"Explanatory comments"
)
},
{
ECO1_N
,
_
(
"TDB"
)
},
{
ECO2_N
,
_
(
"TBD"
)
},
{
EDGE_N
,
_
(
"Board's perimeter definition"
)
},
};
for
(
unsigned
i
=
0
;
i
<
DIM
(
techLayerSeq
);
++
i
)
...
...
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