KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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-2023 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{
47 GERBVIEW_SETTINGS* cfg = mgr.GetAppSettings<GERBVIEW_SETTINGS>( "gerbview" );
48
49 m_galOptsPanel = new GAL_OPTIONS_PANEL( this, cfg );
50 m_galOptionsSizer->Add( m_galOptsPanel, 0, wxEXPAND|wxRIGHT, 15 );
51}
52
53
55{
56 // Show Option Draw polygons
58
59 // Show Option Draw Lines. We use DisplayPcbTrackFill as Lines draw option
64
65 for( unsigned i = 0; i < arrayDim( gerberPageSizeList ); ++i )
66 {
68 {
69 m_PageSize->SetSelection( i );
70 break;
71 }
72 }
73
75}
76
77
79{
81
83 GERBVIEW_SETTINGS* cfg = mgr.GetAppSettings<GERBVIEW_SETTINGS>( "gerbview" );
84
85 loadSettings( cfg );
86
87 return true;
88}
89
90
92{
94 GERBVIEW_SETTINGS* cfg = mgr.GetAppSettings<GERBVIEW_SETTINGS>( "gerbview" );
95
97
102
103 cfg->m_Appearance.page_type = gerberPageSizeList[ m_PageSize->GetSelection() ];
106
107 return true;
108}
109
110
112{
114 cfg.Load(); // Loading without a file will init to defaults
115
116 loadSettings( &cfg );
117
118 m_galOptsPanel->ResetPanel( &cfg );
119}
120
121
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)
double m_OpacityModeAlphaValue
the alpha channel (opacity) value in opacity forced mode
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)
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition: pgm_base.h:142
T * GetAppSettings(const wxString &aFilename)
Returns a handle to the a given settings by type If the settings have already been loaded,...
static const wxChar * gerberPageSizeList[]
List of page sizes.
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: pgm_base.cpp:1060
see class PGM_BASE