28#include <wx/wupdlock.h> 
   81                                                std::shared_ptr<NET_SETTINGS> aNetSettings,
 
   82                                                const std::set<wxString>& aNetNames, 
bool aIsEEschema ) :
 
  120    wxWindowUpdateLocker updateLock( 
this );
 
  132    int const min_best_width = 
m_netclassGrid->GetTextExtent( 
"555,555555 mils" ).x;
 
  138        int const min_width =  
m_netclassGrid->GetVisibleWidth( i, 
true, 
true );
 
  140        int const weighted_min_best_width = ( i == 
GRID_LINESTYLE ) ? min_best_width * 3 / 2
 
  162    wxGridCellAttr* attr = 
new wxGridCellAttr;
 
  167    attr = 
new wxGridCellAttr;
 
  172    attr = 
new wxGridCellAttr;
 
  240          [
this]( wxIdleEvent& aEvent )
 
  246                  wxWindow* dialog = wxGetTopLevelParent( 
this );
 
  247                  wxWindow* topLevelFocus = wxGetTopLevelParent( wxWindow::FindFocus() );
 
 
  286    auto netclassToGridRow =
 
  295                wxString colorAsString = nc->GetSchematicColor().ToCSSString();
 
  298                if( nc->HasLineStyle() )
 
  300                    int lineStyleIdx = std::max( 0, nc->GetLineStyle() );
 
  322                colorAsString = nc->GetPcbColor().ToCSSString();
 
  325                if( nc->IsDefault() )
 
  337    std::vector<const NETCLASS*> netclasses;
 
  341        netclasses.push_back( netclass.get() );
 
  343    std::sort( netclasses.begin(), netclasses.end(),
 
  346                   return nc1->GetPriority() < nc2->GetPriority();
 
  351    m_netclassGrid->AppendRows( 
static_cast<int>( netclasses.size() ) );
 
  355    for( 
const NETCLASS* nc : netclasses )
 
  356        netclassToGridRow( row++, nc );
 
  360    netclassToGridRow( row, 
m_netSettings->GetDefaultNetclass().get() );
 
  367    for( 
const auto& [matcher, netclassName] : 
m_netSettings->GetNetclassPatternAssignments() )
 
 
  380            [
this, aRowId, aIsDefault]( 
int aCol )
 
  389                wxGridCellAttr* attr = 
m_netclassGrid->GetOrCreateCellAttr( aRowId, aCol );
 
  390                attr->SetEditor( cellEditor );
 
 
  414    if( 
IsOK( m_parent, 
_( 
"The netclasses have been changed outside the Setup dialog.\n" 
  415                           "Do you wish to reload them?" ) ) )
 
 
  425    std::shared_ptr<NET_SETTINGS> tempNetSettings = std::make_shared<NET_SETTINGS>( 
nullptr, 
"" );
 
  426    std::shared_ptr<NET_SETTINGS> saveNetSettings = 
m_netSettings;
 
 
  459    wxArrayString netclassNames;
 
  465        if( !netclassName.IsEmpty() )
 
  466            netclassNames.push_back( netclassName );
 
  469    wxGridCellAttr* attr = 
new wxGridCellAttr;
 
  470    attr->SetEditor( 
new wxGridCellChoiceEditor( netclassNames ) );
 
 
  480    auto gridRowToNetclass =
 
  481            [&]( 
int aRow, 
const std::shared_ptr<NETCLASS>& nc )
 
  483                if( nc->IsDefault() )
 
  484                    nc->SetPriority( std::numeric_limits<int>::max() );
 
  486                    nc->SetPriority( aRow );
 
  498                    nc->SetLineStyle( std::optional<int>() );
 
  500                    nc->SetLineStyle( lineIdx - 1 );
 
  502                wxASSERT_MSG( lineIdx >= 0, 
"Line style name not found." );
 
  515                if( !nc->IsDefault() )
 
  521                        nc->SetPcbColor( newPcbColor );
 
  527                        nc->SetSchematicColor( newSchematicColor );
 
  537    for( 
int row = 0; row < 
m_netclassGrid->GetNumberRows() - 1; ++row )
 
  540        gridRowToNetclass( row, nc );
 
  552        m_netSettings->SetNetclassPatternAssignment( pattern, netclass );
 
 
  561    wxString tmp = aName;
 
  568        wxString msg =  
_( 
"Netclass must have a name." );
 
  577            wxString msg = 
_( 
"Netclass name already in use." );
 
 
  597        wxString msg = wxString::Format( 
_( 
"Clearance was too large.  It has been clipped to %s." ),
 
 
  615            wxString newName = 
event.GetString();
 
  617            if( !oldName.IsEmpty() )
 
 
  646    if( ( event.GetCol() < 0 ) || ( event.GetCol() >= 
m_assignmentGrid->GetNumberCols() ) )
 
  660    std::vector<std::pair<wxString, wxString>> netclassesassignments;
 
  665        netclassesassignments.emplace_back( 
m_assignmentGrid->GetCellValue( row, 0 ),
 
  669    std::sort( netclassesassignments.begin(), netclassesassignments.end(),
 
  670               [
this]( 
const std::pair<wxString, wxString>& assign1,
 
  671                       const std::pair<wxString, wxString>& assign2 )
 
  673                   const wxString& str1 = ( m_sortCol == 0 ) ? assign1.first : assign1.second;
 
  674                   const wxString& str2 = ( m_sortCol == 0 ) ? assign2.first : assign2.second;
 
  675                   return m_sortAsc ? ( str1 < str2 ) : ( str1 > str2 );
 
  683    for( 
const auto& [pattern, netclassName] : netclassesassignments )
 
 
  695    if( aEvent.Moving() || aEvent.Entering() )
 
  699        if( col == wxNOT_FOUND )
 
  719        case GRID_uVIADRILL:        tip = 
_( 
"Microvia plated hole diameter" ); 
break;
 
  732    else if( aEvent.Leaving() )
 
 
  745            [&]() -> std::pair<int, int>
 
 
  782                for( 
int assignment = 0; assignment < 
m_assignmentGrid->GetNumberRows(); ++assignment )
 
 
  828            [&]() -> std::pair<int, int>
 
 
  850    const std::map<wxString, std::shared_ptr<NETCLASS>>& netclasses =
 
  853    for( 
int row = 0; row < 
m_netclassGrid->GetNumberRows() - 1; ++row )
 
  857        if( netclasses.find( netclassName ) != netclasses.end() )
 
  859            const KIGFX::COLOR4D ncColor = netclasses.at( netclassName )->GetSchematicColor();
 
 
  871    int classNameWidth = 160;
 
  873    m_assignmentGrid->SetColSize( 0, std::max( aWidth - classNameWidth, classNameWidth ) );
 
 
  913        if( wxTextEntry* txt = 
dynamic_cast<wxTextEntry*
>( cellEditor->GetControl() ) )
 
  914            pattern = txt->GetValue();
 
  916        cellEditor->DecRef();
 
  923        if( !pattern.IsEmpty() )
 
  927            m_matchingNets->Report( wxString::Format( 
_( 
"<b>Nets matching '%s':</b>" ), pattern ) );
 
 
  951        netclassName.Trim( 
true );
 
  952        netclassName.Trim( 
false );
 
 
 1015    wxArrayString profileNames;
 
 1016    profileNames.push_back( wxEmptyString );
 
 1017    std::ranges::for_each( aNames,
 
 1018                           [&]( 
const wxString& aName )
 
 1020                               profileNames.push_back( aName );
 
 1023    wxGridCellAttr* attr = 
new wxGridCellAttr;
 
 1024    attr->SetEditor( 
new wxGridCellChoiceEditor( profileNames, 
false ) );
 
 
constexpr EDA_IU_SCALE schIUScale
 
constexpr EDA_IU_SCALE pcbIUScale
 
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
 
#define MAXIMUM_CLEARANCE
 
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.
 
A color representation with 4 components: red, green, blue, alpha.
 
wxString ToCSSString() const
 
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
 
A collection of nets and the parameters used to route or test these nets.
 
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)
 
wxStaticText * m_colorDefaultHelpText
 
STD_BITMAP_BUTTON * m_removeAssignmentButton
 
STD_BITMAP_BUTTON * m_addAssignmentButton
 
STD_BITMAP_BUTTON * m_removeButton
 
WX_PANEL * m_netclassesPane
 
wxButton * m_importColorsButton
 
WX_PANEL * m_membershipPane
 
STD_BITMAP_BUTTON * m_moveUpButton
 
WX_HTML_REPORT_BOX * m_matchingNets
 
STD_BITMAP_BUTTON * m_moveDownButton
 
PANEL_SETUP_NETCLASSES_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
 
STD_BITMAP_BUTTON * m_addButton
 
WX_GRID * m_assignmentGrid
 
wxSplitterWindow * m_splitter
 
void OnImportColorsClick(wxCommandEvent &event) override
 
std::map< int, int > m_originalColWidths
 
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
 
bool validateNetclassClearance(int aRow)
 
std::map< wxString, std::shared_ptr< NETCLASS > > m_lastLoaded
 
void UpdateDelayProfileNames(const std::vector< wxString > &aNames) const
 
void ImportSettingsFrom(const std::shared_ptr< NET_SETTINGS > &aNetSettings)
 
void onUnitsChanged(wxCommandEvent &aEvent)
 
void rebuildNetclassDropdowns()
 
~PANEL_SETUP_NETCLASSES() override
 
void OnNetclassGridCellChanging(wxGridEvent &event)
 
void setNetclassRowNullableEditors(int aRowId, bool aIsDefault)
 
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
 
void AdjustAssignmentGridColumns(int aWidth)
 
void OnMoveNetclassUpClick(wxCommandEvent &event) override
 
std::set< wxString > m_netNames
 
void OnAddNetclassClick(wxCommandEvent &event) override
 
bool TransferDataFromWindow() override
 
std::unique_ptr< UNITS_PROVIDER > m_schUnitsProvider
 
std::bitset< 64 > m_shownColumns
 
void OnSizeNetclassGrid(wxSizeEvent &event) override
 
void OnNetclassAssignmentSort(wxGridEvent &event)
 
void AdjustNetclassGridColumns(int aWidth)
 
std::shared_ptr< NET_SETTINGS > m_netSettings
 
void OnMoveNetclassDownClick(wxCommandEvent &event) override
 
virtual COMMON_SETTINGS * GetCommonSettings() const
 
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
 
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
 
This file is part of the common library.
 
KICOMMON_API wxFont GetInfoFont(wxWindow *aWindow)
 
std::vector< BITMAPS > g_lineStyleIcons
 
wxArrayString g_lineStyleNames
 
PGM_BASE & Pgm()
The global program "get" accessor.
 
wxString pcbnew_visible_columns
 
wxString eeschema_visible_columns