toolbars_lib_view.cpp and toolbars_libedit.cpp: do not recreate comboboxes

when clearing toolbars.
Clearing toolbars delete only tools, not other widgets.
recreating comboboxes creates strange cosmetic issues.

Fixes #4542
https://gitlab.com/kicad/code/kicad/issues/4542
This commit is contained in:
jean-pierre charras 2020-05-30 14:08:00 +02:00
parent 449c90a0ae
commit 598ed8b394
3 changed files with 9 additions and 4 deletions

View File

@ -102,7 +102,8 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
aFrameType == FRAME_SCH_VIEWER_MODAL ? LIB_VIEW_STYLE_MODAL : LIB_VIEW_STYLE, aFrameType == FRAME_SCH_VIEWER_MODAL ? LIB_VIEW_STYLE_MODAL : LIB_VIEW_STYLE,
aFrameType == FRAME_SCH_VIEWER_MODAL ? LIB_VIEW_NAME_MODAL : LIB_VIEW_NAME ), aFrameType == FRAME_SCH_VIEWER_MODAL ? LIB_VIEW_NAME_MODAL : LIB_VIEW_NAME ),
m_libList( nullptr ), m_cmpList( nullptr ), m_previewItem( nullptr ) m_unitChoice( nullptr ), m_libList( nullptr ),
m_cmpList( nullptr ), m_previewItem( nullptr )
{ {
wxASSERT( aFrameType == FRAME_SCH_VIEWER || aFrameType == FRAME_SCH_VIEWER_MODAL ); wxASSERT( aFrameType == FRAME_SCH_VIEWER || aFrameType == FRAME_SCH_VIEWER_MODAL );

View File

@ -112,6 +112,8 @@ void LIB_EDIT_FRAME::ReCreateHToolbar()
m_mainToolBar->Add( EE_ACTIONS::showDeMorganAlternate, ACTION_TOOLBAR::TOGGLE ); m_mainToolBar->Add( EE_ACTIONS::showDeMorganAlternate, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_mainToolBar, this ); KiScaledSeparator( m_mainToolBar, this );
if( m_unitSelectBox == nullptr )
m_unitSelectBox = new wxComboBox( m_mainToolBar, ID_LIBEDIT_SELECT_PART_NUMBER, wxEmptyString, m_unitSelectBox = new wxComboBox( m_mainToolBar, ID_LIBEDIT_SELECT_PART_NUMBER, wxEmptyString,
wxDefaultPosition, wxSize( LISTBOX_WIDTH, -1 ), 0, nullptr, wxDefaultPosition, wxSize( LISTBOX_WIDTH, -1 ), 0, nullptr,
wxCB_READONLY ); wxCB_READONLY );

View File

@ -69,6 +69,8 @@ void LIB_VIEW_FRAME::ReCreateHToolbar()
toolbar->Add( EE_ACTIONS::showDeMorganAlternate, ACTION_TOOLBAR::TOGGLE ); toolbar->Add( EE_ACTIONS::showDeMorganAlternate, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_mainToolBar, this ); KiScaledSeparator( m_mainToolBar, this );
if( m_unitChoice == nullptr )
m_unitChoice = new wxChoice( m_mainToolBar, ID_LIBVIEW_SELECT_PART_NUMBER, m_unitChoice = new wxChoice( m_mainToolBar, ID_LIBVIEW_SELECT_PART_NUMBER,
wxDefaultPosition, wxSize( 150, -1 ) ); wxDefaultPosition, wxSize( 150, -1 ) );
m_mainToolBar->AddControl( m_unitChoice ); m_mainToolBar->AddControl( m_unitChoice );