KiCad PCB EDA Suite
footprint_preview_panel.h
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2016-2017 KiCad Developers, see AUTHORS.txt for contributors.
5  * Copyright (C) 2017 Chris Pavlina <pavlina.chris@gmail.com>
6  * Copyright (C) 2016 Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
7  *
8  * This program is free software: you can redistribute it and/or modify it
9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation, either version 3 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef __FOOTPRINT_PREVIEW_PANEL_H
23 #define __FOOTPRINT_PREVIEW_PANEL_H
24 
25 #include <wx/wx.h>
26 
27 #include <map>
28 #include <deque>
29 #include <functional>
30 
31 #include <pcb_draw_panel_gal.h>
33 #include <lib_id.h>
34 #include <kiway_player.h>
35 #include <boost/optional.hpp>
36 
38 
39 class MODULE;
40 class KIWAY;
41 class IO_MGR;
42 class BOARD;
43 class FP_LOADER_THREAD;
44 class FP_THREAD_IFACE;
45 
46 
53 {
54  friend class FP_THREAD_IFACE;
55  friend class FP_LOADER_THREAD;
56 
57 public:
58 
59  virtual ~FOOTPRINT_PREVIEW_PANEL( );
60 
61  virtual void CacheFootprint( LIB_ID const& aFPID ) override;
62 
63  virtual void DisplayFootprint ( LIB_ID const& aFPID ) override;
64 
65  virtual void SetStatusHandler( FOOTPRINT_STATUS_HANDLER aHandler ) override;
66 
67  virtual wxWindow* GetWindow() override;
68 
69  static FOOTPRINT_PREVIEW_PANEL* New( KIWAY* aKiway, wxWindow* aParent );
70 
71 private:
72 
73  struct CACHE_ENTRY {
77  };
78 
80  KIWAY* aKiway, wxWindow* aParent,
81  KIGFX::GAL_DISPLAY_OPTIONS& aOpts, GAL_TYPE aGalType );
82 
83 
84  virtual CACHE_ENTRY CacheAndReturn ( LIB_ID const& aFPID );
85 
86  void OnLoaderThreadUpdate( wxCommandEvent& aEvent );
87 
88  void renderFootprint( MODULE *module );
89 
91  std::shared_ptr<FP_THREAD_IFACE> m_iface;
93  std::unique_ptr<BOARD> m_dummyBoard;
94 
97 };
98 
99 #endif
Class KIWAY_HOLDER is a mix in class which holds the location of a wxWindow's KIWAY.
Definition: kiway_player.h:48
LIB_ID fpid
Footprint loader thread to prevent footprint loading from locking the UI.
FOOTPRINT_STATUS status
void renderFootprint(MODULE *module)
virtual CACHE_ENTRY CacheAndReturn(LIB_ID const &aFPID)
std::shared_ptr< FP_THREAD_IFACE > m_iface
Class LIB_ID.
Definition: lib_id.h:56
Panel that renders a single footprint via Cairo GAL, meant to be exported through Kiface...
Class IO_MGR is a factory which returns an instance of a PLUGIN.
Definition: io_mgr.h:42
virtual wxWindow * GetWindow() override
Get the underlying wxWindow.
std::unique_ptr< BOARD > m_dummyBoard
Threadsafe interface class between loader thread and panel class.
virtual void SetStatusHandler(FOOTPRINT_STATUS_HANDLER aHandler) override
Set the callback to receive status updates.
static FOOTPRINT_PREVIEW_PANEL * New(KIWAY *aKiway, wxWindow *aParent)
Class KIWAY is a minimalistic software bus for communications between various DLLs/DSOs (DSOs) within...
Definition: kiway.h:257
Base class for the actual viewer panel.
virtual void CacheFootprint(LIB_ID const &aFPID) override
Preload a footprint into the cache.
void OnLoaderThreadUpdate(wxCommandEvent &aEvent)
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:166
FOOTPRINT_STATUS_HANDLER m_handler
MODULE * module
virtual void DisplayFootprint(LIB_ID const &aFPID) override
Set the currently displayed footprint.
FOOTPRINT_PREVIEW_PANEL(KIWAY *aKiway, wxWindow *aParent, KIGFX::GAL_DISPLAY_OPTIONS &aOpts, GAL_TYPE aGalType)
std::function< void(FOOTPRINT_STATUS)> FOOTPRINT_STATUS_HANDLER