| 1 | // |
|---|
| 2 | // prefsdlg.cc |
|---|
| 3 | // |
|---|
| 4 | // Preferences dialog box. |
|---|
| 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|---|
| 22 | // |
|---|
| 23 | |
|---|
| 24 | #ifdef HAVE_CONFIG_H |
|---|
| 25 | #include <config.h> |
|---|
| 26 | #endif |
|---|
| 27 | |
|---|
| 28 | #include <wx/confbase.h> |
|---|
| 29 | |
|---|
| 30 | #include "ctlprefs.h" |
|---|
| 31 | #include "gridprefs.h" |
|---|
| 32 | #include "indicatorprefs.h" |
|---|
| 33 | #include "legprefs.h" |
|---|
| 34 | #include "prefsdlg.h" |
|---|
| 35 | #include "stnprefs.h" |
|---|
| 36 | #include "tubeprefs.h" |
|---|
| 37 | #include "unitsprefs.h" |
|---|
| 38 | #include "winprefs.h" |
|---|
| 39 | #include "mainfrm.h" |
|---|
| 40 | |
|---|
| 41 | PrefsDlg::PrefsDlg(GfxCore* parent, MainFrm* parent_win) : PanelDlg(parent_win, 1000, "Preferences") |
|---|
| 42 | { |
|---|
| 43 | CtlPrefs* ctlprefs = new CtlPrefs(this); |
|---|
| 44 | GridPrefs* gridprefs = new GridPrefs(this); |
|---|
| 45 | LegPrefs* legprefs = new LegPrefs(this); |
|---|
| 46 | StnPrefs* stnprefs = new StnPrefs(parent, this); |
|---|
| 47 | TubePrefs* tubeprefs = new TubePrefs(this); |
|---|
| 48 | UnitsPrefs* unitsprefs = new UnitsPrefs(this); |
|---|
| 49 | IndicatorPrefs* indicatorprefs = new IndicatorPrefs(this); |
|---|
| 50 | WinPrefs* winprefs = new WinPrefs(parent_win, this); |
|---|
| 51 | |
|---|
| 52 | list<PanelDlgPage*> pages; |
|---|
| 53 | pages.push_back(stnprefs); |
|---|
| 54 | pages.push_back(legprefs); |
|---|
| 55 | pages.push_back(tubeprefs); |
|---|
| 56 | pages.push_back(indicatorprefs); |
|---|
| 57 | pages.push_back(gridprefs); |
|---|
| 58 | pages.push_back(ctlprefs); |
|---|
| 59 | pages.push_back(unitsprefs); |
|---|
| 60 | pages.push_back(winprefs); |
|---|
| 61 | |
|---|
| 62 | list<PanelDlgPage*>::iterator iter = pages.begin(); |
|---|
| 63 | while (iter != pages.end()) { |
|---|
| 64 | (*iter++)->Hide(); |
|---|
| 65 | } |
|---|
| 66 | |
|---|
| 67 | SetPages(pages); |
|---|
| 68 | } |
|---|
| 69 | |
|---|
| 70 | wxBitmap PrefsDlg::LoadPreferencesIcon(const wxString& icon) const |
|---|
| 71 | { |
|---|
| 72 | // Load an icon for use in the preferences dialog. |
|---|
| 73 | //FIXME share code with LoadIcon... |
|---|
| 74 | |
|---|
| 75 | wxString path = wmsg_cfgpth(); |
|---|
| 76 | path += wxCONFIG_PATH_SEPARATOR; |
|---|
| 77 | path += wxString("icons"); |
|---|
| 78 | path += wxCONFIG_PATH_SEPARATOR; |
|---|
| 79 | path += wxString(icon); |
|---|
| 80 | path += wxString("prefs.png"); |
|---|
| 81 | return wxBitmap(path, wxBITMAP_TYPE_PNG); |
|---|
| 82 | } |
|---|