KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcbnew/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) 2004-2018 Jean-Pierre Charras jp.charras at wanadoo.fr
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
26#include <widgets/font_choice.h>
28#include <confirm.h>
29#include <board_commit.h>
30#include <board.h>
31#include <footprint.h>
32#include <pcb_text.h>
33#include <project.h>
34#include <pcb_edit_frame.h>
36#include <wx/valnum.h>
37#include <scintilla_tricks.h>
38
39
42 m_frame( aParent ),
43 m_item( aText ),
44 m_textWidth( aParent, m_SizeXLabel, m_SizeXCtrl, m_SizeXUnits ),
45 m_textHeight( aParent, m_SizeYLabel, m_SizeYCtrl, m_SizeYUnits ),
46 m_thickness( aParent, m_ThicknessLabel, m_ThicknessCtrl, m_ThicknessUnits ),
47 m_posX( aParent, m_PositionXLabel, m_PositionXCtrl, m_PositionXUnits ),
48 m_posY( aParent, m_PositionYLabel, m_PositionYCtrl, m_PositionYUnits ),
49 m_orientation( aParent, m_OrientLabel, m_OrientCtrl, nullptr )
50{
51 wxString title;
52
53 // Configure display origin transforms
55 {
58 }
59 else
60 {
63 }
64
65 m_MultiLineText->SetEOLMode( wxSTC_EOL_LF );
66
67#ifdef _WIN32
68 // Without this setting, on Windows, some esoteric unicode chars create display issue
69 // in a wxStyledTextCtrl.
70 // for SetTechnology() info, see https://www.scintilla.org/ScintillaDoc.html#SCI_SETTECHNOLOGY
71 m_MultiLineText->SetTechnology(wxSTC_TECHNOLOGY_DIRECTWRITE);
72#endif
73
74 m_scintillaTricks = new SCINTILLA_TRICKS( m_MultiLineText, wxT( "{}" ), false,
75 // onAcceptFn
76 [this]( wxKeyEvent& aEvent )
77 {
78 wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
79 },
80 // onCharFn
81 [this]( wxStyledTextEvent& aEvent )
82 {
84 // getTokensFn
85 [this]( const wxString& xRef, wxArrayString* tokens )
86 {
87 m_frame->GetContextualTextVars( m_item, xRef, tokens );
88 } );
89 } );
90
91 // A hack which causes Scintilla to auto-size the text editor canvas
92 // See: https://github.com/jacobslusser/ScintillaNET/issues/216
93 m_MultiLineText->SetScrollWidth( 1 );
94 m_MultiLineText->SetScrollWidthTracking( true );
95
97 {
98 m_PositionXLabel->SetLabel( _( "Offset X:" ) );
99 m_PositionYLabel->SetLabel( _( "Offset Y:" ) );
100
101 if( m_item->Type() == PCB_FIELD_T )
102 {
103 PCB_FIELD* field = static_cast<PCB_FIELD*>( m_item );
104
105 if( field->IsReference() )
106 {
107 title = _( "Footprint Reference Properties" );
108 m_TextLabel->SetLabel( _( "Reference:" ) );
109 }
110 else if( field->IsValue() )
111 {
112 title = _( "Footprint Value Properties" );
113 m_TextLabel->SetLabel( _( "Value:" ) );
114 }
115 else
116 {
117 title = _( "Footprint Field Properties" );
118 m_TextLabel->SetLabel( _( "Text:" ) );
119 }
120 }
121 else
122 {
123 title = _( "Footprint Text Properties" );
124 m_TextLabel->SetLabel( _( "Text:" ) );
125 m_Visible->Show( false );
126 }
127
129 m_MultiLineSizer->Show( false );
130
131 // Do not allow locking items in the footprint editor
132 m_cbLocked->Show( false );
133
134 m_tabOrder = {
140 m_Visible,
148 };
149 }
150 else
151 {
152 title = _( "Text Properties" );
153
155 m_SingleLineSizer->Show( false );
156
157 m_Visible->Show( false );
158 m_KeepUpright->Show( false );
159 m_statusLine->Show( false );
160
161 m_tabOrder = {
174 };
175 }
176
178 m_bold->SetBitmap( KiBitmapBundle( BITMAPS::text_bold ) );
180 m_italic->SetBitmap( KiBitmapBundle( BITMAPS::text_italic ) );
181
183
185 m_alignLeft->SetBitmap( KiBitmapBundle( BITMAPS::text_align_left ) );
187 m_alignCenter->SetBitmap( KiBitmapBundle( BITMAPS::text_align_center ) );
189 m_alignRight->SetBitmap( KiBitmapBundle( BITMAPS::text_align_right ) );
190
192
194 m_valignBottom->SetBitmap( KiBitmapBundle( BITMAPS::text_valign_bottom ) );
196 m_valignCenter->SetBitmap( KiBitmapBundle( BITMAPS::text_valign_center ) );
198 m_valignTop->SetBitmap( KiBitmapBundle( BITMAPS::text_valign_top ) );
199
201
203 m_mirrored->SetBitmap( KiBitmapBundle( BITMAPS::text_mirrored ) );
204
206 m_autoTextThickness->SetBitmap( KiBitmapBundle( BITMAPS::edit_cmp_symb_links ) );
207
208 SetTitle( title );
209 m_hash_key = title;
210
211 // Configure the layers list selector. Note that footprints are built outside the current
212 // board and so we may need to show all layers if the text is on an unactivated layer.
213 if( !m_frame->GetBoard()->IsLayerEnabled( m_item->GetLayer() ) )
215
219
220 m_orientation.SetUnits( EDA_UNITS::DEGREES );
222
223 // Set predefined rotations in combo dropdown, according to the locale floating point
224 // separator notation
225 double rot_list[] = { 0.0, 90.0, -90.0, 180.0 };
226
227 for( size_t ii = 0; ii < m_OrientCtrl->GetCount() && ii < 4; ++ii )
228 m_OrientCtrl->SetString( ii, wxString::Format( wxT( "%.1f" ), rot_list[ii] ) );
229
230 // Set font sizes
231 m_statusLine->SetFont( KIUI::GetInfoFont( this ) );
232
234
235 // wxTextCtrls fail to generate wxEVT_CHAR events when the wxTE_MULTILINE flag is set,
236 // so we have to listen to wxEVT_CHAR_HOOK events instead.
237 Connect( wxEVT_CHAR_HOOK, wxKeyEventHandler( DIALOG_TEXT_PROPERTIES::OnCharHook ),
238 nullptr, this );
239
241}
242
243
245{
246 Disconnect( wxEVT_CHAR_HOOK, wxKeyEventHandler( DIALOG_TEXT_PROPERTIES::OnCharHook ),
247 nullptr, this );
248
249 delete m_scintillaTricks;
250}
251
252
254{
255 DIALOG_TEXT_PROPERTIES dlg( this, aText );
256
257 // QuasiModal required for Scintilla auto-complete
258 dlg.ShowQuasiModal();
259}
260
261
262void DIALOG_TEXT_PROPERTIES::OnSetFocusText( wxFocusEvent& event )
263{
264 if( m_item->Type() == PCB_FIELD_T && static_cast<PCB_FIELD*>( m_item )->IsReference() )
265 {
266#ifdef __WXGTK__
267 // Force an update of the text control before setting the text selection
268 // This is needed because GTK seems to ignore the selection on first update
269 //
270 // Note that we can't do this on OSX as it tends to provoke Apple's
271 // "[NSAlert runModal] may not be invoked inside of transaction begin/commit pair"
272 // bug. See: https://bugs.launchpad.net/kicad/+bug/1837225
273 m_SingleLineText->Update();
274#endif
275 KIUI::SelectReferenceNumber( static_cast<wxTextEntry*>( m_SingleLineText ) );
276 }
277 else
278 m_SingleLineText->SetSelection( -1, -1 );
279
280 event.Skip();
281}
282
283
285{
286 BOARD* board = m_frame->GetBoard();
287 FOOTPRINT* parentFP = m_item->GetParentFootprint();
288 wxString text = m_item->GetText();
289
290 // show text variable cross-references in a human-readable format
292
293 if( m_SingleLineText->IsShown() )
294 {
295 m_SingleLineText->SetValue( text );
296
297 if( m_item->Type() == PCB_FIELD_T && static_cast<PCB_FIELD*>( m_item )->IsReference() )
298 KIUI::SelectReferenceNumber( static_cast<wxTextEntry*>( m_SingleLineText ) );
299 else
300 m_SingleLineText->SetSelection( -1, -1 );
301 }
302 else if( m_MultiLineText->IsShown() )
303 {
304 m_MultiLineText->SetValue( text );
305 m_MultiLineText->SetSelection( -1, -1 );
306 m_MultiLineText->EmptyUndoBuffer();
307 }
308
309 if( parentFP )
310 {
311 m_statusLine->SetLabel( wxString::Format( _( "Footprint %s (%s), %s, rotated %.1f deg"),
312 parentFP->GetReference(),
313 parentFP->GetValue(),
314 parentFP->IsFlipped() ? _( "back side (mirrored)" )
315 : _( "front side" ),
316 parentFP->GetOrientation().AsDegrees() ) );
317 }
318 else
319 {
320 m_statusLine->Show( false );
321 }
322
323 m_cbLocked->SetValue( m_item->IsLocked() );
324
326 m_cbKnockout->SetValue( m_item->IsKnockout() );
327
329
332
333 if( m_item->GetAutoThickness() )
334 {
337 m_thickness.Enable( false );
338 }
339 else
340 {
342 }
343
346
347 if( m_Visible->IsShown() )
348 m_Visible->SetValue( m_item->IsVisible() );
349
350 if( m_KeepUpright->IsShown() )
351 m_KeepUpright->SetValue( m_item->IsKeepUpright() );
352
353 m_bold->Check( m_item->IsBold() );
355
356 switch ( m_item->GetHorizJustify() )
357 {
358 case GR_TEXT_H_ALIGN_LEFT: m_alignLeft->Check( true ); break;
359 case GR_TEXT_H_ALIGN_CENTER: m_alignCenter->Check( true ); break;
360 case GR_TEXT_H_ALIGN_RIGHT: m_alignRight->Check( true ); break;
362 }
363
364 switch ( m_item->GetVertJustify() )
365 {
366 case GR_TEXT_V_ALIGN_BOTTOM: m_valignBottom->Check( true ); break;
367 case GR_TEXT_V_ALIGN_CENTER: m_valignCenter->Check( true ); break;
368 case GR_TEXT_V_ALIGN_TOP: m_valignTop->Check( true ); break;
370 }
371
373
374 EDA_ANGLE orientation = m_item->GetTextAngle();
376
377 return DIALOG_TEXT_PROPERTIES_BASE::TransferDataToWindow();
378}
379
380
381void DIALOG_TEXT_PROPERTIES::onFontSelected( wxCommandEvent & aEvent )
382{
383 if( KIFONT::FONT::IsStroke( aEvent.GetString() ) )
384 {
385 m_thickness.Show( true );
386 m_autoTextThickness->Show( true );
387
388 int textSize = std::min( m_textWidth.GetValue(), m_textHeight.GetValue() );
389 int thickness = m_thickness.GetValue();
390
391 m_bold->Check( abs( thickness - GetPenSizeForBold( textSize ) )
392 < abs( thickness - GetPenSizeForNormal( textSize ) ) );
393 }
394 else
395 {
396 m_thickness.Show( false );
397 m_autoTextThickness->Show( false );
398 }
399}
400
401
402void DIALOG_TEXT_PROPERTIES::onBoldToggle( wxCommandEvent & aEvent )
403{
404 int textSize = std::min( m_textWidth.GetValue(), m_textHeight.GetValue() );
405
406 if( aEvent.IsChecked() )
408 else
410
411 aEvent.Skip();
412}
413
414
415void DIALOG_TEXT_PROPERTIES::onAlignButton( wxCommandEvent& aEvent )
416{
418 {
419 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
420 btn->Check( false );
421 }
422}
423
424
425void DIALOG_TEXT_PROPERTIES::onValignButton( wxCommandEvent& aEvent )
426{
428 {
429 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
430 btn->Check( false );
431 }
432}
433
434
435void DIALOG_TEXT_PROPERTIES::onThickness( wxCommandEvent& event )
436{
437 int textSize = std::min( m_textWidth.GetValue(), m_textHeight.GetValue() );
438 int thickness = m_thickness.GetValue();
439
440 m_bold->Check( abs( thickness - GetPenSizeForBold( textSize ) )
441 < abs( thickness - GetPenSizeForNormal( textSize ) ) );
442}
443
444
445void DIALOG_TEXT_PROPERTIES::onTextSize( wxCommandEvent& aEvent )
446{
448 {
449 int textSize = std::min( m_textWidth.GetValue(), m_textHeight.GetValue() );
450 int thickness;
451
452 // Calculate the "best" thickness from text size and bold option:
453 if( m_bold->IsChecked() )
454 thickness = GetPenSizeForBold( textSize );
455 else
456 thickness = GetPenSizeForNormal( textSize );
457
458 m_thickness.SetValue( thickness );
459 }
460}
461
462
464{
465 if( aEvent.IsChecked() )
466 {
467 m_autoTextThickness->Check( true );
468
469 wxCommandEvent dummy;
470 onTextSize( dummy );
471
472 m_thickness.Enable( false );
473 }
474 else
475 {
476 m_thickness.Enable( true );
477 }
478}
479
480
482{
483 if( !DIALOG_TEXT_PROPERTIES_BASE::TransferDataFromWindow() )
484 return false;
485
487 int maxSize = pcbIUScale.mmToIU( TEXT_MAX_SIZE_MM );
488
489 if( !m_textWidth.Validate( minSize, maxSize ) || !m_textHeight.Validate( minSize, maxSize ) )
490 return false;
491
492 BOARD* board = m_frame->GetBoard();
493 BOARD_COMMIT commit( m_frame );
494 commit.Modify( m_item );
495
496 // If no other command in progress, prepare undo command
497 // (for a command in progress, will be made later, at the completion of command)
498 bool pushCommit = ( m_item->GetEditFlags() == 0 );
499
500 // Set IN_EDIT flag to force undo/redo/abort proper operation and avoid new calls to
501 // SaveCopyInUndoList for the same text if is moved, and then rotated, edited, etc....
502 if( !pushCommit )
504
505 // Set the new text content
506 if( m_SingleLineText->IsShown() )
507 {
508 if( !m_SingleLineText->GetValue().IsEmpty() )
509 {
510 // convert any text variable cross-references to their UUIDs
511 wxString txt = board->ConvertCrossReferencesToKIIDs( m_SingleLineText->GetValue() );
512
513 m_item->SetText( txt );
514 }
515 }
516 else if( m_MultiLineText->IsShown() )
517 {
518 if( !m_MultiLineText->GetValue().IsEmpty() )
519 {
520 // convert any text variable cross-references to their UUIDs
521 wxString txt = board->ConvertCrossReferencesToKIIDs( m_MultiLineText->GetValue() );
522
523#ifdef __WXMAC__
524 // On macOS CTRL+Enter produces '\r' instead of '\n' regardless of EOL setting.
525 // Replace it now.
526 txt.Replace( wxT( "\r" ), wxT( "\n" ) );
527#elif defined( __WINDOWS__ )
528 // On Windows, a new line is coded as \r\n. We use only \n in kicad files and in
529 // drawing routines so strip the \r char.
530 txt.Replace( wxT( "\r" ), wxT( "" ) );
531#endif
533 }
534 }
535
536 m_item->SetLocked( m_cbLocked->GetValue() );
537
539 m_item->SetIsKnockout( m_cbKnockout->GetValue() );
540
542 {
544 m_italic->IsChecked() ) );
545 }
546
548
550 {
551 m_item->SetAutoThickness( true );
552 }
553 else
554 {
556
557 // Test for acceptable values for thickness and size and clamp if fails
558 int maxPenWidth = ClampTextPenSize( m_item->GetTextThickness(), m_item->GetTextSize() );
559
560 if( m_item->GetTextThickness() > maxPenWidth )
561 {
562 DisplayError( this, _( "The text thickness is too large for the text size.\n"
563 "It will be clamped." ) );
564 m_item->SetTextThickness( maxPenWidth );
565 }
566 }
567
570
571 if( m_Visible->IsShown() )
572 m_item->SetVisible( m_Visible->GetValue() );
573
574 if( m_KeepUpright->IsShown() )
575 m_item->SetKeepUpright( m_KeepUpright->GetValue() );
576
579
580 if( m_alignLeft->IsChecked() )
582 else if( m_alignCenter->IsChecked() )
584 else
586
589 else if( m_valignCenter->IsChecked() )
591 else
593
595
596 if( pushCommit )
597 commit.Push( _( "Edit Text Properties" ) );
598
599 return true;
600}
601
602
603void DIALOG_TEXT_PROPERTIES::onMultiLineTCLostFocus( wxFocusEvent& event )
604{
607
608 event.Skip();
609}
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:112
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
Definition: bitmap.cpp:110
A bitmap button widget that behaves like an AUI toolbar item's button when it is drawn.
Definition: bitmap_button.h:42
void SetIsRadioButton()
bool IsChecked() const
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).
void SetBitmap(const wxBitmapBundle &aBmp)
Set the bitmap shown when the button is enabled.
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:232
void SetLocked(bool aLocked) override
Definition: board_item.h:323
virtual bool IsKnockout() const
Definition: board_item.h:319
bool IsLocked() const override
Definition: board_item.cpp:103
virtual void SetIsKnockout(bool aKnockout)
Definition: board_item.h:320
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:280
FOOTPRINT * GetParentFootprint() const
Definition: board_item.cpp:97
VECTOR2I GetFPRelativePosition() const
Definition: board_item.cpp:346
void SetFPRelativePosition(const VECTOR2I &aPos)
Definition: board_item.cpp:360
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:317
wxString ConvertCrossReferencesToKIIDs(const wxString &aSource) const
Convert cross-references back and forth between ${refDes:field} and ${kiid:field}.
Definition: board.cpp:1732
wxString ConvertKIIDsToCrossReferences(const wxString &aSource) const
Definition: board.cpp:1786
std::vector< wxWindow * > m_tabOrder
Definition: dialog_shim.h:256
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
Definition: dialog_shim.h:75
void SetupStandardButtons(std::map< int, wxString > aLabels={})
int ShowQuasiModal()
std::string m_hash_key
Definition: dialog_shim.h:236
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
virtual void OnCharHook(wxKeyEvent &aEvt)
virtual void OnSetFocusText(wxFocusEvent &event) override
Used to select the variant part of some text fields (for instance, the question mark or number in a r...
void onAutoTextThickness(wxCommandEvent &aEvent) override
void onMultiLineTCLostFocus(wxFocusEvent &event) override
void onTextSize(wxCommandEvent &aEvent) override
void onFontSelected(wxCommandEvent &aEvent) override
DIALOG_TEXT_PROPERTIES(SCH_BASE_FRAME *parent, SCH_ITEM *aTextItem)
void onBoldToggle(wxCommandEvent &aEvent) override
void onThickness(wxCommandEvent &aEvent) override
void onValignButton(wxCommandEvent &aEvent) override
void onAlignButton(wxCommandEvent &aEvent) override
EDA_ANGLE Normalize()
Definition: eda_angle.h:229
double AsDegrees() const
Definition: eda_angle.h:116
EDA_ANGLE Normalize180()
Definition: eda_angle.h:268
EDA_ITEM_FLAGS GetEditFlags() const
Definition: eda_item.h:148
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:142
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:110
bool IsItalic() const
Definition: eda_text.h:166
const EDA_ANGLE & GetTextAngle() const
Definition: eda_text.h:144
void SetTextSize(VECTOR2I aNewSize, bool aEnforceMinTextSize=true)
Definition: eda_text.cpp:533
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:97
bool IsKeepUpright() const
Definition: eda_text.h:203
virtual bool IsVisible() const
Definition: eda_text.h:184
KIFONT::FONT * GetFont() const
Definition: eda_text.h:244
void SetMirrored(bool isMirrored)
Definition: eda_text.cpp:393
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
Definition: eda_text.cpp:417
GR_TEXT_H_ALIGN_T GetHorizJustify() const
Definition: eda_text.h:197
void SetBoldFlag(bool aBold)
Set only the bold flag, without changing the font.
Definition: eda_text.cpp:378
virtual void SetVisible(bool aVisible)
Definition: eda_text.cpp:386
bool GetAutoThickness() const
Definition: eda_text.h:136
void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
Definition: eda_text.cpp:284
void SetItalicFlag(bool aItalic)
Set only the italic flag, without changing the font.
Definition: eda_text.cpp:327
void SetAutoThickness(bool aAuto)
Definition: eda_text.cpp:292
bool IsMirrored() const
Definition: eda_text.h:187
int GetEffectiveTextPenWidth(int aDefaultPenWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultPenWidth.
Definition: eda_text.cpp:465
bool IsBold() const
Definition: eda_text.h:181
void SetKeepUpright(bool aKeepUpright)
Definition: eda_text.cpp:425
GR_TEXT_V_ALIGN_T GetVertJustify() const
Definition: eda_text.h:200
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:270
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
Definition: eda_text.cpp:299
int GetTextThickness() const
Definition: eda_text.h:125
void SetFont(KIFONT::FONT *aFont)
Definition: eda_text.cpp:499
VECTOR2I GetTextSize() const
Definition: eda_text.h:258
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
Definition: eda_text.cpp:409
void SetFontSelection(KIFONT::FONT *aFont, bool aSilentMode=false)
Set the selection in wxChoice widget.
Definition: font_choice.cpp:73
KIFONT::FONT * GetFontSelection(bool aBold, bool aItalic, bool aForDrawingSheet=false) const
bool HaveFontSelection() const
Definition: font_choice.cpp:95
EDA_ANGLE GetOrientation() const
Definition: footprint.h:230
bool IsFlipped() const
Definition: footprint.h:400
const wxString & GetValue() const
Definition: footprint.h:649
const wxString & GetReference() const
Definition: footprint.h:627
virtual bool IsStroke() const
Definition: font.h:138
int SetLayerSelection(int layer)
bool SetLayersHotkeys(bool value)
Common, abstract interface for edit frames.
bool IsReference() const
Definition: pcb_field.h:68
bool IsValue() const
Definition: pcb_field.h:69
void SetBoardFrame(PCB_BASE_FRAME *aFrame)
void ShowNonActivatedLayers(bool aShow)
Add cut/copy/paste, dark theme, autocomplete and brace highlighting to a wxStyleTextCtrl instance.
void DoTextVarAutocomplete(const std::function< void(const wxString &xRef, wxArrayString *tokens)> &getTokensFn)
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 void SetPrecision(int aLength)
Normally not needed, but can be used to set the precision when using internal units that are floats (...
virtual void SetUnits(EDA_UNITS aUnits)
Normally not needed (as the UNIT_BINDER inherits from the parent frame), but can be used to set to DE...
virtual EDA_ANGLE GetAngleValue()
virtual void SetAngleValue(const EDA_ANGLE &aValue)
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 ChangeValue(int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion WITHOUT trigger...
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 SetCoordType(ORIGIN_TRANSFORMS::COORD_TYPES_T aCoordType)
Set the current origin transform mode.
Definition: unit_binder.h:205
void DisplayError(wxWindow *aParent, const wxString &aText)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:169
This file is part of the common library.
const int minSize
Push and Shove router track width and via size dialog.
#define _(s)
#define IN_EDIT
Item currently edited.
#define TEXT_MIN_SIZE_MM
Minimum text size (1 micron).
Definition: eda_text.h:46
#define TEXT_MAX_SIZE_MM
Maximum text size in mm (~10 inches)
Definition: eda_text.h:47
int GetPenSizeForBold(int aTextSize)
Definition: gr_text.cpp:36
int GetPenSizeForNormal(int aTextSize)
Definition: gr_text.cpp:60
int ClampTextPenSize(int aPenSize, int aSize, bool aStrict)
Pen width should not allow characters to become cluttered up in their own fatness.
Definition: gr_text.cpp:72
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:744
KICOMMON_API wxFont GetInfoFont(wxWindow *aWindow)
Definition: ui_common.cpp:156
KICOMMON_API void SelectReferenceNumber(wxTextEntry *aTextEntry)
Select the number (or "?") in a reference for ease of editing.
Definition: ui_common.cpp:236
std::vector< FAB_LAYER_COLOR > dummy
wxString UnescapeString(const wxString &aSource)
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
@ CTX_QUOTED_STR
Definition: string_utils.h:57
constexpr int mmToIU(double mm) const
Definition: base_units.h:92
@ 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
@ PCB_FIELD_T
class PCB_FIELD, text associated with a footprint property
Definition: typeinfo.h:90
VECTOR2< int32_t > VECTOR2I
Definition: vector2d.h:695