Improvement for label edit dialog in eeschema:

- Added wxTE_RICH property to label text controls (allows ctrl+backspace in Windows)
- Added numeric validator to text size
This commit is contained in:
Oliver 2017-03-08 00:32:34 +11:00 committed by Wayne Stambaugh
parent 2f730cad81
commit fdb53f28e6
4 changed files with 18 additions and 6 deletions

View File

@ -30,6 +30,7 @@
#include <fctsys.h>
#include <wx/valgen.h>
#include <wx/valnum.h>
#include <schframe.h>
#include <base_units.h>
@ -110,6 +111,17 @@ DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR( SCH_EDIT_FRAME* aParent, SCH_TEXT* aTe
m_CurrentText = aTextItem;
InitDialog();
// Conservative limits 0.01 to 10.0 inches
int minSize = 10 * IU_PER_MILS;
int maxSize = 10 * 1000 * IU_PER_MILS;
wxFloatingPointValidator<double> textSizeValidator( NULL, wxNUM_VAL_NO_TRAILING_ZEROES );
textSizeValidator.SetPrecision( 4 );
textSizeValidator.SetRange( To_User_Unit( g_UserUnit, minSize ),
To_User_Unit( g_UserUnit, maxSize ) );
m_TextSize->SetValidator( textSizeValidator );
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
}

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Feb 26 2016)
// C++ code generated with wxFormBuilder (version Jun 17 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -31,12 +31,12 @@ DIALOG_LABEL_EDITOR_BASE::DIALOG_LABEL_EDITOR_BASE( wxWindow* parent, wxWindowID
wxBoxSizer* bSizeText;
bSizeText = new wxBoxSizer( wxVERTICAL );
m_textLabelSingleLine = new wxTextCtrl( this, wxID_VALUESINGLE, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
m_textLabelSingleLine = new wxTextCtrl( this, wxID_VALUESINGLE, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER|wxTE_RICH );
m_textLabelSingleLine->SetValidator( wxTextValidator( wxFILTER_EXCLUDE_CHAR_LIST, &m_labelText ) );
bSizeText->Add( m_textLabelSingleLine, 0, wxEXPAND|wxLEFT, 3 );
m_textLabelMultiLine = new wxTextCtrl( this, wxID_VALUEMULTI, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
m_textLabelMultiLine = new wxTextCtrl( this, wxID_VALUEMULTI, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_RICH );
m_textLabelMultiLine->SetMinSize( wxSize( -1,60 ) );
bSizeText->Add( m_textLabelMultiLine, 1, wxEXPAND|wxLEFT, 3 );

View File

@ -251,7 +251,7 @@
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxTE_PROCESS_ENTER</property>
<property name="style">wxTE_PROCESS_ENTER|wxTE_RICH</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
@ -342,7 +342,7 @@
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxTE_MULTILINE</property>
<property name="style">wxTE_MULTILINE|wxTE_RICH</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Feb 26 2016)
// C++ code generated with wxFormBuilder (version Jun 17 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!