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