44 m_grid =
new WX_GRID(
this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
47 m_grid->EnableEditing(
true );
48 m_grid->EnableGridLines(
true );
49 m_grid->EnableDragGridSize(
false );
50 m_grid->SetMargins( 0, 0 );
51 m_grid->SetCellHighlightROPenWidth( 0 );
53 m_grid->EnableDragColMove(
false );
54 m_grid->EnableDragColSize(
false );
55 m_grid->SetColLabelSize( 0 );
56 m_grid->EnableDragRowMove(
false );
57 m_grid->EnableDragRowSize(
false );
58 m_grid->SetRowLabelSize( 0 );
59 m_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
64 for(
int row = 0; row <
m_table->GetRowCount(); ++row )
66 for(
int col = 0; col <
m_table->GetColCount(); ++col )
69 wxGridCellAttr* attr =
new wxGridCellAttr;
78 attr->SetRenderer(
new wxGridCellAutoWrapStringRenderer );
85 [
this](
const wxString& xRef, wxArrayString* tokens )
92 m_grid->SetAttr( row, col, attr );
106 if(
m_frame->GetColorSettings()->GetOverrideSchItemColors() )
107 m_infoBar->ShowMessage(
_(
"Note: individual item colors overridden in Preferences." ) );
120 m_grid->PopEventHandler(
true );
126 if( !wxDialog::TransferDataToWindow() )
133 wxColour coveredColor = wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE );
136 coveredColor = coveredColor.ChangeLightness( 140 );
138 coveredColor = coveredColor.ChangeLightness( 100 );
140 for(
int row = 0; row <
m_table->GetRowCount(); ++row )
142 for(
int col = 0; col <
m_table->GetColCount(); ++col )
148 m_grid->SetCellValue( row, col, coveredColor.GetAsString() );
156 text = schematic->ConvertKIIDsToRefs(
text );
164 for(
int row = 0; row <
m_table->GetRowCount(); ++row )
166 for(
int col = 0; col <
m_table->GetColCount(); ++col )
172 m_grid->SetGridCursor( row, col );
173 m_grid->EnableCellEditControl();
174 m_grid->ShowCellEditControl();
190 if(
m_table->GetBorderStroke().GetWidth() >= 0 )
195 int style =
static_cast<int>(
m_table->GetBorderStroke().GetLineStyle() );
208 bool rows =
m_table->StrokeRows() &&
m_table->GetSeparatorsStroke().GetWidth() >= 0;
209 bool cols =
m_table->StrokeColumns() &&
m_table->GetSeparatorsStroke().GetWidth() >= 0;
214 if(
m_table->GetSeparatorsStroke().GetWidth() >= 0 )
219 style =
static_cast<int>(
m_table->GetSeparatorsStroke().GetLineStyle() );
238 if( !aCrossRef.IsEmpty() )
245 for(
int jj = 0; jj < (int) refs.
GetCount(); jj++ )
269 for( std::pair<wxString, wxString> entry :
Prj().GetTextVars() )
270 aTokens->push_back( entry.first );
281 if( ( border || headerSeparator ) &&
m_borderWidth.GetValue() < 0 )
306 if( !
m_grid->CommitPendingChanges() )
309 if( !wxDialog::TransferDataFromWindow() )
315 if(
m_table->GetEditFlags() == 0 )
318 for(
int row = 0; row <
m_table->GetRowCount(); ++row )
320 for(
int col = 0; col <
m_table->GetColCount(); ++col )
323 wxString txt =
m_grid->GetCellValue( row, col );
331 txt = schematic->ConvertRefsToKIIDs( txt );
336 txt.Replace(
"\r",
"\n" );
337#elif defined( __WINDOWS__ )
340 txt.Replace(
"\r",
"" );
367 m_table->SetBorderStroke( stroke );
390 m_table->SetSeparatorsStroke( stroke );
393 if( !commit.
Empty() )
394 commit.
Push(
_(
"Edit Table" ) );
404 wxSize availableGridSize =
m_grid->GetClientSize();
406 if( availableGridSize.x == 0 || availableGridSize.y == 0 )
410 double scalerX =
static_cast<double>( availableGridSize.x ) / tableBBox.
GetWidth();
411 double scalerY =
static_cast<double>( availableGridSize.y ) / tableBBox.
GetHeight();
413 for(
int row = 0; row <
m_table->GetRowCount(); ++row )
414 m_grid->SetRowSize( row, std::floor(
m_table->GetRowHeight( row ) * scalerY ) );
416 for(
int col = 0; col <
m_table->GetColCount(); ++col )
417 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.
Commit for the schematic and symbol editors.
void Push(const wxString &aMessage=wxEmptyString, 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
@ SYMBOL_FILTER_NON_POWER
const std::map< LINE_STYLE, struct LINE_STYLE_DESC > lineTypeNames
Conversion map between LINE_STYLE values and style names displayed.