45 m_currentItem( aTextItem ),
46 m_currentText( dynamic_cast<
EDA_TEXT*>( aTextItem ) ),
47 m_textSize( aParent, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits ),
48 m_borderWidth( aParent, m_borderWidthLabel, m_borderWidthCtrl, m_borderWidthUnits ),
49 m_scintillaTricks( nullptr ),
50 m_helpWindow( nullptr )
57 SetTitle(
_(
"Text Box Properties" ) );
62 for(
const auto& [ lineStyle, lineStyleDesc ] :
lineTypeNames )
92 m_textCtrl->SetTechnology(wxSTC_TECHNOLOGY_DIRECTWRITE);
97 [
this]( wxKeyEvent& aEvent )
99 wxPostEvent(
this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
102 [
this]( wxStyledTextEvent& aEvent )
105 [
this](
const wxString& crossRef, wxArrayString* tokens )
156 wxString sheetPageNum = sheet.GetPageNumber();
157 wxString sheetName = sheet.size() == 1 ?
_(
"<root sheet>" ) : sheet.Last()->GetName();
160 wxString::Format(
_(
"Page %s (%s)" ), sheetPageNum, sheetName ) );
196 wxArrayString* aTokens )
198 if( !aCrossRef.IsEmpty() )
206 for(
int jj = 0; jj < (int) refs.
GetCount(); jj++ )
231 aTokens->push_back( entry.first );
239 if( !wxDialog::TransferDataToWindow() )
297 wxFAIL_MSG(
"Line type not found in the type lookup map" );
365 if( aEvent.GetSelection() >= 0 )
377 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
387 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
397 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
405 if( !wxDialog::TransferDataFromWindow() )
426 text.Replace(
"\r",
"\n" );
427#elif defined( __WINDOWS__ )
430 text.Replace(
"\r",
"" );
438 else if( !
text.IsEmpty() )
453 DisplayError(
this,
_(
"Invalid hyperlink destination. Please enter either a valid URL "
454 "(e.g. file:// or http(s)://) or \"#<page number>\" to create "
455 "a hyperlink to a page in this schematic." ) );
536 if( !commit.
Empty() )
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
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
wxStyledTextCtrl * m_textCtrl
BITMAP_BUTTON * m_separator5
BITMAP_BUTTON * m_hAlignCenter
BITMAP_BUTTON * m_vAlignTop
BITMAP_BUTTON * m_vAlignBottom
WX_COMBOBOX * m_hyperlinkCombo
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
BITMAP_BUTTON * m_separator2
BITMAP_BUTTON * m_separator3
wxStaticText * m_borderColorLabel
COLOR_SWATCH * m_fillColorSwatch
BITMAP_BUTTON * m_horizontal
~DIALOG_TEXT_PROPERTIES()
void onHyperlinkText(wxCommandEvent &aEvent) override
std::vector< wxString > m_pageNumbers
UNIT_BINDER m_borderWidth
bool TransferDataToWindow() override
DIALOG_TEXT_PROPERTIES(SCH_EDIT_FRAME *parent, SCH_ITEM *aTextItem)
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)
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
void SetTextSize(VECTOR2I aNewSize)
const EDA_ANGLE & GetTextAngle() const
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 SetTextThickness(int aWidth)
The TextThickness is that set by the user.
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)
void SetFont(KIFONT::FONT *aFont)
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
bool HaveFontSelection() const
void SetFontSelection(KIFONT::FONT *aFont)
KIFONT::FONT * GetFontSelection(bool aBold, bool aItalic) 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
wxString ConvertKIIDsToRefs(const wxString &aSource) const
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
wxString ConvertRefsToKIIDs(const wxString &aSource) const
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.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
SCHEMATIC & Schematic() const
Base class for any item which can be embedded within the SCHEMATIC container class,...
virtual bool GetExcludedFromSim() const
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
virtual void SetExcludedFromSim(bool aExclude)
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
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
void SortByPageNumbers(bool aUpdateVirtualPageNums=true)
Sort the list of sheets by page number.
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.
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const
Return the reference for the given sheet path.
void GetContextualTextVars(wxArrayString *aVars) const
Return the list of system text vars & fields for this symbol.
static HTML_MESSAGE_BOX * ShowSyntaxHelp(wxWindow *aParentWindow)
Add cut/copy/paste, dark theme, autocomplete and brace highlighting to a wxStyleTextCtrl instance.
void DoTextVarAutocomplete(std::function< void(const wxString &crossRef, wxArrayString *tokens)> aTokenProvider)
void CancelAutocomplete()
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
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_HORIZONTAL
static constexpr EDA_ANGLE & ANGLE_VERTICAL
int GetPenSizeForBold(int aTextSize)
@ LAYER_SCHEMATIC_BACKGROUND
#define SKIP_CONNECTIVITY
const std::map< LINE_STYLE, struct LINE_STYLE_DESC > lineTypeNames
int default_line_thickness