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 
22 #include <gerbview.h>
23 #include <gerbview_frame.h>
24 #include <macros.h>
25 
27 
28 
30 static const wxChar* gerberPageSizeList[] =
31 {
32  wxT( "GERBER" ), // index 0: full size page selection
33  wxT( "A4" ),
34  wxT( "A3" ),
35  wxT( "A2" ),
36  wxT( "A" ),
37  wxT( "B" ),
38  wxT( "C" ),
39 };
40 
41 
43  PANEL_GERBVIEW_SETTINGS_BASE( aWindow, wxID_ANY ),
44  m_Parent( aFrame )
45 {
46 }
47 
48 
50 {
52 
53  for( unsigned i = 0; i < arrayDim( gerberPageSizeList ); ++i )
54  {
56  {
57  m_PageSize->SetSelection( i );
58  break;
59  }
60  }
61 
62  return true;
63 }
64 
65 
67 {
68  auto opts = m_Parent->GetDisplayOptions();
69  opts.m_DisplayPageLimits = m_ShowPageLimitsOpt->GetValue();
70 
71  PAGE_INFO pageInfo( gerberPageSizeList[ m_PageSize->GetSelection() ] );
72  m_Parent->SetPageSettings( pageInfo );
73 
75 
76  return true;
77 }
78 
void SetPageSettings(const PAGE_INFO &aPageSettings) override
const GBR_DISPLAY_OPTIONS & GetDisplayOptions() const
const wxString & GetType() const
Definition: page_info.h:98
This file contains miscellaneous commonly used macros and functions.
void UpdateDisplayOptions(const GBR_DISPLAY_OPTIONS &aOptions)
Updates the display options and refreshes the view as needed.
PAGE_INFO describes the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:54
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Definition: macros.h:121
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)