mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-21 00:21:25 +00:00
Make EDA_LIST_DIALOG more hi-dpi friendly
This commit is contained in:
parent
afb61b3b4e
commit
062a813139
@ -32,6 +32,7 @@
|
||||
// wxWidgets spends *far* too long calculating column widths (most of it, believe it or
|
||||
// not, in repeatedly creating/destroying a wxDC to do the measurement in).
|
||||
// Use default column widths instead.
|
||||
// Note, these are "standard DPI" widths
|
||||
static int DEFAULT_SINGLE_COL_WIDTH = 260;
|
||||
static int DEFAULT_COL_WIDTHS[] = { 200, 300 };
|
||||
|
||||
@ -43,6 +44,8 @@ EDA_LIST_DIALOG::EDA_LIST_DIALOG( wxWindow* aParent, const wxString& aTitle,
|
||||
EDA_LIST_DIALOG_BASE( aParent, wxID_ANY, aTitle ),
|
||||
m_sortList( aSortList )
|
||||
{
|
||||
// correct for wxfb not supporting FromDIP
|
||||
m_listBox->SetMinSize( FromDIP( m_listBox->GetMinSize() ) );
|
||||
m_filterBox->SetHint( _( "Filter" ) );
|
||||
|
||||
initDialog( aItemHeaders, aItemList, aPreselectText );
|
||||
@ -98,8 +101,8 @@ void EDA_LIST_DIALOG::initDialog( const wxArrayString& aItemHeaders,
|
||||
m_listBox->InsertColumn( 0, aItemHeaders.Item( 0 ), wxLIST_FORMAT_LEFT,
|
||||
DEFAULT_SINGLE_COL_WIDTH );
|
||||
|
||||
m_listBox->SetMinClientSize( wxSize( DEFAULT_SINGLE_COL_WIDTH, 200 ) );
|
||||
SetMinClientSize( wxSize( DEFAULT_COL_WIDTHS[0], 220 ) );
|
||||
m_listBox->SetMinClientSize( FromDIP( wxSize( DEFAULT_SINGLE_COL_WIDTH, 200 ) ) );
|
||||
SetMinClientSize( FromDIP( wxSize( DEFAULT_COL_WIDTHS[0], 220 ) ) );
|
||||
}
|
||||
else if( aItemHeaders.Count() == 2 )
|
||||
{
|
||||
@ -109,8 +112,8 @@ void EDA_LIST_DIALOG::initDialog( const wxArrayString& aItemHeaders,
|
||||
DEFAULT_COL_WIDTHS[ i ] );
|
||||
}
|
||||
|
||||
m_listBox->SetMinClientSize( wxSize( DEFAULT_COL_WIDTHS[0] * 3, 200 ) );
|
||||
SetMinClientSize( wxSize( DEFAULT_COL_WIDTHS[0] * 2, 220 ) );
|
||||
m_listBox->SetMinClientSize( FromDIP( wxSize( DEFAULT_COL_WIDTHS[0] * 3, 200 ) ) );
|
||||
SetMinClientSize( FromDIP( wxSize( DEFAULT_COL_WIDTHS[0] * 2, 220 ) ) );
|
||||
}
|
||||
|
||||
m_itemsList = aItemList;
|
||||
@ -126,7 +129,7 @@ void EDA_LIST_DIALOG::initDialog( const wxArrayString& aItemHeaders,
|
||||
|
||||
// Set to a small size so EnsureVisible() won't be foiled by later additions.
|
||||
// ListBox will expand to fit later.
|
||||
m_listBox->SetSize( m_listBox->GetSize().GetX(), 100 );
|
||||
m_listBox->SetSize( m_listBox->GetSize().GetX(), FromDIP( 100 ) );
|
||||
m_listBox->EnsureVisible( sel );
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user