58 bool multiLine =
false;
61 multiLine = cfg->m_Appearance.edit_label_multiple;
72 m_activeTextEntry = m_valueCombo;
73 SetInitialFocus( m_valueCombo->GetTextCtrl() );
75 m_labelSingleLine->Show( false );
76 m_valueSingleLine->Show( false );
78 if( multiLine && aNew )
80 m_activeTextEntry = m_valueMultiLine;
81 SetInitialFocus( m_valueMultiLine );
82 m_labelCombo->Show( false );
83 m_valueCombo->Show( false );
87 m_labelMultiLine->Show( false );
88 m_valueMultiLine->Show( false );
89 m_valueCombo->SetValidator( m_netNameValidator );
94 m_activeTextEntry = m_valueSingleLine;
95 SetInitialFocus( m_valueSingleLine );
97 m_labelCombo->Show( false );
98 m_valueCombo->Show( false );
100 if( multiLine && aNew )
102 m_activeTextEntry = m_valueMultiLine;
103 SetInitialFocus( m_valueMultiLine );
104 m_labelSingleLine->Show( false );
105 m_valueSingleLine->Show( false );
109 m_labelMultiLine->Show( false );
110 m_valueMultiLine->Show( false );
111 m_valueSingleLine->SetValidator( m_netNameValidator );
116 SetInitialFocus( m_grid );
117 m_delayedFocusRow = 0;
119 m_labelSingleLine->Show( false );
120 m_valueSingleLine->Show( false );
121 m_labelCombo->Show( false );
122 m_valueCombo->Show( false );
123 m_syntaxHelp->Show( false );
124 m_textEntrySizer->Show( false );
125 m_labelCombo->Show( false );
126 m_valueCombo->Show( false );
127 m_cbMultiLine->Show( false );
129 m_textSizeLabel->SetLabel( _(
"Pin length:" ) );
133 m_cbMultiLine->Show(
false );
135 switch( m_currentLabel->Type() )
137 case SCH_GLOBAL_LABEL_T: SetTitle( _(
"Global Label Properties" ) ); break;
138 case SCH_HIER_LABEL_T: SetTitle( _(
"Hierarchical Label Properties" ) ); break;
139 case SCH_LABEL_T: SetTitle( _(
"Label Properties" ) ); break;
140 case SCH_DIRECTIVE_LABEL_T: SetTitle( _(
"Directive Label Properties" ) ); break;
141 case SCH_SHEET_PIN_T: SetTitle( _(
"Hierarchical Sheet Pin Properties" ) ); break;
142 default: UNIMPLEMENTED_FOR( m_currentLabel->GetClass() ); break;
145 m_grid->SetTable( m_fields );
147 [&]( wxCommandEvent& aEvent )
149 OnAddField( aEvent );
151 m_grid->SetSelectionMode( wxGrid::wxGridSelectRows );
156 m_grid->ShowHideColumns( cfg->m_Appearance.edit_label_visible_columns );
157 m_shownColumns = m_grid->GetShownColumns();
166 m_separator1->SetIsSeparator();
168 m_bold->SetIsCheckButton();
170 m_italic->SetIsCheckButton();
173 m_separator2->SetIsSeparator();
175 m_spin0->SetIsRadioButton();
176 m_spin1->SetIsRadioButton();
177 m_spin2->SetIsRadioButton();
178 m_spin3->SetIsRadioButton();
180 m_separator3->SetIsSeparator();
183 m_textColorSwatch->SetSwatchBackground( schematicBackground );
193 m_spin0->SetBitmap( KiBitmapBundle( BITMAPS::label_align_left ) );
194 m_spin1->SetBitmap( KiBitmapBundle( BITMAPS::label_align_right ) );
195 m_spin2->SetBitmap( KiBitmapBundle( BITMAPS::label_align_bottom ) );
196 m_spin3->SetBitmap( KiBitmapBundle( BITMAPS::label_align_top ) );
202 m_bidirectional->Hide();
206 m_fontLabel->SetLabel( _(
"Orientation:" ) );
208 m_separator1->Hide();
211 m_separator2->Hide();
212 m_spin0->SetBitmap( KiBitmapBundle( BITMAPS::pinorient_down ) );
213 m_spin1->SetBitmap( KiBitmapBundle( BITMAPS::pinorient_up ) );
214 m_spin2->SetBitmap( KiBitmapBundle( BITMAPS::pinorient_right ) );
215 m_spin3->SetBitmap( KiBitmapBundle( BITMAPS::pinorient_left ) );
216 m_separator3->Hide();
218 m_formattingGB->Detach( m_fontCtrl );
219 m_formattingGB->Detach( m_iconBar );
220 m_formattingGB->Add( m_iconBar, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxEXPAND | wxRIGHT, 5 );
224 m_shapeSizer->Show( false );
226 m_spin0->SetBitmap( KiBitmapBundle( BITMAPS::text_align_left ) );
227 m_spin1->SetBitmap( KiBitmapBundle( BITMAPS::text_align_right ) );
228 m_spin2->SetBitmap( KiBitmapBundle( BITMAPS::text_align_bottom ) );
229 m_spin3->SetBitmap( KiBitmapBundle( BITMAPS::text_align_top ) );
232 if( !m_currentLabel->AutoRotateOnPlacementSupported() )
234 m_autoRotate->Hide();
235 wxSizer* parentSizer = m_autoRotate->GetContainingSizer();
236 parentSizer->Detach( m_autoRotate );
237 parentSizer->Layout();
240 SetupStandardButtons();
244 m_hash_key =
TO_UTF8( GetTitle() );
252 finishDialogSettings();
256 if( cfg->m_Appearance.edit_label_width > 0 && cfg->m_Appearance.edit_label_height > 0 )
257 SetSize( cfg->m_Appearance.edit_label_width, cfg->m_Appearance.edit_label_height );
285 if( !wxDialog::TransferDataToWindow() )
302 std::set<wxString> existingLabels;
303 std::vector<std::shared_ptr<BUS_ALIAS>> busAliases;
349 auto& sheetAliases = screen->GetBusAliases();
350 busAliases.insert( busAliases.end(), sheetAliases.begin(), sheetAliases.end() );
354 for(
const std::shared_ptr<BUS_ALIAS>& busAlias : busAliases )
355 existingLabels.insert( wxT(
"{" ) + busAlias->GetName() + wxT(
"}" ) );
357 for(
const wxString& label : existingLabels )
380 wxGridTableMessage msg(
m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, (
int)
m_fields->size() );
381 m_grid->ProcessTableMessage( msg );
505 if( !
m_grid->CommitPendingChanges() )
508 if( !wxDialog::TransferDataFromWindow() )
534 text.Replace( wxS(
"\r" ), wxS(
"\n" ) );
551 if( field.GetCanonicalName() == wxT(
"Netclass" ) )
557 if( field.IsVisible() !=
m_Parent->Schematic().Settings().m_IntersheetRefsShow )
559 DisplayInfoMessage(
this,
_(
"Intersheet reference visibility is controlled globally from "
560 "Schematic Setup > General > Formatting" ) );
574 for(
int ii =
m_fields->GetNumberRows() - 1; ii >= 0; ii-- )
578 const wxString& fieldText = field.
GetText();
580 if( fieldName.IsEmpty() && fieldText.IsEmpty() )
585 else if( fieldName == wxT(
"Netclass" ) && fieldText.IsEmpty() )
588 int netclassFieldCount = 0;
590 for(
int jj = 0; jj <
m_fields->GetNumberRows(); ++jj )
592 if(
m_fields->at( jj ).GetCanonicalName() == wxT(
"Netclass" ) )
593 netclassFieldCount++;
596 if( netclassFieldCount > 1 )
599 else if( fieldName.IsEmpty() )
610 if( !field.IsMandatory() )
611 field.SetOrdinal( ordinal++ );
669 if( !commit.
Empty() )
671 commit.
Push(
_(
"Edit Label Properties" ) );
677 text.Replace( wxS(
"\r" ), wxS(
"\n" ) );
678 wxArrayString lines = wxSplit(
text,
'\n' );
680 for(
const wxString& line : lines )
683 text.Trim(
false ).Trim(
true );
697 m_labelList->push_back( std::unique_ptr<SCH_LABEL_BASE>( label ) );
704 m_labelList->push_back( std::unique_ptr<SCH_LABEL_BASE>( label ) );
711 m_labelList->push_back( std::unique_ptr<SCH_LABEL_BASE>( label ) );
722 m_labelList->push_back( std::unique_ptr<SCH_LABEL_BASE>( label ) );
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
virtual const wxString & GetText() const
Return the string associated with the text object.
void SetAttributes(const EDA_TEXT &aSrc, bool aSetPosition=true)
Set the text attributes from another instance.
void SetItalic(bool aItalic)
Set the text to be italic - this will also update the font if needed.
static HTML_MESSAGE_BOX * ShowSyntaxHelp(wxWindow *aParentWindow)