| 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 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 |
|
|---|
| 32 | const int DISPLAY_SHIFT = 10;
|
|---|
| 33 | const double FLYFREE_SHIFT = 0.2;
|
|---|
| 34 | const double ROTATE_STEP = 2.0;
|
|---|
| 35 |
|
|---|
| 36 | GUIControl::GUIControl()
|
|---|
| 37 | : dragging(NO_DRAG)
|
|---|
| 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 |
|
|---|
| 49 | bool GUIControl::MouseDown() const
|
|---|
| 50 | {
|
|---|
| 51 | return (dragging != NO_DRAG);
|
|---|
| 52 | }
|
|---|
| 53 |
|
|---|
| 54 | void 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 |
|
|---|
| 72 | void 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 |
|
|---|
| 95 | void 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 |
|
|---|
| 166 | void 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 |
|
|---|
| 192 | void 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 |
|
|---|
| 216 | void 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 |
|
|---|
| 225 | void 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 |
|
|---|
| 253 | void 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 |
|
|---|
| 328 | void 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 |
|
|---|
| 365 | void GUIControl::OnLButtonUp(wxMouseEvent& event)
|
|---|
| 366 | {
|
|---|
| 367 | if (m_View->HasData()) {
|
|---|
| 368 | if (dragging != LEFT_DRAG)
|
|---|
| 369 | return;
|
|---|
| 370 |
|
|---|
| 371 | if (event.GetPosition() == m_DragRealStart) {
|
|---|
| 372 | // Just a "click"...
|
|---|
| 373 | m_View->CheckHitTestGrid(m_DragStart, true);
|
|---|
| 374 | }
|
|---|
| 375 |
|
|---|
| 376 | if (event.MiddleIsDown()) {
|
|---|
| 377 | if (m_LastDrag == drag_ZOOM)
|
|---|
| 378 | m_View->UnsetZoomBox();
|
|---|
| 379 | OnMButtonDown(event);
|
|---|
| 380 | return;
|
|---|
| 381 | }
|
|---|
| 382 |
|
|---|
| 383 | if (event.RightIsDown()) {
|
|---|
| 384 | if (m_LastDrag == drag_ZOOM)
|
|---|
| 385 | m_View->UnsetZoomBox();
|
|---|
| 386 | OnRButtonDown(event);
|
|---|
| 387 | return;
|
|---|
| 388 | }
|
|---|
| 389 |
|
|---|
| 390 | if (m_LastDrag == drag_ZOOM) {
|
|---|
| 391 | m_View->ZoomBoxGo();
|
|---|
| 392 | }
|
|---|
| 393 |
|
|---|
| 394 | m_View->ReleaseMouse();
|
|---|
| 395 |
|
|---|
| 396 | m_LastDrag = drag_NONE;
|
|---|
| 397 | dragging = NO_DRAG;
|
|---|
| 398 |
|
|---|
| 399 | m_View->DragFinished();
|
|---|
| 400 |
|
|---|
| 401 | if (event.GetPosition() == m_DragRealStart) {
|
|---|
| 402 | RestoreCursor();
|
|---|
| 403 | } else {
|
|---|
| 404 | HandleNonDrag(event.GetPosition());
|
|---|
| 405 | }
|
|---|
| 406 | }
|
|---|
| 407 | }
|
|---|
| 408 |
|
|---|
| 409 | void GUIControl::OnMButtonDown(wxMouseEvent& event)
|
|---|
| 410 | {
|
|---|
| 411 | if (m_View->HasData() && !m_View->IsExtendedElevation()) {
|
|---|
| 412 | m_DragStart = event.GetPosition();
|
|---|
| 413 |
|
|---|
| 414 | m_View->UpdateCursor(GfxCore::CURSOR_ROTATE_VERTICALLY);
|
|---|
| 415 |
|
|---|
| 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 | }
|
|---|
| 423 | m_View->CaptureMouse();
|
|---|
| 424 | dragging = MIDDLE_DRAG;
|
|---|
| 425 | }
|
|---|
| 426 | }
|
|---|
| 427 |
|
|---|
| 428 | void GUIControl::OnMButtonUp(wxMouseEvent& event)
|
|---|
| 429 | {
|
|---|
| 430 | if (m_View->HasData()) {
|
|---|
| 431 | if (dragging != MIDDLE_DRAG)
|
|---|
| 432 | return;
|
|---|
| 433 |
|
|---|
| 434 | if (event.LeftIsDown()) {
|
|---|
| 435 | OnLButtonDown(event);
|
|---|
| 436 | return;
|
|---|
| 437 | }
|
|---|
| 438 |
|
|---|
| 439 | if (event.RightIsDown()) {
|
|---|
| 440 | OnRButtonDown(event);
|
|---|
| 441 | return;
|
|---|
| 442 | }
|
|---|
| 443 |
|
|---|
| 444 | dragging = NO_DRAG;
|
|---|
| 445 | m_View->ReleaseMouse();
|
|---|
| 446 | m_View->DragFinished();
|
|---|
| 447 |
|
|---|
| 448 | RestoreCursor();
|
|---|
| 449 | }
|
|---|
| 450 | }
|
|---|
| 451 |
|
|---|
| 452 | void GUIControl::OnRButtonDown(wxMouseEvent& event)
|
|---|
| 453 | {
|
|---|
| 454 | if (m_View->HasData()) {
|
|---|
| 455 | if (m_View->HandleRClick(event.GetPosition()))
|
|---|
| 456 | return;
|
|---|
| 457 |
|
|---|
| 458 | m_DragStart = event.GetPosition();
|
|---|
| 459 |
|
|---|
| 460 | m_View->UpdateCursor(GfxCore::CURSOR_DRAGGING_HAND);
|
|---|
| 461 |
|
|---|
| 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 | }
|
|---|
| 469 | m_View->CaptureMouse();
|
|---|
| 470 | dragging = RIGHT_DRAG;
|
|---|
| 471 | }
|
|---|
| 472 | }
|
|---|
| 473 |
|
|---|
| 474 | void GUIControl::OnRButtonUp(wxMouseEvent& event)
|
|---|
| 475 | {
|
|---|
| 476 | if (dragging != RIGHT_DRAG)
|
|---|
| 477 | return;
|
|---|
| 478 |
|
|---|
| 479 | if (event.LeftIsDown()) {
|
|---|
| 480 | OnLButtonDown(event);
|
|---|
| 481 | return;
|
|---|
| 482 | }
|
|---|
| 483 |
|
|---|
| 484 | if (event.MiddleIsDown()) {
|
|---|
| 485 | OnMButtonDown(event);
|
|---|
| 486 | return;
|
|---|
| 487 | }
|
|---|
| 488 |
|
|---|
| 489 | m_LastDrag = drag_NONE;
|
|---|
| 490 | m_View->ReleaseMouse();
|
|---|
| 491 |
|
|---|
| 492 | dragging = NO_DRAG;
|
|---|
| 493 |
|
|---|
| 494 | RestoreCursor();
|
|---|
| 495 |
|
|---|
| 496 | m_View->DragFinished();
|
|---|
| 497 | }
|
|---|
| 498 |
|
|---|
| 499 | void GUIControl::OnMouseWheel(wxMouseEvent& event) {
|
|---|
| 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));
|
|---|
| 505 | m_View->ForceRefresh();
|
|---|
| 506 | }
|
|---|
| 507 | }
|
|---|
| 508 |
|
|---|
| 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 |
|
|---|
| 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 |
|
|---|
| 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 |
|
|---|
| 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 |
|
|---|
| 547 | void GUIControl::OnColourByDepthUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 548 | {
|
|---|
| 549 | cmd.Enable(m_View->HasData());
|
|---|
| 550 | cmd.Check(m_View->ColouringBy() == COLOUR_BY_DEPTH);
|
|---|
| 551 | }
|
|---|
| 552 |
|
|---|
| 553 | void GUIControl::OnColourByDateUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 554 | {
|
|---|
| 555 | cmd.Enable(m_View->HasData());
|
|---|
| 556 | cmd.Check(m_View->ColouringBy() == COLOUR_BY_DATE);
|
|---|
| 557 | }
|
|---|
| 558 |
|
|---|
| 559 | void GUIControl::OnColourByErrorUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 560 | {
|
|---|
| 561 | cmd.Enable(m_View->HasData());
|
|---|
| 562 | cmd.Check(m_View->ColouringBy() == COLOUR_BY_ERROR);
|
|---|
| 563 | }
|
|---|
| 564 |
|
|---|
| 565 | void GUIControl::OnShowCrosses()
|
|---|
| 566 | {
|
|---|
| 567 | m_View->ToggleCrosses();
|
|---|
| 568 | }
|
|---|
| 569 |
|
|---|
| 570 | void GUIControl::OnShowCrossesUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 571 | {
|
|---|
| 572 | cmd.Enable(m_View->HasData());
|
|---|
| 573 | cmd.Check(m_View->ShowingCrosses());
|
|---|
| 574 | }
|
|---|
| 575 |
|
|---|
| 576 | void GUIControl::OnShowStationNames()
|
|---|
| 577 | {
|
|---|
| 578 | m_View->ToggleStationNames();
|
|---|
| 579 | }
|
|---|
| 580 |
|
|---|
| 581 | void GUIControl::OnShowStationNamesUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 582 | {
|
|---|
| 583 | cmd.Enable(m_View->HasData());
|
|---|
| 584 | cmd.Check(m_View->ShowingStationNames());
|
|---|
| 585 | }
|
|---|
| 586 |
|
|---|
| 587 | void GUIControl::OnShowSurveyLegs()
|
|---|
| 588 | {
|
|---|
| 589 | m_View->ToggleUndergroundLegs();
|
|---|
| 590 | }
|
|---|
| 591 |
|
|---|
| 592 | void GUIControl::OnShowSurveyLegsUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 593 | {
|
|---|
| 594 | cmd.Enable(m_View->HasData() && m_View->HasUndergroundLegs());
|
|---|
| 595 | cmd.Check(m_View->ShowingUndergroundLegs());
|
|---|
| 596 | }
|
|---|
| 597 |
|
|---|
| 598 | void GUIControl::OnHideSplays()
|
|---|
| 599 | {
|
|---|
| 600 | m_View->SetSplaysMode(SPLAYS_HIDE);
|
|---|
| 601 | }
|
|---|
| 602 |
|
|---|
| 603 | void GUIControl::OnShowSplaysNormal()
|
|---|
| 604 | {
|
|---|
| 605 | m_View->SetSplaysMode(SPLAYS_SHOW_NORMAL);
|
|---|
| 606 | }
|
|---|
| 607 |
|
|---|
| 608 | void GUIControl::OnShowSplaysFaded()
|
|---|
| 609 | {
|
|---|
| 610 | m_View->SetSplaysMode(SPLAYS_SHOW_FADED);
|
|---|
| 611 | }
|
|---|
| 612 |
|
|---|
| 613 | void GUIControl::OnSplaysUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 614 | {
|
|---|
| 615 | cmd.Enable(m_View->HasData() && m_View->HasSplays());
|
|---|
| 616 | }
|
|---|
| 617 |
|
|---|
| 618 | void GUIControl::OnHideSplaysUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 619 | {
|
|---|
| 620 | cmd.Enable(m_View->HasData() && m_View->HasSplays());
|
|---|
| 621 | cmd.Check(m_View->ShowingSplaysMode() == SPLAYS_HIDE);
|
|---|
| 622 | }
|
|---|
| 623 |
|
|---|
| 624 | void GUIControl::OnShowSplaysNormalUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 625 | {
|
|---|
| 626 | cmd.Enable(m_View->HasData() && m_View->HasSplays());
|
|---|
| 627 | cmd.Check(m_View->ShowingSplaysMode() == SPLAYS_SHOW_NORMAL);
|
|---|
| 628 | }
|
|---|
| 629 |
|
|---|
| 630 | void GUIControl::OnShowSplaysFadedUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 631 | {
|
|---|
| 632 | cmd.Enable(m_View->HasData() && m_View->HasSplays());
|
|---|
| 633 | cmd.Check(m_View->ShowingSplaysMode() == SPLAYS_SHOW_FADED);
|
|---|
| 634 | }
|
|---|
| 635 |
|
|---|
| 636 | void GUIControl::OnMoveEast()
|
|---|
| 637 | {
|
|---|
| 638 | m_View->TurnCaveTo(90.0);
|
|---|
| 639 | m_View->ForceRefresh();
|
|---|
| 640 | }
|
|---|
| 641 |
|
|---|
| 642 | void GUIControl::OnMoveEastUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 643 | {
|
|---|
| 644 | cmd.Enable(m_View->HasData() && !m_View->IsExtendedElevation() && m_View->GetCompassValue() != 90.0);
|
|---|
| 645 | }
|
|---|
| 646 |
|
|---|
| 647 | void GUIControl::OnMoveNorth()
|
|---|
| 648 | {
|
|---|
| 649 | m_View->TurnCaveTo(0.0);
|
|---|
| 650 | m_View->ForceRefresh();
|
|---|
| 651 | }
|
|---|
| 652 |
|
|---|
| 653 | void GUIControl::OnMoveNorthUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 654 | {
|
|---|
| 655 | cmd.Enable(m_View->HasData() && m_View->GetCompassValue() != 0.0);
|
|---|
| 656 | }
|
|---|
| 657 |
|
|---|
| 658 | void GUIControl::OnMoveSouth()
|
|---|
| 659 | {
|
|---|
| 660 | m_View->TurnCaveTo(180.0);
|
|---|
| 661 | m_View->ForceRefresh();
|
|---|
| 662 | }
|
|---|
| 663 |
|
|---|
| 664 | void GUIControl::OnMoveSouthUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 665 | {
|
|---|
| 666 | cmd.Enable(m_View->HasData() && m_View->GetCompassValue() != 180.0);
|
|---|
| 667 | }
|
|---|
| 668 |
|
|---|
| 669 | void GUIControl::OnMoveWest()
|
|---|
| 670 | {
|
|---|
| 671 | m_View->TurnCaveTo(270.0);
|
|---|
| 672 | m_View->ForceRefresh();
|
|---|
| 673 | }
|
|---|
| 674 |
|
|---|
| 675 | void GUIControl::OnMoveWestUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 676 | {
|
|---|
| 677 | cmd.Enable(m_View->HasData() && !m_View->IsExtendedElevation() && m_View->GetCompassValue() != 270.0);
|
|---|
| 678 | }
|
|---|
| 679 |
|
|---|
| 680 | void GUIControl::OnToggleRotation()
|
|---|
| 681 | {
|
|---|
| 682 | m_View->ToggleRotation();
|
|---|
| 683 | }
|
|---|
| 684 |
|
|---|
| 685 | void GUIControl::OnToggleRotationUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 686 | {
|
|---|
| 687 | cmd.Enable(m_View->HasData() && !m_View->IsExtendedElevation());
|
|---|
| 688 | cmd.Check(m_View->HasData() && m_View->IsRotating());
|
|---|
| 689 | }
|
|---|
| 690 |
|
|---|
| 691 | void GUIControl::OnReverseControls()
|
|---|
| 692 | {
|
|---|
| 693 | m_ReverseControls = !m_ReverseControls;
|
|---|
| 694 | }
|
|---|
| 695 |
|
|---|
| 696 | void GUIControl::OnReverseControlsUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 697 | {
|
|---|
| 698 | cmd.Enable(m_View->HasData());
|
|---|
| 699 | cmd.Check(m_ReverseControls);
|
|---|
| 700 | }
|
|---|
| 701 |
|
|---|
| 702 | void GUIControl::OnReverseDirectionOfRotation()
|
|---|
| 703 | {
|
|---|
| 704 | m_View->ReverseRotation();
|
|---|
| 705 | }
|
|---|
| 706 |
|
|---|
| 707 | void GUIControl::OnReverseDirectionOfRotationUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 708 | {
|
|---|
| 709 | cmd.Enable(m_View->HasData() && !m_View->IsExtendedElevation());
|
|---|
| 710 | }
|
|---|
| 711 |
|
|---|
| 712 | void GUIControl::OnSlowDown(bool accel)
|
|---|
| 713 | {
|
|---|
| 714 | m_View->RotateSlower(accel);
|
|---|
| 715 | }
|
|---|
| 716 |
|
|---|
| 717 | void GUIControl::OnSlowDownUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 718 | {
|
|---|
| 719 | cmd.Enable(m_View->HasData() && !m_View->IsExtendedElevation());
|
|---|
| 720 | }
|
|---|
| 721 |
|
|---|
| 722 | void GUIControl::OnSpeedUp(bool accel)
|
|---|
| 723 | {
|
|---|
| 724 | m_View->RotateFaster(accel);
|
|---|
| 725 | }
|
|---|
| 726 |
|
|---|
| 727 | void GUIControl::OnSpeedUpUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 728 | {
|
|---|
| 729 | cmd.Enable(m_View->HasData() && !m_View->IsExtendedElevation());
|
|---|
| 730 | }
|
|---|
| 731 |
|
|---|
| 732 | void GUIControl::OnStepOnceAnticlockwise(bool accel)
|
|---|
| 733 | {
|
|---|
| 734 | if (m_View->GetPerspective()) {
|
|---|
| 735 | m_View->TurnCave(accel ? -5.0 * ROTATE_STEP : -ROTATE_STEP);
|
|---|
| 736 | } else {
|
|---|
| 737 | m_View->TurnCave(accel ? 5.0 * ROTATE_STEP : ROTATE_STEP);
|
|---|
| 738 | }
|
|---|
| 739 | m_View->ForceRefresh();
|
|---|
| 740 | }
|
|---|
| 741 |
|
|---|
| 742 | void GUIControl::OnStepOnceAnticlockwiseUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 743 | {
|
|---|
| 744 | cmd.Enable(m_View->HasData() && !m_View->IsExtendedElevation() && !m_View->Animating());
|
|---|
| 745 | }
|
|---|
| 746 |
|
|---|
| 747 | void GUIControl::OnStepOnceClockwise(bool accel)
|
|---|
| 748 | {
|
|---|
| 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 | }
|
|---|
| 754 | m_View->ForceRefresh();
|
|---|
| 755 | }
|
|---|
| 756 |
|
|---|
| 757 | void GUIControl::OnStepOnceClockwiseUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 758 | {
|
|---|
| 759 | cmd.Enable(m_View->HasData() && !m_View->IsExtendedElevation() && !m_View->Animating());
|
|---|
| 760 | }
|
|---|
| 761 |
|
|---|
| 762 | void GUIControl::OnDefaults()
|
|---|
| 763 | {
|
|---|
| 764 | m_View->Defaults();
|
|---|
| 765 | }
|
|---|
| 766 |
|
|---|
| 767 | void GUIControl::OnDefaultsUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 768 | {
|
|---|
| 769 | cmd.Enable(m_View->HasData());
|
|---|
| 770 | }
|
|---|
| 771 |
|
|---|
| 772 | void GUIControl::OnElevation()
|
|---|
| 773 | {
|
|---|
| 774 | // Switch to elevation view.
|
|---|
| 775 |
|
|---|
| 776 | m_View->SwitchToElevation();
|
|---|
| 777 | }
|
|---|
| 778 |
|
|---|
| 779 | void GUIControl::OnElevationUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 780 | {
|
|---|
| 781 | cmd.Enable(m_View->HasData() && !m_View->IsExtendedElevation() && !m_View->ShowingElevation());
|
|---|
| 782 | }
|
|---|
| 783 |
|
|---|
| 784 | void GUIControl::OnHigherViewpoint(bool accel)
|
|---|
| 785 | {
|
|---|
| 786 | // Raise the viewpoint.
|
|---|
| 787 | if (m_View->GetPerspective()) {
|
|---|
| 788 | m_View->TiltCave(accel ? 5.0 * ROTATE_STEP : ROTATE_STEP);
|
|---|
| 789 | } else {
|
|---|
| 790 | m_View->TiltCave(accel ? -5.0 * ROTATE_STEP : -ROTATE_STEP);
|
|---|
| 791 | }
|
|---|
| 792 | m_View->ForceRefresh();
|
|---|
| 793 | }
|
|---|
| 794 |
|
|---|
| 795 | void GUIControl::OnHigherViewpointUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 796 | {
|
|---|
| 797 | cmd.Enable(m_View->HasData() && m_View->CanRaiseViewpoint() && !m_View->IsExtendedElevation());
|
|---|
| 798 | }
|
|---|
| 799 |
|
|---|
| 800 | void GUIControl::OnLowerViewpoint(bool accel)
|
|---|
| 801 | {
|
|---|
| 802 | // Lower the viewpoint.
|
|---|
| 803 | if (m_View->GetPerspective()) {
|
|---|
| 804 | m_View->TiltCave(accel ? -5.0 * ROTATE_STEP : -ROTATE_STEP);
|
|---|
| 805 | } else {
|
|---|
| 806 | m_View->TiltCave(accel ? 5.0 * ROTATE_STEP : ROTATE_STEP);
|
|---|
| 807 | }
|
|---|
| 808 | m_View->ForceRefresh();
|
|---|
| 809 | }
|
|---|
| 810 |
|
|---|
| 811 | void GUIControl::OnLowerViewpointUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 812 | {
|
|---|
| 813 | cmd.Enable(m_View->HasData() && m_View->CanLowerViewpoint() && !m_View->IsExtendedElevation());
|
|---|
| 814 | }
|
|---|
| 815 |
|
|---|
| 816 | void GUIControl::OnPlan()
|
|---|
| 817 | {
|
|---|
| 818 | // Switch to plan view.
|
|---|
| 819 | m_View->SwitchToPlan();
|
|---|
| 820 | }
|
|---|
| 821 |
|
|---|
| 822 | void GUIControl::OnPlanUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 823 | {
|
|---|
| 824 | cmd.Enable(m_View->HasData() && !m_View->IsExtendedElevation() && !m_View->ShowingPlan());
|
|---|
| 825 | }
|
|---|
| 826 |
|
|---|
| 827 | void GUIControl::OnShiftDisplayDown(bool accel)
|
|---|
| 828 | {
|
|---|
| 829 | if (m_View->GetPerspective())
|
|---|
| 830 | m_View->MoveViewer(0, accel ? 5 * FLYFREE_SHIFT : FLYFREE_SHIFT, 0);
|
|---|
| 831 | else
|
|---|
| 832 | m_View->TranslateCave(0, accel ? 5 * DISPLAY_SHIFT : DISPLAY_SHIFT);
|
|---|
| 833 | }
|
|---|
| 834 |
|
|---|
| 835 | void GUIControl::OnShiftDisplayDownUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 836 | {
|
|---|
| 837 | cmd.Enable(m_View->HasData());
|
|---|
| 838 | }
|
|---|
| 839 |
|
|---|
| 840 | void GUIControl::OnShiftDisplayLeft(bool accel)
|
|---|
| 841 | {
|
|---|
| 842 | if (m_View->GetPerspective())
|
|---|
| 843 | m_View->MoveViewer(0, 0, accel ? 5 * FLYFREE_SHIFT : FLYFREE_SHIFT);
|
|---|
| 844 | else
|
|---|
| 845 | m_View->TranslateCave(accel ? -5 * DISPLAY_SHIFT : -DISPLAY_SHIFT, 0);
|
|---|
| 846 | }
|
|---|
| 847 |
|
|---|
| 848 | void GUIControl::OnShiftDisplayLeftUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 849 | {
|
|---|
| 850 | cmd.Enable(m_View->HasData());
|
|---|
| 851 | }
|
|---|
| 852 |
|
|---|
| 853 | void GUIControl::OnShiftDisplayRight(bool accel)
|
|---|
| 854 | {
|
|---|
| 855 | if (m_View->GetPerspective())
|
|---|
| 856 | m_View->MoveViewer(0, 0, accel ? -5 * FLYFREE_SHIFT : -FLYFREE_SHIFT);
|
|---|
| 857 | else
|
|---|
| 858 | m_View->TranslateCave(accel ? 5 * DISPLAY_SHIFT : DISPLAY_SHIFT, 0);
|
|---|
| 859 | }
|
|---|
| 860 |
|
|---|
| 861 | void GUIControl::OnShiftDisplayRightUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 862 | {
|
|---|
| 863 | cmd.Enable(m_View->HasData());
|
|---|
| 864 | }
|
|---|
| 865 |
|
|---|
| 866 | void GUIControl::OnShiftDisplayUp(bool accel)
|
|---|
| 867 | {
|
|---|
| 868 | if (m_View->GetPerspective())
|
|---|
| 869 | m_View->MoveViewer(0, accel ? -5 * FLYFREE_SHIFT : -FLYFREE_SHIFT, 0);
|
|---|
| 870 | else
|
|---|
| 871 | m_View->TranslateCave(0, accel ? -5 * DISPLAY_SHIFT : -DISPLAY_SHIFT);
|
|---|
| 872 | }
|
|---|
| 873 |
|
|---|
| 874 | void GUIControl::OnShiftDisplayUpUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 875 | {
|
|---|
| 876 | cmd.Enable(m_View->HasData());
|
|---|
| 877 | }
|
|---|
| 878 |
|
|---|
| 879 | void GUIControl::OnZoomIn(bool accel)
|
|---|
| 880 | {
|
|---|
| 881 | // Increase the scale.
|
|---|
| 882 |
|
|---|
| 883 | if (m_View->GetPerspective()) {
|
|---|
| 884 | m_View->MoveViewer(accel ? 5 * FLYFREE_SHIFT : FLYFREE_SHIFT, 0, 0);
|
|---|
| 885 | } else {
|
|---|
| 886 | m_View->SetScale(m_View->GetScale() * (accel ? 1.1236 : 1.06));
|
|---|
| 887 | m_View->ForceRefresh();
|
|---|
| 888 | }
|
|---|
| 889 | }
|
|---|
| 890 |
|
|---|
| 891 | void GUIControl::OnZoomInUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 892 | {
|
|---|
| 893 | cmd.Enable(m_View->HasData());
|
|---|
| 894 | }
|
|---|
| 895 |
|
|---|
| 896 | void GUIControl::OnZoomOut(bool accel)
|
|---|
| 897 | {
|
|---|
| 898 | // Decrease the scale.
|
|---|
| 899 |
|
|---|
| 900 | if (m_View->GetPerspective()) {
|
|---|
| 901 | m_View->MoveViewer(accel ? -5 * FLYFREE_SHIFT : -FLYFREE_SHIFT, 0, 0);
|
|---|
| 902 | } else {
|
|---|
| 903 | m_View->SetScale(m_View->GetScale() / (accel ? 1.1236 : 1.06));
|
|---|
| 904 | m_View->ForceRefresh();
|
|---|
| 905 | }
|
|---|
| 906 | }
|
|---|
| 907 |
|
|---|
| 908 | void GUIControl::OnZoomOutUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 909 | {
|
|---|
| 910 | cmd.Enable(m_View->HasData());
|
|---|
| 911 | }
|
|---|
| 912 |
|
|---|
| 913 | void GUIControl::OnToggleScalebar()
|
|---|
| 914 | {
|
|---|
| 915 | m_View->ToggleScaleBar();
|
|---|
| 916 | }
|
|---|
| 917 |
|
|---|
| 918 | void GUIControl::OnToggleScalebarUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 919 | {
|
|---|
| 920 | cmd.Enable(m_View->HasData());
|
|---|
| 921 | cmd.Check(m_View->ShowingScaleBar());
|
|---|
| 922 | }
|
|---|
| 923 |
|
|---|
| 924 | void GUIControl::OnToggleColourKey()
|
|---|
| 925 | {
|
|---|
| 926 | m_View->ToggleColourKey();
|
|---|
| 927 | }
|
|---|
| 928 |
|
|---|
| 929 | void GUIControl::OnToggleColourKeyUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 930 | {
|
|---|
| 931 | cmd.Enable(m_View->HasData() && m_View->ColouringBy() != COLOUR_BY_NONE);
|
|---|
| 932 | cmd.Check(m_View->ShowingColourKey());
|
|---|
| 933 | }
|
|---|
| 934 |
|
|---|
| 935 | void GUIControl::OnViewCompass()
|
|---|
| 936 | {
|
|---|
| 937 | m_View->ToggleCompass();
|
|---|
| 938 | }
|
|---|
| 939 |
|
|---|
| 940 | void GUIControl::OnViewCompassUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 941 | {
|
|---|
| 942 | cmd.Enable(m_View->HasData() && !m_View->IsExtendedElevation());
|
|---|
| 943 | cmd.Check(m_View->ShowingCompass());
|
|---|
| 944 | }
|
|---|
| 945 |
|
|---|
| 946 | void GUIControl::OnViewClino()
|
|---|
| 947 | {
|
|---|
| 948 | m_View->ToggleClino();
|
|---|
| 949 | }
|
|---|
| 950 |
|
|---|
| 951 | void GUIControl::OnViewClinoUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 952 | {
|
|---|
| 953 | cmd.Enable(m_View->HasData() && !m_View->IsExtendedElevation());
|
|---|
| 954 | cmd.Check(m_View->ShowingClino());
|
|---|
| 955 | }
|
|---|
| 956 |
|
|---|
| 957 | void GUIControl::OnShowSurface()
|
|---|
| 958 | {
|
|---|
| 959 | m_View->ToggleSurfaceLegs();
|
|---|
| 960 | }
|
|---|
| 961 |
|
|---|
| 962 | void GUIControl::OnShowSurfaceUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 963 | {
|
|---|
| 964 | cmd.Enable(m_View->HasData() && m_View->HasSurfaceLegs());
|
|---|
| 965 | cmd.Check(m_View->ShowingSurfaceLegs());
|
|---|
| 966 | }
|
|---|
| 967 |
|
|---|
| 968 | void GUIControl::OnShowEntrances()
|
|---|
| 969 | {
|
|---|
| 970 | m_View->ToggleEntrances();
|
|---|
| 971 | }
|
|---|
| 972 |
|
|---|
| 973 | void GUIControl::OnShowEntrancesUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 974 | {
|
|---|
| 975 | cmd.Enable(m_View->HasData() && (m_View->GetNumEntrances() > 0));
|
|---|
| 976 | cmd.Check(m_View->ShowingEntrances());
|
|---|
| 977 | }
|
|---|
| 978 |
|
|---|
| 979 | void GUIControl::OnShowFixedPts()
|
|---|
| 980 | {
|
|---|
| 981 | m_View->ToggleFixedPts();
|
|---|
| 982 | }
|
|---|
| 983 |
|
|---|
| 984 | void GUIControl::OnShowFixedPtsUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 985 | {
|
|---|
| 986 | cmd.Enable(m_View->HasData() && (m_View->GetNumFixedPts() > 0));
|
|---|
| 987 | cmd.Check(m_View->ShowingFixedPts());
|
|---|
| 988 | }
|
|---|
| 989 |
|
|---|
| 990 | void GUIControl::OnShowExportedPts()
|
|---|
| 991 | {
|
|---|
| 992 | m_View->ToggleExportedPts();
|
|---|
| 993 | }
|
|---|
| 994 |
|
|---|
| 995 | void GUIControl::OnShowExportedPtsUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 996 | {
|
|---|
| 997 | cmd.Enable(m_View->HasData() && (m_View->GetNumExportedPts() > 0));
|
|---|
| 998 | cmd.Check(m_View->ShowingExportedPts());
|
|---|
| 999 | }
|
|---|
| 1000 |
|
|---|
| 1001 | void GUIControl::OnViewGrid()
|
|---|
| 1002 | {
|
|---|
| 1003 | m_View->ToggleGrid();
|
|---|
| 1004 | }
|
|---|
| 1005 |
|
|---|
| 1006 | void GUIControl::OnViewGridUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 1007 | {
|
|---|
| 1008 | cmd.Enable(m_View->HasData());
|
|---|
| 1009 | cmd.Check(m_View->ShowingGrid());
|
|---|
| 1010 | }
|
|---|
| 1011 |
|
|---|
| 1012 | void GUIControl::OnIndicatorsUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 1013 | {
|
|---|
| 1014 | cmd.Enable(m_View->HasData());
|
|---|
| 1015 | }
|
|---|
| 1016 |
|
|---|
| 1017 | void GUIControl::OnViewPerspective()
|
|---|
| 1018 | {
|
|---|
| 1019 | m_View->TogglePerspective();
|
|---|
| 1020 | // Force update of coordinate display.
|
|---|
| 1021 | if (m_View->GetPerspective()) {
|
|---|
| 1022 | m_View->MoveViewer(0, 0, 0);
|
|---|
| 1023 | } else {
|
|---|
| 1024 | m_View->ClearCoords();
|
|---|
| 1025 | }
|
|---|
| 1026 | }
|
|---|
| 1027 |
|
|---|
| 1028 | void GUIControl::OnViewPerspectiveUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 1029 | {
|
|---|
| 1030 | cmd.Enable(m_View->HasData() && !m_View->IsExtendedElevation());
|
|---|
| 1031 | cmd.Check(m_View->GetPerspective());
|
|---|
| 1032 | }
|
|---|
| 1033 |
|
|---|
| 1034 | void GUIControl::OnViewSmoothShading()
|
|---|
| 1035 | {
|
|---|
| 1036 | m_View->ToggleSmoothShading();
|
|---|
| 1037 | }
|
|---|
| 1038 |
|
|---|
| 1039 | void GUIControl::OnViewSmoothShadingUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 1040 | {
|
|---|
| 1041 | cmd.Enable(m_View->HasData());
|
|---|
| 1042 | cmd.Check(m_View->GetSmoothShading());
|
|---|
| 1043 | }
|
|---|
| 1044 |
|
|---|
| 1045 | void GUIControl::OnViewTextured()
|
|---|
| 1046 | {
|
|---|
| 1047 | m_View->ToggleTextured();
|
|---|
| 1048 | }
|
|---|
| 1049 |
|
|---|
| 1050 | void GUIControl::OnViewTexturedUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 1051 | {
|
|---|
| 1052 | cmd.Enable(m_View->HasData());
|
|---|
| 1053 | cmd.Check(m_View->GetTextured());
|
|---|
| 1054 | }
|
|---|
| 1055 |
|
|---|
| 1056 | void GUIControl::OnViewFog()
|
|---|
| 1057 | {
|
|---|
| 1058 | m_View->ToggleFog();
|
|---|
| 1059 | }
|
|---|
| 1060 |
|
|---|
| 1061 | void GUIControl::OnViewFogUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 1062 | {
|
|---|
| 1063 | cmd.Enable(m_View->HasData());
|
|---|
| 1064 | cmd.Check(m_View->GetFog());
|
|---|
| 1065 | }
|
|---|
| 1066 |
|
|---|
| 1067 | void GUIControl::OnViewSmoothLines()
|
|---|
| 1068 | {
|
|---|
| 1069 | m_View->ToggleAntiAlias();
|
|---|
| 1070 | }
|
|---|
| 1071 |
|
|---|
| 1072 | void GUIControl::OnViewSmoothLinesUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 1073 | {
|
|---|
| 1074 | cmd.Enable(m_View->HasData());
|
|---|
| 1075 | cmd.Check(m_View->GetAntiAlias());
|
|---|
| 1076 | }
|
|---|
| 1077 |
|
|---|
| 1078 | void GUIControl::OnToggleMetric()
|
|---|
| 1079 | {
|
|---|
| 1080 | m_View->ToggleMetric();
|
|---|
| 1081 |
|
|---|
| 1082 | wxConfigBase::Get()->Write(wxT("metric"), m_View->GetMetric());
|
|---|
| 1083 | wxConfigBase::Get()->Flush();
|
|---|
| 1084 | }
|
|---|
| 1085 |
|
|---|
| 1086 | void GUIControl::OnToggleMetricUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 1087 | {
|
|---|
| 1088 | cmd.Enable(m_View->HasData());
|
|---|
| 1089 | cmd.Check(m_View->GetMetric());
|
|---|
| 1090 | }
|
|---|
| 1091 |
|
|---|
| 1092 | void GUIControl::OnToggleDegrees()
|
|---|
| 1093 | {
|
|---|
| 1094 | m_View->ToggleDegrees();
|
|---|
| 1095 |
|
|---|
| 1096 | wxConfigBase::Get()->Write(wxT("degrees"), m_View->GetDegrees());
|
|---|
| 1097 | wxConfigBase::Get()->Flush();
|
|---|
| 1098 | }
|
|---|
| 1099 |
|
|---|
| 1100 | void GUIControl::OnToggleDegreesUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 1101 | {
|
|---|
| 1102 | cmd.Enable(m_View->HasData());
|
|---|
| 1103 | cmd.Check(m_View->GetDegrees());
|
|---|
| 1104 | }
|
|---|
| 1105 |
|
|---|
| 1106 | void GUIControl::OnTogglePercent()
|
|---|
| 1107 | {
|
|---|
| 1108 | m_View->TogglePercent();
|
|---|
| 1109 |
|
|---|
| 1110 | wxConfigBase::Get()->Write(wxT("percent"), m_View->GetPercent());
|
|---|
| 1111 | wxConfigBase::Get()->Flush();
|
|---|
| 1112 | }
|
|---|
| 1113 |
|
|---|
| 1114 | void GUIControl::OnTogglePercentUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 1115 | {
|
|---|
| 1116 | cmd.Enable(m_View->HasData());
|
|---|
| 1117 | cmd.Check(m_View->GetPercent());
|
|---|
| 1118 | }
|
|---|
| 1119 |
|
|---|
| 1120 | void GUIControl::OnToggleTubes()
|
|---|
| 1121 | {
|
|---|
| 1122 | m_View->ToggleTubes();
|
|---|
| 1123 | }
|
|---|
| 1124 |
|
|---|
| 1125 | void GUIControl::OnToggleTubesUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 1126 | {
|
|---|
| 1127 | cmd.Enable(m_View->HasData() && m_View->HasTubes());
|
|---|
| 1128 | cmd.Check(m_View->GetTubes());
|
|---|
| 1129 | }
|
|---|
| 1130 |
|
|---|
| 1131 | void GUIControl::OnCancelDistLine()
|
|---|
| 1132 | {
|
|---|
| 1133 | m_View->ClearTreeSelection();
|
|---|
| 1134 | }
|
|---|
| 1135 |
|
|---|
| 1136 | void GUIControl::OnCancelDistLineUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 1137 | {
|
|---|
| 1138 | cmd.Enable(m_View->ShowingMeasuringLine());
|
|---|
| 1139 | }
|
|---|
| 1140 |
|
|---|
| 1141 | void GUIControl::OnKeyPress(wxKeyEvent &e)
|
|---|
| 1142 | {
|
|---|
| 1143 | if (!m_View->HasData()) {
|
|---|
| 1144 | e.Skip();
|
|---|
| 1145 | return;
|
|---|
| 1146 | }
|
|---|
| 1147 |
|
|---|
| 1148 | // The changelog says this is meant to keep animation going while keys are
|
|---|
| 1149 | // pressed, but that happens anyway (on linux at least - perhaps it helps
|
|---|
| 1150 | // on windows?) FIXME : check!
|
|---|
| 1151 | //bool refresh = m_View->Animate();
|
|---|
| 1152 |
|
|---|
| 1153 | switch (e.GetKeyCode()) {
|
|---|
| 1154 | case '/': case '?':
|
|---|
| 1155 | if (m_View->CanLowerViewpoint() && !m_View->IsExtendedElevation())
|
|---|
| 1156 | OnLowerViewpoint(e.GetModifiers() == wxMOD_SHIFT);
|
|---|
| 1157 | break;
|
|---|
| 1158 | case '\'': case '@': case '"': // both shifted forms - US and UK kbd
|
|---|
| 1159 | if (m_View->CanRaiseViewpoint() && !m_View->IsExtendedElevation())
|
|---|
| 1160 | OnHigherViewpoint(e.GetModifiers() == wxMOD_SHIFT);
|
|---|
| 1161 | break;
|
|---|
| 1162 | case 'C': case 'c':
|
|---|
| 1163 | if (!m_View->IsExtendedElevation() && !m_View->IsRotating())
|
|---|
| 1164 | OnStepOnceAnticlockwise(e.GetModifiers() == wxMOD_SHIFT);
|
|---|
| 1165 | break;
|
|---|
| 1166 | case 'V': case 'v':
|
|---|
| 1167 | if (!m_View->IsExtendedElevation() && !m_View->IsRotating())
|
|---|
| 1168 | OnStepOnceClockwise(e.GetModifiers() == wxMOD_SHIFT);
|
|---|
| 1169 | break;
|
|---|
| 1170 | case ']': case '}':
|
|---|
| 1171 | OnZoomIn(e.GetModifiers() == wxMOD_SHIFT);
|
|---|
| 1172 | break;
|
|---|
| 1173 | case '[': case '{':
|
|---|
| 1174 | OnZoomOut(e.GetModifiers() == wxMOD_SHIFT);
|
|---|
| 1175 | break;
|
|---|
| 1176 | case 'N': case 'n':
|
|---|
| 1177 | OnMoveNorth();
|
|---|
| 1178 | break;
|
|---|
| 1179 | case 'S': case 's':
|
|---|
| 1180 | OnMoveSouth();
|
|---|
| 1181 | break;
|
|---|
| 1182 | case 'E': case 'e':
|
|---|
| 1183 | if (!m_View->IsExtendedElevation())
|
|---|
| 1184 | OnMoveEast();
|
|---|
| 1185 | break;
|
|---|
| 1186 | case 'W': case 'w':
|
|---|
| 1187 | if (!m_View->IsExtendedElevation())
|
|---|
| 1188 | OnMoveWest();
|
|---|
| 1189 | break;
|
|---|
| 1190 | case 'Z': case 'z':
|
|---|
| 1191 | if (!m_View->IsExtendedElevation())
|
|---|
| 1192 | OnSpeedUp(e.GetModifiers() == wxMOD_SHIFT);
|
|---|
| 1193 | break;
|
|---|
| 1194 | case 'X': case 'x':
|
|---|
| 1195 | if (!m_View->IsExtendedElevation())
|
|---|
| 1196 | OnSlowDown(e.GetModifiers() == wxMOD_SHIFT);
|
|---|
| 1197 | break;
|
|---|
| 1198 | case 'R': case 'r':
|
|---|
| 1199 | if (!m_View->IsExtendedElevation())
|
|---|
| 1200 | OnReverseDirectionOfRotation();
|
|---|
| 1201 | break;
|
|---|
| 1202 | case 'P': case 'p':
|
|---|
| 1203 | if (!m_View->IsExtendedElevation() && !m_View->ShowingPlan())
|
|---|
| 1204 | OnPlan();
|
|---|
| 1205 | break;
|
|---|
| 1206 | case 'L': case 'l':
|
|---|
| 1207 | if (!m_View->IsExtendedElevation() && !m_View->ShowingElevation())
|
|---|
| 1208 | OnElevation();
|
|---|
| 1209 | break;
|
|---|
| 1210 | case 'O': case 'o':
|
|---|
| 1211 | OnDisplayOverlappingNames();
|
|---|
| 1212 | break;
|
|---|
| 1213 | case WXK_DELETE:
|
|---|
| 1214 | OnDefaults();
|
|---|
| 1215 | break;
|
|---|
| 1216 | case WXK_RETURN:
|
|---|
| 1217 | // For compatibility with older versions.
|
|---|
| 1218 | if (!m_View->IsExtendedElevation() && !m_View->IsRotating())
|
|---|
| 1219 | m_View->StartRotation();
|
|---|
| 1220 | break;
|
|---|
| 1221 | case WXK_SPACE:
|
|---|
| 1222 | if (!m_View->IsExtendedElevation())
|
|---|
| 1223 | OnToggleRotation();
|
|---|
| 1224 | break;
|
|---|
| 1225 | case WXK_LEFT:
|
|---|
| 1226 | if ((e.GetModifiers() &~ wxMOD_SHIFT) == wxMOD_CONTROL) {
|
|---|
| 1227 | if (!m_View->IsExtendedElevation() && !m_View->IsRotating())
|
|---|
| 1228 | OnStepOnceAnticlockwise(e.GetModifiers() == wxMOD_SHIFT);
|
|---|
| 1229 | } else {
|
|---|
| 1230 | OnShiftDisplayLeft(e.GetModifiers() == wxMOD_SHIFT);
|
|---|
| 1231 | }
|
|---|
| 1232 | break;
|
|---|
| 1233 | case WXK_RIGHT:
|
|---|
| 1234 | if ((e.GetModifiers() &~ wxMOD_SHIFT) == wxMOD_CONTROL) {
|
|---|
| 1235 | if (!m_View->IsExtendedElevation() && !m_View->IsRotating())
|
|---|
| 1236 | OnStepOnceClockwise(e.GetModifiers() == wxMOD_SHIFT);
|
|---|
| 1237 | } else {
|
|---|
| 1238 | OnShiftDisplayRight(e.GetModifiers() == wxMOD_SHIFT);
|
|---|
| 1239 | }
|
|---|
| 1240 | break;
|
|---|
| 1241 | case WXK_UP:
|
|---|
| 1242 | if ((e.GetModifiers() &~ wxMOD_SHIFT) == wxMOD_CONTROL) {
|
|---|
| 1243 | if (m_View->CanRaiseViewpoint() && !m_View->IsExtendedElevation())
|
|---|
| 1244 | OnHigherViewpoint(e.GetModifiers() == wxMOD_SHIFT);
|
|---|
| 1245 | } else {
|
|---|
| 1246 | OnShiftDisplayUp(e.GetModifiers() == wxMOD_SHIFT);
|
|---|
| 1247 | }
|
|---|
| 1248 | break;
|
|---|
| 1249 | case WXK_DOWN:
|
|---|
| 1250 | if ((e.GetModifiers() &~ wxMOD_SHIFT) == wxMOD_CONTROL) {
|
|---|
| 1251 | if (m_View->CanLowerViewpoint() && !m_View->IsExtendedElevation())
|
|---|
| 1252 | OnLowerViewpoint(e.GetModifiers() == wxMOD_SHIFT);
|
|---|
| 1253 | } else {
|
|---|
| 1254 | OnShiftDisplayDown(e.GetModifiers() == wxMOD_SHIFT);
|
|---|
| 1255 | }
|
|---|
| 1256 | break;
|
|---|
| 1257 | case WXK_ESCAPE:
|
|---|
| 1258 | if (m_View->ShowingMeasuringLine()) {
|
|---|
| 1259 | OnCancelDistLine();
|
|---|
| 1260 | }
|
|---|
| 1261 | break;
|
|---|
| 1262 | case WXK_F2:
|
|---|
| 1263 | m_View->ToggleFatFinger();
|
|---|
| 1264 | break;
|
|---|
| 1265 | case WXK_F3:
|
|---|
| 1266 | m_View->ToggleHitTestDebug();
|
|---|
| 1267 | break;
|
|---|
| 1268 | case WXK_F4:
|
|---|
| 1269 | #if wxDEBUG_LEVEL
|
|---|
| 1270 | if (wxTheAssertHandler)
|
|---|
| 1271 | wxTheAssertHandler = NULL;
|
|---|
| 1272 | else
|
|---|
| 1273 | wxSetDefaultAssertHandler();
|
|---|
| 1274 | wxMessageBox(wxTheAssertHandler ? "Assertions enabled" : "Assertions disabled", "Aven Debug", wxOK | wxICON_INFORMATION);
|
|---|
| 1275 | #else
|
|---|
| 1276 | wxMessageBox("wxWidgets was built without assertions", "Aven Debug", wxOK | wxICON_INFORMATION);
|
|---|
| 1277 | #endif
|
|---|
| 1278 | break;
|
|---|
| 1279 | case WXK_F5:
|
|---|
| 1280 | m_View->InvalidateAllLists();
|
|---|
| 1281 | m_View->ForceRefresh();
|
|---|
| 1282 | break;
|
|---|
| 1283 | default:
|
|---|
| 1284 | e.Skip();
|
|---|
| 1285 | }
|
|---|
| 1286 |
|
|---|
| 1287 | //if (refresh) m_View->ForceRefresh();
|
|---|
| 1288 | }
|
|---|
| 1289 |
|
|---|
| 1290 | void GUIControl::OnViewFullScreenUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 1291 | {
|
|---|
| 1292 | cmd.Check(m_View->IsFullScreen());
|
|---|
| 1293 | }
|
|---|
| 1294 |
|
|---|
| 1295 | void GUIControl::OnViewFullScreen()
|
|---|
| 1296 | {
|
|---|
| 1297 | m_View->FullScreenMode();
|
|---|
| 1298 | }
|
|---|
| 1299 |
|
|---|
| 1300 | void GUIControl::OnViewBoundingBoxUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 1301 | {
|
|---|
| 1302 | cmd.Enable(m_View->HasData());
|
|---|
| 1303 | cmd.Check(m_View->DisplayingBoundingBox());
|
|---|
| 1304 | }
|
|---|
| 1305 |
|
|---|
| 1306 | void GUIControl::OnViewBoundingBox()
|
|---|
| 1307 | {
|
|---|
| 1308 | m_View->ToggleBoundingBox();
|
|---|
| 1309 | }
|
|---|