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
c0eeafa0
Commit
c0eeafa0
authored
Nov 03, 2010
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issue with new layer box, mainly with wxWidgets 2.9.1
parent
aeb6dd8c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
95 additions
and
93 deletions
+95
-93
class_layerchoicebox.h
include/class_layerchoicebox.h
+2
-2
class_layerchoicebox.cpp
pcbnew/class_layerchoicebox.cpp
+86
-81
pcbframe.cpp
pcbnew/pcbframe.cpp
+1
-1
tool_pcb.cpp
pcbnew/tool_pcb.cpp
+4
-5
toolbars_update_user_interface.cpp
pcbnew/toolbars_update_user_interface.cpp
+2
-4
No files found.
include/class_layerchoicebox.h
View file @
c0eeafa0
...
@@ -10,12 +10,12 @@
...
@@ -10,12 +10,12 @@
class
WinEDALayerChoiceBox
:
public
wxBitmapComboBox
class
WinEDALayerChoiceBox
:
public
wxBitmapComboBox
{
{
public
:
public
:
WinEDALayerChoiceBox
(
wxWindow
*
parent
,
wxWindowID
id
,
WinEDALayerChoiceBox
(
WinEDA_Toolbar
*
parent
,
wxWindowID
id
,
const
wxPoint
&
pos
=
wxDefaultPosition
,
const
wxPoint
&
pos
=
wxDefaultPosition
,
const
wxSize
&
size
=
wxDefaultSize
,
const
wxSize
&
size
=
wxDefaultSize
,
int
n
=
0
,
const
wxString
choices
[]
=
NULL
);
int
n
=
0
,
const
wxString
choices
[]
=
NULL
);
WinEDALayerChoiceBox
(
wxWindow
*
parent
,
wxWindowID
id
,
WinEDALayerChoiceBox
(
WinEDA_Toolbar
*
parent
,
wxWindowID
id
,
const
wxPoint
&
pos
,
const
wxSize
&
size
,
const
wxPoint
&
pos
,
const
wxSize
&
size
,
const
wxArrayString
&
choices
);
const
wxArrayString
&
choices
);
...
...
pcbnew/class_layerchoicebox.cpp
View file @
c0eeafa0
...
@@ -21,95 +21,100 @@
...
@@ -21,95 +21,100 @@
*
*
*/
*/
WinEDALayerChoiceBox
::
WinEDALayerChoiceBox
(
wxWindow
*
parent
,
wxWindowID
id
,
WinEDALayerChoiceBox
::
WinEDALayerChoiceBox
(
WinEDA_Toolbar
*
parent
,
wxWindowID
id
,
const
wxPoint
&
pos
,
const
wxSize
&
size
,
const
wxPoint
&
pos
,
const
wxSize
&
size
,
int
n
,
const
wxString
choices
[]
)
:
int
n
,
const
wxString
choices
[]
)
:
wxBitmapComboBox
(
parent
,
id
,
wxEmptyString
,
pos
,
size
,
wxBitmapComboBox
(
parent
,
id
,
wxEmptyString
,
pos
,
size
,
n
,
choices
,
wxCB_READONLY
)
n
,
choices
,
wxCB_READONLY
)
{
{
}
}
WinEDALayerChoiceBox
::
WinEDALayerChoiceBox
(
wxWindow
*
parent
,
wxWindowID
id
,
WinEDALayerChoiceBox
::
WinEDALayerChoiceBox
(
WinEDA_Toolbar
*
parent
,
wxWindowID
id
,
const
wxPoint
&
pos
,
const
wxSize
&
size
,
const
wxPoint
&
pos
,
const
wxSize
&
size
,
const
wxArrayString
&
choices
)
:
const
wxArrayString
&
choices
)
:
wxBitmapComboBox
(
parent
,
id
,
wxEmptyString
,
pos
,
size
,
wxBitmapComboBox
(
parent
,
id
,
wxEmptyString
,
pos
,
size
,
choices
,
wxCB_READONLY
)
choices
,
wxCB_READONLY
)
{
{
}
}
// Get Current Item #
int
WinEDALayerChoiceBox
::
GetChoice
()
{
return
GetSelection
();
}
// Get Current Layer
// Get Current Item #
int
WinEDALayerChoiceBox
::
GetLayer
Choice
()
int
WinEDALayerChoiceBox
::
Get
Choice
()
{
{
return
(
long
)
GetClientData
(
GetSelection
()
);
return
GetSelection
(
);
}
}
// Set Layer #
int
WinEDALayerChoiceBox
::
SetLayerSelection
(
int
layer
)
{
int
elements
=
GetCount
();
for
(
int
i
=
0
;
i
<
elements
;
i
++
)
if
(
GetClientData
(
i
)
==
(
void
*
)
layer
)
if
(
GetSelection
()
!=
i
)
// Element (i) is not selected
{
SetSelection
(
i
);
return
i
;
}
else
return
i
;
//If element already selected; do nothing
// Not Found
SetSelection
(
-
1
);
return
-
1
;
}
// Reload the Layers
// Get Current Layer
void
WinEDALayerChoiceBox
::
Resync
()
int
WinEDALayerChoiceBox
::
GetLayerChoice
()
{
return
(
long
)
GetClientData
(
GetSelection
()
);
}
// Set Layer #
int
WinEDALayerChoiceBox
::
SetLayerSelection
(
int
layer
)
{
int
elements
=
GetCount
();
for
(
int
i
=
0
;
i
<
elements
;
i
++
)
{
{
BOARD
*
board
=
((
WinEDA_BasePcbFrame
*
)
GetParent
())
->
GetBoard
();
if
(
GetClientData
(
i
)
==
(
void
*
)
layer
)
wxASSERT
(
board
!=
NULL
);
Clear
();
static
DECLARE_LAYERS_ORDER_LIST
(
layertranscode
);
static
DECLARE_LAYERS_HOTKEY
(
layerhk
);
for
(
int
i
=
0
;
i
<
LAYER_COUNT
;
i
++
)
{
{
wxBitmap
layerbmp
(
20
,
18
);
if
(
GetSelection
()
!=
i
)
// Element (i) is not selected
wxMemoryDC
bmpDC
;
{
wxBrush
brush
;
SetSelection
(
i
);
wxString
layername
;
return
i
;
}
int
layerid
=
layertranscode
[
i
];
else
return
i
;
//If element already selected; do nothing
// Prepare Bitmap
bmpDC
.
SelectObject
(
layerbmp
);
brush
.
SetColour
(
MakeColour
(
board
->
GetLayerColor
(
layerid
)
));
brush
.
SetStyle
(
wxSOLID
);
bmpDC
.
SetBrush
(
brush
);
bmpDC
.
DrawRectangle
(
0
,
0
,
layerbmp
.
GetWidth
(),
layerbmp
.
GetHeight
());
bmpDC
.
SetBrush
(
*
wxTRANSPARENT_BRUSH
);
bmpDC
.
SetPen
(
*
wxBLACK_PEN
);
bmpDC
.
DrawRectangle
(
0
,
0
,
layerbmp
.
GetWidth
(),
layerbmp
.
GetHeight
());
layername
=
board
->
GetLayerName
(
layerid
);
layername
.
Append
(
wxT
(
"
\t
"
)
);
layername
=
AddHotkeyName
(
layername
,
s_Board_Editor_Hokeys_Descr
,
layerhk
[
layerid
],
false
);
if
(
board
->
IsLayerEnabled
(
layerid
))
Append
(
layername
,
layerbmp
,
(
void
*
)
layerid
);
}
}
}
}
// Not Found
SetSelection
(
-
1
);
return
-
1
;
}
// Reload the Layers
void
WinEDALayerChoiceBox
::
Resync
()
{
WinEDA_BasePcbFrame
*
pcbFrame
=
(
WinEDA_BasePcbFrame
*
)
GetParent
()
->
GetParent
();
BOARD
*
board
=
pcbFrame
->
GetBoard
();
wxASSERT
(
board
!=
NULL
);
Clear
();
static
DECLARE_LAYERS_ORDER_LIST
(
layertranscode
);
static
DECLARE_LAYERS_HOTKEY
(
layerhk
);
for
(
int
i
=
0
;
i
<
LAYER_COUNT
;
i
++
)
{
wxBitmap
layerbmp
(
14
,
14
);
wxMemoryDC
bmpDC
;
wxBrush
brush
;
wxString
layername
;
int
layerid
=
layertranscode
[
i
];
if
(
!
board
->
IsLayerEnabled
(
layerid
)
)
continue
;
// Prepare Bitmap
bmpDC
.
SelectObject
(
layerbmp
);
brush
.
SetColour
(
MakeColour
(
board
->
GetLayerColor
(
layerid
)
)
);
brush
.
SetStyle
(
wxSOLID
);
bmpDC
.
SetBrush
(
brush
);
bmpDC
.
DrawRectangle
(
0
,
0
,
layerbmp
.
GetWidth
(),
layerbmp
.
GetHeight
()
);
bmpDC
.
SetBrush
(
*
wxTRANSPARENT_BRUSH
);
bmpDC
.
SetPen
(
*
wxBLACK_PEN
);
bmpDC
.
DrawRectangle
(
0
,
0
,
layerbmp
.
GetWidth
(),
layerbmp
.
GetHeight
()
);
layername
=
board
->
GetLayerName
(
layerid
);
layername
=
AddHotkeyName
(
layername
,
s_Board_Editor_Hokeys_Descr
,
layerhk
[
layerid
],
false
);
Append
(
layername
,
layerbmp
,
(
void
*
)
layerid
);
}
}
pcbnew/pcbframe.cpp
View file @
c0eeafa0
...
@@ -342,7 +342,7 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
...
@@ -342,7 +342,7 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
vert
.
TopDockable
(
false
).
BottomDockable
(
false
);
vert
.
TopDockable
(
false
).
BottomDockable
(
false
);
horiz
.
LeftDockable
(
false
).
RightDockable
(
false
);
horiz
.
LeftDockable
(
false
).
RightDockable
(
false
);
// Create a template from the horiz wxAuiPaneInfo, specific
for
horizontal toolbars:
// Create a template from the horiz wxAuiPaneInfo, specific
to
horizontal toolbars:
wxAuiPaneInfo
horiz_tb
(
horiz
);
wxAuiPaneInfo
horiz_tb
(
horiz
);
horiz_tb
.
ToolbarPane
().
Gripper
(
false
);
horiz_tb
.
ToolbarPane
().
Gripper
(
false
);
...
...
pcbnew/tool_pcb.cpp
View file @
c0eeafa0
...
@@ -267,13 +267,13 @@ void WinEDA_PcbFrame::ReCreateHToolbar()
...
@@ -267,13 +267,13 @@ void WinEDA_PcbFrame::ReCreateHToolbar()
_
(
"Perform design rules check"
)
);
_
(
"Perform design rules check"
)
);
m_HToolBar
->
AddSeparator
();
m_HToolBar
->
AddSeparator
();
if
(
m_SelLayerBox
==
NULL
)
if
(
m_SelLayerBox
==
NULL
)
m_SelLayerBox
=
new
WinEDALayerChoiceBox
(
this
,
ID_TOOLBARH_PCB_SELECT_LAYER
);
m_SelLayerBox
=
new
WinEDALayerChoiceBox
(
m_HToolBar
,
ID_TOOLBARH_PCB_SELECT_LAYER
);
ReCreateLayerBox
(
m_HToolBar
);
ReCreateLayerBox
(
m_HToolBar
);
m_HToolBar
->
AddControl
(
m_SelLayerBox
);
m_HToolBar
->
AddControl
(
m_SelLayerBox
);
PrepareLayerIndicator
();
// Initialize the bitmap with current
PrepareLayerIndicator
();
// Initialize the bitmap with current
// active layer colors for the next tool
// active layer colors for the next tool
m_HToolBar
->
AddTool
(
ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR
,
wxEmptyString
,
m_HToolBar
->
AddTool
(
ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR
,
wxEmptyString
,
...
@@ -683,7 +683,6 @@ an existing track use its width\notherwise, use current width setting" ),
...
@@ -683,7 +683,6 @@ an existing track use its width\notherwise, use current width setting" ),
m_TrackAndViasSizesList_Changed
=
true
;
m_TrackAndViasSizesList_Changed
=
true
;
m_AuxiliaryToolBar
->
AddSeparator
();
m_AuxiliaryToolBar
->
AddSeparator
();
ReCreateLayerBox
(
NULL
);
}
}
...
@@ -698,7 +697,7 @@ void WinEDA_PcbFrame::syncLayerBox()
...
@@ -698,7 +697,7 @@ void WinEDA_PcbFrame::syncLayerBox()
WinEDALayerChoiceBox
*
WinEDA_PcbFrame
::
ReCreateLayerBox
(
WinEDA_Toolbar
*
parent
)
WinEDALayerChoiceBox
*
WinEDA_PcbFrame
::
ReCreateLayerBox
(
WinEDA_Toolbar
*
parent
)
{
{
if
(
m_SelLayerBox
==
NULL
)
if
(
m_SelLayerBox
==
NULL
)
return
NULL
;
return
NULL
;
m_SelLayerBox
->
Resync
();
m_SelLayerBox
->
Resync
();
...
...
pcbnew/toolbars_update_user_interface.cpp
View file @
c0eeafa0
...
@@ -184,6 +184,8 @@ void WinEDA_PcbFrame::SetToolbars()
...
@@ -184,6 +184,8 @@ void WinEDA_PcbFrame::SetToolbars()
state
=
GetScreen
()
->
GetRedoCommandCount
()
>
0
;
state
=
GetScreen
()
->
GetRedoCommandCount
()
>
0
;
m_HToolBar
->
EnableTool
(
wxID_REDO
,
state
);
m_HToolBar
->
EnableTool
(
wxID_REDO
,
state
);
syncLayerBox
();
PrepareLayerIndicator
();
m_HToolBar
->
Refresh
();
m_HToolBar
->
Refresh
();
if
(
m_OptionsToolBar
)
if
(
m_OptionsToolBar
)
...
@@ -276,9 +278,5 @@ void WinEDA_PcbFrame::SetToolbars()
...
@@ -276,9 +278,5 @@ void WinEDA_PcbFrame::SetToolbars()
if
(
m_AuxiliaryToolBar
)
if
(
m_AuxiliaryToolBar
)
AuxiliaryToolBar_Update_UI
();
AuxiliaryToolBar_Update_UI
();
syncLayerBox
();
PrepareLayerIndicator
();
DisplayUnitsMsg
();
DisplayUnitsMsg
();
}
}
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