KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_export_3d_image.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 3
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, see <https://www.gnu.org/licenses/>.
18 */
19
20#pragma once
21
22#include "dialog_shim.h"
23#include <3d_viewer/eda_3d_viewer_frame.h> // for EDA_3D_VIEWER_EXPORT_FORMAT
25#include <wx/spinctrl.h>
26#include <wx/choice.h>
27#include <wx/stattext.h>
28#include <wx/bmpbuttn.h>
29
37
43
45{
46public:
47 DIALOG_EXPORT_3D_IMAGE( wxWindow* aParent, const wxSize& aCanvasSize,
49
50 wxSize GetSize() const { return wxSize( m_width, m_height ); }
51 double GetXResolution() const { return m_xResolution; }
52 double GetYResolution() const { return m_yResolution; }
53
54private:
55 bool TransferDataToWindow() override;
56 bool TransferDataFromWindow() override;
57
58 void OnLockToggle( wxCommandEvent& aEvent );
59 void OnWidthChange( wxSpinDoubleEvent& aEvent );
60 void OnHeightChange( wxSpinDoubleEvent& aEvent );
61 void OnXResolutionChange( wxSpinDoubleEvent& aEvent );
62 void OnYResolutionChange( wxSpinDoubleEvent& aEvent );
63 void OnSizeUnitChange( wxCommandEvent& aEvent );
64 void OnResolutionUnitChange( wxCommandEvent& aEvent );
65
66 wxSize GetPixelSize( double aWidth, double aHeight, double aXResolution, double aYResolution, SIZE_UNITS aSizeUnits ) const;
67 void UpdatePixelSize();
68 void UpdateAspectRatio();
69 void ConvertSizeUnits( SIZE_UNITS aFromUnit, SIZE_UNITS aToUnit );
71
72private:
81
84
85 wxSpinCtrlDouble* m_spinWidth;
86 wxSpinCtrlDouble* m_spinHeight;
87 wxSpinCtrlDouble* m_spinXResolution;
88 wxSpinCtrlDouble* m_spinYResolution;
91 wxBitmapButton* m_lockButton;
92 wxStaticText* m_pixelSizeLabel;
93};
DIALOG_EXPORT_3D_IMAGE(wxWindow *aParent, const wxSize &aCanvasSize, EDA_3D_VIEWER_SETTINGS::EXPORT_IMAGE_SETTINGS *aCfg)
void OnWidthChange(wxSpinDoubleEvent &aEvent)
void OnXResolutionChange(wxSpinDoubleEvent &aEvent)
void OnLockToggle(wxCommandEvent &aEvent)
void OnHeightChange(wxSpinDoubleEvent &aEvent)
wxSize GetPixelSize(double aWidth, double aHeight, double aXResolution, double aYResolution, SIZE_UNITS aSizeUnits) const
void OnResolutionUnitChange(wxCommandEvent &aEvent)
void OnYResolutionChange(wxSpinDoubleEvent &aEvent)
wxSpinCtrlDouble * m_spinYResolution
wxSpinCtrlDouble * m_spinHeight
void ConvertSizeUnits(SIZE_UNITS aFromUnit, SIZE_UNITS aToUnit)
wxSpinCtrlDouble * m_spinXResolution
void OnSizeUnitChange(wxCommandEvent &aEvent)
EDA_3D_VIEWER_SETTINGS::EXPORT_IMAGE_SETTINGS * m_cfg
void ConvertResolutionUnits(RESOLUTION_UNITS aFromUnit, RESOLUTION_UNITS aToUnit)
DIALOG_SHIM(wxWindow *aParent, wxWindowID id, const wxString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER, const wxString &name=wxDialogNameStr)
Declaration of the eda_3d_viewer class.
static const long long MM