From 1e88695001a9096563e7a392e8e5e7b666b8818e Mon Sep 17 00:00:00 2001 From: Bernhard Stegmaier Date: Tue, 5 Dec 2017 13:51:09 +0100 Subject: [PATCH] Fix initial sizing of 'Fields' table columns in component table view. --- eeschema/dialogs/dialog_bom_editor.cpp | 34 +++++++------------------- 1 file changed, 9 insertions(+), 25 deletions(-) diff --git a/eeschema/dialogs/dialog_bom_editor.cpp b/eeschema/dialogs/dialog_bom_editor.cpp index 92fca290cb..75a999af9b 100644 --- a/eeschema/dialogs/dialog_bom_editor.cpp +++ b/eeschema/dialogs/dialog_bom_editor.cpp @@ -54,9 +54,6 @@ DIALOG_BOM_EDITOR::DIALOG_BOM_EDITOR( SCH_EDIT_FRAME* parent ) : { m_bom = BOM_TABLE_MODEL::Create(); - m_columnListCtrl->DeleteAllItems(); - m_columnListCtrl->ClearColumns(); - auto nameColumn = m_columnListCtrl->AppendTextColumn( _( "Field" ) ); auto showColumn = m_columnListCtrl->AppendToggleColumn( @@ -70,23 +67,6 @@ DIALOG_BOM_EDITOR::DIALOG_BOM_EDITOR( SCH_EDIT_FRAME* parent ) : 100 ); - // Resize the columns appropriately - m_columnListCtrl->Update(); - - showColumn->SetWidth( wxCOL_WIDTH_AUTOSIZE ); - showColumn->SetMinWidth( showColumn->GetWidth() ); - showColumn->SetResizeable( false ); - - m_columnListCtrl->Update(); - - nameColumn->SetWidth( wxCOL_WIDTH_AUTOSIZE ); - nameColumn->SetResizeable( true ); - - sortColumn->SetWidth( wxCOL_WIDTH_AUTOSIZE ); - sortColumn->SetResizeable( true ); - - m_columnListCtrl->Update(); - // Read all components LoadComponents(); @@ -95,11 +75,17 @@ DIALOG_BOM_EDITOR::DIALOG_BOM_EDITOR( SCH_EDIT_FRAME* parent ) : m_bom->ReloadTable(); - Update(); + // Set default column widths for fields table + showColumn->SetWidth( wxCOL_WIDTH_AUTOSIZE ); + showColumn->SetResizeable( false ); - m_bomView->Update(); + nameColumn->SetWidth( wxCOL_WIDTH_AUTOSIZE ); + nameColumn->SetResizeable( true ); - // Set default column widths + sortColumn->SetWidth( wxCOL_WIDTH_AUTOSIZE ); + sortColumn->SetResizeable( false ); + + // Set default column widths for BOM table for( unsigned int ii = 0; ii < m_bomView->GetColumnCount(); ii++ ) { auto col = m_bomView->GetColumn( ii ); @@ -112,8 +98,6 @@ DIALOG_BOM_EDITOR::DIALOG_BOM_EDITOR( SCH_EDIT_FRAME* parent ) : } Layout(); - GetSizer()->SetSizeHints( this ); - Centre(); }