KiCad PCB EDA Suite
Loading...
Searching...
No Matches
eeschema/dialogs/dialog_text_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) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 2013 Wayne Stambaugh <[email protected]>
6 * Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.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
26#include <sch_edit_frame.h>
27#include <symbol_edit_frame.h>
29#include <widgets/font_choice.h>
31#include <widgets/wx_combobox.h>
33#include <sch_textbox.h>
34#include <confirm.h>
35#include <schematic.h>
36#include <sch_commit.h>
38#include <scintilla_tricks.h>
40#include <string_utils.h>
41
42
45 m_frame( aParent ),
46 m_currentItem( aTextItem ),
47 m_currentText( dynamic_cast<EDA_TEXT*>( aTextItem ) ),
48 m_textSize( aParent, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits ),
49 m_borderWidth( aParent, m_borderWidthLabel, m_borderWidthCtrl, m_borderWidthUnits ),
50 m_scintillaTricks( nullptr ),
51 m_helpWindow( nullptr )
52{
53 m_isSymbolEditor = dynamic_cast<SYMBOL_EDIT_FRAME*>( aParent ) != nullptr;
54
55 COLOR_SETTINGS* colorSettings = m_frame->GetColorSettings();
56 COLOR4D schematicBackground = colorSettings->GetColor( LAYER_SCHEMATIC_BACKGROUND );
57
58 if( aTextItem->Type() == SCH_TEXTBOX_T )
59 {
60 SetTitle( _( "Text Box Properties" ) );
61
62 m_borderColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
63 m_borderColorSwatch->SetSwatchBackground( schematicBackground );
64
65 for( const auto& [ lineStyle, lineStyleDesc ] : lineTypeNames )
66 m_borderStyleCombo->Append( lineStyleDesc.name,
67 KiBitmapBundle( lineStyleDesc.bitmap ) );
68
70
71 m_fillColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
72 m_fillColorSwatch->SetSwatchBackground( schematicBackground );
73
75 m_infoBar->ShowMessage( _( "Note: individual item colors overridden in Preferences." ) );
76 }
77 else
78 {
79 m_borderCheckbox->Show( false );
80 m_borderWidth.Show( false );
81 m_borderColorLabel->Show( false );
82 m_panelBorderColor->Show( false );
83 m_borderStyleLabel->Show( false );
84 m_borderStyleCombo->Show( false );
85 m_fillColorLabel->Show( false );
86 m_panelFillColor->Show( false );
87 m_filledCtrl->Show( false );
88 }
89
90 // DIALOG_SHIM needs a unique hash_key because classname is not sufficient because the
91 // different text item types (and even whether or not we're within the symbol editor) cause
92 // different dialog layouts).
93 m_hash_key = TO_UTF8( GetTitle() + aParent->GetName() );
94
95 m_textCtrl->SetEOLMode( wxSTC_EOL_LF );
96
97#ifdef _WIN32
98 // Without this setting, on Windows, some esoteric unicode chars create display issue
99 // in a wxStyledTextCtrl.
100 // for SetTechnology() info, see https://www.scintilla.org/ScintillaDoc.html#SCI_SETTECHNOLOGY
101 m_textCtrl->SetTechnology( wxSTC_TECHNOLOGY_DIRECTWRITE );
102#endif
103
104 m_scintillaTricks = new SCINTILLA_TRICKS( m_textCtrl, wxT( "{}" ), false,
105 // onAcceptFn
106 [this]( wxKeyEvent& aEvent )
107 {
108 wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
109 },
110
111 // onCharFn
112 [this]( wxStyledTextEvent& aEvent )
113 {
115 // getTokensFn
116 [this]( const wxString& xRef, wxArrayString* tokens )
117 {
118 getContextualTextVars( xRef, tokens );
119 } );
120 } );
121
122 m_textEntrySizer->AddGrowableRow( 0 );
123
124 m_textColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
125 m_textColorSwatch->SetSwatchBackground( schematicBackground );
126
128
130
132 m_bold->SetBitmap( KiBitmapBundle( BITMAPS::text_bold ) );
134 m_italic->SetBitmap( KiBitmapBundle( BITMAPS::text_italic ) );
135
137
139 m_hAlignLeft->SetBitmap( KiBitmapBundle( BITMAPS::text_align_left ) );
141 m_hAlignCenter->SetBitmap( KiBitmapBundle( BITMAPS::text_align_center ) );
143 m_hAlignRight->SetBitmap( KiBitmapBundle( BITMAPS::text_align_right ) );
144
146
148 m_vAlignTop->SetBitmap( KiBitmapBundle( BITMAPS::text_valign_top ) );
150 m_vAlignCenter->SetBitmap( KiBitmapBundle( BITMAPS::text_valign_center ) );
152 m_vAlignBottom->SetBitmap( KiBitmapBundle( BITMAPS::text_valign_bottom ) );
153
155
157 m_horizontal->SetBitmap( KiBitmapBundle( BITMAPS::text_horizontal ) );
159 m_vertical->SetBitmap( KiBitmapBundle( BITMAPS::text_vertical ) );
160
162
164
165 if( SCH_EDIT_FRAME* schematicEditor = dynamic_cast<SCH_EDIT_FRAME*>( m_frame ) )
166 {
167 SCH_SHEET_LIST sheetList = schematicEditor->Schematic().GetSheets();
168 sheetList.SortByPageNumbers( false );
169
170 for( const SCH_SHEET_PATH& sheet : sheetList )
171 {
172 wxString sheetPageNum = sheet.GetPageNumber();
173 wxString sheetName = sheet.size() == 1 ? _( "<root sheet>" )
174 : sheet.Last()->GetName();
175
176 m_hyperlinkCombo->Append( wxT( "#" ) + sheetPageNum,
177 wxString::Format( _( "Page %s (%s)" ),
178 sheetPageNum,
179 sheetName ) );
180 m_pageNumbers.push_back( sheetPageNum );
181 }
182
183 m_hyperlinkCombo->Append( wxT( "---" ) );
184 m_hyperlinkCombo->Append( wxT( "file://" ), wxT( "file://..." ) );
185 m_hyperlinkCombo->Append( wxT( "http://" ), wxT( "http://..." ) );
186 m_hyperlinkCombo->Append( wxT( "https://" ), wxT( "https://..." ) );
187 }
188 else
189 {
190 m_excludeFromSim->Hide();
191 m_syntaxHelp->Hide();
192 m_hyperlinkCb->Hide();
193 m_hyperlinkCombo->Hide();
194 }
195
197 Layout();
198
199 m_hAlignLeft->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onHAlignButton, this );
200 m_hAlignCenter->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onHAlignButton, this );
201 m_hAlignRight->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onHAlignButton, this );
202 m_vAlignTop->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onVAlignButton, this );
203 m_vAlignCenter->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onVAlignButton, this );
204 m_vAlignBottom->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onVAlignButton, this );
205 m_horizontal->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onTextAngleButton, this );
206 m_vertical->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onTextAngleButton, this );
207
208 // Now all widgets have the size fixed, call FinishDialogSettings
210}
211
212
214{
215 delete m_scintillaTricks;
216
217 if( m_helpWindow )
218 m_helpWindow->Destroy();
219}
220
221
222void DIALOG_TEXT_PROPERTIES::getContextualTextVars( const wxString& aCrossRef,
223 wxArrayString* aTokens )
224{
225 SCHEMATIC* schematic = m_currentItem->Schematic();
226
227 if( !aCrossRef.IsEmpty() )
228 {
229 SCH_SYMBOL* refSymbol = nullptr;
230
231 if( schematic )
232 {
235
236 sheets.GetSymbols( refs );
237
238 for( int jj = 0; jj < (int) refs.GetCount(); jj++ )
239 {
240 SCH_REFERENCE& ref = refs[jj];
241
242 if( ref.GetSymbol()->GetRef( &ref.GetSheetPath(), true ) == aCrossRef )
243 {
244 refSymbol = ref.GetSymbol();
245 break;
246 }
247 }
248 }
249
250 if( refSymbol )
251 refSymbol->GetContextualTextVars( aTokens );
252 }
253 else
254 {
255 if( schematic && schematic->CurrentSheet().Last() )
256 {
257 schematic->CurrentSheet().Last()->GetContextualTextVars( aTokens );
258 }
259 else
260 {
261 for( std::pair<wxString, wxString> entry : Prj().GetTextVars() )
262 aTokens->push_back( entry.first );
263 }
264 }
265}
266
267
269{
270 if( !wxDialog::TransferDataToWindow() )
271 return false;
272
275
276 wxString text = m_currentText->GetText();
277
278 // show text variable cross-references in a human-readable format
279 if( SCHEMATIC* schematic = m_currentItem->Schematic() )
280 text = schematic->ConvertKIIDsToRefs( text );
281
282 m_textCtrl->SetValue( text );
283 m_textCtrl->EmptyUndoBuffer();
284
285 if( !m_isSymbolEditor )
287
291
294
295 switch( m_currentText->GetHorizJustify() )
296 {
301 }
302
303 switch( m_currentText->GetVertJustify() )
304 {
305 case GR_TEXT_V_ALIGN_TOP: m_vAlignTop->Check(); break;
309 }
310
312 m_vertical->Check();
313 else
315
317 {
318 SCH_TEXTBOX* textBox = static_cast<SCH_TEXTBOX*>( m_currentItem );
319
320 m_borderCheckbox->SetValue( textBox->GetWidth() >= 0 );
321
322 if( textBox->GetWidth() >= 0 )
323 m_borderWidth.SetValue( textBox->GetWidth() );
324
326
327 int style = static_cast<int>( textBox->GetStroke().GetLineStyle() );
328
329 if( style == -1 )
330 m_borderStyleCombo->SetStringSelection( DEFAULT_STYLE );
331 else if( style < (int) lineTypeNames.size() )
332 m_borderStyleCombo->SetSelection( style );
333 else
334 wxFAIL_MSG( "Line type not found in the type lookup map" );
335
336 m_borderWidth.Enable( textBox->GetWidth() >= 0 );
337 m_borderColorLabel->Enable( textBox->GetWidth() >= 0 );
338 m_borderColorSwatch->Enable( textBox->GetWidth() >= 0 );
339 m_borderStyleLabel->Enable( textBox->GetWidth() >= 0 );
340 m_borderStyleCombo->Enable( textBox->GetWidth() >= 0 );
341
342 m_filledCtrl->SetValue( textBox->IsFilled() );
343 m_fillColorSwatch->SetSwatchColor( textBox->GetFillColor(), false );
344
345 m_fillColorLabel->Enable( textBox->IsFilled() );
346 m_fillColorSwatch->Enable( textBox->IsFilled() );
347 }
348
349 if( m_isSymbolEditor )
350 {
352
354 m_commonToAllUnits->SetValue( symbol->IsMulti() && m_currentItem->GetUnit() == 0 );
355 m_commonToAllUnits->Enable( symbol->IsMulti() );
358 }
359
360 return true;
361}
362
363
364void DIALOG_TEXT_PROPERTIES::onBorderChecked( wxCommandEvent& aEvent )
365{
366 bool border = m_borderCheckbox->GetValue();
367
368 if( border && m_borderWidth.GetValue() < 0 )
370
371 m_borderWidth.Enable( border );
372 m_borderColorLabel->Enable( border );
373 m_borderColorSwatch->Enable( border );
374 m_borderStyleLabel->Enable( border );
375 m_borderStyleCombo->Enable( border );
376}
377
378
379void DIALOG_TEXT_PROPERTIES::onFillChecked( wxCommandEvent& aEvent )
380{
381 bool fill = m_filledCtrl->GetValue();
382
383 m_fillColorLabel->Enable( fill );
384 m_fillColorSwatch->Enable( fill );
385}
386
387
388void DIALOG_TEXT_PROPERTIES::onHyperlinkChecked( wxCommandEvent& aEvent )
389{
390 if( aEvent.IsChecked() && m_hyperlinkCombo->GetValue().IsEmpty() )
391 {
392 m_hyperlinkCombo->ChangeValue( m_lastLink );
393 }
394 else if( !aEvent.IsChecked() && !m_hyperlinkCombo->GetValue().IsEmpty() )
395 {
396 m_lastLink = m_hyperlinkCombo->GetValue();
397 m_hyperlinkCombo->SetValue( wxEmptyString );
398 }
399
400 aEvent.Skip();
401}
402
403
404void DIALOG_TEXT_PROPERTIES::onHyperlinkText( wxCommandEvent& event )
405{
406 if( !m_hyperlinkCombo->GetValue().IsEmpty() )
407 m_hyperlinkCb->SetValue( true );
408}
409
410
411void DIALOG_TEXT_PROPERTIES::onHyperlinkCombo( wxCommandEvent& aEvent )
412{
413 if( aEvent.GetSelection() >= 0 )
414 {
415 m_hyperlinkCb->SetValue( true );
416 m_hyperlinkCombo->SetInsertionPointEnd();
417 }
418}
419
420
421void DIALOG_TEXT_PROPERTIES::onHAlignButton( wxCommandEvent& aEvent )
422{
424 {
425 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
426 btn->Check( false );
427 }
428}
429
430
431void DIALOG_TEXT_PROPERTIES::onVAlignButton( wxCommandEvent& aEvent )
432{
434 {
435 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
436 btn->Check( false );
437 }
438}
439
440
441void DIALOG_TEXT_PROPERTIES::onTextAngleButton( wxCommandEvent& aEvent )
442{
443 for( BITMAP_BUTTON* btn : { m_horizontal, m_vertical } )
444 {
445 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
446 btn->Check( false );
447 }
448}
449
450
452{
453 if( !wxDialog::TransferDataFromWindow() )
454 return false;
455
456 // Don't allow text to disappear; it can be difficult to correct if you can't select it
457 if( !m_textSize.Validate( 0.01, 1000.0, EDA_UNITS::MILLIMETRES ) )
458 return false;
459
460 SCH_COMMIT commit( m_frame );
461
462 /* save old text in undo list if not already in edit */
463 if( m_currentItem->GetEditFlags() == 0 )
465
467
468 wxString text = m_textCtrl->GetValue();
469
470 // convert any text variable cross-references to their UUIDs
471 if( SCHEMATIC* schematic = m_currentItem->Schematic() )
472 text = schematic->ConvertRefsToKIIDs( m_textCtrl->GetValue() );
473
474#ifdef __WXMAC__
475 // On macOS CTRL+Enter produces '\r' instead of '\n' regardless of EOL setting
476 text.Replace( "\r", "\n" );
477#elif defined( __WINDOWS__ )
478 // On Windows, a new line is coded as \r\n. We use only \n in kicad files and in
479 // drawing routines so strip the \r char.
480 text.Replace( "\r", "" );
481#endif
482
484 {
485 // Textboxes have a defined extent and so are allowed to be empty
487 }
488 else if( !text.IsEmpty() )
489 {
491 }
492 else
493 {
494 // Other text items do not have defined extents, and so will disappear if empty
495 DisplayError( this, _( "Text can not be empty." ) );
496 return false;
497 }
498
500
501 if( SYMBOL_EDIT_FRAME* symbolEditor = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame ) )
502 {
504
505 if( !m_commonToAllUnits->GetValue() )
506 m_currentItem->SetUnit( symbolEditor->GetUnit() );
507 else
509
510 if( !m_commonToAllBodyStyles->GetValue() )
511 m_currentItem->SetBodyStyle( symbolEditor->GetBodyStyle() );
512 else
514 }
515
517 {
518 DisplayError( this, _( "Invalid hyperlink destination. Please enter either a valid URL "
519 "(e.g. file:// or http(s)://) or \"#<page number>\" to create "
520 "a hyperlink to a page in this schematic." ) );
521 return false;
522 }
523 else
524 {
526 }
527
530
532 {
534 m_italic->IsChecked() ) );
535 }
536
537 // Must come after SetTextSize()
540
542
543 if( m_hAlignRight->IsChecked() )
545 else if( m_hAlignCenter->IsChecked() )
547 else
549
552 else if( m_vAlignCenter->IsChecked() )
554 else
556
557 if( m_vertical->IsChecked() )
559 else
561
563 {
564 SCH_TEXTBOX* textBox = static_cast<SCH_TEXTBOX*>( m_currentItem );
565
566 STROKE_PARAMS stroke = textBox->GetStroke();
567
568 if( m_borderCheckbox->GetValue() )
569 stroke.SetWidth( std::max( 0, m_borderWidth.GetIntValue() ) );
570 else
571 stroke.SetWidth( -1 );
572
573 auto it = lineTypeNames.begin();
574 std::advance( it, m_borderStyleCombo->GetSelection() );
575
576 if( it == lineTypeNames.end() )
577 stroke.SetLineStyle( LINE_STYLE::DEFAULT );
578 else
579 stroke.SetLineStyle( it->first );
580
582
583 textBox->SetStroke( stroke );
584
585 textBox->SetFillMode( m_filledCtrl->GetValue() ? FILL_T::FILLED_WITH_COLOR
586 : FILL_T::NO_FILL );
588 }
589
590 if( !commit.Empty() )
591 commit.Push( _( "Edit Text Properties" ) );
592
593 return true;
594}
595
596
597void DIALOG_TEXT_PROPERTIES::OnFormattingHelp( wxHyperlinkEvent& aEvent )
598{
600}
601
602
604{
607
608 event.Skip();
609}
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...
bool GetOverrideSchItemColors() const
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
bool Empty() const
Returns status of an item.
Definition: commit.h:144
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
Definition: dialog_shim.h:102
void SetupStandardButtons(std::map< int, wxString > aLabels={})
std::string m_hash_key
Definition: dialog_shim.h:210
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
void onHyperlinkText(wxCommandEvent &aEvent) override
void onFillChecked(wxCommandEvent &aEvent) override
void onMultiLineTCLostFocus(wxFocusEvent &event) override
void onBorderChecked(wxCommandEvent &aEvent) override
void OnFormattingHelp(wxHyperlinkEvent &aEvent) override
DIALOG_TEXT_PROPERTIES(SCH_BASE_FRAME *parent, SCH_ITEM *aTextItem)
void onHyperlinkCombo(wxCommandEvent &aEvent) override
void getContextualTextVars(const wxString &aCrossRef, wxArrayString *aTokens)
void onHyperlinkChecked(wxCommandEvent &aEvent) override
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
EDA_ITEM_FLAGS GetEditFlags() const
Definition: eda_item.h:132
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:100
bool IsFilled() const
Definition: eda_shape.h:91
void SetFillColor(const COLOR4D &aColor)
Definition: eda_shape.h:107
COLOR4D GetFillColor() const
Definition: eda_shape.h:106
virtual int GetWidth() const
Definition: eda_shape.h:110
void SetFillMode(FILL_T aFill)
Definition: eda_shape.h:101
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
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:372
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:98
KIFONT::FONT * GetFont() const
Definition: eda_text.h:211
int GetTextWidth() const
Definition: eda_text.h:225
virtual bool HasHyperlink() const
Definition: eda_text.h:361
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
Definition: eda_text.cpp:274
wxString GetHyperlink() const
Definition: eda_text.h:362
GR_TEXT_H_ALIGN_T GetHorizJustify() const
Definition: eda_text.h:164
void SetBold(bool aBold)
Definition: eda_text.cpp:219
static bool ValidateHyperlink(const wxString &aURL)
Check if aURL is a valid hyperlink.
Definition: eda_text.cpp:1085
bool IsBold() const
Definition: eda_text.h:148
void SetHyperlink(wxString aLink)
Definition: eda_text.h:363
GR_TEXT_V_ALIGN_T GetVertJustify() const
Definition: eda_text.h:167
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:181
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
Definition: eda_text.cpp:203
void SetItalic(bool aItalic)
Definition: eda_text.cpp:211
void SetFont(KIFONT::FONT *aFont)
Definition: eda_text.cpp:356
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
Definition: eda_text.cpp:266
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
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
virtual std::map< wxString, wxString > & GetTextVars() const
Definition: project.cpp:84
Holds all the data relating to one schematic.
Definition: schematic.h:75
SCH_SHEET_PATH & CurrentSheet() const override
Definition: schematic.h:136
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:100
A shim class between EDA_DRAW_FRAME and several derived classes: SYMBOL_EDIT_FRAME,...
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
EESCHEMA_SETTINGS * eeconfig() const
COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Returns a pointer to the active color theme settings.
virtual void Push(const wxString &aMessage=wxT("A commit"), int aCommitFlags=0) override
Revert the commit by restoring the modified items state.
Definition: sch_commit.cpp:406
Schematic editor (Eeschema) main window.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:174
virtual bool GetExcludedFromSim() const
Definition: sch_item.h:246
virtual void SetBodyStyle(int aBodyStyle)
Definition: sch_item.h:239
const SYMBOL * GetParentSymbol() const
Definition: sch_item.cpp:161
void SetPrivate(bool aPrivate)
Definition: sch_item.h:242
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:145
int GetBodyStyle() const
Definition: sch_item.h:240
int GetUnit() const
Definition: sch_item.h:237
bool IsPrivate() const
Definition: sch_item.h:243
virtual void SetExcludedFromSim(bool aExclude)
Definition: sch_item.h:245
virtual void SetUnit(int aUnit)
Definition: sch_item.h:236
Container to create a flattened list of symbols because in a complex hierarchy, a symbol can be used ...
size_t GetCount() const
A helper to define a symbol's reference designator in a schematic.
const SCH_SHEET_PATH & GetSheetPath() const
SCH_SYMBOL * GetSymbol() const
void SetStroke(const STROKE_PARAMS &aStroke) override
Definition: sch_shape.cpp:63
STROKE_PARAMS GetStroke() const override
Definition: sch_shape.h:55
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
void SortByPageNumbers(bool aUpdateVirtualPageNums=true)
Sort the list of sheets by page number.
void GetSymbols(SCH_REFERENCE_LIST &aReferences, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanSymbols=false) const
Add a SCH_REFERENCE object to aReferences for each symbol in the list of sheets.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
void GetContextualTextVars(wxArrayString *aVars) const
Return the list of system text vars & fields for this sheet.
Definition: sch_sheet.cpp:202
Schematic symbol object.
Definition: sch_symbol.h:105
void GetContextualTextVars(wxArrayString *aVars) const
Return the list of system text vars & fields for this symbol.
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const override
Definition: sch_symbol.cpp:713
static HTML_MESSAGE_BOX * ShowSyntaxHelp(wxWindow *aParentWindow)
Definition: sch_label.cpp:2209
Add cut/copy/paste, dark theme, autocomplete and brace highlighting to a wxStyleTextCtrl instance.
void DoTextVarAutocomplete(const std::function< void(const wxString &xRef, wxArrayString *tokens)> &getTokensFn)
Simple container to manage line stroke parameters.
Definition: stroke_params.h:81
void SetLineStyle(LINE_STYLE aLineStyle)
Definition: stroke_params.h:95
void SetWidth(int aWidth)
Definition: stroke_params.h:92
void SetColor(const KIGFX::COLOR4D &aColor)
Definition: stroke_params.h:98
LINE_STYLE GetLineStyle() const
Definition: stroke_params.h:94
KIGFX::COLOR4D GetColor() const
Definition: stroke_params.h:97
The symbol library editor main window.
A base class for LIB_SYMBOL and SCH_SYMBOL.
Definition: symbol.h:34
virtual bool IsMulti() const =0
virtual bool HasAlternateBodyStyle() const =0
Test if symbol has more than one body conversion type (DeMorgan).
int GetIntValue()
Definition: unit_binder.h:127
virtual long long int GetValue()
Return the current value in Internal Units.
void Enable(bool aEnable)
Enable/disable the label, widget and units label.
virtual bool Validate(double aMin, double aMax, EDA_UNITS aUnits=EDA_UNITS::UNSCALED)
Validate the control against the given range, informing the user of any errors found.
virtual void SetValue(long long int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
void Show(bool aShow, bool aResize=false)
Show/hide the label, widget and units label.
void Append(const wxString &aText, const wxString &aMenuText=wxEmptyString)
void ShowMessage(const wxString &aMessage, int aFlags=wxICON_INFORMATION) override
Show the info bar with the provided message and icon.
Definition: wx_infobar.cpp:154
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:170
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
@ LAYER_SCHEMATIC_BACKGROUND
Definition: layer_ids.h:390
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: string_utils.h:391
const std::map< LINE_STYLE, struct LINE_STYLE_DESC > lineTypeNames
@ 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_TEXTBOX_T
Definition: typeinfo.h:152
VECTOR2< int > VECTOR2I
Definition: vector2d.h:602