KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_field_properties.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2012 Jean-Pierre Charras, [email protected]
5 * Copyright (C) 2016 Wayne Stambaugh, [email protected]
6 * Copyright (C) 2004-2024 KiCad Developers, see AITHORS.txt for contributors.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, you may find one here:
20 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21 * or you may search the http://www.gnu.org website for the version 2 license,
22 * or you may write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24 */
25
28#include <widgets/font_choice.h>
31#include <bitmaps.h>
32#include <kiway.h>
33#include <kiway_express.h>
34#include <confirm.h>
35#include <common.h>
36#include <string_utils.h>
37#include <sch_edit_frame.h>
38#include <ee_collectors.h>
39#include <sch_symbol.h>
40#include <template_fieldnames.h>
41#include <symbol_library.h>
42#include <sch_validators.h>
43#include <schematic.h>
44#include <sch_commit.h>
46#include <sch_text.h>
47#include <scintilla_tricks.h>
49
50
52 const SCH_FIELD* aField ) :
53 DIALOG_FIELD_PROPERTIES_BASE( aParent, wxID_ANY, aTitle ),
54 m_posX( aParent, m_xPosLabel, m_xPosCtrl, m_xPosUnits, true ),
55 m_posY( aParent, m_yPosLabel, m_yPosCtrl, m_yPosUnits, true ),
56 m_textSize( aParent, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits, true ),
57 m_font( nullptr ),
58 m_firstFocus( true ),
59 m_scintillaTricks( nullptr ),
60 m_field( aField )
61{
62 COLOR_SETTINGS* colorSettings = aParent->GetColorSettings();
63 COLOR4D schematicBackground = colorSettings->GetColor( LAYER_SCHEMATIC_BACKGROUND );
64
65 wxASSERT( m_field );
66
67 m_note->SetFont( KIUI::GetInfoFont( this ).Italic() );
68 m_note->Show( false );
69
70 // The field ID is initialized in the derived object's ctor.
72
73 m_scintillaTricks = new SCINTILLA_TRICKS( m_StyledTextCtrl, wxT( "{}" ), true,
74 // onAcceptFn
75 [this]( wxKeyEvent& aEvent )
76 {
77 wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
78 } );
79
80 m_StyledTextCtrl->SetEOLMode( wxSTC_EOL_LF ); // Normalize EOL across platforms
81
82#ifdef _WIN32
83 // Without this setting, on Windows, some esoteric unicode chars create display issue
84 // in a wxStyledTextCtrl.
85 // for SetTechnology() info, see https://www.scintilla.org/ScintillaDoc.html#SCI_SETTECHNOLOGY
86 m_StyledTextCtrl->SetTechnology(wxSTC_TECHNOLOGY_DIRECTWRITE);
87#endif
88
89 m_textColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
90 m_textColorSwatch->SetSwatchBackground( schematicBackground );
91
93
95 m_horizontal->SetBitmap( KiBitmapBundle( BITMAPS::text_horizontal ) );
97 m_vertical->SetBitmap( KiBitmapBundle( BITMAPS::text_vertical ) );
98
100
102 m_bold->SetBitmap( KiBitmapBundle( BITMAPS::text_bold ) );
104 m_italic->SetBitmap( KiBitmapBundle( BITMAPS::text_italic ) );
105
107
109 m_hAlignLeft->SetBitmap( KiBitmapBundle( BITMAPS::text_align_left ) );
111 m_hAlignCenter->SetBitmap( KiBitmapBundle( BITMAPS::text_align_center ) );
113 m_hAlignRight->SetBitmap( KiBitmapBundle( BITMAPS::text_align_right ) );
114
116
118 m_vAlignTop->SetBitmap( KiBitmapBundle( BITMAPS::text_valign_top ) );
120 m_vAlignCenter->SetBitmap( KiBitmapBundle( BITMAPS::text_valign_center ) );
122 m_vAlignBottom->SetBitmap( KiBitmapBundle( BITMAPS::text_valign_bottom ) );
123
125
126 m_horizontal->Bind( wxEVT_BUTTON, &DIALOG_FIELD_PROPERTIES::onOrientButton, this );
127 m_vertical->Bind( wxEVT_BUTTON, &DIALOG_FIELD_PROPERTIES::onOrientButton, this );
128
129 m_hAlignLeft->Bind( wxEVT_BUTTON, &DIALOG_FIELD_PROPERTIES::onHAlignButton, this );
130 m_hAlignCenter->Bind( wxEVT_BUTTON, &DIALOG_FIELD_PROPERTIES::onHAlignButton, this );
131 m_hAlignRight->Bind( wxEVT_BUTTON, &DIALOG_FIELD_PROPERTIES::onHAlignButton, this );
132
133 m_vAlignTop->Bind( wxEVT_BUTTON, &DIALOG_FIELD_PROPERTIES::onVAlignButton, this );
134 m_vAlignCenter->Bind( wxEVT_BUTTON, &DIALOG_FIELD_PROPERTIES::onVAlignButton, this );
135 m_vAlignBottom->Bind( wxEVT_BUTTON, &DIALOG_FIELD_PROPERTIES::onVAlignButton, this );
136
137 // show text variable cross-references in a human-readable format
138 if( aField->Schematic() )
139 m_text = aField->Schematic()->ConvertKIIDsToRefs( aField->GetText() );
140 else
141 m_text = aField->GetText();
142
144 m_isItalic = aField->IsItalic();
145 m_isBold = aField->IsBold();
146 m_color = aField->GetTextColor();
147 m_position = aField->GetTextPos();
148 m_size = aField->GetTextWidth();
152 m_isVisible = aField->IsVisible();
153
154 m_isSheetFilename = false;
155
156 if( aField->GetParent() && aField->GetParent()->Type() == LIB_SYMBOL_T )
157 {
158 const LIB_SYMBOL* symbol = static_cast<const LIB_SYMBOL*>( aField->GetParentSymbol() );
159
160 /*
161 * Symbol netlist format:
162 * pinNumber pinName <tab> pinNumber pinName...
163 * fpFilter fpFilter...
164 */
165 wxString netlist;
166 wxArrayString pins;
167
168 for( SCH_PIN* pin : symbol->GetPins( 0 /* all units */, 1 /* single bodyStyle */ ) )
169 pins.push_back( pin->GetNumber() + ' ' + pin->GetShownName() );
170
171 if( !pins.IsEmpty() )
172 netlist << EscapeString( wxJoin( pins, '\t' ), CTX_LINE );
173
174 netlist << wxS( "\r" );
175
176 wxArrayString fpFilters = symbol->GetFPFilters();
177
178 if( !fpFilters.IsEmpty() )
179 netlist << EscapeString( wxJoin( fpFilters, ' ' ), CTX_LINE );
180
181 netlist << wxS( "\r" );
182
184 }
185 else if( aField->GetParent() && aField->GetParent()->Type() == SCH_SYMBOL_T )
186 {
187 const SCH_SYMBOL* symbol = static_cast<const SCH_SYMBOL*>( aField->GetParentSymbol() );
188 SCH_SHEET_PATH sheetPath = static_cast<SCH_EDIT_FRAME*>( aParent )->GetCurrentSheet();
189
190 m_fieldId = aField->GetId();
191
192 /*
193 * Symbol netlist format:
194 * pinNumber pinName <tab> pinNumber pinName...
195 * fpFilter fpFilter...
196 */
197 wxString netlist;
198
199 wxArrayString pins;
200
201 for( SCH_PIN* pin : symbol->GetPins( &sheetPath ) )
202 pins.push_back( pin->GetNumber() + ' ' + pin->GetShownName() );
203
204 if( !pins.IsEmpty() )
205 netlist << EscapeString( wxJoin( pins, '\t' ), CTX_LINE );
206
207 netlist << wxS( "\r" );
208
209 wxArrayString fpFilters = symbol->GetLibSymbolRef()->GetFPFilters();
210
211 if( !fpFilters.IsEmpty() )
212 netlist << EscapeString( wxJoin( fpFilters, ' ' ), CTX_LINE );
213
214 netlist << wxS( "\r" );
215
217 }
218 else if( aField->GetParent() && aField->GetParent()->Type() == SCH_SHEET_T )
219 {
220 switch( aField->GetId() )
221 {
222 case SHEETNAME:
224 break;
225
226 case SHEETFILENAME:
227 m_isSheetFilename = true;
229 m_note->SetLabel( wxString::Format( m_note->GetLabel(),
230 _( "Sheet filename can only be modified in Sheet Properties dialog." ) ) );
231 m_note->Show( true );
232 break;
233
234 default:
236 break;
237 }
238 }
239 else if( aField->GetParent() && aField->GetParent()->IsType( { SCH_LABEL_LOCATE_ANY_T } ) )
240 {
242 }
243
244 m_textLabel->SetLabel( aField->GetName() + wxS( ":" ) );
245
247
250
253
254 m_StyledTextCtrl->Bind( wxEVT_STC_CHARADDED,
256 m_StyledTextCtrl->Bind( wxEVT_STC_AUTOCOMP_CHAR_DELETED,
258
259 m_nameVisible->Show();
260 m_cbAllowAutoPlace->Show();
261
262 init();
263
265 {
266 m_StyledTextCtrl->Enable( false );
267 m_TextCtrl->Enable( false );
268 }
269}
270
271
273{
274 delete m_scintillaTricks;
275}
276
277
279{
280 // Disable options for graphic text editing which are not needed for fields.
281 m_commonToAllBodyStyles->Show( false );
282 m_commonToAllUnits->Show( false );
283
284 // Predefined fields cannot contain some chars and cannot be empty, so they need a
285 // SCH_FIELD_VALIDATOR (m_StyledTextCtrl cannot use a SCH_FIELD_VALIDATOR).
291 {
292 m_TextCtrl->SetValidator( FIELD_VALIDATOR( m_fieldId, &m_text ) );
294
295 m_StyledTextCtrl->Show( false );
296 }
297 else
298 {
300
301 m_TextCtrl->Show( false );
302 }
303
304 // Show the footprint selection dialog if this is the footprint field.
305 m_TextValueSelectButton->SetBitmap( KiBitmapBundle( BITMAPS::small_library ) );
307
308 m_TextCtrl->Enable( true );
309
310 GetSizer()->SetSizeHints( this );
311
312 // Adjust the height of the scintilla editor after the first layout to show a single line
313 // (multiline text is not supported in fields and will be removed)
314 if( m_StyledTextCtrl->IsShown() )
315 {
316 wxSize maxSize = m_StyledTextCtrl->GetSize();
317 maxSize.x = -1; // Do not fix the max width
318 maxSize.y = m_xPosCtrl->GetSize().y;
319 m_StyledTextCtrl->SetMaxSize( maxSize );
320 m_StyledTextCtrl->SetUseVerticalScrollBar( false );
321 m_StyledTextCtrl->SetUseHorizontalScrollBar( false );
322 }
323
325
326 // Now all widgets have the size fixed, call FinishDialogSettings
328}
329
330
332{
333 // pick a footprint using the footprint picker.
334 wxString fpid;
335
336 if( m_StyledTextCtrl->IsShown() )
337 fpid = m_StyledTextCtrl->GetValue();
338 else
339 fpid = m_TextCtrl->GetValue();
340
341 if( KIWAY_PLAYER* frame = Kiway().Player( FRAME_FOOTPRINT_CHOOSER, true ) )
342 {
344 frame->KiwayMailIn( event );
345
346 if( frame->ShowModal( &fpid, this ) )
347 {
348 if( m_StyledTextCtrl->IsShown() )
349 m_StyledTextCtrl->SetValue( fpid );
350 else
351 m_TextCtrl->SetValue( fpid );
352 }
353
354 frame->Destroy();
355 }
356}
357
358
360{
361 if( m_firstFocus )
362 {
363#ifdef __WXGTK__
364 // Force an update of the text control before setting the text selection
365 // This is needed because GTK seems to ignore the selection on first update
366 //
367 // Note that we can't do this on OSX as it tends to provoke Apple's
368 // "[NSAlert runModal] may not be invoked inside of transaction begin/commit pair"
369 // bug. See: https://bugs.launchpad.net/kicad/+bug/1837225
371 m_TextCtrl->Update();
372#endif
373
375 KIUI::SelectReferenceNumber( static_cast<wxTextEntry*>( m_TextCtrl ) );
376 else if( m_fieldId == VALUE_FIELD || m_fieldId == SHEETNAME_V )
377 m_TextCtrl->SetSelection( -1, -1 );
378
379 m_firstFocus = false;
380 }
381
382 event.Skip();
383}
384
385
386void DIALOG_FIELD_PROPERTIES::onOrientButton( wxCommandEvent& aEvent )
387{
388 for( BITMAP_BUTTON* btn : { m_horizontal, m_vertical } )
389 {
390 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
391 btn->Check( false );
392 }
393}
394
395
396void DIALOG_FIELD_PROPERTIES::onHAlignButton( wxCommandEvent& aEvent )
397{
399 {
400 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
401 btn->Check( false );
402 }
403}
404
405
406void DIALOG_FIELD_PROPERTIES::onVAlignButton( wxCommandEvent& aEvent )
407{
409 {
410 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
411 btn->Check( false );
412 }
413}
414
415
417{
418 if( m_TextCtrl->IsShown() )
419 {
420 m_TextCtrl->SetValue( EscapeString( m_text, CTX_LINE ) );
421 }
422 else if( m_StyledTextCtrl->IsShown() )
423 {
425 m_StyledTextCtrl->EmptyUndoBuffer();
426 }
427
429
433
436
439
441
443 {
444 case GR_TEXT_H_ALIGN_LEFT: m_hAlignLeft->Check( true ); break;
445 case GR_TEXT_H_ALIGN_CENTER: m_hAlignCenter->Check( true ); break;
446 case GR_TEXT_H_ALIGN_RIGHT: m_hAlignRight->Check( true ); break;
448 }
449
450 switch ( m_verticalJustification )
451 {
452 case GR_TEXT_V_ALIGN_TOP: m_vAlignTop->Check( true ); break;
453 case GR_TEXT_V_ALIGN_CENTER: m_vAlignCenter->Check( true ); break;
454 case GR_TEXT_V_ALIGN_BOTTOM: m_vAlignBottom->Check( true ); break;
456 }
457
458 m_visible->SetValue( m_isVisible );
459 m_nameVisible->SetValue( m_isNameVisible );
461
462 return true;
463}
464
465
467{
468 if( m_TextCtrl->IsShown() )
469 m_text = UnescapeString( m_TextCtrl->GetValue() );
470 else if( m_StyledTextCtrl->IsShown() )
471 m_text = UnescapeString( m_StyledTextCtrl->GetValue() );
472
474 {
475 // Test if the reference string is valid:
477 {
478 DisplayError( this, _( "Illegal reference designator value!" ) );
479 return false;
480 }
481 }
482 else if( m_fieldId == SHEETFILENAME_V )
483 {
485 }
486
489
492
494
498
499 if( m_hAlignLeft->IsChecked() )
501 else if( m_hAlignCenter->IsChecked() )
503 else
505
506 if( m_vAlignTop->IsChecked() )
508 else if( m_vAlignCenter->IsChecked() )
510 else
512
513 m_isVisible = m_visible->GetValue();
514 m_isNameVisible = m_nameVisible->GetValue();
516
517 return true;
518}
519
520
522{
523 if( aText->GetTextWidth() != m_size )
524 aText->SetTextSize( VECTOR2I( m_size, m_size ) );
525
526 aText->SetFont( m_font );
527 aText->SetVisible( m_isVisible );
529 aText->SetItalic( m_isItalic );
530 aText->SetBold( m_isBold );
531 aText->SetTextColor( m_color );
532}
533
534
536{
537 aField->SetText( m_text );
538
539 updateText( aField );
540
541 aField->SetNameShown( m_isNameVisible );
543
546 aField->SetTextPos( m_position );
547}
548
549
550void DIALOG_FIELD_PROPERTIES::onScintillaCharAdded( wxStyledTextEvent &aEvent )
551{
553}
554
555
557 SCH_SHEET_PATH* aSheetPath )
558{
559 SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( GetParent() );
560 SCH_ITEM* parent = dynamic_cast<SCH_ITEM*>( aField->GetParent() );
561 int fieldType = aField->GetId();
562
563 if( parent && parent->Type() == SCH_SYMBOL_T )
564 {
565 SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( parent );
566
567 if( fieldType == REFERENCE_FIELD )
568 symbol->SetRef( aSheetPath, m_text );
569 else if( fieldType == VALUE_FIELD )
570 symbol->SetValueFieldText( m_text );
571 else if( fieldType == FOOTPRINT_FIELD )
572 symbol->SetFootprintFieldText( m_text );
573 }
574 else if( parent && parent->Type() == SCH_GLOBAL_LABEL_T )
575 {
576 if( aField->GetCanonicalName() == wxT( "Intersheetrefs" ) )
577 {
578 if( m_visible->GetValue() != parent->Schematic()->Settings().m_IntersheetRefsShow )
579 {
580 DisplayInfoMessage( this, _( "Intersheet reference visibility is "
581 "controlled globally from "
582 "Schematic Setup > General > Formatting" ) );
583 }
584 }
585 }
586
587 bool positioningModified = false;
588
589 if( aField->GetPosition() != m_position )
590 positioningModified = true;
591
592 if( aField->GetTextAngle().IsVertical() != m_isVertical )
593 positioningModified = true;
594
596 positioningModified = true;
597
599 positioningModified = true;
600
601 // convert any text variable cross-references to their UUIDs
603
604 // Changing a sheetname need to update the hierarchy navigator
605 bool needUpdateHierNav = false;
606
607 if( parent && parent->Type() == SCH_SHEET_T && fieldType == SHEETNAME )
608 needUpdateHierNav = m_text != aField->GetText();
609
610 aField->SetText( m_text );
611 updateText( aField );
612 aField->SetPosition( m_position );
613
614 aField->SetNameShown( m_isNameVisible );
616
617 // Note that we must set justifications before we can ask if they're flipped. If the old
618 // justification is center then it won't know (whereas if the new justification is center
619 // the we don't care).
622
623 if( aField->IsHorizJustifyFlipped() )
625
626 if( aField->IsVertJustifyFlipped() )
628
629 // The value, footprint and datasheet fields should be kept in sync in multi-unit parts.
630 // Of course the symbol must be annotated to collect other units.
631 if( editFrame && parent && parent->Type() == SCH_SYMBOL_T )
632 {
633 SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( parent );
634
635 if( symbol->IsAnnotated( aSheetPath ) && ( fieldType == VALUE_FIELD
636 || fieldType == FOOTPRINT_FIELD
637 || fieldType == DATASHEET_FIELD ) )
638 {
639 wxString ref = symbol->GetRef( aSheetPath );
640 int unit = symbol->GetUnit();
641 LIB_ID libId = symbol->GetLibId();
642
643 for( SCH_SHEET_PATH& sheet : editFrame->Schematic().GetSheets() )
644 {
645 SCH_SCREEN* screen = sheet.LastScreen();
646 std::vector<SCH_SYMBOL*> otherUnits;
647
648 CollectOtherUnits( ref, unit, libId, sheet, &otherUnits );
649
650 for( SCH_SYMBOL* otherUnit : otherUnits )
651 {
652 aCommit->Modify( otherUnit, screen );
653
654 if( fieldType == VALUE_FIELD )
655 otherUnit->SetValueFieldText( m_text );
656 else if( fieldType == FOOTPRINT_FIELD )
657 otherUnit->SetFootprintFieldText( m_text );
658 else
659 otherUnit->GetField( DATASHEET_FIELD )->SetText( m_text );
660
661 editFrame->UpdateItem( otherUnit, false, true );
662 }
663 }
664 }
665 }
666
667 if( positioningModified && parent )
668 parent->ClearFieldsAutoplaced();
669
670 //Update the hierarchy navigator labels if needed
671 if( needUpdateHierNav )
673}
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
Definition: bitmap.cpp:110
A bitmap button widget that behaves like an AUI toolbar item's button when it is drawn.
Definition: bitmap_button.h:42
void SetIsRadioButton()
bool IsChecked() const
void Check(bool aCheck=true)
Check the control.
void SetIsSeparator()
Render button as a toolbar separator.
void SetIsCheckButton()
Setup the control as a two-state button (checked or unchecked).
void SetBitmap(const wxBitmapBundle &aBmp)
Set the bitmap shown when the button is enabled.
Color settings are a bit different than most of the settings objects in that there can be more than o...
COLOR4D GetColor(int aLayer) const
void SetSwatchColor(const KIGFX::COLOR4D &aColor, bool aSendEvent)
Set the current swatch color directly.
KIGFX::COLOR4D GetSwatchColor() const
void SetDefaultColor(const KIGFX::COLOR4D &aColor)
Sets the color that will be chosen with the "Reset to Default" button in the chooser.
void SetSwatchBackground(const KIGFX::COLOR4D &aBackground)
Set the swatch background color.
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Create an undo entry for an item that has been already modified.
Definition: commit.h:105
Class DIALOG_FIELD_PROPERTIES_BASE.
void onOrientButton(wxCommandEvent &aEvent)
void OnTextValueSelectButtonClick(wxCommandEvent &aEvent) override
Handle the select button next to the text value field.
DIALOG_FIELD_PROPERTIES(SCH_BASE_FRAME *aParent, const wxString &aTitle, const SCH_FIELD *aField)
GR_TEXT_H_ALIGN_T m_horizontalJustification
void onVAlignButton(wxCommandEvent &aEvent)
SCINTILLA_TRICKS * m_scintillaTricks
void UpdateField(SCH_FIELD *aField)
void onScintillaCharAdded(wxStyledTextEvent &aEvent)
void OnSetFocusText(wxFocusEvent &event) override
Used to select the variant part of some text fields (for instance, the question mark or number in a r...
void updateText(EDA_TEXT *aText)
void onHAlignButton(wxCommandEvent &aEvent)
GR_TEXT_V_ALIGN_T m_verticalJustification
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
Definition: dialog_shim.h:98
void SetupStandardButtons(std::map< int, wxString > aLabels={})
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
bool IsVertical() const
Definition: eda_angle.h:185
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:100
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
Definition: eda_item.h:175
EDA_ITEM * GetParent() const
Definition: eda_item.h:102
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:83
void SetTextColor(const COLOR4D &aColor)
Definition: eda_text.h:230
const VECTOR2I & GetTextPos() const
Definition: eda_text.h:234
COLOR4D GetTextColor() const
Definition: eda_text.h:231
bool IsItalic() const
Definition: eda_text.h:144
const EDA_ANGLE & GetTextAngle() const
Definition: eda_text.h:134
void SetTextSize(VECTOR2I aNewSize, bool aEnforceMinTextSize=true)
Definition: eda_text.cpp:374
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:98
virtual bool IsVisible() const
Definition: eda_text.h:151
void SetTextPos(const VECTOR2I &aPoint)
Definition: eda_text.cpp:419
KIFONT::FONT * GetFont() const
Definition: eda_text.h:211
int GetTextWidth() const
Definition: eda_text.h:225
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
Definition: eda_text.cpp:276
GR_TEXT_H_ALIGN_T GetHorizJustify() const
Definition: eda_text.h:164
virtual void SetVisible(bool aVisible)
Definition: eda_text.cpp:245
static GR_TEXT_H_ALIGN_T MapHorizJustify(int aHorizJustify)
Definition: eda_text.cpp:63
void SetBold(bool aBold)
Definition: eda_text.cpp:221
bool IsBold() const
Definition: eda_text.h:148
static GR_TEXT_V_ALIGN_T MapVertJustify(int aVertJustify)
Definition: eda_text.cpp:77
GR_TEXT_V_ALIGN_T GetVertJustify() const
Definition: eda_text.h:167
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
Definition: eda_text.cpp:205
void SetItalic(bool aItalic)
Definition: eda_text.cpp:213
void SetFont(KIFONT::FONT *aFont)
Definition: eda_text.cpp:358
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
Definition: eda_text.cpp:268
A text control validator used for validating the text allowed in fields.
Definition: validators.h:221
bool HaveFontSelection() const
Definition: font_choice.cpp:94
void SetFontSelection(KIFONT::FONT *aFont)
Definition: font_choice.cpp:73
KIFONT::FONT * GetFontSelection(bool aBold, bool aItalic) const
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
Carry a payload from one KIWAY_PLAYER to another within a PROJECT.
Definition: kiway_express.h:40
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:55
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
Definition: kiway_player.h:67
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:49
Define a library symbol object.
Definition: lib_symbol.h:77
std::vector< SCH_PIN * > GetPins(int aUnit=0, int aBodyStyle=0) const
Return a list of pin object pointers from the draw item list.
Definition: lib_symbol.cpp:982
wxArrayString GetFPFilters() const
Definition: lib_symbol.h:205
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:287
wxString ConvertKIIDsToRefs(const wxString &aSource) const
Definition: schematic.cpp:541
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:100
wxString ConvertRefsToKIIDs(const wxString &aSource) const
Definition: schematic.cpp:473
A shim class between EDA_DRAW_FRAME and several derived classes: SYMBOL_EDIT_FRAME,...
COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Returns a pointer to the active color theme settings.
Schematic editor (Eeschema) main window.
SCHEMATIC & Schematic() const
void UpdateLabelsHierarchyNavigator()
Update the hierarchy navigation tree labels.
void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false, bool aUpdateRtree=false) override
Mark an item for refresh.
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Definition: sch_field.h:51
GR_TEXT_V_ALIGN_T GetEffectiveVertJustify() const
Definition: sch_field.cpp:714
VECTOR2I GetPosition() const override
Definition: sch_field.cpp:1407
bool IsNameShown() const
Definition: sch_field.h:205
bool IsHorizJustifyFlipped() const
Return whether the field will be rendered with the horizontal justification inverted due to rotation ...
Definition: sch_field.cpp:654
bool IsVertJustifyFlipped() const
Definition: sch_field.cpp:691
void SetCanAutoplace(bool aCanPlace)
Definition: sch_field.h:217
wxString GetCanonicalName() const
Get a non-language-specific name for a field which can be used for storage, variable look-up,...
Definition: sch_field.cpp:1174
bool IsNamedVariable() const
Named variables are fields whose names are variables like ${VAR}.
Definition: sch_field.h:214
int GetId() const
Definition: sch_field.h:133
GR_TEXT_H_ALIGN_T GetEffectiveHorizJustify() const
Definition: sch_field.cpp:677
wxString GetName(bool aUseDefaultName=true) const
Return the field name (not translated).
Definition: sch_field.cpp:1149
void SetPosition(const VECTOR2I &aPosition) override
Definition: sch_field.cpp:1387
bool CanAutoplace() const
Definition: sch_field.h:216
void SetText(const wxString &aText) override
Definition: sch_field.cpp:1138
void OnScintillaCharAdded(SCINTILLA_TRICKS *aScintillaTricks, wxStyledTextEvent &aEvent) const
Definition: sch_field.cpp:777
void SetNameShown(bool aShown=true)
Definition: sch_field.h:206
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:174
const SYMBOL * GetParentSymbol() const
Definition: sch_item.cpp:155
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:139
int GetUnit() const
Definition: sch_item.h:237
void ClearFieldsAutoplaced()
Definition: sch_item.h:559
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Schematic symbol object.
Definition: sch_symbol.h:108
static bool IsReferenceStringValid(const wxString &aReferenceString)
Test for an acceptable reference string.
Definition: sch_symbol.cpp:744
bool IsAnnotated(const SCH_SHEET_PATH *aSheet) const
Check if the symbol has a valid annotation (reference) for the given sheet path.
Definition: sch_symbol.cpp:786
void SetValueFieldText(const wxString &aValue)
Definition: sch_symbol.cpp:888
void SetRef(const SCH_SHEET_PATH *aSheet, const wxString &aReference)
Set the reference for the given sheet path for this symbol.
Definition: sch_symbol.cpp:750
std::vector< SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve a list of the SCH_PINs for the given sheet path.
void SetFootprintFieldText(const wxString &aFootprint)
Definition: sch_symbol.cpp:904
const LIB_ID & GetLibId() const override
Definition: sch_symbol.h:197
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
Definition: sch_symbol.h:216
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const override
Definition: sch_symbol.cpp:711
Add cut/copy/paste, dark theme, autocomplete and brace highlighting to a wxStyleTextCtrl instance.
void SetBitmap(const wxBitmapBundle &aBmp)
int GetIntValue()
Definition: unit_binder.h:127
virtual void SetValue(long long int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
wxString EnsureFileExtension(const wxString &aFilename, const wxString &aExtension)
It's annoying to throw up nag dialogs when the extension isn't right.
Definition: common.cpp:415
The common library.
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:280
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
Definition: confirm.cpp:332
This file is part of the common library.
#define _(s)
static constexpr EDA_ANGLE ANGLE_VERTICAL
Definition: eda_angle.h:432
static constexpr EDA_ANGLE ANGLE_HORIZONTAL
Definition: eda_angle.h:431
void CollectOtherUnits(const wxString &aRef, int aUnit, const LIB_ID &aLibId, SCH_SHEET_PATH &aSheet, std::vector< SCH_SYMBOL * > *otherUnits)
@ FRAME_FOOTPRINT_CHOOSER
Definition: frame_type.h:44
static const std::string KiCadSchematicFileExtension
@ LAYER_SCHEMATIC_BACKGROUND
Definition: layer_ids.h:390
@ MAIL_SYMBOL_NETLIST
Definition: mail_type.h:45
KICOMMON_API wxFont GetInfoFont(wxWindow *aWindow)
Definition: ui_common.cpp:151
KICOMMON_API void SelectReferenceNumber(wxTextEntry *aTextEntry)
Select the number (or "?") in a reference for ease of editing.
Definition: ui_common.cpp:225
@ SHEETNAME
Definition: sch_sheet.h:45
@ SHEETFILENAME
Definition: sch_sheet.h:46
Definitions of control validators for schematic dialogs.
wxString UnescapeString(const wxString &aSource)
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
@ CTX_LINE
Definition: string_utils.h:59
Definition for symbol library class.
@ DATASHEET_FIELD
name of datasheet
@ FOOTPRINT_FIELD
Field Name Module PCB, i.e. "16DIP300".
@ VALUE_FIELD
Field Value of part, i.e. "3.3K".
@ REFERENCE_FIELD
Field Reference of part, i.e. "IC21".
@ GR_TEXT_H_ALIGN_CENTER
@ GR_TEXT_H_ALIGN_RIGHT
@ GR_TEXT_H_ALIGN_LEFT
@ GR_TEXT_H_ALIGN_INDETERMINATE
@ GR_TEXT_V_ALIGN_BOTTOM
@ GR_TEXT_V_ALIGN_INDETERMINATE
@ GR_TEXT_V_ALIGN_CENTER
@ GR_TEXT_V_ALIGN_TOP
@ LIB_SYMBOL_T
Definition: typeinfo.h:148
@ SCH_SYMBOL_T
Definition: typeinfo.h:172
@ SCH_SHEET_T
Definition: typeinfo.h:174
@ SCH_GLOBAL_LABEL_T
Definition: typeinfo.h:168
#define SHEETFILENAME_V
Definition: validators.h:47
#define LABELUSERFIELD_V
Definition: validators.h:50
#define SHEETNAME_V
Definition: validators.h:46
#define SHEETUSERFIELD_V
Definition: validators.h:48
VECTOR2< int > VECTOR2I
Definition: vector2d.h:588
Definition of file extensions used in Kicad.