eeschema: make footprint preview optional

The footprint preview and selection has been problematic for some users;
I'd rather option it out for 5.0 and work on polishing it for 6.0.
This commit is contained in:
Chris Pavlina 2018-01-02 19:52:35 -07:00
parent 4298d4ff4e
commit 0945c319f0
15 changed files with 220 additions and 51 deletions

View File

@ -2,8 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 Henner Zeller <h.zeller@acm.org>
* Copyright (C) 2017 Chris Pavlina <pavlina.chris@gmail.com>
* 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<FOOTPRINT_LIST> 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<wxWindow *>( vsplitter ) : static_cast<wxWindow *>( 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 );

View File

@ -2,8 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 Henner Zeller <h.zeller@acm.org>
* Copyright (C) 2017 Chris Pavlina <pavlina.chris@gmail.com>
* 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;

View File

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

View File

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

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Wayne Stambaugh <stambaughw@verizon.net>
* 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

View File

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

View File

@ -1670,6 +1670,94 @@
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxEXPAND|wxLEFT|wxRIGHT|wxTOP</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Footprint previews in symbol chooser (experimental)</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_footprintPreview</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
</object>

View File

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

View File

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

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
* 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() )
{

View File

@ -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 <dick@softplc.com>
* 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 <lib_id.h>
#include <draw_frame.h>
@ -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 );

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras wanadoo.fr
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
* 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;

View File

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

View File

@ -2,8 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 Henner Zeller <h.zeller@acm.org>
* Copyright (C) 2017 Chris Pavlina <pavlina.chris@gmail.com>
* 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 );
}

View File

@ -2,8 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 Henner Zeller <h.zeller@acm.org>
* Copyright (C) 2017 Chris Pavlina <pavlina.chris@gmail.com>
* 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