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-2023 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>
28#include <widgets/font_choice.h>
30#include <widgets/wx_combobox.h>
32#include <sch_textbox.h>
33#include <confirm.h>
34#include <schematic.h>
35#include <sch_commit.h>
37#include <scintilla_tricks.h>
39#include <gr_text.h>
40
41
44 m_frame( aParent ),
45 m_currentItem( aTextItem ),
46 m_currentText( dynamic_cast<EDA_TEXT*>( aTextItem ) ),
47 m_textSize( aParent, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits ),
48 m_borderWidth( aParent, m_borderWidthLabel, m_borderWidthCtrl, m_borderWidthUnits ),
49 m_scintillaTricks( nullptr ),
50 m_helpWindow( nullptr )
51{
52 COLOR_SETTINGS* colorSettings = m_frame->GetColorSettings();
53 COLOR4D schematicBackground = colorSettings->GetColor( LAYER_SCHEMATIC_BACKGROUND );
54
55 if( aTextItem->Type() == SCH_TEXTBOX_T )
56 {
57 SetTitle( _( "Text Box Properties" ) );
58
59 m_borderColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
60 m_borderColorSwatch->SetSwatchBackground( schematicBackground );
61
62 for( const auto& [ lineStyle, lineStyleDesc ] : lineTypeNames )
63 m_borderStyleCombo->Append( lineStyleDesc.name, KiBitmap( lineStyleDesc.bitmap ) );
64
66
67 m_fillColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
68 m_fillColorSwatch->SetSwatchBackground( schematicBackground );
69
71 m_infoBar->ShowMessage( _( "Note: individual item colors overridden in Preferences." ) );
72 }
73 else
74 {
75 m_borderCheckbox->Show( false );
76 m_borderWidth.Show( false );
77 m_borderColorLabel->Show( false );
78 m_panelBorderColor->Show( false );
79 m_borderStyleLabel->Show( false );
80 m_borderStyleCombo->Show( false );
81 m_fillColorLabel->Show( false );
82 m_panelFillColor->Show( false );
83 m_filledCtrl->Show( false );
84 }
85
86 m_textCtrl->SetEOLMode( wxSTC_EOL_LF );
87
88#ifdef _WIN32
89 // Without this setting, on Windows, some esoteric unicode chars create display issue
90 // in a wxStyledTextCtrl.
91 // for SetTechnology() info, see https://www.scintilla.org/ScintillaDoc.html#SCI_SETTECHNOLOGY
92 m_textCtrl->SetTechnology(wxSTC_TECHNOLOGY_DIRECTWRITE);
93#endif
94
95 m_scintillaTricks = new SCINTILLA_TRICKS( m_textCtrl, wxT( "{}" ), false,
96 // onAccept handler
97 [this]( wxKeyEvent& aEvent )
98 {
99 wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
100 },
101 // onCharAdded handler
102 [this]( wxStyledTextEvent& aEvent )
103 {
105 [this]( const wxString& crossRef, wxArrayString* tokens )
106 {
107 getContextualTextVars( crossRef, tokens );
108 } );
109 } );
110
111 m_textEntrySizer->AddGrowableRow( 0 );
112
113 m_textColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
114 m_textColorSwatch->SetSwatchBackground( schematicBackground );
115
117
119
121 m_bold->SetBitmap( KiBitmapBundle( BITMAPS::text_bold ) );
123 m_italic->SetBitmap( KiBitmapBundle( BITMAPS::text_italic ) );
124
126
128 m_hAlignLeft->SetBitmap( KiBitmapBundle( BITMAPS::text_align_left ) );
130 m_hAlignCenter->SetBitmap( KiBitmapBundle( BITMAPS::text_align_center ) );
132 m_hAlignRight->SetBitmap( KiBitmapBundle( BITMAPS::text_align_right ) );
134
136 m_vAlignTop->SetBitmap( KiBitmapBundle( BITMAPS::text_valign_top ) );
138 m_vAlignCenter->SetBitmap( KiBitmapBundle( BITMAPS::text_valign_center ) );
140 m_vAlignBottom->SetBitmap( KiBitmapBundle( BITMAPS::text_valign_bottom ) );
141
143
145 m_horizontal->SetBitmap( KiBitmapBundle( BITMAPS::text_horizontal ) );
147 m_vertical->SetBitmap( KiBitmapBundle( BITMAPS::text_vertical ) );
148
150
151 SCH_SHEET_LIST sheetList = m_frame->Schematic().GetSheets();
152 sheetList.SortByPageNumbers( false );
153
154 for( const SCH_SHEET_PATH& sheet : sheetList )
155 {
156 wxString sheetPageNum = sheet.GetPageNumber();
157 wxString sheetName = sheet.size() == 1 ? _( "<root sheet>" ) : sheet.Last()->GetName();
158
159 m_hyperlinkCombo->Append( wxT( "#" ) + sheetPageNum,
160 wxString::Format( _( "Page %s (%s)" ), sheetPageNum, sheetName ) );
161 m_pageNumbers.push_back( sheetPageNum );
162 }
163
164 m_hyperlinkCombo->Append( wxT( "---" ) );
165 m_hyperlinkCombo->Append( wxT( "file://" ), wxT( "file://..." ) );
166 m_hyperlinkCombo->Append( wxT( "http://" ), wxT( "http://..." ) );
167 m_hyperlinkCombo->Append( wxT( "https://" ), wxT( "https://..." ) );
168
170 Layout();
171
172 m_hAlignLeft->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onHAlignButton, this );
173 m_hAlignCenter->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onHAlignButton, this );
174 m_hAlignRight->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onHAlignButton, this );
175 m_vAlignTop->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onVAlignButton, this );
176 m_vAlignCenter->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onVAlignButton, this );
177 m_vAlignBottom->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onVAlignButton, this );
178 m_horizontal->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onTextAngleButton, this );
179 m_vertical->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onTextAngleButton, this );
180
181 // Now all widgets have the size fixed, call FinishDialogSettings
183}
184
185
187{
188 delete m_scintillaTricks;
189
190 if( m_helpWindow )
191 m_helpWindow->Destroy();
192}
193
194
195void DIALOG_TEXT_PROPERTIES::getContextualTextVars( const wxString& aCrossRef,
196 wxArrayString* aTokens )
197{
198 if( !aCrossRef.IsEmpty() )
199 {
202 SCH_SYMBOL* refSymbol = nullptr;
203
204 sheets.GetSymbols( refs );
205
206 for( int jj = 0; jj < (int) refs.GetCount(); jj++ )
207 {
208 SCH_REFERENCE& ref = refs[jj];
209
210 if( ref.GetSymbol()->GetRef( &ref.GetSheetPath(), true ) == aCrossRef )
211 {
212 refSymbol = ref.GetSymbol();
213 break;
214 }
215 }
216
217 if( refSymbol )
218 refSymbol->GetContextualTextVars( aTokens );
219 }
220 else
221 {
222 SCHEMATIC* schematic = m_currentItem->Schematic();
223
224 if( schematic && schematic->CurrentSheet().Last() )
225 {
226 schematic->CurrentSheet().Last()->GetContextualTextVars( aTokens );
227 }
228 else
229 {
230 for( std::pair<wxString, wxString> entry : Prj().GetTextVars() )
231 aTokens->push_back( entry.first );
232 }
233 }
234}
235
236
238{
239 if( !wxDialog::TransferDataToWindow() )
240 return false;
241
242 SCHEMATIC& schematic = m_frame->Schematic();
243
246
247 // show text variable cross-references in a human-readable format
248 m_textCtrl->SetValue( schematic.ConvertKIIDsToRefs( m_currentText->GetText() ) );
249 m_textCtrl->EmptyUndoBuffer();
250
252
256
259
260 switch( m_currentText->GetHorizJustify() )
261 {
265 }
266
267 switch( m_currentText->GetVertJustify() )
268 {
269 case GR_TEXT_V_ALIGN_TOP: m_vAlignTop->Check(); break;
272 }
273
275 m_vertical->Check();
276 else
278
280 {
281 SCH_TEXTBOX* textBox = static_cast<SCH_TEXTBOX*>( m_currentItem );
282
283 m_borderCheckbox->SetValue( textBox->GetWidth() >= 0 );
284
285 if( textBox->GetWidth() >= 0 )
286 m_borderWidth.SetValue( textBox->GetWidth() );
287
289
290 int style = static_cast<int>( textBox->GetStroke().GetLineStyle() );
291
292 if( style == -1 )
293 m_borderStyleCombo->SetStringSelection( DEFAULT_STYLE );
294 else if( style < (int) lineTypeNames.size() )
295 m_borderStyleCombo->SetSelection( style );
296 else
297 wxFAIL_MSG( "Line type not found in the type lookup map" );
298
299 m_borderWidth.Enable( textBox->GetWidth() >= 0 );
300 m_borderColorLabel->Enable( textBox->GetWidth() >= 0 );
301 m_borderColorSwatch->Enable( textBox->GetWidth() >= 0 );
302 m_borderStyleLabel->Enable( textBox->GetWidth() >= 0 );
303 m_borderStyleCombo->Enable( textBox->GetWidth() >= 0 );
304
305 m_filledCtrl->SetValue( textBox->IsFilled() );
306 m_fillColorSwatch->SetSwatchColor( textBox->GetFillColor(), false );
307
308 m_fillColorLabel->Enable( textBox->IsFilled() );
309 m_fillColorSwatch->Enable( textBox->IsFilled() );
310 }
311
312 return true;
313}
314
315
316void DIALOG_TEXT_PROPERTIES::onBorderChecked( wxCommandEvent& aEvent )
317{
318 bool border = m_borderCheckbox->GetValue();
319
320 if( border && m_borderWidth.GetValue() < 0 )
322
323 m_borderWidth.Enable( border );
324 m_borderColorLabel->Enable( border );
325 m_borderColorSwatch->Enable( border );
326 m_borderStyleLabel->Enable( border );
327 m_borderStyleCombo->Enable( border );
328}
329
330
331void DIALOG_TEXT_PROPERTIES::onFillChecked( wxCommandEvent& aEvent )
332{
333 bool fill = m_filledCtrl->GetValue();
334
335 m_fillColorLabel->Enable( fill );
336 m_fillColorSwatch->Enable( fill );
337}
338
339
340void DIALOG_TEXT_PROPERTIES::onHyperlinkChecked( wxCommandEvent& aEvent )
341{
342 if( aEvent.IsChecked() && m_hyperlinkCombo->GetValue().IsEmpty() )
343 {
344 m_hyperlinkCombo->ChangeValue( m_lastLink );
345 }
346 else if( !aEvent.IsChecked() && !m_hyperlinkCombo->GetValue().IsEmpty() )
347 {
348 m_lastLink = m_hyperlinkCombo->GetValue();
349 m_hyperlinkCombo->SetValue( wxEmptyString );
350 }
351
352 aEvent.Skip();
353}
354
355
356void DIALOG_TEXT_PROPERTIES::onHyperlinkText( wxCommandEvent& event )
357{
358 if( !m_hyperlinkCombo->GetValue().IsEmpty() )
359 m_hyperlinkCb->SetValue( true );
360}
361
362
363void DIALOG_TEXT_PROPERTIES::onHyperlinkCombo( wxCommandEvent& aEvent )
364{
365 if( aEvent.GetSelection() >= 0 )
366 {
367 m_hyperlinkCb->SetValue( true );
368 m_hyperlinkCombo->SetInsertionPointEnd();
369 }
370}
371
372
373void DIALOG_TEXT_PROPERTIES::onHAlignButton( wxCommandEvent& aEvent )
374{
376 {
377 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
378 btn->Check( false );
379 }
380}
381
382
383void DIALOG_TEXT_PROPERTIES::onVAlignButton( wxCommandEvent& aEvent )
384{
386 {
387 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
388 btn->Check( false );
389 }
390}
391
392
393void DIALOG_TEXT_PROPERTIES::onTextAngleButton( wxCommandEvent& aEvent )
394{
395 for( BITMAP_BUTTON* btn : { m_horizontal, m_vertical } )
396 {
397 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
398 btn->Check( false );
399 }
400}
401
402
404{
405 if( !wxDialog::TransferDataFromWindow() )
406 return false;
407
408 // Don't allow text to disappear; it can be difficult to correct if you can't select it
409 if( !m_textSize.Validate( 0.01, 1000.0, EDA_UNITS::MILLIMETRES ) )
410 return false;
411
412 SCH_COMMIT commit( m_frame );
413 wxString text;
414
415 /* save old text in undo list if not already in edit */
416 if( m_currentItem->GetEditFlags() == 0 )
418
420
421 // convert any text variable cross-references to their UUIDs
423
424#ifdef __WXMAC__
425 // On macOS CTRL+Enter produces '\r' instead of '\n' regardless of EOL setting
426 text.Replace( "\r", "\n" );
427#elif defined( __WINDOWS__ )
428 // On Windows, a new line is coded as \r\n. We use only \n in kicad files and in
429 // drawing routines so strip the \r char.
430 text.Replace( "\r", "" );
431#endif
432
434 {
435 // Textboxes have a defined extent and so are allowed to be empty
437 }
438 else if( !text.IsEmpty() )
439 {
441 }
442 else
443 {
444 // Other text items do not have defined extents, and so will disappear if empty
445 DisplayError( this, _( "Text can not be empty." ) );
446 return false;
447 }
448
450
452 {
453 DisplayError( this, _( "Invalid hyperlink destination. Please enter either a valid URL "
454 "(e.g. file:// or http(s)://) or \"#<page number>\" to create "
455 "a hyperlink to a page in this schematic." ) );
456 return false;
457 }
458 else
459 {
461 }
462
465
467 {
469 m_italic->IsChecked() ) );
470 }
471
472 if( m_bold->IsChecked() != m_currentText->IsBold() )
473 {
474 if( m_bold->IsChecked() )
475 {
476 m_currentText->SetBold( true );
478 }
479 else
480 {
481 m_currentText->SetBold( false );
482 m_currentText->SetTextThickness( 0 ); // Use default pen width
483 }
484 }
485
488
489 if( m_hAlignRight->IsChecked() )
491 else if( m_hAlignCenter->IsChecked() )
493 else
495
498 else if( m_vAlignCenter->IsChecked() )
500 else
502
503 if( m_vertical->IsChecked() )
505 else
507
509 {
510 SCH_TEXTBOX* textBox = static_cast<SCH_TEXTBOX*>( m_currentItem );
511
512 STROKE_PARAMS stroke = textBox->GetStroke();
513
514 if( m_borderCheckbox->GetValue() )
515 stroke.SetWidth( std::max( 0, m_borderWidth.GetIntValue() ) );
516 else
517 stroke.SetWidth( -1 );
518
519 auto it = lineTypeNames.begin();
520 std::advance( it, m_borderStyleCombo->GetSelection() );
521
522 if( it == lineTypeNames.end() )
523 stroke.SetLineStyle( LINE_STYLE::DEFAULT );
524 else
525 stroke.SetLineStyle( it->first );
526
528
529 textBox->SetStroke( stroke );
530
531 textBox->SetFillMode( m_filledCtrl->GetValue() ? FILL_T::FILLED_WITH_COLOR
532 : FILL_T::NO_FILL );
534 }
535
536 if( !commit.Empty() )
537 commit.Push( _( "Edit Text" ), SKIP_CONNECTIVITY );
538
539 return true;
540}
541
542
543void DIALOG_TEXT_PROPERTIES::OnFormattingHelp( wxHyperlinkEvent& aEvent )
544{
546}
547
548
550{
553
554 event.Skip();
555}
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
Definition: bitmap.cpp:110
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Definition: bitmap.cpp:104
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...
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:103
bool Empty() const
Returns status of an item.
Definition: commit.h:142
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...
void onHyperlinkText(wxCommandEvent &aEvent) override
DIALOG_TEXT_PROPERTIES(SCH_EDIT_FRAME *parent, SCH_ITEM *aTextItem)
void onFillChecked(wxCommandEvent &aEvent) override
void onMultiLineTCLostFocus(wxFocusEvent &event) override
void onBorderChecked(wxCommandEvent &aEvent) override
void OnFormattingHelp(wxHyperlinkEvent &aEvent) override
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:129
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
bool IsFilled() const
Definition: eda_shape.h:90
void SetFillColor(const COLOR4D &aColor)
Definition: eda_shape.h:106
COLOR4D GetFillColor() const
Definition: eda_shape.h:105
virtual int GetWidth() const
Definition: eda_shape.h:109
void SetFillMode(FILL_T aFill)
Definition: eda_shape.h:100
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:226
COLOR4D GetTextColor() const
Definition: eda_text.h:227
void SetTextSize(VECTOR2I aNewSize)
Definition: eda_text.cpp:358
bool IsItalic() const
Definition: eda_text.h:141
const EDA_ANGLE & GetTextAngle() const
Definition: eda_text.h:131
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:95
KIFONT::FONT * GetFont() const
Definition: eda_text.h:207
int GetTextWidth() const
Definition: eda_text.h:221
virtual bool HasHyperlink() const
Definition: eda_text.h:357
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
Definition: eda_text.cpp:260
wxString GetHyperlink() const
Definition: eda_text.h:358
GR_TEXT_H_ALIGN_T GetHorizJustify() const
Definition: eda_text.h:160
void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
Definition: eda_text.cpp:197
void SetBold(bool aBold)
Definition: eda_text.cpp:221
static bool ValidateHyperlink(const wxString &aURL)
Check if aURL is a valid hyperlink.
Definition: eda_text.cpp:1055
bool IsBold() const
Definition: eda_text.h:144
void SetHyperlink(wxString aLink)
Definition: eda_text.h:359
GR_TEXT_V_ALIGN_T GetVertJustify() const
Definition: eda_text.h:163
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:342
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
Definition: eda_text.cpp:252
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
wxString ConvertKIIDsToRefs(const wxString &aSource) const
Definition: schematic.cpp:537
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:469
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:353
Schematic editor (Eeschema) main window.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
SCHEMATIC & Schematic() const
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:151
virtual bool GetExcludedFromSim() const
Definition: sch_item.h:211
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:113
virtual void SetExcludedFromSim(bool aExclude)
Definition: sch_item.h:210
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:64
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:81
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const
Return the reference for the given sheet path.
Definition: sch_symbol.cpp:738
void GetContextualTextVars(wxArrayString *aVars) const
Return the list of system text vars & fields for this symbol.
static HTML_MESSAGE_BOX * ShowSyntaxHelp(wxWindow *aParentWindow)
Definition: sch_label.cpp:2050
Add cut/copy/paste, dark theme, autocomplete and brace highlighting to a wxStyleTextCtrl instance.
void DoTextVarAutocomplete(std::function< void(const wxString &crossRef, wxArrayString *tokens)> aTokenProvider)
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
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:280
This file is part of the common library.
#define _(s)
static constexpr EDA_ANGLE & ANGLE_HORIZONTAL
Definition: eda_angle.h:433
static constexpr EDA_ANGLE & ANGLE_VERTICAL
Definition: eda_angle.h:434
int GetPenSizeForBold(int aTextSize)
Definition: gr_text.cpp:40
@ LAYER_SCHEMATIC_BACKGROUND
Definition: layer_ids.h:382
#define SKIP_CONNECTIVITY
Definition: sch_commit.h:43
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_V_ALIGN_BOTTOM
@ GR_TEXT_V_ALIGN_CENTER
@ GR_TEXT_V_ALIGN_TOP
@ SCH_TEXTBOX_T
Definition: typeinfo.h:149
VECTOR2< int > VECTOR2I
Definition: vector2d.h:588