KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_via_stitch_properties.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 The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24#pragma once
25
27
28#include <memory>
29
31class PCB_VIA_STITCH;
32class PCB_VIA;
33class PCB_TRACK;
34class UNIT_BINDER;
35
36namespace KIGFX
37{
38class ORIGIN_VIEWITEM;
39}
40
41
52{
53public:
56
57protected:
58 bool TransferDataToWindow() override;
59 bool TransferDataFromWindow() override;
60
61 void OnValuesChanged( wxCommandEvent& event ) override;
62 void OnViaConfigureClicked( wxCommandEvent& event ) override;
63 void OnCancel( wxCommandEvent& event ) override;
64 void OnUpdateUI( wxUpdateUIEvent& event ) override;
65
66private:
70
72 void redrawPreview();
73
80 int buildStitchPreview( std::vector<VECTOR2I>& aSamples );
81
88 int buildGuardPreview( std::vector<VECTOR2I>& aSamples );
89
91 void fitPreview();
92
94 void prepareCanvas();
95
96private:
98
101
103 std::unique_ptr<PCB_VIA_STITCH> m_workingCopy;
104
105 std::unique_ptr<UNIT_BINDER> m_pitchBinder;
106 std::unique_ptr<UNIT_BINDER> m_posXBinder;
107 std::unique_ptr<UNIT_BINDER> m_posYBinder;
108
110
112 std::vector<std::unique_ptr<PCB_VIA>> m_previewVias;
113
115 std::vector<std::unique_ptr<PCB_TRACK>> m_previewTracks;
116
118
122};
DIALOG_VIA_STITCH_PROPERTIES_BASE(wxWindow *parent, wxWindowID id=wxID_DIALOG_EDIT_PAD, const wxString &title=_("Via Stitch Properties"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
void OnCancel(wxCommandEvent &event) override
std::unique_ptr< UNIT_BINDER > m_posYBinder
std::vector< std::unique_ptr< PCB_VIA > > m_previewVias
Vias currently in the preview canvas, used for both Guard and Stitch mode previews.
DIALOG_VIA_STITCH_PROPERTIES(PCB_BASE_EDIT_FRAME *aFrame, PCB_VIA_STITCH *aStitch)
std::unique_ptr< PCB_VIA_STITCH > m_workingCopy
Off-board clone of m_stitch used to drive the preview without touching the board.
void OnUpdateUI(wxUpdateUIEvent &event) override
int m_previewExtent
Side length of the tile drawn by the last redrawPreview(), in IU; 0 if nothing is currently drawn.
int buildStitchPreview(std::vector< VECTOR2I > &aSamples)
Builds a preview for stitch mode.
int buildGuardPreview(std::vector< VECTOR2I > &aSamples)
Builds a preview for guard mode.
void OnViaConfigureClicked(wxCommandEvent &event) override
std::vector< std::unique_ptr< PCB_TRACK > > m_previewTracks
Tracks currently in the preview canvas, only used for Guard mode preview.
void redrawPreview()
Push the GAL preview to reflect the current m_workingCopy state.
std::unique_ptr< UNIT_BINDER > m_pitchBinder
PCB_VIA_STITCH * m_stitch
The live generator being edited. Only written back on OK.
void OnValuesChanged(wxCommandEvent &event) override
void prepareCanvas()
First-time set-up of m_panelShowPreview — colors, view layers, board attachment.
void updateWorkingCopyFromUI()
Pull values out of UI controls into m_workingCopy, regenerate its children, and re-zoom the preview c...
std::unique_ptr< UNIT_BINDER > m_posXBinder
void fitPreview()
Autozoom the preview canvas onto the last-rendered tile.
Common, abstract interface for edit frames.
The Cairo implementation of the graphics abstraction layer.
Definition eda_group.h:30