Add tooltips to netclass setup panel column headers

Change router tooltips to be more straightforward
This commit is contained in:
Jon Evans
2021-02-11 20:50:26 -05:00
parent 32b12228fc
commit b708fd36ae
5 changed files with 62 additions and 6 deletions
+57 -1
View File
@@ -73,7 +73,8 @@ PANEL_SETUP_NETCLASSES::PANEL_SETUP_NETCLASSES( PAGED_DIALOG* aParent, NETCLASSE
PANEL_SETUP_NETCLASSES_BASE( aParent->GetTreebook() ),
m_Parent( aParent ),
m_netclasses( aNetclasses ),
m_netNames( aNetNames )
m_netNames( aNetNames ),
m_hoveredCol( -1 )
{
if( g_lineStyleIcons.empty() )
{
@@ -177,6 +178,11 @@ PANEL_SETUP_NETCLASSES::PANEL_SETUP_NETCLASSES( PAGED_DIALOG* aParent, NETCLASSE
wxGridEventHandler( PANEL_SETUP_NETCLASSES::OnNetclassGridCellChanging ),
NULL, this );
// Handle tooltips for grid
m_netclassGrid->GetGridColLabelWindow()->Bind( wxEVT_MOTION,
&PANEL_SETUP_NETCLASSES::OnNetclassGridMouseEvent,
this );
m_netclassGrid->EndBatch();
m_membershipGrid->EndBatch();
Thaw();
@@ -441,6 +447,56 @@ void PANEL_SETUP_NETCLASSES::OnNetclassGridCellChanging( wxGridEvent& event )
}
void PANEL_SETUP_NETCLASSES::OnNetclassGridMouseEvent( wxMouseEvent& aEvent )
{
int col = m_netclassGrid->XToCol( aEvent.GetPosition().x );
if( aEvent.Moving() || aEvent.Entering() )
{
aEvent.Skip();
if( col == wxNOT_FOUND )
{
m_netclassGrid->GetGridColLabelWindow()->UnsetToolTip();
return;
}
if( col == m_hoveredCol )
return;
m_hoveredCol = col;
wxString tip;
switch( col )
{
case GRID_CLEARANCE: tip = _( "Minimum copper clearance" ); break;
case GRID_TRACKSIZE: tip = _( "Minimum track width" ); break;
case GRID_VIASIZE: tip = _( "Via pad diameter" ); break;
case GRID_VIADRILL: tip = _( "Via plated hole diameter" ); break;
case GRID_uVIASIZE: tip = _( "Microvia pad diameter" ); break;
case GRID_uVIADRILL: tip = _( "Microvia plated hole diameter" ); break;
case GRID_DIFF_PAIR_WIDTH: tip = _( "Differential pair track width" ); break;
case GRID_DIFF_PAIR_GAP: tip = _( "Differential pair gap" ); break;
case GRID_WIREWIDTH: tip = _( "Schematic wire thickness" ); break;
case GRID_BUSWIDTH: tip = _( "Bus wire thickness" ); break;
case GRID_SCHEMATIC_COLOR: tip = _( "Schematic wire color" ); break;
case GRID_LINESTYLE: tip = _( "Schematic wire line style" ); break;
}
m_netclassGrid->GetGridColLabelWindow()->UnsetToolTip();
m_netclassGrid->GetGridColLabelWindow()->SetToolTip( tip );
}
else if( aEvent.Leaving() )
{
m_netclassGrid->GetGridColLabelWindow()->UnsetToolTip();
aEvent.Skip();
}
aEvent.Skip();
}
void PANEL_SETUP_NETCLASSES::OnAddNetclassClick( wxCommandEvent& event )
{
if( !m_netclassGrid->CommitPendingChanges() )