KiCad PCB EDA Suite
panel_gerbview_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) 2010-2014 Jean-Pierre Charras jp.charras at wanadoo.fr
5  * Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software: you can redistribute it and/or modify it
8  * under the terms of the GNU General Public License as published by the
9  * Free Software Foundation, either version 3 of the License, or (at your
10  * option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #include <gerbview.h>
22 #include <gerbview_frame.h>
23 #include <core/arraydim.h>
24 
26 
27 
29 static const wxChar* gerberPageSizeList[] =
30 {
31  wxT( "GERBER" ), // index 0: full size page selection
32  wxT( "A4" ),
33  wxT( "A3" ),
34  wxT( "A2" ),
35  wxT( "A" ),
36  wxT( "B" ),
37  wxT( "C" ),
38 };
39 
40 
42  PANEL_GERBVIEW_SETTINGS_BASE( aWindow, wxID_ANY ),
43  m_Parent( aFrame )
44 {
45 }
46 
47 
49 {
51 
52  for( unsigned i = 0; i < arrayDim( gerberPageSizeList ); ++i )
53  {
55  {
56  m_PageSize->SetSelection( i );
57  break;
58  }
59  }
60 
61  return true;
62 }
63 
64 
66 {
67  auto opts = m_Parent->GetDisplayOptions();
68  opts.m_DisplayPageLimits = m_ShowPageLimitsOpt->GetValue();
69 
70  PAGE_INFO pageInfo( gerberPageSizeList[ m_PageSize->GetSelection() ] );
71  m_Parent->SetPageSettings( pageInfo );
72 
74 
75  return true;
76 }
77 
void SetPageSettings(const PAGE_INFO &aPageSettings) override
const GBR_DISPLAY_OPTIONS & GetDisplayOptions() const
const wxString & GetType() const
Definition: page_info.h:94
void UpdateDisplayOptions(const GBR_DISPLAY_OPTIONS &aOptions)
Update the display options and refreshes the view as needed.
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:53
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
Definition: arraydim.h:31
static const wxChar * gerberPageSizeList[]
List of page sizes.
const PAGE_INFO & GetPageSettings() const override
Class PANEL_GERBVIEW_SETTINGS_BASE.
PANEL_GERBVIEW_SETTINGS(GERBVIEW_FRAME *aFrame, wxWindow *aWindow)