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 (C) 2020 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 VECTOR2I aMaxUserSizeMils ) :
31 DIALOG_PAGES_SETTINGS( aParent, aEmbeddedFiles, schIUScale.IU_PER_MILS, aMaxUserSizeMils )
32{
33}
34
35
37{
38 EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
39 wxCHECK( cfg, /* void */ );
40
41 cfg->m_PageSettings.export_paper = m_PaperExport->GetValue();
42 if ( !m_TextRevision->GetValue().IsEmpty() ) cfg->m_PageSettings.export_revision = m_RevisionExport->GetValue();
43 if ( !m_TextDate->GetValue().IsEmpty() ) cfg->m_PageSettings.export_date = m_DateExport->GetValue();
44 if ( !m_TextTitle->GetValue().IsEmpty() ) cfg->m_PageSettings.export_title = m_TitleExport->GetValue();
45 if ( !m_TextCompany->GetValue().IsEmpty() ) cfg->m_PageSettings.export_company = m_CompanyExport->GetValue();
46 if ( !m_TextComment1->GetValue().IsEmpty() ) cfg->m_PageSettings.export_comment1 = m_Comment1Export->GetValue();
47 if ( !m_TextComment2->GetValue().IsEmpty() ) cfg->m_PageSettings.export_comment2 = m_Comment2Export->GetValue();
48 if ( !m_TextComment3->GetValue().IsEmpty() ) cfg->m_PageSettings.export_comment3 = m_Comment3Export->GetValue();
49 if ( !m_TextComment4->GetValue().IsEmpty() ) cfg->m_PageSettings.export_comment4 = m_Comment4Export->GetValue();
50 if ( !m_TextComment5->GetValue().IsEmpty() ) cfg->m_PageSettings.export_comment5 = m_Comment5Export->GetValue();
51 if ( !m_TextComment6->GetValue().IsEmpty() ) cfg->m_PageSettings.export_comment6 = m_Comment6Export->GetValue();
52 if ( !m_TextComment7->GetValue().IsEmpty() ) cfg->m_PageSettings.export_comment7 = m_Comment7Export->GetValue();
53 if ( !m_TextComment8->GetValue().IsEmpty() ) cfg->m_PageSettings.export_comment8 = m_Comment8Export->GetValue();
54 if ( !m_TextComment9->GetValue().IsEmpty() ) cfg->m_PageSettings.export_comment9 = m_Comment9Export->GetValue();
55}
56
57
59{
60 wxString msg;
61
62 m_TextSheetCount->Show( true );
63 m_TextSheetNumber->Show( true );
64 m_PaperExport->Show( true );
65 m_RevisionExport->Show( true );
66 m_DateExport->Show( true );
67 m_TitleExport->Show( true );
68 m_CompanyExport->Show( true );
69 m_Comment1Export->Show( true );
70 m_Comment2Export->Show( true );
71 m_Comment3Export->Show( true );
72 m_Comment4Export->Show( true );
73 m_Comment5Export->Show( true );
74 m_Comment6Export->Show( true );
75 m_Comment7Export->Show( true );
76 m_Comment8Export->Show( true );
77 m_Comment9Export->Show( true );
78
79 // Init display value for schematic sub-sheet number
80 wxString format = m_TextSheetCount->GetLabel();
81 msg.Printf( format, m_screen->GetPageCount() );
82 m_TextSheetCount->SetLabel( msg );
83
84 format = m_TextSheetNumber->GetLabel();
85 msg.Printf( format, m_screen->GetVirtualPageNumber() );
86 m_TextSheetNumber->SetLabel( msg );
87
88 EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
89 wxCHECK( cfg, /* void */ );
90
92 m_RevisionExport->SetValue( m_TextRevision->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_revision );
93 m_DateExport->SetValue( m_TextDate->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_date );
94 m_TitleExport->SetValue( m_TextTitle->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_title );
95 m_CompanyExport->SetValue( m_TextCompany->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_company );
96 m_Comment1Export->SetValue( m_TextComment1->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment1 );
97 m_Comment2Export->SetValue( m_TextComment2->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment2 );
98 m_Comment3Export->SetValue( m_TextComment3->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment3 );
99 m_Comment4Export->SetValue( m_TextComment4->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment4 );
100 m_Comment5Export->SetValue( m_TextComment5->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment5 );
101 m_Comment6Export->SetValue( m_TextComment6->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment6 );
102 m_Comment7Export->SetValue( m_TextComment7->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment7 );
103 m_Comment8Export->SetValue( m_TextComment8->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment8 );
104 m_Comment9Export->SetValue( m_TextComment9->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment9 );
105}
106
107
109{
110 wxCHECK_MSG( dynamic_cast<SCH_EDIT_FRAME*>( m_parent ), true,
111 "DIALOG_PAGES_SETTINGS::OnDateApplyClick frame is not a schematic frame!" );
112
113 // Exports settings to other sheets if requested:
114 SCH_SCREENS ScreenList( dynamic_cast<SCH_EDIT_FRAME*>( m_parent )->Schematic().Root() );
115
116 // Update page info and/or title blocks for all screens
117 for( SCH_SCREEN* screen = ScreenList.GetFirst(); screen; screen = ScreenList.GetNext() )
118 {
119 if( screen == m_screen )
120 continue;
121
122 if( m_PaperExport->IsChecked() )
123 screen->SetPageSettings( m_pageInfo );
124
125 TITLE_BLOCK tb2 = screen->GetTitleBlock();
126
127 if( m_RevisionExport->IsChecked() )
129
130 if( m_DateExport->IsChecked() )
131 tb2.SetDate( m_tb.GetDate() );
132
133 if( m_TitleExport->IsChecked() )
134 tb2.SetTitle( m_tb.GetTitle() );
135
136 if( m_CompanyExport->IsChecked() )
137 tb2.SetCompany( m_tb.GetCompany() );
138
139 if( m_Comment1Export->IsChecked() )
140 tb2.SetComment( 0, m_tb.GetComment( 0 ) );
141
142 if( m_Comment2Export->IsChecked() )
143 tb2.SetComment( 1, m_tb.GetComment( 1 ) );
144
145 if( m_Comment3Export->IsChecked() )
146 tb2.SetComment( 2, m_tb.GetComment( 2 ) );
147
148 if( m_Comment4Export->IsChecked() )
149 tb2.SetComment( 3, m_tb.GetComment( 3 ) );
150
151 if( m_Comment5Export->IsChecked() )
152 tb2.SetComment( 4, m_tb.GetComment( 4 ) );
153
154 if( m_Comment6Export->IsChecked() )
155 tb2.SetComment( 5, m_tb.GetComment( 5 ) );
156
157 if( m_Comment7Export->IsChecked() )
158 tb2.SetComment( 6, m_tb.GetComment( 6 ) );
159
160 if( m_Comment8Export->IsChecked() )
161 tb2.SetComment( 7, m_tb.GetComment( 7 ) );
162
163 if( m_Comment9Export->IsChecked() )
164 tb2.SetComment( 8, m_tb.GetComment( 8 ) );
165
166 screen->SetTitleBlock( tb2 );
167 }
168
169 return true;
170}
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