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
4fad477d
Commit
4fad477d
authored
Jun 24, 2013
by
Dick Hollenbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add CTL_OMIT_INITIAL_COMMENTS and CTL_FOR_BOARD PCB_IO::Format()ing flags
parent
9d86345e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
11 deletions
+23
-11
kicad_plugin.cpp
pcbnew/kicad_plugin.cpp
+17
-8
kicad_plugin.h
pcbnew/kicad_plugin.h
+6
-3
No files found.
pcbnew/kicad_plugin.cpp
View file @
4fad477d
...
...
@@ -331,7 +331,9 @@ void PCB_IO::Save( const wxString& aFileName, BOARD* aBoard, PROPERTIES* aProper
{
LOCALE_IO
toggle
;
// toggles on, then off, the C locale.
m_board
=
aBoard
;
init
(
aProperties
);
m_board
=
aBoard
;
// after init()
FILE_OUTPUTFORMATTER
formatter
(
aFileName
);
...
...
@@ -881,12 +883,17 @@ void PCB_IO::format( PCB_TARGET* aTarget, int aNestLevel ) const
void
PCB_IO
::
format
(
MODULE
*
aModule
,
int
aNestLevel
)
const
throw
(
IO_ERROR
)
{
const
wxArrayString
*
initial_comments
=
aModule
->
GetInitialComments
();
if
(
initial_comments
)
if
(
!
(
m_ctl
&
CTL_OMIT_INITIAL_COMMENTS
)
)
{
for
(
unsigned
i
=
0
;
i
<
initial_comments
->
GetCount
();
++
i
)
m_out
->
Print
(
aNestLevel
,
"%s
\n
"
,
TO_UTF8
(
(
*
initial_comments
)[
i
]
)
);
const
wxArrayString
*
initial_comments
=
aModule
->
GetInitialComments
();
if
(
initial_comments
)
{
for
(
unsigned
i
=
0
;
i
<
initial_comments
->
GetCount
();
++
i
)
m_out
->
Print
(
aNestLevel
,
"%s
\n
"
,
TO_UTF8
(
(
*
initial_comments
)[
i
]
)
);
m_out
->
Print
(
0
,
"
\n
"
);
// improve readability?
}
}
m_out
->
Print
(
aNestLevel
,
"(module %s"
,
m_out
->
Quotew
(
aModule
->
GetLibRef
()
).
c_str
()
);
...
...
@@ -1073,7 +1080,7 @@ void PCB_IO::formatLayers( LAYER_MSK aLayerMask, int aNestLevel ) const
{
if
(
aLayerMask
&
GetLayerMask
(
layer
)
)
{
if
(
m_board
&&
!
(
m_ctl
&
CTL_STD_LAYER_NAMES
)
)
if
(
m_board
&&
!
(
m_ctl
&
CTL_STD_LAYER_NAMES
)
)
layerName
=
m_board
->
GetLayerName
(
layer
);
else
// I am being called from FootprintSave()
...
...
@@ -1558,7 +1565,7 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const
PCB_IO
::
PCB_IO
()
:
m_cache
(
0
),
m_ctl
(
0
),
m_ctl
(
CTL_FOR_BOARD
),
// expecting to OUTPUTFORMAT into BOARD files.
m_parser
(
new
PCB_PARSER
()
)
{
init
(
0
);
...
...
@@ -1587,6 +1594,8 @@ BOARD* PCB_IO::Load( const wxString& aFileName, BOARD* aAppendToMe, PROPERTIES*
{
FILE_LINE_READER
reader
(
aFileName
);
init
(
aProperties
);
m_parser
->
SetLineReader
(
&
reader
);
m_parser
->
SetBoard
(
aAppendToMe
);
...
...
pcbnew/kicad_plugin.h
View file @
4fad477d
...
...
@@ -37,12 +37,11 @@ class PCB_PARSER;
/// Current s-expression file format version. 2 was the last legacy format version.
#define SEXPR_BOARD_FILE_VERSION 3
/// Use English Standard layer names
#define CTL_STD_LAYER_NAMES (1 << 0)
#define CTL_STD_LAYER_NAMES (1 << 0) ///< Use English Standard layer names
#define CTL_OMIT_NETS (1 << 1)
#define CTL_OMIT_TSTAMPS (1 << 2)
#define CTL_OMIT_INITIAL_COMMENTS (1 << 3) ///< omit MODULE initial comments
// common combinations of the above:
...
...
@@ -52,6 +51,10 @@ class PCB_PARSER;
/// Format output for a footprint library instead of clipboard or BOARD
#define CTL_FOR_LIBRARY (CTL_STD_LAYER_NAMES|CTL_OMIT_NETS|CTL_OMIT_TSTAMPS)
/// The zero arg constructor when PCB_IO is used for PLUGIN::Load() and PLUGIN::Save()ing
/// a BOARD file underneath IO_MGR.
#define CTL_FOR_BOARD (CTL_OMIT_INITIAL_COMMENTS)
/**
* Class PCB_IO
* is a PLUGIN derivation for saving and loading Pcbnew s-expression formatted files.
...
...
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