Minor cleanup.

This commit is contained in:
Jeff Young 2021-01-01 23:42:44 +00:00
parent 8a049cf290
commit 419d8dcd6f
1 changed files with 11 additions and 16 deletions

View File

@ -93,8 +93,7 @@ DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, BO
SetInitialFocus( m_MultiLineText ); SetInitialFocus( m_MultiLineText );
m_SingleLineSizer->Show( false ); m_SingleLineSizer->Show( false );
// This option make sense only for footprint texts, // This option make sense only for footprint texts; texts on board are always visible.
// Texts on board are always visible:
m_Visible->SetValue( true ); m_Visible->SetValue( true );
m_Visible->Show( false ); m_Visible->Show( false );
@ -118,8 +117,8 @@ DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, BO
m_orientation.SetUnits( EDA_UNITS::DEGREES ); m_orientation.SetUnits( EDA_UNITS::DEGREES );
m_orientation.SetPrecision( 3 ); m_orientation.SetPrecision( 3 );
// Set predefined rotations in combo dropdown, according to the locale // Set predefined rotations in combo dropdown, according to the locale floating point
// floating point separator notation // separator notation
double rot_list[] = { 0.0, 90.0, -90.0, 180.0 }; double rot_list[] = { 0.0, 90.0, -90.0, 180.0 };
for( size_t ii = 0; ii < m_OrientCtrl->GetCount() && ii < 4; ++ii ) for( size_t ii = 0; ii < m_OrientCtrl->GetCount() && ii < 4; ++ii )
@ -319,7 +318,9 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow()
if( !m_textWidth.Validate( TEXTS_MIN_SIZE, TEXTS_MAX_SIZE ) if( !m_textWidth.Validate( TEXTS_MIN_SIZE, TEXTS_MAX_SIZE )
|| !m_textHeight.Validate( TEXTS_MIN_SIZE, TEXTS_MAX_SIZE ) ) || !m_textHeight.Validate( TEXTS_MIN_SIZE, TEXTS_MAX_SIZE ) )
{
return false; return false;
}
BOARD_COMMIT commit( m_Parent ); BOARD_COMMIT commit( m_Parent );
commit.Modify( m_item ); commit.Modify( m_item );
@ -328,10 +329,8 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow()
// (for a command in progress, will be made later, at the completion of command) // (for a command in progress, will be made later, at the completion of command)
bool pushCommit = ( m_item->GetEditFlags() == 0 ); bool pushCommit = ( m_item->GetEditFlags() == 0 );
/* set flag in edit to force undo/redo/abort proper operation, // Set IN_EDIT flag to force undo/redo/abort proper operation and avoid new calls to
* and avoid new calls to SaveCopyInUndoList for the same text // SaveCopyInUndoList for the same text if is moved, and then rotated, edited, etc....
* this can occurs when a text is moved, and then rotated, edited ..
*/
if( !pushCommit ) if( !pushCommit )
m_item->SetFlags( IN_EDIT ); m_item->SetFlags( IN_EDIT );
@ -346,17 +345,14 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow()
if( !m_MultiLineText->GetValue().IsEmpty() ) if( !m_MultiLineText->GetValue().IsEmpty() )
{ {
BOARD* board = m_Parent->GetBoard(); BOARD* board = m_Parent->GetBoard();
wxString txt = EscapeString( wxString txt = board->ConvertCrossReferencesToKIIDs( m_MultiLineText->GetValue() );
board->ConvertCrossReferencesToKIIDs( m_MultiLineText->GetValue() ),
CTX_QUOTED_STR );
// On Windows, a new line is coded as \r\n.
// We use only \n in kicad files and in drawing routines.
// so strip the \r char
#ifdef __WINDOWS__ #ifdef __WINDOWS__
// On Windows, a new line is coded as \r\n. We use only \n in kicad files and in
// drawing routines so strip the \r char.
txt.Replace( "\r", "" ); txt.Replace( "\r", "" );
#endif #endif
m_edaText->SetText( txt ); m_edaText->SetText( EscapeString( txt, CTX_QUOTED_STR ) );
} }
} }
@ -396,7 +392,6 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow()
default: break; default: break;
} }
if( pushCommit ) if( pushCommit )
commit.Push( _( "Change text properties" ) ); commit.Push( _( "Change text properties" ) );