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
212
215
217 {
218 SCH_TEXTBOX* textBox = static_cast<SCH_TEXTBOX*>( m_currentItem );
219
220 switch( m_currentText->GetHorizJustify() )
221 {
225 }
226
227 switch( m_currentText->GetVertJustify() )
228 {
229 case GR_TEXT_V_ALIGN_TOP: m_vAlignTop->Check(); break;
232 }
233
235 m_vertical->Check();
236 else
238
239 m_borderCheckbox->SetValue( textBox->GetWidth() >= 0 );
240
241 if( textBox->GetWidth() >= 0 )
242 m_borderWidth.SetValue( textBox->GetWidth() );
243
245
246 int style = static_cast<int>( textBox->GetStroke().GetPlotStyle() );
247
248 if( style == -1 )
249 m_borderStyleCombo->SetStringSelection( DEFAULT_STYLE );
250 else if( style < (int) lineTypeNames.size() )
251 m_borderStyleCombo->SetSelection( style );
252 else
253 wxFAIL_MSG( "Line type not found in the type lookup map" );
254
255 m_borderWidth.Enable( textBox->GetWidth() >= 0 );
256 m_borderColorLabel->Enable( textBox->GetWidth() >= 0 );
257 m_borderColorSwatch->Enable( textBox->GetWidth() >= 0 );
258 m_borderStyleLabel->Enable( textBox->GetWidth() >= 0 );
259 m_borderStyleCombo->Enable( textBox->GetWidth() >= 0 );
260
261 m_filledCtrl->SetValue( textBox->IsFilled() );
262 m_fillColorSwatch->SetSwatchColor( textBox->GetFillColor(), false );
263
264 m_fillColorLabel->Enable( textBox->IsFilled() );
265 m_fillColorSwatch->Enable( textBox->IsFilled() );
266 }
267 else
268 {
269 switch( static_cast<SCH_TEXT*>( m_currentItem )->GetTextSpinStyle() )
270 {
272 m_hAlignLeft->Check( true ); // Spin style to right means text aligned left
273 m_horizontal->Check( true );
274 break;
276 m_hAlignRight->Check( true ); // Spin style to left means text aligned right
277 m_horizontal->Check( true );
278 break;
280 m_hAlignLeft->Check( true ); // Spin style up means text aligned to bottom
281 m_vertical->Check( true );
282 break;
283 case TEXT_SPIN_STYLE::BOTTOM: // Spin style down means text aligned to top
284 m_hAlignRight->Check( true );
285 m_vertical->Check( true );
286 break;
287 }
288 }
289
290 return true;
291}
292
293
294void DIALOG_TEXT_PROPERTIES::onBorderChecked( wxCommandEvent& aEvent )
295{
296 bool border = m_borderCheckbox->GetValue();
297
298 if( border && m_borderWidth.GetValue() < 0 )
300
301 m_borderWidth.Enable( border );
302 m_borderColorLabel->Enable( border );
303 m_borderColorSwatch->Enable( border );
304 m_borderStyleLabel->Enable( border );
305 m_borderStyleCombo->Enable( border );
306}
307
308
309void DIALOG_TEXT_PROPERTIES::onFillChecked( wxCommandEvent& aEvent )
310{
311 bool fill = m_filledCtrl->GetValue();
312
313 m_fillColorLabel->Enable( fill );
314 m_fillColorSwatch->Enable( fill );
315}
316
317
318void DIALOG_TEXT_PROPERTIES::onHyperlinkChecked( wxCommandEvent& aEvent )
319{
320 if( aEvent.IsChecked() && m_hyperlinkCombo->GetValue().IsEmpty() )
321 {
322 m_hyperlinkCombo->ChangeValue( m_lastLink );
323 }
324 else if( !aEvent.IsChecked() && !m_hyperlinkCombo->GetValue().IsEmpty() )
325 {
326 m_lastLink = m_hyperlinkCombo->GetValue();
327 m_hyperlinkCombo->SetValue( wxEmptyString );
328 }
329
330 aEvent.Skip();
331}
332
333
334void DIALOG_TEXT_PROPERTIES::onHyperlinkText( wxCommandEvent& event )
335{
336 if( !m_hyperlinkCombo->GetValue().IsEmpty() )
337 m_hyperlinkCb->SetValue( true );
338}
339
340
341void DIALOG_TEXT_PROPERTIES::onHyperlinkCombo( wxCommandEvent& aEvent )
342{
343 if( aEvent.GetSelection() >= 0 )
344 {
345 m_hyperlinkCb->SetValue( true );
346 m_hyperlinkCombo->SetInsertionPointEnd();
347 }
348}
349
350
351void DIALOG_TEXT_PROPERTIES::onScintillaCharAdded( wxStyledTextEvent &aEvent )
352{
353 wxStyledTextCtrl* te = m_textCtrl;
354 wxArrayString autocompleteTokens;
355 int text_pos = te->GetCurrentPos();
356 int start = te->WordStartPosition( text_pos, true );
357 wxString partial;
358
359 auto textVarRef =
360 [&]( int pos )
361 {
362 return pos >= 2 && te->GetCharAt( pos-2 ) == '$' && te->GetCharAt( pos-1 ) == '{';
363 };
364
365 // Check for cross-reference
366 if( start > 1 && te->GetCharAt( start-1 ) == ':' )
367 {
368 int refStart = te->WordStartPosition( start-1, true );
369
370 if( textVarRef( refStart ) )
371 {
372 partial = te->GetRange( start+1, text_pos );
373
374 wxString ref = te->GetRange( refStart, start-1 );
377 SCH_SYMBOL* refSymbol = nullptr;
378
379 sheets.GetSymbols( refs );
380
381 for( size_t jj = 0; jj < refs.GetCount(); jj++ )
382 {
383 if( refs[ jj ].GetSymbol()->GetRef( &refs[ jj ].GetSheetPath(), true ) == ref )
384 {
385 refSymbol = refs[ jj ].GetSymbol();
386 break;
387 }
388 }
389
390 if( refSymbol )
391 refSymbol->GetContextualTextVars( &autocompleteTokens );
392 }
393 }
394 else if( textVarRef( start ) )
395 {
396 partial = te->GetTextRange( start, text_pos );
397
398 SCHEMATIC* schematic = m_currentItem->Schematic();
399
400 if( schematic && schematic->CurrentSheet().Last() )
401 schematic->CurrentSheet().Last()->GetContextualTextVars( &autocompleteTokens );
402
403 for( std::pair<wxString, wxString> entry : Prj().GetTextVars() )
404 autocompleteTokens.push_back( entry.first );
405 }
406
407 m_scintillaTricks->DoAutocomplete( partial, autocompleteTokens );
408 m_textCtrl->SetFocus();
409}
410
411
412void DIALOG_TEXT_PROPERTIES::onHAlignButton( wxCommandEvent& aEvent )
413{
415 {
416 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
417 btn->Check( false );
418 }
419}
420
421
422void DIALOG_TEXT_PROPERTIES::onVAlignButton( wxCommandEvent& aEvent )
423{
425 {
426 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
427 btn->Check( false );
428 }
429}
430
431
432void DIALOG_TEXT_PROPERTIES::onTextAngleButton( wxCommandEvent& aEvent )
433{
434 for( BITMAP_BUTTON* btn : { m_horizontal, m_vertical } )
435 {
436 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
437 btn->Check( false );
438 }
439}
440
441
443{
444 if( !wxDialog::TransferDataFromWindow() )
445 return false;
446
447 // Don't allow text to disappear; it can be difficult to correct if you can't select it
448 if( !m_textSize.Validate( 0.01, 1000.0, EDA_UNITS::MILLIMETRES ) )
449 return false;
450
451 wxString text;
452
453 /* save old text in undo list if not already in edit */
454 if( m_currentItem->GetEditFlags() == 0 )
455 {
457 false, false );
458 }
459
461
462 // convert any text variable cross-references to their UUIDs
464
465#ifdef __WXMAC__
466 // On macOS CTRL+Enter produces '\r' instead of '\n' regardless of EOL setting
467 text.Replace( "\r", "\n" );
468#elif defined( __WINDOWS__ )
469 // On Windows, a new line is coded as \r\n. We use only \n in kicad files and in
470 // drawing routines so strip the \r char.
471 text.Replace( "\r", "" );
472#endif
473
475 {
476 // Textboxes have a defined extent and so are allowed to be empty
478 }
479 else if( !text.IsEmpty() )
480 {
482 }
483 else
484 {
485 // Other text items do not have defined extents, and so will disappear if empty
486 DisplayError( this, _( "Text can not be empty." ) );
487 return false;
488 }
489
491 {
492 DisplayError( this, _( "Invalid hyperlink destination. Please enter either a valid URL "
493 "(e.g. file:// or http(s)://) or \"#<page number>\" to create "
494 "a hyperlink to a page in this schematic." ) );
495 return false;
496 }
497 else
498 {
500 }
501
504
506 {
508 m_italic->IsChecked() ) );
509 }
510
511 if( m_bold->IsChecked() != m_currentText->IsBold() )
512 {
513 if( m_bold->IsChecked() )
514 {
515 m_currentText->SetBold( true );
517 }
518 else
519 {
520 m_currentText->SetBold( false );
521 m_currentText->SetTextThickness( 0 ); // Use default pen width
522 }
523 }
524
527
528 if( m_currentItem->Type() == SCH_TEXT_T )
529 {
530 SCH_TEXT* textItem = static_cast<SCH_TEXT*>( m_currentItem );
531
532 if( m_hAlignRight->IsChecked() )
533 {
534 if( m_vertical->IsChecked() )
536 else
538 }
539 else
540 {
541 if( m_vertical->IsChecked() )
543 else
545 }
546 }
547 else
548 {
549 SCH_TEXTBOX* textBox = static_cast<SCH_TEXTBOX*>( m_currentItem );
550
551 if( m_hAlignRight->IsChecked() )
553 else if( m_hAlignCenter->IsChecked() )
555 else
557
560 else if( m_vAlignCenter->IsChecked() )
562 else
564
565 if( m_vertical->IsChecked() )
567 else
569
570 STROKE_PARAMS stroke = textBox->GetStroke();
571
572 if( m_borderCheckbox->GetValue() )
573 stroke.SetWidth( std::max( (long long int) 0, m_borderWidth.GetValue() ) );
574 else
575 stroke.SetWidth( -1 );
576
577 auto it = lineTypeNames.begin();
578 std::advance( it, m_borderStyleCombo->GetSelection() );
579
580 if( it == lineTypeNames.end() )
582 else
583 stroke.SetPlotStyle( it->first );
584
586
587 textBox->SetStroke( stroke );
588
590 : FILL_T::NO_FILL );
592 }
593
594 m_frame->UpdateItem( m_currentItem, false, true );
596 m_frame->OnModify();
597
598 return true;
599}
600
601
602void DIALOG_TEXT_PROPERTIES::OnFormattingHelp( wxHyperlinkEvent& aEvent )
603{
605}
606
607
609{
612
613 event.Skip();
614}
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:147
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:104
COLOR4D GetFillColor() const
Definition: eda_shape.h:103
int GetWidth() const
Definition: eda_shape.h:107
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:194
COLOR4D GetTextColor() const
Definition: eda_text.h:195
bool IsItalic() const
Definition: eda_text.h:120
const EDA_ANGLE & GetTextAngle() const
Definition: eda_text.h:117
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:178
int GetTextWidth() const
Definition: eda_text.h:189
virtual bool HasHyperlink() const
Definition: eda_text.h:324
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
Definition: eda_text.cpp:248
wxString GetHyperlink() const
Definition: eda_text.h:325
GR_TEXT_H_ALIGN_T GetHorizJustify() const
Definition: eda_text.h:139
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:976
bool IsBold() const
Definition: eda_text.h:123
void SetHyperlink(wxString aLink)
Definition: eda_text.h:326
GR_TEXT_V_ALIGN_T GetVertJustify() const
Definition: eda_text.h:142
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:81
Holds all the data relating to one schematic.
Definition: schematic.h:60
SCH_SHEET_PATH & CurrentSheet() const override
Definition: schematic.h:119
wxString ConvertKIIDsToRefs(const wxString &aSource) const
Definition: schematic.cpp:387
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:85
wxString ConvertRefsToKIIDs(const wxString &aSource) const
Definition: schematic.cpp:319
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 of the current screen and u...
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:201
Schematic symbol object.
Definition: sch_symbol.h:79
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:1638
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: infobar.cpp:142
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:408
static constexpr EDA_ANGLE & ANGLE_VERTICAL
Definition: eda_angle.h:409
@ 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:149
@ SCH_TEXTBOX_T
Definition: typeinfo.h:148