35#include <wx/wupdlock.h>
39 std::shared_ptr<TIME_DOMAIN_PARAMETERS> aTimeDomainParameters ) :
70 wxEVT_GRID_CELL_CHANGING,
81 std::vector<int> viaColIds;
104 wxEVT_GRID_CELL_CHANGING,
123 addViaRow( profile.m_ProfileName, viaOverride );
172 if( col < m_tracePropagationGrid->GetNumberCols() )
184 std::map<PCB_LAYER_ID, int> propDelays;
227 std::swap( signalLayerIdFrom, signalLayerIdTo );
230 std::swap( viaLayerIdFrom, viaLayerIdTo );
249 for(
const auto& layer :
LSET::AllCuMask( aNumCopperLayers ).CuStack() )
251 wxString layerName =
m_board->GetLayerName( layer );
296 if( newCopperLayers < curCopperLayers )
300 curCopperLayers - newCopperLayers );
302 else if( newCopperLayers > curCopperLayers )
307 std::vector<int> copperColIds;
318 copperColIds.push_back( colIdx );
330 wxArrayString layerNames;
332 [&layerNames](
const wxString& aLayerName )
334 layerNames.push_back( aLayerName );
338 std::vector<wxString> currentSignalLayersFrom;
339 std::vector<wxString> currentSignalLayersTo;
340 std::vector<wxString> currentViaLayersFrom;
341 std::vector<wxString> currentViaLayersTo;
352 wxGridCellAttr* attr =
new wxGridCellAttr;
353 attr->SetEditor(
new wxGridCellChoiceEditor( layerNames,
false ) );
356 attr =
new wxGridCellAttr;
357 attr->SetEditor(
new wxGridCellChoiceEditor( layerNames,
false ) );
360 attr =
new wxGridCellAttr;
361 attr->SetEditor(
new wxGridCellChoiceEditor( layerNames,
false ) );
364 attr =
new wxGridCellAttr;
365 attr->SetEditor(
new wxGridCellChoiceEditor( layerNames,
false ) );
375 m_board->GetLayerName( lastSignalFromId ) );
383 m_board->GetLayerName( lastSignalToId ) );
407 [&]() -> std::pair<int, int>
446 [&]() -> std::pair<int, int>
487 wxString newName =
event.GetString();
488 newName.Trim(
true ).Trim(
false );
490 if( !oldName.IsEmpty() )
517 const wxString& aNewName )
const
519 wxArrayString profileNames;
525 if( profileName == aOldName )
526 profileName = aNewName;
528 profileNames.push_back( profileName );
531 std::ranges::sort( profileNames,
532 [](
const wxString& a,
const wxString& b )
534 return a.CmpNoCase( b ) < 0;
537 wxGridCellAttr* attr =
new wxGridCellAttr;
538 attr->SetEditor(
new wxGridCellChoiceEditor( profileNames,
false ) );
545 wxString tmp = aName;
551 const wxString msg =
_(
"Tuning profile must have a name" );
560 const wxString msg =
_(
"Tuning profile name already in use" );
595 std::map<wxString, std::set<DELAY_PROFILE_VIA_OVERRIDE_ENTRY>> rowCache;
601 std::set<DELAY_PROFILE_VIA_OVERRIDE_ENTRY>& viaOverrides = rowCache[profileName];
603 if( viaOverrides.contains( entry ) )
605 const wxString msg =
_(
"Via override configuration is duplicated" );
611 viaOverrides.insert( entry );
621 std::vector<wxString> profileNames;
626 profileNames.emplace_back( profileName );
629 std::ranges::sort( profileNames,
630 [](
const wxString& a,
const wxString& b )
632 return a.CmpNoCase( b ) < 0;
640 const std::shared_ptr<TIME_DOMAIN_PARAMETERS>& aOtherParameters )
658 profileName.Trim(
true ).Trim(
false );
constexpr EDA_IU_SCALE pcbIUScale
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
Information pertinent to a Pcbnew printed circuit board.
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.
static LSET AllCuMask(int aCuLayerCount)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
static PAGED_DIALOG * GetDialog(wxWindow *aWindow)
void SetError(const wxString &aMessage, const wxString &aPageName, int aCtrlId, int aRow=-1, int aCol=-1)
STD_BITMAP_BUTTON * m_removeDelayProfileButton
WX_GRID * m_viaPropagationGrid
STD_BITMAP_BUTTON * m_removeViaOverrideButton
STD_BITMAP_BUTTON * m_addDelayProfileButton
STD_BITMAP_BUTTON * m_addViaOverrideButton
wxSplitterWindow * m_splitter
PANEL_SETUP_TIME_DOMAIN_PARAMETERS_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)
WX_GRID * m_tracePropagationGrid
WX_PANEL * m_timeDomainParametersPane
wxString getProfileNameForProfileGridRow(int aRow) const
Gets the profile name for the given profile grid row.
std::map< wxString, PCB_LAYER_ID > m_prevLayerNamesToIDs
std::map< wxString, PCB_LAYER_ID > m_layerNamesToIDs
bool TransferDataFromWindow() override
Save parameter data to the settings object.
void updateViaGridColumns()
Update the dynamic (per-layer) columns in the via overrides grid.
void OnAddViaOverrideClick(wxCommandEvent &event) override
Adds a new via override profile entry to the via overrides grid.
PCB_EDIT_FRAME * m_frame
The active edit frame.
std::vector< wxString > m_layerNames
std::map< int, PCB_LAYER_ID > m_copperColumnsToLayerId
void OnRemoveViaOverrideClick(wxCommandEvent &event) override
Removes a via override profile entry from the via overrides grid.
void OnAddDelayProfileClick(wxCommandEvent &event) override
Adds a new tuning profile entry to the tuning profile grid.
void addProfileRow(const DELAY_PROFILE &aDelayProfile)
Adds a tuning profile row with the given persisted parameters.
PANEL_SETUP_TIME_DOMAIN_PARAMETERS(wxWindow *aParentWindow, PCB_EDIT_FRAME *aFrame, BOARD *aBoard, std::shared_ptr< TIME_DOMAIN_PARAMETERS > aTimeDomainParameters)
bool Validate() override
Validates all data.
void setColumnWidths()
Optimise grid columns to fit titles and content.
void addViaRow(const wxString &aProfileName, const DELAY_PROFILE_VIA_OVERRIDE_ENTRY &aViaOverrideEntry) const
Adds a via override row with the given persisted parameters.
void ImportSettingsFrom(const std::shared_ptr< TIME_DOMAIN_PARAMETERS > &aOtherParameters)
Load configuration from the given settings object.
~PANEL_SETUP_TIME_DOMAIN_PARAMETERS() override
@ PROFILE_GRID_PROFILE_NAME
@ PROFILE_GRID_NUM_REQUIRED_COLS
@ PROFILE_GRID_VIA_PROP_DELAY
@ VIA_GRID_VIA_LAYER_FROM
@ VIA_GRID_SIGNAL_LAYER_FROM
@ VIA_GRID_SIGNAL_LAYER_TO
bool validateDelayProfileName(int aRow, const wxString &aName, bool focusFirst=true)
Validates a tuning profile name (checks for not empty and not duplicated)
void updateProfileGridColumns()
Update the dynamic (per-layer) columns in the tuning profiles grid.
DELAY_PROFILE getProfileRow(int aRow)
Gets a tuning profile row as a set of persistable parameters.
BOARD * m_board
The current board.
std::shared_ptr< TIME_DOMAIN_PARAMETERS > m_timeDomainParameters
The parameters object to load / save data from / to.
void updateViaProfileNamesEditor(const wxString &aOldName=wxEmptyString, const wxString &aNewName=wxEmptyString) const
Updates the via override tuning profile name dropdown lists Updates entries if aOldName and aNewName ...
bool validateViaRows()
Validates all via override rows.
void OnDelayProfileGridCellChanging(wxGridEvent &event)
Validates a tuning profile row data.
DELAY_PROFILE_VIA_OVERRIDE_ENTRY getViaRow(int aRow)
Gets a via override row as a set of persistable parameters.
void OnRemoveDelayProfileClick(wxCommandEvent &event) override
Removes a tuning profile entry from the tuning profile grid.
bool TransferDataToWindow() override
Load parameter data from the settings object.
std::map< PCB_LAYER_ID, int > m_copperLayerIdsToColumns
void SyncCopperLayers(int aNumCopperLayers)
Called when switching to this tab to make sure that any changes to the copper layer count made on the...
std::unique_ptr< UNITS_PROVIDER > m_unitsProvider
std::vector< wxString > GetDelayProfileNames() const
Returns all configured tuning profile names. Used by the netclass setup panel.
The main frame for Pcbnew.
bool IsCopperLayerLowerThan(PCB_LAYER_ID aLayerA, PCB_LAYER_ID aLayerB)
Return true if copper aLayerA is placed lower than aLayerB, false otherwise.
PCB_LAYER_ID
A quick note on layer IDs:
Represents a single line in the time domain configuration via overrides configuration grid.
PCB_LAYER_ID m_SignalLayerFrom
PCB_LAYER_ID m_ViaLayerFrom
PCB_LAYER_ID m_SignalLayerTo
PCB_LAYER_ID m_ViaLayerTo
Represents a single line in the time domain configuration net class configuration grid.
std::vector< DELAY_PROFILE_VIA_OVERRIDE_ENTRY > m_ViaOverrides
std::map< PCB_LAYER_ID, int > m_LayerPropagationDelays
int m_ViaPropagationDelay