46 m_grid =
new WX_GRID(
this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
49 m_grid->EnableEditing(
true );
50 m_grid->EnableGridLines(
true );
51 m_grid->EnableDragGridSize(
false );
52 m_grid->SetMargins( 0, 0 );
53 m_grid->SetCellHighlightROPenWidth( 0 );
55 m_grid->EnableDragColMove(
false );
56 m_grid->EnableDragColSize(
false );
57 m_grid->SetColLabelSize( 0 );
58 m_grid->EnableDragRowMove(
false );
59 m_grid->EnableDragRowSize(
false );
60 m_grid->SetRowLabelSize( 0 );
61 m_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
66 for(
int row = 0; row <
m_table->GetRowCount(); ++row )
68 for(
int col = 0; col <
m_table->GetColCount(); ++col )
71 wxGridCellAttr* attr =
new wxGridCellAttr;
86 [
this](
const wxString& xRef, wxArrayString* tokens )
93 m_grid->SetAttr( row, col, attr );
107 if(
m_frame->GetColorSettings()->GetOverrideSchItemColors() )
108 m_infoBar->ShowMessage(
_(
"Note: individual item colors overridden in Preferences." ) );
121 m_grid->PopEventHandler(
true );
127 if( !wxDialog::TransferDataToWindow() )
134 wxColour coveredColor = wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE );
137 coveredColor = coveredColor.ChangeLightness( 140 );
139 coveredColor = coveredColor.ChangeLightness( 100 );
141 for(
int row = 0; row <
m_table->GetRowCount(); ++row )
143 for(
int col = 0; col <
m_table->GetColCount(); ++col )
149 m_grid->SetCellValue( row, col, coveredColor.GetAsString() );
157 text = schematic->ConvertKIIDsToRefs(
text );
165 for(
int row = 0; row <
m_table->GetRowCount(); ++row )
167 for(
int col = 0; col <
m_table->GetColCount(); ++col )
173 m_grid->SetGridCursor( row, col );
174 m_grid->EnableCellEditControl();
175 m_grid->ShowCellEditControl();
191 if(
m_table->GetBorderStroke().GetWidth() >= 0 )
196 int style =
static_cast<int>(
m_table->GetBorderStroke().GetLineStyle() );
209 bool rows =
m_table->StrokeRows() &&
m_table->GetSeparatorsStroke().GetWidth() >= 0;
210 bool cols =
m_table->StrokeColumns() &&
m_table->GetSeparatorsStroke().GetWidth() >= 0;
215 if(
m_table->GetSeparatorsStroke().GetWidth() >= 0 )
220 style =
static_cast<int>(
m_table->GetSeparatorsStroke().GetLineStyle() );
238 wxArrayString* aTokens )
240 if( !aCrossRef.IsEmpty() )
245 m_frame->Schematic().Hierarchy().GetSymbols( refs );
247 for(
int jj = 0; jj < (int) refs.
GetCount(); jj++ )
271 for( std::pair<wxString, wxString> entry :
Prj().GetTextVars() )
272 aTokens->push_back( entry.first );
283 if( ( border || headerSeparator ) &&
m_borderWidth.GetValue() < 0 )
308 if( !
m_grid->CommitPendingChanges() )
311 if( !wxDialog::TransferDataFromWindow() )
317 if(
m_table->GetEditFlags() == 0 )
320 for(
int row = 0; row <
m_table->GetRowCount(); ++row )
322 for(
int col = 0; col <
m_table->GetColCount(); ++col )
325 wxString txt =
m_grid->GetCellValue( row, col );
329 txt = schematic->ConvertRefsToKIIDs( txt );
334 txt.Replace(
"\r",
"\n" );
335#elif defined( __WINDOWS__ )
338 txt.Replace(
"\r",
"" );
365 m_table->SetBorderStroke( stroke );
388 m_table->SetSeparatorsStroke( stroke );
391 if( !commit.
Empty() )
392 commit.
Push(
_(
"Edit Table" ) );
402 wxSize availableGridSize =
m_grid->GetClientSize();
404 if( availableGridSize.x == 0 || availableGridSize.y == 0 )
408 double scalerX =
static_cast<double>( availableGridSize.x ) / tableBBox.
GetWidth();
409 double scalerY =
static_cast<double>( availableGridSize.y ) / tableBBox.
GetHeight();
411 for(
int row = 0; row <
m_table->GetRowCount(); ++row )
412 m_grid->SetRowSize( row, std::floor(
m_table->GetRowHeight( row ) * scalerY ) );
414 for(
int col = 0; col <
m_table->GetColCount(); ++col )
415 m_grid->SetColSize( col, std::floor(
m_table->GetColWidth( col ) * scalerX ) );
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
constexpr size_type GetWidth() const
constexpr size_type GetHeight() const
COLOR4D GetColor(int aLayer) const
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
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...
wxCheckBox * m_headerBorder
wxStaticText * m_separatorsStyleLabel
wxStaticText * m_separatorsWidthLabel
wxStaticText * m_borderStyleLabel
wxBitmapComboBox * m_borderStyleCombo
wxStaticText * m_separatorsColorLabel
wxCheckBox * m_borderCheckbox
wxStaticText * m_borderWidthLabel
COLOR_SWATCH * m_borderColorSwatch
DIALOG_TABLE_PROPERTIES_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Table Properties"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
wxTextCtrl * m_borderWidthCtrl
wxCheckBox * m_rowSeparators
wxBitmapComboBox * m_separatorsStyleCombo
wxCheckBox * m_colSeparators
wxStaticText * m_borderWidthUnits
wxStaticText * m_borderColorLabel
wxStaticText * m_separatorsWidthUnits
COLOR_SWATCH * m_separatorsColorSwatch
wxTextCtrl * m_separatorsWidthCtrl
bool TransferDataFromWindow() override
UNIT_BINDER m_borderWidth
DIALOG_TABLE_PROPERTIES(SCH_EDIT_FRAME *aParentFrame, SCH_TABLE *aTable)
~DIALOG_TABLE_PROPERTIES()
void getContextualTextVars(const wxString &aCrossRef, wxArrayString *aTokens)
UNIT_BINDER m_separatorsWidth
void onBorderChecked(wxCommandEvent &aEvent) override
bool TransferDataToWindow() override
void onSize(wxSizeEvent &aEvent) override
virtual const wxString & GetText() const
Return the string associated with the text object.
virtual void SetText(const wxString &aText)
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.
A color representation with 4 components: red, green, blue, alpha.
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
Holds all the data relating to one schematic.
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.
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
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 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)
@ LAYER_SCHEMATIC_BACKGROUND
const std::map< LINE_STYLE, struct LINE_STYLE_DESC > lineTypeNames
Conversion map between LINE_STYLE values and style names displayed.