Hack around broken column sizing in wxGTK 3.0 for hotkey editor
Fixes https://gitlab.com/kicad/code/kicad/-/issues/6767 Fixes https://gitlab.com/kicad/code/kicad/-/issues/6396
This commit is contained in:
parent
ec3e0946a0
commit
a7ea63e610
|
@ -449,6 +449,20 @@ WIDGET_HOTKEY_LIST::WIDGET_HOTKEY_LIST( wxWindow* aParent, HOTKEY_STORE& aHotkey
|
||||||
AppendColumn( command_header, 450, wxALIGN_LEFT, wxCOL_RESIZABLE | wxCOL_SORTABLE );
|
AppendColumn( command_header, 450, wxALIGN_LEFT, wxCOL_RESIZABLE | wxCOL_SORTABLE );
|
||||||
AppendColumn( _( "Hotkey" ), 120, wxALIGN_LEFT, wxCOL_RESIZABLE | wxCOL_SORTABLE );
|
AppendColumn( _( "Hotkey" ), 120, wxALIGN_LEFT, wxCOL_RESIZABLE | wxCOL_SORTABLE );
|
||||||
AppendColumn( _( "Description" ), 900, wxALIGN_LEFT, wxCOL_RESIZABLE | wxCOL_SORTABLE );
|
AppendColumn( _( "Description" ), 900, wxALIGN_LEFT, wxCOL_RESIZABLE | wxCOL_SORTABLE );
|
||||||
|
|
||||||
|
|
||||||
|
#if defined( __WXGTK__ ) && !wxCHECK_VERSION( 3, 1, 0 )
|
||||||
|
// Automatic column widths are broken in wxGTK 3.0.x; set min widths to ensure visibility
|
||||||
|
|
||||||
|
wxDataViewCtrl* dv = GetDataView();
|
||||||
|
|
||||||
|
wxString longKey = wxT( "Ctrl+Alt+Shift+X" );
|
||||||
|
int pad = 20;
|
||||||
|
|
||||||
|
dv->GetColumn( 0 )->SetMinWidth( dv->GetMainWindow()->GetTextExtent( command_header ).x + pad );
|
||||||
|
dv->GetColumn( 1 )->SetMinWidth( dv->GetMainWindow()->GetTextExtent( longKey ).x + pad );
|
||||||
|
#endif
|
||||||
|
|
||||||
GetDataView()->SetIndent( 10 );
|
GetDataView()->SetIndent( 10 );
|
||||||
|
|
||||||
if( !m_readOnly )
|
if( !m_readOnly )
|
||||||
|
@ -480,14 +494,7 @@ void WIDGET_HOTKEY_LIST::ResetAllHotkeys( bool aResetToDefault )
|
||||||
m_hk_store.ResetAllHotkeysToOriginal();
|
m_hk_store.ResetAllHotkeysToOriginal();
|
||||||
|
|
||||||
updateFromClientData();
|
updateFromClientData();
|
||||||
|
updateColumnWidths();
|
||||||
wxDataViewColumn* col = GetDataView()->GetColumn( 0 );
|
|
||||||
col->SetWidth( wxCOL_WIDTH_AUTOSIZE );
|
|
||||||
col->SetWidth( col->GetWidth() );
|
|
||||||
|
|
||||||
col = GetDataView()->GetColumn( 1 );
|
|
||||||
col->SetWidth( wxCOL_WIDTH_AUTOSIZE );
|
|
||||||
col->SetWidth( col->GetWidth() );
|
|
||||||
|
|
||||||
Thaw();
|
Thaw();
|
||||||
}
|
}
|
||||||
|
@ -496,16 +503,29 @@ void WIDGET_HOTKEY_LIST::ResetAllHotkeys( bool aResetToDefault )
|
||||||
bool WIDGET_HOTKEY_LIST::TransferDataToControl()
|
bool WIDGET_HOTKEY_LIST::TransferDataToControl()
|
||||||
{
|
{
|
||||||
updateShownItems( "" );
|
updateShownItems( "" );
|
||||||
|
updateColumnWidths();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void WIDGET_HOTKEY_LIST::updateColumnWidths()
|
||||||
|
{
|
||||||
wxDataViewColumn* col = GetDataView()->GetColumn( 0 );
|
wxDataViewColumn* col = GetDataView()->GetColumn( 0 );
|
||||||
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( 1 );
|
col = GetDataView()->GetColumn( 1 );
|
||||||
col->SetWidth( wxCOL_WIDTH_AUTOSIZE );
|
col->SetWidth( wxCOL_WIDTH_AUTOSIZE );
|
||||||
col->SetWidth( col->GetWidth() );
|
col->SetWidth( col->GetWidth() );
|
||||||
|
|
||||||
return true;
|
#if defined( __WXGTK__ ) && !wxCHECK_VERSION( 3, 1, 0 )
|
||||||
|
col->SetResizeable( true );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -173,6 +173,11 @@ private:
|
||||||
*/
|
*/
|
||||||
void changeHotkey( HOTKEY& aHotkey, long aKey );
|
void changeHotkey( HOTKEY& aHotkey, long aKey );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recalculates column widths after model has changed
|
||||||
|
*/
|
||||||
|
void updateColumnWidths();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HOTKEY_STORE& m_hk_store;
|
HOTKEY_STORE& m_hk_store;
|
||||||
bool m_readOnly;
|
bool m_readOnly;
|
||||||
|
|
Loading…
Reference in New Issue