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
50d1bcb1
Commit
50d1bcb1
authored
Apr 15, 2009
by
charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more about management of lib files in defualt paths
parent
dd4e9021
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
69 additions
and
33 deletions
+69
-33
3d_viewer.h
3d-viewer/3d_viewer.h
+1
-1
edaappl.cpp
common/edaappl.cpp
+41
-0
dialog_eeschema_config_fbp.cpp
eeschema/dialog_eeschema_config_fbp.cpp
+4
-4
dialog_eeschema_config_fbp.fbp
eeschema/dialog_eeschema_config_fbp.fbp
+4
-4
edit_component_in_lib.cpp
eeschema/edit_component_in_lib.cpp
+2
-21
appl_wxstruct.h
include/appl_wxstruct.h
+7
-1
dialog_edit_module.cpp
pcbnew/dialog_edit_module.cpp
+10
-2
No files found.
3d-viewer/3d_viewer.h
View file @
50d1bcb1
...
...
@@ -26,7 +26,7 @@
#define KICAD_DEFAULT_3D_DRAWFRAME_STYLE wxDEFAULT_FRAME_STYLE|wxWANTS_CHARS
#define LIB3D_PATH wxT("packages3d
/
")
#define LIB3D_PATH wxT("packages3d")
class
Pcb3D_GLCanvas
;
class
WinEDA3D_DrawFrame
;
...
...
common/edaappl.cpp
View file @
50d1bcb1
...
...
@@ -1081,6 +1081,47 @@ void WinEDA_App::SaveLastVisitedLibraryPath( const wxString & aPath)
s_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
)
{
/* If the library path is already in the library search paths
* list, just add the library name to the list. Otherwise, add
* the library name with the full or relative path.
* the relative path, when possible is preferable,
* because it preserve use of default libraries paths, when the path is a sub path of these default paths
*
*/
wxFileName
fn
=
aFullFilename
;
wxString
filename
=
aFullFilename
;
int
pathlen
=
-
1
;
// path len, used to find the better subpath within defualts paths
if
(
GetLibraryPathList
().
Index
(
fn
.
GetPath
()
)
!=
wxNOT_FOUND
)
// Ok, trivial case
filename
=
fn
.
GetName
();
else
// not in the default, : see if this file is in a subpath:
{
filename
=
fn
.
GetPathWithSep
()
+
fn
.
GetFullName
();
for
(
unsigned
kk
=
0
;
kk
<
wxGetApp
().
GetLibraryPathList
().
GetCount
();
kk
++
)
{
if
(
fn
.
MakeRelativeTo
(
GetLibraryPathList
()[
kk
]
)
)
{
if
(
pathlen
<
0
// a subpath is found
||
pathlen
>
(
int
)
fn
.
GetPath
().
Len
()
)
// a better subpath if found
{
filename
=
fn
.
GetPathWithSep
()
+
fn
.
GetFullName
();
pathlen
=
fn
.
GetPath
().
Len
();
}
fn
=
aFullFilename
;
//Try to find a better subpath
}
}
}
return
filename
;
}
/** FindLibraryPath
* Kicad saves user defined library files that are not in the standard
...
...
eeschema/dialog_eeschema_config_fbp.cpp
View file @
50d1bcb1
...
...
@@ -92,7 +92,7 @@ DIALOG_EESCHEMA_CONFIG_FBP::DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWind
m_buttonAdd
->
SetForegroundColour
(
wxColour
(
13
,
118
,
1
)
);
m_buttonAdd
->
SetToolTip
(
_
(
"Add a new library after the selected library, and load it"
)
);
bRightSizer
->
Add
(
m_buttonAdd
,
0
,
wx
ALL
,
5
);
bRightSizer
->
Add
(
m_buttonAdd
,
0
,
wx
RIGHT
|
wxLEFT
,
5
);
m_buttonIns
=
new
wxButton
(
this
,
wxID_ANY
,
_
(
"Ins"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_buttonIns
->
SetForegroundColour
(
wxColour
(
0
,
65
,
130
)
);
...
...
@@ -109,7 +109,7 @@ DIALOG_EESCHEMA_CONFIG_FBP::DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWind
m_buttonCancel
=
new
wxButton
(
this
,
wxID_CANCEL
,
_
(
"Cancel"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_buttonCancel
->
SetForegroundColour
(
wxColour
(
14
,
0
,
179
)
);
bRightSizer
->
Add
(
m_buttonCancel
,
0
,
wx
ALL
,
5
);
bRightSizer
->
Add
(
m_buttonCancel
,
0
,
wx
RIGHT
|
wxLEFT
,
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"
)
);
...
...
@@ -146,10 +146,10 @@ DIALOG_EESCHEMA_CONFIG_FBP::DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWind
bUserPathsButtonsSizer
=
new
wxBoxSizer
(
wxVERTICAL
);
m_buttonBrowse
=
new
wxButton
(
this
,
ID_LIB_PATH_SEL
,
_
(
"Browse"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
bUserPathsButtonsSizer
->
Add
(
m_buttonBrowse
,
0
,
wx
BOTTOM
|
wxRIGHT
|
wxLEFT
|
wxALIGN_CENTER_VERTICAL
,
5
);
bUserPathsButtonsSizer
->
Add
(
m_buttonBrowse
,
0
,
wx
ALIGN_CENTER_VERTICAL
|
wxRIGHT
|
wxLEFT
,
5
);
m_buttonRemovePath
=
new
wxButton
(
this
,
wxID_ANY
,
_
(
"Remove"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
bUserPathsButtonsSizer
->
Add
(
m_buttonRemovePath
,
0
,
wx
ALL
,
5
);
bUserPathsButtonsSizer
->
Add
(
m_buttonRemovePath
,
0
,
wx
BOTTOM
|
wxRIGHT
|
wxLEFT
,
5
);
sbSizer4
->
Add
(
bUserPathsButtonsSizer
,
0
,
wxEXPAND
,
5
);
...
...
eeschema/dialog_eeschema_config_fbp.fbp
View file @
50d1bcb1
...
...
@@ -668,7 +668,7 @@
</object>
<object
class=
"sizeritem"
expanded=
"1"
>
<property
name=
"border"
>
5
</property>
<property
name=
"flag"
>
wx
ALL
</property>
<property
name=
"flag"
>
wx
RIGHT|wxLEFT
</property>
<property
name=
"proportion"
>
0
</property>
<object
class=
"wxButton"
expanded=
"1"
>
<property
name=
"bg"
></property>
...
...
@@ -834,7 +834,7 @@
</object>
<object
class=
"sizeritem"
expanded=
"1"
>
<property
name=
"border"
>
5
</property>
<property
name=
"flag"
>
wx
ALL
</property>
<property
name=
"flag"
>
wx
RIGHT|wxLEFT
</property>
<property
name=
"proportion"
>
0
</property>
<object
class=
"wxButton"
expanded=
"1"
>
<property
name=
"bg"
></property>
...
...
@@ -1099,7 +1099,7 @@
<property
name=
"permission"
>
none
</property>
<object
class=
"sizeritem"
expanded=
"1"
>
<property
name=
"border"
>
5
</property>
<property
name=
"flag"
>
wx
BOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL
</property>
<property
name=
"flag"
>
wx
ALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT
</property>
<property
name=
"proportion"
>
0
</property>
<object
class=
"wxButton"
expanded=
"1"
>
<property
name=
"bg"
></property>
...
...
@@ -1151,7 +1151,7 @@
</object>
<object
class=
"sizeritem"
expanded=
"1"
>
<property
name=
"border"
>
5
</property>
<property
name=
"flag"
>
wx
ALL
</property>
<property
name=
"flag"
>
wx
BOTTOM|wxRIGHT|wxLEFT
</property>
<property
name=
"proportion"
>
0
</property>
<object
class=
"wxButton"
expanded=
"1"
>
<property
name=
"bg"
></property>
...
...
eeschema/edit_component_in_lib.cpp
View file @
50d1bcb1
...
...
@@ -774,30 +774,11 @@ void WinEDA_PartPropertiesFrame::BrowseAndSelectDocFile( wxCommandEvent& event )
* the library name with the full or relative path.
* the relative path, when possible is preferable,
* because it preserve use of default libraries paths, when the path is a sub path of these default paths
*
*/
wxFileName
fn
=
FullFileName
;
wxGetApp
().
SaveLastVisitedLibraryPath
(
fn
.
GetPath
()
);
int
pathlen
=
-
1
;
// path len, used to find the better subpath within defualts paths
if
(
wxGetApp
().
GetLibraryPathList
().
Index
(
fn
.
GetPath
()
)
!=
wxNOT_FOUND
)
// Ok, trivial case
filename
=
fn
.
GetName
();
else
// not in the default, : see if this file is in a subpath:
{
filename
=
fn
.
GetPathWithSep
()
+
fn
.
GetName
();
for
(
unsigned
kk
=
0
;
kk
<
wxGetApp
().
GetLibraryPathList
().
GetCount
();
kk
++
)
{
if
(
fn
.
MakeRelativeTo
(
wxGetApp
().
GetLibraryPathList
()[
kk
]
)
)
{
if
(
pathlen
<
0
// a subpath is found
||
pathlen
>
(
int
)
fn
.
GetPath
().
Len
()
)
// a better subpath if found
{
filename
=
fn
.
GetPathWithSep
()
+
fn
.
GetFullName
();
pathlen
=
fn
.
GetPath
().
Len
();
}
fn
=
FullFileName
;
//Try to find a better subpath
}
}
}
filename
=
wxGetApp
().
ReturnFilenameWithRelativePathInLibPath
(
FullFileName
);
m_Docfile
->
SetValue
(
filename
);
}
...
...
include/appl_wxstruct.h
View file @
50d1bcb1
...
...
@@ -178,6 +178,12 @@ public:
wxString
ReturnLastVisitedLibraryPath
(
const
wxString
&
aSubPathToSearch
=
wxEmptyString
);
void
SaveLastVisitedLibraryPath
(
const
wxString
&
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
ReturnFilenameWithRelativePathInLibPath
(
const
wxString
&
aFullFilename
);
/** Function RemoveLibraryPath
* Removes the given ptah from the libary path list
...
...
pcbnew/dialog_edit_module.cpp
View file @
50d1bcb1
...
...
@@ -506,8 +506,16 @@ void Panel3D_Ctrl::Browse3DLib( wxCommandEvent& event )
if
(
fullfilename
==
wxEmptyString
)
return
;
shortfilename
=
MakeReducedFileName
(
fullfilename
,
fullpath
,
wxEmptyString
);
wxFileName
fn
=
fullfilename
;
wxGetApp
().
SaveLastVisitedLibraryPath
(
fn
.
GetPath
()
);
/* If the file path is already in the library search paths
* list, just add the library name to the list. Otherwise, add
* the library name with the full or relative path.
* the relative path, when possible is preferable,
* because it preserve use of default libraries paths, when the path is a sub path of these default paths
*/
shortfilename
=
wxGetApp
().
ReturnFilenameWithRelativePathInLibPath
(
fullfilename
);
m_3D_ShapeName
->
SetValue
(
shortfilename
);
}
...
...
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