2018-10-05 14:41:17 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2018 CERN
|
|
|
|
* Author: Maciej Suminski <maciej.suminski@cern.ch>
|
|
|
|
*
|
|
|
|
* 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 DIALOG_PRINT_GENERIC_H
|
|
|
|
#define DIALOG_PRINT_GENERIC_H
|
|
|
|
|
2020-12-17 13:12:18 +00:00
|
|
|
#include <dialogs/dialog_print_generic_base.h>
|
2018-10-05 14:41:17 +00:00
|
|
|
#include <wx/valnum.h>
|
|
|
|
#include <widgets/unit_binder.h>
|
|
|
|
|
|
|
|
class EDA_DRAW_FRAME;
|
|
|
|
struct PRINTOUT_SETTINGS;
|
2021-06-03 22:32:32 +00:00
|
|
|
class wxPageSetupDialogData;
|
|
|
|
class wxPrintout;
|
|
|
|
class wxPrintData;
|
2018-10-05 14:41:17 +00:00
|
|
|
|
|
|
|
class DIALOG_PRINT_GENERIC : public DIALOG_PRINT_GENERIC_BASE
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DIALOG_PRINT_GENERIC( EDA_DRAW_FRAME* aParent, PRINTOUT_SETTINGS* aSettings );
|
|
|
|
virtual ~DIALOG_PRINT_GENERIC();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set 'print border and title block' to a requested value and hides the
|
|
|
|
* corresponding checkbox.
|
|
|
|
*/
|
|
|
|
void ForcePrintBorder( bool aValue );
|
|
|
|
|
|
|
|
protected:
|
|
|
|
/**
|
|
|
|
* Create a printout with a requested title.
|
|
|
|
*/
|
|
|
|
virtual wxPrintout* createPrintout( const wxString& aTitle ) = 0;
|
|
|
|
|
|
|
|
virtual void saveSettings();
|
|
|
|
|
|
|
|
wxSizer* getMainSizer()
|
|
|
|
{
|
2021-04-16 12:12:55 +00:00
|
|
|
return m_bUpperSizer;
|
2018-10-05 14:41:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
wxGridBagSizer* getOptionsSizer()
|
|
|
|
{
|
2021-04-16 12:12:55 +00:00
|
|
|
return m_gbOptionsSizer;
|
2018-10-05 14:41:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
wxStaticBox* getOptionsBox()
|
|
|
|
{
|
2021-04-16 12:12:55 +00:00
|
|
|
return m_sbOptionsSizer->GetStaticBox();
|
2018-10-05 14:41:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return scale value selected in the dialog.
|
2019-07-18 11:14:42 +00:00
|
|
|
* if this value is outside limits, it will be clamped
|
2018-10-05 14:41:17 +00:00
|
|
|
*/
|
2019-07-18 11:14:42 +00:00
|
|
|
double getScaleValue();
|
2018-10-05 14:41:17 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Select a corresponding scale radio button and update custom scale value if needed.
|
|
|
|
* @param aValue is the scale value to be selected (0 stands for fit-to-page).
|
|
|
|
*/
|
|
|
|
void setScaleValue( double aValue );
|
|
|
|
|
|
|
|
// There is no TransferDataFromWindow() so options are saved
|
|
|
|
// even if the dialog is closed without printing
|
|
|
|
bool TransferDataToWindow() override;
|
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
APP_SETTINGS_BASE* m_config;
|
2018-10-05 14:41:17 +00:00
|
|
|
|
|
|
|
PRINTOUT_SETTINGS* m_settings;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void onPageSetup( wxCommandEvent& event ) override;
|
|
|
|
void onPrintPreview( wxCommandEvent& event ) override;
|
|
|
|
void onPrintButtonClick( wxCommandEvent& event ) override;
|
|
|
|
|
2018-11-07 08:31:40 +00:00
|
|
|
// onClose* handlers are needed to save the dialogs settings as TransferDataFromWindow()
|
|
|
|
// is not called for 'Cancel' button that closes the window
|
2018-10-05 14:41:17 +00:00
|
|
|
void onCloseButton( wxCommandEvent& event ) override;
|
|
|
|
void onClose( wxCloseEvent& event ) override;
|
2018-11-07 08:31:40 +00:00
|
|
|
|
2018-10-05 14:41:17 +00:00
|
|
|
void onSetCustomScale( wxCommandEvent& event ) override;
|
|
|
|
|
|
|
|
void initPrintData();
|
|
|
|
|
|
|
|
wxFloatingPointValidator<double> m_scaleValidator;
|
|
|
|
|
|
|
|
static wxPrintData* s_PrintData;
|
|
|
|
static wxPageSetupDialogData* s_pageSetupData;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // DIALOG_PRINT_GENERIC_H
|