Clean strings before displaying in hotkeys list.
Also make sure the description column is wide enough. Fixes https://gitlab.com/kicad/code/kicad/issues/11994
This commit is contained in:
parent
2c30a04efc
commit
d9d579c895
|
@ -296,10 +296,15 @@ void WIDGET_HOTKEY_LIST::updateFromClientData()
|
||||||
if( label.IsEmpty() )
|
if( label.IsEmpty() )
|
||||||
label = changed_hk.m_Actions[ 0 ]->GetName();
|
label = changed_hk.m_Actions[ 0 ]->GetName();
|
||||||
|
|
||||||
|
label.Replace( wxT( "..." ), wxEmptyString );
|
||||||
|
|
||||||
// mark unsaved changes
|
// mark unsaved changes
|
||||||
if( changed_hk.m_EditKeycode != changed_hk.m_Actions[ 0 ]->GetHotKey() )
|
if( changed_hk.m_EditKeycode != changed_hk.m_Actions[ 0 ]->GetHotKey() )
|
||||||
label += " *";
|
label += " *";
|
||||||
|
|
||||||
|
description.Replace( wxS( "\n" ), wxS( " " ) );
|
||||||
|
description.Replace( wxS( "\r" ), wxS( " " ) );
|
||||||
|
|
||||||
SetItemText( i, 0, label );
|
SetItemText( i, 0, label );
|
||||||
SetItemText( i, 1, key_text);
|
SetItemText( i, 1, key_text);
|
||||||
SetItemText( i, 2, description );
|
SetItemText( i, 2, description );
|
||||||
|
@ -477,14 +482,15 @@ WIDGET_HOTKEY_LIST::WIDGET_HOTKEY_LIST( wxWindow* aParent, HOTKEY_STORE& aHotkey
|
||||||
wxString longKey = wxT( "Ctrl+Alt+Shift+X" );
|
wxString longKey = wxT( "Ctrl+Alt+Shift+X" );
|
||||||
int pad = 20;
|
int pad = 20;
|
||||||
|
|
||||||
dv->GetColumn( 0 )->SetMinWidth( dv->GetMainWindow()->GetTextExtent( command_header ).x + pad );
|
dv->GetColumn( 0 )->SetMinWidth( aParent->GetTextExtent( command_header ).x * 2 + pad );
|
||||||
dv->GetColumn( 1 )->SetMinWidth( dv->GetMainWindow()->GetTextExtent( longKey ).x + pad );
|
dv->GetColumn( 1 )->SetMinWidth( aParent->GetTextExtent( longKey ).x + pad );
|
||||||
|
dv->GetColumn( 2 )->SetMinWidth( aParent->GetTextExtent( command_header ).x * 5 + pad );
|
||||||
|
|
||||||
CallAfter( [&]()
|
CallAfter( [&]()
|
||||||
{
|
{
|
||||||
GetDataView()->Update();
|
GetDataView()->Update();
|
||||||
} );
|
} );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::vector<wxString> reserved_keys =
|
std::vector<wxString> reserved_keys =
|
||||||
{
|
{
|
||||||
|
@ -492,16 +498,14 @@ WIDGET_HOTKEY_LIST::WIDGET_HOTKEY_LIST( wxWindow* aParent, HOTKEY_STORE& aHotkey
|
||||||
"Ctrl+Shift+Tab"
|
"Ctrl+Shift+Tab"
|
||||||
};
|
};
|
||||||
|
|
||||||
for( auto& key : reserved_keys )
|
for( const wxString& key : reserved_keys )
|
||||||
{
|
{
|
||||||
long code = KeyCodeFromKeyName( key );
|
long code = KeyCodeFromKeyName( key );
|
||||||
|
|
||||||
if( code )
|
if( code )
|
||||||
m_reservedHotkeys[code] = key;
|
m_reservedHotkeys[code] = key;
|
||||||
else
|
else
|
||||||
{
|
|
||||||
wxLogWarning( "Unknown reserved keycode %s\n", key );
|
wxLogWarning( "Unknown reserved keycode %s\n", key );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GetDataView()->SetIndent( 10 );
|
GetDataView()->SetIndent( 10 );
|
||||||
|
@ -564,6 +568,14 @@ void WIDGET_HOTKEY_LIST::updateColumnWidths()
|
||||||
col->SetWidth( wxCOL_WIDTH_AUTOSIZE );
|
col->SetWidth( wxCOL_WIDTH_AUTOSIZE );
|
||||||
col->SetWidth( col->GetWidth() );
|
col->SetWidth( col->GetWidth() );
|
||||||
|
|
||||||
|
#if defined( __WXGTK__ ) && !wxCHECK_VERSION( 3, 1, 0 )
|
||||||
|
col->SetResizeable( true );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
col = GetDataView()->GetColumn( 2 );
|
||||||
|
col->SetWidth( wxCOL_WIDTH_AUTOSIZE );
|
||||||
|
col->SetWidth( col->GetWidth() );
|
||||||
|
|
||||||
#if defined( __WXGTK__ ) && !wxCHECK_VERSION( 3, 1, 0 )
|
#if defined( __WXGTK__ ) && !wxCHECK_VERSION( 3, 1, 0 )
|
||||||
col->SetResizeable( true );
|
col->SetResizeable( true );
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue