46#include <wx/settings.h>
60#define DEFAULT_FONT_NAME _( "Default Font" )
77 pins.push_back(
pin->GetNumber() +
' ' +
pin->GetShownName() );
86 if( !fpFilters.IsEmpty() )
106 pins.push_back(
pin->GetNumber() +
' ' +
pin->GetShownName() );
108 if( !pins.IsEmpty() )
115 if( !fpFilters.IsEmpty() )
131 m_symbolNetlist(
netList( aSymbol ) ),
149 m_part( aSymbol->GetLibSymbolRef().get() ),
150 m_symbolNetlist(
netList( aSymbol, aFrame->GetCurrentSheet() ) ),
185 m_mandatoryFieldCount( aLabel->GetMandatoryFieldCount() ),
188 m_referenceValidator( 0 ),
189 m_valueValidator( 0 ),
192 m_filepathValidator( 0 )
255 wxString wildCard(
_(
"Schematic Files" ) );
256 std::vector<std::string> exts;
265 m_boolAttr->SetRenderer(
new wxGridCellBoolRenderer() );
266 m_boolAttr->SetEditor(
new wxGridCellBoolEditor() );
267 m_boolAttr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
269 wxArrayString vAlignNames;
270 vAlignNames.Add(
_(
"Top" ) );
271 vAlignNames.Add(
_(
"Center" ) );
272 vAlignNames.Add(
_(
"Bottom" ) );
274 m_vAlignAttr->SetEditor(
new wxGridCellChoiceEditor( vAlignNames ) );
275 m_vAlignAttr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
277 wxArrayString hAlignNames;
278 hAlignNames.Add(
_(
"Left" ) );
279 hAlignNames.Add(
_(
"Center" ) );
280 hAlignNames.Add(
_(
"Right" ) );
282 m_hAlignAttr->SetEditor(
new wxGridCellChoiceEditor( hAlignNames ) );
283 m_hAlignAttr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
285 wxArrayString orientationNames;
286 orientationNames.Add(
_(
"Horizontal" ) );
287 orientationNames.Add(
_(
"Vertical" ) );
293 wxArrayString existingNetclasses;
299 const std::shared_ptr<NET_SETTINGS>& settings = projectFile.
NetSettings();
301 existingNetclasses.push_back( settings->m_DefaultNetClass->GetName() );
303 for(
const auto& [
name, netclass ] : settings->m_NetClasses )
304 existingNetclasses.push_back(
name );
311 std::vector<std::string> fontNames;
312 Fontconfig()->ListFonts( fontNames, std::string(
Pgm().GetLanguageTag().utf8_str() ) );
314 for(
const std::string&
name : fontNames )
359 GetView()->ForceRefresh();
384 default: wxFAIL;
return wxEmptyString;
403 return aTypeName == wxGRID_VALUE_STRING;
410 return aTypeName == wxGRID_VALUE_BOOL;
435 tmp->SetReadOnly(
true );
487 && this->at( (
size_t) aRow ).GetCanonicalName() == wxT(
"Netclass" ) )
501 if( templateFn && templateFn->
m_URL )
557 wxGrid*
grid = GetView();
558 const SCH_FIELD& field = this->at( (
size_t) aRow );
560 if(
grid->GetGridCursorRow() == aRow &&
grid->GetGridCursorCol() == aCol
561 &&
grid->IsCellEditControlShown() )
594 wxFAIL_MSG( wxS(
"Unhandled field owner type." ) );
640 return _(
"Horizontal" );
642 return _(
"Vertical" );
668 return wxT(
"bad wxWidgets!" );
675 const SCH_FIELD& field = this->at( (
size_t) aRow );
685 wxFAIL_MSG( wxString::Format( wxT(
"column %d doesn't hold a bool value" ), aCol ) );
694 SCH_FIELD& field = this->at( (
size_t) aRow );
696 wxString value = aValue;
705 if(
m_eval->Process( value ) )
750 if( value ==
_(
"Left" ) )
752 else if( value ==
_(
"Center" ) )
754 else if( value ==
_(
"Right" ) )
757 wxFAIL_MSG( wxT(
"unknown horizontal alignment: " ) + value );
774 if( value ==
_(
"Top" ) )
776 else if( value ==
_(
"Center" ) )
778 else if( value ==
_(
"Bottom" ) )
781 wxFAIL_MSG( wxT(
"unknown vertical alignment: " ) + value);
808 if( value ==
_(
"Horizontal" ) )
810 else if( value ==
_(
"Vertical" ) )
813 wxFAIL_MSG( wxT(
"unknown orientation: " ) + value );
849 wxFAIL_MSG( wxString::Format( wxT(
"column %d doesn't hold a string value" ), aCol ) );
855 GetView()->Refresh();
862 SCH_FIELD& field = this->at( (
size_t) aRow );
887 wxFAIL_MSG( wxString::Format( wxT(
"column %d doesn't hold a bool value" ), aCol ) );
901 _(
"Browse for footprint" ) );
902 menu.AppendSeparator();
908 _(
"Show datasheet in browser" ) );
909 menu.AppendSeparator();
953 if( aValue == wxS(
"1" ) )
957 else if( aValue == wxS(
"0" ) )
963 wxFAIL_MSG( wxString::Format(
"string '%s' can't be converted to boolean correctly and "
964 "will be perceived as FALSE", aValue ) );
Dialog helper object to sit in the inheritance tree between wxDialog and any class written by wxFormB...
bool IsHorizontal() const
int GetTextHeight() const
void SetTextColor(const COLOR4D &aColor)
const VECTOR2I & GetTextPos() const
COLOR4D GetTextColor() const
const EDA_ANGLE & GetTextAngle() const
void SetTextSize(VECTOR2I aNewSize, bool aEnforceMinTextSize=true)
virtual const wxString & GetText() const
Return the string associated with the text object.
virtual bool IsVisible() const
void SetTextPos(const VECTOR2I &aPoint)
KIFONT::FONT * GetFont() const
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
virtual void SetVisible(bool aVisible)
static GR_TEXT_H_ALIGN_T MapHorizJustify(int aHorizJustify)
static GR_TEXT_V_ALIGN_T MapVertJustify(int aVertJustify)
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
void SetItalic(bool aItalic)
void SetFont(KIFONT::FONT *aFont)
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
wxString StringFromBool(bool aValue) const
bool GetValueAsBool(int aRow, int aCol) override
FIELD_VALIDATOR m_fieldNameValidator
bool CanSetValueAs(int aRow, int aCol, const wxString &aTypeName) override
void initGrid(WX_GRID *aGrid)
wxGridCellAttr * m_fieldNameAttr
int GetNumberRows() override
wxGridCellAttr * m_readOnlyAttr
FIELD_VALIDATOR m_urlValidator
~FIELDS_GRID_TABLE() override
bool CanGetValueAs(int aRow, int aCol, const wxString &aTypeName) override
wxGridCellAttr * GetAttr(int row, int col, wxGridCellAttr::wxAttrKind kind) override
wxGridCellAttr * m_colorAttr
wxGridCellAttr * m_nonUrlAttr
wxGridCellAttr * m_referenceAttr
FIELD_VALIDATOR m_referenceValidator
FIELD_VALIDATOR m_valueValidator
std::map< std::pair< int, int >, wxString > m_evalOriginal
wxGridCellAttr * m_footprintAttr
wxGridCellAttr * m_boolAttr
int m_mandatoryFieldCount
wxGridCellAttr * m_fontAttr
wxGridCellAttr * m_urlAttr
wxGridCellAttr * m_valueAttr
wxGridCellAttr * m_hAlignAttr
wxGridCellAttr * m_orientationAttr
void SetValue(int aRow, int aCol, const wxString &aValue) override
wxGridCellAttr * m_vAlignAttr
FIELDS_GRID_TABLE(DIALOG_SHIM *aDialog, SCH_BASE_FRAME *aFrame, WX_GRID *aGrid, LIB_SYMBOL *aSymbol)
wxGridCellAttr * m_filepathAttr
wxGridCellAttr * m_netclassAttr
void SetValueAsBool(int aRow, int aCol, bool aValue) override
wxString GetValue(int aRow, int aCol) override
void onUnitsChanged(wxCommandEvent &aEvent)
std::unique_ptr< NUMERIC_EVALUATOR > m_eval
FIELD_VALIDATOR m_nonUrlValidator
FIELD_VALIDATOR m_filepathValidator
wxString GetColLabelValue(int aCol) override
bool BoolFromString(wxString aValue) const
void showPopupMenu(wxMenu &menu, wxGridEvent &aEvent) override
void doPopupSelection(wxCommandEvent &event) override
Editor for wxGrid cells that adds a file/folder browser to the grid input field.
This class works around a bug in wxGrid where the first keystroke doesn't get sent through the valida...
virtual void SetValidator(const wxValidator &validator) override
virtual void doPopupSelection(wxCommandEvent &event)
virtual void showPopupMenu(wxMenu &menu, wxGridEvent &aEvent)
WX_GRID * m_grid
I don't own the grid, but he owns me.
static FONT * GetFont(const wxString &aFontName=wxEmptyString, bool aBold=false, bool aItalic=false)
const wxString & GetName() const
wxString ToCSSString() const
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
virtual bool ShowModal(wxString *aResult=nullptr, wxWindow *aResultantFocusWindow=nullptr)
Show this wxFrame as if it were a modal dialog, with all other instantiated wxFrames disabled until t...
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Define a library symbol object.
bool IsPower() const override
std::vector< SCH_PIN * > GetPins(int aUnit=0, int aBodyStyle=0) const
Return a list of pin object pointers from the draw item list.
wxArrayString GetFPFilters() const
The backing store for a PROJECT, in JSON format.
SCHEMATIC_SETTINGS * m_SchematicSettings
std::shared_ptr< NET_SETTINGS > & NetSettings()
static SEARCH_STACK * SchSearchS(PROJECT *aProject)
Accessor for Eeschema search stack.
virtual const wxString GetProjectPath() const
Return the full path of the project.
virtual PROJECT_FILE & GetProjectFile() const
These settings were stored in SCH_BASE_FRAME previously.
TEMPLATES m_TemplateFieldNames
A shim class between EDA_DRAW_FRAME and several derived classes: SYMBOL_EDIT_FRAME,...
Schematic editor (Eeschema) main window.
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
GR_TEXT_V_ALIGN_T GetEffectiveVertJustify() const
bool IsHorizJustifyFlipped() const
Return whether the field will be rendered with the horizontal justification inverted due to rotation ...
bool IsVertJustifyFlipped() const
void SetCanAutoplace(bool aCanPlace)
wxString GetCanonicalName() const
Get a non-language-specific name for a field which can be used for storage, variable look-up,...
GR_TEXT_H_ALIGN_T GetEffectiveHorizJustify() const
wxString GetName(bool aUseDefaultName=true) const
Return the field name (not translated).
void SetName(const wxString &aName)
bool CanAutoplace() const
void SetText(const wxString &aText) override
void OnScintillaCharAdded(SCINTILLA_TRICKS *aScintillaTricks, wxStyledTextEvent &aEvent) const
void SetNameShown(bool aShown=true)
static const wxString GetDefaultFieldName(const wxString &aName, bool aUseDefaultName)
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
static const wxString GetDefaultFieldName(int aFieldNdx, bool aTranslated=true)
std::vector< SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve a list of the SCH_PINs for the given sheet path.
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
Add cut/copy/paste, dark theme, autocomplete and brace highlighting to a wxStyleTextCtrl instance.
const TEMPLATE_FIELDNAME * GetFieldName(const wxString &aName)
Search for aName in the template field name list.
EDA_UNITS GetUserUnits() const
wxString StringFromValue(double aValue, bool aAddUnitLabel=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
Converts aValue in internal units into a united string.
int ValueFromString(const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
Converts aTextValue in aUnits to internal units used by the frame.
wxString EnsureFileExtension(const wxString &aFilename, const wxString &aExtension)
It's annoying to throw up nag dialogs when the extension isn't right.
static constexpr EDA_ANGLE ANGLE_VERTICAL
static constexpr EDA_ANGLE ANGLE_HORIZONTAL
bool GetAssociatedDocument(wxWindow *aParent, const wxString &aDocName, PROJECT *aProject, SEARCH_STACK *aPaths)
Open a document (file) with the suitable browser.
This file is part of the common library.
#define DEFAULT_FONT_NAME
static wxString netList(SCH_SYMBOL *aSymbol, SCH_SHEET_PATH &aSheetPath)
FONTCONFIG * Fontconfig()
@ FRAME_FOOTPRINT_CHOOSER
@ GRIDTRICKS_FIRST_CLIENT_ID
static const std::string KiCadSchematicFileExtension
PGM_BASE & Pgm()
The global Program "get" accessor.
@ SHEET_MANDATORY_FIELDS
The first 2 are mandatory, and must be instantiated in SCH_SHEET.
Definitions of control validators for schematic dialogs.
wxString UnescapeString(const wxString &aSource)
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
Hold a name of a symbol's field, field value, and default visibility.
static const wxString GetDefaultFieldName(int aFieldNdx, bool aTranslateForHI=false)
Return a default symbol field name for field aFieldNdx for all components.
Definition for symbol library class.
@ DATASHEET_FIELD
name of datasheet
@ FOOTPRINT_FIELD
Field Name Module PCB, i.e. "16DIP300".
@ VALUE_FIELD
Field Value of part, i.e. "3.3K".
@ MANDATORY_FIELDS
The first 5 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.
@ REFERENCE_FIELD
Field Reference of part, i.e. "IC21".
@ GR_TEXT_H_ALIGN_INDETERMINATE
@ GR_TEXT_V_ALIGN_INDETERMINATE
#define INDETERMINATE_STATE
Used for holding indeterminate values, such as with multiple selections holding different values or c...
Custom text control validator definitions.
wxString AddFileExtListToFilter(const std::vector< std::string > &aExts)
Build the wildcard extension file dialog wildcard filter to add to the base message dialog.
Definition of file extensions used in Kicad.