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
a564d2f8
Commit
a564d2f8
authored
Dec 14, 2012
by
Dick Hollenbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor file save as fixes, move legacy header into its plugin
parent
79b48462
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
17 deletions
+32
-17
files.cpp
pcbnew/files.cpp
+17
-14
legacy_plugin.cpp
pcbnew/legacy_plugin.cpp
+15
-3
No files found.
pcbnew/files.cpp
View file @
a564d2f8
...
...
@@ -415,13 +415,22 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
wildcard
<<
wxGetTranslation
(
PcbFileWildcard
)
<<
wxChar
(
'|'
)
<<
wxGetTranslation
(
LegacyPcbFileWildcard
);
wxFileDialog
dlg
(
this
,
_
(
"Save Board File"
),
wxEmptyString
,
GetBoard
()
->
GetFileName
(),
wildcard
,
wxFD_SAVE
|
wxFD_OVERWRITE_PROMPT
);
wxFileDialog
dlg
(
this
,
_
(
"Save Board File As"
),
wxEmptyString
,
GetBoard
()
->
GetFileName
(),
wildcard
,
wxFD_SAVE
/* wxFileDialog is not equipped to handle multiple wildcards and
wxFD_OVERWRITE_PROMPT both together.
| wxFD_OVERWRITE_PROMPT
*/
);
if
(
dlg
.
ShowModal
()
!=
wxID_OK
)
return
false
;
pluginType
=
(
dlg
.
GetFilterIndex
()
==
1
)
?
IO_MGR
::
LEGACY
:
IO_MGR
::
KICAD
;
int
filterNdx
=
dlg
.
GetFilterIndex
();
pluginType
=
(
filterNdx
==
1
)
?
IO_MGR
::
LEGACY
:
IO_MGR
::
KICAD
;
// Note: on Linux wxFileDialog is not reliable for noticing a changed filename.
pcbFileName
=
dlg
.
GetPath
();
...
...
@@ -492,21 +501,15 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
try
{
PROPERTIES
props
;
PLUGIN
*
plugin
=
IO_MGR
::
PluginFind
(
pluginType
);
PLUGIN
::
RELEASER
pi
(
IO_MGR
::
PluginFind
(
pluginType
)
);
if
(
plugin
==
NULL
)
/*
if( (PLUGIN*)pi == NULL )
THROW_IO_ERROR( wxString::Format( _( "cannot find file plug in for file format '%s'" ),
GetChars( pcbFileName.GetExt() ) ) );
*/
wxString
header
=
wxString
::
Format
(
wxT
(
"PCBNEW-BOARD Version %d
\n
# Created by Pcbnew%s
\n\n
"
),
LEGACY_BOARD_FILE_VERSION
,
GetBuildVersion
().
GetData
()
);
props
[
"header"
]
=
header
;
plugin
->
Save
(
pcbFileName
.
GetFullPath
(),
GetBoard
(),
&
props
);
pi
->
Save
(
pcbFileName
.
GetFullPath
(),
GetBoard
(),
NULL
);
}
catch
(
IO_ERROR
ioe
)
{
...
...
pcbnew/legacy_plugin.cpp
View file @
a564d2f8
...
...
@@ -62,6 +62,7 @@
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <wx/ffile.h>
#include <legacy_plugin.h> // implement this here
...
...
@@ -83,8 +84,7 @@
#include <drawtxt.h>
#include <convert_to_biu.h>
#include <trigo.h>
#include <wx/ffile.h>
#include <build_version.h>
typedef
LEGACY_PLUGIN
::
BIU
BIU
;
...
...
@@ -2823,14 +2823,26 @@ void LEGACY_PLUGIN::Save( const wxString& aFileName, BOARD* aBoard, PROPERTIES*
m_fp
=
fp
;
// member function accessibility
#if 0 // old school, property "header" was not used by any other plugin.
if( m_props )
{
// @todo move the header production into this source file.
wxString header = (*m_props)["header"];
// save a file header, if caller provided one (with trailing \n hopefully).
fprintf( m_fp, "%s", TO_UTF8( header ) );
}
#else
wxString
header
=
wxString
::
Format
(
wxT
(
"PCBNEW-BOARD Version %d date %s
\n\n
# Created by Pcbnew%s
\n\n
"
),
LEGACY_BOARD_FILE_VERSION
,
DateAndTime
().
GetData
(),
GetBuildVersion
().
GetData
()
);
// save a file header, if caller provided one (with trailing \n hopefully).
fprintf
(
m_fp
,
"%s"
,
TO_UTF8
(
header
)
);
#endif
SaveBOARD
(
aBoard
);
}
...
...
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