diff --git a/eeschema/dialogs/dialog_choose_component.cpp b/eeschema/dialogs/dialog_choose_component.cpp index 2218e7b9f8..a04e686c0a 100644 --- a/eeschema/dialogs/dialog_choose_component.cpp +++ b/eeschema/dialogs/dialog_choose_component.cpp @@ -2,8 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2014 Henner Zeller - * Copyright (C) 2017 Chris Pavlina - * Copyright (C) 2016-2017 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2016-2018 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -50,21 +49,37 @@ FOOTPRINT_ASYNC_LOADER DIALOG_CHOOSE_COMPONENT::m_fp_loader; std::unique_ptr DIALOG_CHOOSE_COMPONENT::m_fp_list; DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT( SCH_BASE_FRAME* aParent, const wxString& aTitle, - CMP_TREE_MODEL_ADAPTER::PTR& aAdapter, int aDeMorganConvert, bool aAllowFieldEdits ) + CMP_TREE_MODEL_ADAPTER::PTR& aAdapter, int aDeMorganConvert, bool aAllowFieldEdits, + bool aShowFootprints ) : DIALOG_SHIM( aParent, wxID_ANY, aTitle, wxDefaultPosition, wxSize( 800, 650 ), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ), + m_fp_sel_ctrl( nullptr ), + m_fp_view_ctrl( nullptr ), m_parent( aParent ), m_deMorganConvert( aDeMorganConvert >= 0 ? aDeMorganConvert : 0 ), m_allow_field_edits( aAllowFieldEdits ), + m_show_footprints( aShowFootprints ), m_external_browser_requested( false ) { wxBusyCursor busy_while_loading; auto sizer = new wxBoxSizer( wxVERTICAL ); + // Use a slightly different layout, with a details pane spanning the entire window, + // if we're not showing footprints. + auto vsplitter = aShowFootprints ? nullptr : new wxSplitterWindow( + this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_LIVE_UPDATE ); + auto splitter = new wxSplitterWindow( - this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_LIVE_UPDATE ); - m_tree = new COMPONENT_TREE( splitter, Prj().SchSymbolLibTable(), aAdapter ); + vsplitter ? static_cast( vsplitter ) : static_cast( this ), + wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_LIVE_UPDATE ); + + auto details = aShowFootprints ? nullptr : new wxHtmlWindow( + vsplitter, wxID_ANY, wxDefaultPosition, wxDefaultSize, + wxHW_SCROLLBAR_AUTO | wxSUNKEN_BORDER ); + + m_tree = new COMPONENT_TREE( splitter, Prj().SchSymbolLibTable(), aAdapter, + COMPONENT_TREE::WIDGETS::ALL, details ); auto right_panel = ConstructRightPanel( splitter ); auto buttons = new wxStdDialogButtonSizer(); m_dbl_click_timer = new wxTimer( this ); @@ -73,11 +88,22 @@ DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT( SCH_BASE_FRAME* aParent, const splitter->SetMinimumPaneSize( 1 ); splitter->SplitVertically( m_tree, right_panel, -300 ); + if( vsplitter ) + { + vsplitter->SetSashGravity( 0.5 ); + vsplitter->SetMinimumPaneSize( 1 ); + vsplitter->SplitHorizontally( splitter, details, -200 ); + sizer->Add( vsplitter, 1, wxEXPAND | wxALL, 5 ); + } + else + { + sizer->Add( splitter, 1, wxEXPAND | wxALL, 5 ); + } + buttons->AddButton( new wxButton( this, wxID_OK ) ); buttons->AddButton( new wxButton( this, wxID_CANCEL ) ); buttons->Realize(); - sizer->Add( splitter, 1, wxEXPAND | wxALL, 5 ); sizer->Add( buttons, 0, wxEXPAND | wxBOTTOM, 10 ); SetSizer( sizer ); @@ -117,21 +143,25 @@ wxPanel* DIALOG_CHOOSE_COMPONENT::ConstructRightPanel( wxWindow* aParent ) wxFULL_REPAINT_ON_RESIZE | wxSUNKEN_BORDER | wxTAB_TRAVERSAL ); m_sch_view_ctrl->SetLayoutDirection( wxLayout_LeftToRight ); - if( m_allow_field_edits ) - m_fp_sel_ctrl = new FOOTPRINT_SELECT_WIDGET( panel, m_fp_loader, m_fp_list, true ); + if( m_show_footprints ) + { + if( m_allow_field_edits ) + m_fp_sel_ctrl = new FOOTPRINT_SELECT_WIDGET( panel, m_fp_loader, m_fp_list, true ); + + m_fp_view_ctrl = new FOOTPRINT_PREVIEW_WIDGET( panel, Kiway() ); + + + sizer->Add( m_sch_view_ctrl, 1, wxEXPAND | wxALL, 5 ); + + if( m_fp_sel_ctrl ) + sizer->Add( m_fp_sel_ctrl, 0, wxEXPAND | wxALL, 5 ); + + sizer->Add( m_fp_view_ctrl, 1, wxEXPAND | wxALL, 5 ); + } else - m_fp_sel_ctrl = nullptr; - - m_fp_view_ctrl = new FOOTPRINT_PREVIEW_WIDGET( panel, Kiway() ); - - - sizer->Add( m_sch_view_ctrl, 1, wxEXPAND | wxALL, 5 ); - - if( m_fp_sel_ctrl ) - sizer->Add( m_fp_sel_ctrl, 0, wxEXPAND | wxALL, 5 ); - - sizer->Add( m_fp_view_ctrl, 1, wxEXPAND | wxALL, 5 ); - + { + sizer->Add( m_sch_view_ctrl, 1, wxEXPAND | wxALL, 5 ); + } panel->SetSizer( sizer ); panel->Layout(); @@ -143,7 +173,7 @@ wxPanel* DIALOG_CHOOSE_COMPONENT::ConstructRightPanel( wxWindow* aParent ) void DIALOG_CHOOSE_COMPONENT::OnInitDialog( wxInitDialogEvent& aEvent ) { - if( m_fp_view_ctrl->IsInitialized() ) + if( m_fp_view_ctrl && m_fp_view_ctrl->IsInitialized() ) { // This hides the GAL panel and shows the status label m_fp_view_ctrl->SetStatusText( wxEmptyString ); @@ -190,7 +220,7 @@ void DIALOG_CHOOSE_COMPONENT::OnSchViewDClick( wxMouseEvent& aEvent ) void DIALOG_CHOOSE_COMPONENT::ShowFootprintFor( LIB_ID const& aLibId ) { - if( !m_fp_view_ctrl->IsInitialized() ) + if( !m_fp_view_ctrl || !m_fp_view_ctrl->IsInitialized() ) return; LIB_ALIAS* alias = nullptr; @@ -222,6 +252,11 @@ void DIALOG_CHOOSE_COMPONENT::ShowFootprintFor( LIB_ID const& aLibId ) void DIALOG_CHOOSE_COMPONENT::ShowFootprint( wxString const& aName ) { + if( !m_fp_view_ctrl ) + { + return; + } + if( aName == wxEmptyString ) { m_fp_view_ctrl->SetStatusText( _( "No footprint specified" ) ); @@ -379,7 +414,7 @@ void DIALOG_CHOOSE_COMPONENT::OnComponentPreselected( wxCommandEvent& aEvent ) } else { - if( m_fp_view_ctrl->IsInitialized() ) + if( m_fp_view_ctrl && m_fp_view_ctrl->IsInitialized() ) m_fp_view_ctrl->SetStatusText( wxEmptyString ); PopulateFootprintSelector( id ); diff --git a/eeschema/dialogs/dialog_choose_component.h b/eeschema/dialogs/dialog_choose_component.h index 94bb15f9af..9819dceab3 100644 --- a/eeschema/dialogs/dialog_choose_component.h +++ b/eeschema/dialogs/dialog_choose_component.h @@ -2,8 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2014 Henner Zeller - * Copyright (C) 2017 Chris Pavlina - * Copyright (C) 2014-2017 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2014-2018 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -100,9 +99,12 @@ public: * (TODO: should happen in dialog) * @param aAllowFieldEdits if false, all functions that allow the user to edit * fields (currently just footprint selection) will not be available. + * @param aShowFootprints if false, all footprint preview and selection features + * are disabled. This forces aAllowFieldEdits false too. */ DIALOG_CHOOSE_COMPONENT( SCH_BASE_FRAME* aParent, const wxString& aTitle, - CMP_TREE_MODEL_ADAPTER::PTR& aAdapter, int aDeMorganConvert, bool aAllowFieldEdits ); + CMP_TREE_MODEL_ADAPTER::PTR& aAdapter, int aDeMorganConvert, bool aAllowFieldEdits, + bool aShowFootprints ); ~DIALOG_CHOOSE_COMPONENT(); @@ -195,6 +197,7 @@ protected: SCH_BASE_FRAME* m_parent; int m_deMorganConvert; bool m_allow_field_edits; + bool m_show_footprints; bool m_external_browser_requested; wxString m_fp_override; diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp index d6a3065b0d..e8d1d9d64c 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2004-2017 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2004-2018 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -287,7 +287,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnSelectChipName( wxCommandEvent& event { SCH_BASE_FRAME::HISTORY_LIST dummy; - auto sel = GetParent()->SelectComponentFromLibrary( NULL, dummy, true, 0, 0 ); + auto sel = GetParent()->SelectComponentFromLibrary( NULL, dummy, true, 0, 0, false ); if( !sel.LibId.IsValid() ) return; diff --git a/eeschema/dialogs/dialog_edit_components_libid.cpp b/eeschema/dialogs/dialog_edit_components_libid.cpp index 71989c40c6..fd90645139 100644 --- a/eeschema/dialogs/dialog_edit_components_libid.cpp +++ b/eeschema/dialogs/dialog_edit_components_libid.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright 2017 Jean-Pierre Charras, jp.charras@wanadoo.fr - * Copyright 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright 1992-2018 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -511,7 +511,7 @@ bool DIALOG_EDIT_COMPONENTS_LIBID::setLibIdByBrowser( int aRow ) // Use dialog symbol selector to choose a symbol SCH_BASE_FRAME::HISTORY_LIST dummy; SCH_BASE_FRAME::COMPONENT_SELECTION sel = - m_parent->SelectComponentFromLibrary( NULL, dummy, true, 0, 0 ); + m_parent->SelectComponentFromLibrary( NULL, dummy, true, 0, 0, false ); #else // Use library viewer to choose a symbol LIB_ID aPreselectedLibid; diff --git a/eeschema/dialogs/dialog_eeschema_options.h b/eeschema/dialogs/dialog_eeschema_options.h index 1304383cb6..6206dffcc4 100644 --- a/eeschema/dialogs/dialog_eeschema_options.h +++ b/eeschema/dialogs/dialog_eeschema_options.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2009 Wayne Stambaugh - * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -336,6 +336,18 @@ public: */ bool GetShowPageLimits( void ) { return m_checkPageLimits->GetValue(); } + /** + * Function + * Set the FootprintPreview setting in the dialog. + */ + void SetFootprintPreview( bool show ) { m_footprintPreview->SetValue( show ); } + + /** + * Function + * Return the current FootprintPreview setting from the dialog + */ + bool GetFootprintPreview( void ) { return m_footprintPreview->GetValue(); } + /** * Function * Set the AutoplaceFields setting in the dialog diff --git a/eeschema/dialogs/dialog_eeschema_options_base.cpp b/eeschema/dialogs/dialog_eeschema_options_base.cpp index 905ec93c85..ecc5769946 100644 --- a/eeschema/dialogs/dialog_eeschema_options_base.cpp +++ b/eeschema/dialogs/dialog_eeschema_options_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 22 2017) +// C++ code generated with wxFormBuilder (version Jan 2 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -109,6 +109,9 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx m_checkPageLimits->SetValue(true); bSizer92->Add( m_checkPageLimits, 0, wxEXPAND|wxLEFT|wxTOP|wxRIGHT, 3 ); + m_footprintPreview = new wxCheckBox( m_panel5, wxID_ANY, _("Footprint previews in symbol chooser (experimental)"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer92->Add( m_footprintPreview, 0, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 3 ); + bSizer82->Add( bSizer92, 0, wxALL|wxEXPAND, 5 ); diff --git a/eeschema/dialogs/dialog_eeschema_options_base.fbp b/eeschema/dialogs/dialog_eeschema_options_base.fbp index 7046789393..ecbbd827eb 100644 --- a/eeschema/dialogs/dialog_eeschema_options_base.fbp +++ b/eeschema/dialogs/dialog_eeschema_options_base.fbp @@ -1670,6 +1670,94 @@ + + 3 + wxEXPAND|wxLEFT|wxRIGHT|wxTOP + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Footprint previews in symbol chooser (experimental) + + 0 + + + 0 + + 1 + m_footprintPreview + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eeschema/dialogs/dialog_eeschema_options_base.h b/eeschema/dialogs/dialog_eeschema_options_base.h index d8d6da01aa..04e8691a14 100644 --- a/eeschema/dialogs/dialog_eeschema_options_base.h +++ b/eeschema/dialogs/dialog_eeschema_options_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 22 2017) +// C++ code generated with wxFormBuilder (version Jan 2 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -76,6 +76,7 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public DIALOG_SHIM wxCheckBox* m_checkHVOrientation; wxCheckBox* m_checkShowHiddenPins; wxCheckBox* m_checkPageLimits; + wxCheckBox* m_footprintPreview; wxPanel* m_panel3; wxStaticText* m_staticText2; wxChoice* m_choiceUnits; diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index 7e4a1c0c34..be2de0c731 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2014-2017 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2014-2018 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -250,6 +250,7 @@ void SCH_EDIT_FRAME::OnPreferencesOptions( wxCommandEvent& event ) dlg.SetEnableAutoPan( m_canvas->GetEnableAutoPan() ); dlg.SetEnableHVBusOrientation( GetForceHVLines() ); dlg.SetShowPageLimits( m_showPageLimits ); + dlg.SetFootprintPreview( m_footprintPreview ); dlg.SetAutoplaceFields( m_autoplaceFields ); dlg.SetAutoplaceJustify( m_autoplaceJustify ); dlg.SetAutoplaceAlign( m_autoplaceAlign ); @@ -302,6 +303,7 @@ void SCH_EDIT_FRAME::OnPreferencesOptions( wxCommandEvent& event ) m_autoplaceFields = dlg.GetAutoplaceFields(); m_autoplaceJustify = dlg.GetAutoplaceJustify(); m_autoplaceAlign = dlg.GetAutoplaceAlign(); + m_footprintPreview = dlg.GetFootprintPreview(); // Delete all template fieldnames and then restore them using the template field data from // the options dialog @@ -428,6 +430,7 @@ const wxChar RescueNeverShowEntry[] = wxT( "RescueNeverShow" ); const wxChar AutoplaceFieldsEntry[] = wxT( "AutoplaceFields" ); const wxChar AutoplaceJustifyEntry[] = wxT( "AutoplaceJustify" ); const wxChar AutoplaceAlignEntry[] = wxT( "AutoplaceAlign" ); +static const wxChar FootprintPreviewEntry[] = wxT( "FootprintPreview" ); static const wxChar DefaultBusWidthEntry[] = wxT( "DefaultBusWidth" ); static const wxChar DefaultDrawLineWidthEntry[] = wxT( "DefaultDrawLineWidth" ); static const wxChar ShowHiddenPinsEntry[] = wxT( "ShowHiddenPins" ); @@ -521,6 +524,7 @@ void SCH_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg ) aCfg->Read( AutoplaceFieldsEntry, &m_autoplaceFields, true ); aCfg->Read( AutoplaceJustifyEntry, &m_autoplaceJustify, true ); aCfg->Read( AutoplaceAlignEntry, &m_autoplaceAlign, false ); + aCfg->Read( FootprintPreviewEntry, &m_footprintPreview, false ); // Load print preview window session settings. aCfg->Read( PreviewFramePositionXEntry, &tmp, -1 ); @@ -614,6 +618,7 @@ void SCH_EDIT_FRAME::SaveSettings( wxConfigBase* aCfg ) aCfg->Write( AutoplaceFieldsEntry, m_autoplaceFields ); aCfg->Write( AutoplaceJustifyEntry, m_autoplaceJustify ); aCfg->Write( AutoplaceAlignEntry, m_autoplaceAlign ); + aCfg->Write( FootprintPreviewEntry, m_footprintPreview ); // Save print preview window session settings. aCfg->Write( PreviewFramePositionXEntry, m_previewPosition.x ); diff --git a/eeschema/getpart.cpp b/eeschema/getpart.cpp index fc490109ac..0b23cf2f80 100644 --- a/eeschema/getpart.cpp +++ b/eeschema/getpart.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2008 Wayne Stambaugh - * Copyright (C) 2004-2017 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2004-2018 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -105,6 +105,7 @@ SCH_BASE_FRAME::COMPONENT_SELECTION SCH_BASE_FRAME::SelectComponentFromLibrary( bool aUseLibBrowser, int aUnit, int aConvert, + bool aShowFootprints, const LIB_ID* aHighlight, bool aAllowFields ) { @@ -159,7 +160,7 @@ SCH_BASE_FRAME::COMPONENT_SELECTION SCH_BASE_FRAME::SelectComponentFromLibrary( adapter->SetPreselectNode( *aHighlight, /* aUnit */ 0 ); dialogTitle.Printf( _( "Choose Symbol (%d items loaded)" ), adapter->GetComponentsCount() ); - DIALOG_CHOOSE_COMPONENT dlg( this, dialogTitle, adapter, aConvert, aAllowFields ); + DIALOG_CHOOSE_COMPONENT dlg( this, dialogTitle, adapter, aConvert, aAllowFields, aShowFootprints ); if( dlg.ShowQuasiModal() == wxID_CANCEL ) return COMPONENT_SELECTION(); @@ -212,7 +213,8 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* aD SetRepeatItem( NULL ); m_canvas->SetIgnoreMouseEvents( true ); - auto sel = SelectComponentFromLibrary( aFilter, aHistoryList, aUseLibBrowser, 1, 1 ); + auto sel = SelectComponentFromLibrary( aFilter, aHistoryList, aUseLibBrowser, 1, 1, + m_footprintPreview ); if( !sel.LibId.IsValid() ) { diff --git a/eeschema/sch_base_frame.h b/eeschema/sch_base_frame.h index aeebb7a2e0..47b0472f3d 100644 --- a/eeschema/sch_base_frame.h +++ b/eeschema/sch_base_frame.h @@ -1,10 +1,8 @@ -#ifndef SCH_BASE_FRAME_H_ -#define SCH_BASE_FRAME_H_ /* * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck - * Copyright (C) 2015-2017 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2015-2018 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -24,6 +22,9 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ +#ifndef SCH_BASE_FRAME_H_ +#define SCH_BASE_FRAME_H_ + #include #include @@ -188,6 +189,7 @@ public: * @param aConvert preselected De Morgan shape * @param aHighlight name of component to highlight in the list. * highlights none if there isn't one by that name + * @param aShowFootprints whether to show footprints in the dialog * @param aAllowFields whether to allow field editing in the dialog * * @return the selected component @@ -198,6 +200,7 @@ public: bool aUseLibBrowser, int aUnit, int aConvert, + bool aShowFootprints, const LIB_ID* aHighlight = nullptr, bool aAllowFields = true ); diff --git a/eeschema/schframe.h b/eeschema/schframe.h index e727e6cee8..78410407ba 100644 --- a/eeschema/schframe.h +++ b/eeschema/schframe.h @@ -3,7 +3,7 @@ * * Copyright (C) 2015 Jean-Pierre Charras, jp.charras wanadoo.fr * Copyright (C) 2008 Wayne Stambaugh - * Copyright (C) 2004-2017 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2004-2018 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -155,6 +155,7 @@ private: bool m_autoplaceFields; ///< automatically place component fields bool m_autoplaceJustify; ///< allow autoplace to change justification bool m_autoplaceAlign; ///< align autoplaced fields to the grid + bool m_footprintPreview; ///< whether to show footprint previews /// An index to the last find item in the found items list #m_foundItems. int m_foundItemIndex; diff --git a/eeschema/viewlibs.cpp b/eeschema/viewlibs.cpp index 4144b50ad2..2ce088fbbb 100644 --- a/eeschema/viewlibs.cpp +++ b/eeschema/viewlibs.cpp @@ -58,7 +58,7 @@ void LIB_VIEW_FRAME::OnSelectSymbol( wxCommandEvent& aEvent ) dialogTitle.Printf( _( "Choose Symbol (%d items loaded)" ), adapter->GetComponentsCount() ); - DIALOG_CHOOSE_COMPONENT dlg( this, dialogTitle, adapter, m_convert, false ); + DIALOG_CHOOSE_COMPONENT dlg( this, dialogTitle, adapter, m_convert, false, false ); if( dlg.ShowQuasiModal() == wxID_CANCEL ) return; diff --git a/eeschema/widgets/component_tree.cpp b/eeschema/widgets/component_tree.cpp index 54524075cf..a623e694a7 100644 --- a/eeschema/widgets/component_tree.cpp +++ b/eeschema/widgets/component_tree.cpp @@ -2,8 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2014 Henner Zeller - * Copyright (C) 2017 Chris Pavlina - * Copyright (C) 2014-2017 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2014-2018 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -36,7 +35,7 @@ COMPONENT_TREE::COMPONENT_TREE( wxWindow* aParent, SYMBOL_LIB_TABLE* aSymLibTable, - CMP_TREE_MODEL_ADAPTER_BASE::PTR& aAdapter, WIDGETS aWidgets ) + CMP_TREE_MODEL_ADAPTER_BASE::PTR& aAdapter, WIDGETS aWidgets, wxHtmlWindow* aDetails ) : wxPanel( aParent ), m_sym_lib_table( aSymLibTable ), m_adapter( aAdapter ), @@ -82,10 +81,17 @@ COMPONENT_TREE::COMPONENT_TREE( wxWindow* aParent, SYMBOL_LIB_TABLE* aSymLibTabl // Description panel if( aWidgets & DETAILS ) { - m_details_ctrl = new wxHtmlWindow( this, wxID_ANY, wxDefaultPosition, wxSize( 320, 240 ), - wxHW_SCROLLBAR_AUTO | wxSUNKEN_BORDER ); + if( !aDetails ) + { + m_details_ctrl = new wxHtmlWindow( this, wxID_ANY, wxDefaultPosition, wxSize( 320, 240 ), + wxHW_SCROLLBAR_AUTO | wxSUNKEN_BORDER ); - sizer->Add( m_details_ctrl, 1, wxALL | wxEXPAND, 5 ); + sizer->Add( m_details_ctrl, 1, wxALL | wxEXPAND, 5 ); + } + else + { + m_details_ctrl = aDetails; + } m_details_ctrl->Bind( wxEVT_HTML_LINK_CLICKED, &COMPONENT_TREE::onDetailsLink, this ); } diff --git a/eeschema/widgets/component_tree.h b/eeschema/widgets/component_tree.h index 1445229fba..34b5d73803 100644 --- a/eeschema/widgets/component_tree.h +++ b/eeschema/widgets/component_tree.h @@ -2,8 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2014 Henner Zeller - * Copyright (C) 2017 Chris Pavlina - * Copyright (C) 2014-2017 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2014-2018 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -46,8 +45,19 @@ public: ///> Flags to select extra widgets enum WIDGETS { NONE = 0x00, SEARCH = 0x01, DETAILS = 0x02, ALL = 0xFF }; + /** + * Construct a component tree. + * + * @param aParent parent window containing this tree widget + * @param aSymLibTable table containing symbols to display + * @param aAdapter a CMP_TREE_MODEL_ADAPTER instance to use + * @param aWidgets selection of sub-widgets to include + * @param aDetails if not null, a custom wxHtmlWindow to hold symbol details. If null this will + * be created inside the COMPONENT_TREE. + */ COMPONENT_TREE( wxWindow* aParent, SYMBOL_LIB_TABLE* aSymLibTable, - CMP_TREE_MODEL_ADAPTER_BASE::PTR& aAdapter, WIDGETS aWidgets = ALL ); + CMP_TREE_MODEL_ADAPTER_BASE::PTR& aAdapter, WIDGETS aWidgets = ALL, + wxHtmlWindow *aDetails = nullptr ); /** * For multi-unit components, if the user selects the component itself