28#include <wx/hyperlink.h>
60 if(
m_item->GetParentFootprint() )
62 m_posX.SetCoordType( ORIGIN_TRANSFORMS::REL_X_COORD );
63 m_posY.SetCoordType( ORIGIN_TRANSFORMS::REL_Y_COORD );
67 m_posX.SetCoordType( ORIGIN_TRANSFORMS::ABS_X_COORD );
68 m_posY.SetCoordType( ORIGIN_TRANSFORMS::ABS_Y_COORD );
83 [
this]( wxKeyEvent& aEvent )
85 wxPostEvent(
this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
88 [
this]( wxStyledTextEvent& aEvent )
92 [
this](
const wxString& xRef, wxArrayString* tokens )
104 m_syntaxHelp =
new wxHyperlinkCtrl(
this, wxID_ANY,
_(
"Syntax help" ), wxEmptyString, wxDefaultPosition,
105 wxDefaultSize, wxHL_DEFAULT_STYLE );
113 if(
m_item->GetParentFootprint() )
124 title =
_(
"Footprint Reference Properties" );
129 title =
_(
"Footprint Value Properties" );
134 title =
_(
"Footprint Field Properties" );
140 title =
_(
"Footprint Text Properties" );
157 title =
_(
"Text Properties" );
171 m_bold->SetIsCheckButton();
207 if( !
m_frame->GetBoard()->IsLayerEnabled(
m_item->GetLayer() ) )
219 double rot_list[] = { 0.0, 90.0, -90.0, 180.0 };
221 for(
size_t ii = 0; ii <
m_OrientCtrl->GetCount() && ii < 4; ++ii )
222 m_OrientCtrl->SetString( ii, wxString::Format( wxT(
"%.1f" ), rot_list[ii] ) );
308 parentFP->
IsFlipped() ?
_(
"back side (mirrored)" ) :
_(
"front side" ),
326 if(
m_item->GetAutoThickness() )
349 switch(
m_item->GetHorizJustify() )
357 switch(
m_item->GetVertJustify() )
367 EDA_ANGLE orientation =
m_item->GetTextAngle();
370 return DIALOG_TEXT_PROPERTIES_BASE::TransferDataToWindow();
399 if( aEvent.IsChecked() )
412 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
422 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
458 if( aEvent.IsChecked() )
462 wxCommandEvent
dummy;
476 if( !DIALOG_TEXT_PROPERTIES_BASE::TransferDataFromWindow() )
519 txt.Replace( wxT(
"\r" ), wxT(
"\n" ) );
520#elif defined( __WINDOWS__ )
523 txt.Replace( wxT(
"\r" ), wxT(
"" ) );
543 m_item->SetAutoThickness(
true );
552 if(
m_item->GetTextThickness() > maxPenWidth )
554 DisplayError(
this,
_(
"The text thickness is too large for the text size.\n"
555 "It will be clamped." ) );
556 m_item->SetTextThickness( maxPenWidth );
589 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.
void SetupStandardButtons(std::map< int, wxString > aLabels={})
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)
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
wxBoxSizer * m_SingleLineSizer
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
wxStaticText * m_TextLabel
BITMAP_BUTTON * m_alignLeft
BITMAP_BUTTON * m_alignCenter
BITMAP_BUTTON * m_separator1
wxStaticText * m_SizeYLabel
PCB_LAYER_BOX_SELECTOR * m_LayerSelectionCtrl
BITMAP_BUTTON * m_separator2
BITMAP_BUTTON * m_separator3
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...
void onSyntaxHelp(wxHyperlinkEvent &aEvent)
wxHyperlinkCtrl * m_syntaxHelp
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
HTML_MESSAGE_BOX * m_helpWindow
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)
static HTML_MESSAGE_BOX * ShowSyntaxHelp(wxWindow *aParentWindow)
Display a syntax help window for text variables and expressions.
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