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 (C) 2010-2024 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 // Don't let users modify the library link, in the board editor
118 if( field->IsFootprint() && !m_frame->IsType( FRAME_FOOTPRINT_EDITOR ) )
119 m_SingleLineText->SetEditable( false );
120
121 title = _( "Footprint Field Properties" );
122 m_TextLabel->SetLabel( _( "Text:" ) );
123 }
124 }
125 else
126 {
127 title = _( "Footprint Text Properties" );
128 m_TextLabel->SetLabel( _( "Text:" ) );
129 }
130
132 m_MultiLineSizer->Show( false );
133
134 // Do not allow locking items in the footprint editor
135 m_cbLocked->Show( false );
136
137 m_tabOrder = {
143 m_Visible,
151 };
152 }
153 else
154 {
155 title = _( "Text Properties" );
156
158 m_SingleLineSizer->Show( false );
159
160 // This option makes sense only for footprint texts; texts on board are always visible.
161 m_Visible->SetValue( true );
162 m_Visible->Show( false );
163
164 m_KeepUpright->Show( false );
165 m_statusLine->Show( false );
166
167 m_tabOrder = {
180 };
181 }
182
184 m_bold->SetBitmap( KiBitmapBundle( BITMAPS::text_bold ) );
186 m_italic->SetBitmap( KiBitmapBundle( BITMAPS::text_italic ) );
187
189
191 m_alignLeft->SetBitmap( KiBitmapBundle( BITMAPS::text_align_left ) );
193 m_alignCenter->SetBitmap( KiBitmapBundle( BITMAPS::text_align_center ) );
195 m_alignRight->SetBitmap( KiBitmapBundle( BITMAPS::text_align_right ) );
196
198
200 m_valignBottom->SetBitmap( KiBitmapBundle( BITMAPS::text_valign_bottom ) );
202 m_valignCenter->SetBitmap( KiBitmapBundle( BITMAPS::text_valign_center ) );
204 m_valignTop->SetBitmap( KiBitmapBundle( BITMAPS::text_valign_top ) );
205
207
209 m_mirrored->SetBitmap( KiBitmapBundle( BITMAPS::text_mirrored ) );
210
211 SetTitle( title );
212 m_hash_key = title;
213
214 // Configure the layers list selector. Note that footprints are built outside the current
215 // board and so we may need to show all layers if the text is on an unactivated layer.
216 if( !m_frame->GetBoard()->IsLayerEnabled( m_item->GetLayer() ) )
218
222
223 m_orientation.SetUnits( EDA_UNITS::DEGREES );
225
226 // Set predefined rotations in combo dropdown, according to the locale floating point
227 // separator notation
228 double rot_list[] = { 0.0, 90.0, -90.0, 180.0 };
229
230 for( size_t ii = 0; ii < m_OrientCtrl->GetCount() && ii < 4; ++ii )
231 m_OrientCtrl->SetString( ii, wxString::Format( wxT( "%.1f" ), rot_list[ii] ) );
232
233 // Set font sizes
234 m_statusLine->SetFont( KIUI::GetInfoFont( this ) );
235
237
238 // wxTextCtrls fail to generate wxEVT_CHAR events when the wxTE_MULTILINE flag is set,
239 // so we have to listen to wxEVT_CHAR_HOOK events instead.
240 Connect( wxEVT_CHAR_HOOK, wxKeyEventHandler( DIALOG_TEXT_PROPERTIES::OnCharHook ),
241 nullptr, this );
242
244}
245
246
248{
249 Disconnect( wxEVT_CHAR_HOOK, wxKeyEventHandler( DIALOG_TEXT_PROPERTIES::OnCharHook ),
250 nullptr, this );
251
252 delete m_scintillaTricks;
253}
254
255
257{
258 DIALOG_TEXT_PROPERTIES dlg( this, aText );
259
260 // QuasiModal required for Scintilla auto-complete
261 dlg.ShowQuasiModal();
262}
263
264
265void DIALOG_TEXT_PROPERTIES::OnSetFocusText( wxFocusEvent& event )
266{
267 if( m_item->Type() == PCB_FIELD_T && static_cast<PCB_FIELD*>( m_item )->IsReference() )
268 {
269#ifdef __WXGTK__
270 // Force an update of the text control before setting the text selection
271 // This is needed because GTK seems to ignore the selection on first update
272 //
273 // Note that we can't do this on OSX as it tends to provoke Apple's
274 // "[NSAlert runModal] may not be invoked inside of transaction begin/commit pair"
275 // bug. See: https://bugs.launchpad.net/kicad/+bug/1837225
276 m_SingleLineText->Update();
277#endif
278 KIUI::SelectReferenceNumber( static_cast<wxTextEntry*>( m_SingleLineText ) );
279 }
280 else
281 m_SingleLineText->SetSelection( -1, -1 );
282
283 event.Skip();
284}
285
286
288{
289 BOARD* board = m_frame->GetBoard();
290 FOOTPRINT* parentFP = m_item->GetParentFootprint();
291 wxString msg = board->ConvertKIIDsToCrossReferences( UnescapeString( m_item->GetText() ) );
292
293 if( m_SingleLineText->IsShown() )
294 {
295 m_SingleLineText->SetValue( msg );
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( msg );
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
335
336 m_Visible->SetValue( m_item->IsVisible() );
337
338 if( parentFP )
339 m_KeepUpright->SetValue( m_item->IsKeepUpright() );
340
341 m_bold->Check( m_item->IsBold() );
343
344 switch ( m_item->GetHorizJustify() )
345 {
346 case GR_TEXT_H_ALIGN_LEFT: m_alignLeft->Check( true ); break;
347 case GR_TEXT_H_ALIGN_CENTER: m_alignCenter->Check( true ); break;
348 case GR_TEXT_H_ALIGN_RIGHT: m_alignRight->Check( true ); break;
350 }
351
352 switch ( m_item->GetVertJustify() )
353 {
354 case GR_TEXT_V_ALIGN_BOTTOM: m_valignBottom->Check( true ); break;
355 case GR_TEXT_V_ALIGN_CENTER: m_valignCenter->Check( true ); break;
356 case GR_TEXT_V_ALIGN_TOP: m_valignTop->Check( true ); break;
358 }
359
361
362 EDA_ANGLE orientation = m_item->GetTextAngle();
364
365 return DIALOG_TEXT_PROPERTIES_BASE::TransferDataToWindow();
366}
367
368
369void DIALOG_TEXT_PROPERTIES::onFontSelected( wxCommandEvent & aEvent )
370{
371 if( KIFONT::FONT::IsStroke( aEvent.GetString() ) )
372 {
373 m_thickness.Show( true );
374 m_buttonUpdateTh->Show( true );
375
376 int textSize = std::min( m_textWidth.GetValue(), m_textHeight.GetValue() );
377 int thickness = m_thickness.GetValue();
378
379 m_bold->Check( abs( thickness - GetPenSizeForBold( textSize ) )
380 < abs( thickness - GetPenSizeForNormal( textSize ) ) );
381 }
382 else
383 {
384 m_thickness.Show( false );
385 m_buttonUpdateTh->Show( false );
386 }
387}
388
389
390void DIALOG_TEXT_PROPERTIES::onBoldToggle( wxCommandEvent & aEvent )
391{
392 int textSize = std::min( m_textWidth.GetValue(), m_textHeight.GetValue() );
393
394 if( aEvent.IsChecked() )
396 else
398
399 aEvent.Skip();
400}
401
402
403void DIALOG_TEXT_PROPERTIES::onAlignButton( wxCommandEvent& aEvent )
404{
406 {
407 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
408 btn->Check( false );
409 }
410}
411
412
413void DIALOG_TEXT_PROPERTIES::onValignButton( wxCommandEvent& aEvent )
414{
416 {
417 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
418 btn->Check( false );
419 }
420}
421
422
423void DIALOG_TEXT_PROPERTIES::onThickness( wxCommandEvent& event )
424{
425 int textSize = std::min( m_textWidth.GetValue(), m_textHeight.GetValue() );
426 int thickness = m_thickness.GetValue();
427
428 m_bold->Check( abs( thickness - GetPenSizeForBold( textSize ) )
429 < abs( thickness - GetPenSizeForNormal( textSize ) ) );
430}
431
432
434{
435 int textSize = std::min( m_textWidth.GetValue(), m_textHeight.GetValue() );
436 int thickness;
437
438 // Calculate the "best" thickness from text size and bold option:
439 if( m_bold->IsChecked() )
440 thickness = GetPenSizeForBold( textSize );
441 else
442 thickness = GetPenSizeForNormal( textSize );
443
444 m_thickness.SetValue( thickness );
445}
446
447
449{
450 if( !DIALOG_TEXT_PROPERTIES_BASE::TransferDataFromWindow() )
451 return false;
452
454 int maxSize = pcbIUScale.mmToIU( TEXT_MAX_SIZE_MM );
455
456 if( !m_textWidth.Validate( minSize, maxSize ) || !m_textHeight.Validate( minSize, maxSize ) )
457 return false;
458
459 BOARD* board = m_frame->GetBoard();
460 BOARD_COMMIT commit( m_frame );
461 commit.Modify( m_item );
462
463 // If no other command in progress, prepare undo command
464 // (for a command in progress, will be made later, at the completion of command)
465 bool pushCommit = ( m_item->GetEditFlags() == 0 );
466
467 // Set IN_EDIT flag to force undo/redo/abort proper operation and avoid new calls to
468 // SaveCopyInUndoList for the same text if is moved, and then rotated, edited, etc....
469 if( !pushCommit )
471
472 // Set the new text content
473 if( m_SingleLineText->IsShown() )
474 {
475 if( !m_SingleLineText->GetValue().IsEmpty() )
476 {
477 wxString txt = board->ConvertCrossReferencesToKIIDs( m_SingleLineText->GetValue() );
478
479 m_item->SetText( txt );
480 }
481 }
482 else if( m_MultiLineText->IsShown() )
483 {
484 if( !m_MultiLineText->GetValue().IsEmpty() )
485 {
486 wxString txt = board->ConvertCrossReferencesToKIIDs( m_MultiLineText->GetValue() );
487
488#ifdef __WXMAC__
489 // On macOS CTRL+Enter produces '\r' instead of '\n' regardless of EOL setting.
490 // Replace it now.
491 txt.Replace( wxT( "\r" ), wxT( "\n" ) );
492#elif defined( __WINDOWS__ )
493 // On Windows, a new line is coded as \r\n. We use only \n in kicad files and in
494 // drawing routines so strip the \r char.
495 txt.Replace( wxT( "\r" ), wxT( "" ) );
496#endif
498 }
499 }
500
501 m_item->SetLocked( m_cbLocked->GetValue() );
502
504 m_item->SetIsKnockout( m_cbKnockout->GetValue() );
505
507 {
509 m_italic->IsChecked() ) );
510 }
511
515
516 // Test for acceptable values for thickness and size and clamp if fails
517 int maxPenWidth = Clamp_Text_PenSize( m_item->GetTextThickness(), m_item->GetTextSize() );
518
519 if( m_item->GetTextThickness() > maxPenWidth )
520 {
521 DisplayError( this, _( "The text thickness is too large for the text size.\n"
522 "It will be clamped." ) );
523 m_item->SetTextThickness( maxPenWidth );
524 }
525
527
528 m_item->SetVisible( m_Visible->GetValue() );
529
530 if( m_KeepUpright->IsShown() )
531 m_item->SetKeepUpright( m_KeepUpright->GetValue() );
532
535
536 if( m_alignLeft->IsChecked() )
538 else if( m_alignCenter->IsChecked() )
540 else
542
545 else if( m_valignCenter->IsChecked() )
547 else
549
551
552 if( pushCommit )
553 commit.Push( _( "Edit Text Properties" ) );
554
555 return true;
556}
557
558
559void DIALOG_TEXT_PROPERTIES::onMultiLineTCLostFocus( wxFocusEvent& event )
560{
563
564 event.Skip();
565}
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:108
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
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:237
virtual void SetLocked(bool aLocked)
Definition: board_item.h:328
virtual bool IsKnockout() const
Definition: board_item.h:324
virtual void SetIsKnockout(bool aKnockout)
Definition: board_item.h:325
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:288
FOOTPRINT * GetParentFootprint() const
Definition: board_item.cpp:299
VECTOR2I GetFPRelativePosition() const
Definition: board_item.cpp:328
void SetFPRelativePosition(const VECTOR2I &aPos)
Definition: board_item.cpp:342
virtual bool IsLocked() const
Definition: board_item.cpp:75
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:290
wxString ConvertCrossReferencesToKIIDs(const wxString &aSource) const
Convert cross-references back and forth between ${refDes:field} and ${kiid:field}.
Definition: board.cpp:1551
wxString ConvertKIIDsToCrossReferences(const wxString &aSource) const
Definition: board.cpp:1605
std::vector< wxWindow * > m_tabOrder
Definition: dialog_shim.h:233
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
Definition: dialog_shim.h:102
void SetupStandardButtons(std::map< int, wxString > aLabels={})
int ShowQuasiModal()
std::string m_hash_key
Definition: dialog_shim.h:213
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 onMultiLineTCLostFocus(wxFocusEvent &event) override
void onFontSelected(wxCommandEvent &aEvent) override
DIALOG_TEXT_PROPERTIES(SCH_BASE_FRAME *parent, SCH_ITEM *aTextItem)
void updateTextThickness(wxCommandEvent &aEvent) override
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:221
double AsDegrees() const
Definition: eda_angle.h:113
EDA_ANGLE Normalize180()
Definition: eda_angle.h:260
bool IsType(FRAME_T aType) const
EDA_ITEM_FLAGS GetEditFlags() const
Definition: eda_item.h:133
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:127
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:101
bool IsItalic() const
Definition: eda_text.h:152
const EDA_ANGLE & GetTextAngle() const
Definition: eda_text.h:130
void SetTextSize(VECTOR2I aNewSize, bool aEnforceMinTextSize=true)
Definition: eda_text.cpp:419
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:94
bool IsKeepUpright() const
Definition: eda_text.h:189
virtual bool IsVisible() const
Definition: eda_text.h:170
KIFONT::FONT * GetFont() const
Definition: eda_text.h:230
void SetMirrored(bool isMirrored)
Definition: eda_text.cpp:297
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
Definition: eda_text.cpp:321
GR_TEXT_H_ALIGN_T GetHorizJustify() const
Definition: eda_text.h:183
void SetBoldFlag(bool aBold)
Set only the italic flag, without changing the font.
Definition: eda_text.cpp:282
virtual void SetVisible(bool aVisible)
Definition: eda_text.cpp:290
void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
Definition: eda_text.cpp:196
void SetItalicFlag(bool aItalic)
Set only the italic flag, without changing the font.
Definition: eda_text.cpp:232
bool IsMirrored() const
Definition: eda_text.h:173
bool IsBold() const
Definition: eda_text.h:167
void SetKeepUpright(bool aKeepUpright)
Definition: eda_text.cpp:329
GR_TEXT_V_ALIGN_T GetVertJustify() const
Definition: eda_text.h:186
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:182
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
Definition: eda_text.cpp:204
int GetTextThickness() const
Definition: eda_text.h:122
void SetFont(KIFONT::FONT *aFont)
Definition: eda_text.cpp:403
VECTOR2I GetTextSize() const
Definition: eda_text.h:241
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
Definition: eda_text.cpp:313
KIFONT::FONT * GetFontSelection(bool aBold, bool aItalic, bool aForDrawingSheet=false) const
bool HaveFontSelection() const
Definition: font_choice.cpp:94
void SetFontSelection(KIFONT::FONT *aFont)
Definition: font_choice.cpp:73
EDA_ANGLE GetOrientation() const
Definition: footprint.h:227
bool IsFlipped() const
Definition: footprint.h:391
const wxString & GetValue() const
Definition: footprint.h:624
const wxString & GetReference() const
Definition: footprint.h:602
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:70
bool IsValue() const
Definition: pcb_field.h:71
bool IsFootprint() const
Definition: pcb_field.h:72
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.
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:199
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:170
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
@ FRAME_FOOTPRINT_EDITOR
Definition: frame_type.h:43
int GetPenSizeForBold(int aTextSize)
Definition: gr_text.cpp:40
int GetPenSizeForNormal(int aTextSize)
Definition: gr_text.cpp:64
int Clamp_Text_PenSize(int aPenSize, int aSize, bool aStrict)
Pen width should not allow characters to become cluttered up in their own fatness.
Definition: gr_text.cpp:87
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:810
KICOMMON_API wxFont GetInfoFont(wxWindow *aWindow)
Definition: ui_common.cpp:154
KICOMMON_API void SelectReferenceNumber(wxTextEntry *aTextEntry)
Select the number (or "?") in a reference for ease of editing.
Definition: ui_common.cpp:228
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:88
@ 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:691