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
d5a17363
Commit
d5a17363
authored
Dec 14, 2011
by
Dick Hollenbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor
parent
74ccc4b5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
93 additions
and
82 deletions
+93
-82
files.cpp
pcbnew/files.cpp
+23
-3
ioascii.cpp
pcbnew/ioascii.cpp
+1
-2
kicad_plugin.cpp
pcbnew/kicad_plugin.cpp
+69
-77
No files found.
pcbnew/files.cpp
View file @
d5a17363
...
...
@@ -388,7 +388,6 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
wxString
msg
;
bool
saveok
=
true
;
FILE
*
dest
;
if
(
aFileName
==
wxEmptyString
)
{
...
...
@@ -447,7 +446,10 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
}
}
/* Create the file */
#if !defined(USE_NEW_PCBNEW_SAVE)
// Create the file
FILE
*
dest
;
dest
=
wxFopen
(
pcbFileName
.
GetFullPath
(),
wxT
(
"wt"
)
);
if
(
dest
==
0
)
...
...
@@ -466,6 +468,24 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
fclose
(
dest
);
}
#else
try
{
IO_MGR
::
Save
(
IO_MGR
::
KICAD
,
pcbFileName
.
GetFullPath
(),
GetBoard
(),
NULL
);
// overload
}
catch
(
IO_ERROR
ioe
)
{
wxString
msg
=
wxString
::
Format
(
_
(
"Error loading board.
\n
%s"
),
ioe
.
errorText
.
GetData
()
);
wxMessageBox
(
msg
,
_
(
"Save Board File"
),
wxICON_ERROR
);
saveok
=
false
;
}
#endif
/* Display the file names: */
m_messagePanel
->
EraseMsgBox
();
...
...
@@ -481,7 +501,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
upperTxt
=
_
(
"Backup file: "
)
+
backupFileName
.
GetFullPath
();
}
if
(
dest
)
if
(
saveok
)
lowerTxt
=
_
(
"Wrote board file: "
);
else
lowerTxt
=
_
(
"Failed to create "
);
...
...
pcbnew/ioascii.cpp
View file @
d5a17363
...
...
@@ -1160,7 +1160,7 @@ int PCB_EDIT_FRAME::SavePcbFormatAscii( FILE* aFile )
// Switch the locale to standard C (needed to print floating point numbers
// like 1.3)
SetLocaleTo_C_standard
()
;
LOCALE_IO
toggle
;
/* Writing file header. */
fprintf
(
aFile
,
"PCBNEW-BOARD Version %d date %s
\n\n
"
,
BOARD_FILE_VERSION
,
...
...
@@ -1179,7 +1179,6 @@ int PCB_EDIT_FRAME::SavePcbFormatAscii( FILE* aFile )
rc
=
GetBoard
()
->
Save
(
aFile
);
SetLocaleTo_Default
();
// revert to the current locale
wxEndBusyCursor
();
if
(
!
rc
)
...
...
pcbnew/kicad_plugin.cpp
View file @
d5a17363
...
...
@@ -1695,7 +1695,7 @@ void KICAD_PLUGIN::loadPCB_TEXT()
size
.
x
=
biuParse
(
data
,
&
data
);
size
.
y
=
biuParse
(
data
,
&
data
);
BIU
thickn
=
biuParse
(
data
,
&
data
);
int
orient
=
int
Parse
(
data
);
double
angle
=
deg
Parse
(
data
);
// Ensure the text has minimal size to see this text on screen:
...
...
@@ -1715,7 +1715,7 @@ void KICAD_PLUGIN::loadPCB_TEXT()
pcbtxt
->
SetSize
(
size
);
pcbtxt
->
SetThickness
(
thickn
);
pcbtxt
->
SetOrientation
(
orient
);
pcbtxt
->
SetOrientation
(
angle
);
pcbtxt
->
SetPosition
(
wxPoint
(
pos_x
,
pos_y
)
);
}
...
...
@@ -2667,7 +2667,7 @@ void KICAD_PLUGIN::saveBOARD() const
savePCB_TEXT
(
(
TEXTE_PCB
*
)
gr
);
break
;
case
PCB_LINE_T
:
save
MODULE_EDGE
(
(
EDGE_MODULE
*
)
gr
);
save
PCB_LINE
(
(
DRAWSEGMENT
*
)
gr
);
break
;
case
PCB_TARGET_T
:
savePCB_TARGET
(
(
PCB_TARGET
*
)
gr
);
...
...
@@ -2717,8 +2717,7 @@ void KICAD_PLUGIN::saveNETINFO_ITEM( const NETINFO_ITEM* aNet ) const
void
KICAD_PLUGIN
::
saveNETCLASSES
()
const
{
// @todo make m_NetClasses private
NETCLASSES
nc
=
m_board
->
m_NetClasses
;
const
NETCLASSES
&
nc
=
m_board
->
m_NetClasses
;
// save the default first.
saveNETCLASS
(
nc
.
GetDefault
()
);
...
...
@@ -2768,17 +2767,23 @@ void KICAD_PLUGIN::saveMODULE_TEXT( const TEXTE_MODULE* me ) const
if
(
parent
)
orient
+=
parent
->
GetOrientation
();
wxString
txt
=
me
->
GetText
();
fprintf
(
m_fp
,
"T%d %s %s %g %s %c %c %d %c %s
\n
"
,
me
->
GetType
(),
fmtBIUPoint
(
me
->
GetPos0
()
).
c_str
(),
// m_Pos0.x, m_Pos0.y,
#if 0
fmtBIUSize( me->GetSize() ).c_str(), // m_Size.y, m_Size.x,
#else
fmtBIUPair
(
me
->
GetSize
().
y
,
me
->
GetSize
().
x
).
c_str
(),
// m_Size.y, m_Size.x,
#endif
orient
,
fmtBIU
(
me
->
GetThickness
()
).
c_str
(),
// m_Thickness,
me
->
IsMirrored
()
?
'M'
:
'N'
,
me
->
IsVisible
()
?
'V'
:
'I'
,
me
->
GetLayer
(),
me
->
IsItalic
()
?
'I'
:
'N'
,
EscapedUTF8
(
me
->
GetText
()
).
c_str
()
EscapedUTF8
(
txt
).
c_str
()
);
CHECK_WRITE_ERROR
();
...
...
@@ -2806,16 +2811,12 @@ void KICAD_PLUGIN::saveMODULE_EDGE( const EDGE_MODULE* me ) const
break
;
case
S_ARC
:
{
double
angle
=
me
->
GetAngle
();
fprintf
(
m_fp
,
"DA %s %s %g %s %d
\n
"
,
fmtBIUPoint
(
me
->
m_Start0
).
c_str
(),
fmtBIUPoint
(
me
->
m_End0
).
c_str
(),
angle
,
me
->
GetAngle
()
,
fmtBIU
(
me
->
GetWidth
()
).
c_str
(),
me
->
GetLayer
()
);
}
break
;
case
S_POLYGON
:
...
...
@@ -2868,8 +2869,7 @@ void KICAD_PLUGIN::savePAD( const D_PAD* me ) const
fprintf
(
m_fp
,
"Dr %s %s"
,
fmtBIU
(
me
->
GetDrillSize
().
x
).
c_str
(),
fmtBIUSize
(
me
->
GetOffset
()
).
c_str
()
);
fmtBIUSize
(
me
->
GetOffset
()
).
c_str
()
);
if
(
me
->
GetDrillShape
()
==
PAD_OVAL
)
{
...
...
@@ -2891,7 +2891,7 @@ void KICAD_PLUGIN::savePAD( const D_PAD* me ) const
THROW_IO_ERROR
(
wxString
::
Format
(
UNKNOWN_PAD_ATTRIBUTE
,
me
->
GetAttribute
()
)
);
}
fprintf
(
m_fp
,
"At %s N %
8.8
X
\n
"
,
texttype
,
me
->
GetLayerMask
()
);
fprintf
(
m_fp
,
"At %s N %X
\n
"
,
texttype
,
me
->
GetLayerMask
()
);
fprintf
(
m_fp
,
"Ne %d %s
\n
"
,
me
->
GetNet
(),
EscapedUTF8
(
me
->
GetNetname
()
).
c_str
()
);
...
...
@@ -2925,19 +2925,11 @@ void KICAD_PLUGIN::saveMODULE( const MODULE* me ) const
fprintf
(
m_fp
,
"$MODULE %s
\n
"
,
TO_UTF8
(
me
->
GetLibRef
()
)
);
if
(
me
->
IsLocked
()
)
statusTxt
[
0
]
=
'F'
;
else
statusTxt
[
0
]
=
'~'
;
if
(
me
->
IsPlaced
()
)
statusTxt
[
1
]
=
'P'
;
else
statusTxt
[
1
]
=
'~'
;
statusTxt
[
0
]
=
me
->
IsLocked
()
?
'F'
:
'~'
;
statusTxt
[
1
]
=
me
->
IsPlaced
()
?
'P'
:
'~'
;
statusTxt
[
2
]
=
'\0'
;
fprintf
(
m_fp
,
"Po %s %g %d %8lX %8
lX %s
\n
"
,
fprintf
(
m_fp
,
"Po %s %g %d %lX %
lX %s
\n
"
,
fmtBIUPoint
(
me
->
GetPosition
()
).
c_str
(),
// m_Pos.x, m_Pos.y,
orient
,
me
->
GetLayer
(),
...
...
@@ -2957,7 +2949,7 @@ void KICAD_PLUGIN::saveMODULE( const MODULE* me ) const
fprintf
(
m_fp
,
"Kw %s
\n
"
,
TO_UTF8
(
me
->
GetKeywords
()
)
);
}
fprintf
(
m_fp
,
"Sc %
8
lX
\n
"
,
me
->
GetTimeStamp
()
);
fprintf
(
m_fp
,
"Sc %lX
\n
"
,
me
->
GetTimeStamp
()
);
fprintf
(
m_fp
,
"AR %s
\n
"
,
TO_UTF8
(
me
->
GetPath
()
)
);
fprintf
(
m_fp
,
"Op %X %X 0
\n
"
,
me
->
m_CntRot90
,
me
->
m_CntRot180
);
...
...
@@ -2987,23 +2979,23 @@ void KICAD_PLUGIN::saveMODULE( const MODULE* me ) const
fprintf
(
m_fp
,
"
\n
"
);
}
saveMODULE_TEXT
(
(
TEXTE_MODULE
*
)
&
me
->
m_Reference
);
saveMODULE_TEXT
(
me
->
m_Reference
);
saveMODULE_TEXT
(
(
TEXTE_MODULE
*
)
&
me
->
m_Value
);
saveMODULE_TEXT
(
me
->
m_Value
);
// save drawing elements
for
(
BOARD_ITEM
*
item
=
me
->
m_Drawings
;
item
;
item
=
item
->
Next
()
)
for
(
BOARD_ITEM
*
gr
=
me
->
m_Drawings
;
gr
;
gr
=
gr
->
Next
()
)
{
switch
(
item
->
Type
()
)
switch
(
gr
->
Type
()
)
{
case
PCB_MODULE_TEXT_T
:
saveMODULE_TEXT
(
(
TEXTE_MODULE
*
)
item
);
saveMODULE_TEXT
(
(
TEXTE_MODULE
*
)
gr
);
break
;
case
PCB_MODULE_EDGE_T
:
saveMODULE_EDGE
(
(
EDGE_MODULE
*
)
item
);
saveMODULE_EDGE
(
(
EDGE_MODULE
*
)
gr
);
break
;
default
:
THROW_IO_ERROR
(
wxString
::
Format
(
UNKNOWN_GRAPHIC_FORMAT
,
item
->
Type
()
)
);
THROW_IO_ERROR
(
wxString
::
Format
(
UNKNOWN_GRAPHIC_FORMAT
,
gr
->
Type
()
)
);
}
}
...
...
@@ -3053,7 +3045,7 @@ void KICAD_PLUGIN::savePCB_TARGET( const PCB_TARGET* me ) const
{
fprintf
(
m_fp
,
"$PCB_TARGET
\n
"
);
fprintf
(
m_fp
,
"Po %X %d %s %s %s %
8
lX
\n
"
,
fprintf
(
m_fp
,
"Po %X %d %s %s %s %lX
\n
"
,
me
->
GetShape
(),
me
->
GetLayer
(),
fmtBIUPoint
(
me
->
GetPosition
()
).
c_str
(),
...
...
@@ -3081,7 +3073,7 @@ void KICAD_PLUGIN::savePCB_LINE( const DRAWSEGMENT* me ) const
if
(
me
->
GetType
()
!=
S_CURVE
)
{
fprintf
(
m_fp
,
"De %d %d %g %
8
lX %X
\n
"
,
fprintf
(
m_fp
,
"De %d %d %g %lX %X
\n
"
,
me
->
GetLayer
(),
me
->
GetType
(),
me
->
GetAngle
(),
...
...
@@ -3091,7 +3083,7 @@ void KICAD_PLUGIN::savePCB_LINE( const DRAWSEGMENT* me ) const
}
else
{
fprintf
(
m_fp
,
"De %d %d %g %
8
lX %X %s %s
\n
"
,
fprintf
(
m_fp
,
"De %d %d %g %lX %X %s %s
\n
"
,
me
->
GetLayer
(),
me
->
GetType
(),
me
->
GetAngle
(),
...
...
@@ -3120,7 +3112,7 @@ void KICAD_PLUGIN::saveTRACK( const TRACK* me ) const
fmtBIU
(
me
->
GetWidth
()
).
c_str
(),
fmtBIU
(
me
->
GetDrill
()
).
c_str
()
);
fprintf
(
m_fp
,
"De %d %d %d %
8
lX %X
\n
"
,
fprintf
(
m_fp
,
"De %d %d %d %lX %X
\n
"
,
me
->
GetLayer
(),
type
,
me
->
GetNet
(),
me
->
GetTimeStamp
(),
me
->
GetStatus
()
);
}
...
...
@@ -3131,7 +3123,7 @@ void KICAD_PLUGIN::saveZONE_CONTAINER( const ZONE_CONTAINER* me ) const
fprintf
(
m_fp
,
"$CZONE_OUTLINE
\n
"
);
// Save the outline main info
fprintf
(
m_fp
,
"ZInfo %
8
lX %d %s
\n
"
,
fprintf
(
m_fp
,
"ZInfo %lX %d %s
\n
"
,
me
->
GetTimeStamp
(),
me
->
GetNet
(),
EscapedUTF8
(
me
->
GetNetName
()
).
c_str
()
);
...
...
@@ -3237,7 +3229,7 @@ void KICAD_PLUGIN::saveDIMENTION( const DIMENSION* me ) const
// this old keyword is used here for compatibility
fprintf
(
m_fp
,
"$COTATION
\n
"
);
fprintf
(
m_fp
,
"Ge %d %d %
8
lX
\n
"
,
me
->
GetShape
(),
me
->
GetLayer
(),
me
->
GetTimeStamp
()
);
fprintf
(
m_fp
,
"Ge %d %d %lX
\n
"
,
me
->
GetShape
(),
me
->
GetLayer
(),
me
->
GetTimeStamp
()
);
fprintf
(
m_fp
,
"Va %d
\n
"
,
me
->
m_Value
);
...
...
@@ -3332,7 +3324,7 @@ void KICAD_PLUGIN::savePCB_TEXT( const TEXTE_PCB* me ) const
case
GR_TEXT_HJUSTIFY_RIGHT
:
hJustify
=
'R'
;
break
;
}
fprintf
(
m_fp
,
"De %d %d %
8
lX %s %c
\n
"
,
fprintf
(
m_fp
,
"De %d %d %lX %s %c
\n
"
,
me
->
GetLayer
(),
!
me
->
IsMirrored
(),
me
->
GetTimeStamp
(),
...
...
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