42 m_textBox( aTextBox ),
43 m_textWidth( aParent, m_SizeXLabel, m_SizeXCtrl, m_SizeXUnits ),
44 m_textHeight( aParent, m_SizeYLabel, m_SizeYCtrl, m_SizeYUnits ),
45 m_thickness( aParent, m_ThicknessLabel, m_ThicknessCtrl, m_ThicknessUnits ),
46 m_orientation( aParent, m_OrientLabel, m_OrientCtrl, nullptr ),
47 m_borderWidth( aParent, m_borderWidthLabel, m_borderWidthCtrl, m_borderWidthUnits )
60 [
this]( wxKeyEvent& aEvent )
62 wxPostEvent(
this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
65 [
this]( wxStyledTextEvent& aEvent )
69 [
this](
const wxString& xRef, wxArrayString* tokens )
125 double rot_list[] = { 0.0, 90.0, -90.0, 180.0 };
127 for(
size_t ii = 0; ii <
m_OrientCtrl->GetCount() && ii < 4; ++ii )
128 m_OrientCtrl->SetString( ii, wxString::Format(
"%.1f", rot_list[ii] ) );
130 for(
const auto& [ lineStyle, lineStyleDesc ] :
lineTypeNames )
208 if( style == LINE_STYLE::DEFAULT )
209 style = LINE_STYLE::SOLID;
218 return DIALOG_TEXTBOX_PROPERTIES_BASE::TransferDataToWindow();
245 if( aEvent.IsChecked() )
258 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
292 if( !DIALOG_TEXTBOX_PROPERTIES_BASE::TransferDataFromWindow() )
319 txt.Replace(
"\r",
"\n" );
320#elif defined( __WINDOWS__ )
323 txt.Replace(
"\r",
"" );
344 DisplayError(
this,
_(
"The text thickness is too large for the text size.\n"
345 "It will be clamped." ) );
382 commit.
Push(
_(
"Edit Text Box Properties" ) );
constexpr EDA_IU_SCALE pcbIUScale
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
virtual void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Revert the commit by restoring the modified items state.
Container for design settings for a BOARD object.
int GetLineThickness(PCB_LAYER_ID aLayer) const
Return the default graphic segment thickness from the layer class for the given layer.
virtual void SetLocked(bool aLocked)
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
FOOTPRINT * GetParentFootprint() const
virtual bool IsLocked() const
Information pertinent to a Pcbnew printed circuit board.
bool IsLayerEnabled(PCB_LAYER_ID aLayer) const
A proxy function that calls the correspondent function in m_BoardSettings tests whether a given layer...
wxString ConvertCrossReferencesToKIIDs(const wxString &aSource) const
Convert cross-references back and forth between ${refDes:field} and ${kiid:field}.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
wxString ConvertKIIDsToCrossReferences(const wxString &aSource) const
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Create an undo entry for an item that has been already modified.
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)
Class DIALOG_TEXTBOX_PROPERTIES_BASE.
BITMAP_BUTTON * m_separator3
wxStaticText * m_borderStyleLabel
BITMAP_BUTTON * m_mirrored
BITMAP_BUTTON * m_alignCenter
BITMAP_BUTTON * m_separator1
wxBitmapComboBox * m_borderStyleCombo
BITMAP_BUTTON * m_alignRight
wxCheckBox * m_borderCheckbox
BITMAP_BUTTON * m_alignLeft
wxComboBox * m_OrientCtrl
BITMAP_BUTTON * m_separator0
wxStyledTextCtrl * m_MultiLineText
PCB_LAYER_BOX_SELECTOR * m_LayerSelectionCtrl
BITMAP_BUTTON * m_separator2
~DIALOG_TEXTBOX_PROPERTIES()
void onAlignButton(wxCommandEvent &aEvent) override
void onThickness(wxCommandEvent &aEvent) override
UNIT_BINDER m_borderWidth
bool TransferDataToWindow() override
void onBoldToggle(wxCommandEvent &aEvent) override
DIALOG_TEXTBOX_PROPERTIES(PCB_BASE_EDIT_FRAME *aParent, PCB_TEXTBOX *aTextBox)
bool TransferDataFromWindow() override
void onMultiLineTCLostFocus(wxFocusEvent &event) override
void onFontSelected(wxCommandEvent &aEvent) override
void onBorderChecked(wxCommandEvent &event) override
SCINTILLA_TRICKS * m_scintillaTricks
UNIT_BINDER m_orientation
PCB_BASE_EDIT_FRAME * m_frame
EDA_ITEM_FLAGS GetEditFlags() const
void SetFlags(EDA_ITEM_FLAGS aMask)
const EDA_ANGLE & GetTextAngle() const
void SetTextSize(VECTOR2I aNewSize, bool aEnforceMinTextSize=true)
virtual const wxString & GetText() const
Return the string associated with the text object.
KIFONT::FONT * GetFont() const
void SetMirrored(bool isMirrored)
GR_TEXT_H_ALIGN_T GetHorizJustify() const
void SetBoldFlag(bool aBold)
Set only the italic flag, without changing the font.
virtual void ClearBoundingBoxCache()
void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
virtual void ClearRenderCache()
void SetItalicFlag(bool aItalic)
Set only the italic flag, without changing the font.
virtual void SetText(const wxString &aText)
int GetTextThickness() const
void SetFont(KIFONT::FONT *aFont)
VECTOR2I GetTextSize() const
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
KIFONT::FONT * GetFontSelection(bool aBold, bool aItalic, bool aForDrawingSheet=false) const
bool HaveFontSelection() const
void SetFontSelection(KIFONT::FONT *aFont)
virtual bool IsStroke() const
int GetLayerSelection() const
int SetLayerSelection(int layer)
bool SetLayersHotkeys(bool value)
Common, abstract interface for edit frames.
int ShowTextBoxPropertiesDialog(PCB_TEXTBOX *aTextBox)
void GetContextualTextVars(BOARD_ITEM *aSourceItem, const wxString &aCrossRef, wxArrayString *aTokens)
void SetBoardFrame(PCB_BASE_FRAME *aFrame)
void ShowNonActivatedLayers(bool aShow)
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
STROKE_PARAMS GetStroke() const override
void SetStroke(const STROKE_PARAMS &aStroke) override
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
bool IsBorderEnabled() const
Disables the border, this is done by changing the stroke internally.
void SetBorderEnabled(bool enabled)
void SetTextAngle(const EDA_ANGLE &aAngle) override
Add cut/copy/paste, dark theme, autocomplete and brace highlighting to a wxStyleTextCtrl instance.
void CancelAutocomplete()
void DoTextVarAutocomplete(const std::function< void(const wxString &xRef, wxArrayString *tokens)> &getTokensFn)
Simple container to manage line stroke parameters.
void SetLineStyle(LINE_STYLE aLineStyle)
void SetWidth(int aWidth)
LINE_STYLE GetLineStyle() const
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()
bool IsIndeterminate() const
Return true if the control holds the indeterminate value (for instance, if it represents a multiple s...
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 DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
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 Clamp_Text_PenSize(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)
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:...
const std::map< LINE_STYLE, struct LINE_STYLE_DESC > lineTypeNames
LINE_STYLE
Dashed line types.
constexpr int mmToIU(double mm) const
@ GR_TEXT_H_ALIGN_INDETERMINATE
VECTOR2< int32_t > VECTOR2I