Make sure cur_lib_table is initialized.
The panel doesn't get Show() events so do it in the constructor.
This commit is contained in:
parent
f0c571769c
commit
4d3aeb3339
|
@ -201,6 +201,10 @@ PANEL_SYM_LIB_TABLE::PANEL_SYM_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent,
|
|||
|
||||
// select the last selected page
|
||||
m_auinotebook->SetSelection( m_pageNdx );
|
||||
m_cur_grid = ( m_pageNdx == 0 ) ? m_global_grid : m_project_grid;
|
||||
|
||||
// for ALT+A handling, we want the initial focus to be on the first selected grid.
|
||||
m_parent->SetInitialFocus( m_cur_grid );
|
||||
|
||||
// Gives a selection for each grid, mainly for delete lib button.
|
||||
// Without that, we do not see what lib will be deleted
|
||||
|
@ -225,28 +229,6 @@ PANEL_SYM_LIB_TABLE::~PANEL_SYM_LIB_TABLE()
|
|||
}
|
||||
|
||||
|
||||
bool PANEL_SYM_LIB_TABLE::Show( bool aShow )
|
||||
{
|
||||
if( aShow )
|
||||
{
|
||||
m_cur_grid = ( m_pageNdx == 0 ) ? m_global_grid : m_project_grid;
|
||||
|
||||
// for ALT+A handling, we want the initial focus to be on the first selected grid.
|
||||
m_parent->SetInitialFocus( m_cur_grid );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Save page index for next invocation
|
||||
// We must do this on Show( false ) because when the first grid is hidden it
|
||||
// gives focus to the next one (which is then hidden), but the result is that
|
||||
// we save the wrong grid if we do it after this.
|
||||
m_pageNdx = (unsigned) std::max( 0, m_auinotebook->GetSelection() );
|
||||
}
|
||||
|
||||
return wxPanel::Show( aShow );
|
||||
}
|
||||
|
||||
|
||||
bool PANEL_SYM_LIB_TABLE::verifyTables()
|
||||
{
|
||||
for( int t=0; t<2; ++t )
|
||||
|
@ -334,7 +316,8 @@ bool PANEL_SYM_LIB_TABLE::verifyTables()
|
|||
|
||||
void PANEL_SYM_LIB_TABLE::pageChangedHandler( wxAuiNotebookEvent& event )
|
||||
{
|
||||
m_cur_grid = ( m_auinotebook->GetSelection() == 0 ) ? m_global_grid : m_project_grid;
|
||||
m_pageNdx = (unsigned) std::max( 0, m_auinotebook->GetSelection() );
|
||||
m_cur_grid = m_pageNdx == 0 ? m_global_grid : m_project_grid;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -39,8 +39,6 @@ public:
|
|||
SYMBOL_LIB_TABLE* aProject );
|
||||
virtual ~PANEL_SYM_LIB_TABLE();
|
||||
|
||||
bool Show( bool aShow ) override;
|
||||
|
||||
private:
|
||||
/**
|
||||
* Trim important fields, removes blank row entries, and checks for duplicates.
|
||||
|
|
|
@ -328,6 +328,10 @@ PANEL_FP_LIB_TABLE::PANEL_FP_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent,
|
|||
|
||||
// select the last selected page
|
||||
m_auinotebook->SetSelection( m_pageNdx );
|
||||
m_cur_grid = ( m_pageNdx == 0 ) ? m_global_grid : m_project_grid;
|
||||
|
||||
// for ALT+A handling, we want the initial focus to be on the first selected grid.
|
||||
m_parent->SetInitialFocus( m_cur_grid );
|
||||
|
||||
// Configure button logos
|
||||
m_append_button->SetBitmap( KiBitmap( small_plus_xpm ) );
|
||||
|
@ -352,28 +356,6 @@ PANEL_FP_LIB_TABLE::~PANEL_FP_LIB_TABLE()
|
|||
}
|
||||
|
||||
|
||||
bool PANEL_FP_LIB_TABLE::Show( bool aShow )
|
||||
{
|
||||
if( aShow )
|
||||
{
|
||||
m_cur_grid = ( m_pageNdx == 0 ) ? m_global_grid : m_project_grid;
|
||||
|
||||
// for ALT+A handling, we want the initial focus to be on the first selected grid.
|
||||
m_parent->SetInitialFocus( m_cur_grid );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Save page index for next invocation
|
||||
// We must do this on Show( false ) because when the first grid is hidden it
|
||||
// gives focus to the next one (which is then hidden), but the result is that
|
||||
// we save the wrong grid if we do it after this.
|
||||
m_pageNdx = (unsigned) std::max( 0, m_auinotebook->GetSelection() );
|
||||
}
|
||||
|
||||
return wxPanel::Show( aShow );
|
||||
}
|
||||
|
||||
|
||||
bool PANEL_FP_LIB_TABLE::verifyTables()
|
||||
{
|
||||
for( int t=0; t<2; ++t )
|
||||
|
@ -462,7 +444,8 @@ bool PANEL_FP_LIB_TABLE::verifyTables()
|
|||
|
||||
void PANEL_FP_LIB_TABLE::pageChangedHandler( wxAuiNotebookEvent& event )
|
||||
{
|
||||
m_cur_grid = ( m_auinotebook->GetSelection() == 0 ) ? m_global_grid : m_project_grid;
|
||||
m_pageNdx = (unsigned) std::max( 0, m_auinotebook->GetSelection() );
|
||||
m_cur_grid = m_pageNdx == 0 ? m_global_grid : m_project_grid;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -38,8 +38,6 @@ public:
|
|||
FP_LIB_TABLE* aProject );
|
||||
~PANEL_FP_LIB_TABLE() override;
|
||||
|
||||
bool Show( bool aShow ) override;
|
||||
|
||||
private:
|
||||
bool TransferDataFromWindow() override;
|
||||
|
||||
|
|
Loading…
Reference in New Issue