KiCad PCB EDA Suite
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-2022 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>
31#include <base_units.h>
33#include <tool/tool_manager.h>
34#include <general.h>
35#include <sch_textbox.h>
36#include <confirm.h>
37#include <schematic.h>
39#include <string_utils.h>
40#include <scintilla_tricks.h>
42#include <gr_text.h>
43
44
47 m_frame( aParent ),
48 m_currentItem( aTextItem ),
49 m_currentText( dynamic_cast<EDA_TEXT*>( aTextItem ) ),
50 m_textSize( aParent, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits ),
51 m_borderWidth( aParent, m_borderWidthLabel, m_borderWidthCtrl, m_borderWidthUnits ),
52 m_scintillaTricks( nullptr ),
53 m_helpWindow( 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 std::pair<const PLOT_DASH_TYPE, lineTypeStruct>& typeEntry : lineTypeNames )
66 m_borderStyleCombo->Append( typeEntry.second.name, KiBitmap( typeEntry.second.bitmap ) );
67
69
70 m_fillColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
71 m_fillColorSwatch->SetSwatchBackground( schematicBackground );
72
74 m_infoBar->ShowMessage( _( "Note: individual item colors overridden in Preferences." ) );
75 }
76 else
77 {
78 m_hAlignCenter->Show( false );
79 m_separator3->Show( false );
80 m_vAlignTop->Show( false );
81 m_vAlignCenter->Show( false );
82 m_vAlignBottom->Show( false );
83
84 wxSizer* parentSizer = m_vAlignTop->GetContainingSizer();
85 parentSizer->Detach( m_hAlignCenter );
86 parentSizer->Detach( m_separator3 );
87 parentSizer->Detach( m_vAlignTop );
88 parentSizer->Detach( m_vAlignCenter );
89 parentSizer->Detach( m_vAlignBottom );
90 parentSizer->Layout();
91
92 m_borderCheckbox->Show( false );
93 m_borderWidth.Show( false );
94 m_borderColorLabel->Show( false );
95 m_panelBorderColor->Show( false );
96 m_borderStyleLabel->Show( false );
97 m_borderStyleCombo->Show( false );
98 m_fillColorLabel->Show( false );
99 m_panelFillColor->Show( false );
100 m_filledCtrl->Show( false );
101 }
102
103 m_textCtrl->SetEOLMode( wxSTC_EOL_LF );
104
105 m_scintillaTricks = new SCINTILLA_TRICKS( m_textCtrl, wxT( "{}" ), false,
106 [this]()
107 {
108 wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
109 } );
110
111 m_textEntrySizer->AddGrowableRow( 0 );
112
113 m_textColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
114 m_textColorSwatch->SetSwatchBackground( schematicBackground );
115
117
119
124
126
134
141
143
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_textCtrl->Bind( wxEVT_STC_CHARADDED, &DIALOG_TEXT_PROPERTIES::onScintillaCharAdded, this );
173 m_hAlignLeft->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onHAlignButton, this );
174 m_hAlignCenter->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onHAlignButton, this );
175 m_hAlignRight->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onHAlignButton, this );
176 m_vAlignTop->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onVAlignButton, this );
177 m_vAlignCenter->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onVAlignButton, this );
178 m_vAlignBottom->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onVAlignButton, this );
179 m_horizontal->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onTextAngleButton, this );
180 m_vertical->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onTextAngleButton, this );
181
182 // Now all widgets have the size fixed, call FinishDialogSettings
184}
185
186
188{
189 delete m_scintillaTricks;
190
191 if( m_helpWindow )
192 m_helpWindow->Destroy();
193}
194
195
197{
198 if( !wxDialog::TransferDataToWindow() )
199 return false;
200
201 SCHEMATIC& schematic = m_frame->Schematic();
202
205
206 // show text variable cross-references in a human-readable format
207 m_textCtrl->SetValue( schematic.ConvertKIIDsToRefs( m_currentText->GetText() ) );
208 m_textCtrl->EmptyUndoBuffer();
209
213
216
218 {
219 SCH_TEXTBOX* textBox = static_cast<SCH_TEXTBOX*>( m_currentItem );
220
221 switch( m_currentText->GetHorizJustify() )
222 {
226 }
227
228 switch( m_currentText->GetVertJustify() )
229 {
230 case GR_TEXT_V_ALIGN_TOP: m_vAlignTop->Check(); break;
233 }
234
236 m_vertical->Check();
237 else
239
240 m_borderCheckbox->SetValue( textBox->GetWidth() >= 0 );
241
242 if( textBox->GetWidth() >= 0 )
243 m_borderWidth.SetValue( textBox->GetWidth() );
244
246
247 int style = static_cast<int>( textBox->GetStroke().GetPlotStyle() );
248
249 if( style == -1 )
250 m_borderStyleCombo->SetStringSelection( DEFAULT_STYLE );
251 else if( style < (int) lineTypeNames.size() )
252 m_borderStyleCombo->SetSelection( style );
253 else
254 wxFAIL_MSG( "Line type not found in the type lookup map" );
255
256 m_borderWidth.Enable( textBox->GetWidth() >= 0 );
257 m_borderColorLabel->Enable( textBox->GetWidth() >= 0 );
258 m_borderColorSwatch->Enable( textBox->GetWidth() >= 0 );
259 m_borderStyleLabel->Enable( textBox->GetWidth() >= 0 );
260 m_borderStyleCombo->Enable( textBox->GetWidth() >= 0 );
261
262 m_filledCtrl->SetValue( textBox->IsFilled() );
263 m_fillColorSwatch->SetSwatchColor( textBox->GetFillColor(), false );
264
265 m_fillColorLabel->Enable( textBox->IsFilled() );
266 m_fillColorSwatch->Enable( textBox->IsFilled() );
267 }
268 else
269 {
270 switch( static_cast<SCH_TEXT*>( m_currentItem )->GetTextSpinStyle() )
271 {
273 m_hAlignLeft->Check( true ); // Spin style to right means text aligned left
274 m_horizontal->Check( true );
275 break;
277 m_hAlignRight->Check( true ); // Spin style to left means text aligned right
278 m_horizontal->Check( true );
279 break;
281 m_hAlignLeft->Check( true ); // Spin style up means text aligned to bottom
282 m_vertical->Check( true );
283 break;
284 case TEXT_SPIN_STYLE::BOTTOM: // Spin style down means text aligned to top
285 m_hAlignRight->Check( true );
286 m_vertical->Check( true );
287 break;
288 }
289 }
290
291 return true;
292}
293
294
295void DIALOG_TEXT_PROPERTIES::onBorderChecked( wxCommandEvent& aEvent )
296{
297 bool border = m_borderCheckbox->GetValue();
298
299 if( border && m_borderWidth.GetValue() < 0 )
301
302 m_borderWidth.Enable( border );
303 m_borderColorLabel->Enable( border );
304 m_borderColorSwatch->Enable( border );
305 m_borderStyleLabel->Enable( border );
306 m_borderStyleCombo->Enable( border );
307}
308
309
310void DIALOG_TEXT_PROPERTIES::onFillChecked( wxCommandEvent& aEvent )
311{
312 bool fill = m_filledCtrl->GetValue();
313
314 m_fillColorLabel->Enable( fill );
315 m_fillColorSwatch->Enable( fill );
316}
317
318
319void DIALOG_TEXT_PROPERTIES::onHyperlinkChecked( wxCommandEvent& aEvent )
320{
321 if( aEvent.IsChecked() && m_hyperlinkCombo->GetValue().IsEmpty() )
322 {
323 m_hyperlinkCombo->ChangeValue( m_lastLink );
324 }
325 else if( !aEvent.IsChecked() && !m_hyperlinkCombo->GetValue().IsEmpty() )
326 {
327 m_lastLink = m_hyperlinkCombo->GetValue();
328 m_hyperlinkCombo->SetValue( wxEmptyString );
329 }
330
331 aEvent.Skip();
332}
333
334
335void DIALOG_TEXT_PROPERTIES::onHyperlinkText( wxCommandEvent& event )
336{
337 if( !m_hyperlinkCombo->GetValue().IsEmpty() )
338 m_hyperlinkCb->SetValue( true );
339}
340
341
342void DIALOG_TEXT_PROPERTIES::onHyperlinkCombo( wxCommandEvent& aEvent )
343{
344 if( aEvent.GetSelection() >= 0 )
345 {
346 m_hyperlinkCb->SetValue( true );
347 m_hyperlinkCombo->SetInsertionPointEnd();
348 }
349}
350
351
352void DIALOG_TEXT_PROPERTIES::onScintillaCharAdded( wxStyledTextEvent &aEvent )
353{
354 wxStyledTextCtrl* te = m_textCtrl;
355 wxArrayString autocompleteTokens;
356 int text_pos = te->GetCurrentPos();
357 int start = te->WordStartPosition( text_pos, true );
358 wxString partial;
359
360 auto textVarRef =
361 [&]( int pos )
362 {
363 return pos >= 2 && te->GetCharAt( pos-2 ) == '$' && te->GetCharAt( pos-1 ) == '{';
364 };
365
366 // Check for cross-reference
367 if( start > 1 && te->GetCharAt( start-1 ) == ':' )
368 {
369 int refStart = te->WordStartPosition( start-1, true );
370
371 if( textVarRef( refStart ) )
372 {
373 partial = te->GetRange( start+1, text_pos );
374
375 wxString ref = te->GetRange( refStart, start-1 );
378 SCH_SYMBOL* refSymbol = nullptr;
379
380 sheets.GetSymbols( refs );
381
382 for( size_t jj = 0; jj < refs.GetCount(); jj++ )
383 {
384 if( refs[ jj ].GetSymbol()->GetRef( &refs[ jj ].GetSheetPath(), true ) == ref )
385 {
386 refSymbol = refs[ jj ].GetSymbol();
387 break;
388 }
389 }
390
391 if( refSymbol )
392 refSymbol->GetContextualTextVars( &autocompleteTokens );
393 }
394 }
395 else if( textVarRef( start ) )
396 {
397 partial = te->GetTextRange( start, text_pos );
398
399 SCHEMATIC* schematic = m_currentItem->Schematic();
400
401 if( schematic && schematic->CurrentSheet().Last() )
402 schematic->CurrentSheet().Last()->GetContextualTextVars( &autocompleteTokens );
403
404 for( std::pair<wxString, wxString> entry : Prj().GetTextVars() )
405 autocompleteTokens.push_back( entry.first );
406 }
407
408 m_scintillaTricks->DoAutocomplete( partial, autocompleteTokens );
409 m_textCtrl->SetFocus();
410}
411
412
413void DIALOG_TEXT_PROPERTIES::onHAlignButton( wxCommandEvent& aEvent )
414{
416 {
417 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
418 btn->Check( false );
419 }
420}
421
422
423void DIALOG_TEXT_PROPERTIES::onVAlignButton( wxCommandEvent& aEvent )
424{
426 {
427 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
428 btn->Check( false );
429 }
430}
431
432
433void DIALOG_TEXT_PROPERTIES::onTextAngleButton( wxCommandEvent& aEvent )
434{
435 for( BITMAP_BUTTON* btn : { m_horizontal, m_vertical } )
436 {
437 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
438 btn->Check( false );
439 }
440}
441
442
444{
445 if( !wxDialog::TransferDataFromWindow() )
446 return false;
447
448 // Don't allow text to disappear; it can be difficult to correct if you can't select it
449 if( !m_textSize.Validate( 0.01, 1000.0, EDA_UNITS::MILLIMETRES ) )
450 return false;
451
452 wxString text;
453
454 /* save old text in undo list if not already in edit */
455 if( m_currentItem->GetEditFlags() == 0 )
456 {
458 false, false );
459 }
460
462
463 // convert any text variable cross-references to their UUIDs
465
466#ifdef __WXMAC__
467 // On macOS CTRL+Enter produces '\r' instead of '\n' regardless of EOL setting
468 text.Replace( "\r", "\n" );
469#elif defined( __WINDOWS__ )
470 // On Windows, a new line is coded as \r\n. We use only \n in kicad files and in
471 // drawing routines so strip the \r char.
472 text.Replace( "\r", "" );
473#endif
474
476 {
477 // Textboxes have a defined extent and so are allowed to be empty
479 }
480 else if( !text.IsEmpty() )
481 {
483 }
484 else
485 {
486 // Other text items do not have defined extents, and so will disappear if empty
487 DisplayError( this, _( "Text can not be empty." ) );
488 return false;
489 }
490
492 {
493 DisplayError( this, _( "Invalid hyperlink destination. Please enter either a valid URL "
494 "(e.g. file:// or http(s)://) or \"#<page number>\" to create "
495 "a hyperlink to a page in this schematic." ) );
496 return false;
497 }
498 else
499 {
501 }
502
505
507 {
509 m_italic->IsChecked() ) );
510 }
511
512 if( m_bold->IsChecked() != m_currentText->IsBold() )
513 {
514 if( m_bold->IsChecked() )
515 {
516 m_currentText->SetBold( true );
518 }
519 else
520 {
521 m_currentText->SetBold( false );
522 m_currentText->SetTextThickness( 0 ); // Use default pen width
523 }
524 }
525
528
529 if( m_currentItem->Type() == SCH_TEXT_T )
530 {
531 SCH_TEXT* textItem = static_cast<SCH_TEXT*>( m_currentItem );
532
533 if( m_hAlignRight->IsChecked() )
534 {
535 if( m_vertical->IsChecked() )
537 else
539 }
540 else
541 {
542 if( m_vertical->IsChecked() )
544 else
546 }
547 }
548 else
549 {
550 SCH_TEXTBOX* textBox = static_cast<SCH_TEXTBOX*>( m_currentItem );
551
552 if( m_hAlignRight->IsChecked() )
554 else if( m_hAlignCenter->IsChecked() )
556 else
558
561 else if( m_vAlignCenter->IsChecked() )
563 else
565
566 if( m_vertical->IsChecked() )
568 else
570
571 STROKE_PARAMS stroke = textBox->GetStroke();
572
573 if( m_borderCheckbox->GetValue() )
574 stroke.SetWidth( std::max( (long long int) 0, m_borderWidth.GetValue() ) );
575 else
576 stroke.SetWidth( -1 );
577
578 auto it = lineTypeNames.begin();
579 std::advance( it, m_borderStyleCombo->GetSelection() );
580
581 if( it == lineTypeNames.end() )
583 else
584 stroke.SetPlotStyle( it->first );
585
587
588 textBox->SetStroke( stroke );
589
591 : FILL_T::NO_FILL );
593 }
594
595 m_frame->UpdateItem( m_currentItem, false, true );
597 m_frame->OnModify();
598
599 return true;
600}
601
602
603void DIALOG_TEXT_PROPERTIES::OnFormattingHelp( wxHyperlinkEvent& aEvent )
604{
606}
607
608
610{
613
614 event.Skip();
615}
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:105
@ text_align_right
@ text_valign_top
@ text_align_left
@ text_valign_center
@ text_vertical
@ text_align_center
@ text_horizontal
@ text_valign_bottom
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 SetBitmap(const wxBitmap &aBmp)
Set the bitmap shown when the button is enabled.
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).
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.
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 onScintillaCharAdded(wxStyledTextEvent &aEvent)
void onHyperlinkChecked(wxCommandEvent &aEvent) override
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
EDA_ITEM_FLAGS GetEditFlags() const
Definition: eda_item.h:145
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
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:72
void SetTextColor(const COLOR4D &aColor)
Definition: eda_text.h:204
COLOR4D GetTextColor() const
Definition: eda_text.h:205
bool IsItalic() const
Definition: eda_text.h:130
const EDA_ANGLE & GetTextAngle() const
Definition: eda_text.h:120
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:87
KIFONT::FONT * GetFont() const
Definition: eda_text.h:188
int GetTextWidth() const
Definition: eda_text.h:199
virtual bool HasHyperlink() const
Definition: eda_text.h:333
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
Definition: eda_text.cpp:248
wxString GetHyperlink() const
Definition: eda_text.h:334
GR_TEXT_H_ALIGN_T GetHorizJustify() const
Definition: eda_text.h:149
void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
Definition: eda_text.cpp:185
void SetBold(bool aBold)
Definition: eda_text.cpp:209
static bool ValidateHyperlink(const wxString &aURL)
Check if aURL is a valid hyperlink.
Definition: eda_text.cpp:980
bool IsBold() const
Definition: eda_text.h:133
void SetHyperlink(wxString aLink)
Definition: eda_text.h:335
GR_TEXT_V_ALIGN_T GetVertJustify() const
Definition: eda_text.h:152
void SetTextSize(const VECTOR2I &aNewSize)
Definition: eda_text.cpp:347
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:163
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
Definition: eda_text.cpp:193
void SetItalic(bool aItalic)
Definition: eda_text.cpp:201
void SetFont(KIFONT::FONT *aFont)
Definition: eda_text.cpp:331
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
Definition: eda_text.cpp:240
bool HaveFontSelection() const
Definition: font_choice.cpp:88
void SetFontSelection(KIFONT::FONT *aFont)
Definition: font_choice.cpp:67
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:82
Holds all the data relating to one schematic.
Definition: schematic.h:61
SCH_SHEET_PATH & CurrentSheet() const override
Definition: schematic.h:122
wxString ConvertKIIDsToRefs(const wxString &aSource) const
Definition: schematic.cpp:451
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:86
wxString ConvertRefsToKIIDs(const wxString &aSource) const
Definition: schematic.cpp:383
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.
Schematic editor (Eeschema) main window.
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag and update other data struc...
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void SaveCopyInUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItemToCopy, UNDO_REDO aTypeCommand, bool aAppend, bool aDirtyConnectivity=true)
Create a copy of the current schematic item, and put it in the undo list.
SCHEMATIC & Schematic() const
void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false, bool aUpdateRtree=false) override
Mark an item for refresh.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:147
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:112
Container to create a flattened list of symbols because in a complex hierarchy, a symbol can be used ...
size_t GetCount() const
void SetStroke(const STROKE_PARAMS &aStroke) override
Definition: sch_shape.cpp:61
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
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:1649
virtual void SetTextSpinStyle(TEXT_SPIN_STYLE aSpinStyle)
Set a spin or rotation angle, along with specific horizontal and vertical justification styles with e...
Definition: sch_text.cpp:188
Add cut/copy/paste, dark theme, autocomplete and brace highlighting to a wxStyleTextCtrl instance.
void DoAutocomplete(const wxString &aPartial, const wxArrayString &aTokens)
Simple container to manage line stroke parameters.
Definition: stroke_params.h:88
void SetWidth(int aWidth)
Definition: stroke_params.h:99
void SetColor(const KIGFX::COLOR4D &aColor)
KIGFX::COLOR4D GetColor() const
PLOT_DASH_TYPE GetPlotStyle() const
void SetPlotStyle(PLOT_DASH_TYPE aPlotStyle)
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:142
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:300
This file is part of the common library.
#define _(s)
static constexpr EDA_ANGLE & ANGLE_HORIZONTAL
Definition: eda_angle.h:419
static constexpr EDA_ANGLE & ANGLE_VERTICAL
Definition: eda_angle.h:420
@ FILLED_WITH_COLOR
int GetPenSizeForBold(int aTextSize)
Definition: gr_text.cpp:40
@ LAYER_SCHEMATIC_BACKGROUND
Definition: layer_ids.h:376
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
const std::map< PLOT_DASH_TYPE, struct lineTypeStruct > lineTypeNames
Definition: stroke_params.h:70
@ 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_TEXT_T
Definition: typeinfo.h:150
@ SCH_TEXTBOX_T
Definition: typeinfo.h:149