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, 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>
27#include <symbol_edit_frame.h>
29#include <widgets/font_choice.h>
31#include <widgets/wx_combobox.h>
33#include <widgets/wx_infobar.h>
34#include <sch_textbox.h>
35#include <confirm.h>
36#include <schematic.h>
37#include <sch_commit.h>
39#include <scintilla_tricks.h>
41#include <string_utils.h>
42
43
46 m_frame( aParent ),
47 m_currentItem( aTextItem ),
48 m_currentText( dynamic_cast<EDA_TEXT*>( aTextItem ) ),
51 m_scintillaTricks( nullptr ),
52 m_helpWindow( nullptr )
53{
54 m_isSymbolEditor = dynamic_cast<SYMBOL_EDIT_FRAME*>( aParent ) != nullptr;
55
56 COLOR_SETTINGS* colorSettings = m_frame->GetColorSettings();
57 COLOR4D schematicBackground = colorSettings->GetColor( LAYER_SCHEMATIC_BACKGROUND );
58
59 if( aTextItem->Type() == SCH_TEXTBOX_T )
60 {
61 SetTitle( _( "Text Box Properties" ) );
62
63 m_borderColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
64 m_borderColorSwatch->SetSwatchBackground( schematicBackground );
65
66 for( const auto& [ lineStyle, lineStyleDesc ] : lineTypeNames )
67 m_borderStyleCombo->Append( lineStyleDesc.name, KiBitmapBundle( lineStyleDesc.bitmap ) );
68
69 m_fillColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
70 m_fillColorSwatch->SetSwatchBackground( schematicBackground );
71
72 if( m_frame->GetColorSettings()->GetOverrideSchItemColors() )
73 m_infoBar->ShowMessage( _( "Note: individual item colors overridden in "
74 "Preferences." ) );
75 }
76 else
77 {
78 m_borderCheckbox->Show( false );
79 m_borderWidth.Show( false );
80 m_borderColorLabel->Show( false );
81 m_panelBorderColor->Show( false );
82 m_borderStyleLabel->Show( false );
83 m_borderStyleCombo->Show( false );
84 m_fillColorLabel->Show( false );
85 m_panelFillColor->Show( false );
86 m_filledCtrl->Show( false );
87 }
88
89 // DIALOG_SHIM needs a unique hash_key because classname is not sufficient because the
90 // different text item types (and even whether or not we're within the symbol editor) cause
91 // different dialog layouts).
92 m_hash_key = TO_UTF8( GetTitle() + aParent->GetName() );
93
94 m_textCtrl->SetEOLMode( wxSTC_EOL_LF );
95
96#ifdef _WIN32
97 // Without this setting, on Windows, some esoteric unicode chars create display issue
98 // in a wxStyledTextCtrl.
99 // for SetTechnology() info, see https://www.scintilla.org/ScintillaDoc.html#SCI_SETTECHNOLOGY
100 m_textCtrl->SetTechnology( wxSTC_TECHNOLOGY_DIRECTWRITE );
101#endif
102
103 m_scintillaTricks = new SCINTILLA_TRICKS( m_textCtrl, wxT( "{}" ), false,
104 // onAcceptFn
105 [this]( wxKeyEvent& aEvent )
106 {
107 wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
108 },
109
110 // onCharFn
111 [this]( wxStyledTextEvent& aEvent )
112 {
113 m_scintillaTricks->DoTextVarAutocomplete(
114 // getTokensFn
115 [this]( const wxString& xRef, wxArrayString* tokens )
116 {
117 getContextualTextVars( xRef, tokens );
118 } );
119 } );
120
121 // A hack which causes Scintilla to auto-size the text editor canvas
122 // See: https://github.com/jacobslusser/ScintillaNET/issues/216
123 m_textCtrl->SetScrollWidth( 1 );
124 m_textCtrl->SetScrollWidthTracking( true );
125
126 m_textEntrySizer->AddGrowableRow( 0 );
127
128 m_textColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
129 m_textColorSwatch->SetSwatchBackground( schematicBackground );
130
132
133 m_separator1->SetIsSeparator();
134
135 m_bold->SetIsCheckButton();
137 m_italic->SetIsCheckButton();
139
140 m_separator2->SetIsSeparator();
141
142 m_hAlignLeft->SetIsRadioButton();
144 m_hAlignCenter->SetIsRadioButton();
146 m_hAlignRight->SetIsRadioButton();
148
149 m_separator3->SetIsSeparator();
150
151 m_vAlignTop->SetIsRadioButton();
153 m_vAlignCenter->SetIsRadioButton();
155 m_vAlignBottom->SetIsRadioButton();
157
158 m_separator4->SetIsSeparator();
159
160 m_horizontal->SetIsRadioButton();
162 m_vertical->SetIsRadioButton();
164
165 m_separator5->SetIsSeparator();
166
168
169 if( SCH_EDIT_FRAME* schematicEditor = dynamic_cast<SCH_EDIT_FRAME*>( m_frame ) )
170 {
171 const SCHEMATIC& schematic = schematicEditor->Schematic();
172
173 for( const SCH_SHEET_PATH& sheet : schematic.Hierarchy() )
174 {
175 wxString sheetPageNum = sheet.GetPageNumber();
176 wxString sheetName = sheet.size() == 1 ? _( "<root sheet>" )
177 : sheet.Last()->GetName();
178
179 m_hyperlinkCombo->Append( wxT( "#" ) + sheetPageNum,
180 wxString::Format( _( "Page %s (%s)" ),
181 sheetPageNum,
182 sheetName ) );
183 m_pageNumbers.push_back( sheetPageNum );
184 }
185
186 m_hyperlinkCombo->Append( wxT( "---" ) );
187 m_hyperlinkCombo->Append( wxT( "file://" ), wxT( "file://..." ) );
188 m_hyperlinkCombo->Append( wxT( "http://" ), wxT( "http://..." ) );
189 m_hyperlinkCombo->Append( wxT( "https://" ), wxT( "https://..." ) );
190 }
191 else
192 {
193 m_excludeFromSim->Hide();
194 m_syntaxHelp->Hide();
195 m_hyperlinkCb->Hide();
196 m_hyperlinkCombo->Hide();
197 }
198
200 Layout();
201
202 m_hAlignLeft->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onHAlignButton, this );
203 m_hAlignCenter->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onHAlignButton, this );
204 m_hAlignRight->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onHAlignButton, this );
205 m_vAlignTop->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onVAlignButton, this );
206 m_vAlignCenter->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onVAlignButton, this );
207 m_vAlignBottom->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onVAlignButton, this );
208 m_horizontal->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onTextAngleButton, this );
209 m_vertical->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onTextAngleButton, this );
210
211 // Now all widgets have the size fixed, call FinishDialogSettings
213}
214
215
217{
218 delete m_scintillaTricks;
219 m_scintillaTricks = nullptr;
220
221 if( m_helpWindow )
222 m_helpWindow->Destroy();
223}
224
225
226void DIALOG_TEXT_PROPERTIES::getContextualTextVars( const wxString& aCrossRef,
227 wxArrayString* aTokens )
228{
229 SCHEMATIC* schematic = m_currentItem->Schematic();
230
231 if( !aCrossRef.IsEmpty() )
232 {
233 SCH_SYMBOL* refSymbol = nullptr;
234
235 if( schematic )
236 {
238 schematic->Hierarchy().GetSymbols( refs );
239
240 for( int jj = 0; jj < (int) refs.GetCount(); jj++ )
241 {
242 SCH_REFERENCE& ref = refs[jj];
243
244 if( ref.GetSymbol()->GetRef( &ref.GetSheetPath(), true ) == aCrossRef )
245 {
246 refSymbol = ref.GetSymbol();
247 break;
248 }
249 }
250 }
251
252 if( refSymbol )
253 refSymbol->GetContextualTextVars( aTokens );
254 }
255 else
256 {
257 if( schematic && schematic->CurrentSheet().Last() )
258 {
259 schematic->CurrentSheet().Last()->GetContextualTextVars( aTokens );
260 }
261 else
262 {
263 for( std::pair<wxString, wxString> entry : Prj().GetTextVars() )
264 aTokens->push_back( entry.first );
265 }
266 }
267}
268
269
271{
272 if( !wxDialog::TransferDataToWindow() )
273 return false;
274
275 m_hyperlinkCb->SetValue( m_currentText->HasHyperlink() );
276 m_hyperlinkCombo->SetValue( m_currentText->GetHyperlink() );
277
278 wxString text = m_currentText->GetText();
279
280 // show text variable cross-references in a human-readable format
281 if( SCHEMATIC* schematic = m_currentItem->Schematic() )
282 text = schematic->ConvertKIIDsToRefs( text );
283
284 m_textCtrl->SetValue( text );
285 m_textCtrl->EmptyUndoBuffer();
286
287 if( !m_isSymbolEditor )
288 m_excludeFromSim->SetValue( m_currentItem->GetExcludedFromSim() );
289
290 m_fontCtrl->SetFontSelection( m_currentText->GetFont() );
291 m_textSize.SetValue( m_currentText->GetTextWidth() );
292 m_textColorSwatch->SetSwatchColor( m_currentText->GetTextColor(), false );
293
294 m_bold->Check( m_currentText->IsBold() );
295 m_italic->Check( m_currentText->IsItalic() );
296
297 switch( m_currentText->GetHorizJustify() )
298 {
299 case GR_TEXT_H_ALIGN_LEFT: m_hAlignLeft->Check(); break;
300 case GR_TEXT_H_ALIGN_CENTER: m_hAlignCenter->Check(); break;
301 case GR_TEXT_H_ALIGN_RIGHT: m_hAlignRight->Check(); break;
303 }
304
305 switch( m_currentText->GetVertJustify() )
306 {
307 case GR_TEXT_V_ALIGN_TOP: m_vAlignTop->Check(); break;
308 case GR_TEXT_V_ALIGN_CENTER: m_vAlignCenter->Check(); break;
309 case GR_TEXT_V_ALIGN_BOTTOM: m_vAlignBottom->Check(); break;
311 }
312
313 if( m_currentText->GetTextAngle() == ANGLE_VERTICAL )
314 m_vertical->Check();
315 else
316 m_horizontal->Check();
317
318 if( m_currentItem->Type() == SCH_TEXTBOX_T )
319 {
320 SCH_TEXTBOX* textBox = static_cast<SCH_TEXTBOX*>( m_currentItem );
321
322 m_borderCheckbox->SetValue( textBox->GetWidth() >= 0 );
323
324 if( textBox->GetWidth() >= 0 )
325 m_borderWidth.SetValue( textBox->GetWidth() );
326
327 m_borderColorSwatch->SetSwatchColor( textBox->GetStroke().GetColor(), false );
328
329 int style = static_cast<int>( textBox->GetStroke().GetLineStyle() );
330
331 if( style >= 0 && style < (int) lineTypeNames.size() )
332 m_borderStyleCombo->SetSelection( style );
333 else
334 m_borderStyleCombo->SetSelection( 0 );
335
336 m_borderWidth.Enable( textBox->GetWidth() >= 0 );
337 m_borderColorLabel->Enable( textBox->GetWidth() >= 0 );
338 m_borderColorSwatch->Enable( textBox->GetWidth() >= 0 );
339 m_borderStyleLabel->Enable( textBox->GetWidth() >= 0 );
340 m_borderStyleCombo->Enable( textBox->GetWidth() >= 0 );
341
342 m_filledCtrl->SetValue( textBox->IsSolidFill() );
343 m_fillColorSwatch->SetSwatchColor( textBox->GetFillColor(), false );
344
345 m_fillColorLabel->Enable( textBox->IsSolidFill() );
346 m_fillColorSwatch->Enable( textBox->IsSolidFill() );
347 }
348
349 if( m_isSymbolEditor )
350 {
351 SYMBOL* symbol = m_currentItem->GetParentSymbol();
352
353 m_privateCheckbox->SetValue( m_currentItem->IsPrivate() );
354 m_commonToAllUnits->SetValue( symbol->IsMultiUnit() && m_currentItem->GetUnit() == 0 );
355 m_commonToAllUnits->Enable( symbol->IsMultiUnit() );
356 m_commonToAllBodyStyles->SetValue( symbol->IsMultiBodyStyle() && m_currentItem->GetBodyStyle() == 0 );
357 m_commonToAllBodyStyles->Enable( symbol->IsMultiBodyStyle() );
358 }
359
360 return true;
361}
362
363
364void DIALOG_TEXT_PROPERTIES::onBorderChecked( wxCommandEvent& aEvent )
365{
366 bool border = m_borderCheckbox->GetValue();
367
368 if( border && m_borderWidth.GetValue() < 0 )
369 m_borderWidth.SetValue( m_frame->eeconfig()->m_Drawing.default_line_thickness );
370
371 m_borderWidth.Enable( border );
372 m_borderColorLabel->Enable( border );
373 m_borderColorSwatch->Enable( border );
374 m_borderStyleLabel->Enable( border );
375 m_borderStyleCombo->Enable( border );
376}
377
378
379void DIALOG_TEXT_PROPERTIES::onFillChecked( wxCommandEvent& aEvent )
380{
381 bool fill = m_filledCtrl->GetValue();
382
383 m_fillColorLabel->Enable( fill );
384 m_fillColorSwatch->Enable( fill );
385}
386
387
388void DIALOG_TEXT_PROPERTIES::onHyperlinkChecked( wxCommandEvent& aEvent )
389{
390 if( aEvent.IsChecked() && m_hyperlinkCombo->GetValue().IsEmpty() )
391 {
392 m_hyperlinkCombo->ChangeValue( m_lastLink );
393 }
394 else if( !aEvent.IsChecked() && !m_hyperlinkCombo->GetValue().IsEmpty() )
395 {
396 m_lastLink = m_hyperlinkCombo->GetValue();
397 m_hyperlinkCombo->SetValue( wxEmptyString );
398 }
399
400 aEvent.Skip();
401}
402
403
404void DIALOG_TEXT_PROPERTIES::onHyperlinkText( wxCommandEvent& event )
405{
406 if( !m_hyperlinkCombo->GetValue().IsEmpty() )
407 m_hyperlinkCb->SetValue( true );
408}
409
410
411void DIALOG_TEXT_PROPERTIES::onHyperlinkCombo( wxCommandEvent& aEvent )
412{
413 if( aEvent.GetSelection() >= 0 )
414 {
415 m_hyperlinkCb->SetValue( true );
416 m_hyperlinkCombo->SetInsertionPointEnd();
417 }
418}
419
420
421void DIALOG_TEXT_PROPERTIES::onHAlignButton( wxCommandEvent& aEvent )
422{
424 {
425 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
426 btn->Check( false );
427 }
428}
429
430
431void DIALOG_TEXT_PROPERTIES::onVAlignButton( wxCommandEvent& aEvent )
432{
434 {
435 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
436 btn->Check( false );
437 }
438}
439
440
441void DIALOG_TEXT_PROPERTIES::onTextAngleButton( wxCommandEvent& aEvent )
442{
443 for( BITMAP_BUTTON* btn : { m_horizontal, m_vertical } )
444 {
445 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
446 btn->Check( false );
447 }
448}
449
450
452{
453 if( !wxDialog::TransferDataFromWindow() )
454 return false;
455
456 // Don't allow text to disappear; it can be difficult to correct if you can't select it
457 if( !m_textSize.Validate( 0.01, 1000.0, EDA_UNITS::MM ) )
458 return false;
459
460 SCH_COMMIT commit( m_frame );
461
462 /* save old text in undo list if not already in edit */
463 if( m_currentItem->GetEditFlags() == 0 )
464 commit.Modify( m_currentItem, m_frame->GetScreen() );
465
466 m_frame->GetCanvas()->Refresh();
467
468 wxString text = m_textCtrl->GetValue();
469
470 // convert any text variable cross-references to their UUIDs
471 if( SCHEMATIC* schematic = m_currentItem->Schematic() )
472 text = schematic->ConvertRefsToKIIDs( text );
473
474#ifdef __WXMAC__
475 // On macOS CTRL+Enter produces '\r' instead of '\n' regardless of EOL setting
476 text.Replace( "\r", "\n" );
477#elif defined( __WINDOWS__ )
478 // On Windows, a new line is coded as \r\n. We use only \n in KiCad files and in
479 // drawing routines so strip the \r char.
480 text.Replace( "\r", "" );
481#endif
482
483 m_currentText->SetText( text );
484 m_currentItem->SetExcludedFromSim( m_excludeFromSim->GetValue() );
485
486 if( SYMBOL_EDIT_FRAME* symbolEditor = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame ) )
487 {
488 m_currentItem->SetPrivate( m_privateCheckbox->GetValue() );
489
490 if( !m_commonToAllUnits->GetValue() )
491 m_currentItem->SetUnit( symbolEditor->GetUnit() );
492 else
493 m_currentItem->SetUnit( 0 );
494
495 if( !m_commonToAllBodyStyles->GetValue() )
496 m_currentItem->SetBodyStyle( symbolEditor->GetBodyStyle() );
497 else
498 m_currentItem->SetBodyStyle( 0 );
499 }
500
502 {
503 DisplayError( this, _( "Invalid hyperlink destination. Please enter either a valid URL "
504 "(e.g. file:// or http(s)://) or \"#<page number>\" to create "
505 "a hyperlink to a page in this schematic." ) );
506 return false;
507 }
508 else
509 {
510 m_currentText->SetHyperlink( m_hyperlinkCombo->GetValue() );
511 }
512
513 if( m_currentText->GetTextWidth() != m_textSize.GetValue() )
514 m_currentText->SetTextSize( VECTOR2I( m_textSize.GetIntValue(), m_textSize.GetIntValue() ) );
515
516 if( m_fontCtrl->HaveFontSelection() )
517 m_currentText->SetFont( m_fontCtrl->GetFontSelection( m_bold->IsChecked(), m_italic->IsChecked() ) );
518
519 // Must come after SetTextSize()
520 m_currentText->SetBold( m_bold->IsChecked() );
521 m_currentText->SetItalic( m_italic->IsChecked() );
522
523 m_currentText->SetTextColor( m_textColorSwatch->GetSwatchColor() );
524
525 if( m_hAlignRight->IsChecked() )
526 m_currentText->SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
527 else if( m_hAlignCenter->IsChecked() )
528 m_currentText->SetHorizJustify( GR_TEXT_H_ALIGN_CENTER );
529 else
530 m_currentText->SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
531
532 if( m_vAlignBottom->IsChecked() )
533 m_currentText->SetVertJustify( GR_TEXT_V_ALIGN_BOTTOM );
534 else if( m_vAlignCenter->IsChecked() )
535 m_currentText->SetVertJustify( GR_TEXT_V_ALIGN_CENTER );
536 else
537 m_currentText->SetVertJustify( GR_TEXT_V_ALIGN_TOP );
538
539 if( m_vertical->IsChecked() )
540 m_currentText->SetTextAngle( ANGLE_VERTICAL );
541 else
542 m_currentText->SetTextAngle( ANGLE_HORIZONTAL );
543
544 if( m_currentItem->Type() == SCH_TEXTBOX_T )
545 {
546 SCH_TEXTBOX* textBox = static_cast<SCH_TEXTBOX*>( m_currentItem );
547
548 STROKE_PARAMS stroke = textBox->GetStroke();
549
550 if( m_borderCheckbox->GetValue() )
551 stroke.SetWidth( std::max( 0, m_borderWidth.GetIntValue() ) );
552 else
553 stroke.SetWidth( -1 );
554
555 auto it = lineTypeNames.begin();
556 std::advance( it, m_borderStyleCombo->GetSelection() );
557
558 if( it == lineTypeNames.end() )
560 else
561 stroke.SetLineStyle( it->first );
562
563 stroke.SetColor( m_borderColorSwatch->GetSwatchColor() );
564
565 textBox->SetStroke( stroke );
566
568 textBox->SetFillColor( m_fillColorSwatch->GetSwatchColor() );
569
570 textBox->ClearBoundingBoxCache();
571 textBox->ClearRenderCache();
572
573 VECTOR2I minBoxSize = textBox->GetMinSize();
574 VECTOR2I start = textBox->GetStart();
575 VECTOR2I end = textBox->GetEnd();
576 bool expanded = false;
577
578 if( minBoxSize.x > 0 && std::abs( end.x - start.x ) < minBoxSize.x )
579 {
580 end.x = ( end.x >= start.x ) ? start.x + minBoxSize.x : start.x - minBoxSize.x;
581 expanded = true;
582 }
583
584 if( minBoxSize.y > 0 && std::abs( end.y - start.y ) < minBoxSize.y )
585 {
586 end.y = ( end.y >= start.y ) ? start.y + minBoxSize.y : start.y - minBoxSize.y;
587 expanded = true;
588 }
589
590 if( expanded )
591 textBox->SetEnd( end );
592 }
593
594 if( !commit.Empty() )
595 commit.Push( _( "Edit Text Properties" ) );
596
597 return true;
598}
599
600
601void DIALOG_TEXT_PROPERTIES::OnFormattingHelp( wxHyperlinkEvent& aEvent )
602{
604}
605
606
608{
610 m_scintillaTricks->CancelAutocomplete();
611
612 event.Skip();
613}
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
Definition bitmap.cpp:110
@ 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:402
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:137
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:106
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
Definition dialog_shim.h:82
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:111
void SetFillColor(const COLOR4D &aColor)
Definition eda_shape.h:154
bool IsSolidFill() const
Definition eda_shape.h:117
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
Definition eda_shape.h:216
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
Definition eda_shape.h:174
COLOR4D GetFillColor() const
Definition eda_shape.h:153
void SetEnd(const VECTOR2I &aEnd)
Definition eda_shape.h:220
virtual int GetWidth() const
Definition eda_shape.h:157
void SetFillMode(FILL_T aFill)
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition eda_text.h:80
virtual void ClearBoundingBoxCache()
Definition eda_text.cpp:689
virtual void ClearRenderCache()
Definition eda_text.cpp:683
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:105
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
Holds all the data relating to one schematic.
Definition schematic.h:88
SCH_SHEET_LIST Hierarchy() const
Return the full schematic flattened hierarchical sheet list.
SCH_SHEET_PATH & CurrentSheet() const
Definition schematic.h:187
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:168
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:63
STROKE_PARAMS GetStroke() const override
Definition sch_shape.h:58
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.
Schematic symbol object.
Definition sch_symbol.h:76
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:63
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:177
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:60
@ NO_FILL
Definition eda_shape.h:57
@ LAYER_SCHEMATIC_BACKGROUND
Definition layer_ids.h:488
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition eda_angle.h:400
#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:156
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:695