57 if(
m_item->GetParentFootprint() )
59 m_posX.SetCoordType( ORIGIN_TRANSFORMS::REL_X_COORD );
60 m_posY.SetCoordType( ORIGIN_TRANSFORMS::REL_Y_COORD );
64 m_posX.SetCoordType( ORIGIN_TRANSFORMS::ABS_X_COORD );
65 m_posY.SetCoordType( ORIGIN_TRANSFORMS::ABS_Y_COORD );
79 [
this]( wxKeyEvent& aEvent )
81 wxPostEvent(
this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
84 [
this]( wxStyledTextEvent& aEvent )
88 [
this](
const wxString& xRef, wxArrayString* tokens )
99 if(
m_item->GetParentFootprint() )
101 m_PositionXLabel->SetLabel( _(
"Offset X:" ) );
102 m_PositionYLabel->SetLabel( _(
"Offset Y:" ) );
104 if( m_item->Type() == PCB_FIELD_T )
106 PCB_FIELD* field = static_cast<PCB_FIELD*>( m_item );
108 if( field->IsReference() )
110 title = _(
"Footprint Reference Properties" );
111 m_TextLabel->SetLabel( _(
"Reference:" ) );
113 else if( field->IsValue() )
115 title = _(
"Footprint Value Properties" );
116 m_TextLabel->SetLabel( _(
"Value:" ) );
120 title = _(
"Footprint Field Properties" );
121 m_TextLabel->SetLabel( _(
"Text:" ) );
126 title = _(
"Footprint Text Properties" );
127 m_TextLabel->SetLabel( _(
"Text:" ) );
128 m_Visible->Show( false );
155 title =
_(
"Text Properties" );
157 SetInitialFocus( m_MultiLineText );
158 m_SingleLineSizer->Show(
false );
160 m_Visible->Show(
false );
161 m_KeepUpright->Show(
false );
162 m_statusLine->Show(
false );
167 m_LayerSelectionCtrl,
180 m_bold->SetIsCheckButton();
182 m_italic->SetIsCheckButton();
185 m_separator1->SetIsSeparator();
187 m_alignLeft->SetIsRadioButton();
189 m_alignCenter->SetIsRadioButton();
191 m_alignRight->SetIsRadioButton();
194 m_separator2->SetIsSeparator();
196 m_valignBottom->SetIsRadioButton();
198 m_valignCenter->SetIsRadioButton();
200 m_valignTop->SetIsRadioButton();
203 m_separator3->SetIsSeparator();
205 m_mirrored->SetIsCheckButton();
208 m_autoTextThickness->SetIsCheckButton();
216 if( !m_frame->GetBoard()->IsLayerEnabled( m_item->GetLayer() ) )
217 m_LayerSelectionCtrl->ShowNonActivatedLayers(
true );
219 m_LayerSelectionCtrl->SetLayersHotkeys(
false );
220 m_LayerSelectionCtrl->SetBoardFrame( m_frame );
221 m_LayerSelectionCtrl->Resync();
224 m_orientation.SetPrecision( 3 );
228 double rot_list[] = { 0.0, 90.0, -90.0, 180.0 };
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] ) );
236 SetupStandardButtons();
243 finishDialogSettings();
314 m_statusLine->SetLabel( wxString::Format(
_(
"Footprint %s (%s), %s, rotated %.1f deg"),
317 parentFP->
IsFlipped() ?
_(
"back side (mirrored)" )
336 if(
m_item->GetAutoThickness() )
359 switch (
m_item->GetHorizJustify() )
367 switch (
m_item->GetVertJustify() )
377 EDA_ANGLE orientation =
m_item->GetTextAngle();
380 return DIALOG_TEXT_PROPERTIES_BASE::TransferDataToWindow();
409 if( aEvent.IsChecked() )
422 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
432 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
468 if( aEvent.IsChecked() )
472 wxCommandEvent
dummy;
486 if( !DIALOG_TEXT_PROPERTIES_BASE::TransferDataFromWindow() )
529 txt.Replace( wxT(
"\r" ), wxT(
"\n" ) );
530#elif defined( __WINDOWS__ )
533 txt.Replace( wxT(
"\r" ), wxT(
"" ) );
554 m_item->SetAutoThickness(
true );
563 if(
m_item->GetTextThickness() > maxPenWidth )
565 DisplayError(
this,
_(
"The text thickness is too large for the text size.\n"
566 "It will be clamped." ) );
567 m_item->SetTextThickness( maxPenWidth );
600 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.
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