Bring symbol editor in line with eeschema for empty text.

Fixes https://gitlab.com/kicad/code/kicad/issues/11799

(cherry picked from commit d07c6699ce)
This commit is contained in:
Jeff Young 2022-07-11 03:37:06 +01:00
parent 6e10a496ef
commit ccb416eead
1 changed files with 8 additions and 2 deletions

View File

@ -28,7 +28,7 @@
#include <dialog_lib_text_properties.h>
#include <symbol_editor/symbol_editor_settings.h>
#include <tools/symbol_editor_drawing_tools.h>
#include "confirm.h"
DIALOG_LIB_TEXT_PROPERTIES::DIALOG_LIB_TEXT_PROPERTIES( SYMBOL_EDIT_FRAME* aParent,
LIB_TEXT* aText ) :
@ -116,9 +116,15 @@ bool DIALOG_LIB_TEXT_PROPERTIES::TransferDataFromWindow()
if( m_graphicText )
{
if( m_TextCtrl->GetValue().IsEmpty() )
m_graphicText->SetText( wxT( "[null]" ) );
{
// Other text items do not have defined extents, and so will disappear if empty
DisplayError( this, _( "Text can not be empty." ) );
return false;
}
else
{
m_graphicText->SetText( m_TextCtrl->GetValue() );
}
m_graphicText->SetPosition( wxPoint( m_posX.GetValue(), m_posY.GetValue() ) );