KiCad PCB EDA Suite
panel_gerbview_display_options.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-2021 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 <vector>
22#include <core/arraydim.h>
23#include <pgm_base.h>
25#include <gerbview_settings.h>
28
29
31static const wxChar* gerberPageSizeList[] =
32{
33 wxT( "GERBER" ), // index 0: full size page selection
34 wxT( "A4" ),
35 wxT( "A3" ),
36 wxT( "A2" ),
37 wxT( "A" ),
38 wxT( "B" ),
39 wxT( "C" ),
40};
41
42
44 PANEL_GERBVIEW_DISPLAY_OPTIONS_BASE( aParent, wxID_ANY )
45{
46 GERBVIEW_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<GERBVIEW_SETTINGS>();
47
48 m_galOptsPanel = new GAL_OPTIONS_PANEL( this, cfg );
49 m_galOptionsSizer->Add( m_galOptsPanel, 0, wxEXPAND | wxLEFT, 5 );
50}
51
52
54{
55 // Show Option Draw polygons
57
58 // Show Option Draw Lines. We use DisplayPcbTrackFill as Lines draw option
62
63 for( unsigned i = 0; i < arrayDim( gerberPageSizeList ); ++i )
64 {
66 {
67 m_PageSize->SetSelection( i );
68 break;
69 }
70 }
71
73}
74
75
77{
79
80 GERBVIEW_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<GERBVIEW_SETTINGS>();
81
82 loadSettings( cfg );
83
84 return true;
85}
86
87
89{
90 GERBVIEW_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<GERBVIEW_SETTINGS>();
91
93
98
99 cfg->m_Appearance.page_type = gerberPageSizeList[ m_PageSize->GetSelection() ];
101
102 return true;
103}
104
105
107{
109 cfg.Load(); // Loading without a file will init to defaults
110
111 loadSettings( &cfg );
112
113 m_galOptsPanel->ResetPanel( &cfg );
114}
115
116
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
Definition: arraydim.h:31
bool ResetPanel(APP_SETTINGS_BASE *aAppSettings)
bool TransferDataToWindow() override
Load the panel controls from the given opt.
bool TransferDataFromWindow() override
Read the options set in the UI into the given options object.
bool m_DisplayFlashedItemsFill
Option to draw flashed items (filled/sketch)
bool m_DisplayPolygonsFill
Option to draw polygons (filled/sketch)
bool m_DisplayLinesFill
Option to draw line items (filled/sketch)
GBR_DISPLAY_OPTIONS m_Display
virtual void Load()
Updates the parameters of this object based on the current JSON document contents.
Class PANEL_GERBVIEW_DISPLAY_OPTIONS_BASE.
void ResetPanel() override
Reset the contents of this panel.
void loadSettings(GERBVIEW_SETTINGS *aCfg)
static const wxChar * gerberPageSizeList[]
List of page sizes.
see class PGM_BASE
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:111