Re: [Kicad-developers] New Footprint libs and wizard issues

2018-04-09 Thread Jeff Young
I looked at the commit and I’m starting to remember why I didn’t: there’s also 
a bug in wxWidgets where if you start typing into a grid cell it will open the 
editor, but the first keystroke never goes through the validator.  So I fixed 
that too, but between that one and the issue commented in the code you already 
saw (where the Mac version looks at the original character rather than the one 
in the event) left me feeling a little uneasy about 5.0.

> On 9 Apr 2018, at 17:12, jp charras  wrote:
> 
> Le 09/04/2018 à 18:03, Jeff Young a écrit :
>> FWIW, this is already fixed in 6.0.  See the last routine in this file:
>> 
>> https://git.launchpad.net/~jeyjey/kicad/tree/common/validators.cpp?h=6.0
>> 
> 
> Perhaps you could commit this fix to the current V5.
> It does not look like risky.
> 
> 
> -- 
> Jean-Pierre CHARRAS
> 
> ___
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp


___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] New Footprint libs and wizard issues

2018-04-09 Thread jp charras
Le 09/04/2018 à 18:03, Jeff Young a écrit :
> FWIW, this is already fixed in 6.0.  See the last routine in this file:
> 
> https://git.launchpad.net/~jeyjey/kicad/tree/common/validators.cpp?h=6.0
> 

Perhaps you could commit this fix to the current V5.
It does not look like risky.


-- 
Jean-Pierre CHARRAS

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] New Footprint libs and wizard issues

2018-04-09 Thread Jeff Young
FWIW, this is already fixed in 6.0.  See the last routine in this file:

https://git.launchpad.net/~jeyjey/kicad/tree/common/validators.cpp?h=6.0

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] New Footprint libs and wizard issues

2018-04-09 Thread Kevin Cozens

On 2018-04-09 10:21 AM, jp charras wrote:

It has an issue: if I try to enter a lowercase char, it is converted to the 
corresponding uppercase
char (as expected), but the cursor moves to the beginning of the text after the 
char is inserted.


The simplest solution is to do the conversion from lowercase letters to 
uppercase after the input field loses focus.


--
Cheers!

Kevin.

http://www.ve3syb.ca/| "Nerds make the shiny things that
https://www.patreon.html/KevinCozens | distract the mouth-breathers, and
 | that's why we're powerful"
Owner of Elecraft K2 #2172   |
#include   | --Chris Hardwick

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] New Footprint libs and wizard issues

2018-04-09 Thread Kevin Cozens

On 2018-04-07 06:42 PM, kristoffer Ödmark wrote:

Agreed, hereis a patch for that :)

- Kristoffer

On 2018-04-06 17:18, Kevin Cozens wrote:

[snip]
I added MYSYSMOD as a custom path ages ago. What I find odd about the 
dialog boxes that let you add paths is that they won't accept lower case 


Thanks for the patch, kristoffer. I haven't tested it yet. I did notice a 
couple of things when I had a look at the patch file. In one comment you had 
the word "lovercase" instead of "lowercase". The other is about code style. 
I don't know what the code style is for KiCad but it appears to me that you 
used tabs when indenting lines where the rest of the code is using spaces.


--
Cheers!

Kevin.

http://www.ve3syb.ca/| "Nerds make the shiny things that
https://www.patreon.html/KevinCozens | distract the mouth-breathers, and
 | that's why we're powerful"
Owner of Elecraft K2 #2172   |
#include   | --Chris Hardwick

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] New Footprint libs and wizard issues

2018-04-09 Thread Kristoffer Ödmark

Thank you JP!

I will have a look when I get home, It was not happening on linux, and I 
do not currently have a windows computer anywhere, but maybe I can force 
the cursor to the end some other way.


 -Kristoffer

On 2018-04-09 16:21, jp charras wrote:

Le 08/04/2018 à 00:42, kristoffer Ödmark a écrit :

Agreed, hereis a patch for that :)


Hi kristoffer,
I tested your patch (about lowercase) on W7.

It has an issue: if I try to enter a lowercase char, it is converted to the 
corresponding uppercase
char (as expected), but the cursor moves to the beginning of the text after the 
char is inserted.



- Kristoffer

On 2018-04-06 17:18, Kevin Cozens wrote:

On 2018-04-06 06:30 AM, kristoffer Ödmark wrote:

Attached is a patch that adds support for custom environment paths. Previously 
the wizard would
only accept KISYSMOD, KIPRJMOD and the github one.


I added MYSYSMOD as a custom path ages ago. What I find odd about the dialog 
boxes that let you
add paths is that they won't accept lower case letters in the name of the 
environment variable. If
you type a lowercase letter nothing happens on the screen. If it doesn't want 
lowercase it should
force what you entered to uppercase when you are done entering the variable 
name.






___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] New Footprint libs and wizard issues

2018-04-09 Thread jp charras
Le 08/04/2018 à 00:42, kristoffer Ödmark a écrit :
> Agreed, hereis a patch for that :)

Hi kristoffer,
I tested your patch (about lowercase) on W7.

It has an issue: if I try to enter a lowercase char, it is converted to the 
corresponding uppercase
char (as expected), but the cursor moves to the beginning of the text after the 
char is inserted.

> 
> - Kristoffer
> 
> On 2018-04-06 17:18, Kevin Cozens wrote:
>> On 2018-04-06 06:30 AM, kristoffer Ödmark wrote:
>>> Attached is a patch that adds support for custom environment paths. 
>>> Previously the wizard would
>>> only accept KISYSMOD, KIPRJMOD and the github one.
>>
>> I added MYSYSMOD as a custom path ages ago. What I find odd about the dialog 
>> boxes that let you
>> add paths is that they won't accept lower case letters in the name of the 
>> environment variable. If
>> you type a lowercase letter nothing happens on the screen. If it doesn't 
>> want lowercase it should
>> force what you entered to uppercase when you are done entering the variable 
>> name.
>>


-- 
Jean-Pierre CHARRAS

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] New Footprint libs and wizard issues

2018-04-09 Thread Kristoffer Ödmark
I know its not the most elegant solution, but it is actually quite 
convenient. Just checking so that this tiny improvement isnt lost :)


 -Kristoffer

On 2018-04-08 00:42, kristoffer Ödmark wrote:

Agreed, hereis a patch for that :)

- Kristoffer

On 2018-04-06 17:18, Kevin Cozens wrote:

On 2018-04-06 06:30 AM, kristoffer Ödmark wrote:
Attached is a patch that adds support for custom environment paths. 
Previously the wizard would only accept KISYSMOD, KIPRJMOD and the 
github one.


I added MYSYSMOD as a custom path ages ago. What I find odd about the 
dialog boxes that let you add paths is that they won't accept lower 
case letters in the name of the environment variable. If you type a 
lowercase letter nothing happens on the screen. If it doesn't want 
lowercase it should force what you entered to uppercase when you are 
done entering the variable name.






___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] New Footprint libs and wizard issues

2018-04-07 Thread kristoffer Ödmark

Agreed, hereis a patch for that :)

- Kristoffer

On 2018-04-06 17:18, Kevin Cozens wrote:

On 2018-04-06 06:30 AM, kristoffer Ödmark wrote:
Attached is a patch that adds support for custom environment paths. 
Previously the wizard would only accept KISYSMOD, KIPRJMOD and the 
github one.


I added MYSYSMOD as a custom path ages ago. What I find odd about the 
dialog boxes that let you add paths is that they won't accept lower 
case letters in the name of the environment variable. If you type a 
lowercase letter nothing happens on the screen. If it doesn't want 
lowercase it should force what you entered to uppercase when you are 
done entering the variable name.




>From defbd12daaa1876787b63ed784997bf2a4702de2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kristoffer=20=C3=96dmark?= 
Date: Sun, 8 Apr 2018 00:39:06 +0200
Subject: [PATCH] Make Environment Editor accept lowercase, but transform them
 to uppercase when editing

---
 common/dialogs/dialog_env_var_config.cpp | 12 
 common/validators.cpp|  2 +-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/common/dialogs/dialog_env_var_config.cpp b/common/dialogs/dialog_env_var_config.cpp
index 8e327ccb2..f94ce0970 100644
--- a/common/dialogs/dialog_env_var_config.cpp
+++ b/common/dialogs/dialog_env_var_config.cpp
@@ -62,6 +62,8 @@ public:
 m_envVarName->Enable( false );
 }
 
+		void TextToUpper( wxCommandEvent& aEvent );
+
 protected:
 void OnSelectPath( wxCommandEvent& event ) override;
 void onHelpClick( wxCommandEvent& event ) override;
@@ -410,10 +412,20 @@ DIALOG_ENV_VAR_SINGLE::DIALOG_ENV_VAR_SINGLE( wxWindow* parent,
 DIALOG_ENV_VAR_SINGLE_BASE( parent )
 {
 m_envVarName->SetValue( aEnvVarName );
+
+		//Allow lovercase in the validator, but then make them uppercase when inserted.
+m_envVarName->Bind( wxEVT_TEXT, &DIALOG_ENV_VAR_SINGLE::TextToUpper, this, wxID_ANY );
 m_envVarPath->SetValue( aEnvVarPath );
 m_envVarName->SetValidator( ENVIRONMENT_VARIABLE_CHAR_VALIDATOR() );
 }
 
+void DIALOG_ENV_VAR_SINGLE::TextToUpper( wxCommandEvent& aEvent )
+{
+		aEvent.Skip();
+		auto val = m_envVarName->GetValue().Upper();
+		m_envVarName->ChangeValue( val );
+}
+
 
 void DIALOG_ENV_VAR_SINGLE::OnSelectPath( wxCommandEvent& event )
 {
diff --git a/common/validators.cpp b/common/validators.cpp
index bb67a7e96..a5f1e6f1f 100644
--- a/common/validators.cpp
+++ b/common/validators.cpp
@@ -80,6 +80,6 @@ FILE_NAME_WITH_PATH_CHAR_VALIDATOR::FILE_NAME_WITH_PATH_CHAR_VALIDATOR( wxString
 ENVIRONMENT_VARIABLE_CHAR_VALIDATOR::ENVIRONMENT_VARIABLE_CHAR_VALIDATOR( wxString* aValue ) :
 wxTextValidator( wxFILTER_INCLUDE_CHAR_LIST | wxFILTER_EMPTY, aValue )
 {
-wxString includeChars( wxT( "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_" ) );
+wxString includeChars( wxT( "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_" ) );
 SetCharIncludes( includeChars );
 }
-- 
2.16.2

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] New Footprint libs and wizard issues

2018-04-06 Thread Kevin Cozens

On 2018-04-06 06:30 AM, kristoffer Ödmark wrote:
Attached is a patch that adds support for custom environment paths. 
Previously the wizard would only accept KISYSMOD, KIPRJMOD and the github one.


I added MYSYSMOD as a custom path ages ago. What I find odd about the dialog 
boxes that let you add paths is that they won't accept lower case letters in 
the name of the environment variable. If you type a lowercase letter nothing 
happens on the screen. If it doesn't want lowercase it should force what you 
entered to uppercase when you are done entering the variable name.


--
Cheers!

Kevin.

http://www.ve3syb.ca/| "Nerds make the shiny things that
https://www.patreon.html/KevinCozens | distract the mouth-breathers, and
 | that's why we're powerful"
Owner of Elecraft K2 #2172   |
#include   | --Chris Hardwick

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] New Footprint libs and wizard issues

2018-04-06 Thread Jeff Young
I think the reason is that KIPRJMOD is not editable.  Still, it would be better 
to show it in the dialog and just make it read-only (as then the user would 
know it existed without opening the help window).  Feel free to log a bug for 
that (just set its milestone to 6.0).

I’ll merge your patch.  Thanks for your contribution!

Cheers,
Jeff.

> On 6 Apr 2018, at 14:05, kristoffer Ödmark  
> wrote:
> 
> Turns out the redundant code was not very redundant. There would have to be 
> some more refactoring of the code to
> get this all using the NormalizePath command in common/env_paths.cpp
> 
> I am also uncertain, since I dont understand the codebase good enough, to why 
> Pgm.GetLocalEnvVars does not
> include the env var to KIPRJMOD, I guess there is a reason?
> 
> 
> On 2018-04-06 13:05, Jeff Young wrote:
>> Patch looks good to me, although I’d rather see the redundant code removed.
>> 
>> 
>>> On 6 Apr 2018, at 11:30, kristoffer Ödmark  
>>> wrote:
>>> 
>>> <0001-Footprint-Wizard-now-also-handles-custom-Env-paths.patch>
> 
> <0001-Footprint-Wizard-now-also-handles-custom-Env-paths.patch>


___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] New Footprint libs and wizard issues

2018-04-06 Thread kristoffer Ödmark
Turns out the redundant code was not very redundant. There would have to 
be some more refactoring of the code to

get this all using the NormalizePath command in common/env_paths.cpp

I am also uncertain, since I dont understand the codebase good enough, 
to why Pgm.GetLocalEnvVars does not

include the env var to KIPRJMOD, I guess there is a reason?


On 2018-04-06 13:05, Jeff Young wrote:

Patch looks good to me, although I’d rather see the redundant code removed.



On 6 Apr 2018, at 11:30, kristoffer Ödmark  wrote:

<0001-Footprint-Wizard-now-also-handles-custom-Env-paths.patch>


>From 561524c7e84d0fc3f0dca70057505e0f84d5147d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kristoffer=20=C3=96dmark?= 
Date: Fri, 6 Apr 2018 12:06:05 +0200
Subject: [PATCH] Footprint Wizard now also handles custom Env paths

---
 common/env_paths.cpp| 17 +
 include/env_paths.h | 16 ++--
 pcbnew/dialogs/wizard_add_fplib.cpp | 19 +++
 3 files changed, 38 insertions(+), 14 deletions(-)

diff --git a/common/env_paths.cpp b/common/env_paths.cpp
index 3569c436d..9e6a6715c 100644
--- a/common/env_paths.cpp
+++ b/common/env_paths.cpp
@@ -64,9 +64,8 @@ static bool normalizeAbsolutePaths( const wxFileName& aPathA,
 return true;
 }
 
-
 wxString NormalizePath( const wxFileName& aFilePath, const ENV_VAR_MAP* aEnvVars,
-const PROJECT* aProject )
+const wxString& aProjectPath )
 {
 wxFileName envPath;
 wxString tmp, varName, normalizedFullPath;
@@ -90,9 +89,10 @@ wxString NormalizePath( const wxFileName& aFilePath, const ENV_VAR_MAP* aEnvVars
 }
 }
 
-if( varName.IsEmpty() && aProject )
+if( varName.IsEmpty() && !aProjectPath.IsEmpty()
+&& wxFileName( aProjectPath ).IsAbsolute() && wxFileName( aFilePath ).IsAbsolute() )
 {
-envPath.SetPath( aProject->GetProjectPath() );
+envPath.SetPath( aProjectPath );
 
 if( normalizeAbsolutePaths( envPath, aFilePath, &tmp ) )
 varName = PROJECT_VAR_NAME;
@@ -111,6 +111,15 @@ wxString NormalizePath( const wxFileName& aFilePath, const ENV_VAR_MAP* aEnvVars
 return normalizedFullPath;
 }
 
+wxString NormalizePath( const wxFileName& aFilePath, const ENV_VAR_MAP* aEnvVars,
+const PROJECT* aProject )
+{
+  if( aProject )
+return NormalizePath( aFilePath, aEnvVars, aProject->GetProjectPath() );
+  else
+return NormalizePath( aFilePath, aEnvVars, "" );
+}
+
 
 // Create file path by appending path and file name. This approach allows the filename
 // to contain a relative path, whereas wxFileName::SetPath() would replace the
diff --git a/include/env_paths.h b/include/env_paths.h
index bac92ffca..a27fbcc7c 100644
--- a/include/env_paths.h
+++ b/include/env_paths.h
@@ -39,6 +39,18 @@
 wxString NormalizePath( const wxFileName& aFilePath, const ENV_VAR_MAP* aEnvVars,
 const PROJECT* aProject );
 
+/**
+ * Normalizes a file path to an environmental variable, if possible.
+ *
+ * @param aFilePath is the full file path (path and file name) to be normalized.
+ * @param aEnvVars is an optional map of environmental variables to try substition with.
+ * @param aProjectPath is an optional string to normalize the file path to the project path.
+ * @return Normalized full file path (path and file name) if succeeded or empty string if the
+ *  path could not be normalized.
+ */
+wxString NormalizePath(
+const wxFileName& aFilePath, const ENV_VAR_MAP* aEnvVars, const wxString& aProjectPath );
+
 /**
  * Searches the default paths trying to find one with the requested file.
  *
@@ -48,7 +60,7 @@ wxString NormalizePath( const wxFileName& aFilePath, const ENV_VAR_MAP* aEnvVars
  * @return Full path (apth and file name) if the file was found in one of the paths, otherwise
  *  an empty string.
 */
-wxString ResolveFile( const wxString& aFileName, const ENV_VAR_MAP* aEnvVars,
-const PROJECT* aProject );
+wxString ResolveFile(
+const wxString& aFileName, const ENV_VAR_MAP* aEnvVars, const PROJECT* aProject );
 
 #endif /* ENV_PATHS_H */
diff --git a/pcbnew/dialogs/wizard_add_fplib.cpp b/pcbnew/dialogs/wizard_add_fplib.cpp
index 193253cb3..b34822f0f 100644
--- a/pcbnew/dialogs/wizard_add_fplib.cpp
+++ b/pcbnew/dialogs/wizard_add_fplib.cpp
@@ -46,6 +46,7 @@
 #include 
 
 #include 
+#include 
 
 #ifdef BUILD_GITHUB_PLUGIN
 #include <../github/github_getliblist.h>
@@ -222,17 +223,14 @@ wxString WIZARD_FPLIB_TABLE::LIBRARY::GetRelativePath( const wxString& aBase, co
 
 wxString WIZARD_FPLIB_TABLE::LIBRARY::GetAutoPath( LIB_SCOPE aScope ) const
 {
-const wxString& global_env = FP_LIB_TABLE::GlobalPathEnvVariableName();
 const wxString& project_env = PROJECT_VAR_NAME;
 const wxString& github_env( "KIGITHUB" );
 
 wxString rel_path;
 
-// KISYSMOD check
-rel_path = replaceEnv( global_env );
-
-if( !rel_path.IsEmpty() )
-return rel_path;
+// The extra KIGITHUB and KIPRJCHEC

Re: [Kicad-developers] New Footprint libs and wizard issues

2018-04-06 Thread kristoffer Ödmark
Found a bug shortly after, I will reupload. I will also remove the 
redundant code and check if it still works.



On 2018-04-06 13:05, Jeff Young wrote:

Patch looks good to me, although I’d rather see the redundant code removed.



On 6 Apr 2018, at 11:30, kristoffer Ödmark  wrote:

<0001-Footprint-Wizard-now-also-handles-custom-Env-paths.patch>



___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] New Footprint libs and wizard issues

2018-04-06 Thread Jeff Young
Patch looks good to me, although I’d rather see the redundant code removed.


> On 6 Apr 2018, at 11:30, kristoffer Ödmark  
> wrote:
> 
> <0001-Footprint-Wizard-now-also-handles-custom-Env-paths.patch>


___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] New Footprint libs and wizard issues

2018-04-06 Thread kristoffer Ödmark
Attached is a patch that adds support for custom environment paths. 
Previously the wizard would only accept KISYSMOD, KIPRJMOD and the 
github one.


left some legacy handling in the GetAutoPath, as to not break anything, 
I can remove it if wanted.



- Kristoffer


On 2018-04-04 11:02, jp charras wrote:

Le 04/04/2018 à 10:01, kristoffer Ödmark a écrit :

Hello!

So it was a while since I made some noise, so its time again.

Is there a way to create new footprint libs from KiCad? I cannot find it,
right now I create them by mkdir name.pretty, thento be able to add them
with the wizard, I have to create a temp.kicad_mod file in that folder.

Should this be considered a bug, and if so, would it go into v5? I would
like to be able to add/create empty libs, and then populate them all from within
kicad.

In footprint library, the third tool.
(Tooltip: Create new lib and save current footprint)


I also noticed that the wizard does not autoreplace the paths with the 
configured
paths in kicad the same way that the symbol library editor does. Should this 
also
be considered a bug and would a fix be accepted in v5?

- Kristoffer

It works for me.




>From 419f409524fe2ab95fcee5eefc7404cbefda1ab7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kristoffer=20=C3=96dmark?= 
Date: Fri, 6 Apr 2018 12:06:05 +0200
Subject: [PATCH] Footprint Wizard now also handles custom Env paths

---
 common/env_paths.cpp| 16 
 include/env_paths.h | 16 ++--
 pcbnew/dialogs/wizard_add_fplib.cpp | 10 --
 3 files changed, 34 insertions(+), 8 deletions(-)

diff --git a/common/env_paths.cpp b/common/env_paths.cpp
index 3569c436d..ae3d08b1e 100644
--- a/common/env_paths.cpp
+++ b/common/env_paths.cpp
@@ -64,9 +64,8 @@ static bool normalizeAbsolutePaths( const wxFileName& aPathA,
 return true;
 }
 
-
 wxString NormalizePath( const wxFileName& aFilePath, const ENV_VAR_MAP* aEnvVars,
-const PROJECT* aProject )
+const wxString& aProjectPath )
 {
 wxFileName envPath;
 wxString tmp, varName, normalizedFullPath;
@@ -90,9 +89,9 @@ wxString NormalizePath( const wxFileName& aFilePath, const ENV_VAR_MAP* aEnvVars
 }
 }
 
-if( varName.IsEmpty() && aProject )
+if( varName.IsEmpty() && !aProjectPath.IsEmpty() )
 {
-envPath.SetPath( aProject->GetProjectPath() );
+envPath.SetPath( aProjectPath );
 
 if( normalizeAbsolutePaths( envPath, aFilePath, &tmp ) )
 varName = PROJECT_VAR_NAME;
@@ -111,6 +110,15 @@ wxString NormalizePath( const wxFileName& aFilePath, const ENV_VAR_MAP* aEnvVars
 return normalizedFullPath;
 }
 
+wxString NormalizePath( const wxFileName& aFilePath, const ENV_VAR_MAP* aEnvVars,
+const PROJECT* aProject )
+{
+  if( aProject )
+return NormalizePath( aFilePath, aEnvVars, aProject->GetProjectPath() );
+  else
+return NormalizePath( aFilePath, aEnvVars, "" );
+}
+
 
 // Create file path by appending path and file name. This approach allows the filename
 // to contain a relative path, whereas wxFileName::SetPath() would replace the
diff --git a/include/env_paths.h b/include/env_paths.h
index bac92ffca..a27fbcc7c 100644
--- a/include/env_paths.h
+++ b/include/env_paths.h
@@ -39,6 +39,18 @@
 wxString NormalizePath( const wxFileName& aFilePath, const ENV_VAR_MAP* aEnvVars,
 const PROJECT* aProject );
 
+/**
+ * Normalizes a file path to an environmental variable, if possible.
+ *
+ * @param aFilePath is the full file path (path and file name) to be normalized.
+ * @param aEnvVars is an optional map of environmental variables to try substition with.
+ * @param aProjectPath is an optional string to normalize the file path to the project path.
+ * @return Normalized full file path (path and file name) if succeeded or empty string if the
+ *  path could not be normalized.
+ */
+wxString NormalizePath(
+const wxFileName& aFilePath, const ENV_VAR_MAP* aEnvVars, const wxString& aProjectPath );
+
 /**
  * Searches the default paths trying to find one with the requested file.
  *
@@ -48,7 +60,7 @@ wxString NormalizePath( const wxFileName& aFilePath, const ENV_VAR_MAP* aEnvVars
  * @return Full path (apth and file name) if the file was found in one of the paths, otherwise
  *  an empty string.
 */
-wxString ResolveFile( const wxString& aFileName, const ENV_VAR_MAP* aEnvVars,
-const PROJECT* aProject );
+wxString ResolveFile(
+const wxString& aFileName, const ENV_VAR_MAP* aEnvVars, const PROJECT* aProject );
 
 #endif /* ENV_PATHS_H */
diff --git a/pcbnew/dialogs/wizard_add_fplib.cpp b/pcbnew/dialogs/wizard_add_fplib.cpp
index 193253cb3..838222402 100644
--- a/pcbnew/dialogs/wizard_add_fplib.cpp
+++ b/pcbnew/dialogs/wizard_add_fplib.cpp
@@ -46,6 +46,7 @@
 #include 
 
 #include 
+#include 
 
 #ifdef BUILD_GITHUB_PLUGIN
 #include <../github/github_getliblist.h>
@@ -249,8 +250,13 @@ wxString WIZARD_FPLIB_TABLE::LIBRARY::GetAutoPath( LIB_SCOPE aScop

Re: [Kicad-developers] New Footprint libs and wizard issues

2018-04-04 Thread kristoffer Ödmark
Ah, I was using it wrong. I was looking for someway to start a new lib, 
not realising
I need to start a new footprint and then start a new lib from that. 
Thanks and sorry
for that. Although, would be nice to be able to start a new footprint in 
a new lib directly
when opening the footprint editor, I will add that as a wishlist, i 
noticed some of my friends

did the same when trying to create a new lib.

The other part doesnt work for me though. I have set a path called 
SHARED that
points to "/home/krille/projects/kicad_libs". I then use the wizard to 
add the lib located at

"/home/krille/projects/kicad_libs/footprints/antennas.pretty".

expected outcome is that the library path will become 
"${SHARED}/footprints/antennas.pretty"


outcome is that the library path become 
"/home/krille/projects/kicad_libs/footprints/antennas.pretty"



- Kristoffer

On 2018-04-04 11:02, jp charras wrote:

Le 04/04/2018 à 10:01, kristoffer Ödmark a écrit :

Hello!

So it was a while since I made some noise, so its time again.

Is there a way to create new footprint libs from KiCad? I cannot find it,
right now I create them by mkdir name.pretty, thento be able to add them
with the wizard, I have to create a temp.kicad_mod file in that folder.

Should this be considered a bug, and if so, would it go into v5? I would
like to be able to add/create empty libs, and then populate them all from within
kicad.

In footprint library, the third tool.
(Tooltip: Create new lib and save current footprint)


I also noticed that the wizard does not autoreplace the paths with the 
configured
paths in kicad the same way that the symbol library editor does. Should this 
also
be considered a bug and would a fix be accepted in v5?

- Kristoffer

It works for me.





___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] New Footprint libs and wizard issues

2018-04-04 Thread jp charras
Le 04/04/2018 à 10:01, kristoffer Ödmark a écrit :
> Hello!
> 
> So it was a while since I made some noise, so its time again.
> 
> Is there a way to create new footprint libs from KiCad? I cannot find it,
> right now I create them by mkdir name.pretty, thento be able to add them
> with the wizard, I have to create a temp.kicad_mod file in that folder.
> 
> Should this be considered a bug, and if so, would it go into v5? I would
> like to be able to add/create empty libs, and then populate them all from 
> within
> kicad.

In footprint library, the third tool.
(Tooltip: Create new lib and save current footprint)

> 
> I also noticed that the wizard does not autoreplace the paths with the 
> configured
> paths in kicad the same way that the symbol library editor does. Should this 
> also
> be considered a bug and would a fix be accepted in v5?
> 
> - Kristoffer

It works for me.


-- 
Jean-Pierre CHARRAS

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] New Footprint libs and wizard issues

2018-04-04 Thread kristoffer Ödmark

Hello!

So it was a while since I made some noise, so its time again.

Is there a way to create new footprint libs from KiCad? I cannot find it,
right now I create them by mkdir name.pretty, thento be able to add them
with the wizard, I have to create a temp.kicad_mod file in that folder.

Should this be considered a bug, and if so, would it go into v5? I would
like to be able to add/create empty libs, and then populate them all 
from within

kicad.

I also noticed that the wizard does not autoreplace the paths with the 
configured
paths in kicad the same way that the symbol library editor does. Should 
this also

be considered a bug and would a fix be accepted in v5?

- Kristoffer

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp