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#include <kiplatform/ui.h>
51
52#define MAX_PAGE_EXAMPLE_SIZE 200
53
54
56 double aIuPerMils, const VECTOR2D& aMaxUserSizeMils ) :
58 m_parent( aParent ),
59 m_screen( m_parent->GetScreen() ),
60 m_initialized( false ),
61 m_pageBitmap( nullptr ),
62 m_iuPerMils( aIuPerMils ),
63 m_embeddedFiles( aEmbeddedFiles ),
66{
69
70 m_maxPageSizeMils = aMaxUserSizeMils;
71 m_tb = m_parent->GetTitleBlock();
72 m_customFmt = false;
74
76 wxString serialization;
78 m_drawingSheet->SetPageLayout( TO_UTF8( serialization ) );
79
80 m_PickDate->SetValue( wxDateTime::Now() );
81
82 if( m_parent->GetName() == PL_EDITOR_FRAME_NAME )
83 {
84 SetTitle( _( "Preview Settings" ) );
85 m_staticTextPaper->SetLabel( _( "Preview Paper" ) );
86 m_staticTextTitleBlock->SetLabel( _( "Preview Title Block Data" ) );
87 }
88 else
89 {
90 SetTitle( _( "Page Settings" ) );
91 m_staticTextPaper->SetLabel( _( "Paper" ) );
92 m_staticTextTitleBlock->SetLabel( _( "Title Block" ) );
93 }
94
96 m_filenameResolver->SetProject( &Prj() );
97 m_filenameResolver->SetProgramBase( &Pgm() );
98
100
101 Centre();
102}
103
104
110
111
113{
114 // initialize page format choice box and page format list.
115 // The first shows translated strings, the second contains not translated strings
116 m_paperSizeComboBox->Clear();
117
118 int selectedIdx = -1;
119 m_pageInfo = m_parent->GetPageSettings();
120
121 for( const PAGE_INFO& pageFmt : PAGE_INFO::GetPageFormatsList() )
122 {
123 int idx = m_paperSizeComboBox->Append( wxGetTranslation( pageFmt.GetPageFormatDescription() ),
124 reinterpret_cast<void*>( static_cast<intptr_t>( pageFmt.GetType() ) ) );
125
126 if( pageFmt.GetType() == m_pageInfo.GetType() )
127 {
128 selectedIdx = idx;
129 }
130 }
131
132 m_paperSizeComboBox->SetSelection( selectedIdx );
133
134 // initialize the drawing sheet filename
136
137 m_orientationComboBox->SetSelection( m_pageInfo.IsPortrait() );
138
139 // only a click fires the "selection changed" event, so have to fabricate this check
140 wxCommandEvent dummy;
142
143 if( m_customFmt )
144 {
145 m_customSizeX.SetDoubleValue( m_pageInfo.GetWidthMils() * m_iuPerMils );
146 m_customSizeY.SetDoubleValue( m_pageInfo.GetHeightMils() * m_iuPerMils );
147 }
148 else
149 {
150 m_customSizeX.SetDoubleValue( m_pageInfo.GetCustomWidthMils() * m_iuPerMils );
151 m_customSizeY.SetDoubleValue( m_pageInfo.GetCustomHeightMils() * m_iuPerMils );
152 }
153
154 m_TextRevision->SetValue( m_tb.GetRevision() );
155 m_TextDate->SetValue( m_tb.GetDate() );
156 m_TextTitle->SetValue( m_tb.GetTitle() );
157 m_TextCompany->SetValue( m_tb.GetCompany() );
158 m_TextComment1->SetValue( m_tb.GetComment( 0 ) );
159 m_TextComment2->SetValue( m_tb.GetComment( 1 ) );
160 m_TextComment3->SetValue( m_tb.GetComment( 2 ) );
161 m_TextComment4->SetValue( m_tb.GetComment( 3 ) );
162 m_TextComment5->SetValue( m_tb.GetComment( 4 ) );
163 m_TextComment6->SetValue( m_tb.GetComment( 5 ) );
164 m_TextComment7->SetValue( m_tb.GetComment( 6 ) );
165 m_TextComment8->SetValue( m_tb.GetComment( 7 ) );
166 m_TextComment9->SetValue( m_tb.GetComment( 8 ) );
167
168 // The default is to disable aall these fields for the "generic" dialog
169 m_TextSheetCount->Show( false );
170 m_TextSheetNumber->Show( false );
171 m_PaperExport->Show( false );
172 m_RevisionExport->Show( false );
173 m_DateExport->Show( false );
174 m_TitleExport->Show( false );
175 m_CompanyExport->Show( false );
176 m_Comment1Export->Show( false );
177 m_Comment2Export->Show( false );
178 m_Comment3Export->Show( false );
179 m_Comment4Export->Show( false );
180 m_Comment5Export->Show( false );
181 m_Comment6Export->Show( false );
182 m_Comment7Export->Show( false );
183 m_Comment8Export->Show( false );
184 m_Comment9Export->Show( false );
185
187
190
191 GetSizer()->SetSizeHints( this );
192
193 m_initialized = true;
194
195 return true;
196}
197
198
200{
201 int idx = std::max( m_paperSizeComboBox->GetSelection(), 0 );
202 void* clientData = m_paperSizeComboBox->GetClientData( idx );
203 PAGE_SIZE_TYPE pageType = static_cast<PAGE_SIZE_TYPE>( reinterpret_cast<intptr_t>( clientData ) );
204
205 if( pageType == PAGE_SIZE_TYPE::User )
206 {
208 return false;
209
211 return false;
212 }
213
214 if( SavePageSettings() )
215 {
216 m_screen->SetContentModified();
217
219 m_parent->OnModify();
220
221 // Call the post processing (if any) after changes
222 m_parent->OnPageSettingsChange();
223 }
224
225 return true;
226}
227
228
229void DIALOG_PAGES_SETTINGS::OnPaperSizeChoice( wxCommandEvent& event )
230{
231 int idx = m_paperSizeComboBox->GetSelection();
232
233 if( idx < 0 )
234 idx = 0;
235
236 void* clientData = m_paperSizeComboBox->GetClientData( idx );
237 PAGE_SIZE_TYPE pageType = static_cast<PAGE_SIZE_TYPE>( reinterpret_cast<intptr_t>( clientData ) );
238
239 if( pageType == PAGE_SIZE_TYPE::User )
240 {
241 m_staticTextOrient->Enable( false );
242 m_orientationComboBox->Enable( false );
243
244 m_staticTextCustSize->Enable( true );
245 m_customSizeX.Enable( true );
246 m_customSizeY.Enable( true );
247 m_customFmt = true;
248 }
249 else
250 {
251 m_staticTextOrient->Enable( true );
252 m_orientationComboBox->Enable( true );
253
254 m_staticTextCustSize->Enable( false );
255 m_customSizeX.Enable( false );
256 m_customSizeY.Enable( false );
257 m_customFmt = false;
258 }
259
262}
263
264
266{
267 if( m_initialized )
268 {
271 }
272}
273
274
276{
277 if( m_initialized )
278 {
281 }
282}
283
284
286{
287 if( m_initialized )
288 {
291 }
292}
293
294
296{
297 if( m_initialized && m_TextRevision->IsModified() )
298 {
300 m_tb.SetRevision( m_TextRevision->GetValue() );
302 }
303}
304
305
306void DIALOG_PAGES_SETTINGS::OnDateTextUpdated( wxCommandEvent& event )
307{
308 if( m_initialized && m_TextDate->IsModified() )
309 {
311 m_tb.SetDate( m_TextDate->GetValue() );
313 }
314}
315
316
317void DIALOG_PAGES_SETTINGS::OnTitleTextUpdated( wxCommandEvent& event )
318{
319 if( m_initialized && m_TextTitle->IsModified() )
320 {
322 m_tb.SetTitle( m_TextTitle->GetValue() );
324 }
325}
326
327
329{
330 if( m_initialized && m_TextCompany->IsModified() )
331 {
333 m_tb.SetCompany( m_TextCompany->GetValue() );
335 }
336}
337
338
340{
341 if( m_initialized && m_TextComment1->IsModified() )
342 {
344 m_tb.SetComment( 0, m_TextComment1->GetValue() );
346 }
347}
348
349
351{
352 if( m_initialized && m_TextComment2->IsModified() )
353 {
355 m_tb.SetComment( 1, m_TextComment2->GetValue() );
357 }
358}
359
360
362{
363 if( m_initialized && m_TextComment3->IsModified() )
364 {
366 m_tb.SetComment( 2, m_TextComment3->GetValue() );
368 }
369}
370
371
373{
374 if( m_initialized && m_TextComment4->IsModified() )
375 {
377 m_tb.SetComment( 3, m_TextComment4->GetValue() );
379 }
380}
381
382
384{
385 if( m_initialized && m_TextComment5->IsModified() )
386 {
388 m_tb.SetComment( 4, m_TextComment5->GetValue() );
390 }
391}
392
393
395{
396 if( m_initialized && m_TextComment6->IsModified() )
397 {
399 m_tb.SetComment( 5, m_TextComment6->GetValue() );
401 }
402}
403
404
406{
407 if( m_initialized && m_TextComment7->IsModified() )
408 {
410 m_tb.SetComment( 6, m_TextComment7->GetValue() );
412 }
413}
414
415
417{
418 if( m_initialized && m_TextComment8->IsModified() )
419 {
421 m_tb.SetComment( 7, m_TextComment8->GetValue() );
423 }
424}
425
426
428{
429 if( m_initialized && m_TextComment9->IsModified() )
430 {
432 m_tb.SetComment( 8, m_TextComment9->GetValue() );
434 }
435}
436
437
438void DIALOG_PAGES_SETTINGS::OnDateApplyClick( wxCommandEvent& event )
439{
440 wxDateTime datetime = m_PickDate->GetValue();
441 wxString date =
442 // We can choose different formats. Should probably be kept in sync with CURRENT_DATE
443 // formatting in TITLE_BLOCK.
444 //
445 // datetime.Format( wxLocale::GetInfo( wxLOCALE_SHORT_DATE_FMT ) );
446 // datetime.Format( wxLocale::GetInfo( wxLOCALE_LONG_DATE_FMT ) );
447 // datetime.Format( wxT("%Y-%b-%d") );
448 datetime.FormatISODate();
449
450 m_TextDate->SetValue( date );
451}
452
453
455{
456 bool success = false;
457 wxString msg;
458 wxString fileName = GetWksFileName();
459
460 wxString fullFileName = m_filenameResolver->ResolvePath( fileName, m_projectPath, { m_embeddedFiles } );
461
463
464 if( !DS_DATA_MODEL::GetTheInstance().LoadDrawingSheet( fullFileName, &msg ) )
465 DisplayErrorMessage( this, wxString::Format( _( "Error loading drawing sheet '%s'." ), fullFileName ), msg );
466
468
469 int idx = std::max( m_paperSizeComboBox->GetSelection(), 0 );
470 void* clientData = m_paperSizeComboBox->GetClientData( idx );
471 PAGE_SIZE_TYPE pageType = static_cast<PAGE_SIZE_TYPE>( reinterpret_cast<intptr_t>( clientData ) );
472
473 if( pageType == PAGE_SIZE_TYPE::User )
474 {
476
477 success = m_pageInfo.SetType( PAGE_SIZE_TYPE::User );
478
479 if( success )
480 {
483
484 m_pageInfo.SetWidthMils( m_layout_size.x );
485 m_pageInfo.SetHeightMils( m_layout_size.y );
486 }
487 }
488 else
489 {
490 success = m_pageInfo.SetType( pageType );
491
492 if( success )
493 {
494 int choice = m_orientationComboBox->GetSelection();
495 m_pageInfo.SetPortrait( choice != 0 );
496 }
497 }
498
499 if( !success )
500 {
501 wxFAIL_MSG( "The translation for paper size must preserve original spellings" );
503 }
504
505 m_parent->SetPageSettings( m_pageInfo );
506
507 m_tb.SetRevision( m_TextRevision->GetValue() );
508 m_tb.SetDate( m_TextDate->GetValue() );
509 m_tb.SetCompany( m_TextCompany->GetValue() );
510 m_tb.SetTitle( m_TextTitle->GetValue() );
511 m_tb.SetComment( 0, m_TextComment1->GetValue() );
512 m_tb.SetComment( 1, m_TextComment2->GetValue() );
513 m_tb.SetComment( 2, m_TextComment3->GetValue() );
514 m_tb.SetComment( 3, m_TextComment4->GetValue() );
515 m_tb.SetComment( 4, m_TextComment5->GetValue() );
516 m_tb.SetComment( 5, m_TextComment6->GetValue() );
517 m_tb.SetComment( 6, m_TextComment7->GetValue() );
518 m_tb.SetComment( 7, m_TextComment8->GetValue() );
519 m_tb.SetComment( 8, m_TextComment9->GetValue() );
520
521 m_parent->SetTitleBlock( m_tb );
522
523 return onSavePageSettings();
524}
525
526
528{
529 int lyWidth, lyHeight;
530
531 VECTOR2D clamped_layout_size( std::clamp( m_layout_size.x, (double) MIN_PAGE_SIZE_MILS,
533 std::clamp( m_layout_size.y, (double) MIN_PAGE_SIZE_MILS,
534 m_maxPageSizeMils.y ) );
535
536 double lyRatio = clamped_layout_size.x < clamped_layout_size.y ?
537 (double) clamped_layout_size.y / clamped_layout_size.x :
538 (double) clamped_layout_size.x / clamped_layout_size.y;
539
540 if( clamped_layout_size.x < clamped_layout_size.y )
541 {
542 lyHeight = MAX_PAGE_EXAMPLE_SIZE;
543 lyWidth = KiROUND( (double) lyHeight / lyRatio );
544 }
545 else
546 {
547 lyWidth = MAX_PAGE_EXAMPLE_SIZE;
548 lyHeight = KiROUND( (double) lyWidth / lyRatio );
549 }
550
551 if( m_pageBitmap )
552 {
553 m_PageLayoutExampleBitmap->SetBitmap( wxNullBitmap );
554 delete m_pageBitmap;
555 }
556
557 m_pageBitmap = new wxBitmap( lyWidth + 1, lyHeight + 1 );
558
559 if( m_pageBitmap->IsOk() )
560 {
561 double scaleW = (double) lyWidth / clamped_layout_size.x;
562 double scaleH = (double) lyHeight / clamped_layout_size.y;
563 double scale = std::min( scaleW, scaleH );
564
565 // Prepare DC.
566 wxSize example_size( lyWidth + 1, lyHeight + 1 );
567 wxMemoryDC memDC;
568 memDC.SelectObject( *m_pageBitmap );
569 memDC.SetClippingRegion( wxPoint( 0, 0 ), example_size );
570 memDC.Clear();
571 memDC.SetUserScale( scale, scale );
572
573 // Get logical page size and margins.
574 PAGE_INFO pageDUMMY;
575
576 // Get page type
577 int idx = m_paperSizeComboBox->GetSelection();
578
579 if( idx < 0 )
580 idx = 0;
581
582 void* clientData = m_paperSizeComboBox->GetClientData( idx );
583 PAGE_SIZE_TYPE pageType = static_cast<PAGE_SIZE_TYPE>( reinterpret_cast<intptr_t>( clientData ) );
584
585 bool portrait = clamped_layout_size.x < clamped_layout_size.y;
586 pageDUMMY.SetType( pageType, portrait );
587
588 if( m_customFmt )
589 {
590 pageDUMMY.SetWidthMils( clamped_layout_size.x );
591 pageDUMMY.SetHeightMils( clamped_layout_size.y );
592 }
593
594 // Draw layout preview.
595 KIGFX::DS_RENDER_SETTINGS renderSettings;
596 COLOR_SETTINGS* colorSettings = m_parent->GetColorSettings();
597 COLOR4D bgColor = m_parent->GetDrawBgColor();
598 wxString emptyString;
599
601 {
602 GRResetPenAndBrush( &memDC );
603 renderSettings.SetDefaultPenWidth( 1 );
604 renderSettings.LoadColors( colorSettings );
605 renderSettings.SetPrintDC( &memDC );
606
607 if( m_parent->IsType( FRAME_SCH )
609 || m_parent->IsType( FRAME_SCH_VIEWER ) )
610 {
611 COLOR4D color = renderSettings.GetLayerColor( LAYER_SCHEMATIC_DRAWINGSHEET );
612 renderSettings.SetLayerColor( LAYER_DRAWINGSHEET, color );
613 }
614
615 GRFilledRect( &memDC, VECTOR2I( 0, 0 ), m_layout_size, 0, bgColor, bgColor );
616
617 PrintDrawingSheet( &renderSettings, pageDUMMY, emptyString, emptyString, emptyString,
618 m_tb, nullptr, m_screen->GetPageCount(), m_screen->GetPageNumber(),
619 1, &Prj(), wxEmptyString, m_screen->GetVirtualPageNumber() == 1 );
620
621 memDC.SelectObject( wxNullBitmap );
623 }
624
626
627 // Refresh the dialog.
628 Layout();
629 Refresh();
630 }
631}
632
633
635{
636 int idx = std::max( m_paperSizeComboBox->GetSelection(), 0 );
637 void* clientData = m_paperSizeComboBox->GetClientData( idx );
638 PAGE_SIZE_TYPE pageType = static_cast<PAGE_SIZE_TYPE>( reinterpret_cast<intptr_t>( clientData ) );
639
640 if( pageType == PAGE_SIZE_TYPE::User )
641 {
643
644 if( m_layout_size.x && m_layout_size.y )
645 {
646 if( m_layout_size.x < m_layout_size.y )
647 m_orientationComboBox->SetStringSelection( _( "Portrait" ) );
648 else
649 m_orientationComboBox->SetStringSelection( _( "Landscape" ) );
650 }
651 }
652 else
653 {
654 PAGE_INFO pageInfo; // SetType() later to lookup size
655
656 pageInfo.SetType( pageType );
657
658 VECTOR2D sz = pageInfo.GetSizeMils();
659 m_layout_size = VECTOR2D( sz.x, sz.y );
660
661 // swap sizes to match orientation
662 bool isPortrait = (bool) m_orientationComboBox->GetSelection();
663
664 if( ( isPortrait && m_layout_size.x >= m_layout_size.y ) ||
665 ( !isPortrait && m_layout_size.x < m_layout_size.y ) )
666 {
667 std::swap( m_layout_size.x, m_layout_size.y );
668 }
669 }
670}
671
672
674{
675 double customSizeX = (double) m_customSizeX.GetDoubleValue() / m_iuPerMils;
676 double customSizeY = (double) m_customSizeY.GetDoubleValue() / m_iuPerMils;
677
678 // Ensure layout size can be converted to int coordinates later
679 customSizeX = std::clamp( customSizeX, double( INT_MIN ), double( INT_MAX ) );
680 customSizeY = std::clamp( customSizeY, double( INT_MIN ), double( INT_MAX ) );
681 m_layout_size = VECTOR2D( customSizeX, customSizeY );
682}
683
684
685void DIALOG_PAGES_SETTINGS::OnWksFileSelection( wxCommandEvent& event )
686{
687 wxFileName fn = GetWksFileName();
688 wxString name = fn.GetFullName();
689 wxString path;
690 wxString msg;
691
692 if( fn.IsAbsolute() )
693 {
694 path = fn.GetPath();
695 }
696 else
697 {
698 wxFileName expanded( ExpandEnvVarSubstitutions( GetWksFileName(), &m_parentFrame->Prj() ) );
699
700 if( expanded.IsAbsolute() )
701 path = expanded.GetPath();
702 else
704 }
705
706 // Display a file picker dialog
707 FILEDLG_HOOK_EMBED_FILE customize;
708 wxFileDialog fileDialog( this, _( "Drawing Sheet File" ), path, name, FILEEXT::DrawingSheetFileWildcard(),
709 wxFD_DEFAULT_STYLE | wxFD_FILE_MUST_EXIST );
710
711 if( m_embeddedFiles )
712 fileDialog.SetCustomizeHook( customize );
713
715
716 if( fileDialog.ShowModal() != wxID_OK )
717 return;
718
719 wxString fileName = fileDialog.GetPath();
720 wxString shortFileName;
721
722 if( m_embeddedFiles && customize.GetEmbed() )
723 {
724 fn.Assign( fileName );
726 shortFileName = result->GetLink();
727 fileName = m_embeddedFiles->GetTemporaryFileName( result->name ).GetFullPath();
728 }
729 else if( !m_projectPath.IsEmpty() && fileName.StartsWith( m_projectPath ) )
730 {
731 // Try to use a project-relative path
732 fn = wxFileName( fileName );
733 fn.MakeRelativeTo( m_projectPath );
734 shortFileName = fn.GetFullPath();
735 }
736 else
737 {
738 // Failing that see if we can shorten it with env vars:
739 shortFileName = NormalizePath( fileName, &Pgm().GetLocalEnvVariables(), nullptr );
740 }
741
742 std::unique_ptr<DS_DATA_MODEL> ws = std::make_unique<DS_DATA_MODEL>();
743
744 if( !ws->LoadDrawingSheet( fileName, &msg ) )
745 {
747 wxString::Format( _( "Error loading drawing sheet '%s'.\n%s" ),
748 fileName ),
749 msg );
750 return;
751 }
752
753 delete m_drawingSheet;
754
755 m_drawingSheet = ws.release();
756
757 SetWksFileName( shortFileName );
758
761}
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:105
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:168
const wxString ExpandEnvVarSubstitutions(const wxString &aString, const PROJECT *aProject)
Replace any environment variable & text variable references with their values.
Definition common.cpp:558
The common library.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition confirm.cpp:202
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:278
@ LAYER_SCHEMATIC_DRAWINGSHEET
Definition layer_ids.h:496
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:717
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.
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
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.