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:49:51 -05:00
parent 32b12228fc
commit b708fd36ae
5 changed files with 62 additions and 6 deletions

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() )

View File

@ -62,8 +62,6 @@ PANEL_SETUP_NETCLASSES_BASE::PANEL_SETUP_NETCLASSES_BASE( wxWindow* parent, wxWi
// Cell Defaults
m_netclassGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
m_netclassGrid->SetToolTip( _("Net Class parameters") );
sbSizerUpper->Add( m_netclassGrid, 1, wxEXPAND, 5 );
wxBoxSizer* buttonBoxSizer;

View File

@ -209,7 +209,7 @@
<property name="size"></property>
<property name="subclass">WX_GRID; widgets/wx_grid.h; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Net Class parameters</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxBORDER_DEFAULT|wxHSCROLL|wxTAB_TRAVERSAL|wxVSCROLL</property>

View File

@ -42,6 +42,7 @@ private:
int* m_originalColWidths;
bool m_netclassesDirty; // The netclass drop-down menus need rebuilding
wxSize m_membershipSize; // The size needed to show the membership list
int m_hoveredCol; // Column being hovered over, for tooltips
private:
void OnAddNetclassClick( wxCommandEvent& event ) override;
@ -51,6 +52,7 @@ private:
void onmembershipPanelSize( wxSizeEvent& event ) override;
void OnUpdateUI( wxUpdateUIEvent &event ) override;
void OnNetclassGridCellChanging( wxGridEvent& event );
void OnNetclassGridMouseEvent( wxMouseEvent& event );
void OnShowAll( wxCommandEvent& event ) override { doApplyFilters( true ); }
void OnApplyFilters( wxCommandEvent& event ) override { doApplyFilters( false ); }
void OnAssignAll( wxCommandEvent& event ) override { doAssignments( true ); }

View File

@ -1237,14 +1237,14 @@ TOOL_ACTION PCB_ACTIONS::autoplaceOffboardComponents( "pcbnew.Autoplacer.autopla
TOOL_ACTION PCB_ACTIONS::routeSingleTrack( "pcbnew.InteractiveRouter.SingleTrack",
AS_GLOBAL,
'X', LEGACY_HK_NAME( "Add New Track" ),
_( "Route Single Track" ), _( "Run push & shove router (single tracks)" ),
_( "Route Single Track" ), _( "Route tracks" ),
add_tracks_xpm, AF_ACTIVATE, (void*) PNS::PNS_MODE_ROUTE_SINGLE );
TOOL_ACTION PCB_ACTIONS::routeDiffPair( "pcbnew.InteractiveRouter.DiffPair",
AS_GLOBAL,
// Don't be tempted to remove "Modern Toolset only". It's in the legacy property name.
'6', LEGACY_HK_NAME( "Route Differential Pair (Modern Toolset only)" ),
_( "Route Differential Pair" ), _( "Run push & shove router (differential pairs)" ),
_( "Route Differential Pair" ), _( "Route differential pairs" ),
ps_diff_pair_xpm, AF_ACTIVATE, (void*) PNS::PNS_MODE_ROUTE_DIFF_PAIR );
TOOL_ACTION PCB_ACTIONS::routerSettingsDialog( "pcbnew.InteractiveRouter.SettingsDialog",