From c55a0e4561a84a18821a7e24a19e30ad5ab7d71d Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 8 Jun 2022 10:32:45 +0100 Subject: [PATCH] Separate last-created-params for textboxes from shapes. Fixes https://gitlab.com/kicad/code/kicad/issues/11755 --- eeschema/tools/sch_drawing_tools.cpp | 26 ++++++++++++++++++-------- eeschema/tools/sch_drawing_tools.h | 3 +++ 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/eeschema/tools/sch_drawing_tools.cpp b/eeschema/tools/sch_drawing_tools.cpp index 544acf5d40..118245a255 100644 --- a/eeschema/tools/sch_drawing_tools.cpp +++ b/eeschema/tools/sch_drawing_tools.cpp @@ -69,8 +69,11 @@ SCH_DRAWING_TOOLS::SCH_DRAWING_TOOLS() : m_lastTextAngle( ANGLE_0 ), m_lastTextJust( GR_TEXT_H_ALIGN_LEFT ), m_lastFillStyle( FILL_T::NO_FILL ), + m_lastTextboxFillStyle( FILL_T::NO_FILL ), m_lastFillColor( COLOR4D::UNSPECIFIED ), + m_lastTextboxFillColor( COLOR4D::UNSPECIFIED ), m_lastStroke( 0, PLOT_DASH_TYPE::DEFAULT, COLOR4D::UNSPECIFIED ), + m_lastTextboxStroke( 0, PLOT_DASH_TYPE::DEFAULT, COLOR4D::UNSPECIFIED ), m_mruPath( wxEmptyString ), m_inPlaceSymbol( false ), m_inDrawShape( false ), @@ -1499,7 +1502,7 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent ) if( isTextBox ) { - SCH_TEXTBOX* textbox = new SCH_TEXTBOX( 0, m_lastFillStyle ); + SCH_TEXTBOX* textbox = new SCH_TEXTBOX( 0, m_lastTextboxFillStyle ); textbox->SetBold( m_lastTextBold ); textbox->SetItalic( m_lastTextItalic ); @@ -1507,16 +1510,18 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent ) sch_settings.m_DefaultTextSize ) ); textbox->SetTextAngle( m_lastTextAngle ); textbox->SetHorizJustify( m_lastTextJust ); + textbox->SetStroke( m_lastTextboxStroke ); + textbox->SetFillColor( m_lastTextboxFillColor ); item = textbox; } else { item = new SCH_SHAPE( type, 0, m_lastFillStyle ); - } - item->SetStroke( m_lastStroke ); - item->SetFillColor( m_lastFillColor ); + item->SetStroke( m_lastStroke ); + item->SetFillColor( m_lastFillColor ); + } item->SetFlags( IS_NEW ); item->BeginEdit( (wxPoint) cursorPos ); @@ -1551,11 +1556,16 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent ) m_lastTextItalic = textbox->IsItalic(); m_lastTextAngle = textbox->GetTextAngle(); m_lastTextJust = textbox->GetHorizJustify(); + m_lastTextboxStroke = textbox->GetStroke(); + m_lastTextboxFillStyle = textbox->GetFillMode(); + m_lastTextboxFillColor = textbox->GetFillColor(); + } + else + { + m_lastStroke = item->GetStroke(); + m_lastFillStyle = item->GetFillMode(); + m_lastFillColor = item->GetFillColor(); } - - m_lastStroke = item->GetStroke(); - m_lastFillStyle = item->GetFillMode(); - m_lastFillColor = item->GetFillColor(); m_frame->AddItemToScreenAndUndoList( m_frame->GetScreen(), item, false ); m_selectionTool->AddItemToSel( item ); diff --git a/eeschema/tools/sch_drawing_tools.h b/eeschema/tools/sch_drawing_tools.h index 6d5e27eff8..c668340392 100644 --- a/eeschema/tools/sch_drawing_tools.h +++ b/eeschema/tools/sch_drawing_tools.h @@ -93,8 +93,11 @@ private: EDA_ANGLE m_lastTextAngle; GR_TEXT_H_ALIGN_T m_lastTextJust; FILL_T m_lastFillStyle; + FILL_T m_lastTextboxFillStyle; COLOR4D m_lastFillColor; + COLOR4D m_lastTextboxFillColor; STROKE_PARAMS m_lastStroke; + STROKE_PARAMS m_lastTextboxStroke; wxString m_mruPath; ///< Re-entrancy guards