1 | // |
---|
2 | // stnprefs.cc |
---|
3 | // |
---|
4 | // Preferences page for stations. |
---|
5 | // |
---|
6 | // Copyright (C) 2002 Mark R. Shinwell |
---|
7 | // Copyright (C) 2004 Olly Betts |
---|
8 | // |
---|
9 | // This program is free software; you can redistribute it and/or modify |
---|
10 | // it under the terms of the GNU General Public License as published by |
---|
11 | // the Free Software Foundation; either version 2 of the License, or |
---|
12 | // (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, write to the Free Software |
---|
21 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
22 | // |
---|
23 | |
---|
24 | #ifdef HAVE_CONFIG_H |
---|
25 | #include <config.h> |
---|
26 | #endif |
---|
27 | |
---|
28 | #include "stnprefs.h" |
---|
29 | #include "message.h" |
---|
30 | #include "gfxcore.h" |
---|
31 | |
---|
32 | #include <wx/statline.h> |
---|
33 | |
---|
34 | static const wxWindowID ID_STN_PREFS = 1001; |
---|
35 | static const wxWindowID ID_STN_CROSSES = 2000; |
---|
36 | static const wxWindowID ID_STN_HI_ENTS = 2001; |
---|
37 | static const wxWindowID ID_STN_HI_FIXED = 2002; |
---|
38 | static const wxWindowID ID_STN_HI_XPTS = 2003; |
---|
39 | static const wxWindowID ID_STN_NAMES = 2004; |
---|
40 | static const wxWindowID ID_STN_OVERLAPPING = 2005; |
---|
41 | static const wxWindowID ID_STN_LINE1 = 2006; |
---|
42 | static const wxWindowID ID_STN_LINE2 = 2006; |
---|
43 | |
---|
44 | BEGIN_EVENT_TABLE(StnPrefs, PanelDlgPage) |
---|
45 | EVT_CHECKBOX(ID_STN_CROSSES, StnPrefs::OnShowCrosses) |
---|
46 | EVT_CHECKBOX(ID_STN_HI_ENTS, StnPrefs::OnHighlightEntrances) |
---|
47 | EVT_CHECKBOX(ID_STN_HI_FIXED, StnPrefs::OnHighlightFixedPts) |
---|
48 | EVT_CHECKBOX(ID_STN_HI_XPTS, StnPrefs::OnHighlightExportedPts) |
---|
49 | EVT_CHECKBOX(ID_STN_NAMES, StnPrefs::OnNames) |
---|
50 | EVT_CHECKBOX(ID_STN_OVERLAPPING, StnPrefs::OnOverlappingNames) |
---|
51 | |
---|
52 | EVT_UPDATE_UI(ID_STN_CROSSES, StnPrefs::OnShowCrossesUpdate) |
---|
53 | EVT_UPDATE_UI(ID_STN_HI_ENTS, StnPrefs::OnHighlightEntrancesUpdate) |
---|
54 | EVT_UPDATE_UI(ID_STN_HI_FIXED, StnPrefs::OnHighlightFixedPtsUpdate) |
---|
55 | EVT_UPDATE_UI(ID_STN_HI_XPTS, StnPrefs::OnHighlightExportedPtsUpdate) |
---|
56 | EVT_UPDATE_UI(ID_STN_NAMES, StnPrefs::OnNamesUpdate) |
---|
57 | EVT_UPDATE_UI(ID_STN_OVERLAPPING, StnPrefs::OnOverlappingNamesUpdate) |
---|
58 | END_EVENT_TABLE() |
---|
59 | |
---|
60 | StnPrefs::StnPrefs(GfxCore* parent, wxWindow* parent_win) : PanelDlgPage(parent_win, ID_STN_PREFS), m_Parent(parent) |
---|
61 | { |
---|
62 | wxCheckBox* show_crosses = new wxCheckBox(this, ID_STN_CROSSES, msg(/*Mark survey stations with crosses*/350)); |
---|
63 | wxCheckBox* hi_ents = new wxCheckBox(this, ID_STN_HI_ENTS, msg(/*Highlight stations marked as entrances*/351)); |
---|
64 | wxCheckBox* hi_fixed = new wxCheckBox(this, ID_STN_HI_FIXED, |
---|
65 | msg(/*Highlight stations marked as fixed points*/352)); |
---|
66 | wxCheckBox* hi_xpts = new wxCheckBox(this, ID_STN_HI_XPTS, msg(/*Highlight stations which are exported*/353)); |
---|
67 | wxCheckBox* names = new wxCheckBox(this, ID_STN_NAMES, msg(/*Mark survey stations with their names*/354)); |
---|
68 | wxCheckBox* overlapping = new wxCheckBox(this, ID_STN_OVERLAPPING, |
---|
69 | msg(/*Allow names to overlap on the display (faster)*/355)); |
---|
70 | |
---|
71 | wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); |
---|
72 | |
---|
73 | sizer->Add(show_crosses, 0 /* not vertically stretchable */, wxALIGN_TOP | wxBOTTOM, 0); |
---|
74 | sizer->Add(10, 8); |
---|
75 | sizer->Add(new wxStaticLine(this, ID_STN_LINE1), 0, wxEXPAND | wxRIGHT, 16); |
---|
76 | sizer->Add(10, 8); |
---|
77 | sizer->Add(hi_ents, 0, wxALIGN_TOP | wxBOTTOM, 4); |
---|
78 | sizer->Add(hi_fixed, 0, wxALIGN_TOP | wxBOTTOM, 4); |
---|
79 | sizer->Add(hi_xpts, 0, wxALIGN_TOP | wxBOTTOM, 0); |
---|
80 | sizer->Add(10, 8); |
---|
81 | sizer->Add(new wxStaticLine(this, ID_STN_LINE2), 0, wxEXPAND | wxRIGHT, 16); |
---|
82 | sizer->Add(10, 8); |
---|
83 | sizer->Add(names, 0, wxALIGN_TOP | wxBOTTOM, 4); |
---|
84 | sizer->Add(overlapping, 0, wxALIGN_TOP | wxLEFT, 32); |
---|
85 | |
---|
86 | SetAutoLayout(true); |
---|
87 | SetSizer(sizer); |
---|
88 | } |
---|
89 | |
---|
90 | StnPrefs::~StnPrefs() |
---|
91 | { |
---|
92 | |
---|
93 | } |
---|
94 | |
---|
95 | void StnPrefs::OnShowCrosses(wxCommandEvent&) |
---|
96 | { |
---|
97 | m_Parent->ToggleCrosses(); |
---|
98 | } |
---|
99 | |
---|
100 | void StnPrefs::OnHighlightEntrances(wxCommandEvent&) |
---|
101 | { |
---|
102 | m_Parent->ToggleEntrances(); |
---|
103 | } |
---|
104 | |
---|
105 | void StnPrefs::OnHighlightFixedPts(wxCommandEvent&) |
---|
106 | { |
---|
107 | m_Parent->ToggleFixedPts(); |
---|
108 | } |
---|
109 | |
---|
110 | void StnPrefs::OnHighlightExportedPts(wxCommandEvent&) |
---|
111 | { |
---|
112 | m_Parent->ToggleExportedPts(); |
---|
113 | } |
---|
114 | |
---|
115 | void StnPrefs::OnNames(wxCommandEvent&) |
---|
116 | { |
---|
117 | m_Parent->ToggleStationNames(); |
---|
118 | } |
---|
119 | |
---|
120 | void StnPrefs::OnOverlappingNames(wxCommandEvent&) |
---|
121 | { |
---|
122 | m_Parent->ToggleOverlappingNames(); |
---|
123 | } |
---|
124 | |
---|
125 | void StnPrefs::OnShowCrossesUpdate(wxUpdateUIEvent& ui) |
---|
126 | { |
---|
127 | ui.Check(m_Parent->ShowingCrosses()); |
---|
128 | } |
---|
129 | |
---|
130 | void StnPrefs::OnHighlightEntrancesUpdate(wxUpdateUIEvent& ui) |
---|
131 | { |
---|
132 | ui.Check(m_Parent->ShowingEntrances()); |
---|
133 | } |
---|
134 | |
---|
135 | void StnPrefs::OnHighlightFixedPtsUpdate(wxUpdateUIEvent& ui) |
---|
136 | { |
---|
137 | ui.Check(m_Parent->ShowingFixedPts()); |
---|
138 | } |
---|
139 | |
---|
140 | void StnPrefs::OnHighlightExportedPtsUpdate(wxUpdateUIEvent& ui) |
---|
141 | { |
---|
142 | ui.Check(m_Parent->ShowingExportedPts()); |
---|
143 | } |
---|
144 | |
---|
145 | void StnPrefs::OnNamesUpdate(wxUpdateUIEvent& ui) |
---|
146 | { |
---|
147 | ui.Check(m_Parent->ShowingStationNames()); |
---|
148 | } |
---|
149 | |
---|
150 | void StnPrefs::OnOverlappingNamesUpdate(wxUpdateUIEvent& ui) |
---|
151 | { |
---|
152 | ui.Check(m_Parent->ShowingOverlappingNames()); |
---|
153 | } |
---|
154 | |
---|
155 | const wxString StnPrefs::GetName() |
---|
156 | { |
---|
157 | return "Stations"; |
---|
158 | } |
---|
159 | |
---|
160 | const wxBitmap StnPrefs::GetIcon() |
---|
161 | { |
---|
162 | return GetParent()->LoadPreferencesIcon("stations"); |
---|
163 | } |
---|
164 | |
---|