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
ff68ae0b
Commit
ff68ae0b
authored
Apr 18, 2009
by
charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added: handling multiple user paths in library path list (currently, only in Eeschema)
parent
bb5832c8
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
313 additions
and
163 deletions
+313
-163
edaappl.cpp
common/edaappl.cpp
+95
-73
dialog_eeschema_config.cpp
eeschema/dialog_eeschema_config.cpp
+93
-20
dialog_eeschema_config_fbp.cpp
eeschema/dialog_eeschema_config_fbp.cpp
+25
-27
dialog_eeschema_config_fbp.fbp
eeschema/dialog_eeschema_config_fbp.fbp
+81
-32
dialog_eeschema_config_fbp.h
eeschema/dialog_eeschema_config_fbp.h
+8
-6
appl_wxstruct.h
include/appl_wxstruct.h
+11
-5
No files found.
common/edaappl.cpp
View file @
ff68ae0b
...
...
@@ -22,6 +22,7 @@
#include <wx/stdpaths.h>
#include <wx/apptrait.h>
#include <wx/snglinst.h>
#include <wx/tokenzr.h>
#include "appl_wxstruct.h"
#include "common.h"
...
...
@@ -267,6 +268,7 @@ WinEDA_App::~WinEDA_App()
void
WinEDA_App
::
InitEDA_Appl
(
const
wxString
&
aName
,
id_app_type
aId
)
{
wxString
EnvLang
;
m_Id
=
aId
;
m_Checker
=
new
wxSingleInstanceChecker
(
aName
.
Lower
()
+
wxT
(
"-"
)
+
wxGetUserId
()
);
...
...
@@ -297,7 +299,7 @@ void WinEDA_App::InitEDA_Appl( const wxString& aName, id_app_type aId )
SetVendorName
(
wxT
(
"kicad"
)
);
SetAppName
(
aName
.
Lower
()
);
SetTitle
(
aName
);
m_EDA_Config
=
new
wxConfig
(
);
m_EDA_Config
=
new
wxConfig
();
wxASSERT
(
m_EDA_Config
!=
NULL
);
m_EDA_CommonConfig
=
new
wxConfig
(
CommonConfigPath
);
wxASSERT
(
m_EDA_CommonConfig
!=
NULL
);
...
...
@@ -474,6 +476,7 @@ void WinEDA_App::SetDefaultSearchPaths( void )
m_searchPaths
.
Clear
();
#ifdef __WINDOWS__
/* m_BinDir path is in unix notation.
* But wxFileName expect (to work fine) native notation
* specifically when using a path including a server, like
...
...
@@ -553,12 +556,13 @@ void WinEDA_App::SetDefaultSearchPaths( void )
{
fn
.
Clear
();
fn
.
SetPath
(
m_searchPaths
[
i
]
);
/* Add schematic library file path to search path list.
* we must add <kicad path>/library and <kicad path>/library/doc
*/
if
(
m_Id
==
APP_TYPE_EESCHEMA
)
if
(
m_Id
==
APP_TYPE_EESCHEMA
)
{
fn
.
AppendDir
(
wxT
(
"library"
)
);
fn
.
AppendDir
(
wxT
(
"library"
)
);
if
(
fn
.
IsDirReadable
()
)
{
wxLogDebug
(
wxT
(
"Adding <%s> to search path list"
),
...
...
@@ -567,7 +571,7 @@ void WinEDA_App::SetDefaultSearchPaths( void )
}
/* Add schematic doc file path (library/doc)to search path list. */
fn
.
AppendDir
(
wxT
(
"doc"
)
);
fn
.
AppendDir
(
wxT
(
"doc"
)
);
if
(
fn
.
IsDirReadable
()
)
{
wxLogDebug
(
wxT
(
"Adding <%s> to search path list"
),
...
...
@@ -590,7 +594,7 @@ void WinEDA_App::SetDefaultSearchPaths( void )
fn
.
RemoveLastDir
();
/* Add PCB library file path to search path list. */
if
(
(
m_Id
==
APP_TYPE_PCBNEW
)
||
(
m_Id
==
APP_TYPE_CVPCB
)
)
if
(
(
m_Id
==
APP_TYPE_PCBNEW
)
||
(
m_Id
==
APP_TYPE_CVPCB
)
)
{
fn
.
AppendDir
(
wxT
(
"modules"
)
);
...
...
@@ -834,7 +838,7 @@ void WinEDA_App::AddMenuLanguageList( wxMenu* MasterMenu )
for
(
ii
=
0
;
ii
<
LANGUAGE_DESCR_COUNT
;
ii
++
)
{
wxString
label
;
if
(
s_Language_List
[
ii
].
m_DoNotTranslate
)
if
(
s_Language_List
[
ii
].
m_DoNotTranslate
)
label
=
s_Language_List
[
ii
].
m_Lang_Label
;
else
label
=
wxGetTranslation
(
s_Language_List
[
ii
].
m_Lang_Label
);
...
...
@@ -963,11 +967,12 @@ wxString WinEDA_App::GetHelpFile( void )
{
subdirs
.
RemoveAt
(
subdirs
.
GetCount
()
-
1
);
altsubdirs
.
RemoveAt
(
altsubdirs
.
GetCount
()
-
1
);
// wxLocale::GetName() does not return always the short name
subdirs
.
Add
(
m_Locale
->
GetName
().
BeforeLast
(
'_'
)
);
altsubdirs
.
Add
(
m_Locale
->
GetName
().
BeforeLast
(
'_'
)
);
fn
=
FindFileInSearchPaths
(
m_HelpFileName
,
&
altsubdirs
);
if
(
!
fn
)
if
(
!
fn
)
fn
=
FindFileInSearchPaths
(
m_HelpFileName
,
&
subdirs
);
}
...
...
@@ -979,7 +984,7 @@ wxString WinEDA_App::GetHelpFile( void )
subdirs
.
Add
(
_T
(
"en"
)
);
altsubdirs
.
Add
(
_T
(
"en"
)
);
fn
=
FindFileInSearchPaths
(
m_HelpFileName
,
&
altsubdirs
);
if
(
!
fn
)
if
(
!
fn
)
fn
=
FindFileInSearchPaths
(
m_HelpFileName
,
&
subdirs
);
}
...
...
@@ -1001,14 +1006,15 @@ wxString WinEDA_App::GetLibraryFile( const wxString& filename )
return
FindFileInSearchPaths
(
filename
,
&
subdirs
);
}
/** ReturnLastVisitedLibraryPath
* Returns the last visited library directory, or (if void) the first
* path in lib path list ( but not the CWD )
* @param aSubPathToSearch = Prefered sub path to search in path list (defualt = empty string)
*/
wxString
WinEDA_App
::
ReturnLastVisitedLibraryPath
(
const
wxString
&
aSubPathToSearch
)
wxString
WinEDA_App
::
ReturnLastVisitedLibraryPath
(
const
wxString
&
aSubPathToSearch
)
{
if
(
!
m_LastVisitedLibPath
.
IsEmpty
()
)
if
(
!
m_LastVisitedLibPath
.
IsEmpty
()
)
return
m_LastVisitedLibPath
;
wxString
path
;
...
...
@@ -1017,22 +1023,22 @@ wxString WinEDA_App::ReturnLastVisitedLibraryPath( const wxString & aSubPathToSe
* this is the second path in list (the first is the project path)
*/
unsigned
pcount
=
m_libSearchPaths
.
GetCount
();
if
(
pcount
)
if
(
pcount
)
{
unsigned
ipath
=
0
;
if
(
m_libSearchPaths
[
0
]
==
wxGetCwd
()
)
if
(
m_libSearchPaths
[
0
]
==
wxGetCwd
()
)
ipath
=
1
;
// First choice of path:
if
(
ipath
<
pcount
)
if
(
ipath
<
pcount
)
path
=
m_libSearchPaths
[
ipath
];
// Search a sub path matching aSubPathToSearch
if
(
!
aSubPathToSearch
.
IsEmpty
()
)
if
(
!
aSubPathToSearch
.
IsEmpty
()
)
{
for
(
;
ipath
<
pcount
;
ipath
++
)
for
(
;
ipath
<
pcount
;
ipath
++
)
{
if
(
m_libSearchPaths
[
ipath
].
Contains
(
aSubPathToSearch
)
)
if
(
m_libSearchPaths
[
ipath
].
Contains
(
aSubPathToSearch
)
)
{
path
=
m_libSearchPaths
[
ipath
];
break
;
...
...
@@ -1041,22 +1047,24 @@ wxString WinEDA_App::ReturnLastVisitedLibraryPath( const wxString & aSubPathToSe
}
}
if
(
path
.
IsEmpty
()
)
if
(
path
.
IsEmpty
()
)
path
=
wxGetCwd
();
return
path
;
}
void
WinEDA_App
::
SaveLastVisitedLibraryPath
(
const
wxString
&
aPath
)
void
WinEDA_App
::
SaveLastVisitedLibraryPath
(
const
wxString
&
aPath
)
{
m_LastVisitedLibPath
=
aPath
;
}
/** ReturnFilenameWithRelativePathInLibPath
* @return a short filename (with extension) with only a relative path if this filename
* can be found in library paths
* @param aFullFilename = filename with path and extension.
*/
wxString
WinEDA_App
::
ReturnFilenameWithRelativePathInLibPath
(
const
wxString
&
aFullFilename
)
wxString
WinEDA_App
::
ReturnFilenameWithRelativePathInLibPath
(
const
wxString
&
aFullFilename
)
{
/* If the library path is already in the library search paths
* list, just add the library name to the list. Otherwise, add
...
...
@@ -1068,6 +1076,7 @@ wxString WinEDA_App::ReturnFilenameWithRelativePathInLibPath(const wxString & aF
wxFileName
fn
=
aFullFilename
;
wxString
filename
=
aFullFilename
;
int
pathlen
=
-
1
;
// path len, used to find the better subpath within defualts paths
if
(
m_libSearchPaths
.
Index
(
fn
.
GetPath
()
)
!=
wxNOT_FOUND
)
// Ok, trivial case
filename
=
fn
.
GetName
();
else
// not in the default, : see if this file is in a subpath:
...
...
@@ -1075,7 +1084,7 @@ wxString WinEDA_App::ReturnFilenameWithRelativePathInLibPath(const wxString & aF
filename
=
fn
.
GetPathWithSep
()
+
fn
.
GetFullName
();
for
(
unsigned
kk
=
0
;
kk
<
m_libSearchPaths
.
GetCount
();
kk
++
)
{
if
(
fn
.
MakeRelativeTo
(
m_libSearchPaths
[
kk
]
)
)
if
(
fn
.
MakeRelativeTo
(
m_libSearchPaths
[
kk
]
)
)
{
if
(
pathlen
<
0
// a subpath is found
||
pathlen
>
(
int
)
fn
.
GetPath
().
Len
()
)
// a better subpath if found
...
...
@@ -1108,37 +1117,50 @@ wxString WinEDA_App::FindLibraryPath( const wxString& aFileName )
return
m_libSearchPaths
.
FindValidPath
(
aFileName
);
}
/** Function RemoveLibraryPath
* Removes the given path from the library path list
* @param
path = the path to remove
* Removes the given path
(s)
from the library path list
* @param
aPaths = path or path list to remove. paths must be separated by ";"
*/
void
WinEDA_App
::
RemoveLibraryPath
(
const
wxString
&
path
)
void
WinEDA_App
::
RemoveLibraryPath
(
const
wxString
&
aPaths
)
{
wxStringTokenizer
Token
(
aPaths
,
wxT
(
";
\n\r
"
)
);
while
(
Token
.
HasMoreTokens
()
)
{
wxString
path
=
Token
.
GetNextToken
();
if
(
m_libSearchPaths
.
Index
(
path
,
wxFileName
::
IsCaseSensitive
()
)
!=
wxNOT_FOUND
)
{
wxLogDebug
(
wxT
(
"Removing path <%s> from library path search list."
),
path
.
c_str
()
);
m_libSearchPaths
.
Remove
(
path
);
}
}
}
void
WinEDA_App
::
InsertLibraryPath
(
const
wxString
&
path
,
size_t
index
)
/** Function InsertLibraryPath
* insert path(s) int lib paths list.
* @param aPaths = path or path list to add. paths must be separated by ";"
* @param aIndex = insertion point
*/
void
WinEDA_App
::
InsertLibraryPath
(
const
wxString
&
aPaths
,
size_t
aIndex
)
{
wxStringTokenizer
Token
(
aPaths
,
wxT
(
";
\n\r
"
)
);
while
(
Token
.
HasMoreTokens
()
)
{
wxString
path
=
Token
.
GetNextToken
();
if
(
wxFileName
::
DirExists
(
path
)
&&
m_libSearchPaths
.
Index
(
path
,
wxFileName
::
IsCaseSensitive
()
)
==
wxNOT_FOUND
)
{
if
(
i
ndex
>=
m_libSearchPaths
.
GetCount
()
)
if
(
aI
ndex
>=
m_libSearchPaths
.
GetCount
()
)
{
wxLogDebug
(
wxT
(
"Adding path <%s> to library path search list."
),
path
.
c_str
()
);
m_libSearchPaths
.
Add
(
path
);
}
else
{
wxLogDebug
(
wxT
(
"Inserting path <%s> in library path search "
\
"list at index position %d."
),
path
.
c_str
(),
index
);
m_libSearchPaths
.
Insert
(
path
,
index
);
m_libSearchPaths
.
Insert
(
path
,
aIndex
);
}
aIndex
++
;
}
}
}
...
...
eeschema/dialog_eeschema_config.cpp
View file @
ff68ae0b
...
...
@@ -9,6 +9,7 @@
/////////////////////////////////////////////////////////////////////////////
#include "fctsys.h"
#include <wx/tokenzr.h>
#include "appl_wxstruct.h"
#include "common.h"
#include "confirm.h"
...
...
@@ -30,6 +31,8 @@ class DIALOG_EESCHEMA_CONFIG : public DIALOG_EESCHEMA_CONFIG_FBP
private
:
WinEDA_SchematicFrame
*
m_Parent
;
bool
m_LibListChanged
;
bool
m_LibPathChanged
;
wxString
m_UserLibDirBufferImg
;
// Copy of original g_UserLibDirBuffer
private
:
...
...
@@ -39,7 +42,7 @@ private:
void
OnSaveCfgClick
(
wxCommandEvent
&
event
);
void
OnRemoveLibClick
(
wxCommandEvent
&
event
);
void
OnAddOrInsertLibClick
(
wxCommandEvent
&
event
);
void
On
LibPathSelClick
(
wxCommandEvent
&
event
);
void
On
AddOrInsertPath
(
wxCommandEvent
&
event
);
void
OnOkClick
(
wxCommandEvent
&
event
);
void
OnCancelClick
(
wxCommandEvent
&
event
);
void
OnRemoveUserPath
(
wxCommandEvent
&
event
);
...
...
@@ -69,7 +72,6 @@ DIALOG_EESCHEMA_CONFIG::DIALOG_EESCHEMA_CONFIG( WinEDA_SchematicFrame* parent )
wxString
msg
;
m_Parent
=
parent
;
m_LibListChanged
=
false
;
Init
();
...
...
@@ -88,6 +90,10 @@ void DIALOG_EESCHEMA_CONFIG::Init()
SetFont
(
*
g_DialogFont
);
SetFocus
();
m_LibListChanged
=
false
;
m_LibPathChanged
=
false
;
m_UserLibDirBufferImg
=
g_UserLibDirBuffer
;
// Save the original lib path
// Display current files extension (info)
wxString
msg
=
m_InfoCmpFileExt
->
GetLabel
()
+
g_NetCmpExtBuffer
;
m_InfoCmpFileExt
->
SetLabel
(
msg
);
...
...
@@ -126,7 +132,15 @@ void DIALOG_EESCHEMA_CONFIG::Init()
m_NetFormatBox
->
SetSelection
(
g_NetFormat
-
NET_TYPE_PCBNEW
);
m_ListLibr
->
InsertItems
(
g_LibName_List
,
0
);
m_LibDirCtrl
->
SetValue
(
g_UserLibDirBuffer
);
// Load user libs paths:
wxStringTokenizer
Token
(
m_UserLibDirBufferImg
,
wxT
(
";
\n\r
"
)
);
while
(
Token
.
HasMoreTokens
()
)
{
wxString
path
=
Token
.
GetNextToken
();
if
(
wxFileName
::
DirExists
(
path
)
)
m_listUserPaths
->
Append
(
path
);
}
// Display actual libraries paths:
wxPathList
libpaths
=
wxGetApp
().
GetLibraryPathList
();
...
...
@@ -134,6 +148,10 @@ void DIALOG_EESCHEMA_CONFIG::Init()
{
m_DefaultLibraryPathslistBox
->
Append
(
libpaths
[
ii
]);
}
// select the first path afer the current path project
if
(
libpaths
.
GetCount
()
>
1
)
m_DefaultLibraryPathslistBox
->
Select
(
1
);
}
...
...
@@ -141,6 +159,13 @@ void DIALOG_EESCHEMA_CONFIG::Init()
void
DIALOG_EESCHEMA_CONFIG
::
OnCancelClick
(
wxCommandEvent
&
event
)
/******************************************************************/
{
// Recreate the user lib path
if
(
m_LibPathChanged
)
{
for
(
unsigned
ii
=
0
;
ii
<
m_ListLibr
->
GetCount
();
ii
++
)
wxGetApp
().
RemoveLibraryPath
(
m_listUserPaths
->
GetString
(
ii
))
;
wxGetApp
().
InsertLibraryPath
(
g_UserLibDirBuffer
,
1
);
}
EndModal
(
-
1
);
}
...
...
@@ -152,17 +177,21 @@ void DIALOG_EESCHEMA_CONFIG::OnOkClick( wxCommandEvent& event )
// Set new netlist format
g_NetFormat
=
m_NetFormatBox
->
GetSelection
()
+
NET_TYPE_PCBNEW
;
//
Set new default path lib
if
(
g_UserLibDirBuffer
!=
m_LibDirCtrl
->
GetValue
()
)
//
Recreate the user lib path
if
(
m_LibPathChanged
)
{
wxGetApp
().
RemoveLibraryPath
(
g_UserLibDirBuffer
);
g_UserLibDirBuffer
=
m_LibDirCtrl
->
GetValue
();
wxGetApp
().
InsertLibraryPath
(
g_UserLibDirBuffer
,
1
);
m_LibListChanged
=
true
;
g_UserLibDirBuffer
.
Empty
();
for
(
unsigned
ii
=
0
;
ii
<
m_listUserPaths
->
GetCount
();
ii
++
)
{
if
(
ii
>
0
)
g_UserLibDirBuffer
<<
wxT
(
";"
);
g_UserLibDirBuffer
<<
m_listUserPaths
->
GetString
(
ii
);
}
}
// Set new active library list if the list of default path was modified
if
(
m_LibListChanged
)
// Set new active library list if the lib list of if default path list was modified
if
(
m_LibListChanged
||
m_LibPathChanged
)
{
// Recreate lib list
g_LibName_List
.
Clear
();
...
...
@@ -223,7 +252,8 @@ void DIALOG_EESCHEMA_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event )
if
(
ii
==
wxNOT_FOUND
&&
event
.
GetId
()
!=
ID_ADD_LIB
)
ii
=
0
;
wxString
libpath
=
m_LibDirCtrl
->
GetValue
();
wxString
libpath
;
libpath
=
m_DefaultLibraryPathslistBox
->
GetStringSelection
();
if
(
libpath
.
IsEmpty
()
)
libpath
=
wxGetApp
().
ReturnLastVisitedLibraryPath
();
...
...
@@ -295,14 +325,12 @@ void DIALOG_EESCHEMA_CONFIG::OnSaveCfgClick( wxCommandEvent& event )
/***********************************************************************/
void
DIALOG_EESCHEMA_CONFIG
::
On
LibPathSelClick
(
wxCommandEvent
&
event
)
void
DIALOG_EESCHEMA_CONFIG
::
On
AddOrInsertPath
(
wxCommandEvent
&
event
)
/***********************************************************************/
{
wxString
path
=
m_LibDirCtrl
->
GetValue
();
if
(
path
.
IsEmpty
()
)
path
=
wxGetApp
().
ReturnLastVisitedLibraryPath
();
wxString
path
=
wxGetApp
().
ReturnLastVisitedLibraryPath
();
bool
select
=
EDA_DirectorySelector
(
_
(
"
Default Path for l
ibraries"
),
/* Titre de la fenetre */
bool
select
=
EDA_DirectorySelector
(
_
(
"
Default Path for L
ibraries"
),
/* Titre de la fenetre */
path
,
/* Chemin par defaut */
wxDD_DEFAULT_STYLE
,
this
,
/* parent frame */
...
...
@@ -311,7 +339,36 @@ void DIALOG_EESCHEMA_CONFIG::OnLibPathSelClick( wxCommandEvent& event )
if
(
!
select
)
return
;
m_LibDirCtrl
->
SetValue
(
path
);
if
(
!
wxFileName
::
DirExists
(
path
)
)
// Should not occurs
return
;
// Add or insert path if not already in list
if
(
m_listUserPaths
->
FindString
(
path
)
==
wxNOT_FOUND
)
{
int
ipos
=
m_listUserPaths
->
GetCount
();
if
(
event
.
GetId
()
==
wxID_INSERT_PATH
)
{
if
(
ipos
)
ipos
--
;
int
jj
=
m_listUserPaths
->
GetSelection
();
if
(
jj
>=
0
)
ipos
=
jj
;
}
m_listUserPaths
->
Insert
(
path
,
ipos
);
m_LibPathChanged
=
true
;
wxGetApp
().
InsertLibraryPath
(
path
,
ipos
+
1
);
// Display actual libraries paths:
wxPathList
libpaths
=
wxGetApp
().
GetLibraryPathList
();
m_DefaultLibraryPathslistBox
->
Clear
();
for
(
unsigned
ii
=
0
;
ii
<
libpaths
.
GetCount
();
ii
++
)
{
m_DefaultLibraryPathslistBox
->
Append
(
libpaths
[
ii
]);
}
}
else
DisplayError
(
this
,
_
(
"Path already in use"
)
);
wxGetApp
().
SaveLastVisitedLibraryPath
(
path
);
}
...
...
@@ -321,5 +378,21 @@ void DIALOG_EESCHEMA_CONFIG::OnLibPathSelClick( wxCommandEvent& event )
void
DIALOG_EESCHEMA_CONFIG
::
OnRemoveUserPath
(
wxCommandEvent
&
event
)
/***********************************************************************/
{
m_LibDirCtrl
->
Clear
(
);
int
ii
=
m_listUserPaths
->
GetSelection
();
if
(
ii
<
0
)
ii
=
m_listUserPaths
->
GetCount
()
-
1
;
if
(
ii
>=
0
)
{
wxGetApp
().
RemoveLibraryPath
(
m_listUserPaths
->
GetStringSelection
()
);
m_listUserPaths
->
Delete
(
ii
);
m_LibPathChanged
=
true
;
}
// Display actual libraries paths:
wxPathList
libpaths
=
wxGetApp
().
GetLibraryPathList
();
m_DefaultLibraryPathslistBox
->
Clear
();
for
(
unsigned
ii
=
0
;
ii
<
libpaths
.
GetCount
();
ii
++
)
{
m_DefaultLibraryPathslistBox
->
Append
(
libpaths
[
ii
]);
}
}
eeschema/dialog_eeschema_config_fbp.cpp
View file @
ff68ae0b
...
...
@@ -83,38 +83,33 @@ DIALOG_EESCHEMA_CONFIG_FBP::DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWind
bRightSizer
=
new
wxBoxSizer
(
wxVERTICAL
);
m_buttonRemoveLib
=
new
wxButton
(
this
,
ID_REMOVE_LIB
,
_
(
"Remove"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_buttonRemoveLib
->
SetForegroundColour
(
wxColour
(
186
,
1
,
38
)
);
m_buttonRemoveLib
->
SetToolTip
(
_
(
"Unload the selected library"
)
);
bRightSizer
->
Add
(
m_buttonRemoveLib
,
0
,
wxALL
,
5
);
bRightSizer
->
Add
(
m_buttonRemoveLib
,
0
,
wxALL
|
wxALIGN_CENTER_HORIZONTAL
,
5
);
m_buttonAdd
=
new
wxButton
(
this
,
ID_ADD_LIB
,
_
(
"Add"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_buttonAdd
->
SetForegroundColour
(
wxColour
(
13
,
118
,
1
)
);
m_buttonAdd
->
SetToolTip
(
_
(
"Add a new library after the selected library, and load it"
)
);
m_buttonAddLib
=
new
wxButton
(
this
,
ID_ADD_LIB
,
_
(
"Add"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_buttonAddLib
->
SetToolTip
(
_
(
"Add a new library after the selected library, and load it"
)
);
bRightSizer
->
Add
(
m_buttonAdd
,
0
,
wxRIGHT
|
wxLEFT
,
5
);
bRightSizer
->
Add
(
m_buttonAdd
Lib
,
0
,
wxRIGHT
|
wxLEFT
|
wxALIGN_CENTER_HORIZONTAL
,
5
);
m_buttonIns
=
new
wxButton
(
this
,
wxID_ANY
,
_
(
"Ins"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_buttonIns
->
SetForegroundColour
(
wxColour
(
0
,
65
,
130
)
);
m_buttonIns
=
new
wxButton
(
this
,
wxID_ANY
,
_
(
"Insert"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_buttonIns
->
SetToolTip
(
_
(
"Add a new library before the selected library, and load it"
)
);
bRightSizer
->
Add
(
m_buttonIns
,
0
,
wxALL
,
5
);
bRightSizer
->
Add
(
m_buttonIns
,
0
,
wxALL
|
wxALIGN_CENTER_HORIZONTAL
,
5
);
bRightSizer
->
Add
(
0
,
20
,
1
,
wxEXPAND
,
5
);
m_buttonOk
=
new
wxButton
(
this
,
wxID_OK
,
_
(
"Ok"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
bRightSizer
->
Add
(
m_buttonOk
,
0
,
wxALL
,
5
);
bRightSizer
->
Add
(
m_buttonOk
,
0
,
wxALL
|
wxALIGN_CENTER_HORIZONTAL
,
5
);
m_buttonCancel
=
new
wxButton
(
this
,
wxID_CANCEL
,
_
(
"Cancel"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_buttonCancel
->
SetForegroundColour
(
wxColour
(
14
,
0
,
179
)
);
bRightSizer
->
Add
(
m_buttonCancel
,
0
,
wxRIGHT
|
wxLEFT
,
5
);
bRightSizer
->
Add
(
m_buttonCancel
,
0
,
wxRIGHT
|
wxLEFT
|
wxALIGN_CENTER_HORIZONTAL
,
5
);
m_buttonSave
=
new
wxButton
(
this
,
ID_SAVE_CFG
,
_
(
"Save Cfg"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_buttonSave
->
SetToolTip
(
_
(
"Accept and save current configuration setting in the local .pro file"
)
);
bRightSizer
->
Add
(
m_buttonSave
,
0
,
wxALL
|
wxALIGN_CENTER_HORIZONTAL
|
wxEXPAND
,
5
);
bRightSizer
->
Add
(
m_buttonSave
,
0
,
wxALL
|
wxALIGN_CENTER_HORIZONTAL
,
5
);
bUpperSizer
->
Add
(
bRightSizer
,
0
,
wxALIGN_CENTER_VERTICAL
,
5
);
...
...
@@ -135,21 +130,22 @@ DIALOG_EESCHEMA_CONFIG_FBP::DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWind
wxBoxSizer
*
bUserListSizer
;
bUserListSizer
=
new
wxBoxSizer
(
wxVERTICAL
);
m_LibDirCtrl
=
new
wxTextCtrl
(
this
,
wxID_ANY
,
wxEmptyString
,
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_LibDirCtrl
->
SetToolTip
(
_
(
"Default path to search libraries which have no absolute path in name,
\n
or a name which does not start by ./ or ../
\n
If void, the default path is kicad/share/library"
)
);
bUserListSizer
->
Add
(
m_LibDirCtrl
,
0
,
wxBOTTOM
|
wxRIGHT
|
wxLEFT
|
wxEXPAND
,
5
);
m_listUserPaths
=
new
wxListBox
(
this
,
wxID_ANY
,
wxDefaultPosition
,
wxDefaultSize
,
0
,
NULL
,
0
);
bUserListSizer
->
Add
(
m_listUserPaths
,
1
,
wxALL
|
wxEXPAND
,
5
);
sbSizer4
->
Add
(
bUserListSizer
,
1
,
wxALIGN_CENTER_VERTICAL
,
5
);
sbSizer4
->
Add
(
bUserListSizer
,
1
,
wxALIGN_CENTER_VERTICAL
|
wxEXPAND
,
5
);
wxBoxSizer
*
bUserPathsButtonsSizer
;
bUserPathsButtonsSizer
=
new
wxBoxSizer
(
wxVERTICAL
);
m_buttonBrowse
=
new
wxButton
(
this
,
ID_LIB_PATH_SEL
,
_
(
"Browse"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
bUserPathsButtonsSizer
->
Add
(
m_buttonBrowse
,
0
,
wxALIGN_CENTER_VERTICAL
|
wxRIGHT
|
wxLEFT
,
5
);
m_buttonRemovePath
=
new
wxButton
(
this
,
wxID_REMOVE_PATH
,
_
(
"Remove"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
bUserPathsButtonsSizer
->
Add
(
m_buttonRemovePath
,
0
,
wxRIGHT
|
wxLEFT
,
5
);
m_buttonAddPath
=
new
wxButton
(
this
,
ID_LIB_PATH_SEL
,
_
(
"Add"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
bUserPathsButtonsSizer
->
Add
(
m_buttonAddPath
,
0
,
wxALIGN_CENTER_VERTICAL
|
wxRIGHT
|
wxLEFT
,
5
);
m_button
RemovePath
=
new
wxButton
(
this
,
wxID_ANY
,
_
(
"Remove
"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
bUserPathsButtonsSizer
->
Add
(
m_button
Remove
Path
,
0
,
wxBOTTOM
|
wxRIGHT
|
wxLEFT
,
5
);
m_button
InsPath
=
new
wxButton
(
this
,
wxID_INSERT_PATH
,
_
(
"Insert
"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
bUserPathsButtonsSizer
->
Add
(
m_button
Ins
Path
,
0
,
wxBOTTOM
|
wxRIGHT
|
wxLEFT
,
5
);
sbSizer4
->
Add
(
bUserPathsButtonsSizer
,
0
,
wxEXPAND
,
5
);
...
...
@@ -175,13 +171,14 @@ DIALOG_EESCHEMA_CONFIG_FBP::DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWind
// Connect Events
this
->
Connect
(
wxEVT_CLOSE_WINDOW
,
wxCloseEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnCloseWindow
)
);
m_buttonRemoveLib
->
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnRemoveLibClick
),
NULL
,
this
);
m_buttonAdd
->
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnAddOrInsertLibClick
),
NULL
,
this
);
m_buttonAdd
Lib
->
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnAddOrInsertLibClick
),
NULL
,
this
);
m_buttonIns
->
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnAddOrInsertLibClick
),
NULL
,
this
);
m_buttonOk
->
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnOkClick
),
NULL
,
this
);
m_buttonCancel
->
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnCancelClick
),
NULL
,
this
);
m_buttonSave
->
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnSaveCfgClick
),
NULL
,
this
);
m_buttonBrowse
->
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnLibPathSelClick
),
NULL
,
this
);
m_buttonRemovePath
->
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnRemoveUserPath
),
NULL
,
this
);
m_buttonAddPath
->
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnAddOrInsertPath
),
NULL
,
this
);
m_buttonInsPath
->
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnAddOrInsertPath
),
NULL
,
this
);
}
DIALOG_EESCHEMA_CONFIG_FBP
::~
DIALOG_EESCHEMA_CONFIG_FBP
()
...
...
@@ -189,11 +186,12 @@ DIALOG_EESCHEMA_CONFIG_FBP::~DIALOG_EESCHEMA_CONFIG_FBP()
// Disconnect Events
this
->
Disconnect
(
wxEVT_CLOSE_WINDOW
,
wxCloseEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnCloseWindow
)
);
m_buttonRemoveLib
->
Disconnect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnRemoveLibClick
),
NULL
,
this
);
m_buttonAdd
->
Disconnect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnAddOrInsertLibClick
),
NULL
,
this
);
m_buttonAdd
Lib
->
Disconnect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnAddOrInsertLibClick
),
NULL
,
this
);
m_buttonIns
->
Disconnect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnAddOrInsertLibClick
),
NULL
,
this
);
m_buttonOk
->
Disconnect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnOkClick
),
NULL
,
this
);
m_buttonCancel
->
Disconnect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnCancelClick
),
NULL
,
this
);
m_buttonSave
->
Disconnect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnSaveCfgClick
),
NULL
,
this
);
m_buttonBrowse
->
Disconnect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnLibPathSelClick
),
NULL
,
this
);
m_buttonRemovePath
->
Disconnect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnRemoveUserPath
),
NULL
,
this
);
m_buttonAddPath
->
Disconnect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnAddOrInsertPath
),
NULL
,
this
);
m_buttonInsPath
->
Disconnect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_EESCHEMA_CONFIG_FBP
::
OnAddOrInsertPath
),
NULL
,
this
);
}
eeschema/dialog_eeschema_config_fbp.fbp
View file @
ff68ae0b
This diff is collapsed.
Click to expand it.
eeschema/dialog_eeschema_config_fbp.h
View file @
ff68ae0b
...
...
@@ -21,7 +21,6 @@
#include <wx/statbox.h>
#include <wx/button.h>
#include <wx/statline.h>
#include <wx/textctrl.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
...
...
@@ -39,7 +38,9 @@ class DIALOG_EESCHEMA_CONFIG_FBP : public wxDialog
ID_REMOVE_LIB
=
1000
,
ID_ADD_LIB
,
ID_SAVE_CFG
,
wxID_REMOVE_PATH
,
ID_LIB_PATH_SEL
,
wxID_INSERT_PATH
,
};
wxStaticText
*
m_staticTextNetListFormats
;
...
...
@@ -53,16 +54,17 @@ class DIALOG_EESCHEMA_CONFIG_FBP : public wxDialog
wxStaticText
*
m_staticTextlibList
;
wxListBox
*
m_ListLibr
;
wxButton
*
m_buttonRemoveLib
;
wxButton
*
m_buttonAdd
;
wxButton
*
m_buttonAdd
Lib
;
wxButton
*
m_buttonIns
;
wxButton
*
m_buttonOk
;
wxButton
*
m_buttonCancel
;
wxButton
*
m_buttonSave
;
wxStaticLine
*
m_staticline1
;
wxTextCtrl
*
m_LibDirCtrl
;
wxButton
*
m_buttonBrowse
;
wxListBox
*
m_listUserPaths
;
wxButton
*
m_buttonRemovePath
;
wxButton
*
m_buttonAddPath
;
wxButton
*
m_buttonInsPath
;
wxStaticText
*
m_staticTextcurrenpaths
;
wxListBox
*
m_DefaultLibraryPathslistBox
;
...
...
@@ -73,12 +75,12 @@ class DIALOG_EESCHEMA_CONFIG_FBP : public wxDialog
virtual
void
OnOkClick
(
wxCommandEvent
&
event
){
event
.
Skip
();
}
virtual
void
OnCancelClick
(
wxCommandEvent
&
event
){
event
.
Skip
();
}
virtual
void
OnSaveCfgClick
(
wxCommandEvent
&
event
){
event
.
Skip
();
}
virtual
void
OnLibPathSelClick
(
wxCommandEvent
&
event
){
event
.
Skip
();
}
virtual
void
OnRemoveUserPath
(
wxCommandEvent
&
event
){
event
.
Skip
();
}
virtual
void
OnAddOrInsertPath
(
wxCommandEvent
&
event
){
event
.
Skip
();
}
public
:
DIALOG_EESCHEMA_CONFIG_FBP
(
wxWindow
*
parent
,
wxWindowID
id
=
wxID_ANY
,
const
wxString
&
title
=
wxEmptyString
,
const
wxPoint
&
pos
=
wxDefaultPosition
,
const
wxSize
&
size
=
wxSize
(
593
,
5
00
),
long
style
=
wxDEFAULT_DIALOG_STYLE
|
wxRESIZE_BORDER
);
DIALOG_EESCHEMA_CONFIG_FBP
(
wxWindow
*
parent
,
wxWindowID
id
=
wxID_ANY
,
const
wxString
&
title
=
wxEmptyString
,
const
wxPoint
&
pos
=
wxDefaultPosition
,
const
wxSize
&
size
=
wxSize
(
593
,
5
59
),
long
style
=
wxDEFAULT_DIALOG_STYLE
|
wxRESIZE_BORDER
);
~
DIALOG_EESCHEMA_CONFIG_FBP
();
};
...
...
include/appl_wxstruct.h
View file @
ff68ae0b
...
...
@@ -187,11 +187,17 @@ public:
wxString
ReturnFilenameWithRelativePathInLibPath
(
const
wxString
&
aFullFilename
);
/** Function RemoveLibraryPath
* Removes the given p
tah from the lib
ary path list
* @param
path = the path to remove
* Removes the given p
ath(s) from the libr
ary path list
* @param
aPaths = path or path list to remove. paths must be separated by ";"
*/
void
RemoveLibraryPath
(
const
wxString
&
path
);
void
InsertLibraryPath
(
const
wxString
&
path
,
size_t
index
);
void
RemoveLibraryPath
(
const
wxString
&
aPaths
);
/** Function InsertLibraryPath
* insert path(s) int lib paths list.
* @param aPaths = path or path list to add. paths must be separated by ";"
* @param aIndex = insertion point
*/
void
InsertLibraryPath
(
const
wxString
&
aPaths
,
size_t
aIndex
);
};
/*
...
...
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