-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathlibmngr_dlgoptions.cpp
131 lines (101 loc) · 4.63 KB
/
libmngr_dlgoptions.cpp
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/*
* Librarian for KiCad, a free EDA CAD application.
* The dialog for the user-interface settings.
*
* Copyright (C) 2013-2017 CompuPhase
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* $Id: libmngr_dlgoptions.cpp 5686 2017-05-24 13:56:46Z thiadmer $
*/
#include "librarymanager.h"
#include "libmngr_dlgoptions.h"
#include <wx/fileconf.h>
libmngrDlgOptions::libmngrDlgOptions( wxWindow* parent )
:
DlgOptions( parent )
{
wxFileConfig *config = new wxFileConfig(APP_NAME, VENDOR_NAME, theApp->GetINIPath());
long idx;
idx = config->Read(wxT("display/fontsize"), 8L);
m_spinFontSize->SetValue(idx);
idx = config->Read(wxT("display/dimoffset"), 50L);
m_spinDimOffset->SetValue(idx);
wxColour clrFootprintMode;
config->Read(wxT("display/footprintbkgnd"), &clrFootprintMode, wxColour(0, 0, 0));
m_colourFootprint->SetColour(clrFootprintMode);
wxColour clrSchematicMode;
config->Read(wxT("display/schematicbkgnd"), &clrSchematicMode, wxColour(255, 255, 255));
m_colourSchematic->SetColour(clrSchematicMode);
wxColour clr3DModelMode;
config->Read(wxT("display/3dmodelbkgnd"), &clr3DModelMode, wxColour(0, 64, 0));
m_colour3DModel->SetColour(clr3DModelMode);
bool showlabels;
config->Read(wxT("display/showlabels"), &showlabels, true);
m_chkDrawLabels->SetValue(showlabels);
bool centrecross;
config->Read(wxT("display/centrecross"), ¢recross, true);
m_chkDrawCentreCross->SetValue(centrecross);
bool fullpaths;
config->Read(wxT("display/fullpath"), &fullpaths, false);
m_chkFullPaths->SetValue(fullpaths);
bool copyvrml;
config->Read(wxT("settings/copyvrml"), ©vrml, true);
m_chkCopyVRML->SetValue(copyvrml);
bool disabletemplate;
config->Read(wxT("settings/disabletemplate"), &disabletemplate, false);
m_chkDisableTemplates->SetValue(disabletemplate);
bool confirmoverwrite;
config->Read(wxT("settings/confirmoverwrite"), &confirmoverwrite, true);
m_chkConfirmOverwrite->SetValue(confirmoverwrite);
bool confirmdelete;
config->Read(wxT("settings/confirmdelete"), &confirmdelete, true);
m_chkConfirmDelete->SetValue(confirmdelete);
bool reloadsession;
config->Read(wxT("settings/reloadsession"), &reloadsession, true);
m_chkReloadSession->SetValue(reloadsession);
delete config;
}
void libmngrDlgOptions::OnOK( wxCommandEvent& event )
{
wxFileConfig *config = new wxFileConfig(APP_NAME, VENDOR_NAME, theApp->GetINIPath());
int idx;
idx = m_spinFontSize->GetValue();
config->Write(wxT("display/fontsize"), idx);
idx = m_spinDimOffset->GetValue();
config->Write(wxT("display/dimoffset"), idx);
wxColour clrFootprintMode = m_colourFootprint->GetColour();
config->Write(wxT("display/footprintbkgnd"), clrFootprintMode);
wxColour clrSchematicMode = m_colourSchematic->GetColour();
config->Write(wxT("display/schematicbkgnd"), clrSchematicMode);
wxColour clr3DModelMode = m_colour3DModel->GetColour();
config->Write(wxT("display/3dmodelbkgnd"), clr3DModelMode);
bool showlabels = m_chkDrawLabels->GetValue();
config->Write(wxT("display/showlabels"), showlabels);
bool centrecross = m_chkDrawCentreCross->GetValue();
config->Write(wxT("display/centrecross"), centrecross);
bool fullpaths = m_chkFullPaths->GetValue();
config->Write(wxT("display/fullpath"), fullpaths);
bool copyvrml = m_chkCopyVRML->GetValue();
config->Write(wxT("settings/copyvrml"), copyvrml);
bool disabletemplate = m_chkDisableTemplates->GetValue();
config->Write(wxT("settings/disabletemplate"), disabletemplate);
bool confirmoverwrite = m_chkConfirmOverwrite->GetValue();
config->Write(wxT("settings/confirmoverwrite"), confirmoverwrite);
bool confirmdelete = m_chkConfirmDelete->GetValue();
config->Write(wxT("settings/confirmdelete"), confirmdelete);
bool reloadsession = m_chkReloadSession->GetValue();
config->Write(wxT("settings/reloadsession"), reloadsession);
delete config;
event.Skip();
}