72 const std::vector<wxString>& aNetNames,
76 m_netclasses( aNetclasses ),
77 m_netNames( aNetNames ),
101 int min_best_width =
m_netclassGrid->GetTextExtent(
"555,555555 mils" ).x;
110 min_best_width *= 1.5;
127 wxGridCellAttr* attr =
new wxGridCellAttr;
132 attr =
new wxGridCellAttr;
161 wxGridCellAttr* attr =
new wxGridCellAttr;
162 attr->SetReadOnly(
true );
207 aGrid->SetCellValue( aRow,
GRID_NAME, nc->GetName() );
209 #define SET_MILS_CELL( col, val ) \ 210 aGrid->SetCellValue( aRow, col, StringFromValue( aUnits, val, true ) ) 224 wxString colorAsString = nc->GetSchematicColor().ToWxString( wxC2S_CSS_SYNTAX );
232 std::map<wxString, wxString> netToNetclassMap;
233 std::map<wxString, wxString> staleNetMap;
236 netToNetclassMap[ candidate ] = wxEmptyString;
248 cellAttr->SetReadOnly();
256 NETCLASSPTR netclass = i->second;
260 for(
const wxString& net : *netclass )
262 if( netToNetclassMap.count( net ) )
263 netToNetclassMap[ net ] = i->second->GetName();
265 staleNetMap[ net ] = i->second->GetName();
273 for(
const std::pair<const wxString, wxString>& ii : netToNetclassMap )
274 addNet( ii.first, ii.second,
false );
276 for(
const std::pair<const wxString, wxString>& ii : staleNetMap )
277 addNet( ii.first, ii.second,
true );
294 wxColour
color = wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT );
298 if( netclass.IsEmpty() )
312 wxArrayString netclassNames;
318 if( !netclassName.IsEmpty() )
319 netclassNames.push_back( netclassName );
322 wxGridCellAttr* attr =
new wxGridCellAttr;
323 attr->SetEditor(
new wxGridCellChoiceEditor( netclassNames ) );
328 netclassNames.Insert( wxEmptyString, 0 );
335 nc->SetName( grid->GetCellValue( row,
GRID_NAME ) );
337 #define MYCELL( col ) \ 338 ValueFromString( aUnits, grid->GetCellValue( row, col ) ) 400 if( aName.IsEmpty() )
402 wxString msg =
_(
"Netclass must have a name." );
411 wxString msg =
_(
"Netclass name already in use." );
428 wxString newName =
event.GetString();
430 if( !oldName.IsEmpty() )
453 if( aEvent.Moving() || aEvent.Entering() )
457 if( col == wxNOT_FOUND )
477 case GRID_uVIADRILL: tip =
_(
"Microvia plated hole diameter" );
break;
489 else if( aEvent.Leaving() )
532 else if( curRow == 0 )
587 m_membershipGrid->SetColSize( 0, std::max( aWidth - classNameWidth, classNameWidth ) );
602 if( c_row >= 0 && c_col == 1 )
625 if( !netFilter.IsEmpty() )
626 netFilter = wxT(
"*" ) + netFilter + wxT(
"*" );
636 if( !netFilter.IsEmpty() && !net.MakeLower().Matches( netFilter ) )
639 if( !netClassFilter.IsEmpty() && netClass != netClassFilter )
663 if( !aAssignAll && selectedRows.Index( row ) == wxNOT_FOUND )
692 netclassName.Trim(
true );
693 netclassName.Trim(
false );
PANEL_SETUP_NETCLASSES(PAGED_DIALOG *aParent, NETCLASSES *aNetclasses, const std::vector< wxString > &aNetNames, bool isEEschema)
bool TransferDataFromWindow() override
const BITMAP_OPAQUE stroke_dot_xpm[1]
NETCLASSPTR Find(const wxString &aName) const
Search this container for a NETCLASS given by aName.
void OnSizeNetclassGrid(wxSizeEvent &event) override
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
NETCLASSES * m_netclasses
Implementation of conversion functions that require both schematic and board internal units.
This file is part of the common library.
void onmembershipPanelSize(wxSizeEvent &event) override
#define SET_MILS_CELL(col, val)
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.
void SetError(const wxString &aMessage, const wxString &aPageName, int aCtrlId, int aRow=-1, int aCol=-1)
int * m_originalColWidths
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
void addNet(const wxString &netName, const wxString &netclass, bool aStale)
void doAssignments(bool aAssignAll)
int GetVisibleWidth(int aCol, bool aHeader=true, bool aContents=false, bool aKeep=true)
Calculates the specified column based on the actual size of the text on screen.
void OnNetclassGridMouseEvent(wxMouseEvent &event)
std::vector< wxString > m_netNames
EDA_UNITS GetUserUnits() const
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
NETCLASS_MAP::iterator iterator
NETCLASS_PANEL m_NetclassPanel
A container for NETCLASS instances.
std::vector< BITMAP_DEF > g_lineStyleIcons
static const char Default[]
the name of the default NETCLASS
const BITMAP_OPAQUE stroke_dash_xpm[1]
void EnsureColLabelsVisible()
Ensure the height of the row displaying the column labels is enough, even if labels are multiline tex...
void OnNetclassGridCellChanging(wxGridEvent &event)
wxChoice * m_netClassFilter
wxChoice * m_assignNetClass
bool TransferDataToWindow() override
static void gridRowToNetclass(EDA_UNITS aUnits, wxGrid *grid, int row, const NETCLASSPTR &nc)
const BITMAP_OPAQUE stroke_dashdot_xpm[1]
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
const BITMAP_OPAQUE small_trash_xpm[1]
wxBitmapButton * m_addButton
Class PANEL_SETUP_NETCLASSES_BASE.
bool Add(const NETCLASSPTR &aNetclass)
Add aNetclass and puts it into this NETCLASSES container.
wxBitmapButton * m_removeButton
void Clear()
Destroy any contained NETCLASS instances except the default one, and clears any members from the defa...
unsigned GetCount() const
WX_GRID * m_membershipGrid
static void netclassToGridRow(EDA_UNITS aUnits, wxGrid *aGrid, int aRow, const NETCLASSPTR &nc)
NETCLASSPTR GetDefault() const
void rebuildNetclassDropdowns()
wxArrayString g_lineStyleNames
const BITMAP_OPAQUE stroke_solid_xpm[1]
void ImportSettingsFrom(NETCLASSES *aBoard)
void OnUpdateUI(wxUpdateUIEvent &event) override
bool validateNetclassName(int aRow, wxString aName, bool focusFirst=true)
const BITMAP_OPAQUE small_plus_xpm[1]
void OnSizeMembershipGrid(wxSizeEvent &event) override
void OnRemoveNetclassClick(wxCommandEvent &event) override
void AdjustNetclassGridColumns(int aWidth)
void AdjustMembershipGridColumns(int aWidth)
wxSplitterWindow * m_splitter
void OnAddNetclassClick(wxCommandEvent &event) override
A text renderer that can unescape text for display This is useful where it's desired to keep the unde...
wxTextCtrl * m_netNameFilter
void doApplyFilters(bool aShowAll)
~PANEL_SETUP_NETCLASSES() override