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
684bfad0
Commit
684bfad0
authored
Sep 01, 2013
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Plain Diff
Cleaning code for PCB_LAYER_BOX_SELECTOR class, and use it in edit dimension dialog.
parents
93eeb75c
eb1f89d0
Changes
17
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
855 additions
and
384 deletions
+855
-384
class_layer_box_selector.cpp
common/class_layer_box_selector.cpp
+44
-43
class_gbr_layer_box_selector.cpp
gerbview/class_gbr_layer_box_selector.cpp
+0
-6
class_gbr_layer_box_selector.h
gerbview/class_gbr_layer_box_selector.h
+2
-15
class_layer_box_selector.h
include/class_layer_box_selector.h
+34
-24
files.cpp
pagelayout_editor/files.cpp
+7
-2
CMakeLists.txt
pcbnew/CMakeLists.txt
+1
-0
class_pcb_layer_box_selector.cpp
pcbnew/class_pcb_layer_box_selector.cpp
+9
-11
class_pcb_layer_box_selector.h
pcbnew/class_pcb_layer_box_selector.h
+28
-17
dialog_dimension_editor_base.cpp
pcbnew/dialogs/dialog_dimension_editor_base.cpp
+10
-2
dialog_dimension_editor_base.fbp
pcbnew/dialogs/dialog_dimension_editor_base.fbp
+1
-1
dialog_dimension_editor_base.h
pcbnew/dialogs/dialog_dimension_editor_base.h
+5
-2
dialog_layer_selection_base.cpp
pcbnew/dialogs/dialog_layer_selection_base.cpp
+225
-0
dialog_layer_selection_base.h
pcbnew/dialogs/dialog_layer_selection_base.h
+87
-0
dimension.cpp
pcbnew/dimension.cpp
+8
-7
edit.cpp
pcbnew/edit.cpp
+8
-0
sel_layer.cpp
pcbnew/sel_layer.cpp
+383
-253
tool_pcb.cpp
pcbnew/tool_pcb.cpp
+3
-1
No files found.
common/class_layer_box_selector.cpp
View file @
684bfad0
...
...
@@ -7,53 +7,72 @@
#include <wx/wx.h>
#include <wx/ownerdrw.h>
#include <wx/menuitem.h>
#include <wx/aui/aui.h>
#include <class_layer_box_selector.h>
/* class to display a layer list.
*
*/
LAYER_BOX_SELECTOR
::
LAYER_BOX_SELECTOR
(
wxAuiToolBar
*
parent
,
wxWindowID
id
,
const
wxPoint
&
pos
,
const
wxSize
&
size
,
int
n
,
const
wxString
choices
[]
)
:
wxBitmapComboBox
(
parent
,
id
,
wxEmptyString
,
pos
,
size
,
n
,
choices
,
wxCB_READONLY
)
LAYER_SELECTOR
::
LAYER_SELECTOR
()
{
m_layerorder
=
true
;
m_layerhotkeys
=
true
;
m_hotkeys
=
NULL
;
}
if
(
choices
!=
NULL
)
ResyncBitmapOnly
();
bool
LAYER_SELECTOR
::
SetLayersOrdered
(
bool
value
)
{
m_layerorder
=
value
;
return
m_layerorder
;
}
LAYER_BOX_SELECTOR
::
LAYER_BOX_SELECTOR
(
wxAuiToolBar
*
parent
,
wxWindowID
id
,
const
wxPoint
&
pos
,
const
wxSize
&
size
,
const
wxArrayString
&
choices
)
:
wxBitmapComboBox
(
parent
,
id
,
wxEmptyString
,
pos
,
size
,
choices
,
wxCB_READONLY
)
bool
LAYER_SELECTOR
::
SetLayersHotkeys
(
bool
value
)
{
m_layer
order
=
tr
ue
;
m_layerhotkeys
=
true
;
m_hotkeys
=
NULL
;
m_layer
hotkeys
=
val
ue
;
return
m_layerhotkeys
;
}
if
(
!
choices
.
IsEmpty
()
)
ResyncBitmapOnly
();
void
LAYER_SELECTOR
::
SetBitmapLayer
(
wxBitmap
&
aLayerbmp
,
LAYER_NUM
aLayer
)
{
wxMemoryDC
bmpDC
;
wxBrush
brush
;
// Prepare Bitmap
bmpDC
.
SelectObject
(
aLayerbmp
);
brush
.
SetColour
(
MakeColour
(
GetLayerColor
(
aLayer
)
)
);
brush
.
SetStyle
(
wxSOLID
);
bmpDC
.
SetBrush
(
brush
);
bmpDC
.
DrawRectangle
(
0
,
0
,
aLayerbmp
.
GetWidth
(),
aLayerbmp
.
GetHeight
()
);
bmpDC
.
SetBrush
(
*
wxTRANSPARENT_BRUSH
);
bmpDC
.
SetPen
(
*
wxBLACK_PEN
);
bmpDC
.
DrawRectangle
(
0
,
0
,
aLayerbmp
.
GetWidth
(),
aLayerbmp
.
GetHeight
()
);
}
/* class to display a layer list.
*
*/
bool
LAYER_BOX_SELECTOR
::
SetLayersOrdered
(
bool
value
)
LAYER_BOX_SELECTOR
::
LAYER_BOX_SELECTOR
(
wxWindow
*
parent
,
wxWindowID
id
,
const
wxPoint
&
pos
,
const
wxSize
&
size
,
int
n
,
const
wxString
choices
[]
)
:
LAYER_SELECTOR
(),
wxBitmapComboBox
(
parent
,
id
,
wxEmptyString
,
pos
,
size
,
n
,
choices
,
wxCB_READONLY
)
{
m_layerorder
=
value
;
return
m_layerorder
;
if
(
choices
!=
NULL
)
ResyncBitmapOnly
()
;
}
bool
LAYER_BOX_SELECTOR
::
SetLayersHotkeys
(
bool
value
)
LAYER_BOX_SELECTOR
::
LAYER_BOX_SELECTOR
(
wxWindow
*
parent
,
wxWindowID
id
,
const
wxPoint
&
pos
,
const
wxSize
&
size
,
const
wxArrayString
&
choices
)
:
LAYER_SELECTOR
(),
wxBitmapComboBox
(
parent
,
id
,
wxEmptyString
,
pos
,
size
,
choices
,
wxCB_READONLY
)
{
m_layerhotkeys
=
value
;
return
m_layerhotkeys
;
if
(
!
choices
.
IsEmpty
()
)
ResyncBitmapOnly
()
;
}
...
...
@@ -104,21 +123,3 @@ void LAYER_BOX_SELECTOR::ResyncBitmapOnly()
SetBitmapLayer
(
layerbmp
,
i
);
}
}
void
LAYER_BOX_SELECTOR
::
SetBitmapLayer
(
wxBitmap
&
aLayerbmp
,
LAYER_NUM
aLayer
)
{
wxMemoryDC
bmpDC
;
wxBrush
brush
;
// Prepare Bitmap
bmpDC
.
SelectObject
(
aLayerbmp
);
brush
.
SetColour
(
MakeColour
(
GetLayerColor
(
aLayer
)
)
);
brush
.
SetStyle
(
wxSOLID
);
bmpDC
.
SetBrush
(
brush
);
bmpDC
.
DrawRectangle
(
0
,
0
,
aLayerbmp
.
GetWidth
(),
aLayerbmp
.
GetHeight
()
);
bmpDC
.
SetBrush
(
*
wxTRANSPARENT_BRUSH
);
bmpDC
.
SetPen
(
*
wxBLACK_PEN
);
bmpDC
.
DrawRectangle
(
0
,
0
,
aLayerbmp
.
GetWidth
(),
aLayerbmp
.
GetHeight
()
);
}
gerbview/class_gbr_layer_box_selector.cpp
View file @
684bfad0
...
...
@@ -32,14 +32,8 @@
#include <common.h>
#include <colors_selection.h>
#include <layers_id_colors_and_visibility.h>
#include <gerbview_frame.h>
#include <wx/ownerdrw.h>
#include <wx/menuitem.h>
#include <wx/bmpcbox.h>
#include <wx/wx.h>
#include <class_gbr_layer_box_selector.h>
void
GBR_LAYER_BOX_SELECTOR
::
Resync
()
...
...
gerbview/class_gbr_layer_box_selector.h
View file @
684bfad0
...
...
@@ -4,14 +4,11 @@
#include <class_layer_box_selector.h>
/* class to display a layer list in GerbView.
*
*/
// class to display a layer list in GerbView.
class
GBR_LAYER_BOX_SELECTOR
:
public
LAYER_BOX_SELECTOR
{
public
:
GBR_LAYER_BOX_SELECTOR
(
wx
AuiToolBar
*
parent
,
wxWindowID
id
,
GBR_LAYER_BOX_SELECTOR
(
wx
Window
*
parent
,
wxWindowID
id
,
const
wxPoint
&
pos
=
wxDefaultPosition
,
const
wxSize
&
size
=
wxDefaultSize
,
int
n
=
0
,
const
wxString
choices
[]
=
NULL
)
...
...
@@ -21,16 +18,6 @@ public:
m_layerorder
=
false
;
}
GBR_LAYER_BOX_SELECTOR
(
wxAuiToolBar
*
parent
,
wxWindowID
id
,
const
wxPoint
&
pos
,
const
wxSize
&
size
,
const
wxArrayString
&
choices
)
:
LAYER_BOX_SELECTOR
(
parent
,
id
,
pos
,
size
,
choices
)
{
m_layerhotkeys
=
false
;
m_layerorder
=
false
;
}
// Reload the Layers names and bitmaps
// Virtual function
void
Resync
();
...
...
include/class_layer_box_selector.h
View file @
684bfad0
#ifndef CLASS_LAYER_BOX_SELECTOR_H
#define CLASS_LAYER_BOX_SELECTOR_H 1
#include <hotkeys_basic.h>
#include <wx/bmpcbox.h>
#include <colors.h> // EDA_COLOR_T definition
#include <layers_id_colors_and_visibility.h>
class
EDA_HOTKEY_CONFIG
;
class
wxAuiToolBar
;
/* class to display a layer list.
*
/* Basic class to build a layer list.
* this is an basic abstract class to build a layer list selector.
* To display this list, you should therefore derive this class
*/
class
LAYER_BOX_SELECTOR
:
public
wxBitmapComboBox
class
LAYER_SELECTOR
{
protected
:
bool
m_layerhotkeys
;
...
...
@@ -24,14 +22,7 @@ public:
struct
EDA_HOTKEY_CONFIG
*
m_hotkeys
;
public
:
LAYER_BOX_SELECTOR
(
wxAuiToolBar
*
parent
,
wxWindowID
id
,
const
wxPoint
&
pos
=
wxDefaultPosition
,
const
wxSize
&
size
=
wxDefaultSize
,
int
n
=
0
,
const
wxString
choices
[]
=
NULL
);
LAYER_BOX_SELECTOR
(
wxAuiToolBar
*
parent
,
wxWindowID
id
,
const
wxPoint
&
pos
,
const
wxSize
&
size
,
const
wxArrayString
&
choices
);
LAYER_SELECTOR
();
// Returns a color index from the layer id
// Virtual function because GerbView uses its own functions in a derived class
...
...
@@ -45,6 +36,32 @@ public:
// Virtual function pure because GerbView uses its own functions in a derived class
virtual
bool
IsLayerEnabled
(
LAYER_NUM
aLayer
)
const
=
0
;
bool
SetLayersOrdered
(
bool
value
);
bool
SetLayersHotkeys
(
bool
value
);
protected
:
// Fills the layer bitmap aLayerbmp with the layer color
void
SetBitmapLayer
(
wxBitmap
&
aLayerbmp
,
LAYER_NUM
aLayer
);
};
/* class to display a layer list in a wxBitmapComboBox.
*/
class
LAYER_BOX_SELECTOR
:
public
LAYER_SELECTOR
,
public
wxBitmapComboBox
{
public
:
// Hotkey Info
struct
EDA_HOTKEY_CONFIG
*
m_hotkeys
;
public
:
LAYER_BOX_SELECTOR
(
wxWindow
*
parent
,
wxWindowID
id
,
const
wxPoint
&
pos
=
wxDefaultPosition
,
const
wxSize
&
size
=
wxDefaultSize
,
int
n
=
0
,
const
wxString
choices
[]
=
NULL
);
LAYER_BOX_SELECTOR
(
wxWindow
*
parent
,
wxWindowID
id
,
const
wxPoint
&
pos
,
const
wxSize
&
size
,
const
wxArrayString
&
choices
);
// Get Current Item #
int
GetChoice
();
...
...
@@ -60,13 +77,6 @@ public:
// Reload the Layers bitmaps colors
void
ResyncBitmapOnly
();
bool
SetLayersOrdered
(
bool
value
);
bool
SetLayersHotkeys
(
bool
value
);
protected
:
// Fills the layer bitmap aLayerbmp with the layer color
void
SetBitmapLayer
(
wxBitmap
&
aLayerbmp
,
LAYER_NUM
aLayer
);
};
#define DECLARE_LAYERS_HOTKEY(list) int list[NB_LAYERS] = \
...
...
pagelayout_editor/files.cpp
View file @
684bfad0
...
...
@@ -186,9 +186,14 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event )
filename
=
openFileDialog
.
GetPath
();
// Ensure the file has the right extension:
// because a name like name.subname.subsubname is legal,
// add the right extension without replacing the wxFileName
// extension
wxFileName
fn
(
filename
);
fn
.
SetExt
(
PageLayoutDescrFileExtension
);
filename
=
fn
.
GetFullPath
();
if
(
fn
.
GetExt
()
!=
PageLayoutDescrFileExtension
)
filename
<<
wxT
(
"."
)
<<
PageLayoutDescrFileExtension
;
if
(
!
SavePageLayoutDescrFile
(
filename
)
)
{
wxString
msg
;
...
...
pcbnew/CMakeLists.txt
View file @
684bfad0
...
...
@@ -76,6 +76,7 @@ set( PCBNEW_DIALOGS
dialogs/dialog_global_deletion_base.cpp
dialogs/dialog_keepout_area_properties.cpp
dialogs/dialog_keepout_area_properties_base.cpp
dialogs/dialog_layer_selection_base.cpp
dialogs/dialog_layers_setup.cpp
dialogs/dialog_layers_setup_base.cpp
dialogs/dialog_netlist.cpp
...
...
pcbnew/class_pcb_layer_box_selector.cpp
View file @
684bfad0
...
...
@@ -38,11 +38,6 @@
#include <class_board.h>
#include <hotkeys.h>
#include <wx/ownerdrw.h>
#include <wx/menuitem.h>
#include <wx/bmpcbox.h>
#include <wx/wx.h>
#include <class_pcb_layer_box_selector.h>
/* class to display a layer list.
...
...
@@ -70,6 +65,9 @@ void PCB_LAYER_BOX_SELECTOR::Resync()
if
(
!
IsLayerEnabled
(
layerid
)
)
continue
;
if
(
(
m_layerMaskDisable
&
GetLayerMask
(
layerid
)
)
)
continue
;
SetBitmapLayer
(
layerbmp
,
layerid
);
layername
=
GetLayerName
(
layerid
);
...
...
@@ -85,8 +83,8 @@ void PCB_LAYER_BOX_SELECTOR::Resync()
// Returns true if the layer id is enabled (i.e. is it should be displayed)
bool
PCB_LAYER_BOX_SELECTOR
::
IsLayerEnabled
(
LAYER_NUM
aLayer
)
const
{
PCB_BASE_FRAME
*
pcbFrame
=
(
PCB_BASE_FRAME
*
)
GetParent
()
->
GetParent
(
);
BOARD
*
board
=
pcb
Frame
->
GetBoard
();
wxASSERT
(
m_boardFrame
!=
NULL
);
BOARD
*
board
=
m_board
Frame
->
GetBoard
();
wxASSERT
(
board
!=
NULL
);
return
board
->
IsLayerEnabled
(
aLayer
);
...
...
@@ -96,8 +94,8 @@ bool PCB_LAYER_BOX_SELECTOR::IsLayerEnabled( LAYER_NUM aLayer ) const
// Returns a color index from the layer id
EDA_COLOR_T
PCB_LAYER_BOX_SELECTOR
::
GetLayerColor
(
LAYER_NUM
aLayer
)
const
{
PCB_BASE_FRAME
*
pcbFrame
=
(
PCB_BASE_FRAME
*
)
GetParent
()
->
GetParent
(
);
BOARD
*
board
=
pcb
Frame
->
GetBoard
();
wxASSERT
(
m_boardFrame
!=
NULL
);
BOARD
*
board
=
m_board
Frame
->
GetBoard
();
wxASSERT
(
board
!=
NULL
);
return
board
->
GetLayerColor
(
aLayer
);
...
...
@@ -107,8 +105,8 @@ EDA_COLOR_T PCB_LAYER_BOX_SELECTOR::GetLayerColor( LAYER_NUM aLayer ) const
// Returns the name of the layer id
wxString
PCB_LAYER_BOX_SELECTOR
::
GetLayerName
(
LAYER_NUM
aLayer
)
const
{
PCB_BASE_FRAME
*
pcbFrame
=
(
PCB_BASE_FRAME
*
)
GetParent
()
->
GetParent
(
);
BOARD
*
board
=
pcb
Frame
->
GetBoard
();
wxASSERT
(
m_boardFrame
!=
NULL
);
BOARD
*
board
=
m_board
Frame
->
GetBoard
();
wxASSERT
(
board
!=
NULL
);
return
board
->
GetLayerName
(
aLayer
);
...
...
pcbnew/class_pcb_layer_box_selector.h
View file @
684bfad0
...
...
@@ -3,36 +3,47 @@
#include <class_layer_box_selector.h>
class
PCB_BASE_FRAME
;
/* class to display a layer list in Pcbnew.
*
*/
/* class to display a layer list.
*
/* class to display a pcb layer list in a wxBitmapComboBox.
*/
class
PCB_LAYER_BOX_SELECTOR
:
public
LAYER_BOX_SELECTOR
{
PCB_BASE_FRAME
*
m_boardFrame
;
LAYER_MSK
m_layerMaskDisable
;
// A mask to remove some layers from layer list
public
:
// Hotkey Info
struct
EDA_HOTKEY_CONFIG
*
m_hotkeys
;
public
:
PCB_LAYER_BOX_SELECTOR
(
wxAuiToolBar
*
parent
,
wxWindowID
id
,
// If you are thinking the constructor is a bit curious,
// just remember it is used by automaticallty generated by wxFormBuilder files,
// and it should mimic the wxBitmapComboBox constructor.
// Therefore, value, pos, size, n, choices and style are not yet used,
// but they are here for compatibility
PCB_LAYER_BOX_SELECTOR
(
wxWindow
*
parent
,
wxWindowID
id
,
const
wxString
&
value
=
wxEmptyString
,
const
wxPoint
&
pos
=
wxDefaultPosition
,
const
wxSize
&
size
=
wxDefaultSize
,
int
n
=
0
,
const
wxString
choices
[]
=
NULL
)
int
n
=
0
,
const
wxString
choices
[]
=
NULL
,
int
style
=
0
)
:
LAYER_BOX_SELECTOR
(
parent
,
id
,
pos
,
size
,
n
,
choices
)
{
m_boardFrame
=
NULL
;
m_layerMaskDisable
=
0
;
}
PCB_LAYER_BOX_SELECTOR
(
wxAuiToolBar
*
parent
,
wxWindowID
id
,
const
wxPoint
&
pos
,
const
wxSize
&
size
,
const
wxArrayString
&
choices
)
:
LAYER_BOX_SELECTOR
(
parent
,
id
,
pos
,
size
,
choices
)
{
}
// Accessors
// SetBoardFrame should be called after creating a PCB_LAYER_BOX_SELECTOR
// It is not passed through the constructor because when using wxFormBuilder
// we should use a constructor compatible with a wxBitmapComboBox
void
SetBoardFrame
(
PCB_BASE_FRAME
*
aFrame
)
{
m_boardFrame
=
aFrame
;
};
// SetLayerMask allows disableing some layers, whiech are not
// shown in list;
void
SetLayerMask
(
LAYER_MSK
aMask
)
{
m_layerMaskDisable
=
aMask
;
}
// Reload the Layers names and bitmaps
// Virtual function
...
...
pcbnew/dialogs/dialog_dimension_editor_base.cpp
View file @
684bfad0
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version
Apr 10
2012)
// C++ code generated with wxFormBuilder (version
Oct 8
2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "class_pcb_layer_box_selector.h"
#include "dialog_dimension_editor_base.h"
///////////////////////////////////////////////////////////////////////////
...
...
@@ -21,6 +23,7 @@ DIALOG_DIMENSION_EDITOR_BASE::DIALOG_DIMENSION_EDITOR_BASE( wxWindow* parent, wx
bSizerMain
->
Add
(
m_staticTextDim
,
0
,
wxTOP
|
wxRIGHT
|
wxLEFT
,
5
);
m_Name
=
new
wxTextCtrl
(
this
,
wxID_ANY
,
wxEmptyString
,
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_Name
->
SetMaxLength
(
0
);
m_Name
->
SetMinSize
(
wxSize
(
400
,
-
1
)
);
bSizerMain
->
Add
(
m_Name
,
0
,
wxEXPAND
|
wxBOTTOM
|
wxRIGHT
|
wxLEFT
,
5
);
...
...
@@ -36,6 +39,7 @@ DIALOG_DIMENSION_EDITOR_BASE::DIALOG_DIMENSION_EDITOR_BASE( wxWindow* parent, wx
bSizerLeft
->
Add
(
m_staticTextSizeX
,
0
,
wxTOP
|
wxRIGHT
|
wxLEFT
,
5
);
m_TxtSizeXCtrl
=
new
wxTextCtrl
(
this
,
wxID_ANY
,
wxEmptyString
,
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_TxtSizeXCtrl
->
SetMaxLength
(
0
);
bSizerLeft
->
Add
(
m_TxtSizeXCtrl
,
0
,
wxBOTTOM
|
wxRIGHT
|
wxLEFT
|
wxEXPAND
,
5
);
m_staticTextSizeY
=
new
wxStaticText
(
this
,
wxID_ANY
,
_
(
"Size Y"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
...
...
@@ -43,6 +47,7 @@ DIALOG_DIMENSION_EDITOR_BASE::DIALOG_DIMENSION_EDITOR_BASE( wxWindow* parent, wx
bSizerLeft
->
Add
(
m_staticTextSizeY
,
0
,
wxRIGHT
|
wxLEFT
,
5
);
m_TxtSizeYCtrl
=
new
wxTextCtrl
(
this
,
wxID_ANY
,
wxEmptyString
,
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_TxtSizeYCtrl
->
SetMaxLength
(
0
);
bSizerLeft
->
Add
(
m_TxtSizeYCtrl
,
0
,
wxBOTTOM
|
wxRIGHT
|
wxLEFT
|
wxEXPAND
,
5
);
m_staticTextWidth
=
new
wxStaticText
(
this
,
wxID_ANY
,
_
(
"Width"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
...
...
@@ -50,6 +55,7 @@ DIALOG_DIMENSION_EDITOR_BASE::DIALOG_DIMENSION_EDITOR_BASE( wxWindow* parent, wx
bSizerLeft
->
Add
(
m_staticTextWidth
,
0
,
wxTOP
|
wxRIGHT
|
wxLEFT
,
5
);
m_TxtWidthCtrl
=
new
wxTextCtrl
(
this
,
wxID_ANY
,
wxEmptyString
,
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_TxtWidthCtrl
->
SetMaxLength
(
0
);
bSizerLeft
->
Add
(
m_TxtWidthCtrl
,
0
,
wxBOTTOM
|
wxRIGHT
|
wxLEFT
|
wxEXPAND
,
5
);
m_staticTextPosX
=
new
wxStaticText
(
this
,
wxID_ANY
,
_
(
"Text position X"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
...
...
@@ -57,6 +63,7 @@ DIALOG_DIMENSION_EDITOR_BASE::DIALOG_DIMENSION_EDITOR_BASE( wxWindow* parent, wx
bSizerLeft
->
Add
(
m_staticTextPosX
,
0
,
wxTOP
|
wxRIGHT
|
wxLEFT
,
5
);
m_textCtrlPosX
=
new
wxTextCtrl
(
this
,
wxID_ANY
,
wxEmptyString
,
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_textCtrlPosX
->
SetMaxLength
(
0
);
bSizerLeft
->
Add
(
m_textCtrlPosX
,
0
,
wxBOTTOM
|
wxRIGHT
|
wxLEFT
|
wxEXPAND
,
5
);
m_staticTextPosY
=
new
wxStaticText
(
this
,
wxID_ANY
,
_
(
"Text position Y"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
...
...
@@ -64,6 +71,7 @@ DIALOG_DIMENSION_EDITOR_BASE::DIALOG_DIMENSION_EDITOR_BASE( wxWindow* parent, wx
bSizerLeft
->
Add
(
m_staticTextPosY
,
0
,
wxRIGHT
|
wxLEFT
,
5
);
m_textCtrlPosY
=
new
wxTextCtrl
(
this
,
wxID_ANY
,
wxEmptyString
,
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_textCtrlPosY
->
SetMaxLength
(
0
);
bSizerLeft
->
Add
(
m_textCtrlPosY
,
0
,
wxEXPAND
|
wxBOTTOM
|
wxRIGHT
|
wxLEFT
,
5
);
...
...
@@ -82,7 +90,7 @@ DIALOG_DIMENSION_EDITOR_BASE::DIALOG_DIMENSION_EDITOR_BASE( wxWindow* parent, wx
m_staticTextLayer
->
Wrap
(
-
1
);
bSizerRight
->
Add
(
m_staticTextLayer
,
0
,
wxTOP
|
wxRIGHT
|
wxLEFT
,
5
);
m_SelLayerBox
=
new
wxComboBox
(
this
,
wxID_ANY
,
wxEmptyString
,
wxDefaultPosition
,
wxDefaultSize
,
0
,
NULL
,
0
);
m_SelLayerBox
=
new
PCB_LAYER_BOX_SELECTOR
(
this
,
wxID_ANY
,
wxEmptyString
,
wxDefaultPosition
,
wxDefaultSize
,
0
,
NULL
,
0
);
bSizerRight
->
Add
(
m_SelLayerBox
,
0
,
wxBOTTOM
|
wxRIGHT
|
wxLEFT
,
5
);
...
...
pcbnew/dialogs/dialog_dimension_editor_base.fbp
View file @
684bfad0
...
...
@@ -1389,7 +1389,7 @@
<property
name=
"show"
>
1
</property>
<property
name=
"size"
></property>
<property
name=
"style"
></property>
<property
name=
"subclass"
></property>
<property
name=
"subclass"
>
PCB_LAYER_BOX_SELECTOR; class_pcb_layer_box_selector.h
</property>
<property
name=
"toolbar_pane"
>
0
</property>
<property
name=
"tooltip"
></property>
<property
name=
"validator_data_type"
></property>
...
...
pcbnew/dialogs/dialog_dimension_editor_base.h
View file @
684bfad0
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version
Apr 10
2012)
// C++ code generated with wxFormBuilder (version
Oct 8
2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
...
...
@@ -11,6 +11,9 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class
DIALOG_SHIM
;
class
PCB_LAYER_BOX_SELECTOR
;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
...
...
@@ -51,7 +54,7 @@ class DIALOG_DIMENSION_EDITOR_BASE : public DIALOG_SHIM
wxTextCtrl
*
m_textCtrlPosY
;
wxRadioBox
*
m_rbMirror
;
wxStaticText
*
m_staticTextLayer
;
wxComboBox
*
m_SelLayerBox
;
PCB_LAYER_BOX_SELECTOR
*
m_SelLayerBox
;
wxStaticLine
*
m_staticline1
;
wxStdDialogButtonSizer
*
m_sdbSizerBts
;
wxButton
*
m_sdbSizerBtsOK
;
...
...
pcbnew/dialogs/dialog_layer_selection_base.cpp
0 → 100644
View file @
684bfad0
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_layer_selection_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_LAYER_SELECTION_BASE
::
DIALOG_LAYER_SELECTION_BASE
(
wxWindow
*
parent
,
wxWindowID
id
,
const
wxString
&
title
,
const
wxPoint
&
pos
,
const
wxSize
&
size
,
long
style
)
:
wxDialog
(
parent
,
id
,
title
,
pos
,
size
,
style
)
{
this
->
SetSizeHints
(
wxDefaultSize
,
wxDefaultSize
);
wxBoxSizer
*
bSizerMain
;
bSizerMain
=
new
wxBoxSizer
(
wxVERTICAL
);
wxBoxSizer
*
bSizerUpper
;
bSizerUpper
=
new
wxBoxSizer
(
wxHORIZONTAL
);
m_leftGridLayers
=
new
wxGrid
(
this
,
ID_LEFT_LIST
,
wxDefaultPosition
,
wxDefaultSize
,
0
);
// Grid
m_leftGridLayers
->
CreateGrid
(
1
,
4
);
m_leftGridLayers
->
EnableEditing
(
false
);
m_leftGridLayers
->
EnableGridLines
(
true
);
m_leftGridLayers
->
EnableDragGridSize
(
false
);
m_leftGridLayers
->
SetMargins
(
0
,
3
);
// Columns
m_leftGridLayers
->
EnableDragColMove
(
false
);
m_leftGridLayers
->
EnableDragColSize
(
false
);
m_leftGridLayers
->
SetColLabelSize
(
0
);
m_leftGridLayers
->
SetColLabelAlignment
(
wxALIGN_CENTRE
,
wxALIGN_CENTRE
);
// Rows
m_leftGridLayers
->
EnableDragRowSize
(
false
);
m_leftGridLayers
->
SetRowLabelSize
(
0
);
m_leftGridLayers
->
SetRowLabelAlignment
(
wxALIGN_CENTRE
,
wxALIGN_CENTRE
);
// Label Appearance
m_leftGridLayers
->
SetLabelBackgroundColour
(
wxSystemSettings
::
GetColour
(
wxSYS_COLOUR_WINDOW
)
);
// Cell Defaults
m_leftGridLayers
->
SetDefaultCellBackgroundColour
(
wxSystemSettings
::
GetColour
(
wxSYS_COLOUR_MENU
)
);
m_leftGridLayers
->
SetDefaultCellAlignment
(
wxALIGN_LEFT
,
wxALIGN_TOP
);
bSizerUpper
->
Add
(
m_leftGridLayers
,
0
,
wxALL
|
wxEXPAND
,
5
);
m_rightGridLayers
=
new
wxGrid
(
this
,
ID_RIGHT_LIST
,
wxDefaultPosition
,
wxDefaultSize
,
0
);
// Grid
m_rightGridLayers
->
CreateGrid
(
1
,
4
);
m_rightGridLayers
->
EnableEditing
(
false
);
m_rightGridLayers
->
EnableGridLines
(
true
);
m_rightGridLayers
->
EnableDragGridSize
(
false
);
m_rightGridLayers
->
SetMargins
(
0
,
3
);
// Columns
m_rightGridLayers
->
EnableDragColMove
(
false
);
m_rightGridLayers
->
EnableDragColSize
(
false
);
m_rightGridLayers
->
SetColLabelSize
(
0
);
m_rightGridLayers
->
SetColLabelAlignment
(
wxALIGN_CENTRE
,
wxALIGN_CENTRE
);
// Rows
m_rightGridLayers
->
EnableDragRowSize
(
false
);
m_rightGridLayers
->
SetRowLabelSize
(
0
);
m_rightGridLayers
->
SetRowLabelAlignment
(
wxALIGN_CENTRE
,
wxALIGN_CENTRE
);
// Label Appearance
// Cell Defaults
m_rightGridLayers
->
SetDefaultCellBackgroundColour
(
wxSystemSettings
::
GetColour
(
wxSYS_COLOUR_MENU
)
);
m_rightGridLayers
->
SetDefaultCellAlignment
(
wxALIGN_LEFT
,
wxALIGN_TOP
);
bSizerUpper
->
Add
(
m_rightGridLayers
,
0
,
wxALL
|
wxEXPAND
,
5
);
bSizerMain
->
Add
(
bSizerUpper
,
1
,
wxEXPAND
,
5
);
m_buttonClear
=
new
wxButton
(
this
,
wxID_ANY
,
_
(
"Clear Selection"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
bSizerMain
->
Add
(
m_buttonClear
,
0
,
wxALL
|
wxALIGN_RIGHT
,
5
);
this
->
SetSizer
(
bSizerMain
);
this
->
Layout
();
this
->
Centre
(
wxBOTH
);
// Connect Events
m_leftGridLayers
->
Connect
(
wxEVT_GRID_CELL_LEFT_CLICK
,
wxGridEventHandler
(
DIALOG_LAYER_SELECTION_BASE
::
OnLeftGridClick
),
NULL
,
this
);
m_rightGridLayers
->
Connect
(
wxEVT_GRID_CELL_LEFT_CLICK
,
wxGridEventHandler
(
DIALOG_LAYER_SELECTION_BASE
::
OnRightGridClick
),
NULL
,
this
);
m_buttonClear
->
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_LAYER_SELECTION_BASE
::
OnClearSelection
),
NULL
,
this
);
}
DIALOG_LAYER_SELECTION_BASE
::~
DIALOG_LAYER_SELECTION_BASE
()
{
// Disconnect Events
m_leftGridLayers
->
Disconnect
(
wxEVT_GRID_CELL_LEFT_CLICK
,
wxGridEventHandler
(
DIALOG_LAYER_SELECTION_BASE
::
OnLeftGridClick
),
NULL
,
this
);
m_rightGridLayers
->
Disconnect
(
wxEVT_GRID_CELL_LEFT_CLICK
,
wxGridEventHandler
(
DIALOG_LAYER_SELECTION_BASE
::
OnRightGridClick
),
NULL
,
this
);
m_buttonClear
->
Disconnect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_LAYER_SELECTION_BASE
::
OnClearSelection
),
NULL
,
this
);
}
DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE
::
DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE
(
wxWindow
*
parent
,
wxWindowID
id
,
const
wxString
&
title
,
const
wxPoint
&
pos
,
const
wxSize
&
size
,
long
style
)
:
wxDialog
(
parent
,
id
,
title
,
pos
,
size
,
style
)
{
this
->
SetSizeHints
(
wxDefaultSize
,
wxDefaultSize
);
wxBoxSizer
*
bSizerMain
;
bSizerMain
=
new
wxBoxSizer
(
wxVERTICAL
);
wxBoxSizer
*
bSizerUpper
;
bSizerUpper
=
new
wxBoxSizer
(
wxHORIZONTAL
);
wxBoxSizer
*
bSizerLeft
;
bSizerLeft
=
new
wxBoxSizer
(
wxVERTICAL
);
m_staticTextTopLayer
=
new
wxStaticText
(
this
,
wxID_ANY
,
_
(
"Top/Front Layer"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_staticTextTopLayer
->
Wrap
(
-
1
);
bSizerLeft
->
Add
(
m_staticTextTopLayer
,
0
,
wxTOP
|
wxRIGHT
|
wxLEFT
,
5
);
m_leftGridLayers
=
new
wxGrid
(
this
,
ID_LEFT_LIST
,
wxDefaultPosition
,
wxDefaultSize
,
0
);
// Grid
m_leftGridLayers
->
CreateGrid
(
1
,
4
);
m_leftGridLayers
->
EnableEditing
(
false
);
m_leftGridLayers
->
EnableGridLines
(
true
);
m_leftGridLayers
->
EnableDragGridSize
(
false
);
m_leftGridLayers
->
SetMargins
(
0
,
3
);
// Columns
m_leftGridLayers
->
EnableDragColMove
(
false
);
m_leftGridLayers
->
EnableDragColSize
(
false
);
m_leftGridLayers
->
SetColLabelSize
(
0
);
m_leftGridLayers
->
SetColLabelAlignment
(
wxALIGN_CENTRE
,
wxALIGN_CENTRE
);
// Rows
m_leftGridLayers
->
EnableDragRowSize
(
false
);
m_leftGridLayers
->
SetRowLabelSize
(
0
);
m_leftGridLayers
->
SetRowLabelAlignment
(
wxALIGN_CENTRE
,
wxALIGN_CENTRE
);
// Label Appearance
m_leftGridLayers
->
SetLabelBackgroundColour
(
wxSystemSettings
::
GetColour
(
wxSYS_COLOUR_WINDOW
)
);
// Cell Defaults
m_leftGridLayers
->
SetDefaultCellBackgroundColour
(
wxSystemSettings
::
GetColour
(
wxSYS_COLOUR_MENU
)
);
m_leftGridLayers
->
SetDefaultCellAlignment
(
wxALIGN_LEFT
,
wxALIGN_TOP
);
bSizerLeft
->
Add
(
m_leftGridLayers
,
1
,
wxALL
|
wxEXPAND
,
5
);
bSizerUpper
->
Add
(
bSizerLeft
,
1
,
wxEXPAND
,
5
);
wxBoxSizer
*
bSizerRight
;
bSizerRight
=
new
wxBoxSizer
(
wxVERTICAL
);
m_staticTextBottomLayer
=
new
wxStaticText
(
this
,
wxID_ANY
,
_
(
"Bottom/Back Layer"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_staticTextBottomLayer
->
Wrap
(
-
1
);
bSizerRight
->
Add
(
m_staticTextBottomLayer
,
0
,
wxTOP
|
wxRIGHT
|
wxLEFT
,
5
);
m_rightGridLayers
=
new
wxGrid
(
this
,
ID_RIGHT_LIST
,
wxDefaultPosition
,
wxDefaultSize
,
0
);
// Grid
m_rightGridLayers
->
CreateGrid
(
1
,
4
);
m_rightGridLayers
->
EnableEditing
(
false
);
m_rightGridLayers
->
EnableGridLines
(
true
);
m_rightGridLayers
->
EnableDragGridSize
(
false
);
m_rightGridLayers
->
SetMargins
(
0
,
3
);
// Columns
m_rightGridLayers
->
EnableDragColMove
(
false
);
m_rightGridLayers
->
EnableDragColSize
(
false
);
m_rightGridLayers
->
SetColLabelSize
(
0
);
m_rightGridLayers
->
SetColLabelAlignment
(
wxALIGN_CENTRE
,
wxALIGN_CENTRE
);
// Rows
m_rightGridLayers
->
EnableDragRowSize
(
false
);
m_rightGridLayers
->
SetRowLabelSize
(
0
);
m_rightGridLayers
->
SetRowLabelAlignment
(
wxALIGN_CENTRE
,
wxALIGN_CENTRE
);
// Label Appearance
// Cell Defaults
m_rightGridLayers
->
SetDefaultCellBackgroundColour
(
wxSystemSettings
::
GetColour
(
wxSYS_COLOUR_MENU
)
);
m_rightGridLayers
->
SetDefaultCellAlignment
(
wxALIGN_LEFT
,
wxALIGN_TOP
);
bSizerRight
->
Add
(
m_rightGridLayers
,
1
,
wxALL
|
wxEXPAND
,
5
);
bSizerUpper
->
Add
(
bSizerRight
,
1
,
wxEXPAND
,
5
);
bSizerMain
->
Add
(
bSizerUpper
,
1
,
wxEXPAND
,
5
);
m_staticline1
=
new
wxStaticLine
(
this
,
wxID_ANY
,
wxDefaultPosition
,
wxDefaultSize
,
wxLI_HORIZONTAL
);
bSizerMain
->
Add
(
m_staticline1
,
0
,
wxEXPAND
|
wxALL
,
5
);
m_sdbSizer
=
new
wxStdDialogButtonSizer
();
m_sdbSizerOK
=
new
wxButton
(
this
,
wxID_OK
);
m_sdbSizer
->
AddButton
(
m_sdbSizerOK
);
m_sdbSizerCancel
=
new
wxButton
(
this
,
wxID_CANCEL
);
m_sdbSizer
->
AddButton
(
m_sdbSizerCancel
);
m_sdbSizer
->
Realize
();
bSizerMain
->
Add
(
m_sdbSizer
,
0
,
wxEXPAND
,
5
);
this
->
SetSizer
(
bSizerMain
);
this
->
Layout
();
this
->
Centre
(
wxBOTH
);
// Connect Events
m_leftGridLayers
->
Connect
(
wxEVT_GRID_CELL_LEFT_CLICK
,
wxGridEventHandler
(
DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE
::
OnLeftGridClick
),
NULL
,
this
);
m_rightGridLayers
->
Connect
(
wxEVT_GRID_CELL_LEFT_CLICK
,
wxGridEventHandler
(
DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE
::
OnRightGridClick
),
NULL
,
this
);
m_sdbSizerCancel
->
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE
::
OnCancelClick
),
NULL
,
this
);
m_sdbSizerOK
->
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE
::
OnOKClick
),
NULL
,
this
);
}
DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE
::~
DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE
()
{
// Disconnect Events
m_leftGridLayers
->
Disconnect
(
wxEVT_GRID_CELL_LEFT_CLICK
,
wxGridEventHandler
(
DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE
::
OnLeftGridClick
),
NULL
,
this
);
m_rightGridLayers
->
Disconnect
(
wxEVT_GRID_CELL_LEFT_CLICK
,
wxGridEventHandler
(
DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE
::
OnRightGridClick
),
NULL
,
this
);
m_sdbSizerCancel
->
Disconnect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE
::
OnCancelClick
),
NULL
,
this
);
m_sdbSizerOK
->
Disconnect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE
::
OnOKClick
),
NULL
,
this
);
}
pcbnew/dialogs/dialog_layer_selection_base.h
0 → 100644
View file @
684bfad0
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_LAYER_SELECTION_BASE_H__
#define __DIALOG_LAYER_SELECTION_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/font.h>
#include <wx/grid.h>
#include <wx/gdicmn.h>
#include <wx/sizer.h>
#include <wx/button.h>
#include <wx/dialog.h>
#include <wx/stattext.h>
#include <wx/statline.h>
///////////////////////////////////////////////////////////////////////////
#define ID_LEFT_LIST 1000
#define ID_RIGHT_LIST 1001
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_LAYER_SELECTION_BASE
///////////////////////////////////////////////////////////////////////////////
class
DIALOG_LAYER_SELECTION_BASE
:
public
wxDialog
{
private
:
protected
:
wxGrid
*
m_leftGridLayers
;
wxGrid
*
m_rightGridLayers
;
wxButton
*
m_buttonClear
;
// Virtual event handlers, overide them in your derived class
virtual
void
OnLeftGridClick
(
wxGridEvent
&
event
)
{
event
.
Skip
();
}
virtual
void
OnRightGridClick
(
wxGridEvent
&
event
)
{
event
.
Skip
();
}
virtual
void
OnClearSelection
(
wxCommandEvent
&
event
)
{
event
.
Skip
();
}
public
:
DIALOG_LAYER_SELECTION_BASE
(
wxWindow
*
parent
,
wxWindowID
id
=
wxID_ANY
,
const
wxString
&
title
=
_
(
"Select Layer:"
),
const
wxPoint
&
pos
=
wxDefaultPosition
,
const
wxSize
&
size
=
wxSize
(
452
,
183
),
long
style
=
wxCAPTION
|
wxCLOSE_BOX
);
~
DIALOG_LAYER_SELECTION_BASE
();
};
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE
///////////////////////////////////////////////////////////////////////////////
class
DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE
:
public
wxDialog
{
private
:
protected
:
wxStaticText
*
m_staticTextTopLayer
;
wxGrid
*
m_leftGridLayers
;
wxStaticText
*
m_staticTextBottomLayer
;
wxGrid
*
m_rightGridLayers
;
wxStaticLine
*
m_staticline1
;
wxStdDialogButtonSizer
*
m_sdbSizer
;
wxButton
*
m_sdbSizerOK
;
wxButton
*
m_sdbSizerCancel
;
// Virtual event handlers, overide them in your derived class
virtual
void
OnLeftGridClick
(
wxGridEvent
&
event
)
{
event
.
Skip
();
}
virtual
void
OnRightGridClick
(
wxGridEvent
&
event
)
{
event
.
Skip
();
}
virtual
void
OnCancelClick
(
wxCommandEvent
&
event
)
{
event
.
Skip
();
}
virtual
void
OnOKClick
(
wxCommandEvent
&
event
)
{
event
.
Skip
();
}
public
:
DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE
(
wxWindow
*
parent
,
wxWindowID
id
=
wxID_ANY
,
const
wxString
&
title
=
_
(
"Select Cpper Layer Pair:"
),
const
wxPoint
&
pos
=
wxDefaultPosition
,
const
wxSize
&
size
=
wxSize
(
332
,
175
),
long
style
=
wxDEFAULT_DIALOG_STYLE
);
~
DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE
();
};
#endif //__DIALOG_LAYER_SELECTION_BASE_H__
pcbnew/dimension.cpp
View file @
684bfad0
...
...
@@ -44,6 +44,7 @@
#include <pcbnew.h>
#include <dialog_dimension_editor_base.h>
#include <class_pcb_layer_box_selector.h>
/* Local functions */
static
void
BuildDimension
(
EDA_DRAW_PANEL
*
aPanel
,
wxDC
*
aDC
,
...
...
@@ -132,12 +133,12 @@ DIALOG_DIMENSION_EDITOR::DIALOG_DIMENSION_EDITOR( PCB_EDIT_FRAME* aParent,
PutValueInLocalUnits
(
*
m_textCtrlPosY
,
aDimension
->
Text
().
GetTextPosition
().
y
);
AddUnitSymbol
(
*
m_staticTextPosY
);
for
(
LAYER_NUM
layer
=
FIRST_NON_COPPER_LAYER
;
layer
<
NB_PCB_LAYERS
;
++
layer
)
{
m_SelLayerBox
->
Append
(
aParent
->
GetBoard
()
->
GetLayerName
(
layer
)
);
}
m_SelLayerBox
->
Set
Selection
(
aDimension
->
GetLayer
()
-
FIRST_NON_COPPER_LAYER
);
// Configure the layers list selector
m_SelLayerBox
->
SetLayersHotkeys
(
false
);
m_SelLayerBox
->
SetLayerMask
(
ALL_CU_LAYERS
|
EDGE_LAYER
);
m_SelLayerBox
->
SetBoardFrame
(
m_Parent
);
m_SelLayerBox
->
Resync
();
m_SelLayerBox
->
Set
LayerSelection
(
aDimension
->
GetLayer
()
);
GetSizer
()
->
Fit
(
this
);
GetSizer
()
->
SetSizeHints
(
this
);
...
...
@@ -199,7 +200,7 @@ void DIALOG_DIMENSION_EDITOR::OnOKClick( wxCommandEvent& event )
CurrentDimension
->
Text
().
SetMirrored
(
(
m_rbMirror
->
GetSelection
()
==
1
)
?
true
:
false
);
CurrentDimension
->
SetLayer
(
FIRST_NON_COPPER_LAYER
+
m_SelLayerBox
->
GetCurrent
Selection
()
);
CurrentDimension
->
SetLayer
(
m_SelLayerBox
->
GetLayer
Selection
()
);
if
(
m_DC
)
// Display new text
{
...
...
pcbnew/edit.cpp
View file @
684bfad0
...
...
@@ -925,7 +925,15 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
itmp
=
SelectLayer
(
getActiveLayer
(),
UNDEFINED_LAYER
,
UNDEFINED_LAYER
);
if
(
itmp
>=
0
)
{
// if user changed colors and we are in high contrast mode, then redraw
// because the PAD_SMD pads may change color.
if
(
DisplayOpt
.
ContrastModeDisplay
&&
getActiveLayer
()
!=
itmp
)
{
m_canvas
->
Refresh
();
}
setActiveLayer
(
itmp
);
}
m_canvas
->
MoveCursorToCrossHair
();
break
;
...
...
pcbnew/sel_layer.cpp
View file @
684bfad0
/**
* @file sel_layer.cpp
* @brief
Set up the basic primitives for Layer control
.
* @brief
dialogs for one layer selection and a layer pair selection
.
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.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
*/
#include <fctsys.h>
#include <common.h>
...
...
@@ -9,340 +33,446 @@
#include <confirm.h>
#include <wxBasePcbFrame.h>
#include <pcbcommon.h>
#include <class_layer_box_selector.h>
#include <class_board.h>
#include <dialogs/dialog_layer_selection_base.h>
enum
layer_sel_id
{
ID_LAYER_SELECT_TOP
=
1800
,
ID_LAYER_SELECT_BOTTOM
,
ID_LAYER_SELECT
};
class
SELECT_LAYER_DIALOG
:
public
wxDialog
/* classes to display a layer list using a wxGrid.
*/
class
PCB_LAYER_SELECTOR
:
public
LAYER_SELECTOR
{
private
:
PCB_BASE_FRAME
*
m_Parent
;
wxRadioBox
*
m_LayerList
;
LAYER_NUM
m_LayerId
[
int
(
NB_PCB_LAYERS
)
+
1
];
// One extra element for "(Deselect)" radiobutton
BOARD
*
m_brd
;
public
:
// Constructor and destructor
SELECT_LAYER_DIALOG
(
PCB_BASE_FRAME
*
parent
,
LAYER_NUM
default_layer
,
LAYER_NUM
min_layer
,
LAYER_NUM
max_layer
,
bool
null_layer
);
~
SELECT_LAYER_DIALOG
()
{
};
private
:
void
OnLayerSelected
(
wxCommandEvent
&
event
);
void
OnCancelClick
(
wxCommandEvent
&
event
);
DECLARE_EVENT_TABLE
()
};
PCB_LAYER_SELECTOR
(
BOARD
*
aBrd
)
:
LAYER_SELECTOR
()
{
m_brd
=
aBrd
;
}
BEGIN_EVENT_TABLE
(
SELECT_LAYER_DIALOG
,
wxDialog
)
EVT_BUTTON
(
wxID_OK
,
SELECT_LAYER_DIALOG
::
OnLayerSelected
)
EVT_BUTTON
(
wxID_CANCEL
,
SELECT_LAYER_DIALOG
::
OnCancelClick
)
EVT_RADIOBOX
(
ID_LAYER_SELECT
,
SELECT_LAYER_DIALOG
::
OnLayerSelected
)
END_EVENT_TABLE
()
protected
:
// Returns true if the layer id is enabled (i.e. is it should be displayed)
bool
IsLayerEnabled
(
LAYER_NUM
aLayer
)
const
{
return
m_brd
->
IsLayerEnabled
(
aLayer
);
}
// Returns a color index from the layer id
// Virtual function
EDA_COLOR_T
GetLayerColor
(
LAYER_NUM
aLayer
)
const
{
return
m_brd
->
GetLayerColor
(
aLayer
);
}
/** Install the dialog box for layer selection
* @param default_layer = Preselection (NB_PCB_LAYERS for "(Deselect)" layer)
* @param min_layer = min layer value (-1 if no min value)
* @param max_layer = max layer value (-1 if no max value)
* @param null_layer = display a "(Deselect)" radiobutton (when set to true)
* @return new layer value (NB_PCB_LAYERS when "(Deselect)" radiobutton selected),
* or -1 if canceled
*
* Providing the option to also display a "(Deselect)" radiobutton makes the
* "Swap Layers" command (and GerbView's "Export to Pcbnew" command) more "user
* friendly", by permitting any layer to be "deselected" immediately after its
* corresponding radiobutton has been clicked on. (It would otherwise be
* necessary to first cancel the "Select Layer:" dialog box (invoked after a
* different radiobutton is clicked on) prior to then clicking on the
* "Deselect"
* button provided within the "Swap Layers:" or "Layer selection:" dialog box).
*/
LAYER_NUM
PCB_BASE_FRAME
::
SelectLayer
(
LAYER_NUM
default_layer
,
LAYER_NUM
min_layer
,
LAYER_NUM
max_layer
,
bool
null_layer
)
{
SELECT_LAYER_DIALOG
*
frame
=
new
SELECT_LAYER_DIALOG
(
this
,
default_layer
,
min_layer
,
max_layer
,
null_layer
);
LAYER_NUM
layer
=
frame
->
ShowModal
();
frame
->
Destroy
();
return
layer
;
}
// Returns the name of the layer id
// Virtual function
wxString
GetLayerName
(
LAYER_NUM
aLayer
)
const
{
return
m_brd
->
GetLayerName
(
aLayer
);
}
};
/*
* The "OK" and "Cancel" buttons are positioned (in a horizontal line)
* beneath the "Layer" radiobox, unless that contains only one column of
* radiobuttons, in which case they are positioned (in a vertical line)
* to the right of that radiobox.
* This class display a pcb layers list in adialog,
* to select one layer from this list
*/
SELECT_LAYER_DIALOG
::
SELECT_LAYER_DIALOG
(
PCB_BASE_FRAME
*
parent
,
LAYER_NUM
default_layer
,
LAYER_NUM
min_layer
,
LAYER_NUM
max_layer
,
bool
null_layer
)
:
wxDialog
(
parent
,
-
1
,
_
(
"Select Layer:"
),
wxPoint
(
-
1
,
-
1
),
wxSize
(
470
,
250
),
DIALOG_STYLE
)
class
PCB_ONE_LAYER_SELECTOR
:
public
PCB_LAYER_SELECTOR
,
public
DIALOG_LAYER_SELECTION_BASE
{
BOARD
*
board
=
parent
->
GetBoard
();
wxButton
*
Button
;
LAYER_NUM
ii
;
wxString
LayerList
[
NB_PCB_LAYERS
+
1
];
// One extra element for "(Deselect)"
// radiobutton
int
LayerCount
,
LayerSelect
=
-
1
;
LAYER_NUM
m_layerSelected
;
LAYER_NUM
m_minLayer
;
LAYER_NUM
m_maxLayer
;
m_Parent
=
parent
;
public
:
PCB_ONE_LAYER_SELECTOR
(
wxWindow
*
aParent
,
BOARD
*
aBrd
,
LAYER_NUM
aDefaultLayer
,
LAYER_NUM
aMinLayer
=
-
1
,
LAYER_NUM
aMaxLayer
=
-
1
,
bool
aClearTool
=
false
)
:
PCB_LAYER_SELECTOR
(
aBrd
),
DIALOG_LAYER_SELECTION_BASE
(
aParent
)
{
m_layerSelected
=
(
int
)
aDefaultLayer
;
// When not needed, remove the "Clear" button
m_buttonClear
->
Show
(
aClearTool
);
m_minLayer
=
aMinLayer
;
m_maxLayer
=
aMaxLayer
;
BuildList
();
Layout
();
GetSizer
()
->
SetSizeHints
(
this
);
SetFocus
();
}
// Build the layer list
LayerCount
=
0
;
LAYER_MSK
Masque_Layer
=
g_TabAllCopperLayerMask
[
board
->
GetCopperLayerCount
()
-
1
];
Masque_Layer
|=
ALL_NO_CU_LAYERS
;
LAYER_NUM
GetLayerSelection
()
{
return
m_layerSelected
;
}
for
(
ii
=
FIRST_LAYER
;
ii
<
NB_PCB_LAYERS
;
++
ii
)
private
:
// Event handlers
void
OnLeftGridClick
(
wxGridEvent
&
event
);
void
OnRightGridClick
(
wxGridEvent
&
event
);
void
OnClearSelection
(
wxCommandEvent
&
event
)
{
m_LayerId
[
ii
]
=
FIRST_LAYER
;
m_layerSelected
=
NB_PCB_LAYERS
;
EndModal
(
NB_PCB_LAYERS
);
}
void
BuildList
();
};
// Build the layers list
// Column position by function:
#define SELECT_COLNUM 0
#define COLOR_COLNUM 1
#define LAYERNAME_COLNUM 2
#define LAYERID_COLNUM 3
static
DECLARE_LAYERS_ORDER_LIST
(
layertranscode
);
if
(
GetLayerMask
(
ii
)
&
Masque_Layer
)
void
PCB_ONE_LAYER_SELECTOR
::
BuildList
()
{
m_leftGridLayers
->
SetColFormatNumber
(
LAYERID_COLNUM
);
m_rightGridLayers
->
SetColFormatNumber
(
LAYERID_COLNUM
);
m_leftGridLayers
->
HideCol
(
LAYERID_COLNUM
);
m_rightGridLayers
->
HideCol
(
LAYERID_COLNUM
);
m_leftGridLayers
->
SetColSize
(
COLOR_COLNUM
,
20
);
m_rightGridLayers
->
SetColSize
(
COLOR_COLNUM
,
20
);
// Select a not show cell, to avoid a wrong cell selection for user
m_leftGridLayers
->
GoToCell
(
0
,
LAYERID_COLNUM
);
m_rightGridLayers
->
GoToCell
(
0
,
LAYERID_COLNUM
);
int
left_row
=
0
;
int
right_row
=
0
;
wxString
layernum
;
wxString
layername
;
for
(
LAYER_NUM
i
=
FIRST_LAYER
;
i
<
NB_LAYERS
;
++
i
)
{
if
(
min_layer
>
ii
)
continue
;
LAYER_NUM
layerid
=
i
;
if
(
(
max_layer
>=
0
)
&&
(
max_layer
<
ii
)
)
break
;
if
(
m_layerorder
)
layerid
=
layertranscode
[
i
]
;
LayerList
[
LayerCount
]
=
board
->
GetLayerName
(
ii
);
if
(
!
IsLayerEnabled
(
layerid
)
)
continue
;
if
(
ii
==
default_l
ayer
)
LayerSelect
=
LayerCount
;
if
(
m_minLayer
>=
0
&&
layerid
<
m_minL
ayer
)
continue
;
m_LayerId
[
LayerCount
]
=
ii
;
LayerCount
++
;
}
}
if
(
m_maxLayer
>=
0
&&
layerid
>
m_maxLayer
)
continue
;
wxColour
color
=
MakeColour
(
GetLayerColor
(
layerid
)
);
layername
=
GetLayerName
(
layerid
);
layernum
.
Printf
(
wxT
(
"%d"
),
layerid
);
// When appropriate, also provide a "(Deselect)" radiobutton
if
(
null_layer
)
if
(
layerid
<=
LAST_COPPER_LAYER
)
{
LayerList
[
LayerCount
]
=
_
(
"(Deselect)"
);
if
(
left_row
)
m_leftGridLayers
->
AppendRows
(
1
);
if
(
NB_PCB_LAYERS
==
default_layer
)
LayerSelect
=
LayerCount
;
m_leftGridLayers
->
SetCellBackgroundColour
(
left_row
,
COLOR_COLNUM
,
color
);
m_leftGridLayers
->
SetCellValue
(
left_row
,
LAYERNAME_COLNUM
,
layername
);
m_leftGridLayers
->
SetCellValue
(
left_row
,
LAYERID_COLNUM
,
layernum
);
m_LayerId
[
LayerCount
]
=
NB_PCB_LAYERS
;
LayerCount
++
;
if
(
m_layerSelected
==
layerid
)
{
m_leftGridLayers
->
SetCellValue
(
left_row
,
SELECT_COLNUM
,
wxT
(
"X"
)
);
m_leftGridLayers
->
SetCellBackgroundColour
(
left_row
,
SELECT_COLNUM
,
color
);
}
m_LayerList
=
new
wxRadioBox
(
this
,
ID_LAYER_SELECT
,
_
(
"Layer"
),
wxPoint
(
-
1
,
-
1
),
wxSize
(
-
1
,
-
1
),
LayerCount
,
LayerList
,
(
LayerCount
<
8
)
?
LayerCount
:
8
,
wxRA_SPECIFY_ROWS
);
if
(
LayerSelect
>=
0
)
m_LayerList
->
SetSelection
(
LayerSelect
);
left_row
++
;
}
else
{
if
(
right_row
)
m_rightGridLayers
->
AppendRows
(
1
);
wxBoxSizer
*
FrameBoxSizer
=
new
wxBoxSizer
(
wxHORIZONTAL
);
SetSizer
(
FrameBoxSizer
);
FrameBoxSizer
->
Add
(
m_LayerList
,
0
,
wxALIGN_TOP
|
wxALL
,
5
);
wxBoxSizer
*
ButtonBoxSizer
=
new
wxBoxSizer
(
wxVERTICAL
);
FrameBoxSizer
->
Add
(
ButtonBoxSizer
,
0
,
wxALIGN_BOTTOM
|
wxALL
,
0
);
m_rightGridLayers
->
SetCellBackgroundColour
(
right_row
,
COLOR_COLNUM
,
color
);
m_rightGridLayers
->
SetCellValue
(
right_row
,
LAYERNAME_COLNUM
,
layername
);
m_rightGridLayers
->
SetCellValue
(
right_row
,
LAYERID_COLNUM
,
layernum
);
Button
=
new
wxButton
(
this
,
wxID_OK
,
_
(
"OK"
)
);
Button
->
SetDefault
();
ButtonBoxSizer
->
Add
(
Button
,
0
,
wxGROW
|
wxALL
,
5
);
if
(
m_layerSelected
==
layerid
)
{
m_rightGridLayers
->
SetCellValue
(
right_row
,
SELECT_COLNUM
,
wxT
(
"X"
)
);
m_rightGridLayers
->
SetCellBackgroundColour
(
right_row
,
SELECT_COLNUM
,
color
);
}
Button
=
new
wxButton
(
this
,
wxID_CANCEL
,
_
(
"Cancel"
)
);
ButtonBoxSizer
->
Add
(
Button
,
0
,
wxGROW
|
wxALL
,
5
);
right_row
++
;
}
}
SetFocus
();
// Show only populated lists:
if
(
left_row
<=
0
)
m_leftGridLayers
->
Show
(
false
);
GetSizer
()
->
SetSizeHints
(
this
);
if
(
right_row
<=
0
)
m_rightGridLayers
->
Show
(
false
);
Center
();
m_leftGridLayers
->
AutoSizeColumn
(
LAYERNAME_COLNUM
);
m_rightGridLayers
->
AutoSizeColumn
(
LAYERNAME_COLNUM
);
m_leftGridLayers
->
AutoSizeColumn
(
SELECT_COLNUM
);
m_rightGridLayers
->
AutoSizeColumn
(
SELECT_COLNUM
);
}
void
SELECT_LAYER_DIALOG
::
OnLayerSelected
(
wxCommandEvent
&
event
)
void
PCB_ONE_LAYER_SELECTOR
::
OnLeftGridClick
(
wxGridEvent
&
event
)
{
int
ii
=
m_LayerId
[
m_LayerList
->
GetSelection
()];
EndModal
(
ii
);
wxString
text
=
m_leftGridLayers
->
GetCellValue
(
event
.
GetRow
(),
LAYERID_COLNUM
);
long
layer
;
text
.
ToLong
(
&
layer
);
m_layerSelected
=
layer
;
EndModal
(
1
);
}
void
SELECT_LAYER_DIALOG
::
OnCancelClick
(
wxCommandEvent
&
event
)
void
PCB_ONE_LAYER_SELECTOR
::
OnRightGridClick
(
wxGridEvent
&
event
)
{
EndModal
(
-
1
);
wxString
text
=
m_rightGridLayers
->
GetCellValue
(
event
.
GetRow
(),
LAYERID_COLNUM
);
long
layer
;
text
.
ToLong
(
&
layer
);
m_layerSelected
=
layer
;
EndModal
(
2
);
}
/** Install the dialog box for layer selection
* @param aDefaultLayer = Preselection (NB_PCB_LAYERS for "(Deselect)" layer)
* @param aMinlayer = min layer id value (-1 if no min value)
* @param aMaxLayer = max layer id value (-1 if no max value)
* @param aDeselectTool = display a "Clear" button when true
* @return new layer value (NB_PCB_LAYERS when "(Deselect)" radiobutton selected),
* or -1 if canceled
*
* Providing the option to also display a "Clear" button makes the
* "Swap Layers" command more "user friendly",
* by permitting any layer to be "deselected" immediately after its
* corresponding radiobutton has been clicked on. (It would otherwise be
* necessary to first cancel the "Select Layer:" dialog box (invoked after a
* different radiobutton is clicked on) prior to then clicking on the
* "Clear" button provided within the "Swap Layers:"
* or "Layer selection:" dialog box).
*/
LAYER_NUM
PCB_BASE_FRAME
::
SelectLayer
(
LAYER_NUM
aDefaultLayer
,
LAYER_NUM
aMinlayer
,
LAYER_NUM
aMaxLayer
,
bool
aDeselectTool
)
{
PCB_ONE_LAYER_SELECTOR
dlg
(
this
,
GetBoard
(),
aDefaultLayer
,
aMinlayer
,
aMaxLayer
,
aDeselectTool
);
dlg
.
ShowModal
();
LAYER_NUM
layer
=
dlg
.
GetLayerSelection
();
return
layer
;
}
/*********************************************/
/* Dialog for the selecting pairs of layers. */
/*********************************************/
class
SELECT_LAYERS_PAIR_DIALOG
:
public
wxDialog
/*
* This class display a double pcb copper layers list in a dialog,
* to select a layer pair from this list
*/
class
SELECT_COPPER_LAYERS_PAIR_DIALOG
:
public
PCB_LAYER_SELECTOR
,
public
DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE
{
private
:
PCB_BASE_FRAME
*
m_Parent
;
wxRadioBox
*
m_LayerListTOP
;
wxRadioBox
*
m_LayerListBOTTOM
;
LAYER_NUM
m_LayerId
[
NB_COPPER_LAYERS
];
BOARD
*
m_brd
;
LAYER_NUM
m_frontLayer
;
LAYER_NUM
m_backLayer
;
int
m_leftRowSelected
;
int
m_rightRowSelected
;
public
:
SELECT_COPPER_LAYERS_PAIR_DIALOG
(
wxWindow
*
aParent
,
BOARD
*
aPcb
,
LAYER_NUM
aFrontLayer
,
LAYER_NUM
aBackLayer
);
public
:
SELECT_LAYERS_PAIR_DIALOG
(
PCB_BASE_FRAME
*
parent
);
~
SELECT_LAYERS_PAIR_DIALOG
()
{
};
void
GetLayerPair
(
LAYER_NUM
&
aFrontLayer
,
LAYER_NUM
&
aBackLayer
)
{
aFrontLayer
=
m_frontLayer
;
aBackLayer
=
m_backLayer
;
}
private
:
void
On
OkClick
(
wxComman
dEvent
&
event
);
void
On
CancelClick
(
wxComman
dEvent
&
event
);
void
On
LeftGridClick
(
wxGri
dEvent
&
event
);
void
On
RightGridClick
(
wxGri
dEvent
&
event
);
DECLARE_EVENT_TABLE
()
};
void
OnOkClick
(
wxCommandEvent
&
event
)
{
EndModal
(
wxID_OK
);
}
void
OnCancelClick
(
wxCommandEvent
&
event
)
{
EndModal
(
wxID_CANCEL
);
}
BEGIN_EVENT_TABLE
(
SELECT_LAYERS_PAIR_DIALOG
,
wxDialog
)
EVT_BUTTON
(
wxID_OK
,
SELECT_LAYERS_PAIR_DIALOG
::
OnOkClick
)
EVT_BUTTON
(
wxID_CANCEL
,
SELECT_LAYERS_PAIR_DIALOG
::
OnCancelClick
)
END_EVENT_TABLE
()
void
BuildList
();
};
/* Display a list of two copper layers
for selection of
a pair of layers
/* Display a list of two copper layers
to choose
a pair of layers
* for auto-routing, vias ...
*/
void
PCB_BASE_FRAME
::
SelectLayerPair
()
{
// Check whether more than one copper layer has been enabled for the
// current PCB file, as Layer Pairs can only meaningfully be defined
// within PCB files which contain at least two copper layers.
if
(
GetBoard
()
->
GetCopperLayerCount
()
<
2
)
PCB_SCREEN
*
screen
=
GetScreen
();
SELECT_COPPER_LAYERS_PAIR_DIALOG
dlg
(
this
,
GetBoard
(),
screen
->
m_Route_Layer_TOP
,
screen
->
m_Route_Layer_BOTTOM
);
if
(
dlg
.
ShowModal
()
==
wxID_OK
)
{
wxString
InfoMsg
;
InfoMsg
=
_
(
"Less than two copper layers are being used."
);
InfoMsg
<<
wxT
(
"
\n
"
)
<<
_
(
"Hence layer pairs cannot be specified."
);
DisplayInfoMessage
(
this
,
InfoMsg
);
return
;
}
dlg
.
GetLayerPair
(
screen
->
m_Route_Layer_TOP
,
screen
->
m_Route_Layer_BOTTOM
);
SELECT_LAYERS_PAIR_DIALOG
*
frame
=
new
SELECT_LAYERS_PAIR_DIALOG
(
this
);
// select the same layer for both layers is allowed (normal in some boards)
// but could be a mistake. So display an info message
if
(
screen
->
m_Route_Layer_TOP
==
screen
->
m_Route_Layer_BOTTOM
)
DisplayInfoMessage
(
this
,
_
(
"Warning: The Top Layer and Bottom Layer are same."
)
);
}
int
result
=
frame
->
ShowModal
();
frame
->
Destroy
();
m_canvas
->
MoveCursorToCrossHair
();
// if user changed colors and we are in high contrast mode, then redraw
// because the PAD_SMD pads may change color.
if
(
result
>=
0
&&
DisplayOpt
.
ContrastModeDisplay
)
{
m_canvas
->
Refresh
();
}
}
SELECT_LAYERS_PAIR_DIALOG
::
SELECT_LAYERS_PAIR_DIALOG
(
PCB_BASE_FRAME
*
parent
)
:
wxDialog
(
parent
,
-
1
,
_
(
"Select Layer Pair:"
),
wxPoint
(
-
1
,
-
1
),
wxSize
(
470
,
250
),
DIALOG_STYLE
)
SELECT_COPPER_LAYERS_PAIR_DIALOG
::
SELECT_COPPER_LAYERS_PAIR_DIALOG
(
wxWindow
*
aParent
,
BOARD
*
aPcb
,
LAYER_NUM
aFrontLayer
,
LAYER_NUM
aBackLayer
)
:
PCB_LAYER_SELECTOR
(
aPcb
),
DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE
(
aParent
)
{
BOARD
*
board
=
parent
->
GetBoard
();
wxButton
*
Button
;
wxString
LayerList
[
NB_COPPER_LAYERS
];
LAYER_NUM
LayerTopSelect
=
FIRST_LAYER
,
LayerBottomSelect
=
FIRST_LAYER
;
m_frontLayer
=
aFrontLayer
;
m_backLayer
=
aBackLayer
;
m_leftRowSelected
=
0
;
m_rightRowSelected
=
0
;
BuildList
();
SetFocus
();
GetSizer
()
->
SetSizeHints
(
this
);
Center
();
}
m_Parent
=
parent
;
void
SELECT_COPPER_LAYERS_PAIR_DIALOG
::
BuildList
()
{
m_leftGridLayers
->
SetColFormatNumber
(
LAYERID_COLNUM
);
m_rightGridLayers
->
SetColFormatNumber
(
LAYERID_COLNUM
);
m_leftGridLayers
->
HideCol
(
LAYERID_COLNUM
);
m_rightGridLayers
->
HideCol
(
LAYERID_COLNUM
);
m_leftGridLayers
->
SetColSize
(
COLOR_COLNUM
,
20
);
m_rightGridLayers
->
SetColSize
(
COLOR_COLNUM
,
20
);
// Select a not show cell, to avoid a wrong cell selection for user
m_leftGridLayers
->
GoToCell
(
0
,
LAYERID_COLNUM
);
m_rightGridLayers
->
GoToCell
(
0
,
LAYERID_COLNUM
);
int
row
=
0
;
wxString
layernum
;
wxString
layername
;
for
(
LAYER_NUM
i
=
FIRST_LAYER
;
i
<
NB_LAYERS
;
++
i
)
{
LAYER_NUM
layerid
=
i
;
PCB_SCREEN
*
screen
=
(
PCB_SCREEN
*
)
m_Parent
->
GetScreen
();
LAYER_MSK
Masque_Layer
=
g_TabAllCopperLayerMask
[
board
->
GetCopperLayerCount
()
-
1
];
Masque_Layer
|=
ALL_NO_CU_LAYERS
;
if
(
m_layerorder
)
layerid
=
layertranscode
[
i
];
LAYER_NUM
LayerCount
=
FIRST_LAYER
;
for
(
LAYER_NUM
ii
=
FIRST_COPPER_LAYER
;
ii
<
NB_COPPER_LAYERS
;
++
ii
)
{
m_LayerId
[
ii
]
=
FIRST_LAYER
;
if
(
!
IsLayerEnabled
(
layerid
)
)
continue
;
if
(
(
GetLayerMask
(
ii
)
&
Masque_Layer
)
)
{
LayerList
[
LayerCount
]
=
board
->
GetLayerName
(
ii
);
if
(
layerid
>
LAST_COPPER_LAYER
)
continue
;
if
(
ii
==
screen
->
m_Route_Layer_TOP
)
LayerTopSelect
=
LayerCount
;
wxColour
color
=
MakeColour
(
GetLayerColor
(
layerid
)
);
layername
=
GetLayerName
(
layerid
);
layernum
.
Printf
(
wxT
(
"%d"
),
layerid
);
if
(
ii
==
screen
->
m_Route_Layer_BOTTOM
)
LayerBottomSelect
=
LayerCount
;
if
(
row
)
m_leftGridLayers
->
AppendRows
(
1
);
m_leftGridLayers
->
SetCellBackgroundColour
(
row
,
COLOR_COLNUM
,
color
);
m_leftGridLayers
->
SetCellValue
(
row
,
LAYERNAME_COLNUM
,
layername
);
m_leftGridLayers
->
SetCellValue
(
row
,
LAYERID_COLNUM
,
layernum
);
m_LayerId
[
LayerCount
]
=
ii
;
++
LayerCount
;
}
if
(
m_frontLayer
==
layerid
)
{
m_leftGridLayers
->
SetCellValue
(
row
,
SELECT_COLNUM
,
wxT
(
"X"
)
);
m_leftGridLayers
->
SetCellBackgroundColour
(
row
,
SELECT_COLNUM
,
color
);
m_leftRowSelected
=
row
;
}
m_LayerListTOP
=
new
wxRadioBox
(
this
,
ID_LAYER_SELECT_TOP
,
_
(
"Top Layer"
),
wxPoint
(
-
1
,
-
1
),
wxSize
(
-
1
,
-
1
),
LayerCount
,
LayerList
,
(
LayerCount
<
8
)
?
LayerCount
:
8
,
wxRA_SPECIFY_ROWS
);
m_LayerListTOP
->
SetSelection
(
LayerTopSelect
);
if
(
row
)
m_rightGridLayers
->
AppendRows
(
1
);
m_rightGridLayers
->
SetCellBackgroundColour
(
row
,
COLOR_COLNUM
,
color
);
m_rightGridLayers
->
SetCellValue
(
row
,
LAYERNAME_COLNUM
,
layername
);
m_rightGridLayers
->
SetCellValue
(
row
,
LAYERID_COLNUM
,
layernum
);
m_LayerListBOTTOM
=
new
wxRadioBox
(
this
,
ID_LAYER_SELECT_BOTTOM
,
_
(
"Bottom Layer"
),
wxPoint
(
-
1
,
-
1
),
wxSize
(
-
1
,
-
1
),
LayerCount
,
LayerList
,
(
LayerCount
<
8
)
?
LayerCount
:
8
,
wxRA_SPECIFY_ROWS
);
m_LayerListBOTTOM
->
SetSelection
(
LayerBottomSelect
);
if
(
m_backLayer
==
layerid
)
{
m_rightGridLayers
->
SetCellValue
(
row
,
SELECT_COLNUM
,
wxT
(
"X"
)
);
m_rightGridLayers
->
SetCellBackgroundColour
(
row
,
SELECT_COLNUM
,
color
);
m_rightRowSelected
=
row
;
}
wxBoxSizer
*
FrameBoxSizer
=
new
wxBoxSizer
(
wxVERTICAL
)
;
SetSizer
(
FrameBoxSizer
);
row
++
;
}
wxBoxSizer
*
RadioBoxSizer
=
new
wxBoxSizer
(
wxHORIZONTAL
);
FrameBoxSizer
->
Add
(
RadioBoxSizer
,
0
,
wxALIGN_LEFT
|
wxALL
,
0
);
m_leftGridLayers
->
AutoSizeColumn
(
LAYERNAME_COLNUM
);
m_rightGridLayers
->
AutoSizeColumn
(
LAYERNAME_COLNUM
);
m_leftGridLayers
->
AutoSizeColumn
(
SELECT_COLNUM
);
m_rightGridLayers
->
AutoSizeColumn
(
SELECT_COLNUM
);
}
wxBoxSizer
*
ButtonBoxSizer
=
new
wxBoxSizer
(
wxHORIZONTAL
);
FrameBoxSizer
->
Add
(
ButtonBoxSizer
,
0
,
wxALIGN_RIGHT
|
wxALL
,
0
);
void
SELECT_COPPER_LAYERS_PAIR_DIALOG
::
OnLeftGridClick
(
wxGridEvent
&
event
)
{
int
row
=
event
.
GetRow
();
wxString
text
=
m_leftGridLayers
->
GetCellValue
(
row
,
LAYERID_COLNUM
);
long
layer
;
text
.
ToLong
(
&
layer
);
RadioBoxSizer
->
Add
(
m_LayerListTOP
,
0
,
wxALIGN_TOP
|
wxALL
,
5
);
RadioBoxSizer
->
Add
(
m_LayerListBOTTOM
,
0
,
wxALIGN_TOP
|
wxALL
,
5
)
;
if
(
m_frontLayer
==
layer
)
return
;
Button
=
new
wxButton
(
this
,
wxID_OK
,
_
(
"OK"
)
);
Button
->
SetDefault
();
ButtonBoxSizer
->
Add
(
Button
,
0
,
wxGROW
|
wxALL
,
5
);
m_leftGridLayers
->
SetCellValue
(
m_leftRowSelected
,
SELECT_COLNUM
,
wxEmptyString
);
m_leftGridLayers
->
SetCellBackgroundColour
(
m_leftRowSelected
,
SELECT_COLNUM
,
m_leftGridLayers
->
GetDefaultCellBackgroundColour
()
);
Button
=
new
wxButton
(
this
,
wxID_CANCEL
,
_
(
"Cancel"
)
);
ButtonBoxSizer
->
Add
(
Button
,
0
,
wxGROW
|
wxALL
,
5
);
SetFocus
();
m_frontLayer
=
layer
;
m_leftRowSelected
=
row
;
m_leftGridLayers
->
SetCellValue
(
row
,
SELECT_COLNUM
,
wxT
(
"X"
)
);
m_leftGridLayers
->
SetCellBackgroundColour
(
row
,
SELECT_COLNUM
,
MakeColour
(
GetLayerColor
(
layer
)
)
);
GetSizer
()
->
SetSizeHints
(
this
);
Center
();
}
void
SELECT_LAYERS_PAIR_DIALOG
::
OnOkClick
(
wxCommandEvent
&
event
)
void
SELECT_COPPER_LAYERS_PAIR_DIALOG
::
OnRightGridClick
(
wxGridEvent
&
event
)
{
// select the same layer for top and bottom is allowed (normal in some
// boards)
// but could be a mistake. So display an info message
if
(
m_LayerId
[
m_LayerListTOP
->
GetSelection
()]
==
m_LayerId
[
m_LayerListBOTTOM
->
GetSelection
()]
)
DisplayInfoMessage
(
this
,
_
(
"Warning: The Top Layer and Bottom Layer are same."
)
);
PCB_SCREEN
*
screen
=
(
PCB_SCREEN
*
)
m_Parent
->
GetScreen
();
screen
->
m_Route_Layer_TOP
=
m_LayerId
[
m_LayerListTOP
->
GetSelection
()];
screen
->
m_Route_Layer_BOTTOM
=
m_LayerId
[
m_LayerListBOTTOM
->
GetSelection
()];
EndModal
(
0
);
}
int
row
=
event
.
GetRow
();
wxString
text
=
m_rightGridLayers
->
GetCellValue
(
row
,
LAYERID_COLNUM
);
long
layer
;
text
.
ToLong
(
&
layer
);
if
(
m_backLayer
==
layer
)
return
;
void
SELECT_LAYERS_PAIR_DIALOG
::
OnCancelClick
(
wxCommandEvent
&
event
)
{
EndModal
(
-
1
);
m_rightGridLayers
->
SetCellValue
(
m_rightRowSelected
,
SELECT_COLNUM
,
wxEmptyString
);
m_rightGridLayers
->
SetCellBackgroundColour
(
m_rightRowSelected
,
SELECT_COLNUM
,
m_rightGridLayers
->
GetDefaultCellBackgroundColour
()
);
m_backLayer
=
layer
;
m_rightRowSelected
=
row
;
m_rightGridLayers
->
SetCellValue
(
row
,
SELECT_COLNUM
,
wxT
(
"X"
)
);
m_rightGridLayers
->
SetCellBackgroundColour
(
row
,
SELECT_COLNUM
,
MakeColour
(
GetLayerColor
(
layer
)
)
);
}
pcbnew/tool_pcb.cpp
View file @
684bfad0
...
...
@@ -277,8 +277,10 @@ void PCB_EDIT_FRAME::ReCreateHToolbar()
m_mainToolBar
->
AddSeparator
();
if
(
m_SelLayerBox
==
NULL
)
{
m_SelLayerBox
=
new
PCB_LAYER_BOX_SELECTOR
(
m_mainToolBar
,
ID_TOOLBARH_PCB_SELECT_LAYER
);
m_SelLayerBox
->
SetBoardFrame
(
this
);
}
ReCreateLayerBox
(
m_mainToolBar
);
m_mainToolBar
->
AddControl
(
m_SelLayerBox
);
...
...
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