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
856b7c79
Commit
856b7c79
authored
Aug 23, 2009
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
beautify, move function comments to header for Doxygen
parent
08d98df7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
123 additions
and
114 deletions
+123
-114
protos.h
eeschema/protos.h
+30
-9
selpart.cpp
eeschema/selpart.cpp
+93
-105
No files found.
eeschema/protos.h
View file @
856b7c79
...
...
@@ -282,21 +282,42 @@ void InstallPineditFrame(WinEDA_LibeditFrame * parent, wxDC * DC, const wxPoint
/* SELPART.CPP */
/**************/
/**
* Function DisplayComponentsNamesInLib
* Routine de selection d'un composant en librairie, par affichage de la
* liste des composants de cette librairie
* Si Library == NULL, selection de librairie demandee
* sinon recherche uniquement dans library
* Retourne
* 1 si composant selectionne
* 0 si commande annulee
*/
int
DisplayComponentsNamesInLib
(
WinEDA_DrawFrame
*
frame
,
LibraryStruct
*
Library
,
wxString
&
Buffer
,
wxString
&
OldName
);
/**
* Function SelectLibraryFromList
* displays a list of current loaded libraries, and allows the user to select a library
* This list is sorted, with the library cache always at end of the list
*/
LibraryStruct
*
SelectLibraryFromList
(
WinEDA_DrawFrame
*
frame
);
/* Routine pour selectionner une librairie a partir d'une liste */
/**
* Function GetNameOfPartToLoad
* Routine de selection du nom d'un composant en librairie pour chargement,
* dans la librairie Library.
* Si Library == NULL, il y aura demande de selection d'une librairie
* Retourne
* 1 si composant selectionne
* 0 si commande annulee
* place le nom du composant a charger, selectionne a partir d'une liste dans
* BufName
*/
int
GetNameOfPartToLoad
(
WinEDA_DrawFrame
*
frame
,
LibraryStruct
*
Lib
,
wxString
&
BufName
);
/* Routine de selection du nom d'un composant en librairie pour chargement,
dans la librairie Library.
Si Library == NULL, il y aura demande de selection d'une librairie
Retourne
1 si composant selectionne
0 si commande annulee
place le nom du composant a charger, selectionne a partir d'une liste dans
BufName */
/**************/
/* LIBARCH.CPP */
...
...
eeschema/selpart.cpp
View file @
856b7c79
/**************************/
/* EESchema - selpart.cpp */
/**************************/
/**************************/
/* EESchema - selpart.cpp */
/**************************/
/* Routine de selection d'un composant en librairie
*/
*/
#include "fctsys.h"
#include "gr_basic.h"
...
...
@@ -22,139 +22,127 @@
/***************************************************************/
LibraryStruct
*
SelectLibraryFromList
(
WinEDA_DrawFrame
*
frame
)
LibraryStruct
*
SelectLibraryFromList
(
WinEDA_DrawFrame
*
frame
)
/***************************************************************/
/** Function SelectLibraryFromList
* Displays a list of current loaded libraries, and allows the user to select a library
* This list is sorted, with the library cache always at end of the list
*/
{
int
ii
,
NumOfLibs
=
NumOfLibraries
();
LibraryStruct
*
Lib
=
NULL
;
static
wxString
OldLibName
;
wxString
LibName
;
if
(
NumOfLibs
==
0
)
{
DisplayError
(
frame
,
_
(
"No libraries are loaded"
)
);
return
(
NULL
)
;
}
WinEDAListBox
ListBox
(
frame
,
_
(
"Select Lib"
),
NULL
,
OldLibName
,
NULL
,
wxColour
(
255
,
255
,
255
));
// Library browser background color
wxArrayString
libNamesList
;
LibraryStruct
*
libcache
=
NULL
;
for
(
LibraryStruct
*
Lib
=
g_LibraryList
;
Lib
!=
NULL
;
Lib
=
Lib
->
m_Pnext
)
int
ii
,
NumOfLibs
=
NumOfLibraries
();
LibraryStruct
*
Lib
=
NULL
;
static
wxString
OldLibName
;
wxString
LibName
;
if
(
NumOfLibs
==
0
)
{
DisplayError
(
frame
,
_
(
"No libraries are loaded"
)
);
return
NULL
;
}
WinEDAListBox
ListBox
(
frame
,
_
(
"Select Lib"
),
NULL
,
OldLibName
,
NULL
,
wxColour
(
255
,
255
,
255
)
);
// Library browser background color
wxArrayString
libNamesList
;
LibraryStruct
*
libcache
=
NULL
;
for
(
LibraryStruct
*
Lib
=
g_LibraryList
;
Lib
!=
NULL
;
Lib
=
Lib
->
m_Pnext
)
{
if
(
Lib
->
m_IsLibCache
)
if
(
Lib
->
m_IsLibCache
)
libcache
=
Lib
;
else
libNamesList
.
Add
(
Lib
->
m_Name
);
}
libNamesList
.
Sort
();
// Add lib cache
if
(
libcache
)
if
(
libcache
)
libNamesList
.
Add
(
libcache
->
m_Name
);
ListBox
.
InsertItems
(
libNamesList
);
ListBox
.
InsertItems
(
libNamesList
);
ListBox
.
MoveMouseToOrigin
();
ListBox
.
MoveMouseToOrigin
();
ii
=
ListBox
.
ShowModal
();
ii
=
ListBox
.
ShowModal
();
if
(
ii
>=
0
)
/* Recherche de la librairie */
if
(
ii
>=
0
)
/* Recherche de la librairie */
{
Lib
=
FindLibrary
(
libNamesList
[
ii
]
);
Lib
=
FindLibrary
(
libNamesList
[
ii
]
);
}
return
(
Lib
)
;
return
Lib
;
}
/******************************************************************************************/
int
DisplayComponentsNamesInLib
(
WinEDA_DrawFrame
*
frame
,
LibraryStruct
*
Library
,
wxString
&
Buffer
,
wxString
&
OldName
)
int
DisplayComponentsNamesInLib
(
WinEDA_DrawFrame
*
frame
,
LibraryStruct
*
Library
,
wxString
&
Buffer
,
wxString
&
OldName
)
/******************************************************************************************/
/* Routine de selection d'un composant en librairie, par affichage de la
liste des composants de cette librairie
Si Library == NULL, selection de librairie demandee
sinon recherche uniquement dans library
Retourne
1 si composant selectionne
0 si commande annulee
*/
{
int
ii
;
wxString
msg
;
EDA_LibComponentStruct
*
LibEntry
;
WinEDAListBox
*
ListBox
;
const
wxChar
**
ListNames
;
if
(
Library
==
NULL
)
Library
=
SelectLibraryFromList
(
frame
);
if
(
Library
==
NULL
)
return
(
0
);
PQCompFunc
((
PQCompFuncType
)
LibraryEntryCompare
);
LibEntry
=
(
EDA_LibComponentStruct
*
)
PQFirst
(
&
Library
->
m_Entries
,
FALSE
);
ii
=
0
;
while
(
LibEntry
)
{
ii
++
;
LibEntry
=
(
EDA_LibComponentStruct
*
)
PQNext
(
Library
->
m_Entries
,
LibEntry
,
NULL
);
}
ListNames
=
(
const
wxChar
**
)
MyZMalloc
(
(
ii
+
1
)
*
sizeof
(
wxChar
*
));
msg
.
Printf
(
_
(
"Select component (%d items)"
),
ii
);
ii
=
0
;
LibEntry
=
(
EDA_LibComponentStruct
*
)
PQFirst
(
&
Library
->
m_Entries
,
FALSE
);
while
(
LibEntry
)
{
ListNames
[
ii
++
]
=
LibEntry
->
m_Name
.
m_Text
.
GetData
();
LibEntry
=
(
EDA_LibComponentStruct
*
)
PQNext
(
Library
->
m_Entries
,
LibEntry
,
NULL
);
}
int
ii
;
wxString
msg
;
EDA_LibComponentStruct
*
LibEntry
;
WinEDAListBox
*
ListBox
;
const
wxChar
**
ListNames
;
if
(
Library
==
NULL
)
Library
=
SelectLibraryFromList
(
frame
);
if
(
Library
==
NULL
)
return
0
;
PQCompFunc
(
(
PQCompFuncType
)
LibraryEntryCompare
);
LibEntry
=
(
EDA_LibComponentStruct
*
)
PQFirst
(
&
Library
->
m_Entries
,
FALSE
);
ii
=
0
;
while
(
LibEntry
)
{
ii
++
;
LibEntry
=
(
EDA_LibComponentStruct
*
)
PQNext
(
Library
->
m_Entries
,
LibEntry
,
NULL
);
}
ListNames
=
(
const
wxChar
**
)
MyZMalloc
(
(
ii
+
1
)
*
sizeof
(
wxChar
*
)
);
msg
.
Printf
(
_
(
"Select component (%d items)"
),
ii
);
ii
=
0
;
LibEntry
=
(
EDA_LibComponentStruct
*
)
PQFirst
(
&
Library
->
m_Entries
,
FALSE
);
while
(
LibEntry
)
{
ListNames
[
ii
++
]
=
LibEntry
->
m_Name
.
m_Text
.
GetData
();
LibEntry
=
(
EDA_LibComponentStruct
*
)
PQNext
(
Library
->
m_Entries
,
LibEntry
,
NULL
);
}
// Qsort(ListNames,StrNumICmp);
ListBox
=
new
WinEDAListBox
(
frame
,
msg
,
ListNames
,
OldName
,
DisplayCmpDoc
,
wxColour
(
255
,
255
,
255
));
// Component background listbox color
ListBox
->
MoveMouseToOrigin
();
ii
=
ListBox
->
ShowModal
();
ListBox
->
Destroy
();
if
(
ii
>=
0
)
Buffer
=
ListNames
[
ii
];
ListBox
=
new
WinEDAListBox
(
frame
,
msg
,
ListNames
,
OldName
,
DisplayCmpDoc
,
wxColour
(
255
,
255
,
255
)
);
// Component background listbox color
ListBox
->
MoveMouseToOrigin
();
ii
=
ListBox
->
ShowModal
();
ListBox
->
Destroy
();
if
(
ii
>=
0
)
Buffer
=
ListNames
[
ii
];
free
(
ListNames
);
free
(
ListNames
);
if
(
ii
<
0
)
return
0
;
return
1
;
if
(
ii
<
0
)
return
0
;
return
1
;
}
/************************************************************/
int
GetNameOfPartToLoad
(
WinEDA_DrawFrame
*
frame
,
LibraryStruct
*
Library
,
wxString
&
BufName
)
int
GetNameOfPartToLoad
(
WinEDA_DrawFrame
*
frame
,
LibraryStruct
*
Library
,
wxString
&
BufName
)
/************************************************************/
/*
Routine de selection du nom d'un composant en librairie pour chargement,
dans la librairie Library.
Si Library == NULL, il y aura demande de selection d'une librairie
Retourne
1 si composant selectionne
0 si commande annulee
place le nom du composant a charger, selectionne a partir d'une liste dans
BufName
*/
{
int
ii
;
static
wxString
OldCmpName
;
int
ii
;
static
wxString
OldCmpName
;
ii
=
DisplayComponentsNamesInLib
(
frame
,
Library
,
BufName
,
OldCmpName
);
if
(
ii
<=
0
)
return
0
;
ii
=
DisplayComponentsNamesInLib
(
frame
,
Library
,
BufName
,
OldCmpName
);
if
(
ii
<=
0
)
return
0
;
OldCmpName
=
BufName
;
return
(
1
);
OldCmpName
=
BufName
;
return
1
;
}
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