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
24e66546
Commit
24e66546
authored
Apr 16, 2008
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
formatting and comments
parent
a55ef8df
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
141 additions
and
152 deletions
+141
-152
lib_export.cpp
eeschema/lib_export.cpp
+122
-115
savelib.cpp
eeschema/savelib.cpp
+18
-36
board_item_struct.h
include/board_item_struct.h
+1
-1
No files found.
eeschema/lib_export.cpp
View file @
24e66546
/*****************************/
/*****************************/
/* EESchema - lib_export.cpp */
/* EESchema - lib_export.cpp */
/*****************************/
/*****************************/
/* Routines de maintenanace des librariries:
/* Routines de maintenanace des librariries:
sauvegarde, modification de librairies.
*
sauvegarde, modification de librairies.
creation edition suppression de composants
*
creation edition suppression de composants
*/
*/
#include "fctsys.h"
#include "fctsys.h"
#include "gr_basic.h"
#include "gr_basic.h"
...
@@ -20,23 +20,23 @@
...
@@ -20,23 +20,23 @@
#include "id.h"
#include "id.h"
/*************************************************/
/*************************************************/
void
WinEDA_LibeditFrame
::
ImportOnePart
()
void
WinEDA_LibeditFrame
::
ImportOnePart
()
/*************************************************/
/*************************************************/
/* Routine de lecture de 1 description.
/* Routine de lecture de 1 description.
Le format est celui des librairies, mais on ne charge que 1 composant
*
Le format est celui des librairies, mais on ne charge que 1 composant
ou le 1er composant s'il y en a plusieurs.
*
ou le 1er composant s'il y en a plusieurs.
Si le premier composant est un alias, on chargera la racine correspondante
*
Si le premier composant est un alias, on chargera la racine correspondante
*/
*/
{
{
wxString
Name
,
mask
;
wxString
Name
,
mask
;
LibraryStruct
*
LibTmp
;
LibraryStruct
*
LibTmp
;
EDA_LibComponentStruct
*
LibEntry
;
EDA_LibComponentStruct
*
LibEntry
;
int
err
=
1
;
int
err
=
1
;
mask
=
wxT
(
"*"
)
+
g_LibExtBuffer
;
mask
=
wxT
(
"*"
)
+
g_LibExtBuffer
;
Name
=
EDA_FileSelector
(
_
(
"Import component:"
),
Name
=
EDA_FileSelector
(
_
(
"Import component:"
),
wxEmptyString
,
/* Chemin par defaut */
wxEmptyString
,
/* Chemin par defaut */
wxEmptyString
,
/* nom fichier par defaut */
wxEmptyString
,
/* nom fichier par defaut */
g_LibExtBuffer
,
/* extension par defaut */
g_LibExtBuffer
,
/* extension par defaut */
...
@@ -45,21 +45,22 @@ int err = 1;
...
@@ -45,21 +45,22 @@ int err = 1;
0
,
0
,
TRUE
TRUE
);
);
if
(
Name
==
wxEmptyString
)
return
;
if
(
Name
==
wxEmptyString
)
return
;
LibTmp
=
g_LibraryList
;
g_LibraryList
=
NULL
;
LibTmp
=
g_LibraryList
;
g_LibraryList
=
NULL
;
LoadLibraryName
(
this
,
Name
,
wxT
(
"$tmplib$"
)
);
LoadLibraryName
(
this
,
Name
,
wxT
(
"$tmplib$"
)
);
if
(
g_LibraryList
)
if
(
g_LibraryList
)
{
{
LibEntry
=
(
EDA_LibComponentStruct
*
)
PQFirst
(
&
g_LibraryList
->
m_Entries
,
FALSE
);
LibEntry
=
(
EDA_LibComponentStruct
*
)
PQFirst
(
&
g_LibraryList
->
m_Entries
,
FALSE
);
if
(
LibEntry
)
if
(
LibEntry
)
err
=
LoadOneLibraryPartAux
(
LibEntry
,
g_LibraryList
,
1
);
err
=
LoadOneLibraryPartAux
(
LibEntry
,
g_LibraryList
,
1
);
FreeCmpLibrary
(
this
,
g_LibraryList
->
m_Name
);
FreeCmpLibrary
(
this
,
g_LibraryList
->
m_Name
);
if
(
err
==
0
)
if
(
err
==
0
)
{
{
ReCreateHToolbar
();
ReCreateHToolbar
();
DisplayLibInfos
();
DisplayLibInfos
();
...
@@ -68,37 +69,42 @@ int err = 1;
...
@@ -68,37 +69,42 @@ int err = 1;
}
}
g_LibraryList
=
LibTmp
;
g_LibraryList
=
LibTmp
;
if
(
err
)
DisplayError
(
this
,
_
(
"File is empty"
),
30
);
if
(
err
)
DisplayError
(
this
,
_
(
"File is empty"
),
30
);
}
}
/************************************************************/
/************************************************************/
void
WinEDA_LibeditFrame
::
ExportOnePart
(
bool
create_lib
)
void
WinEDA_LibeditFrame
::
ExportOnePart
(
bool
create_lib
)
/************************************************************/
/************************************************************/
/* Routine de creation d'une nouvelle librairie et de sauvegarde du
composant courant dans cette librarie
si create_lib == TRUE sauvegarde dans le repertoire des libr
sinon: sauvegarde sous le nom demande sans modifications.
Le format du fichier cree est dans tous les cas le meme.
/* Routine de creation d'une nouvelle librairie et de sauvegarde du
*/
* composant courant dans cette librarie
* si create_lib == TRUE sauvegarde dans le repertoire des libr
* sinon: sauvegarde sous le nom demande sans modifications.
*
* Le format du fichier cree est dans tous les cas le meme.
*/
{
{
wxString
Name
,
mask
;
wxString
Name
,
mask
;
LibraryStruct
*
NewLib
,
*
LibTmp
,
*
CurLibTmp
;
LibraryStruct
*
NewLib
,
*
LibTmp
,
*
CurLibTmp
;
int
err
;
int
err
;
if
(
CurrentLibEntry
==
NULL
)
if
(
CurrentLibEntry
==
NULL
)
{
{
DisplayError
(
this
,
_
(
"No Part to Save"
),
10
);
return
;
DisplayError
(
this
,
_
(
"No Part to Save"
),
10
);
return
;
}
}
Name
=
CurrentLibEntry
->
m_Name
.
m_Text
;
Name
=
CurrentLibEntry
->
m_Name
.
m_Text
;
Name
.
MakeLower
();
Name
.
MakeLower
();
mask
=
wxT
(
"*"
)
+
g_LibExtBuffer
;
mask
=
wxT
(
"*"
)
+
g_LibExtBuffer
;
wxString
def_path
;
wxString
def_path
;
if
(
create_lib
)
def_path
=
g_RealLibDirBuffer
;
Name
=
EDA_FileSelector
(
create_lib
?
_
(
"New Library"
)
:
_
(
"Export component:"
),
if
(
create_lib
)
def_path
=
g_RealLibDirBuffer
;
Name
=
EDA_FileSelector
(
create_lib
?
_
(
"New Library"
)
:
_
(
"Export component:"
),
def_path
,
/* Chemin par defaut */
def_path
,
/* Chemin par defaut */
Name
,
/* nom fichier par defaut */
Name
,
/* nom fichier par defaut */
g_LibExtBuffer
,
/* extension par defaut */
g_LibExtBuffer
,
/* extension par defaut */
...
@@ -107,38 +113,39 @@ int err;
...
@@ -107,38 +113,39 @@ int err;
wxFD_SAVE
,
wxFD_SAVE
,
TRUE
TRUE
);
);
if
(
Name
==
wxEmptyString
)
return
;
if
(
Name
==
wxEmptyString
)
return
;
/* Creation d'une librairie standard pour sauvegarde */
/* Creation d'une librairie standard pour sauvegarde */
ChangeFileNameExt
(
Name
,
g_LibExtBuffer
);
ChangeFileNameExt
(
Name
,
g_LibExtBuffer
);
LibTmp
=
g_LibraryList
;
LibTmp
=
g_LibraryList
;
CurLibTmp
=
CurrentLib
;
CurLibTmp
=
CurrentLib
;
NewLib
=
new
LibraryStruct
(
LIBRARY_TYPE_EESCHEMA
,
wxT
(
"$libTmp$"
),
Name
);
NewLib
=
new
LibraryStruct
(
LIBRARY_TYPE_EESCHEMA
,
wxT
(
"$libTmp$"
),
Name
);
g_LibraryList
=
NewLib
;
g_LibraryList
=
NewLib
;
/* Sauvegarde du composant: */
/* Sauvegarde du composant: */
CurrentLib
=
NewLib
;
CurrentLib
=
NewLib
;
SaveOnePartInMemory
();
SaveOnePartInMemory
();
err
=
SaveOneLibrary
(
this
,
Name
,
NewLib
);
err
=
SaveOneLibrary
(
this
,
Name
,
NewLib
);
/* Suppression de la librarie temporaire */
/* Suppression de la librarie temporaire */
FreeCmpLibrary
(
this
,
NewLib
->
m_Name
);
FreeCmpLibrary
(
this
,
NewLib
->
m_Name
);
g_LibraryList
=
LibTmp
;
g_LibraryList
=
LibTmp
;
CurrentLib
=
CurLibTmp
;
CurrentLib
=
CurLibTmp
;
wxString
msg
;
wxString
msg
;
if
(
create_lib
&&
(
err
==
0
)
)
if
(
create_lib
&&
(
err
==
0
)
)
{
{
msg
=
Name
+
_
(
"0k"
);
msg
=
Name
+
_
(
"0k"
);
DisplayInfo
(
this
,
DisplayInfo
(
this
,
_
(
"Note: this new library will be available only if it is loaded by eeschema.
\n
Modify eeschema config if you want use it."
)
);
_
(
"Note: this new library will be available only if it is loaded by eeschema.
\n
Modify eeschema config if you want use it."
)
);
}
}
else
msg
=
_
(
"Error while create "
)
+
Name
;
else
Affiche_Message
(
msg
);
msg
=
_
(
"Error while create "
)
+
Name
;
Affiche_Message
(
msg
);
}
}
eeschema/savelib.cpp
View file @
24e66546
...
@@ -97,40 +97,22 @@ bool LibDrawSquare::WriteDescr( FILE* ExportFile )
...
@@ -97,40 +97,22 @@ bool LibDrawSquare::WriteDescr( FILE* ExportFile )
bool
LibDrawPin
::
WriteDescr
(
FILE
*
ExportFile
)
bool
LibDrawPin
::
WriteDescr
(
FILE
*
ExportFile
)
/************************************************/
/************************************************/
{
{
int
Etype
=
'I'
;
wxString
StringPinNum
;
wxString
StringPinNum
;
int
Etype
;
switch
(
m_PinType
)
switch
(
m_PinType
)
{
{
case
PIN_INPUT
:
default
:
Etype
=
'I'
;
break
;
case
PIN_INPUT
:
Etype
=
'I'
;
break
;
case
PIN_OUTPUT
:
Etype
=
'O'
;
break
;
case
PIN_OUTPUT
:
case
PIN_BIDI
:
Etype
=
'B'
;
break
;
Etype
=
'O'
;
break
;
case
PIN_TRISTATE
:
Etype
=
'T'
;
break
;
case
PIN_PASSIVE
:
Etype
=
'P'
;
break
;
case
PIN_BIDI
:
case
PIN_UNSPECIFIED
:
Etype
=
'U'
;
break
;
Etype
=
'B'
;
break
;
case
PIN_POWER_IN
:
Etype
=
'W'
;
break
;
case
PIN_POWER_OUT
:
Etype
=
'w'
;
break
;
case
PIN_TRISTATE
:
case
PIN_OPENCOLLECTOR
:
Etype
=
'C'
;
break
;
Etype
=
'T'
;
break
;
case
PIN_OPENEMITTER
:
Etype
=
'E'
;
break
;
case
PIN_PASSIVE
:
Etype
=
'P'
;
break
;
case
PIN_UNSPECIFIED
:
Etype
=
'U'
;
break
;
case
PIN_POWER_IN
:
Etype
=
'W'
;
break
;
case
PIN_POWER_OUT
:
Etype
=
'w'
;
break
;
case
PIN_OPENCOLLECTOR
:
Etype
=
'C'
;
break
;
case
PIN_OPENEMITTER
:
Etype
=
'E'
;
break
;
}
}
ReturnPinStringNum
(
StringPinNum
);
ReturnPinStringNum
(
StringPinNum
);
...
...
include/board_item_struct.h
View file @
24e66546
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
* is a base class for any item which can be embedded within the BOARD
* is a base class for any item which can be embedded within the BOARD
* container class, and therefore instances of derived classes should only be
* container class, and therefore instances of derived classes should only be
* found in PCBNEW or other programs that use class BOARD and its contents.
* found in PCBNEW or other programs that use class BOARD and its contents.
* The corresponding class in EESCHEMA
seems to be DrawPartStruct
.
* The corresponding class in EESCHEMA
is SCH_ITEM
.
*/
*/
class
BOARD_ITEM
:
public
EDA_BaseStruct
class
BOARD_ITEM
:
public
EDA_BaseStruct
{
{
...
...
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