47#include <wx/textdlg.h>
48#include <wx/filedlg.h>
51#define DISPLAY_NAME_COLUMN 0
52#define SHOW_FIELD_COLUMN 1
53#define GROUP_BY_COLUMN 2
54#define CANONICAL_NAME_COLUMN 3
56#define QUANTITY_COLUMN ( GetNumberCols() - 1 )
59#define COLUMN_MARGIN 5
61#define COLUMN_MARGIN 15
75 wxDataViewListCtrl* aFieldsCtrl ) :
87 _(
"Browse for footprint" ) );
88 menu.AppendSeparator();
93 _(
"Show datasheet in browser" ) );
94 menu.AppendSeparator();
105 wxString fpid =
m_grid->GetCellValue(
m_grid->GetGridCursorRow(),
117 wxString datasheet_uri =
m_grid->GetCellValue(
m_grid->GetGridCursorRow(),
160 m_Refs.push_back( aFirstReference );
207 void AddColumn(
const wxString& aFieldName,
bool aAddedByUser )
222 if( aFieldName == wxT(
"Value" ) )
224 else if( aFieldName == wxT(
"Footprint" ) )
303 return m_rows[ aRow ].m_Flag;
308 wxCHECK( aRow < (
int)
m_rows.size(), std::vector<SCH_REFERENCE>() );
309 return m_rows[ aRow ].m_Refs;
314 std::vector<SCH_REFERENCE> references;
321 references.push_back( ref );
333 if( &ref == &
group.m_Refs.front() )
343 std::sort( references.begin(), references.end(),
346 wxString l_ref( l.GetRef() << l.GetRefNumber() );
347 wxString r_ref( r.GetRef() << r.GetRefNumber() );
348 return StrNumCmp( l_ref, r_ref, true ) < 0;
351 auto logicalEnd = std::unique( references.begin(), references.end(),
356 if( l.GetRefNumber() == wxT(
"?" ) )
359 wxString l_ref( l.GetRef() << l.GetRefNumber() );
360 wxString r_ref( r.GetRef() << r.GetRefNumber() );
361 return l_ref == r_ref;
364 references.erase( logicalEnd, references.end() );
375 void SetValue(
int aRow,
int aCol,
const wxString &aValue )
override
393 if( lhGroup.
m_Refs.size() == 0 )
395 else if( rhGroup.
m_Refs.size() == 0 )
401 [ ascending ](
const auto a,
const auto b )
416 wxString lhRef = lhGroup.
m_Refs[ 0 ].GetRef() + lhGroup.
m_Refs[ 0 ].GetRefNumber();
417 wxString rhRef = rhGroup.
m_Refs[ 0 ].GetRef() + rhGroup.
m_Refs[ 0 ].GetRefNumber();
418 return local_cmp(
StrNumCmp( lhRef, rhRef,
true ), 0 );
426 void Sort(
int aColumn,
bool ascending )
440 std::sort( row.m_Refs.begin(), row.m_Refs.end(),
443 wxString lhs_ref( lhs.GetRef() << lhs.GetRefNumber() );
444 wxString rhs_ref( rhs.GetRef() << rhs.GetRefNumber() );
445 return StrNumCmp( lhs_ref, rhs_ref, true ) < 0;
452 return cmp( lhs, rhs, this, m_sortColumn, m_sortAscending );
468 wxDataViewListCtrl* fieldsCtrl )
470 bool matchFound =
false;
488 for(
int i =
REFERENCE_FIELD + 1; i < fieldsCtrl->GetItemCount(); ++i )
504 void RebuildRows( wxSearchCtrl* aFilter, wxCheckBox* aGroupSymbolsBox,
505 wxDataViewListCtrl* aFieldsCtrl )
511 static_cast<WX_GRID*
>( GetView() )->CommitPendingChanges(
true );
513 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_DELETED, 0,
m_rows.size() );
514 GetView()->ProcessTableMessage( msg );
523 if( !aFilter->GetValue().IsEmpty()
529 bool matchFound =
false;
540 row.m_Refs.push_back( ref );
543 else if ( aGroupSymbolsBox->GetValue() &&
groupMatch( ref, rowRef, aFieldsCtrl ) )
546 row.m_Refs.push_back( ref );
558 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_APPENDED,
m_rows.size() );
559 GetView()->ProcessTableMessage( msg );
565 std::vector<DATA_MODEL_ROW> children;
569 bool matchFound =
false;
576 if(
unitMatch( ref, child.m_Refs[ 0 ] ) )
579 child.m_Refs.push_back( ref );
588 if( children.size() < 2 )
591 std::sort( children.begin(), children.end(),
594 return cmp( lhs, rhs, this, m_sortColumn, m_sortAscending );
598 m_rows.insert(
m_rows.begin() + aRow + 1, children.begin(), children.end() );
600 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_INSERTED, aRow, children.size() );
601 GetView()->ProcessTableMessage( msg );
606 auto firstChild =
m_rows.begin() + aRow + 1;
607 auto afterLastChild = firstChild;
610 while( afterLastChild !=
m_rows.end() && afterLastChild->m_Flag ==
CHILD_ITEM )
617 m_rows.erase( firstChild, afterLastChild );
619 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_DELETED, aRow + 1, deleted );
620 GetView()->ProcessTableMessage( msg );
635 for(
size_t i = 0; i <
m_rows.size(); ++i )
647 for(
size_t i = 0; i <
m_rows.size(); ++i )
665 for(
const std::pair<wxString, wxString> srcData : fieldStore )
667 if( srcData.first ==
_(
"Qty" ) )
670 const wxString& srcName = srcData.first;
671 const wxString& srcValue = srcData.second;
695 if( !srcValue.IsEmpty() )
704 destField->
SetText( srcValue );
710 if( fieldStore.count( symbol.
GetFields()[ii].GetName() ) == 0 )
755 wxSize defaultDlgSize = ConvertDialogToPixels( wxSize( 600, 300 ) );
756 int nameColWidthMargin = 44;
765 m_fieldsCtrl->AppendTextColumn(
_(
"Field" ), wxDATAVIEW_CELL_INERT, 0, wxALIGN_LEFT, 0 );
766 m_fieldsCtrl->AppendToggleColumn(
_(
"Show" ), wxDATAVIEW_CELL_ACTIVATABLE, 0,
768 m_fieldsCtrl->AppendToggleColumn(
_(
"Group By" ), wxDATAVIEW_CELL_ACTIVATABLE, 0,
773 m_fieldsCtrl->AppendTextColumn(
_(
"Name" ), wxDATAVIEW_CELL_INERT, 0, wxALIGN_LEFT, 0 );
789 m_filter->SetDescriptiveText(
_(
"Filter" ) );
797 int nameColWidth = 0;
799 for(
int row = 0; row <
m_fieldsCtrl->GetItemCount(); ++row )
805 nameColWidth += nameColWidthMargin;
820 m_grid->UseNativeColHeader(
true );
824 m_grid->SetSelectionMode( wxGrid::wxGridSelectCells );
839 m_grid->SetDefaultRowSize(
m_grid->GetDefaultRowSize() + 4 );
842 wxGridCellAttr* attr =
new wxGridCellAttr;
847 attr =
new wxGridCellAttr;
852 attr =
new wxGridCellAttr;
857 attr =
new wxGridCellAttr;
861 m_grid->AutoSizeColumns(
false );
863 for(
int col = 0; col <
m_grid->GetNumberCols(); ++col )
867 if(
m_grid->IsColShown( col ) )
875 m_grid->SetColSize( col, width );
880 int maxWidth = defaultDlgSize.x / 3;
882 if( col ==
m_grid->GetNumberCols() - 1 )
883 m_grid->SetColSize( col,
Clamp( 50, textWidth, maxWidth ) );
885 m_grid->SetColSize( col,
Clamp( 100, textWidth, maxWidth ) );
891 m_grid->SetGridCursor( 0, 1 );
897 SetSize( defaultDlgSize );
901 m_grid->Connect( wxEVT_GRID_COL_SORT,
909 m_grid->Disconnect( wxEVT_GRID_COL_SORT,
914 m_grid->PopEventHandler(
true );
922 if( !wxDialog::TransferDataFromWindow() )
930 if( selection.GetSize() == 1 )
949 if( ref.GetSymbol() == symbol )
958 m_grid->GoToCell( row, 1 );
973 if( !wxDialog::TransferDataFromWindow() )
992 const wxString& aCanonicalName,
993 bool defaultShow,
bool defaultSortBy,
bool addedByUser )
997 wxVector<wxVariant> fieldsCtrlRow;
1000 bool show = defaultShow;
1001 bool sort_by = defaultSortBy;
1003 std::string key( aCanonicalName.ToUTF8() );
1012 fieldsCtrlRow.push_back( wxVariant( aDisplayName ) );
1013 fieldsCtrlRow.push_back( wxVariant( show ) );
1014 fieldsCtrlRow.push_back( wxVariant( sort_by ) );
1015 fieldsCtrlRow.push_back( wxVariant( aCanonicalName ) );
1023 std::set<wxString> userFieldNames;
1030 userFieldNames.insert( symbol->
GetFields()[j].GetName() );
1039 AddField(
_(
"Reference" ), wxT(
"Reference" ),
true,
true );
1040 AddField(
_(
"Value" ), wxT(
"Value" ),
true,
true );
1041 AddField(
_(
"Footprint" ), wxT(
"Footprint" ),
true,
true );
1042 AddField(
_(
"Datasheet" ), wxT(
"Datasheet" ),
true,
false );
1044 for(
const wxString& fieldName : userFieldNames )
1045 AddField( fieldName, fieldName,
true,
false );
1051 if( userFieldNames.count( templateFieldname.m_Name ) == 0 )
1052 AddField( templateFieldname.m_Name, templateFieldname.m_Name,
false,
false );
1059 wxTextEntryDialog dlg(
this,
_(
"New field name:" ),
_(
"Add Field" ) );
1061 if( dlg.ShowModal() != wxID_OK )
1064 wxString fieldName = dlg.GetValue();
1066 if( fieldName.IsEmpty() )
1083 wxGridCellAttr* attr =
new wxGridCellAttr;
1085 m_grid->SetColFormatCustom(
m_dataModel->GetColsCount() - 1, wxGRID_VALUE_STRING );
1087 std::string key( fieldName.ToUTF8() );
1092 AddField( fieldName, fieldName,
true,
false,
true );
1094 wxGridTableMessage msg(
m_dataModel, wxGRIDTABLE_NOTIFY_COLS_INSERTED,
1096 m_grid->ProcessTableMessage( msg );
1099 attr =
new wxGridCellAttr;
1100 attr->SetReadOnly();
1114 wxCHECK_RET( row != -1, wxS(
"Some user defined field must be selected first" ) );
1115 wxCHECK_RET( row >=
MANDATORY_FIELDS, wxS(
"Mandatory fields cannot be removed" ) );
1117 wxString fieldName =
m_fieldsCtrl->GetTextValue( row, 0 );
1119 wxString confirm_msg =
wxString::Format(
_(
"Are you sure you want to remove the field '%s'?" ),
1122 if( !
IsOK(
this, confirm_msg ) )
1141 wxGridTableMessage msg(
m_dataModel, wxGRIDTABLE_NOTIFY_COLS_DELETED,
1144 m_grid->ProcessTableMessage( msg );
1147 wxGridCellAttr* attr =
new wxGridCellAttr;
1148 attr->SetReadOnly();
1166 wxPoint pos = aEvent.GetPosition();
1167 wxRect ctrlRect =
m_filter->GetScreenRect();
1168 int buttonWidth = ctrlRect.GetHeight();
1170 if(
m_filter->IsSearchButtonVisible() && pos.x < buttonWidth )
1171 SetCursor( wxCURSOR_ARROW );
1172 else if(
m_filter->IsCancelButtonVisible() && pos.x > ctrlRect.GetWidth() - buttonWidth )
1173 SetCursor( wxCURSOR_ARROW );
1175 SetCursor( wxCURSOR_IBEAM );
1192 wxDataViewItem item =
event.GetItem();
1195 int col =
event.GetColumn();
1205 DisplayError(
this,
_(
"The Reference column cannot be hidden." ) );
1250 int sortCol = aEvent.GetCol();
1255 if(
m_grid->IsSortingBy( sortCol ) )
1258 ascending = !
m_grid->IsSortOrderAscending();
1280 int col = aEvent.GetRowOrCol();
1283 if(
m_grid->GetColSize( col ) )
1302 m_grid->ClearSelection();
1303 m_grid->SetGridCursor( event.GetRow(), event.GetCol() );
1315 wxGridCellCoordsArray selectedCells =
m_grid->GetSelectedCells();
1317 if( selectedCells.GetCount() == 1 )
1319 int row = selectedCells[0].GetRow();
1329 std::sort( refs.begin(), refs.end(),
1332 return a.GetUnit() < b.GetUnit();
1337 wxString symbol_path = refs[0].GetFullPath();
1389 int last_col =
m_grid->GetNumberCols() - 1;
1393 _(
"Changes are unsaved. Export unsaved data?" ),
"",
_(
"OK" ),
1403 wxFileDialog saveDlg(
this,
_(
"Save as CSV" ), wxPathOnly(
Prj().GetProjectFullName() ),
1404 fn.GetFullName(),
CsvFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
1406 if( saveDlg.ShowModal() == wxID_CANCEL )
1409 wxFFile out( saveDlg.GetPath(),
"wb" );
1411 if( !out.IsOpened() )
1415 for(
int col =
m_grid->GetNumberCols() - 1; col >=0 ; --col )
1417 if(
m_grid->IsColShown( col ) )
1425 for(
int col = 0; col <
m_grid->GetNumberCols(); col++ )
1427 if( !
m_grid->IsColShown( col ) )
1430 wxString escapedValue =
m_grid->GetColLabelValue( col );
1431 escapedValue.Replace( wxS(
"\"" ), wxS(
"\"\"" ) );
1433 wxString format = col == last_col ? wxS(
"\"%s\"\r\n" ) : wxS(
"\"%s\"," );
1439 for(
int row = 0; row <
m_grid->GetNumberRows(); row++ )
1445 for(
int col = 0; col <
m_grid->GetNumberCols(); col++ )
1447 if( !
m_grid->IsColShown( col ) )
1452 escapedValue.Replace( wxS(
"\"" ), wxS(
"\"\"" ) );
1454 wxString format = col == last_col ? wxS(
"\"%s\"\r\n" ) : wxS(
"\"%s\"," );
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Dialog helper object to sit in the inheritance tree between wxDialog and any class written by wxFormB...
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_SYMBOL_FIELDS_TABLE_BASE.
wxButton * m_removeFieldButton
wxBitmapButton * m_bRefresh
BITMAP_BUTTON * m_separator1
wxSplitterWindow * m_splitterMainWindow
wxDataViewListCtrl * m_fieldsCtrl
wxCheckBox * m_groupSymbolsBox
BITMAP_BUTTON * m_separator2
void OnTableColSize(wxGridSizeEvent &event) override
void OnSaveAndContinue(wxCommandEvent &aEvent) override
void OnAddField(wxCommandEvent &event) override
void OnGroupSymbolsToggled(wxCommandEvent &event) override
void OnColumnItemToggled(wxDataViewEvent &event) override
SCH_EDIT_FRAME * m_parent
bool TransferDataFromWindow() override
SCH_REFERENCE_LIST m_symbolsList
FIELDS_EDITOR_GRID_DATA_MODEL * m_dataModel
void OnTableItemContextMenu(wxGridEvent &event) override
void OnFilterText(wxCommandEvent &aEvent) override
void AddField(const wxString &displayName, const wxString &aCanonicalName, bool defaultShow, bool defaultSortBy, bool addedByUser=false)
void OnRemoveField(wxCommandEvent &event) override
void OnTableCellClick(wxGridEvent &event) override
DIALOG_SYMBOL_FIELDS_TABLE(SCH_EDIT_FRAME *parent)
void OnTableValueChanged(wxGridEvent &event) override
void OnExport(wxCommandEvent &aEvent) override
void OnClose(wxCloseEvent &aEvent) override
void OnFieldsCtrlSelectionChanged(wxDataViewEvent &event) override
bool TransferDataToWindow() override
void OnTableRangeSelected(wxGridRangeSelectEvent &event) override
void OnCancel(wxCommandEvent &aEvent) override
void OnFilterMouseMoved(wxMouseEvent &event) override
void OnSizeFieldList(wxSizeEvent &event) override
void OnRegroupSymbols(wxCommandEvent &aEvent) override
void OnColSort(wxGridEvent &aEvent)
virtual ~DIALOG_SYMBOL_FIELDS_TABLE()
void LoadFieldNames()
Construct the rows of m_fieldsCtrl and the columns of m_dataModel from a union of all field names in ...
A base class for most all the KiCad significant classes used in schematics and boards.
KICAD_T Type() const
Returns the type of object.
EDA_ITEM * GetParent() const
virtual void SetText(const wxString &aText)
PANEL_FIELD_EDITOR m_FieldEditorPanel
void AddColumn(const wxString &aFieldName, bool aAddedByUser)
std::vector< wxString > m_userAddedFields
std::vector< SCH_REFERENCE > GetRowReferences(int aRow) const
SCH_REFERENCE_LIST m_symbolsList
int GetNumberCols() override
wxString GetColLabelValue(int aCol) override
bool unitMatch(const SCH_REFERENCE &lhRef, const SCH_REFERENCE &rhRef)
int GetNumberRows() override
void CollapseRow(int aRow)
bool IsEmptyCell(int aRow, int aCol) override
void ExpandCollapseRow(int aRow)
std::vector< wxString > m_fieldNames
void Sort(int aColumn, bool ascending)
bool groupMatch(const SCH_REFERENCE &lhRef, const SCH_REFERENCE &rhRef, wxDataViewListCtrl *fieldsCtrl)
std::map< KIID, std::map< wxString, wxString > > m_dataStore
wxString GetCanonicalColLabel(int aCol)
void RebuildRows(wxSearchCtrl *aFilter, wxCheckBox *aGroupSymbolsBox, wxDataViewListCtrl *aFieldsCtrl)
wxString GetValue(int aRow, int aCol) override
int GetDataWidth(int aCol)
void RemoveColumn(int aCol)
GROUP_TYPE GetRowFlags(int aRow)
wxString GetRawValue(int aRow, int aCol)
FIELDS_EDITOR_GRID_DATA_MODEL(SCH_EDIT_FRAME *aFrame, SCH_REFERENCE_LIST &aSymbolsList)
static bool cmp(const DATA_MODEL_ROW &lhGroup, const DATA_MODEL_ROW &rhGroup, FIELDS_EDITOR_GRID_DATA_MODEL *dataModel, int sortCol, bool ascending)
void SetValue(int aRow, int aCol, const wxString &aValue) override
std::vector< DATA_MODEL_ROW > m_rows
wxString GetValue(const DATA_MODEL_ROW &group, int aCol)
FIELDS_EDITOR_GRID_TRICKS(DIALOG_SHIM *aParent, WX_GRID *aGrid, wxDataViewListCtrl *aFieldsCtrl)
wxDataViewListCtrl * m_fieldsCtrl
void showPopupMenu(wxMenu &menu, wxGridEvent &aEvent) override
void doPopupSelection(wxCommandEvent &event) override
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.
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.
APP_SETTINGS_BASE * KifaceSettings() 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.
TEMPLATES m_TemplateFieldNames
wxString GetFileName() const override
Helper to retrieve the filename from the root sheet screen.
SCHEMATIC_SETTINGS & Settings() const
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
void SyncView()
Mark all items for refresh.
Handle actions specific to the schematic editor.
Schematic editor (Eeschema) main window.
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag and update other data struc...
void SaveCopyInUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItemToCopy, UNDO_REDO aTypeCommand, bool aAppend, bool aDirtyConnectivity=true)
Create a copy of the current schematic item, and put it in the undo list.
SCH_SHEET_PATH & GetCurrentSheet() const
SCHEMATIC & Schematic() const
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
bool SaveProject(bool aSaveAs=false)
Save the currently-open schematic (including its hierarchy) and associated project.
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Container to create a flattened list of symbols because in a complex hierarchy, a symbol can be used ...
static wxString Shorthand(std::vector< SCH_REFERENCE > aList)
Return a shorthand string representing all the references in the list.
void SplitReferences()
Attempt to split all reference designators into a name (U) and number (1).
A helper to define a symbol's reference designator in a schematic.
wxString GetFullRef() const
SCH_SYMBOL * GetSymbol() const
wxString GetRefNumber() 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.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
int GetFieldCount() const
Return the number of fields in this symbol.
const std::vector< SCH_SYMBOL_INSTANCE > & GetInstanceReferences()
SCH_FIELD * FindField(const wxString &aFieldName, bool aIncludeDefaultFields=true)
Search for a SCH_FIELD with aFieldName.
void SetValueFieldText(const wxString &aValue)
const wxString GetFootprintFieldText(bool aResolve) const
void SetFootprintFieldText(const wxString &aFootprint)
VECTOR2I GetPosition() const override
const wxString GetValueFieldText(bool aResolve) const
SCH_FIELD * AddField(const SCH_FIELD &aField)
Add a field to the symbol.
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly)
Populate a std::vector with SCH_FIELDs.
wxString GetFieldText(const wxString &aFieldName) const
Search for a field named aFieldName and returns text associated with this field.
const TEMPLATE_FIELDNAMES & GetTemplateFieldNames()
Return a template field name list for read only access.
void SetTable(wxGridTableBase *table, bool aTakeOwnership=false)
Hide wxGrid's SetTable() method with one which doesn't mess up the grid column widths when setting th...
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
int OKOrCancelDialog(wxWindow *aParent, const wxString &aWarning, const wxString &aMessage, const wxString &aDetailedMessage, const wxString &aOKLabel, const wxString &aCancelLabel, bool *aApplyToAll)
Display a warning dialog with aMessage and returns the user response.
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
bool HandleUnsavedChanges(wxWindow *aParent, const wxString &aMessage, const std::function< bool()> &aSaveFunction)
Display a dialog with Save, Cancel and Discard Changes buttons.
This file is part of the common library.
@ GROUP_COLLAPSED_DURING_SORT
#define DISPLAY_NAME_COLUMN
#define CANONICAL_NAME_COLUMN
#define SHOW_FIELD_COLUMN
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.
@ FRAME_FOOTPRINT_VIEWER_MODAL
@ GRIDTRICKS_FIRST_SHOWHIDE
@ GRIDTRICKS_FIRST_CLIENT_ID
const std::string CsvFileExtension
wxString CsvFileWildcard()
wxSize GetTextSize(const wxString &aSingleLine, wxWindow *aWindow)
Return the size of aSingleLine of text when it is rendered in aWindow using whatever font is currentl...
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
int StrNumCmp(const wxString &aString1, const wxString &aString2, bool aIgnoreCase)
Compare two strings with alphanumerical content.
bool WildCompareString(const wxString &pattern, const wxString &string_to_tst, bool case_sensitive)
Compare a string against wild card (* and ?) pattern using the usual rules.
int ValueStringCompare(const wxString &strFWord, const wxString &strSWord)
Compare strings like the strcmp function but handle numbers and modifiers within the string text corr...
std::vector< SCH_REFERENCE > m_Refs
DATA_MODEL_ROW(const SCH_REFERENCE &aFirstReference, GROUP_TYPE aType)
std::map< std::string, bool > fields_show
std::map< std::string, int > column_widths
std::map< std::string, bool > fields_group_by
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 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.
@ REFERENCE_FIELD
Field Reference of part, i.e. "IC21".
#define INDETERMINATE_STATE
Used for holding indeterminate values, such as with multiple selections holding different values or c...
constexpr T Clamp(const T &lower, const T &value, const T &upper)
Limit value within the range lower <= value <= upper.
Definition of file extensions used in Kicad.