← Back to team overview

kicad-developers team mailing list archive

Re: New Footprint libs and wizard issues

 

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?= <kristoffer.odmark90@xxxxxxxxx>
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


Follow ups

References