47 m_grid =
new WX_GRID(
this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
50 m_grid->EnableEditing(
true );
51 m_grid->EnableGridLines(
true );
52 m_grid->EnableDragGridSize(
false );
53 m_grid->SetMargins( 0, 0 );
54 m_grid->SetCellHighlightROPenWidth( 0 );
56 m_grid->EnableDragColMove(
false );
57 m_grid->EnableDragColSize(
false );
58 m_grid->SetColLabelSize( 0 );
59 m_grid->EnableDragRowMove(
false );
60 m_grid->EnableDragRowSize(
false );
61 m_grid->SetRowLabelSize( 0 );
62 m_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
67 for(
int row = 0; row <
m_table->GetRowCount(); ++row )
69 for(
int col = 0; col <
m_table->GetColCount(); ++col )
72 wxGridCellAttr* attr =
new wxGridCellAttr;
87 [
this](
const wxString& xRef, wxArrayString* tokens )
94 m_grid->SetAttr( row, col, attr );
108 if(
m_frame->GetColorSettings()->GetOverrideSchItemColors() )
109 m_infoBar->ShowMessage(
_(
"Note: individual item colors overridden in Preferences." ) );
122 m_grid->PopEventHandler(
true );
128 if( !wxDialog::TransferDataToWindow() )
135 wxColour coveredColor = wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE );
138 coveredColor = coveredColor.ChangeLightness( 140 );
140 coveredColor = coveredColor.ChangeLightness( 100 );
142 for(
int row = 0; row <
m_table->GetRowCount(); ++row )
144 for(
int col = 0; col <
m_table->GetColCount(); ++col )
150 m_grid->SetCellValue( row, col, coveredColor.GetAsString() );
158 text = schematic->ConvertKIIDsToRefs(
text );
166 for(
int row = 0; row <
m_table->GetRowCount(); ++row )
168 for(
int col = 0; col <
m_table->GetColCount(); ++col )
174 m_grid->SetGridCursor( row, col );
175 m_grid->EnableCellEditControl();
176 m_grid->ShowCellEditControl();
192 if(
m_table->GetBorderStroke().GetWidth() >= 0 )
197 int style =
static_cast<int>(
m_table->GetBorderStroke().GetLineStyle() );
210 bool rows =
m_table->StrokeRows() &&
m_table->GetSeparatorsStroke().GetWidth() >= 0;
211 bool cols =
m_table->StrokeColumns() &&
m_table->GetSeparatorsStroke().GetWidth() >= 0;
216 if(
m_table->GetSeparatorsStroke().GetWidth() >= 0 )
221 style =
static_cast<int>(
m_table->GetSeparatorsStroke().GetLineStyle() );
239 wxArrayString* aTokens )
241 if( !aCrossRef.IsEmpty() )
246 m_frame->Schematic().Hierarchy().GetSymbols( refs );
248 for(
int jj = 0; jj < (int) refs.
GetCount(); jj++ )
272 for( std::pair<wxString, wxString> entry :
Prj().GetTextVars() )
273 aTokens->push_back( entry.first );
284 if( ( border || headerSeparator ) &&
m_borderWidth.GetValue() < 0 )
309 if( !
m_grid->CommitPendingChanges() )
312 if( !wxDialog::TransferDataFromWindow() )
318 if(
m_table->GetEditFlags() == 0 )
321 for(
int row = 0; row <
m_table->GetRowCount(); ++row )
323 for(
int col = 0; col <
m_table->GetColCount(); ++col )
326 wxString txt =
m_grid->GetCellValue( row, col );
330 txt = schematic->ConvertRefsToKIIDs( txt );
335 txt.Replace(
"\r",
"\n" );
336#elif defined( __WINDOWS__ )
339 txt.Replace(
"\r",
"" );
366 m_table->SetBorderStroke( stroke );
389 m_table->SetSeparatorsStroke( stroke );
392 if( !commit.
Empty() )
393 commit.
Push(
_(
"Edit Table" ) );
403 wxSize availableGridSize =
m_grid->GetClientSize();
405 if( availableGridSize.x == 0 || availableGridSize.y == 0 )
409 double scalerX =
static_cast<double>( availableGridSize.x ) / tableBBox.
GetWidth();
410 double scalerY =
static_cast<double>( availableGridSize.y ) / tableBBox.
GetHeight();
412 for(
int row = 0; row <
m_table->GetRowCount(); ++row )
413 m_grid->SetRowSize( row, std::floor(
m_table->GetRowHeight( row ) * scalerY ) );
415 for(
int col = 0; col <
m_table->GetColCount(); ++col )
416 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.