KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_eeschema_page_settings.cpp
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 The 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
21
22#include <kiface_base.h>
23#include <general.h>
24#include <sch_edit_frame.h>
25#include <sch_screen.h>
26#include <schematic.h>
27#include <eeschema_settings.h>
28
30 EMBEDDED_FILES* aEmbeddedFiles,
31 VECTOR2I aMaxUserSizeMils ) :
32 DIALOG_PAGES_SETTINGS( aParent, aEmbeddedFiles, schIUScale.IU_PER_MILS, aMaxUserSizeMils )
33{
34}
35
36
38{
39 EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
40 wxCHECK( cfg, /* void */ );
41
42 cfg->m_PageSettings.export_paper = m_PaperExport->GetValue();
43
44 if( !m_TextRevision->GetValue().IsEmpty() )
46
47 if( !m_TextDate->GetValue().IsEmpty() )
48 cfg->m_PageSettings.export_date = m_DateExport->GetValue();
49
50 if( !m_TextTitle->GetValue().IsEmpty() )
51 cfg->m_PageSettings.export_title = m_TitleExport->GetValue();
52
53 if( !m_TextCompany->GetValue().IsEmpty() )
55
56 if( !m_TextComment1->GetValue().IsEmpty() )
58
59 if( !m_TextComment2->GetValue().IsEmpty() )
61
62 if( !m_TextComment3->GetValue().IsEmpty() )
64
65 if( !m_TextComment4->GetValue().IsEmpty() )
67
68 if( !m_TextComment5->GetValue().IsEmpty() )
70
71 if( !m_TextComment6->GetValue().IsEmpty() )
73
74 if( !m_TextComment7->GetValue().IsEmpty() )
76
77 if( !m_TextComment8->GetValue().IsEmpty() )
79
80 if( !m_TextComment9->GetValue().IsEmpty() )
82}
83
84
86{
87 wxString msg;
88
89 m_TextSheetCount->Show( true );
90 m_TextSheetNumber->Show( true );
91 m_PaperExport->Show( true );
92 m_RevisionExport->Show( true );
93 m_DateExport->Show( true );
94 m_TitleExport->Show( true );
95 m_CompanyExport->Show( true );
96 m_Comment1Export->Show( true );
97 m_Comment2Export->Show( true );
98 m_Comment3Export->Show( true );
99 m_Comment4Export->Show( true );
100 m_Comment5Export->Show( true );
101 m_Comment6Export->Show( true );
102 m_Comment7Export->Show( true );
103 m_Comment8Export->Show( true );
104 m_Comment9Export->Show( true );
105
106 // Init display value for schematic sub-sheet number
107 wxString format = m_TextSheetCount->GetLabel();
108 msg.Printf( format, m_screen->GetPageCount() );
109 m_TextSheetCount->SetLabel( msg );
110
111 format = m_TextSheetNumber->GetLabel();
112 msg.Printf( format, m_screen->GetVirtualPageNumber() );
113 m_TextSheetNumber->SetLabel( msg );
114
115 EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
116 wxCHECK( cfg, /* void */ );
117
118 m_PaperExport->SetValue( cfg->m_PageSettings.export_paper );
119 m_RevisionExport->SetValue(
120 m_TextRevision->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_revision );
121 m_DateExport->SetValue( m_TextDate->GetValue().IsEmpty() ? false
123 m_TitleExport->SetValue( m_TextTitle->GetValue().IsEmpty() ? false
125 m_CompanyExport->SetValue(
126 m_TextCompany->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_company );
127 m_Comment1Export->SetValue(
128 m_TextComment1->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment1 );
129 m_Comment2Export->SetValue(
130 m_TextComment2->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment2 );
131 m_Comment3Export->SetValue(
132 m_TextComment3->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment3 );
133 m_Comment4Export->SetValue(
134 m_TextComment4->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment4 );
135 m_Comment5Export->SetValue(
136 m_TextComment5->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment5 );
137 m_Comment6Export->SetValue(
138 m_TextComment6->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment6 );
139 m_Comment7Export->SetValue(
140 m_TextComment7->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment7 );
141 m_Comment8Export->SetValue(
142 m_TextComment8->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment8 );
143 m_Comment9Export->SetValue(
144 m_TextComment9->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment9 );
145}
146
147
149{
150 wxCHECK_MSG( dynamic_cast<SCH_EDIT_FRAME*>( m_parent ), true,
151 "DIALOG_PAGES_SETTINGS::OnDateApplyClick frame is not a schematic frame!" );
152
153 // Exports settings to other sheets if requested:
154 SCH_SCREENS ScreenList( dynamic_cast<SCH_EDIT_FRAME*>( m_parent )->Schematic().Root() );
155
156 // Update page info and/or title blocks for all screens
157 for( SCH_SCREEN* screen = ScreenList.GetFirst(); screen; screen = ScreenList.GetNext() )
158 {
159 if( screen == m_screen )
160 continue;
161
162 if( m_PaperExport->IsChecked() )
163 screen->SetPageSettings( m_pageInfo );
164
165 TITLE_BLOCK tb2 = screen->GetTitleBlock();
166
167 if( m_RevisionExport->IsChecked() )
169
170 if( m_DateExport->IsChecked() )
171 tb2.SetDate( m_tb.GetDate() );
172
173 if( m_TitleExport->IsChecked() )
174 tb2.SetTitle( m_tb.GetTitle() );
175
176 if( m_CompanyExport->IsChecked() )
177 tb2.SetCompany( m_tb.GetCompany() );
178
179 if( m_Comment1Export->IsChecked() )
180 tb2.SetComment( 0, m_tb.GetComment( 0 ) );
181
182 if( m_Comment2Export->IsChecked() )
183 tb2.SetComment( 1, m_tb.GetComment( 1 ) );
184
185 if( m_Comment3Export->IsChecked() )
186 tb2.SetComment( 2, m_tb.GetComment( 2 ) );
187
188 if( m_Comment4Export->IsChecked() )
189 tb2.SetComment( 3, m_tb.GetComment( 3 ) );
190
191 if( m_Comment5Export->IsChecked() )
192 tb2.SetComment( 4, m_tb.GetComment( 4 ) );
193
194 if( m_Comment6Export->IsChecked() )
195 tb2.SetComment( 5, m_tb.GetComment( 5 ) );
196
197 if( m_Comment7Export->IsChecked() )
198 tb2.SetComment( 6, m_tb.GetComment( 6 ) );
199
200 if( m_Comment8Export->IsChecked() )
201 tb2.SetComment( 7, m_tb.GetComment( 7 ) );
202
203 if( m_Comment9Export->IsChecked() )
204 tb2.SetComment( 8, m_tb.GetComment( 8 ) );
205
206 screen->SetTitleBlock( tb2 );
207 }
208
209 return true;
210}
constexpr EDA_IU_SCALE schIUScale
Definition: base_units.h:110
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
int GetPageCount() const
Definition: base_screen.h:72
int GetVirtualPageNumber() const
Definition: base_screen.h:75
DIALOG_EESCHEMA_PAGE_SETTINGS(EDA_DRAW_FRAME *aParent, EMBEDDED_FILES *aEmbeddedFiles, VECTOR2I aMaxUserSizeMils)
PAGE_INFO m_pageInfo
The max page size allowed by the caller frame.
TITLE_BLOCK m_tb
true if the page selection is custom
The base class for create windows for drawing purpose.
PAGE_SETTINGS m_PageSettings
APP_SETTINGS_BASE * KifaceSettings() const
Definition: kiface_base.h:95
Schematic editor (Eeschema) main window.
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:712
SCH_SCREEN * GetNext()
SCH_SCREEN * GetFirst()
Hold the information shown in the lower right corner of a plot, printout, or editing view.
Definition: title_block.h:41
const wxString & GetCompany() const
Definition: title_block.h:96
void SetRevision(const wxString &aRevision)
Definition: title_block.h:81
void SetComment(int aIdx, const wxString &aComment)
Definition: title_block.h:101
const wxString & GetRevision() const
Definition: title_block.h:86
void SetTitle(const wxString &aTitle)
Definition: title_block.h:58
const wxString & GetDate() const
Definition: title_block.h:76
const wxString & GetComment(int aIdx) const
Definition: title_block.h:107
void SetCompany(const wxString &aCompany)
Definition: title_block.h:91
const wxString & GetTitle() const
Definition: title_block.h:63
void SetDate(const wxString &aDate)
Set the date field, and defaults to the current time and date.
Definition: title_block.h:71
#define IU_PER_MILS
Definition: plotter.cpp:129