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 The 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 <pgm_base.h>
24#include <gerbview_settings.h>
27
28
30 PANEL_GERBVIEW_DISPLAY_OPTIONS_BASE( aParent, wxID_ANY )
31{
32 GERBVIEW_SETTINGS* cfg = GetAppSettings<GERBVIEW_SETTINGS>( "gerbview" );
33
34 m_galOptsPanel = new GAL_OPTIONS_PANEL( this, cfg );
35 m_galOptionsSizer->Add( m_galOptsPanel, 0, wxEXPAND|wxRIGHT, 15 );
36}
37
38
40{
41 // Show Option Draw polygons
43
44 // Show Option Draw Lines. We use DisplayPcbTrackFill as Lines draw option
49
50 if( aCfg->m_Appearance.page_type == wxT( "A4" ) )
51 m_pageSizeA4->SetValue( true );
52 else if( aCfg->m_Appearance.page_type == wxT( "A3" ) )
53 m_pageSizeA3->SetValue( true );
54 else if( aCfg->m_Appearance.page_type == wxT( "A2" ) )
55 m_pageSizeA2->SetValue( true );
56 else if( aCfg->m_Appearance.page_type == wxT( "A" ) )
57 m_pageSizeA->SetValue( true );
58 else if( aCfg->m_Appearance.page_type == wxT( "B" ) )
59 m_pageSizeB->SetValue( true );
60 else if( aCfg->m_Appearance.page_type == wxT( "C" ) )
61 m_pageSizeC->SetValue( true );
62 else
63 m_pageSizeFull->SetValue( true );
64
66}
67
68
70{
72
73 loadSettings( GetAppSettings<GERBVIEW_SETTINGS>( "gerbview" ) );
74
75 return true;
76}
77
78
80{
82
83 if( GERBVIEW_SETTINGS* cfg = GetAppSettings<GERBVIEW_SETTINGS>( "gerbview" ) )
84 {
85 cfg->m_Display.m_DisplayLinesFill = !m_OptDisplayLines->GetValue();
86 cfg->m_Display.m_DisplayFlashedItemsFill = !m_OptDisplayFlashedItems->GetValue();
87 cfg->m_Display.m_DisplayPolygonsFill = !m_OptDisplayPolygons->GetValue();
88 cfg->m_Appearance.show_dcodes = m_OptDisplayDCodes->GetValue();
89
90 // clang-format off
91 if( m_pageSizeA4->GetValue() ) cfg->m_Appearance.page_type = wxT( "A4" );
92 else if( m_pageSizeA3->GetValue() ) cfg->m_Appearance.page_type = wxT( "A3" );
93 else if( m_pageSizeA2->GetValue() ) cfg->m_Appearance.page_type = wxT( "A2" );
94 else if( m_pageSizeA->GetValue() ) cfg->m_Appearance.page_type = wxT( "A" );
95 else if( m_pageSizeB->GetValue() ) cfg->m_Appearance.page_type = wxT( "B" );
96 else if( m_pageSizeC->GetValue() ) cfg->m_Appearance.page_type = wxT( "C" );
97 else cfg->m_Appearance.page_type = wxT( "GERBER" );
98 // clang-format on
99
100 cfg->m_Display.m_DisplayPageLimits = m_ShowPageLimitsOpt->GetValue();
101 cfg->m_Display.m_OpacityModeAlphaValue = m_spOpacityCtrl->GetValue();
102 }
103
104 return true;
105}
106
107
109{
111 cfg.Load(); // Loading without a file will init to defaults
112
113 loadSettings( &cfg );
114
115 m_galOptsPanel->ResetPanel( &cfg );
116}
117
118
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)
see class PGM_BASE