2018-10-05 14:41:17 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2018 CERN
|
2021-07-21 21:37:49 +00:00
|
|
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
2018-10-05 14:41:17 +00:00
|
|
|
* 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;
|
2024-04-27 19:57:24 +00:00
|
|
|
class APP_SETTINGS_BASE;
|
2018-10-05 14:41:17 +00:00
|
|
|
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.
|
2021-07-21 21:37:49 +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.
|
2021-07-21 21:37:49 +00:00
|
|
|
*
|
2018-10-05 14:41:17 +00:00
|
|
|
* @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;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void onPageSetup( wxCommandEvent& event ) override;
|
|
|
|
void onPrintPreview( wxCommandEvent& event ) override;
|
|
|
|
void onPrintButtonClick( wxCommandEvent& event ) override;
|
2021-07-21 21:37:49 +00:00
|
|
|
void onCancelButtonClick( wxCommandEvent& aEvent ) override;
|
2018-10-05 14:41:17 +00:00
|
|
|
|
2021-07-21 21:37:49 +00:00
|
|
|
// 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 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();
|
|
|
|
|
2021-07-21 21:37:49 +00:00
|
|
|
protected:
|
|
|
|
APP_SETTINGS_BASE* m_config;
|
|
|
|
|
|
|
|
PRINTOUT_SETTINGS* m_settings;
|
|
|
|
|
|
|
|
private:
|
2018-10-05 14:41:17 +00:00
|
|
|
wxFloatingPointValidator<double> m_scaleValidator;
|
|
|
|
|
|
|
|
static wxPrintData* s_PrintData;
|
|
|
|
static wxPageSetupDialogData* s_pageSetupData;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // DIALOG_PRINT_GENERIC_H
|