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 along
17 * with this program. If not, see <http://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
51#define MAX_PAGE_EXAMPLE_SIZE 200
52
53
55 double aIuPerMils, const VECTOR2D& aMaxUserSizeMils ) :
57 m_parent( aParent ),
58 m_screen( m_parent->GetScreen() ),
59 m_initialized( false ),
60 m_pageBitmap( nullptr ),
61 m_iuPerMils( aIuPerMils ),
62 m_embeddedFiles( aEmbeddedFiles ),
65{
68
69 m_maxPageSizeMils = aMaxUserSizeMils;
70 m_tb = m_parent->GetTitleBlock();
71 m_customFmt = false;
73
75 wxString serialization;
77 m_drawingSheet->SetPageLayout( TO_UTF8( serialization ) );
78
79 m_PickDate->SetValue( wxDateTime::Now() );
80
81 if( m_parent->GetName() == PL_EDITOR_FRAME_NAME )
82 {
83 SetTitle( _( "Preview Settings" ) );
84 m_staticTextPaper->SetLabel( _( "Preview Paper" ) );
85 m_staticTextTitleBlock->SetLabel( _( "Preview Title Block Data" ) );
86 }
87 else
88 {
89 SetTitle( _( "Page Settings" ) );
90 m_staticTextPaper->SetLabel( _( "Paper" ) );
91 m_staticTextTitleBlock->SetLabel( _( "Title Block" ) );
92 }
93
95 m_filenameResolver->SetProject( &Prj() );
96 m_filenameResolver->SetProgramBase( &Pgm() );
97
99
100 Centre();
101}
102
103
109
110
112{
113 // initialize page format choice box and page format list.
114 // The first shows translated strings, the second contains not translated strings
115 m_paperSizeComboBox->Clear();
116
117 int selectedIdx = -1;
118 m_pageInfo = m_parent->GetPageSettings();
119
120 for( const PAGE_INFO& pageFmt : PAGE_INFO::GetPageFormatsList() )
121 {
122 int idx = m_paperSizeComboBox->Append( wxGetTranslation( pageFmt.GetPageFormatDescription() ),
123 reinterpret_cast<void*>( static_cast<intptr_t>( pageFmt.GetType() ) ) );
124
125 if( pageFmt.GetType() == m_pageInfo.GetType() )
126 {
127 selectedIdx = idx;
128 }
129 }
130
131 m_paperSizeComboBox->SetSelection( selectedIdx );
132
133 // initialize the drawing sheet filename
135
136 m_orientationComboBox->SetSelection( m_pageInfo.IsPortrait() );
137
138 // only a click fires the "selection changed" event, so have to fabricate this check
139 wxCommandEvent dummy;
141
142 if( m_customFmt )
143 {
144 m_customSizeX.SetDoubleValue( m_pageInfo.GetWidthMils() * m_iuPerMils );
145 m_customSizeY.SetDoubleValue( m_pageInfo.GetHeightMils() * m_iuPerMils );
146 }
147 else
148 {
149 m_customSizeX.SetDoubleValue( m_pageInfo.GetCustomWidthMils() * m_iuPerMils );
150 m_customSizeY.SetDoubleValue( m_pageInfo.GetCustomHeightMils() * m_iuPerMils );
151 }
152
153 m_TextRevision->SetValue( m_tb.GetRevision() );
154 m_TextDate->SetValue( m_tb.GetDate() );
155 m_TextTitle->SetValue( m_tb.GetTitle() );
156 m_TextCompany->SetValue( m_tb.GetCompany() );
157 m_TextComment1->SetValue( m_tb.GetComment( 0 ) );
158 m_TextComment2->SetValue( m_tb.GetComment( 1 ) );
159 m_TextComment3->SetValue( m_tb.GetComment( 2 ) );
160 m_TextComment4->SetValue( m_tb.GetComment( 3 ) );
161 m_TextComment5->SetValue( m_tb.GetComment( 4 ) );
162 m_TextComment6->SetValue( m_tb.GetComment( 5 ) );
163 m_TextComment7->SetValue( m_tb.GetComment( 6 ) );
164 m_TextComment8->SetValue( m_tb.GetComment( 7 ) );
165 m_TextComment9->SetValue( m_tb.GetComment( 8 ) );
166
167 // The default is to disable aall these fields for the "generic" dialog
168 m_TextSheetCount->Show( false );
169 m_TextSheetNumber->Show( false );
170 m_PaperExport->Show( false );
171 m_RevisionExport->Show( false );
172 m_DateExport->Show( false );
173 m_TitleExport->Show( false );
174 m_CompanyExport->Show( false );
175 m_Comment1Export->Show( false );
176 m_Comment2Export->Show( false );
177 m_Comment3Export->Show( false );
178 m_Comment4Export->Show( false );
179 m_Comment5Export->Show( false );
180 m_Comment6Export->Show( false );
181 m_Comment7Export->Show( false );
182 m_Comment8Export->Show( false );
183 m_Comment9Export->Show( false );
184
186
189
190 GetSizer()->SetSizeHints( this );
191
192 m_initialized = true;
193
194 return true;
195}
196
197
199{
200 int idx = std::max( m_paperSizeComboBox->GetSelection(), 0 );
201 void* clientData = m_paperSizeComboBox->GetClientData( idx );
202 PAGE_SIZE_TYPE pageType = static_cast<PAGE_SIZE_TYPE>( reinterpret_cast<intptr_t>( clientData ) );
203
204 if( pageType == PAGE_SIZE_TYPE::User )
205 {
207 return false;
208
210 return false;
211 }
212
213 if( SavePageSettings() )
214 {
215 m_screen->SetContentModified();
216
218 m_parent->OnModify();
219
220 // Call the post processing (if any) after changes
221 m_parent->OnPageSettingsChange();
222 }
223
224 return true;
225}
226
227
228void DIALOG_PAGES_SETTINGS::OnPaperSizeChoice( wxCommandEvent& event )
229{
230 int idx = m_paperSizeComboBox->GetSelection();
231
232 if( idx < 0 )
233 idx = 0;
234
235 void* clientData = m_paperSizeComboBox->GetClientData( idx );
236 PAGE_SIZE_TYPE pageType = static_cast<PAGE_SIZE_TYPE>( reinterpret_cast<intptr_t>( clientData ) );
237
238 if( pageType == PAGE_SIZE_TYPE::User )
239 {
240 m_staticTextOrient->Enable( false );
241 m_orientationComboBox->Enable( false );
242
243 m_staticTextCustSize->Enable( true );
244 m_customSizeX.Enable( true );
245 m_customSizeY.Enable( true );
246 m_customFmt = true;
247 }
248 else
249 {
250 m_staticTextOrient->Enable( true );
251 m_orientationComboBox->Enable( true );
252
253 m_staticTextCustSize->Enable( false );
254 m_customSizeX.Enable( false );
255 m_customSizeY.Enable( false );
256 m_customFmt = false;
257 }
258
261}
262
263
265{
266 if( m_initialized )
267 {
270 }
271}
272
273
275{
276 if( m_initialized )
277 {
280 }
281}
282
283
285{
286 if( m_initialized )
287 {
290 }
291}
292
293
295{
296 if( m_initialized && m_TextRevision->IsModified() )
297 {
299 m_tb.SetRevision( m_TextRevision->GetValue() );
301 }
302}
303
304
305void DIALOG_PAGES_SETTINGS::OnDateTextUpdated( wxCommandEvent& event )
306{
307 if( m_initialized && m_TextDate->IsModified() )
308 {
310 m_tb.SetDate( m_TextDate->GetValue() );
312 }
313}
314
315
316void DIALOG_PAGES_SETTINGS::OnTitleTextUpdated( wxCommandEvent& event )
317{
318 if( m_initialized && m_TextTitle->IsModified() )
319 {
321 m_tb.SetTitle( m_TextTitle->GetValue() );
323 }
324}
325
326
328{
329 if( m_initialized && m_TextCompany->IsModified() )
330 {
332 m_tb.SetCompany( m_TextCompany->GetValue() );
334 }
335}
336
337
339{
340 if( m_initialized && m_TextComment1->IsModified() )
341 {
343 m_tb.SetComment( 0, m_TextComment1->GetValue() );
345 }
346}
347
348
350{
351 if( m_initialized && m_TextComment2->IsModified() )
352 {
354 m_tb.SetComment( 1, m_TextComment2->GetValue() );
356 }
357}
358
359
361{
362 if( m_initialized && m_TextComment3->IsModified() )
363 {
365 m_tb.SetComment( 2, m_TextComment3->GetValue() );
367 }
368}
369
370
372{
373 if( m_initialized && m_TextComment4->IsModified() )
374 {
376 m_tb.SetComment( 3, m_TextComment4->GetValue() );
378 }
379}
380
381
383{
384 if( m_initialized && m_TextComment5->IsModified() )
385 {
387 m_tb.SetComment( 4, m_TextComment5->GetValue() );
389 }
390}
391
392
394{
395 if( m_initialized && m_TextComment6->IsModified() )
396 {
398 m_tb.SetComment( 5, m_TextComment6->GetValue() );
400 }
401}
402
403
405{
406 if( m_initialized && m_TextComment7->IsModified() )
407 {
409 m_tb.SetComment( 6, m_TextComment7->GetValue() );
411 }
412}
413
414
416{
417 if( m_initialized && m_TextComment8->IsModified() )
418 {
420 m_tb.SetComment( 7, m_TextComment8->GetValue() );
422 }
423}
424
425
427{
428 if( m_initialized && m_TextComment9->IsModified() )
429 {
431 m_tb.SetComment( 8, m_TextComment9->GetValue() );
433 }
434}
435
436
437void DIALOG_PAGES_SETTINGS::OnDateApplyClick( wxCommandEvent& event )
438{
439 wxDateTime datetime = m_PickDate->GetValue();
440 wxString date =
441 // We can choose different formats. Should probably be kept in sync with CURRENT_DATE
442 // formatting in TITLE_BLOCK.
443 //
444 // datetime.Format( wxLocale::GetInfo( wxLOCALE_SHORT_DATE_FMT ) );
445 // datetime.Format( wxLocale::GetInfo( wxLOCALE_LONG_DATE_FMT ) );
446 // datetime.Format( wxT("%Y-%b-%d") );
447 datetime.FormatISODate();
448
449 m_TextDate->SetValue( date );
450}
451
452
454{
455 bool success = false;
456 wxString msg;
457 wxString fileName = GetWksFileName();
458
459 wxString fullFileName = m_filenameResolver->ResolvePath( fileName, m_projectPath, { m_embeddedFiles } );
460
462
463 if( !DS_DATA_MODEL::GetTheInstance().LoadDrawingSheet( fullFileName, &msg ) )
464 DisplayErrorMessage( this, wxString::Format( _( "Error loading drawing sheet '%s'." ), fullFileName ), msg );
465
467
468 int idx = std::max( m_paperSizeComboBox->GetSelection(), 0 );
469 void* clientData = m_paperSizeComboBox->GetClientData( idx );
470 PAGE_SIZE_TYPE pageType = static_cast<PAGE_SIZE_TYPE>( reinterpret_cast<intptr_t>( clientData ) );
471
472 if( pageType == PAGE_SIZE_TYPE::User )
473 {
475
476 success = m_pageInfo.SetType( PAGE_SIZE_TYPE::User );
477
478 if( success )
479 {
482
483 m_pageInfo.SetWidthMils( m_layout_size.x );
484 m_pageInfo.SetHeightMils( m_layout_size.y );
485 }
486 }
487 else
488 {
489 success = m_pageInfo.SetType( pageType );
490
491 if( success )
492 {
493 int choice = m_orientationComboBox->GetSelection();
494 m_pageInfo.SetPortrait( choice != 0 );
495 }
496 }
497
498 if( !success )
499 {
500 wxFAIL_MSG( "The translation for paper size must preserve original spellings" );
502 }
503
504 m_parent->SetPageSettings( m_pageInfo );
505
506 m_tb.SetRevision( m_TextRevision->GetValue() );
507 m_tb.SetDate( m_TextDate->GetValue() );
508 m_tb.SetCompany( m_TextCompany->GetValue() );
509 m_tb.SetTitle( m_TextTitle->GetValue() );
510 m_tb.SetComment( 0, m_TextComment1->GetValue() );
511 m_tb.SetComment( 1, m_TextComment2->GetValue() );
512 m_tb.SetComment( 2, m_TextComment3->GetValue() );
513 m_tb.SetComment( 3, m_TextComment4->GetValue() );
514 m_tb.SetComment( 4, m_TextComment5->GetValue() );
515 m_tb.SetComment( 5, m_TextComment6->GetValue() );
516 m_tb.SetComment( 6, m_TextComment7->GetValue() );
517 m_tb.SetComment( 7, m_TextComment8->GetValue() );
518 m_tb.SetComment( 8, m_TextComment9->GetValue() );
519
520 m_parent->SetTitleBlock( m_tb );
521
522 return onSavePageSettings();
523}
524
525
527{
528 int lyWidth, lyHeight;
529
530 VECTOR2D clamped_layout_size( std::clamp( m_layout_size.x, (double) MIN_PAGE_SIZE_MILS,
532 std::clamp( m_layout_size.y, (double) MIN_PAGE_SIZE_MILS,
533 m_maxPageSizeMils.y ) );
534
535 double lyRatio = clamped_layout_size.x < clamped_layout_size.y ?
536 (double) clamped_layout_size.y / clamped_layout_size.x :
537 (double) clamped_layout_size.x / clamped_layout_size.y;
538
539 if( clamped_layout_size.x < clamped_layout_size.y )
540 {
541 lyHeight = MAX_PAGE_EXAMPLE_SIZE;
542 lyWidth = KiROUND( (double) lyHeight / lyRatio );
543 }
544 else
545 {
546 lyWidth = MAX_PAGE_EXAMPLE_SIZE;
547 lyHeight = KiROUND( (double) lyWidth / lyRatio );
548 }
549
550 if( m_pageBitmap )
551 {
552 m_PageLayoutExampleBitmap->SetBitmap( wxNullBitmap );
553 delete m_pageBitmap;
554 }
555
556 m_pageBitmap = new wxBitmap( lyWidth + 1, lyHeight + 1 );
557
558 if( m_pageBitmap->IsOk() )
559 {
560 double scaleW = (double) lyWidth / clamped_layout_size.x;
561 double scaleH = (double) lyHeight / clamped_layout_size.y;
562 double scale = std::min( scaleW, scaleH );
563
564 // Prepare DC.
565 wxSize example_size( lyWidth + 1, lyHeight + 1 );
566 wxMemoryDC memDC;
567 memDC.SelectObject( *m_pageBitmap );
568 memDC.SetClippingRegion( wxPoint( 0, 0 ), example_size );
569 memDC.Clear();
570 memDC.SetUserScale( scale, scale );
571
572 // Get logical page size and margins.
573 PAGE_INFO pageDUMMY;
574
575 // Get page type
576 int idx = m_paperSizeComboBox->GetSelection();
577
578 if( idx < 0 )
579 idx = 0;
580
581 void* clientData = m_paperSizeComboBox->GetClientData( idx );
582 PAGE_SIZE_TYPE pageType = static_cast<PAGE_SIZE_TYPE>( reinterpret_cast<intptr_t>( clientData ) );
583
584 bool portrait = clamped_layout_size.x < clamped_layout_size.y;
585 pageDUMMY.SetType( pageType, portrait );
586
587 if( m_customFmt )
588 {
589 pageDUMMY.SetWidthMils( clamped_layout_size.x );
590 pageDUMMY.SetHeightMils( clamped_layout_size.y );
591 }
592
593 // Draw layout preview.
594 KIGFX::DS_RENDER_SETTINGS renderSettings;
595 COLOR_SETTINGS* colorSettings = m_parent->GetColorSettings();
596 COLOR4D bgColor = m_parent->GetDrawBgColor();
597 wxString emptyString;
598
600 {
601 GRResetPenAndBrush( &memDC );
602 renderSettings.SetDefaultPenWidth( 1 );
603 renderSettings.LoadColors( colorSettings );
604 renderSettings.SetPrintDC( &memDC );
605
606 if( m_parent->IsType( FRAME_SCH )
608 || m_parent->IsType( FRAME_SCH_VIEWER ) )
609 {
611 renderSettings.SetLayerColor( LAYER_DRAWINGSHEET, color );
612 }
613
614 GRFilledRect( &memDC, VECTOR2I( 0, 0 ), m_layout_size, 0, bgColor, bgColor );
615
616 PrintDrawingSheet( &renderSettings, pageDUMMY, emptyString, emptyString, emptyString,
617 m_tb, nullptr, m_screen->GetPageCount(), m_screen->GetPageNumber(),
618 1, &Prj(), wxEmptyString, m_screen->GetVirtualPageNumber() == 1 );
619
620 memDC.SelectObject( wxNullBitmap );
622 }
623
625
626 // Refresh the dialog.
627 Layout();
628 Refresh();
629 }
630}
631
632
634{
635 int idx = std::max( m_paperSizeComboBox->GetSelection(), 0 );
636 void* clientData = m_paperSizeComboBox->GetClientData( idx );
637 PAGE_SIZE_TYPE pageType = static_cast<PAGE_SIZE_TYPE>( reinterpret_cast<intptr_t>( clientData ) );
638
639 if( pageType == PAGE_SIZE_TYPE::User )
640 {
642
643 if( m_layout_size.x && m_layout_size.y )
644 {
645 if( m_layout_size.x < m_layout_size.y )
646 m_orientationComboBox->SetStringSelection( _( "Portrait" ) );
647 else
648 m_orientationComboBox->SetStringSelection( _( "Landscape" ) );
649 }
650 }
651 else
652 {
653 PAGE_INFO pageInfo; // SetType() later to lookup size
654
655 pageInfo.SetType( pageType );
656
657 VECTOR2D sz = pageInfo.GetSizeMils();
658 m_layout_size = VECTOR2D( sz.x, sz.y );
659
660 // swap sizes to match orientation
661 bool isPortrait = (bool) m_orientationComboBox->GetSelection();
662
663 if( ( isPortrait && m_layout_size.x >= m_layout_size.y ) ||
664 ( !isPortrait && m_layout_size.x < m_layout_size.y ) )
665 {
666 std::swap( m_layout_size.x, m_layout_size.y );
667 }
668 }
669}
670
671
673{
674 double customSizeX = (double) m_customSizeX.GetDoubleValue() / m_iuPerMils;
675 double customSizeY = (double) m_customSizeY.GetDoubleValue() / m_iuPerMils;
676
677 // Ensure layout size can be converted to int coordinates later
678 customSizeX = std::clamp( customSizeX, double( INT_MIN ), double( INT_MAX ) );
679 customSizeY = std::clamp( customSizeY, double( INT_MIN ), double( INT_MAX ) );
680 m_layout_size = VECTOR2D( customSizeX, customSizeY );
681}
682
683
684void DIALOG_PAGES_SETTINGS::OnWksFileSelection( wxCommandEvent& event )
685{
686 wxFileName fn = GetWksFileName();
687 wxString name = fn.GetFullName();
688 wxString path;
689 wxString msg;
690
691 if( fn.IsAbsolute() )
692 {
693 path = fn.GetPath();
694 }
695 else
696 {
697 wxFileName expanded( ExpandEnvVarSubstitutions( GetWksFileName(), &m_parentFrame->Prj() ) );
698
699 if( expanded.IsAbsolute() )
700 path = expanded.GetPath();
701 else
703 }
704
705 // Display a file picker dialog
706 FILEDLG_HOOK_EMBED_FILE customize;
707 wxFileDialog fileDialog( this, _( "Drawing Sheet File" ), path, name, FILEEXT::DrawingSheetFileWildcard(),
708 wxFD_DEFAULT_STYLE | wxFD_FILE_MUST_EXIST );
709
710 if( m_embeddedFiles )
711 fileDialog.SetCustomizeHook( customize );
712
713 if( fileDialog.ShowModal() != wxID_OK )
714 return;
715
716 wxString fileName = fileDialog.GetPath();
717 wxString shortFileName;
718
719 if( m_embeddedFiles && customize.GetEmbed() )
720 {
721 fn.Assign( fileName );
723 shortFileName = result->GetLink();
724 fileName = m_embeddedFiles->GetTemporaryFileName( result->name ).GetFullPath();
725 }
726 else if( !m_projectPath.IsEmpty() && fileName.StartsWith( m_projectPath ) )
727 {
728 // Try to use a project-relative path
729 fn = wxFileName( fileName );
730 fn.MakeRelativeTo( m_projectPath );
731 shortFileName = fn.GetFullPath();
732 }
733 else
734 {
735 // Failing that see if we can shorten it with env vars:
736 shortFileName = NormalizePath( fileName, &Pgm().GetLocalEnvVariables(), nullptr );
737 }
738
739 std::unique_ptr<DS_DATA_MODEL> ws = std::make_unique<DS_DATA_MODEL>();
740
741 if( !ws->LoadDrawingSheet( fileName, &msg ) )
742 {
744 wxString::Format( _( "Error loading drawing sheet '%s'.\n%s" ),
745 fileName ),
746 msg );
747 return;
748 }
749
750 delete m_drawingSheet;
751
752 m_drawingSheet = ws.release();
753
754 SetWksFileName( shortFileName );
755
758}
int color
const char * name
BASE_SCREEN class implementation.
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
Definition bitmap.cpp:110
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
Definition box2.h:990
static wxString m_DrawingSheetFileName
the name of the drawing sheet file, or empty to use the default drawing sheet
Definition base_screen.h:85
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:104
Store page-layout-specific render settings.
Definition ds_painter.h:46
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:79
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:150
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 const wxString GetProjectPath() const
Return the full path of the project.
Definition project.cpp:162
const wxString ExpandEnvVarSubstitutions(const wxString &aString, const PROJECT *aProject)
Replace any environment variable & text variable references with their values.
Definition common.cpp:355
The common library.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition confirm.cpp:194
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.
@ FRAME_SCH_SYMBOL_EDITOR
Definition frame_type.h:35
@ FRAME_SCH_VIEWER
Definition frame_type.h:36
@ FRAME_SCH
Definition frame_type.h:34
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()
@ LAYER_DRAWINGSHEET
Sheet frame and title block.
Definition layer_ids.h:277
@ LAYER_SCHEMATIC_DRAWINGSHEET
Definition layer_ids.h:494
This file contains miscellaneous commonly used macros and functions.
PAGE_SIZE_TYPE
Definition page_info.h:50
#define MIN_PAGE_SIZE_MILS
Min and max page sizes for clamping, in mils.
Definition page_info.h:34
void Refresh()
Update the board display after modifying it by a python script (note: it is automatically called by a...
PGM_BASE & Pgm()
The global program "get" accessor.
Definition pgm_base.cpp:913
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.
wxString result
Test unit parsing edge cases and error handling.
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:695
VECTOR2< double > VECTOR2D
Definition vector2d.h:694
Definition of file extensions used in Kicad.