diff --git a/eeschema/dialogs/dialog_lib_textbox_properties.cpp b/eeschema/dialogs/dialog_lib_textbox_properties.cpp index 8b2fbb95a5..9f61e7ba4f 100644 --- a/eeschema/dialogs/dialog_lib_textbox_properties.cpp +++ b/eeschema/dialogs/dialog_lib_textbox_properties.cpp @@ -25,15 +25,16 @@ #include #include #include +#include #include #include +#include #include #include #include #include #include #include -#include #include "symbol_editor_drawing_tools.h" DIALOG_LIB_TEXTBOX_PROPERTIES::DIALOG_LIB_TEXTBOX_PROPERTIES( SYMBOL_EDIT_FRAME* aParent, @@ -46,7 +47,11 @@ DIALOG_LIB_TEXTBOX_PROPERTIES::DIALOG_LIB_TEXTBOX_PROPERTIES( SYMBOL_EDIT_FRAME* m_scintillaTricks( nullptr ), m_helpWindow( nullptr ) { + COLOR_SETTINGS* colorSettings = m_frame->GetColorSettings(); + COLOR4D schematicBackground = colorSettings->GetColor( LAYER_SCHEMATIC_BACKGROUND ); + m_borderColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED ); + m_borderColorSwatch->SetSwatchBackground( schematicBackground ); for( const std::pair& typeEntry : lineTypeNames ) m_borderStyleCombo->Append( typeEntry.second.name, KiBitmap( typeEntry.second.bitmap ) ); @@ -54,6 +59,7 @@ DIALOG_LIB_TEXTBOX_PROPERTIES::DIALOG_LIB_TEXTBOX_PROPERTIES( SYMBOL_EDIT_FRAME* m_borderStyleCombo->Append( DEFAULT_STYLE ); m_fillColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED ); + m_fillColorSwatch->SetSwatchBackground( schematicBackground ); m_textCtrl->SetEOLMode( wxSTC_EOL_LF ); @@ -65,6 +71,9 @@ DIALOG_LIB_TEXTBOX_PROPERTIES::DIALOG_LIB_TEXTBOX_PROPERTIES( SYMBOL_EDIT_FRAME* m_textEntrySizer->AddGrowableRow( 0 ); + m_textColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED ); + m_textColorSwatch->SetSwatchBackground( schematicBackground ); + SetInitialFocus( m_textCtrl ); m_separator1->SetIsSeparator(); @@ -124,6 +133,7 @@ bool DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataToWindow() m_fontCtrl->SetFontSelection( m_currentText->GetFont() ); m_textSize.SetValue( m_currentText->GetTextWidth() ); + m_textColorSwatch->SetSwatchColor( m_currentText->GetTextColor(), false ); m_bold->Check( m_currentText->IsBold() ); m_italic->Check( m_currentText->IsItalic() ); @@ -240,6 +250,7 @@ bool DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataFromWindow() } m_currentText->SetItalic( m_italic->IsChecked() ); + m_currentText->SetTextColor( m_textColorSwatch->GetSwatchColor() ); if( m_spin0->IsChecked() ) { diff --git a/eeschema/dialogs/dialog_lib_textbox_properties_base.cpp b/eeschema/dialogs/dialog_lib_textbox_properties_base.cpp index e4000a660e..f950f57b5b 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 3.10.0-39-g3487c3cb) +// C++ code generated with wxFormBuilder (version Oct 26 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -38,7 +38,6 @@ 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 ); @@ -148,12 +147,38 @@ DIALOG_LIB_TEXTBOX_PROPERTIES_BASE::DIALOG_LIB_TEXTBOX_PROPERTIES_BASE( wxWindow m_textSizeLabel->Wrap( -1 ); m_textEntrySizer->Add( m_textSizeLabel, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 ); - m_textSizeCtrl = new wxTextCtrl( this, wxID_SIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_textEntrySizer->Add( m_textSizeCtrl, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + wxBoxSizer* bSizer71; + bSizer71 = new wxBoxSizer( wxHORIZONTAL ); + + m_textSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), 0 ); + bSizer71->Add( m_textSizeCtrl, 0, wxALIGN_CENTER_VERTICAL, 5 ); m_textSizeUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 ); m_textSizeUnits->Wrap( -1 ); - m_textEntrySizer->Add( m_textSizeUnits, wxGBPosition( 2, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 ); + bSizer71->Add( m_textSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 3 ); + + m_textColorLabel = new wxStaticText( this, wxID_ANY, _("Color:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_textColorLabel->Wrap( -1 ); + bSizer71->Add( m_textColorLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 15 ); + + + bSizer71->Add( 5, 0, 0, 0, 5 ); + + m_panelBorderColor1 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE|wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer221; + bSizer221 = new wxBoxSizer( wxVERTICAL ); + + m_textColorSwatch = new COLOR_SWATCH( m_panelBorderColor1, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + bSizer221->Add( m_textColorSwatch, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + + m_panelBorderColor1->SetSizer( bSizer221 ); + m_panelBorderColor1->Layout(); + bSizer221->Fit( m_panelBorderColor1 ); + bSizer71->Add( m_panelBorderColor1, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + + m_textEntrySizer->Add( bSizer71, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 ); m_textEntrySizer->Add( 0, 15, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 ); diff --git a/eeschema/dialogs/dialog_lib_textbox_properties_base.fbp b/eeschema/dialogs/dialog_lib_textbox_properties_base.fbp index 0e058ab19a..25f6597095 100644 --- a/eeschema/dialogs/dialog_lib_textbox_properties_base.fbp +++ b/eeschema/dialogs/dialog_lib_textbox_properties_base.fbp @@ -14,7 +14,6 @@ dialog_lib_textbox_properties_base 1000 none - 1 dialog_lib_textbox_properties_base @@ -26,7 +25,6 @@ 1 1 UI - 0 1 0 @@ -52,7 +50,6 @@ DIALOG_SHIM; dialog_shim.h Text Box Properties - 0 @@ -193,7 +190,6 @@ protected 1 - 0 Resizable 1 @@ -367,7 +363,6 @@ - 0 @@ -440,7 +435,6 @@ - 0 @@ -513,7 +507,6 @@ - 0 @@ -586,7 +579,6 @@ - 0 @@ -659,7 +651,6 @@ - 0 @@ -732,7 +723,6 @@ - 0 @@ -805,7 +795,6 @@ - 0 @@ -878,7 +867,6 @@ - 0 @@ -951,7 +939,6 @@ - 0 @@ -1024,7 +1011,6 @@ - 0 @@ -1097,7 +1083,6 @@ - 0 @@ -1305,131 +1290,335 @@ 5 1 1 - wxALIGN_CENTER_VERTICAL|wxEXPAND + wxEXPAND 2 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_SIZE - - 0 - - - - 0 + - 1 - m_textSizeCtrl - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - 5 - 1 - 2 - wxALIGN_CENTER_VERTICAL - 2 - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - mm - 0 - - 0 - - - 0 - - 1 - m_textSizeUnits - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 + bSizer71 + wxHORIZONTAL + none + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + -1,-1 + 0 + -1,-1 + 1 + m_textSizeCtrl + 1 + + + protected + 1 + + Resizable + 1 + -1,-1 + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 3 + wxALIGN_CENTER_VERTICAL|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + mm + 0 + + 0 + + + 0 + -1,-1 + 1 + m_textSizeUnits + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 15 + wxALIGN_CENTER_VERTICAL|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Color: + 0 + + 0 + + + 0 + + 1 + m_textColorLabel + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; Not forward_declare + 0 + + + + + -1 + + + + 5 + + 0 + + 0 + protected + 5 + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_panelBorderColor1 + 1 + + + protected + 1 + + Resizable + 1 + + ; ; forward_declare + 0 + + + + wxBORDER_SIMPLE|wxTAB_TRAVERSAL + + + bSizer221 + wxVERTICAL + none + + 5 + wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + COLOR_SWATCH + 1 + + + 1 + + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + + 0 + + + 0 + + 1 + m_textColorSwatch + 1 + + + protected + 1 + + Resizable + + 1 + + COLOR_SWATCH; widgets/color_swatch.h; forward_declare + 0 + + + + + + + + + diff --git a/eeschema/dialogs/dialog_lib_textbox_properties_base.h b/eeschema/dialogs/dialog_lib_textbox_properties_base.h index 8126651a28..f1183a6a4e 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 3.10.0-39-g3487c3cb) +// C++ code generated with wxFormBuilder (version Oct 26 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -31,8 +31,8 @@ class FONT_CHOICE; #include #include #include -#include #include +#include #include #include #include @@ -48,11 +48,6 @@ class DIALOG_LIB_TEXTBOX_PROPERTIES_BASE : public DIALOG_SHIM private: protected: - enum - { - wxID_SIZE = 1000 - }; - wxGridBagSizer* m_textEntrySizer; wxStaticText* m_textLabel; wxStyledTextCtrl* m_textCtrl; @@ -73,6 +68,9 @@ class DIALOG_LIB_TEXTBOX_PROPERTIES_BASE : public DIALOG_SHIM wxStaticText* m_textSizeLabel; wxTextCtrl* m_textSizeCtrl; wxStaticText* m_textSizeUnits; + wxStaticText* m_textColorLabel; + wxPanel* m_panelBorderColor1; + COLOR_SWATCH* m_textColorSwatch; wxCheckBox* m_borderCheckbox; wxStaticText* m_borderWidthLabel; wxTextCtrl* m_borderWidthCtrl; @@ -94,7 +92,7 @@ class DIALOG_LIB_TEXTBOX_PROPERTIES_BASE : public DIALOG_SHIM wxButton* m_sdbSizer1OK; wxButton* m_sdbSizer1Cancel; - // Virtual event handlers, override them in your derived class + // Virtual event handlers, overide 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(); } @@ -104,7 +102,6 @@ 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.h b/eeschema/dialogs/dialog_text_properties.h index 28f4cfc18b..eb055bd5d4 100644 --- a/eeschema/dialogs/dialog_text_properties.h +++ b/eeschema/dialogs/dialog_text_properties.h @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2020-2022 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -46,7 +46,6 @@ private: void onSpinButton( wxCommandEvent &aEvent ); void onBorderChecked( wxCommandEvent& event ) override; void onFillChecked( wxCommandEvent& event ) override; - void onFillSwatch( wxCommandEvent& aEvent ); void OnFormattingHelp( wxHyperlinkEvent& aEvent ) override; void onMultiLineTCLostFocus( wxFocusEvent& event ) override;