Move Model class to its own file
[survex.git] / src / mainfrm.h
blobc5b6e2c0a193575942100e4c6779dde22f8f94a4
1 //
2 // mainfrm.h
3 //
4 // Main frame handling for Aven.
5 //
6 // Copyright (C) 2000-2003,2005 Mark R. Shinwell
7 // Copyright (C) 2001-2003,2004,2005,2006,2010,2011,2012,2013,2014,2015,2016 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.
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.
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
24 #ifndef mainfrm_h
25 #define mainfrm_h
27 #include "wx.h"
28 #include <wx/docview.h> // for m_FileHistory
29 #include <wx/listctrl.h>
30 #include <wx/notebook.h>
31 #include <wx/print.h>
32 #include <wx/printdlg.h>
34 #include "aventreectrl.h"
35 #include "gfxcore.h"
36 #include "guicontrol.h"
37 #include "img_hosted.h"
38 #include "labelinfo.h"
39 #include "message.h"
40 #include "model.h"
41 #include "vector3.h"
42 #include "aven.h"
43 //#include "prefsdlg.h"
45 #include <list>
46 #include <vector>
48 using namespace std;
50 #include <math.h>
51 #include <time.h>
53 #ifdef __WXMAC__
54 // Currently on OS X, we force use of a generic toolbar, which needs to be put
55 // in a sizer.
56 # define USING_GENERIC_TOOLBAR
57 #endif
59 #define MARK_FIRST 1
60 #define MARK_NEXT 2
61 #define MARK_PREV 3
63 enum {
64 menu_FILE_LOG = 1000,
65 menu_FILE_OPEN_TERRAIN,
66 menu_FILE_PAGE_SETUP,
67 menu_FILE_SCREENSHOT,
68 menu_FILE_EXPORT,
69 menu_FILE_EXTEND,
70 menu_PRES_NEW,
71 menu_PRES_OPEN,
72 menu_PRES_SAVE,
73 menu_PRES_SAVE_AS,
74 menu_PRES_MARK,
75 menu_PRES_EXPORT_MOVIE,
76 menu_PRES_FREWIND,
77 menu_PRES_REWIND,
78 menu_PRES_REVERSE,
79 menu_PRES_PLAY,
80 menu_PRES_FF,
81 menu_PRES_FFF,
82 menu_PRES_PAUSE,
83 menu_ROTATION_START,
84 menu_ROTATION_STOP,
85 menu_ROTATION_TOGGLE,
86 menu_ROTATION_REVERSE,
87 menu_ORIENT_MOVE_NORTH,
88 menu_ORIENT_MOVE_EAST,
89 menu_ORIENT_MOVE_SOUTH,
90 menu_ORIENT_MOVE_WEST,
91 menu_ORIENT_PLAN,
92 menu_ORIENT_ELEVATION,
93 menu_ORIENT_DEFAULTS,
94 menu_VIEW_SHOW_LEGS,
95 menu_VIEW_SPLAYS,
96 menu_SPLAYS_HIDE,
97 menu_SPLAYS_SHOW_DASHED,
98 menu_SPLAYS_SHOW_FADED,
99 menu_SPLAYS_SHOW_NORMAL,
100 menu_VIEW_DUPES,
101 menu_DUPES_HIDE,
102 menu_DUPES_SHOW_DASHED,
103 menu_DUPES_SHOW_FADED,
104 menu_DUPES_SHOW_NORMAL,
105 menu_VIEW_SHOW_CROSSES,
106 menu_VIEW_SHOW_NAMES,
107 menu_VIEW_SHOW_SURFACE,
108 menu_VIEW_SHOW_OVERLAPPING_NAMES,
109 menu_VIEW_SHOW_ENTRANCES,
110 menu_VIEW_SHOW_FIXED_PTS,
111 menu_VIEW_SHOW_EXPORTED_PTS,
112 menu_VIEW_STATUS_BAR,
113 menu_VIEW_GRID,
114 menu_VIEW_BOUNDING_BOX,
115 menu_VIEW_TERRAIN,
116 menu_VIEW_SHOW_TUBES,
117 menu_VIEW_PERSPECTIVE,
118 menu_VIEW_SMOOTH_SHADING,
119 menu_VIEW_TEXTURED,
120 menu_VIEW_FOG,
121 menu_VIEW_SMOOTH_LINES,
122 menu_VIEW_FULLSCREEN,
123 menu_VIEW_COLOUR_BY,
124 menu_COLOUR_BY_DEPTH,
125 menu_COLOUR_BY_DATE,
126 menu_COLOUR_BY_ERROR,
127 menu_COLOUR_BY_GRADIENT,
128 menu_COLOUR_BY_LENGTH,
129 menu_IND_COMPASS,
130 menu_IND_CLINO,
131 menu_IND_COLOUR_KEY,
132 menu_IND_SCALE_BAR,
133 menu_CTL_INDICATORS,
134 menu_CTL_SIDE_PANEL,
135 menu_CTL_METRIC,
136 menu_CTL_DEGREES,
137 menu_CTL_PERCENT,
138 menu_CTL_REVERSE,
139 menu_CTL_CANCEL_DIST_LINE,
140 menu_SURVEY_RESTRICT,
141 menu_SURVEY_SHOW_ALL,
142 textctrl_FIND,
143 button_HIDE,
144 listctrl_PRES
147 class AvenPresList;
149 class MainFrm : public wxFrame, public Model {
150 wxFileHistory m_history;
151 int m_SashPosition;
152 bool was_showing_sidepanel_before_fullscreen;
153 GfxCore* m_Gfx;
154 wxWindow* m_Log;
155 GUIControl* m_Control;
156 wxSplitterWindow* m_Splitter;
157 AvenTreeCtrl* m_Tree;
158 wxTextCtrl* m_FindBox;
159 // wxCheckBox* m_RegexpCheckBox;
160 wxNotebook* m_Notebook;
161 AvenPresList* m_PresList;
162 wxString m_File;
163 // Processed version of data - same as m_File if m_File is processed data.
164 wxString m_FileProcessed;
165 wxString m_Survey;
167 // Strings for status bar reporting of distances.
168 wxString here_text, coords_text, dist_text, distfree_text;
170 int m_NumHighlighted = 0;
171 bool pending_find;
173 bool fullscreen_showing_menus;
175 #ifdef PREFDLG
176 PrefsDlg* m_PrefsDlg;
177 #endif
179 void FillTree(const wxString & root_name);
180 bool ProcessSVXFile(const wxString & file);
181 // void FixLRUD(traverse & centreline);
183 void CreateMenuBar();
184 void MakeToolBar();
185 void CreateSidePanel();
187 void UpdateStatusBar();
189 #ifdef USING_GENERIC_TOOLBAR
190 wxToolBar * GetToolBar() const {
191 wxSizer * sizer = GetSizer();
192 if (!sizer) return NULL;
193 return (wxToolBar*)sizer->GetItem(size_t(0))->GetWindow();
195 #endif
197 public:
198 MainFrm(const wxString& title, const wxPoint& pos, const wxSize& size);
200 // public for CavernLog.
201 bool LoadData(const wxString& file, const wxString& prefix);
202 void AddToFileHistory(const wxString & file);
204 void InitialiseAfterLoad(const wxString & file, const wxString & prefix);
205 void OnShowLog(wxCommandEvent& event);
207 void OnMRUFile(wxCommandEvent& event);
208 void OpenFile(const wxString& file, const wxString& survey = wxString());
210 void OnPresNewUpdate(wxUpdateUIEvent& event);
211 void OnPresOpenUpdate(wxUpdateUIEvent& event);
212 void OnPresSaveUpdate(wxUpdateUIEvent& event);
213 void OnPresSaveAsUpdate(wxUpdateUIEvent& event);
214 void OnPresMarkUpdate(wxUpdateUIEvent& event);
215 void OnPresFRewindUpdate(wxUpdateUIEvent& event);
216 void OnPresRewindUpdate(wxUpdateUIEvent& event);
217 void OnPresReverseUpdate(wxUpdateUIEvent& event);
218 void OnPresPlayUpdate(wxUpdateUIEvent& event);
219 void OnPresFFUpdate(wxUpdateUIEvent& event);
220 void OnPresFFFUpdate(wxUpdateUIEvent& event);
221 void OnPresPauseUpdate(wxUpdateUIEvent& event);
222 void OnPresStopUpdate(wxUpdateUIEvent& event);
223 void OnPresExportMovieUpdate(wxUpdateUIEvent& event);
224 void OnOpenTerrainUpdate(wxUpdateUIEvent& event);
226 void DoFind();
227 void OnFind(wxCommandEvent& event);
228 void OnIdle(wxIdleEvent& event);
229 void OnGotoFound(wxCommandEvent& event);
230 void OnHide(wxCommandEvent& event);
231 void OnHideUpdate(wxUpdateUIEvent& ui);
233 void OnOpen(wxCommandEvent& event);
234 void OnOpenTerrain(wxCommandEvent&);
235 void HideLog(wxWindow * log_window);
236 void OnScreenshot(wxCommandEvent& event);
237 void OnScreenshotUpdate(wxUpdateUIEvent& event);
238 void OnFilePreferences(wxCommandEvent& event);
239 void OnPrint(wxCommandEvent& event);
240 void PrintAndExit();
241 void OnPageSetup(wxCommandEvent& event);
242 void OnPresNew(wxCommandEvent& event);
243 void OnPresOpen(wxCommandEvent& event);
244 void OnPresSave(wxCommandEvent& event);
245 void OnPresSaveAs(wxCommandEvent& event);
246 void OnPresMark(wxCommandEvent& event);
247 void OnPresFRewind(wxCommandEvent& event);
248 void OnPresRewind(wxCommandEvent& event);
249 void OnPresReverse(wxCommandEvent& event);
250 void OnPresPlay(wxCommandEvent& event);
251 void OnPresFF(wxCommandEvent& event);
252 void OnPresFFF(wxCommandEvent& event);
253 void OnPresPause(wxCommandEvent& event);
254 void OnPresStop(wxCommandEvent& event);
255 void OnPresExportMovie(wxCommandEvent& event);
256 void OnExport(wxCommandEvent& event);
257 void OnExtend(wxCommandEvent& event);
258 void OnQuit(wxCommandEvent& event);
260 void OnAbout(wxCommandEvent& event);
261 void OnClose(wxCloseEvent&);
263 void OnSetFocus(wxFocusEvent &) { if (m_Gfx) m_Gfx->SetFocus(); }
265 void OnKeyPress(wxKeyEvent &e) {
266 if (m_Gfx) {
267 m_Gfx->SetFocus();
268 m_Gfx->OnKeyPress(e);
272 void OnShowLogUpdate(wxUpdateUIEvent &ui) {
273 ui.Enable(m_Log != NULL || (m_Splitter->GetWindow1() != m_Gfx && m_Splitter->GetWindow2() != m_Gfx));
274 ui.Check(m_Log == NULL);
276 void OnPrintUpdate(wxUpdateUIEvent &ui) { ui.Enable(!m_File.empty()); }
277 void OnExportUpdate(wxUpdateUIEvent &ui) { ui.Enable(!m_File.empty()); }
278 void OnExtendUpdate(wxUpdateUIEvent &ui) {
279 ui.Enable(!IsExtendedElevation());
282 // temporary bodges until event handling problem is sorted out:
283 void OnDefaultsUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnDefaultsUpdate(event); }
284 void OnPlanUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnPlanUpdate(event); }
285 void OnElevationUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnElevationUpdate(event); }
286 void OnDisplayOverlappingNamesUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnDisplayOverlappingNamesUpdate(event); }
287 void OnColourByUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnColourByUpdate(event); }
288 void OnColourByDepthUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnColourByDepthUpdate(event); }
289 void OnColourByDateUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnColourByDateUpdate(event); }
290 void OnColourByErrorUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnColourByErrorUpdate(event); }
291 void OnColourByGradientUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnColourByGradientUpdate(event); }
292 void OnColourByLengthUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnColourByLengthUpdate(event); }
293 void OnShowCrossesUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnShowCrossesUpdate(event); }
294 void OnShowEntrancesUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnShowEntrancesUpdate(event); }
295 void OnShowFixedPtsUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnShowFixedPtsUpdate(event); }
296 void OnShowExportedPtsUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnShowExportedPtsUpdate(event); }
297 void OnShowStationNamesUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnShowStationNamesUpdate(event); }
298 void OnShowSurveyLegsUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnShowSurveyLegsUpdate(event); }
299 void OnSplaysUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnSplaysUpdate(event); }
300 void OnHideSplaysUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnHideSplaysUpdate(event); }
301 void OnShowSplaysDashedUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnShowSplaysDashedUpdate(event); }
302 void OnShowSplaysFadedUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnShowSplaysFadedUpdate(event); }
303 void OnShowSplaysNormalUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnShowSplaysNormalUpdate(event); }
304 void OnDupesUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnDupesUpdate(event); }
305 void OnHideDupesUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnHideDupesUpdate(event); }
306 void OnShowDupesDashedUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnShowDupesDashedUpdate(event); }
307 void OnShowDupesFadedUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnShowDupesFadedUpdate(event); }
308 void OnShowDupesNormalUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnShowDupesNormalUpdate(event); }
309 void OnShowSurfaceUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnShowSurfaceUpdate(event); }
310 void OnMoveEastUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnMoveEastUpdate(event); }
311 void OnMoveNorthUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnMoveNorthUpdate(event); }
312 void OnMoveSouthUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnMoveSouthUpdate(event); }
313 void OnMoveWestUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnMoveWestUpdate(event); }
314 void OnToggleRotationUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnToggleRotationUpdate(event); }
315 void OnReverseControlsUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnReverseControlsUpdate(event); }
316 void OnToggleScalebarUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnToggleScalebarUpdate(event); }
317 void OnToggleColourKeyUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnToggleColourKeyUpdate(event); }
318 void OnViewCompassUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnViewCompassUpdate(event); }
319 void OnViewGridUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnViewGridUpdate(event); }
320 void OnViewBoundingBoxUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnViewBoundingBoxUpdate(event); }
321 void OnViewTerrainUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnViewTerrainUpdate(event); }
322 void OnViewClinoUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnViewClinoUpdate(event); }
323 void OnViewPerspectiveUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnViewPerspectiveUpdate(event); }
324 void OnViewSmoothShadingUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnViewSmoothShadingUpdate(event); }
325 void OnViewTexturedUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnViewTexturedUpdate(event); }
326 void OnViewFogUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnViewFogUpdate(event); }
327 void OnViewSmoothLinesUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnViewSmoothLinesUpdate(event); }
328 void OnViewFullScreenUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnViewFullScreenUpdate(event); }
329 void OnReverseDirectionOfRotationUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnReverseDirectionOfRotationUpdate(event); }
330 void OnCancelDistLineUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnCancelDistLineUpdate(event); }
331 void OnIndicatorsUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnIndicatorsUpdate(event); }
333 void OnDefaults(wxCommandEvent&) { if (m_Control) m_Control->OnDefaults(); }
334 void OnPlan(wxCommandEvent&) { if (m_Control) m_Control->OnPlan(); }
335 void OnElevation(wxCommandEvent&) { if (m_Control) m_Control->OnElevation(); }
336 void OnDisplayOverlappingNames(wxCommandEvent&) { if (m_Control) m_Control->OnDisplayOverlappingNames(); }
337 void OnColourByDepth(wxCommandEvent&) { if (m_Control) m_Control->OnColourByDepth(); }
338 void OnColourByDate(wxCommandEvent&) { if (m_Control) m_Control->OnColourByDate(); }
339 void OnColourByError(wxCommandEvent&) { if (m_Control) m_Control->OnColourByError(); }
340 void OnColourByGradient(wxCommandEvent&) { if (m_Control) m_Control->OnColourByGradient(); }
341 void OnColourByLength(wxCommandEvent&) { if (m_Control) m_Control->OnColourByLength(); }
342 void OnShowCrosses(wxCommandEvent&) { if (m_Control) m_Control->OnShowCrosses(); }
343 void OnShowEntrances(wxCommandEvent&) { if (m_Control) m_Control->OnShowEntrances(); }
344 void OnShowFixedPts(wxCommandEvent&) { if (m_Control) m_Control->OnShowFixedPts(); }
345 void OnShowExportedPts(wxCommandEvent&) { if (m_Control) m_Control->OnShowExportedPts(); }
346 void OnShowStationNames(wxCommandEvent&) { if (m_Control) m_Control->OnShowStationNames(); }
347 void OnShowSurveyLegs(wxCommandEvent&) { if (m_Control) m_Control->OnShowSurveyLegs(); }
348 void OnHideSplays(wxCommandEvent&) { if (m_Control) m_Control->OnHideSplays(); }
349 void OnShowSplaysDashed(wxCommandEvent&) { if (m_Control) m_Control->OnShowSplaysDashed(); }
350 void OnShowSplaysFaded(wxCommandEvent&) { if (m_Control) m_Control->OnShowSplaysFaded(); }
351 void OnShowSplaysNormal(wxCommandEvent&) { if (m_Control) m_Control->OnShowSplaysNormal(); }
352 void OnHideDupes(wxCommandEvent&) { if (m_Control) m_Control->OnHideDupes(); }
353 void OnShowDupesDashed(wxCommandEvent&) { if (m_Control) m_Control->OnShowDupesDashed(); }
354 void OnShowDupesFaded(wxCommandEvent&) { if (m_Control) m_Control->OnShowDupesFaded(); }
355 void OnShowDupesNormal(wxCommandEvent&) { if (m_Control) m_Control->OnShowDupesNormal(); }
356 void OnShowSurface(wxCommandEvent&) { if (m_Control) m_Control->OnShowSurface(); }
357 void OnMoveEast(wxCommandEvent&) { if (m_Control) m_Control->OnMoveEast(); }
358 void OnMoveNorth(wxCommandEvent&) { if (m_Control) m_Control->OnMoveNorth(); }
359 void OnMoveSouth(wxCommandEvent&) { if (m_Control) m_Control->OnMoveSouth(); }
360 void OnMoveWest(wxCommandEvent&) { if (m_Control) m_Control->OnMoveWest(); }
361 void OnToggleRotation(wxCommandEvent&) { if (m_Control) m_Control->OnToggleRotation(); }
362 void OnReverseControls(wxCommandEvent&) { if (m_Control) m_Control->OnReverseControls(); }
363 void OnToggleScalebar(wxCommandEvent&) { if (m_Control) m_Control->OnToggleScalebar(); }
364 void OnToggleColourKey(wxCommandEvent&) { if (m_Control) m_Control->OnToggleColourKey(); }
365 void OnViewCompass(wxCommandEvent&) { if (m_Control) m_Control->OnViewCompass(); }
366 void OnViewClino(wxCommandEvent&) { if (m_Control) m_Control->OnViewClino(); }
367 void OnViewGrid(wxCommandEvent&) { if (m_Control) m_Control->OnViewGrid(); }
368 void OnViewBoundingBox(wxCommandEvent&) { if (m_Control) m_Control->OnViewBoundingBox(); }
369 void OnViewTerrain(wxCommandEvent&) { if (m_Control) m_Control->OnViewTerrain(); }
370 void OnViewPerspective(wxCommandEvent&) { if (m_Control) m_Control->OnViewPerspective(); }
371 void OnViewSmoothShading(wxCommandEvent&) { if (m_Control) m_Control->OnViewSmoothShading(); }
372 void OnViewTextured(wxCommandEvent&) { if (m_Control) m_Control->OnViewTextured(); }
373 void OnViewFog(wxCommandEvent&) { if (m_Control) m_Control->OnViewFog(); }
374 void OnViewSmoothLines(wxCommandEvent&) { if (m_Control) m_Control->OnViewSmoothLines(); }
375 void OnViewFullScreen(wxCommandEvent&) { ViewFullScreen(); }
376 void ViewFullScreen();
377 bool FullScreenModeShowingMenus() const;
378 void FullScreenModeShowMenus(bool show);
379 void OnReverseDirectionOfRotation(wxCommandEvent&) { if (m_Control) m_Control->OnReverseDirectionOfRotation(); }
380 void OnCancelDistLine(wxCommandEvent&) { if (m_Control) m_Control->OnCancelDistLine(); }
382 void OnToggleMetric(wxCommandEvent&) { if (m_Control) m_Control->OnToggleMetric(); }
383 void OnToggleDegrees(wxCommandEvent&) { if (m_Control) m_Control->OnToggleDegrees(); }
384 void OnTogglePercent(wxCommandEvent&) { if (m_Control) m_Control->OnTogglePercent(); }
385 void OnToggleTubes(wxCommandEvent&) { if (m_Control) m_Control->OnToggleTubes(); }
387 void OnToggleMetricUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnToggleMetricUpdate(event); }
388 void OnToggleDegreesUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnToggleDegreesUpdate(event); }
389 void OnTogglePercentUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnTogglePercentUpdate(event); }
390 void OnToggleTubesUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnToggleTubesUpdate(event); }
392 // end of horrible bodges
394 void OnViewSidePanelUpdate(wxUpdateUIEvent& event);
395 void OnViewSidePanel(wxCommandEvent& event);
396 void ToggleSidePanel();
397 bool ShowingSidePanel();
399 void SelectTreeItem(const LabelInfo* label) {
400 if (label->tree_id.IsOk())
401 m_Tree->SelectItem(label->tree_id);
402 else
403 m_Tree->UnselectAll();
406 void ClearTreeSelection();
408 void ClearCoords();
409 void SetCoords(const Vector3 &v);
410 const LabelInfo * GetTreeSelection() const;
411 void SetCoords(Double x, Double y, const LabelInfo * there);
412 void SetAltitude(Double z, const LabelInfo * there);
414 void ShowInfo(const LabelInfo *here = NULL, const LabelInfo *there = NULL);
415 void DisplayTreeInfo(const wxTreeItemData* data = NULL);
416 void TreeItemSelected(const wxTreeItemData* data, bool zoom);
417 PresentationMark GetPresMark(int which);
418 bool Animating() const { return m_Gfx && m_Gfx->Animating(); }
420 // Restrict to subsurvey `survey` (or show all if `survey` empty).
421 void RestrictTo(const wxString & survey);
423 wxString GetSurvey() const { return m_Survey; }
425 int GetNumHighlightedPts() const { return m_NumHighlighted; }
427 private:
428 DECLARE_EVENT_TABLE()
431 // Older wxGTK loses pop-up dialogs under the always-on-top, maximised window.
432 // Not sure when this got fixed, but wx 2.8.10 definitely works properly on
433 // Debian squeeze.
435 // To work around this issue, create this object on the stack, and it will
436 // temporarily un-fullscreen the window while the dialog as a workaround.
437 class AvenAllowOnTop {
438 #if defined __WXGTK__ && !wxCHECK_VERSION(2,8,10)
439 MainFrm * mainfrm;
440 public:
441 explicit AvenAllowOnTop(MainFrm * mainfrm_) {
442 if (mainfrm_ && mainfrm_->IsFullScreen()) {
443 mainfrm = mainfrm_;
444 mainfrm->ViewFullScreen();
445 } else {
446 mainfrm = 0;
449 ~AvenAllowOnTop() {
450 if (mainfrm) mainfrm->ViewFullScreen();
452 #else
453 public:
454 AvenAllowOnTop(MainFrm *) { }
455 #endif
458 #endif