KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_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
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#include <env_paths.h>
21#include <pgm_base.h>
22#include <bitmaps.h>
23#include <base_screen.h>
24#include <common.h> // ExpandEnvVarSubstitutions
25#include <core/arraydim.h>
27#include <eda_draw_frame.h>
28#include <eda_item.h>
29#include <embedded_files.h>
30#include <filename_resolver.h>
31#include <gr_basic.h>
32#include <kiface_base.h>
33#include <macros.h>
34#include <math/util.h> // for KiROUND
35#include <project.h>
36#include <tool/actions.h>
37#include <tool/tool_manager.h>
41#include <string_utils.h>
44#include <wx/valgen.h>
45#include <wx/tokenzr.h>
46#include <wx/filedlg.h>
47#include <wx/dcmemory.h>
48#include <wx/msgdlg.h>
49#include <confirm.h>
50#include <kiplatform/ui.h>
51#include <env_vars.h>
52
53#define MAX_PAGE_EXAMPLE_SIZE 200
54
55
57 double aIuPerMils, const VECTOR2D& aMaxUserSizeMils ) :
59 m_parent( aParent ),
60 m_screen( m_parent->GetScreen() ),
61 m_initialized( false ),
62 m_pageBitmap( nullptr ),
63 m_iuPerMils( aIuPerMils ),
64 m_embeddedFiles( aEmbeddedFiles ),
67{
70
71 m_maxPageSizeMils = aMaxUserSizeMils;
72 m_tb = m_parent->GetTitleBlock();
73 m_customFmt = false;
75
77 wxString serialization;
79 m_drawingSheet->SetPageLayout( TO_UTF8( serialization ) );
80
81 m_PickDate->SetValue( wxDateTime::Now() );
82
83 if( m_parent->GetName() == PL_EDITOR_FRAME_NAME )
84 {
85 SetTitle( _( "Preview Settings" ) );
86 m_staticTextPaper->SetLabel( _( "Preview Paper" ) );
87 m_staticTextTitleBlock->SetLabel( _( "Preview Title Block Data" ) );
88 }
89 else
90 {
91 SetTitle( _( "Page Settings" ) );
92 m_staticTextPaper->SetLabel( _( "Paper" ) );
93 m_staticTextTitleBlock->SetLabel( _( "Title Block" ) );
94 }
95
97 m_filenameResolver->SetProject( &Prj() );
98 m_filenameResolver->SetProgramBase( &Pgm() );
99
101
102 Centre();
103}
104
105
111
112
114{
115 // initialize page format choice box and page format list.
116 // The first shows translated strings, the second contains not translated strings
117 m_paperSizeComboBox->Clear();
118
119 int selectedIdx = -1;
120 m_pageInfo = m_parent->GetPageSettings();
121
122 for( const PAGE_INFO& pageFmt : PAGE_INFO::GetPageFormatsList() )
123 {
124 int idx = m_paperSizeComboBox->Append( wxGetTranslation( pageFmt.GetPageFormatDescription() ),
125 reinterpret_cast<void*>( static_cast<intptr_t>( pageFmt.GetType() ) ) );
126
127 if( pageFmt.GetType() == m_pageInfo.GetType() )
128 {
129 selectedIdx = idx;
130 }
131 }
132
133 m_paperSizeComboBox->SetSelection( selectedIdx );
134
135 // initialize the drawing sheet filename
137
138 m_orientationComboBox->SetSelection( m_pageInfo.IsPortrait() );
139
140 // only a click fires the "selection changed" event, so have to fabricate this check
141 wxCommandEvent dummy;
143
144 if( m_customFmt )
145 {
146 m_customSizeX.SetDoubleValue( m_pageInfo.GetWidthMils() * m_iuPerMils );
147 m_customSizeY.SetDoubleValue( m_pageInfo.GetHeightMils() * m_iuPerMils );
148 }
149 else
150 {
151 m_customSizeX.SetDoubleValue( m_pageInfo.GetCustomWidthMils() * m_iuPerMils );
152 m_customSizeY.SetDoubleValue( m_pageInfo.GetCustomHeightMils() * m_iuPerMils );
153 }
154
155 m_TextRevision->SetValue( m_tb.GetRevision() );
156 m_TextDate->SetValue( m_tb.GetDate() );
157 m_TextTitle->SetValue( m_tb.GetTitle() );
158 m_TextCompany->SetValue( m_tb.GetCompany() );
159 m_TextComment1->SetValue( m_tb.GetComment( 0 ) );
160 m_TextComment2->SetValue( m_tb.GetComment( 1 ) );
161 m_TextComment3->SetValue( m_tb.GetComment( 2 ) );
162 m_TextComment4->SetValue( m_tb.GetComment( 3 ) );
163 m_TextComment5->SetValue( m_tb.GetComment( 4 ) );
164 m_TextComment6->SetValue( m_tb.GetComment( 5 ) );
165 m_TextComment7->SetValue( m_tb.GetComment( 6 ) );
166 m_TextComment8->SetValue( m_tb.GetComment( 7 ) );
167 m_TextComment9->SetValue( m_tb.GetComment( 8 ) );
168
169 // The default is to disable aall these fields for the "generic" dialog
170 m_TextSheetCount->Show( false );
171 m_TextSheetNumber->Show( false );
172 m_PaperExport->Show( false );
173 m_RevisionExport->Show( false );
174 m_DateExport->Show( false );
175 m_TitleExport->Show( false );
176 m_CompanyExport->Show( false );
177 m_Comment1Export->Show( false );
178 m_Comment2Export->Show( false );
179 m_Comment3Export->Show( false );
180 m_Comment4Export->Show( false );
181 m_Comment5Export->Show( false );
182 m_Comment6Export->Show( false );
183 m_Comment7Export->Show( false );
184 m_Comment8Export->Show( false );
185 m_Comment9Export->Show( false );
186
188
191
192 GetSizer()->SetSizeHints( this );
193
194 m_initialized = true;
195
196 return true;
197}
198
199
201{
202 int idx = std::max( m_paperSizeComboBox->GetSelection(), 0 );
203 void* clientData = m_paperSizeComboBox->GetClientData( idx );
204 PAGE_SIZE_TYPE pageType = static_cast<PAGE_SIZE_TYPE>( reinterpret_cast<intptr_t>( clientData ) );
205
206 if( pageType == PAGE_SIZE_TYPE::User )
207 {
209 return false;
210
212 return false;
213 }
214
215 if( SavePageSettings() )
216 {
217 m_screen->SetContentModified();
218
220 m_parent->OnModify();
221
222 // Call the post processing (if any) after changes
223 m_parent->OnPageSettingsChange();
224 }
225
226 return true;
227}
228
229
230void DIALOG_PAGES_SETTINGS::OnPaperSizeChoice( wxCommandEvent& event )
231{
232 int idx = m_paperSizeComboBox->GetSelection();
233
234 if( idx < 0 )
235 idx = 0;
236
237 void* clientData = m_paperSizeComboBox->GetClientData( idx );
238 PAGE_SIZE_TYPE pageType = static_cast<PAGE_SIZE_TYPE>( reinterpret_cast<intptr_t>( clientData ) );
239
240 if( pageType == PAGE_SIZE_TYPE::User )
241 {
242 m_staticTextOrient->Enable( false );
243 m_orientationComboBox->Enable( false );
244
245 m_staticTextCustSize->Enable( true );
246 m_customSizeX.Enable( true );
247 m_customSizeY.Enable( true );
248 m_customFmt = true;
249 }
250 else
251 {
252 m_staticTextOrient->Enable( true );
253 m_orientationComboBox->Enable( true );
254
255 m_staticTextCustSize->Enable( false );
256 m_customSizeX.Enable( false );
257 m_customSizeY.Enable( false );
258 m_customFmt = false;
259 }
260
263}
264
265
267{
268 if( m_initialized )
269 {
272 }
273}
274
275
277{
278 if( m_initialized )
279 {
282 }
283}
284
285
287{
288 if( m_initialized )
289 {
292 }
293}
294
295
297{
298 if( m_initialized && m_TextRevision->IsModified() )
299 {
301 m_tb.SetRevision( m_TextRevision->GetValue() );
303 }
304}
305
306
307void DIALOG_PAGES_SETTINGS::OnDateTextUpdated( wxCommandEvent& event )
308{
309 if( m_initialized && m_TextDate->IsModified() )
310 {
312 m_tb.SetDate( m_TextDate->GetValue() );
314 }
315}
316
317
318void DIALOG_PAGES_SETTINGS::OnTitleTextUpdated( wxCommandEvent& event )
319{
320 if( m_initialized && m_TextTitle->IsModified() )
321 {
323 m_tb.SetTitle( m_TextTitle->GetValue() );
325 }
326}
327
328
330{
331 if( m_initialized && m_TextCompany->IsModified() )
332 {
334 m_tb.SetCompany( m_TextCompany->GetValue() );
336 }
337}
338
339
341{
342 if( m_initialized && m_TextComment1->IsModified() )
343 {
345 m_tb.SetComment( 0, m_TextComment1->GetValue() );
347 }
348}
349
350
352{
353 if( m_initialized && m_TextComment2->IsModified() )
354 {
356 m_tb.SetComment( 1, m_TextComment2->GetValue() );
358 }
359}
360
361
363{
364 if( m_initialized && m_TextComment3->IsModified() )
365 {
367 m_tb.SetComment( 2, m_TextComment3->GetValue() );
369 }
370}
371
372
374{
375 if( m_initialized && m_TextComment4->IsModified() )
376 {
378 m_tb.SetComment( 3, m_TextComment4->GetValue() );
380 }
381}
382
383
385{
386 if( m_initialized && m_TextComment5->IsModified() )
387 {
389 m_tb.SetComment( 4, m_TextComment5->GetValue() );
391 }
392}
393
394
396{
397 if( m_initialized && m_TextComment6->IsModified() )
398 {
400 m_tb.SetComment( 5, m_TextComment6->GetValue() );
402 }
403}
404
405
407{
408 if( m_initialized && m_TextComment7->IsModified() )
409 {
411 m_tb.SetComment( 6, m_TextComment7->GetValue() );
413 }
414}
415
416
418{
419 if( m_initialized && m_TextComment8->IsModified() )
420 {
422 m_tb.SetComment( 7, m_TextComment8->GetValue() );
424 }
425}
426
427
429{
430 if( m_initialized && m_TextComment9->IsModified() )
431 {
433 m_tb.SetComment( 8, m_TextComment9->GetValue() );
435 }
436}
437
438
439void DIALOG_PAGES_SETTINGS::OnDateApplyClick( wxCommandEvent& event )
440{
441 wxDateTime datetime = m_PickDate->GetValue();
442 wxString date =
443 // We can choose different formats. Should probably be kept in sync with CURRENT_DATE
444 // formatting in TITLE_BLOCK.
445 //
446 // datetime.Format( wxLocale::GetInfo( wxLOCALE_SHORT_DATE_FMT ) );
447 // datetime.Format( wxLocale::GetInfo( wxLOCALE_LONG_DATE_FMT ) );
448 // datetime.Format( wxT("%Y-%b-%d") );
449 datetime.FormatISODate();
450
451 m_TextDate->SetValue( date );
452}
453
454
456{
457 bool success = false;
458 wxString msg;
459 wxString fileName = GetWksFileName();
460
461 wxString fullFileName = m_filenameResolver->ResolvePath( fileName, m_projectPath, { m_embeddedFiles } );
462
464
465 if( !DS_DATA_MODEL::GetTheInstance().LoadDrawingSheet( fullFileName, &msg ) )
466 DisplayErrorMessage( this, wxString::Format( _( "Error loading drawing sheet '%s'." ), fullFileName ), msg );
467
469
470 int idx = std::max( m_paperSizeComboBox->GetSelection(), 0 );
471 void* clientData = m_paperSizeComboBox->GetClientData( idx );
472 PAGE_SIZE_TYPE pageType = static_cast<PAGE_SIZE_TYPE>( reinterpret_cast<intptr_t>( clientData ) );
473
474 if( pageType == PAGE_SIZE_TYPE::User )
475 {
477
478 success = m_pageInfo.SetType( PAGE_SIZE_TYPE::User );
479
480 if( success )
481 {
484
485 m_pageInfo.SetWidthMils( m_layout_size.x );
486 m_pageInfo.SetHeightMils( m_layout_size.y );
487 }
488 }
489 else
490 {
491 success = m_pageInfo.SetType( pageType );
492
493 if( success )
494 {
495 int choice = m_orientationComboBox->GetSelection();
496 m_pageInfo.SetPortrait( choice != 0 );
497 }
498 }
499
500 if( !success )
501 {
502 wxFAIL_MSG( "The translation for paper size must preserve original spellings" );
504 }
505
506 m_parent->SetPageSettings( m_pageInfo );
507
508 m_tb.SetRevision( m_TextRevision->GetValue() );
509 m_tb.SetDate( m_TextDate->GetValue() );
510 m_tb.SetCompany( m_TextCompany->GetValue() );
511 m_tb.SetTitle( m_TextTitle->GetValue() );
512 m_tb.SetComment( 0, m_TextComment1->GetValue() );
513 m_tb.SetComment( 1, m_TextComment2->GetValue() );
514 m_tb.SetComment( 2, m_TextComment3->GetValue() );
515 m_tb.SetComment( 3, m_TextComment4->GetValue() );
516 m_tb.SetComment( 4, m_TextComment5->GetValue() );
517 m_tb.SetComment( 5, m_TextComment6->GetValue() );
518 m_tb.SetComment( 6, m_TextComment7->GetValue() );
519 m_tb.SetComment( 7, m_TextComment8->GetValue() );
520 m_tb.SetComment( 8, m_TextComment9->GetValue() );
521
522 m_parent->SetTitleBlock( m_tb );
523
524 return onSavePageSettings();
525}
526
527
529{
530 int lyWidth, lyHeight;
531
532 VECTOR2D clamped_layout_size( std::clamp( m_layout_size.x, (double) MIN_PAGE_SIZE_MILS,
534 std::clamp( m_layout_size.y, (double) MIN_PAGE_SIZE_MILS,
535 m_maxPageSizeMils.y ) );
536
537 double lyRatio = clamped_layout_size.x < clamped_layout_size.y ?
538 (double) clamped_layout_size.y / clamped_layout_size.x :
539 (double) clamped_layout_size.x / clamped_layout_size.y;
540
541 if( clamped_layout_size.x < clamped_layout_size.y )
542 {
543 lyHeight = MAX_PAGE_EXAMPLE_SIZE;
544 lyWidth = KiROUND( (double) lyHeight / lyRatio );
545 }
546 else
547 {
548 lyWidth = MAX_PAGE_EXAMPLE_SIZE;
549 lyHeight = KiROUND( (double) lyWidth / lyRatio );
550 }
551
552 if( m_pageBitmap )
553 {
554 m_PageLayoutExampleBitmap->SetBitmap( wxNullBitmap );
555 delete m_pageBitmap;
556 }
557
558 m_pageBitmap = new wxBitmap( lyWidth + 1, lyHeight + 1 );
559
560 if( m_pageBitmap->IsOk() )
561 {
562 double scaleW = (double) lyWidth / clamped_layout_size.x;
563 double scaleH = (double) lyHeight / clamped_layout_size.y;
564 double scale = std::min( scaleW, scaleH );
565
566 // Prepare DC.
567 wxSize example_size( lyWidth + 1, lyHeight + 1 );
568 wxMemoryDC memDC;
569 memDC.SelectObject( *m_pageBitmap );
570 memDC.SetClippingRegion( wxPoint( 0, 0 ), example_size );
571 memDC.Clear();
572 memDC.SetUserScale( scale, scale );
573
574 // Get logical page size and margins.
575 PAGE_INFO pageDUMMY;
576
577 // Get page type
578 int idx = m_paperSizeComboBox->GetSelection();
579
580 if( idx < 0 )
581 idx = 0;
582
583 void* clientData = m_paperSizeComboBox->GetClientData( idx );
584 PAGE_SIZE_TYPE pageType = static_cast<PAGE_SIZE_TYPE>( reinterpret_cast<intptr_t>( clientData ) );
585
586 bool portrait = clamped_layout_size.x < clamped_layout_size.y;
587 pageDUMMY.SetType( pageType, portrait );
588
589 if( m_customFmt )
590 {
591 pageDUMMY.SetWidthMils( clamped_layout_size.x );
592 pageDUMMY.SetHeightMils( clamped_layout_size.y );
593 }
594
595 // Draw layout preview.
596 KIGFX::DS_RENDER_SETTINGS renderSettings;
597 COLOR_SETTINGS* colorSettings = m_parent->GetColorSettings();
598 COLOR4D bgColor = m_parent->GetDrawBgColor();
599 wxString emptyString;
600
602 {
603 GRResetPenAndBrush( &memDC );
604 renderSettings.SetDefaultPenWidth( 1 );
605 renderSettings.LoadColors( colorSettings );
606 renderSettings.SetPrintDC( &memDC );
607
608 if( m_parent->IsType( FRAME_SCH )
610 || m_parent->IsType( FRAME_SCH_VIEWER ) )
611 {
612 COLOR4D color = renderSettings.GetLayerColor( LAYER_SCHEMATIC_DRAWINGSHEET );
613 renderSettings.SetLayerColor( LAYER_DRAWINGSHEET, color );
614 }
615
616 GRFilledRect( &memDC, VECTOR2I( 0, 0 ), m_layout_size, 0, bgColor, bgColor );
617
618 PrintDrawingSheet( &renderSettings, pageDUMMY, emptyString, emptyString, emptyString,
619 m_tb, nullptr, m_screen->GetPageCount(), m_screen->GetPageNumber(),
620 1, &Prj(), wxEmptyString, m_screen->GetVirtualPageNumber() == 1 );
621
622 memDC.SelectObject( wxNullBitmap );
624 }
625
627
628 // Refresh the dialog.
629 Layout();
630 Refresh();
631 }
632}
633
634
636{
637 int idx = std::max( m_paperSizeComboBox->GetSelection(), 0 );
638 void* clientData = m_paperSizeComboBox->GetClientData( idx );
639 PAGE_SIZE_TYPE pageType = static_cast<PAGE_SIZE_TYPE>( reinterpret_cast<intptr_t>( clientData ) );
640
641 if( pageType == PAGE_SIZE_TYPE::User )
642 {
644
645 if( m_layout_size.x && m_layout_size.y )
646 {
647 if( m_layout_size.x < m_layout_size.y )
648 m_orientationComboBox->SetStringSelection( _( "Portrait" ) );
649 else
650 m_orientationComboBox->SetStringSelection( _( "Landscape" ) );
651 }
652 }
653 else
654 {
655 PAGE_INFO pageInfo; // SetType() later to lookup size
656
657 pageInfo.SetType( pageType );
658
659 VECTOR2D sz = pageInfo.GetSizeMils();
660 m_layout_size = VECTOR2D( sz.x, sz.y );
661
662 // swap sizes to match orientation
663 bool isPortrait = (bool) m_orientationComboBox->GetSelection();
664
665 if( ( isPortrait && m_layout_size.x >= m_layout_size.y ) ||
666 ( !isPortrait && m_layout_size.x < m_layout_size.y ) )
667 {
668 std::swap( m_layout_size.x, m_layout_size.y );
669 }
670 }
671}
672
673
675{
676 double customSizeX = (double) m_customSizeX.GetDoubleValue() / m_iuPerMils;
677 double customSizeY = (double) m_customSizeY.GetDoubleValue() / m_iuPerMils;
678
679 // Ensure layout size can be converted to int coordinates later
680 customSizeX = std::clamp( customSizeX, double( INT_MIN ), double( INT_MAX ) );
681 customSizeY = std::clamp( customSizeY, double( INT_MIN ), double( INT_MAX ) );
682 m_layout_size = VECTOR2D( customSizeX, customSizeY );
683}
684
685
686void DIALOG_PAGES_SETTINGS::OnWksFileSelection( wxCommandEvent& event )
687{
688 wxFileName fn = GetWksFileName();
689 wxString name = fn.GetFullName();
690 wxString path = m_projectPath;
691 wxString msg;
692
693 if( fn.IsAbsolute() )
694 {
695 path = fn.GetPath();
696 }
697 else
698 {
699 wxFileName expanded( ExpandEnvVarSubstitutions( GetWksFileName(), &m_parentFrame->Prj() ) );
700
701 if( expanded.IsAbsolute() )
702 {
703 path = expanded.GetPath();
704 }
705 else
706 {
707 ENV_VAR_MAP_CITER itUser = Pgm().GetLocalEnvVariables().find( "KICAD_USER_TEMPLATE_DIR" );
708 if( itUser != Pgm().GetLocalEnvVariables().end() && itUser->second.GetValue() != wxEmptyString )
709 {
710 wxString resolved = ExpandEnvVarSubstitutions( itUser->second.GetValue(), &m_parentFrame->Prj() );
711 if( !resolved.Contains( wxT( "${" ) ) && !resolved.Contains( wxT( "$(" ) ) )
712 {
713 wxFileName resolvedFn;
714 resolvedFn.AssignDir( resolved );
715 resolvedFn.Normalize( FN_NORMALIZE_FLAGS | wxPATH_NORM_ENV_VARS );
716 path = resolvedFn.GetFullPath();
717 }
718 }
719 }
720 }
721
722 // Display a file picker dialog
724 wxFileDialog fileDialog( this, _( "Drawing Sheet File" ), path, name, FILEEXT::DrawingSheetFileWildcard(),
725 wxFD_DEFAULT_STYLE | wxFD_FILE_MUST_EXIST );
726
727 if( m_embeddedFiles )
728 fileDialog.SetCustomizeHook( customize );
729
731
732 if( fileDialog.ShowModal() != wxID_OK )
733 return;
734
735 wxString fileName = fileDialog.GetPath();
736 wxString shortFileName;
737
738 if( m_embeddedFiles && customize.GetEmbed() )
739 {
740 fn.Assign( fileName );
742 shortFileName = result->GetLink();
743 fileName = m_embeddedFiles->GetTemporaryFileName( result->name ).GetFullPath();
744 }
745 else if( !m_projectPath.IsEmpty() && fileName.StartsWith( m_projectPath ) )
746 {
747 // Try to use a project-relative path
748 fn = wxFileName( fileName );
749 fn.MakeRelativeTo( m_projectPath );
750 shortFileName = fn.GetFullPath();
751 }
752 else
753 {
754 // Failing that see if we can shorten it with env vars:
755 shortFileName = NormalizePath( fileName, &Pgm().GetLocalEnvVariables(), nullptr );
756 }
757
758 std::unique_ptr<DS_DATA_MODEL> ws = std::make_unique<DS_DATA_MODEL>();
759
760 if( !ws->LoadDrawingSheet( fileName, &msg ) )
761 {
763 wxString::Format( _( "Error loading drawing sheet '%s'.\n%s" ),
764 fileName ),
765 msg );
766 return;
767 }
768
769 delete m_drawingSheet;
770
771 m_drawingSheet = ws.release();
772
773 SetWksFileName( shortFileName );
774
777}
const char * name
BASE_SCREEN class implementation.
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
Definition bitmap.cpp:106
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
Definition box2.h:986
static wxString m_DrawingSheetFileName
the name of the drawing sheet file, or empty to use the default drawing sheet
Definition base_screen.h:81
Color settings are a bit different than most of the settings objects in that there can be more than o...
DIALOG_PAGES_SETTINGS_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Page Settings"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
void OnComment4TextUpdated(wxCommandEvent &event) override
void OnPageOrientationChoice(wxCommandEvent &event) override
void OnUserPageSizeYTextUpdated(wxCommandEvent &event) override
PAGE_INFO m_pageInfo
The max page size allowed by the caller frame.
FILENAME_RESOLVER * m_filenameResolver
DS_DATA_MODEL * m_drawingSheet
Temporary title block (basic inscriptions).
DIALOG_PAGES_SETTINGS(EDA_DRAW_FRAME *aParent, EMBEDDED_FILES *aEmbeddedFiles, double aIuPerMils, const VECTOR2D &aMaxUserSizeMils)
void OnRevisionTextUpdated(wxCommandEvent &event) override
const wxString GetWksFileName()
void OnComment6TextUpdated(wxCommandEvent &event) override
void OnDateApplyClick(wxCommandEvent &event) override
TITLE_BLOCK m_tb
true if the page selection is custom
void OnDateTextUpdated(wxCommandEvent &event) override
VECTOR2D m_layout_size
Temporary bitmap for the drawing sheet example.
void OnComment3TextUpdated(wxCommandEvent &event) override
void OnCompanyTextUpdated(wxCommandEvent &event) override
void OnUserPageSizeXTextUpdated(wxCommandEvent &event) override
void OnComment7TextUpdated(wxCommandEvent &event) override
EMBEDDED_FILES * m_embeddedFiles
void OnPaperSizeChoice(wxCommandEvent &event) override
virtual bool onSavePageSettings()
virtual void onTransferDataToWindow()
void OnComment5TextUpdated(wxCommandEvent &event) override
void OnComment9TextUpdated(wxCommandEvent &event) override
void OnComment1TextUpdated(wxCommandEvent &event) override
void OnComment8TextUpdated(wxCommandEvent &event) override
void OnWksFileSelection(wxCommandEvent &event) override
VECTOR2D m_maxPageSizeMils
Logical drawing sheet size.
virtual bool TransferDataToWindow() override
virtual bool TransferDataFromWindow() override
void SetWksFileName(const wxString &aFilename)
bool m_customFmt
Temporary page info.
void OnComment2TextUpdated(wxCommandEvent &event) override
wxBitmap * m_pageBitmap
the page layuout filename was changed
void OnTitleTextUpdated(wxCommandEvent &event) override
void SetupStandardButtons(std::map< int, wxString > aLabels={})
EDA_BASE_FRAME * m_parentFrame
Handle the graphic items list to draw/plot the frame and title block.
static DS_DATA_MODEL & GetTheInstance()
Return the instance of DS_DATA_MODEL used in the application.
void SaveInString(wxString *aOutputString)
Save the description in a buffer.
static void SetAltInstance(DS_DATA_MODEL *aLayout=nullptr)
Set an alternate instance of DS_DATA_MODEL.
The base class for create windows for drawing purpose.
Provide an extensible class to resolve 3D model paths.
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:101
Store page-layout-specific render settings.
Definition ds_painter.h:42
void LoadColors(const COLOR_SETTINGS *aSettings) override
void SetDefaultPenWidth(int aWidth)
void SetLayerColor(int aLayer, const COLOR4D &aColor)
Change the color used to draw a layer.
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
void SetPrintDC(wxDC *aDC)
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition page_info.h:75
bool SetType(PAGE_SIZE_TYPE aPageSize, bool aIsPortrait=false)
Set the name of the page type and also the sizes and margins commonly associated with that type name.
static void SetCustomWidthMils(double aWidthInMils)
Set the width of Custom page in mils for any custom page constructed or made via SetType() after maki...
void SetHeightMils(double aHeightInMils)
static const std::vector< PAGE_INFO > & GetPageFormatsList()
const VECTOR2D & GetSizeMils() const
Definition page_info.h:146
void SetWidthMils(double aWidthInMils)
static void SetCustomHeightMils(double aHeightInMils)
Set the height of Custom page in mils for any custom page constructed or made via SetType() after mak...
virtual ENV_VAR_MAP & GetLocalEnvVariables() const
Definition pgm_base.cpp:799
virtual const wxString GetProjectPath() const
Return the full path of the project.
Definition project.cpp:183
const wxString ExpandEnvVarSubstitutions(const wxString &aString, const PROJECT *aProject)
Replace any environment variable & text variable references with their values.
Definition common.cpp:721
The common library.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition confirm.cpp:217
This file is part of the common library.
#define MAX_PAGE_EXAMPLE_SIZE
#define _(s)
void PrintDrawingSheet(const RENDER_SETTINGS *aSettings, const PAGE_INFO &aPageInfo, const wxString &aSheetName, const wxString &aSheetPath, const wxString &aFileName, const TITLE_BLOCK &aTitleBlock, const std::map< wxString, wxString > *aProperties, int aSheetCount, const wxString &aPageNumber, double aMils2Iu, const PROJECT *aProject, const wxString &aSheetLayer, bool aIsFirstPage)
Print the border and title block.
#define PL_EDITOR_FRAME_NAME
wxString NormalizePath(const wxFileName &aFilePath, const ENV_VAR_MAP *aEnvVars, const wxString &aProjectPath)
Normalize a file path to an environmental variable, if possible.
Definition env_paths.cpp:73
Helper functions to substitute paths with environmental variables.
Functions related to environment variables, including help functions.
@ FRAME_SCH_SYMBOL_EDITOR
Definition frame_type.h:31
@ FRAME_SCH_VIEWER
Definition frame_type.h:32
@ FRAME_SCH
Definition frame_type.h:30
void GRResetPenAndBrush(wxDC *DC)
Definition gr_basic.cpp:73
void GRFilledRect(wxDC *DC, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, const COLOR4D &aColor, const COLOR4D &aBgColor)
Definition gr_basic.cpp:404
static wxString DrawingSheetFileWildcard()
std::map< wxString, ENV_VAR_ITEM >::const_iterator ENV_VAR_MAP_CITER
@ LAYER_DRAWINGSHEET
Sheet frame and title block.
Definition layer_ids.h:274
@ LAYER_SCHEMATIC_DRAWINGSHEET
Definition layer_ids.h:494
This file contains miscellaneous commonly used macros and functions.
void AllowNetworkFileSystems(wxDialog *aDialog)
Configure a file dialog to show network and virtual file systems.
Definition wxgtk/ui.cpp:448
PAGE_SIZE_TYPE
Definition page_info.h:46
#define MIN_PAGE_SIZE_MILS
Min and max page sizes for clamping, in mils.
Definition page_info.h:30
PGM_BASE & Pgm()
The global program "get" accessor.
see class PGM_BASE
static const char * emptyString
const int scale
std::vector< FAB_LAYER_COLOR > dummy
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
std::string path
VECTOR2I end
wxString result
Test unit parsing edge cases and error handling.
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683
VECTOR2< double > VECTOR2D
Definition vector2d.h:682
Definition of file extensions used in Kicad.
#define FN_NORMALIZE_FLAGS
Default flags to pass to wxFileName::Normalize().
Definition wx_filename.h:35