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
a9e23996
Commit
a9e23996
authored
Dec 15, 2011
by
Dick Hollenbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
legacy pcbnew plugin touch ups
parent
cc70c1a4
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
279 additions
and
42 deletions
+279
-42
config.h.cmake
CMakeModules/config.h.cmake
+11
-3
build_version.h
include/build_version.h
+0
-4
class_board.h
pcbnew/class_board.h
+0
-1
files.cpp
pcbnew/files.cpp
+46
-6
io_mgr.h
pcbnew/io_mgr.h
+3
-4
kicad_plugin.cpp
pcbnew/kicad_plugin.cpp
+199
-19
kicad_plugin.h
pcbnew/kicad_plugin.h
+20
-5
No files found.
CMakeModules/config.h.cmake
View file @
a9e23996
/* Do not modify this file, it was automatically generated by CMake. */
#ifndef
__CONFIG_H_
_
#define
__CONFIG_H_
_
#ifndef
CONFIG_H
_
#define
CONFIG_H
_
#cmakedefine HAVE_STRCASECMP
...
...
@@ -57,4 +57,12 @@
#cmakedefine USE_NEW_PCBNEW_LOAD
#cmakedefine USE_NEW_PCBNEW_SAVE
#endif /* __CONFIG_H__ */
/// The file format revision of the *.brd file created by this build
#if defined(KICAD_NANOMETRE)
#define BOARD_FILE_VERSION 2
#else
#define BOARD_FILE_VERSION 1
#endif
#endif // CONFIG_H_
include/build_version.h
View file @
a9e23996
...
...
@@ -12,8 +12,4 @@ class wxString;
*/
wxString
GetBuildVersion
();
/// The file format revision of the *.brd file created by this build
#define BOARD_FILE_VERSION 1
#endif // KICAD_BUILD_VERSION_H
pcbnew/class_board.h
View file @
a9e23996
...
...
@@ -845,7 +845,6 @@ public:
m_ViasDimensionsList
[
m_ViaSizeSelector
].
m_Drill
:
-
1
;
}
/**
* Function GetCurrentMicroViaSize
* @return the current micro via size,
...
...
pcbnew/files.cpp
View file @
a9e23996
...
...
@@ -272,31 +272,36 @@ this file again." ) );
m_DisplayPadFill
=
DisplayOpt
.
DisplayPadFill
;
m_DisplayViaFill
=
DisplayOpt
.
DisplayViaFill
;
}
else
{
GetBoard
()
->
m_NetClasses
.
Clear
();
}
BOARD
*
loadedBoard
=
0
;
// it will be set to non-NULL if loadedOK
try
{
// load or append either:
BOARD
*
b
oard
=
IO_MGR
::
Load
(
IO_MGR
::
KICAD
,
GetScreen
()
->
GetFileName
(),
loadedB
oard
=
IO_MGR
::
Load
(
IO_MGR
::
KICAD
,
GetScreen
()
->
GetFileName
(),
aAppend
?
GetBoard
()
:
NULL
,
NULL
);
if
(
!
aAppend
)
{
if
(
b
oard
->
GetFileFormatVersionAtLoad
()
<
BOARD_FILE_VERSION
)
if
(
loadedB
oard
->
GetFileFormatVersionAtLoad
()
<
BOARD_FILE_VERSION
)
{
DisplayInfoMessage
(
this
,
_
(
"This file was created by an older \
version of Pcbnew. It will be stored in the new file format when you save \
this file again."
)
);
}
SetBoard
(
b
oard
);
SetBoard
(
loadedB
oard
);
}
}
catch
(
IO_ERROR
ioe
)
{
wxString
msg
=
wxString
::
Format
(
_
(
"Error loading board.
\n
%s"
),
ioe
.
errorText
.
GetData
()
);
wxMessageBox
(
msg
,
_
(
"Open Board File"
),
wxICON_ERROR
);
}
...
...
@@ -305,6 +310,16 @@ this file again." ) );
LoadProjectSettings
(
GetScreen
()
->
GetFileName
()
);
}
if
(
loadedBoard
)
{
// we should not ask PLUGINs to do these items:
loadedBoard
->
BuildListOfNets
();
loadedBoard
->
SynchronizeNetsAndNetClasses
();
SetStatusText
(
wxEmptyString
);
BestZoom
();
}
#endif
GetScreen
()
->
ClrModify
();
...
...
@@ -448,18 +463,43 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
#if defined(USE_NEW_PCBNEW_SAVE)
GetBoard
()
->
m_Status_Pcb
&=
~
CONNEXION_OK
;
GetBoard
()
->
SynchronizeNetsAndNetClasses
();
// Select default Netclass before writing file.
// Useful to save default values in headers
GetBoard
()
->
SetCurrentNetClass
(
GetBoard
()
->
m_NetClasses
.
GetDefault
()
->
GetName
()
);
try
{
IO_MGR
::
Save
(
IO_MGR
::
KICAD
,
pcbFileName
.
GetFullPath
(),
GetBoard
(),
NULL
);
wxString
header
=
wxString
::
Format
(
wxT
(
"PCBNEW-BOARD Version %d date %s
\n\n
# Created by Pcbnew%s
\n\n
"
),
BOARD_FILE_VERSION
,
TO_UTF8
(
DateAndTime
()
),
TO_UTF8
(
GetBuildVersion
()
)
);
PROPERTIES
props
;
// wanting wxWidgets 2.9.x which can actually create a wxString() from
// a const char*, so don't have to use wxT()
props
[
wxT
(
"header"
)
]
=
header
;
IO_MGR
::
Save
(
IO_MGR
::
KICAD
,
pcbFileName
.
GetFullPath
(),
GetBoard
(),
&
props
);
}
catch
(
IO_ERROR
ioe
)
{
wxString
msg
=
wxString
::
Format
(
_
(
"Error
load
ing board.
\n
%s"
),
wxString
msg
=
wxString
::
Format
(
_
(
"Error
sav
ing board.
\n
%s"
),
ioe
.
errorText
.
GetData
()
);
wxMessageBox
(
msg
,
_
(
"Save Board File"
),
wxICON_ERROR
);
saveok
=
false
;
}
if
(
saveok
)
{
GetScreen
()
->
SetFileName
(
pcbFileName
.
GetFullPath
()
);
UpdateTitle
();
}
#else
// Create the file
FILE
*
dest
;
...
...
pcbnew/io_mgr.h
View file @
a9e23996
...
...
@@ -227,10 +227,9 @@ public:
/* The compiler writes the "zero argument" constructor for a PLUGIN
automatically if you do not provide one. If you decide you need to
provide a zero argument constructor of your own design, that is allowed,
but there can only be one constructor and it must be a "zero argument"
version. Normally you can do your initialization in a function like
KICAD_PLUGIN::init( PROPERTIES* aProperties ) instead.
provide a zero argument constructor of your own design, that is allowed.
It must be public, and it is what the IO_MGR uses. Parameters may be
passed into a PLUGIN via the PROPERTIES variable for either Save() and Load().
*/
virtual
~
PLUGIN
()
{}
...
...
pcbnew/kicad_plugin.cpp
View file @
a9e23996
This diff is collapsed.
Click to expand it.
pcbnew/kicad_plugin.h
View file @
a9e23996
...
...
@@ -73,6 +73,7 @@ protected:
wxString
m_error
;
///< for throwing exceptions
BOARD
*
m_board
;
///< which BOARD, no ownership here
PROPERTIES
*
m_props
;
///< passed via Save() or Load(), no ownership, may be NULL.
LINE_READER
*
m_reader
;
///< no ownership here.
FILE
*
m_fp
;
///< no ownership here.
...
...
@@ -89,7 +90,8 @@ protected:
/**
* Function biuParse
* parses an ASCII decimal floating point value and scales it into a BIU
* according to the current value of diskToBui.
* according to the current value of diskToBui. This fuction is the complement of
* fmtBIU(). One has to know what the other is doing.
*
* @param aValue is the ASCII value in C locale form with possible leading whitespace
*
...
...
@@ -104,7 +106,8 @@ protected:
* Function degParse
* parses an ASCII decimal floating point value which is certainy an angle. This
* is a dedicated function for encapsulating support for the migration from
* tenths of degrees to degrees in floating point.
* tenths of degrees to degrees in floating point. This function is the complement of
* fmtDEG(). One has to know what the other is doing.
*
* @param aValue is the ASCII value in C locale form with possible leading whitespace
*
...
...
@@ -164,9 +167,15 @@ protected:
*/
wxString
writeError
()
const
;
/// encapsulate the BIU formatting tricks in one place.
int
biuSprintf
(
char
*
buf
,
BIU
aValue
)
const
;
/// convert a BIU to engineering units by scaling and formatting to ASCII.
/**
* Function fmtBIU
* converts a BIU to engineering units by scaling and formatting to ASCII.
* This function is the complement of biuParse(). One has to know what the
* other is doing.
*/
std
::
string
fmtBIU
(
BIU
aValue
)
const
;
std
::
string
fmtBIUPair
(
BIU
first
,
BIU
second
)
const
;
...
...
@@ -178,11 +187,17 @@ protected:
std
::
string
fmtBIUSize
(
const
wxSize
&
aSize
)
const
{
// unfortunately there is inconsistency in the order of saving wxSize,
// so sometimes we use fmtBIUPair() directly in the saveXXX() functions.
return
fmtBIUPair
(
aSize
.
x
,
aSize
.
y
);
}
/**
* Function fmtDEG
* formats an angle in a way particular to a board file format. This function
* is the opposite or complement of degParse(). One has to know what the
* other is doing.
*/
std
::
string
fmtDEG
(
double
aAngle
)
const
;
void
saveAllSections
()
const
;
void
saveGENERAL
()
const
;
void
saveSHEET
()
const
;
...
...
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