source: git/src/guicontrol.cc @ a0d24c4

RELEASE/1.2debug-cidebug-ci-sanitisersfaster-cavernlogwalls-datawalls-data-hanging-as-warning
Last change on this file since a0d24c4 was 36f0d86, checked in by Olly Betts <olly@…>, 4 years ago

[aven] Support colouring by survey style

  • Property mode set to 100644
File size: 33.5 KB
Line 
1//
2//  guicontrol.cc
3//
4//  Handlers for events relating to the display of a survey.
5//
6//  Copyright (C) 2000-2002,2005 Mark R. Shinwell
7//  Copyright (C) 2001,2003,2004,2005,2006,2011,2012,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.
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 "guicontrol.h"
29#include "gfxcore.h"
30#include <wx/confbase.h>
31
32const int DISPLAY_SHIFT = 10;
33const double FLYFREE_SHIFT = 0.2;
34const double ROTATE_STEP = 2.0;
35
36GUIControl::GUIControl()
37    : dragging(NO_DRAG)
38{
39    m_View = NULL;
40    m_ReverseControls = false;
41    m_LastDrag = drag_NONE;
42}
43
44void GUIControl::SetView(GfxCore* view)
45{
46    m_View = view;
47}
48
49bool GUIControl::MouseDown() const
50{
51    return (dragging != NO_DRAG);
52}
53
54void GUIControl::HandleTilt(wxPoint point)
55{
56    // Handle a mouse movement during tilt mode.
57
58    // wxGTK (at least) fails to update the cursor while dragging.
59    m_View->UpdateCursor(GfxCore::CURSOR_ROTATE_VERTICALLY);
60
61    int dy = point.y - m_DragStart.y;
62
63    if (m_ReverseControls != m_View->GetPerspective()) dy = -dy;
64
65    m_View->TiltCave(Double(dy) * 0.36);
66
67    m_DragStart = point;
68
69    m_View->ForceRefresh();
70}
71
72void GUIControl::HandleTranslate(wxPoint point)
73{
74    // Handle a mouse movement during translation mode.
75
76    // wxGTK (at least) fails to update the cursor while dragging.
77    m_View->UpdateCursor(GfxCore::CURSOR_DRAGGING_HAND);
78
79    int dx = point.x - m_DragStart.x;
80    int dy = point.y - m_DragStart.y;
81
82    if (m_ReverseControls) {
83        dx = -dx;
84        dy = -dy;
85    }
86
87    if (m_View->GetPerspective())
88        m_View->MoveViewer(0, -dy * .1, dx * .1);
89    else
90        m_View->TranslateCave(dx, dy);
91
92    m_DragStart = point;
93}
94
95void GUIControl::HandleScaleRotate(wxPoint point)
96{
97    // Handle a mouse movement during scale/rotate mode.
98
99    // wxGTK (at least) fails to update the cursor while dragging.
100    m_View->UpdateCursor(GfxCore::CURSOR_ZOOM_ROTATE);
101
102    int dx, dy;
103    int threshold;
104    if (m_ScaleRotateLock == lock_NONE) {
105        // Dragging to scale or rotate but we've not decided which yet.
106        dx = point.x - m_DragRealStart.x;
107        dy = point.y - m_DragRealStart.y;
108        threshold = 8 * 8;
109    } else {
110        dx = point.x - m_DragStart.x;
111        dy = point.y - m_DragStart.y;
112        threshold = 5;
113    }
114    int dx2 = dx * dx;
115    int dy2 = dy * dy;
116    if (dx2 + dy2 < threshold) return;
117
118    switch (m_ScaleRotateLock) {
119        case lock_NONE:
120            if (dx2 > dy2) {
121                m_ScaleRotateLock = lock_ROTATE;
122//              m_View->UpdateCursor(GfxCore::CURSOR_ROTATE_HORIZONTALLY);
123            } else {
124                m_ScaleRotateLock = lock_SCALE;
125//              m_View->UpdateCursor(GfxCore::CURSOR_ZOOM);
126            }
127            break;
128        case lock_SCALE:
129            if (dx2 >= 8 * dy2) {
130                m_ScaleRotateLock = lock_ROTATE;
131//              m_View->UpdateCursor(GfxCore::CURSOR_ROTATE_HORIZONTALLY);
132            }
133            break;
134        case lock_ROTATE:
135            if (dy2 >= 8 * dx2) {
136                m_ScaleRotateLock = lock_SCALE;
137//              m_View->UpdateCursor(GfxCore::CURSOR_ZOOM);
138            }
139            break;
140    }
141
142    if (m_ScaleRotateLock == lock_ROTATE) {
143        dy = 0;
144    } else {
145        dx = 0;
146    }
147
148    if (m_ReverseControls) {
149        dx = -dx;
150        dy = -dy;
151    }
152
153    if (m_View->GetPerspective()) {
154        if (dy) m_View->MoveViewer(-dy * .1, 0, 0);
155    } else {
156        // up/down => scale.
157        if (dy) m_View->SetScale(m_View->GetScale() * pow(1.06, 0.08 * dy));
158        // left/right => rotate.
159        if (dx) m_View->TurnCave(Double(dx) * -0.36);
160        if (dx || dy) m_View->ForceRefresh();
161    }
162
163    m_DragStart = point;
164}
165
166void GUIControl::HandleTiltRotate(wxPoint point)
167{
168    // Handle a mouse movement during tilt/rotate mode.
169    if (m_View->IsExtendedElevation()) return;
170
171    // wxGTK (at least) fails to update the cursor while dragging.
172    m_View->UpdateCursor(GfxCore::CURSOR_ROTATE_EITHER_WAY);
173
174    int dx = point.x - m_DragStart.x;
175    int dy = point.y - m_DragStart.y;
176
177    if (m_ReverseControls != m_View->GetPerspective()) {
178        dx = -dx;
179        dy = -dy;
180    }
181
182    // left/right => rotate, up/down => tilt.
183    // Make tilt less sensitive than rotate as that feels better.
184    m_View->TurnCave(Double(dx) * -0.36);
185    m_View->TiltCave(Double(dy) * 0.18);
186
187    m_View->ForceRefresh();
188
189    m_DragStart = point;
190}
191
192void GUIControl::HandleRotate(wxPoint point)
193{
194    // Handle a mouse movement during rotate mode.
195    if (m_View->IsExtendedElevation()) return;
196
197    // wxGTK (at least) fails to update the cursor while dragging.
198    m_View->UpdateCursor(GfxCore::CURSOR_ROTATE_HORIZONTALLY);
199
200    int dx = point.x - m_DragStart.x;
201    int dy = point.y - m_DragStart.y;
202
203    if (m_ReverseControls != m_View->GetPerspective()) {
204        dx = -dx;
205        dy = -dy;
206    }
207
208    // left/right => rotate.
209    m_View->TurnCave(Double(dx) * -0.36);
210
211    m_View->ForceRefresh();
212
213    m_DragStart = point;
214}
215
216void GUIControl::RestoreCursor()
217{
218    if (m_View->HereIsReal()) {
219        m_View->UpdateCursor(GfxCore::CURSOR_POINTING_HAND);
220    } else {
221        m_View->UpdateCursor(GfxCore::CURSOR_DEFAULT);
222    }
223}
224
225void GUIControl::HandleNonDrag(const wxPoint & point) {
226    if (m_View->IsFullScreen()) {
227        if (m_View->FullScreenModeShowingMenus()) {
228            if (point.y > 8)
229                m_View->FullScreenModeShowMenus(false);
230        } else {
231            if (point.y == 0) {
232                m_View->FullScreenModeShowMenus(true);
233            }
234        }
235    }
236    if (m_View->CheckHitTestGrid(point, false)) {
237        m_View->UpdateCursor(GfxCore::CURSOR_POINTING_HAND);
238    } else if (m_View->PointWithinScaleBar(point)) {
239        m_View->UpdateCursor(GfxCore::CURSOR_HORIZONTAL_RESIZE);
240    } else if (m_View->PointWithinCompass(point)) {
241        m_View->UpdateCursor(GfxCore::CURSOR_ROTATE_HORIZONTALLY);
242    } else if (m_View->PointWithinClino(point)) {
243        m_View->UpdateCursor(GfxCore::CURSOR_ROTATE_VERTICALLY);
244    } else {
245        RestoreCursor();
246    }
247}
248
249//
250//  Mouse event handling methods
251//
252
253void GUIControl::OnMouseMove(wxMouseEvent& event)
254{
255    // Mouse motion event handler.
256    if (!m_View->HasData()) return;
257
258    // Ignore moves which don't change the position.
259    if (event.GetPosition() == m_DragStart) {
260        return;
261    }
262
263    static long timestamp = LONG_MIN;
264    if (dragging != NO_DRAG && m_ScaleRotateLock != lock_NONE &&
265        timestamp != LONG_MIN) {
266        // If no motion for a second, reset the direction lock.
267        if (event.GetTimestamp() - timestamp >= 1000) {
268            m_ScaleRotateLock = lock_NONE;
269            m_DragRealStart = m_DragStart;
270            RestoreCursor();
271        }
272    }
273    timestamp = event.GetTimestamp();
274
275    wxPoint point(event.GetPosition());
276
277    // Check hit-test grid (only if no buttons are pressed).
278    if (!event.LeftIsDown() && !event.MiddleIsDown() && !event.RightIsDown()) {
279        HandleNonDrag(point);
280    }
281
282    // Update coordinate display if in plan view,
283    // or altitude if in elevation view.
284    m_View->SetCoords(point);
285
286    switch (dragging) {
287        case LEFT_DRAG:
288            switch (m_LastDrag) {
289                case drag_COMPASS:
290                    // Drag in heading indicator.
291                    m_View->SetCompassFromPoint(point);
292                    break;
293                case drag_ELEV:
294                    // Drag in clinometer.
295                    m_View->SetClinoFromPoint(point);
296                    break;
297                case drag_SCALE:
298                    m_View->SetScaleBarFromOffset(point.x - m_DragLast.x);
299                    break;
300                case drag_MAIN:
301                    if (event.ControlDown()) {
302                        HandleTiltRotate(point);
303                    } else {
304                        HandleScaleRotate(point);
305                    }
306                    break;
307                case drag_ZOOM:
308                    m_View->SetZoomBox(m_DragStart, point, !event.ShiftDown(), event.ControlDown());
309                    break;
310                case drag_NONE:
311                    // Shouldn't happen?!  FIXME: assert or something.
312                    break;
313            }
314            break;
315        case MIDDLE_DRAG:
316            HandleTilt(point);
317            break;
318        case RIGHT_DRAG:
319            HandleTranslate(point);
320            break;
321        case NO_DRAG:
322            break;
323    }
324
325    m_DragLast = point;
326}
327
328void GUIControl::OnLButtonDown(wxMouseEvent& event)
329{
330    if (m_View->HasData()) {
331        m_DragStart = m_DragRealStart = event.GetPosition();
332
333        if (m_View->PointWithinCompass(m_DragStart)) {
334            m_LastDrag = drag_COMPASS;
335            m_View->UpdateCursor(GfxCore::CURSOR_ROTATE_HORIZONTALLY);
336        } else if (m_View->PointWithinClino(m_DragStart)) {
337            m_LastDrag = drag_ELEV;
338            m_View->UpdateCursor(GfxCore::CURSOR_ROTATE_VERTICALLY);
339        } else if (m_View->PointWithinScaleBar(m_DragStart)) {
340            m_LastDrag = drag_SCALE;
341            m_View->UpdateCursor(GfxCore::CURSOR_HORIZONTAL_RESIZE);
342        } else if (event.ShiftDown()) {
343            m_LastDrag = drag_ZOOM;
344            m_View->UpdateCursor(GfxCore::CURSOR_ZOOM);
345        } else {
346            if (event.ControlDown() && !m_View->IsExtendedElevation()) {
347                m_View->UpdateCursor(GfxCore::CURSOR_ROTATE_EITHER_WAY);
348            } else {
349                m_View->UpdateCursor(GfxCore::CURSOR_ZOOM_ROTATE);
350            }
351
352            m_LastDrag = drag_MAIN;
353            m_ScaleRotateLock = lock_NONE;
354        }
355
356        // We need to release and recapture for the cursor to update (noticed
357        // with wxGTK).
358        if (dragging != NO_DRAG) m_View->ReleaseMouse();
359        m_View->CaptureMouse();
360
361        dragging = LEFT_DRAG;
362    }
363}
364
365void GUIControl::OnLButtonUp(wxMouseEvent& event)
366{
367    if (m_View->HasData()) {
368        if (dragging != LEFT_DRAG)
369            return;
370
371        if (event.MiddleIsDown()) {
372            if (m_LastDrag == drag_ZOOM)
373                m_View->UnsetZoomBox();
374            OnMButtonDown(event);
375            return;
376        }
377
378        if (event.RightIsDown()) {
379            if (m_LastDrag == drag_ZOOM)
380                m_View->UnsetZoomBox();
381            OnRButtonDown(event);
382            return;
383        }
384
385        if (m_LastDrag == drag_ZOOM) {
386            m_View->ZoomBoxGo();
387        }
388
389        m_View->ReleaseMouse();
390
391        m_LastDrag = drag_NONE;
392        dragging = NO_DRAG;
393
394        m_View->DragFinished();
395
396        if (event.GetPosition() == m_DragRealStart) {
397            // Just a "click"...
398            m_View->CheckHitTestGrid(m_DragStart, true);
399            RestoreCursor();
400        } else {
401            HandleNonDrag(event.GetPosition());
402        }
403    }
404}
405
406void GUIControl::OnMButtonDown(wxMouseEvent& event)
407{
408    if (m_View->HasData() && !m_View->IsExtendedElevation()) {
409        m_DragStart = event.GetPosition();
410
411        m_View->UpdateCursor(GfxCore::CURSOR_ROTATE_VERTICALLY);
412
413        if (dragging != NO_DRAG) {
414            if (m_LastDrag == drag_ZOOM)
415                m_View->UnsetZoomBox();
416            // We need to release and recapture for the cursor to update
417            // (noticed with wxGTK).
418            m_View->ReleaseMouse();
419        }
420        m_View->CaptureMouse();
421        dragging = MIDDLE_DRAG;
422    }
423}
424
425void GUIControl::OnMButtonUp(wxMouseEvent& event)
426{
427    if (m_View->HasData()) {
428        if (dragging != MIDDLE_DRAG)
429            return;
430
431        if (event.LeftIsDown()) {
432            OnLButtonDown(event);
433            return;
434        }
435
436        if (event.RightIsDown()) {
437            OnRButtonDown(event);
438            return;
439        }
440
441        dragging = NO_DRAG;
442        m_View->ReleaseMouse();
443        m_View->DragFinished();
444
445        RestoreCursor();
446    }
447}
448
449void GUIControl::OnRButtonDown(wxMouseEvent& event)
450{
451    if (m_View->HasData()) {
452        if (m_View->HandleRClick(event.GetPosition()))
453            return;
454
455        m_DragStart = event.GetPosition();
456
457        m_View->UpdateCursor(GfxCore::CURSOR_DRAGGING_HAND);
458
459        if (dragging != NO_DRAG) {
460            if (m_LastDrag == drag_ZOOM)
461                m_View->UnsetZoomBox();
462            // We need to release and recapture for the cursor to update
463            // (noticed with wxGTK).
464            m_View->ReleaseMouse();
465        }
466        m_View->CaptureMouse();
467        dragging = RIGHT_DRAG;
468    }
469}
470
471void GUIControl::OnRButtonUp(wxMouseEvent& event)
472{
473    if (dragging != RIGHT_DRAG)
474        return;
475
476    if (event.LeftIsDown()) {
477        OnLButtonDown(event);
478        return;
479    }
480
481    if (event.MiddleIsDown()) {
482        OnMButtonDown(event);
483        return;
484    }
485
486    m_LastDrag = drag_NONE;
487    m_View->ReleaseMouse();
488
489    dragging = NO_DRAG;
490
491    RestoreCursor();
492
493    m_View->DragFinished();
494}
495
496void GUIControl::OnMouseWheel(wxMouseEvent& event) {
497    int dy = event.GetWheelRotation();
498    if (m_View->GetPerspective()) {
499        m_View->MoveViewer(-dy, 0, 0);
500    } else {
501        m_View->SetScale(m_View->GetScale() * pow(1.06, -0.04 * dy));
502        m_View->ForceRefresh();
503    }
504}
505
506void GUIControl::OnDisplayOverlappingNames()
507{
508    m_View->ToggleOverlappingNames();
509}
510
511void GUIControl::OnDisplayOverlappingNamesUpdate(wxUpdateUIEvent& cmd)
512{
513    cmd.Enable(m_View->HasData() && m_View->ShowingStationNames());
514    cmd.Check(m_View->ShowingOverlappingNames());
515}
516
517void GUIControl::OnColourByDepth()
518{
519    if (m_View->ColouringBy() == COLOUR_BY_DEPTH) {
520        m_View->SetColourBy(COLOUR_BY_NONE);
521    } else {
522        m_View->SetColourBy(COLOUR_BY_DEPTH);
523    }
524}
525
526void GUIControl::OnColourByDate()
527{
528    if (m_View->ColouringBy() == COLOUR_BY_DATE) {
529        m_View->SetColourBy(COLOUR_BY_NONE);
530    } else {
531        m_View->SetColourBy(COLOUR_BY_DATE);
532    }
533}
534
535void GUIControl::OnColourByError()
536{
537    if (m_View->ColouringBy() == COLOUR_BY_ERROR) {
538        m_View->SetColourBy(COLOUR_BY_NONE);
539    } else {
540        m_View->SetColourBy(COLOUR_BY_ERROR);
541    }
542}
543
544void GUIControl::OnColourByHError()
545{
546    if (m_View->ColouringBy() == COLOUR_BY_H_ERROR) {
547        m_View->SetColourBy(COLOUR_BY_NONE);
548    } else {
549        m_View->SetColourBy(COLOUR_BY_H_ERROR);
550    }
551}
552
553void GUIControl::OnColourByVError()
554{
555    if (m_View->ColouringBy() == COLOUR_BY_V_ERROR) {
556        m_View->SetColourBy(COLOUR_BY_NONE);
557    } else {
558        m_View->SetColourBy(COLOUR_BY_V_ERROR);
559    }
560}
561
562void GUIControl::OnColourByGradient()
563{
564    if (m_View->ColouringBy() == COLOUR_BY_GRADIENT) {
565        m_View->SetColourBy(COLOUR_BY_NONE);
566    } else {
567        m_View->SetColourBy(COLOUR_BY_GRADIENT);
568    }
569}
570
571void GUIControl::OnColourByLength()
572{
573    if (m_View->ColouringBy() == COLOUR_BY_LENGTH) {
574        m_View->SetColourBy(COLOUR_BY_NONE);
575    } else {
576        m_View->SetColourBy(COLOUR_BY_LENGTH);
577    }
578}
579
580void GUIControl::OnColourBySurvey()
581{
582    if (m_View->ColouringBy() == COLOUR_BY_SURVEY) {
583        m_View->SetColourBy(COLOUR_BY_NONE);
584    } else {
585        m_View->SetColourBy(COLOUR_BY_SURVEY);
586    }
587}
588
589void GUIControl::OnColourByStyle()
590{
591    if (m_View->ColouringBy() == COLOUR_BY_STYLE) {
592        m_View->SetColourBy(COLOUR_BY_NONE);
593    } else {
594        m_View->SetColourBy(COLOUR_BY_STYLE);
595    }
596}
597
598void GUIControl::OnColourByUpdate(wxUpdateUIEvent& cmd)
599{
600    cmd.Enable(m_View->HasData());
601}
602
603void GUIControl::OnColourByDepthUpdate(wxUpdateUIEvent& cmd)
604{
605    cmd.Enable(m_View->HasData());
606    cmd.Check(m_View->ColouringBy() == COLOUR_BY_DEPTH);
607}
608
609void GUIControl::OnColourByDateUpdate(wxUpdateUIEvent& cmd)
610{
611    cmd.Enable(m_View->HasData());
612    cmd.Check(m_View->ColouringBy() == COLOUR_BY_DATE);
613}
614
615void GUIControl::OnColourByErrorUpdate(wxUpdateUIEvent& cmd)
616{
617    cmd.Enable(m_View->HasData());
618    cmd.Check(m_View->ColouringBy() == COLOUR_BY_ERROR);
619}
620
621void GUIControl::OnColourByHErrorUpdate(wxUpdateUIEvent& cmd)
622{
623    cmd.Enable(m_View->HasData());
624    cmd.Check(m_View->ColouringBy() == COLOUR_BY_H_ERROR);
625}
626
627void GUIControl::OnColourByVErrorUpdate(wxUpdateUIEvent& cmd)
628{
629    cmd.Enable(m_View->HasData());
630    cmd.Check(m_View->ColouringBy() == COLOUR_BY_V_ERROR);
631}
632
633void GUIControl::OnColourByGradientUpdate(wxUpdateUIEvent& cmd)
634{
635    cmd.Enable(m_View->HasData());
636    cmd.Check(m_View->ColouringBy() == COLOUR_BY_GRADIENT);
637}
638
639void GUIControl::OnColourByLengthUpdate(wxUpdateUIEvent& cmd)
640{
641    cmd.Enable(m_View->HasData());
642    cmd.Check(m_View->ColouringBy() == COLOUR_BY_LENGTH);
643}
644
645void GUIControl::OnColourBySurveyUpdate(wxUpdateUIEvent& cmd)
646{
647    cmd.Enable(m_View->HasData());
648    cmd.Check(m_View->ColouringBy() == COLOUR_BY_SURVEY);
649}
650
651void GUIControl::OnColourByStyleUpdate(wxUpdateUIEvent& cmd)
652{
653    cmd.Enable(m_View->HasData());
654    cmd.Check(m_View->ColouringBy() == COLOUR_BY_STYLE);
655}
656
657void GUIControl::OnShowCrosses()
658{
659    m_View->ToggleCrosses();
660}
661
662void GUIControl::OnShowCrossesUpdate(wxUpdateUIEvent& cmd)
663{
664    cmd.Enable(m_View->HasData());
665    cmd.Check(m_View->ShowingCrosses());
666}
667
668void GUIControl::OnShowStationNames()
669{
670    m_View->ToggleStationNames();
671}
672
673void GUIControl::OnShowStationNamesUpdate(wxUpdateUIEvent& cmd)
674{
675    cmd.Enable(m_View->HasData());
676    cmd.Check(m_View->ShowingStationNames());
677}
678
679void GUIControl::OnShowSurveyLegs()
680{
681    m_View->ToggleUndergroundLegs();
682}
683
684void GUIControl::OnShowSurveyLegsUpdate(wxUpdateUIEvent& cmd)
685{
686    cmd.Enable(m_View->HasData() && m_View->HasUndergroundLegs());
687    cmd.Check(m_View->ShowingUndergroundLegs());
688}
689
690void GUIControl::OnHideSplays()
691{
692    m_View->SetSplaysMode(SHOW_HIDE);
693}
694
695void GUIControl::OnShowSplaysDashed()
696{
697    m_View->SetSplaysMode(SHOW_DASHED);
698}
699
700void GUIControl::OnShowSplaysFaded()
701{
702    m_View->SetSplaysMode(SHOW_FADED);
703}
704
705void GUIControl::OnShowSplaysNormal()
706{
707    m_View->SetSplaysMode(SHOW_NORMAL);
708}
709
710void GUIControl::OnSplaysUpdate(wxUpdateUIEvent& cmd)
711{
712    cmd.Enable(m_View->HasData() && m_View->HasSplays());
713}
714
715void GUIControl::OnHideSplaysUpdate(wxUpdateUIEvent& cmd)
716{
717    cmd.Enable(m_View->HasData() && m_View->HasSplays());
718    cmd.Check(m_View->ShowingSplaysMode() == SHOW_HIDE);
719}
720
721void GUIControl::OnShowSplaysDashedUpdate(wxUpdateUIEvent& cmd)
722{
723    cmd.Enable(m_View->HasData() && m_View->HasSplays());
724    cmd.Check(m_View->ShowingSplaysMode() == SHOW_DASHED);
725}
726
727void GUIControl::OnShowSplaysFadedUpdate(wxUpdateUIEvent& cmd)
728{
729    cmd.Enable(m_View->HasData() && m_View->HasSplays());
730    cmd.Check(m_View->ShowingSplaysMode() == SHOW_FADED);
731}
732
733void GUIControl::OnShowSplaysNormalUpdate(wxUpdateUIEvent& cmd)
734{
735    cmd.Enable(m_View->HasData() && m_View->HasSplays());
736    cmd.Check(m_View->ShowingSplaysMode() == SHOW_NORMAL);
737}
738
739void GUIControl::OnHideDupes() {
740    m_View->SetDupesMode(SHOW_HIDE);
741}
742
743void GUIControl::OnShowDupesDashed() {
744    m_View->SetDupesMode(SHOW_DASHED);
745}
746
747void GUIControl::OnShowDupesFaded() {
748    m_View->SetDupesMode(SHOW_FADED);
749}
750
751void GUIControl::OnShowDupesNormal() {
752    m_View->SetDupesMode(SHOW_NORMAL);
753}
754
755void GUIControl::OnDupesUpdate(wxUpdateUIEvent& cmd) {
756    cmd.Enable(m_View->HasData() && m_View->HasDupes());
757}
758
759void GUIControl::OnHideDupesUpdate(wxUpdateUIEvent& cmd) {
760    cmd.Enable(m_View->HasData() && m_View->HasDupes());
761    cmd.Check(m_View->ShowingDupesMode() == SHOW_HIDE);
762}
763
764void GUIControl::OnShowDupesDashedUpdate(wxUpdateUIEvent& cmd) {
765    cmd.Enable(m_View->HasData() && m_View->HasDupes());
766    cmd.Check(m_View->ShowingDupesMode() == SHOW_DASHED);
767}
768
769void GUIControl::OnShowDupesFadedUpdate(wxUpdateUIEvent& cmd) {
770    cmd.Enable(m_View->HasData() && m_View->HasDupes());
771    cmd.Check(m_View->ShowingDupesMode() == SHOW_FADED);
772}
773
774void GUIControl::OnShowDupesNormalUpdate(wxUpdateUIEvent& cmd) {
775    cmd.Enable(m_View->HasData() && m_View->HasDupes());
776    cmd.Check(m_View->ShowingDupesMode() == SHOW_NORMAL);
777}
778
779void GUIControl::OnMoveEast()
780{
781    m_View->TurnCaveTo(90.0);
782    m_View->ForceRefresh();
783}
784
785void GUIControl::OnMoveEastUpdate(wxUpdateUIEvent& cmd)
786{
787    cmd.Enable(m_View->HasData() && !m_View->IsExtendedElevation() && m_View->GetCompassValue() != 90.0);
788}
789
790void GUIControl::OnMoveNorth()
791{
792    m_View->TurnCaveTo(0.0);
793    m_View->ForceRefresh();
794}
795
796void GUIControl::OnMoveNorthUpdate(wxUpdateUIEvent& cmd)
797{
798    cmd.Enable(m_View->HasData() && m_View->GetCompassValue() != 0.0);
799}
800
801void GUIControl::OnMoveSouth()
802{
803    m_View->TurnCaveTo(180.0);
804    m_View->ForceRefresh();
805}
806
807void GUIControl::OnMoveSouthUpdate(wxUpdateUIEvent& cmd)
808{
809    cmd.Enable(m_View->HasData() && m_View->GetCompassValue() != 180.0);
810}
811
812void GUIControl::OnMoveWest()
813{
814    m_View->TurnCaveTo(270.0);
815    m_View->ForceRefresh();
816}
817
818void GUIControl::OnMoveWestUpdate(wxUpdateUIEvent& cmd)
819{
820    cmd.Enable(m_View->HasData() && !m_View->IsExtendedElevation() && m_View->GetCompassValue() != 270.0);
821}
822
823void GUIControl::OnToggleRotation()
824{
825    m_View->ToggleRotation();
826}
827
828void GUIControl::OnToggleRotationUpdate(wxUpdateUIEvent& cmd)
829{
830    cmd.Enable(m_View->HasData() && !m_View->IsExtendedElevation());
831    cmd.Check(m_View->HasData() && m_View->IsRotating());
832}
833
834void GUIControl::OnReverseControls()
835{
836    m_ReverseControls = !m_ReverseControls;
837}
838
839void GUIControl::OnReverseControlsUpdate(wxUpdateUIEvent& cmd)
840{
841    cmd.Enable(m_View->HasData());
842    cmd.Check(m_ReverseControls);
843}
844
845void GUIControl::OnReverseDirectionOfRotation()
846{
847    m_View->ReverseRotation();
848}
849
850void GUIControl::OnReverseDirectionOfRotationUpdate(wxUpdateUIEvent& cmd)
851{
852    cmd.Enable(m_View->HasData() && !m_View->IsExtendedElevation());
853}
854
855void GUIControl::OnStepOnceAnticlockwise(bool accel)
856{
857    if (m_View->GetPerspective()) {
858        m_View->TurnCave(accel ? -5.0 * ROTATE_STEP : -ROTATE_STEP);
859    } else {
860        m_View->TurnCave(accel ? 5.0 * ROTATE_STEP : ROTATE_STEP);
861    }
862    m_View->ForceRefresh();
863}
864
865void GUIControl::OnStepOnceClockwise(bool accel)
866{
867    if (m_View->GetPerspective()) {
868        m_View->TurnCave(accel ? 5.0 * ROTATE_STEP : ROTATE_STEP);
869    } else {
870        m_View->TurnCave(accel ? -5.0 * ROTATE_STEP : -ROTATE_STEP);
871    }
872    m_View->ForceRefresh();
873}
874
875void GUIControl::OnDefaults()
876{
877    m_View->Defaults();
878}
879
880void GUIControl::OnDefaultsUpdate(wxUpdateUIEvent& cmd)
881{
882    cmd.Enable(m_View->HasData());
883}
884
885void GUIControl::OnElevation()
886{
887    // Switch to elevation view.
888
889    m_View->SwitchToElevation();
890}
891
892void GUIControl::OnElevationUpdate(wxUpdateUIEvent& cmd)
893{
894    cmd.Enable(m_View->HasData() && !m_View->IsExtendedElevation() && !m_View->ShowingElevation());
895}
896
897void GUIControl::OnHigherViewpoint(bool accel)
898{
899    // Raise the viewpoint.
900    if (m_View->GetPerspective()) {
901        m_View->TiltCave(accel ? 5.0 * ROTATE_STEP : ROTATE_STEP);
902    } else {
903        m_View->TiltCave(accel ? -5.0 * ROTATE_STEP : -ROTATE_STEP);
904    }
905    m_View->ForceRefresh();
906}
907
908void GUIControl::OnLowerViewpoint(bool accel)
909{
910    // Lower the viewpoint.
911    if (m_View->GetPerspective()) {
912        m_View->TiltCave(accel ? -5.0 * ROTATE_STEP : -ROTATE_STEP);
913    } else {
914        m_View->TiltCave(accel ? 5.0 * ROTATE_STEP : ROTATE_STEP);
915    }
916    m_View->ForceRefresh();
917}
918
919void GUIControl::OnPlan()
920{
921    // Switch to plan view.
922    m_View->SwitchToPlan();
923}
924
925void GUIControl::OnPlanUpdate(wxUpdateUIEvent& cmd)
926{
927    cmd.Enable(m_View->HasData() && !m_View->IsExtendedElevation() && !m_View->ShowingPlan());
928}
929
930void GUIControl::OnShiftDisplayDown(bool accel)
931{
932    if (m_View->GetPerspective())
933        m_View->MoveViewer(0, accel ? 5 * FLYFREE_SHIFT : FLYFREE_SHIFT, 0);
934    else
935        m_View->TranslateCave(0, accel ? 5 * DISPLAY_SHIFT : DISPLAY_SHIFT);
936}
937
938void GUIControl::OnShiftDisplayLeft(bool accel)
939{
940    if (m_View->GetPerspective())
941        m_View->MoveViewer(0, 0, accel ? 5 * FLYFREE_SHIFT : FLYFREE_SHIFT);
942    else
943        m_View->TranslateCave(accel ? -5 * DISPLAY_SHIFT : -DISPLAY_SHIFT, 0);
944}
945
946void GUIControl::OnShiftDisplayRight(bool accel)
947{
948    if (m_View->GetPerspective())
949        m_View->MoveViewer(0, 0, accel ? -5 * FLYFREE_SHIFT : -FLYFREE_SHIFT);
950    else
951        m_View->TranslateCave(accel ? 5 * DISPLAY_SHIFT : DISPLAY_SHIFT, 0);
952}
953
954void GUIControl::OnShiftDisplayUp(bool accel)
955{
956    if (m_View->GetPerspective())
957        m_View->MoveViewer(0, accel ? -5 * FLYFREE_SHIFT : -FLYFREE_SHIFT, 0);
958    else
959        m_View->TranslateCave(0, accel ? -5 * DISPLAY_SHIFT : -DISPLAY_SHIFT);
960}
961
962void GUIControl::OnZoomIn(bool accel)
963{
964    // Increase the scale.
965
966    if (m_View->GetPerspective()) {
967        m_View->MoveViewer(accel ? 5 * FLYFREE_SHIFT : FLYFREE_SHIFT, 0, 0);
968    } else {
969        m_View->SetScale(m_View->GetScale() * (accel ? 1.1236 : 1.06));
970        m_View->ForceRefresh();
971    }
972}
973
974void GUIControl::OnZoomOut(bool accel)
975{
976    // Decrease the scale.
977
978    if (m_View->GetPerspective()) {
979        m_View->MoveViewer(accel ? -5 * FLYFREE_SHIFT : -FLYFREE_SHIFT, 0, 0);
980    } else {
981        m_View->SetScale(m_View->GetScale() / (accel ? 1.1236 : 1.06));
982        m_View->ForceRefresh();
983    }
984}
985
986void GUIControl::OnToggleScalebar()
987{
988    m_View->ToggleScaleBar();
989}
990
991void GUIControl::OnToggleScalebarUpdate(wxUpdateUIEvent& cmd)
992{
993    cmd.Enable(m_View->HasData());
994    cmd.Check(m_View->ShowingScaleBar());
995}
996
997void GUIControl::OnToggleColourKey()
998{
999    m_View->ToggleColourKey();
1000}
1001
1002void GUIControl::OnToggleColourKeyUpdate(wxUpdateUIEvent& cmd)
1003{
1004    cmd.Enable(m_View->HasData() && m_View->ColouringBy() != COLOUR_BY_NONE);
1005    cmd.Check(m_View->ShowingColourKey());
1006}
1007
1008void GUIControl::OnViewCompass()
1009{
1010    m_View->ToggleCompass();
1011}
1012
1013void GUIControl::OnViewCompassUpdate(wxUpdateUIEvent& cmd)
1014{
1015    cmd.Enable(m_View->HasData() && !m_View->IsExtendedElevation());
1016    cmd.Check(m_View->ShowingCompass());
1017}
1018
1019void GUIControl::OnViewClino()
1020{
1021    m_View->ToggleClino();
1022}
1023
1024void GUIControl::OnViewClinoUpdate(wxUpdateUIEvent& cmd)
1025{
1026    cmd.Enable(m_View->HasData() && !m_View->IsExtendedElevation());
1027    cmd.Check(m_View->ShowingClino());
1028}
1029
1030void GUIControl::OnShowSurface()
1031{
1032    m_View->ToggleSurfaceLegs();
1033}
1034
1035void GUIControl::OnShowSurfaceUpdate(wxUpdateUIEvent& cmd)
1036{
1037    cmd.Enable(m_View->HasData() && m_View->HasSurfaceLegs());
1038    cmd.Check(m_View->ShowingSurfaceLegs());
1039}
1040
1041void GUIControl::OnShowEntrances()
1042{
1043    m_View->ToggleEntrances();
1044}
1045
1046void GUIControl::OnShowEntrancesUpdate(wxUpdateUIEvent& cmd)
1047{
1048    cmd.Enable(m_View->HasData() && (m_View->GetNumEntrances() > 0));
1049    cmd.Check(m_View->ShowingEntrances());
1050}
1051
1052void GUIControl::OnShowFixedPts()
1053{
1054    m_View->ToggleFixedPts();
1055}
1056
1057void GUIControl::OnShowFixedPtsUpdate(wxUpdateUIEvent& cmd)
1058{
1059    cmd.Enable(m_View->HasData() && (m_View->GetNumFixedPts() > 0));
1060    cmd.Check(m_View->ShowingFixedPts());
1061}
1062
1063void GUIControl::OnShowExportedPts()
1064{
1065    m_View->ToggleExportedPts();
1066}
1067
1068void GUIControl::OnShowExportedPtsUpdate(wxUpdateUIEvent& cmd)
1069{
1070    cmd.Enable(m_View->HasData() && (m_View->GetNumExportedPts() > 0));
1071    cmd.Check(m_View->ShowingExportedPts());
1072}
1073
1074void GUIControl::OnViewGrid()
1075{
1076    m_View->ToggleGrid();
1077}
1078
1079void GUIControl::OnViewGridUpdate(wxUpdateUIEvent& cmd)
1080{
1081    cmd.Enable(m_View->HasData());
1082    cmd.Check(m_View->ShowingGrid());
1083}
1084
1085void GUIControl::OnIndicatorsUpdate(wxUpdateUIEvent& cmd)
1086{
1087    cmd.Enable(m_View->HasData());
1088}
1089
1090void GUIControl::OnViewPerspective()
1091{
1092    m_View->TogglePerspective();
1093    // Force update of coordinate display.
1094    if (m_View->GetPerspective()) {
1095        m_View->MoveViewer(0, 0, 0);
1096    } else {
1097        m_View->ClearCoords();
1098    }
1099}
1100
1101void GUIControl::OnViewPerspectiveUpdate(wxUpdateUIEvent& cmd)
1102{
1103    cmd.Enable(m_View->HasData() && !m_View->IsExtendedElevation());
1104    cmd.Check(m_View->GetPerspective());
1105}
1106
1107void GUIControl::OnViewSmoothShading()
1108{
1109    m_View->ToggleSmoothShading();
1110}
1111
1112void GUIControl::OnViewSmoothShadingUpdate(wxUpdateUIEvent& cmd)
1113{
1114    cmd.Enable(m_View->HasData());
1115    cmd.Check(m_View->GetSmoothShading());
1116}
1117
1118void GUIControl::OnViewTextured()
1119{
1120    m_View->ToggleTextured();
1121}
1122
1123void GUIControl::OnViewTexturedUpdate(wxUpdateUIEvent& cmd)
1124{
1125    cmd.Enable(m_View->HasData());
1126    cmd.Check(m_View->GetTextured());
1127}
1128
1129void GUIControl::OnViewFog()
1130{
1131    m_View->ToggleFog();
1132}
1133
1134void GUIControl::OnViewFogUpdate(wxUpdateUIEvent& cmd)
1135{
1136    cmd.Enable(m_View->HasData());
1137    cmd.Check(m_View->GetFog());
1138}
1139
1140void GUIControl::OnViewSmoothLines()
1141{
1142    m_View->ToggleAntiAlias();
1143}
1144
1145void GUIControl::OnViewSmoothLinesUpdate(wxUpdateUIEvent& cmd)
1146{
1147    cmd.Enable(m_View->HasData());
1148    cmd.Check(m_View->GetAntiAlias());
1149}
1150
1151void GUIControl::OnToggleMetric()
1152{
1153    m_View->ToggleMetric();
1154
1155    wxConfigBase::Get()->Write(wxT("metric"), m_View->GetMetric());
1156    wxConfigBase::Get()->Flush();
1157}
1158
1159void GUIControl::OnToggleMetricUpdate(wxUpdateUIEvent& cmd)
1160{
1161    cmd.Enable(m_View->HasData());
1162    cmd.Check(m_View->GetMetric());
1163}
1164
1165void GUIControl::OnToggleDegrees()
1166{
1167    m_View->ToggleDegrees();
1168
1169    wxConfigBase::Get()->Write(wxT("degrees"), m_View->GetDegrees());
1170    wxConfigBase::Get()->Flush();
1171}
1172
1173void GUIControl::OnToggleDegreesUpdate(wxUpdateUIEvent& cmd)
1174{
1175    cmd.Enable(m_View->HasData());
1176    cmd.Check(m_View->GetDegrees());
1177}
1178
1179void GUIControl::OnTogglePercent()
1180{
1181    m_View->TogglePercent();
1182
1183    wxConfigBase::Get()->Write(wxT("percent"), m_View->GetPercent());
1184    wxConfigBase::Get()->Flush();
1185}
1186
1187void GUIControl::OnTogglePercentUpdate(wxUpdateUIEvent& cmd)
1188{
1189    cmd.Enable(m_View->HasData());
1190    cmd.Check(m_View->GetPercent());
1191}
1192
1193void GUIControl::OnToggleTubes()
1194{
1195    m_View->ToggleTubes();
1196}
1197
1198void GUIControl::OnToggleTubesUpdate(wxUpdateUIEvent& cmd)
1199{
1200    cmd.Enable(m_View->HasData() && m_View->HasTubes());
1201    cmd.Check(m_View->GetTubes());
1202}
1203
1204void GUIControl::OnCancelDistLine()
1205{
1206    m_View->ClearTreeSelection();
1207}
1208
1209void GUIControl::OnCancelDistLineUpdate(wxUpdateUIEvent& cmd)
1210{
1211    cmd.Enable(m_View->ShowingMeasuringLine());
1212}
1213
1214void GUIControl::OnKeyPress(wxKeyEvent &e)
1215{
1216    if (!m_View->HasData() ||
1217        (e.GetModifiers() &~ (wxMOD_CONTROL|wxMOD_SHIFT))) {
1218        // Pass on the event if there's no survey data, or if any modifier keys
1219        // other than Ctrl and Shift are pressed.
1220        e.Skip();
1221        return;
1222    }
1223
1224    // The changelog says this is meant to keep animation going while keys are
1225    // pressed, but that happens anyway (on linux at least - perhaps it helps
1226    // on windows?)  FIXME : check!
1227    //bool refresh = m_View->Animate();
1228
1229    switch (e.GetKeyCode()) {
1230        case '/': case '?':
1231            if (m_View->CanLowerViewpoint() && !m_View->IsExtendedElevation())
1232                OnLowerViewpoint(e.GetModifiers() == wxMOD_SHIFT);
1233            break;
1234        case '\'': case '@': case '"': // both shifted forms - US and UK kbd
1235            if (m_View->CanRaiseViewpoint() && !m_View->IsExtendedElevation())
1236                OnHigherViewpoint(e.GetModifiers() == wxMOD_SHIFT);
1237            break;
1238        case 'C': case 'c':
1239            if (!m_View->IsExtendedElevation() && !m_View->IsRotating())
1240                OnStepOnceAnticlockwise(e.GetModifiers() == wxMOD_SHIFT);
1241            break;
1242        case 'V': case 'v':
1243            if (!m_View->IsExtendedElevation() && !m_View->IsRotating())
1244                OnStepOnceClockwise(e.GetModifiers() == wxMOD_SHIFT);
1245            break;
1246        case ']': case '}':
1247            OnZoomIn(e.GetModifiers() == wxMOD_SHIFT);
1248            break;
1249        case '[': case '{':
1250            OnZoomOut(e.GetModifiers() == wxMOD_SHIFT);
1251            break;
1252        case 'N': case 'n':
1253            OnMoveNorth();
1254            break;
1255        case 'S': case 's':
1256            OnMoveSouth();
1257            break;
1258        case 'E': case 'e':
1259            if (!m_View->IsExtendedElevation())
1260                OnMoveEast();
1261            break;
1262        case 'W': case 'w':
1263            if (!m_View->IsExtendedElevation())
1264                OnMoveWest();
1265            break;
1266        case 'Z': case 'z':
1267            if (!m_View->IsExtendedElevation())
1268                m_View->RotateFaster(e.GetModifiers() == wxMOD_SHIFT);
1269            break;
1270        case 'X': case 'x':
1271            if (!m_View->IsExtendedElevation())
1272                m_View->RotateSlower(e.GetModifiers() == wxMOD_SHIFT);
1273            break;
1274        case 'R': case 'r':
1275            if (!m_View->IsExtendedElevation())
1276                OnReverseDirectionOfRotation();
1277            break;
1278        case 'P': case 'p':
1279            if (!m_View->IsExtendedElevation() && !m_View->ShowingPlan())
1280                OnPlan();
1281            break;
1282        case 'L': case 'l':
1283            if (!m_View->IsExtendedElevation() && !m_View->ShowingElevation())
1284                OnElevation();
1285            break;
1286        case 'O': case 'o':
1287            OnDisplayOverlappingNames();
1288            break;
1289        case WXK_DELETE:
1290            if (e.GetModifiers() == 0)
1291                OnDefaults();
1292            break;
1293        case WXK_RETURN:
1294            if (e.GetModifiers() == 0) {
1295                // For compatibility with older versions.
1296                if (!m_View->IsExtendedElevation() && !m_View->IsRotating())
1297                    m_View->StartRotation();
1298            }
1299            break;
1300        case WXK_SPACE:
1301            if (e.GetModifiers() == 0) {
1302                if (!m_View->IsExtendedElevation())
1303                    OnToggleRotation();
1304            }
1305            break;
1306        case WXK_LEFT:
1307            if ((e.GetModifiers() &~ wxMOD_SHIFT) == wxMOD_CONTROL) {
1308                if (!m_View->IsExtendedElevation() && !m_View->IsRotating())
1309                    OnStepOnceAnticlockwise(e.GetModifiers() == wxMOD_SHIFT);
1310            } else {
1311                OnShiftDisplayLeft(e.GetModifiers() == wxMOD_SHIFT);
1312            }
1313            break;
1314        case WXK_RIGHT:
1315            if ((e.GetModifiers() &~ wxMOD_SHIFT) == wxMOD_CONTROL) {
1316                if (!m_View->IsExtendedElevation() && !m_View->IsRotating())
1317                    OnStepOnceClockwise(e.GetModifiers() == wxMOD_SHIFT);
1318            } else {
1319                OnShiftDisplayRight(e.GetModifiers() == wxMOD_SHIFT);
1320            }
1321            break;
1322        case WXK_UP:
1323            if ((e.GetModifiers() &~ wxMOD_SHIFT) == wxMOD_CONTROL) {
1324                if (m_View->CanRaiseViewpoint() && !m_View->IsExtendedElevation())
1325                    OnHigherViewpoint(e.GetModifiers() == wxMOD_SHIFT);
1326            } else {
1327                OnShiftDisplayUp(e.GetModifiers() == wxMOD_SHIFT);
1328            }
1329            break;
1330        case WXK_DOWN:
1331            if ((e.GetModifiers() &~ wxMOD_SHIFT) == wxMOD_CONTROL) {
1332                if (m_View->CanLowerViewpoint() && !m_View->IsExtendedElevation())
1333                    OnLowerViewpoint(e.GetModifiers() == wxMOD_SHIFT);
1334            } else {
1335                OnShiftDisplayDown(e.GetModifiers() == wxMOD_SHIFT);
1336            }
1337            break;
1338        case WXK_ESCAPE:
1339            if (e.GetModifiers() == 0) {
1340                if (m_View->ShowingMeasuringLine()) {
1341                    OnCancelDistLine();
1342                } else if (m_View->IsFullScreen()) {
1343                    // Cancel full-screen mode on "Escape" if it isn't cancelling
1344                    // the measuring line.
1345                    m_View->FullScreenMode();
1346                }
1347            }
1348            break;
1349        case WXK_F2:
1350            if (e.GetModifiers() == 0)
1351                m_View->ToggleFatFinger();
1352            break;
1353        case WXK_F3:
1354            if (e.GetModifiers() == 0)
1355                m_View->ToggleHitTestDebug();
1356            break;
1357        case WXK_F4: {
1358            if (e.GetModifiers() == 0) {
1359                const wxChar * msg;
1360#if wxDEBUG_LEVEL
1361                if (wxTheAssertHandler)
1362                    wxTheAssertHandler = NULL;
1363                else
1364                    wxSetDefaultAssertHandler();
1365                if (wxTheAssertHandler)
1366                    msg = wxT("Assertions enabled");
1367                else
1368                    msg = wxT("Assertions disabled");
1369#else
1370                msg = wxT("wxWidgets was built without assertions");
1371#endif
1372                wxMessageBox(msg, wxT("Aven Debug"), wxOK | wxICON_INFORMATION);
1373            }
1374            break;
1375        }
1376        case WXK_F5:
1377            if (e.GetModifiers() == 0) {
1378                m_View->InvalidateAllLists();
1379                m_View->ForceRefresh();
1380            }
1381            break;
1382        case WXK_F6:
1383            if (e.GetModifiers() == 0)
1384                m_View->ToggleRenderStats();
1385            break;
1386        default:
1387            e.Skip();
1388    }
1389
1390    //if (refresh) m_View->ForceRefresh();
1391}
1392
1393void GUIControl::OnViewFullScreenUpdate(wxUpdateUIEvent& cmd)
1394{
1395    cmd.Check(m_View->IsFullScreen());
1396}
1397
1398void GUIControl::OnViewFullScreen()
1399{
1400    m_View->FullScreenMode();
1401}
1402
1403void GUIControl::OnViewBoundingBoxUpdate(wxUpdateUIEvent& cmd)
1404{
1405    cmd.Enable(m_View->HasData());
1406    cmd.Check(m_View->DisplayingBoundingBox());
1407}
1408
1409void GUIControl::OnViewBoundingBox()
1410{
1411    m_View->ToggleBoundingBox();
1412}
1413
1414void GUIControl::OnViewTerrainUpdate(wxUpdateUIEvent& cmd)
1415{
1416    cmd.Enable(m_View->HasTerrain());
1417    cmd.Check(m_View->DisplayingTerrain());
1418}
1419
1420void GUIControl::OnViewTerrain()
1421{
1422    m_View->ToggleTerrain();
1423}
Note: See TracBrowser for help on using the repository browser.