File: dialog_display_options.cpp

package info (click to toggle)
kicad 5.1.9%2Bdfsg1-1%2Bdeb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 240,044 kB
  • sloc: cpp: 464,812; ansic: 58,106; python: 4,972; sh: 488; awk: 294; makefile: 269; xml: 53; perl: 10
file content (99 lines) | stat: -rw-r--r-- 3,065 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*
 * This program source code file is part of KiCad, a free EDA CAD application.
 *
 * Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, you may find one here:
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * or you may search the http://www.gnu.org website for the version 2 license,
 * or you may write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 */

#include <fctsys.h>

#include <common.h>
#include <cvpcb.h>
#include <class_drawpanel.h>
#include <display_footprints_frame.h>

#include <dialog_display_options.h>


void DISPLAY_FOOTPRINTS_FRAME::InstallOptionsDisplay( wxCommandEvent& event )
{
    DIALOG_FOOTPRINTS_DISPLAY_OPTIONS OptionWindow( this );

    OptionWindow.ShowModal();
}


DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::DIALOG_FOOTPRINTS_DISPLAY_OPTIONS( DISPLAY_FOOTPRINTS_FRAME* parent )
    : DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE( parent )
{
    m_Parent = parent;

    initDialog();
    m_sdbSizerOK->SetDefault();

    FinishDialogSettings();;
}


DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::~DIALOG_FOOTPRINTS_DISPLAY_OPTIONS( )
{
}


void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::initDialog()
{
    /* mandatory to use escape key as cancel under wxGTK. */
    SetFocus();

    auto displ_opts = (PCB_DISPLAY_OPTIONS*)m_Parent->GetDisplayOptions();

    m_EdgesDisplayOption->SetValue( not displ_opts->m_DisplayModEdgeFill );
    m_TextDisplayOption->SetValue( not displ_opts->m_DisplayModTextFill );
    m_ShowPadSketch->SetValue( not displ_opts->m_DisplayPadFill );
    m_ShowPadNum->SetValue( displ_opts->m_DisplayPadNum );

    m_autoZoomOption->SetValue( m_Parent->GetAutoZoom() );
}


void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::UpdateObjectSettings( void )
{
    auto displ_opts = (PCB_DISPLAY_OPTIONS*)m_Parent->GetDisplayOptions();

    displ_opts->m_DisplayModEdgeFill = not m_EdgesDisplayOption->GetValue();
    displ_opts->m_DisplayModTextFill = not m_TextDisplayOption->GetValue();
    displ_opts->m_DisplayPadNum  = m_ShowPadNum->GetValue();
    displ_opts->m_DisplayPadFill = not m_ShowPadSketch->GetValue();
    m_Parent->ApplyDisplaySettingsToGAL();

    m_Parent->SetAutoZoom( m_autoZoomOption->GetValue() );
}


bool DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::TransferDataFromWindow()
{
    UpdateObjectSettings();
    return true;
}


void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::OnApplyClick( wxCommandEvent& event )
{
    UpdateObjectSettings();
}