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 <lib_field.h>
41#include <template_fieldnames.h>
42#include <symbol_library.h>
43#include <sch_validators.h>
44#include <schematic.h>
45#include <sch_commit.h>
47#include <sch_text.h>
48#include <scintilla_tricks.h>
50
51
53 const EDA_TEXT* aTextItem ) :
54 DIALOG_FIELD_PROPERTIES_BASE( aParent, wxID_ANY, aTitle ),
55 m_posX( aParent, m_xPosLabel, m_xPosCtrl, m_xPosUnits, true ),
56 m_posY( aParent, m_yPosLabel, m_yPosCtrl, m_yPosUnits, true ),
57 m_textSize( aParent, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits, true ),
58 m_font( nullptr ),
59 m_firstFocus( true ),
60 m_scintillaTricks( nullptr )
61{
62 COLOR_SETTINGS* colorSettings = aParent->GetColorSettings();
63 COLOR4D schematicBackground = colorSettings->GetColor( LAYER_SCHEMATIC_BACKGROUND );
64
65 wxASSERT( aTextItem );
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 [this]( wxKeyEvent& aEvent )
75 {
76 wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
77 } );
78
79 m_StyledTextCtrl->SetEOLMode( wxSTC_EOL_LF ); // Normalize EOL across platforms
80
81#ifdef _WIN32
82 // Without this setting, on Windows, some esoteric unicode chars create display issue
83 // in a wxStyledTextCtrl.
84 // for SetTechnology() info, see https://www.scintilla.org/ScintillaDoc.html#SCI_SETTECHNOLOGY
85 m_StyledTextCtrl->SetTechnology(wxSTC_TECHNOLOGY_DIRECTWRITE);
86#endif
87
88 m_textColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
89 m_textColorSwatch->SetSwatchBackground( schematicBackground );
90
92
94 m_horizontal->SetBitmap( KiBitmapBundle( BITMAPS::text_horizontal ) );
96 m_vertical->SetBitmap( KiBitmapBundle( BITMAPS::text_vertical ) );
97
99
101 m_bold->SetBitmap( KiBitmapBundle( BITMAPS::text_bold ) );
103 m_italic->SetBitmap( KiBitmapBundle( BITMAPS::text_italic ) );
104
106
108 m_hAlignLeft->SetBitmap( KiBitmapBundle( BITMAPS::text_align_left ) );
110 m_hAlignCenter->SetBitmap( KiBitmapBundle( BITMAPS::text_align_center ) );
112 m_hAlignRight->SetBitmap( KiBitmapBundle( BITMAPS::text_align_right ) );
113
115
117 m_vAlignTop->SetBitmap( KiBitmapBundle( BITMAPS::text_valign_top ) );
119 m_vAlignCenter->SetBitmap( KiBitmapBundle( BITMAPS::text_valign_center ) );
121 m_vAlignBottom->SetBitmap( KiBitmapBundle( BITMAPS::text_valign_bottom ) );
122
124
125 m_horizontal->Bind( wxEVT_BUTTON, &DIALOG_FIELD_PROPERTIES::onOrientButton, this );
126 m_vertical->Bind( wxEVT_BUTTON, &DIALOG_FIELD_PROPERTIES::onOrientButton, this );
127
128 m_hAlignLeft->Bind( wxEVT_BUTTON, &DIALOG_FIELD_PROPERTIES::onHAlignButton, this );
129 m_hAlignCenter->Bind( wxEVT_BUTTON, &DIALOG_FIELD_PROPERTIES::onHAlignButton, this );
130 m_hAlignRight->Bind( wxEVT_BUTTON, &DIALOG_FIELD_PROPERTIES::onHAlignButton, this );
131
132 m_vAlignTop->Bind( wxEVT_BUTTON, &DIALOG_FIELD_PROPERTIES::onVAlignButton, this );
133 m_vAlignCenter->Bind( wxEVT_BUTTON, &DIALOG_FIELD_PROPERTIES::onVAlignButton, this );
134 m_vAlignBottom->Bind( wxEVT_BUTTON, &DIALOG_FIELD_PROPERTIES::onVAlignButton, this );
135
136 m_text = aTextItem->GetText();
137 m_isItalic = aTextItem->IsItalic();
138 m_isBold = aTextItem->IsBold();
139 m_color = aTextItem->GetTextColor();
140 m_position = aTextItem->GetTextPos();
141 m_size = aTextItem->GetTextWidth();
142 m_isVertical = aTextItem->GetTextAngle().IsVertical();
145 m_isVisible = aTextItem->IsVisible();
146
147 // These should be initialized in the child classes implementing dialogs for lib and sch items.
148 m_isNameVisible = false;
149 m_allowAutoplace = true;
150}
151
152
154{
155 delete m_scintillaTricks;
156}
157
158
160{
161 // Disable options for graphic text editing which are not needed for fields.
162 m_commonToAllBodyStyles->Show( false );
163 m_commonToAllUnits->Show( false );
164
165 // Predefined fields cannot contain some chars and cannot be empty, so they need a
166 // SCH_FIELD_VALIDATOR (m_StyledTextCtrl cannot use a SCH_FIELD_VALIDATOR).
172 {
173 m_TextCtrl->SetValidator( FIELD_VALIDATOR( m_fieldId, &m_text ) );
175
176 m_StyledTextCtrl->Show( false );
177 }
178 else
179 {
181
182 m_TextCtrl->Show( false );
183 }
184
185 // Show the footprint selection dialog if this is the footprint field.
186 m_TextValueSelectButton->SetBitmap( KiBitmapBundle( BITMAPS::small_library ) );
188
190 {
191 }
192
193 m_TextCtrl->Enable( true );
194
195 GetSizer()->SetSizeHints( this );
196
197 // Adjust the height of the scintilla editor after the first layout to show a single line
198 // (multiline text is not supported in fields and will be removed)
199 if( m_StyledTextCtrl->IsShown() )
200 {
201 wxSize maxSize = m_StyledTextCtrl->GetSize();
202 maxSize.x = -1; // Do not fix the max width
203 maxSize.y = m_xPosCtrl->GetSize().y;
204 m_StyledTextCtrl->SetMaxSize( maxSize );
205 m_StyledTextCtrl->SetUseVerticalScrollBar( false );
206 m_StyledTextCtrl->SetUseHorizontalScrollBar( false );
207 }
208
210
211 // Now all widgets have the size fixed, call FinishDialogSettings
213}
214
215
217{
218 // pick a footprint using the footprint picker.
219 wxString fpid;
220
221 if( m_StyledTextCtrl->IsShown() )
222 fpid = m_StyledTextCtrl->GetValue();
223 else
224 fpid = m_TextCtrl->GetValue();
225
226 if( KIWAY_PLAYER* frame = Kiway().Player( FRAME_FOOTPRINT_CHOOSER, true ) )
227 {
229 frame->KiwayMailIn( event );
230
231 if( frame->ShowModal( &fpid, this ) )
232 {
233 if( m_StyledTextCtrl->IsShown() )
234 m_StyledTextCtrl->SetValue( fpid );
235 else
236 m_TextCtrl->SetValue( fpid );
237 }
238
239 frame->Destroy();
240 }
241}
242
243
245{
246 if( m_firstFocus )
247 {
248#ifdef __WXGTK__
249 // Force an update of the text control before setting the text selection
250 // This is needed because GTK seems to ignore the selection on first update
251 //
252 // Note that we can't do this on OSX as it tends to provoke Apple's
253 // "[NSAlert runModal] may not be invoked inside of transaction begin/commit pair"
254 // bug. See: https://bugs.launchpad.net/kicad/+bug/1837225
256 m_TextCtrl->Update();
257#endif
258
260 KIUI::SelectReferenceNumber( static_cast<wxTextEntry*>( m_TextCtrl ) );
261 else if( m_fieldId == VALUE_FIELD || m_fieldId == SHEETNAME_V )
262 m_TextCtrl->SetSelection( -1, -1 );
263
264 m_firstFocus = false;
265 }
266
267 event.Skip();
268}
269
270
271void DIALOG_FIELD_PROPERTIES::onOrientButton( wxCommandEvent& aEvent )
272{
273 for( BITMAP_BUTTON* btn : { m_horizontal, m_vertical } )
274 {
275 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
276 btn->Check( false );
277 }
278}
279
280
281void DIALOG_FIELD_PROPERTIES::onHAlignButton( wxCommandEvent& aEvent )
282{
284 {
285 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
286 btn->Check( false );
287 }
288}
289
290
291void DIALOG_FIELD_PROPERTIES::onVAlignButton( wxCommandEvent& aEvent )
292{
294 {
295 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
296 btn->Check( false );
297 }
298}
299
300
302{
303 if( m_TextCtrl->IsShown() )
304 {
305 m_TextCtrl->SetValue( EscapeString( m_text, CTX_LINE ) );
306 }
307 else if( m_StyledTextCtrl->IsShown() )
308 {
310 m_StyledTextCtrl->EmptyUndoBuffer();
311 }
312
314
318
321
324
326
328 {
329 case GR_TEXT_H_ALIGN_LEFT: m_hAlignLeft->Check( true ); break;
330 case GR_TEXT_H_ALIGN_CENTER: m_hAlignCenter->Check( true ); break;
331 case GR_TEXT_H_ALIGN_RIGHT: m_hAlignRight->Check( true ); break;
333 }
334
335 switch ( m_verticalJustification )
336 {
337 case GR_TEXT_V_ALIGN_TOP: m_vAlignTop->Check( true ); break;
338 case GR_TEXT_V_ALIGN_CENTER: m_vAlignCenter->Check( true ); break;
339 case GR_TEXT_V_ALIGN_BOTTOM: m_vAlignBottom->Check( true ); break;
341 }
342
343 m_visible->SetValue( m_isVisible );
344 m_nameVisible->SetValue( m_isNameVisible );
346
347 return true;
348}
349
350
352{
353 if( m_TextCtrl->IsShown() )
354 m_text = UnescapeString( m_TextCtrl->GetValue() );
355 else if( m_StyledTextCtrl->IsShown() )
356 m_text = UnescapeString( m_StyledTextCtrl->GetValue() );
357
359 {
360 // Test if the reference string is valid:
362 {
363 DisplayError( this, _( "Illegal reference designator value!" ) );
364 return false;
365 }
366 }
367 else if( m_fieldId == SHEETFILENAME_V )
368 {
370 }
371
374
377
379
383
384 if( m_hAlignLeft->IsChecked() )
386 else if( m_hAlignCenter->IsChecked() )
388 else
390
391 if( m_vAlignTop->IsChecked() )
393 else if( m_vAlignCenter->IsChecked() )
395 else
397
398 m_isVisible = m_visible->GetValue();
399 m_isNameVisible = m_nameVisible->GetValue();
401
402 return true;
403}
404
405
407{
408 if( aText->GetTextWidth() != m_size )
409 aText->SetTextSize( VECTOR2I( m_size, m_size ) );
410
411 aText->SetFont( m_font );
412 aText->SetVisible( m_isVisible );
414 aText->SetItalic( m_isItalic );
415 aText->SetBold( m_isBold );
416 aText->SetTextColor( m_color );
417}
418
419
421 const wxString& aTitle,
422 const LIB_FIELD* aField ) :
423 DIALOG_FIELD_PROPERTIES( aParent, aTitle, aField )
424{
425 m_fieldId = aField->GetId();
426 m_isNameVisible = aField->IsNameShown();
427 m_allowAutoplace = aField->CanAutoplace();
428
429 if( m_fieldId == VALUE_FIELD )
430 m_text = UnescapeString( aField->GetText() );
431
433 {
434 LIB_SYMBOL* symbol = aField->GetParent();
435 wxString netlist;
436
437 /*
438 * Symbol netlist format:
439 * pinCount
440 * fpFilters
441 */
442 netlist << wxString::Format( wxS( "%d\r" ), symbol->GetPinCount() );
443
444 wxArrayString fpFilters = symbol->GetFPFilters();
445
446 if( !fpFilters.IsEmpty() )
447 netlist << EscapeString( wxJoin( fpFilters, ' ' ), CTX_LINE );
448
449 netlist << wxS( "\r" );
450
452 }
453
454 m_font = aField->GetFont();
455
456 m_nameVisible->Show();
457 m_cbAllowAutoPlace->Show();
458
459 init();
460}
461
462
464{
465 aField->SetText( m_text );
466
467 updateText( aField );
468
469 aField->SetNameShown( m_isNameVisible );
471
474 aField->SetTextPos( m_position );
475}
476
477
479 const wxString& aTitle,
480 const SCH_FIELD* aField ) :
481 DIALOG_FIELD_PROPERTIES( aParent, aTitle, aField ),
482 m_field( aField )
483{
484 m_isSheetFilename = false;
485
486 if( aField->GetParent() && aField->GetParent()->Type() == SCH_SYMBOL_T )
487 {
488 SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( aField->GetParent() );
489 wxString netlist;
490
491 m_fieldId = aField->GetId();
492
493 /*
494 * Symbol netlist format:
495 * pinCount
496 * fpFilters
497 */
498 netlist << wxString::Format( wxS( "%zu\r" ), symbol->GetFullPinCount() );
499
500 wxArrayString fpFilters = symbol->GetLibSymbolRef()->GetFPFilters();
501
502 if( !fpFilters.IsEmpty() )
503 netlist << EscapeString( wxJoin( fpFilters, ' ' ), CTX_LINE );
504
505 netlist << wxS( "\r" );
506
508 }
509 else if( aField->GetParent() && aField->GetParent()->Type() == SCH_SHEET_T )
510 {
511 switch( aField->GetId() )
512 {
513 case SHEETNAME:
515 break;
516
517 case SHEETFILENAME:
518 m_isSheetFilename = true;
520 m_note->SetLabel( wxString::Format( m_note->GetLabel(),
521 _( "Sheet filename can only be modified in Sheet Properties dialog." ) ) );
522 m_note->Show( true );
523 break;
524
525 default:
527 break;
528 }
529 }
530 else if( aField->GetParent() && aField->GetParent()->IsType( { SCH_LABEL_LOCATE_ANY_T } ) )
531 {
533 }
534
535 // show text variable cross-references in a human-readable format
536 m_text = aField->Schematic()->ConvertKIIDsToRefs( aField->GetText() );
537
539
540 m_textLabel->SetLabel( aField->GetName() + wxS( ":" ) );
541
543
546
549
551 this );
552 m_StyledTextCtrl->Bind( wxEVT_STC_AUTOCOMP_CHAR_DELETED,
554
555 m_nameVisible->Show();
556 m_cbAllowAutoPlace->Show();
557
558 init();
559
561 {
562 m_StyledTextCtrl->Enable( false );
563 m_TextCtrl->Enable( false );
564 }
565}
566
567
569{
571}
572
573
575 SCH_SHEET_PATH* aSheetPath )
576{
577 SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( GetParent() );
578 SCH_ITEM* parent = dynamic_cast<SCH_ITEM*>( aField->GetParent() );
579 int fieldType = aField->GetId();
580
581 if( parent && parent->Type() == SCH_SYMBOL_T )
582 {
583 SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( parent );
584
585 if( fieldType == REFERENCE_FIELD )
586 symbol->SetRef( aSheetPath, m_text );
587 else if( fieldType == VALUE_FIELD )
588 symbol->SetValueFieldText( m_text );
589 else if( fieldType == FOOTPRINT_FIELD )
590 symbol->SetFootprintFieldText( m_text );
591 }
592 else if( parent && parent->Type() == SCH_GLOBAL_LABEL_T )
593 {
594 if( aField->GetCanonicalName() == wxT( "Intersheetrefs" ) )
595 {
596 if( m_visible->GetValue() != parent->Schematic()->Settings().m_IntersheetRefsShow )
597 {
598 DisplayInfoMessage( this, _( "Intersheet reference visibility is "
599 "controlled globally from "
600 "Schematic Setup > General > Formatting" ) );
601 }
602 }
603 }
604
605 bool positioningModified = false;
606
607 if( aField->GetPosition() != m_position )
608 positioningModified = true;
609
610 if( aField->GetTextAngle().IsVertical() != m_isVertical )
611 positioningModified = true;
612
614 positioningModified = true;
615
617 positioningModified = true;
618
619 // convert any text variable cross-references to their UUIDs
621
622 // Changing a sheetname need to update the hierarchy navigator
623 bool needUpdateHierNav = false;
624
625 if( parent && parent->Type() == SCH_SHEET_T && fieldType == SHEETNAME )
626 needUpdateHierNav = m_text != aField->GetText();
627
628 aField->SetText( m_text );
629 updateText( aField );
630 aField->SetPosition( m_position );
631
632 aField->SetNameShown( m_isNameVisible );
634
635 // Note that we must set justifications before we can ask if they're flipped. If the old
636 // justification is center then it won't know (whereas if the new justification is center
637 // the we don't care).
640
641 if( aField->IsHorizJustifyFlipped() )
643
644 if( aField->IsVertJustifyFlipped() )
646
647 // The value, footprint and datasheet fields should be kept in sync in multi-unit parts.
648 // Of course the symbol must be annotated to collect other units.
649 if( editFrame && parent && parent->Type() == SCH_SYMBOL_T )
650 {
651 SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( parent );
652
653 if( symbol->IsAnnotated( aSheetPath ) && ( fieldType == VALUE_FIELD
654 || fieldType == FOOTPRINT_FIELD
655 || fieldType == DATASHEET_FIELD ) )
656 {
657 wxString ref = symbol->GetRef( aSheetPath );
658 int unit = symbol->GetUnit();
659 LIB_ID libId = symbol->GetLibId();
660
661 for( SCH_SHEET_PATH& sheet : editFrame->Schematic().GetSheets() )
662 {
663 SCH_SCREEN* screen = sheet.LastScreen();
664 std::vector<SCH_SYMBOL*> otherUnits;
665
666 CollectOtherUnits( ref, unit, libId, sheet, &otherUnits );
667
668 for( SCH_SYMBOL* otherUnit : otherUnits )
669 {
670 aCommit->Modify( otherUnit, screen );
671
672 if( fieldType == VALUE_FIELD )
673 otherUnit->SetValueFieldText( m_text );
674 else if( fieldType == FOOTPRINT_FIELD )
675 otherUnit->SetFootprintFieldText( m_text );
676 else
677 otherUnit->GetField( DATASHEET_FIELD )->SetText( m_text );
678
679 editFrame->UpdateItem( otherUnit, false, true );
680 }
681 }
682 }
683 }
684
685 if( positioningModified && parent )
686 parent->ClearFieldsAutoplaced();
687
688 //Update the hierarchy navigator labels if needed
689 if( needUpdateHierNav )
691}
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:41
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.
A base class to edit schematic and symbol library fields.
void onOrientButton(wxCommandEvent &aEvent)
void OnTextValueSelectButtonClick(wxCommandEvent &aEvent) override
Handle the select button next to the text value field.
GR_TEXT_H_ALIGN_T m_horizontalJustification
void onVAlignButton(wxCommandEvent &aEvent)
SCINTILLA_TRICKS * m_scintillaTricks
virtual 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
DIALOG_FIELD_PROPERTIES(SCH_BASE_FRAME *aParent, const wxString &aTitle, const EDA_TEXT *aTextItem)
DIALOG_LIB_FIELD_PROPERTIES(SCH_BASE_FRAME *aParent, const wxString &aTitle, const LIB_FIELD *aField)
DIALOG_SCH_FIELD_PROPERTIES(SCH_BASE_FRAME *aParent, const wxString &aTitle, const SCH_FIELD *aField)
void onScintillaCharAdded(wxStyledTextEvent &aEvent)
void UpdateField(SCH_COMMIT *aCommit, SCH_FIELD *aField, SCH_SHEET_PATH *aSheetPath)
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
Definition: dialog_shim.h:97
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:97
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
Definition: eda_item.h:172
EDA_ITEM * GetParent() const
Definition: eda_item.h:99
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:80
void SetTextColor(const COLOR4D &aColor)
Definition: eda_text.h:227
const VECTOR2I & GetTextPos() const
Definition: eda_text.h:231
COLOR4D GetTextColor() const
Definition: eda_text.h:228
bool IsItalic() const
Definition: eda_text.h:141
const EDA_ANGLE & GetTextAngle() const
Definition: eda_text.h:131
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:95
virtual bool IsVisible() const
Definition: eda_text.h:148
void SetTextPos(const VECTOR2I &aPoint)
Definition: eda_text.cpp:419
KIFONT::FONT * GetFont() const
Definition: eda_text.h:208
int GetTextWidth() const
Definition: eda_text.h:222
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
Definition: eda_text.cpp:276
GR_TEXT_H_ALIGN_T GetHorizJustify() const
Definition: eda_text.h:161
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:145
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:164
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:183
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:238
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:39
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:53
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
Definition: kiway_player.h:67
Field object used in symbol libraries.
Definition: lib_field.h:62
bool CanAutoplace() const
Definition: lib_field.h:195
bool IsNameShown() const
Definition: lib_field.h:192
void SetNameShown(bool aShown=true)
Definition: lib_field.h:193
void SetCanAutoplace(bool aCanPlace)
Definition: lib_field.h:196
int GetId() const
Definition: lib_field.h:120
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:49
LIB_SYMBOL * GetParent() const
Definition: lib_item.h:209
Define a library symbol object.
Definition: lib_symbol.h:99
wxArrayString GetFPFilters() const
Definition: lib_symbol.h:226
int GetPinCount() override
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:52
GR_TEXT_V_ALIGN_T GetEffectiveVertJustify() const
Definition: sch_field.cpp:607
VECTOR2I GetPosition() const override
Definition: sch_field.cpp:1269
bool IsNameShown() const
Definition: sch_field.h:184
bool IsHorizJustifyFlipped() const
Return whether the field will be rendered with the horizontal justification inverted due to rotation ...
Definition: sch_field.cpp:547
bool IsVertJustifyFlipped() const
Definition: sch_field.cpp:584
void SetCanAutoplace(bool aCanPlace)
Definition: sch_field.h:196
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:1034
bool IsNamedVariable() const
Named variables are fields whose names are variables like ${VAR}.
Definition: sch_field.h:193
int GetId() const
Definition: sch_field.h:128
GR_TEXT_H_ALIGN_T GetEffectiveHorizJustify() const
Definition: sch_field.cpp:570
wxString GetName(bool aUseDefaultName=true) const
Return the field name (not translated).
Definition: sch_field.cpp:1002
void SetPosition(const VECTOR2I &aPosition) override
Definition: sch_field.cpp:1249
bool CanAutoplace() const
Definition: sch_field.h:195
void SetText(const wxString &aText) override
Definition: sch_field.cpp:991
void OnScintillaCharAdded(SCINTILLA_TRICKS *aScintillaTricks, wxStyledTextEvent &aEvent) const
Definition: sch_field.cpp:670
void SetNameShown(bool aShown=true)
Definition: sch_field.h:185
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:165
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:113
void ClearFieldsAutoplaced()
Definition: sch_item.h:473
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:109
size_t GetFullPinCount()
Definition: sch_symbol.h:631
int GetUnit() const
Definition: sch_symbol.h:258
static bool IsReferenceStringValid(const wxString &aReferenceString)
Test for an acceptable reference string.
Definition: sch_symbol.cpp:784
void SetValueFieldText(const wxString &aValue)
Definition: sch_symbol.cpp:928
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const
Return the reference for the given sheet path.
Definition: sch_symbol.cpp:748
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:790
void SetFootprintFieldText(const wxString &aFootprint)
Definition: sch_symbol.cpp:944
bool IsAnnotated(const SCH_SHEET_PATH *aSheet)
Check if the symbol has a valid annotation (reference) for the given sheet path.
Definition: sch_symbol.cpp:826
const LIB_ID & GetLibId() const
Definition: sch_symbol.h:203
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
Definition: sch_symbol.h:222
Add cut/copy/paste, dark theme, autocomplete and brace highlighting to a wxStyleTextCtrl instance.
void SetBitmap(const wxBitmapBundle &aBmp)
virtual long long int GetValue()
Return the current value in Internal Units.
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:388
@ MAIL_SYMBOL_NETLIST
Definition: mail_type.h:45
wxFont GetInfoFont(wxWindow *aWindow)
Definition: ui_common.cpp:151
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
@ SCH_SYMBOL_T
Definition: typeinfo.h:160
@ SCH_SHEET_T
Definition: typeinfo.h:162
@ SCH_GLOBAL_LABEL_T
Definition: typeinfo.h:156
#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.