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
bf688ea1
Commit
bf688ea1
authored
Sep 18, 2008
by
charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eeschema: code cleaning
parent
2057c815
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
202 additions
and
237 deletions
+202
-237
CMakeLists.txt
eeschema/CMakeLists.txt
+1
-1
class_library.cpp
eeschema/class_library.cpp
+0
-0
class_library.h
eeschema/class_library.h
+23
-3
class_pin.cpp
eeschema/class_pin.cpp
+4
-4
classes_body_items.h
eeschema/classes_body_items.h
+66
-10
eelibs_draw_components.cpp
eeschema/eelibs_draw_components.cpp
+7
-8
lib_export.cpp
eeschema/lib_export.cpp
+2
-3
libarch.cpp
eeschema/libarch.cpp
+4
-9
libedit.cpp
eeschema/libedit.cpp
+2
-3
makefile.include
eeschema/makefile.include
+1
-1
protos.h
eeschema/protos.h
+1
-16
savelib.cpp
eeschema/savelib.cpp
+88
-127
symbedit.cpp
eeschema/symbedit.cpp
+3
-52
No files found.
eeschema/CMakeLists.txt
View file @
bf688ea1
...
@@ -15,6 +15,7 @@ set(EESCHEMA_SRCS
...
@@ -15,6 +15,7 @@ set(EESCHEMA_SRCS
class_drawsheet.cpp
class_drawsheet.cpp
class_hierarchical_PIN_sheet.cpp
class_hierarchical_PIN_sheet.cpp
class_pin.cpp
class_pin.cpp
class_library.cpp
class_schematic_items.cpp
class_schematic_items.cpp
class_screen.cpp
class_screen.cpp
class_text-label.cpp
class_text-label.cpp
...
@@ -56,7 +57,6 @@ set(EESCHEMA_SRCS
...
@@ -56,7 +57,6 @@ set(EESCHEMA_SRCS
hotkeys.cpp
hotkeys.cpp
libalias.cpp
libalias.cpp
libarch.cpp
libarch.cpp
libclass.cpp
libedit.cpp
libedit.cpp
libedit_onleftclick.cpp
libedit_onleftclick.cpp
libedit_onrightclick.cpp
libedit_onrightclick.cpp
...
...
eeschema/
libclass
.cpp
→
eeschema/
class_library
.cpp
View file @
bf688ea1
File moved
eeschema/class_library.h
View file @
bf688ea1
...
@@ -45,8 +45,21 @@ public:
...
@@ -45,8 +45,21 @@ public:
public
:
public
:
LibraryStruct
(
int
type
,
const
wxString
&
name
,
const
wxString
&
fullname
);
LibraryStruct
(
int
type
,
const
wxString
&
name
,
const
wxString
&
fullname
);
~
LibraryStruct
();
~
LibraryStruct
();
bool
WriteHeader
(
FILE
*
file
);
/**
* Function SaveLibrary
* writes the data structures for this object out to 2 file
* the library in "*.lib" format.
* the doc file in "*.dcm" format.
* creates a backup file for each file (.bak and .bck)
* @param aFullFileName The full lib filename.
* @return bool - true if success writing else false.
*/
bool
SaveLibrary
(
const
wxString
&
aFullFileName
);
bool
ReadHeader
(
FILE
*
file
,
int
*
LineNum
);
bool
ReadHeader
(
FILE
*
file
,
int
*
LineNum
);
private
:
bool
WriteHeader
(
FILE
*
file
);
};
};
...
@@ -73,8 +86,15 @@ public:
...
@@ -73,8 +86,15 @@ public:
return
wxT
(
"LibCmpEntry"
);
return
wxT
(
"LibCmpEntry"
);
}
}
/**
bool
WriteDescr
(
FILE
*
File
);
* Function SaveLibrary
* writes the data structures for this object out to 2 FILE in "*.lib" and ".dcm" format.
* the main file (.lib) is the library content (set of components)
* the second file (.dcm)is the auxiliary file that contents the keywords and description for components)
* @param FullFileName the new full filename (*.lib).
* @return bool - true if success writing else false.
*/
bool
SaveLibrary
(
const
wxString
&
FullFileName
);
};
};
...
...
eeschema/class_pin.cpp
View file @
bf688ea1
...
@@ -761,9 +761,9 @@ int LibDrawPin::ReturnPinDrawOrient( int TransMat[2][2] )
...
@@ -761,9 +761,9 @@ int LibDrawPin::ReturnPinDrawOrient( int TransMat[2][2] )
}
}
/****************************************************/
/****************************************************
*******
/
void
LibDrawPin
::
ReturnPinStringNum
(
wxString
&
buffer
)
void
LibDrawPin
::
ReturnPinStringNum
(
wxString
&
buffer
)
const
/****************************************************/
/****************************************************
*******
/
/* fill the buffer with pin num as a wxString
/* fill the buffer with pin num as a wxString
* Pin num is coded as a long
* Pin num is coded as a long
...
@@ -772,7 +772,7 @@ void LibDrawPin::ReturnPinStringNum( wxString& buffer )
...
@@ -772,7 +772,7 @@ void LibDrawPin::ReturnPinStringNum( wxString& buffer )
{
{
char
ascii_buf
[
5
];
char
ascii_buf
[
5
];
strncpy
(
ascii_buf
,
(
char
*
)
&
m_PinNum
,
4
);
memcpy
(
ascii_buf
,
&
m_PinNum
,
4
);
ascii_buf
[
4
]
=
0
;
ascii_buf
[
4
]
=
0
;
buffer
=
CONV_FROM_UTF8
(
ascii_buf
);
buffer
=
CONV_FROM_UTF8
(
ascii_buf
);
...
...
eeschema/classes_body_items.h
View file @
bf688ea1
...
@@ -151,7 +151,7 @@ public:
...
@@ -151,7 +151,7 @@ public:
* @param aOffset = offset to draw
* @param aOffset = offset to draw
* @param aColor = -1 to use the normal body item color, or use this color if >= 0
* @param aColor = -1 to use the normal body item color, or use this color if >= 0
* @param aDrawMode = GR_OR, GR_XOR, ...
* @param aDrawMode = GR_OR, GR_XOR, ...
* @param aData = pointer used to pass others parametres, depending on body items.
* @param aData =
value or
pointer used to pass others parametres, depending on body items.
* used for some items to force to force no fill mode
* used for some items to force to force no fill mode
* ( has meaning only for items what can be filled ). used in printing or moving objects mode
* ( has meaning only for items what can be filled ). used in printing or moving objects mode
* or to pass refernce to the lib component for pins
* or to pass refernce to the lib component for pins
...
@@ -160,6 +160,14 @@ public:
...
@@ -160,6 +160,14 @@ public:
virtual
void
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
virtual
void
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
int
aDrawMode
,
void
*
aData
,
int
aTransformMatrix
[
2
][
2
]
)
=
0
;
int
aDrawMode
,
void
*
aData
,
int
aTransformMatrix
[
2
][
2
]
)
=
0
;
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
virtual
bool
Save
(
FILE
*
aFile
)
const
=
0
;
void
Display_Infos_DrawEntry
(
WinEDA_DrawFrame
*
frame
);
void
Display_Infos_DrawEntry
(
WinEDA_DrawFrame
*
frame
);
};
};
...
@@ -189,15 +197,21 @@ public:
...
@@ -189,15 +197,21 @@ public:
{
{
return
wxT
(
"LibDrawPin"
);
return
wxT
(
"LibDrawPin"
);
}
}
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
virtual
bool
Save
(
FILE
*
aFile
)
const
;
LibDrawPin
*
GenCopy
();
LibDrawPin
*
GenCopy
();
bool
WriteDescr
(
FILE
*
File
);
void
Display_Infos
(
WinEDA_DrawFrame
*
frame
);
void
Display_Infos
(
WinEDA_DrawFrame
*
frame
);
wxPoint
ReturnPinEndPoint
();
wxPoint
ReturnPinEndPoint
();
int
ReturnPinDrawOrient
(
int
TransMat
[
2
][
2
]
);
int
ReturnPinDrawOrient
(
int
TransMat
[
2
][
2
]
);
void
ReturnPinStringNum
(
wxString
&
buffer
);
void
ReturnPinStringNum
(
wxString
&
buffer
)
const
;
void
SetPinNumFromString
(
wxString
&
buffer
);
void
SetPinNumFromString
(
wxString
&
buffer
);
void
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
void
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
...
@@ -234,10 +248,16 @@ public:
...
@@ -234,10 +248,16 @@ public:
{
{
return
wxT
(
"LibDrawArc"
);
return
wxT
(
"LibDrawArc"
);
}
}
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
virtual
bool
Save
(
FILE
*
aFile
)
const
;
LibDrawArc
*
GenCopy
();
LibDrawArc
*
GenCopy
();
bool
WriteDescr
(
FILE
*
File
);
void
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
void
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
int
aDrawMode
,
void
*
aData
,
int
aTransformMatrix
[
2
][
2
]
);
int
aDrawMode
,
void
*
aData
,
int
aTransformMatrix
[
2
][
2
]
);
};
};
...
@@ -257,10 +277,16 @@ public:
...
@@ -257,10 +277,16 @@ public:
{
{
return
wxT
(
"LibDrawCircle"
);
return
wxT
(
"LibDrawCircle"
);
}
}
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
virtual
bool
Save
(
FILE
*
aFile
)
const
;
LibDrawCircle
*
GenCopy
();
LibDrawCircle
*
GenCopy
();
bool
WriteDescr
(
FILE
*
File
);
void
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
void
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
int
aDrawMode
,
void
*
aData
,
int
aTransformMatrix
[
2
][
2
]
);
int
aDrawMode
,
void
*
aData
,
int
aTransformMatrix
[
2
][
2
]
);
};
};
...
@@ -287,10 +313,16 @@ public:
...
@@ -287,10 +313,16 @@ public:
{
{
return
wxT
(
"LibDrawText"
);
return
wxT
(
"LibDrawText"
);
}
}
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
virtual
bool
Save
(
FILE
*
aFile
)
const
;
LibDrawText
*
GenCopy
();
LibDrawText
*
GenCopy
();
bool
WriteDescr
(
FILE
*
File
);
void
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
void
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
int
aDrawMode
,
void
*
aData
,
int
aTransformMatrix
[
2
][
2
]
);
int
aDrawMode
,
void
*
aData
,
int
aTransformMatrix
[
2
][
2
]
);
};
};
...
@@ -311,10 +343,16 @@ public:
...
@@ -311,10 +343,16 @@ public:
{
{
return
wxT
(
"LibDrawSquare"
);
return
wxT
(
"LibDrawSquare"
);
}
}
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
virtual
bool
Save
(
FILE
*
aFile
)
const
;
LibDrawSquare
*
GenCopy
();
LibDrawSquare
*
GenCopy
();
bool
WriteDescr
(
FILE
*
File
);
void
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
void
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
int
aDrawMode
,
void
*
aData
,
int
aTransformMatrix
[
2
][
2
]
);
int
aDrawMode
,
void
*
aData
,
int
aTransformMatrix
[
2
][
2
]
);
};
};
...
@@ -334,10 +372,16 @@ public:
...
@@ -334,10 +372,16 @@ public:
{
{
return
wxT
(
"LibDrawSegment"
);
return
wxT
(
"LibDrawSegment"
);
}
}
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
virtual
bool
Save
(
FILE
*
aFile
)
const
;
LibDrawSegment
*
GenCopy
();
LibDrawSegment
*
GenCopy
();
bool
WriteDescr
(
FILE
*
File
);
void
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
void
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
int
aDrawMode
,
void
*
aData
,
int
aTransformMatrix
[
2
][
2
]
);
int
aDrawMode
,
void
*
aData
,
int
aTransformMatrix
[
2
][
2
]
);
};
};
...
@@ -365,10 +409,16 @@ public:
...
@@ -365,10 +409,16 @@ public:
return
wxT
(
"LibDrawPolyline"
);
return
wxT
(
"LibDrawPolyline"
);
}
}
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
virtual
bool
Save
(
FILE
*
aFile
)
const
;
LibDrawPolyline
*
GenCopy
();
LibDrawPolyline
*
GenCopy
();
void
AddPoint
(
const
wxPoint
&
point
);
void
AddPoint
(
const
wxPoint
&
point
);
bool
WriteDescr
(
FILE
*
File
);
void
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
void
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
int
aDrawMode
,
void
*
aData
,
int
aTransformMatrix
[
2
][
2
]
);
int
aDrawMode
,
void
*
aData
,
int
aTransformMatrix
[
2
][
2
]
);
};
};
...
@@ -406,11 +456,17 @@ public:
...
@@ -406,11 +456,17 @@ public:
{
{
return
wxT
(
"LibDrawField"
);
return
wxT
(
"LibDrawField"
);
}
}
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
virtual
bool
Save
(
FILE
*
aFile
)
const
;
LibDrawField
*
GenCopy
();
LibDrawField
*
GenCopy
();
void
Copy
(
LibDrawField
*
Target
);
void
Copy
(
LibDrawField
*
Target
);
bool
WriteDescr
(
FILE
*
File
);
void
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
void
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
int
aDrawMode
,
void
*
aData
,
int
aTransformMatrix
[
2
][
2
]
);
int
aDrawMode
,
void
*
aData
,
int
aTransformMatrix
[
2
][
2
]
);
};
};
...
...
eeschema/eelibs_draw_components.cpp
View file @
bf688ea1
...
@@ -18,12 +18,11 @@
...
@@ -18,12 +18,11 @@
//#define DRAW_ARC_WITH_ANGLE // Used to draw arcs
//#define DRAW_ARC_WITH_ANGLE // Used to draw arcs
/* Fonctions locales */
/* Descr component <DUMMY> used when a component is not found in library,
* to draw a dummy shape*/
/*
/* Local functions */
/* Descr component <DUMMY> used when a component is not found in library,
* to draw a dummy shape
* This component is a 400 mils square with the text ??
* This component is a 400 mils square with the text ??
* DEF DUMMY U 0 40 Y Y 1 0 N
* DEF DUMMY U 0 40 Y Y 1 0 N
* F0 "U" 0 -350 60 H V
* F0 "U" 0 -350 60 H V
...
@@ -34,9 +33,7 @@
...
@@ -34,9 +33,7 @@
* ENDDRAW
* ENDDRAW
* ENDDEF
* ENDDEF
*/
*/
static
void
CreateDummyCmp
();
static
EDA_LibComponentStruct
*
DummyCmp
;
static
void
DrawLibPartAux
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
static
void
DrawLibPartAux
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
SCH_COMPONENT
*
Component
,
SCH_COMPONENT
*
Component
,
EDA_LibComponentStruct
*
Entry
,
EDA_LibComponentStruct
*
Entry
,
...
@@ -45,6 +42,8 @@ static void DrawLibPartAux( WinEDA_DrawPanel * panel, wxDC * DC,
...
@@ -45,6 +42,8 @@ static void DrawLibPartAux( WinEDA_DrawPanel * panel, wxDC * DC,
int
Multi
,
int
convert
,
int
Multi
,
int
convert
,
int
DrawMode
,
int
Color
=
-
1
,
bool
DrawPinText
=
TRUE
);
int
DrawMode
,
int
Color
=
-
1
,
bool
DrawPinText
=
TRUE
);
/* Local variables */
static
EDA_LibComponentStruct
*
DummyCmp
;
/***************************************************************************/
/***************************************************************************/
wxPoint
TransformCoordinate
(
int
aTransformMatrix
[
2
][
2
],
wxPoint
&
aPosition
)
wxPoint
TransformCoordinate
(
int
aTransformMatrix
[
2
][
2
],
wxPoint
&
aPosition
)
...
@@ -66,7 +65,7 @@ wxPoint TransformCoordinate( int aTransformMatrix[2][2], wxPoint& aPosition )
...
@@ -66,7 +65,7 @@ wxPoint TransformCoordinate( int aTransformMatrix[2][2], wxPoint& aPosition )
/******************************/
/******************************/
static
void
CreateDummyCmp
()
void
CreateDummyCmp
()
/******************************/
/******************************/
{
{
DummyCmp
=
new
EDA_LibComponentStruct
(
NULL
);
DummyCmp
=
new
EDA_LibComponentStruct
(
NULL
);
...
...
eeschema/lib_export.cpp
View file @
bf688ea1
...
@@ -88,7 +88,6 @@ void WinEDA_LibeditFrame::ExportOnePart( bool create_lib )
...
@@ -88,7 +88,6 @@ void WinEDA_LibeditFrame::ExportOnePart( bool create_lib )
{
{
wxString
Name
,
mask
;
wxString
Name
,
mask
;
LibraryStruct
*
NewLib
,
*
LibTmp
,
*
CurLibTmp
;
LibraryStruct
*
NewLib
,
*
LibTmp
,
*
CurLibTmp
;
int
err
;
if
(
CurrentLibEntry
==
NULL
)
if
(
CurrentLibEntry
==
NULL
)
{
{
...
@@ -131,7 +130,7 @@ void WinEDA_LibeditFrame::ExportOnePart( bool create_lib )
...
@@ -131,7 +130,7 @@ void WinEDA_LibeditFrame::ExportOnePart( bool create_lib )
/* Sauvegarde du composant: */
/* Sauvegarde du composant: */
CurrentLib
=
NewLib
;
CurrentLib
=
NewLib
;
SaveOnePartInMemory
();
SaveOnePartInMemory
();
err
=
SaveOneLibrary
(
this
,
Name
,
NewLib
);
bool
success
=
NewLib
->
SaveLibrary
(
Name
);
/* Suppression de la librarie temporaire */
/* Suppression de la librarie temporaire */
FreeCmpLibrary
(
this
,
NewLib
->
m_Name
);
FreeCmpLibrary
(
this
,
NewLib
->
m_Name
);
...
@@ -139,7 +138,7 @@ void WinEDA_LibeditFrame::ExportOnePart( bool create_lib )
...
@@ -139,7 +138,7 @@ void WinEDA_LibeditFrame::ExportOnePart( bool create_lib )
CurrentLib
=
CurLibTmp
;
CurrentLib
=
CurLibTmp
;
wxString
msg
;
wxString
msg
;
if
(
create_lib
&&
(
err
==
0
)
)
if
(
create_lib
&&
success
)
{
{
msg
=
Name
+
_
(
"0k"
);
msg
=
Name
+
_
(
"0k"
);
DisplayInfo
(
this
,
DisplayInfo
(
this
,
...
...
eeschema/libarch.cpp
View file @
bf688ea1
...
@@ -95,18 +95,13 @@ const wxChar * Text;
...
@@ -95,18 +95,13 @@ const wxChar * Text;
{
{
if
(
ListEntry
[
ii
]
==
NULL
)
// Composant non trouv� en librairie
if
(
ListEntry
[
ii
]
==
NULL
)
// Composant non trouv� en librairie
{
{
continue
;
continue
;
}
}
if
(
ii
==
0
)
if
(
(
ii
==
0
)
||
(
ListEntry
[
ii
-
1
]
!=
ListEntry
[
ii
]
)
)
{
{
WriteOneLibEntry
(
frame
,
ArchiveFile
,
ListEntry
[
ii
]);
WriteOneLibEntry
(
ArchiveFile
,
ListEntry
[
ii
]);
if
(
DocFile
)
WriteOneDocLibEntry
(
DocFile
,
ListEntry
[
ii
]);
if
(
DocFile
)
WriteOneDocLibEntry
(
DocFile
,
ListEntry
[
ii
]);
}
}
else
if
(
ListEntry
[
ii
-
1
]
!=
ListEntry
[
ii
]
)
{
WriteOneLibEntry
(
frame
,
ArchiveFile
,
ListEntry
[
ii
]);
if
(
DocFile
)
WriteOneDocLibEntry
(
DocFile
,
ListEntry
[
ii
]);
}
}
}
/* Generation fin de fichier */
/* Generation fin de fichier */
...
...
eeschema/libedit.cpp
View file @
bf688ea1
...
@@ -222,7 +222,6 @@ void WinEDA_LibeditFrame::SaveActiveLibrary()
...
@@ -222,7 +222,6 @@ void WinEDA_LibeditFrame::SaveActiveLibrary()
*/
*/
{
{
wxString
Name
,
msg
;
wxString
Name
,
msg
;
int
err
;
if
(
CurrentLib
==
NULL
)
if
(
CurrentLib
==
NULL
)
{
{
...
@@ -234,11 +233,11 @@ int err;
...
@@ -234,11 +233,11 @@ int err;
msg
=
_
(
"Modify Library File
\"
"
)
+
Name
+
_
(
"
\"
?"
);
msg
=
_
(
"Modify Library File
\"
"
)
+
Name
+
_
(
"
\"
?"
);
if
(
!
IsOK
(
this
,
msg
)
)
return
;
if
(
!
IsOK
(
this
,
msg
)
)
return
;
err
=
SaveOneLibrary
(
this
,
Name
,
CurrentLib
);
bool
success
=
CurrentLib
->
SaveLibrary
(
Name
);
MsgPanel
->
EraseMsgBox
();
MsgPanel
->
EraseMsgBox
();
if
(
err
)
if
(
!
success
)
{
{
msg
=
_
(
"Error while saving Library File
\"
"
)
+
Name
+
_
(
"
\"
."
);
msg
=
_
(
"Error while saving Library File
\"
"
)
+
Name
+
_
(
"
\"
."
);
Affiche_1_Parametre
(
this
,
1
,
wxT
(
" *** ERROR : **"
),
msg
,
BLUE
);
Affiche_1_Parametre
(
this
,
1
,
wxT
(
" *** ERROR : **"
),
msg
,
BLUE
);
...
...
eeschema/makefile.include
View file @
bf688ea1
...
@@ -26,7 +26,7 @@ OBJECTS = eeschema.o\
...
@@ -26,7 +26,7 @@ OBJECTS = eeschema.o\
class_hierarchical_PIN_sheet.o
\
class_hierarchical_PIN_sheet.o
\
class_text-label.o
\
class_text-label.o
\
component_class.o
\
component_class.o
\
libclass
.o
\
class_library
.o
\
dialog_options.o
\
dialog_options.o
\
tool_lib.o
\
tool_lib.o
\
tool_sch.o
\
tool_sch.o
\
...
...
eeschema/protos.h
View file @
bf688ea1
...
@@ -229,7 +229,7 @@ LibEDA_BaseStruct * CopyDrawEntryStruct( wxWindow * frame, LibEDA_BaseStruct * D
...
@@ -229,7 +229,7 @@ LibEDA_BaseStruct * CopyDrawEntryStruct( wxWindow * frame, LibEDA_BaseStruct * D
Retourne:
Retourne:
Pointeur sur la structure creee (ou NULL si impossible) */
Pointeur sur la structure creee (ou NULL si impossible) */
int
WriteOneLibEntry
(
wxWindow
*
frame
,
FILE
*
ExportFile
,
EDA_LibComponentStruct
*
LibEntry
);
int
WriteOneLibEntry
(
FILE
*
ExportFile
,
EDA_LibComponentStruct
*
LibEntry
);
/* Routine d'ecriture du composant pointe par LibEntry
/* Routine d'ecriture du composant pointe par LibEntry
dans le fichier ExportFile( qui doit etre deja ouvert)
dans le fichier ExportFile( qui doit etre deja ouvert)
return: FALSE si Ok, TRUE si err write */
return: FALSE si Ok, TRUE si err write */
...
@@ -246,21 +246,6 @@ int WriteOneDocLibEntry(FILE * ExportFile, EDA_LibComponentStruct * LibEntry);
...
@@ -246,21 +246,6 @@ int WriteOneDocLibEntry(FILE * ExportFile, EDA_LibComponentStruct * LibEntry);
1 si err write */
1 si err write */
int
SaveOneLibrary
(
wxWindow
*
frame
,
const
wxString
&
FullFileName
,
LibraryStruct
*
Library
);
/* Sauvegarde en fichier la librairie pointee par Library, sous le nom
FullFileName.
2 fichiers sont crees
- La librarie
- le fichier de documentation
une sauvegarde .bak de l'ancien fichier librairie est cree
une sauvegarde .bck de l'ancien fichier documentation est cree
return:
0 si OK
1 si erreur */
/***************/
/***************/
/* SYMBEDIT.CPP */
/* SYMBEDIT.CPP */
/***************/
/***************/
...
...
eeschema/savelib.cpp
View file @
bf688ea1
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
/* EESchema - eesavlib.cpp */
/* EESchema - eesavlib.cpp */
/****************************/
/****************************/
/* Write Routines to save schematic libraries and library components (::
WriteDescr
() members)
/* Write Routines to save schematic libraries and library components (::
Save
() members)
*/
*/
#include "fctsys.h"
#include "fctsys.h"
...
@@ -27,7 +27,7 @@ static bool WriteLibEntryDateAndTime( FILE* ExportFile,
...
@@ -27,7 +27,7 @@ static bool WriteLibEntryDateAndTime( FILE* ExportFile,
static
int
fill_tab
[
3
]
=
{
'N'
,
'F'
,
'f'
};
static
int
fill_tab
[
3
]
=
{
'N'
,
'F'
,
'f'
};
/***********************************************/
/***********************************************/
bool
LibDrawArc
::
WriteDescr
(
FILE
*
ExportFile
)
bool
LibDrawArc
::
Save
(
FILE
*
ExportFile
)
const
/***********************************************/
/***********************************************/
/* format
/* format
...
@@ -46,12 +46,12 @@ bool LibDrawArc::WriteDescr( FILE* ExportFile )
...
@@ -46,12 +46,12 @@ bool LibDrawArc::WriteDescr( FILE* ExportFile )
m_Unit
,
m_Convert
,
m_Unit
,
m_Convert
,
m_Width
,
fill_tab
[
m_Fill
],
m_Width
,
fill_tab
[
m_Fill
],
m_ArcStart
.
x
,
m_ArcStart
.
y
,
m_ArcEnd
.
x
,
m_ArcEnd
.
y
);
m_ArcStart
.
x
,
m_ArcStart
.
y
,
m_ArcEnd
.
x
,
m_ArcEnd
.
y
);
return
FALSE
;
return
true
;
}
}
/***************************************************/
/***************************************************/
bool
LibDrawCircle
::
WriteDescr
(
FILE
*
ExportFile
)
bool
LibDrawCircle
::
Save
(
FILE
*
ExportFile
)
const
/***************************************************/
/***************************************************/
{
{
fprintf
(
ExportFile
,
"C %d %d %d %d %d %d %c
\n
"
,
fprintf
(
ExportFile
,
"C %d %d %d %d %d %d %c
\n
"
,
...
@@ -59,12 +59,12 @@ bool LibDrawCircle::WriteDescr( FILE* ExportFile )
...
@@ -59,12 +59,12 @@ bool LibDrawCircle::WriteDescr( FILE* ExportFile )
m_Rayon
,
m_Rayon
,
m_Unit
,
m_Convert
,
m_Unit
,
m_Convert
,
m_Width
,
fill_tab
[
m_Fill
]
);
m_Width
,
fill_tab
[
m_Fill
]
);
return
FALSE
;
return
true
;
}
}
/************************************************/
/************************************************/
bool
LibDrawText
::
WriteDescr
(
FILE
*
ExportFile
)
bool
LibDrawText
::
Save
(
FILE
*
ExportFile
)
const
/************************************************/
/************************************************/
{
{
wxString
text
=
m_Text
;
wxString
text
=
m_Text
;
...
@@ -77,24 +77,24 @@ bool LibDrawText::WriteDescr( FILE* ExportFile )
...
@@ -77,24 +77,24 @@ bool LibDrawText::WriteDescr( FILE* ExportFile )
m_Size
.
x
,
m_Type
,
m_Size
.
x
,
m_Type
,
m_Unit
,
m_Convert
,
m_Unit
,
m_Convert
,
CONV_TO_UTF8
(
text
)
);
CONV_TO_UTF8
(
text
)
);
return
FALSE
;
return
true
;
}
}
/***************************************************/
/***************************************************/
bool
LibDrawSquare
::
WriteDescr
(
FILE
*
ExportFile
)
bool
LibDrawSquare
::
Save
(
FILE
*
ExportFile
)
const
/***************************************************/
/***************************************************/
{
{
fprintf
(
ExportFile
,
"S %d %d %d %d %d %d %d %c
\n
"
,
fprintf
(
ExportFile
,
"S %d %d %d %d %d %d %d %c
\n
"
,
m_Pos
.
x
,
m_Pos
.
y
,
m_End
.
x
,
m_End
.
y
,
m_Pos
.
x
,
m_Pos
.
y
,
m_End
.
x
,
m_End
.
y
,
m_Unit
,
m_Convert
,
m_Unit
,
m_Convert
,
m_Width
,
fill_tab
[
m_Fill
]
);
m_Width
,
fill_tab
[
m_Fill
]
);
return
FALSE
;
return
true
;
}
}
/************************************************/
/************************************************/
bool
LibDrawPin
::
WriteDescr
(
FILE
*
ExportFile
)
bool
LibDrawPin
::
Save
(
FILE
*
ExportFile
)
const
/************************************************/
/************************************************/
{
{
wxString
StringPinNum
;
wxString
StringPinNum
;
...
@@ -145,12 +145,12 @@ bool LibDrawPin::WriteDescr( FILE* ExportFile )
...
@@ -145,12 +145,12 @@ bool LibDrawPin::WriteDescr( FILE* ExportFile )
fprintf
(
ExportFile
,
"V"
);
fprintf
(
ExportFile
,
"V"
);
fprintf
(
ExportFile
,
"
\n
"
);
fprintf
(
ExportFile
,
"
\n
"
);
return
FALSE
;
return
true
;
}
}
/****************************************************/
/****************************************************/
bool
LibDrawPolyline
::
WriteDescr
(
FILE
*
ExportFile
)
bool
LibDrawPolyline
::
Save
(
FILE
*
ExportFile
)
const
/****************************************************/
/****************************************************/
{
{
int
ii
,
*
ptpoly
;
int
ii
,
*
ptpoly
;
...
@@ -167,12 +167,22 @@ bool LibDrawPolyline::WriteDescr( FILE* ExportFile )
...
@@ -167,12 +167,22 @@ bool LibDrawPolyline::WriteDescr( FILE* ExportFile )
}
}
fprintf
(
ExportFile
,
" %c
\n
"
,
fill_tab
[
m_Fill
]
);
fprintf
(
ExportFile
,
" %c
\n
"
,
fill_tab
[
m_Fill
]
);
return
FALSE
;
return
true
;
}
/****************************************************/
bool
LibDrawSegment
::
Save
(
FILE
*
ExportFile
)
const
/****************************************************/
{
fprintf
(
ExportFile
,
"L %d %d %d"
,
m_Unit
,
m_Convert
,
m_Width
);
return
true
;
}
}
/**************************************************/
/**************************************************/
bool
LibDrawField
::
WriteDescr
(
FILE
*
ExportFile
)
bool
LibDrawField
::
Save
(
FILE
*
ExportFile
)
const
/**************************************************/
/**************************************************/
{
{
int
hjustify
,
vjustify
;
int
hjustify
,
vjustify
;
...
@@ -203,7 +213,7 @@ bool LibDrawField::WriteDescr( FILE* ExportFile )
...
@@ -203,7 +213,7 @@ bool LibDrawField::WriteDescr( FILE* ExportFile )
fprintf
(
ExportFile
,
"
\"
%s
\"
"
,
CONV_TO_UTF8
(
m_Name
)
);
fprintf
(
ExportFile
,
"
\"
%s
\"
"
,
CONV_TO_UTF8
(
m_Name
)
);
fprintf
(
ExportFile
,
"
\n
"
);
fprintf
(
ExportFile
,
"
\n
"
);
return
FALSE
;
return
true
;
}
}
...
@@ -341,10 +351,9 @@ EDA_LibComponentStruct* CopyLibEntryStruct( wxWindow* frame, EDA_LibComponentStr
...
@@ -341,10 +351,9 @@ EDA_LibComponentStruct* CopyLibEntryStruct( wxWindow* frame, EDA_LibComponentStr
}
}
/********************************************************/
/*************************************************************************/
int
WriteOneLibEntry
(
wxWindow
*
frame
,
FILE
*
ExportFile
,
int
WriteOneLibEntry
(
FILE
*
ExportFile
,
EDA_LibComponentStruct
*
LibEntry
)
EDA_LibComponentStruct
*
LibEntry
)
/*************************************************************************/
/********************************************************/
/* Routine d'ecriture du composant pointe par LibEntry
/* Routine d'ecriture du composant pointe par LibEntry
* dans le fichier ExportFile( qui doit etre deja ouvert)
* dans le fichier ExportFile( qui doit etre deja ouvert)
...
@@ -384,15 +393,15 @@ int WriteOneLibEntry( wxWindow* frame, FILE* ExportFile,
...
@@ -384,15 +393,15 @@ int WriteOneLibEntry( wxWindow* frame, FILE* ExportFile,
WriteLibEntryDateAndTime
(
ExportFile
,
LibEntry
);
WriteLibEntryDateAndTime
(
ExportFile
,
LibEntry
);
/* Position / orientation / visibilite des champs */
/* Position / orientation / visibilite des champs */
LibEntry
->
m_Prefix
.
WriteDescr
(
ExportFile
);
LibEntry
->
m_Prefix
.
Save
(
ExportFile
);
LibEntry
->
m_Name
.
WriteDescr
(
ExportFile
);
LibEntry
->
m_Name
.
Save
(
ExportFile
);
for
(
Field
=
LibEntry
->
Fields
;
Field
!=
NULL
;
for
(
Field
=
LibEntry
->
Fields
;
Field
!=
NULL
;
Field
=
(
LibDrawField
*
)
Field
->
Pnext
)
Field
=
(
LibDrawField
*
)
Field
->
Pnext
)
{
{
if
(
Field
->
m_Text
.
IsEmpty
()
&&
Field
->
m_Name
.
IsEmpty
()
)
if
(
Field
->
m_Text
.
IsEmpty
()
&&
Field
->
m_Name
.
IsEmpty
()
)
continue
;
continue
;
Field
->
WriteDescr
(
ExportFile
);
Field
->
Save
(
ExportFile
);
}
}
/* Sauvegarde de la ligne "ALIAS" */
/* Sauvegarde de la ligne "ALIAS" */
...
@@ -429,48 +438,7 @@ int WriteOneLibEntry( wxWindow* frame, FILE* ExportFile,
...
@@ -429,48 +438,7 @@ int WriteOneLibEntry( wxWindow* frame, FILE* ExportFile,
DrawEntry
=
LibEntry
->
m_Drawings
;
DrawEntry
=
LibEntry
->
m_Drawings
;
while
(
DrawEntry
)
while
(
DrawEntry
)
{
{
switch
(
DrawEntry
->
Type
()
)
DrawEntry
->
Save
(
ExportFile
);
{
case
COMPONENT_ARC_DRAW_TYPE
:
#define DRAWSTRUCT ( (LibDrawArc*) DrawEntry )
DRAWSTRUCT
->
WriteDescr
(
ExportFile
);
break
;
case
COMPONENT_CIRCLE_DRAW_TYPE
:
#undef DRAWSTRUCT
#define DRAWSTRUCT ( (LibDrawCircle*) DrawEntry )
DRAWSTRUCT
->
WriteDescr
(
ExportFile
);
break
;
case
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
:
#undef DRAWSTRUCT
#define DRAWSTRUCT ( (LibDrawText*) DrawEntry )
DRAWSTRUCT
->
WriteDescr
(
ExportFile
);
break
;
case
COMPONENT_RECT_DRAW_TYPE
:
#undef DRAWSTRUCT
#define DRAWSTRUCT ( (LibDrawSquare*) DrawEntry )
DRAWSTRUCT
->
WriteDescr
(
ExportFile
);
break
;
case
COMPONENT_PIN_DRAW_TYPE
:
#undef DRAWSTRUCT
#define DRAWSTRUCT ( (LibDrawPin*) DrawEntry )
DRAWSTRUCT
->
WriteDescr
(
ExportFile
);
break
;
case
COMPONENT_POLYLINE_DRAW_TYPE
:
#undef DRAWSTRUCT
#define DRAWSTRUCT ( (LibDrawPolyline*) DrawEntry )
DRAWSTRUCT
->
WriteDescr
(
ExportFile
);
break
;
default
:
DisplayError
(
frame
,
wxT
(
"Save Lib: Unknown Draw Type"
)
);
break
;
}
DrawEntry
=
DrawEntry
->
Next
();
DrawEntry
=
DrawEntry
->
Next
();
}
}
fprintf
(
ExportFile
,
"ENDDRAW
\n
"
);
fprintf
(
ExportFile
,
"ENDDRAW
\n
"
);
...
@@ -517,104 +485,97 @@ int WriteOneDocLibEntry( FILE* ExportFile, EDA_LibComponentStruct* LibEntry )
...
@@ -517,104 +485,97 @@ int WriteOneDocLibEntry( FILE* ExportFile, EDA_LibComponentStruct* LibEntry )
/*********************************************************************************/
/*********************************************************************************/
int
SaveOneLibrary
(
wxWindow
*
frame
,
const
wxString
&
FullFileName
,
LibraryStruct
*
Library
)
bool
LibraryStruct
::
SaveLibrary
(
const
wxString
&
FullFileName
)
/*********************************************************************************/
/*********************************************************************************/
/**
/* Sauvegarde en fichier la librairie pointee par Library, sous le nom
* Function SaveLibrary
* FullFileName.
* writes the data structures for this object out to 2 file
* 2 fichiers sont crees
* the library in "*.lib" format.
* - La librarie
* the doc file in "*.dcm" format.
* - le fichier de documentation
* creates a backup file for each file (.bak and .bck)
*
* @param aFullFileName The full lib filename.
* une sauvegarde .bak de l'ancien fichier librairie est cree
* @return bool - true if success writing else false.
* une sauvegarde .bck de l'ancien fichier documentation est cree
*
* return:
* 0 si OK
* 1 si erreur
*/
*/
{
{
FILE
*
SaveFile
,
*
SaveDocF
ile
;
FILE
*
libfile
,
*
docf
ile
;
EDA_LibComponentStruct
*
LibEntry
;
EDA_LibComponentStruct
*
LibEntry
;
char
Line
[
1024
];
wxString
libname
,
docname
,
backupname
,
msg
;
int
err
=
1
;
wxString
Name
,
DocName
,
BakName
,
msg
;
if
(
Library
==
NULL
)
libname
=
FullFileName
;
return
err
;
Name
=
FullFileName
;
/* the old .lib file is renamed .bak */
if
(
wxFileExists
(
libname
)
)
/* L'ancien fichier lib est renomme en .bak */
if
(
wxFileExists
(
Name
)
)
{
{
BakName
=
Name
;
ChangeFileNameExt
(
BakN
ame
,
wxT
(
".bak"
)
);
backupname
=
libname
;
ChangeFileNameExt
(
backupn
ame
,
wxT
(
".bak"
)
);
wxRemoveFile
(
BakN
ame
);
wxRemoveFile
(
backupn
ame
);
if
(
!
wxRenameFile
(
Name
,
BakN
ame
)
)
if
(
!
wxRenameFile
(
libname
,
backupn
ame
)
)
{
{
msg
=
wxT
(
"Failed to rename old lib file "
)
+
BakN
ame
;
msg
=
wxT
(
"Failed to rename old lib file "
)
+
backupn
ame
;
DisplayError
(
frame
,
msg
,
20
);
DisplayError
(
NULL
,
msg
,
20
);
}
}
}
}
docname
=
FullFileName
;
ChangeFileNameExt
(
docname
,
DOC_EXT
);
DocName
=
Name
;
ChangeFileNameExt
(
DocName
,
DOC_EXT
);
/* L'ancien fichier doc lib est renomme en .bck */
/* L'ancien fichier doc lib est renomme en .bck */
if
(
wxFileExists
(
DocN
ame
)
)
if
(
wxFileExists
(
docn
ame
)
)
{
{
BakName
=
DocName
;
ChangeFileNameExt
(
BakN
ame
,
wxT
(
".bck"
)
);
backupname
=
docname
;
ChangeFileNameExt
(
backupn
ame
,
wxT
(
".bck"
)
);
wxRemoveFile
(
BakN
ame
);
wxRemoveFile
(
backupn
ame
);
if
(
!
wxRenameFile
(
DocName
,
BakN
ame
)
)
if
(
!
wxRenameFile
(
docname
,
backupn
ame
)
)
{
{
msg
=
wxT
(
"Failed to save old doc lib file "
)
+
BakN
ame
;
msg
=
wxT
(
"Failed to save old doc lib file "
)
+
backupn
ame
;
DisplayError
(
frame
,
msg
,
20
);
DisplayError
(
NULL
,
msg
,
20
);
}
}
}
}
SaveFile
=
wxFopen
(
N
ame
,
wxT
(
"wt"
)
);
libfile
=
wxFopen
(
libn
ame
,
wxT
(
"wt"
)
);
if
(
SaveF
ile
==
NULL
)
if
(
libf
ile
==
NULL
)
{
{
msg
=
wxT
(
"Failed to create Lib File "
)
+
N
ame
;
msg
=
wxT
(
"Failed to create Lib File "
)
+
libn
ame
;
DisplayError
(
frame
,
msg
,
20
);
DisplayError
(
NULL
,
msg
,
20
);
return
err
;
return
false
;
}
}
SaveDocFile
=
wxFopen
(
DocN
ame
,
wxT
(
"wt"
)
);
docfile
=
wxFopen
(
docn
ame
,
wxT
(
"wt"
)
);
if
(
SaveDocF
ile
==
NULL
)
if
(
docf
ile
==
NULL
)
{
{
msg
=
wxT
(
"Failed to create DocLib File "
)
+
DocName
;
msg
=
wxT
(
"Failed to create DocLib File "
)
+
docname
;
DisplayError
(
frame
,
msg
,
20
);
DisplayError
(
NULL
,
msg
,
20
);
return
err
;
}
}
Library
->
m_Modified
=
0
;
m_Modified
=
0
;
/* Creation de l'entete de la librairie */
/* Creation de l'entete de la librairie */
Library
->
m_TimeStamp
=
GetTimeStamp
();
m_TimeStamp
=
GetTimeStamp
();
Library
->
WriteHeader
(
SaveFile
);
WriteHeader
(
libfile
);
fprintf
(
SaveDocFile
,
"%s Date: %s
\n
"
,
DOCFILE_IDENT
,
DateAndTime
(
Line
)
);
/* Sauvegarde des composant: */
/* Sauvegarde des composant: */
PQCompFunc
(
(
PQCompFuncType
)
LibraryEntryCompare
);
PQCompFunc
(
(
PQCompFuncType
)
LibraryEntryCompare
);
LibEntry
=
(
EDA_LibComponentStruct
*
)
PQFirst
(
&
Library
->
m_Entries
,
FALSE
);
LibEntry
=
(
EDA_LibComponentStruct
*
)
PQFirst
(
&
m_Entries
,
FALSE
);
char
Line
[
256
];
fprintf
(
docfile
,
"%s Date: %s
\n
"
,
DOCFILE_IDENT
,
DateAndTime
(
Line
)
);
bool
success
=
true
;
while
(
LibEntry
)
while
(
LibEntry
)
{
{
err
=
WriteOneLibEntry
(
frame
,
SaveFile
,
LibEntry
);
if
(
WriteOneLibEntry
(
libfile
,
LibEntry
)
!=
0
)
err
=
WriteOneDocLibEntry
(
SaveDocFile
,
LibEntry
);
success
=
false
;
if
(
docfile
)
if
(
WriteOneDocLibEntry
(
docfile
,
LibEntry
)
!=
0
)
success
=
false
;
LibEntry
=
(
EDA_LibComponentStruct
*
)
LibEntry
=
(
EDA_LibComponentStruct
*
)
PQNext
(
Library
->
m_Entries
,
LibEntry
,
NULL
);
PQNext
(
m_Entries
,
LibEntry
,
NULL
);
}
}
fprintf
(
SaveFile
,
"#
\n
#End Library
\n
"
);
fprintf
(
libfile
,
"#
\n
#End Library
\n
"
);
fprintf
(
SaveDocFile
,
"#
\n
#End Doc Library
\n
"
);
if
(
docfile
)
fclose
(
SaveFile
);
fprintf
(
docfile
,
"#
\n
#End Doc Library
\n
"
);
fclose
(
SaveDocFile
);
fclose
(
libfile
);
return
err
;
fclose
(
docfile
);
return
success
;
}
}
...
...
eeschema/symbedit.cpp
View file @
bf688ea1
...
@@ -137,7 +137,6 @@ void WinEDA_LibeditFrame::SaveOneSymbol()
...
@@ -137,7 +137,6 @@ void WinEDA_LibeditFrame::SaveOneSymbol()
{
{
EDA_LibComponentStruct
*
LibEntry
=
CurrentLibEntry
;
EDA_LibComponentStruct
*
LibEntry
=
CurrentLibEntry
;
int
Unit
=
CurrentUnit
,
convert
=
CurrentConvert
;
int
Unit
=
CurrentUnit
,
convert
=
CurrentConvert
;
int
SymbUnit
,
SymbConvert
;
LibEDA_BaseStruct
*
DrawEntry
;
LibEDA_BaseStruct
*
DrawEntry
;
wxString
FullFileName
,
mask
;
wxString
FullFileName
,
mask
;
wxString
msg
;
wxString
msg
;
...
@@ -196,8 +195,8 @@ void WinEDA_LibeditFrame::SaveOneSymbol()
...
@@ -196,8 +195,8 @@ void WinEDA_LibeditFrame::SaveOneSymbol()
1
,
0
/* unused */
,
'N'
);
1
,
0
/* unused */
,
'N'
);
/* Position / orientation / visibilite des champs */
/* Position / orientation / visibilite des champs */
LibEntry
->
m_Prefix
.
WriteDescr
(
ExportFile
);
LibEntry
->
m_Prefix
.
Save
(
ExportFile
);
LibEntry
->
m_Name
.
WriteDescr
(
ExportFile
);
LibEntry
->
m_Name
.
Save
(
ExportFile
);
DrawEntry
=
LibEntry
->
m_Drawings
;
DrawEntry
=
LibEntry
->
m_Drawings
;
if
(
DrawEntry
)
if
(
DrawEntry
)
...
@@ -211,55 +210,7 @@ void WinEDA_LibeditFrame::SaveOneSymbol()
...
@@ -211,55 +210,7 @@ void WinEDA_LibeditFrame::SaveOneSymbol()
if
(
convert
&&
DrawEntry
->
m_Convert
&&
(
DrawEntry
->
m_Convert
!=
convert
)
)
if
(
convert
&&
DrawEntry
->
m_Convert
&&
(
DrawEntry
->
m_Convert
!=
convert
)
)
continue
;
continue
;
/* .Unit , . Convert est laisse a 0 ou mis a 1 */
DrawEntry
->
Save
(
ExportFile
);
SymbUnit
=
DrawEntry
->
m_Unit
;
if
(
SymbUnit
>
1
)
SymbUnit
=
1
;
SymbConvert
=
DrawEntry
->
m_Convert
;
if
(
SymbConvert
>
1
)
SymbConvert
=
1
;
switch
(
DrawEntry
->
Type
()
)
{
case
COMPONENT_ARC_DRAW_TYPE
:
#define DRAWSTRUCT ( (LibDrawArc*) DrawEntry )
DRAWSTRUCT
->
WriteDescr
(
ExportFile
);
break
;
case
COMPONENT_CIRCLE_DRAW_TYPE
:
#undef DRAWSTRUCT
#define DRAWSTRUCT ( (LibDrawCircle*) DrawEntry )
DRAWSTRUCT
->
WriteDescr
(
ExportFile
);
break
;
case
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
:
#undef DRAWSTRUCT
#define DRAWSTRUCT ( (LibDrawText*) DrawEntry )
DRAWSTRUCT
->
WriteDescr
(
ExportFile
);
break
;
case
COMPONENT_RECT_DRAW_TYPE
:
#undef DRAWSTRUCT
#define DRAWSTRUCT ( (LibDrawSquare*) DrawEntry )
DRAWSTRUCT
->
WriteDescr
(
ExportFile
);
break
;
case
COMPONENT_PIN_DRAW_TYPE
:
#undef DRAWSTRUCT
#define DRAWSTRUCT ( (LibDrawPin*) DrawEntry )
if
(
DRAWSTRUCT
->
m_Attributs
&
PINNOTDRAW
)
break
;
DRAWSTRUCT
->
WriteDescr
(
ExportFile
);
break
;
case
COMPONENT_POLYLINE_DRAW_TYPE
:
#undef DRAWSTRUCT
#define DRAWSTRUCT ( (LibDrawPolyline*) DrawEntry )
DRAWSTRUCT
->
WriteDescr
(
ExportFile
);
break
;
default
:
;
}
}
}
fprintf
(
ExportFile
,
"ENDDRAW
\n
"
);
fprintf
(
ExportFile
,
"ENDDRAW
\n
"
);
}
}
...
...
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