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
a7f19392
Commit
a7f19392
authored
Mar 21, 2014
by
Dick Hollenbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplify and fix the technique used to get the project fp-lib-table
parent
34dda6a1
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
158 additions
and
151 deletions
+158
-151
fp_lib_table.cpp
common/fp_lib_table.cpp
+15
-69
project.cpp
common/project.cpp
+43
-0
cfg.cpp
cvpcb/cfg.cpp
+2
-5
cvframe.cpp
cvpcb/cvframe.cpp
+20
-18
readwrite_dlgs.cpp
cvpcb/readwrite_dlgs.cpp
+10
-10
fp_lib_table.h
include/fp_lib_table.h
+12
-7
project.h
include/project.h
+7
-0
basepcbframe.cpp
pcbnew/basepcbframe.cpp
+4
-0
files.cpp
pcbnew/files.cpp
+11
-11
pcbnew.cpp
pcbnew/pcbnew.cpp
+3
-0
pcbnew_config.cpp
pcbnew/pcbnew_config.cpp
+31
-31
No files found.
common/fp_lib_table.cpp
View file @
a7f19392
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
*/
*/
#include <fctsys.h>
#include <wx/config.h> // wxExpandEnvVars()
#include <wx/config.h> // wxExpandEnvVars()
#include <wx/filename.h>
#include <wx/filename.h>
#include <wx/stdpaths.h>
#include <wx/stdpaths.h>
...
@@ -45,19 +46,6 @@
...
@@ -45,19 +46,6 @@
using
namespace
FP_LIB_TABLE_T
;
using
namespace
FP_LIB_TABLE_T
;
/**
* Definition for enabling and disabling footprint library trace output. See the
* wxWidgets documentation on using the WXTRACE environment variable.
*/
static
const
wxString
traceFpLibTable
(
wxT
(
"KicadFpLibTable"
)
);
/// The footprint library table name used when no project file is passed to Pcbnew or CvPcb.
/// This is used temporarily to store the project specific library table until the project
/// file being edited is saved. It is then moved to the file fp-lib-table in the folder where
/// the project file is saved.
static
const
wxChar
templateProjectFileName
[]
=
wxT
(
"prj-fp-lib-table"
);
static
const
wxChar
global_tbl_name
[]
=
wxT
(
"fp-lib-table"
);
static
const
wxChar
global_tbl_name
[]
=
wxT
(
"fp-lib-table"
);
...
@@ -408,19 +396,6 @@ void FP_LIB_TABLE::ROW::Format( OUTPUTFORMATTER* out, int nestLevel ) const
...
@@ -408,19 +396,6 @@ void FP_LIB_TABLE::ROW::Format( OUTPUTFORMATTER* out, int nestLevel ) const
);
);
}
}
void
FP_LIB_TABLE
::
Save
(
const
wxFileName
&
aPath
)
const
throw
(
IO_ERROR
)
{
wxFileName
fn
=
GetProjectTableFileName
(
aPath
.
GetFullPath
()
);
wxLogTrace
(
traceFpLibTable
,
wxT
(
"Saving footprint libary table <%s>."
),
GetChars
(
fn
.
GetFullPath
()
)
);
FILE_OUTPUTFORMATTER
sf
(
fn
.
GetFullPath
()
);
Format
(
&
sf
,
0
);
}
#define OPT_SEP '|' ///< options separator character
#define OPT_SEP '|' ///< options separator character
PROPERTIES
*
FP_LIB_TABLE
::
ParseOptions
(
const
std
::
string
&
aOptionsList
)
PROPERTIES
*
FP_LIB_TABLE
::
ParseOptions
(
const
std
::
string
&
aOptionsList
)
...
@@ -842,34 +817,6 @@ const wxString FP_LIB_TABLE::GlobalPathEnvVariableName()
...
@@ -842,34 +817,6 @@ const wxString FP_LIB_TABLE::GlobalPathEnvVariableName()
}
}
wxString
FP_LIB_TABLE
::
GetProjectTableFileName
(
const
wxString
&
aProjectFullName
)
{
wxFileName
fn
=
aProjectFullName
;
wxString
path
=
fn
.
GetPath
();
// Set $KICAD_PRJ_PATH to user's configuration path if aPath is not set or does not exist.
if
(
!
fn
.
IsOk
()
||
!
wxFileName
::
IsDirReadable
(
path
)
)
{
fn
.
AssignDir
(
wxStandardPaths
::
Get
().
GetUserConfigDir
()
);
#if defined( __WINDOWS__ )
fn
.
AppendDir
(
wxT
(
"kicad"
)
);
#endif
fn
.
SetName
(
templateProjectFileName
);
}
else
{
fn
.
SetName
(
global_tbl_name
);
}
wxLogTrace
(
traceFpLibTable
,
wxT
(
"Project footprint lib table file '%s'."
),
GetChars
(
fn
.
GetFullPath
()
)
);
return
fn
.
GetFullPath
();
}
bool
FP_LIB_TABLE
::
LoadGlobalTable
(
FP_LIB_TABLE
&
aTable
)
throw
(
IO_ERROR
,
PARSE_ERROR
)
bool
FP_LIB_TABLE
::
LoadGlobalTable
(
FP_LIB_TABLE
&
aTable
)
throw
(
IO_ERROR
,
PARSE_ERROR
)
{
{
bool
tableExists
=
true
;
bool
tableExists
=
true
;
...
@@ -911,39 +858,38 @@ wxString FP_LIB_TABLE::GetGlobalTableFileName()
...
@@ -911,39 +858,38 @@ wxString FP_LIB_TABLE::GetGlobalTableFileName()
{
{
wxFileName
fn
;
wxFileName
fn
;
// This is possibly problematic with an uncertain wxApp title, which is now
// the case. We'll need a better technique soon.
fn
.
SetPath
(
wxStandardPaths
::
Get
().
GetUserConfigDir
()
);
fn
.
SetPath
(
wxStandardPaths
::
Get
().
GetUserConfigDir
()
);
#if defined( __WINDOWS__ )
#if defined( __WINDOWS__ )
fn
.
AppendDir
(
wxT
(
"kicad"
)
);
fn
.
AppendDir
(
wxT
(
"kicad"
)
);
#endif
#endif
fn
.
SetName
(
GetFileName
()
);
fn
.
SetName
(
global_tbl_name
);
wxLogTrace
(
traceFpLibTable
,
wxT
(
"Global footprint library table file '%s'."
),
GetChars
(
fn
.
GetFullPath
()
)
);
return
fn
.
GetFullPath
();
return
fn
.
GetFullPath
();
}
}
// prefer wxString filename so it can be seen in a debugger easier than wxFileName.
const
wxString
FP_LIB_TABLE
::
GetFileName
()
void
FP_LIB_TABLE
::
Load
(
const
wxString
&
aFileName
)
{
return
global_tbl_name
;
}
void
FP_LIB_TABLE
::
Load
(
const
wxFileName
&
aFileName
,
FP_LIB_TABLE
*
aFallBackTable
)
throw
(
IO_ERROR
)
throw
(
IO_ERROR
)
{
{
fallBack
=
aFallBackTable
;
// Empty footprint library tables are valid.
// Empty footprint library tables are valid.
if
(
aFileName
.
IsOk
()
&&
aFileName
.
FileExists
(
)
)
if
(
wxFileName
::
IsFileReadable
(
aFileName
)
)
{
{
FILE_LINE_READER
reader
(
aFileName
.
GetFullPath
()
);
FILE_LINE_READER
reader
(
aFileName
);
FP_LIB_TABLE_LEXER
lexer
(
&
reader
);
FP_LIB_TABLE_LEXER
lexer
(
&
reader
);
Parse
(
&
lexer
);
Parse
(
&
lexer
);
}
}
}
}
void
FP_LIB_TABLE
::
Save
(
const
wxString
&
aFileName
)
const
throw
(
IO_ERROR
)
{
FILE_OUTPUTFORMATTER
sf
(
aFileName
);
Format
(
&
sf
,
0
);
}
common/project.cpp
View file @
a7f19392
...
@@ -82,6 +82,49 @@ const wxString PROJECT::GetProjectFullName() const
...
@@ -82,6 +82,49 @@ const wxString PROJECT::GetProjectFullName() const
}
}
const
wxString
PROJECT
::
FootprintLibTblName
()
const
{
wxFileName
fn
=
GetProjectFullName
();
wxString
path
=
fn
.
GetPath
();
// DBG(printf( "path:'%s' fn:'%s'\n", TO_UTF8(path), TO_UTF8(fn.GetFullPath()) );)
// if there's no path to the project name, or the name as a whole is bogus or its not
// write-able then use a template file.
if
(
!
fn
.
GetDirCount
()
||
!
fn
.
IsOk
()
||
!
wxFileName
::
IsDirWritable
(
path
)
)
{
// return a template filename now.
// this next line is likely a problem now, since it relies on an
// application title which is no longer constant or known. This next line needs
// to be re-thought out.
fn
.
AssignDir
(
wxStandardPaths
::
Get
().
GetUserConfigDir
()
);
#if defined( __WINDOWS__ )
fn
.
AppendDir
(
wxT
(
"kicad"
)
);
#endif
/*
The footprint library table name used when no project file is passed
to Pcbnew or CvPcb. This is used temporarily to store the project
specific library table until the project file being edited is saved.
It is then moved to the file fp-lib-table in the folder where the
project file is saved.
*/
fn
.
SetName
(
wxT
(
"prj-fp-lib-table"
)
);
}
else
// normal path.
{
fn
.
SetName
(
wxT
(
"fp-lib-table"
)
);
}
fn
.
ClearExt
();
return
fn
.
GetFullPath
();
}
RETAINED_PATH
&
PROJECT
::
RPath
(
RETPATH_T
aIndex
)
RETAINED_PATH
&
PROJECT
::
RPath
(
RETPATH_T
aIndex
)
{
{
unsigned
ndx
=
unsigned
(
aIndex
);
unsigned
ndx
=
unsigned
(
aIndex
);
...
...
cvpcb/cfg.cpp
View file @
a7f19392
...
@@ -93,14 +93,11 @@ void CVPCB_MAINFRAME::LoadProjectFile( const wxString& aFileName )
...
@@ -93,14 +93,11 @@ void CVPCB_MAINFRAME::LoadProjectFile( const wxString& aFileName )
prj.SetProjectFullName( fn.GetFullPath() );
prj.SetProjectFullName( fn.GetFullPath() );
*/
*/
wx
FileName
projectFpLibTableFileName
=
FP_LIB_TABLE
::
GetProjectTableFileName
(
fn
.
GetFullPath
()
);
wx
String
projectFpLibTableFileName
=
prj
.
FootprintLibTblName
(
);
try
try
{
{
// Stack the project specific FP_LIB_TABLE overlay on top of the global table.
FootprintLibs
()
->
Load
(
projectFpLibTableFileName
);
// ~FP_LIB_TABLE() will not touch the fallback table, so multiple projects may
// stack this way, all using the same global fallback table.
FootprintLibs
()
->
Load
(
projectFpLibTableFileName
,
&
GFootprintTable
);
}
}
catch
(
const
IO_ERROR
&
ioe
)
catch
(
const
IO_ERROR
&
ioe
)
{
{
...
...
cvpcb/cvframe.cpp
View file @
a7f19392
...
@@ -210,6 +210,9 @@ FP_LIB_TABLE* CVPCB_MAINFRAME::FootprintLibs() const
...
@@ -210,6 +210,9 @@ FP_LIB_TABLE* CVPCB_MAINFRAME::FootprintLibs() const
if
(
!
tbl
)
if
(
!
tbl
)
{
{
// Stack the project specific FP_LIB_TABLE overlay on top of the global table.
// ~FP_LIB_TABLE() will not touch the fallback table, so multiple projects may
// stack this way, all using the same global fallback table.
tbl
=
new
FP_LIB_TABLE
(
&
GFootprintTable
);
tbl
=
new
FP_LIB_TABLE
(
&
GFootprintTable
);
prj
.
Elem
(
PROJECT
::
FPTBL
,
tbl
);
prj
.
Elem
(
PROJECT
::
FPTBL
,
tbl
);
}
}
...
@@ -504,41 +507,40 @@ void CVPCB_MAINFRAME::OnEditFootprintLibraryTable( wxCommandEvent& aEvent )
...
@@ -504,41 +507,40 @@ void CVPCB_MAINFRAME::OnEditFootprintLibraryTable( wxCommandEvent& aEvent )
if
(
r
&
1
)
if
(
r
&
1
)
{
{
wxString
fileName
=
FP_LIB_TABLE
::
GetGlobalTableFileName
();
try
try
{
{
FILE_OUTPUTFORMATTER
sf
(
FP_LIB_TABLE
::
GetGlobalTableFileName
()
);
GFootprintTable
.
Save
(
fileName
);
GFootprintTable
.
Format
(
&
sf
,
0
);
tableChanged
=
true
;
tableChanged
=
true
;
}
}
catch
(
const
IO_ERROR
&
ioe
)
catch
(
const
IO_ERROR
&
ioe
)
{
{
wxString
msg
=
wxString
::
Format
(
_
(
wxString
msg
=
wxString
::
Format
(
_
(
"Error occurred saving the global footprint library "
"Error occurred saving the global footprint library table:
\n
'%s'
\n
%s"
),
"table:
\n\n
%s"
),
GetChars
(
fileName
),
GetChars
(
ioe
.
errorText
)
);
GetChars
(
ioe
.
errorText
)
);
wxMessageBox
(
msg
,
_
(
"File Save Error"
),
wxOK
|
wxICON_ERROR
);
wxMessageBox
(
msg
,
_
(
"File Save Error"
),
wxOK
|
wxICON_ERROR
);
}
}
}
}
if
(
r
&
2
)
if
(
r
&
2
)
{
{
wxFileName
fn
=
m_NetlistFileName
;
wxString
fileName
=
Prj
().
FootprintLibTblName
();
fn
.
SetName
(
FP_LIB_TABLE
::
GetFileName
()
);
fn
.
SetExt
(
wxEmptyString
);
try
try
{
{
FILE_OUTPUTFORMATTER
sf
(
fn
.
GetFullPath
()
);
FootprintLibs
()
->
Save
(
fileName
);
FootprintLibs
()
->
Format
(
&
sf
,
0
);
tableChanged
=
true
;
tableChanged
=
true
;
}
}
catch
(
IO_ERROR
&
ioe
)
catch
(
const
IO_ERROR
&
ioe
)
{
{
wxString
msg
;
wxString
msg
=
wxString
::
Format
(
_
(
msg
.
Printf
(
_
(
"Error occurred saving the global footprint library "
"Error occurred saving the project footprint library table:
\n
'%s'
\n
%s"
),
"table:
\n\n
%s"
),
ioe
.
errorText
.
GetData
()
);
GetChars
(
fileName
),
GetChars
(
ioe
.
errorText
)
);
wxMessageBox
(
msg
,
_
(
"File Save Error"
),
wxOK
|
wxICON_ERROR
);
wxMessageBox
(
msg
,
_
(
"File Save Error"
),
wxOK
|
wxICON_ERROR
);
}
}
}
}
...
...
cvpcb/readwrite_dlgs.cpp
View file @
a7f19392
...
@@ -317,25 +317,25 @@ int CVPCB_MAINFRAME::SaveCmpLinkFile( const wxString& aFullFileName )
...
@@ -317,25 +317,25 @@ int CVPCB_MAINFRAME::SaveCmpLinkFile( const wxString& aFullFileName )
// Save the project specific footprint library table.
// Save the project specific footprint library table.
if
(
!
FootprintLibs
()
->
IsEmpty
(
false
)
)
if
(
!
FootprintLibs
()
->
IsEmpty
(
false
)
)
{
{
wxFileName
fpLibFileName
=
fn
;
wxString
fp_lib_tbl
=
Prj
().
FootprintLibTblName
();
fpLibFileName
.
ClearExt
();
fpLibFileName
.
SetName
(
FP_LIB_TABLE
::
GetFileName
()
);
if
(
fpLibFileName
.
FileExists
(
)
if
(
wxFileName
::
FileExists
(
fp_lib_tbl
)
&&
IsOK
(
this
,
_
(
"A footprint library table already exists in this path.
\n\n
Do "
&&
IsOK
(
this
,
_
(
"A footprint library table already exists in this path.
\n\n
Do "
"you want to overwrite it?"
)
)
)
"you want to overwrite it?"
)
)
)
{
{
try
try
{
{
FootprintLibs
()
->
Save
(
fp
LibFileName
);
FootprintLibs
()
->
Save
(
fp
_lib_tbl
);
}
}
catch
(
const
IO_ERROR
&
ioe
)
catch
(
const
IO_ERROR
&
ioe
)
{
{
DisplayError
(
this
,
wxString
msg
=
wxString
::
Format
(
_
(
wxString
::
Format
(
_
(
"An error occurred attempting to save the "
"An error occurred attempting to save the "
"footprint library table <%s>
\n\n
%s"
),
"footprint library table '%s'
\n\n
%s"
),
GetChars
(
fpLibFileName
.
GetFullPath
()
),
GetChars
(
fp_lib_tbl
),
GetChars
(
ioe
.
errorText
)
)
);
GetChars
(
ioe
.
errorText
)
);
DisplayError
(
this
,
msg
);
}
}
}
}
}
}
...
...
include/fp_lib_table.h
View file @
a7f19392
...
@@ -357,8 +357,6 @@ public:
...
@@ -357,8 +357,6 @@ public:
*/
*/
void
Format
(
OUTPUTFORMATTER
*
out
,
int
nestLevel
)
const
throw
(
IO_ERROR
);
void
Format
(
OUTPUTFORMATTER
*
out
,
int
nestLevel
)
const
throw
(
IO_ERROR
);
void
Save
(
const
wxFileName
&
aPath
)
const
throw
(
IO_ERROR
);
/**
/**
* Function GetLogicalLibs
* Function GetLogicalLibs
* returns the logical library names, all of them that are pertinent to
* returns the logical library names, all of them that are pertinent to
...
@@ -544,11 +542,13 @@ public:
...
@@ -544,11 +542,13 @@ public:
*/
*/
static
wxString
GetGlobalTableFileName
();
static
wxString
GetGlobalTableFileName
();
#if 0
/**
/**
* Function GetFileName
* Function GetFileName
* @return the footprint library file name.
* @return the footprint library file name.
*/
*/
static const wxString GetFileName();
static const wxString GetFileName();
#endif
/**
/**
* Function GlobalPathEnvVarVariableName
* Function GlobalPathEnvVarVariableName
...
@@ -560,19 +560,24 @@ public:
...
@@ -560,19 +560,24 @@ public:
*/
*/
static
const
wxString
GlobalPathEnvVariableName
();
static
const
wxString
GlobalPathEnvVariableName
();
static
wxString
GetProjectTableFileName
(
const
wxString
&
aProjectFullName
);
/**
/**
* Function Load
* Function Load
* loads the footprint library table using the path defined in \a aFileName with
* loads the footprint library table using the path defined in \a aFileName with
* \a aFallBackTable.
* \a aFallBackTable.
*
*
* @param aFileName contains the
path and possible the file name and extension
.
* @param aFileName contains the
full path to the s-expression file
.
*
@param aFallBackTable the fall back footprint library table which can be NULL.
*
* @throw IO_ERROR if an error occurs attempting to load the footprint library
* @throw IO_ERROR if an error occurs attempting to load the footprint library
* table.
* table.
*/
*/
void
Load
(
const
wxFileName
&
aFileName
,
FP_LIB_TABLE
*
aFallBackTable
)
throw
(
IO_ERROR
);
void
Load
(
const
wxString
&
aFileName
)
throw
(
IO_ERROR
);
/**
* Function Save
* writes this table to aFileName in s-expression form.
* @param aFileName is the name of the file to write to.
*/
void
Save
(
const
wxString
&
aFileName
)
const
throw
(
IO_ERROR
);
protected
:
protected
:
...
...
include/project.h
View file @
a7f19392
...
@@ -82,6 +82,13 @@ public:
...
@@ -82,6 +82,13 @@ public:
*/
*/
VTBL_ENTRY
const
wxString
GetProjectFullName
()
const
;
VTBL_ENTRY
const
wxString
GetProjectFullName
()
const
;
/**
* Function FootprintLibTblName
* returns the path and filename of this project's fp-lib-table,
* i.e. the project specific one, not the global one.
*/
VTBL_ENTRY
const
wxString
FootprintLibTblName
()
const
;
/**
/**
* Function ConfigSave
* Function ConfigSave
* saves the current "project" parameters into the wxConfigBase* derivative.
* saves the current "project" parameters into the wxConfigBase* derivative.
...
...
pcbnew/basepcbframe.cpp
View file @
a7f19392
...
@@ -181,7 +181,11 @@ FP_LIB_TABLE* PCB_BASE_FRAME::FootprintLibs() const
...
@@ -181,7 +181,11 @@ FP_LIB_TABLE* PCB_BASE_FRAME::FootprintLibs() const
if
(
!
tbl
)
if
(
!
tbl
)
{
{
// Stack the project specific FP_LIB_TABLE overlay on top of the global table.
// ~FP_LIB_TABLE() will not touch the fallback table, so multiple projects may
// stack this way, all using the same global fallback table.
tbl
=
new
FP_LIB_TABLE
(
&
GFootprintTable
);
tbl
=
new
FP_LIB_TABLE
(
&
GFootprintTable
);
prj
.
Elem
(
PROJECT
::
FPTBL
,
tbl
);
prj
.
Elem
(
PROJECT
::
FPTBL
,
tbl
);
}
}
...
...
pcbnew/files.cpp
View file @
a7f19392
...
@@ -605,25 +605,25 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
...
@@ -605,25 +605,25 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
// Save the project specific footprint library table.
// Save the project specific footprint library table.
if
(
!
FootprintLibs
()
->
IsEmpty
(
false
)
)
if
(
!
FootprintLibs
()
->
IsEmpty
(
false
)
)
{
{
wxFileName
fn
=
pcbFileName
;
wxString
fp_lib_tbl
=
Prj
().
FootprintLibTblName
();
fn
.
ClearExt
();
fn
.
SetName
(
FP_LIB_TABLE
::
GetFileName
()
);
if
(
fn
.
FileExists
(
)
if
(
wxFileName
::
FileExists
(
fp_lib_tbl
)
&&
IsOK
(
this
,
_
(
"A footprint library table already exists in this path.
\n\n
Do "
&&
IsOK
(
this
,
_
(
"A footprint library table already exists in this path.
\n\n
Do "
"you want to overwrite it?"
)
)
)
"you want to overwrite it?"
)
)
)
{
{
try
try
{
{
FootprintLibs
()
->
Save
(
f
n
);
FootprintLibs
()
->
Save
(
f
p_lib_tbl
);
}
}
catch
(
IO_ERROR
&
ioe
)
catch
(
const
IO_ERROR
&
ioe
)
{
{
DisplayError
(
this
,
wxString
msg
=
wxString
::
Format
(
_
(
wxString
::
Format
(
_
(
"An error occurred attempting to save the "
"An error occurred attempting to save the "
"footprint library table '%s'
\n\n
%s"
),
"footprint library table '%s'
\n\n
%s"
),
GetChars
(
fn
.
GetFullPath
()
),
GetChars
(
fp_lib_tbl
),
GetChars
(
ioe
.
errorText
)
)
);
GetChars
(
ioe
.
errorText
)
);
DisplayError
(
this
,
msg
);
}
}
}
}
}
}
...
...
pcbnew/pcbnew.cpp
View file @
a7f19392
...
@@ -478,6 +478,9 @@ void IFACE::OnKifaceEnd()
...
@@ -478,6 +478,9 @@ void IFACE::OnKifaceEnd()
// wxPython will do its own cleanup as part of that process.
// wxPython will do its own cleanup as part of that process.
// This should only be called if python was setup correctly.
// This should only be called if python was setup correctly.
/* bring this in, but without a linker error:
pcbnewFinishPythonScripting();
pcbnewFinishPythonScripting();
*/
#endif
#endif
}
}
pcbnew/pcbnew_config.cpp
View file @
a7f19392
...
@@ -108,7 +108,7 @@ void PCB_EDIT_FRAME::Process_Config( wxCommandEvent& event )
...
@@ -108,7 +108,7 @@ void PCB_EDIT_FRAME::Process_Config( wxCommandEvent& event )
GFootprintTable
.
Format
(
&
sf
,
0
);
GFootprintTable
.
Format
(
&
sf
,
0
);
tableChanged
=
true
;
tableChanged
=
true
;
}
}
catch
(
IO_ERROR
&
ioe
)
catch
(
const
IO_ERROR
&
ioe
)
{
{
wxString
msg
=
wxString
::
Format
(
_
(
wxString
msg
=
wxString
::
Format
(
_
(
"Error occurred saving the global footprint library "
"Error occurred saving the global footprint library "
...
@@ -123,18 +123,20 @@ void PCB_EDIT_FRAME::Process_Config( wxCommandEvent& event )
...
@@ -123,18 +123,20 @@ void PCB_EDIT_FRAME::Process_Config( wxCommandEvent& event )
// is kept in memory and created in the path when the new board is saved.
// is kept in memory and created in the path when the new board is saved.
if
(
(
r
&
2
)
&&
!
GetBoard
()
->
GetFileName
().
IsEmpty
()
)
if
(
(
r
&
2
)
&&
!
GetBoard
()
->
GetFileName
().
IsEmpty
()
)
{
{
wx
FileName
fn
=
GetBoard
()
->
GetFile
Name
();
wx
String
tblName
=
Prj
().
FootprintLibTbl
Name
();
try
try
{
{
FootprintLibs
()
->
Save
(
fn
);
FootprintLibs
()
->
Save
(
tblName
);
tableChanged
=
true
;
tableChanged
=
true
;
}
}
catch
(
IO_ERROR
&
ioe
)
catch
(
const
IO_ERROR
&
ioe
)
{
{
wxString
msg
;
wxString
msg
=
wxString
::
Format
(
_
(
msg
.
Printf
(
_
(
"Error occurred saving project specific footprint library "
"Error occurred saving project specific footprint library "
"table:
\n\n
%s"
),
ioe
.
errorText
.
GetData
()
);
"table:
\n\n
%s"
),
GetChars
(
ioe
.
errorText
)
);
wxMessageBox
(
msg
,
_
(
"File Save Error"
),
wxOK
|
wxICON_ERROR
);
wxMessageBox
(
msg
,
_
(
"File Save Error"
),
wxOK
|
wxICON_ERROR
);
}
}
}
}
...
@@ -258,17 +260,15 @@ bool PCB_EDIT_FRAME::LoadProjectSettings( const wxString& aProjectFileName )
...
@@ -258,17 +260,15 @@ bool PCB_EDIT_FRAME::LoadProjectSettings( const wxString& aProjectFileName )
SetElementVisibility( RATSNEST_VISIBLE, showRats );
SetElementVisibility( RATSNEST_VISIBLE, showRats );
#endif
#endif
fn
=
GetBoard
()
->
GetFileName
();
wxString
projectFpLibTableFileName
=
Prj
().
FootprintLibTblName
();
wxFileName
projectFpLibTableFileName
=
FP_LIB_TABLE
::
GetProjectTableFileName
(
fn
.
GetFullPath
()
);
FootprintLibs
()
->
Clear
();
FootprintLibs
()
->
Clear
();
try
try
{
{
FootprintLibs
()
->
Load
(
projectFpLibTableFileName
,
&
GFootprintTable
);
FootprintLibs
()
->
Load
(
projectFpLibTableFileName
);
}
}
catch
(
IO_ERROR
ioe
)
catch
(
const
IO_ERROR
&
ioe
)
{
{
DisplayError
(
this
,
ioe
.
errorText
);
DisplayError
(
this
,
ioe
.
errorText
);
}
}
...
...
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