| 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 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 | #ifndef mainfrm_h |
|---|
| 25 | #define mainfrm_h |
|---|
| 26 | |
|---|
| 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> |
|---|
| 33 | |
|---|
| 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 "vector3.h" |
|---|
| 41 | #include "aven.h" |
|---|
| 42 | //#include "prefsdlg.h" |
|---|
| 43 | |
|---|
| 44 | #include <list> |
|---|
| 45 | #include <vector> |
|---|
| 46 | |
|---|
| 47 | using namespace std; |
|---|
| 48 | |
|---|
| 49 | #include <math.h> |
|---|
| 50 | #include <time.h> |
|---|
| 51 | |
|---|
| 52 | #define MARK_FIRST 1 |
|---|
| 53 | #define MARK_NEXT 2 |
|---|
| 54 | #define MARK_PREV 3 |
|---|
| 55 | |
|---|
| 56 | enum { |
|---|
| 57 | menu_FILE_LOG = 1000, |
|---|
| 58 | menu_FILE_PAGE_SETUP, |
|---|
| 59 | menu_FILE_SCREENSHOT, |
|---|
| 60 | menu_FILE_EXPORT, |
|---|
| 61 | menu_PRES_NEW, |
|---|
| 62 | menu_PRES_OPEN, |
|---|
| 63 | menu_PRES_SAVE, |
|---|
| 64 | menu_PRES_SAVE_AS, |
|---|
| 65 | menu_PRES_MARK, |
|---|
| 66 | menu_PRES_EXPORT_MOVIE, |
|---|
| 67 | menu_PRES_FREWIND, |
|---|
| 68 | menu_PRES_REWIND, |
|---|
| 69 | menu_PRES_REVERSE, |
|---|
| 70 | menu_PRES_PLAY, |
|---|
| 71 | menu_PRES_FF, |
|---|
| 72 | menu_PRES_FFF, |
|---|
| 73 | menu_PRES_PAUSE, |
|---|
| 74 | menu_ROTATION_START, |
|---|
| 75 | menu_ROTATION_STOP, |
|---|
| 76 | menu_ROTATION_TOGGLE, |
|---|
| 77 | menu_ROTATION_SPEED_UP, |
|---|
| 78 | menu_ROTATION_SLOW_DOWN, |
|---|
| 79 | menu_ROTATION_REVERSE, |
|---|
| 80 | menu_ROTATION_STEP_CCW, |
|---|
| 81 | menu_ROTATION_STEP_CW, |
|---|
| 82 | menu_ORIENT_MOVE_NORTH, |
|---|
| 83 | menu_ORIENT_MOVE_EAST, |
|---|
| 84 | menu_ORIENT_MOVE_SOUTH, |
|---|
| 85 | menu_ORIENT_MOVE_WEST, |
|---|
| 86 | menu_ORIENT_SHIFT_LEFT, |
|---|
| 87 | menu_ORIENT_SHIFT_RIGHT, |
|---|
| 88 | menu_ORIENT_SHIFT_UP, |
|---|
| 89 | menu_ORIENT_SHIFT_DOWN, |
|---|
| 90 | menu_ORIENT_PLAN, |
|---|
| 91 | menu_ORIENT_ELEVATION, |
|---|
| 92 | menu_ORIENT_HIGHER_VP, |
|---|
| 93 | menu_ORIENT_LOWER_VP, |
|---|
| 94 | menu_ORIENT_DEFAULTS, |
|---|
| 95 | menu_VIEW_SHOW_LEGS, |
|---|
| 96 | menu_VIEW_SPLAYS, |
|---|
| 97 | menu_SPLAYS_HIDE, |
|---|
| 98 | menu_SPLAYS_SHOW_FADED, |
|---|
| 99 | menu_SPLAYS_SHOW_NORMAL, |
|---|
| 100 | menu_VIEW_SHOW_CROSSES, |
|---|
| 101 | menu_VIEW_SHOW_NAMES, |
|---|
| 102 | menu_VIEW_SHOW_SURFACE, |
|---|
| 103 | menu_VIEW_SHOW_OVERLAPPING_NAMES, |
|---|
| 104 | menu_VIEW_SHOW_ENTRANCES, |
|---|
| 105 | menu_VIEW_SHOW_FIXED_PTS, |
|---|
| 106 | menu_VIEW_SHOW_EXPORTED_PTS, |
|---|
| 107 | menu_VIEW_STATUS_BAR, |
|---|
| 108 | menu_VIEW_GRID, |
|---|
| 109 | menu_VIEW_BOUNDING_BOX, |
|---|
| 110 | menu_VIEW_SHOW_TUBES, |
|---|
| 111 | menu_VIEW_PERSPECTIVE, |
|---|
| 112 | menu_VIEW_SMOOTH_SHADING, |
|---|
| 113 | menu_VIEW_TEXTURED, |
|---|
| 114 | menu_VIEW_FOG, |
|---|
| 115 | menu_VIEW_SMOOTH_LINES, |
|---|
| 116 | menu_VIEW_FULLSCREEN, |
|---|
| 117 | menu_VIEW_COLOUR_BY_DEPTH, |
|---|
| 118 | menu_VIEW_COLOUR_BY_DATE, |
|---|
| 119 | menu_VIEW_COLOUR_BY_ERROR, |
|---|
| 120 | menu_VIEW_COLOUR_BY_LENGTH, |
|---|
| 121 | menu_IND_COMPASS, |
|---|
| 122 | menu_IND_CLINO, |
|---|
| 123 | menu_IND_COLOUR_KEY, |
|---|
| 124 | menu_IND_SCALE_BAR, |
|---|
| 125 | menu_CTL_INDICATORS, |
|---|
| 126 | menu_CTL_SIDE_PANEL, |
|---|
| 127 | menu_CTL_METRIC, |
|---|
| 128 | menu_CTL_DEGREES, |
|---|
| 129 | menu_CTL_PERCENT, |
|---|
| 130 | menu_CTL_REVERSE, |
|---|
| 131 | menu_CTL_CANCEL_DIST_LINE, |
|---|
| 132 | textctrl_FIND, |
|---|
| 133 | button_HIDE, |
|---|
| 134 | listctrl_PRES |
|---|
| 135 | }; |
|---|
| 136 | |
|---|
| 137 | class PointInfo : public Point { |
|---|
| 138 | int date; |
|---|
| 139 | |
|---|
| 140 | public: |
|---|
| 141 | PointInfo() : Point(), date(-1) { } |
|---|
| 142 | PointInfo(const img_point & pt) : Point(pt), date(-1) { } |
|---|
| 143 | PointInfo(const img_point & pt, int date_) : Point(pt), date(date_) { } |
|---|
| 144 | PointInfo(const Point & p, int date_) : Point(p), date(date_) { } |
|---|
| 145 | int GetDate() const { return date; } |
|---|
| 146 | }; |
|---|
| 147 | |
|---|
| 148 | class XSect : public PointInfo { |
|---|
| 149 | friend class MainFrm; |
|---|
| 150 | Double l, r, u, d; |
|---|
| 151 | Double right_bearing; |
|---|
| 152 | |
|---|
| 153 | public: |
|---|
| 154 | XSect() : PointInfo(), l(0), r(0), u(0), d(0), right_bearing(0) { } |
|---|
| 155 | XSect(const Point &p, int date_, |
|---|
| 156 | Double l_, Double r_, Double u_, Double d_) |
|---|
| 157 | : PointInfo(p, date_), l(l_), r(r_), u(u_), d(d_), right_bearing(0) { } |
|---|
| 158 | Double GetL() const { return l; } |
|---|
| 159 | Double GetR() const { return r; } |
|---|
| 160 | Double GetU() const { return u; } |
|---|
| 161 | Double GetD() const { return d; } |
|---|
| 162 | Double get_right_bearing() const { return right_bearing; } |
|---|
| 163 | void set_right_bearing(Double right_bearing_) { |
|---|
| 164 | right_bearing = right_bearing_; |
|---|
| 165 | } |
|---|
| 166 | }; |
|---|
| 167 | |
|---|
| 168 | class AvenPresList; |
|---|
| 169 | |
|---|
| 170 | class traverse : public vector<PointInfo> { |
|---|
| 171 | public: |
|---|
| 172 | int n_legs; |
|---|
| 173 | bool isSplay; |
|---|
| 174 | double length; |
|---|
| 175 | double E, H, V; |
|---|
| 176 | |
|---|
| 177 | traverse() : n_legs(0), length(0), E(-1), H(-1), V(-1) { } |
|---|
| 178 | }; |
|---|
| 179 | |
|---|
| 180 | class MainFrm : public wxFrame { |
|---|
| 181 | wxFileHistory m_history; |
|---|
| 182 | int m_SashPosition; |
|---|
| 183 | bool was_showing_sidepanel_before_fullscreen; |
|---|
| 184 | list<traverse> traverses; |
|---|
| 185 | list<traverse> surface_traverses; |
|---|
| 186 | list<vector<XSect> > tubes; |
|---|
| 187 | list<LabelInfo*> m_Labels; |
|---|
| 188 | Vector3 m_Ext; |
|---|
| 189 | Double m_DepthMin, m_DepthExt; |
|---|
| 190 | int m_DateMin, m_DateExt; |
|---|
| 191 | bool complete_dateinfo; |
|---|
| 192 | GfxCore* m_Gfx; |
|---|
| 193 | wxWindow* m_Log; |
|---|
| 194 | GUIControl* m_Control; |
|---|
| 195 | int m_NumEntrances; |
|---|
| 196 | int m_NumFixedPts; |
|---|
| 197 | int m_NumExportedPts; |
|---|
| 198 | int m_NumHighlighted; |
|---|
| 199 | bool m_HasUndergroundLegs; |
|---|
| 200 | bool m_HasSplays; |
|---|
| 201 | bool m_HasSurfaceLegs; |
|---|
| 202 | bool m_HasErrorInformation; |
|---|
| 203 | wxSplitterWindow* m_Splitter; |
|---|
| 204 | AvenTreeCtrl* m_Tree; |
|---|
| 205 | wxTextCtrl* m_FindBox; |
|---|
| 206 | // wxCheckBox* m_RegexpCheckBox; |
|---|
| 207 | wxNotebook* m_Notebook; |
|---|
| 208 | AvenPresList* m_PresList; |
|---|
| 209 | wxString m_File; |
|---|
| 210 | wxString m_Title, m_cs_proj, m_DateStamp; |
|---|
| 211 | time_t m_DateStamp_numeric; |
|---|
| 212 | wxChar separator; // character separating survey levels (often '.') |
|---|
| 213 | Vector3 m_Offsets; |
|---|
| 214 | |
|---|
| 215 | // Strings for status bar reporting of distances. |
|---|
| 216 | wxString here_text, coords_text, dist_text, distfree_text; |
|---|
| 217 | |
|---|
| 218 | bool m_IsExtendedElevation; |
|---|
| 219 | bool pending_find; |
|---|
| 220 | |
|---|
| 221 | bool fullscreen_showing_menus; |
|---|
| 222 | |
|---|
| 223 | #ifdef PREFDLG |
|---|
| 224 | PrefsDlg* m_PrefsDlg; |
|---|
| 225 | #endif |
|---|
| 226 | |
|---|
| 227 | void FillTree(const wxString & root_name); |
|---|
| 228 | bool ProcessSVXFile(const wxString & file); |
|---|
| 229 | // void FixLRUD(traverse & centreline); |
|---|
| 230 | void CentreDataset(const Vector3 & vmin); |
|---|
| 231 | |
|---|
| 232 | void CreateMenuBar(); |
|---|
| 233 | void MakeToolBar(); |
|---|
| 234 | void CreateSidePanel(); |
|---|
| 235 | |
|---|
| 236 | void UpdateStatusBar(); |
|---|
| 237 | |
|---|
| 238 | public: |
|---|
| 239 | MainFrm(const wxString& title, const wxPoint& pos, const wxSize& size); |
|---|
| 240 | |
|---|
| 241 | // public for CavernLog. |
|---|
| 242 | bool LoadData(const wxString& file, const wxString& prefix); |
|---|
| 243 | void AddToFileHistory(const wxString & file); |
|---|
| 244 | |
|---|
| 245 | void InitialiseAfterLoad(const wxString & file); |
|---|
| 246 | void OnShowLog(wxCommandEvent& event); |
|---|
| 247 | |
|---|
| 248 | void OnMRUFile(wxCommandEvent& event); |
|---|
| 249 | void OpenFile(const wxString& file, const wxString& survey = wxString()); |
|---|
| 250 | |
|---|
| 251 | void OnPresNewUpdate(wxUpdateUIEvent& event); |
|---|
| 252 | void OnPresOpenUpdate(wxUpdateUIEvent& event); |
|---|
| 253 | void OnPresSaveUpdate(wxUpdateUIEvent& event); |
|---|
| 254 | void OnPresSaveAsUpdate(wxUpdateUIEvent& event); |
|---|
| 255 | void OnPresMarkUpdate(wxUpdateUIEvent& event); |
|---|
| 256 | void OnPresFRewindUpdate(wxUpdateUIEvent& event); |
|---|
| 257 | void OnPresRewindUpdate(wxUpdateUIEvent& event); |
|---|
| 258 | void OnPresReverseUpdate(wxUpdateUIEvent& event); |
|---|
| 259 | void OnPresPlayUpdate(wxUpdateUIEvent& event); |
|---|
| 260 | void OnPresFFUpdate(wxUpdateUIEvent& event); |
|---|
| 261 | void OnPresFFFUpdate(wxUpdateUIEvent& event); |
|---|
| 262 | void OnPresPauseUpdate(wxUpdateUIEvent& event); |
|---|
| 263 | void OnPresStopUpdate(wxUpdateUIEvent& event); |
|---|
| 264 | void OnPresExportMovieUpdate(wxUpdateUIEvent& event); |
|---|
| 265 | //void OnFileOpenTerrainUpdate(wxUpdateUIEvent& event); |
|---|
| 266 | |
|---|
| 267 | void DoFind(); |
|---|
| 268 | void OnFind(wxCommandEvent& event); |
|---|
| 269 | void OnIdle(wxIdleEvent& event); |
|---|
| 270 | void OnGotoFound(wxCommandEvent& event); |
|---|
| 271 | void OnHide(wxCommandEvent& event); |
|---|
| 272 | void OnHideUpdate(wxUpdateUIEvent& ui); |
|---|
| 273 | |
|---|
| 274 | void OnOpen(wxCommandEvent& event); |
|---|
| 275 | void HideLog(wxWindow * log_window); |
|---|
| 276 | void OnScreenshot(wxCommandEvent& event); |
|---|
| 277 | void OnScreenshotUpdate(wxUpdateUIEvent& event); |
|---|
| 278 | void OnFilePreferences(wxCommandEvent& event); |
|---|
| 279 | void OnFileOpenTerrain(wxCommandEvent& event); |
|---|
| 280 | void OnPrint(wxCommandEvent& event); |
|---|
| 281 | void PrintAndExit(); |
|---|
| 282 | void OnPageSetup(wxCommandEvent& event); |
|---|
| 283 | void OnPresNew(wxCommandEvent& event); |
|---|
| 284 | void OnPresOpen(wxCommandEvent& event); |
|---|
| 285 | void OnPresSave(wxCommandEvent& event); |
|---|
| 286 | void OnPresSaveAs(wxCommandEvent& event); |
|---|
| 287 | void OnPresMark(wxCommandEvent& event); |
|---|
| 288 | void OnPresFRewind(wxCommandEvent& event); |
|---|
| 289 | void OnPresRewind(wxCommandEvent& event); |
|---|
| 290 | void OnPresReverse(wxCommandEvent& event); |
|---|
| 291 | void OnPresPlay(wxCommandEvent& event); |
|---|
| 292 | void OnPresFF(wxCommandEvent& event); |
|---|
| 293 | void OnPresFFF(wxCommandEvent& event); |
|---|
| 294 | void OnPresPause(wxCommandEvent& event); |
|---|
| 295 | void OnPresStop(wxCommandEvent& event); |
|---|
| 296 | void OnPresExportMovie(wxCommandEvent& event); |
|---|
| 297 | void OnExport(wxCommandEvent& event); |
|---|
| 298 | void OnQuit(wxCommandEvent& event); |
|---|
| 299 | |
|---|
| 300 | void OnAbout(wxCommandEvent& event); |
|---|
| 301 | void OnClose(wxCloseEvent&); |
|---|
| 302 | |
|---|
| 303 | void OnSetFocus(wxFocusEvent &) { if (m_Gfx) m_Gfx->SetFocus(); } |
|---|
| 304 | |
|---|
| 305 | void OnKeyPress(wxKeyEvent &e) { |
|---|
| 306 | if (m_Gfx) { |
|---|
| 307 | m_Gfx->SetFocus(); |
|---|
| 308 | m_Gfx->OnKeyPress(e); |
|---|
| 309 | } |
|---|
| 310 | } |
|---|
| 311 | |
|---|
| 312 | void OnShowLogUpdate(wxUpdateUIEvent &ui) { ui.Enable(m_Log != NULL); } |
|---|
| 313 | void OnPrintUpdate(wxUpdateUIEvent &ui) { ui.Enable(!m_File.empty()); } |
|---|
| 314 | void OnExportUpdate(wxUpdateUIEvent &ui) { ui.Enable(!m_File.empty()); } |
|---|
| 315 | |
|---|
| 316 | // temporary bodges until event handling problem is sorted out: |
|---|
| 317 | void OnDefaultsUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnDefaultsUpdate(event); } |
|---|
| 318 | void OnPlanUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnPlanUpdate(event); } |
|---|
| 319 | void OnElevationUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnElevationUpdate(event); } |
|---|
| 320 | void OnDisplayOverlappingNamesUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnDisplayOverlappingNamesUpdate(event); } |
|---|
| 321 | void OnColourByDepthUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnColourByDepthUpdate(event); } |
|---|
| 322 | void OnColourByDateUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnColourByDateUpdate(event); } |
|---|
| 323 | void OnColourByErrorUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnColourByErrorUpdate(event); } |
|---|
| 324 | void OnColourByLengthUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnColourByLengthUpdate(event); } |
|---|
| 325 | void OnShowCrossesUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnShowCrossesUpdate(event); } |
|---|
| 326 | void OnShowEntrancesUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnShowEntrancesUpdate(event); } |
|---|
| 327 | void OnShowFixedPtsUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnShowFixedPtsUpdate(event); } |
|---|
| 328 | void OnShowExportedPtsUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnShowExportedPtsUpdate(event); } |
|---|
| 329 | void OnShowStationNamesUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnShowStationNamesUpdate(event); } |
|---|
| 330 | void OnShowSurveyLegsUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnShowSurveyLegsUpdate(event); } |
|---|
| 331 | void OnSplaysUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnSplaysUpdate(event); } |
|---|
| 332 | void OnHideSplaysUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnHideSplaysUpdate(event); } |
|---|
| 333 | void OnShowSplaysNormalUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnShowSplaysNormalUpdate(event); } |
|---|
| 334 | void OnShowSplaysFadedUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnShowSplaysFadedUpdate(event); } |
|---|
| 335 | void OnShowSurfaceUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnShowSurfaceUpdate(event); } |
|---|
| 336 | void OnMoveEastUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnMoveEastUpdate(event); } |
|---|
| 337 | void OnMoveNorthUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnMoveNorthUpdate(event); } |
|---|
| 338 | void OnMoveSouthUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnMoveSouthUpdate(event); } |
|---|
| 339 | void OnMoveWestUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnMoveWestUpdate(event); } |
|---|
| 340 | void OnToggleRotationUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnToggleRotationUpdate(event); } |
|---|
| 341 | void OnReverseControlsUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnReverseControlsUpdate(event); } |
|---|
| 342 | void OnSlowDownUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnSlowDownUpdate(event); } |
|---|
| 343 | void OnSpeedUpUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnSpeedUpUpdate(event); } |
|---|
| 344 | void OnStepOnceUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnStepOnceUpdate(event); } |
|---|
| 345 | void OnHigherViewpointUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnHigherViewpointUpdate(event); } |
|---|
| 346 | void OnLowerViewpointUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnLowerViewpointUpdate(event); } |
|---|
| 347 | void OnShiftDisplayDownUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnShiftDisplayDownUpdate(event); } |
|---|
| 348 | void OnShiftDisplayLeftUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnShiftDisplayLeftUpdate(event); } |
|---|
| 349 | void OnShiftDisplayRightUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnShiftDisplayRightUpdate(event); } |
|---|
| 350 | void OnShiftDisplayUpUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnShiftDisplayUpUpdate(event); } |
|---|
| 351 | void OnZoomInUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnZoomInUpdate(event); } |
|---|
| 352 | void OnZoomOutUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnZoomOutUpdate(event); } |
|---|
| 353 | void OnToggleScalebarUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnToggleScalebarUpdate(event); } |
|---|
| 354 | void OnToggleColourKeyUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnToggleColourKeyUpdate(event); } |
|---|
| 355 | void OnViewCompassUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnViewCompassUpdate(event); } |
|---|
| 356 | void OnViewGridUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnViewGridUpdate(event); } |
|---|
| 357 | void OnViewBoundingBoxUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnViewBoundingBoxUpdate(event); } |
|---|
| 358 | void OnViewClinoUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnViewClinoUpdate(event); } |
|---|
| 359 | void OnViewPerspectiveUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnViewPerspectiveUpdate(event); } |
|---|
| 360 | void OnViewSmoothShadingUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnViewSmoothShadingUpdate(event); } |
|---|
| 361 | void OnViewTexturedUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnViewTexturedUpdate(event); } |
|---|
| 362 | void OnViewFogUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnViewFogUpdate(event); } |
|---|
| 363 | void OnViewSmoothLinesUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnViewSmoothLinesUpdate(event); } |
|---|
| 364 | void OnViewFullScreenUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnViewFullScreenUpdate(event); } |
|---|
| 365 | void OnReverseDirectionOfRotationUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnReverseDirectionOfRotationUpdate(event); } |
|---|
| 366 | void OnCancelDistLineUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnCancelDistLineUpdate(event); } |
|---|
| 367 | void OnIndicatorsUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnIndicatorsUpdate(event); } |
|---|
| 368 | |
|---|
| 369 | void OnDefaults(wxCommandEvent&) { if (m_Control) m_Control->OnDefaults(); } |
|---|
| 370 | void OnPlan(wxCommandEvent&) { if (m_Control) m_Control->OnPlan(); } |
|---|
| 371 | void OnElevation(wxCommandEvent&) { if (m_Control) m_Control->OnElevation(); } |
|---|
| 372 | void OnDisplayOverlappingNames(wxCommandEvent&) { if (m_Control) m_Control->OnDisplayOverlappingNames(); } |
|---|
| 373 | void OnColourByDepth(wxCommandEvent&) { if (m_Control) m_Control->OnColourByDepth(); } |
|---|
| 374 | void OnColourByDate(wxCommandEvent&) { if (m_Control) m_Control->OnColourByDate(); } |
|---|
| 375 | void OnColourByError(wxCommandEvent&) { if (m_Control) m_Control->OnColourByError(); } |
|---|
| 376 | void OnColourByLength(wxCommandEvent&) { if (m_Control) m_Control->OnColourByLength(); } |
|---|
| 377 | void OnShowCrosses(wxCommandEvent&) { if (m_Control) m_Control->OnShowCrosses(); } |
|---|
| 378 | void OnShowEntrances(wxCommandEvent&) { if (m_Control) m_Control->OnShowEntrances(); } |
|---|
| 379 | void OnShowFixedPts(wxCommandEvent&) { if (m_Control) m_Control->OnShowFixedPts(); } |
|---|
| 380 | void OnShowExportedPts(wxCommandEvent&) { if (m_Control) m_Control->OnShowExportedPts(); } |
|---|
| 381 | void OnShowStationNames(wxCommandEvent&) { if (m_Control) m_Control->OnShowStationNames(); } |
|---|
| 382 | void OnShowSurveyLegs(wxCommandEvent&) { if (m_Control) m_Control->OnShowSurveyLegs(); } |
|---|
| 383 | void OnHideSplays(wxCommandEvent&) { if (m_Control) m_Control->OnHideSplays(); } |
|---|
| 384 | void OnShowSplaysNormal(wxCommandEvent&) { if (m_Control) m_Control->OnShowSplaysNormal(); } |
|---|
| 385 | void OnShowSplaysFaded(wxCommandEvent&) { if (m_Control) m_Control->OnShowSplaysFaded(); } |
|---|
| 386 | void OnShowSurface(wxCommandEvent&) { if (m_Control) m_Control->OnShowSurface(); } |
|---|
| 387 | void OnMoveEast(wxCommandEvent&) { if (m_Control) m_Control->OnMoveEast(); } |
|---|
| 388 | void OnMoveNorth(wxCommandEvent&) { if (m_Control) m_Control->OnMoveNorth(); } |
|---|
| 389 | void OnMoveSouth(wxCommandEvent&) { if (m_Control) m_Control->OnMoveSouth(); } |
|---|
| 390 | void OnMoveWest(wxCommandEvent&) { if (m_Control) m_Control->OnMoveWest(); } |
|---|
| 391 | void OnToggleRotation(wxCommandEvent&) { if (m_Control) m_Control->OnToggleRotation(); } |
|---|
| 392 | void OnReverseControls(wxCommandEvent&) { if (m_Control) m_Control->OnReverseControls(); } |
|---|
| 393 | void OnSlowDown(wxCommandEvent&) { if (m_Control) m_Control->OnSlowDown(); } |
|---|
| 394 | void OnSpeedUp(wxCommandEvent&) { if (m_Control) m_Control->OnSpeedUp(); } |
|---|
| 395 | void OnStepOnceAnticlockwise(wxCommandEvent&) { if (m_Control) m_Control->OnStepOnceAnticlockwise(); } |
|---|
| 396 | void OnStepOnceClockwise(wxCommandEvent&) { if (m_Control) m_Control->OnStepOnceClockwise(); } |
|---|
| 397 | void OnHigherViewpoint(wxCommandEvent&) { if (m_Control) m_Control->OnHigherViewpoint(); } |
|---|
| 398 | void OnLowerViewpoint(wxCommandEvent&) { if (m_Control) m_Control->OnLowerViewpoint(); } |
|---|
| 399 | void OnShiftDisplayDown(wxCommandEvent&) { if (m_Control) m_Control->OnShiftDisplayDown(); } |
|---|
| 400 | void OnShiftDisplayLeft(wxCommandEvent&) { if (m_Control) m_Control->OnShiftDisplayLeft(); } |
|---|
| 401 | void OnShiftDisplayRight(wxCommandEvent&) { if (m_Control) m_Control->OnShiftDisplayRight(); } |
|---|
| 402 | void OnShiftDisplayUp(wxCommandEvent&) { if (m_Control) m_Control->OnShiftDisplayUp(); } |
|---|
| 403 | void OnZoomIn(wxCommandEvent&) { if (m_Control) m_Control->OnZoomIn(); } |
|---|
| 404 | void OnZoomOut(wxCommandEvent&) { if (m_Control) m_Control->OnZoomOut(); } |
|---|
| 405 | void OnToggleScalebar(wxCommandEvent&) { if (m_Control) m_Control->OnToggleScalebar(); } |
|---|
| 406 | void OnToggleColourKey(wxCommandEvent&) { if (m_Control) m_Control->OnToggleColourKey(); } |
|---|
| 407 | void OnViewCompass(wxCommandEvent&) { if (m_Control) m_Control->OnViewCompass(); } |
|---|
| 408 | void OnViewClino(wxCommandEvent&) { if (m_Control) m_Control->OnViewClino(); } |
|---|
| 409 | void OnViewGrid(wxCommandEvent&) { if (m_Control) m_Control->OnViewGrid(); } |
|---|
| 410 | void OnViewBoundingBox(wxCommandEvent&) { if (m_Control) m_Control->OnViewBoundingBox(); } |
|---|
| 411 | void OnViewPerspective(wxCommandEvent&) { if (m_Control) m_Control->OnViewPerspective(); } |
|---|
| 412 | void OnViewSmoothShading(wxCommandEvent&) { if (m_Control) m_Control->OnViewSmoothShading(); } |
|---|
| 413 | void OnViewTextured(wxCommandEvent&) { if (m_Control) m_Control->OnViewTextured(); } |
|---|
| 414 | void OnViewFog(wxCommandEvent&) { if (m_Control) m_Control->OnViewFog(); } |
|---|
| 415 | void OnViewSmoothLines(wxCommandEvent&) { if (m_Control) m_Control->OnViewSmoothLines(); } |
|---|
| 416 | void OnViewFullScreen(wxCommandEvent&) { ViewFullScreen(); } |
|---|
| 417 | void ViewFullScreen(); |
|---|
| 418 | bool FullScreenModeShowingMenus() const; |
|---|
| 419 | void FullScreenModeShowMenus(bool show); |
|---|
| 420 | void OnReverseDirectionOfRotation(wxCommandEvent&) { if (m_Control) m_Control->OnReverseDirectionOfRotation(); } |
|---|
| 421 | void OnCancelDistLine(wxCommandEvent&) { if (m_Control) m_Control->OnCancelDistLine(); } |
|---|
| 422 | |
|---|
| 423 | void OnToggleMetric(wxCommandEvent&) { if (m_Control) m_Control->OnToggleMetric(); } |
|---|
| 424 | void OnToggleDegrees(wxCommandEvent&) { if (m_Control) m_Control->OnToggleDegrees(); } |
|---|
| 425 | void OnTogglePercent(wxCommandEvent&) { if (m_Control) m_Control->OnTogglePercent(); } |
|---|
| 426 | void OnToggleTubes(wxCommandEvent&) { if (m_Control) m_Control->OnToggleTubes(); } |
|---|
| 427 | |
|---|
| 428 | void OnToggleMetricUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnToggleMetricUpdate(event); } |
|---|
| 429 | void OnToggleDegreesUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnToggleDegreesUpdate(event); } |
|---|
| 430 | void OnTogglePercentUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnTogglePercentUpdate(event); } |
|---|
| 431 | void OnToggleTubesUpdate(wxUpdateUIEvent& event) { if (m_Control) m_Control->OnToggleTubesUpdate(event); } |
|---|
| 432 | |
|---|
| 433 | // end of horrible bodges |
|---|
| 434 | |
|---|
| 435 | void OnViewSidePanelUpdate(wxUpdateUIEvent& event); |
|---|
| 436 | void OnViewSidePanel(wxCommandEvent& event); |
|---|
| 437 | void ToggleSidePanel(); |
|---|
| 438 | bool ShowingSidePanel(); |
|---|
| 439 | |
|---|
| 440 | const Vector3 & GetExtent() const { return m_Ext; } |
|---|
| 441 | Double GetXExtent() const { return m_Ext.GetX(); } |
|---|
| 442 | Double GetYExtent() const { return m_Ext.GetY(); } |
|---|
| 443 | Double GetZExtent() const { return m_Ext.GetZ(); } |
|---|
| 444 | |
|---|
| 445 | Double GetDepthExtent() const { return m_DepthExt; } |
|---|
| 446 | Double GetDepthMin() const { return m_DepthMin; } |
|---|
| 447 | |
|---|
| 448 | bool HasCompleteDateInfo() const { return complete_dateinfo; } |
|---|
| 449 | int GetDateExtent() const { return m_DateExt; } |
|---|
| 450 | int GetDateMin() const { return m_DateMin; } |
|---|
| 451 | |
|---|
| 452 | void SelectTreeItem(const LabelInfo* label) { |
|---|
| 453 | if (label->tree_id.IsOk()) |
|---|
| 454 | m_Tree->SelectItem(label->tree_id); |
|---|
| 455 | else |
|---|
| 456 | m_Tree->UnselectAll(); |
|---|
| 457 | } |
|---|
| 458 | |
|---|
| 459 | void ClearTreeSelection(); |
|---|
| 460 | |
|---|
| 461 | int GetNumFixedPts() const { return m_NumFixedPts; } |
|---|
| 462 | int GetNumExportedPts() const { return m_NumExportedPts; } |
|---|
| 463 | int GetNumEntrances() const { return m_NumEntrances; } |
|---|
| 464 | int GetNumHighlightedPts() const { return m_NumHighlighted; } |
|---|
| 465 | |
|---|
| 466 | bool HasUndergroundLegs() const { return m_HasUndergroundLegs; } |
|---|
| 467 | bool HasSplays() const { return m_HasSplays; } |
|---|
| 468 | bool HasSurfaceLegs() const { return m_HasSurfaceLegs; } |
|---|
| 469 | bool HasTubes() const { return !tubes.empty(); } |
|---|
| 470 | bool HasErrorInformation() const { return m_HasErrorInformation; } |
|---|
| 471 | |
|---|
| 472 | bool IsExtendedElevation() const { return m_IsExtendedElevation; } |
|---|
| 473 | |
|---|
| 474 | void ClearCoords(); |
|---|
| 475 | void SetCoords(const Vector3 &v); |
|---|
| 476 | const LabelInfo * GetTreeSelection() const; |
|---|
| 477 | void SetCoords(Double x, Double y, const LabelInfo * there); |
|---|
| 478 | void SetAltitude(Double z, const LabelInfo * there); |
|---|
| 479 | |
|---|
| 480 | const Vector3 & GetOffset() const { return m_Offsets; } |
|---|
| 481 | |
|---|
| 482 | list<traverse>::const_iterator traverses_begin() const { |
|---|
| 483 | return traverses.begin(); |
|---|
| 484 | } |
|---|
| 485 | |
|---|
| 486 | list<traverse>::const_iterator traverses_end() const { |
|---|
| 487 | return traverses.end(); |
|---|
| 488 | } |
|---|
| 489 | |
|---|
| 490 | list<traverse>::const_iterator surface_traverses_begin() const { |
|---|
| 491 | return surface_traverses.begin(); |
|---|
| 492 | } |
|---|
| 493 | |
|---|
| 494 | list<traverse>::const_iterator surface_traverses_end() const { |
|---|
| 495 | return surface_traverses.end(); |
|---|
| 496 | } |
|---|
| 497 | |
|---|
| 498 | list<vector<XSect> >::const_iterator tubes_begin() const { |
|---|
| 499 | return tubes.begin(); |
|---|
| 500 | } |
|---|
| 501 | |
|---|
| 502 | list<vector<XSect> >::const_iterator tubes_end() const { |
|---|
| 503 | return tubes.end(); |
|---|
| 504 | } |
|---|
| 505 | |
|---|
| 506 | list<vector<XSect> >::iterator tubes_begin() { |
|---|
| 507 | return tubes.begin(); |
|---|
| 508 | } |
|---|
| 509 | |
|---|
| 510 | list<vector<XSect> >::iterator tubes_end() { |
|---|
| 511 | return tubes.end(); |
|---|
| 512 | } |
|---|
| 513 | |
|---|
| 514 | list<LabelInfo*>::const_iterator GetLabels() const { |
|---|
| 515 | return m_Labels.begin(); |
|---|
| 516 | } |
|---|
| 517 | |
|---|
| 518 | list<LabelInfo*>::const_iterator GetLabelsEnd() const { |
|---|
| 519 | return m_Labels.end(); |
|---|
| 520 | } |
|---|
| 521 | |
|---|
| 522 | list<LabelInfo*>::const_reverse_iterator GetRevLabels() const { |
|---|
| 523 | return m_Labels.rbegin(); |
|---|
| 524 | } |
|---|
| 525 | |
|---|
| 526 | list<LabelInfo*>::const_reverse_iterator GetRevLabelsEnd() const { |
|---|
| 527 | return m_Labels.rend(); |
|---|
| 528 | } |
|---|
| 529 | |
|---|
| 530 | list<LabelInfo*>::iterator GetLabelsNC() { |
|---|
| 531 | return m_Labels.begin(); |
|---|
| 532 | } |
|---|
| 533 | |
|---|
| 534 | list<LabelInfo*>::iterator GetLabelsNCEnd() { |
|---|
| 535 | return m_Labels.end(); |
|---|
| 536 | } |
|---|
| 537 | |
|---|
| 538 | void ShowInfo(const LabelInfo *here = NULL, const LabelInfo *there = NULL); |
|---|
| 539 | void DisplayTreeInfo(const wxTreeItemData* data = NULL); |
|---|
| 540 | void TreeItemSelected(const wxTreeItemData* data, bool zoom); |
|---|
| 541 | PresentationMark GetPresMark(int which); |
|---|
| 542 | |
|---|
| 543 | private: |
|---|
| 544 | DECLARE_EVENT_TABLE() |
|---|
| 545 | }; |
|---|
| 546 | |
|---|
| 547 | // Older wxGTK loses pop-up dialogs under the always-on-top, maximised window. |
|---|
| 548 | // Not sure when this got fixed, but wx 2.8.10 definitely works properly on |
|---|
| 549 | // Debian squeeze. |
|---|
| 550 | // |
|---|
| 551 | // To work around this issue, create this object on the stack, and it will |
|---|
| 552 | // temporarily un-fullscreen the window while the dialog as a workaround. |
|---|
| 553 | class AvenAllowOnTop { |
|---|
| 554 | #if defined __WXGTK__ && !wxCHECK_VERSION(2,8,10) |
|---|
| 555 | MainFrm * mainfrm; |
|---|
| 556 | public: |
|---|
| 557 | AvenAllowOnTop(MainFrm * mainfrm_) { |
|---|
| 558 | if (mainfrm_ && mainfrm_->IsFullScreen()) { |
|---|
| 559 | mainfrm = mainfrm_; |
|---|
| 560 | mainfrm->ViewFullScreen(); |
|---|
| 561 | } else { |
|---|
| 562 | mainfrm = 0; |
|---|
| 563 | } |
|---|
| 564 | } |
|---|
| 565 | ~AvenAllowOnTop() { |
|---|
| 566 | if (mainfrm) mainfrm->ViewFullScreen(); |
|---|
| 567 | } |
|---|
| 568 | #else |
|---|
| 569 | public: |
|---|
| 570 | AvenAllowOnTop(MainFrm *) { } |
|---|
| 571 | #endif |
|---|
| 572 | }; |
|---|
| 573 | |
|---|
| 574 | #endif |
|---|