From 20eca94fcaacf8f02fa19610d87fd5178037d282 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 2 Sep 2022 19:15:40 +0100 Subject: [PATCH] ADDED vertical alignment for text boxes. Fixes https://gitlab.com/kicad/code/kicad/issues/12340 --- .../dialogs/dialog_field_properties_base.cpp | 45 +- .../dialogs/dialog_field_properties_base.fbp | 458 +++++----- .../dialogs/dialog_field_properties_base.h | 15 +- .../dialogs/dialog_lib_textbox_properties.cpp | 153 ++-- .../dialogs/dialog_lib_textbox_properties.h | 6 +- .../dialog_lib_textbox_properties_base.cpp | 107 ++- .../dialog_lib_textbox_properties_base.fbp | 793 ++++++++++++------ .../dialog_lib_textbox_properties_base.h | 21 +- eeschema/dialogs/dialog_text_properties.cpp | 212 +++-- eeschema/dialogs/dialog_text_properties.h | 4 +- .../dialogs/dialog_text_properties_base.cpp | 68 +- .../dialogs/dialog_text_properties_base.fbp | 456 ++++++++-- .../dialogs/dialog_text_properties_base.h | 16 +- eeschema/lib_textbox.cpp | 51 +- eeschema/sch_textbox.cpp | 49 +- 15 files changed, 1626 insertions(+), 828 deletions(-) diff --git a/eeschema/dialogs/dialog_field_properties_base.cpp b/eeschema/dialogs/dialog_field_properties_base.cpp index a47f272a6e..b2b097b68a 100644 --- a/eeschema/dialogs/dialog_field_properties_base.cpp +++ b/eeschema/dialogs/dialog_field_properties_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Oct 26 2018) +// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -46,6 +46,7 @@ DIALOG_FIELD_PROPERTIES_BASE::DIALOG_FIELD_PROPERTIES_BASE( wxWindow* parent, wx m_StyledTextCtrl->SetViewWhiteSpace( false ); m_StyledTextCtrl->SetMarginWidth( 2, 0 ); m_StyledTextCtrl->SetIndentationGuides( false ); + m_StyledTextCtrl->SetReadOnly( false ); m_StyledTextCtrl->SetMarginWidth( 1, 0 ); m_StyledTextCtrl->SetMarginWidth( 0, 0 ); m_StyledTextCtrl->MarkerDefine( wxSTC_MARKNUM_FOLDER, wxSTC_MARK_BOXPLUS ); @@ -113,21 +114,6 @@ DIALOG_FIELD_PROPERTIES_BASE::DIALOG_FIELD_PROPERTIES_BASE( wxWindow* parent, wx formattingSizer->Add( m_separator1, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - m_horizontal = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); - m_horizontal->SetToolTip( _("Horizontal text") ); - - formattingSizer->Add( m_horizontal, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_vertical = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); - m_vertical->SetToolTip( _("Vertical text") ); - - formattingSizer->Add( m_vertical, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_separator2 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); - m_separator2->Enable( false ); - - formattingSizer->Add( m_separator2, 0, wxALIGN_CENTER_VERTICAL, 5 ); - m_bold = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); m_bold->SetToolTip( _("Bold") ); @@ -138,10 +124,10 @@ DIALOG_FIELD_PROPERTIES_BASE::DIALOG_FIELD_PROPERTIES_BASE( wxWindow* parent, wx formattingSizer->Add( m_italic, 0, wxALIGN_CENTER_VERTICAL, 5 ); - m_separator3 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); - m_separator3->Enable( false ); + m_separator2 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); + m_separator2->Enable( false ); - formattingSizer->Add( m_separator3, 0, wxALIGN_CENTER_VERTICAL, 5 ); + formattingSizer->Add( m_separator2, 0, wxALIGN_CENTER_VERTICAL, 5 ); m_hAlignLeft = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); m_hAlignLeft->SetToolTip( _("Align left") ); @@ -158,10 +144,10 @@ DIALOG_FIELD_PROPERTIES_BASE::DIALOG_FIELD_PROPERTIES_BASE( wxWindow* parent, wx formattingSizer->Add( m_hAlignRight, 0, wxALIGN_CENTER_VERTICAL, 5 ); - m_separator4 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); - m_separator4->Enable( false ); + m_separator3 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); + m_separator3->Enable( false ); - formattingSizer->Add( m_separator4, 0, wxALIGN_CENTER_VERTICAL, 5 ); + formattingSizer->Add( m_separator3, 0, wxALIGN_CENTER_VERTICAL, 5 ); m_vAlignTop = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); m_vAlignTop->SetToolTip( _("Align top") ); @@ -178,6 +164,21 @@ DIALOG_FIELD_PROPERTIES_BASE::DIALOG_FIELD_PROPERTIES_BASE( wxWindow* parent, wx formattingSizer->Add( m_vAlignBottom, 0, wxALIGN_CENTER_VERTICAL, 5 ); + m_separator4 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); + m_separator4->Enable( false ); + + formattingSizer->Add( m_separator4, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_horizontal = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); + m_horizontal->SetToolTip( _("Horizontal text") ); + + formattingSizer->Add( m_horizontal, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_vertical = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); + m_vertical->SetToolTip( _("Vertical text") ); + + formattingSizer->Add( m_vertical, 0, wxALIGN_CENTER_VERTICAL, 5 ); + m_separator5 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); m_separator5->Enable( false ); diff --git a/eeschema/dialogs/dialog_field_properties_base.fbp b/eeschema/dialogs/dialog_field_properties_base.fbp index a140efd5d9..d227f5b2a5 100644 --- a/eeschema/dialogs/dialog_field_properties_base.fbp +++ b/eeschema/dialogs/dialog_field_properties_base.fbp @@ -1,6 +1,6 @@ - + C++ @@ -14,6 +14,7 @@ dialog_field_properties_base 1000 none + 1 DIALOG_FIELD_PROPERTIES_BASE @@ -25,6 +26,7 @@ 1 1 UI + 0 1 0 @@ -50,6 +52,7 @@ DIALOG_SHIM; dialog_shim.h Text Item Properties + 0 @@ -262,6 +265,7 @@ protected 1 + 0 Resizable 1 @@ -293,6 +297,7 @@ + 0 @@ -664,6 +669,7 @@ + 0 @@ -736,222 +742,7 @@ - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - Horizontal text - - 0 - - 0 - -1,-1 - - 0 - - 1 - m_horizontal - 1 - - - protected - 1 - - - - Resizable - 1 - 21,21 - wxBORDER_NONE - BITMAP_BUTTON; widgets/bitmap_button.h; forward_declare - 0 - Horizontal text - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - Vertical text - - 0 - - 0 - -1,-1 - - 0 - - 1 - m_vertical - 1 - - - protected - 1 - - - - Resizable - 1 - 21,21 - wxBORDER_NONE - BITMAP_BUTTON; widgets/bitmap_button.h; forward_declare - 0 - Vertical text - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 0 - - 1 - - - 0 - 0 - wxID_ANY - - - 0 - - 0 - -1,-1 - - 0 - - 1 - m_separator2 - 1 - - - protected - 1 - - - - Resizable - 1 - 21,21 - wxBORDER_NONE - BITMAP_BUTTON; widgets/bitmap_button.h; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - + 0 @@ -1024,6 +815,7 @@ + 0 @@ -1096,6 +888,7 @@ + 0 @@ -1130,7 +923,7 @@ 0 1 - m_separator3 + m_separator2 1 @@ -1168,6 +961,7 @@ + 0 @@ -1240,6 +1034,7 @@ + 0 @@ -1312,6 +1107,7 @@ + 0 @@ -1384,6 +1180,7 @@ + 0 @@ -1418,7 +1215,7 @@ 0 1 - m_separator4 + m_separator3 1 @@ -1456,6 +1253,7 @@ + 0 @@ -1528,6 +1326,7 @@ + 0 @@ -1600,6 +1399,7 @@ + 0 @@ -1672,6 +1472,226 @@ + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + + 1 + + + 0 + 0 + wxID_ANY + + + 0 + + 0 + -1,-1 + + 0 + + 1 + m_separator4 + 1 + + + protected + 1 + + + + Resizable + 1 + 21,21 + wxBORDER_NONE + BITMAP_BUTTON; widgets/bitmap_button.h; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + Horizontal text + + 0 + + 0 + -1,-1 + + 0 + + 1 + m_horizontal + 1 + + + protected + 1 + + + + Resizable + 1 + 21,21 + wxBORDER_NONE + BITMAP_BUTTON; widgets/bitmap_button.h; forward_declare + 0 + Horizontal text + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + Vertical text + + 0 + + 0 + -1,-1 + + 0 + + 1 + m_vertical + 1 + + + protected + 1 + + + + Resizable + 1 + 21,21 + wxBORDER_NONE + BITMAP_BUTTON; widgets/bitmap_button.h; forward_declare + 0 + Vertical text + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + 0 diff --git a/eeschema/dialogs/dialog_field_properties_base.h b/eeschema/dialogs/dialog_field_properties_base.h index 813ea85c14..867c6f50ea 100644 --- a/eeschema/dialogs/dialog_field_properties_base.h +++ b/eeschema/dialogs/dialog_field_properties_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Oct 26 2018) +// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -55,19 +55,19 @@ class DIALOG_FIELD_PROPERTIES_BASE : public DIALOG_SHIM wxStaticText* m_fontLabel; FONT_CHOICE* m_fontCtrl; BITMAP_BUTTON* m_separator1; - BITMAP_BUTTON* m_horizontal; - BITMAP_BUTTON* m_vertical; - BITMAP_BUTTON* m_separator2; BITMAP_BUTTON* m_bold; BITMAP_BUTTON* m_italic; - BITMAP_BUTTON* m_separator3; + BITMAP_BUTTON* m_separator2; BITMAP_BUTTON* m_hAlignLeft; BITMAP_BUTTON* m_hAlignCenter; BITMAP_BUTTON* m_hAlignRight; - BITMAP_BUTTON* m_separator4; + BITMAP_BUTTON* m_separator3; BITMAP_BUTTON* m_vAlignTop; BITMAP_BUTTON* m_vAlignCenter; BITMAP_BUTTON* m_vAlignBottom; + BITMAP_BUTTON* m_separator4; + BITMAP_BUTTON* m_horizontal; + BITMAP_BUTTON* m_vertical; BITMAP_BUTTON* m_separator5; wxStaticText* m_textSizeLabel; wxTextCtrl* m_textSizeCtrl; @@ -88,7 +88,7 @@ class DIALOG_FIELD_PROPERTIES_BASE : public DIALOG_SHIM wxButton* m_sdbSizerButtonsOK; wxButton* m_sdbSizerButtonsCancel; - // Virtual event handlers, overide them in your derived class + // Virtual event handlers, override them in your derived class virtual void OnCloseDialog( wxCloseEvent& event ) { event.Skip(); } virtual void OnSetFocusText( wxFocusEvent& event ) { event.Skip(); } virtual void onMultiLineTCLostFocus( wxFocusEvent& event ) { event.Skip(); } @@ -98,6 +98,7 @@ class DIALOG_FIELD_PROPERTIES_BASE : public DIALOG_SHIM public: DIALOG_FIELD_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Text Item Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~DIALOG_FIELD_PROPERTIES_BASE(); }; diff --git a/eeschema/dialogs/dialog_lib_textbox_properties.cpp b/eeschema/dialogs/dialog_lib_textbox_properties.cpp index 114b9230df..a59523bad6 100644 --- a/eeschema/dialogs/dialog_lib_textbox_properties.cpp +++ b/eeschema/dialogs/dialog_lib_textbox_properties.cpp @@ -85,30 +85,41 @@ DIALOG_LIB_TEXTBOX_PROPERTIES::DIALOG_LIB_TEXTBOX_PROPERTIES( SYMBOL_EDIT_FRAME* m_separator2->SetIsSeparator(); - m_spin0->SetIsRadioButton(); - m_spin0->SetBitmap( KiBitmap( BITMAPS::text_align_left ) ); - m_spin1->SetIsRadioButton(); - m_spin1->SetBitmap( KiBitmap( BITMAPS::text_align_center ) ); - m_spin2->SetIsRadioButton(); - m_spin2->SetBitmap( KiBitmap( BITMAPS::text_align_right ) ); - m_spin3->SetIsRadioButton(); - m_spin3->SetBitmap( KiBitmap( BITMAPS::text_align_bottom ) ); - m_spin4->SetIsRadioButton(); - m_spin4->SetBitmap( KiBitmap( BITMAPS::text_align_middle ) ); - m_spin5->SetIsRadioButton(); - m_spin5->SetBitmap( KiBitmap( BITMAPS::text_align_top ) ); - + m_hAlignLeft->SetIsRadioButton(); + m_hAlignLeft->SetBitmap( KiBitmap( BITMAPS::text_align_left ) ); + m_hAlignCenter->SetIsRadioButton(); + m_hAlignCenter->SetBitmap( KiBitmap( BITMAPS::text_align_center ) ); + m_hAlignRight->SetIsRadioButton(); + m_hAlignRight->SetBitmap( KiBitmap( BITMAPS::text_align_right ) ); m_separator3->SetIsSeparator(); + m_vAlignTop->SetIsRadioButton(); + m_vAlignTop->SetBitmap( KiBitmap( BITMAPS::text_valign_top ) ); + m_vAlignCenter->SetIsRadioButton(); + m_vAlignCenter->SetBitmap( KiBitmap( BITMAPS::text_valign_center ) ); + m_vAlignBottom->SetIsRadioButton(); + m_vAlignBottom->SetBitmap( KiBitmap( BITMAPS::text_valign_bottom ) ); + + m_separator4->SetIsSeparator(); + + m_horizontal->SetIsRadioButton(); + m_horizontal->SetBitmap( KiBitmap( BITMAPS::text_horizontal ) ); + m_vertical->SetIsRadioButton(); + m_vertical->SetBitmap( KiBitmap( BITMAPS::text_vertical ) ); + + m_separator5->SetIsSeparator(); + SetupStandardButtons(); Layout(); - m_spin0->Bind( wxEVT_BUTTON, &DIALOG_LIB_TEXTBOX_PROPERTIES::onSpinButton, this ); - m_spin1->Bind( wxEVT_BUTTON, &DIALOG_LIB_TEXTBOX_PROPERTIES::onSpinButton, this ); - m_spin2->Bind( wxEVT_BUTTON, &DIALOG_LIB_TEXTBOX_PROPERTIES::onSpinButton, this ); - m_spin3->Bind( wxEVT_BUTTON, &DIALOG_LIB_TEXTBOX_PROPERTIES::onSpinButton, this ); - m_spin4->Bind( wxEVT_BUTTON, &DIALOG_LIB_TEXTBOX_PROPERTIES::onSpinButton, this ); - m_spin5->Bind( wxEVT_BUTTON, &DIALOG_LIB_TEXTBOX_PROPERTIES::onSpinButton, this ); + m_hAlignLeft->Bind( wxEVT_BUTTON, &DIALOG_LIB_TEXTBOX_PROPERTIES::onHAlignButton, this ); + m_hAlignCenter->Bind( wxEVT_BUTTON, &DIALOG_LIB_TEXTBOX_PROPERTIES::onHAlignButton, this ); + m_hAlignRight->Bind( wxEVT_BUTTON, &DIALOG_LIB_TEXTBOX_PROPERTIES::onHAlignButton, this ); + m_vAlignTop->Bind( wxEVT_BUTTON, &DIALOG_LIB_TEXTBOX_PROPERTIES::onVAlignButton, this ); + m_vAlignCenter->Bind( wxEVT_BUTTON, &DIALOG_LIB_TEXTBOX_PROPERTIES::onVAlignButton, this ); + m_vAlignBottom->Bind( wxEVT_BUTTON, &DIALOG_LIB_TEXTBOX_PROPERTIES::onVAlignButton, this ); + m_horizontal->Bind( wxEVT_BUTTON, &DIALOG_LIB_TEXTBOX_PROPERTIES::onTextAngleButton, this ); + m_vertical->Bind( wxEVT_BUTTON, &DIALOG_LIB_TEXTBOX_PROPERTIES::onTextAngleButton, this ); // Now all widgets have the size fixed, call FinishDialogSettings finishDialogSettings(); @@ -138,6 +149,25 @@ bool DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataToWindow() m_bold->Check( m_currentText->IsBold() ); m_italic->Check( m_currentText->IsItalic() ); + switch( m_currentText->GetHorizJustify() ) + { + case GR_TEXT_H_ALIGN_LEFT: m_hAlignLeft->Check(); break; + case GR_TEXT_H_ALIGN_CENTER: m_hAlignCenter->Check(); break; + case GR_TEXT_H_ALIGN_RIGHT: m_hAlignRight->Check(); break; + } + + switch( m_currentText->GetVertJustify() ) + { + case GR_TEXT_V_ALIGN_TOP: m_vAlignTop->Check(); break; + case GR_TEXT_V_ALIGN_CENTER: m_vAlignCenter->Check(); break; + case GR_TEXT_V_ALIGN_BOTTOM: m_vAlignBottom->Check(); break; + } + + if( m_currentText->GetTextAngle() == ANGLE_VERTICAL ) + m_vertical->Check(); + else + m_horizontal->Check(); + if( m_currentText->GetWidth() >= 0 ) { m_borderCheckbox->SetValue( true ); @@ -171,25 +201,6 @@ bool DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataToWindow() m_fillColorLabel->Enable( m_currentText->IsFilled() ); m_fillColorSwatch->Enable( m_currentText->IsFilled() ); - if( m_currentText->GetTextAngle() == ANGLE_VERTICAL ) - { - switch( m_currentText->GetHorizJustify() ) - { - case GR_TEXT_H_ALIGN_LEFT: m_spin3->Check(); break; - case GR_TEXT_H_ALIGN_CENTER: m_spin4->Check(); break; - case GR_TEXT_H_ALIGN_RIGHT: m_spin5->Check(); break; - } - } - else - { - switch( m_currentText->GetHorizJustify() ) - { - case GR_TEXT_H_ALIGN_LEFT: m_spin0->Check(); break; - case GR_TEXT_H_ALIGN_CENTER: m_spin1->Check(); break; - case GR_TEXT_H_ALIGN_RIGHT: m_spin2->Check(); break; - } - } - m_privateCheckbox->SetValue( m_currentText->IsPrivate() ); m_CommonUnit->SetValue( m_currentText->GetUnit() == 0 ); m_CommonConvert->SetValue( m_currentText->GetConvert() == 0 ); @@ -198,9 +209,29 @@ bool DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataToWindow() } -void DIALOG_LIB_TEXTBOX_PROPERTIES::onSpinButton( wxCommandEvent& aEvent ) +void DIALOG_LIB_TEXTBOX_PROPERTIES::onHAlignButton( wxCommandEvent& aEvent ) { - for( BITMAP_BUTTON* btn : { m_spin0, m_spin1, m_spin2, m_spin3, m_spin4, m_spin5 } ) + for( BITMAP_BUTTON* btn : { m_hAlignLeft, m_hAlignCenter, m_hAlignRight } ) + { + if( btn->IsChecked() && btn != aEvent.GetEventObject() ) + btn->Check( false ); + } +} + + +void DIALOG_LIB_TEXTBOX_PROPERTIES::onVAlignButton( wxCommandEvent& aEvent ) +{ + for( BITMAP_BUTTON* btn : { m_vAlignTop, m_vAlignCenter, m_vAlignBottom } ) + { + if( btn->IsChecked() && btn != aEvent.GetEventObject() ) + btn->Check( false ); + } +} + + +void DIALOG_LIB_TEXTBOX_PROPERTIES::onTextAngleButton( wxCommandEvent& aEvent ) +{ + for( BITMAP_BUTTON* btn : { m_horizontal, m_vertical } ) { if( btn->IsChecked() && btn != aEvent.GetEventObject() ) btn->Check( false ); @@ -252,36 +283,24 @@ bool DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataFromWindow() m_currentText->SetItalic( m_italic->IsChecked() ); m_currentText->SetTextColor( m_textColorSwatch->GetSwatchColor() ); - if( m_spin0->IsChecked() ) - { - m_currentText->SetTextAngle( ANGLE_HORIZONTAL ); - m_currentText->SetHorizJustify( GR_TEXT_H_ALIGN_LEFT ); - } - else if( m_spin1->IsChecked() ) - { - m_currentText->SetTextAngle( ANGLE_HORIZONTAL ); - m_currentText->SetHorizJustify( GR_TEXT_H_ALIGN_CENTER ); - } - else if( m_spin2->IsChecked() ) - { - m_currentText->SetTextAngle( ANGLE_HORIZONTAL ); + if( m_hAlignRight->IsChecked() ) m_currentText->SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT ); - } - else if( m_spin3->IsChecked() ) - { - m_currentText->SetTextAngle( ANGLE_VERTICAL ); - m_currentText->SetHorizJustify( GR_TEXT_H_ALIGN_LEFT ); - } - else if( m_spin4->IsChecked() ) - { - m_currentText->SetTextAngle( ANGLE_VERTICAL ); + else if( m_hAlignCenter->IsChecked() ) m_currentText->SetHorizJustify( GR_TEXT_H_ALIGN_CENTER ); - } - else if( m_spin5->IsChecked() ) - { + else + m_currentText->SetHorizJustify( GR_TEXT_H_ALIGN_LEFT ); + + if( m_vAlignBottom->IsChecked() ) + m_currentText->SetVertJustify( GR_TEXT_V_ALIGN_BOTTOM ); + else if( m_vAlignCenter->IsChecked() ) + m_currentText->SetVertJustify( GR_TEXT_V_ALIGN_CENTER ); + else + m_currentText->SetVertJustify( GR_TEXT_V_ALIGN_TOP ); + + if( m_vertical->IsChecked() ) m_currentText->SetTextAngle( ANGLE_VERTICAL ); - m_currentText->SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT ); - } + else + m_currentText->SetTextAngle( ANGLE_HORIZONTAL ); STROKE_PARAMS stroke = m_currentText->GetStroke(); diff --git a/eeschema/dialogs/dialog_lib_textbox_properties.h b/eeschema/dialogs/dialog_lib_textbox_properties.h index a7c1a1cfc2..4328f26ffc 100644 --- a/eeschema/dialogs/dialog_lib_textbox_properties.h +++ b/eeschema/dialogs/dialog_lib_textbox_properties.h @@ -42,7 +42,9 @@ public: ~DIALOG_LIB_TEXTBOX_PROPERTIES(); private: - void onSpinButton( wxCommandEvent &aEvent ); + void onHAlignButton( wxCommandEvent &aEvent ); + void onVAlignButton( wxCommandEvent &aEvent ); + void onTextAngleButton( wxCommandEvent &aEvent ); void onBorderChecked( wxCommandEvent& event ) override; void onFillChecked( wxCommandEvent& event ) override; @@ -53,7 +55,7 @@ private: bool TransferDataFromWindow() override; SYMBOL_EDIT_FRAME* m_frame; - LIB_TEXTBOX* m_currentText; + LIB_TEXTBOX* m_currentText; UNIT_BINDER m_textSize; UNIT_BINDER m_borderWidth; SCINTILLA_TRICKS* m_scintillaTricks; diff --git a/eeschema/dialogs/dialog_lib_textbox_properties_base.cpp b/eeschema/dialogs/dialog_lib_textbox_properties_base.cpp index f950f57b5b..0bcf9a41e6 100644 --- a/eeschema/dialogs/dialog_lib_textbox_properties_base.cpp +++ b/eeschema/dialogs/dialog_lib_textbox_properties_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Oct 26 2018) +// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -38,6 +38,7 @@ DIALOG_LIB_TEXTBOX_PROPERTIES_BASE::DIALOG_LIB_TEXTBOX_PROPERTIES_BASE( wxWindow m_textCtrl->SetViewWhiteSpace( false ); m_textCtrl->SetMarginWidth( 2, 0 ); m_textCtrl->SetIndentationGuides( false ); + m_textCtrl->SetReadOnly( false ); m_textCtrl->SetMarginWidth( 1, 0 ); m_textCtrl->SetMarginWidth( 0, 0 ); m_textCtrl->MarkerDefine( wxSTC_MARKNUM_FOLDER, wxSTC_MARK_BOXPLUS ); @@ -63,13 +64,13 @@ DIALOG_LIB_TEXTBOX_PROPERTIES_BASE::DIALOG_LIB_TEXTBOX_PROPERTIES_BASE( wxWindow m_fontLabel = new wxStaticText( this, wxID_ANY, _("Font:"), wxDefaultPosition, wxDefaultSize, 0 ); m_fontLabel->Wrap( -1 ); - m_textEntrySizer->Add( m_fontLabel, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP, 5 ); + m_textEntrySizer->Add( m_fontLabel, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP, 5 ); wxString m_fontCtrlChoices[] = { _("Default Font"), _("KiCad Font") }; int m_fontCtrlNChoices = sizeof( m_fontCtrlChoices ) / sizeof( wxString ); m_fontCtrl = new FONT_CHOICE( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_fontCtrlNChoices, m_fontCtrlChoices, 0 ); m_fontCtrl->SetSelection( 0 ); - m_textEntrySizer->Add( m_fontCtrl, wxGBPosition( 1, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP, 5 ); + m_textEntrySizer->Add( m_fontCtrl, wxGBPosition( 2, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP, 5 ); wxBoxSizer* bSizeCtrlSizer; bSizeCtrlSizer = new wxBoxSizer( wxHORIZONTAL ); @@ -94,43 +95,63 @@ DIALOG_LIB_TEXTBOX_PROPERTIES_BASE::DIALOG_LIB_TEXTBOX_PROPERTIES_BASE( wxWindow bSizeCtrlSizer->Add( m_separator2, 0, wxALIGN_CENTER_VERTICAL, 5 ); - m_spin0 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); - m_spin0->SetToolTip( _("Align left") ); + m_hAlignLeft = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); + m_hAlignLeft->SetToolTip( _("Align left") ); - bSizeCtrlSizer->Add( m_spin0, 0, wxALIGN_CENTER_VERTICAL, 5 ); + bSizeCtrlSizer->Add( m_hAlignLeft, 0, wxALIGN_CENTER_VERTICAL, 5 ); - m_spin1 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); - m_spin1->SetToolTip( _("Align horizontal center") ); + m_hAlignCenter = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); + m_hAlignCenter->SetToolTip( _("Align horizontal center") ); - bSizeCtrlSizer->Add( m_spin1, 0, wxALIGN_CENTER_VERTICAL, 5 ); + bSizeCtrlSizer->Add( m_hAlignCenter, 0, wxALIGN_CENTER_VERTICAL, 5 ); - m_spin2 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); - m_spin2->SetToolTip( _("Align right") ); + m_hAlignRight = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); + m_hAlignRight->SetToolTip( _("Align right") ); - bSizeCtrlSizer->Add( m_spin2, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_spin3 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); - m_spin3->SetToolTip( _("Align bottom") ); - - bSizeCtrlSizer->Add( m_spin3, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_spin4 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); - m_spin4->SetToolTip( _("Align vertical center") ); - - bSizeCtrlSizer->Add( m_spin4, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_spin5 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); - m_spin5->SetToolTip( _("Align top") ); - - bSizeCtrlSizer->Add( m_spin5, 0, wxALIGN_CENTER_VERTICAL, 5 ); + bSizeCtrlSizer->Add( m_hAlignRight, 0, wxALIGN_CENTER_VERTICAL, 5 ); m_separator3 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); m_separator3->Enable( false ); bSizeCtrlSizer->Add( m_separator3, 0, wxALIGN_CENTER_VERTICAL, 5 ); + m_vAlignTop = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); + m_vAlignTop->SetToolTip( _("Align top") ); - m_textEntrySizer->Add( bSizeCtrlSizer, wxGBPosition( 1, 3 ), wxGBSpan( 1, 2 ), wxEXPAND|wxTOP, 5 ); + bSizeCtrlSizer->Add( m_vAlignTop, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_vAlignCenter = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); + m_vAlignCenter->SetToolTip( _("Align top") ); + + bSizeCtrlSizer->Add( m_vAlignCenter, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_vAlignBottom = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); + m_vAlignBottom->SetToolTip( _("Align top") ); + + bSizeCtrlSizer->Add( m_vAlignBottom, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_separator4 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); + m_separator4->Enable( false ); + + bSizeCtrlSizer->Add( m_separator4, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_horizontal = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); + m_horizontal->SetToolTip( _("Align bottom") ); + + bSizeCtrlSizer->Add( m_horizontal, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_vertical = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); + m_vertical->SetToolTip( _("Align vertical center") ); + + bSizeCtrlSizer->Add( m_vertical, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_separator5 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); + m_separator5->Enable( false ); + + bSizeCtrlSizer->Add( m_separator5, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + + m_textEntrySizer->Add( bSizeCtrlSizer, wxGBPosition( 2, 3 ), wxGBSpan( 1, 3 ), wxEXPAND|wxTOP, 5 ); wxBoxSizer* bSizer41; bSizer41 = new wxBoxSizer( wxVERTICAL ); @@ -141,11 +162,11 @@ DIALOG_LIB_TEXTBOX_PROPERTIES_BASE::DIALOG_LIB_TEXTBOX_PROPERTIES_BASE( wxWindow bSizer41->Add( m_syntaxHelp, 0, wxRIGHT|wxLEFT, 5 ); - m_textEntrySizer->Add( bSizer41, wxGBPosition( 1, 5 ), wxGBSpan( 1, 1 ), wxEXPAND|wxALIGN_RIGHT|wxLEFT, 80 ); + m_textEntrySizer->Add( bSizer41, wxGBPosition( 1, 5 ), wxGBSpan( 1, 1 ), wxEXPAND|wxALIGN_RIGHT|wxBOTTOM|wxLEFT, 5 ); m_textSizeLabel = new wxStaticText( this, wxID_ANY, _("Text size:"), wxDefaultPosition, wxDefaultSize, 0 ); m_textSizeLabel->Wrap( -1 ); - m_textEntrySizer->Add( m_textSizeLabel, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 ); + m_textEntrySizer->Add( m_textSizeLabel, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 ); wxBoxSizer* bSizer71; bSizer71 = new wxBoxSizer( wxHORIZONTAL ); @@ -178,17 +199,17 @@ DIALOG_LIB_TEXTBOX_PROPERTIES_BASE::DIALOG_LIB_TEXTBOX_PROPERTIES_BASE( wxWindow bSizer71->Add( m_panelBorderColor1, 0, wxALIGN_CENTER_VERTICAL, 5 ); - m_textEntrySizer->Add( bSizer71, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 ); + m_textEntrySizer->Add( bSizer71, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 ); - m_textEntrySizer->Add( 0, 15, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 ); + m_textEntrySizer->Add( 0, 15, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 ); m_borderCheckbox = new wxCheckBox( this, wxID_ANY, _("Border"), wxDefaultPosition, wxDefaultSize, 0 ); - m_textEntrySizer->Add( m_borderCheckbox, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), 0, 5 ); + m_textEntrySizer->Add( m_borderCheckbox, wxGBPosition( 5, 0 ), wxGBSpan( 1, 1 ), 0, 5 ); m_borderWidthLabel = new wxStaticText( this, wxID_ANY, _("Width:"), wxDefaultPosition, wxDefaultSize, 0 ); m_borderWidthLabel->Wrap( -1 ); - m_textEntrySizer->Add( m_borderWidthLabel, wxGBPosition( 5, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 ); + m_textEntrySizer->Add( m_borderWidthLabel, wxGBPosition( 6, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 ); wxBoxSizer* bSizer7; bSizer7 = new wxBoxSizer( wxHORIZONTAL ); @@ -221,22 +242,22 @@ DIALOG_LIB_TEXTBOX_PROPERTIES_BASE::DIALOG_LIB_TEXTBOX_PROPERTIES_BASE( wxWindow bSizer7->Add( m_panelBorderColor, 0, wxALIGN_CENTER_VERTICAL, 5 ); - m_textEntrySizer->Add( bSizer7, wxGBPosition( 5, 1 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 ); + m_textEntrySizer->Add( bSizer7, wxGBPosition( 6, 1 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 ); m_borderStyleLabel = new wxStaticText( this, wxID_ANY, _("Style:"), wxDefaultPosition, wxDefaultSize, 0 ); m_borderStyleLabel->Wrap( -1 ); - m_textEntrySizer->Add( m_borderStyleLabel, wxGBPosition( 6, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 ); + m_textEntrySizer->Add( m_borderStyleLabel, wxGBPosition( 7, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 ); m_borderStyleCombo = new wxBitmapComboBox( this, wxID_ANY, _("Combo!"), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY ); m_borderStyleCombo->SetMinSize( wxSize( 240,-1 ) ); - m_textEntrySizer->Add( m_borderStyleCombo, wxGBPosition( 6, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + m_textEntrySizer->Add( m_borderStyleCombo, wxGBPosition( 7, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - m_textEntrySizer->Add( 0, 15, wxGBPosition( 7, 0 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 ); + m_textEntrySizer->Add( 0, 15, wxGBPosition( 8, 0 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 ); m_filledCtrl = new wxCheckBox( this, wxID_ANY, _("Background fill"), wxDefaultPosition, wxDefaultSize, 0 ); - m_textEntrySizer->Add( m_filledCtrl, wxGBPosition( 4, 4 ), wxGBSpan( 1, 2 ), wxRIGHT, 140 ); + m_textEntrySizer->Add( m_filledCtrl, wxGBPosition( 5, 4 ), wxGBSpan( 1, 2 ), wxRIGHT, 140 ); wxBoxSizer* bSizer8; bSizer8 = new wxBoxSizer( wxHORIZONTAL ); @@ -259,16 +280,16 @@ DIALOG_LIB_TEXTBOX_PROPERTIES_BASE::DIALOG_LIB_TEXTBOX_PROPERTIES_BASE( wxWindow bSizer8->Add( m_panelFillColor, 0, wxALIGN_CENTER_VERTICAL, 5 ); - m_textEntrySizer->Add( bSizer8, wxGBPosition( 5, 4 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 ); + m_textEntrySizer->Add( bSizer8, wxGBPosition( 6, 4 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 ); m_privateCheckbox = new wxCheckBox( this, wxID_ANY, _("Private to symbol editor"), wxDefaultPosition, wxDefaultSize, 0 ); - m_textEntrySizer->Add( m_privateCheckbox, wxGBPosition( 8, 0 ), wxGBSpan( 1, 2 ), 0, 5 ); + m_textEntrySizer->Add( m_privateCheckbox, wxGBPosition( 9, 0 ), wxGBSpan( 1, 2 ), 0, 5 ); m_CommonUnit = new wxCheckBox( this, wxID_ANY, _("Common to all units"), wxDefaultPosition, wxDefaultSize, 0 ); - m_textEntrySizer->Add( m_CommonUnit, wxGBPosition( 8, 4 ), wxGBSpan( 1, 2 ), 0, 5 ); + m_textEntrySizer->Add( m_CommonUnit, wxGBPosition( 9, 4 ), wxGBSpan( 1, 2 ), 0, 5 ); m_CommonConvert = new wxCheckBox( this, wxID_ANY, _("Common to all body styles"), wxDefaultPosition, wxDefaultSize, 0 ); - m_textEntrySizer->Add( m_CommonConvert, wxGBPosition( 9, 4 ), wxGBSpan( 1, 2 ), 0, 5 ); + m_textEntrySizer->Add( m_CommonConvert, wxGBPosition( 10, 4 ), wxGBSpan( 1, 2 ), wxRIGHT, 90 ); m_textEntrySizer->AddGrowableCol( 3 ); diff --git a/eeschema/dialogs/dialog_lib_textbox_properties_base.fbp b/eeschema/dialogs/dialog_lib_textbox_properties_base.fbp index 25f6597095..34d1fb053e 100644 --- a/eeschema/dialogs/dialog_lib_textbox_properties_base.fbp +++ b/eeschema/dialogs/dialog_lib_textbox_properties_base.fbp @@ -1,6 +1,6 @@ - + C++ @@ -14,6 +14,7 @@ dialog_lib_textbox_properties_base 1000 none + 1 dialog_lib_textbox_properties_base @@ -25,6 +26,7 @@ 1 1 UI + 0 1 0 @@ -50,6 +52,7 @@ DIALOG_SHIM; dialog_shim.h Text Box Properties + 0 @@ -190,6 +193,7 @@ protected 1 + 0 Resizable 1 @@ -212,7 +216,7 @@ 1 0 wxALIGN_CENTER_VERTICAL|wxTOP - 1 + 2 1 1 @@ -276,7 +280,7 @@ 2 1 wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP - 1 + 2 1 1 @@ -340,10 +344,10 @@ 5 - 2 + 3 3 wxEXPAND|wxTOP - 1 + 2 1 @@ -363,6 +367,7 @@ + 0 @@ -435,6 +440,7 @@ + 0 @@ -507,6 +513,7 @@ + 0 @@ -579,6 +586,7 @@ + 0 @@ -651,6 +659,7 @@ + 0 @@ -685,7 +694,7 @@ 0 1 - m_spin0 + m_hAlignLeft 1 @@ -723,6 +732,7 @@ + 0 @@ -757,7 +767,7 @@ 0 1 - m_spin1 + m_hAlignCenter 1 @@ -795,6 +805,7 @@ + 0 @@ -829,7 +840,7 @@ 0 1 - m_spin2 + m_hAlignRight 1 @@ -867,222 +878,7 @@ - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - Align top - - 0 - - 0 - - - 0 - - 1 - m_spin3 - 1 - - - protected - 1 - - - - Resizable - 1 - 21,21 - wxBORDER_NONE - BITMAP_BUTTON; widgets/bitmap_button.h; forward_declare - 0 - Align bottom - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - Align middle - - 0 - - 0 - - - 0 - - 1 - m_spin4 - 1 - - - protected - 1 - - - - Resizable - 1 - 21,21 - wxBORDER_NONE - BITMAP_BUTTON; widgets/bitmap_button.h; forward_declare - 0 - Align vertical center - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - Align bottom - - 0 - - 0 - - - 0 - - 1 - m_spin5 - 1 - - - protected - 1 - - - - Resizable - 1 - 21,21 - wxBORDER_NONE - BITMAP_BUTTON; widgets/bitmap_button.h; forward_declare - 0 - Align top - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - + 0 @@ -1142,16 +938,527 @@ + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + Align top + + 0 + + 0 + + + 0 + + 1 + m_vAlignTop + 1 + + + protected + 1 + + + + Resizable + 1 + 21,21 + wxBORDER_NONE + BITMAP_BUTTON; widgets/bitmap_button.h; forward_declare + 0 + Align top + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + Align middle + + 0 + + 0 + + + 0 + + 1 + m_vAlignCenter + 1 + + + protected + 1 + + + + Resizable + 1 + 21,21 + wxBORDER_NONE + BITMAP_BUTTON; widgets/bitmap_button.h; forward_declare + 0 + Align top + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + Align bottom + + 0 + + 0 + + + 0 + + 1 + m_vAlignBottom + 1 + + + protected + 1 + + + + Resizable + 1 + 21,21 + wxBORDER_NONE + BITMAP_BUTTON; widgets/bitmap_button.h; forward_declare + 0 + Align top + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + + 1 + + + 0 + 0 + wxID_ANY + + + 0 + + 0 + + + 0 + + 1 + m_separator4 + 1 + + + protected + 1 + + + + Resizable + 1 + 21,21 + wxBORDER_NONE + BITMAP_BUTTON; widgets/bitmap_button.h; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + Align top + + 0 + + 0 + + + 0 + + 1 + m_horizontal + 1 + + + protected + 1 + + + + Resizable + 1 + 21,21 + wxBORDER_NONE + BITMAP_BUTTON; widgets/bitmap_button.h; forward_declare + 0 + Align bottom + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + Align middle + + 0 + + 0 + + + 0 + + 1 + m_vertical + 1 + + + protected + 1 + + + + Resizable + 1 + 21,21 + wxBORDER_NONE + BITMAP_BUTTON; widgets/bitmap_button.h; forward_declare + 0 + Align vertical center + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + + 1 + + + 0 + 0 + wxID_ANY + + + 0 + + 0 + + + 0 + + 1 + m_separator5 + 1 + + + protected + 1 + + + + Resizable + 1 + 21,21 + wxBORDER_NONE + BITMAP_BUTTON; widgets/bitmap_button.h; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + - 80 + 5 1 5 - wxEXPAND|wxALIGN_RIGHT|wxLEFT + wxEXPAND|wxALIGN_RIGHT|wxBOTTOM|wxLEFT 1 1 - + bSizer41 wxVERTICAL @@ -1227,7 +1534,7 @@ 1 0 wxALIGN_CENTER_VERTICAL - 2 + 3 1 1 @@ -1291,7 +1598,7 @@ 1 1 wxEXPAND - 2 + 3 1 @@ -1626,7 +1933,7 @@ 1 0 wxEXPAND - 3 + 4 1 15 @@ -1639,7 +1946,7 @@ 1 0 - 4 + 5 1 1 @@ -1707,7 +2014,7 @@ 1 0 wxALIGN_CENTER_VERTICAL - 5 + 6 1 1 @@ -1771,7 +2078,7 @@ 1 1 wxEXPAND - 5 + 6 1 @@ -2106,7 +2413,7 @@ 1 0 wxALIGN_CENTER_VERTICAL - 6 + 7 1 1 @@ -2170,7 +2477,7 @@ 2 1 wxALIGN_CENTER_VERTICAL|wxEXPAND - 6 + 7 1 1 @@ -2238,7 +2545,7 @@ 1 0 wxEXPAND - 7 + 8 1 15 @@ -2251,7 +2558,7 @@ 2 4 wxRIGHT - 4 + 5 1 1 @@ -2319,7 +2626,7 @@ 1 4 wxEXPAND - 5 + 6 1 @@ -2519,7 +2826,7 @@ 2 0 - 8 + 9 1 1 @@ -2586,7 +2893,7 @@ 2 4 - 8 + 9 1 1 @@ -2649,11 +2956,11 @@ - 5 + 90 2 4 - - 9 + wxRIGHT + 10 1 1 diff --git a/eeschema/dialogs/dialog_lib_textbox_properties_base.h b/eeschema/dialogs/dialog_lib_textbox_properties_base.h index f1183a6a4e..495721714a 100644 --- a/eeschema/dialogs/dialog_lib_textbox_properties_base.h +++ b/eeschema/dialogs/dialog_lib_textbox_properties_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Oct 26 2018) +// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -57,13 +57,17 @@ class DIALOG_LIB_TEXTBOX_PROPERTIES_BASE : public DIALOG_SHIM BITMAP_BUTTON* m_bold; BITMAP_BUTTON* m_italic; BITMAP_BUTTON* m_separator2; - BITMAP_BUTTON* m_spin0; - BITMAP_BUTTON* m_spin1; - BITMAP_BUTTON* m_spin2; - BITMAP_BUTTON* m_spin3; - BITMAP_BUTTON* m_spin4; - BITMAP_BUTTON* m_spin5; + BITMAP_BUTTON* m_hAlignLeft; + BITMAP_BUTTON* m_hAlignCenter; + BITMAP_BUTTON* m_hAlignRight; BITMAP_BUTTON* m_separator3; + BITMAP_BUTTON* m_vAlignTop; + BITMAP_BUTTON* m_vAlignCenter; + BITMAP_BUTTON* m_vAlignBottom; + BITMAP_BUTTON* m_separator4; + BITMAP_BUTTON* m_horizontal; + BITMAP_BUTTON* m_vertical; + BITMAP_BUTTON* m_separator5; wxHyperlinkCtrl* m_syntaxHelp; wxStaticText* m_textSizeLabel; wxTextCtrl* m_textSizeCtrl; @@ -92,7 +96,7 @@ class DIALOG_LIB_TEXTBOX_PROPERTIES_BASE : public DIALOG_SHIM wxButton* m_sdbSizer1OK; wxButton* m_sdbSizer1Cancel; - // Virtual event handlers, overide them in your derived class + // Virtual event handlers, override them in your derived class virtual void onMultiLineTCLostFocus( wxFocusEvent& event ) { event.Skip(); } virtual void OnFormattingHelp( wxHyperlinkEvent& event ) { event.Skip(); } virtual void onBorderChecked( wxCommandEvent& event ) { event.Skip(); } @@ -102,6 +106,7 @@ class DIALOG_LIB_TEXTBOX_PROPERTIES_BASE : public DIALOG_SHIM public: DIALOG_LIB_TEXTBOX_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Text Box Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~DIALOG_LIB_TEXTBOX_PROPERTIES_BASE(); }; diff --git a/eeschema/dialogs/dialog_text_properties.cpp b/eeschema/dialogs/dialog_text_properties.cpp index 05a2c8ae51..2cf3c9d541 100644 --- a/eeschema/dialogs/dialog_text_properties.cpp +++ b/eeschema/dialogs/dialog_text_properties.cpp @@ -74,8 +74,13 @@ DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_ITE } else { - m_spin1->Show( false ); - m_spin4->Show( false ); + m_hAlignCenter->Show( false ); + m_vAlignCenter->Show( false ); + + wxSizer* parentSizer = m_vAlignTop->GetContainingSizer(); + parentSizer->Detach( m_hAlignCenter ); + parentSizer->Detach( m_vAlignCenter ); + parentSizer->Layout(); m_borderCheckbox->Show( false ); m_borderWidth.Show( false ); @@ -112,21 +117,30 @@ DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_ITE m_separator2->SetIsSeparator(); - m_spin0->SetIsRadioButton(); - m_spin0->SetBitmap( KiBitmap( BITMAPS::text_align_left ) ); - m_spin1->SetIsRadioButton(); - m_spin1->SetBitmap( KiBitmap( BITMAPS::text_align_center ) ); - m_spin2->SetIsRadioButton(); - m_spin2->SetBitmap( KiBitmap( BITMAPS::text_align_right ) ); - m_spin3->SetIsRadioButton(); - m_spin3->SetBitmap( KiBitmap( BITMAPS::text_align_bottom ) ); - m_spin4->SetIsRadioButton(); - m_spin4->SetBitmap( KiBitmap( BITMAPS::text_align_middle ) ); - m_spin5->SetIsRadioButton(); - m_spin5->SetBitmap( KiBitmap( BITMAPS::text_align_top ) ); - + m_hAlignLeft->SetIsRadioButton(); + m_hAlignLeft->SetBitmap( KiBitmap( BITMAPS::text_align_left ) ); + m_hAlignCenter->SetIsRadioButton(); + m_hAlignCenter->SetBitmap( KiBitmap( BITMAPS::text_align_center ) ); + m_hAlignRight->SetIsRadioButton(); + m_hAlignRight->SetBitmap( KiBitmap( BITMAPS::text_align_right ) ); m_separator3->SetIsSeparator(); + m_vAlignTop->SetIsRadioButton(); + m_vAlignTop->SetBitmap( KiBitmap( BITMAPS::text_valign_top ) ); + m_vAlignCenter->SetIsRadioButton(); + m_vAlignCenter->SetBitmap( KiBitmap( BITMAPS::text_valign_center ) ); + m_vAlignBottom->SetIsRadioButton(); + m_vAlignBottom->SetBitmap( KiBitmap( BITMAPS::text_valign_bottom ) ); + + m_separator4->SetIsSeparator(); + + m_horizontal->SetIsRadioButton(); + m_horizontal->SetBitmap( KiBitmap( BITMAPS::text_horizontal ) ); + m_vertical->SetIsRadioButton(); + m_vertical->SetBitmap( KiBitmap( BITMAPS::text_vertical ) ); + + m_separator5->SetIsSeparator(); + SCH_SHEET_LIST sheetList = m_frame->Schematic().GetSheets(); sheetList.SortByPageNumbers( false ); @@ -149,12 +163,14 @@ DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_ITE Layout(); m_textCtrl->Bind( wxEVT_STC_CHARADDED, &DIALOG_TEXT_PROPERTIES::onScintillaCharAdded, this ); - m_spin0->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onSpinButton, this ); - m_spin1->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onSpinButton, this ); - m_spin2->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onSpinButton, this ); - m_spin3->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onSpinButton, this ); - m_spin4->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onSpinButton, this ); - m_spin5->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onSpinButton, this ); + m_hAlignLeft->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onHAlignButton, this ); + m_hAlignCenter->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onHAlignButton, this ); + m_hAlignRight->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onHAlignButton, this ); + m_vAlignTop->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onVAlignButton, this ); + m_vAlignCenter->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onVAlignButton, this ); + m_vAlignBottom->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onVAlignButton, this ); + m_horizontal->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onTextAngleButton, this ); + m_vertical->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onTextAngleButton, this ); // Now all widgets have the size fixed, call FinishDialogSettings finishDialogSettings(); @@ -194,6 +210,25 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataToWindow() { SCH_TEXTBOX* textBox = static_cast( m_currentItem ); + switch( m_currentText->GetHorizJustify() ) + { + case GR_TEXT_H_ALIGN_LEFT: m_hAlignLeft->Check(); break; + case GR_TEXT_H_ALIGN_CENTER: m_hAlignCenter->Check(); break; + case GR_TEXT_H_ALIGN_RIGHT: m_hAlignRight->Check(); break; + } + + switch( m_currentText->GetVertJustify() ) + { + case GR_TEXT_V_ALIGN_TOP: m_vAlignTop->Check(); break; + case GR_TEXT_V_ALIGN_CENTER: m_vAlignCenter->Check(); break; + case GR_TEXT_V_ALIGN_BOTTOM: m_vAlignBottom->Check(); break; + } + + if( m_currentText->GetTextAngle() == ANGLE_VERTICAL ) + m_vertical->Check(); + else + m_horizontal->Check(); + m_borderCheckbox->SetValue( textBox->GetWidth() >= 0 ); if( textBox->GetWidth() >= 0 ) @@ -221,36 +256,27 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataToWindow() m_fillColorLabel->Enable( textBox->IsFilled() ); m_fillColorSwatch->Enable( textBox->IsFilled() ); - - if( m_currentText->GetTextAngle() == ANGLE_VERTICAL ) - { - switch( m_currentText->GetHorizJustify() ) - { - case GR_TEXT_H_ALIGN_LEFT: m_spin3->Check(); break; - case GR_TEXT_H_ALIGN_CENTER: m_spin4->Check(); break; - case GR_TEXT_H_ALIGN_RIGHT: m_spin5->Check(); break; - } - } - else - { - switch( m_currentText->GetHorizJustify() ) - { - case GR_TEXT_H_ALIGN_LEFT: m_spin0->Check(); break; - case GR_TEXT_H_ALIGN_CENTER: m_spin1->Check(); break; - case GR_TEXT_H_ALIGN_RIGHT: m_spin2->Check(); break; - } - } } else { - TEXT_SPIN_STYLE spin = static_cast( m_currentItem )->GetTextSpinStyle(); - - switch( spin ) + switch( static_cast( m_currentItem )->GetTextSpinStyle() ) { - case TEXT_SPIN_STYLE::RIGHT: m_spin0->Check( true ); break; - case TEXT_SPIN_STYLE::LEFT: m_spin2->Check( true ); break; - case TEXT_SPIN_STYLE::UP: m_spin3->Check( true ); break; - case TEXT_SPIN_STYLE::BOTTOM: m_spin5->Check( true ); break; + case TEXT_SPIN_STYLE::RIGHT: + m_hAlignRight->Check( true ); + m_horizontal->Check( true ); + break; + case TEXT_SPIN_STYLE::LEFT: + m_hAlignLeft->Check( true ); + m_horizontal->Check( true ); + break; + case TEXT_SPIN_STYLE::UP: + m_vAlignTop->Check( true ); + m_vertical->Check( true ); + break; + case TEXT_SPIN_STYLE::BOTTOM: + m_vAlignBottom->Check( true ); + m_vertical->Check( true ); + break; } } @@ -376,9 +402,29 @@ void DIALOG_TEXT_PROPERTIES::onScintillaCharAdded( wxStyledTextEvent &aEvent ) } -void DIALOG_TEXT_PROPERTIES::onSpinButton( wxCommandEvent& aEvent ) +void DIALOG_TEXT_PROPERTIES::onHAlignButton( wxCommandEvent& aEvent ) { - for( BITMAP_BUTTON* btn : { m_spin0, m_spin1, m_spin2, m_spin3, m_spin4, m_spin5 } ) + for( BITMAP_BUTTON* btn : { m_hAlignLeft, m_hAlignCenter, m_hAlignRight } ) + { + if( btn->IsChecked() && btn != aEvent.GetEventObject() ) + btn->Check( false ); + } +} + + +void DIALOG_TEXT_PROPERTIES::onVAlignButton( wxCommandEvent& aEvent ) +{ + for( BITMAP_BUTTON* btn : { m_vAlignTop, m_vAlignCenter, m_vAlignBottom } ) + { + if( btn->IsChecked() && btn != aEvent.GetEventObject() ) + btn->Check( false ); + } +} + + +void DIALOG_TEXT_PROPERTIES::onTextAngleButton( wxCommandEvent& aEvent ) +{ + for( BITMAP_BUTTON* btn : { m_horizontal, m_vertical } ) { if( btn->IsChecked() && btn != aEvent.GetEventObject() ) btn->Check( false ); @@ -474,53 +520,45 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow() if( m_currentItem->Type() == SCH_TEXT_T ) { - TEXT_SPIN_STYLE selectedSpinStyle= TEXT_SPIN_STYLE::LEFT; + SCH_TEXT* textItem = static_cast( m_currentItem ); - if( m_spin0->IsChecked() ) - selectedSpinStyle = TEXT_SPIN_STYLE::RIGHT; - else if( m_spin2->IsChecked() ) - selectedSpinStyle = TEXT_SPIN_STYLE::LEFT; - else if( m_spin3->IsChecked() ) - selectedSpinStyle = TEXT_SPIN_STYLE::UP; - else if( m_spin5->IsChecked() ) - selectedSpinStyle = TEXT_SPIN_STYLE::BOTTOM; - - static_cast( m_currentItem )->SetTextSpinStyle( selectedSpinStyle ); + if( m_hAlignRight->IsChecked() ) + { + if( m_vertical->IsChecked() ) + textItem->SetTextSpinStyle( TEXT_SPIN_STYLE::BOTTOM ); + else + textItem->SetTextSpinStyle( TEXT_SPIN_STYLE::RIGHT ); + } + else + { + if( m_vertical->IsChecked() ) + textItem->SetTextSpinStyle( TEXT_SPIN_STYLE::UP ); + else + textItem->SetTextSpinStyle( TEXT_SPIN_STYLE::LEFT ); + } } else { SCH_TEXTBOX* textBox = static_cast( m_currentItem ); - if( m_spin0->IsChecked() ) - { - m_currentText->SetTextAngle( ANGLE_HORIZONTAL ); - m_currentText->SetHorizJustify( GR_TEXT_H_ALIGN_LEFT ); - } - else if( m_spin1->IsChecked() ) - { - m_currentText->SetTextAngle( ANGLE_HORIZONTAL ); - m_currentText->SetHorizJustify( GR_TEXT_H_ALIGN_CENTER ); - } - else if( m_spin2->IsChecked() ) - { - m_currentText->SetTextAngle( ANGLE_HORIZONTAL ); + if( m_hAlignRight->IsChecked() ) m_currentText->SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT ); - } - else if( m_spin3->IsChecked() ) - { - m_currentText->SetTextAngle( ANGLE_VERTICAL ); - m_currentText->SetHorizJustify( GR_TEXT_H_ALIGN_LEFT ); - } - else if( m_spin4->IsChecked() ) - { - m_currentText->SetTextAngle( ANGLE_VERTICAL ); + else if( m_hAlignCenter->IsChecked() ) m_currentText->SetHorizJustify( GR_TEXT_H_ALIGN_CENTER ); - } - else if( m_spin5->IsChecked() ) - { + else + m_currentText->SetHorizJustify( GR_TEXT_H_ALIGN_LEFT ); + + if( m_vAlignBottom->IsChecked() ) + m_currentText->SetVertJustify( GR_TEXT_V_ALIGN_BOTTOM ); + else if( m_vAlignCenter->IsChecked() ) + m_currentText->SetVertJustify( GR_TEXT_V_ALIGN_CENTER ); + else + m_currentText->SetVertJustify( GR_TEXT_V_ALIGN_TOP ); + + if( m_vertical->IsChecked() ) m_currentText->SetTextAngle( ANGLE_VERTICAL ); - m_currentText->SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT ); - } + else + m_currentText->SetTextAngle( ANGLE_HORIZONTAL ); STROKE_PARAMS stroke = textBox->GetStroke(); diff --git a/eeschema/dialogs/dialog_text_properties.h b/eeschema/dialogs/dialog_text_properties.h index 66f8481bdd..40558d62c2 100644 --- a/eeschema/dialogs/dialog_text_properties.h +++ b/eeschema/dialogs/dialog_text_properties.h @@ -43,7 +43,9 @@ public: private: void onScintillaCharAdded( wxStyledTextEvent &aEvent ); - void onSpinButton( wxCommandEvent &aEvent ); + void onHAlignButton( wxCommandEvent &aEvent ); + void onVAlignButton( wxCommandEvent &aEvent ); + void onTextAngleButton( wxCommandEvent &aEvent ); void onBorderChecked( wxCommandEvent& aEvent ) override; void onFillChecked( wxCommandEvent& aEvent ) override; void onHyperlinkChecked( wxCommandEvent& aEvent ) override; diff --git a/eeschema/dialogs/dialog_text_properties_base.cpp b/eeschema/dialogs/dialog_text_properties_base.cpp index 32cc32ac7e..eabc4ed5e6 100644 --- a/eeschema/dialogs/dialog_text_properties_base.cpp +++ b/eeschema/dialogs/dialog_text_properties_base.cpp @@ -115,41 +115,61 @@ DIALOG_TEXT_PROPERTIES_BASE::DIALOG_TEXT_PROPERTIES_BASE( wxWindow* parent, wxWi bSizeCtrlSizer->Add( m_separator2, 0, wxALIGN_CENTER_VERTICAL, 5 ); - m_spin0 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); - m_spin0->SetToolTip( _("Align left") ); + m_hAlignLeft = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); + m_hAlignLeft->SetToolTip( _("Align left") ); - bSizeCtrlSizer->Add( m_spin0, 0, wxALIGN_CENTER_VERTICAL, 5 ); + bSizeCtrlSizer->Add( m_hAlignLeft, 0, wxALIGN_CENTER_VERTICAL, 5 ); - m_spin1 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); - m_spin1->SetToolTip( _("Align horizontal center") ); + m_hAlignCenter = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); + m_hAlignCenter->SetToolTip( _("Align horizontal center") ); - bSizeCtrlSizer->Add( m_spin1, 0, wxALIGN_CENTER_VERTICAL, 5 ); + bSizeCtrlSizer->Add( m_hAlignCenter, 0, wxALIGN_CENTER_VERTICAL, 5 ); - m_spin2 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); - m_spin2->SetToolTip( _("Align right") ); + m_hAlignRight = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); + m_hAlignRight->SetToolTip( _("Align right") ); - bSizeCtrlSizer->Add( m_spin2, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_spin3 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); - m_spin3->SetToolTip( _("Align bottom") ); - - bSizeCtrlSizer->Add( m_spin3, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_spin4 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); - m_spin4->SetToolTip( _("Align vertical center") ); - - bSizeCtrlSizer->Add( m_spin4, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_spin5 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); - m_spin5->SetToolTip( _("Align top") ); - - bSizeCtrlSizer->Add( m_spin5, 0, wxALIGN_CENTER_VERTICAL, 5 ); + bSizeCtrlSizer->Add( m_hAlignRight, 0, wxALIGN_CENTER_VERTICAL, 5 ); m_separator3 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); m_separator3->Enable( false ); bSizeCtrlSizer->Add( m_separator3, 0, wxALIGN_CENTER_VERTICAL, 5 ); + m_vAlignTop = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); + m_vAlignTop->SetToolTip( _("Align left") ); + + bSizeCtrlSizer->Add( m_vAlignTop, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_vAlignCenter = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); + m_vAlignCenter->SetToolTip( _("Align left") ); + + bSizeCtrlSizer->Add( m_vAlignCenter, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_vAlignBottom = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); + m_vAlignBottom->SetToolTip( _("Align left") ); + + bSizeCtrlSizer->Add( m_vAlignBottom, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_separator4 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); + m_separator4->Enable( false ); + + bSizeCtrlSizer->Add( m_separator4, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_horizontal = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); + m_horizontal->SetToolTip( _("Align bottom") ); + + bSizeCtrlSizer->Add( m_horizontal, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_vertical = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); + m_vertical->SetToolTip( _("Align vertical center") ); + + bSizeCtrlSizer->Add( m_vertical, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_separator5 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE ); + m_separator5->Enable( false ); + + bSizeCtrlSizer->Add( m_separator5, 0, wxALIGN_CENTER_VERTICAL, 5 ); + m_textEntrySizer->Add( bSizeCtrlSizer, wxGBPosition( 2, 3 ), wxGBSpan( 1, 2 ), wxEXPAND|wxTOP, 5 ); diff --git a/eeschema/dialogs/dialog_text_properties_base.fbp b/eeschema/dialogs/dialog_text_properties_base.fbp index 22d1b0355c..5442b01f32 100644 --- a/eeschema/dialogs/dialog_text_properties_base.fbp +++ b/eeschema/dialogs/dialog_text_properties_base.fbp @@ -278,7 +278,7 @@ wxEXPAND|wxALIGN_RIGHT|wxLEFT 1 1 - + bSizer41 wxVERTICAL @@ -832,7 +832,7 @@ 0 1 - m_spin0 + m_hAlignLeft 1 @@ -905,7 +905,7 @@ 0 1 - m_spin1 + m_hAlignCenter 1 @@ -978,7 +978,7 @@ 0 1 - m_spin2 + m_hAlignRight 1 @@ -1003,6 +1003,371 @@ + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + + 1 + + + 0 + 0 + wxID_ANY + + + 0 + + 0 + + + 0 + + 1 + m_separator3 + 1 + + + protected + 1 + + + + Resizable + 1 + 21,21 + wxBORDER_NONE + BITMAP_BUTTON; widgets/bitmap_button.h; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + Align top + + 0 + + 0 + + + 0 + + 1 + m_vAlignTop + 1 + + + protected + 1 + + + + Resizable + 1 + 21,21 + wxBORDER_NONE + BITMAP_BUTTON; widgets/bitmap_button.h; forward_declare + 0 + Align left + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + Align middle + + 0 + + 0 + + + 0 + + 1 + m_vAlignCenter + 1 + + + protected + 1 + + + + Resizable + 1 + 21,21 + wxBORDER_NONE + BITMAP_BUTTON; widgets/bitmap_button.h; forward_declare + 0 + Align left + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + Align bottom + + 0 + + 0 + + + 0 + + 1 + m_vAlignBottom + 1 + + + protected + 1 + + + + Resizable + 1 + 21,21 + wxBORDER_NONE + BITMAP_BUTTON; widgets/bitmap_button.h; forward_declare + 0 + Align left + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + + 1 + + + 0 + 0 + wxID_ANY + + + 0 + + 0 + + + 0 + + 1 + m_separator4 + 1 + + + protected + 1 + + + + Resizable + 1 + 21,21 + wxBORDER_NONE + BITMAP_BUTTON; widgets/bitmap_button.h; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + 5 wxALIGN_CENTER_VERTICAL @@ -1051,7 +1416,7 @@ 0 1 - m_spin3 + m_horizontal 1 @@ -1124,7 +1489,7 @@ 0 1 - m_spin4 + m_vertical 1 @@ -1149,84 +1514,11 @@ - + 5 wxALIGN_CENTER_VERTICAL 0 - - 1 - 1 - 1 - 1 - - - - - 0 - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - Align bottom - - 0 - - 0 - - - 0 - - 1 - m_spin5 - 1 - - - protected - 1 - - - - Resizable - 1 - 21,21 - wxBORDER_NONE - BITMAP_BUTTON; widgets/bitmap_button.h; forward_declare - 0 - Align top - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL - 0 - + 1 1 1 @@ -1270,7 +1562,7 @@ 0 1 - m_separator3 + m_separator5 1 diff --git a/eeschema/dialogs/dialog_text_properties_base.h b/eeschema/dialogs/dialog_text_properties_base.h index a0f7f47b23..82cab07fd4 100644 --- a/eeschema/dialogs/dialog_text_properties_base.h +++ b/eeschema/dialogs/dialog_text_properties_base.h @@ -62,13 +62,17 @@ class DIALOG_TEXT_PROPERTIES_BASE : public DIALOG_SHIM BITMAP_BUTTON* m_bold; BITMAP_BUTTON* m_italic; BITMAP_BUTTON* m_separator2; - BITMAP_BUTTON* m_spin0; - BITMAP_BUTTON* m_spin1; - BITMAP_BUTTON* m_spin2; - BITMAP_BUTTON* m_spin3; - BITMAP_BUTTON* m_spin4; - BITMAP_BUTTON* m_spin5; + BITMAP_BUTTON* m_hAlignLeft; + BITMAP_BUTTON* m_hAlignCenter; + BITMAP_BUTTON* m_hAlignRight; BITMAP_BUTTON* m_separator3; + BITMAP_BUTTON* m_vAlignTop; + BITMAP_BUTTON* m_vAlignCenter; + BITMAP_BUTTON* m_vAlignBottom; + BITMAP_BUTTON* m_separator4; + BITMAP_BUTTON* m_horizontal; + BITMAP_BUTTON* m_vertical; + BITMAP_BUTTON* m_separator5; wxStaticText* m_textSizeLabel; wxTextCtrl* m_textSizeCtrl; wxStaticText* m_textSizeUnits; diff --git a/eeschema/lib_textbox.cpp b/eeschema/lib_textbox.cpp index 4b0b01d556..3095949f87 100644 --- a/eeschema/lib_textbox.cpp +++ b/eeschema/lib_textbox.cpp @@ -109,16 +109,34 @@ VECTOR2I LIB_TEXTBOX::GetDrawPos() const BOX2I bbox( VECTOR2I( std::min( m_start.x, m_end.x ), std::min( -m_start.y, -m_end.y ) ), VECTOR2I( abs( m_end.x - m_start.x ), abs( m_end.y - m_start.y ) ) ); + VECTOR2I pos( bbox.GetLeft() + margin, bbox.GetBottom() - margin ); + if( GetTextAngle() == ANGLE_VERTICAL ) { switch( GetHorizJustify() ) { case GR_TEXT_H_ALIGN_LEFT: - return VECTOR2I( bbox.GetLeft() + margin, bbox.GetBottom() - margin ); + pos.y = bbox.GetBottom() - margin; + break; case GR_TEXT_H_ALIGN_CENTER: - return VECTOR2I( bbox.GetLeft() + margin, ( bbox.GetTop() + bbox.GetBottom() ) / 2 ); + pos.y = ( bbox.GetTop() + bbox.GetBottom() ) / 2; + break; case GR_TEXT_H_ALIGN_RIGHT: - return VECTOR2I( bbox.GetLeft() + margin, bbox.GetTop() + margin ); + pos.y = bbox.GetTop() + margin; + break; + } + + switch( GetVertJustify() ) + { + case GR_TEXT_V_ALIGN_TOP: + pos.x = bbox.GetLeft() + margin; + break; + case GR_TEXT_V_ALIGN_CENTER: + pos.x = ( bbox.GetLeft() + bbox.GetRight() ) / 2; + break; + case GR_TEXT_V_ALIGN_BOTTOM: + pos.x = bbox.GetRight() - margin; + break; } } else @@ -126,16 +144,31 @@ VECTOR2I LIB_TEXTBOX::GetDrawPos() const switch( GetHorizJustify() ) { case GR_TEXT_H_ALIGN_LEFT: - return VECTOR2I( bbox.GetLeft() + margin, bbox.GetTop() + margin ); + pos.x = bbox.GetLeft() + margin; + break; case GR_TEXT_H_ALIGN_CENTER: - return VECTOR2I( ( bbox.GetLeft() + bbox.GetRight() ) / 2, bbox.GetTop() + margin ); + pos.x = ( bbox.GetLeft() + bbox.GetRight() ) / 2; + break; case GR_TEXT_H_ALIGN_RIGHT: - return VECTOR2I( bbox.GetRight() - margin, bbox.GetTop() + margin ); + pos.x = bbox.GetRight() - margin; + break; + } + + switch( GetVertJustify() ) + { + case GR_TEXT_V_ALIGN_TOP: + pos.y = bbox.GetTop() + margin; + break; + case GR_TEXT_V_ALIGN_CENTER: + pos.y = ( bbox.GetTop() + bbox.GetBottom() ) / 2; + break; + case GR_TEXT_V_ALIGN_BOTTOM: + pos.y = bbox.GetBottom() - margin; + break; } } - // Dummy default. Should never reach here - return VECTOR2I( bbox.GetLeft() + margin, bbox.GetBottom() - margin ); + return pos; } @@ -215,7 +248,7 @@ void LIB_TEXTBOX::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffs color = aSettings->GetLayerColor( LAYER_DEVICE ); if( lineStyle == PLOT_DASH_TYPE::DEFAULT ) - lineStyle = PLOT_DASH_TYPE::DASH; + lineStyle = PLOT_DASH_TYPE::SOLID; if( lineStyle <= PLOT_DASH_TYPE::FIRST_TYPE ) { diff --git a/eeschema/sch_textbox.cpp b/eeschema/sch_textbox.cpp index 2f191f3e7d..ed851787bd 100644 --- a/eeschema/sch_textbox.cpp +++ b/eeschema/sch_textbox.cpp @@ -117,16 +117,34 @@ VECTOR2I SCH_TEXTBOX::GetDrawPos() const bbox.Normalize(); + VECTOR2I pos( bbox.GetLeft() + margin, bbox.GetBottom() - margin ); + if( GetTextAngle() == ANGLE_VERTICAL ) { switch( GetHorizJustify() ) { case GR_TEXT_H_ALIGN_LEFT: - return VECTOR2I( bbox.GetLeft() + margin, bbox.GetBottom() - margin ); + pos.y = bbox.GetBottom() - margin; + break; case GR_TEXT_H_ALIGN_CENTER: - return VECTOR2I( bbox.GetLeft() + margin, ( bbox.GetTop() + bbox.GetBottom() ) / 2 ); + pos.y = ( bbox.GetTop() + bbox.GetBottom() ) / 2; + break; case GR_TEXT_H_ALIGN_RIGHT: - return VECTOR2I( bbox.GetLeft() + margin, bbox.GetTop() + margin ); + pos.y = bbox.GetTop() + margin; + break; + } + + switch( GetVertJustify() ) + { + case GR_TEXT_V_ALIGN_TOP: + pos.x = bbox.GetLeft() + margin; + break; + case GR_TEXT_V_ALIGN_CENTER: + pos.x = ( bbox.GetLeft() + bbox.GetRight() ) / 2; + break; + case GR_TEXT_V_ALIGN_BOTTOM: + pos.x = bbox.GetRight() - margin; + break; } } else @@ -134,16 +152,31 @@ VECTOR2I SCH_TEXTBOX::GetDrawPos() const switch( GetHorizJustify() ) { case GR_TEXT_H_ALIGN_LEFT: - return VECTOR2I( bbox.GetLeft() + margin, bbox.GetTop() + margin ); + pos.x = bbox.GetLeft() + margin; + break; case GR_TEXT_H_ALIGN_CENTER: - return VECTOR2I( ( bbox.GetLeft() + bbox.GetRight() ) / 2, bbox.GetTop() + margin ); + pos.x = ( bbox.GetLeft() + bbox.GetRight() ) / 2; + break; case GR_TEXT_H_ALIGN_RIGHT: - return VECTOR2I( bbox.GetRight() - margin, bbox.GetTop() + margin ); + pos.x = bbox.GetRight() - margin; + break; + } + + switch( GetVertJustify() ) + { + case GR_TEXT_V_ALIGN_TOP: + pos.y = bbox.GetTop() + margin; + break; + case GR_TEXT_V_ALIGN_CENTER: + pos.y = ( bbox.GetTop() + bbox.GetBottom() ) / 2; + break; + case GR_TEXT_V_ALIGN_BOTTOM: + pos.y = bbox.GetBottom() - margin; + break; } } - // Dummy default. Should never reach here - return VECTOR2I( bbox.GetLeft() + margin, bbox.GetBottom() - margin ); + return pos; }