kicad/include/dialogs/dialog_page_settings.h

138 lines
5.1 KiB
C
Raw Normal View History

2012-03-26 21:45:05 +00:00
/*
* This program source code file is part of KiCad, a free EDA CAD application.
2012-03-26 21:45:05 +00:00
*
* Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
2012-03-26 21:45:05 +00:00
*
* 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.
2012-03-26 21:45:05 +00:00
*
* 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.
2012-03-26 21:45:05 +00:00
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
2012-03-26 21:45:05 +00:00
*/
#ifndef _DIALOG_PAGES_SETTINGS_H_
#define _DIALOG_PAGES_SETTINGS_H_
#include <page_info.h>
#include <title_block.h>
#include <widgets/unit_binder.h>
#include <dialog_page_settings_base.h>
2021-02-22 23:47:17 +00:00
class DS_DATA_MODEL;
/*!
* DIALOG_PAGES_SETTINGS class declaration
*/
class DIALOG_PAGES_SETTINGS: public DIALOG_PAGES_SETTINGS_BASE
{
public:
DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* aParent, double aIuPerMils,
const wxSize& aMaxUserSizeMils );
virtual ~DIALOG_PAGES_SETTINGS();
const wxString GetWksFileName()
{
return m_textCtrlFilePicker->GetValue();
}
void SetWksFileName(const wxString& aFilename )
{
m_textCtrlFilePicker->SetValue( aFilename );
}
void EnableWksFileNamePicker( bool aEnable )
{
m_textCtrlFilePicker->Enable( aEnable );
m_browseButton->Enable( aEnable );
}
private:
virtual void onTransferDataToWindow() {}
virtual bool onSavePageSettings()
{
// default just return true savepagesettings to succeed
return true;
}
virtual bool TransferDataToWindow() override;
virtual bool TransferDataFromWindow() override;
// event handlers for page size choice
2016-09-24 18:53:15 +00:00
void OnPaperSizeChoice( wxCommandEvent& event ) override;
void OnUserPageSizeXTextUpdated( wxCommandEvent& event ) override;
void OnUserPageSizeYTextUpdated( wxCommandEvent& event ) override;
void OnPageOrientationChoice( wxCommandEvent& event ) override;
2012-03-26 21:45:05 +00:00
// event handler for texts in title block
2016-09-24 18:53:15 +00:00
void OnRevisionTextUpdated( wxCommandEvent& event ) override;
void OnDateTextUpdated( wxCommandEvent& event ) override;
void OnTitleTextUpdated( wxCommandEvent& event ) override;
void OnCompanyTextUpdated( wxCommandEvent& event ) override;
void OnComment1TextUpdated( wxCommandEvent& event ) override;
void OnComment2TextUpdated( wxCommandEvent& event ) override;
void OnComment3TextUpdated( wxCommandEvent& event ) override;
void OnComment4TextUpdated( wxCommandEvent& event ) override;
void OnComment5TextUpdated( wxCommandEvent& event ) override;
void OnComment6TextUpdated( wxCommandEvent& event ) override;
void OnComment7TextUpdated( wxCommandEvent& event ) override;
void OnComment8TextUpdated( wxCommandEvent& event ) override;
void OnComment9TextUpdated( wxCommandEvent& event ) override;
2012-03-26 21:45:05 +00:00
// Handle button click for setting the date from the picker
2016-09-24 18:53:15 +00:00
void OnDateApplyClick( wxCommandEvent& event ) override;
// .kicad_wks file description selection
2016-09-24 18:53:15 +00:00
void OnWksFileSelection( wxCommandEvent& event ) override;
// Save in the current title block the new page settings
// return true if changes are made, or false if not
bool SavePageSettings();
2012-03-26 21:45:05 +00:00
void SetCurrentPageSizeSelection( const wxString& aPaperSize );
2012-03-26 21:45:05 +00:00
// Update drawing sheet example
void UpdateDrawingSheetExample();
2012-03-26 21:45:05 +00:00
// Get page layout info from selected dialog items
2012-03-26 21:45:05 +00:00
void GetPageLayoutInfoFromDialog();
// Get custom page size in mils from dialog
2012-03-26 21:45:05 +00:00
void GetCustomSizeMilsFromDialog();
/// @return true if the local prj config is chande
/// i.e. if the drawing sheet file has chnaged
bool LocalPrjConfigChanged() { return m_localPrjConfigChanged; }
protected:
EDA_DRAW_FRAME* m_parent;
BASE_SCREEN* m_screen;
wxString m_projectPath; // the curr project path
wxArrayString m_pageFmt; /// list of page sizes (not translated)
bool m_initialized;
bool m_localPrjConfigChanged; /// the page layuout filename was changed
wxBitmap* m_pageBitmap; /// Temporary bitmap for the drawing sheet example.
wxSize m_layout_size; /// Logical drawing sheet size.
wxSize m_maxPageSizeMils; /// The max page size allowed by the caller frame
PAGE_INFO m_pageInfo; /// Temporary page info.
bool m_customFmt; /// true if the page selection is custom
TITLE_BLOCK m_tb; /// Temporary title block (basic inscriptions).
DS_DATA_MODEL* m_drawingSheet; // the alternate and temporary drawing sheet shown by the
// dialog when the initial one is replaced by a new one
double m_iuPerMils;
private:
UNIT_BINDER m_customSizeX;
UNIT_BINDER m_customSizeY;
};
#endif // _DIALOG_PAGES_SETTINGS_H_