58 if(
m_item->GetParentFootprint() )
60 m_posX.SetCoordType( ORIGIN_TRANSFORMS::REL_X_COORD );
61 m_posY.SetCoordType( ORIGIN_TRANSFORMS::REL_Y_COORD );
65 m_posX.SetCoordType( ORIGIN_TRANSFORMS::ABS_X_COORD );
66 m_posY.SetCoordType( ORIGIN_TRANSFORMS::ABS_Y_COORD );
80 [
this]( wxKeyEvent& aEvent )
82 wxPostEvent(
this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
85 [
this]( wxStyledTextEvent& aEvent )
89 [
this](
const wxString& xRef, wxArrayString* tokens )
100 if(
m_item->GetParentFootprint() )
102 m_PositionXLabel->SetLabel( _(
"Offset X:" ) );
103 m_PositionYLabel->SetLabel( _(
"Offset Y:" ) );
105 if( m_item->Type() == PCB_FIELD_T )
107 PCB_FIELD* field = static_cast<PCB_FIELD*>( m_item );
109 if( field->IsReference() )
111 title = _(
"Footprint Reference Properties" );
112 m_TextLabel->SetLabel( _(
"Reference:" ) );
114 else if( field->IsValue() )
116 title = _(
"Footprint Value Properties" );
117 m_TextLabel->SetLabel( _(
"Value:" ) );
121 title = _(
"Footprint Field Properties" );
122 m_TextLabel->SetLabel( _(
"Text:" ) );
127 title = _(
"Footprint Text Properties" );
128 m_TextLabel->SetLabel( _(
"Text:" ) );
129 m_Visible->Show( false );
156 title =
_(
"Text Properties" );
158 SetInitialFocus( m_MultiLineText );
159 m_SingleLineSizer->Show(
false );
161 m_Visible->Show(
false );
162 m_KeepUpright->Show(
false );
163 m_statusLine->Show(
false );
168 m_LayerSelectionCtrl,
181 m_bold->SetIsCheckButton();
183 m_italic->SetIsCheckButton();
186 m_separator1->SetIsSeparator();
188 m_alignLeft->SetIsRadioButton();
190 m_alignCenter->SetIsRadioButton();
192 m_alignRight->SetIsRadioButton();
195 m_separator2->SetIsSeparator();
197 m_valignBottom->SetIsRadioButton();
199 m_valignCenter->SetIsRadioButton();
201 m_valignTop->SetIsRadioButton();
204 m_separator3->SetIsSeparator();
206 m_mirrored->SetIsCheckButton();
209 m_autoTextThickness->SetIsCheckButton();
217 if( !m_frame->GetBoard()->IsLayerEnabled( m_item->GetLayer() ) )
218 m_LayerSelectionCtrl->ShowNonActivatedLayers(
true );
220 m_LayerSelectionCtrl->SetLayersHotkeys(
false );
221 m_LayerSelectionCtrl->SetBoardFrame( m_frame );
222 m_LayerSelectionCtrl->Resync();
225 m_orientation.SetPrecision( 3 );
229 double rot_list[] = { 0.0, 90.0, -90.0, 180.0 };
231 for(
size_t ii = 0; ii < m_OrientCtrl->GetCount() && ii < 4; ++ii )
232 m_OrientCtrl->SetString( ii, wxString::Format( wxT(
"%.1f" ), rot_list[ii] ) );
237 SetupStandardButtons();
244 finishDialogSettings();
315 m_statusLine->SetLabel( wxString::Format(
_(
"Footprint %s (%s), %s, rotated %.1f deg"),
318 parentFP->
IsFlipped() ?
_(
"back side (mirrored)" )
337 if(
m_item->GetAutoThickness() )
360 switch (
m_item->GetHorizJustify() )
368 switch (
m_item->GetVertJustify() )
378 EDA_ANGLE orientation =
m_item->GetTextAngle();
381 return DIALOG_TEXT_PROPERTIES_BASE::TransferDataToWindow();
410 if( aEvent.IsChecked() )
423 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
433 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
469 if( aEvent.IsChecked() )
473 wxCommandEvent
dummy;
487 if( !DIALOG_TEXT_PROPERTIES_BASE::TransferDataFromWindow() )
530 txt.Replace( wxT(
"\r" ), wxT(
"\n" ) );
531#elif defined( __WINDOWS__ )
534 txt.Replace( wxT(
"\r" ), wxT(
"" ) );
555 m_item->SetAutoThickness(
true );
564 if(
m_item->GetTextThickness() > maxPenWidth )
566 DisplayError(
this,
_(
"The text thickness is too large for the text size.\n"
567 "It will be clamped." ) );
568 m_item->SetTextThickness( maxPenWidth );
601 commit.Push(
_(
"Edit Text Properties" ) );
constexpr EDA_IU_SCALE pcbIUScale
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
FOOTPRINT * GetParentFootprint() const
Information pertinent to a Pcbnew printed circuit board.
wxString ConvertCrossReferencesToKIIDs(const wxString &aSource) const
Convert cross-references back and forth between ${refDes:field} and ${kiid:field}.
wxString ConvertKIIDsToCrossReferences(const wxString &aSource) const
std::vector< wxWindow * > m_tabOrder
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
virtual void OnCharHook(wxKeyEvent &aEvt)
wxComboBox * m_OrientCtrl
wxTextCtrl * m_PositionXCtrl
wxStaticText * m_SizeYUnits
wxStyledTextCtrl * m_MultiLineText
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)
wxTextCtrl * m_PositionYCtrl
wxButton * m_sdbSizerCancel
BITMAP_BUTTON * m_alignRight
BITMAP_BUTTON * m_mirrored
wxStaticText * m_statusLine
BITMAP_BUTTON * m_autoTextThickness
wxTextCtrl * m_SingleLineText
wxCheckBox * m_KeepUpright
wxStaticText * m_PositionXUnits
wxStaticText * m_PositionYLabel
BITMAP_BUTTON * m_valignCenter
wxBoxSizer * m_MultiLineSizer
wxStaticText * m_SizeXLabel
wxStaticText * m_OrientLabel
wxStaticText * m_ThicknessLabel
wxTextCtrl * m_ThicknessCtrl
wxStaticText * m_PositionYUnits
wxStaticText * m_ThicknessUnits
wxCheckBox * m_cbKnockout
BITMAP_BUTTON * m_valignTop
BITMAP_BUTTON * m_alignLeft
BITMAP_BUTTON * m_alignCenter
wxStaticText * m_SizeYLabel
PCB_LAYER_BOX_SELECTOR * m_LayerSelectionCtrl
wxStaticText * m_PositionXLabel
BITMAP_BUTTON * m_valignBottom
wxStaticText * m_SizeXUnits
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...
UNIT_BINDER m_orientation
bool TransferDataToWindow() override
~DIALOG_TEXT_PROPERTIES() override
void onAutoTextThickness(wxCommandEvent &aEvent) override
void onMultiLineTCLostFocus(wxFocusEvent &event) override
SCINTILLA_TRICKS * m_scintillaTricks
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
bool TransferDataFromWindow() override
void onThickness(wxCommandEvent &aEvent) override
void onValignButton(wxCommandEvent &aEvent) override
void onAlignButton(wxCommandEvent &aEvent) override
EDA_ITEM_FLAGS GetEditFlags() const
void SetFlags(EDA_ITEM_FLAGS aMask)
KICAD_T Type() const
Returns the type of object.
virtual const wxString & GetText() const
Return the string associated with the text object.
virtual void SetText(const wxString &aText)
virtual bool IsStroke() const
Common, abstract interface for edit frames.
void ShowTextPropertiesDialog(PCB_TEXT *aText)
Add cut/copy/paste, dark theme, autocomplete and brace highlighting to a wxStyleTextCtrl instance.
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.
void DisplayError(wxWindow *aParent, const wxString &aText)
Display an error or warning message box with aMessage.
This file is part of the common library.
const int minSize
Push and Shove router track width and via size dialog.
#define IN_EDIT
Item currently edited.
#define TEXT_MIN_SIZE_MM
Minimum text size (1 micron).
#define TEXT_MAX_SIZE_MM
Maximum text size in mm (~10 inches)
int GetPenSizeForBold(int aTextSize)
int GetPenSizeForNormal(int aTextSize)
int ClampTextPenSize(int aPenSize, int aSize, bool aStrict)
Pen width should not allow characters to become cluttered up in their own fatness.
PCB_LAYER_ID ToLAYER_ID(int aLayer)
KICOMMON_API wxFont GetInfoFont(wxWindow *aWindow)
KICOMMON_API void SelectReferenceNumber(wxTextEntry *aTextEntry)
Select the number (or "?") in a reference for ease of editing.
BARCODE class definition.
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:...
@ GR_TEXT_H_ALIGN_INDETERMINATE
@ GR_TEXT_V_ALIGN_INDETERMINATE
@ PCB_FIELD_T
class PCB_FIELD, text associated with a footprint property
VECTOR2< int32_t > VECTOR2I