Patch annoying large checkbox cols in wxWidgets 3.1.x on OSX.
This commit is contained in:
parent
5479514819
commit
ded611aed5
|
@ -737,6 +737,7 @@ DIALOG_SYMBOL_FIELDS_TABLE::DIALOG_SYMBOL_FIELDS_TABLE( SCH_EDIT_FRAME* parent )
|
||||||
m_parent( parent )
|
m_parent( parent )
|
||||||
{
|
{
|
||||||
wxSize defaultDlgSize = ConvertDialogToPixels( wxSize( 600, 300 ) );
|
wxSize defaultDlgSize = ConvertDialogToPixels( wxSize( 600, 300 ) );
|
||||||
|
int nameColWidthMargin = 44;
|
||||||
|
|
||||||
// Get all symbols from the list of schematic sheets
|
// Get all symbols from the list of schematic sheets
|
||||||
m_parent->Schematic().GetSheets().GetSymbols( m_symbolsList, false );
|
m_parent->Schematic().GetSheets().GetSymbols( m_symbolsList, false );
|
||||||
|
@ -785,6 +786,8 @@ DIALOG_SYMBOL_FIELDS_TABLE::DIALOG_SYMBOL_FIELDS_TABLE( SCH_EDIT_FRAME* parent )
|
||||||
nameColWidth = std::max( nameColWidth, KIUI::GetTextSize( fieldName, m_fieldsCtrl ).x );
|
nameColWidth = std::max( nameColWidth, KIUI::GetTextSize( fieldName, m_fieldsCtrl ).x );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nameColWidth += nameColWidthMargin;
|
||||||
|
|
||||||
int fieldsMinWidth = nameColWidth + m_groupByColWidth + m_showColWidth;
|
int fieldsMinWidth = nameColWidth + m_groupByColWidth + m_showColWidth;
|
||||||
|
|
||||||
m_fieldsCtrl->GetColumn( DISPLAY_NAME_COLUMN )->SetWidth( nameColWidth );
|
m_fieldsCtrl->GetColumn( DISPLAY_NAME_COLUMN )->SetWidth( nameColWidth );
|
||||||
|
@ -798,6 +801,7 @@ DIALOG_SYMBOL_FIELDS_TABLE::DIALOG_SYMBOL_FIELDS_TABLE( SCH_EDIT_FRAME* parent )
|
||||||
m_dataModel->RebuildRows( m_filter, m_groupSymbolsBox, m_fieldsCtrl );
|
m_dataModel->RebuildRows( m_filter, m_groupSymbolsBox, m_fieldsCtrl );
|
||||||
m_dataModel->Sort( 0, true );
|
m_dataModel->Sort( 0, true );
|
||||||
|
|
||||||
|
m_grid->UseNativeColHeader( true );
|
||||||
m_grid->SetTable( m_dataModel, true );
|
m_grid->SetTable( m_dataModel, true );
|
||||||
|
|
||||||
// must be done after SetTable(), which appears to re-set it
|
// must be done after SetTable(), which appears to re-set it
|
||||||
|
@ -1303,14 +1307,12 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnTableItemContextMenu( wxGridEvent& event )
|
||||||
|
|
||||||
void DIALOG_SYMBOL_FIELDS_TABLE::OnSizeFieldList( wxSizeEvent& event )
|
void DIALOG_SYMBOL_FIELDS_TABLE::OnSizeFieldList( wxSizeEvent& event )
|
||||||
{
|
{
|
||||||
#ifdef __WXMAC__
|
|
||||||
// I'm not sure why KIPLATFORM::UI::GetUnobscuredSize() doesn't give us the correct size
|
|
||||||
// on Mac, but I do know the old code worked.
|
|
||||||
int nameColWidth = event.GetSize().GetX() - wxSystemSettings::GetMetric( wxSYS_VSCROLL_X );
|
|
||||||
#else
|
|
||||||
int nameColWidth = KIPLATFORM::UI::GetUnobscuredSize( m_fieldsCtrl ).x;
|
int nameColWidth = KIPLATFORM::UI::GetUnobscuredSize( m_fieldsCtrl ).x;
|
||||||
#endif
|
|
||||||
nameColWidth -= m_showColWidth + m_groupByColWidth;
|
nameColWidth -= m_showColWidth + m_groupByColWidth;
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
// TODO: something in wxWidgets 3.1.x makes checkboxes really wide...
|
||||||
|
nameColWidth -= 40;
|
||||||
|
#endif
|
||||||
|
|
||||||
// GTK loses its head and messes these up when resizing the splitter bar:
|
// GTK loses its head and messes these up when resizing the splitter bar:
|
||||||
m_fieldsCtrl->GetColumn( SHOW_FIELD_COLUMN )->SetWidth( m_showColWidth );
|
m_fieldsCtrl->GetColumn( SHOW_FIELD_COLUMN )->SetWidth( m_showColWidth );
|
||||||
|
|
|
@ -27,7 +27,7 @@ DIALOG_SYMBOL_FIELDS_TABLE_BASE::DIALOG_SYMBOL_FIELDS_TABLE_BASE( wxWindow* pare
|
||||||
bLeftSizer = new wxBoxSizer( wxVERTICAL );
|
bLeftSizer = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
m_fieldsCtrl = new wxDataViewListCtrl( m_leftPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
m_fieldsCtrl = new wxDataViewListCtrl( m_leftPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
m_fieldsCtrl->SetMinSize( wxSize( -1,220 ) );
|
m_fieldsCtrl->SetMinSize( wxSize( -1,320 ) );
|
||||||
|
|
||||||
bLeftSizer->Add( m_fieldsCtrl, 1, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 );
|
bLeftSizer->Add( m_fieldsCtrl, 1, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 );
|
||||||
|
|
||||||
|
|
|
@ -194,7 +194,7 @@
|
||||||
<property name="hidden">0</property>
|
<property name="hidden">0</property>
|
||||||
<property name="id">wxID_ANY</property>
|
<property name="id">wxID_ANY</property>
|
||||||
<property name="maximum_size"></property>
|
<property name="maximum_size"></property>
|
||||||
<property name="minimum_size">-1,220</property>
|
<property name="minimum_size">-1,320</property>
|
||||||
<property name="name">m_fieldsCtrl</property>
|
<property name="name">m_fieldsCtrl</property>
|
||||||
<property name="permission">protected</property>
|
<property name="permission">protected</property>
|
||||||
<property name="pos"></property>
|
<property name="pos"></property>
|
||||||
|
|
|
@ -88,17 +88,22 @@ DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* aParent ) :
|
||||||
|
|
||||||
m_messagesPanel->SetFileName( Prj().GetProjectPath() + wxT( "report.txt" ) );
|
m_messagesPanel->SetFileName( Prj().GetProjectPath() + wxT( "report.txt" ) );
|
||||||
|
|
||||||
int order = 0;
|
int order = 0;
|
||||||
LSET plotOnAllLayersSelection = m_plotOpts.GetPlotOnAllLayersSelection();
|
LSET plotOnAllLayersSelection = m_plotOpts.GetPlotOnAllLayersSelection();
|
||||||
wxArrayInt plotAllLayersOrder;
|
wxArrayInt plotAllLayersOrder;
|
||||||
wxArrayString plotAllLayersChoicesStrings;
|
wxArrayString plotAllLayersChoicesStrings;
|
||||||
std::vector<PCB_LAYER_ID> layersIdChoiceList;
|
std::vector<PCB_LAYER_ID> layersIdChoiceList;
|
||||||
|
int textWidth = 0;
|
||||||
|
|
||||||
for( LSEQ seq = board->GetEnabledLayers().UIOrder(); seq; ++seq )
|
for( LSEQ seq = board->GetEnabledLayers().UIOrder(); seq; ++seq )
|
||||||
{
|
{
|
||||||
PCB_LAYER_ID id = *seq;
|
PCB_LAYER_ID id = *seq;
|
||||||
|
wxString layerName = board->GetLayerName( id );
|
||||||
|
|
||||||
plotAllLayersChoicesStrings.Add( board->GetLayerName( id ) );
|
// wxCOL_WIDTH_AUTOSIZE doesn't work on all platforms, so we calculate width here
|
||||||
|
textWidth = std::max( textWidth, KIUI::GetTextSize( layerName, m_layerCheckListBox ).x );
|
||||||
|
|
||||||
|
plotAllLayersChoicesStrings.Add( layerName );
|
||||||
layersIdChoiceList.push_back( id );
|
layersIdChoiceList.push_back( id );
|
||||||
|
|
||||||
size_t size = plotOnAllLayersSelection.size();
|
size_t size = plotOnAllLayersSelection.size();
|
||||||
|
@ -111,14 +116,29 @@ DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* aParent ) :
|
||||||
order += 1;
|
order += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxStaticBoxSizer* sbSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY,
|
int checkColSize = 22;
|
||||||
_("Plot on All Layers") ),
|
int layerColSize = textWidth + 15;
|
||||||
wxVERTICAL );
|
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
// TODO: something in wxWidgets 3.1.x makes checkbox padding really large...
|
||||||
|
int checkColMargins = 40;
|
||||||
|
#else
|
||||||
|
int checkColMargins = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
m_layerCheckListBox->SetMinClientSize( wxSize( checkColSize + checkColMargins + layerColSize,
|
||||||
|
m_layerCheckListBox->GetMinClientSize().y ) );
|
||||||
|
|
||||||
|
wxStaticBox* allLayersLabel = new wxStaticBox( this, wxID_ANY, _( "Plot on All Layers" ) );
|
||||||
|
wxStaticBoxSizer* sbSizer = new wxStaticBoxSizer( allLayersLabel, wxVERTICAL );
|
||||||
|
|
||||||
m_plotAllLayersList = new wxRearrangeList( sbSizer->GetStaticBox(), wxID_ANY,
|
m_plotAllLayersList = new wxRearrangeList( sbSizer->GetStaticBox(), wxID_ANY,
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
plotAllLayersOrder, plotAllLayersChoicesStrings, 0 );
|
plotAllLayersOrder, plotAllLayersChoicesStrings, 0 );
|
||||||
|
|
||||||
|
m_plotAllLayersList->SetMinClientSize( wxSize( checkColSize + checkColMargins + layerColSize,
|
||||||
|
m_plotAllLayersList->GetMinClientSize().y ) );
|
||||||
|
|
||||||
// Attach the LAYER_ID to each item in m_plotAllLayersList
|
// Attach the LAYER_ID to each item in m_plotAllLayersList
|
||||||
// plotAllLayersChoicesStrings and layersIdChoiceList are in the same order,
|
// plotAllLayersChoicesStrings and layersIdChoiceList are in the same order,
|
||||||
// but m_plotAllLayersList has these strings in a different order
|
// but m_plotAllLayersList has these strings in a different order
|
||||||
|
|
|
@ -246,10 +246,18 @@ void ZONE_SETTINGS::SetupLayersList( wxDataViewListCtrl* aList, PCB_BASE_FRAME*
|
||||||
int checkColSize = 22;
|
int checkColSize = 22;
|
||||||
int layerColSize = textWidth + LAYER_BITMAP_SIZE.x + 15;
|
int layerColSize = textWidth + LAYER_BITMAP_SIZE.x + 15;
|
||||||
|
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
// TODO: something in wxWidgets 3.1.x makes checkbox padding really large...
|
||||||
|
int checkColMargins = 40;
|
||||||
|
#else
|
||||||
|
int checkColMargins = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
// You'd think the fact that m_layers is a list would encourage wxWidgets not to save room
|
// You'd think the fact that m_layers is a list would encourage wxWidgets not to save room
|
||||||
// for the tree expanders... but you'd be wrong. Force indent to 0.
|
// for the tree expanders... but you'd be wrong. Force indent to 0.
|
||||||
aList->SetIndent( 0 );
|
aList->SetIndent( 0 );
|
||||||
aList->SetMinClientSize( wxSize( checkColSize + layerColSize, aList->GetMinClientSize().y ) );
|
aList->SetMinClientSize( wxSize( checkColSize + checkColMargins + layerColSize,
|
||||||
|
aList->GetMinClientSize().y ) );
|
||||||
|
|
||||||
checkColumn->SetWidth( checkColSize );
|
checkColumn->SetWidth( checkColSize );
|
||||||
layerColumn->SetWidth( layerColSize );
|
layerColumn->SetWidth( layerColSize );
|
||||||
|
|
Loading…
Reference in New Issue