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.

From master, commit 598ed8b39.
This commit is contained in:
jean-pierre charras 2020-05-30 14:26:35 +02:00
parent c7f02d5e51
commit 2395c6fdaa
4 changed files with 12 additions and 8 deletions

View File

@ -201,6 +201,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH_LIB_EDITOR, _( "Library Editor" ),
wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, LIB_EDIT_FRAME_NAME )
{
m_partSelectBox = nullptr;
m_showAxis = true; // true to draw axis
SetShowDeMorgan( false );
m_drawSpecificConvert = true;

View File

@ -177,12 +177,12 @@ void LIB_EDIT_FRAME::ReCreateHToolbar()
KiScaledSeparator( m_mainToolBar, this );
m_partSelectBox = new wxComboBox( m_mainToolBar,
ID_LIBEDIT_SELECT_PART_NUMBER,
wxEmptyString,
wxDefaultPosition,
wxSize( LISTBOX_WIDTH, -1 ),
0, nullptr, wxCB_READONLY );
if( m_partSelectBox == nullptr )
m_partSelectBox = new wxComboBox( m_mainToolBar, ID_LIBEDIT_SELECT_PART_NUMBER,
wxEmptyString,
wxDefaultPosition, wxSize( LISTBOX_WIDTH, -1 ),
0, nullptr, wxCB_READONLY );
m_mainToolBar->AddControl( m_partSelectBox );
KiScaledSeparator( m_mainToolBar, this );

View File

@ -95,8 +95,10 @@ void LIB_VIEW_FRAME::ReCreateHToolbar()
m_mainToolBar->AddSeparator();
m_unitChoice = new wxChoice( m_mainToolBar, ID_LIBVIEW_SELECT_PART_NUMBER,
wxDefaultPosition, wxSize( 150, -1 ) );
if( m_unitChoice == nullptr )
m_unitChoice = new wxChoice( m_mainToolBar, ID_LIBVIEW_SELECT_PART_NUMBER,
wxDefaultPosition, wxSize( 150, -1 ) );
m_mainToolBar->AddControl( m_unitChoice );
m_mainToolBar->AddSeparator();

View File

@ -107,6 +107,7 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
wxDefaultPosition, wxDefaultSize,
aFrameType == FRAME_SCH_VIEWER_MODAL ? LIB_VIEW_STYLE_MODAL : LIB_VIEW_STYLE,
aFrameType == FRAME_SCH_VIEWER_MODAL ? LIB_VIEW_NAME_MODAL : LIB_VIEW_NAME ),
m_unitChoice( nullptr ),
m_libList( nullptr ),
m_cmpList( nullptr ),
m_previewItem( nullptr )