From e80c5a4e4ec5e85960e937910b71d8db3fd06d42 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 3 May 2022 22:55:35 +0100 Subject: [PATCH] Add text colour to Edit Text & Graphics Properties. Fixes https://gitlab.com/kicad/code/kicad/issues/11459 --- .../dialog_global_edit_text_and_graphics.cpp | 5 + ...log_global_edit_text_and_graphics_base.cpp | 9 +- ...log_global_edit_text_and_graphics_base.fbp | 126 ++++++++++++++++-- ...ialog_global_edit_text_and_graphics_base.h | 2 + 4 files changed, 129 insertions(+), 13 deletions(-) diff --git a/eeschema/dialogs/dialog_global_edit_text_and_graphics.cpp b/eeschema/dialogs/dialog_global_edit_text_and_graphics.cpp index 4cbb3f517d..ec215f2ab8 100644 --- a/eeschema/dialogs/dialog_global_edit_text_and_graphics.cpp +++ b/eeschema/dialogs/dialog_global_edit_text_and_graphics.cpp @@ -126,6 +126,8 @@ DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS( SCH_ m_lineStyle->Append( DEFAULT_STYLE ); m_lineStyle->Append( INDETERMINATE_ACTION ); + m_textColorSwatch->SetSwatchColor( COLOR4D::UNSPECIFIED, false ); + m_textColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED ); m_colorSwatch->SetSwatchColor( COLOR4D::UNSPECIFIED, false ); m_colorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED ); m_fillColorSwatch->SetSwatchColor( COLOR4D::UNSPECIFIED, false ); @@ -260,6 +262,9 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem( const SCH_SHEET_PATH& aS if( !m_textSize.IsIndeterminate() ) eda_text->SetTextSize( wxSize( m_textSize.GetValue(), m_textSize.GetValue() ) ); + if( m_setTextColor->GetValue() ) + eda_text->SetTextColor( m_textColorSwatch->GetSwatchColor() ); + if( m_hAlign->GetStringSelection() != INDETERMINATE_ACTION ) eda_text->SetHorizJustify( EDA_TEXT::MapHorizJustify( m_hAlign->GetSelection() - 1 ) ); diff --git a/eeschema/dialogs/dialog_global_edit_text_and_graphics_base.cpp b/eeschema/dialogs/dialog_global_edit_text_and_graphics_base.cpp index 7e7753fb97..b0e2f104ef 100644 --- a/eeschema/dialogs/dialog_global_edit_text_and_graphics_base.cpp +++ b/eeschema/dialogs/dialog_global_edit_text_and_graphics_base.cpp @@ -182,11 +182,14 @@ DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_ fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 ); + m_setTextColor = new wxCheckBox( m_specifiedValues, wxID_ANY, _("Text color:"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer1->Add( m_setTextColor, 0, wxALL, 5 ); - fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 ); + m_textColorSwatch = new COLOR_SWATCH( m_specifiedValues, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + m_textColorSwatch->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); + m_textColorSwatch->SetMinSize( wxSize( 48,24 ) ); - - fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 ); + fgSizer1->Add( m_textColorSwatch, 0, wxALL, 5 ); m_textSizeLabel = new wxStaticText( m_specifiedValues, wxID_ANY, _("Text size:"), wxDefaultPosition, wxDefaultSize, 0 ); m_textSizeLabel->Wrap( -1 ); diff --git a/eeschema/dialogs/dialog_global_edit_text_and_graphics_base.fbp b/eeschema/dialogs/dialog_global_edit_text_and_graphics_base.fbp index 224a2b5504..5ad9bc8d5c 100644 --- a/eeschema/dialogs/dialog_global_edit_text_and_graphics_base.fbp +++ b/eeschema/dialogs/dialog_global_edit_text_and_graphics_base.fbp @@ -1938,22 +1938,128 @@ 5 - wxEXPAND - 1 - - 0 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Text color: + + 0 + + + 0 + + 1 + m_setTextColor + 1 + + protected - 0 + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + 5 - wxEXPAND - 1 - - 0 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + COLOR_SWATCH + 1 + + + 1 + + 0 + Dock + 0 + Left + 1 + wxSYS_COLOUR_WINDOW + 1 + + 0 + 0 + wxID_ANY + + + 0 + + + 0 + 48,24 + 1 + m_textColorSwatch + 1 + + protected - 0 + 1 + + Resizable + + 1 + + COLOR_SWATCH; widgets/color_swatch.h; Not forward_declare + 0 + + + + diff --git a/eeschema/dialogs/dialog_global_edit_text_and_graphics_base.h b/eeschema/dialogs/dialog_global_edit_text_and_graphics_base.h index e85892e263..80db228cc4 100644 --- a/eeschema/dialogs/dialog_global_edit_text_and_graphics_base.h +++ b/eeschema/dialogs/dialog_global_edit_text_and_graphics_base.h @@ -67,6 +67,8 @@ class DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE : public DIALOG_SHIM wxPanel* m_specifiedValues; wxStaticText* m_fontLabel; FONT_CHOICE* m_fontCtrl; + wxCheckBox* m_setTextColor; + COLOR_SWATCH* m_textColorSwatch; wxStaticText* m_textSizeLabel; wxTextCtrl* m_textSizeCtrl; wxStaticText* m_textSizeUnits;