KiCad PCB EDA Suite
modeditoptions.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) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
6  * Copyright (C) 2015 Wayne Stambaugh <stambaughw@verizon.net>
7  * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
8 *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; either version 2
12  * of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, you may find one here:
21  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22  * or you may search the http://www.gnu.org website for the version 2 license,
23  * or you may write to the Free Software Foundation, Inc.,
24  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25  */
26 
32 #include <fctsys.h>
33 #include <class_drawpanel.h>
34 
35 #include <pcbnew.h>
36 #include <wxPcbStruct.h>
37 #include <module_editor_frame.h>
40 
41 #include <pcbnew_id.h>
42 
43 
44 void FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
45 {
46  int id = event.GetId();
48  bool state = m_optionsToolBar->GetToolToggled( id );
49 
50  switch( id )
51  {
53  displ_opts->m_DisplayPadFill = !state;
54  m_canvas->Refresh( );
55  break;
56 
58  displ_opts->m_DisplayViaFill = !state;
59  m_canvas->Refresh( );
60  break;
61 
63  displ_opts->m_DisplayModTextFill = state ? SKETCH : FILLED;
64  m_canvas->Refresh( );
65  break;
66 
68  displ_opts->m_DisplayModEdgeFill = state ? SKETCH : FILLED;
69  m_canvas->Refresh( );
70  break;
71 
73  displ_opts->m_ContrastModeDisplay = state;
74  m_canvas->Refresh( );
75  break;
76 
77  default:
78  wxMessageBox( wxT( "FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar error" ) );
79  break;
80  }
81 }
82 
83 
85 {
88 
89  // Update everything
90  m_configSettings.clear(); // boost::ptr_vector destroys the pointers inside
91 
92  // Display options:
93  m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorUnits" ),
94  (int*)&g_UserUnit, MILLIMETRES ) );
95  m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorDisplayPolarCoords" ),
96  &displ_opts->m_DisplayPolarCood, false ) );
97  m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorPadDisplayMode" ),
98  &displ_opts->m_DisplayPadFill, true ) );
99  m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorGraphicLinesDisplayMode" ),
100  &displ_opts->m_DisplayModEdgeFill, FILLED ) );
101  m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorTextsDisplayMode" ),
102  &displ_opts->m_DisplayModTextFill, FILLED ) );
103  m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorTextsDisplayMode" ),
104  &displ_opts->m_DisplayModTextFill, FILLED ) );
105  m_configSettings.push_back( new PARAM_CFG_WXSTRING( true, wxT( "FpEditorTextsRefDefaultText" ),
106  &settings.m_RefDefaultText, wxT( "REF**" ) ) );
107 
108  // design settings
109  m_configSettings.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorGrlineWidth" ),
110  &settings.m_ModuleSegmentWidth,
111  Millimeter2iu( DEFAULT_GR_MODULE_THICKNESS ),
112  Millimeter2iu( 0.01 ), Millimeter2iu( 100.0 ),
113  NULL, 1/IU_PER_MM ) );
114  m_configSettings.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorTextsDefaultSizeH" ),
115  &settings.m_ModuleTextSize.x,
116  Millimeter2iu( DEFAULT_TEXT_MODULE_SIZE ),
117  Millimeter2iu( 0.01 ), Millimeter2iu( 100.0 ),
118  NULL, 1/IU_PER_MM ) );
119  m_configSettings.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorTextsDefaultSizeV" ),
120  &settings.m_ModuleTextSize.y,
121  Millimeter2iu( DEFAULT_TEXT_MODULE_SIZE ),
122  Millimeter2iu(0.01), Millimeter2iu( 100.0 ),
123  NULL, 1/IU_PER_MM ) );
124  m_configSettings.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorTextsDefaultThickness" ),
125  &settings.m_ModuleTextWidth,
126  Millimeter2iu( DEFAULT_GR_MODULE_THICKNESS ),
127  Millimeter2iu( 0.01 ), Millimeter2iu( 20.0 ),
128  NULL, 1/IU_PER_MM ) );
129 
130  m_configSettings.push_back( new PARAM_CFG_WXSTRING( true,
131  wxT( "FpEditorRefDefaultText" ),
132  &settings.m_RefDefaultText, wxT( "REF**" ) ) );
133  m_configSettings.push_back( new PARAM_CFG_BOOL( true,
134  wxT( "FpEditorRefDefaultVisibility" ),
135  &settings.m_RefDefaultVisibility, true ) );
136  m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorRefDefaultLayer" ),
137  &settings.m_RefDefaultlayer,
138  int( F_SilkS ), int( F_SilkS ), int( F_Fab ) ) );
139 
140  m_configSettings.push_back( new PARAM_CFG_WXSTRING( true, wxT( "FpEditorValueDefaultText" ),
141  &settings.m_ValueDefaultText, wxT( "" ) ) );
142  m_configSettings.push_back( new PARAM_CFG_BOOL( true,
143  wxT( "FpEditorValueDefaultVisibility" ),
144  &settings.m_ValueDefaultVisibility, true ) );
145  m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorValueDefaultLayer" ),
146  &settings.m_ValueDefaultlayer,
147  int( F_Fab ), int( F_SilkS ), int( F_Fab ) ) );
148 
149  return m_configSettings;
150 }
151 
wxString m_RefDefaultText
Default ref text on fp creation.
A list of parameters type.
Definition of class FOOTPRINT_EDIT_FRAME.
bool m_ValueDefaultVisibility
Default value text visibility on fp creation.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const override
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame...
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Definition: draw_panel.cpp:326
int m_ModuleTextWidth
Default footprint texts thickness.
int m_ModuleSegmentWidth
Default width for all graphic lines.
bool m_DisplayModEdgeFill
Definition: pcbstruct.h:69
int m_ValueDefaultlayer
Default value text layer on fp creation.
bool m_DisplayPolarCood
Definition: pcbstruct.h:76
wxSize m_ModuleTextSize
Default footprint texts size.
Configuration parameter - Integer Class with unit conversion.
void * GetDisplayOptions() override
Function GetDisplayOptions returns the display options current in use Display options are relative to...
#define DEFAULT_TEXT_MODULE_SIZE
wxAuiToolBar * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:125
#define DEFAULT_GR_MODULE_THICKNESS
void OnSelectOptionToolbar(wxCommandEvent &event)
Configuration parameter - Integer Class.
bool m_ContrastModeDisplay
Definition: pcbstruct.h:85
PARAM_CFG_ARRAY m_configSettings
List of footprint editor configuration settings.
Configuration parameter - Boolean Class.
wxString m_ValueDefaultText
Default value text on fp creation.
Configuration parameter - wxString Class.
Class DISPLAY_OPTIONS handles display options like enable/disable some optional drawings.
Definition: pcbstruct.h:62
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
bool m_DisplayPadFill
Definition: pcbstruct.h:65
Board layer functions and definitions.
PARAM_CFG_ARRAY & GetConfigurationSettings()
Function GetConfigurationSettings returns the footpr�int editor settings list.
int m_RefDefaultlayer
Default ref text layer on fp creation.
bool m_DisplayViaFill
Definition: pcbstruct.h:66
bool m_RefDefaultVisibility
Default ref text visibility on fp creation.
bool m_DisplayModTextFill
Definition: pcbstruct.h:70
Class BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.