46 m_currentItem( aTextItem ),
47 m_currentText( dynamic_cast<
EDA_TEXT*>( aTextItem ) ),
48 m_textSize( aParent, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits ),
49 m_borderWidth( aParent, m_borderWidthLabel, m_borderWidthCtrl, m_borderWidthUnits ),
50 m_scintillaTricks( nullptr ),
51 m_helpWindow( nullptr )
60 SetTitle(
_(
"Text Box Properties" ) );
65 for(
const auto& [ lineStyle, lineStyleDesc ] :
lineTypeNames )
101 m_textCtrl->SetTechnology( wxSTC_TECHNOLOGY_DIRECTWRITE );
106 [
this]( wxKeyEvent& aEvent )
108 wxPostEvent(
this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
112 [
this]( wxStyledTextEvent& aEvent )
116 [
this](
const wxString& xRef, wxArrayString* tokens )
167 const SCHEMATIC& schematic = schematicEditor->Schematic();
171 wxString sheetPageNum = sheet.GetPageNumber();
172 wxString sheetName = sheet.size() == 1 ?
_(
"<root sheet>" )
173 : sheet.Last()->GetName();
176 wxString::Format(
_(
"Page %s (%s)" ),
222 wxArrayString* aTokens )
226 if( !aCrossRef.IsEmpty() )
235 for(
int jj = 0; jj < (int) refs.
GetCount(); jj++ )
259 aTokens->push_back( entry.first );
267 if( !wxDialog::TransferDataToWindow() )
277 text = schematic->ConvertKIIDsToRefs(
text );
331 wxFAIL_MSG(
"Line type not found in the type lookup map" );
410 if( aEvent.GetSelection() >= 0 )
422 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
432 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
442 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
450 if( !wxDialog::TransferDataFromWindow() )
473 text.Replace(
"\r",
"\n" );
474#elif defined( __WINDOWS__ )
477 text.Replace(
"\r",
"" );
485 else if( !
text.IsEmpty() )
515 DisplayError(
this,
_(
"Invalid hyperlink destination. Please enter either a valid URL "
516 "(e.g. file:// or http(s)://) or \"#<page number>\" to create "
517 "a hyperlink to a page in this schematic." ) );
587 if( !commit.
Empty() )
588 commit.
Push(
_(
"Edit Text Properties" ) );
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
Color settings are a bit different than most of the settings objects in that there can be more than o...
bool GetOverrideSchItemColors() const
COLOR4D GetColor(int aLayer) const
void SetSwatchColor(const KIGFX::COLOR4D &aColor, bool aSendEvent)
Set the current swatch color directly.
KIGFX::COLOR4D GetSwatchColor() const
void SetDefaultColor(const KIGFX::COLOR4D &aColor)
Sets the color that will be chosen with the "Reset to Default" button in the chooser.
void SetSwatchBackground(const KIGFX::COLOR4D &aBackground)
Set the swatch background color.
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Create an undo entry for an item that has been already modified.
bool Empty() const
Returns status of an item.
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...
Class DIALOG_TEXT_PROPERTIES_BASE.
wxBitmapComboBox * m_borderStyleCombo
wxCheckBox * m_borderCheckbox
COLOR_SWATCH * m_borderColorSwatch
wxCheckBox * m_privateCheckbox
wxStyledTextCtrl * m_textCtrl
BITMAP_BUTTON * m_separator5
BITMAP_BUTTON * m_hAlignCenter
BITMAP_BUTTON * m_vAlignTop
BITMAP_BUTTON * m_vAlignBottom
WX_COMBOBOX * m_hyperlinkCombo
wxFlexGridSizer * m_fgSymbolEditor
BITMAP_BUTTON * m_hAlignLeft
BITMAP_BUTTON * m_vAlignCenter
wxCheckBox * m_filledCtrl
COLOR_SWATCH * m_textColorSwatch
wxPanel * m_panelFillColor
wxCheckBox * m_hyperlinkCb
wxPanel * m_panelBorderColor
wxStaticText * m_borderStyleLabel
wxStaticText * m_fillColorLabel
BITMAP_BUTTON * m_separator1
wxGridBagSizer * m_textEntrySizer
wxCheckBox * m_excludeFromSim
BITMAP_BUTTON * m_separator4
BITMAP_BUTTON * m_vertical
BITMAP_BUTTON * m_hAlignRight
wxCheckBox * m_commonToAllBodyStyles
wxHyperlinkCtrl * m_syntaxHelp
BITMAP_BUTTON * m_separator2
BITMAP_BUTTON * m_separator3
wxStaticText * m_borderColorLabel
COLOR_SWATCH * m_fillColorSwatch
wxCheckBox * m_commonToAllUnits
BITMAP_BUTTON * m_horizontal
void onHyperlinkText(wxCommandEvent &aEvent) override
std::vector< wxString > m_pageNumbers
UNIT_BINDER m_borderWidth
bool TransferDataToWindow() override
~DIALOG_TEXT_PROPERTIES() override
HTML_MESSAGE_BOX * m_helpWindow
void onFillChecked(wxCommandEvent &aEvent) override
void onMultiLineTCLostFocus(wxFocusEvent &event) override
void onBorderChecked(wxCommandEvent &aEvent) override
SCINTILLA_TRICKS * m_scintillaTricks
void OnFormattingHelp(wxHyperlinkEvent &aEvent) override
void onVAlignButton(wxCommandEvent &aEvent)
void onHAlignButton(wxCommandEvent &aEvent)
DIALOG_TEXT_PROPERTIES(SCH_BASE_FRAME *parent, SCH_ITEM *aTextItem)
void onHyperlinkCombo(wxCommandEvent &aEvent) override
void getContextualTextVars(const wxString &aCrossRef, wxArrayString *aTokens)
bool TransferDataFromWindow() override
void onTextAngleButton(wxCommandEvent &aEvent)
void onHyperlinkChecked(wxCommandEvent &aEvent) override
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
EDA_ITEM_FLAGS GetEditFlags() const
KICAD_T Type() const
Returns the type of object.
void SetFillColor(const COLOR4D &aColor)
COLOR4D GetFillColor() const
virtual int GetWidth() const
void SetFillMode(FILL_T aFill)
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
void SetTextColor(const COLOR4D &aColor)
COLOR4D GetTextColor() const
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
virtual bool HasHyperlink() const
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
wxString GetHyperlink() const
GR_TEXT_H_ALIGN_T GetHorizJustify() const
void SetBold(bool aBold)
Set the text to be bold - this will also update the font if needed.
static bool ValidateHyperlink(const wxString &aURL)
Check if aURL is a valid hyperlink.
void SetHyperlink(wxString aLink)
GR_TEXT_V_ALIGN_T GetVertJustify() const
virtual void SetText(const wxString &aText)
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
void SetItalic(bool aItalic)
Set the text to be italic - this will also update the font if needed.
void SetFont(KIFONT::FONT *aFont)
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
void SetFontSelection(KIFONT::FONT *aFont, bool aSilentMode=false)
Set the selection in wxChoice widget.
KIFONT::FONT * GetFontSelection(bool aBold, bool aItalic, bool aForDrawingSheet=false) const
bool HaveFontSelection() const
A color representation with 4 components: red, green, blue, alpha.
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
virtual std::map< wxString, wxString > & GetTextVars() const
Holds all the data relating to one schematic.
SCH_SHEET_PATH & CurrentSheet() const override
SCH_SHEET_LIST Hierarchy() const override
Return the full schematic flattened hierarchical sheet list.
A shim class between EDA_DRAW_FRAME and several derived classes: SYMBOL_EDIT_FRAME,...
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
EESCHEMA_SETTINGS * eeconfig() const
COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Returns a pointer to the active color theme settings.
virtual void Push(const wxString &aMessage=wxT("A commit"), int aCommitFlags=0) override
Revert the commit by restoring the modified items state.
Schematic editor (Eeschema) main window.
Base class for any item which can be embedded within the SCHEMATIC container class,...
virtual bool GetExcludedFromSim() const
virtual void SetBodyStyle(int aBodyStyle)
const SYMBOL * GetParentSymbol() const
void SetPrivate(bool aPrivate)
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
virtual void SetExcludedFromSim(bool aExclude)
virtual void SetUnit(int aUnit)
Container to create a flattened list of symbols because in a complex hierarchy, a symbol can be used ...
A helper to define a symbol's reference designator in a schematic.
const SCH_SHEET_PATH & GetSheetPath() const
SCH_SYMBOL * GetSymbol() const
void SetStroke(const STROKE_PARAMS &aStroke) override
STROKE_PARAMS GetStroke() const override
void GetSymbols(SCH_REFERENCE_LIST &aReferences, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanSymbols=false) const
Add a SCH_REFERENCE object to aReferences for each symbol in the list of sheets.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
void GetContextualTextVars(wxArrayString *aVars) const
Return the list of system text vars & fields for this sheet.
void GetContextualTextVars(wxArrayString *aVars) const
Return the list of system text vars & fields for this symbol.
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const override
static HTML_MESSAGE_BOX * ShowSyntaxHelp(wxWindow *aParentWindow)
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)
void SetColor(const KIGFX::COLOR4D &aColor)
LINE_STYLE GetLineStyle() const
KIGFX::COLOR4D GetColor() const
The symbol library editor main window.
A base class for LIB_SYMBOL and SCH_SYMBOL.
virtual bool IsMulti() const =0
virtual bool HasAlternateBodyStyle() const =0
Test if symbol has more than one body conversion type (DeMorgan).
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 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 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 Append(const wxString &aText, const wxString &aMenuText=wxEmptyString)
void ShowMessage(const wxString &aMessage, int aFlags=wxICON_INFORMATION) override
Show the info bar with the provided message and icon.
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.
static constexpr EDA_ANGLE ANGLE_VERTICAL
static constexpr EDA_ANGLE ANGLE_HORIZONTAL
@ LAYER_SCHEMATIC_BACKGROUND
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
const std::map< LINE_STYLE, struct LINE_STYLE_DESC > lineTypeNames
int default_line_thickness
@ GR_TEXT_H_ALIGN_INDETERMINATE
@ GR_TEXT_V_ALIGN_INDETERMINATE
VECTOR2< int32_t > VECTOR2I