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-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 // onAccept handler
107 [this]()
108 {
109 wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
110 },
111 // onCharAdded handler
112 [this]( wxStyledTextEvent& aEvent )
113 {
115 [this]( const wxString& crossRef, wxArrayString* tokens )
116 {
117 getContextualTextVars( crossRef, tokens );
118 } );
119 } );
120
121 m_textEntrySizer->AddGrowableRow( 0 );
122
123 m_textColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
124 m_textColorSwatch->SetSwatchBackground( schematicBackground );
125
127
129
131 m_bold->SetBitmap( KiBitmap( BITMAPS::text_bold ) );
133 m_italic->SetBitmap( KiBitmap( BITMAPS::text_italic ) );
134
136
138 m_hAlignLeft->SetBitmap( KiBitmap( BITMAPS::text_align_left ) );
140 m_hAlignCenter->SetBitmap( KiBitmap( BITMAPS::text_align_center ) );
142 m_hAlignRight->SetBitmap( KiBitmap( BITMAPS::text_align_right ) );
144
146 m_vAlignTop->SetBitmap( KiBitmap( BITMAPS::text_valign_top ) );
148 m_vAlignCenter->SetBitmap( KiBitmap( BITMAPS::text_valign_center ) );
150 m_vAlignBottom->SetBitmap( KiBitmap( BITMAPS::text_valign_bottom ) );
151
153
155 m_horizontal->SetBitmap( KiBitmap( BITMAPS::text_horizontal ) );
157 m_vertical->SetBitmap( KiBitmap( BITMAPS::text_vertical ) );
158
160
161 SCH_SHEET_LIST sheetList = m_frame->Schematic().GetSheets();
162 sheetList.SortByPageNumbers( false );
163
164 for( const SCH_SHEET_PATH& sheet : sheetList )
165 {
166 wxString sheetPageNum = sheet.GetPageNumber();
167 wxString sheetName = sheet.size() == 1 ? _( "<root sheet>" ) : sheet.Last()->GetName();
168
169 m_hyperlinkCombo->Append( wxT( "#" ) + sheetPageNum,
170 wxString::Format( _( "Page %s (%s)" ), sheetPageNum, sheetName ) );
171 m_pageNumbers.push_back( sheetPageNum );
172 }
173
174 m_hyperlinkCombo->Append( wxT( "---" ) );
175 m_hyperlinkCombo->Append( wxT( "file://" ), wxT( "file://..." ) );
176 m_hyperlinkCombo->Append( wxT( "http://" ), wxT( "http://..." ) );
177 m_hyperlinkCombo->Append( wxT( "https://" ), wxT( "https://..." ) );
178
180 Layout();
181
182 m_hAlignLeft->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onHAlignButton, this );
183 m_hAlignCenter->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onHAlignButton, this );
184 m_hAlignRight->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onHAlignButton, this );
185 m_vAlignTop->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onVAlignButton, this );
186 m_vAlignCenter->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onVAlignButton, this );
187 m_vAlignBottom->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onVAlignButton, this );
188 m_horizontal->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onTextAngleButton, this );
189 m_vertical->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onTextAngleButton, this );
190
191 // Now all widgets have the size fixed, call FinishDialogSettings
193}
194
195
197{
198 delete m_scintillaTricks;
199
200 if( m_helpWindow )
201 m_helpWindow->Destroy();
202}
203
204
205void DIALOG_TEXT_PROPERTIES::getContextualTextVars( const wxString& aCrossRef,
206 wxArrayString* aTokens )
207{
208 if( !aCrossRef.IsEmpty() )
209 {
212 SCH_SYMBOL* refSymbol = nullptr;
213
214 sheets.GetSymbols( refs );
215
216 for( int jj = 0; jj < (int) refs.GetCount(); jj++ )
217 {
218 SCH_REFERENCE& ref = refs[jj];
219
220 if( ref.GetSymbol()->GetRef( &ref.GetSheetPath(), true ) == aCrossRef )
221 {
222 refSymbol = ref.GetSymbol();
223 break;
224 }
225 }
226
227 if( refSymbol )
228 refSymbol->GetContextualTextVars( aTokens );
229 }
230 else
231 {
232 SCHEMATIC* schematic = m_currentItem->Schematic();
233
234 if( schematic && schematic->CurrentSheet().Last() )
235 schematic->CurrentSheet().Last()->GetContextualTextVars( aTokens );
236
237 for( std::pair<wxString, wxString> entry : Prj().GetTextVars() )
238 aTokens->push_back( entry.first );
239 }
240}
241
242
244{
245 if( !wxDialog::TransferDataToWindow() )
246 return false;
247
248 SCHEMATIC& schematic = m_frame->Schematic();
249
252
253 // show text variable cross-references in a human-readable format
254 m_textCtrl->SetValue( schematic.ConvertKIIDsToRefs( m_currentText->GetText() ) );
255 m_textCtrl->EmptyUndoBuffer();
256
258
262
265
267 {
268 SCH_TEXTBOX* textBox = static_cast<SCH_TEXTBOX*>( m_currentItem );
269
270 switch( m_currentText->GetHorizJustify() )
271 {
275 }
276
277 switch( m_currentText->GetVertJustify() )
278 {
279 case GR_TEXT_V_ALIGN_TOP: m_vAlignTop->Check(); break;
282 }
283
285 m_vertical->Check();
286 else
288
289 m_borderCheckbox->SetValue( textBox->GetWidth() >= 0 );
290
291 if( textBox->GetWidth() >= 0 )
292 m_borderWidth.SetValue( textBox->GetWidth() );
293
295
296 int style = static_cast<int>( textBox->GetStroke().GetPlotStyle() );
297
298 if( style == -1 )
299 m_borderStyleCombo->SetStringSelection( DEFAULT_STYLE );
300 else if( style < (int) lineTypeNames.size() )
301 m_borderStyleCombo->SetSelection( style );
302 else
303 wxFAIL_MSG( "Line type not found in the type lookup map" );
304
305 m_borderWidth.Enable( textBox->GetWidth() >= 0 );
306 m_borderColorLabel->Enable( textBox->GetWidth() >= 0 );
307 m_borderColorSwatch->Enable( textBox->GetWidth() >= 0 );
308 m_borderStyleLabel->Enable( textBox->GetWidth() >= 0 );
309 m_borderStyleCombo->Enable( textBox->GetWidth() >= 0 );
310
311 m_filledCtrl->SetValue( textBox->IsFilled() );
312 m_fillColorSwatch->SetSwatchColor( textBox->GetFillColor(), false );
313
314 m_fillColorLabel->Enable( textBox->IsFilled() );
315 m_fillColorSwatch->Enable( textBox->IsFilled() );
316 }
317 else
318 {
319 switch( static_cast<SCH_TEXT*>( m_currentItem )->GetTextSpinStyle() )
320 {
322 m_hAlignLeft->Check( true ); // Spin style to right means text aligned left
323 m_horizontal->Check( true );
324 break;
326 m_hAlignRight->Check( true ); // Spin style to left means text aligned right
327 m_horizontal->Check( true );
328 break;
330 m_hAlignLeft->Check( true ); // Spin style up means text aligned to bottom
331 m_vertical->Check( true );
332 break;
333 case TEXT_SPIN_STYLE::BOTTOM: // Spin style down means text aligned to top
334 m_hAlignRight->Check( true );
335 m_vertical->Check( true );
336 break;
337 }
338 }
339
340 return true;
341}
342
343
344void DIALOG_TEXT_PROPERTIES::onBorderChecked( wxCommandEvent& aEvent )
345{
346 bool border = m_borderCheckbox->GetValue();
347
348 if( border && m_borderWidth.GetValue() < 0 )
350
351 m_borderWidth.Enable( border );
352 m_borderColorLabel->Enable( border );
353 m_borderColorSwatch->Enable( border );
354 m_borderStyleLabel->Enable( border );
355 m_borderStyleCombo->Enable( border );
356}
357
358
359void DIALOG_TEXT_PROPERTIES::onFillChecked( wxCommandEvent& aEvent )
360{
361 bool fill = m_filledCtrl->GetValue();
362
363 m_fillColorLabel->Enable( fill );
364 m_fillColorSwatch->Enable( fill );
365}
366
367
368void DIALOG_TEXT_PROPERTIES::onHyperlinkChecked( wxCommandEvent& aEvent )
369{
370 if( aEvent.IsChecked() && m_hyperlinkCombo->GetValue().IsEmpty() )
371 {
372 m_hyperlinkCombo->ChangeValue( m_lastLink );
373 }
374 else if( !aEvent.IsChecked() && !m_hyperlinkCombo->GetValue().IsEmpty() )
375 {
376 m_lastLink = m_hyperlinkCombo->GetValue();
377 m_hyperlinkCombo->SetValue( wxEmptyString );
378 }
379
380 aEvent.Skip();
381}
382
383
384void DIALOG_TEXT_PROPERTIES::onHyperlinkText( wxCommandEvent& event )
385{
386 if( !m_hyperlinkCombo->GetValue().IsEmpty() )
387 m_hyperlinkCb->SetValue( true );
388}
389
390
391void DIALOG_TEXT_PROPERTIES::onHyperlinkCombo( wxCommandEvent& aEvent )
392{
393 if( aEvent.GetSelection() >= 0 )
394 {
395 m_hyperlinkCb->SetValue( true );
396 m_hyperlinkCombo->SetInsertionPointEnd();
397 }
398}
399
400
401void DIALOG_TEXT_PROPERTIES::onHAlignButton( wxCommandEvent& aEvent )
402{
404 {
405 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
406 btn->Check( false );
407 }
408}
409
410
411void DIALOG_TEXT_PROPERTIES::onVAlignButton( wxCommandEvent& aEvent )
412{
414 {
415 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
416 btn->Check( false );
417 }
418}
419
420
421void DIALOG_TEXT_PROPERTIES::onTextAngleButton( wxCommandEvent& aEvent )
422{
423 for( BITMAP_BUTTON* btn : { m_horizontal, m_vertical } )
424 {
425 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
426 btn->Check( false );
427 }
428}
429
430
432{
433 if( !wxDialog::TransferDataFromWindow() )
434 return false;
435
436 // Don't allow text to disappear; it can be difficult to correct if you can't select it
437 if( !m_textSize.Validate( 0.01, 1000.0, EDA_UNITS::MILLIMETRES ) )
438 return false;
439
440 wxString text;
441
442 /* save old text in undo list if not already in edit */
443 if( m_currentItem->GetEditFlags() == 0 )
444 {
445 m_frame->SaveCopyInUndoList( m_frame->GetScreen(), m_currentItem, UNDO_REDO::CHANGED,
446 false, false );
447 }
448
450
451 // convert any text variable cross-references to their UUIDs
453
454#ifdef __WXMAC__
455 // On macOS CTRL+Enter produces '\r' instead of '\n' regardless of EOL setting
456 text.Replace( "\r", "\n" );
457#elif defined( __WINDOWS__ )
458 // On Windows, a new line is coded as \r\n. We use only \n in kicad files and in
459 // drawing routines so strip the \r char.
460 text.Replace( "\r", "" );
461#endif
462
464 {
465 // Textboxes have a defined extent and so are allowed to be empty
467 }
468 else if( !text.IsEmpty() )
469 {
471 }
472 else
473 {
474 // Other text items do not have defined extents, and so will disappear if empty
475 DisplayError( this, _( "Text can not be empty." ) );
476 return false;
477 }
478
480
482 {
483 DisplayError( this, _( "Invalid hyperlink destination. Please enter either a valid URL "
484 "(e.g. file:// or http(s)://) or \"#<page number>\" to create "
485 "a hyperlink to a page in this schematic." ) );
486 return false;
487 }
488 else
489 {
491 }
492
495
497 {
499 m_italic->IsChecked() ) );
500 }
501
502 if( m_bold->IsChecked() != m_currentText->IsBold() )
503 {
504 if( m_bold->IsChecked() )
505 {
506 m_currentText->SetBold( true );
508 }
509 else
510 {
511 m_currentText->SetBold( false );
512 m_currentText->SetTextThickness( 0 ); // Use default pen width
513 }
514 }
515
518
519 if( m_currentItem->Type() == SCH_TEXT_T )
520 {
521 SCH_TEXT* textItem = static_cast<SCH_TEXT*>( m_currentItem );
522
523 if( m_hAlignRight->IsChecked() )
524 {
525 if( m_vertical->IsChecked() )
527 else
529 }
530 else
531 {
532 if( m_vertical->IsChecked() )
534 else
536 }
537 }
538 else
539 {
540 SCH_TEXTBOX* textBox = static_cast<SCH_TEXTBOX*>( m_currentItem );
541
542 if( m_hAlignRight->IsChecked() )
544 else if( m_hAlignCenter->IsChecked() )
546 else
548
551 else if( m_vAlignCenter->IsChecked() )
553 else
555
556 if( m_vertical->IsChecked() )
558 else
560
561 STROKE_PARAMS stroke = textBox->GetStroke();
562
563 if( m_borderCheckbox->GetValue() )
564 stroke.SetWidth( std::max( (long long int) 0, m_borderWidth.GetValue() ) );
565 else
566 stroke.SetWidth( -1 );
567
568 auto it = lineTypeNames.begin();
569 std::advance( it, m_borderStyleCombo->GetSelection() );
570
571 if( it == lineTypeNames.end() )
572 stroke.SetPlotStyle( PLOT_DASH_TYPE::DEFAULT );
573 else
574 stroke.SetPlotStyle( it->first );
575
577
578 textBox->SetStroke( stroke );
579
580 textBox->SetFillMode( m_filledCtrl->GetValue() ? FILL_T::FILLED_WITH_COLOR
581 : FILL_T::NO_FILL );
583 }
584
585 m_frame->UpdateItem( m_currentItem, false, true );
587 m_frame->OnModify();
588
589 return true;
590}
591
592
593void DIALOG_TEXT_PROPERTIES::OnFormattingHelp( wxHyperlinkEvent& aEvent )
594{
596}
597
598
600{
603
604 event.Skip();
605}
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:106
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 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
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:207
COLOR4D GetTextColor() const
Definition: eda_text.h:208
bool IsItalic() const
Definition: eda_text.h:133
const EDA_ANGLE & GetTextAngle() const
Definition: eda_text.h:123
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:191
int GetTextWidth() const
Definition: eda_text.h:202
virtual bool HasHyperlink() const
Definition: eda_text.h:327
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
Definition: eda_text.cpp:260
wxString GetHyperlink() const
Definition: eda_text.h:328
GR_TEXT_H_ALIGN_T GetHorizJustify() const
Definition: eda_text.h:152
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:984
bool IsBold() const
Definition: eda_text.h:136
void SetHyperlink(wxString aLink)
Definition: eda_text.h:329
GR_TEXT_V_ALIGN_T GetVertJustify() const
Definition: eda_text.h:155
void SetTextSize(const VECTOR2I &aNewSize)
Definition: eda_text.cpp:359
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:175
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:343
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:103
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:72
SCH_SHEET_PATH & CurrentSheet() const override
Definition: schematic.h:133
wxString ConvertKIIDsToRefs(const wxString &aSource) const
Definition: schematic.cpp:453
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:97
wxString ConvertRefsToKIIDs(const wxString &aSource) const
Definition: schematic.cpp:385
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
virtual bool GetExcludeFromSim() const
Definition: sch_item.h:202
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:113
virtual void SetExcludeFromSim(bool aExclude)
Definition: sch_item.h:201
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: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: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:698
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:1804
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:193
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: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:154
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:283
This file is part of the common library.
#define _(s)
static constexpr EDA_ANGLE & ANGLE_HORIZONTAL
Definition: eda_angle.h:425
static constexpr EDA_ANGLE & ANGLE_VERTICAL
Definition: eda_angle.h:426
int GetPenSizeForBold(int aTextSize)
Definition: gr_text.cpp:40
@ LAYER_SCHEMATIC_BACKGROUND
Definition: layer_ids.h:380
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:140
@ SCH_TEXTBOX_T
Definition: typeinfo.h:139
VECTOR2< int > VECTOR2I
Definition: vector2d.h:588