Improved column sizing in library setup dialogs.

This commit is contained in:
Jeff Young 2022-12-28 16:27:03 +00:00
parent e927328ecf
commit e7300ffb5c
7 changed files with 116 additions and 54 deletions

View File

@ -224,6 +224,15 @@ PANEL_SYM_LIB_TABLE::PANEL_SYM_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent, P
m_lastProjectLibDir = m_project->GetProjectPath();
auto autoSizeCol =
[&]( WX_GRID* aGrid, int aCol )
{
int prevWidth = aGrid->GetColSize( aCol );
aGrid->AutoSizeColumn( aCol, false );
aGrid->SetColSize( aCol, std::max( prevWidth, aGrid->GetColSize( aCol ) ) );
};
auto setupGrid =
[&]( WX_GRID* aGrid )
{
@ -234,7 +243,6 @@ PANEL_SYM_LIB_TABLE::PANEL_SYM_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent, P
aGrid->PushEventHandler( new SYMBOL_GRID_TRICKS( m_parent, aGrid ) );
aGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
aGrid->AutoSizeColumns( false );
// Set special attributes
wxGridCellAttr* attr;
@ -264,14 +272,11 @@ PANEL_SYM_LIB_TABLE::PANEL_SYM_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent, P
aGrid->SetColAttr( COL_VISIBLE, attr );
// all but COL_OPTIONS, which is edited with Option Editor anyways.
aGrid->AutoSizeColumn( COL_NICKNAME, false );
aGrid->AutoSizeColumn( COL_TYPE, false );
aGrid->AutoSizeColumn( COL_URI, false );
aGrid->AutoSizeColumn( COL_DESCR, false );
aGrid->AutoSizeColumn( COL_ENABLED, false );
// would set this to width of title, if it was easily known.
aGrid->SetColSize( COL_OPTIONS, 80 );
autoSizeCol( aGrid, COL_NICKNAME );
autoSizeCol( aGrid, COL_TYPE );
autoSizeCol( aGrid, COL_URI );
autoSizeCol( aGrid, COL_DESCR );
autoSizeCol( aGrid, COL_ENABLED );
// Gives a selection to each grid, mainly for delete button. wxGrid's wake up with
// a currentCell which is sometimes not highlighted.

View File

@ -21,8 +21,6 @@ PANEL_SYM_LIB_TABLE_BASE::PANEL_SYM_LIB_TABLE_BASE( wxWindow* parent, wxWindowID
m_top_sizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Libraries by Scope") ), wxVERTICAL );
m_notebook = new wxNotebook( m_top_sizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_notebook->SetMinSize( wxSize( 400,-1 ) );
m_global_panel = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* m_global_sizer;
m_global_sizer = new wxBoxSizer( wxVERTICAL );
@ -30,16 +28,29 @@ PANEL_SYM_LIB_TABLE_BASE::PANEL_SYM_LIB_TABLE_BASE( wxWindow* parent, wxWindowID
m_global_grid = new WX_GRID( m_global_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_global_grid->CreateGrid( 1, 5 );
m_global_grid->CreateGrid( 1, 7 );
m_global_grid->EnableEditing( true );
m_global_grid->EnableGridLines( true );
m_global_grid->EnableDragGridSize( false );
m_global_grid->SetMargins( 0, 0 );
// Columns
m_global_grid->AutoSizeColumns();
m_global_grid->SetColSize( 0, 48 );
m_global_grid->SetColSize( 1, 48 );
m_global_grid->SetColSize( 2, 100 );
m_global_grid->SetColSize( 3, 240 );
m_global_grid->SetColSize( 4, 100 );
m_global_grid->SetColSize( 5, 80 );
m_global_grid->SetColSize( 6, 240 );
m_global_grid->EnableDragColMove( false );
m_global_grid->EnableDragColSize( true );
m_global_grid->SetColLabelValue( 0, _("Active") );
m_global_grid->SetColLabelValue( 1, _("Visible") );
m_global_grid->SetColLabelValue( 2, _("Nickname") );
m_global_grid->SetColLabelValue( 3, _("Library Path") );
m_global_grid->SetColLabelValue( 4, _("LIbrary Format") );
m_global_grid->SetColLabelValue( 5, _("Options") );
m_global_grid->SetColLabelValue( 6, _("Description") );
m_global_grid->SetColLabelSize( 22 );
m_global_grid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
@ -67,16 +78,29 @@ PANEL_SYM_LIB_TABLE_BASE::PANEL_SYM_LIB_TABLE_BASE( wxWindow* parent, wxWindowID
m_project_grid = new WX_GRID( m_project_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_project_grid->CreateGrid( 1, 5 );
m_project_grid->CreateGrid( 1, 7 );
m_project_grid->EnableEditing( true );
m_project_grid->EnableGridLines( true );
m_project_grid->EnableDragGridSize( false );
m_project_grid->SetMargins( 0, 0 );
// Columns
m_project_grid->AutoSizeColumns();
m_project_grid->SetColSize( 0, 48 );
m_project_grid->SetColSize( 1, 48 );
m_project_grid->SetColSize( 2, 100 );
m_project_grid->SetColSize( 3, 240 );
m_project_grid->SetColSize( 4, 100 );
m_project_grid->SetColSize( 5, 80 );
m_project_grid->SetColSize( 6, 240 );
m_project_grid->EnableDragColMove( false );
m_project_grid->EnableDragColSize( true );
m_project_grid->SetColLabelValue( 0, _("Active") );
m_project_grid->SetColLabelValue( 1, _("Visible") );
m_project_grid->SetColLabelValue( 2, _("Nickname") );
m_project_grid->SetColLabelValue( 3, _("Library Path") );
m_project_grid->SetColLabelValue( 4, _("LIbrary Format") );
m_project_grid->SetColLabelValue( 5, _("Options") );
m_project_grid->SetColLabelValue( 6, _("Description") );
m_project_grid->SetColLabelSize( 22 );
m_project_grid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
@ -89,6 +113,8 @@ PANEL_SYM_LIB_TABLE_BASE::PANEL_SYM_LIB_TABLE_BASE( wxWindow* parent, wxWindowID
// Cell Defaults
m_project_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
m_project_grid->SetMinSize( wxSize( 600,-1 ) );
m_project_sizer->Add( m_project_grid, 2, wxALL|wxEXPAND, 5 );

View File

@ -42,7 +42,7 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="minimum_size">-1,-1</property>
<property name="name">PANEL_SYM_LIB_TABLE_BASE</property>
<property name="pos"></property>
<property name="size">-1,-1</property>
@ -108,7 +108,7 @@
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">400,-1</property>
<property name="minimum_size">-1,-1</property>
<property name="moveable">1</property>
<property name="name">m_notebook</property>
<property name="pane_border">1</property>
@ -200,7 +200,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="autosize_cols">1</property>
<property name="autosize_cols">0</property>
<property name="autosize_rows">1</property>
<property name="best_size"></property>
<property name="bg"></property>
@ -215,10 +215,10 @@
<property name="close_button">1</property>
<property name="col_label_horiz_alignment">wxALIGN_CENTER</property>
<property name="col_label_size">22</property>
<property name="col_label_values"></property>
<property name="col_label_values">&quot;Active&quot; &quot;Visible&quot; &quot;Nickname&quot; &quot;Library Path&quot; &quot;LIbrary Format&quot; &quot;Options&quot; &quot;Description&quot;</property>
<property name="col_label_vert_alignment">wxALIGN_CENTER</property>
<property name="cols">5</property>
<property name="column_sizes"></property>
<property name="cols">7</property>
<property name="column_sizes">48,48,100,240,100,80,240</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
@ -351,7 +351,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="autosize_cols">1</property>
<property name="autosize_cols">0</property>
<property name="autosize_rows">0</property>
<property name="best_size"></property>
<property name="bg"></property>
@ -366,10 +366,10 @@
<property name="close_button">1</property>
<property name="col_label_horiz_alignment">wxALIGN_CENTER</property>
<property name="col_label_size">22</property>
<property name="col_label_values"></property>
<property name="col_label_values">&quot;Active&quot; &quot;Visible&quot; &quot;Nickname&quot; &quot;Library Path&quot; &quot;LIbrary Format&quot; &quot;Options&quot; &quot;Description&quot;</property>
<property name="col_label_vert_alignment">wxALIGN_CENTER</property>
<property name="cols">5</property>
<property name="column_sizes"></property>
<property name="cols">7</property>
<property name="column_sizes">48,48,100,240,100,80,240</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
@ -400,7 +400,7 @@
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="minimum_size">600,-1</property>
<property name="moveable">0</property>
<property name="name">m_project_grid</property>
<property name="pane_border">1</property>

View File

@ -391,6 +391,15 @@ PANEL_FP_LIB_TABLE::PANEL_FP_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent,
m_lastProjectLibDir = m_projectBasePath;
auto autoSizeCol =
[&]( WX_GRID* aGrid, int aCol )
{
int prevWidth = aGrid->GetColSize( aCol );
aGrid->AutoSizeColumn( aCol, false );
aGrid->SetColSize( aCol, std::max( prevWidth, aGrid->GetColSize( aCol ) ) );
};
auto setupGrid =
[&]( WX_GRID* aGrid )
{
@ -401,7 +410,6 @@ PANEL_FP_LIB_TABLE::PANEL_FP_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent,
aGrid->PushEventHandler( new FP_GRID_TRICKS( m_parent, aGrid ) );
aGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
aGrid->AutoSizeColumns( false );
wxGridCellAttr* attr;
@ -427,13 +435,10 @@ PANEL_FP_LIB_TABLE::PANEL_FP_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent,
aGrid->HideCol( COL_VISIBLE );
// all but COL_OPTIONS, which is edited with Option Editor anyways.
aGrid->AutoSizeColumn( COL_NICKNAME, false );
aGrid->AutoSizeColumn( COL_TYPE, false );
aGrid->AutoSizeColumn( COL_URI, false );
aGrid->AutoSizeColumn( COL_DESCR, false );
// would set this to width of title, if it was easily known.
aGrid->SetColSize( COL_OPTIONS, 80 );
autoSizeCol( aGrid, COL_NICKNAME );
autoSizeCol( aGrid, COL_TYPE );
autoSizeCol( aGrid, COL_URI );
autoSizeCol( aGrid, COL_DESCR );
// Gives a selection to each grid, mainly for delete button. wxGrid's wake up with
// a currentCell which is sometimes not highlighted.

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.0-4761b0c5)
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -28,16 +28,29 @@ PANEL_FP_LIB_TABLE_BASE::PANEL_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID i
m_global_grid = new WX_GRID( m_global_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_global_grid->CreateGrid( 1, 5 );
m_global_grid->CreateGrid( 1, 7 );
m_global_grid->EnableEditing( true );
m_global_grid->EnableGridLines( true );
m_global_grid->EnableDragGridSize( false );
m_global_grid->SetMargins( 0, 0 );
// Columns
m_global_grid->AutoSizeColumns();
m_global_grid->SetColSize( 0, 48 );
m_global_grid->SetColSize( 1, 48 );
m_global_grid->SetColSize( 2, 100 );
m_global_grid->SetColSize( 3, 240 );
m_global_grid->SetColSize( 4, 100 );
m_global_grid->SetColSize( 5, 80 );
m_global_grid->SetColSize( 6, 240 );
m_global_grid->EnableDragColMove( false );
m_global_grid->EnableDragColSize( true );
m_global_grid->SetColLabelValue( 0, _("Active") );
m_global_grid->SetColLabelValue( 1, _("Visible") );
m_global_grid->SetColLabelValue( 2, _("Nickname") );
m_global_grid->SetColLabelValue( 3, _("Library Path") );
m_global_grid->SetColLabelValue( 4, _("LIbrary Format") );
m_global_grid->SetColLabelValue( 5, _("Options") );
m_global_grid->SetColLabelValue( 6, _("Description") );
m_global_grid->SetColLabelSize( 22 );
m_global_grid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
@ -64,16 +77,29 @@ PANEL_FP_LIB_TABLE_BASE::PANEL_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID i
m_project_grid = new WX_GRID( m_project_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_project_grid->CreateGrid( 1, 5 );
m_project_grid->CreateGrid( 1, 7 );
m_project_grid->EnableEditing( true );
m_project_grid->EnableGridLines( true );
m_project_grid->EnableDragGridSize( false );
m_project_grid->SetMargins( 0, 0 );
// Columns
m_project_grid->AutoSizeColumns();
m_project_grid->SetColSize( 0, 48 );
m_project_grid->SetColSize( 1, 48 );
m_project_grid->SetColSize( 2, 100 );
m_project_grid->SetColSize( 3, 240 );
m_project_grid->SetColSize( 4, 100 );
m_project_grid->SetColSize( 5, 80 );
m_project_grid->SetColSize( 6, 240 );
m_project_grid->EnableDragColMove( false );
m_project_grid->EnableDragColSize( true );
m_project_grid->SetColLabelValue( 0, _("Active") );
m_project_grid->SetColLabelValue( 1, _("Visible") );
m_project_grid->SetColLabelValue( 2, _("Nickname") );
m_project_grid->SetColLabelValue( 3, _("Library Path") );
m_project_grid->SetColLabelValue( 4, _("LIbrary Format") );
m_project_grid->SetColLabelValue( 5, _("Options") );
m_project_grid->SetColLabelValue( 6, _("Description") );
m_project_grid->SetColLabelSize( 22 );
m_project_grid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );

View File

@ -127,11 +127,11 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<object class="notebookpage" expanded="0">
<object class="notebookpage" expanded="1">
<property name="bitmap"></property>
<property name="label">Global Libraries</property>
<property name="select">1</property>
<object class="wxPanel" expanded="0">
<object class="wxPanel" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -182,7 +182,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<object class="wxBoxSizer" expanded="0">
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">m_global_sizer</property>
<property name="orient">wxVERTICAL</property>
@ -200,7 +200,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="autosize_cols">1</property>
<property name="autosize_cols">0</property>
<property name="autosize_rows">0</property>
<property name="best_size"></property>
<property name="bg"></property>
@ -215,10 +215,10 @@
<property name="close_button">1</property>
<property name="col_label_horiz_alignment">wxALIGN_CENTER</property>
<property name="col_label_size">22</property>
<property name="col_label_values"></property>
<property name="col_label_values">&quot;Active&quot; &quot;Visible&quot; &quot;Nickname&quot; &quot;Library Path&quot; &quot;LIbrary Format&quot; &quot;Options&quot; &quot;Description&quot;</property>
<property name="col_label_vert_alignment">wxALIGN_CENTER</property>
<property name="cols">5</property>
<property name="column_sizes"></property>
<property name="cols">7</property>
<property name="column_sizes">48,48,100,240,100,80,240</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
@ -278,11 +278,11 @@
</object>
</object>
</object>
<object class="notebookpage" expanded="0">
<object class="notebookpage" expanded="1">
<property name="bitmap"></property>
<property name="label">Project Specific Libraries</property>
<property name="select">0</property>
<object class="wxPanel" expanded="0">
<object class="wxPanel" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -333,7 +333,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<object class="wxBoxSizer" expanded="0">
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">m_project_sizer</property>
<property name="orient">wxVERTICAL</property>
@ -351,7 +351,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="autosize_cols">1</property>
<property name="autosize_cols">0</property>
<property name="autosize_rows">0</property>
<property name="best_size"></property>
<property name="bg"></property>
@ -366,10 +366,10 @@
<property name="close_button">1</property>
<property name="col_label_horiz_alignment">wxALIGN_CENTER</property>
<property name="col_label_size">22</property>
<property name="col_label_values"></property>
<property name="col_label_values">&quot;Active&quot; &quot;Visible&quot; &quot;Nickname&quot; &quot;Library Path&quot; &quot;LIbrary Format&quot; &quot;Options&quot; &quot;Description&quot;</property>
<property name="col_label_vert_alignment">wxALIGN_CENTER</property>
<property name="cols">5</property>
<property name="column_sizes"></property>
<property name="cols">7</property>
<property name="column_sizes">48,48,100,240,100,80,240</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.0-4761b0c5)
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!