Allow user to affect width of field names column.
Without this there's no way to re-adjust the column width when new items are added. Doing more auto-sizing would be another option, but at some point we have to stop trying to be smarter than the user. (And the resize algo already has bugs on Mac causing us to make the column too short for "${ITEM_NUMBER}" for some reason.)
This commit is contained in:
parent
f58c0c370c
commit
a82a007301
|
@ -226,16 +226,20 @@ DIALOG_SYMBOL_FIELDS_TABLE::DIALOG_SYMBOL_FIELDS_TABLE( SCH_EDIT_FRAME* parent )
|
|||
m_fieldNameColWidth = 0;
|
||||
m_labelColWidth = 0;
|
||||
|
||||
int colWidth = 0;
|
||||
|
||||
for( int row = 0; row < m_fieldsCtrl->GetItemCount(); ++row )
|
||||
{
|
||||
const wxString& displayName = m_fieldsCtrl->GetTextValue( row, DISPLAY_NAME_COLUMN );
|
||||
m_fieldNameColWidth =
|
||||
std::max( m_fieldNameColWidth, KIUI::GetTextSize( displayName, m_fieldsCtrl ).x );
|
||||
colWidth = std::max( colWidth, KIUI::GetTextSize( displayName, m_fieldsCtrl ).x );
|
||||
|
||||
const wxString& label = m_fieldsCtrl->GetTextValue( row, LABEL_COLUMN );
|
||||
m_labelColWidth = std::max( m_labelColWidth, KIUI::GetTextSize( label, m_fieldsCtrl ).x );
|
||||
colWidth = std::max( colWidth, KIUI::GetTextSize( label, m_fieldsCtrl ).x );
|
||||
}
|
||||
|
||||
m_fieldNameColWidth = colWidth + 20;
|
||||
m_labelColWidth = colWidth + 20;
|
||||
|
||||
int fieldsMinWidth = m_fieldNameColWidth + m_labelColWidth + m_groupByColWidth + m_showColWidth;
|
||||
|
||||
m_fieldsCtrl->GetColumn( DISPLAY_NAME_COLUMN )->SetWidth( m_fieldNameColWidth );
|
||||
|
@ -254,8 +258,8 @@ DIALOG_SYMBOL_FIELDS_TABLE::DIALOG_SYMBOL_FIELDS_TABLE( SCH_EDIT_FRAME* parent )
|
|||
m_grid->SetSelectionMode( wxGrid::wxGridSelectCells );
|
||||
|
||||
// add Cut, Copy, and Paste to wxGrid
|
||||
m_grid->PushEventHandler(
|
||||
new FIELDS_EDITOR_GRID_TRICKS( this, m_grid, m_fieldsCtrl, m_dataModel ) );
|
||||
m_grid->PushEventHandler( new FIELDS_EDITOR_GRID_TRICKS( this, m_grid, m_fieldsCtrl,
|
||||
m_dataModel ) );
|
||||
|
||||
// give a bit more room for comboboxes
|
||||
m_grid->SetDefaultRowSize( m_grid->GetDefaultRowSize() + 4 );
|
||||
|
@ -1084,15 +1088,19 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnTableItemContextMenu( wxGridEvent& event )
|
|||
|
||||
void DIALOG_SYMBOL_FIELDS_TABLE::OnSizeFieldList( wxSizeEvent& event )
|
||||
{
|
||||
m_labelColWidth = KIPLATFORM::UI::GetUnobscuredSize( m_fieldsCtrl ).x;
|
||||
m_labelColWidth -= m_fieldNameColWidth + m_showColWidth + m_groupByColWidth;
|
||||
int width = KIPLATFORM::UI::GetUnobscuredSize( m_fieldsCtrl ).x
|
||||
- m_showColWidth
|
||||
- m_groupByColWidth;
|
||||
#ifdef __WXMAC__
|
||||
// TODO: something in wxWidgets 3.1.x pads checkbox columns with extra space. (It used to
|
||||
// also be that the width of the column would get set too wide (to 30), but that's patched in
|
||||
// our local wxWidgets fork.)
|
||||
m_labelColWidth -= 50;
|
||||
width -= 50;
|
||||
#endif
|
||||
|
||||
m_fieldNameColWidth = width / 2;
|
||||
m_labelColWidth = width = m_fieldNameColWidth;
|
||||
|
||||
// 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( GROUP_BY_COLUMN )->SetWidth( m_groupByColWidth );
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
|
@ -35,7 +35,7 @@ DIALOG_SYMBOL_FIELDS_TABLE_BASE::DIALOG_SYMBOL_FIELDS_TABLE_BASE( wxWindow* pare
|
|||
m_fieldsCtrl = new wxDataViewListCtrl( m_leftPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_fieldsCtrl->SetMinSize( wxSize( -1,320 ) );
|
||||
|
||||
bLeftSizer->Add( m_fieldsCtrl, 1, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 );
|
||||
bLeftSizer->Add( m_fieldsCtrl, 1, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 );
|
||||
|
||||
wxBoxSizer* bFieldsButtons;
|
||||
bFieldsButtons = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
@ -53,7 +53,7 @@ DIALOG_SYMBOL_FIELDS_TABLE_BASE::DIALOG_SYMBOL_FIELDS_TABLE_BASE( wxWindow* pare
|
|||
bFieldsButtons->Add( m_removeFieldButton, 0, wxBOTTOM|wxLEFT, 5 );
|
||||
|
||||
|
||||
bLeftSizer->Add( bFieldsButtons, 0, wxEXPAND|wxRIGHT, 5 );
|
||||
bLeftSizer->Add( bFieldsButtons, 0, wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bPresets;
|
||||
bPresets = new wxBoxSizer( wxVERTICAL );
|
||||
|
@ -72,7 +72,7 @@ DIALOG_SYMBOL_FIELDS_TABLE_BASE::DIALOG_SYMBOL_FIELDS_TABLE_BASE( wxWindow* pare
|
|||
bPresets->Add( m_cbBomPresets, 0, wxEXPAND|wxTOP|wxLEFT, 4 );
|
||||
|
||||
|
||||
bLeftSizer->Add( bPresets, 0, wxBOTTOM|wxEXPAND|wxRIGHT|wxTOP, 5 );
|
||||
bLeftSizer->Add( bPresets, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
|
||||
|
||||
|
||||
m_leftPanel->SetSizer( bLeftSizer );
|
||||
|
@ -124,7 +124,7 @@ DIALOG_SYMBOL_FIELDS_TABLE_BASE::DIALOG_SYMBOL_FIELDS_TABLE_BASE( wxWindow* pare
|
|||
bControls->Add( m_bRefresh, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
||||
|
||||
|
||||
bRightSizer->Add( bControls, 0, wxEXPAND|wxLEFT, 5 );
|
||||
bRightSizer->Add( bControls, 0, wxEXPAND, 5 );
|
||||
|
||||
m_grid = new WX_GRID( m_rightPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
|
||||
|
@ -138,7 +138,7 @@ DIALOG_SYMBOL_FIELDS_TABLE_BASE::DIALOG_SYMBOL_FIELDS_TABLE_BASE( wxWindow* pare
|
|||
// Columns
|
||||
m_grid->EnableDragColMove( true );
|
||||
m_grid->EnableDragColSize( true );
|
||||
m_grid->SetColLabelSize( 20 );
|
||||
m_grid->SetColLabelSize( 24 );
|
||||
m_grid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
|
||||
|
||||
// Rows
|
||||
|
@ -152,7 +152,7 @@ DIALOG_SYMBOL_FIELDS_TABLE_BASE::DIALOG_SYMBOL_FIELDS_TABLE_BASE( wxWindow* pare
|
|||
m_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_CENTER );
|
||||
m_grid->SetMinSize( wxSize( 600,240 ) );
|
||||
|
||||
bRightSizer->Add( m_grid, 1, wxEXPAND|wxLEFT|wxRIGHT, 5 );
|
||||
bRightSizer->Add( m_grid, 1, wxEXPAND|wxRIGHT, 5 );
|
||||
|
||||
|
||||
bRightSizer->Add( 0, 4, 0, wxEXPAND, 5 );
|
||||
|
@ -192,7 +192,7 @@ DIALOG_SYMBOL_FIELDS_TABLE_BASE::DIALOG_SYMBOL_FIELDS_TABLE_BASE( wxWindow* pare
|
|||
bSizer12->Add( m_radioOff, 0, wxALIGN_CENTER_VERTICAL, 8 );
|
||||
|
||||
|
||||
bRightSizer->Add( bSizer12, 0, wxEXPAND|wxLEFT|wxRIGHT, 5 );
|
||||
bRightSizer->Add( bSizer12, 0, wxEXPAND|wxRIGHT, 5 );
|
||||
|
||||
|
||||
m_rightPanel->SetSizer( bRightSizer );
|
||||
|
@ -205,7 +205,7 @@ DIALOG_SYMBOL_FIELDS_TABLE_BASE::DIALOG_SYMBOL_FIELDS_TABLE_BASE( wxWindow* pare
|
|||
m_panelEdit->SetSizer( bEditSizer );
|
||||
m_panelEdit->Layout();
|
||||
bEditSizer->Fit( m_panelEdit );
|
||||
m_nbPages->AddPage( m_panelEdit, _("Edit"), true );
|
||||
m_nbPages->AddPage( m_panelEdit, _("Edit"), false );
|
||||
m_panelExport = new wxPanel( m_nbPages, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxGridBagSizer* gbExport;
|
||||
gbExport = new wxGridBagSizer( 0, 5 );
|
||||
|
@ -274,7 +274,7 @@ DIALOG_SYMBOL_FIELDS_TABLE_BASE::DIALOG_SYMBOL_FIELDS_TABLE_BASE( wxWindow* pare
|
|||
gbExportOptions->Add( m_cbBomFmtPresets, wxGBPosition( 9, 0 ), wxGBSpan( 1, 2 ), wxEXPAND, 5 );
|
||||
|
||||
|
||||
gbExport->Add( gbExportOptions, wxGBPosition( 0, 0 ), wxGBSpan( 3, 1 ), wxEXPAND|wxALL, 5 );
|
||||
gbExport->Add( gbExportOptions, wxGBPosition( 0, 0 ), wxGBSpan( 3, 1 ), wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
wxBoxSizer* bOutputDirectory;
|
||||
bOutputDirectory = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
@ -324,7 +324,7 @@ DIALOG_SYMBOL_FIELDS_TABLE_BASE::DIALOG_SYMBOL_FIELDS_TABLE_BASE( wxWindow* pare
|
|||
m_panelExport->SetSizer( gbExport );
|
||||
m_panelExport->Layout();
|
||||
gbExport->Fit( m_panelExport );
|
||||
m_nbPages->AddPage( m_panelExport, _("Export"), false );
|
||||
m_nbPages->AddPage( m_panelExport, _("Export"), true );
|
||||
|
||||
bMainSizer->Add( m_nbPages, 1, wxEXPAND | wxALL, 5 );
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@
|
|||
<object class="notebookpage" expanded="1">
|
||||
<property name="bitmap"></property>
|
||||
<property name="label">Edit</property>
|
||||
<property name="select">1</property>
|
||||
<property name="select">0</property>
|
||||
<object class="wxPanel" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
|
@ -300,7 +300,7 @@
|
|||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT|wxTOP</property>
|
||||
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM|wxLEFT</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxDataViewListCtrl" expanded="0">
|
||||
<property name="bg"></property>
|
||||
|
@ -330,7 +330,7 @@
|
|||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxRIGHT</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
|
@ -573,7 +573,7 @@
|
|||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM|wxEXPAND|wxRIGHT|wxTOP</property>
|
||||
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
|
@ -827,7 +827,7 @@
|
|||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxLEFT</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
|
@ -1328,7 +1328,7 @@
|
|||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxLEFT|wxRIGHT</property>
|
||||
<property name="flag">wxEXPAND|wxRIGHT</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxGrid" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
|
@ -1353,7 +1353,7 @@
|
|||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="col_label_horiz_alignment">wxALIGN_CENTER</property>
|
||||
<property name="col_label_size">20</property>
|
||||
<property name="col_label_size">24</property>
|
||||
<property name="col_label_values"></property>
|
||||
<property name="col_label_vert_alignment">wxALIGN_CENTER</property>
|
||||
<property name="cols">5</property>
|
||||
|
@ -1431,7 +1431,7 @@
|
|||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxLEFT|wxRIGHT</property>
|
||||
<property name="flag">wxEXPAND|wxRIGHT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
|
@ -2033,7 +2033,7 @@
|
|||
<object class="notebookpage" expanded="1">
|
||||
<property name="bitmap"></property>
|
||||
<property name="label">Export</property>
|
||||
<property name="select">0</property>
|
||||
<property name="select">1</property>
|
||||
<object class="wxPanel" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
|
@ -2100,7 +2100,7 @@
|
|||
<property name="border">5</property>
|
||||
<property name="colspan">1</property>
|
||||
<property name="column">0</property>
|
||||
<property name="flag">wxEXPAND|wxALL</property>
|
||||
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
|
||||
<property name="row">0</property>
|
||||
<property name="rowspan">3</property>
|
||||
<object class="wxGridBagSizer" expanded="1">
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
|
|
Loading…
Reference in New Issue