36 std::vector<SCH_TABLECELL*> aCells ) :
39 m_scintillaTricks( nullptr ),
40 m_textSize( aFrame, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits ),
41 m_marginLeft( aFrame, nullptr, m_marginLeftCtrl, nullptr ),
42 m_marginTop( aFrame, nullptr, m_marginTopCtrl, m_marginTopUnits ),
43 m_marginRight( aFrame, nullptr, m_marginRightCtrl, nullptr ),
44 m_marginBottom( aFrame, nullptr, m_marginBottomCtrl, nullptr ),
45 m_cellText( m_cellTextCtrl ),
46 m_returnValue( TABLECELL_PROPS_CANCEL )
56 m_cellText->SetTechnology( wxSTC_TECHNOLOGY_DIRECTWRITE );
62 [
this]( wxKeyEvent& aEvent )
64 wxPostEvent(
this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
68 [
this]( wxStyledTextEvent& aEvent )
72 [
this](
const wxString& xRef, wxArrayString* tokens )
123 wxArrayString* aTokens )
127 if( !aCrossRef.IsEmpty() )
136 for(
int jj = 0; jj < (int) refs.
GetCount(); jj++ )
160 aTokens->push_back( entry.first );
168 if( !wxDialog::TransferDataToWindow() )
171 bool firstCell =
true;
177 wxString
text = cell->GetText();
187 m_bold->Set3StateValue( cell->IsBold() ? wxCHK_CHECKED : wxCHK_UNCHECKED );
188 m_italic->Set3StateValue( cell->IsItalic() ? wxCHK_CHECKED : wxCHK_UNCHECKED );
190 hAlign = cell->GetHorizJustify();
191 vAlign = cell->GetVertJustify();
199 if( cell->IsSolidFill() )
222 wxCheckBoxState bold = cell->IsBold() ? wxCHK_CHECKED : wxCHK_UNCHECKED;
224 if( bold !=
m_bold->Get3StateValue() )
225 m_bold->Set3StateValue( wxCHK_UNDETERMINED );
227 wxCheckBoxState italic = cell->IsItalic() ? wxCHK_CHECKED : wxCHK_UNCHECKED;
229 if( italic !=
m_italic->Get3StateValue() )
230 m_italic->Set3StateValue( wxCHK_UNDETERMINED );
232 if( cell->GetHorizJustify() != hAlign )
235 if( cell->GetVertJustify() != vAlign )
244 COLOR4D fillColor = cell->IsSolidFill() ? cell->GetFillColor() : COLOR4D::UNSPECIFIED;
253 fillColor = COLOR4D::UNSPECIFIED;
293 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
303 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
311 if( aEvent.GetSelection() == 1 )
321 if( aEvent.GetSelection() == 1 )
331 if( !wxDialog::TransferDataFromWindow() )
346 text.Replace(
"\r",
"\n" );
347#elif defined( __WINDOWS__ )
350 text.Replace(
"\r",
"" );
353 cell->SetText(
text );
355 if(
m_bold->Get3StateValue() == wxCHK_CHECKED )
356 cell->SetBold(
true );
357 else if(
m_bold->Get3StateValue() == wxCHK_UNCHECKED )
358 cell->SetBold(
false );
360 if(
m_italic->Get3StateValue() == wxCHK_CHECKED )
361 cell->SetItalic(
true );
362 else if(
m_italic->Get3StateValue() == wxCHK_UNCHECKED )
363 cell->SetItalic(
false );
392 if( fillColor == COLOR4D::UNSPECIFIED )
394 cell->SetFillMode( FILL_T::NO_FILL );
398 cell->SetFillMode( FILL_T::FILLED_WITH_COLOR );
399 cell->SetFillColor( fillColor );
416 if( !commit.
Empty() )
417 commit.
Push(
_(
"Edit Table Cell Properties" ) );
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
bool GetOverrideSchItemColors() const
COLOR4D GetColor(int aLayer) const
void SetSwatchColor(const KIGFX::COLOR4D &aColor, bool aSendEvent)
Set the current swatch color directly.
void GetNewSwatchColor()
Prompt for a new colour, using the colour picker dialog.
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)
Modify a given item in the model.
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_TABLECELL_PROPERTIES_BASE.
BITMAP_BUTTON * m_vAlignTop
wxChoice * m_fillColorPopup
COLOR_SWATCH * m_fillColorSwatch
BITMAP_BUTTON * m_vAlignCenter
BITMAP_BUTTON * m_hAlignRight
BITMAP_BUTTON * m_hAlignCenter
BITMAP_BUTTON * m_vAlignBottom
wxStyledTextCtrl * m_cellTextCtrl
COLOR_SWATCH * m_textColorSwatch
wxSimplebook * m_textColorBook
wxChoice * m_textColorPopup
BITMAP_BUTTON * m_hAlignLeft
wxSimplebook * m_fillColorBook
bool TransferDataFromWindow() override
std::vector< SCH_TABLECELL * > m_cells
@ TABLECELL_PROPS_EDIT_TABLE
void onTextColorPopup(wxCommandEvent &aEvent) override
void onMultiLineTCLostFocus(wxFocusEvent &event) override
void onFillColorPopup(wxCommandEvent &aEvent) override
void onHAlignButton(wxCommandEvent &aEvent)
void onEditTable(wxCommandEvent &aEvent) override
enum TABLECELL_PROPS_RETVALUE m_returnValue
wxStyledTextCtrl * m_cellText
SCINTILLA_TRICKS * m_scintillaTricks
DIALOG_TABLECELL_PROPERTIES(SCH_EDIT_FRAME *aParentFrame, std::vector< SCH_TABLECELL * > aCells)
UNIT_BINDER m_marginBottom
bool TransferDataToWindow() override
~DIALOG_TABLECELL_PROPERTIES()
void getContextualTextVars(const wxString &aCrossRef, wxArrayString *aTokens)
UNIT_BINDER m_marginRight
void onVAlignButton(wxCommandEvent &aEvent)
EDA_ITEM_FLAGS GetEditFlags() const
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_LIST Hierarchy() const
Return the full schematic flattened hierarchical sheet list.
SCH_SHEET_PATH & CurrentSheet() 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
Execute the changes.
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
Search the item hierarchy to find a SCHEMATIC.
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 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.
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
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)
virtual long long int GetValue()
Return the current value in Internal Units.
bool IsIndeterminate() const
Return true if the control holds the indeterminate value (for instance, if it represents a multiple s...
virtual void SetValue(long long int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
void ShowMessage(const wxString &aMessage, int aFlags=wxICON_INFORMATION) override
Show the info bar with the provided message and icon.
@ LAYER_SCHEMATIC_BACKGROUND
GR_TEXT_H_ALIGN_T
This is API surface mapped to common.types.HorizontalAlignment.
@ GR_TEXT_H_ALIGN_INDETERMINATE
GR_TEXT_V_ALIGN_T
This is API surface mapped to common.types.VertialAlignment.
@ GR_TEXT_V_ALIGN_INDETERMINATE
#define INDETERMINATE_STATE
Used for holding indeterminate values, such as with multiple selections holding different values or c...
VECTOR2< int32_t > VECTOR2I