2012-03-26 21:45:05 +00:00
|
|
|
/*
|
2020-12-19 15:08:31 +00:00
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
2012-03-26 21:45:05 +00:00
|
|
|
*
|
2022-12-13 20:47:28 +00:00
|
|
|
* Copyright (C) 2020-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
2012-03-26 21:45:05 +00:00
|
|
|
*
|
2020-12-19 15:08:31 +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
|
|
|
*
|
2020-12-19 15:08:31 +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
|
|
|
*
|
2020-12-19 15:08:31 +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
|
|
|
*/
|
2010-03-14 10:34:40 +00:00
|
|
|
|
|
|
|
#ifndef _DIALOG_PAGES_SETTINGS_H_
|
|
|
|
#define _DIALOG_PAGES_SETTINGS_H_
|
|
|
|
|
2020-01-07 17:12:59 +00:00
|
|
|
#include <page_info.h>
|
|
|
|
#include <title_block.h>
|
2018-06-14 08:26:11 +00:00
|
|
|
#include <widgets/unit_binder.h>
|
2022-12-13 20:47:28 +00:00
|
|
|
#include <widgets/std_bitmap_button.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <dialog_page_settings_base.h>
|
2010-03-14 10:34:40 +00:00
|
|
|
|
2021-02-22 23:47:17 +00:00
|
|
|
class DS_DATA_MODEL;
|
2019-05-25 11:05:39 +00:00
|
|
|
|
2010-03-14 10:34:40 +00:00
|
|
|
/*!
|
|
|
|
* DIALOG_PAGES_SETTINGS class declaration
|
|
|
|
*/
|
|
|
|
|
|
|
|
class DIALOG_PAGES_SETTINGS: public DIALOG_PAGES_SETTINGS_BASE
|
|
|
|
{
|
|
|
|
public:
|
2021-07-26 23:47:26 +00:00
|
|
|
DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* aParent, double aIuPerMils,
|
|
|
|
const wxSize& aMaxUserSizeMils );
|
2020-12-19 15:08:31 +00:00
|
|
|
virtual ~DIALOG_PAGES_SETTINGS();
|
2010-03-14 10:34:40 +00:00
|
|
|
|
2013-07-19 18:27:22 +00:00
|
|
|
const wxString GetWksFileName()
|
|
|
|
{
|
2013-08-09 16:19:52 +00:00
|
|
|
return m_textCtrlFilePicker->GetValue();
|
2013-07-19 18:27:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SetWksFileName(const wxString& aFilename )
|
|
|
|
{
|
2013-08-09 16:19:52 +00:00
|
|
|
m_textCtrlFilePicker->SetValue( aFilename );
|
2013-07-19 18:27:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void EnableWksFileNamePicker( bool aEnable )
|
|
|
|
{
|
2013-08-09 16:19:52 +00:00
|
|
|
m_textCtrlFilePicker->Enable( aEnable );
|
2021-09-23 15:44:39 +00:00
|
|
|
m_browseButton->Enable( aEnable );
|
2013-07-19 18:27:22 +00:00
|
|
|
}
|
|
|
|
|
2010-03-14 10:34:40 +00:00
|
|
|
private:
|
2020-12-19 15:08:31 +00:00
|
|
|
virtual void onTransferDataToWindow() {}
|
|
|
|
|
2021-09-23 15:44:39 +00:00
|
|
|
virtual bool onSavePageSettings()
|
|
|
|
{
|
2020-12-19 15:08:31 +00:00
|
|
|
// default just return true savepagesettings to succeed
|
|
|
|
return true;
|
|
|
|
}
|
2010-03-14 10:34:40 +00:00
|
|
|
|
2020-12-19 15:08:31 +00:00
|
|
|
virtual bool TransferDataToWindow() override;
|
|
|
|
virtual bool TransferDataFromWindow() override;
|
2010-03-14 10:34:40 +00:00
|
|
|
|
2013-07-19 18:27:22 +00:00
|
|
|
// 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
|
|
|
|
2013-07-19 18:27:22 +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;
|
2019-08-21 16:58:29 +00:00
|
|
|
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
|
|
|
|
2013-07-19 18:27:22 +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;
|
2013-05-23 18:45:23 +00:00
|
|
|
|
2013-07-19 18:27:22 +00:00
|
|
|
// .kicad_wks file description selection
|
2016-09-24 18:53:15 +00:00
|
|
|
void OnWksFileSelection( wxCommandEvent& event ) override;
|
2013-07-19 18:27:22 +00:00
|
|
|
|
|
|
|
// 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
|
|
|
|
2013-07-19 18:27:22 +00:00
|
|
|
void SetCurrentPageSizeSelection( const wxString& aPaperSize );
|
2012-03-26 21:45:05 +00:00
|
|
|
|
2021-05-30 22:56:24 +00:00
|
|
|
// Update drawing sheet example
|
|
|
|
void UpdateDrawingSheetExample();
|
2012-03-26 21:45:05 +00:00
|
|
|
|
2013-07-19 18:27:22 +00:00
|
|
|
// Get page layout info from selected dialog items
|
2012-03-26 21:45:05 +00:00
|
|
|
void GetPageLayoutInfoFromDialog();
|
2010-03-14 10:34:40 +00:00
|
|
|
|
2013-07-19 18:27:22 +00:00
|
|
|
// Get custom page size in mils from dialog
|
2012-03-26 21:45:05 +00:00
|
|
|
void GetCustomSizeMilsFromDialog();
|
2013-07-19 18:27:22 +00:00
|
|
|
|
|
|
|
/// @return true if the local prj config is chande
|
2021-05-30 22:56:24 +00:00
|
|
|
/// i.e. if the drawing sheet file has chnaged
|
2013-07-19 18:27:22 +00:00
|
|
|
bool LocalPrjConfigChanged() { return m_localPrjConfigChanged; }
|
2020-12-19 15:08:31 +00:00
|
|
|
|
|
|
|
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
|
2021-05-30 22:56:24 +00:00
|
|
|
wxBitmap* m_pageBitmap; /// Temporary bitmap for the drawing sheet example.
|
|
|
|
wxSize m_layout_size; /// Logical drawing sheet size.
|
2020-12-19 15:08:31 +00:00
|
|
|
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).
|
2021-05-30 22:56:24 +00:00
|
|
|
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
|
2020-12-19 15:08:31 +00:00
|
|
|
double m_iuPerMils;
|
|
|
|
|
|
|
|
private:
|
|
|
|
UNIT_BINDER m_customSizeX;
|
|
|
|
UNIT_BINDER m_customSizeY;
|
2010-03-14 10:34:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _DIALOG_PAGES_SETTINGS_H_
|