source: git/src/guicontrol.cc @ 04078a7

walls-datawalls-data-hanging-as-warning
Last change on this file since 04078a7 was f18dadb, checked in by Olly Betts <olly@…>, 3 years ago

Fix aven assertion

Clicking and holding the left mouse button on the compass or clino,
then (while still holding) clicking the right button caused a wxWidgets
assertion to fail.

Reported by echarlie.

  • 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 (dragging != NO_DRAG) {
453            if (m_LastDrag == drag_ZOOM)
454                m_View->UnsetZoomBox();
455            // We need to release and recapture for the cursor to update
456            // (noticed with wxGTK).
457            m_View->ReleaseMouse();
458            dragging = NO_DRAG;
459        }
460
461        if (m_View->HandleRClick(event.GetPosition()))
462            return;
463
464        m_DragStart = event.GetPosition();
465
466        m_View->UpdateCursor(GfxCore::CURSOR_DRAGGING_HAND);
467
468        m_View->CaptureMouse();
469        dragging = RIGHT_DRAG;
470    }
471}
472
473void GUIControl::OnRButtonUp(wxMouseEvent& event)
474{
475    if (dragging != RIGHT_DRAG)
476        return;
477
478    if (event.LeftIsDown()) {
479        OnLButtonDown(event);
480        return;
481    }
482
483    if (event.MiddleIsDown()) {
484        OnMButtonDown(event);
485        return;
486    }
487
488    m_LastDrag = drag_NONE;
489    m_View->ReleaseMouse();
490
491    dragging = NO_DRAG;
492
493    RestoreCursor();
494
495    m_View->DragFinished();
496}
497
498void GUIControl::OnMouseWheel(wxMouseEvent& event) {
499    int dy = event.GetWheelRotation();
500    if (m_View->GetPerspective()) {
501        m_View->MoveViewer(-dy, 0, 0);
502    } else {
503        m_View->SetScale(m_View->GetScale() * pow(1.06, -0.04 * dy));
504        m_View->ForceRefresh();
505    }
506}
507
508void GUIControl::OnDisplayOverlappingNames()
509{
510    m_View->ToggleOverlappingNames();
511}
512
513void GUIControl::OnDisplayOverlappingNamesUpdate(wxUpdateUIEvent& cmd)
514{
515    cmd.Enable(m_View->HasData() && m_View->ShowingStationNames());
516    cmd.Check(m_View->ShowingOverlappingNames());
517}
518
519void GUIControl::OnColourByDepth()
520{
521    if (m_View->ColouringBy() == COLOUR_BY_DEPTH) {
522        m_View->SetColourBy(COLOUR_BY_NONE);
523    } else {
524        m_View->SetColourBy(COLOUR_BY_DEPTH);
525    }
526}
527
528void GUIControl::OnColourByDate()
529{
530    if (m_View->ColouringBy() == COLOUR_BY_DATE) {
531        m_View->SetColourBy(COLOUR_BY_NONE);
532    } else {
533        m_View->SetColourBy(COLOUR_BY_DATE);
534    }
535}
536
537void GUIControl::OnColourByError()
538{
539    if (m_View->ColouringBy() == COLOUR_BY_ERROR) {
540        m_View->SetColourBy(COLOUR_BY_NONE);
541    } else {
542        m_View->SetColourBy(COLOUR_BY_ERROR);
543    }
544}
545
546void GUIControl::OnColourByHError()
547{
548    if (m_View->ColouringBy() == COLOUR_BY_H_ERROR) {
549        m_View->SetColourBy(COLOUR_BY_NONE);
550    } else {
551        m_View->SetColourBy(COLOUR_BY_H_ERROR);
552    }
553}
554
555void GUIControl::OnColourByVError()
556{
557    if (m_View->ColouringBy() == COLOUR_BY_V_ERROR) {
558        m_View->SetColourBy(COLOUR_BY_NONE);
559    } else {
560        m_View->SetColourBy(COLOUR_BY_V_ERROR);
561    }
562}
563
564void GUIControl::OnColourByGradient()
565{
566    if (m_View->ColouringBy() == COLOUR_BY_GRADIENT) {
567        m_View->SetColourBy(COLOUR_BY_NONE);
568    } else {
569        m_View->SetColourBy(COLOUR_BY_GRADIENT);
570    }
571}
572
573void GUIControl::OnColourByLength()
574{
575    if (m_View->ColouringBy() == COLOUR_BY_LENGTH) {
576        m_View->SetColourBy(COLOUR_BY_NONE);
577    } else {
578        m_View->SetColourBy(COLOUR_BY_LENGTH);
579    }
580}
581
582void GUIControl::OnColourBySurvey()
583{
584    if (m_View->ColouringBy() == COLOUR_BY_SURVEY) {
585        m_View->SetColourBy(COLOUR_BY_NONE);
586    } else {
587        m_View->SetColourBy(COLOUR_BY_SURVEY);
588    }
589}
590
591void GUIControl::OnColourByStyle()
592{
593    if (m_View->ColouringBy() == COLOUR_BY_STYLE) {
594        m_View->SetColourBy(COLOUR_BY_NONE);
595    } else {
596        m_View->SetColourBy(COLOUR_BY_STYLE);
597    }
598}
599
600void GUIControl::OnColourByUpdate(wxUpdateUIEvent& cmd)
601{
602    cmd.Enable(m_View->HasData());
603}
604
605void GUIControl::OnColourByDepthUpdate(wxUpdateUIEvent& cmd)
606{
607    cmd.Enable(m_View->HasData());
608    cmd.Check(m_View->ColouringBy() == COLOUR_BY_DEPTH);
609}
610
611void GUIControl::OnColourByDateUpdate(wxUpdateUIEvent& cmd)
612{
613    cmd.Enable(m_View->HasData());
614    cmd.Check(m_View->ColouringBy() == COLOUR_BY_DATE);
615}
616
617void GUIControl::OnColourByErrorUpdate(wxUpdateUIEvent& cmd)
618{
619    cmd.Enable(m_View->HasData());
620    cmd.Check(m_View->ColouringBy() == COLOUR_BY_ERROR);
621}
622
623void GUIControl::OnColourByHErrorUpdate(wxUpdateUIEvent& cmd)
624{
625    cmd.Enable(m_View->HasData());
626    cmd.Check(m_View->ColouringBy() == COLOUR_BY_H_ERROR);
627}
628
629void GUIControl::OnColourByVErrorUpdate(wxUpdateUIEvent& cmd)
630{
631    cmd.Enable(m_View->HasData());
632    cmd.Check(m_View->ColouringBy() == COLOUR_BY_V_ERROR);
633}
634
635void GUIControl::OnColourByGradientUpdate(wxUpdateUIEvent& cmd)
636{
637    cmd.Enable(m_View->HasData());
638    cmd.Check(m_View->ColouringBy() == COLOUR_BY_GRADIENT);
639}
640
641void GUIControl::OnColourByLengthUpdate(wxUpdateUIEvent& cmd)
642{
643    cmd.Enable(m_View->HasData());
644    cmd.Check(m_View->ColouringBy() == COLOUR_BY_LENGTH);
645}
646
647void GUIControl::OnColourBySurveyUpdate(wxUpdateUIEvent& cmd)
648{
649    cmd.Enable(m_View->HasData());
650    cmd.Check(m_View->ColouringBy() == COLOUR_BY_SURVEY);
651}
652
653void GUIControl::OnColourByStyleUpdate(wxUpdateUIEvent& cmd)
654{
655    cmd.Enable(m_View->HasData());
656    cmd.Check(m_View->ColouringBy() == COLOUR_BY_STYLE);
657}
658
659void GUIControl::OnShowCrosses()
660{
661    m_View->ToggleCrosses();
662}
663
664void GUIControl::OnShowCrossesUpdate(wxUpdateUIEvent& cmd)
665{
666    cmd.Enable(m_View->HasData());
667    cmd.Check(m_View->ShowingCrosses());
668}
669
670void GUIControl::OnShowStationNames()
671{
672    m_View->ToggleStationNames();
673}
674
675void GUIControl::OnShowStationNamesUpdate(wxUpdateUIEvent& cmd)
676{
677    cmd.Enable(m_View->HasData());
678    cmd.Check(m_View->ShowingStationNames());
679}
680
681void GUIControl::OnShowSurveyLegs()
682{
683    m_View->ToggleUndergroundLegs();
684}
685
686void GUIControl::OnShowSurveyLegsUpdate(wxUpdateUIEvent& cmd)
687{
688    cmd.Enable(m_View->HasData() && m_View->HasUndergroundLegs());
689    cmd.Check(m_View->ShowingUndergroundLegs());
690}
691
692void GUIControl::OnHideSplays()
693{
694    m_View->SetSplaysMode(SHOW_HIDE);
695}
696
697void GUIControl::OnShowSplaysDashed()
698{
699    m_View->SetSplaysMode(SHOW_DASHED);
700}
701
702void GUIControl::OnShowSplaysFaded()
703{
704    m_View->SetSplaysMode(SHOW_FADED);
705}
706
707void GUIControl::OnShowSplaysNormal()
708{
709    m_View->SetSplaysMode(SHOW_NORMAL);
710}
711
712void GUIControl::OnSplaysUpdate(wxUpdateUIEvent& cmd)
713{
714    cmd.Enable(m_View->HasData() && m_View->HasSplays());
715}
716
717void GUIControl::OnHideSplaysUpdate(wxUpdateUIEvent& cmd)
718{
719    cmd.Enable(m_View->HasData() && m_View->HasSplays());
720    cmd.Check(m_View->ShowingSplaysMode() == SHOW_HIDE);
721}
722
723void GUIControl::OnShowSplaysDashedUpdate(wxUpdateUIEvent& cmd)
724{
725    cmd.Enable(m_View->HasData() && m_View->HasSplays());
726    cmd.Check(m_View->ShowingSplaysMode() == SHOW_DASHED);
727}
728
729void GUIControl::OnShowSplaysFadedUpdate(wxUpdateUIEvent& cmd)
730{
731    cmd.Enable(m_View->HasData() && m_View->HasSplays());
732    cmd.Check(m_View->ShowingSplaysMode() == SHOW_FADED);
733}
734
735void GUIControl::OnShowSplaysNormalUpdate(wxUpdateUIEvent& cmd)
736{
737    cmd.Enable(m_View->HasData() && m_View->HasSplays());
738    cmd.Check(m_View->ShowingSplaysMode() == SHOW_NORMAL);
739}
740
741void GUIControl::OnHideDupes() {
742    m_View->SetDupesMode(SHOW_HIDE);
743}
744
745void GUIControl::OnShowDupesDashed() {
746    m_View->SetDupesMode(SHOW_DASHED);
747}
748
749void GUIControl::OnShowDupesFaded() {
750    m_View->SetDupesMode(SHOW_FADED);
751}
752
753void GUIControl::OnShowDupesNormal() {
754    m_View->SetDupesMode(SHOW_NORMAL);
755}
756
757void GUIControl::OnDupesUpdate(wxUpdateUIEvent& cmd) {
758    cmd.Enable(m_View->HasData() && m_View->HasDupes());
759}
760
761void GUIControl::OnHideDupesUpdate(wxUpdateUIEvent& cmd) {
762    cmd.Enable(m_View->HasData() && m_View->HasDupes());
763    cmd.Check(m_View->ShowingDupesMode() == SHOW_HIDE);
764}
765
766void GUIControl::OnShowDupesDashedUpdate(wxUpdateUIEvent& cmd) {
767    cmd.Enable(m_View->HasData() && m_View->HasDupes());
768    cmd.Check(m_View->ShowingDupesMode() == SHOW_DASHED);
769}
770
771void GUIControl::OnShowDupesFadedUpdate(wxUpdateUIEvent& cmd) {
772    cmd.Enable(m_View->HasData() && m_View->HasDupes());
773    cmd.Check(m_View->ShowingDupesMode() == SHOW_FADED);
774}
775
776void GUIControl::OnShowDupesNormalUpdate(wxUpdateUIEvent& cmd) {
777    cmd.Enable(m_View->HasData() && m_View->HasDupes());
778    cmd.Check(m_View->ShowingDupesMode() == SHOW_NORMAL);
779}
780
781void GUIControl::OnMoveEast()
782{
783    m_View->TurnCaveTo(90.0);
784    m_View->ForceRefresh();
785}
786
787void GUIControl::OnMoveEastUpdate(wxUpdateUIEvent& cmd)
788{
789    cmd.Enable(m_View->HasData() && !m_View->IsExtendedElevation() && m_View->GetCompassValue() != 90.0);
790}
791
792void GUIControl::OnMoveNorth()
793{
794    m_View->TurnCaveTo(0.0);
795    m_View->ForceRefresh();
796}
797
798void GUIControl::OnMoveNorthUpdate(wxUpdateUIEvent& cmd)
799{
800    cmd.Enable(m_View->HasData() && m_View->GetCompassValue() != 0.0);
801}
802
803void GUIControl::OnMoveSouth()
804{
805    m_View->TurnCaveTo(180.0);
806    m_View->ForceRefresh();
807}
808
809void GUIControl::OnMoveSouthUpdate(wxUpdateUIEvent& cmd)
810{
811    cmd.Enable(m_View->HasData() && m_View->GetCompassValue() != 180.0);
812}
813
814void GUIControl::OnMoveWest()
815{
816    m_View->TurnCaveTo(270.0);
817    m_View->ForceRefresh();
818}
819
820void GUIControl::OnMoveWestUpdate(wxUpdateUIEvent& cmd)
821{
822    cmd.Enable(m_View->HasData() && !m_View->IsExtendedElevation() && m_View->GetCompassValue() != 270.0);
823}
824
825void GUIControl::OnToggleRotation()
826{
827    m_View->ToggleRotation();
828}
829
830void GUIControl::OnToggleRotationUpdate(wxUpdateUIEvent& cmd)
831{
832    cmd.Enable(m_View->HasData() && !m_View->IsExtendedElevation());
833    cmd.Check(m_View->HasData() && m_View->IsRotating());
834}
835
836void GUIControl::OnReverseControls()
837{
838    m_ReverseControls = !m_ReverseControls;
839}
840
841void GUIControl::OnReverseControlsUpdate(wxUpdateUIEvent& cmd)
842{
843    cmd.Enable(m_View->HasData());
844    cmd.Check(m_ReverseControls);
845}
846
847void GUIControl::OnReverseDirectionOfRotation()
848{
849    m_View->ReverseRotation();
850}
851
852void GUIControl::OnReverseDirectionOfRotationUpdate(wxUpdateUIEvent& cmd)
853{
854    cmd.Enable(m_View->HasData() && !m_View->IsExtendedElevation());
855}
856
857void GUIControl::OnStepOnceAnticlockwise(bool accel)
858{
859    if (m_View->GetPerspective()) {
860        m_View->TurnCave(accel ? -5.0 * ROTATE_STEP : -ROTATE_STEP);
861    } else {
862        m_View->TurnCave(accel ? 5.0 * ROTATE_STEP : ROTATE_STEP);
863    }
864    m_View->ForceRefresh();
865}
866
867void GUIControl::OnStepOnceClockwise(bool accel)
868{
869    if (m_View->GetPerspective()) {
870        m_View->TurnCave(accel ? 5.0 * ROTATE_STEP : ROTATE_STEP);
871    } else {
872        m_View->TurnCave(accel ? -5.0 * ROTATE_STEP : -ROTATE_STEP);
873    }
874    m_View->ForceRefresh();
875}
876
877void GUIControl::OnDefaults()
878{
879    m_View->Defaults();
880}
881
882void GUIControl::OnDefaultsUpdate(wxUpdateUIEvent& cmd)
883{
884    cmd.Enable(m_View->HasData());
885}
886
887void GUIControl::OnElevation()
888{
889    // Switch to elevation view.
890
891    m_View->SwitchToElevation();
892}
893
894void GUIControl::OnElevationUpdate(wxUpdateUIEvent& cmd)
895{
896    cmd.Enable(m_View->HasData() && !m_View->IsExtendedElevation() && !m_View->ShowingElevation());
897}
898
899void GUIControl::OnHigherViewpoint(bool accel)
900{
901    // Raise the viewpoint.
902    if (m_View->GetPerspective()) {
903        m_View->TiltCave(accel ? 5.0 * ROTATE_STEP : ROTATE_STEP);
904    } else {
905        m_View->TiltCave(accel ? -5.0 * ROTATE_STEP : -ROTATE_STEP);
906    }
907    m_View->ForceRefresh();
908}
909
910void GUIControl::OnLowerViewpoint(bool accel)
911{
912    // Lower the viewpoint.
913    if (m_View->GetPerspective()) {
914        m_View->TiltCave(accel ? -5.0 * ROTATE_STEP : -ROTATE_STEP);
915    } else {
916        m_View->TiltCave(accel ? 5.0 * ROTATE_STEP : ROTATE_STEP);
917    }
918    m_View->ForceRefresh();
919}
920
921void GUIControl::OnPlan()
922{
923    // Switch to plan view.
924    m_View->SwitchToPlan();
925}
926
927void GUIControl::OnPlanUpdate(wxUpdateUIEvent& cmd)
928{
929    cmd.Enable(m_View->HasData() && !m_View->IsExtendedElevation() && !m_View->ShowingPlan());
930}
931
932void GUIControl::OnShiftDisplayDown(bool accel)
933{
934    if (m_View->GetPerspective())
935        m_View->MoveViewer(0, accel ? 5 * FLYFREE_SHIFT : FLYFREE_SHIFT, 0);
936    else
937        m_View->TranslateCave(0, accel ? 5 * DISPLAY_SHIFT : DISPLAY_SHIFT);
938}
939
940void GUIControl::OnShiftDisplayLeft(bool accel)
941{
942    if (m_View->GetPerspective())
943        m_View->MoveViewer(0, 0, accel ? 5 * FLYFREE_SHIFT : FLYFREE_SHIFT);
944    else
945        m_View->TranslateCave(accel ? -5 * DISPLAY_SHIFT : -DISPLAY_SHIFT, 0);
946}
947
948void GUIControl::OnShiftDisplayRight(bool accel)
949{
950    if (m_View->GetPerspective())
951        m_View->MoveViewer(0, 0, accel ? -5 * FLYFREE_SHIFT : -FLYFREE_SHIFT);
952    else
953        m_View->TranslateCave(accel ? 5 * DISPLAY_SHIFT : DISPLAY_SHIFT, 0);
954}
955
956void GUIControl::OnShiftDisplayUp(bool accel)
957{
958    if (m_View->GetPerspective())
959        m_View->MoveViewer(0, accel ? -5 * FLYFREE_SHIFT : -FLYFREE_SHIFT, 0);
960    else
961        m_View->TranslateCave(0, accel ? -5 * DISPLAY_SHIFT : -DISPLAY_SHIFT);
962}
963
964void GUIControl::OnZoomIn(bool accel)
965{
966    // Increase the scale.
967
968    if (m_View->GetPerspective()) {
969        m_View->MoveViewer(accel ? 5 * FLYFREE_SHIFT : FLYFREE_SHIFT, 0, 0);
970    } else {
971        m_View->SetScale(m_View->GetScale() * (accel ? 1.1236 : 1.06));
972        m_View->ForceRefresh();
973    }
974}
975
976void GUIControl::OnZoomOut(bool accel)
977{
978    // Decrease the scale.
979
980    if (m_View->GetPerspective()) {
981        m_View->MoveViewer(accel ? -5 * FLYFREE_SHIFT : -FLYFREE_SHIFT, 0, 0);
982    } else {
983        m_View->SetScale(m_View->GetScale() / (accel ? 1.1236 : 1.06));
984        m_View->ForceRefresh();
985    }
986}
987
988void GUIControl::OnToggleScalebar()
989{
990    m_View->ToggleScaleBar();
991}
992
993void GUIControl::OnToggleScalebarUpdate(wxUpdateUIEvent& cmd)
994{
995    cmd.Enable(m_View->HasData());
996    cmd.Check(m_View->ShowingScaleBar());
997}
998
999void GUIControl::OnToggleColourKey()
1000{
1001    m_View->ToggleColourKey();
1002}
1003
1004void GUIControl::OnToggleColourKeyUpdate(wxUpdateUIEvent& cmd)
1005{
1006    cmd.Enable(m_View->HasData() && m_View->ColouringBy() != COLOUR_BY_NONE);
1007    cmd.Check(m_View->ShowingColourKey());
1008}
1009
1010void GUIControl::OnViewCompass()
1011{
1012    m_View->ToggleCompass();
1013}
1014
1015void GUIControl::OnViewCompassUpdate(wxUpdateUIEvent& cmd)
1016{
1017    cmd.Enable(m_View->HasData() && !m_View->IsExtendedElevation());
1018    cmd.Check(m_View->ShowingCompass());
1019}
1020
1021void GUIControl::OnViewClino()
1022{
1023    m_View->ToggleClino();
1024}
1025
1026void GUIControl::OnViewClinoUpdate(wxUpdateUIEvent& cmd)
1027{
1028    cmd.Enable(m_View->HasData() && !m_View->IsExtendedElevation());
1029    cmd.Check(m_View->ShowingClino());
1030}
1031
1032void GUIControl::OnShowSurface()
1033{
1034    m_View->ToggleSurfaceLegs();
1035}
1036
1037void GUIControl::OnShowSurfaceUpdate(wxUpdateUIEvent& cmd)
1038{
1039    cmd.Enable(m_View->HasData() && m_View->HasSurfaceLegs());
1040    cmd.Check(m_View->ShowingSurfaceLegs());
1041}
1042
1043void GUIControl::OnShowEntrances()
1044{
1045    m_View->ToggleEntrances();
1046}
1047
1048void GUIControl::OnShowEntrancesUpdate(wxUpdateUIEvent& cmd)
1049{
1050    cmd.Enable(m_View->HasData() && (m_View->GetNumEntrances() > 0));
1051    cmd.Check(m_View->ShowingEntrances());
1052}
1053
1054void GUIControl::OnShowFixedPts()
1055{
1056    m_View->ToggleFixedPts();
1057}
1058
1059void GUIControl::OnShowFixedPtsUpdate(wxUpdateUIEvent& cmd)
1060{
1061    cmd.Enable(m_View->HasData() && (m_View->GetNumFixedPts() > 0));
1062    cmd.Check(m_View->ShowingFixedPts());
1063}
1064
1065void GUIControl::OnShowExportedPts()
1066{
1067    m_View->ToggleExportedPts();
1068}
1069
1070void GUIControl::OnShowExportedPtsUpdate(wxUpdateUIEvent& cmd)
1071{
1072    cmd.Enable(m_View->HasData() && (m_View->GetNumExportedPts() > 0));
1073    cmd.Check(m_View->ShowingExportedPts());
1074}
1075
1076void GUIControl::OnViewGrid()
1077{
1078    m_View->ToggleGrid();
1079}
1080
1081void GUIControl::OnViewGridUpdate(wxUpdateUIEvent& cmd)
1082{
1083    cmd.Enable(m_View->HasData());
1084    cmd.Check(m_View->ShowingGrid());
1085}
1086
1087void GUIControl::OnIndicatorsUpdate(wxUpdateUIEvent& cmd)
1088{
1089    cmd.Enable(m_View->HasData());
1090}
1091
1092void GUIControl::OnViewPerspective()
1093{
1094    m_View->TogglePerspective();
1095    // Force update of coordinate display.
1096    if (m_View->GetPerspective()) {
1097        m_View->MoveViewer(0, 0, 0);
1098    } else {
1099        m_View->ClearCoords();
1100    }
1101}
1102
1103void GUIControl::OnViewPerspectiveUpdate(wxUpdateUIEvent& cmd)
1104{
1105    cmd.Enable(m_View->HasData() && !m_View->IsExtendedElevation());
1106    cmd.Check(m_View->GetPerspective());
1107}
1108
1109void GUIControl::OnViewSmoothShading()
1110{
1111    m_View->ToggleSmoothShading();
1112}
1113
1114void GUIControl::OnViewSmoothShadingUpdate(wxUpdateUIEvent& cmd)
1115{
1116    cmd.Enable(m_View->HasData());
1117    cmd.Check(m_View->GetSmoothShading());
1118}
1119
1120void GUIControl::OnViewTextured()
1121{
1122    m_View->ToggleTextured();
1123}
1124
1125void GUIControl::OnViewTexturedUpdate(wxUpdateUIEvent& cmd)
1126{
1127    cmd.Enable(m_View->HasData());
1128    cmd.Check(m_View->GetTextured());
1129}
1130
1131void GUIControl::OnViewFog()
1132{
1133    m_View->ToggleFog();
1134}
1135
1136void GUIControl::OnViewFogUpdate(wxUpdateUIEvent& cmd)
1137{
1138    cmd.Enable(m_View->HasData());
1139    cmd.Check(m_View->GetFog());
1140}
1141
1142void GUIControl::OnViewSmoothLines()
1143{
1144    m_View->ToggleAntiAlias();
1145}
1146
1147void GUIControl::OnViewSmoothLinesUpdate(wxUpdateUIEvent& cmd)
1148{
1149    cmd.Enable(m_View->HasData());
1150    cmd.Check(m_View->GetAntiAlias());
1151}
1152
1153void GUIControl::OnToggleMetric()
1154{
1155    m_View->ToggleMetric();
1156
1157    wxConfigBase::Get()->Write(wxT("metric"), m_View->GetMetric());
1158    wxConfigBase::Get()->Flush();
1159}
1160
1161void GUIControl::OnToggleMetricUpdate(wxUpdateUIEvent& cmd)
1162{
1163    cmd.Enable(m_View->HasData());
1164    cmd.Check(m_View->GetMetric());
1165}
1166
1167void GUIControl::OnToggleDegrees()
1168{
1169    m_View->ToggleDegrees();
1170
1171    wxConfigBase::Get()->Write(wxT("degrees"), m_View->GetDegrees());
1172    wxConfigBase::Get()->Flush();
1173}
1174
1175void GUIControl::OnToggleDegreesUpdate(wxUpdateUIEvent& cmd)
1176{
1177    cmd.Enable(m_View->HasData());
1178    cmd.Check(m_View->GetDegrees());
1179}
1180
1181void GUIControl::OnTogglePercent()
1182{
1183    m_View->TogglePercent();
1184
1185    wxConfigBase::Get()->Write(wxT("percent"), m_View->GetPercent());
1186    wxConfigBase::Get()->Flush();
1187}
1188
1189void GUIControl::OnTogglePercentUpdate(wxUpdateUIEvent& cmd)
1190{
1191    cmd.Enable(m_View->HasData());
1192    cmd.Check(m_View->GetPercent());
1193}
1194
1195void GUIControl::OnToggleTubes()
1196{
1197    m_View->ToggleTubes();
1198}
1199
1200void GUIControl::OnToggleTubesUpdate(wxUpdateUIEvent& cmd)
1201{
1202    cmd.Enable(m_View->HasData() && m_View->HasTubes());
1203    cmd.Check(m_View->GetTubes());
1204}
1205
1206void GUIControl::OnCancelDistLine()
1207{
1208    m_View->ClearTreeSelection();
1209}
1210
1211void GUIControl::OnCancelDistLineUpdate(wxUpdateUIEvent& cmd)
1212{
1213    cmd.Enable(m_View->ShowingMeasuringLine());
1214}
1215
1216void GUIControl::OnKeyPress(wxKeyEvent &e)
1217{
1218    if (!m_View->HasData() ||
1219        (e.GetModifiers() &~ (wxMOD_CONTROL|wxMOD_SHIFT))) {
1220        // Pass on the event if there's no survey data, or if any modifier keys
1221        // other than Ctrl and Shift are pressed.
1222        e.Skip();
1223        return;
1224    }
1225
1226    // The changelog says this is meant to keep animation going while keys are
1227    // pressed, but that happens anyway (on linux at least - perhaps it helps
1228    // on windows?)  FIXME : check!
1229    //bool refresh = m_View->Animate();
1230
1231    switch (e.GetKeyCode()) {
1232        case '/': case '?':
1233            if (m_View->CanLowerViewpoint() && !m_View->IsExtendedElevation())
1234                OnLowerViewpoint(e.GetModifiers() == wxMOD_SHIFT);
1235            break;
1236        case '\'': case '@': case '"': // both shifted forms - US and UK kbd
1237            if (m_View->CanRaiseViewpoint() && !m_View->IsExtendedElevation())
1238                OnHigherViewpoint(e.GetModifiers() == wxMOD_SHIFT);
1239            break;
1240        case 'C': case 'c':
1241            if (!m_View->IsExtendedElevation() && !m_View->IsRotating())
1242                OnStepOnceAnticlockwise(e.GetModifiers() == wxMOD_SHIFT);
1243            break;
1244        case 'V': case 'v':
1245            if (!m_View->IsExtendedElevation() && !m_View->IsRotating())
1246                OnStepOnceClockwise(e.GetModifiers() == wxMOD_SHIFT);
1247            break;
1248        case ']': case '}':
1249            OnZoomIn(e.GetModifiers() == wxMOD_SHIFT);
1250            break;
1251        case '[': case '{':
1252            OnZoomOut(e.GetModifiers() == wxMOD_SHIFT);
1253            break;
1254        case 'N': case 'n':
1255            OnMoveNorth();
1256            break;
1257        case 'S': case 's':
1258            OnMoveSouth();
1259            break;
1260        case 'E': case 'e':
1261            if (!m_View->IsExtendedElevation())
1262                OnMoveEast();
1263            break;
1264        case 'W': case 'w':
1265            if (!m_View->IsExtendedElevation())
1266                OnMoveWest();
1267            break;
1268        case 'Z': case 'z':
1269            if (!m_View->IsExtendedElevation())
1270                m_View->RotateFaster(e.GetModifiers() == wxMOD_SHIFT);
1271            break;
1272        case 'X': case 'x':
1273            if (!m_View->IsExtendedElevation())
1274                m_View->RotateSlower(e.GetModifiers() == wxMOD_SHIFT);
1275            break;
1276        case 'R': case 'r':
1277            if (!m_View->IsExtendedElevation())
1278                OnReverseDirectionOfRotation();
1279            break;
1280        case 'P': case 'p':
1281            if (!m_View->IsExtendedElevation() && !m_View->ShowingPlan())
1282                OnPlan();
1283            break;
1284        case 'L': case 'l':
1285            if (!m_View->IsExtendedElevation() && !m_View->ShowingElevation())
1286                OnElevation();
1287            break;
1288        case 'O': case 'o':
1289            OnDisplayOverlappingNames();
1290            break;
1291        case WXK_DELETE:
1292            if (e.GetModifiers() == 0)
1293                OnDefaults();
1294            break;
1295        case WXK_RETURN:
1296            if (e.GetModifiers() == 0) {
1297                // For compatibility with older versions.
1298                if (!m_View->IsExtendedElevation() && !m_View->IsRotating())
1299                    m_View->StartRotation();
1300            }
1301            break;
1302        case WXK_SPACE:
1303            if (e.GetModifiers() == 0) {
1304                if (!m_View->IsExtendedElevation())
1305                    OnToggleRotation();
1306            }
1307            break;
1308        case WXK_LEFT:
1309            if ((e.GetModifiers() &~ wxMOD_SHIFT) == wxMOD_CONTROL) {
1310                if (!m_View->IsExtendedElevation() && !m_View->IsRotating())
1311                    OnStepOnceAnticlockwise(e.GetModifiers() == wxMOD_SHIFT);
1312            } else {
1313                OnShiftDisplayLeft(e.GetModifiers() == wxMOD_SHIFT);
1314            }
1315            break;
1316        case WXK_RIGHT:
1317            if ((e.GetModifiers() &~ wxMOD_SHIFT) == wxMOD_CONTROL) {
1318                if (!m_View->IsExtendedElevation() && !m_View->IsRotating())
1319                    OnStepOnceClockwise(e.GetModifiers() == wxMOD_SHIFT);
1320            } else {
1321                OnShiftDisplayRight(e.GetModifiers() == wxMOD_SHIFT);
1322            }
1323            break;
1324        case WXK_UP:
1325            if ((e.GetModifiers() &~ wxMOD_SHIFT) == wxMOD_CONTROL) {
1326                if (m_View->CanRaiseViewpoint() && !m_View->IsExtendedElevation())
1327                    OnHigherViewpoint(e.GetModifiers() == wxMOD_SHIFT);
1328            } else {
1329                OnShiftDisplayUp(e.GetModifiers() == wxMOD_SHIFT);
1330            }
1331            break;
1332        case WXK_DOWN:
1333            if ((e.GetModifiers() &~ wxMOD_SHIFT) == wxMOD_CONTROL) {
1334                if (m_View->CanLowerViewpoint() && !m_View->IsExtendedElevation())
1335                    OnLowerViewpoint(e.GetModifiers() == wxMOD_SHIFT);
1336            } else {
1337                OnShiftDisplayDown(e.GetModifiers() == wxMOD_SHIFT);
1338            }
1339            break;
1340        case WXK_ESCAPE:
1341            if (e.GetModifiers() == 0) {
1342                if (m_View->ShowingMeasuringLine()) {
1343                    OnCancelDistLine();
1344                } else if (m_View->IsFullScreen()) {
1345                    // Cancel full-screen mode on "Escape" if it isn't cancelling
1346                    // the measuring line.
1347                    m_View->FullScreenMode();
1348                }
1349            }
1350            break;
1351        case WXK_F2:
1352            if (e.GetModifiers() == 0)
1353                m_View->ToggleFatFinger();
1354            break;
1355        case WXK_F3:
1356            if (e.GetModifiers() == 0)
1357                m_View->ToggleHitTestDebug();
1358            break;
1359        case WXK_F4: {
1360            if (e.GetModifiers() == 0) {
1361                const wxChar * msg;
1362#if wxDEBUG_LEVEL
1363                if (wxTheAssertHandler)
1364                    wxTheAssertHandler = NULL;
1365                else
1366                    wxSetDefaultAssertHandler();
1367                if (wxTheAssertHandler)
1368                    msg = wxT("Assertions enabled");
1369                else
1370                    msg = wxT("Assertions disabled");
1371#else
1372                msg = wxT("wxWidgets was built without assertions");
1373#endif
1374                wxMessageBox(msg, wxT("Aven Debug"), wxOK | wxICON_INFORMATION);
1375            }
1376            break;
1377        }
1378        case WXK_F5:
1379            if (e.GetModifiers() == 0) {
1380                m_View->InvalidateAllLists();
1381                m_View->ForceRefresh();
1382            }
1383            break;
1384        case WXK_F6:
1385            if (e.GetModifiers() == 0)
1386                m_View->ToggleRenderStats();
1387            break;
1388        default:
1389            e.Skip();
1390    }
1391
1392    //if (refresh) m_View->ForceRefresh();
1393}
1394
1395void GUIControl::OnViewFullScreenUpdate(wxUpdateUIEvent& cmd)
1396{
1397    cmd.Check(m_View->IsFullScreen());
1398}
1399
1400void GUIControl::OnViewFullScreen()
1401{
1402    m_View->FullScreenMode();
1403}
1404
1405void GUIControl::OnViewBoundingBoxUpdate(wxUpdateUIEvent& cmd)
1406{
1407    cmd.Enable(m_View->HasData());
1408    cmd.Check(m_View->DisplayingBoundingBox());
1409}
1410
1411void GUIControl::OnViewBoundingBox()
1412{
1413    m_View->ToggleBoundingBox();
1414}
1415
1416void GUIControl::OnViewTerrainUpdate(wxUpdateUIEvent& cmd)
1417{
1418    cmd.Enable(m_View->HasTerrain());
1419    cmd.Check(m_View->DisplayingTerrain());
1420}
1421
1422void GUIControl::OnViewTerrain()
1423{
1424    m_View->ToggleTerrain();
1425}
Note: See TracBrowser for help on using the repository browser.