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