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
77c64161
Commit
77c64161
authored
Feb 03, 2011
by
Marco Mattila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add limit checking to plot dialog fields.
parent
82879001
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
197 additions
and
63 deletions
+197
-63
dialog_plot_base.cpp
pcbnew/dialogs/dialog_plot_base.cpp
+6
-4
dialog_plot_base.fbp
pcbnew/dialogs/dialog_plot_base.fbp
+5
-5
pcb_plot_params.cpp
pcbnew/pcb_plot_params.cpp
+89
-34
pcb_plot_params.h
pcbnew/pcb_plot_params.h
+9
-0
pcbplot.cpp
pcbnew/pcbplot.cpp
+88
-20
No files found.
pcbnew/dialogs/dialog_plot_base.cpp
View file @
77c64161
...
@@ -47,7 +47,7 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
...
@@ -47,7 +47,7 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
bSizer29
=
new
wxBoxSizer
(
wxHORIZONTAL
);
bSizer29
=
new
wxBoxSizer
(
wxHORIZONTAL
);
m_outputDirectoryName
=
new
wxTextCtrl
(
this
,
wxID_ANY
,
wxEmptyString
,
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_outputDirectoryName
=
new
wxTextCtrl
(
this
,
wxID_ANY
,
wxEmptyString
,
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_outputDirectoryName
->
SetToolTip
(
_
(
"Target directory for plot files. Can be
relative or absolute
."
)
);
m_outputDirectoryName
->
SetToolTip
(
_
(
"Target directory for plot files. Can be
absolute or relative to the board file location
."
)
);
bSizer29
->
Add
(
m_outputDirectoryName
,
1
,
wxALIGN_CENTER_VERTICAL
|
wxALL
|
wxEXPAND
,
5
);
bSizer29
->
Add
(
m_outputDirectoryName
,
1
,
wxALIGN_CENTER_VERTICAL
|
wxALL
|
wxEXPAND
,
5
);
...
@@ -112,7 +112,7 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
...
@@ -112,7 +112,7 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
bSizer201
->
Add
(
m_plotInvisibleText
,
0
,
wxALL
,
2
);
bSizer201
->
Add
(
m_plotInvisibleText
,
0
,
wxALL
,
2
);
m_plotNoViaOnMaskOpt
=
new
wxCheckBox
(
this
,
wxID_ANY
,
_
(
"Do not tent vias"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_plotNoViaOnMaskOpt
=
new
wxCheckBox
(
this
,
wxID_ANY
,
_
(
"Do not tent vias"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_plotNoViaOnMaskOpt
->
SetToolTip
(
_
(
"
Print/plot vias on mask layers. They are in this case not protected
"
)
);
m_plotNoViaOnMaskOpt
->
SetToolTip
(
_
(
"
Remove soldermask on vias.
"
)
);
bSizer201
->
Add
(
m_plotNoViaOnMaskOpt
,
0
,
wxALL
,
2
);
bSizer201
->
Add
(
m_plotNoViaOnMaskOpt
,
0
,
wxALL
,
2
);
...
@@ -256,7 +256,7 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
...
@@ -256,7 +256,7 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
bSizer18
->
Add
(
m_staticText7
,
0
,
wxTOP
|
wxRIGHT
|
wxLEFT
,
5
);
bSizer18
->
Add
(
m_staticText7
,
0
,
wxTOP
|
wxRIGHT
|
wxLEFT
,
5
);
m_fineAdjustXscaleOpt
=
new
wxTextCtrl
(
this
,
wxID_ANY
,
wxEmptyString
,
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_fineAdjustXscaleOpt
=
new
wxTextCtrl
(
this
,
wxID_ANY
,
wxEmptyString
,
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_fineAdjustXscaleOpt
->
SetToolTip
(
_
(
"Set
X scale adjust for exact scale plotting
"
)
);
m_fineAdjustXscaleOpt
->
SetToolTip
(
_
(
"Set
global X scale adjust for exact scale postscript output.
"
)
);
bSizer18
->
Add
(
m_fineAdjustXscaleOpt
,
0
,
wxEXPAND
|
wxBOTTOM
|
wxRIGHT
|
wxLEFT
,
5
);
bSizer18
->
Add
(
m_fineAdjustXscaleOpt
,
0
,
wxEXPAND
|
wxBOTTOM
|
wxRIGHT
|
wxLEFT
,
5
);
...
@@ -270,6 +270,8 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
...
@@ -270,6 +270,8 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
bSizer19
->
Add
(
m_staticText8
,
0
,
wxTOP
|
wxRIGHT
|
wxLEFT
,
5
);
bSizer19
->
Add
(
m_staticText8
,
0
,
wxTOP
|
wxRIGHT
|
wxLEFT
,
5
);
m_fineAdjustYscaleOpt
=
new
wxTextCtrl
(
this
,
wxID_ANY
,
wxEmptyString
,
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_fineAdjustYscaleOpt
=
new
wxTextCtrl
(
this
,
wxID_ANY
,
wxEmptyString
,
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_fineAdjustYscaleOpt
->
SetToolTip
(
_
(
"Set global Y scale adjust for exact scale postscript output."
)
);
bSizer19
->
Add
(
m_fineAdjustYscaleOpt
,
0
,
wxEXPAND
|
wxBOTTOM
|
wxRIGHT
|
wxLEFT
,
5
);
bSizer19
->
Add
(
m_fineAdjustYscaleOpt
,
0
,
wxEXPAND
|
wxBOTTOM
|
wxRIGHT
|
wxLEFT
,
5
);
bSizer17
->
Add
(
bSizer19
,
1
,
wxEXPAND
,
5
);
bSizer17
->
Add
(
bSizer19
,
1
,
wxEXPAND
,
5
);
...
@@ -299,7 +301,7 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
...
@@ -299,7 +301,7 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
m_staticText2
->
Wrap
(
-
1
);
m_staticText2
->
Wrap
(
-
1
);
bSizer12
->
Add
(
m_staticText2
,
0
,
wxALL
|
wxEXPAND
,
5
);
bSizer12
->
Add
(
m_staticText2
,
0
,
wxALL
|
wxEXPAND
,
5
);
m_messagesBox
=
new
wxTextCtrl
(
this
,
wxID_ANY
,
wxEmptyString
,
wxDefaultPosition
,
wxDefaultSize
,
wxTE_MULTILINE
);
m_messagesBox
=
new
wxTextCtrl
(
this
,
wxID_ANY
,
wxEmptyString
,
wxDefaultPosition
,
wxDefaultSize
,
wxTE_MULTILINE
|
wxTE_READONLY
);
m_messagesBox
->
SetMinSize
(
wxSize
(
-
1
,
70
)
);
m_messagesBox
->
SetMinSize
(
wxSize
(
-
1
,
70
)
);
bSizer12
->
Add
(
m_messagesBox
,
1
,
wxALL
|
wxEXPAND
,
5
);
bSizer12
->
Add
(
m_messagesBox
,
1
,
wxALL
|
wxEXPAND
,
5
);
...
...
pcbnew/dialogs/dialog_plot_base.fbp
View file @
77c64161
...
@@ -462,7 +462,7 @@
...
@@ -462,7 +462,7 @@
<property
name=
"style"
></property>
<property
name=
"style"
></property>
<property
name=
"subclass"
></property>
<property
name=
"subclass"
></property>
<property
name=
"toolbar_pane"
>
0
</property>
<property
name=
"toolbar_pane"
>
0
</property>
<property
name=
"tooltip"
>
Target directory for plot files. Can be
relative or absolute
.
</property>
<property
name=
"tooltip"
>
Target directory for plot files. Can be
absolute or relative to the board file location
.
</property>
<property
name=
"validator_data_type"
></property>
<property
name=
"validator_data_type"
></property>
<property
name=
"validator_style"
>
wxFILTER_NONE
</property>
<property
name=
"validator_style"
>
wxFILTER_NONE
</property>
<property
name=
"validator_type"
>
wxDefaultValidator
</property>
<property
name=
"validator_type"
>
wxDefaultValidator
</property>
...
@@ -1242,7 +1242,7 @@
...
@@ -1242,7 +1242,7 @@
<property
name=
"style"
></property>
<property
name=
"style"
></property>
<property
name=
"subclass"
></property>
<property
name=
"subclass"
></property>
<property
name=
"toolbar_pane"
>
0
</property>
<property
name=
"toolbar_pane"
>
0
</property>
<property
name=
"tooltip"
>
Print/plot vias on mask layers. They are in this case not protected
</property>
<property
name=
"tooltip"
>
Remove soldermask on vias.
</property>
<property
name=
"validator_data_type"
></property>
<property
name=
"validator_data_type"
></property>
<property
name=
"validator_style"
>
wxFILTER_NONE
</property>
<property
name=
"validator_style"
>
wxFILTER_NONE
</property>
<property
name=
"validator_type"
>
wxDefaultValidator
</property>
<property
name=
"validator_type"
>
wxDefaultValidator
</property>
...
@@ -3146,7 +3146,7 @@
...
@@ -3146,7 +3146,7 @@
<property
name=
"style"
></property>
<property
name=
"style"
></property>
<property
name=
"subclass"
></property>
<property
name=
"subclass"
></property>
<property
name=
"toolbar_pane"
>
0
</property>
<property
name=
"toolbar_pane"
>
0
</property>
<property
name=
"tooltip"
>
Set
X scale adjust for exact scale plotting
</property>
<property
name=
"tooltip"
>
Set
global X scale adjust for exact scale postscript output.
</property>
<property
name=
"validator_data_type"
></property>
<property
name=
"validator_data_type"
></property>
<property
name=
"validator_style"
>
wxFILTER_NONE
</property>
<property
name=
"validator_style"
>
wxFILTER_NONE
</property>
<property
name=
"validator_type"
>
wxDefaultValidator
</property>
<property
name=
"validator_type"
>
wxDefaultValidator
</property>
...
@@ -3329,7 +3329,7 @@
...
@@ -3329,7 +3329,7 @@
<property
name=
"style"
></property>
<property
name=
"style"
></property>
<property
name=
"subclass"
></property>
<property
name=
"subclass"
></property>
<property
name=
"toolbar_pane"
>
0
</property>
<property
name=
"toolbar_pane"
>
0
</property>
<property
name=
"tooltip"
></property>
<property
name=
"tooltip"
>
Set global Y scale adjust for exact scale postscript output.
</property>
<property
name=
"validator_data_type"
></property>
<property
name=
"validator_data_type"
></property>
<property
name=
"validator_style"
>
wxFILTER_NONE
</property>
<property
name=
"validator_style"
>
wxFILTER_NONE
</property>
<property
name=
"validator_type"
>
wxDefaultValidator
</property>
<property
name=
"validator_type"
>
wxDefaultValidator
</property>
...
@@ -3615,7 +3615,7 @@
...
@@ -3615,7 +3615,7 @@
<property
name=
"row"
></property>
<property
name=
"row"
></property>
<property
name=
"show"
>
1
</property>
<property
name=
"show"
>
1
</property>
<property
name=
"size"
></property>
<property
name=
"size"
></property>
<property
name=
"style"
>
wxTE_MULTILINE
</property>
<property
name=
"style"
>
wxTE_MULTILINE
|wxTE_READONLY
</property>
<property
name=
"subclass"
></property>
<property
name=
"subclass"
></property>
<property
name=
"toolbar_pane"
>
0
</property>
<property
name=
"toolbar_pane"
>
0
</property>
<property
name=
"tooltip"
></property>
<property
name=
"tooltip"
></property>
...
...
pcbnew/pcb_plot_params.cpp
View file @
77c64161
...
@@ -29,18 +29,44 @@
...
@@ -29,18 +29,44 @@
#include "plot_common.h"
#include "plot_common.h"
#include "macros.h"
#include "macros.h"
#define PLOT_LINEWIDTH_MIN 40
#define PLOT_LINEWIDTH_MAX 200
#define HPGL_PEN_DIAMETER_MIN 0
#define HPGL_PEN_DIAMETER_MAX 100
#define HPGL_PEN_SPEED_MIN 0
#define HPGL_PEN_SPEED_MAX 1000
#define HPGL_PEN_NUMBER_MIN 1
#define HPGL_PEN_NUMBER_MAX 16
#define HPGL_PEN_OVERLAY_MIN 0
#define HPGL_PEN_OVERLAY_MAX 0x100
extern
int
g_DrawDefaultLineThickness
;
extern
int
g_DrawDefaultLineThickness
;
PCB_PLOT_PARAMS
g_PcbPlotOptions
;
PCB_PLOT_PARAMS
g_PcbPlotOptions
;
using
namespace
PCBPLOTPARAMS_T
;
using
namespace
PCBPLOTPARAMS_T
;
static
const
char
*
GetTokenName
(
T
aTok
)
static
const
char
*
getTokenName
(
T
aTok
)
{
{
return
PCB_PLOT_PARAMS_LEXER
::
TokenName
(
aTok
);
return
PCB_PLOT_PARAMS_LEXER
::
TokenName
(
aTok
);
}
}
static
bool
setInt
(
int
*
aInt
,
int
aValue
,
int
aMin
,
int
aMax
)
{
int
temp
=
aValue
;
if
(
aValue
<
aMin
)
temp
=
aMin
;
else
if
(
aValue
>
aMax
)
temp
=
aMax
;
*
aInt
=
temp
;
return
(
temp
==
aValue
);
}
// PCB_PLOT_PARAMS
// PCB_PLOT_PARAMS
PCB_PLOT_PARAMS
::
PCB_PLOT_PARAMS
()
PCB_PLOT_PARAMS
::
PCB_PLOT_PARAMS
()
...
@@ -81,59 +107,59 @@ PCB_PLOT_PARAMS::PCB_PLOT_PARAMS()
...
@@ -81,59 +107,59 @@ PCB_PLOT_PARAMS::PCB_PLOT_PARAMS()
void
PCB_PLOT_PARAMS
::
Format
(
OUTPUTFORMATTER
*
aFormatter
,
void
PCB_PLOT_PARAMS
::
Format
(
OUTPUTFORMATTER
*
aFormatter
,
int
aNestLevel
)
const
throw
(
IO_ERROR
)
int
aNestLevel
)
const
throw
(
IO_ERROR
)
{
{
const
char
*
falseStr
=
G
etTokenName
(
T_false
);
const
char
*
falseStr
=
g
etTokenName
(
T_false
);
const
char
*
trueStr
=
G
etTokenName
(
T_true
);
const
char
*
trueStr
=
g
etTokenName
(
T_true
);
aFormatter
->
Print
(
aNestLevel
,
"(%s"
,
G
etTokenName
(
T_pcbplotparams
)
);
aFormatter
->
Print
(
aNestLevel
,
"(%s"
,
g
etTokenName
(
T_pcbplotparams
)
);
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %ld)
\n
"
,
G
etTokenName
(
T_layerselection
),
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %ld)
\n
"
,
g
etTokenName
(
T_layerselection
),
layerSelection
);
layerSelection
);
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %s)
\n
"
,
G
etTokenName
(
T_usegerberextensions
),
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %s)
\n
"
,
g
etTokenName
(
T_usegerberextensions
),
useGerberExtensions
?
trueStr
:
falseStr
);
useGerberExtensions
?
trueStr
:
falseStr
);
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %s)
\n
"
,
G
etTokenName
(
T_excludeedgelayer
),
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %s)
\n
"
,
g
etTokenName
(
T_excludeedgelayer
),
m_ExcludeEdgeLayer
?
trueStr
:
falseStr
);
m_ExcludeEdgeLayer
?
trueStr
:
falseStr
);
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %d)
\n
"
,
G
etTokenName
(
T_linewidth
),
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %d)
\n
"
,
g
etTokenName
(
T_linewidth
),
m_PlotLineWidth
);
m_PlotLineWidth
);
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %s)
\n
"
,
G
etTokenName
(
T_plotframeref
),
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %s)
\n
"
,
g
etTokenName
(
T_plotframeref
),
m_PlotFrameRef
?
trueStr
:
falseStr
);
m_PlotFrameRef
?
trueStr
:
falseStr
);
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %s)
\n
"
,
G
etTokenName
(
T_viasonmask
),
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %s)
\n
"
,
g
etTokenName
(
T_viasonmask
),
m_PlotViaOnMaskLayer
?
trueStr
:
falseStr
);
m_PlotViaOnMaskLayer
?
trueStr
:
falseStr
);
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %d)
\n
"
,
G
etTokenName
(
T_mode
),
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %d)
\n
"
,
g
etTokenName
(
T_mode
),
m_PlotMode
);
m_PlotMode
);
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %s)
\n
"
,
G
etTokenName
(
T_useauxorigin
),
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %s)
\n
"
,
g
etTokenName
(
T_useauxorigin
),
useAuxOrigin
?
trueStr
:
falseStr
);
useAuxOrigin
?
trueStr
:
falseStr
);
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %d)
\n
"
,
G
etTokenName
(
T_hpglpennumber
),
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %d)
\n
"
,
g
etTokenName
(
T_hpglpennumber
),
m_HPGLPenNum
);
m_HPGLPenNum
);
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %d)
\n
"
,
G
etTokenName
(
T_hpglpenspeed
),
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %d)
\n
"
,
g
etTokenName
(
T_hpglpenspeed
),
m_HPGLPenSpeed
);
m_HPGLPenSpeed
);
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %d)
\n
"
,
G
etTokenName
(
T_hpglpendiameter
),
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %d)
\n
"
,
g
etTokenName
(
T_hpglpendiameter
),
m_HPGLPenDiam
);
m_HPGLPenDiam
);
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %d)
\n
"
,
G
etTokenName
(
T_hpglpenoverlay
),
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %d)
\n
"
,
g
etTokenName
(
T_hpglpenoverlay
),
m_HPGLPenOvr
);
m_HPGLPenOvr
);
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %s)
\n
"
,
G
etTokenName
(
T_pscolor
),
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %s)
\n
"
,
g
etTokenName
(
T_pscolor
),
m_PlotPSColorOpt
?
trueStr
:
falseStr
);
m_PlotPSColorOpt
?
trueStr
:
falseStr
);
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %s)
\n
"
,
G
etTokenName
(
T_psnegative
),
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %s)
\n
"
,
g
etTokenName
(
T_psnegative
),
m_PlotPSNegative
?
trueStr
:
falseStr
);
m_PlotPSNegative
?
trueStr
:
falseStr
);
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %s)
\n
"
,
G
etTokenName
(
T_plotreference
),
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %s)
\n
"
,
g
etTokenName
(
T_plotreference
),
m_PlotReference
?
trueStr
:
falseStr
);
m_PlotReference
?
trueStr
:
falseStr
);
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %s)
\n
"
,
G
etTokenName
(
T_plotvalue
),
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %s)
\n
"
,
g
etTokenName
(
T_plotvalue
),
m_PlotValue
?
trueStr
:
falseStr
);
m_PlotValue
?
trueStr
:
falseStr
);
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %s)
\n
"
,
G
etTokenName
(
T_plotothertext
),
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %s)
\n
"
,
g
etTokenName
(
T_plotothertext
),
m_PlotTextOther
?
trueStr
:
falseStr
);
m_PlotTextOther
?
trueStr
:
falseStr
);
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %s)
\n
"
,
G
etTokenName
(
T_plotinvisibletext
),
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %s)
\n
"
,
g
etTokenName
(
T_plotinvisibletext
),
m_PlotInvisibleTexts
?
trueStr
:
falseStr
);
m_PlotInvisibleTexts
?
trueStr
:
falseStr
);
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %s)
\n
"
,
G
etTokenName
(
T_padsonsilk
),
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %s)
\n
"
,
g
etTokenName
(
T_padsonsilk
),
m_PlotPadsOnSilkLayer
?
trueStr
:
falseStr
);
m_PlotPadsOnSilkLayer
?
trueStr
:
falseStr
);
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %s)
\n
"
,
G
etTokenName
(
T_subtractmaskfromsilk
),
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %s)
\n
"
,
g
etTokenName
(
T_subtractmaskfromsilk
),
subtractMaskFromSilk
?
trueStr
:
falseStr
);
subtractMaskFromSilk
?
trueStr
:
falseStr
);
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %d)
\n
"
,
G
etTokenName
(
T_outputformat
),
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %d)
\n
"
,
g
etTokenName
(
T_outputformat
),
m_PlotFormat
);
m_PlotFormat
);
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %s)
\n
"
,
G
etTokenName
(
T_mirror
),
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %s)
\n
"
,
g
etTokenName
(
T_mirror
),
m_PlotMirror
?
trueStr
:
falseStr
);
m_PlotMirror
?
trueStr
:
falseStr
);
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %d)
\n
"
,
G
etTokenName
(
T_drillshape
),
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %d)
\n
"
,
g
etTokenName
(
T_drillshape
),
m_DrillShapeOpt
);
m_DrillShapeOpt
);
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %d)
\n
"
,
G
etTokenName
(
T_scaleselection
),
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %d)
\n
"
,
g
etTokenName
(
T_scaleselection
),
scaleSelection
);
scaleSelection
);
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %s)
\n
"
,
G
etTokenName
(
T_outputdirectory
),
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %s)
\n
"
,
g
etTokenName
(
T_outputdirectory
),
aFormatter
->
Quotew
(
outputDirectory
).
c_str
()
);
aFormatter
->
Quotew
(
outputDirectory
).
c_str
()
);
aFormatter
->
Print
(
0
,
")
\n
"
);
aFormatter
->
Print
(
0
,
")
\n
"
);
}
}
...
@@ -207,6 +233,30 @@ bool PCB_PLOT_PARAMS::operator!=( const PCB_PLOT_PARAMS &aPcbPlotParams ) const
...
@@ -207,6 +233,30 @@ bool PCB_PLOT_PARAMS::operator!=( const PCB_PLOT_PARAMS &aPcbPlotParams ) const
}
}
bool
PCB_PLOT_PARAMS
::
SetHpglPenDiameter
(
int
aValue
)
{
return
setInt
(
&
m_HPGLPenDiam
,
aValue
,
HPGL_PEN_DIAMETER_MIN
,
HPGL_PEN_DIAMETER_MAX
);
}
bool
PCB_PLOT_PARAMS
::
SetHpglPenSpeed
(
int
aValue
)
{
return
setInt
(
&
m_HPGLPenSpeed
,
aValue
,
HPGL_PEN_SPEED_MIN
,
HPGL_PEN_SPEED_MAX
);
}
bool
PCB_PLOT_PARAMS
::
SetHpglPenOverlay
(
int
aValue
)
{
return
setInt
(
&
m_HPGLPenOvr
,
aValue
,
HPGL_PEN_OVERLAY_MIN
,
HPGL_PEN_OVERLAY_MAX
);
}
bool
PCB_PLOT_PARAMS
::
SetPlotLineWidth
(
int
aValue
)
{
return
setInt
(
&
m_PlotLineWidth
,
aValue
,
PLOT_LINEWIDTH_MIN
,
PLOT_LINEWIDTH_MAX
);
}
// PCB_PLOT_PARAMS_PARSER
// PCB_PLOT_PARAMS_PARSER
PCB_PLOT_PARAMS_PARSER
::
PCB_PLOT_PARAMS_PARSER
(
LINE_READER
*
aReader
)
:
PCB_PLOT_PARAMS_PARSER
::
PCB_PLOT_PARAMS_PARSER
(
LINE_READER
*
aReader
)
:
...
@@ -250,7 +300,8 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams ) throw( IO_
...
@@ -250,7 +300,8 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams ) throw( IO_
aPcbPlotParams
->
m_ExcludeEdgeLayer
=
ParseBool
();
aPcbPlotParams
->
m_ExcludeEdgeLayer
=
ParseBool
();
break
;
break
;
case
T_linewidth
:
case
T_linewidth
:
aPcbPlotParams
->
m_PlotLineWidth
=
ParseInt
(
40
,
200
);
aPcbPlotParams
->
m_PlotLineWidth
=
ParseInt
(
PLOT_LINEWIDTH_MIN
,
PLOT_LINEWIDTH_MAX
);
break
;
break
;
case
T_plotframeref
:
case
T_plotframeref
:
aPcbPlotParams
->
m_PlotFrameRef
=
ParseBool
();
aPcbPlotParams
->
m_PlotFrameRef
=
ParseBool
();
...
@@ -265,16 +316,20 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams ) throw( IO_
...
@@ -265,16 +316,20 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams ) throw( IO_
aPcbPlotParams
->
useAuxOrigin
=
ParseBool
();
aPcbPlotParams
->
useAuxOrigin
=
ParseBool
();
break
;
break
;
case
T_hpglpennumber
:
case
T_hpglpennumber
:
aPcbPlotParams
->
m_HPGLPenNum
=
ParseInt
(
1
,
16
);
aPcbPlotParams
->
m_HPGLPenNum
=
ParseInt
(
HPGL_PEN_NUMBER_MIN
,
HPGL_PEN_NUMBER_MAX
);
break
;
break
;
case
T_hpglpenspeed
:
case
T_hpglpenspeed
:
aPcbPlotParams
->
m_HPGLPenSpeed
=
ParseInt
(
0
,
1000
);
aPcbPlotParams
->
m_HPGLPenSpeed
=
ParseInt
(
HPGL_PEN_SPEED_MIN
,
HPGL_PEN_SPEED_MAX
);
break
;
break
;
case
T_hpglpendiameter
:
case
T_hpglpendiameter
:
aPcbPlotParams
->
m_HPGLPenDiam
=
ParseInt
(
0
,
100
);
aPcbPlotParams
->
m_HPGLPenDiam
=
ParseInt
(
HPGL_PEN_DIAMETER_MIN
,
HPGL_PEN_DIAMETER_MAX
);
break
;
break
;
case
T_hpglpenoverlay
:
case
T_hpglpenoverlay
:
aPcbPlotParams
->
m_HPGLPenOvr
=
ParseInt
(
0
,
0x100
);
aPcbPlotParams
->
m_HPGLPenOvr
=
ParseInt
(
HPGL_PEN_OVERLAY_MIN
,
HPGL_PEN_OVERLAY_MIN
);
break
;
break
;
case
T_pscolor
:
case
T_pscolor
:
aPcbPlotParams
->
m_PlotPSColorOpt
=
ParseBool
();
aPcbPlotParams
->
m_PlotPSColorOpt
=
ParseBool
();
...
...
pcbnew/pcb_plot_params.h
View file @
77c64161
...
@@ -114,6 +114,15 @@ public:
...
@@ -114,6 +114,15 @@ public:
bool
GetUseAuxOrigin
()
const
{
return
useAuxOrigin
;
};
bool
GetUseAuxOrigin
()
const
{
return
useAuxOrigin
;
};
void
SetScaleSelection
(
int
aSelection
)
{
scaleSelection
=
aSelection
;
};
void
SetScaleSelection
(
int
aSelection
)
{
scaleSelection
=
aSelection
;
};
int
GetScaleSelection
()
const
{
return
scaleSelection
;
};
int
GetScaleSelection
()
const
{
return
scaleSelection
;
};
int
GetHpglPenDiameter
()
const
{
return
m_HPGLPenDiam
;
};
bool
SetHpglPenDiameter
(
int
aValue
);
int
GetHpglPenSpeed
()
const
{
return
m_HPGLPenSpeed
;
};
bool
SetHpglPenSpeed
(
int
aValue
);
int
GetHpglPenOverlay
()
const
{
return
m_HPGLPenOvr
;
};
bool
SetHpglPenOverlay
(
int
aValue
);
int
GetPlotLineWidth
()
const
{
return
m_PlotLineWidth
;
};
bool
SetPlotLineWidth
(
int
aValue
);
};
};
...
...
pcbnew/pcbplot.cpp
View file @
77c64161
...
@@ -19,11 +19,10 @@
...
@@ -19,11 +19,10 @@
#include "dialog_plot_base.h"
#include "dialog_plot_base.h"
#include "pcb_plot_params.h"
#include "pcb_plot_params.h"
#define PLOT_DEFAULT_MARGE 300 // mils
/* Keywords to r/w options in m_Config */
/* Keywords to r/w options in m_Config */
#define
OPTKEY
_XFINESCALE_ADJ wxT( "PlotXFineScaleAdj" )
#define
CONFIG
_XFINESCALE_ADJ wxT( "PlotXFineScaleAdj" )
#define
OPTKEY
_YFINESCALE_ADJ wxT( "PlotYFineScaleAdj" )
#define
CONFIG
_YFINESCALE_ADJ wxT( "PlotYFineScaleAdj" )
// Define min and max reasonable values for print scale
// Define min and max reasonable values for print scale
#define MIN_SCALE 0.01
#define MIN_SCALE 0.01
...
@@ -32,6 +31,23 @@
...
@@ -32,6 +31,23 @@
extern
int
g_DrawDefaultLineThickness
;
extern
int
g_DrawDefaultLineThickness
;
static
bool
setDouble
(
double
*
aDouble
,
double
aValue
,
double
aMin
,
double
aMax
)
{
if
(
aValue
<
aMin
)
{
*
aDouble
=
aMin
;
return
false
;
}
else
if
(
aValue
>
aMax
)
{
*
aDouble
=
aMax
;
return
false
;
}
*
aDouble
=
aValue
;
return
true
;
}
/*******************************/
/*******************************/
/* Dialog box for plot control */
/* Dialog box for plot control */
/*******************************/
/*******************************/
...
@@ -114,30 +130,27 @@ void DIALOG_PLOT::Init_Dialog()
...
@@ -114,30 +130,27 @@ void DIALOG_PLOT::Init_Dialog()
BOARD
*
board
=
m_Parent
->
GetBoard
();
BOARD
*
board
=
m_Parent
->
GetBoard
();
m_Config
->
Read
(
OPTKEY
_XFINESCALE_ADJ
,
&
m_XScaleAdjust
);
m_Config
->
Read
(
CONFIG
_XFINESCALE_ADJ
,
&
m_XScaleAdjust
);
m_Config
->
Read
(
OPTKEY
_YFINESCALE_ADJ
,
&
m_YScaleAdjust
);
m_Config
->
Read
(
CONFIG
_YFINESCALE_ADJ
,
&
m_YScaleAdjust
);
m_plotFormatOpt
->
SetSelection
(
g_PcbPlotOptions
.
m_PlotFormat
);
m_plotFormatOpt
->
SetSelection
(
g_PcbPlotOptions
.
m_PlotFormat
);
// Set units and value for HPGL pen size.
// Set units and value for HPGL pen size.
AddUnitSymbol
(
*
m_textPenSize
,
g_UserUnit
);
AddUnitSymbol
(
*
m_textPenSize
,
g_UserUnit
);
msg
=
ReturnStringFromValue
(
g_UserUnit
,
g_PcbPlotOptions
.
m_HPGLPenDiam
,
UNITS_MILS
);
msg
=
ReturnStringFromValue
(
g_UserUnit
,
g_PcbPlotOptions
.
GetHpglPenDiameter
()
,
UNITS_MILS
);
m_HPGLPenSizeOpt
->
AppendText
(
msg
);
m_HPGLPenSizeOpt
->
AppendText
(
msg
);
// Set units to cm/s for standard HPGL pen speed.
// Set units to cm/s for standard HPGL pen speed.
msg
=
ReturnStringFromValue
(
UNSCALED_UNITS
,
g_PcbPlotOptions
.
m_HPGLPenSpeed
,
1
);
msg
=
ReturnStringFromValue
(
UNSCALED_UNITS
,
g_PcbPlotOptions
.
GetHpglPenSpeed
()
,
1
);
m_HPGLPenSpeedOpt
->
AppendText
(
msg
);
m_HPGLPenSpeedOpt
->
AppendText
(
msg
);
// Set units and value for HPGL pen overlay.
// Set units and value for HPGL pen overlay.
AddUnitSymbol
(
*
m_textPenOvr
,
g_UserUnit
);
AddUnitSymbol
(
*
m_textPenOvr
,
g_UserUnit
);
msg
=
ReturnStringFromValue
(
g_UserUnit
,
msg
=
ReturnStringFromValue
(
g_UserUnit
,
g_PcbPlotOptions
.
GetHpglPenOverlay
(),
UNITS_MILS
);
g_PcbPlotOptions
.
m_HPGLPenOvr
,
UNITS_MILS
);
m_HPGLPenOverlayOpt
->
AppendText
(
msg
);
m_HPGLPenOverlayOpt
->
AppendText
(
msg
);
AddUnitSymbol
(
*
m_textDefaultPenSize
,
g_UserUnit
);
AddUnitSymbol
(
*
m_textDefaultPenSize
,
g_UserUnit
);
msg
=
ReturnStringFromValue
(
g_UserUnit
,
msg
=
ReturnStringFromValue
(
g_UserUnit
,
g_PcbPlotOptions
.
GetPlotLineWidth
(),
g_PcbPlotOptions
.
m_PlotLineWidth
,
PCB_INTERNAL_UNIT
);
PCB_INTERNAL_UNIT
);
m_linesWidth
->
AppendText
(
msg
);
m_linesWidth
->
AppendText
(
msg
);
...
@@ -453,28 +466,83 @@ void DIALOG_PLOT::applyPlotSettings( wxCommandEvent& event )
...
@@ -453,28 +466,83 @@ void DIALOG_PLOT::applyPlotSettings( wxCommandEvent& event )
tempOptions
.
m_PlotMode
=
(
GRTraceMode
)
m_plotModeOpt
->
GetSelection
();
tempOptions
.
m_PlotMode
=
(
GRTraceMode
)
m_plotModeOpt
->
GetSelection
();
tempOptions
.
m_PlotViaOnMaskLayer
=
m_plotNoViaOnMaskOpt
->
GetValue
();
tempOptions
.
m_PlotViaOnMaskLayer
=
m_plotNoViaOnMaskOpt
->
GetValue
();
// Update settings from text fields. Rewrite values back to the fields,
// since the values may have been constrained by the setters.
// HPLG pen size
wxString
msg
=
m_HPGLPenSizeOpt
->
GetValue
();
wxString
msg
=
m_HPGLPenSizeOpt
->
GetValue
();
int
tmp
=
ReturnValueFromString
(
g_UserUnit
,
msg
,
UNITS_MILS
);
int
tmp
=
ReturnValueFromString
(
g_UserUnit
,
msg
,
UNITS_MILS
);
tempOptions
.
m_HPGLPenDiam
=
tmp
;
if
(
!
tempOptions
.
SetHpglPenDiameter
(
tmp
)
)
{
msg
=
ReturnStringFromValue
(
g_UserUnit
,
tempOptions
.
GetHpglPenDiameter
(),
UNITS_MILS
);
m_HPGLPenSizeOpt
->
SetValue
(
msg
);
msg
.
Printf
(
wxT
(
"HPGL pen size constrained!
\n
"
)
);
m_messagesBox
->
AppendText
(
msg
);
}
// HPGL pen speed
msg
=
m_HPGLPenSpeedOpt
->
GetValue
();
msg
=
m_HPGLPenSpeedOpt
->
GetValue
();
tmp
=
ReturnValueFromString
(
UNSCALED_UNITS
,
msg
,
1
);
tmp
=
ReturnValueFromString
(
UNSCALED_UNITS
,
msg
,
1
);
tempOptions
.
m_HPGLPenSpeed
=
tmp
;
if
(
!
tempOptions
.
SetHpglPenSpeed
(
tmp
)
)
{
msg
=
ReturnStringFromValue
(
UNSCALED_UNITS
,
tempOptions
.
GetHpglPenSpeed
(),
1
);
m_HPGLPenSpeedOpt
->
SetValue
(
msg
);
msg
.
Printf
(
wxT
(
"HPGL pen speed constrained!
\n
"
)
);
m_messagesBox
->
AppendText
(
msg
);
}
// HPGL pen overlay
msg
=
m_HPGLPenOverlayOpt
->
GetValue
();
msg
=
m_HPGLPenOverlayOpt
->
GetValue
();
tmp
=
ReturnValueFromString
(
g_UserUnit
,
msg
,
UNITS_MILS
);
tmp
=
ReturnValueFromString
(
g_UserUnit
,
msg
,
UNITS_MILS
);
tempOptions
.
m_HPGLPenOvr
=
tmp
;
if
(
!
tempOptions
.
SetHpglPenOverlay
(
tmp
)
)
{
msg
=
ReturnStringFromValue
(
g_UserUnit
,
tempOptions
.
GetHpglPenOverlay
(),
UNITS_MILS
);
m_HPGLPenOverlayOpt
->
SetValue
(
msg
);
msg
.
Printf
(
wxT
(
"HPGL pen overlay constrained!
\n
"
)
);
m_messagesBox
->
AppendText
(
msg
);
}
// Default linewidth
msg
=
m_linesWidth
->
GetValue
();
msg
=
m_linesWidth
->
GetValue
();
tmp
=
ReturnValueFromString
(
g_UserUnit
,
msg
,
PCB_INTERNAL_UNIT
);
tmp
=
ReturnValueFromString
(
g_UserUnit
,
msg
,
PCB_INTERNAL_UNIT
);
tempOptions
.
m_PlotLineWidth
=
tmp
;
if
(
!
tempOptions
.
SetPlotLineWidth
(
tmp
)
)
{
msg
=
ReturnStringFromValue
(
g_UserUnit
,
tempOptions
.
GetPlotLineWidth
(),
PCB_INTERNAL_UNIT
);
m_linesWidth
->
SetValue
(
msg
);
msg
.
Printf
(
wxT
(
"Default linewidth constrained!
\n
"
)
);
m_messagesBox
->
AppendText
(
msg
);
}
// X scale
double
tmpDouble
;
msg
=
m_fineAdjustXscaleOpt
->
GetValue
();
msg
=
m_fineAdjustXscaleOpt
->
GetValue
();
msg
.
ToDouble
(
&
m_XScaleAdjust
);
msg
.
ToDouble
(
&
tmpDouble
);
if
(
!
setDouble
(
&
m_XScaleAdjust
,
tmpDouble
,
MIN_SCALE
,
MAX_SCALE
)
)
{
msg
.
Printf
(
wxT
(
"%f"
),
m_XScaleAdjust
);
m_fineAdjustXscaleOpt
->
SetValue
(
msg
);
msg
.
Printf
(
wxT
(
"X scale constrained!
\n
"
)
);
m_messagesBox
->
AppendText
(
msg
);
}
m_Config
->
Write
(
CONFIG_XFINESCALE_ADJ
,
m_XScaleAdjust
);
// Y scale
msg
=
m_fineAdjustYscaleOpt
->
GetValue
();
msg
=
m_fineAdjustYscaleOpt
->
GetValue
();
msg
.
ToDouble
(
&
m_YScaleAdjust
);
msg
.
ToDouble
(
&
tmpDouble
);
m_Config
->
Write
(
OPTKEY_XFINESCALE_ADJ
,
m_XScaleAdjust
);
m_Config
->
Write
(
OPTKEY_YFINESCALE_ADJ
,
m_YScaleAdjust
);
if
(
!
setDouble
(
&
m_YScaleAdjust
,
tmpDouble
,
MIN_SCALE
,
MAX_SCALE
)
)
{
msg
.
Printf
(
wxT
(
"%f"
),
m_YScaleAdjust
);
m_fineAdjustYscaleOpt
->
SetValue
(
msg
);
msg
.
Printf
(
wxT
(
"Y scale constrained!
\n
"
)
);
m_messagesBox
->
AppendText
(
msg
);
}
m_Config
->
Write
(
CONFIG_YFINESCALE_ADJ
,
m_YScaleAdjust
);
tempOptions
.
SetUseGerberExtensions
(
m_useGerberExtensions
->
GetValue
()
);
tempOptions
.
SetUseGerberExtensions
(
m_useGerberExtensions
->
GetValue
()
);
...
...
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