KiCad PCB EDA Suite
Loading...
Searching...
No Matches
panel_setup_time_domain_parameters.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24#include <widgets/wx_panel.h>
26
27#include <bitmaps.h>
29#include <pcb_edit_frame.h>
30#include <grid_tricks.h>
31#include <layer_ids.h>
32#include <pgm_base.h>
35#include <wx/wupdlock.h>
36
38 wxWindow* aParentWindow, PCB_EDIT_FRAME* aFrame, BOARD* aBoard,
39 std::shared_ptr<TIME_DOMAIN_PARAMETERS> aTimeDomainParameters ) :
41 m_timeDomainParameters( std::move( aTimeDomainParameters ) ),
42 m_frame( aFrame ),
43 m_board( aFrame->GetBoard() )
44{
45 m_timeDomainParametersPane->SetBorders( true, false, false, false );
46
47 // Set up units
48 m_unitsProvider = std::make_unique<UNITS_PROVIDER>( pcbIUScale, m_frame->GetUserUnits() );
51
52 Freeze();
53
54 m_splitter->SetMinimumPaneSize( FromDIP( m_splitter->GetMinimumPaneSize() ) );
55
56 // Set up the tuning profiles grid
57 m_tracePropagationGrid->BeginBatch();
58 m_tracePropagationGrid->SetUseNativeColLabels();
59
62 m_tracePropagationGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
63
64 m_addDelayProfileButton->SetBitmap( KiBitmapBundle( BITMAPS::small_plus ) );
65 m_removeDelayProfileButton->SetBitmap( KiBitmapBundle( BITMAPS::small_trash ) );
66
67 m_tracePropagationGrid->EndBatch();
68
70 wxEVT_GRID_CELL_CHANGING,
71 wxGridEventHandler( PANEL_SETUP_TIME_DOMAIN_PARAMETERS::OnDelayProfileGridCellChanging ), nullptr, this );
72
73 // Set up the via override grid
74 m_viaPropagationGrid->BeginBatch();
75 m_viaPropagationGrid->SetUseNativeColLabels();
76
78 m_viaPropagationGrid->PushEventHandler( new GRID_TRICKS( m_viaPropagationGrid ) );
79 m_viaPropagationGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
80
81 std::vector<int> viaColIds;
83 m_unitsProvider->GetUnitsFromType( EDA_DATA_TYPE::TIME ) );
84 viaColIds.push_back( VIA_GRID_DELAY );
86 m_viaPropagationGrid->EndBatch();
87
88 m_addViaOverrideButton->SetBitmap( KiBitmapBundle( BITMAPS::small_plus ) );
89 m_removeViaOverrideButton->SetBitmap( KiBitmapBundle( BITMAPS::small_trash ) );
90
92
93 Thaw();
94}
95
96
98{
99 // Delete the GRID_TRICKS
100 m_tracePropagationGrid->PopEventHandler( true );
101 m_viaPropagationGrid->PopEventHandler( true );
102
103 m_tracePropagationGrid->Disconnect(
104 wxEVT_GRID_CELL_CHANGING,
105 wxGridEventHandler( PANEL_SETUP_TIME_DOMAIN_PARAMETERS::OnDelayProfileGridCellChanging ), nullptr, this );
106}
107
108
110{
113
114 const std::vector<DELAY_PROFILE>& delayProfiles = m_timeDomainParameters->GetDelayProfiles();
115
117
118 for( const DELAY_PROFILE& profile : delayProfiles )
119 {
120 addProfileRow( profile );
121
122 for( const DELAY_PROFILE_VIA_OVERRIDE_ENTRY& viaOverride : profile.m_ViaOverrides )
123 addViaRow( profile.m_ProfileName, viaOverride );
124 }
125
127
128 return true;
129}
130
131
133{
134 if( !Validate() )
135 return false;
136
137 m_timeDomainParameters->ClearDelayProfiles();
138
139 for( int i = 0; i < m_tracePropagationGrid->GetNumberRows(); ++i )
140 {
141 DELAY_PROFILE profile = getProfileRow( i );
142 wxString profileName = profile.m_ProfileName;
143
144 for( int j = 0; j < m_viaPropagationGrid->GetNumberRows(); ++j )
145 {
146 if( m_viaPropagationGrid->GetCellValue( j, VIA_GRID_PROFILE_NAME ) == profileName )
147 profile.m_ViaOverrides.emplace_back( getViaRow( j ) );
148 }
149
150 m_timeDomainParameters->AddDelayProfile( std::move( profile ) );
151 }
152
153 return true;
154}
155
156
158{
159 const int rowId = m_tracePropagationGrid->GetNumberRows();
160 m_tracePropagationGrid->AppendRows();
161
162 m_tracePropagationGrid->SetCellValue( rowId, PROFILE_GRID_PROFILE_NAME, aDelayProfile.m_ProfileName );
164
165 for( const auto& [layerId, velocity] : aDelayProfile.m_LayerPropagationDelays )
166 {
167 if( !m_copperLayerIdsToColumns.contains( layerId ) )
168 continue;
169
170 int col = m_copperLayerIdsToColumns[layerId];
171
172 if( col < m_tracePropagationGrid->GetNumberCols() )
173 m_tracePropagationGrid->SetUnitValue( rowId, col, velocity );
174 }
175}
176
177
179{
180 DELAY_PROFILE entry;
183
184 std::map<PCB_LAYER_ID, int> propDelays;
185
186 for( const auto& [layer, col] : m_copperLayerIdsToColumns )
187 propDelays[layer] = m_tracePropagationGrid->GetUnitValue( aRow, col );
188
189 entry.m_LayerPropagationDelays = std::move( propDelays );
190
191 return entry;
192}
193
194
195void PANEL_SETUP_TIME_DOMAIN_PARAMETERS::addViaRow( const wxString& aProfileName,
196 const DELAY_PROFILE_VIA_OVERRIDE_ENTRY& aViaOverrideEntry ) const
197{
198 const int rowId = m_viaPropagationGrid->GetNumberRows();
199 m_viaPropagationGrid->AppendRows();
200 m_viaPropagationGrid->SetCellValue( rowId, VIA_GRID_PROFILE_NAME, aProfileName );
202 m_board->GetLayerName( aViaOverrideEntry.m_SignalLayerFrom ) );
204 m_board->GetLayerName( aViaOverrideEntry.m_SignalLayerTo ) );
205 m_viaPropagationGrid->SetCellValue( rowId, VIA_GRID_VIA_LAYER_FROM,
206 m_board->GetLayerName( aViaOverrideEntry.m_ViaLayerFrom ) );
207 m_viaPropagationGrid->SetCellValue( rowId, VIA_GRID_VIA_LAYER_TO,
208 m_board->GetLayerName( aViaOverrideEntry.m_ViaLayerTo ) );
209 m_viaPropagationGrid->SetUnitValue( rowId, VIA_GRID_DELAY, aViaOverrideEntry.m_Delay );
210}
211
212
214{
215 // Get layer info
216 const wxString signalLayerFrom = m_viaPropagationGrid->GetCellValue( aRow, VIA_GRID_SIGNAL_LAYER_FROM );
217 const wxString signalLayerTo = m_viaPropagationGrid->GetCellValue( aRow, VIA_GRID_SIGNAL_LAYER_TO );
218 const wxString viaLayerFrom = m_viaPropagationGrid->GetCellValue( aRow, VIA_GRID_VIA_LAYER_FROM );
219 const wxString viaLayerTo = m_viaPropagationGrid->GetCellValue( aRow, VIA_GRID_VIA_LAYER_TO );
220 PCB_LAYER_ID signalLayerIdFrom = m_layerNamesToIDs[signalLayerFrom];
221 PCB_LAYER_ID signalLayerIdTo = m_layerNamesToIDs[signalLayerTo];
222 PCB_LAYER_ID viaLayerIdFrom = m_layerNamesToIDs[viaLayerFrom];
223 PCB_LAYER_ID viaLayerIdTo = m_layerNamesToIDs[viaLayerTo];
224
225 // Order layers in stackup order (from F_Cu first)
226 if( IsCopperLayerLowerThan( signalLayerIdFrom, signalLayerIdTo ) )
227 std::swap( signalLayerIdFrom, signalLayerIdTo );
228
229 if( IsCopperLayerLowerThan( viaLayerIdFrom, viaLayerIdTo ) )
230 std::swap( viaLayerIdFrom, viaLayerIdTo );
231
232 const DELAY_PROFILE_VIA_OVERRIDE_ENTRY entry{ signalLayerIdFrom, signalLayerIdTo, viaLayerIdFrom, viaLayerIdTo,
234
235 return entry;
236}
237
238
240{
244 m_layerNames.clear();
245 m_layerNamesToIDs.clear();
246
248
249 for( const auto& layer : LSET::AllCuMask( aNumCopperLayers ).CuStack() )
250 {
251 wxString layerName = m_board->GetLayerName( layer );
252 m_layerNames.emplace_back( layerName );
253 m_layerNamesToIDs[layerName] = layer;
254 m_copperLayerIdsToColumns[layer] = colIdx;
255 m_copperColumnsToLayerId[colIdx] = layer;
256 ++colIdx;
257 }
258
262}
263
264
266{
267 const int minValueWidth = m_tracePropagationGrid->GetTextExtent( wxT( "000.00 ps/mm" ) ).x;
268 const int minNameWidth = m_tracePropagationGrid->GetTextExtent( wxT( "MMMMMMMMMMMM" ) ).x;
269
270 for( int i = 0; i < m_tracePropagationGrid->GetNumberCols(); ++i )
271 {
272 const int titleSize = m_tracePropagationGrid->GetTextExtent( m_tracePropagationGrid->GetColLabelValue( i ) ).x;
273
275 m_tracePropagationGrid->SetColSize( i, std::max( titleSize, minNameWidth ) );
276 else
277 m_tracePropagationGrid->SetColSize( i, std::max( titleSize, minValueWidth ) );
278 }
279
280 for( int i = 0; i < m_viaPropagationGrid->GetNumberCols(); ++i )
281 {
282 const int titleSize = GetTextExtent( m_viaPropagationGrid->GetColLabelValue( i ) ).x;
283 if( i == VIA_GRID_PROFILE_NAME )
284 m_viaPropagationGrid->SetColSize( i, std::max( titleSize, minNameWidth ) );
285 else
286 m_viaPropagationGrid->SetColSize( i, titleSize + 30 );
287 }
288}
289
290
292{
293 const int newCopperLayers = static_cast<int>( m_copperLayerIdsToColumns.size() );
294 const int curCopperLayers = m_tracePropagationGrid->GetNumberCols() - PROFILE_GRID_NUM_REQUIRED_COLS;
295
296 if( newCopperLayers < curCopperLayers )
297 {
298 // TODO: WARN OF DELETING DATA?
299 m_tracePropagationGrid->DeleteCols( curCopperLayers - newCopperLayers + PROFILE_GRID_NUM_REQUIRED_COLS,
300 curCopperLayers - newCopperLayers );
301 }
302 else if( newCopperLayers > curCopperLayers )
303 {
304 m_tracePropagationGrid->AppendCols( newCopperLayers - curCopperLayers );
305 }
306
307 std::vector<int> copperColIds;
308
310 m_unitsProvider->GetUnitsFromType( EDA_DATA_TYPE::LENGTH_DELAY ) );
311 copperColIds.push_back( PROFILE_GRID_VIA_PROP_DELAY );
312
313 for( const auto& [colIdx, layerId] : m_copperColumnsToLayerId )
314 {
315 m_tracePropagationGrid->SetColLabelValue( colIdx, m_board->GetLayerName( layerId ) );
317 m_unitsProvider->GetUnitsFromType( EDA_DATA_TYPE::LENGTH_DELAY ) );
318 copperColIds.push_back( colIdx );
319 }
320
322
324 m_tracePropagationGrid->Refresh();
325}
326
327
329{
330 wxArrayString layerNames;
331 std::ranges::for_each( m_layerNames,
332 [&layerNames]( const wxString& aLayerName )
333 {
334 layerNames.push_back( aLayerName );
335 } );
336
337 // Save the current data
338 std::vector<wxString> currentSignalLayersFrom;
339 std::vector<wxString> currentSignalLayersTo;
340 std::vector<wxString> currentViaLayersFrom;
341 std::vector<wxString> currentViaLayersTo;
342
343 for( int row = 0; row < m_viaPropagationGrid->GetNumberRows(); ++row )
344 {
345 currentSignalLayersFrom.emplace_back( m_viaPropagationGrid->GetCellValue( row, VIA_GRID_SIGNAL_LAYER_FROM ) );
346 currentSignalLayersTo.emplace_back( m_viaPropagationGrid->GetCellValue( row, VIA_GRID_SIGNAL_LAYER_TO ) );
347 currentViaLayersFrom.emplace_back( m_viaPropagationGrid->GetCellValue( row, VIA_GRID_VIA_LAYER_FROM ) );
348 currentViaLayersTo.emplace_back( m_viaPropagationGrid->GetCellValue( row, VIA_GRID_VIA_LAYER_TO ) );
349 }
350
351 // Reset the via layers lists
352 wxGridCellAttr* attr = new wxGridCellAttr;
353 attr->SetEditor( new wxGridCellChoiceEditor( layerNames, false ) );
355
356 attr = new wxGridCellAttr;
357 attr->SetEditor( new wxGridCellChoiceEditor( layerNames, false ) );
359
360 attr = new wxGridCellAttr;
361 attr->SetEditor( new wxGridCellChoiceEditor( layerNames, false ) );
363
364 attr = new wxGridCellAttr;
365 attr->SetEditor( new wxGridCellChoiceEditor( layerNames, false ) );
366 m_viaPropagationGrid->SetColAttr( VIA_GRID_VIA_LAYER_TO, attr );
367
368 // Restore the data, changing or resetting layer names if required
369 for( int row = 0; row < m_viaPropagationGrid->GetNumberRows(); ++row )
370 {
371 const PCB_LAYER_ID lastSignalFromId = m_prevLayerNamesToIDs[currentSignalLayersFrom[row]];
372
373 if( m_copperLayerIdsToColumns.contains( lastSignalFromId ) )
375 m_board->GetLayerName( lastSignalFromId ) );
376 else
377 m_viaPropagationGrid->SetCellValue( row, VIA_GRID_SIGNAL_LAYER_FROM, m_layerNames.front() );
378
379 const PCB_LAYER_ID lastSignalToId = m_prevLayerNamesToIDs[currentSignalLayersTo[row]];
380
381 if( m_copperLayerIdsToColumns.contains( lastSignalToId ) )
383 m_board->GetLayerName( lastSignalToId ) );
384 else
385 m_viaPropagationGrid->SetCellValue( row, VIA_GRID_SIGNAL_LAYER_TO, m_layerNames.back() );
386
387 const PCB_LAYER_ID lastViaFromId = m_prevLayerNamesToIDs[currentViaLayersFrom[row]];
388
389 if( m_copperLayerIdsToColumns.contains( lastViaFromId ) )
390 m_viaPropagationGrid->SetCellValue( row, VIA_GRID_VIA_LAYER_FROM, m_board->GetLayerName( lastViaFromId ) );
391 else
392 m_viaPropagationGrid->SetCellValue( row, VIA_GRID_VIA_LAYER_FROM, m_layerNames.front() );
393
394 const PCB_LAYER_ID lastViaToId = m_prevLayerNamesToIDs[currentViaLayersTo[row]];
395
396 if( m_copperLayerIdsToColumns.contains( lastViaToId ) )
397 m_viaPropagationGrid->SetCellValue( row, VIA_GRID_VIA_LAYER_TO, m_board->GetLayerName( lastViaToId ) );
398 else
399 m_viaPropagationGrid->SetCellValue( row, VIA_GRID_VIA_LAYER_TO, m_layerNames.back() );
400 }
401}
402
403
405{
407 [&]() -> std::pair<int, int>
408 {
409 const int row = m_tracePropagationGrid->GetNumberRows();
410 m_tracePropagationGrid->AppendRows();
411 m_tracePropagationGrid->SetCellValue( row, PROFILE_GRID_PROFILE_NAME, "" );
412
413 for( int i = PROFILE_GRID_VIA_PROP_DELAY; i < m_tracePropagationGrid->GetNumberCols(); ++i )
415
416 return { row, PROFILE_GRID_PROFILE_NAME };
417 } );
418}
419
420
422{
424 [&]( int row )
425 {
426 wxString profileName = getProfileNameForProfileGridRow( row );
427
428 // Delete associated via overrides
429 for( int viaRow = m_viaPropagationGrid->GetNumberRows() - 1; viaRow >= 0; --viaRow )
430 {
431 if( m_viaPropagationGrid->GetCellValue( viaRow, VIA_GRID_PROFILE_NAME ) == profileName )
432 m_viaPropagationGrid->DeleteRows( viaRow, 1 );
433 }
434
435 // Delete tuning profile
436 m_tracePropagationGrid->DeleteRows( row, 1 );
437
439 } );
440}
441
442
444{
446 [&]() -> std::pair<int, int>
447 {
448 const int row = m_viaPropagationGrid->GetNumberRows();
449
450 // Check we have delay profiles to override
451 if( m_tracePropagationGrid->GetNumberRows() == 0 )
452 {
453 PAGED_DIALOG::GetDialog( this )->SetError( _( "No delay profiles to override" ), this, nullptr );
454 return { row, -1 };
455 }
456
457 m_viaPropagationGrid->AppendRows();
459 m_viaPropagationGrid->SetCellValue( row, VIA_GRID_SIGNAL_LAYER_FROM, m_layerNames.front() );
460 m_viaPropagationGrid->SetCellValue( row, VIA_GRID_SIGNAL_LAYER_TO, m_layerNames.back() );
461 m_viaPropagationGrid->SetCellValue( row, VIA_GRID_VIA_LAYER_FROM, m_layerNames.front() );
462 m_viaPropagationGrid->SetCellValue( row, VIA_GRID_VIA_LAYER_TO, m_layerNames.back() );
464
465 return { row, VIA_GRID_DELAY };
466 } );
467}
468
469
471{
473 [&]( int row )
474 {
475 m_viaPropagationGrid->DeleteRows( row, 1 );
476 } );
477}
478
479
481{
482 if( event.GetCol() == PROFILE_GRID_PROFILE_NAME )
483 {
484 if( validateDelayProfileName( event.GetRow(), event.GetString() ) )
485 {
486 const wxString oldName = getProfileNameForProfileGridRow( event.GetRow() );
487 wxString newName = event.GetString();
488 newName.Trim( true ).Trim( false );
489
490 if( !oldName.IsEmpty() )
491 {
492 wxWindowUpdateLocker updateLocker( m_viaPropagationGrid );
493
494 updateViaProfileNamesEditor( oldName, newName );
495
496 // Update changed profile names
497 for( int row = 0; row < m_viaPropagationGrid->GetNumberRows(); ++row )
498 {
499 if( m_viaPropagationGrid->GetCellValue( row, VIA_GRID_PROFILE_NAME ) == oldName )
500 m_viaPropagationGrid->SetCellValue( row, VIA_GRID_PROFILE_NAME, newName );
501 }
502 }
503 else
504 {
505 updateViaProfileNamesEditor( oldName, newName );
506 }
507 }
508 else
509 {
510 event.Veto();
511 }
512 }
513}
514
515
517 const wxString& aNewName ) const
518{
519 wxArrayString profileNames;
520
521 for( int i = 0; i < m_tracePropagationGrid->GetNumberRows(); ++i )
522 {
523 wxString profileName = getProfileNameForProfileGridRow( i );
524
525 if( profileName == aOldName )
526 profileName = aNewName;
527
528 profileNames.push_back( profileName );
529 }
530
531 std::ranges::sort( profileNames,
532 []( const wxString& a, const wxString& b )
533 {
534 return a.CmpNoCase( b ) < 0;
535 } );
536
537 wxGridCellAttr* attr = new wxGridCellAttr;
538 attr->SetEditor( new wxGridCellChoiceEditor( profileNames, false ) );
539 m_viaPropagationGrid->SetColAttr( VIA_GRID_PROFILE_NAME, attr );
540}
541
542
543bool PANEL_SETUP_TIME_DOMAIN_PARAMETERS::validateDelayProfileName( int aRow, const wxString& aName, bool focusFirst )
544{
545 wxString tmp = aName;
546 tmp.Trim( true );
547 tmp.Trim( false );
548
549 if( tmp.IsEmpty() )
550 {
551 const wxString msg = _( "Tuning profile must have a name" );
553 return false;
554 }
555
556 for( int ii = 0; ii < m_tracePropagationGrid->GetNumberRows(); ii++ )
557 {
558 if( ii != aRow && getProfileNameForProfileGridRow( ii ).CmpNoCase( tmp ) == 0 )
559 {
560 const wxString msg = _( "Tuning profile name already in use" );
561 PAGED_DIALOG::GetDialog( this )->SetError( msg, this, m_tracePropagationGrid, focusFirst ? aRow : ii,
563 return false;
564 }
565 }
566
567 return true;
568}
569
570
572{
574 return false;
575
576 // Test delay profile parameters
577 for( int row = 0; row < m_tracePropagationGrid->GetNumberRows(); row++ )
578 {
579 const wxString profileName = getProfileNameForProfileGridRow( row );
580
581 if( !validateDelayProfileName( row, profileName, false ) )
582 return false;
583 }
584
585 // Test via override parameters
586 if( !validateViaRows() )
587 return false;
588
589 return true;
590}
591
592
594{
595 std::map<wxString, std::set<DELAY_PROFILE_VIA_OVERRIDE_ENTRY>> rowCache;
596
597 for( int row = 0; row < m_viaPropagationGrid->GetNumberRows(); row++ )
598 {
600 const wxString profileName = m_viaPropagationGrid->GetCellValue( row, VIA_GRID_PROFILE_NAME );
601 std::set<DELAY_PROFILE_VIA_OVERRIDE_ENTRY>& viaOverrides = rowCache[profileName];
602
603 if( viaOverrides.contains( entry ) )
604 {
605 const wxString msg = _( "Via override configuration is duplicated" );
607 return false;
608 }
609 else
610 {
611 viaOverrides.insert( entry );
612 }
613 }
614
615 return true;
616}
617
618
620{
621 std::vector<wxString> profileNames;
622
623 for( int i = 0; i < m_tracePropagationGrid->GetNumberRows(); i++ )
624 {
625 const wxString profileName = getProfileNameForProfileGridRow( i );
626 profileNames.emplace_back( profileName );
627 }
628
629 std::ranges::sort( profileNames,
630 []( const wxString& a, const wxString& b )
631 {
632 return a.CmpNoCase( b ) < 0;
633 } );
634
635 return profileNames;
636}
637
638
640 const std::shared_ptr<TIME_DOMAIN_PARAMETERS>& aOtherParameters )
641{
642 std::shared_ptr<TIME_DOMAIN_PARAMETERS> savedParameters = m_timeDomainParameters;
643
644 m_timeDomainParameters = aOtherParameters;
646
648
649 m_viaPropagationGrid->ForceRefresh();
650
651 m_timeDomainParameters = std::move( savedParameters );
652}
653
654
656{
657 wxString profileName = m_tracePropagationGrid->GetCellValue( aRow, PROFILE_GRID_PROFILE_NAME );
658 profileName.Trim( true ).Trim( false );
659 return profileName;
660}
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:112
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
Definition: bitmap.cpp:110
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:317
int GetCopperLayerCount() const
Definition: board.cpp:859
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:680
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.
Definition: grid_tricks.h:61
static LSET AllCuMask()
return AllCuMask( MAX_CU_LAYERS );
Definition: lset.cpp:591
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_TIME_DOMAIN_PARAMETERS_BASE.
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.
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)
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.
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.
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.
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.
void SetBitmap(const wxBitmapBundle &aBmp)
EDA_UNITS GetUserUnits() const
void SetAutoEvalColUnits(int col, EDA_UNITS aUnit, EDA_DATA_TYPE aUnitType)
Set the unit and unit data type to use for a given column.
Definition: wx_grid.cpp:841
void SetUnitValue(int aRow, int aCol, int aValue)
Set a unitized cell's value.
Definition: wx_grid.cpp:890
int GetUnitValue(int aRow, int aCol)
Apply standard KiCad unit and eval services to a numeric cell.
Definition: wx_grid.cpp:854
void EnsureColLabelsVisible()
Ensure the height of the row displaying the column labels is enough, even if labels are multiline tex...
Definition: wx_grid.cpp:956
void OnDeleteRows(const std::function< void(int row)> &aDeleter)
Handles a row deletion event.
Definition: wx_grid.cpp:704
void OnAddRow(const std::function< std::pair< int, int >()> &aAdder)
Definition: wx_grid.cpp:684
void SetAutoEvalCols(const std::vector< int > &aCols)
Definition: wx_grid.h:145
void SetUnitsProvider(UNITS_PROVIDER *aProvider, int aCol=0)
Set a EUNITS_PROVIDER to enable use of unit- and eval-based Getters.
Definition: wx_grid.cpp:832
void ClearRows()
wxWidgets recently added an ASSERT which fires if the position is greater than or equal to the number...
Definition: wx_grid.h:220
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:632
void SetBorders(bool aLeft, bool aRight, bool aTop, bool aBottom)
Definition: wx_panel.h:39
#define _(s)
bool IsCopperLayerLowerThan(PCB_LAYER_ID aLayerA, PCB_LAYER_ID aLayerB)
Return true if copper aLayerA is placed lower than aLayerB, false otherwise.
Definition: layer_ids.h:811
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:60
STL namespace.
BOARD * GetBoard()
see class PGM_BASE
Represents a single line in the time domain configuration via overrides configuration grid.
PCB_LAYER_ID m_SignalLayerFrom
PCB_LAYER_ID m_ViaLayerFrom
int m_Delay
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