Layout adjustments to Choose Symbol and Choose Footprint.

This commit is contained in:
Jeff Young 2018-08-05 14:22:29 +01:00
parent 08bcec9ac0
commit 0fbe702043
4 changed files with 28 additions and 10 deletions

View File

@ -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 )

View File

@ -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
{

View File

@ -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 );

View File

@ -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();