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;
42
43
49 public KIWAY_HOLDER,
51{
52public:
53
54 virtual ~FOOTPRINT_PREVIEW_PANEL( );
55
56 virtual void SetUserUnits( EDA_UNITS aUnits ) override { m_userUnits = aUnits; }
57 virtual bool DisplayFootprint( const LIB_ID& aFPID ) override;
58 virtual void DisplayFootprints( std::shared_ptr<FOOTPRINT> aFootprintA,
59 std::shared_ptr<FOOTPRINT> aFootprintB ) override;
60
61 virtual const KIGFX::COLOR4D& GetBackgroundColor() const override;
62 virtual const KIGFX::COLOR4D& GetForegroundColor() const override;
63
64 virtual wxWindow* GetWindow() override;
65 BOARD* GetBoard() { return m_dummyBoard.get(); }
66
67 virtual void RefreshAll() override;
68
69 static FOOTPRINT_PREVIEW_PANEL* New( KIWAY* aKiway, wxWindow* aParent,
70 UNITS_PROVIDER* aUnitsProvider );
71
72private:
81 FOOTPRINT_PREVIEW_PANEL( KIWAY* aKiway, wxWindow* aParent, UNITS_PROVIDER* aUnitsProvider,
82 std::unique_ptr<KIGFX::GAL_DISPLAY_OPTIONS> aOpts, GAL_TYPE aGalType );
83
84 void renderFootprint( std::shared_ptr<FOOTPRINT> aFootprint );
85
87
88private:
89 std::unique_ptr<BOARD> m_dummyBoard;
90 std::unique_ptr<KIGFX::GAL_DISPLAY_OPTIONS> m_displayOptions;
92 std::shared_ptr<FOOTPRINT> m_currentFootprint;
93 std::shared_ptr<FOOTPRINT> m_otherFootprint;
94};
95
96#endif
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:276
Base class for the actual viewer panel.
Panel that renders a single footprint via Cairo GAL, meant to be exported through Kiface.
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.
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 const KIGFX::COLOR4D & GetForegroundColor() const override
A factory which returns an instance of a PLUGIN.
Definition: io_mgr.h:46
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:37
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