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_browseButton->Enable( aEnable );
55  }
56 
57 private:
58  virtual void onTransferDataToWindow() {}
59 
60  virtual bool onSavePageSettings()
61  {
62  // default just return true savepagesettings to succeed
63  return true;
64  }
65 
66  virtual bool TransferDataToWindow() override;
67  virtual bool TransferDataFromWindow() override;
68 
69  // event handlers for page size choice
70  void OnPaperSizeChoice( wxCommandEvent& event ) override;
71  void OnUserPageSizeXTextUpdated( wxCommandEvent& event ) override;
72  void OnUserPageSizeYTextUpdated( wxCommandEvent& event ) override;
73  void OnPageOrientationChoice( wxCommandEvent& event ) override;
74 
75  // event handler for texts in title block
76  void OnRevisionTextUpdated( wxCommandEvent& event ) override;
77  void OnDateTextUpdated( wxCommandEvent& event ) override;
78  void OnTitleTextUpdated( wxCommandEvent& event ) override;
79  void OnCompanyTextUpdated( wxCommandEvent& event ) override;
80  void OnComment1TextUpdated( wxCommandEvent& event ) override;
81  void OnComment2TextUpdated( wxCommandEvent& event ) override;
82  void OnComment3TextUpdated( wxCommandEvent& event ) override;
83  void OnComment4TextUpdated( wxCommandEvent& event ) override;
84  void OnComment5TextUpdated( wxCommandEvent& event ) override;
85  void OnComment6TextUpdated( wxCommandEvent& event ) override;
86  void OnComment7TextUpdated( wxCommandEvent& event ) override;
87  void OnComment8TextUpdated( wxCommandEvent& event ) override;
88  void OnComment9TextUpdated( wxCommandEvent& event ) override;
89 
90  // Handle button click for setting the date from the picker
91  void OnDateApplyClick( wxCommandEvent& event ) override;
92 
93  // .kicad_wks file description selection
94  void OnWksFileSelection( wxCommandEvent& event ) override;
95 
96  // Save in the current title block the new page settings
97  // return true if changes are made, or false if not
98  bool SavePageSettings();
99 
100  void SetCurrentPageSizeSelection( const wxString& aPaperSize );
101 
102  // Update drawing sheet example
104 
105  // Get page layout info from selected dialog items
107 
108  // Get custom page size in mils from dialog
110 
114 
115 protected:
118  wxString m_projectPath; // the curr project path
119  wxArrayString m_pageFmt;
122  wxBitmap* m_pageBitmap;
123  wxSize m_layout_size;
126  bool m_customFmt;
128  DS_DATA_MODEL* m_drawingSheet; // the alternate and temporary drawing sheet shown by the
129  // dialog when the initial one is replaced by a new one
130  double m_iuPerMils;
131 
132 private:
135 };
136 
137 #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)