-
-
Notifications
You must be signed in to change notification settings - Fork 486
/
footprint_preview_panel.h
104 lines (85 loc) · 3.55 KB
/
footprint_preview_panel.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2016-2023 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2017 Chris Pavlina <[email protected]>
* Copyright (C) 2016 Tomasz Wlostowski <[email protected]>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __FOOTPRINT_PREVIEW_PANEL_H
#define __FOOTPRINT_PREVIEW_PANEL_H
#include <map>
#include <deque>
#include <functional>
#include <pcb_draw_panel_gal.h>
#include <gal/color4d.h>
#include <gal/gal_display_options.h>
#include <lib_id.h>
#include <kiway_player.h>
#include <optional>
#include <widgets/footprint_preview_widget.h>
class FOOTPRINT;
class KIWAY;
class IO_MGR;
class BOARD;
class FOOTPRINT;
/**
* Panel that renders a single footprint via Cairo GAL, meant to be exported
* through Kiface.
*/
class FOOTPRINT_PREVIEW_PANEL : public PCB_DRAW_PANEL_GAL,
public KIWAY_HOLDER,
public FOOTPRINT_PREVIEW_PANEL_BASE
{
public:
virtual ~FOOTPRINT_PREVIEW_PANEL( );
virtual void SetUserUnits( EDA_UNITS aUnits ) override { m_userUnits = aUnits; }
virtual void SetPinFunctions( const std::map<wxString, wxString>& aPinFunctions ) override
{
m_pinFunctions = aPinFunctions;
}
virtual bool DisplayFootprint( const LIB_ID& aFPID ) override;
virtual void DisplayFootprints( std::shared_ptr<FOOTPRINT> aFootprintA,
std::shared_ptr<FOOTPRINT> aFootprintB ) override;
virtual const KIGFX::COLOR4D& GetBackgroundColor() const override;
virtual const KIGFX::COLOR4D& GetForegroundColor() const override;
virtual wxWindow* GetWindow() override;
BOARD* GetBoard() { return m_dummyBoard.get(); }
virtual void RefreshAll() override;
static FOOTPRINT_PREVIEW_PANEL* New( KIWAY* aKiway, wxWindow* aParent,
UNITS_PROVIDER* aUnitsProvider );
const FOOTPRINT* GetCurrentFootprint() const { return m_currentFootprint.get(); }
private:
/**
* Create a new panel
*
* @param aKiway the connected KIWAY
* @param aParent the owning WX window
* @param aOpts the GAL options (ownership is assumed)
* @param aGalType the displayed GAL type
*/
FOOTPRINT_PREVIEW_PANEL( KIWAY* aKiway, wxWindow* aParent, UNITS_PROVIDER* aUnitsProvider,
std::unique_ptr<KIGFX::GAL_DISPLAY_OPTIONS> aOpts, GAL_TYPE aGalType );
void renderFootprint( std::shared_ptr<FOOTPRINT> aFootprint );
void fitToCurrentFootprint();
private:
std::unique_ptr<BOARD> m_dummyBoard;
std::unique_ptr<KIGFX::GAL_DISPLAY_OPTIONS> m_displayOptions;
EDA_UNITS m_userUnits;
std::map<wxString, wxString> m_pinFunctions;
std::shared_ptr<FOOTPRINT> m_currentFootprint;
std::shared_ptr<FOOTPRINT> m_otherFootprint;
};
#endif