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
79b48462
Commit
79b48462
authored
Dec 14, 2012
by
Dick Hollenbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch over to *.kicad_pcb format as the default BOARD format.
Add KiCadPcbFileExt global.
parent
312254bc
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
59 additions
and
35 deletions
+59
-35
wildcards_and_files_ext.cpp
common/wildcards_and_files_ext.cpp
+4
-1
worksheet.cpp
common/worksheet.cpp
+4
-2
wildcards_and_files_ext.h
include/wildcards_and_files_ext.h
+5
-1
mainframe.cpp
kicad/mainframe.cpp
+9
-3
tree_project_frame.cpp
kicad/tree_project_frame.cpp
+2
-4
files.cpp
pcbnew/files.cpp
+25
-19
kicad_plugin.cpp
pcbnew/kicad_plugin.cpp
+6
-5
kicad_plugin.h
pcbnew/kicad_plugin.h
+4
-0
No files found.
common/wildcards_and_files_ext.cpp
View file @
79b48462
...
...
@@ -44,7 +44,10 @@ const wxString NetlistFileExtension( wxT( "net" ) );
const
wxString
LegacyFootprintLibPathExtension
(
wxT
(
"mod"
)
);
const
wxString
ComponentFileExtension
(
wxT
(
"cmp"
)
);
const
wxString
GerberFileExtension
(
wxT
(
"pho"
)
);
const
wxString
PcbFileExtension
(
wxT
(
"brd"
)
);
const
wxString
LegacyPcbFileExtension
(
wxT
(
"brd"
)
);
const
wxString
KiCadPcbFileExtension
(
wxT
(
"kicad_pcb"
)
);
const
wxString
PdfFileExtension
(
wxT
(
"pdf"
)
);
const
wxString
MacrosFileExtension
(
wxT
(
"mcr"
)
);
const
wxString
DrillFileExtension
(
wxT
(
"drl"
)
);
...
...
common/worksheet.cpp
View file @
79b48462
...
...
@@ -1666,19 +1666,21 @@ void TITLE_BLOCK::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aCont
throw
(
IO_ERROR
)
{
// Don't write the title block information if there is nothing to write.
if
(
!
m_title
.
IsEmpty
()
||
!
m_date
.
IsEmpty
()
||
!
m_revision
.
IsEmpty
()
if
(
!
m_title
.
IsEmpty
()
||
/* !m_date.IsEmpty() || */
!
m_revision
.
IsEmpty
()
||
!
m_company
.
IsEmpty
()
||
!
m_comment1
.
IsEmpty
()
||
!
m_comment2
.
IsEmpty
()
||
!
m_comment3
.
IsEmpty
()
||
!
m_comment4
.
IsEmpty
()
)
{
aFormatter
->
Print
(
aNestLevel
,
"(title_block
\n
"
);
aFormatter
->
Print
(
aNestLevel
,
"(title_block
"
);
if
(
!
m_title
.
IsEmpty
()
)
aFormatter
->
Print
(
aNestLevel
+
1
,
"(title %s)
\n
"
,
aFormatter
->
Quotew
(
m_title
).
c_str
()
);
/* version control users were complaining, see mailing list.
if( !m_date.IsEmpty() )
aFormatter->Print( aNestLevel+1, "(date %s)\n",
aFormatter->Quotew( m_date ).c_str() );
*/
if
(
!
m_revision
.
IsEmpty
()
)
aFormatter
->
Print
(
aNestLevel
+
1
,
"(rev %s)
\n
"
,
...
...
include/wildcards_and_files_ext.h
View file @
79b48462
...
...
@@ -51,7 +51,11 @@ extern const wxString ProjectFileExtension;
extern
const
wxString
SchematicFileExtension
;
extern
const
wxString
NetlistFileExtension
;
extern
const
wxString
GerberFileExtension
;
extern
const
wxString
PcbFileExtension
;
extern
const
wxString
LegacyPcbFileExtension
;
extern
const
wxString
KiCadPcbFileExtension
;
#define PcbFileExtension KiCadPcbFileExtension // symlink choice
extern
const
wxString
LegacyFootprintLibPathExtension
;
extern
const
wxString
PdfFileExtension
;
extern
const
wxString
MacrosFileExtension
;
...
...
kicad/mainframe.cpp
View file @
79b48462
...
...
@@ -199,10 +199,16 @@ void KICAD_MANAGER_FRAME::OnRunPcbCalculator( wxCommandEvent& event )
void
KICAD_MANAGER_FRAME
::
OnRunPcbNew
(
wxCommandEvent
&
event
)
{
wxFileName
fn
(
m_ProjectFileName
);
wxFileName
legacy_board
(
m_ProjectFileName
);
wxFileName
kicad_board
(
m_ProjectFileName
);
legacy_board
.
SetExt
(
LegacyPcbFileExtension
);
kicad_board
.
SetExt
(
KiCadPcbFileExtension
);
fn
.
SetExt
(
PcbFileExtension
);
ExecuteFile
(
this
,
PCBNEW_EXE
,
QuoteFullPath
(
fn
)
);
if
(
!
legacy_board
.
FileExists
()
||
kicad_board
.
FileExists
()
)
ExecuteFile
(
this
,
PCBNEW_EXE
,
QuoteFullPath
(
kicad_board
)
);
else
ExecuteFile
(
this
,
PCBNEW_EXE
,
QuoteFullPath
(
legacy_board
)
);
}
...
...
kicad/tree_project_frame.cpp
View file @
79b48462
...
...
@@ -45,8 +45,6 @@
#include <wx/imaglist.h>
#include <menus_helpers.h>
// TODO: use the wxString defined in wildcards_and_files_ext.h, when exists
const
wxString
PcbSexpFileExtension
(
wxT
(
"kicad_brd"
)
);
/* Note about the tree project build process:
* Building the tree project can be *very* long if there are a lot of subdirectories
...
...
@@ -419,11 +417,11 @@ wxString TREE_PROJECT_FRAME::GetFileExt( TreeFileType type )
break
;
case
TREE_LEGACY_PCB
:
ext
=
PcbFileExtension
;
ext
=
Legacy
PcbFileExtension
;
break
;
case
TREE_SEXP_PCB
:
ext
=
PcbSexp
FileExtension
;
ext
=
KiCadPcb
FileExtension
;
break
;
case
TREE_GERBER
:
...
...
pcbnew/files.cpp
View file @
79b48462
...
...
@@ -188,8 +188,8 @@ the changes?" ) ) )
IO_MGR
::
PCB_FILE_T
pluginType
;
}
loaders
[]
=
{
{
LegacyPcbFileWildcard
,
IO_MGR
::
LEGACY
},
{
PcbFileWildcard
,
IO_MGR
::
KICAD
},
{
LegacyPcbFileWildcard
,
IO_MGR
::
LEGACY
},
{
EaglePcbFileWildcard
,
IO_MGR
::
EAGLE
},
};
...
...
@@ -405,31 +405,41 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
wxString
upperTxt
;
wxString
lowerTxt
;
wxString
msg
;
wxString
wildcard
;
int
wildcardIndex
=
0
;
bool
saveok
=
true
;
wildcard
<<
wxGetTranslation
(
LegacyPcbFileWildcard
)
<<
wxChar
(
'|'
)
<<
wxGetTranslation
(
PcbFileWildcard
);
IO_MGR
::
PCB_FILE_T
pluginType
;
if
(
aFileName
==
wxEmptyString
)
{
wxString
wildcard
;
wildcard
<<
wxGetTranslation
(
PcbFileWildcard
)
<<
wxChar
(
'|'
)
<<
wxGetTranslation
(
LegacyPcbFileWildcard
);
wxFileDialog
dlg
(
this
,
_
(
"Save Board File"
),
wxEmptyString
,
GetBoard
()
->
GetFileName
(),
wildcard
,
wxFD_SAVE
|
wxFD_OVERWRITE_PROMPT
);
if
(
dlg
.
ShowModal
()
!=
wxID_OK
)
return
false
;
GetBoard
()
->
SetFileName
(
dlg
.
GetPath
()
);
wildcardIndex
=
dlg
.
GetFilterIndex
();
// Legacy or s-expression file format.
pluginType
=
(
dlg
.
GetFilterIndex
()
==
1
)
?
IO_MGR
::
LEGACY
:
IO_MGR
::
KICAD
;
pcbFileName
=
dlg
.
GetPath
();
// enforce file extension, must match plugin's policy.
pcbFileName
.
SetExt
(
IO_MGR
::
GetFileExtension
(
pluginType
)
);
}
else
{
GetBoard
()
->
SetFileName
(
aFileName
);
}
pcbFileName
=
aFileName
;
IO_MGR
::
PCB_FILE_T
pluginType
=
(
wildcardIndex
==
0
)
?
IO_MGR
::
LEGACY
:
IO_MGR
::
KICAD
;
if
(
pcbFileName
.
GetExt
()
==
LegacyPcbFileExtension
)
pluginType
=
IO_MGR
::
LEGACY
;
else
{
pluginType
=
IO_MGR
::
KICAD
;
pcbFileName
.
SetExt
(
KiCadPcbFileExtension
);
}
}
// If changes are made, update the board date
if
(
GetScreen
()
->
IsModify
()
)
...
...
@@ -440,11 +450,6 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
SetTitleBlock
(
tb
);
}
pcbFileName
=
GetBoard
()
->
GetFileName
();
if
(
pcbFileName
.
GetExt
().
IsEmpty
()
)
pcbFileName
.
SetExt
(
IO_MGR
::
GetFileExtension
(
pluginType
)
);
if
(
!
IsWritable
(
pcbFileName
)
)
return
false
;
...
...
@@ -462,7 +467,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
if
(
backupFileName
.
FileExists
()
)
wxRemoveFile
(
backupFileName
.
GetFullPath
()
);
// Rename the "old" file" from xxx.
brd
to xxx.000
// Rename the "old" file" from xxx.
kicad_pcb
to xxx.000
if
(
!
wxRenameFile
(
pcbFileName
.
GetFullPath
(),
backupFileName
.
GetFullPath
()
)
)
{
msg
=
_
(
"Warning: unable to create backup file "
)
+
backupFileName
.
GetFullPath
();
...
...
@@ -495,8 +500,8 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
GetChars
(
pcbFileName
.
GetExt
()
)
)
);
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
(),
wxT
(
"PCBNEW-BOARD Version %d
\n
# Created by Pcbnew%s
\n\n
"
),
LEGACY_BOARD_FILE_VERSION
,
GetBuildVersion
().
GetData
()
);
props
[
"header"
]
=
header
;
...
...
@@ -515,6 +520,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
{
GetBoard
()
->
SetFileName
(
pcbFileName
.
GetFullPath
()
);
UpdateTitle
();
UpdateFileHistory
(
GetBoard
()
->
GetFileName
()
);
}
// Display the file names:
...
...
pcbnew/kicad_plugin.cpp
View file @
79b48462
...
...
@@ -606,7 +606,7 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const
for
(
BOARD_ITEM
*
item
=
aBoard
->
m_Drawings
;
item
;
item
=
item
->
Next
()
)
Format
(
item
,
aNestLevel
);
m_out
->
Print
(
0
,
"
\n
"
);
if
(
aBoard
->
m_Drawings
.
GetCount
()
)
m_out
->
Print
(
0
,
"
\n
"
);
// Do not save MARKER_PCBs, they can be regenerated easily.
...
...
@@ -615,11 +615,12 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const
for
(
TRACK
*
track
=
aBoard
->
m_Track
;
track
;
track
=
track
->
Next
()
)
Format
(
track
,
aNestLevel
);
if
(
aBoard
->
m_Track
.
GetCount
()
)
m_out
->
Print
(
0
,
"
\n
"
);
/// @todo Add warning here that the old segment filed zones are no longer supported and
/// will not be saved.
m_out
->
Print
(
0
,
"
\n
"
);
// Save the polygon (which are the newer technology) zones.
for
(
int
i
=
0
;
i
<
aBoard
->
GetAreaCount
();
++
i
)
Format
(
aBoard
->
GetArea
(
i
),
aNestLevel
);
...
...
pcbnew/kicad_plugin.h
View file @
79b48462
...
...
@@ -73,6 +73,10 @@ public:
const
wxString
&
GetFileExtension
()
const
{
// Would have used wildcards_and_files_ext.cpp's KiCadPcbFileExtension,
// but to be pure, a plugin should not assume that it will always be linked
// with the core of the pcbnew code. (Might someday be a DLL/DSO.) Besides,
// file extension policy should be controlled by the plugin.
static
const
wxString
extension
=
wxT
(
"kicad_pcb"
);
return
extension
;
}
...
...
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