diff --git a/common/widgets/footprint_preview_widget.cpp b/common/widgets/footprint_preview_widget.cpp index c932cf03c0..6a7d62cee2 100644 --- a/common/widgets/footprint_preview_widget.cpp +++ b/common/widgets/footprint_preview_widget.cpp @@ -26,7 +26,7 @@ FOOTPRINT_PREVIEW_WIDGET::FOOTPRINT_PREVIEW_WIDGET( wxWindow* aParent, KIWAY& aKiway ): wxPanel( aParent, wxID_ANY, wxDefaultPosition, wxDefaultSize, - wxFULL_REPAINT_ON_RESIZE | wxBORDER_SIMPLE | wxTAB_TRAVERSAL ), + wxFULL_REPAINT_ON_RESIZE | wxTAB_TRAVERSAL ), m_prev_panel( nullptr ), m_status_label( nullptr ), m_sizer( nullptr ) diff --git a/common/widgets/lib_tree.cpp b/common/widgets/lib_tree.cpp index d332dc1557..1b653890b8 100644 --- a/common/widgets/lib_tree.cpp +++ b/common/widgets/lib_tree.cpp @@ -59,10 +59,17 @@ LIB_TREE::LIB_TREE( wxWindow* aParent, LIB_TABLE* aLibTable, LIB_TREE_MODEL_ADAP // Additional visual cue for GTK, which hides the placeholder text on focus #ifdef __WXGTK__ auto bitmap = new wxStaticBitmap( this, wxID_ANY, wxArtProvider::GetBitmap( wxART_FIND, wxART_FRAME_ICON ) ); - search_sizer->Add( bitmap, 0, wxALIGN_CENTER | wxRIGHT, 5 ); + + if( aWidgets & DETAILS ) + search_sizer->Add( bitmap, 0, wxALIGN_CENTER | wxALL, 5 ); + else + search_sizer->Add( bitmap, 0, wxALIGN_CENTER | wxRIGHT, 5 ); #endif - search_sizer->Add( m_query_ctrl, 1, wxEXPAND, 5 ); + if( aWidgets & DETAILS ) + search_sizer->Add( m_query_ctrl, 1, wxLEFT | wxTOP | wxRIGHT | wxEXPAND, 5 ); + else + search_sizer->Add( m_query_ctrl, 1, wxEXPAND, 5 ); sizer->Add( search_sizer, 0, wxEXPAND, 5 ); m_query_ctrl->Bind( wxEVT_TEXT, &LIB_TREE::onQueryText, this ); @@ -75,7 +82,10 @@ LIB_TREE::LIB_TREE( wxWindow* aParent, LIB_TABLE* aLibTable, LIB_TREE_MODEL_ADAP wxDV_SINGLE | wxDV_NO_HEADER ); m_adapter->AttachTo( m_tree_ctrl ); - sizer->Add( m_tree_ctrl, 5, wxEXPAND | wxRIGHT | wxBOTTOM, 1 ); + if( aWidgets & DETAILS ) + sizer->Add( m_tree_ctrl, 5, wxLEFT | wxTOP | wxRIGHT | wxEXPAND, 5 ); + else + sizer->Add( m_tree_ctrl, 5, wxRIGHT | wxBOTTOM | wxEXPAND, 1 ); // Description panel if( aWidgets & DETAILS ) @@ -88,7 +98,7 @@ LIB_TREE::LIB_TREE( wxWindow* aParent, LIB_TABLE* aLibTable, LIB_TREE_MODEL_ADAP this, wxID_ANY, wxDefaultPosition, wxSize( html_sz.x, html_sz.y ), wxHW_SCROLLBAR_AUTO ); - sizer->Add( m_details_ctrl, 2, wxLEFT | wxTOP | wxBOTTOM | wxEXPAND, 5 ); + sizer->Add( m_details_ctrl, 2, wxALL | wxEXPAND, 5 ); } else { diff --git a/eeschema/dialogs/dialog_choose_component.cpp b/eeschema/dialogs/dialog_choose_component.cpp index d6cd8eb3c9..1b90c9f51a 100644 --- a/eeschema/dialogs/dialog_choose_component.cpp +++ b/eeschema/dialogs/dialog_choose_component.cpp @@ -101,7 +101,7 @@ DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT( SCH_BASE_FRAME* aParent, const details = new wxHtmlWindow( detailsPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO ); - detailsSizer->Add( details, 1, wxEXPAND | wxLEFT | wxRIGHT, 5 ); + detailsSizer->Add( details, 1, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, 5 ); detailsPanel->Layout(); detailsSizer->Fit( detailsPanel ); @@ -126,7 +126,7 @@ DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT( SCH_BASE_FRAME* aParent, const if( aAllowBrowser ) { m_browser_button = new wxButton( this, wxID_ANY, _( "Select with Browser" ) ); - buttonsSizer->Add( m_browser_button, 0, wxALL, 5 ); + buttonsSizer->Add( m_browser_button, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5 ); } auto sdbSizer = new wxStdDialogButtonSizer(); @@ -425,8 +425,12 @@ void DIALOG_CHOOSE_COMPONENT::OnSymbolPreviewPaint( wxPaintEvent& aEvent ) LIB_PART* part = alias->GetPart(); + // Don't draw if we don't have a part to show, just display a tooltip if( !part ) + { + RenderPreview( nullptr, unit ); return; + } if( alias->IsRoot() ) { @@ -515,8 +519,12 @@ void DIALOG_CHOOSE_COMPONENT::RenderPreview( LIB_PART* aComponent, int aUnit ) if( dc_size.x == 0 || dc_size.y == 0 ) return; - if( !aComponent ) + if( !aComponent ) // display a tooltip + { + wxString tooltip = _( "No symbol selected" ); + GRDrawWrappedText( dc, tooltip ); return; + } GRResetPenAndBrush( &dc ); diff --git a/pcbnew/dialogs/dialog_choose_footprint.cpp b/pcbnew/dialogs/dialog_choose_footprint.cpp index 2f6ebe74a8..b19b0fa66a 100644 --- a/pcbnew/dialogs/dialog_choose_footprint.cpp +++ b/pcbnew/dialogs/dialog_choose_footprint.cpp @@ -78,7 +78,7 @@ DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT( PCB_BASE_FRAME* aParent, details = new wxHtmlWindow( detailsPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO ); - detailsSizer->Add( details, 1, wxEXPAND | wxLEFT | wxRIGHT, 5 ); + detailsSizer->Add( details, 1, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, 5 ); detailsPanel->Layout(); detailsSizer->Fit( detailsPanel ); @@ -171,7 +171,7 @@ wxPanel* DIALOG_CHOOSE_FOOTPRINT::ConstructRightPanel( wxWindow* aParent ) auto sizer = new wxBoxSizer( wxVERTICAL ); m_preview_ctrl = new FOOTPRINT_PREVIEW_WIDGET( panel, Kiway() ); - sizer->Add( m_preview_ctrl, 1, wxEXPAND | wxBOTTOM | wxRIGHT, 5 ); + sizer->Add( m_preview_ctrl, 1, wxEXPAND | wxTOP | wxRIGHT, 5 ); panel->SetSizer( sizer ); panel->Layout();