| 1 | // | 
|---|
| 2 | //  unitsprefs.cc | 
|---|
| 3 | // | 
|---|
| 4 | //  Preferences page for measurement unit options. | 
|---|
| 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 |  | 
|---|
| 23 | #ifdef HAVE_CONFIG_H | 
|---|
| 24 | #include <config.h> | 
|---|
| 25 | #endif | 
|---|
| 26 |  | 
|---|
| 27 | #include "unitsprefs.h" | 
|---|
| 28 | #include "message.h" | 
|---|
| 29 |  | 
|---|
| 30 | #include <wx/statline.h> | 
|---|
| 31 |  | 
|---|
| 32 | static const wxWindowID ID_UNITS_PREFS = 5005; | 
|---|
| 33 | static const wxWindowID ID_UNITS_METRIC = 2000; | 
|---|
| 34 | static const wxWindowID ID_UNITS_IMPERIAL = 2001; | 
|---|
| 35 | static const wxWindowID ID_UNITS_DEGREES = 2002; | 
|---|
| 36 | static const wxWindowID ID_UNITS_GRADS = 2003; | 
|---|
| 37 | static const wxWindowID ID_UNITS_LINE1 = 2004; | 
|---|
| 38 | static const wxWindowID ID_UNITS_LABEL1 = 2005; | 
|---|
| 39 | static const wxWindowID ID_UNITS_LABEL2 = 2006; | 
|---|
| 40 |  | 
|---|
| 41 | UnitsPrefs::UnitsPrefs(wxWindow* parent) : PanelDlgPage(parent, ID_UNITS_PREFS) | 
|---|
| 42 | { | 
|---|
| 43 |     wxRadioButton* metric = new wxRadioButton(this, ID_UNITS_METRIC, msg(/*metric units*/362), | 
|---|
| 44 |                                               wxDefaultPosition, wxDefaultSize, wxRB_GROUP); | 
|---|
| 45 |     wxRadioButton* imperial = new wxRadioButton(this, ID_UNITS_IMPERIAL, msg(/*imperial units*/363)); | 
|---|
| 46 |     wxRadioButton* degrees = new wxRadioButton(this, ID_UNITS_DEGREES, msg(/*degrees*/364), | 
|---|
| 47 |                                                wxDefaultPosition, wxDefaultSize, wxRB_GROUP); | 
|---|
| 48 |     wxRadioButton* grads = new wxRadioButton(this, ID_UNITS_GRADS, msg(/*grads*/365)); | 
|---|
| 49 |  | 
|---|
| 50 |     wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); | 
|---|
| 51 |  | 
|---|
| 52 |     sizer->Add(new wxStaticText(this, ID_UNITS_LABEL1, msg(/*Display measurements in*/366)), | 
|---|
| 53 |                0 /* not vertically stretchable */, wxALIGN_TOP | wxBOTTOM, 4); | 
|---|
| 54 |     sizer->Add(metric, 0, wxALIGN_TOP | wxLEFT, 32); | 
|---|
| 55 |     sizer->Add(10, 4); | 
|---|
| 56 |     sizer->Add(imperial, 0, wxALIGN_TOP | wxLEFT, 32); | 
|---|
| 57 |     sizer->Add(10, 8); | 
|---|
| 58 |     sizer->Add(new wxStaticLine(this, ID_UNITS_LINE1), 0, wxEXPAND | wxRIGHT, 16); | 
|---|
| 59 |     sizer->Add(10, 8); | 
|---|
| 60 |     sizer->Add(new wxStaticText(this, ID_UNITS_LABEL2, msg(/*Display angles in*/367)), | 
|---|
| 61 |                0 /* not vertically stretchable */, wxALIGN_TOP | wxBOTTOM, 4); | 
|---|
| 62 |     sizer->Add(degrees, 0, wxALIGN_TOP | wxLEFT, 32); | 
|---|
| 63 |     sizer->Add(10, 4); | 
|---|
| 64 |     sizer->Add(grads, 0, wxALIGN_TOP | wxLEFT, 32); | 
|---|
| 65 |  | 
|---|
| 66 |     SetAutoLayout(true); | 
|---|
| 67 |     SetSizer(sizer); | 
|---|
| 68 | } | 
|---|
| 69 |  | 
|---|
| 70 | UnitsPrefs::~UnitsPrefs() | 
|---|
| 71 | { | 
|---|
| 72 |  | 
|---|
| 73 | } | 
|---|
| 74 |  | 
|---|
| 75 | const wxString UnitsPrefs::GetName() | 
|---|
| 76 | { | 
|---|
| 77 |     return "Units"; | 
|---|
| 78 | } | 
|---|
| 79 |  | 
|---|
| 80 | const wxBitmap UnitsPrefs::GetIcon() | 
|---|
| 81 | { | 
|---|
| 82 |     return wxGetApp().LoadPreferencesIcon("units"); | 
|---|
| 83 | } | 
|---|
| 84 |  | 
|---|