KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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-2023 KiCad Developers, see AUTHORS.txt for contributors.
5 * Copyright (C) 2017 Chris Pavlina <[email protected]>
6 * Copyright (C) 2016 Tomasz Wlostowski <[email protected]>
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 <map>
26#include <deque>
27#include <functional>
28
29#include <pcb_draw_panel_gal.h>
30#include <gal/color4d.h>
32#include <lib_id.h>
33#include <kiway_player.h>
34#include <optional>
35
37
38class FOOTPRINT;
39class KIWAY;
40class IO_MGR;
41class BOARD;
42class FOOTPRINT;
43
44
50 public KIWAY_HOLDER,
52{
53public:
54
55 virtual ~FOOTPRINT_PREVIEW_PANEL( );
56
57 virtual void SetUserUnits( EDA_UNITS aUnits ) override { m_userUnits = aUnits; }
58 virtual void SetPinFunctions( const std::map<wxString, wxString>& aPinFunctions ) override
59 {
60 m_pinFunctions = aPinFunctions;
61 }
62
63 virtual bool DisplayFootprint( const LIB_ID& aFPID ) override;
64 virtual void DisplayFootprints( std::shared_ptr<FOOTPRINT> aFootprintA,
65 std::shared_ptr<FOOTPRINT> aFootprintB ) override;
66
67 virtual const KIGFX::COLOR4D& GetBackgroundColor() const override;
68 virtual const KIGFX::COLOR4D& GetForegroundColor() const override;
69
70 virtual wxWindow* GetWindow() override;
71 BOARD* GetBoard() { return m_dummyBoard.get(); }
72
73 virtual void RefreshAll() override;
74
75 static FOOTPRINT_PREVIEW_PANEL* New( KIWAY* aKiway, wxWindow* aParent,
76 UNITS_PROVIDER* aUnitsProvider );
77 const FOOTPRINT* GetCurrentFootprint() const { return m_currentFootprint.get(); }
78
79private:
88 FOOTPRINT_PREVIEW_PANEL( KIWAY* aKiway, wxWindow* aParent, UNITS_PROVIDER* aUnitsProvider,
89 std::unique_ptr<KIGFX::GAL_DISPLAY_OPTIONS> aOpts, GAL_TYPE aGalType );
90
91 void renderFootprint( std::shared_ptr<FOOTPRINT> aFootprint );
92
94
95private:
96 std::unique_ptr<BOARD> m_dummyBoard;
97 std::unique_ptr<KIGFX::GAL_DISPLAY_OPTIONS> m_displayOptions;
99 std::map<wxString, wxString> m_pinFunctions;
100 std::shared_ptr<FOOTPRINT> m_currentFootprint;
101 std::shared_ptr<FOOTPRINT> m_otherFootprint;
102};
103
104#endif
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:282
Base class for the actual viewer panel.
Panel that renders a single footprint via Cairo GAL, meant to be exported through Kiface.
const FOOTPRINT * GetCurrentFootprint() const
void renderFootprint(std::shared_ptr< FOOTPRINT > aFootprint)
std::shared_ptr< FOOTPRINT > m_currentFootprint
virtual wxWindow * GetWindow() override
Get the underlying wxWindow.
virtual void DisplayFootprints(std::shared_ptr< FOOTPRINT > aFootprintA, std::shared_ptr< FOOTPRINT > aFootprintB) override
Display a pair of footprints.
std::map< wxString, wxString > m_pinFunctions
virtual void SetUserUnits(EDA_UNITS aUnits) override
virtual void RefreshAll() override
Force the redrawing of all contents.
std::shared_ptr< FOOTPRINT > m_otherFootprint
virtual const KIGFX::COLOR4D & GetBackgroundColor() const override
Get the colors to use in a preview widget to match the preview panel.
std::unique_ptr< KIGFX::GAL_DISPLAY_OPTIONS > m_displayOptions
virtual bool DisplayFootprint(const LIB_ID &aFPID) override
Set the currently displayed footprint.
std::unique_ptr< BOARD > m_dummyBoard
static FOOTPRINT_PREVIEW_PANEL * New(KIWAY *aKiway, wxWindow *aParent, UNITS_PROVIDER *aUnitsProvider)
virtual void SetPinFunctions(const std::map< wxString, wxString > &aPinFunctions) override
Set the pin functions from the symbol's netlist.
virtual const KIGFX::COLOR4D & GetForegroundColor() const override
Definition: io_mgr.h:37
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
A mix in class which holds the location of a wxWindow's KIWAY.
Definition: kiway_holder.h:39
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h:279
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:49
EDA_UNITS
Definition: eda_units.h:46