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
6518139b
Commit
6518139b
authored
Jan 24, 2010
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more layer widget work
parent
84d82cf2
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
714 additions
and
1022 deletions
+714
-1022
CHANGELOG.txt
CHANGELOG.txt
+20
-0
TODO.txt
TODO.txt
+12
-7
wxPcbStruct.h
include/wxPcbStruct.h
+54
-52
CMakeLists.txt
pcbnew/CMakeLists.txt
+0
-2
deltrack.cpp
pcbnew/deltrack.cpp
+2
-2
edit.cpp
pcbnew/edit.cpp
+17
-28
editrack-part2.cpp
pcbnew/editrack-part2.cpp
+17
-27
layer_panel_base.cpp
pcbnew/layer_panel_base.cpp
+0
-88
layer_panel_base.h
pcbnew/layer_panel_base.h
+0
-59
layer_widget.cpp
pcbnew/layer_widget.cpp
+98
-131
layer_widget.h
pcbnew/layer_widget.h
+52
-16
onleftclick.cpp
pcbnew/onleftclick.cpp
+3
-3
panel_layer_select.fbp
pcbnew/panel_layer_select.fbp
+0
-357
pcbframe.cpp
pcbnew/pcbframe.cpp
+412
-226
tool_pcb.cpp
pcbnew/tool_pcb.cpp
+21
-19
toolbars_update_user_interface.cpp
pcbnew/toolbars_update_user_interface.cpp
+2
-1
zones_by_polygon.cpp
pcbnew/zones_by_polygon.cpp
+4
-4
No files found.
CHANGELOG.txt
View file @
6518139b
...
...
@@ -4,6 +4,26 @@ KiCad ChangeLog 2010
Please add newer entries at the top, list the date and your name with
email address.
2010-Jan-23 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
++pcbnew's PCB_LAYER_WIDGET
Removed wxformbuilder dependency from LAYER_WIDGET, thus killing off
layer_widget_base.* and panel_layer_select.fbp.
Added aPointSize to LAYER_WIDGET constructor so it uses that font size.
Removed layer_widget.h from wxPcbStruct.h for faster compiles with less
dependencies, and this meant moving the class LYRS out of
class WinEDA_PcbFrame. While doing that I renamed it to PCB_LAYER_WIDGET.
Integration of PCB_LAYER_WIDGET into WinEDA_PcbFrame to fully support
the layer change logic. Added syncLayerWidget(),
* WinEDA_PcbFrame:
Added syncLayerWidget(), syncLayerBox() (via a rename), setActiveLayer(),
and getActiveLayer().
Use a font size in PCB_LAYER_WIDGET 80% of the system font size for systems
with screen resolution height <= 900, or 100% if not. See WinEDA_PcbFrame
constructor.
* See TODO.txt for more things that need to be done.
2010-Jan-23 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++ Pcbnew:
...
...
TODO.txt
View file @
6518139b
...
...
@@ -72,19 +72,24 @@ PCBNew
* Need to add polygon aperture type.
Then example 2 in RS274xrevd_e.pdf will draw properly.
Dick:
* Get the nested quote support for DSNLEXER fixed up and committed.
LAYER_WIDGET for PCBNEW
-----------------------
L2) Hook in bool WinEDA_PcbFrame::LYRS::OnLayerSelect( int aLayer )
L4) Move popup menu code from class LAYER_WIDGET into WinEDA_PcbFrame::LYRS so as
to keep LAYER_WIDGET fully usage agnostic. Remove #include "pcbstruct.h" // IsValidCopperLayerIndex()
from layer_widget.cpp.
L5) Add to moved popu menu code the ability to save the current layer widget
color and enable settings with an additional menu item.
L6) Test, and fix up any remaining issues with the PCB_VISIBLE support, several
items which are stored on globals could and should be stored in
EDA_Settings.m_VisibleElements using enum PCB_VISIBLE.
EDA_Settings.m_VisibleElements using enum PCB_VISIBLE. Initial Render
checkbox settings are probably not correct, for example grid.
L7) make the bitmapbutton a staticbitmap, and make its size dependent on
the point size.
L8) LAYER_WIDGET::GetBestSize() needs platform independence.
Dick:
L9) still thinking about background colors, easier now without wxformbuilder.
include/wxPcbStruct.h
View file @
6518139b
...
...
@@ -8,7 +8,6 @@
#include "wxstruct.h"
#include "base_struct.h"
#include "layer_widget.h"
#ifndef PCB_INTERNAL_UNIT
#define PCB_INTERNAL_UNIT 10000
...
...
@@ -36,6 +35,7 @@ class ZONE_CONTAINER;
class
DRAWSEGMENT
;
class
GENERAL_COLLECTOR
;
class
GENERAL_COLLECTORS_GUIDE
;
class
PCB_LAYER_WIDGET
;
/**
...
...
@@ -49,34 +49,64 @@ class GENERAL_COLLECTORS_GUIDE;
/*****************************************************/
class
WinEDA_PcbFrame
:
public
WinEDA_BasePcbFrame
{
friend
class
PCB_LAYER_WIDGET
;
protected
:
PCB_LAYER_WIDGET
*
m_Layers
;
DRC
*
m_drc
;
///< the DRC controller, see drc.cpp
// we'll use lower case function names for private member functions.
void
createPopUpMenuForZones
(
ZONE_CONTAINER
*
edge_zone
,
wxMenu
*
aPopMenu
);
void
createPopUpMenuForFootprints
(
MODULE
*
aModule
,
wxMenu
*
aPopMenu
);
void
createPopUpMenuForFpTexts
(
TEXTE_MODULE
*
aText
,
wxMenu
*
aPopMenu
);
void
createPopUpMenuForFpPads
(
D_PAD
*
aPad
,
wxMenu
*
aPopMenu
);
void
createPopupMenuForTracks
(
TRACK
*
aTrack
,
wxMenu
*
aPopMenu
);
void
createPopUpMenuForTexts
(
TEXTE_PCB
*
Text
,
wxMenu
*
menu
);
void
createPopUpBlockMenu
(
wxMenu
*
menu
);
void
createPopUpMenuForMarkers
(
MARKER_PCB
*
aMarker
,
wxMenu
*
aPopMenu
);
/**
*
Class LYRS
*
is here to implement the abtract functions of LAYER_WIDGET so they
*
may be tied into this frame's data
.
*
Function setActiveLayer
*
will change the currently active layer to \a aLayer and also
*
update the PCB_LAYER_WIDGET
.
*/
class
LYRS
:
public
LAYER_WIDGET
void
setActiveLayer
(
int
aLayer
,
bool
doLayerWidgetUpdate
=
true
)
{
WinEDA_PcbFrame
*
myframe
;
public
:
LYRS
(
WinEDA_PcbFrame
*
aParent
,
wxWindow
*
aFocusOwner
)
:
LAYER_WIDGET
(
aParent
,
aFocusOwner
),
myframe
(
aParent
)
{
}
//-----<implement LAYER_WIDGET abstract callback functions>-----------
void
OnLayerColorChange
(
int
aLayer
,
int
aColor
);
bool
OnLayerSelect
(
int
aLayer
);
void
OnLayerVisible
(
int
aLayer
,
bool
isVisible
,
bool
isFinal
);
void
OnRenderColorChange
(
int
aId
,
int
aColor
);
void
OnRenderEnable
(
int
aId
,
bool
isEnabled
);
//-----</implement LAYER_WIDGET abstract callback functions>----------
};
LYRS
*
m_Layers
;
// established in constructor
(
(
PCB_SCREEN
*
)
GetScreen
()
)
->
m_Active_Layer
=
aLayer
;
if
(
doLayerWidgetUpdate
)
syncLayerWidget
();
}
/**
* Function getActiveLayer
* returns the active layer
*/
int
getActiveLayer
()
{
return
(
(
PCB_SCREEN
*
)
GetScreen
()
)
->
m_Active_Layer
;
}
/**
* Function syncLayerWidget
* updates the currently "selected" layer within the PCB_LAYER_WIDGET.
* The currently active layer is defined by the return value of getActiveLayer().
* <p>
* This function cannot be inline without including layer_widget.h in
* here and we do not want to do that.
*/
void
syncLayerWidget
();
/**
* Function syncLayerBox
* updates the currently "selected" layer within m_SelLayerBox
* The currently active layer, as defined by the return value of
* getActiveLayer(). And updates the colored icon in the toolbar.
*/
void
syncLayerBox
();
public
:
WinEDAChoiceBox
*
m_SelLayerBox
;
// a combo box to display and
...
...
@@ -95,19 +125,6 @@ public:
bool
m_show_microwave_tools
;
bool
m_show_layer_manager_tools
;
private
:
DRC
*
m_drc
;
///< the DRC controller, see drc.cpp
// we'll use lower case function names for private member functions.
void
createPopUpMenuForZones
(
ZONE_CONTAINER
*
edge_zone
,
wxMenu
*
aPopMenu
);
void
createPopUpMenuForFootprints
(
MODULE
*
aModule
,
wxMenu
*
aPopMenu
);
void
createPopUpMenuForFpTexts
(
TEXTE_MODULE
*
aText
,
wxMenu
*
aPopMenu
);
void
createPopUpMenuForFpPads
(
D_PAD
*
aPad
,
wxMenu
*
aPopMenu
);
void
createPopupMenuForTracks
(
TRACK
*
aTrack
,
wxMenu
*
aPopMenu
);
void
createPopUpMenuForTexts
(
TEXTE_PCB
*
Text
,
wxMenu
*
menu
);
void
createPopUpBlockMenu
(
wxMenu
*
menu
);
void
createPopUpMenuForMarkers
(
MARKER_PCB
*
aMarker
,
wxMenu
*
aPopMenu
);
public
:
WinEDA_PcbFrame
(
wxWindow
*
father
,
const
wxString
&
title
,
...
...
@@ -183,13 +200,6 @@ public:
/* toolbars update UI functions: */
/**
* Function UpdateToolbarLayerInfo
* updates the currently selected layer in the layer listbox and
* the colored icon in the toolbar.
*/
void
UpdateToolbarLayerInfo
();
void
PrepareLayerIndicator
();
/**
...
...
@@ -206,14 +216,6 @@ public:
*/
void
AuxiliaryToolBar_DesignRules_Update_UI
();
/** Function SynchronizeLayersManager( )
* Must be called when info displayed in the layer manager Toolbar
* as been changed in the main window ( by hotkey or a tool option.
* Mainly when the active layer as changed.
* @param aFlag = flag giving the type of data (layers, checkboxes...)
*/
void
SynchronizeLayersManager
(
int
aFlag
);
/* mouse functions events: */
void
OnLeftClick
(
wxDC
*
DC
,
const
wxPoint
&
MousePos
);
void
OnLeftDClick
(
wxDC
*
DC
,
const
wxPoint
&
MousePos
);
...
...
pcbnew/CMakeLists.txt
View file @
6518139b
...
...
@@ -111,7 +111,6 @@ set(PCBNEW_SRCS
ioascii.cpp
print_board_functions.cpp
printout_controler.cpp
layer_panel_base.cpp
layer_widget.cpp
librairi.cpp
loadcmp.cpp
...
...
@@ -243,7 +242,6 @@ endif(NOT MSVC)
# This one gets made only when testing.
add_executable
(
layer_widget_test WIN32 EXCLUDE_FROM_ALL
layer_panel_base.cpp
layer_widget.cpp
)
target_link_libraries
(
layer_widget_test common
${
wxWidgets_LIBRARIES
}
)
pcbnew/deltrack.cpp
View file @
6518139b
...
...
@@ -36,7 +36,7 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* aTrack )
{
if
(
g_CurrentTrackList
.
GetCount
()
>
0
)
{
int
previous_layer
=
(
(
PCB_SCREEN
*
)
GetScreen
()
)
->
m_Active_Layer
;
int
previous_layer
=
getActiveLayer
()
;
D
(
g_CurrentTrackList
.
VerifyListIntegrity
();
)
...
...
@@ -71,7 +71,7 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* aTrack )
// Correct active layer which could change if a via
// has been erased
(
(
PCB_SCREEN
*
)
GetScreen
()
)
->
m_Active_Layer
=
previous_layer
;
setActiveLayer
(
previous_layer
)
;
UpdateStatusBar
();
if
(
g_TwoSegmentTrackBuild
)
// We must have 2 segments or more,
...
...
pcbnew/edit.cpp
View file @
6518139b
...
...
@@ -738,12 +738,10 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break
;
case
ID_POPUP_PCB_SELECT_LAYER
:
itmp
=
SelectLayer
(
(
(
PCB_SCREEN
*
)
GetScreen
()
)
->
m_Active_Layer
,
-
1
,
-
1
);
itmp
=
SelectLayer
(
getActiveLayer
(),
-
1
,
-
1
);
if
(
itmp
>=
0
)
(
(
PCB_SCREEN
*
)
GetScreen
()
)
->
m_Active_Layer
=
itmp
;
setActiveLayer
(
itmp
)
;
DrawPanel
->
MouseToCursorSchema
();
SynchronizeLayersManager
(
1
);
break
;
case
ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR
:
...
...
@@ -751,24 +749,17 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break
;
case
ID_POPUP_PCB_SELECT_NO_CU_LAYER
:
itmp
=
SelectLayer
(
(
(
PCB_SCREEN
*
)
GetScreen
()
)
->
m_Active_Layer
,
FIRST_NO_COPPER_LAYER
,
-
1
);
itmp
=
SelectLayer
(
getActiveLayer
(),
FIRST_NO_COPPER_LAYER
,
-
1
);
if
(
itmp
>=
0
)
(
(
PCB_SCREEN
*
)
GetScreen
()
)
->
m_Active_Layer
=
itmp
;
setActiveLayer
(
itmp
)
;
DrawPanel
->
MouseToCursorSchema
();
SynchronizeLayersManager
(
1
);
break
;
break
;
case
ID_POPUP_PCB_SELECT_CU_LAYER
:
itmp
=
SelectLayer
(
(
(
PCB_SCREEN
*
)
GetScreen
()
)
->
m_Active_Layer
,
-
1
,
LAST_COPPER_LAYER
);
itmp
=
SelectLayer
(
getActiveLayer
(),
-
1
,
LAST_COPPER_LAYER
);
if
(
itmp
>=
0
)
(
(
PCB_SCREEN
*
)
GetScreen
()
)
->
m_Active_Layer
=
itmp
;
SynchronizeLayersManager
(
1
);
break
;
setActiveLayer
(
itmp
);
break
;
case
ID_POPUP_PCB_SELECT_LAYER_PAIR
:
SelectLayerPair
();
...
...
@@ -777,9 +768,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case
ID_TOOLBARH_PCB_SELECT_LAYER
:
itmp
=
m_SelLayerBox
->
GetChoice
();
(
(
PCB_SCREEN
*
)
GetScreen
()
)
->
m_Active_Layer
=
(
int
)
(
(
size_t
)
m_SelLayerBox
->
GetClientData
(
itmp
)
);
SynchronizeLayersManager
(
1
);
// Ensure Layer manager synchronization
setActiveLayer
(
(
size_t
)
m_SelLayerBox
->
GetClientData
(
itmp
)
);
if
(
DisplayOpt
.
ContrastModeDisplay
)
DrawPanel
->
Refresh
(
true
);
break
;
...
...
@@ -1076,10 +1065,10 @@ void WinEDA_PcbFrame::RemoveStruct( BOARD_ITEM* Item, wxDC* DC )
void
WinEDA_PcbFrame
::
SwitchLayer
(
wxDC
*
DC
,
int
layer
)
{
int
preslayer
=
GetScreen
()
->
m_Active_Layer
;
int
curLayer
=
getActiveLayer
()
;
// Check if the specified layer matches the present layer
if
(
layer
==
presl
ayer
)
if
(
layer
==
curL
ayer
)
return
;
// Copper layers cannot be selected unconditionally; how many
...
...
@@ -1087,7 +1076,7 @@ void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer )
if
(
IsValidCopperLayerIndex
(
layer
)
)
{
// If only one copper layer is enabled, the only such layer
// that can be selected to is the "
Copper
" layer (so the
// that can be selected to is the "
Back
" layer (so the
// selection of any other copper layer is disregarded).
if
(
GetBoard
()
->
m_BoardSettings
->
GetCopperLayerCount
()
<
2
)
{
...
...
@@ -1129,9 +1118,10 @@ void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer )
// Want to set the routing layers so that it switches properly -
// see the implementation of Other_Layer_Route - the working
// layer is used to 'start' the via and set the layer masks appropriately.
GetScreen
()
->
m_Route_Layer_TOP
=
presl
ayer
;
GetScreen
()
->
m_Route_Layer_TOP
=
curL
ayer
;
GetScreen
()
->
m_Route_Layer_BOTTOM
=
layer
;
GetScreen
()
->
m_Active_Layer
=
preslayer
;
setActiveLayer
(
curLayer
);
if
(
Other_Layer_Route
(
(
TRACK
*
)
GetScreen
()
->
GetCurItem
(),
DC
)
)
{
...
...
@@ -1140,7 +1130,7 @@ void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer )
}
// if the via was allowed by DRC, then the layer swap has already
// been done by Other_Layer_Route(). if via not allowed, then
// return now so assignment to
m_Active_Layer
below doesn't happen.
// return now so assignment to
setActiveLayer()
below doesn't happen.
return
;
}
}
...
...
@@ -1151,8 +1141,7 @@ void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer )
// and a non-copper layer, or vice-versa?
// ...
GetScreen
()
->
m_Active_Layer
=
layer
;
SynchronizeLayersManager
(
1
);
// Ensure Layer manager synchronization
setActiveLayer
(
layer
);
if
(
DisplayOpt
.
ContrastModeDisplay
)
GetScreen
()
->
SetRefreshReq
();
...
...
pcbnew/editrack-part2.cpp
View file @
6518139b
...
...
@@ -128,17 +128,14 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
if
(
aTrack
==
NULL
)
{
if
(
((
PCB_SCREEN
*
)
GetScreen
())
->
m_Active_Layer
!=
if
(
getActiveLayer
()
!=
((
PCB_SCREEN
*
)
GetScreen
())
->
m_Route_Layer_TOP
)
((
PCB_SCREEN
*
)
GetScreen
())
->
m_Active_Layer
=
((
PCB_SCREEN
*
)
GetScreen
())
->
m_Route_Layer_TOP
;
setActiveLayer
(
((
PCB_SCREEN
*
)
GetScreen
())
->
m_Route_Layer_TOP
);
else
((
PCB_SCREEN
*
)
GetScreen
())
->
m_Active_Layer
=
((
PCB_SCREEN
*
)
GetScreen
())
->
m_Route_Layer_BOTTOM
;
setActiveLayer
(((
PCB_SCREEN
*
)
GetScreen
())
->
m_Route_Layer_BOTTOM
);
UpdateStatusBar
();
SetToolbars
();
SynchronizeLayersManager
(
1
);
return
true
;
}
...
...
@@ -185,39 +182,34 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
via
->
m_Width
=
GetBoard
()
->
GetCurrentViaSize
();
via
->
SetNet
(
g_HightLigth_NetCode
);
via
->
m_Start
=
via
->
m_End
=
g_CurrentTrackSegment
->
m_End
;
int
old_layer
=
((
PCB_SCREEN
*
)
GetScreen
())
->
m_Active_Layer
;
int
old_layer
=
getActiveLayer
()
;
// swap the layers.
if
(
((
PCB_SCREEN
*
)
GetScreen
())
->
m_Active_Layer
!=
if
(
getActiveLayer
()
!=
((
PCB_SCREEN
*
)
GetScreen
())
->
m_Route_Layer_TOP
)
((
PCB_SCREEN
*
)
GetScreen
())
->
m_Active_Layer
=
((
PCB_SCREEN
*
)
GetScreen
())
->
m_Route_Layer_TOP
;
setActiveLayer
(((
PCB_SCREEN
*
)
GetScreen
())
->
m_Route_Layer_TOP
);
else
((
PCB_SCREEN
*
)
GetScreen
())
->
m_Active_Layer
=
((
PCB_SCREEN
*
)
GetScreen
())
->
m_Route_Layer_BOTTOM
;
setActiveLayer
(
((
PCB_SCREEN
*
)
GetScreen
())
->
m_Route_Layer_BOTTOM
);
/* Adjust the via layer pair */
switch
(
via
->
Shape
()
)
{
case
VIA_BLIND_BURIED
:
via
->
SetLayerPair
(
old_layer
,
((
PCB_SCREEN
*
)
GetScreen
())
->
m_Active_Layer
);
via
->
SetLayerPair
(
old_layer
,
getActiveLayer
()
);
via
->
SetDrillValue
(
GetBoard
()
->
GetCurrentViaDrill
()
);
break
;
case
VIA_MICROVIA
:
// from external to the near neighbor inner layer
if
(
old_layer
==
LAYER_N_BACK
)
((
PCB_SCREEN
*
)
GetScreen
())
->
m_Active_Layer
=
LAYER_N_2
;
setActiveLayer
(
LAYER_N_2
)
;
else
if
(
old_layer
==
LAYER_N_FRONT
)
((
PCB_SCREEN
*
)
GetScreen
())
->
m_Active_Layer
=
GetBoard
()
->
m_BoardSettings
->
GetCopperLayerCount
()
-
2
;
setActiveLayer
(
GetBoard
()
->
m_BoardSettings
->
GetCopperLayerCount
()
-
2
);
else
if
(
old_layer
==
LAYER_N_2
)
((
PCB_SCREEN
*
)
GetScreen
())
->
m_Active_Layer
=
LAYER_N_BACK
;
else
if
(
old_layer
==
GetBoard
()
->
m_BoardSettings
->
GetCopperLayerCount
()
-
2
)
((
PCB_SCREEN
*
)
GetScreen
())
->
m_Active_Layer
=
LAYER_N_FRONT
;
setActiveLayer
(
LAYER_N_BACK
)
;
else
if
(
old_layer
==
GetBoard
()
->
m_BoardSettings
->
GetCopperLayerCount
()
-
2
)
;
setActiveLayer
(
LAYER_N_FRONT
)
;
// else error
via
->
SetLayerPair
(
old_layer
,
((
PCB_SCREEN
*
)
GetScreen
())
->
m_Active_Layer
);
via
->
SetLayerPair
(
old_layer
,
getActiveLayer
()
);
{
NETINFO_ITEM
*
net
=
GetBoard
()
->
FindNet
(
via
->
GetNet
()
);
via
->
m_Width
=
net
->
GetMicroViaSize
();
...
...
@@ -236,7 +228,7 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
/* DRC fault: the Via cannot be placed here ... */
delete
via
;
((
PCB_SCREEN
*
)
GetScreen
())
->
m_Active_Layer
=
old_layer
;
setActiveLayer
(
old_layer
)
;
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
...
...
@@ -274,7 +266,7 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
*/
// set the layer to the new value
track
->
SetLayer
(
((
PCB_SCREEN
*
)
GetScreen
())
->
m_Active_Layer
);
track
->
SetLayer
(
getActiveLayer
()
);
/* the start point is the via position and the end point is the cursor
* which also is on the via (will change when moving mouse)
...
...
@@ -294,7 +286,6 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
UpdateStatusBar
();
SetToolbars
();
SynchronizeLayersManager
(
1
);
return
true
;
}
...
...
@@ -307,8 +298,7 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
void
WinEDA_PcbFrame
::
Affiche_Status_Net
(
wxDC
*
DC
)
{
TRACK
*
pt_segm
;
int
masquelayer
=
g_TabOneLayerMask
[((
PCB_SCREEN
*
)
GetScreen
())
->
m_Active_Layer
];
int
masquelayer
=
(
1
<<
getActiveLayer
());
pt_segm
=
Locate_Pistes
(
GetBoard
()
->
m_Track
,
masquelayer
,
CURSEUR_OFF_GRILLE
);
...
...
pcbnew/layer_panel_base.cpp
deleted
100644 → 0
View file @
84d82cf2
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 29 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#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
)
{
wxBoxSizer
*
boxSizer
;
boxSizer
=
new
wxBoxSizer
(
wxVERTICAL
);
// 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
,
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
|
wxLEFT
|
wxTOP
,
2
);
m_LayerPanel
->
SetSizer
(
bSizer3
);
m_LayerPanel
->
Layout
();
bSizer3
->
Fit
(
m_LayerPanel
);
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
,
0
,
1
);
m_RenderFlexGridSizer
->
SetFlexibleDirection
(
wxHORIZONTAL
);
m_RenderFlexGridSizer
->
SetNonFlexibleGrowMode
(
wxFLEX_GROWMODE_NONE
);
m_RenderScrolledWindow
->
SetSizer
(
m_RenderFlexGridSizer
);
m_RenderScrolledWindow
->
Layout
();
m_RenderFlexGridSizer
->
Fit
(
m_RenderScrolledWindow
);
bSizer4
->
Add
(
m_RenderScrolledWindow
,
1
,
wxALL
|
wxEXPAND
,
5
);
m_RenderingPanel
->
SetSizer
(
bSizer4
);
m_RenderingPanel
->
Layout
();
bSizer4
->
Fit
(
m_RenderingPanel
);
m_notebook
->
AddPage
(
m_RenderingPanel
,
_
(
"Render"
),
false
);
boxSizer
->
Add
(
m_notebook
,
1
,
wxEXPAND
|
wxALL
,
5
);
this
->
SetSizer
(
boxSizer
);
this
->
Layout
();
// Connect Events
m_LayerScrolledWindow
->
Connect
(
wxEVT_LEFT_DOWN
,
wxMouseEventHandler
(
LAYER_PANEL_BASE
::
OnLeftDownLayers
),
NULL
,
this
);
m_LayerScrolledWindow
->
Connect
(
wxEVT_RIGHT_DOWN
,
wxMouseEventHandler
(
LAYER_PANEL_BASE
::
OnRightDownLayers
),
NULL
,
this
);
}
LAYER_PANEL_BASE
::~
LAYER_PANEL_BASE
()
{
// Disconnect Events
m_LayerScrolledWindow
->
Disconnect
(
wxEVT_LEFT_DOWN
,
wxMouseEventHandler
(
LAYER_PANEL_BASE
::
OnLeftDownLayers
),
NULL
,
this
);
m_LayerScrolledWindow
->
Disconnect
(
wxEVT_RIGHT_DOWN
,
wxMouseEventHandler
(
LAYER_PANEL_BASE
::
OnRightDownLayers
),
NULL
,
this
);
}
pcbnew/layer_panel_base.h
deleted
100644 → 0
View file @
84d82cf2
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 29 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __layer_panel_base__
#define __layer_panel_base__
#include <wx/intl.h>
#include <wx/sizer.h>
#include <wx/gdicmn.h>
#include <wx/scrolwin.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/panel.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
//#include <wx/notebook.h>
#include <wx/aui/auibook.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class LAYER_PANEL_BASE
///////////////////////////////////////////////////////////////////////////////
class
LAYER_PANEL_BASE
:
public
wxPanel
{
private
:
protected
:
// wxNotebook* m_notebook;
wxAuiNotebook
*
m_notebook
;
wxPanel
*
m_LayerPanel
;
wxScrolledWindow
*
m_LayerScrolledWindow
;
wxFlexGridSizer
*
m_LayersFlexGridSizer
;
wxPanel
*
m_RenderingPanel
;
wxScrolledWindow
*
m_RenderScrolledWindow
;
wxFlexGridSizer
*
m_RenderFlexGridSizer
;
// Virtual event handlers, overide them in your derived class
virtual
void
OnLeftDownLayers
(
wxMouseEvent
&
event
){
event
.
Skip
();
}
virtual
void
OnRightDownLayers
(
wxMouseEvent
&
event
){
event
.
Skip
();
}
public
:
LAYER_PANEL_BASE
(
wxWindow
*
parent
,
wxWindowID
id
=
wxID_ANY
,
const
wxPoint
&
pos
=
wxDefaultPosition
,
const
wxSize
&
size
=
wxSize
(
200
,
200
),
long
style
=
wxTAB_TRAVERSAL
);
~
LAYER_PANEL_BASE
();
};
#endif //__layer_panel_base__
pcbnew/layer_widget.cpp
View file @
6518139b
...
...
@@ -26,6 +26,7 @@
/* This source module implements the layer visibility and selection widget
@todo make the bitmapbutton a staticbitmap, and make dependent on the point size.
*/
...
...
@@ -33,31 +34,19 @@
// also enable KICAD_AUIMANAGER and KICAD_AUITOOLBAR in ccmake to
// build this test program
#include <wx/wx.h>
#include <wx/statbmp.h>
#include <wx/notebook.h>
#include "layer_widget.h"
#include "macros.h"
#include "common.h"
#include "colors.h"
#include "layer_widget.h"
#include "pcbstruct.h" // IsValidCopperLayerIndex()
#define LYR_COLUMN_COUNT 4 ///< Layer tab column count
#define RND_COLUMN_COUNT 2 ///< Rendering tab column count
#define BUTT_SIZE_X 20
#define BUTT_SIZE_Y 18
#define BUTT_VOID 4
#define ID_SHOW_ALL_COPPERS wxID_HIGHEST
#define ID_SHOW_NO_COPPERS (wxID_HIGHEST+1)
/* XPM */
static
const
char
*
clear_xpm
[]
=
{
"10 14 1 1"
,
...
...
@@ -100,30 +89,6 @@ static const char * rightarrow_xpm[] = {
" ooO "
,
" oO "
};
/**
* Function encodeId
* is here to allow saving a layer index within a control as its wxControl id,
* but to do so in a way that all child wxControl ids within a wxWindow are unique,
* since this is required by Windows.
* @see getDecodedId()
*/
static
int
encodeId
(
int
aColumn
,
int
aId
)
{
int
id
=
aId
*
LYR_COLUMN_COUNT
+
aColumn
;
return
id
;
}
/**
* Function getDecodedId
* decodes \a aControlId to original un-encoded value.
*/
static
int
getDecodedId
(
int
aControlId
)
{
int
id
=
aControlId
/
LYR_COLUMN_COUNT
;
// rounding is OK.
return
id
;
}
/**
* Function makeColorTxt
...
...
@@ -142,13 +107,28 @@ static wxString makeColorTxt( int aColor )
* Function shrinkFont
* reduces the size of the wxFont associated with \a aControl
*/
static
void
shrinkFont
(
wxWindow
*
aControl
)
static
void
shrinkFont
(
wxWindow
*
aControl
,
int
aPointSize
)
{
wxFont
font
=
aControl
->
GetFont
();
font
.
SetPointSize
(
(
font
.
GetPointSize
()
*
8
)
/
10
);
// go to 80% of original.
aControl
->
SetFont
(
font
);
font
.
SetPointSize
(
aPointSize
);
aControl
->
SetFont
(
font
);
// need this?
}
int
LAYER_WIDGET
::
encodeId
(
int
aColumn
,
int
aId
)
{
int
id
=
aId
*
LYR_COLUMN_COUNT
+
aColumn
;
return
id
;
}
int
LAYER_WIDGET
::
getDecodedId
(
int
aControlId
)
{
int
id
=
aControlId
/
LYR_COLUMN_COUNT
;
// rounding is OK.
return
id
;
}
wxBitmap
LAYER_WIDGET
::
makeBitmap
(
int
aColor
)
{
// the bitmap will be BUTT_VOID*2 pixels smaller than the button, leaving a
...
...
@@ -185,6 +165,7 @@ wxBitmapButton* LAYER_WIDGET::makeColorButton( wxWindow* aParent, int aColor, in
void
LAYER_WIDGET
::
OnLeftDownLayers
(
wxMouseEvent
&
event
)
{
int
row
;
int
layer
;
wxWindow
*
eventSource
=
(
wxWindow
*
)
event
.
GetEventObject
();
...
...
@@ -209,17 +190,20 @@ void LAYER_WIDGET::OnLeftDownLayers( wxMouseEvent& event )
if
(
row
>=
rowCount
)
row
=
rowCount
-
1
;
layer
=
getDecodedId
(
getLayerComp
(
row
*
LYR_COLUMN_COUNT
)
->
GetId
()
);
}
else
{
// all nested controls on a given row will have their ID encoded with
// encodeId(), and the corresponding decoding is getDecodedId()
int
layer
=
getDecodedId
(
eventSource
->
GetId
()
);
row
=
findLayerRow
(
layer
);
int
id
=
eventSource
->
GetId
();
layer
=
getDecodedId
(
id
);
row
=
findLayerRow
(
layer
);
}
if
(
OnLayerSelect
(
row
)
)
// if client allows this change.
if
(
OnLayerSelect
(
layer
)
)
// if client allows this change.
SelectLayerRow
(
row
);
passOnFocus
();
...
...
@@ -252,73 +236,6 @@ void LAYER_WIDGET::OnMiddleDownLayerColor( wxMouseEvent& event )
}
void
LAYER_WIDGET
::
OnRightDownLayers
(
wxMouseEvent
&
event
)
{
wxMenu
menu
;
// menu text is capitalized:
// http://library.gnome.org/devel/hig-book/2.20/design-text-labels.html.en#layout-capitalization
menu
.
Append
(
new
wxMenuItem
(
&
menu
,
ID_SHOW_ALL_COPPERS
,
_
(
"Show All Cu"
)
)
);
menu
.
Append
(
new
wxMenuItem
(
&
menu
,
ID_SHOW_NO_COPPERS
,
_
(
"Hide All Cu"
)
)
);
PopupMenu
(
&
menu
);
passOnFocus
();
}
void
LAYER_WIDGET
::
OnPopupSelection
(
wxCommandEvent
&
event
)
{
int
rowCount
;
int
menuId
=
event
.
GetId
();
bool
visible
;
switch
(
menuId
)
{
case
ID_SHOW_ALL_COPPERS
:
visible
=
true
;
goto
L_change_coppers
;
case
ID_SHOW_NO_COPPERS
:
visible
=
false
;
L_change_coppers
:
int
lastCu
=
-
1
;
rowCount
=
GetLayerRowCount
();
for
(
int
row
=
rowCount
-
1
;
row
>=
0
;
--
row
)
{
wxCheckBox
*
cb
=
(
wxCheckBox
*
)
getLayerComp
(
row
*
LYR_COLUMN_COUNT
+
3
);
int
layer
=
getDecodedId
(
cb
->
GetId
()
);
if
(
IsValidCopperLayerIndex
(
layer
)
)
{
lastCu
=
row
;
break
;
}
}
for
(
int
row
=
0
;
row
<
rowCount
;
++
row
)
{
wxCheckBox
*
cb
=
(
wxCheckBox
*
)
getLayerComp
(
row
*
LYR_COLUMN_COUNT
+
3
);
int
layer
=
getDecodedId
(
cb
->
GetId
()
);
if
(
IsValidCopperLayerIndex
(
layer
)
)
{
cb
->
SetValue
(
visible
);
bool
isLastCopperLayer
=
(
row
==
lastCu
);
OnLayerVisible
(
layer
,
visible
,
isLastCopperLayer
);
if
(
isLastCopperLayer
)
break
;
}
}
break
;
}
}
void
LAYER_WIDGET
::
OnLayerCheckBox
(
wxCommandEvent
&
event
)
{
wxCheckBox
*
eventSource
=
(
wxCheckBox
*
)
event
.
GetEventObject
();
...
...
@@ -406,7 +323,6 @@ void LAYER_WIDGET::insertLayerRow( int aRow, const ROW& aSpec )
wxStaticBitmap
*
sbm
=
new
wxStaticBitmap
(
m_LayerScrolledWindow
,
encodeId
(
col
,
aSpec
.
id
),
*
m_BlankBitmap
,
wxDefaultPosition
,
m_BitmapSize
);
sbm
->
Connect
(
wxEVT_LEFT_DOWN
,
wxMouseEventHandler
(
LAYER_WIDGET
::
OnLeftDownLayers
),
NULL
,
this
);
sbm
->
Connect
(
wxEVT_RIGHT_DOWN
,
wxMouseEventHandler
(
LAYER_WIDGET
::
OnRightDownLayers
),
NULL
,
this
);
m_LayersFlexGridSizer
->
wxSizer
::
Insert
(
index
+
col
,
sbm
,
0
,
flags
);
// column 1
...
...
@@ -414,16 +330,14 @@ void LAYER_WIDGET::insertLayerRow( int aRow, const ROW& aSpec )
wxBitmapButton
*
bmb
=
makeColorButton
(
m_LayerScrolledWindow
,
aSpec
.
color
,
encodeId
(
col
,
aSpec
.
id
)
);
bmb
->
Connect
(
wxEVT_LEFT_DOWN
,
wxMouseEventHandler
(
LAYER_WIDGET
::
OnLeftDownLayers
),
NULL
,
this
);
bmb
->
Connect
(
wxEVT_MIDDLE_DOWN
,
wxMouseEventHandler
(
LAYER_WIDGET
::
OnMiddleDownLayerColor
),
NULL
,
this
);
bmb
->
Connect
(
wxEVT_RIGHT_DOWN
,
wxMouseEventHandler
(
LAYER_WIDGET
::
OnRightDownLayers
),
NULL
,
this
);
bmb
->
SetToolTip
(
_
(
"Left click to select, middle click for color change, right click for menu"
)
);
m_LayersFlexGridSizer
->
wxSizer
::
Insert
(
index
+
col
,
bmb
,
0
,
flags
);
// column 2
col
=
2
;
wxStaticText
*
st
=
new
wxStaticText
(
m_LayerScrolledWindow
,
encodeId
(
col
,
aSpec
.
id
),
aSpec
.
rowName
);
shrinkFont
(
st
);
shrinkFont
(
st
,
m_PointSize
);
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
);
m_LayersFlexGridSizer
->
wxSizer
::
Insert
(
index
+
col
,
st
,
0
,
flags
);
...
...
@@ -467,7 +381,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
);
shrinkFont
(
cb
,
m_PointSize
);
cb
->
SetValue
(
aSpec
.
state
);
cb
->
Connect
(
wxEVT_COMMAND_CHECKBOX_CLICKED
,
wxCommandEventHandler
(
LAYER_WIDGET
::
OnRenderCheckBox
),
NULL
,
this
);
...
...
@@ -484,31 +398,84 @@ void LAYER_WIDGET::passOnFocus()
//-----<public>-------------------------------------------------------
LAYER_WIDGET
::
LAYER_WIDGET
(
wxWindow
*
aParent
,
wxWindow
*
aFocusOwner
)
:
LAYER_PANEL_BASE
(
aParent
)
LAYER_WIDGET
::
LAYER_WIDGET
(
wxWindow
*
aParent
,
wxWindow
*
aFocusOwner
,
int
aPointSize
,
wxWindowID
id
,
const
wxPoint
&
pos
,
const
wxSize
&
size
,
long
style
)
:
wxPanel
(
aParent
,
id
,
pos
,
size
,
style
)
{
m_PointSize
=
aPointSize
;
wxBoxSizer
*
boxSizer
;
boxSizer
=
new
wxBoxSizer
(
wxVERTICAL
);
m_notebook
=
new
wxAuiNotebook
(
this
,
wxID_ANY
,
wxDefaultPosition
,
wxDefaultSize
,
wxAUI_NB_TOP
);
// change the font size on the notebook's tabs to match aPointSize
wxFont
font
=
m_notebook
->
GetFont
();
font
.
SetPointSize
(
aPointSize
);
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
,
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
|
wxLEFT
|
wxTOP
,
2
);
m_LayerPanel
->
SetSizer
(
bSizer3
);
m_LayerPanel
->
Layout
();
bSizer3
->
Fit
(
m_LayerPanel
);
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
,
0
,
1
);
m_RenderFlexGridSizer
->
SetFlexibleDirection
(
wxHORIZONTAL
);
m_RenderFlexGridSizer
->
SetNonFlexibleGrowMode
(
wxFLEX_GROWMODE_NONE
);
m_RenderScrolledWindow
->
SetSizer
(
m_RenderFlexGridSizer
);
m_RenderScrolledWindow
->
Layout
();
m_RenderFlexGridSizer
->
Fit
(
m_RenderScrolledWindow
);
bSizer4
->
Add
(
m_RenderScrolledWindow
,
1
,
wxALL
|
wxEXPAND
,
5
);
m_RenderingPanel
->
SetSizer
(
bSizer4
);
m_RenderingPanel
->
Layout
();
bSizer4
->
Fit
(
m_RenderingPanel
);
m_notebook
->
AddPage
(
m_RenderingPanel
,
_
(
"Render"
),
false
);
boxSizer
->
Add
(
m_notebook
,
1
,
wxEXPAND
|
wxALL
,
5
);
SetSizer
(
boxSizer
);
m_FocusOwner
=
aFocusOwner
;
m_CurrentRow
=
-
1
;
m_CurrentRow
=
-
1
;
// hide the arrow initially
m_RightArrowBitmap
=
new
wxBitmap
(
rightarrow_xpm
);
m_BlankBitmap
=
new
wxBitmap
(
clear_xpm
);
// translucent
m_BitmapSize
=
wxSize
(
m_BlankBitmap
->
GetWidth
(),
m_BlankBitmap
->
GetHeight
());
// handle the popup menu over the layer window
m_LayerScrolledWindow
->
Connect
(
wxEVT_RIGHT_DOWN
,
wxMouseEventHandler
(
LAYER_WIDGET
::
OnRightDownLayers
),
NULL
,
this
);
// since Popupmenu() calls this->ProcessEvent() we must call this->Connect()
// and not m_LayerScrolledWindow->Connect()
Connect
(
ID_SHOW_ALL_COPPERS
,
ID_SHOW_NO_COPPERS
,
wxEVT_COMMAND_MENU_SELECTED
,
wxCommandEventHandler
(
LAYER_WIDGET
::
OnPopupSelection
),
NULL
,
this
);
// trap the tab changes so that we can call passOnFocus().
m_notebook
->
Connect
(
-
1
,
wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED
,
wxNotebookEventHandler
(
LAYER_WIDGET
::
OnTabChange
),
NULL
,
this
);
Layout
();
}
...
...
@@ -518,7 +485,7 @@ wxSize LAYER_WIDGET::GetBestSize() const
wxSize layerz = m_LayersFlexGridSizer->GetMinSize();
wxSize renderz = m_RenderFlexGridSizer->GetMinSize();
wxSize clientz(
max(renderz.x,layerz.x), max
(renderz.y,layerz.y) );
wxSize clientz(
MAX(renderz.x,layerz.x), MAX
(renderz.y,layerz.y) );
return ClientToWindowSize( clientz );
...
...
@@ -593,7 +560,7 @@ wxSize LAYER_WIDGET::GetBestSize() const
renderz
+=
m_RenderingPanel
->
GetWindowBorderSize
();
wxSize
clientz
(
max
(
renderz
.
x
,
layerz
.
x
),
max
(
renderz
.
y
,
layerz
.
y
)
);
wxSize
clientz
(
MAX
(
renderz
.
x
,
layerz
.
x
),
MAX
(
renderz
.
y
,
layerz
.
y
)
);
// wxSize diffz( GetSize() - GetClientSize() );
// clientz += diffz;
...
...
pcbnew/layer_widget.h
View file @
6518139b
...
...
@@ -25,7 +25,26 @@
#ifndef LAYERWIDGET_H_
#define LAYERWIDGET_H_
#include "layer_panel_base.h"
#include <wx/intl.h>
#include <wx/wx.h>
#include <wx/statbmp.h>
#include <wx/string.h>
#include <wx/aui/auibook.h>
#include <wx/notebook.h>
#include <wx/sizer.h>
#include <wx/gdicmn.h>
#include <wx/scrolwin.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/panel.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#define LYR_COLUMN_COUNT 4 ///< Layer tab column count
#define RND_COLUMN_COUNT 2 ///< Rendering tab column count
/**
...
...
@@ -44,7 +63,7 @@
* <p> void OnRenderColorChange( int id, int aColor );
* <p> void OnRenderEnable( int id, bool isEnabled );
*/
class
LAYER_WIDGET
:
public
LAYER_PANEL_BASE
class
LAYER_WIDGET
:
public
wxPanel
{
public
:
/**
...
...
@@ -74,14 +93,37 @@ public:
protected
:
wxWindow
*
m_FocusOwner
;
wxBitmap
*
m_BlankBitmap
;
wxBitmap
*
m_RightArrowBitmap
;
wxSize
m_BitmapSize
;
int
m_CurrentRow
;
///< selected row of layer list
wxAuiNotebook
*
m_notebook
;
wxPanel
*
m_LayerPanel
;
wxScrolledWindow
*
m_LayerScrolledWindow
;
wxFlexGridSizer
*
m_LayersFlexGridSizer
;
wxPanel
*
m_RenderingPanel
;
wxScrolledWindow
*
m_RenderScrolledWindow
;
wxFlexGridSizer
*
m_RenderFlexGridSizer
;
wxWindow
*
m_FocusOwner
;
wxBitmap
*
m_BlankBitmap
;
wxBitmap
*
m_RightArrowBitmap
;
wxSize
m_BitmapSize
;
int
m_CurrentRow
;
///< selected row of layer list
int
m_PointSize
;
static
wxBitmap
makeBitmap
(
int
aColor
);
/**
* Function encodeId
* is here to allow saving a layer index within a control as its wxControl id,
* but to do so in a way that all child wxControl ids within a wxWindow are unique,
* since this is required by Windows.
* @see getDecodedId()
*/
static
int
encodeId
(
int
aColumn
,
int
aId
);
/**
* Function getDecodedId
* decodes \a aControlId to original un-encoded value.
*/
static
int
getDecodedId
(
int
aControlId
);
/**
* Function makeColorButton
...
...
@@ -97,14 +139,6 @@ protected:
*/
void
OnMiddleDownLayerColor
(
wxMouseEvent
&
event
);
/**
* Function OnRightDownLayers
* puts up a popup menu for the layer panel.
*/
void
OnRightDownLayers
(
wxMouseEvent
&
event
);
void
OnPopupSelection
(
wxCommandEvent
&
event
);
/**
* Function OnLayerCheckBox
* handles the "is layer visible" checkbox and propogates the
...
...
@@ -155,7 +189,9 @@ public:
* @param aFocusOwner is the window that should be sent the focus after
* every operation.
*/
LAYER_WIDGET
(
wxWindow
*
aParent
,
wxWindow
*
aFocusOwner
);
LAYER_WIDGET
(
wxWindow
*
aParent
,
wxWindow
*
aFocusOwner
,
int
aPointSize
,
wxWindowID
id
=
wxID_ANY
,
const
wxPoint
&
pos
=
wxDefaultPosition
,
const
wxSize
&
size
=
wxDefaultSize
,
long
style
=
wxTAB_TRAVERSAL
);
/**
* Function GetBestSize
...
...
pcbnew/onleftclick.cpp
View file @
6518139b
...
...
@@ -196,7 +196,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
if
(
m_ID_current_state
==
ID_PCB_ARC_BUTT
)
shape
=
S_ARC
;
if
(
(
(
PCB_SCREEN
*
)
GetScreen
()
)
->
m_Active_Layer
<=
LAST_COPPER_LAYER
)
if
(
getActiveLayer
()
<=
LAST_COPPER_LAYER
)
{
DisplayError
(
this
,
_
(
"Graphic not authorized on Copper layers"
)
);
break
;
...
...
@@ -219,7 +219,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
}
case
ID_TRACK_BUTT
:
if
(
(
(
PCB_SCREEN
*
)
GetScreen
()
)
->
m_Active_Layer
>
LAST_COPPER_LAYER
)
if
(
getActiveLayer
()
>
LAST_COPPER_LAYER
)
{
DisplayError
(
this
,
_
(
"Tracks on Copper layers only "
)
);
break
;
...
...
@@ -328,7 +328,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
break
;
case
ID_PCB_COTATION_BUTT
:
if
(
(
(
PCB_SCREEN
*
)
GetScreen
()
)
->
m_Active_Layer
<=
LAST_COPPER_LAYER
)
if
(
getActiveLayer
()
<=
LAST_COPPER_LAYER
)
{
DisplayError
(
this
,
_
(
"Cotation not authorized on Copper layers"
)
);
break
;
...
...
pcbnew/panel_layer_select.fbp
deleted
100644 → 0
View file @
84d82cf2
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion
major=
"1"
minor=
"9"
/>
<object
class=
"Project"
expanded=
"1"
>
<property
name=
"class_decoration"
></property>
<property
name=
"code_generation"
>
C++
</property>
<property
name=
"disconnect_events"
>
1
</property>
<property
name=
"encoding"
>
UTF-8
</property>
<property
name=
"event_generation"
>
connect
</property>
<property
name=
"file"
>
layer_panel_base
</property>
<property
name=
"first_id"
>
1000
</property>
<property
name=
"help_provider"
>
none
</property>
<property
name=
"internationalize"
>
1
</property>
<property
name=
"name"
>
LAYER_PANEL
</property>
<property
name=
"namespace"
></property>
<property
name=
"path"
>
.
</property>
<property
name=
"precompiled_header"
></property>
<property
name=
"relative_path"
>
1
</property>
<property
name=
"use_enum"
>
0
</property>
<property
name=
"use_microsoft_bom"
>
0
</property>
<object
class=
"Panel"
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=
"hidden"
>
0
</property>
<property
name=
"id"
>
wxID_ANY
</property>
<property
name=
"maximum_size"
></property>
<property
name=
"minimum_size"
>
-1,-1
</property>
<property
name=
"name"
>
LAYER_PANEL_BASE
</property>
<property
name=
"pos"
></property>
<property
name=
"size"
>
200,200
</property>
<property
name=
"subclass"
>
;
</property>
<property
name=
"tooltip"
></property>
<property
name=
"window_extra_style"
></property>
<property
name=
"window_name"
></property>
<property
name=
"window_style"
>
wxTAB_TRAVERSAL
</property>
<event
name=
"OnChar"
></event>
<event
name=
"OnEnterWindow"
></event>
<event
name=
"OnEraseBackground"
></event>
<event
name=
"OnInitDialog"
></event>
<event
name=
"OnKeyDown"
></event>
<event
name=
"OnKeyUp"
></event>
<event
name=
"OnKillFocus"
></event>
<event
name=
"OnLeaveWindow"
></event>
<event
name=
"OnLeftDClick"
></event>
<event
name=
"OnLeftDown"
></event>
<event
name=
"OnLeftUp"
></event>
<event
name=
"OnMiddleDClick"
></event>
<event
name=
"OnMiddleDown"
></event>
<event
name=
"OnMiddleUp"
></event>
<event
name=
"OnMotion"
></event>
<event
name=
"OnMouseEvents"
></event>
<event
name=
"OnMouseWheel"
></event>
<event
name=
"OnPaint"
></event>
<event
name=
"OnRightDClick"
></event>
<event
name=
"OnRightDown"
></event>
<event
name=
"OnRightUp"
></event>
<event
name=
"OnSetFocus"
></event>
<event
name=
"OnSize"
></event>
<event
name=
"OnUpdateUI"
></event>
<object
class=
"wxBoxSizer"
expanded=
"1"
>
<property
name=
"minimum_size"
></property>
<property
name=
"name"
>
boxSizer
</property>
<property
name=
"orient"
>
wxVERTICAL
</property>
<property
name=
"permission"
>
none
</property>
<object
class=
"sizeritem"
expanded=
"1"
>
<property
name=
"border"
>
5
</property>
<property
name=
"flag"
>
wxEXPAND | wxALL
</property>
<property
name=
"proportion"
>
1
</property>
<object
class=
"wxNotebook"
expanded=
"1"
>
<property
name=
"bg"
></property>
<property
name=
"bitmapsize"
></property>
<property
name=
"context_help"
></property>
<property
name=
"enabled"
>
1
</property>
<property
name=
"fg"
></property>
<property
name=
"font"
></property>
<property
name=
"hidden"
>
0
</property>
<property
name=
"id"
>
wxID_ANY
</property>
<property
name=
"maximum_size"
></property>
<property
name=
"minimum_size"
></property>
<property
name=
"name"
>
m_notebook
</property>
<property
name=
"permission"
>
protected
</property>
<property
name=
"pos"
></property>
<property
name=
"size"
></property>
<property
name=
"style"
></property>
<property
name=
"subclass"
></property>
<property
name=
"tooltip"
></property>
<property
name=
"window_extra_style"
></property>
<property
name=
"window_name"
></property>
<property
name=
"window_style"
></property>
<event
name=
"OnChar"
></event>
<event
name=
"OnEnterWindow"
></event>
<event
name=
"OnEraseBackground"
></event>
<event
name=
"OnKeyDown"
></event>
<event
name=
"OnKeyUp"
></event>
<event
name=
"OnKillFocus"
></event>
<event
name=
"OnLeaveWindow"
></event>
<event
name=
"OnLeftDClick"
></event>
<event
name=
"OnLeftDown"
></event>
<event
name=
"OnLeftUp"
></event>
<event
name=
"OnMiddleDClick"
></event>
<event
name=
"OnMiddleDown"
></event>
<event
name=
"OnMiddleUp"
></event>
<event
name=
"OnMotion"
></event>
<event
name=
"OnMouseEvents"
></event>
<event
name=
"OnMouseWheel"
></event>
<event
name=
"OnNotebookPageChanged"
></event>
<event
name=
"OnNotebookPageChanging"
></event>
<event
name=
"OnPaint"
></event>
<event
name=
"OnRightDClick"
></event>
<event
name=
"OnRightDown"
></event>
<event
name=
"OnRightUp"
></event>
<event
name=
"OnSetFocus"
></event>
<event
name=
"OnSize"
></event>
<event
name=
"OnUpdateUI"
></event>
<object
class=
"notebookpage"
expanded=
"1"
>
<property
name=
"bitmap"
>
layerbitmap; Load From File
</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"
>
,90,90,10,70,0
</property>
<property
name=
"hidden"
>
0
</property>
<property
name=
"id"
>
wxID_ANY
</property>
<property
name=
"maximum_size"
></property>
<property
name=
"minimum_size"
></property>
<property
name=
"name"
>
m_LayerPanel
</property>
<property
name=
"permission"
>
protected
</property>
<property
name=
"pos"
></property>
<property
name=
"size"
></property>
<property
name=
"subclass"
></property>
<property
name=
"tooltip"
></property>
<property
name=
"window_extra_style"
></property>
<property
name=
"window_name"
></property>
<property
name=
"window_style"
>
wxTAB_TRAVERSAL
</property>
<event
name=
"OnChar"
></event>
<event
name=
"OnEnterWindow"
></event>
<event
name=
"OnEraseBackground"
></event>
<event
name=
"OnKeyDown"
></event>
<event
name=
"OnKeyUp"
></event>
<event
name=
"OnKillFocus"
></event>
<event
name=
"OnLeaveWindow"
></event>
<event
name=
"OnLeftDClick"
></event>
<event
name=
"OnLeftDown"
></event>
<event
name=
"OnLeftUp"
></event>
<event
name=
"OnMiddleDClick"
></event>
<event
name=
"OnMiddleDown"
></event>
<event
name=
"OnMiddleUp"
></event>
<event
name=
"OnMotion"
></event>
<event
name=
"OnMouseEvents"
></event>
<event
name=
"OnMouseWheel"
></event>
<event
name=
"OnPaint"
></event>
<event
name=
"OnRightDClick"
></event>
<event
name=
"OnRightDown"
></event>
<event
name=
"OnRightUp"
></event>
<event
name=
"OnSetFocus"
></event>
<event
name=
"OnSize"
></event>
<event
name=
"OnUpdateUI"
></event>
<object
class=
"wxBoxSizer"
expanded=
"1"
>
<property
name=
"minimum_size"
></property>
<property
name=
"name"
>
bSizer3
</property>
<property
name=
"orient"
>
wxVERTICAL
</property>
<property
name=
"permission"
>
none
</property>
<object
class=
"sizeritem"
expanded=
"1"
>
<property
name=
"border"
>
2
</property>
<property
name=
"flag"
>
wxBOTTOM|wxEXPAND|wxLEFT|wxTOP
</property>
<property
name=
"proportion"
>
1
</property>
<object
class=
"wxScrolledWindow"
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=
"hidden"
>
0
</property>
<property
name=
"id"
>
wxID_ANY
</property>
<property
name=
"maximum_size"
></property>
<property
name=
"minimum_size"
></property>
<property
name=
"name"
>
m_LayerScrolledWindow
</property>
<property
name=
"permission"
>
protected
</property>
<property
name=
"pos"
></property>
<property
name=
"scroll_rate_x"
>
5
</property>
<property
name=
"scroll_rate_y"
>
5
</property>
<property
name=
"size"
></property>
<property
name=
"subclass"
>
;
</property>
<property
name=
"tooltip"
></property>
<property
name=
"window_extra_style"
></property>
<property
name=
"window_name"
></property>
<property
name=
"window_style"
>
wxNO_BORDER
</property>
<event
name=
"OnChar"
></event>
<event
name=
"OnEnterWindow"
></event>
<event
name=
"OnEraseBackground"
></event>
<event
name=
"OnKeyDown"
></event>
<event
name=
"OnKeyUp"
></event>
<event
name=
"OnKillFocus"
></event>
<event
name=
"OnLeaveWindow"
></event>
<event
name=
"OnLeftDClick"
></event>
<event
name=
"OnLeftDown"
>
OnLeftDownLayers
</event>
<event
name=
"OnLeftUp"
></event>
<event
name=
"OnMiddleDClick"
></event>
<event
name=
"OnMiddleDown"
></event>
<event
name=
"OnMiddleUp"
></event>
<event
name=
"OnMotion"
></event>
<event
name=
"OnMouseEvents"
></event>
<event
name=
"OnMouseWheel"
></event>
<event
name=
"OnPaint"
></event>
<event
name=
"OnRightDClick"
></event>
<event
name=
"OnRightDown"
>
OnRightDownLayers
</event>
<event
name=
"OnRightUp"
></event>
<event
name=
"OnSetFocus"
></event>
<event
name=
"OnSize"
></event>
<event
name=
"OnUpdateUI"
></event>
<object
class=
"wxFlexGridSizer"
expanded=
"1"
>
<property
name=
"cols"
>
4
</property>
<property
name=
"flexible_direction"
>
wxHORIZONTAL
</property>
<property
name=
"growablecols"
></property>
<property
name=
"growablerows"
></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"
>
0
</property>
</object>
</object>
</object>
</object>
</object>
</object>
<object
class=
"notebookpage"
expanded=
"1"
>
<property
name=
"bitmap"
>
; Load From File
</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"
>
,90,90,10,70,0
</property>
<property
name=
"hidden"
>
0
</property>
<property
name=
"id"
>
wxID_ANY
</property>
<property
name=
"maximum_size"
></property>
<property
name=
"minimum_size"
></property>
<property
name=
"name"
>
m_RenderingPanel
</property>
<property
name=
"permission"
>
protected
</property>
<property
name=
"pos"
></property>
<property
name=
"size"
></property>
<property
name=
"subclass"
></property>
<property
name=
"tooltip"
></property>
<property
name=
"window_extra_style"
></property>
<property
name=
"window_name"
></property>
<property
name=
"window_style"
>
wxTAB_TRAVERSAL
</property>
<event
name=
"OnChar"
></event>
<event
name=
"OnEnterWindow"
></event>
<event
name=
"OnEraseBackground"
></event>
<event
name=
"OnKeyDown"
></event>
<event
name=
"OnKeyUp"
></event>
<event
name=
"OnKillFocus"
></event>
<event
name=
"OnLeaveWindow"
></event>
<event
name=
"OnLeftDClick"
></event>
<event
name=
"OnLeftDown"
></event>
<event
name=
"OnLeftUp"
></event>
<event
name=
"OnMiddleDClick"
></event>
<event
name=
"OnMiddleDown"
></event>
<event
name=
"OnMiddleUp"
></event>
<event
name=
"OnMotion"
></event>
<event
name=
"OnMouseEvents"
></event>
<event
name=
"OnMouseWheel"
></event>
<event
name=
"OnPaint"
></event>
<event
name=
"OnRightDClick"
></event>
<event
name=
"OnRightDown"
></event>
<event
name=
"OnRightUp"
></event>
<event
name=
"OnSetFocus"
></event>
<event
name=
"OnSize"
></event>
<event
name=
"OnUpdateUI"
></event>
<object
class=
"wxBoxSizer"
expanded=
"1"
>
<property
name=
"minimum_size"
></property>
<property
name=
"name"
>
bSizer4
</property>
<property
name=
"orient"
>
wxVERTICAL
</property>
<property
name=
"permission"
>
none
</property>
<object
class=
"sizeritem"
expanded=
"1"
>
<property
name=
"border"
>
5
</property>
<property
name=
"flag"
>
wxALL|wxEXPAND
</property>
<property
name=
"proportion"
>
1
</property>
<object
class=
"wxScrolledWindow"
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=
"hidden"
>
0
</property>
<property
name=
"id"
>
wxID_ANY
</property>
<property
name=
"maximum_size"
></property>
<property
name=
"minimum_size"
></property>
<property
name=
"name"
>
m_RenderScrolledWindow
</property>
<property
name=
"permission"
>
protected
</property>
<property
name=
"pos"
></property>
<property
name=
"scroll_rate_x"
>
5
</property>
<property
name=
"scroll_rate_y"
>
5
</property>
<property
name=
"size"
></property>
<property
name=
"subclass"
></property>
<property
name=
"tooltip"
></property>
<property
name=
"window_extra_style"
></property>
<property
name=
"window_name"
></property>
<property
name=
"window_style"
>
wxNO_BORDER
</property>
<event
name=
"OnChar"
></event>
<event
name=
"OnEnterWindow"
></event>
<event
name=
"OnEraseBackground"
></event>
<event
name=
"OnKeyDown"
></event>
<event
name=
"OnKeyUp"
></event>
<event
name=
"OnKillFocus"
></event>
<event
name=
"OnLeaveWindow"
></event>
<event
name=
"OnLeftDClick"
></event>
<event
name=
"OnLeftDown"
></event>
<event
name=
"OnLeftUp"
></event>
<event
name=
"OnMiddleDClick"
></event>
<event
name=
"OnMiddleDown"
></event>
<event
name=
"OnMiddleUp"
></event>
<event
name=
"OnMotion"
></event>
<event
name=
"OnMouseEvents"
></event>
<event
name=
"OnMouseWheel"
></event>
<event
name=
"OnPaint"
></event>
<event
name=
"OnRightDClick"
></event>
<event
name=
"OnRightDown"
></event>
<event
name=
"OnRightUp"
></event>
<event
name=
"OnSetFocus"
></event>
<event
name=
"OnSize"
></event>
<event
name=
"OnUpdateUI"
></event>
<object
class=
"wxFlexGridSizer"
expanded=
"1"
>
<property
name=
"cols"
>
2
</property>
<property
name=
"flexible_direction"
>
wxHORIZONTAL
</property>
<property
name=
"growablecols"
></property>
<property
name=
"growablerows"
></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"
>
0
</property>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</wxFormBuilder_Project>
pcbnew/pcbframe.cpp
View file @
6518139b
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2004-2010 Jean-Pierre Charras, jean-pierre.charras@gpisa-lab.inpg.fr
* Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2010 Kicad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/******************************************/
/* pcbframe.cpp - PCB editor main window. */
/******************************************/
...
...
@@ -17,9 +43,374 @@
#include "drc_stuff.h"
#include "3d_viewer.h"
#include "kbool/include/kbool/booleng.h"
#include "layer_widget.h"
#include "dialog_design_rules.h"
/**
* Class PCB_LAYER_WIDGET
* is here to implement the abtract functions of LAYER_WIDGET so they
* may be tied into the WinEDA_PcbFrame's data and so we can add a popup
* menu which is specific to PCBNEW's needs.
*/
class
PCB_LAYER_WIDGET
:
public
LAYER_WIDGET
{
WinEDA_PcbFrame
*
myframe
;
// popup menu ids.
#define ID_SHOW_ALL_COPPERS wxID_HIGHEST
#define ID_SHOW_NO_COPPERS (wxID_HIGHEST+1)
/**
* Function OnRightDownLayers
* puts up a popup menu for the layer panel.
*/
void
onRightDownLayers
(
wxMouseEvent
&
event
);
void
onPopupSelection
(
wxCommandEvent
&
event
);
/// this is for the popup menu, the right click handler has to be installed
/// on every child control within the layer panel.
void
installRightLayerClickHandler
();
public
:
/**
* Constructor
* @param aPointSize is the font point size to use within the widget. This
* effectively sets the overal size of the widget via the row height and bitmap
* button sizes.
*/
PCB_LAYER_WIDGET
(
WinEDA_PcbFrame
*
aParent
,
wxWindow
*
aFocusOwner
,
int
aPointSize
=
10
);
void
ReFill
();
//-----<implement LAYER_WIDGET abstract callback functions>-----------
void
OnLayerColorChange
(
int
aLayer
,
int
aColor
);
bool
OnLayerSelect
(
int
aLayer
);
void
OnLayerVisible
(
int
aLayer
,
bool
isVisible
,
bool
isFinal
);
void
OnRenderColorChange
(
int
aId
,
int
aColor
);
void
OnRenderEnable
(
int
aId
,
bool
isEnabled
);
//-----</implement LAYER_WIDGET abstract callback functions>----------
};
PCB_LAYER_WIDGET
::
PCB_LAYER_WIDGET
(
WinEDA_PcbFrame
*
aParent
,
wxWindow
*
aFocusOwner
,
int
aPointSize
)
:
LAYER_WIDGET
(
aParent
,
aFocusOwner
,
aPointSize
),
myframe
(
aParent
)
{
BOARD
*
board
=
myframe
->
GetBoard
();
// Fixed "Rendering" tab rows within the LAYER_WIDGET, only the initial color
// is changed before appending to the LAYER_WIDGET. This is an automatic variable
// not a static variable, change the color & state after copying from code to renderRows
// on the stack.
LAYER_WIDGET
::
ROW
renderRows
[
14
]
=
{
#define RR LAYER_WIDGET::ROW // Render Row abreviation to reduce source width
// text id color tooltip checked
RR
(
_
(
"Through Via"
),
VIAS_VISIBLE
,
WHITE
,
_
(
"Show through vias"
)
),
RR
(
_
(
"Bl/Buried Via"
),
VIA_MICROVIA_VISIBLE
,
WHITE
,
_
(
"Show blind or buried vias"
)
),
RR
(
_
(
"Micro Via"
),
VIA_BBLIND_VISIBLE
,
WHITE
,
_
(
"Show micro vias"
)
),
RR
(
_
(
"Ratsnest"
),
RATSNEST_VISIBLE
,
WHITE
,
_
(
"Show unconnected nets as a ratsnest"
)
),
RR
(
_
(
"Pads Front"
),
PAD_FR_VISIBLE
,
WHITE
,
_
(
"Show footprint pads on board's front"
)
),
RR
(
_
(
"Pads Back"
),
PAD_BK_VISIBLE
,
WHITE
,
_
(
"Show footprint pads on board's back"
)
),
RR
(
_
(
"Text Front"
),
MOD_TEXT_FR_VISIBLE
,
WHITE
,
_
(
"Show footprint text on board's back"
)
),
RR
(
_
(
"Text Back"
),
MOD_TEXT_BK_VISIBLE
,
WHITE
,
_
(
"Show footprint text on board's back"
)
),
RR
(
_
(
"Hidden Text"
),
MOD_TEXT_INVISIBLE
,
WHITE
,
_
(
"Show footprint text marked as invisible"
)
),
RR
(
_
(
"Anchors"
),
ANCHOR_VISIBLE
,
WHITE
,
_
(
"Show footprint and text origins as a cross"
)
),
RR
(
_
(
"Grid"
),
GRID_VISIBLE
,
WHITE
,
_
(
"Show the (x,y) grid dots"
)
),
RR
(
_
(
"No-Connects"
),
NO_CONNECTS_VISIBLE
,
-
1
,
_
(
"Show a marker on pads which have no net connected"
)
),
RR
(
_
(
"Modules Front"
),
MOD_FR_VISIBLE
,
-
1
,
_
(
"Show footprints that are on board's front"
)
),
RR
(
_
(
"Modules Back"
),
MOD_BK_VISIBLE
,
-
1
,
_
(
"Show footprints that are on board's back"
)
),
};
for
(
unsigned
row
=
0
;
row
<
DIM
(
renderRows
);
++
row
)
{
if
(
renderRows
[
row
].
color
!=
-
1
)
// does this row show a color?
{
// this window frame must have an established BOARD, i.e. after SetBoard()
renderRows
[
row
].
color
=
board
->
GetVisibleElementColor
(
renderRows
[
row
].
id
);
}
// @todo
// renderRows[row].state = GetBoard()->IsElementVisible( renderRows[row].id );
}
AppendRenderRows
(
renderRows
,
DIM
(
renderRows
)
);
//-----<Popup menu>-------------------------------------------------
// handle the popup menu over the layer window.
m_LayerScrolledWindow
->
Connect
(
wxEVT_RIGHT_DOWN
,
wxMouseEventHandler
(
PCB_LAYER_WIDGET
::
onRightDownLayers
),
NULL
,
this
);
// since Popupmenu() calls this->ProcessEvent() we must call this->Connect()
// and not m_LayerScrolledWindow->Connect()
Connect
(
ID_SHOW_ALL_COPPERS
,
ID_SHOW_NO_COPPERS
,
wxEVT_COMMAND_MENU_SELECTED
,
wxCommandEventHandler
(
PCB_LAYER_WIDGET
::
onPopupSelection
),
NULL
,
this
);
// install the right click handler into each control at end of ReFill()
// using installRightLayerClickHandler
}
void
PCB_LAYER_WIDGET
::
installRightLayerClickHandler
()
{
int
rowCount
=
GetLayerRowCount
();
for
(
int
row
=
0
;
row
<
rowCount
;
++
row
)
{
for
(
int
col
=
0
;
col
<
LYR_COLUMN_COUNT
;
++
col
)
{
wxWindow
*
w
=
getLayerComp
(
row
*
LYR_COLUMN_COUNT
+
col
);
w
->
Connect
(
wxEVT_RIGHT_DOWN
,
wxMouseEventHandler
(
PCB_LAYER_WIDGET
::
onRightDownLayers
),
NULL
,
this
);
}
}
}
void
PCB_LAYER_WIDGET
::
onRightDownLayers
(
wxMouseEvent
&
event
)
{
wxMenu
menu
;
// menu text is capitalized:
// http://library.gnome.org/devel/hig-book/2.20/design-text-labels.html.en#layout-capitalization
menu
.
Append
(
new
wxMenuItem
(
&
menu
,
ID_SHOW_ALL_COPPERS
,
_
(
"Show All Cu"
)
)
);
menu
.
Append
(
new
wxMenuItem
(
&
menu
,
ID_SHOW_NO_COPPERS
,
_
(
"Hide All Cu"
)
)
);
PopupMenu
(
&
menu
);
passOnFocus
();
}
void
PCB_LAYER_WIDGET
::
onPopupSelection
(
wxCommandEvent
&
event
)
{
int
rowCount
;
int
menuId
=
event
.
GetId
();
bool
visible
;
switch
(
menuId
)
{
case
ID_SHOW_ALL_COPPERS
:
visible
=
true
;
goto
L_change_coppers
;
case
ID_SHOW_NO_COPPERS
:
visible
=
false
;
L_change_coppers
:
int
lastCu
=
-
1
;
rowCount
=
GetLayerRowCount
();
for
(
int
row
=
rowCount
-
1
;
row
>=
0
;
--
row
)
{
wxCheckBox
*
cb
=
(
wxCheckBox
*
)
getLayerComp
(
row
*
LYR_COLUMN_COUNT
+
3
);
int
layer
=
getDecodedId
(
cb
->
GetId
()
);
if
(
IsValidCopperLayerIndex
(
layer
)
)
{
lastCu
=
row
;
break
;
}
}
for
(
int
row
=
0
;
row
<
rowCount
;
++
row
)
{
wxCheckBox
*
cb
=
(
wxCheckBox
*
)
getLayerComp
(
row
*
LYR_COLUMN_COUNT
+
3
);
int
layer
=
getDecodedId
(
cb
->
GetId
()
);
if
(
IsValidCopperLayerIndex
(
layer
)
)
{
cb
->
SetValue
(
visible
);
bool
isLastCopperLayer
=
(
row
==
lastCu
);
OnLayerVisible
(
layer
,
visible
,
isLastCopperLayer
);
if
(
isLastCopperLayer
)
break
;
}
}
break
;
}
}
void
PCB_LAYER_WIDGET
::
ReFill
()
{
BOARD
*
brd
=
myframe
->
GetBoard
();
int
layer
;
int
enabledLayers
=
brd
->
GetEnabledLayers
();
// m_Layers->Freeze(); // no screen updates until done modifying
ClearLayerRows
();
// show all coppers first, with front on top, back on bottom, then technical layers
layer
=
LAYER_N_FRONT
;
if
(
enabledLayers
&
(
1
<<
layer
)
)
{
AppendLayerRow
(
LAYER_WIDGET
::
ROW
(
brd
->
GetLayerName
(
layer
),
layer
,
brd
->
GetLayerColor
(
layer
),
_
(
"Front copper layer"
),
true
)
);
}
for
(
layer
=
LAYER_N_FRONT
-
1
;
layer
>=
1
;
--
layer
)
{
if
(
enabledLayers
&
(
1
<<
layer
)
)
{
AppendLayerRow
(
LAYER_WIDGET
::
ROW
(
brd
->
GetLayerName
(
layer
),
layer
,
brd
->
GetLayerColor
(
layer
),
_
(
"An innner copper layer"
),
true
)
);
}
}
layer
=
LAYER_N_BACK
;
if
(
enabledLayers
&
(
1
<<
layer
)
)
{
AppendLayerRow
(
LAYER_WIDGET
::
ROW
(
brd
->
GetLayerName
(
layer
),
layer
,
brd
->
GetLayerColor
(
layer
),
_
(
"Back copper layer"
),
true
)
);
}
// technical layers are shown in this order:
static
const
struct
{
int
layerId
;
wxString
tooltip
;
}
techLayerSeq
[]
=
{
{
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"
)},
{
SOLDERPASTE_N_BACK
,
_
(
"Solder paste on board's back"
)
},
{
SILKSCREEN_N_FRONT
,
_
(
"Silkscreen on board's front"
)
},
{
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"
)
},
};
for
(
unsigned
i
=
0
;
i
<
DIM
(
techLayerSeq
);
++
i
)
{
layer
=
techLayerSeq
[
i
].
layerId
;
if
(
!
(
enabledLayers
&
(
1
<<
layer
))
)
continue
;
AppendLayerRow
(
LAYER_WIDGET
::
ROW
(
brd
->
GetLayerName
(
layer
),
layer
,
brd
->
GetLayerColor
(
layer
),
techLayerSeq
[
i
].
tooltip
,
true
)
);
}
installRightLayerClickHandler
();
// m_Layers->Thaw();
}
//-----<LAYER_WIDGET callbacks>-------------------------------------------
void
PCB_LAYER_WIDGET
::
OnLayerColorChange
(
int
aLayer
,
int
aColor
)
{
myframe
->
GetBoard
()
->
SetLayerColor
(
aLayer
,
aColor
);
myframe
->
DrawPanel
->
Refresh
();
}
bool
PCB_LAYER_WIDGET
::
OnLayerSelect
(
int
aLayer
)
{
// the layer change from the PCB_LAYER_WIDGET can be denied by returning
// false from this function.
myframe
->
setActiveLayer
(
aLayer
,
false
);
myframe
->
syncLayerBox
();
return
true
;
}
void
PCB_LAYER_WIDGET
::
OnLayerVisible
(
int
aLayer
,
bool
isVisible
,
bool
isFinal
)
{
BOARD
*
brd
=
myframe
->
GetBoard
();
int
visibleLayers
=
brd
->
GetVisibleLayers
();
if
(
isVisible
)
visibleLayers
|=
(
1
<<
aLayer
);
else
visibleLayers
&=
~
(
1
<<
aLayer
);
brd
->
SetVisibleLayers
(
visibleLayers
);
if
(
isFinal
)
myframe
->
DrawPanel
->
Refresh
();
}
void
PCB_LAYER_WIDGET
::
OnRenderColorChange
(
int
aId
,
int
aColor
)
{
myframe
->
GetBoard
()
->
SetVisibleElementColor
(
aId
,
aColor
);
myframe
->
DrawPanel
->
Refresh
();
}
void
PCB_LAYER_WIDGET
::
OnRenderEnable
(
int
aId
,
bool
isEnabled
)
{
BOARD
*
brd
=
myframe
->
GetBoard
();
/* @todo:
1) move:
RATSNEST_VISIBLE,
GRID_VISIBLE, ? maybe not this one
NO_CONNECTS_VISIBLE,
MOD_FR_VISIBLE,
MOD_BK_VISIBLE,
into m_VisibleElements and get rid of globals.
2) Add IsElementVisible() & SetVisibleElement() to class BOARD
*/
switch
(
aId
)
{
// see todo above, don't really want anything except IsElementVisible() here.
case
GRID_VISIBLE
:
myframe
->
m_Draw_Grid
=
isEnabled
;
break
;
case
MOD_FR_VISIBLE
:
DisplayOpt
.
Show_Modules_Cmp
=
isEnabled
;
break
;
case
MOD_BK_VISIBLE
:
DisplayOpt
.
Show_Modules_Cu
=
isEnabled
;
break
;
default
:
int
visibleElements
=
brd
->
GetVisibleElements
();
if
(
isEnabled
)
visibleElements
|=
(
1
<<
aId
);
else
visibleElements
&=
~
(
1
<<
aId
);
brd
->
SetVisibleElements
(
visibleElements
);
}
myframe
->
DrawPanel
->
Refresh
();
}
//-----</LAYER_WIDGET callbacks>------------------------------------------
// Keys used in read/write config
#define PCB_MAGNETIC_PADS_OPT wxT( "PcbMagPadOpt" )
#define PCB_MAGNETIC_TRACKS_OPT wxT( "PcbMagTrackOpt" )
...
...
@@ -228,10 +619,21 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
m_show_microwave_tools
=
false
;
m_show_layer_manager_tools
=
true
;
m_Layers
=
new
LYRS
(
this
,
DrawPanel
);
SetBoard
(
new
BOARD
(
NULL
,
this
)
);
// Create the PCB_LAYER_WIDGET *after* SetBoard():
wxFont
font
=
wxSystemSettings
::
GetFont
(
wxSYS_DEFAULT_GUI_FONT
);
int
pointSize
=
font
.
GetPointSize
();
int
screenHeight
=
wxSystemSettings
::
GetMetric
(
wxSYS_SCREEN_Y
);
// printf( "pointSize:%d 80%%:%d\n", pointSize, (pointSize*8)/10 );
if
(
screenHeight
<=
900
)
pointSize
=
(
pointSize
*
8
)
/
10
;
m_Layers
=
new
PCB_LAYER_WIDGET
(
this
,
DrawPanel
,
pointSize
);
m_TrackAndViasSizesList_Changed
=
true
;
m_drc
=
new
DRC
(
this
);
// these 2 objects point to each other
...
...
@@ -265,47 +667,6 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
ReCreateAuxVToolbar
();
// Fixed "Rendering" tab rows within the LAYER_WIDGET, only the initial color
// is changed before appending to the LAYER_WIDGET. This is an automatic variable
// not a static variable, change the color & state after copying from code to renderRows
// on the stack.
LAYER_WIDGET
::
ROW
renderRows
[
14
]
=
{
#define RR LAYER_WIDGET::ROW // Render Row abreviation to reduce source width
// text id color tooltip checked
RR
(
_
(
"Through Via"
),
VIAS_VISIBLE
,
WHITE
,
_
(
"Show through vias"
)
),
RR
(
_
(
"Bl/Buried Via"
),
VIA_MICROVIA_VISIBLE
,
WHITE
,
_
(
"Show blind or buried vias"
)
),
RR
(
_
(
"Micro Via"
),
VIA_BBLIND_VISIBLE
,
WHITE
,
_
(
"Show micro vias"
)
),
RR
(
_
(
"Ratsnest"
),
RATSNEST_VISIBLE
,
WHITE
,
_
(
"Show unconnected nets as a ratsnest"
)
),
RR
(
_
(
"Pads Front"
),
PAD_FR_VISIBLE
,
WHITE
,
_
(
"Show footprint pads on board's front"
)
),
RR
(
_
(
"Pads Back"
),
PAD_BK_VISIBLE
,
WHITE
,
_
(
"Show footprint pads on board's back"
)
),
RR
(
_
(
"Text Front"
),
MOD_TEXT_FR_VISIBLE
,
WHITE
,
_
(
"Show footprint text on board's back"
)
),
RR
(
_
(
"Text Back"
),
MOD_TEXT_BK_VISIBLE
,
WHITE
,
_
(
"Show footprint text on board's back"
)
),
RR
(
_
(
"Hidden Text"
),
MOD_TEXT_INVISIBLE
,
WHITE
,
_
(
"Show footprint text marked as invisible"
)
),
RR
(
_
(
"Anchors"
),
ANCHOR_VISIBLE
,
WHITE
,
_
(
"Show footprint and text origins as a cross"
)
),
RR
(
_
(
"Grid"
),
GRID_VISIBLE
,
WHITE
,
_
(
"Show the (x,y) grid dots"
)
),
RR
(
_
(
"No-Connects"
),
NO_CONNECTS_VISIBLE
,
-
1
,
_
(
"Show a marker on pads which have no net connected"
)
),
RR
(
_
(
"Modules Front"
),
MOD_FR_VISIBLE
,
-
1
,
_
(
"Show footprints that are on board's front"
)
),
RR
(
_
(
"Modules Back"
),
MOD_BK_VISIBLE
,
-
1
,
_
(
"Show footprints that are on board's back"
)
),
};
for
(
unsigned
row
=
0
;
row
<
DIM
(
renderRows
);
++
row
)
{
if
(
renderRows
[
row
].
color
!=
-
1
)
// does this row show a color?
{
// this window frame must have an established BOARD, i.e. after SetBoard()
renderRows
[
row
].
color
=
GetBoard
()
->
GetVisibleElementColor
(
renderRows
[
row
].
id
);
}
// @todo
// renderRows[row].state = GetBoard()->IsElementVisible( renderRows[row].id );
}
m_Layers
->
AppendRenderRows
(
renderRows
,
DIM
(
renderRows
)
);
#if defined(KICAD_AUIMANAGER)
m_auimgr
.
SetManagedWindow
(
this
);
...
...
@@ -373,7 +734,9 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
m_AuxVToolBar
->
Show
(
m_show_microwave_tools
);
#endif
ReFillLayerWidget
();
// this is near end because contents establishes size
ReFillLayerWidget
();
// this is near end because contents establish size
syncLayerWidget
();
}
...
...
@@ -385,179 +748,9 @@ WinEDA_PcbFrame::~WinEDA_PcbFrame()
delete
m_drc
;
}
//-----<LAYER_WIDGET callbacks>-------------------------------------------
void
WinEDA_PcbFrame
::
LYRS
::
OnLayerColorChange
(
int
aLayer
,
int
aColor
)
{
myframe
->
GetBoard
()
->
SetLayerColor
(
aLayer
,
aColor
);
myframe
->
DrawPanel
->
Refresh
();
}
bool
WinEDA_PcbFrame
::
LYRS
::
OnLayerSelect
(
int
aLayer
)
{
// @todo
return
true
;
}
void
WinEDA_PcbFrame
::
LYRS
::
OnLayerVisible
(
int
aLayer
,
bool
isVisible
,
bool
isFinal
)
{
BOARD
*
brd
=
myframe
->
GetBoard
();
int
visibleLayers
=
brd
->
GetVisibleLayers
();
if
(
isVisible
)
visibleLayers
|=
(
1
<<
aLayer
);
else
visibleLayers
&=
~
(
1
<<
aLayer
);
brd
->
SetVisibleLayers
(
visibleLayers
);
if
(
isFinal
)
myframe
->
DrawPanel
->
Refresh
();
}
void
WinEDA_PcbFrame
::
LYRS
::
OnRenderColorChange
(
int
aId
,
int
aColor
)
{
myframe
->
GetBoard
()
->
SetVisibleElementColor
(
aId
,
aColor
);
myframe
->
DrawPanel
->
Refresh
();
}
void
WinEDA_PcbFrame
::
LYRS
::
OnRenderEnable
(
int
aId
,
bool
isEnabled
)
{
BOARD
*
brd
=
myframe
->
GetBoard
();
/* @todo:
1) move:
RATSNEST_VISIBLE,
GRID_VISIBLE, ? maybe not this one
NO_CONNECTS_VISIBLE,
MOD_FR_VISIBLE,
MOD_BK_VISIBLE,
into m_VisibleElements and get rid of globals.
2) Add IsElementVisible() & SetVisibleElement() to class BOARD
*/
switch
(
aId
)
{
// see todo above, don't really want anything except IsElementVisible() here.
case
GRID_VISIBLE
:
myframe
->
m_Draw_Grid
=
isEnabled
;
break
;
case
MOD_FR_VISIBLE
:
DisplayOpt
.
Show_Modules_Cmp
=
isEnabled
;
break
;
case
MOD_BK_VISIBLE
:
DisplayOpt
.
Show_Modules_Cu
=
isEnabled
;
break
;
default
:
int
visibleElements
=
brd
->
GetVisibleElements
();
if
(
isEnabled
)
visibleElements
|=
(
1
<<
aId
);
else
visibleElements
&=
~
(
1
<<
aId
);
brd
->
SetVisibleElements
(
visibleElements
);
}
myframe
->
DrawPanel
->
Refresh
();
}
//-----</LAYER_WIDGET callbacks>------------------------------------------
void
WinEDA_PcbFrame
::
ReFillLayerWidget
()
{
BOARD
*
brd
=
GetBoard
();
int
layer
;
int
enabledLayers
=
brd
->
GetEnabledLayers
();
// m_Layers->Freeze(); // no screen updates until done modifying
m_Layers
->
ClearLayerRows
();
// show all coppers first, with front on top, back on bottom, then technical layers
layer
=
LAYER_N_FRONT
;
if
(
enabledLayers
&
(
1
<<
layer
)
)
{
m_Layers
->
AppendLayerRow
(
LAYER_WIDGET
::
ROW
(
brd
->
GetLayerName
(
layer
),
layer
,
brd
->
GetLayerColor
(
layer
),
_
(
"Front copper layer"
),
true
)
);
}
for
(
layer
=
LAYER_N_FRONT
-
1
;
layer
>=
1
;
--
layer
)
{
if
(
enabledLayers
&
(
1
<<
layer
)
)
{
m_Layers
->
AppendLayerRow
(
LAYER_WIDGET
::
ROW
(
brd
->
GetLayerName
(
layer
),
layer
,
brd
->
GetLayerColor
(
layer
),
_
(
"An innner copper layer"
),
true
)
);
}
}
layer
=
LAYER_N_BACK
;
if
(
enabledLayers
&
(
1
<<
layer
)
)
{
m_Layers
->
AppendLayerRow
(
LAYER_WIDGET
::
ROW
(
brd
->
GetLayerName
(
layer
),
layer
,
brd
->
GetLayerColor
(
layer
),
_
(
"Back copper layer"
),
true
)
);
}
m_Layers
->
SelectLayer
(
LAYER_N_FRONT
);
// technical layers are shown in this order:
static
const
struct
{
int
layerId
;
wxString
tooltip
;
}
techLayerSeq
[]
=
{
/* some layers are not visible nor editable, don't show them for now:
* >> In fact they are useful here because we must be able to change
* the color and visibility because they can be visible.
* slikscreen and adhesive layers are visible (adhesive layer is rarely used)
* Solder mask and solder paste (used for pads) are visible in *Hight Color*
* mode when they are selected
* they are now editable because Pcbnew handle parameters (global and local)
* to calculate pads shapes on these layers
*/
{
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"
)
},
{
SOLDERPASTE_N_BACK
,
_
(
"Solder paste on board's back"
)
},
{
SILKSCREEN_N_FRONT
,
_
(
"Silkscreen on board's front"
)
},
{
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"
)
},
};
for
(
unsigned
i
=
0
;
i
<
DIM
(
techLayerSeq
);
++
i
)
{
layer
=
techLayerSeq
[
i
].
layerId
;
if
(
!
(
enabledLayers
&
(
1
<<
layer
))
)
continue
;
m_Layers
->
AppendLayerRow
(
LAYER_WIDGET
::
ROW
(
brd
->
GetLayerName
(
layer
),
layer
,
brd
->
GetLayerColor
(
layer
),
techLayerSeq
[
i
].
tooltip
,
true
)
);
}
// m_Layers->Thaw();
m_Layers
->
ReFill
();
wxAuiPaneInfo
&
lyrs
=
m_auimgr
.
GetPane
(
m_Layers
);
...
...
@@ -688,15 +881,8 @@ void WinEDA_PcbFrame::SaveSettings()
}
/** Function SynchronizeLayersManager( )
* Must be called when info displayed in the layer manager Toolbar
* as been changed in the main window ( by hotkey or a tool option.
* Mainly when the active layer as changed.
* @param aFlag = flag giving the type of data (layers, checkboxes...)
*/
void
WinEDA_PcbFrame
::
SynchronizeLayersManager
(
int
aFlag
)
void
WinEDA_PcbFrame
::
syncLayerWidget
()
{
// Ensure Layer manager synchronization for the active layer
if
(
(
aFlag
&
1
)
)
m_Layers
->
SelectLayer
(
GetScreen
()
->
m_Active_Layer
);
m_Layers
->
SelectLayer
(
getActiveLayer
()
);
}
pcbnew/tool_pcb.cpp
View file @
6518139b
...
...
@@ -68,7 +68,7 @@ void WinEDA_PcbFrame::PrepareLayerIndicator()
previous_Route_Layer_BOTTOM_color
,
previous_via_color
;
/* get colors, and redraw bitmap button only on changes */
active_layer_color
=
g_DesignSettings
.
m_LayerColor
[
((
PCB_SCREEN
*
)
GetScreen
())
->
m_Active_Layer
];
active_layer_color
=
g_DesignSettings
.
m_LayerColor
[
getActiveLayer
()
];
if
(
previous_active_layer_color
!=
active_layer_color
)
{
previous_active_layer_color
=
active_layer_color
;
...
...
@@ -386,13 +386,13 @@ void WinEDA_PcbFrame::ReCreateOptToolbar()
g_DesignSettings
.
IsElementVisible
(
MOD_TEXT_INVISIBLE
));
m_OptionsToolBar
->
AddSeparator
();
m_OptionsToolBar
->
AddTool
(
ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR
,
wxEmptyString
,
wxBitmap
(
layers_manager_xpm
),
_
(
"Show/hide the layers manager toolbar"
),
wxITEM_CHECK
);
m_OptionsToolBar
->
AddTool
(
ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1
,
m_OptionsToolBar
->
AddTool
(
ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR
,
wxEmptyString
,
wxBitmap
(
layers_manager_xpm
),
_
(
"Show/hide the layers manager toolbar"
),
wxITEM_CHECK
);
m_OptionsToolBar
->
AddTool
(
ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1
,
wxEmptyString
,
wxBitmap
(
mw_toolbar_xpm
),
_
(
"Show/hide the toolbar for microwaves tools
\n
This is a experimental feature (under development)"
),
...
...
@@ -664,20 +664,22 @@ an existing track use its width\notherwise, use current width setting" ),
}
void
WinEDA_PcbFrame
::
UpdateToolbarLayerInfo
()
void
WinEDA_PcbFrame
::
syncLayerBox
()
{
wxASSERT
(
m_SelLayerBox
);
// Enable the display on the correct layer
// To avoid reentrancy ( Bug wxGTK Linux version? ), the selection is
// made
where it is bad
( corrected on wxGTK 2.6.0 )
int
count
=
m_SelLayerBox
->
GetCount
();
// made
only if it needs changing
( corrected on wxGTK 2.6.0 )
int
count
=
m_SelLayerBox
->
GetCount
();
int
choice
=
m_SelLayerBox
->
GetChoice
();
int
layer
=
GetScreen
()
->
m_Active_Layer
;
int
layer
=
getActiveLayer
()
;
for
(
int
listNdx
=
0
;
listNdx
<
count
;
++
listNdx
)
{
if
(
(
int
)
(
size_t
)
m_SelLayerBox
->
GetClientData
(
listNdx
)
==
layer
)
int
clientData
=
(
int
)
(
size_t
)
m_SelLayerBox
->
GetClientData
(
listNdx
);
if
(
clientData
==
layer
)
{
if
(
listNdx
!=
choice
)
m_SelLayerBox
->
SetSelection
(
listNdx
);
...
...
@@ -748,11 +750,11 @@ WinEDAChoiceBox* WinEDA_PcbFrame::ReCreateLayerBox( WinEDA_Toolbar* parent )
wxString
msg
=
GetBoard
()
->
GetLayerName
(
layer
);
msg
=
AddHotkeyName
(
msg
,
s_Board_Editor_Hokeys_Descr
,
HK_SwitchLayer
[
layer
]
);
/* we are using tabs in AddHotkeyName message.
* this is not handled by m_SelLayerBox.
* so we replace them by 3 spaces
*/
/* we are using tabs in AddHotkeyName message.
* this is not handled by m_SelLayerBox.
* so we replace them by 3 spaces
*/
msg
.
Replace
(
wxT
(
"
\t
"
),
wxT
(
" "
)
);
m_SelLayerBox
->
Append
(
msg
);
...
...
@@ -766,7 +768,7 @@ WinEDAChoiceBox* WinEDA_PcbFrame::ReCreateLayerBox( WinEDA_Toolbar* parent )
m_SelLayerBox
->
SetToolTip
(
_
(
"+/- to switch"
)
);
UpdateToolbarLayerInfo
();
syncLayerBox
();
return
m_SelLayerBox
;
}
pcbnew/toolbars_update_user_interface.cpp
View file @
6518139b
...
...
@@ -285,7 +285,8 @@ void WinEDA_PcbFrame::SetToolbars()
if
(
m_AuxiliaryToolBar
)
AuxiliaryToolBar_Update_UI
();
UpdateToolbarLayerInfo
();
syncLayerBox
();
PrepareLayerIndicator
();
DisplayUnitsMsg
();
#if defined(KICAD_AUIMANAGER)
...
...
pcbnew/zones_by_polygon.cpp
View file @
6518139b
...
...
@@ -500,7 +500,7 @@ int WinEDA_PcbFrame::Begin_Zone( wxDC* DC )
{
int
diag
;
// Init zone params to reasonnable values
zone
->
SetLayer
(
GetScreen
()
->
m_Active_Layer
);
zone
->
SetLayer
(
getActiveLayer
()
);
// Prompt user for parameters:
DrawPanel
->
m_IgnoreMouseEvents
=
TRUE
;
...
...
@@ -535,12 +535,12 @@ int WinEDA_PcbFrame::Begin_Zone( wxDC* DC )
return
0
;
// Switch active layer to the selectec zonz layer
GetScreen
()
->
m_Active_Layer
=
g_Zone_Default_Setting
.
m_CurrentZone_Layer
;
setActiveLayer
(
g_Zone_Default_Setting
.
m_CurrentZone_Layer
)
;
}
else
// Start a new contour: init zone params (net and layer) from an existing zone (add cutout or similar zone)
{
(
(
PCB_SCREEN
*
)
GetScreen
()
)
->
m_Active_Layer
=
g_Zone_Default_Setting
.
m_CurrentZone_Layer
=
s_CurrentZone
->
GetLayer
(
);
g_Zone_Default_Setting
.
m_CurrentZone_Layer
=
s_CurrentZone
->
GetLayer
();
setActiveLayer
(
s_CurrentZone
->
GetLayer
()
);
g_Zone_Default_Setting
.
ImportSetting
(
*
s_CurrentZone
);
}
...
...
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