KiCad PCB EDA Suite
dialog_modedit_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) 2017-2018 KiCad Developers, see AUTHORS.txt for contributors.
5  *
6  * This program is free software: you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License as published by the
8  * Free Software Foundation, either version 3 of the License, or (at your
9  * option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
21 
22 #include <class_drawpanel.h>
23 #include <footprint_edit_frame.h>
24 
25 #include <view/view.h>
26 
28 #include <widgets/stepped_slider.h>
29 #include <wx/checkbox.h>
30 #include <wx/sizer.h>
31 
32 
34 {
35  DIALOG_MODEDIT_DISPLAY_OPTIONS dlg( aCaller );
36 
37  int ret = dlg.ShowModal();
38 
39  return ret == wxID_OK;
40 }
41 
42 
44  DIALOG_SHIM( &aParent, wxID_ANY, _( "Display Options" ) ),
45  m_parent( aParent )
46 {
47  auto mainSizer = new wxBoxSizer( wxVERTICAL );
48  SetSizer( mainSizer );
49 
50  // install GAL options pane
52 
53  m_galOptsPanel = new GAL_OPTIONS_PANEL( this, galOptions );
54  mainSizer->Add( m_galOptsPanel, 1, wxEXPAND, 0 );
55 
56  auto btnSizer = new wxStdDialogButtonSizer();
57  mainSizer->Add( btnSizer, 0, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 5 );
58 
59  btnSizer->AddButton( new wxButton( this, wxID_OK ) );
60  btnSizer->AddButton( new wxButton( this, wxID_CANCEL ) );
61 
62  btnSizer->Realize();
63 
64  GetSizer()->SetSizeHints( this );
65  Centre();
66 }
67 
68 
70 {
71  // update GAL options
73  return true;
74 }
75 
76 
78 {
79  // update GAL options
81 
82  // refresh view
84  view->RecacheAllItems();
87 
88  return true;
89 }
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Function GetGalDisplayOptions Returns a reference to the gal rendering options used by GAL for render...
Definition: draw_frame.h:924
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Definition: draw_panel.cpp:338
EDA_DRAW_PANEL * GetCanvas()
Definition: draw_frame.h:359
void RecacheAllItems()
Function RecacheAllItems() Rebuilds GAL display lists.
Definition: view.cpp:1335
Class DIALOG_SHIM may sit in the inheritance tree between wxDialog and any class written by wxFormBui...
Definition: dialog_shim.h:70
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
Definition of class FOOTPRINT_EDIT_FRAME.
Auxiliary rendering target (noncached)
Definition: definitions.h:42
bool TransferDataToWindow() override
Load the panel controls from the given opt.
void MarkTargetDirty(int aTarget)
Function MarkTargetDirty() Sets or clears target &#39;dirty&#39; flag.
Definition: view.h:577
static bool Invoke(FOOTPRINT_EDIT_FRAME &aCaller)
DIALOG_MODEDIT_DISPLAY_OPTIONS(FOOTPRINT_EDIT_FRAME &aParent)
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:903
Class VIEW.
Definition: view.h:58
bool TransferDataFromWindow() override
Read the options set in the UI into the given options object.