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;
30class wxPageSetupDialogData;
31class wxPrintout;
32class wxPrintData;
33
35{
36public:
38 virtual ~DIALOG_PRINT_GENERIC();
39
44 void ForcePrintBorder( bool aValue );
45
46protected:
50 virtual wxPrintout* createPrintout( const wxString& aTitle ) = 0;
51
52 virtual void saveSettings();
53
54 wxSizer* getMainSizer()
55 {
56 return m_bUpperSizer;
57 }
58
59 wxGridBagSizer* getOptionsSizer()
60 {
61 return m_gbOptionsSizer;
62 }
63
64 wxStaticBox* getOptionsBox()
65 {
66 return m_sbOptionsSizer->GetStaticBox();
67 }
68
74 double getScaleValue();
75
81 void setScaleValue( double aValue );
82
83 // There is no TransferDataFromWindow() so options are saved
84 // even if the dialog is closed without printing
85 bool TransferDataToWindow() override;
86
87private:
88 void onPageSetup( wxCommandEvent& event ) override;
89 void onPrintPreview( wxCommandEvent& event ) override;
90 void onPrintButtonClick( wxCommandEvent& event ) override;
91 void onCancelButtonClick( wxCommandEvent& aEvent ) override;
92
93 // Needed to save the dialogs settings as TransferDataFromWindow()
94 // is not called for 'Cancel' button that closes the window.
95 void onClose( wxCloseEvent& event ) override;
96
97 void onSetCustomScale( wxCommandEvent& event ) override;
98
99 void initPrintData();
100
101protected:
103
105
106private:
107 wxFloatingPointValidator<double> m_scaleValidator;
108
109 static wxPrintData* s_PrintData;
110 static wxPageSetupDialogData* s_pageSetupData;
111};
112
113#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