KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_print_generic.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2018 CERN
3 * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
4 * Author: Maciej Suminski <[email protected]>
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef DIALOG_PRINT_GENERIC_H
21#define DIALOG_PRINT_GENERIC_H
22
24#include <wx/valnum.h>
25#include <widgets/unit_binder.h>
26
27class EDA_DRAW_FRAME;
29class wxPageSetupDialogData;
30class wxPrintout;
31class wxPrintData;
32
34{
35public:
37 virtual ~DIALOG_PRINT_GENERIC();
38
43 void ForcePrintBorder( bool aValue );
44
45protected:
49 virtual wxPrintout* createPrintout( const wxString& aTitle ) = 0;
50
51 virtual void saveSettings();
52
53 wxSizer* getMainSizer()
54 {
55 return m_bUpperSizer;
56 }
57
58 wxGridBagSizer* getOptionsSizer()
59 {
60 return m_gbOptionsSizer;
61 }
62
63 wxStaticBox* getOptionsBox()
64 {
65 return m_sbOptionsSizer->GetStaticBox();
66 }
67
73 double getScaleValue();
74
80 void setScaleValue( double aValue );
81
82 // There is no TransferDataFromWindow() so options are saved
83 // even if the dialog is closed without printing
84 bool TransferDataToWindow() override;
85
86private:
87 void onPageSetup( wxCommandEvent& event ) override;
88 void onPrintPreview( wxCommandEvent& event ) override;
89 void onPrintButtonClick( wxCommandEvent& event ) override;
90 void onCancelButtonClick( wxCommandEvent& aEvent ) override;
91
92 // Needed to save the dialogs settings as TransferDataFromWindow()
93 // is not called for 'Cancel' button that closes the window.
94 void onClose( wxCloseEvent& event ) override;
95
96 void onSetCustomScale( wxCommandEvent& event ) override;
97
98 void initPrintData();
99
100protected:
102
104
105private:
106 wxFloatingPointValidator<double> m_scaleValidator;
107
108 static wxPrintData* s_PrintData;
109 static wxPageSetupDialogData* s_pageSetupData;
110};
111
112#endif // DIALOG_PRINT_GENERIC_H
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:92
Class DIALOG_PRINT_GENERIC_BASE.
APP_SETTINGS_BASE * m_config
void onClose(wxCloseEvent &event) override
void setScaleValue(double aValue)
Select a corresponding scale radio button and update custom scale value if needed.
void onSetCustomScale(wxCommandEvent &event) override
static wxPrintData * s_PrintData
wxStaticBox * getOptionsBox()
void onCancelButtonClick(wxCommandEvent &aEvent) override
virtual wxPrintout * createPrintout(const wxString &aTitle)=0
Create a printout with a requested title.
bool TransferDataToWindow() override
void onPageSetup(wxCommandEvent &event) override
double getScaleValue()
Return scale value selected in the dialog.
void onPrintButtonClick(wxCommandEvent &event) override
wxFloatingPointValidator< double > m_scaleValidator
void ForcePrintBorder(bool aValue)
Set 'print border and title block' to a requested value and hides the corresponding checkbox.
static wxPageSetupDialogData * s_pageSetupData
wxGridBagSizer * getOptionsSizer()
void onPrintPreview(wxCommandEvent &event) override
PRINTOUT_SETTINGS * m_settings
The base class for create windows for drawing purpose.
Handle the parameters used to print a board drawing.
Definition: printout.h:32