Default common-to-all-units based on last-used setting.

(Or whether or not the symbol has interchangeable units when a new
symbol is loaded.)

Fixes https://gitlab.com/kicad/code/kicad/issues/13391
This commit is contained in:
Jeff Young 2023-01-06 00:32:25 +00:00
parent 126225866b
commit 98f0959f39
3 changed files with 14 additions and 1 deletions

View File

@ -41,7 +41,8 @@ LIB_TEXT::LIB_TEXT( LIB_SYMBOL* aParent ) :
LIB_ITEM( LIB_TEXT_T, aParent ),
EDA_TEXT( schIUScale, wxEmptyString )
{
SetTextSize( wxSize( schIUScale.MilsToIU( DEFAULT_TEXT_SIZE ), schIUScale.MilsToIU( DEFAULT_TEXT_SIZE ) ) );
SetTextSize( wxSize( schIUScale.MilsToIU( DEFAULT_TEXT_SIZE ),
schIUScale.MilsToIU( DEFAULT_TEXT_SIZE ) ) );
}

View File

@ -1428,6 +1428,12 @@ void SYMBOL_EDIT_FRAME::LoadSymbolFromSchematic( SCH_SYMBOL* aSymbol )
m_unit = std::max( 1, aSymbol->GetUnit() );
m_convert = std::max( 1, aSymbol->GetConvert() );
// Optimize default edit options for this symbol
// Usually if units are locked, graphic items are specific to each unit
// and if units are interchangeable, graphic items are common to units
SYMBOL_EDITOR_DRAWING_TOOLS* tools = GetToolManager()->GetTool<SYMBOL_EDITOR_DRAWING_TOOLS>();
tools->SetDrawSpecificUnit( symbol->UnitsLocked() );
// The buffered screen for the symbol
SCH_SCREEN* tmpScreen = new SCH_SCREEN();

View File

@ -215,6 +215,12 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
{
LIB_TEXT* text = new LIB_TEXT( symbol );
if( m_drawSpecificUnit )
text->SetUnit( m_frame->GetUnit() );
if( m_drawSpecificConvert )
text->SetConvert( m_frame->GetConvert() );
text->SetPosition( VECTOR2I( cursorPos.x, -cursorPos.y ) );
text->SetTextSize( wxSize( schIUScale.MilsToIU( settings->m_Defaults.text_size ),
schIUScale.MilsToIU( settings->m_Defaults.text_size ) ) );