Connect thickness to unit binder

This commit is contained in:
Marek Roszko 2020-12-08 22:38:40 -05:00
parent 6d678f4780
commit bf7daac975
5 changed files with 73 additions and 5 deletions

View File

@ -56,7 +56,8 @@ PROPERTIES_FRAME::PROPERTIES_FRAME( PL_EDITOR_FRAME* aParent ) :
m_textCtrlLeftMarginBinder( aParent, m_staticTextLeftMargin, m_textCtrlLeftMargin, m_TextLeftMarginUnits ), m_textCtrlLeftMarginBinder( aParent, m_staticTextLeftMargin, m_textCtrlLeftMargin, m_TextLeftMarginUnits ),
m_textCtrlRightMarginBinder( aParent, m_staticTextDefRightMargin, m_textCtrlRightMargin, m_TextRightMarginUnits ), m_textCtrlRightMarginBinder( aParent, m_staticTextDefRightMargin, m_textCtrlRightMargin, m_TextRightMarginUnits ),
m_textCtrlTopMarginBinder( aParent, m_staticTextTopMargin, m_textCtrlTopMargin, m_TextTopMarginUnits ), m_textCtrlTopMarginBinder( aParent, m_staticTextTopMargin, m_textCtrlTopMargin, m_TextTopMarginUnits ),
m_textCtrlBottomMarginBinder( aParent, m_staticTextBottomMargin, m_textCtrlBottomMargin, m_TextBottomMarginUnits ) m_textCtrlBottomMarginBinder( aParent, m_staticTextBottomMargin, m_textCtrlBottomMargin, m_TextBottomMarginUnits ),
m_textCtrlThicknessBinder( aParent, m_staticTextThickness, m_textCtrlThickness, m_TextLineThicknessUnits )
{ {
m_parent = aParent; m_parent = aParent;
@ -208,8 +209,8 @@ void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( WS_DATA_ITEM* aItem )
case LT_CORNER: m_comboBoxCornerEnd->SetSelection( 1 ); break; case LT_CORNER: m_comboBoxCornerEnd->SetSelection( 1 ); break;
} }
msg.Printf( wxT("%.3f"), aItem->m_LineWidth ); m_textCtrlThicknessBinder.SetDoubleValue(
m_textCtrlThickness->SetValue( msg ); From_User_Unit( EDA_UNITS::MILLIMETRES, aItem->m_LineWidth ) );
// Now, set prms more specific to WS_DATA_ITEM types // Now, set prms more specific to WS_DATA_ITEM types
// For a given type, disable widgets which are not relevant, // For a given type, disable widgets which are not relevant,
@ -388,8 +389,7 @@ bool PROPERTIES_FRAME::CopyPrmsFromPanelToItem( WS_DATA_ITEM* aItem )
} }
// Import thickness // Import thickness
msg = m_textCtrlThickness->GetValue(); aItem->m_LineWidth = To_User_Unit( EDA_UNITS::MILLIMETRES, m_textCtrlThicknessBinder.GetValue() );
aItem->m_LineWidth = DoubleValueFromString( EDA_UNITS::UNSCALED, msg );
// Import Start point // Import Start point
aItem->m_Pos.m_Pos.x = To_User_Unit( EDA_UNITS::MILLIMETRES, m_textCtrlPosXBinder.GetValue() ); aItem->m_Pos.m_Pos.x = To_User_Unit( EDA_UNITS::MILLIMETRES, m_textCtrlPosXBinder.GetValue() );

View File

@ -72,6 +72,8 @@ class PROPERTIES_FRAME : public PANEL_PROPERTIES_BASE
UNIT_BINDER m_textCtrlTopMarginBinder; UNIT_BINDER m_textCtrlTopMarginBinder;
UNIT_BINDER m_textCtrlBottomMarginBinder; UNIT_BINDER m_textCtrlBottomMarginBinder;
UNIT_BINDER m_textCtrlThicknessBinder;
public: public:
PROPERTIES_FRAME( PL_EDITOR_FRAME* aParent ); PROPERTIES_FRAME( PL_EDITOR_FRAME* aParent );
~PROPERTIES_FRAME(); ~PROPERTIES_FRAME();

View File

@ -347,6 +347,10 @@ PANEL_PROPERTIES_BASE::PANEL_PROPERTIES_BASE( wxWindow* parent, wxWindowID id, c
m_textCtrlThickness = new wxTextCtrl( m_swItemProperties, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_textCtrlThickness = new wxTextCtrl( m_swItemProperties, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_SizerLineThickness->Add( m_textCtrlThickness, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 ); m_SizerLineThickness->Add( m_textCtrlThickness, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
m_TextLineThicknessUnits = new wxStaticText( m_swItemProperties, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
m_TextLineThicknessUnits->Wrap( -1 );
m_SizerLineThickness->Add( m_TextLineThicknessUnits, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxBOTTOM|wxLEFT, 5 );
m_staticTextInfoThickness = new wxStaticText( m_swItemProperties, wxID_ANY, _("Set to 0 for default"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextInfoThickness = new wxStaticText( m_swItemProperties, wxID_ANY, _("Set to 0 for default"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextInfoThickness->Wrap( -1 ); m_staticTextInfoThickness->Wrap( -1 );
m_SizerLineThickness->Add( m_staticTextInfoThickness, 0, wxALIGN_CENTER|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); m_SizerLineThickness->Add( m_staticTextInfoThickness, 0, wxALIGN_CENTER|wxBOTTOM|wxRIGHT|wxLEFT, 5 );

View File

@ -3287,6 +3287,67 @@
<property name="window_style"></property> <property name="window_style"></property>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxBOTTOM|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">mm</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_TextLineThicknessUnits</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALIGN_CENTER|wxBOTTOM|wxRIGHT|wxLEFT</property> <property name="flag">wxALIGN_CENTER|wxBOTTOM|wxRIGHT|wxLEFT</property>

View File

@ -93,6 +93,7 @@ class PANEL_PROPERTIES_BASE : public wxPanel
wxBoxSizer* m_SizerLineThickness; wxBoxSizer* m_SizerLineThickness;
wxStaticText* m_staticTextThickness; wxStaticText* m_staticTextThickness;
wxTextCtrl* m_textCtrlThickness; wxTextCtrl* m_textCtrlThickness;
wxStaticText* m_TextLineThicknessUnits;
wxStaticText* m_staticTextInfoThickness; wxStaticText* m_staticTextInfoThickness;
wxBoxSizer* m_SizerRotation; wxBoxSizer* m_SizerRotation;
wxStaticText* m_staticTextRot; wxStaticText* m_staticTextRot;