73 std::shared_ptr<NET_SETTINGS> aNetSettings,
74 const std::set<wxString>& aNetNames,
78 m_isEEschema( aIsEEschema ),
79 m_netSettings( aNetSettings ),
80 m_netNames( aNetNames ),
82 m_lastNetclassGridWidth( -1 )
114 int const min_best_width =
m_netclassGrid->GetTextExtent(
"555,555555 mils" ).x;
122 int const weighted_min_best_width = ( i ==
GRID_LINESTYLE ) ? min_best_width * 3 / 2
156 wxGridCellAttr* attr =
new wxGridCellAttr;
161 attr =
new wxGridCellAttr;
247 std::shared_ptr<NET_SETTINGS> tempNetSettings = std::make_shared<NET_SETTINGS>(
nullptr,
"" );
248 std::shared_ptr<NET_SETTINGS> saveNetSettings =
m_netSettings;
269 auto netclassToGridRow =
270 [&](
int aRow,
const std::shared_ptr<NETCLASS>& nc )
277 wxString colorAsString = nc->GetSchematicColor().ToCSSString();
280 int lineStyleIdx = std::max( 0, nc->GetLineStyle() );
301 netclassToGridRow( row++,
m_netSettings->m_DefaultNetClass );
305 cellAttr->SetReadOnly();
312 netclassToGridRow( row++, netclass );
318 for(
const auto& [ matcher, netclassName ] :
m_netSettings->m_NetClassPatternAssignments )
335 wxArrayString netclassNames;
341 if( !netclassName.IsEmpty() )
342 netclassNames.push_back( netclassName );
345 wxGridCellAttr* attr =
new wxGridCellAttr;
346 attr->SetEditor(
new wxGridCellChoiceEditor( netclassNames ) );
358 auto gridRowToNetclass =
359 [&](
int aRow,
const std::shared_ptr<NETCLASS>& nc )
367 nc->SetSchematicColor( wxColour(
color ) );
371 wxASSERT_MSG( nc->GetLineStyle() >= 0,
"Line style name not found." );
386 gridRowToNetclass( row++,
m_netSettings->m_DefaultNetClass );
392 gridRowToNetclass( row, nc );
405 std::make_unique<EDA_COMBINED_MATCHER>( pattern,
CTX_NETCLASS ),
419 wxString tmp = aName;
426 wxString msg =
_(
"Netclass must have a name." );
435 wxString msg =
_(
"Netclass name already in use." );
453 wxString newName =
event.GetString();
455 if( !oldName.IsEmpty() )
478 if( aEvent.Moving() || aEvent.Entering() )
482 if( col == wxNOT_FOUND )
502 case GRID_uVIADRILL: tip =
_(
"Microvia plated hole diameter" );
break;
514 else if( aEvent.Leaving() )
557 else if( curRow == 0 )
652 int classNameWidth = 160;
654 m_assignmentGrid->SetColSize( 0, std::max( aWidth - classNameWidth, classNameWidth ) );
688 if( wxTextEntry* txt =
dynamic_cast<wxTextEntry*
>( cellEditor->GetControl() ) )
689 pattern = txt->GetValue();
691 cellEditor->DecRef();
698 if( !pattern.IsEmpty() )
729 netclassName.Trim(
true );
730 netclassName.Trim(
false );
constexpr EDA_IU_SCALE schIUScale
constexpr EDA_IU_SCALE pcbIUScale
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
NETCLASS_PANEL m_NetclassPanel
bool StartsWith(const wxString &aTerm)
The base class for create windows for drawing purpose.
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.
static const char Default[]
the name of the default NETCLASS
static PAGED_DIALOG * GetDialog(wxWindow *aWindow)
void SetError(const wxString &aMessage, const wxString &aPageName, int aCtrlId, int aRow=-1, int aCol=-1)
Class PANEL_SETUP_NETCLASSES_BASE.
wxStaticText * m_colorDefaultHelpText
STD_BITMAP_BUTTON * m_removeAssignmentButton
STD_BITMAP_BUTTON * m_addAssignmentButton
STD_BITMAP_BUTTON * m_removeButton
WX_PANEL * m_netclassesPane
WX_PANEL * m_membershipPane
WX_HTML_REPORT_BOX * m_matchingNets
STD_BITMAP_BUTTON * m_addButton
WX_GRID * m_assignmentGrid
wxSplitterWindow * m_splitter
void OnUpdateUI(wxUpdateUIEvent &event) override
void OnSizeAssignmentGrid(wxSizeEvent &event) override
PANEL_SETUP_NETCLASSES(wxWindow *aParentWindow, EDA_DRAW_FRAME *aFrame, std::shared_ptr< NET_SETTINGS > aSettings, const std::set< wxString > &aNetNames, bool isEEschema)
int m_lastNetclassGridWidth
void OnRemoveNetclassClick(wxCommandEvent &event) override
void OnRemoveAssignmentClick(wxCommandEvent &event) override
void ImportSettingsFrom(const std::shared_ptr< NET_SETTINGS > &aNetSettings)
void onUnitsChanged(wxCommandEvent &aEvent)
void rebuildNetclassDropdowns()
~PANEL_SETUP_NETCLASSES() override
void OnNetclassGridCellChanging(wxGridEvent &event)
bool TransferDataToWindow() override
bool validateNetclassName(int aRow, const wxString &aName, bool focusFirst=true)
std::unique_ptr< UNITS_PROVIDER > m_pcbUnitsProvider
void OnNetclassGridMouseEvent(wxMouseEvent &event)
void OnAddAssignmentClick(wxCommandEvent &event) override
int * m_originalColWidths
void AdjustAssignmentGridColumns(int aWidth)
std::set< wxString > m_netNames
void OnAddNetclassClick(wxCommandEvent &event) override
bool TransferDataFromWindow() override
std::unique_ptr< UNITS_PROVIDER > m_schUnitsProvider
void OnSizeNetclassGrid(wxSizeEvent &event) override
void AdjustNetclassGridColumns(int aWidth)
std::shared_ptr< NET_SETTINGS > m_netSettings
EDA_UNITS GetUserUnits() const
int GetVisibleWidth(int aCol, bool aHeader=true, bool aContents=true, bool aKeep=false)
Calculates the specified column based on the actual size of the text on screen.
void SetUnitValue(int aRow, int aCol, int aValue)
Set a unitized cell's value.
int GetUnitValue(int aRow, int aCol)
Apply standard KiCad unit and eval services to a numeric cell.
void EnsureColLabelsVisible()
Ensure the height of the row displaying the column labels is enough, even if labels are multiline tex...
void SetAutoEvalCols(const std::vector< int > &aCols)
void SetUnitsProvider(UNITS_PROVIDER *aProvider, int aCol=0)
Set a UNITS_PROVIDER to enable use of unit- and eval-based Getters.
void ClearRows()
wxWidgets recently added an ASSERT which fires if the position is greater than or equal to the number...
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
void Clear()
Delete the stored messages.
REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED) override
Report a string with a given severity.
void Flush()
Build the HTML messages page.
void SetBorders(bool aLeft, bool aRight, bool aTop, bool aBottom)
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
This file is part of the common library.
wxFont GetInfoFont(wxWindow *aWindow)
std::vector< BITMAPS > g_lineStyleIcons
wxArrayString g_lineStyleNames
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.