Change track width setting to dropbox
This commit is contained in:
parent
ee43728b18
commit
ffeba9de93
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/textentry.h>
|
||||
#include <limits>
|
||||
#include <base_units.h>
|
||||
#include <wx/valnum.h>
|
||||
|
@ -33,9 +33,9 @@
|
|||
|
||||
#include "wx_unit_binder.h"
|
||||
|
||||
WX_UNIT_BINDER::WX_UNIT_BINDER( wxWindow* aParent, wxTextCtrl* aTextInput,
|
||||
WX_UNIT_BINDER::WX_UNIT_BINDER( wxWindow* aParent, wxTextEntry* aTextInput,
|
||||
wxStaticText* aUnitLabel, wxSpinButton* aSpinButton ) :
|
||||
m_textCtrl( aTextInput ),
|
||||
m_textEntry( aTextInput ),
|
||||
m_unitLabel( aUnitLabel ),
|
||||
m_units( g_UserUnit ),
|
||||
m_step( 1 ),
|
||||
|
@ -43,7 +43,7 @@ WX_UNIT_BINDER::WX_UNIT_BINDER( wxWindow* aParent, wxTextCtrl* aTextInput,
|
|||
m_max( 1 )
|
||||
{
|
||||
// Use the currently selected units
|
||||
m_textCtrl->SetValue( wxT( "0" ) );
|
||||
m_textEntry->SetValue( wxT( "0" ) );
|
||||
m_unitLabel->SetLabel( GetAbbreviatedUnitsLabel( m_units ) );
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ void WX_UNIT_BINDER::SetValue( int aValue )
|
|||
{
|
||||
wxString s = StringFromValue( m_units, aValue, false );
|
||||
|
||||
m_textCtrl->SetValue( s );
|
||||
m_textEntry->SetValue( s );
|
||||
|
||||
m_unitLabel->SetLabel( GetAbbreviatedUnitsLabel( m_units ) );
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ void WX_UNIT_BINDER::SetValue( int aValue )
|
|||
|
||||
int WX_UNIT_BINDER::GetValue() const
|
||||
{
|
||||
wxString s = m_textCtrl->GetValue();
|
||||
wxString s = m_textEntry->GetValue();
|
||||
|
||||
return ValueFromString( m_units, s );
|
||||
}
|
||||
|
@ -75,12 +75,14 @@ bool WX_UNIT_BINDER::Valid() const
|
|||
{
|
||||
double dummy;
|
||||
|
||||
return m_textCtrl->GetValue().ToDouble( &dummy );
|
||||
return m_textEntry->GetValue().ToDouble( &dummy );
|
||||
}
|
||||
|
||||
|
||||
void WX_UNIT_BINDER::Enable( bool aEnable )
|
||||
{
|
||||
m_textCtrl->Enable( aEnable );
|
||||
wxWindow* wxWin = dynamic_cast<wxWindow*> ( m_textEntry );
|
||||
wxWin->Enable( aEnable );
|
||||
m_unitLabel->Enable( aEnable );
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include <common.h>
|
||||
#include <wx/spinbutt.h>
|
||||
|
||||
class wxTextCtrl;
|
||||
class wxTextEntry;
|
||||
class wxSpinButton;
|
||||
class wxStaticText;
|
||||
|
||||
|
@ -39,11 +39,11 @@ public:
|
|||
/**
|
||||
* Constructor.
|
||||
* @param aParent is the parent window.
|
||||
* @param aTextInput is the text input widget used to edit the given value.
|
||||
* @param aTextInput is the text input widget used to edit the given value (wxTextCtrl, wxComboBox, ...).
|
||||
* @param aUnitLabel is the units label displayed next to the text field.
|
||||
* @param aSpinButton is an optional spin button (for adjusting the input value)
|
||||
*/
|
||||
WX_UNIT_BINDER( wxWindow* aParent, wxTextCtrl* aTextInput, wxStaticText* aUnitLabel, wxSpinButton* aSpinButton = NULL );
|
||||
WX_UNIT_BINDER( wxWindow* aParent, wxTextEntry* aTextInput, wxStaticText* aUnitLabel, wxSpinButton* aSpinButton = NULL );
|
||||
|
||||
virtual ~WX_UNIT_BINDER();
|
||||
|
||||
|
@ -77,7 +77,7 @@ protected:
|
|||
void onTextChanged( wxEvent& aEvent );
|
||||
|
||||
///> Text input control.
|
||||
wxTextCtrl* m_textCtrl;
|
||||
wxTextEntry* m_textEntry;
|
||||
|
||||
///> Label showing currently used units.
|
||||
wxStaticText* m_unitLabel;
|
||||
|
|
|
@ -204,6 +204,13 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen
|
|||
setCommonVal( trackEndY, m_TrackEndYCtrl, m_trackEndY );
|
||||
setCommonVal( trackWidth, m_TrackWidthCtrl, m_trackWidth );
|
||||
|
||||
for( unsigned ii = 0; ii < aParent->GetDesignSettings().m_TrackWidthList.size(); ii++ )
|
||||
{
|
||||
int width = aParent->GetDesignSettings().m_TrackWidthList[ii];
|
||||
wxString msg = StringFromValue( g_UserUnit, width, false );
|
||||
m_TrackWidthCtrl->Append( msg );
|
||||
}
|
||||
|
||||
m_TrackLayerCtrl->SetLayersHotkeys( false );
|
||||
m_TrackLayerCtrl->SetLayerSet( LSET::AllNonCuMask() );
|
||||
m_TrackLayerCtrl->SetBoardFrame( aParent );
|
||||
|
|
|
@ -59,14 +59,14 @@ private:
|
|||
///> Checks if the dialog values are correct.
|
||||
bool check() const;
|
||||
|
||||
///> Sets wxTextCtrl to the value stored in boost::optional<T> or "<...>" if it is not available.
|
||||
///> Sets wxTextEntry to the value stored in boost::optional<T> or "<...>" if it is not available.
|
||||
template<typename T>
|
||||
void setCommonVal( const boost::optional<T>& aVal, wxTextCtrl* aTxtCtrl, WX_UNIT_BINDER& aBinder )
|
||||
void setCommonVal( const boost::optional<T>& aVal, wxTextEntry* aTxtEntry, WX_UNIT_BINDER& aBinder )
|
||||
{
|
||||
if( aVal )
|
||||
aBinder.SetValue( *aVal );
|
||||
else
|
||||
aTxtCtrl->SetValue( "<...>" );
|
||||
aTxtEntry->SetValue( "<...>" );
|
||||
}
|
||||
|
||||
///> Selected items to be modified.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Jun 17 2015)
|
||||
// C++ code generated with wxFormBuilder (version Aug 20 2017)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
|
@ -65,7 +65,6 @@ DIALOG_TRACK_VIA_PROPERTIES_BASE::DIALOG_TRACK_VIA_PROPERTIES_BASE( wxWindow* pa
|
|||
fgTrackLeftGridSizer->Add( m_TrackStartXLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 );
|
||||
|
||||
m_TrackStartXCtrl = new wxTextCtrl( m_sbTrackSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_TrackStartXCtrl->SetMaxLength( 0 );
|
||||
fgTrackLeftGridSizer->Add( m_TrackStartXCtrl, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
|
||||
|
||||
m_TrackStartXUnit = new wxStaticText( m_sbTrackSizer->GetStaticBox(), wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
|
@ -77,7 +76,6 @@ DIALOG_TRACK_VIA_PROPERTIES_BASE::DIALOG_TRACK_VIA_PROPERTIES_BASE( wxWindow* pa
|
|||
fgTrackLeftGridSizer->Add( m_TrackStartYLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 );
|
||||
|
||||
m_TrackStartYCtrl = new wxTextCtrl( m_sbTrackSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_TrackStartYCtrl->SetMaxLength( 0 );
|
||||
fgTrackLeftGridSizer->Add( m_TrackStartYCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
|
||||
|
||||
m_TrackStartYUnit = new wxStaticText( m_sbTrackSizer->GetStaticBox(), wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
|
@ -89,7 +87,6 @@ DIALOG_TRACK_VIA_PROPERTIES_BASE::DIALOG_TRACK_VIA_PROPERTIES_BASE( wxWindow* pa
|
|||
fgTrackLeftGridSizer->Add( m_TrackEndXLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 );
|
||||
|
||||
m_TrackEndXCtrl = new wxTextCtrl( m_sbTrackSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_TrackEndXCtrl->SetMaxLength( 0 );
|
||||
fgTrackLeftGridSizer->Add( m_TrackEndXCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
|
||||
|
||||
m_TrackEndXUnit = new wxStaticText( m_sbTrackSizer->GetStaticBox(), wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
|
@ -101,7 +98,6 @@ DIALOG_TRACK_VIA_PROPERTIES_BASE::DIALOG_TRACK_VIA_PROPERTIES_BASE( wxWindow* pa
|
|||
fgTrackLeftGridSizer->Add( m_TrackEndYLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 );
|
||||
|
||||
m_TrackEndYCtrl = new wxTextCtrl( m_sbTrackSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_TrackEndYCtrl->SetMaxLength( 0 );
|
||||
fgTrackLeftGridSizer->Add( m_TrackEndYCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
|
||||
|
||||
m_TrackEndYUnit = new wxStaticText( m_sbTrackSizer->GetStaticBox(), wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
|
@ -123,8 +119,7 @@ DIALOG_TRACK_VIA_PROPERTIES_BASE::DIALOG_TRACK_VIA_PROPERTIES_BASE( wxWindow* pa
|
|||
m_TrackWidthLabel->Wrap( -1 );
|
||||
fgTrackRightSizer->Add( m_TrackWidthLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
m_TrackWidthCtrl = new wxTextCtrl( m_sbTrackSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_TrackWidthCtrl->SetMaxLength( 0 );
|
||||
m_TrackWidthCtrl = new wxComboBox( m_sbTrackSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
|
||||
fgTrackRightSizer->Add( m_TrackWidthCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
|
||||
|
||||
m_TrackWidthUnit = new wxStaticText( m_sbTrackSizer->GetStaticBox(), wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
|
@ -168,7 +163,6 @@ DIALOG_TRACK_VIA_PROPERTIES_BASE::DIALOG_TRACK_VIA_PROPERTIES_BASE( wxWindow* pa
|
|||
fgViaLeftSizer->Add( m_ViaXLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 );
|
||||
|
||||
m_ViaXCtrl = new wxTextCtrl( m_sbViaSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_ViaXCtrl->SetMaxLength( 0 );
|
||||
fgViaLeftSizer->Add( m_ViaXCtrl, 0, wxEXPAND, 5 );
|
||||
|
||||
m_ViaXUnit = new wxStaticText( m_sbViaSizer->GetStaticBox(), wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
|
@ -180,7 +174,6 @@ DIALOG_TRACK_VIA_PROPERTIES_BASE::DIALOG_TRACK_VIA_PROPERTIES_BASE( wxWindow* pa
|
|||
fgViaLeftSizer->Add( m_ViaYLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 );
|
||||
|
||||
m_ViaYCtrl = new wxTextCtrl( m_sbViaSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_ViaYCtrl->SetMaxLength( 0 );
|
||||
fgViaLeftSizer->Add( m_ViaYCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
|
||||
|
||||
m_ViaYUnit = new wxStaticText( m_sbViaSizer->GetStaticBox(), wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
|
@ -203,7 +196,6 @@ DIALOG_TRACK_VIA_PROPERTIES_BASE::DIALOG_TRACK_VIA_PROPERTIES_BASE( wxWindow* pa
|
|||
fgViaRightSizer->Add( m_ViaDiameterLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 );
|
||||
|
||||
m_ViaDiameterCtrl = new wxTextCtrl( m_sbViaSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_ViaDiameterCtrl->SetMaxLength( 0 );
|
||||
fgViaRightSizer->Add( m_ViaDiameterCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
|
||||
|
||||
m_ViaDiameterUnit = new wxStaticText( m_sbViaSizer->GetStaticBox(), wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
|
@ -215,7 +207,6 @@ DIALOG_TRACK_VIA_PROPERTIES_BASE::DIALOG_TRACK_VIA_PROPERTIES_BASE( wxWindow* pa
|
|||
fgViaRightSizer->Add( m_ViaDrillLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 );
|
||||
|
||||
m_ViaDrillCtrl = new wxTextCtrl( m_sbViaSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_ViaDrillCtrl->SetMaxLength( 0 );
|
||||
fgViaRightSizer->Add( m_ViaDrillCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
|
||||
|
||||
m_ViaDrillUnit = new wxStaticText( m_sbViaSizer->GetStaticBox(), wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
|
|
|
@ -1728,7 +1728,7 @@
|
|||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxTextCtrl" expanded="0">
|
||||
<object class="wxComboBox" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
|
@ -1742,6 +1742,7 @@
|
|||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="choices"></property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
|
@ -1759,7 +1760,6 @@
|
|||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="maxlength">0</property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
|
@ -1772,6 +1772,7 @@
|
|||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="selection">-1</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
|
@ -1787,6 +1788,7 @@
|
|||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCombobox"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
|
@ -1810,8 +1812,6 @@
|
|||
<event name="OnSize"></event>
|
||||
<event name="OnText"></event>
|
||||
<event name="OnTextEnter"></event>
|
||||
<event name="OnTextMaxLen"></event>
|
||||
<event name="OnTextURL"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Jun 17 2015)
|
||||
// C++ code generated with wxFormBuilder (version Aug 20 2017)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
|
@ -65,7 +65,7 @@ class DIALOG_TRACK_VIA_PROPERTIES_BASE : public DIALOG_SHIM
|
|||
wxStaticText* m_TrackEndYUnit;
|
||||
wxStaticLine* m_trackStaticLine;
|
||||
wxStaticText* m_TrackWidthLabel;
|
||||
wxTextCtrl* m_TrackWidthCtrl;
|
||||
wxComboBox* m_TrackWidthCtrl;
|
||||
wxStaticText* m_TrackWidthUnit;
|
||||
wxCheckBox* m_trackNetclass;
|
||||
wxStaticText* m_TrackLayerLabel;
|
||||
|
|
Loading…
Reference in New Issue