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 The 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, see <https://www.gnu.org/licenses/>.
20 */
21
22#include <sch_edit_frame.h>
23#include <symbol_edit_frame.h>
25#include <widgets/font_choice.h>
27#include <widgets/wx_combobox.h>
29#include <widgets/wx_infobar.h>
30#include <sch_textbox.h>
31#include <confirm.h>
32#include <schematic.h>
33#include <sch_commit.h>
35#include <scintilla_tricks.h>
37#include <string_utils.h>
38
39
42 m_frame( aParent ),
43 m_currentItem( aTextItem ),
44 m_currentText( dynamic_cast<EDA_TEXT*>( aTextItem ) ),
47 m_scintillaTricks( nullptr ),
48 m_helpWindow( nullptr )
49{
50 m_isSymbolEditor = dynamic_cast<SYMBOL_EDIT_FRAME*>( aParent ) != 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, KiBitmapBundle( lineStyleDesc.bitmap ) );
64
65 m_fillColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
66 m_fillColorSwatch->SetSwatchBackground( schematicBackground );
67
68 if( m_frame->GetColorSettings()->GetOverrideSchItemColors() )
69 m_infoBar->ShowMessage( _( "Note: individual item colors overridden in "
70 "Preferences." ) );
71 }
72 else
73 {
74 m_borderCheckbox->Show( false );
75 m_borderWidth.Show( false );
76 m_borderColorLabel->Show( false );
77 m_panelBorderColor->Show( false );
78 m_borderStyleLabel->Show( false );
79 m_borderStyleCombo->Show( false );
80 m_fillColorLabel->Show( false );
81 m_panelFillColor->Show( false );
82 m_filledCtrl->Show( false );
83 }
84
85 // DIALOG_SHIM needs a unique hash_key because classname is not sufficient because the
86 // different text item types (and even whether or not we're within the symbol editor) cause
87 // different dialog layouts).
88 m_hash_key = TO_UTF8( GetTitle() + aParent->GetName() );
89
90 m_textCtrl->SetEOLMode( wxSTC_EOL_LF );
91
92 // Wrapping is display-only and does not insert newlines into the stored text.
93 m_textCtrl->SetWrapMode( wxSTC_WRAP_WORD );
94 m_textCtrl->SetWrapVisualFlags( wxSTC_WRAPVISUALFLAG_END );
95 m_textCtrl->SetWrapIndentMode( wxSTC_WRAPINDENT_INDENT );
96
97#ifdef _WIN32
98 // Without this setting, on Windows, some esoteric unicode chars create display issue
99 // in a wxStyledTextCtrl.
100 // for SetTechnology() info, see https://www.scintilla.org/ScintillaDoc.html#SCI_SETTECHNOLOGY
101 m_textCtrl->SetTechnology( wxSTC_TECHNOLOGY_DIRECTWRITE );
102#endif
103
104 m_scintillaTricks = new SCINTILLA_TRICKS( m_textCtrl, wxT( "{}" ), false,
105 // onAcceptFn
106 [this]( wxKeyEvent& aEvent )
107 {
108 wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
109 },
110
111 // onCharFn
112 [this]( wxStyledTextEvent& aEvent )
113 {
114 m_scintillaTricks->DoTextVarAutocomplete(
115 // getTokensFn
116 [this]( const wxString& xRef, wxArrayString* tokens )
117 {
118 getContextualTextVars( xRef, tokens );
119 } );
120 } );
121
122 // A hack which causes Scintilla to auto-size the text editor canvas
123 // See: https://github.com/jacobslusser/ScintillaNET/issues/216
124 m_textCtrl->SetScrollWidth( 1 );
125 m_textCtrl->SetScrollWidthTracking( true );
126
127 m_textEntrySizer->AddGrowableRow( 0 );
128
129 m_textColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
130 m_textColorSwatch->SetSwatchBackground( schematicBackground );
131
133
134 m_separator1->SetIsSeparator();
135
136 m_bold->SetIsCheckButton();
138 m_italic->SetIsCheckButton();
140
141 m_separator2->SetIsSeparator();
142
143 m_hAlignLeft->SetIsRadioButton();
145 m_hAlignCenter->SetIsRadioButton();
147 m_hAlignRight->SetIsRadioButton();
149
150 m_separator3->SetIsSeparator();
151
152 m_vAlignTop->SetIsRadioButton();
154 m_vAlignCenter->SetIsRadioButton();
156 m_vAlignBottom->SetIsRadioButton();
158
159 m_separator4->SetIsSeparator();
160
161 m_horizontal->SetIsRadioButton();
163 m_vertical->SetIsRadioButton();
165
166 m_separator5->SetIsSeparator();
167
169
170 if( SCH_EDIT_FRAME* schematicEditor = dynamic_cast<SCH_EDIT_FRAME*>( m_frame ) )
171 {
172 const SCHEMATIC& schematic = schematicEditor->Schematic();
173
174 for( const SCH_SHEET_PATH& sheet : schematic.Hierarchy() )
175 {
176 wxString sheetPageNum = sheet.GetPageNumber();
177 wxString sheetName = sheet.size() == 1 ? _( "<root sheet>" )
178 : sheet.Last()->GetName();
179
180 m_hyperlinkCombo->Append( wxT( "#" ) + sheetPageNum,
181 wxString::Format( _( "Page %s (%s)" ),
182 sheetPageNum,
183 sheetName ) );
184 m_pageNumbers.push_back( sheetPageNum );
185 }
186
187 m_hyperlinkCombo->Append( wxT( "---" ) );
188 m_hyperlinkCombo->Append( wxT( "file://" ), wxT( "file://..." ) );
189 m_hyperlinkCombo->Append( wxT( "http://" ), wxT( "http://..." ) );
190 m_hyperlinkCombo->Append( wxT( "https://" ), wxT( "https://..." ) );
191 }
192 else
193 {
194 m_excludeFromSim->Hide();
195 m_syntaxHelp->Hide();
196 m_hyperlinkCb->Hide();
197 m_hyperlinkCombo->Hide();
198 }
199
201 Layout();
202
203 m_hAlignLeft->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onHAlignButton, this );
204 m_hAlignCenter->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onHAlignButton, this );
205 m_hAlignRight->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onHAlignButton, this );
206 m_vAlignTop->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onVAlignButton, this );
207 m_vAlignCenter->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onVAlignButton, this );
208 m_vAlignBottom->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onVAlignButton, this );
209 m_horizontal->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onTextAngleButton, this );
210 m_vertical->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onTextAngleButton, this );
211
212 // Now all widgets have the size fixed, call FinishDialogSettings
214}
215
216
218{
219 delete m_scintillaTricks;
220 m_scintillaTricks = nullptr;
221
222 if( m_helpWindow )
223 m_helpWindow->Destroy();
224}
225
226
227void DIALOG_TEXT_PROPERTIES::getContextualTextVars( const wxString& aCrossRef,
228 wxArrayString* aTokens )
229{
230 SCHEMATIC* schematic = m_currentItem->Schematic();
231
232 if( !aCrossRef.IsEmpty() )
233 {
234 SCH_SYMBOL* refSymbol = nullptr;
235
236 if( schematic )
237 {
239 schematic->Hierarchy().GetSymbols( refs, SYMBOL_FILTER_ALL );
240
241 for( int jj = 0; jj < (int) refs.GetCount(); jj++ )
242 {
243 SCH_REFERENCE& ref = refs[jj];
244
245 if( ref.GetSymbol()->GetRef( &ref.GetSheetPath(), true ) == aCrossRef )
246 {
247 refSymbol = ref.GetSymbol();
248 break;
249 }
250 }
251 }
252
253 if( refSymbol )
254 refSymbol->GetContextualTextVars( aTokens );
255 }
256 else
257 {
258 if( schematic && schematic->CurrentSheet().Last() )
259 {
260 schematic->CurrentSheet().Last()->GetContextualTextVars( aTokens );
261 }
262 else
263 {
264 for( std::pair<wxString, wxString> entry : Prj().GetTextVars() )
265 aTokens->push_back( entry.first );
266 }
267 }
268}
269
270
272{
273 if( !wxDialog::TransferDataToWindow() )
274 return false;
275
276 m_hyperlinkCb->SetValue( m_currentText->HasHyperlink() );
277 m_hyperlinkCombo->SetValue( m_currentText->GetHyperlink() );
278
279 wxString text = m_currentText->GetText();
280
281 // show text variable cross-references in a human-readable format
282 if( SCHEMATIC* schematic = m_currentItem->Schematic() )
283 text = schematic->ConvertKIIDsToRefs( text );
284
285 m_textCtrl->SetValue( text );
286 m_textCtrl->EmptyUndoBuffer();
287
288 if( !m_isSymbolEditor )
289 m_excludeFromSim->SetValue( m_currentItem->GetExcludedFromSim() );
290
291 m_fontCtrl->SetFontSelection( m_currentText->GetFont() );
292 m_textSize.SetValue( m_currentText->GetTextWidth() );
293 m_textColorSwatch->SetSwatchColor( m_currentText->GetTextColor(), false );
294
295 m_bold->Check( m_currentText->IsBold() );
296 m_italic->Check( m_currentText->IsItalic() );
297
298 switch( m_currentText->GetHorizJustify() )
299 {
300 case GR_TEXT_H_ALIGN_LEFT: m_hAlignLeft->Check(); break;
301 case GR_TEXT_H_ALIGN_CENTER: m_hAlignCenter->Check(); break;
302 case GR_TEXT_H_ALIGN_RIGHT: m_hAlignRight->Check(); break;
304 }
305
306 switch( m_currentText->GetVertJustify() )
307 {
308 case GR_TEXT_V_ALIGN_TOP: m_vAlignTop->Check(); break;
309 case GR_TEXT_V_ALIGN_CENTER: m_vAlignCenter->Check(); break;
310 case GR_TEXT_V_ALIGN_BOTTOM: m_vAlignBottom->Check(); break;
312 }
313
314 if( m_currentText->GetTextAngle() == ANGLE_VERTICAL )
315 m_vertical->Check();
316 else
317 m_horizontal->Check();
318
319 if( m_currentItem->Type() == SCH_TEXTBOX_T )
320 {
321 SCH_TEXTBOX* textBox = static_cast<SCH_TEXTBOX*>( m_currentItem );
322
323 m_borderCheckbox->SetValue( textBox->GetWidth() >= 0 );
324
325 if( textBox->GetWidth() >= 0 )
326 m_borderWidth.SetValue( textBox->GetWidth() );
327
328 m_borderColorSwatch->SetSwatchColor( textBox->GetStroke().GetColor(), false );
329
330 int style = static_cast<int>( textBox->GetStroke().GetLineStyle() );
331
332 if( style >= 0 && style < (int) lineTypeNames.size() )
333 m_borderStyleCombo->SetSelection( style );
334 else
335 m_borderStyleCombo->SetSelection( 0 );
336
337 m_borderWidth.Enable( textBox->GetWidth() >= 0 );
338 m_borderColorLabel->Enable( textBox->GetWidth() >= 0 );
339 m_borderColorSwatch->Enable( textBox->GetWidth() >= 0 );
340 m_borderStyleLabel->Enable( textBox->GetWidth() >= 0 );
341 m_borderStyleCombo->Enable( textBox->GetWidth() >= 0 );
342
343 m_filledCtrl->SetValue( textBox->IsSolidFill() );
344 m_fillColorSwatch->SetSwatchColor( textBox->GetFillColor(), false );
345
346 m_fillColorLabel->Enable( textBox->IsSolidFill() );
347 m_fillColorSwatch->Enable( textBox->IsSolidFill() );
348 }
349
350 if( m_isSymbolEditor )
351 {
352 SYMBOL* symbol = m_currentItem->GetParentSymbol();
353
354 m_privateCheckbox->SetValue( m_currentItem->IsPrivate() );
355 m_commonToAllUnits->SetValue( symbol->IsMultiUnit() && m_currentItem->GetUnit() == 0 );
356 m_commonToAllUnits->Enable( symbol->IsMultiUnit() );
357 m_commonToAllBodyStyles->SetValue( symbol->IsMultiBodyStyle() && m_currentItem->GetBodyStyle() == 0 );
358 m_commonToAllBodyStyles->Enable( symbol->IsMultiBodyStyle() );
359 }
360
361 return true;
362}
363
364
365void DIALOG_TEXT_PROPERTIES::onBorderChecked( wxCommandEvent& aEvent )
366{
367 bool border = m_borderCheckbox->GetValue();
368
369 if( border && m_borderWidth.GetValue() < 0 )
370 m_borderWidth.SetValue( m_frame->eeconfig()->m_Drawing.default_line_thickness );
371
372 m_borderWidth.Enable( border );
373 m_borderColorLabel->Enable( border );
374 m_borderColorSwatch->Enable( border );
375 m_borderStyleLabel->Enable( border );
376 m_borderStyleCombo->Enable( border );
377}
378
379
380void DIALOG_TEXT_PROPERTIES::onFillChecked( wxCommandEvent& aEvent )
381{
382 bool fill = m_filledCtrl->GetValue();
383
384 m_fillColorLabel->Enable( fill );
385 m_fillColorSwatch->Enable( fill );
386}
387
388
389void DIALOG_TEXT_PROPERTIES::onHyperlinkChecked( wxCommandEvent& aEvent )
390{
391 if( aEvent.IsChecked() && m_hyperlinkCombo->GetValue().IsEmpty() )
392 {
393 m_hyperlinkCombo->ChangeValue( m_lastLink );
394 }
395 else if( !aEvent.IsChecked() && !m_hyperlinkCombo->GetValue().IsEmpty() )
396 {
397 m_lastLink = m_hyperlinkCombo->GetValue();
398 m_hyperlinkCombo->SetValue( wxEmptyString );
399 }
400
401 aEvent.Skip();
402}
403
404
405void DIALOG_TEXT_PROPERTIES::onHyperlinkText( wxCommandEvent& event )
406{
407 if( !m_hyperlinkCombo->GetValue().IsEmpty() )
408 m_hyperlinkCb->SetValue( true );
409}
410
411
412void DIALOG_TEXT_PROPERTIES::onHyperlinkCombo( wxCommandEvent& aEvent )
413{
414 if( aEvent.GetSelection() >= 0 )
415 {
416 m_hyperlinkCb->SetValue( true );
417 m_hyperlinkCombo->SetInsertionPointEnd();
418 }
419}
420
421
422void DIALOG_TEXT_PROPERTIES::onHAlignButton( wxCommandEvent& aEvent )
423{
425 {
426 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
427 btn->Check( false );
428 }
429}
430
431
432void DIALOG_TEXT_PROPERTIES::onVAlignButton( wxCommandEvent& aEvent )
433{
435 {
436 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
437 btn->Check( false );
438 }
439}
440
441
442void DIALOG_TEXT_PROPERTIES::onTextAngleButton( wxCommandEvent& aEvent )
443{
444 for( BITMAP_BUTTON* btn : { m_horizontal, m_vertical } )
445 {
446 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
447 btn->Check( false );
448 }
449}
450
451
453{
454 if( !wxDialog::TransferDataFromWindow() )
455 return false;
456
457 // Don't allow text to disappear; it can be difficult to correct if you can't select it
458 if( !m_textSize.Validate( 0.01, 1000.0, EDA_UNITS::MM ) )
459 return false;
460
461 SCH_COMMIT commit( m_frame );
462
463 /* save old text in undo list if not already in edit */
464 if( m_currentItem->GetEditFlags() == 0 )
465 commit.Modify( m_currentItem, m_frame->GetScreen() );
466
467 m_frame->GetCanvas()->Refresh();
468
469 wxString text = m_textCtrl->GetValue();
470
471 // convert any text variable cross-references to their UUIDs
472 if( SCHEMATIC* schematic = m_currentItem->Schematic() )
473 text = schematic->ConvertRefsToKIIDs( text );
474
475#ifdef __WXMAC__
476 // On macOS CTRL+Enter produces '\r' instead of '\n' regardless of EOL setting
477 text.Replace( "\r", "\n" );
478#elif defined( __WINDOWS__ )
479 // On Windows, a new line is coded as \r\n. We use only \n in KiCad files and in
480 // drawing routines so strip the \r char.
481 text.Replace( "\r", "" );
482#endif
483
484 m_currentText->SetText( text );
485 m_currentItem->SetExcludedFromSim( m_excludeFromSim->GetValue() );
486
487 if( SYMBOL_EDIT_FRAME* symbolEditor = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame ) )
488 {
489 m_currentItem->SetPrivate( m_privateCheckbox->GetValue() );
490
491 if( !m_commonToAllUnits->GetValue() )
492 m_currentItem->SetUnit( symbolEditor->GetUnit() );
493 else
494 m_currentItem->SetUnit( 0 );
495
496 if( !m_commonToAllBodyStyles->GetValue() )
497 m_currentItem->SetBodyStyle( symbolEditor->GetBodyStyle() );
498 else
499 m_currentItem->SetBodyStyle( 0 );
500 }
501
503 {
504 DisplayError( this, _( "Invalid hyperlink destination. Please enter either a valid URL "
505 "(e.g. file:// or http(s)://) or \"#<page number>\" to create "
506 "a hyperlink to a page in this schematic." ) );
507 return false;
508 }
509 else
510 {
511 m_currentText->SetHyperlink( m_hyperlinkCombo->GetValue() );
512 }
513
514 if( m_currentText->GetTextWidth() != m_textSize.GetValue() )
515 m_currentText->SetTextSize( VECTOR2I( m_textSize.GetIntValue(), m_textSize.GetIntValue() ) );
516
517 if( m_fontCtrl->HaveFontSelection() )
518 m_currentText->SetFont( m_fontCtrl->GetFontSelection( m_bold->IsChecked(), m_italic->IsChecked() ) );
519
520 // Must come after SetTextSize()
521 m_currentText->SetBold( m_bold->IsChecked() );
522 m_currentText->SetItalic( m_italic->IsChecked() );
523
524 m_currentText->SetTextColor( m_textColorSwatch->GetSwatchColor() );
525
526 if( m_hAlignRight->IsChecked() )
527 m_currentText->SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
528 else if( m_hAlignCenter->IsChecked() )
529 m_currentText->SetHorizJustify( GR_TEXT_H_ALIGN_CENTER );
530 else
531 m_currentText->SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
532
533 if( m_vAlignBottom->IsChecked() )
534 m_currentText->SetVertJustify( GR_TEXT_V_ALIGN_BOTTOM );
535 else if( m_vAlignCenter->IsChecked() )
536 m_currentText->SetVertJustify( GR_TEXT_V_ALIGN_CENTER );
537 else
538 m_currentText->SetVertJustify( GR_TEXT_V_ALIGN_TOP );
539
540 if( m_vertical->IsChecked() )
541 m_currentText->SetTextAngle( ANGLE_VERTICAL );
542 else
543 m_currentText->SetTextAngle( ANGLE_HORIZONTAL );
544
545 if( m_currentItem->Type() == SCH_TEXTBOX_T )
546 {
547 SCH_TEXTBOX* textBox = static_cast<SCH_TEXTBOX*>( m_currentItem );
548
549 STROKE_PARAMS stroke = textBox->GetStroke();
550
551 if( m_borderCheckbox->GetValue() )
552 stroke.SetWidth( std::max( 0, m_borderWidth.GetIntValue() ) );
553 else
554 stroke.SetWidth( -1 );
555
556 auto it = lineTypeNames.begin();
557 std::advance( it, m_borderStyleCombo->GetSelection() );
558
559 if( it == lineTypeNames.end() )
561 else
562 stroke.SetLineStyle( it->first );
563
564 stroke.SetColor( m_borderColorSwatch->GetSwatchColor() );
565
566 textBox->SetStroke( stroke );
567
569 textBox->SetFillColor( m_fillColorSwatch->GetSwatchColor() );
570
571 textBox->ClearBoundingBoxCache();
572 textBox->ClearRenderCache();
573
574 VECTOR2I minBoxSize = textBox->GetMinSize();
575 VECTOR2I start = textBox->GetStart();
576 VECTOR2I end = textBox->GetEnd();
577 bool expanded = false;
578
579 if( minBoxSize.x > 0 && std::abs( end.x - start.x ) < minBoxSize.x )
580 {
581 end.x = ( end.x >= start.x ) ? start.x + minBoxSize.x : start.x - minBoxSize.x;
582 expanded = true;
583 }
584
585 if( minBoxSize.y > 0 && std::abs( end.y - start.y ) < minBoxSize.y )
586 {
587 end.y = ( end.y >= start.y ) ? start.y + minBoxSize.y : start.y - minBoxSize.y;
588 expanded = true;
589 }
590
591 if( expanded )
592 textBox->SetEnd( end );
593 }
594
595 if( !commit.Empty() )
596 commit.Push( _( "Edit Text Properties" ) );
597
598 return true;
599}
600
601
602void DIALOG_TEXT_PROPERTIES::OnFormattingHelp( wxHyperlinkEvent& aEvent )
603{
605}
606
607
609{
611 m_scintillaTricks->CancelAutocomplete();
612
613 event.Skip();
614}
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
Definition bitmap.cpp:106
@ text_align_right
@ text_valign_top
@ text_align_left
@ text_valign_center
@ 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.
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
Definition color4d.h:398
Color settings are a bit different than most of the settings objects in that there can be more than o...
COLOR4D GetColor(int aLayer) const
bool Empty() const
Definition commit.h:134
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
Definition commit.h:102
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
Definition dialog_shim.h:79
void SetupStandardButtons(std::map< int, wxString > aLabels={})
std::string m_hash_key
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
DIALOG_TEXT_PROPERTIES_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Text Properties"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
void onHyperlinkText(wxCommandEvent &aEvent) override
void onFillChecked(wxCommandEvent &aEvent) override
void onMultiLineTCLostFocus(wxFocusEvent &event) override
void onBorderChecked(wxCommandEvent &aEvent) override
void OnFormattingHelp(wxHyperlinkEvent &aEvent) override
DIALOG_TEXT_PROPERTIES(SCH_BASE_FRAME *parent, SCH_ITEM *aTextItem)
void onHyperlinkCombo(wxCommandEvent &aEvent) override
void getContextualTextVars(const wxString &aCrossRef, wxArrayString *aTokens)
void onHyperlinkChecked(wxCommandEvent &aEvent) override
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:108
virtual void SetEnd(const VECTOR2I &aEnd)
Definition eda_shape.h:244
void SetFillColor(const COLOR4D &aColor)
Definition eda_shape.h:170
bool IsSolidFill() const
Definition eda_shape.h:133
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
Definition eda_shape.h:240
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
Definition eda_shape.h:190
COLOR4D GetFillColor() const
Definition eda_shape.h:169
virtual int GetWidth() const
Definition eda_shape.h:173
void SetFillMode(FILL_T aFill)
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition eda_text.h:89
virtual void ClearBoundingBoxCache()
Definition eda_text.cpp:695
virtual void ClearRenderCache()
Definition eda_text.cpp:689
static bool ValidateHyperlink(const wxString &aURL)
Check if aURL is a valid hyperlink.
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:101
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
Holds all the data relating to one schematic.
Definition schematic.h:90
A shim class between EDA_DRAW_FRAME and several derived classes: SYMBOL_EDIT_FRAME,...
virtual void Push(const wxString &aMessage=wxT("A commit"), int aCommitFlags=0) override
Execute the changes.
Schematic editor (Eeschema) main window.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition sch_item.h:162
Container to create a flattened list of symbols because in a complex hierarchy, a symbol can be used ...
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:98
STROKE_PARAMS GetStroke() const override
Definition sch_shape.h:57
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Schematic symbol object.
Definition sch_symbol.h:69
void GetContextualTextVars(wxArrayString *aVars) const
Return the list of system text vars & fields for this symbol.
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const override
VECTOR2I GetMinSize() const
Return the minimum height needed to contain the textbox's wrapped text content plus margins.
static HTML_MESSAGE_BOX * ShowSyntaxHelp(wxWindow *aParentWindow)
Add cut/copy/paste, dark theme, autocomplete and brace highlighting to a wxStyleTextCtrl instance.
Simple container to manage line stroke parameters.
void SetLineStyle(LINE_STYLE aLineStyle)
void SetWidth(int aWidth)
void SetColor(const KIGFX::COLOR4D &aColor)
KIGFX::COLOR4D GetColor() const
The symbol library editor main window.
A base class for LIB_SYMBOL and SCH_SYMBOL.
Definition symbol.h:59
virtual bool IsMultiUnit() const =0
virtual bool IsMultiBodyStyle() const =0
void DisplayError(wxWindow *aParent, const wxString &aText)
Display an error or warning message box with aMessage.
Definition confirm.cpp:192
This file is part of the common library.
#define _(s)
static constexpr EDA_ANGLE ANGLE_VERTICAL
Definition eda_angle.h:408
static constexpr EDA_ANGLE ANGLE_HORIZONTAL
Definition eda_angle.h:407
@ FILLED_WITH_COLOR
Definition eda_shape.h:63
@ NO_FILL
Definition eda_shape.h:60
@ LAYER_SCHEMATIC_BACKGROUND
Definition layer_ids.h:486
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition eda_angle.h:400
@ SYMBOL_FILTER_ALL
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
const std::map< LINE_STYLE, struct LINE_STYLE_DESC > lineTypeNames
Conversion map between LINE_STYLE values and style names displayed.
VECTOR2I end
@ GR_TEXT_H_ALIGN_CENTER
@ GR_TEXT_H_ALIGN_RIGHT
@ GR_TEXT_H_ALIGN_LEFT
@ GR_TEXT_H_ALIGN_INDETERMINATE
@ GR_TEXT_V_ALIGN_BOTTOM
@ GR_TEXT_V_ALIGN_INDETERMINATE
@ GR_TEXT_V_ALIGN_CENTER
@ GR_TEXT_V_ALIGN_TOP
@ SCH_TEXTBOX_T
Definition typeinfo.h:149
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683