KiCad PCB EDA Suite
dialog_page_settings.h
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
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_PAGES_SETTINGS_H_
21 #define _DIALOG_PAGES_SETTINGS_H_
22 
23 #include <page_info.h>
24 #include <title_block.h>
25 #include <widgets/unit_binder.h>
27 
28 class DS_DATA_MODEL;
29 
35 {
36 public:
37  DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* aParent, double aIuPerMils,
38  const wxSize& aMaxUserSizeMils );
39  virtual ~DIALOG_PAGES_SETTINGS();
40 
41  const wxString GetWksFileName()
42  {
43  return m_textCtrlFilePicker->GetValue();
44  }
45 
46  void SetWksFileName(const wxString& aFilename )
47  {
48  m_textCtrlFilePicker->SetValue( aFilename );
49  }
50 
51  void EnableWksFileNamePicker( bool aEnable )
52  {
53  m_textCtrlFilePicker->Enable( aEnable );
54  m_buttonBrowse->Enable( aEnable );
55  }
56 
57 private:
58  virtual void onTransferDataToWindow() {}
59 
60  virtual bool onSavePageSettings() {
61  // default just return true savepagesettings to succeed
62  return true;
63  }
64 
65  virtual bool TransferDataToWindow() override;
66  virtual bool TransferDataFromWindow() override;
67 
68  // event handlers for page size choice
69  void OnPaperSizeChoice( wxCommandEvent& event ) override;
70  void OnUserPageSizeXTextUpdated( wxCommandEvent& event ) override;
71  void OnUserPageSizeYTextUpdated( wxCommandEvent& event ) override;
72  void OnPageOrientationChoice( wxCommandEvent& event ) override;
73 
74  // event handler for texts in title block
75  void OnRevisionTextUpdated( wxCommandEvent& event ) override;
76  void OnDateTextUpdated( wxCommandEvent& event ) override;
77  void OnTitleTextUpdated( wxCommandEvent& event ) override;
78  void OnCompanyTextUpdated( wxCommandEvent& event ) override;
79  void OnComment1TextUpdated( wxCommandEvent& event ) override;
80  void OnComment2TextUpdated( wxCommandEvent& event ) override;
81  void OnComment3TextUpdated( wxCommandEvent& event ) override;
82  void OnComment4TextUpdated( wxCommandEvent& event ) override;
83  void OnComment5TextUpdated( wxCommandEvent& event ) override;
84  void OnComment6TextUpdated( wxCommandEvent& event ) override;
85  void OnComment7TextUpdated( wxCommandEvent& event ) override;
86  void OnComment8TextUpdated( wxCommandEvent& event ) override;
87  void OnComment9TextUpdated( wxCommandEvent& event ) override;
88 
89  // Handle button click for setting the date from the picker
90  void OnDateApplyClick( wxCommandEvent& event ) override;
91 
92  // .kicad_wks file description selection
93  void OnWksFileSelection( wxCommandEvent& event ) override;
94 
95  // Save in the current title block the new page settings
96  // return true if changes are made, or false if not
97  bool SavePageSettings();
98 
99  void SetCurrentPageSizeSelection( const wxString& aPaperSize );
100 
101  // Update drawing sheet example
103 
104  // Get page layout info from selected dialog items
106 
107  // Get custom page size in mils from dialog
109 
113 
114 protected:
117  wxString m_projectPath; // the curr project path
118  wxArrayString m_pageFmt;
121  wxBitmap* m_pageBitmap;
122  wxSize m_layout_size;
125  bool m_customFmt;
127  DS_DATA_MODEL* m_drawingSheet; // the alternate and temporary drawing sheet shown by the
128  // dialog when the initial one is replaced by a new one
129  double m_iuPerMils;
130 
131 private:
134 };
135 
136 #endif // _DIALOG_PAGES_SETTINGS_H_
void OnDateApplyClick(wxCommandEvent &event) override
virtual void onTransferDataToWindow()
Handle the graphic items list to draw/plot the frame and title block.
Definition: ds_data_model.h:38
void OnComment5TextUpdated(wxCommandEvent &event) override
wxSize m_maxPageSizeMils
Logical drawing sheet size.
void OnPageOrientationChoice(wxCommandEvent &event) override
void OnComment3TextUpdated(wxCommandEvent &event) override
TITLE_BLOCK m_tb
true if the page selection is custom
void OnComment7TextUpdated(wxCommandEvent &event) override
void SetWksFileName(const wxString &aFilename)
virtual bool TransferDataFromWindow() override
virtual bool TransferDataToWindow() override
void OnUserPageSizeXTextUpdated(wxCommandEvent &event) override
const wxString GetWksFileName()
bool m_initialized
list of page sizes (not translated)
The base class for create windows for drawing purpose.
Hold the information shown in the lower right corner of a plot, printout, or editing view.
Definition: title_block.h:40
wxSize m_layout_size
Temporary bitmap for the drawing sheet example.
DS_DATA_MODEL * m_drawingSheet
Temporary title block (basic inscriptions).
void OnComment8TextUpdated(wxCommandEvent &event) override
void OnComment1TextUpdated(wxCommandEvent &event) override
virtual bool onSavePageSettings()
void OnComment9TextUpdated(wxCommandEvent &event) override
void EnableWksFileNamePicker(bool aEnable)
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:53
Handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:40
void OnDateTextUpdated(wxCommandEvent &event) override
void SetCurrentPageSizeSelection(const wxString &aPaperSize)
wxBitmap * m_pageBitmap
the page layuout filename was changed
void OnWksFileSelection(wxCommandEvent &event) override
Class DIALOG_PAGES_SETTINGS_BASE.
void OnComment6TextUpdated(wxCommandEvent &event) override
PAGE_INFO m_pageInfo
The max page size allowed by the caller frame.
void OnComment4TextUpdated(wxCommandEvent &event) override
void OnUserPageSizeYTextUpdated(wxCommandEvent &event) override
bool m_customFmt
Temporary page info.
void OnComment2TextUpdated(wxCommandEvent &event) override
void OnPaperSizeChoice(wxCommandEvent &event) override
void OnTitleTextUpdated(wxCommandEvent &event) override
void OnCompanyTextUpdated(wxCommandEvent &event) override
void OnRevisionTextUpdated(wxCommandEvent &event) override
DIALOG_PAGES_SETTINGS(EDA_DRAW_FRAME *aParent, double aIuPerMils, const wxSize &aMaxUserSizeMils)