| 1 | //
|
|---|
| 2 | // guicontrol.cc
|
|---|
| 3 | //
|
|---|
| 4 | // Handlers for events relating to the display of a survey.
|
|---|
| 5 | //
|
|---|
| 6 | // Copyright (C) 2000-2002 Mark R. Shinwell
|
|---|
| 7 | // Copyright (C) 2001-2003 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 | static const int DISPLAY_SHIFT = 50;
|
|---|
| 33 |
|
|---|
| 34 | GUIControl::GUIControl()
|
|---|
| 35 | {
|
|---|
| 36 | m_View = NULL;
|
|---|
| 37 | m_DraggingLeft = false;
|
|---|
| 38 | m_DraggingMiddle = false;
|
|---|
| 39 | m_DraggingRight = false;
|
|---|
| 40 | m_ReverseControls = false;
|
|---|
| 41 | m_LastDrag = drag_NONE;
|
|---|
| 42 | }
|
|---|
| 43 |
|
|---|
| 44 | GUIControl::~GUIControl()
|
|---|
| 45 | {
|
|---|
| 46 | // no action
|
|---|
| 47 | }
|
|---|
| 48 |
|
|---|
| 49 | void GUIControl::SetView(GfxCore* view)
|
|---|
| 50 | {
|
|---|
| 51 | m_View = view;
|
|---|
| 52 | }
|
|---|
| 53 |
|
|---|
| 54 | bool GUIControl::MouseDown()
|
|---|
| 55 | {
|
|---|
| 56 | return m_DraggingLeft || m_DraggingMiddle || m_DraggingRight;
|
|---|
| 57 | }
|
|---|
| 58 |
|
|---|
| 59 | void GUIControl::HandleTilt(wxPoint point)
|
|---|
| 60 | {
|
|---|
| 61 | // Handle a mouse movement during tilt mode.
|
|---|
| 62 | int dy = point.y - m_DragStart.y;
|
|---|
| 63 |
|
|---|
| 64 | if (m_ReverseControls) dy = -dy;
|
|---|
| 65 |
|
|---|
| 66 | m_View->TiltCave(Double(-dy) * M_PI / 500.0);
|
|---|
| 67 |
|
|---|
| 68 | m_DragStart = point;
|
|---|
| 69 |
|
|---|
| 70 | m_View->ForceRefresh();
|
|---|
| 71 | }
|
|---|
| 72 |
|
|---|
| 73 | void GUIControl::HandleTranslate(wxPoint point)
|
|---|
| 74 | {
|
|---|
| 75 | // Handle a mouse movement during translation mode.
|
|---|
| 76 | int dx = point.x - m_DragStart.x;
|
|---|
| 77 | int dy = point.y - m_DragStart.y;
|
|---|
| 78 |
|
|---|
| 79 | if (m_ReverseControls) {
|
|---|
| 80 | dx = -dx;
|
|---|
| 81 | dy = -dy;
|
|---|
| 82 | }
|
|---|
| 83 |
|
|---|
| 84 | #ifndef FLYFREE
|
|---|
| 85 | m_View->TranslateCave(dx, dy);
|
|---|
| 86 | #else
|
|---|
| 87 | m_View->MoveViewer(0, dy, dx);
|
|---|
| 88 | #endif
|
|---|
| 89 | m_DragStart = point;
|
|---|
| 90 | }
|
|---|
| 91 |
|
|---|
| 92 | void GUIControl::HandleScale(wxPoint point)
|
|---|
| 93 | {
|
|---|
| 94 | // Handle a mouse movement during scale mode.
|
|---|
| 95 |
|
|---|
| 96 | int dx = point.x - m_DragStart.x;
|
|---|
| 97 | int dy = point.y - m_DragStart.y;
|
|---|
| 98 |
|
|---|
| 99 | if (m_ReverseControls) {
|
|---|
| 100 | dx = -dx;
|
|---|
| 101 | dy = -dy;
|
|---|
| 102 | }
|
|---|
| 103 |
|
|---|
| 104 | #ifndef FLYFREE
|
|---|
| 105 | m_View->SetScale(m_View->GetScale() * pow(1.06, 0.08 * dy));
|
|---|
| 106 | m_View->ForceRefresh();
|
|---|
| 107 | #else
|
|---|
| 108 | m_View->MoveViewer(dy, 0, 0);
|
|---|
| 109 | #endif
|
|---|
| 110 |
|
|---|
| 111 | m_DragStart = point;
|
|---|
| 112 | }
|
|---|
| 113 |
|
|---|
| 114 | void GUIControl::HandleTiltRotate(wxPoint point)
|
|---|
| 115 | {
|
|---|
| 116 | // Handle a mouse movement during tilt/rotate mode.
|
|---|
| 117 |
|
|---|
| 118 | int dx = point.x - m_DragStart.x;
|
|---|
| 119 | int dy = point.y - m_DragStart.y;
|
|---|
| 120 |
|
|---|
| 121 | if (m_ReverseControls) {
|
|---|
| 122 | dx = -dx;
|
|---|
| 123 | dy = -dy;
|
|---|
| 124 | }
|
|---|
| 125 |
|
|---|
| 126 | // left/right => rotate, up/down => tilt
|
|---|
| 127 | m_View->TurnCave(m_View->CanRotate() ?
|
|---|
| 128 | (Double(dx) * (M_PI / -500.0)) : 0.0);
|
|---|
| 129 | m_View->TiltCave(Double(-dy) * M_PI / 1000.0);
|
|---|
| 130 |
|
|---|
| 131 | m_View->ForceRefresh();
|
|---|
| 132 |
|
|---|
| 133 | m_DragStart = point;
|
|---|
| 134 | }
|
|---|
| 135 |
|
|---|
| 136 | void GUIControl::HandleScaleRotate(wxPoint point)
|
|---|
| 137 | {
|
|---|
| 138 | // Handle a mouse movement during scale/rotate mode.
|
|---|
| 139 | int dx = point.x - m_DragStart.x;
|
|---|
| 140 | int dy = point.y - m_DragStart.y;
|
|---|
| 141 |
|
|---|
| 142 | if (m_ReverseControls) {
|
|---|
| 143 | dx = -dx;
|
|---|
| 144 | dy = -dy;
|
|---|
| 145 | }
|
|---|
| 146 |
|
|---|
| 147 | Double pan_angle = m_View->CanRotate() ? (Double(dx) * (-M_PI / 500.0)) : 0.0;
|
|---|
| 148 |
|
|---|
| 149 | // left/right => rotate, up/down => scale
|
|---|
| 150 | m_View->TurnCave(pan_angle);
|
|---|
| 151 |
|
|---|
| 152 | m_View->SetScale(m_View->GetScale() * pow(1.06, 0.08 * dy));
|
|---|
| 153 |
|
|---|
| 154 | #ifdef AVENGL
|
|---|
| 155 | //glDeleteLists(m_Lists.grid, 1);
|
|---|
| 156 | // DrawGrid();
|
|---|
| 157 | #endif
|
|---|
| 158 | m_View->ForceRefresh();
|
|---|
| 159 |
|
|---|
| 160 | m_DragStart = point;
|
|---|
| 161 | }
|
|---|
| 162 |
|
|---|
| 163 | void GUIControl::HandCursor()
|
|---|
| 164 | {
|
|---|
| 165 | const wxCursor HAND_CURSOR(wxCURSOR_HAND);
|
|---|
| 166 | m_View->SetCursor(HAND_CURSOR);
|
|---|
| 167 | }
|
|---|
| 168 |
|
|---|
| 169 | void GUIControl::RestoreCursor()
|
|---|
| 170 | {
|
|---|
| 171 | if (m_View->ShowingMeasuringLine()) {
|
|---|
| 172 | HandCursor();
|
|---|
| 173 | }
|
|---|
| 174 | else {
|
|---|
| 175 | m_View->SetCursor(wxNullCursor);
|
|---|
| 176 | }
|
|---|
| 177 | }
|
|---|
| 178 |
|
|---|
| 179 | //
|
|---|
| 180 | // Mouse event handling methods
|
|---|
| 181 | //
|
|---|
| 182 |
|
|---|
| 183 | void GUIControl::OnMouseMove(wxMouseEvent& event)
|
|---|
| 184 | {
|
|---|
| 185 | // Mouse motion event handler.
|
|---|
| 186 | if (!m_View->HasData()) return;
|
|---|
| 187 |
|
|---|
| 188 | wxPoint point = wxPoint(event.GetX(), event.GetY());
|
|---|
| 189 |
|
|---|
| 190 | // Check hit-test grid (only if no buttons are pressed).
|
|---|
| 191 | if (!event.LeftIsDown() && !event.MiddleIsDown() && !event.RightIsDown()) {
|
|---|
| 192 | if (m_View->CheckHitTestGrid(point, false)) {
|
|---|
| 193 | HandCursor();
|
|---|
| 194 | }
|
|---|
| 195 | else {
|
|---|
| 196 | if (m_View->ShowingScaleBar() &&
|
|---|
| 197 | m_View->PointWithinScaleBar(point)) {
|
|---|
| 198 |
|
|---|
| 199 | const wxCursor CURSOR(wxCURSOR_SIZEWE);
|
|---|
| 200 | m_View->SetCursor(CURSOR);
|
|---|
| 201 | }
|
|---|
| 202 | else {
|
|---|
| 203 | m_View->SetCursor(wxNullCursor);
|
|---|
| 204 | }
|
|---|
| 205 | }
|
|---|
| 206 | }
|
|---|
| 207 |
|
|---|
| 208 | // Update coordinate display if in plan view,
|
|---|
| 209 | // or altitude if in elevation view.
|
|---|
| 210 | m_View->SetCoords(point);
|
|---|
| 211 |
|
|---|
| 212 | if (!m_View->ChangingOrientation()) {
|
|---|
| 213 | if (m_DraggingLeft) {
|
|---|
| 214 | if (m_LastDrag == drag_NONE) {
|
|---|
| 215 | if (m_View->ShowingCompass() &&
|
|---|
| 216 | m_View->PointWithinCompass(point)) {
|
|---|
| 217 | m_LastDrag = drag_COMPASS;
|
|---|
| 218 | }
|
|---|
| 219 | else if (m_View->ShowingClino() &&
|
|---|
| 220 | m_View->PointWithinClino(point)) {
|
|---|
| 221 | m_LastDrag = drag_ELEV;
|
|---|
| 222 | }
|
|---|
| 223 | else if (m_View->ShowingScaleBar() &&
|
|---|
| 224 | m_View->PointWithinScaleBar(point)) {
|
|---|
| 225 | m_LastDrag = drag_SCALE;
|
|---|
| 226 | }
|
|---|
| 227 | }
|
|---|
| 228 |
|
|---|
| 229 | if (m_LastDrag == drag_COMPASS) {
|
|---|
| 230 | // drag in heading indicator
|
|---|
| 231 | m_View->SetCompassFromPoint(point);
|
|---|
| 232 | }
|
|---|
| 233 | else if (m_LastDrag == drag_ELEV) {
|
|---|
| 234 | // drag in clinometer
|
|---|
| 235 | m_View->SetClinoFromPoint(point);
|
|---|
| 236 | }
|
|---|
| 237 | else if (m_LastDrag == drag_SCALE) {
|
|---|
| 238 | // FIXME: check why there was a check here for x being inside
|
|---|
| 239 | // the window
|
|---|
| 240 | m_View->SetScaleBarFromOffset(point.x - m_DragLast.x);
|
|---|
| 241 | }
|
|---|
| 242 | else if (m_LastDrag == drag_NONE || m_LastDrag == drag_MAIN) {
|
|---|
| 243 | m_LastDrag = drag_MAIN;
|
|---|
| 244 | if (event.ShiftDown()) {
|
|---|
| 245 | HandleScaleRotate(point);
|
|---|
| 246 | }
|
|---|
| 247 | else {
|
|---|
| 248 | HandleTiltRotate(point);
|
|---|
| 249 | }
|
|---|
| 250 | }
|
|---|
| 251 | }
|
|---|
| 252 | else if (m_DraggingMiddle) {
|
|---|
| 253 | if (event.ShiftDown()) {
|
|---|
| 254 | HandleTilt(point);
|
|---|
| 255 | }
|
|---|
| 256 | else {
|
|---|
| 257 | HandleScale(point);
|
|---|
| 258 | }
|
|---|
| 259 | }
|
|---|
| 260 | else if (m_DraggingRight) {
|
|---|
| 261 | if ((m_LastDrag == drag_NONE && m_View->PointWithinScaleBar(point)) || m_LastDrag == drag_SCALE) {
|
|---|
| 262 | /* FIXME
|
|---|
| 263 | if (point.x < 0) point.x = 0;
|
|---|
| 264 | if (point.y < 0) point.y = 0;
|
|---|
| 265 | if (point.x > m_XSize) point.x = m_XSize;
|
|---|
| 266 | if (point.y > m_YSize) point.y = m_YSize;
|
|---|
| 267 | m_LastDrag = drag_SCALE;
|
|---|
| 268 | int x_inside_bar = m_DragStart.x - m_ScaleBar.drag_start_offset_x;
|
|---|
| 269 | int y_inside_bar = m_YSize - m_ScaleBar.drag_start_offset_y - m_DragStart.y;
|
|---|
| 270 | m_ScaleBar.offset_x = point.x - x_inside_bar;
|
|---|
| 271 | m_ScaleBar.offset_y = (m_YSize - point.y) - y_inside_bar;
|
|---|
| 272 | m_View->ForceRefresh(); */
|
|---|
| 273 | }
|
|---|
| 274 | else {
|
|---|
| 275 | m_LastDrag = drag_MAIN;
|
|---|
| 276 | HandleTranslate(point);
|
|---|
| 277 | }
|
|---|
| 278 | }
|
|---|
| 279 | }
|
|---|
| 280 |
|
|---|
| 281 | m_DragLast = point;
|
|---|
| 282 | }
|
|---|
| 283 |
|
|---|
| 284 | void GUIControl::OnLButtonDown(wxMouseEvent& event)
|
|---|
| 285 | {
|
|---|
| 286 | if (m_View->HasData() && m_View->GetLock() != lock_POINT) {
|
|---|
| 287 | m_DraggingLeft = true;
|
|---|
| 288 |
|
|---|
| 289 | /* FIXME
|
|---|
| 290 | m_ScaleBar.drag_start_offset_x = m_ScaleBar.offset_x;
|
|---|
| 291 | m_ScaleBar.drag_start_offset_y = m_ScaleBar.offset_y; */
|
|---|
| 292 |
|
|---|
| 293 | m_DragStart = m_DragRealStart = wxPoint(event.GetX(), event.GetY());
|
|---|
| 294 |
|
|---|
| 295 | // const wxCursor CURSOR(wxCURSOR_MAGNIFIER);
|
|---|
| 296 | // m_View->SetCursor(CURSOR);
|
|---|
| 297 | m_View->CaptureMouse();
|
|---|
| 298 | }
|
|---|
| 299 | }
|
|---|
| 300 |
|
|---|
| 301 | void GUIControl::OnLButtonUp(wxMouseEvent& event)
|
|---|
| 302 | {
|
|---|
| 303 | if (m_View->HasData() && m_View->GetLock() != lock_POINT) {
|
|---|
| 304 | if (event.GetPosition() == m_DragRealStart) {
|
|---|
| 305 | // just a "click"...
|
|---|
| 306 | m_View->CheckHitTestGrid(m_DragStart, true);
|
|---|
| 307 | }
|
|---|
| 308 |
|
|---|
| 309 | // m_View->RedrawIndicators();
|
|---|
| 310 | m_View->ReleaseMouse();
|
|---|
| 311 |
|
|---|
| 312 | m_LastDrag = drag_NONE;
|
|---|
| 313 | m_DraggingLeft = false;
|
|---|
| 314 |
|
|---|
| 315 | m_View->DragFinished();
|
|---|
| 316 |
|
|---|
| 317 | RestoreCursor();
|
|---|
| 318 | }
|
|---|
| 319 | }
|
|---|
| 320 |
|
|---|
| 321 | void GUIControl::OnMButtonDown(wxMouseEvent& event)
|
|---|
| 322 | {
|
|---|
| 323 | if (m_View->HasData() && m_View->GetLock() == lock_NONE) {
|
|---|
| 324 | m_DraggingMiddle = true;
|
|---|
| 325 | m_DragStart = wxPoint(event.GetX(), event.GetY());
|
|---|
| 326 |
|
|---|
| 327 | const wxCursor CURSOR(wxCURSOR_MAGNIFIER);
|
|---|
| 328 | m_View->SetCursor(CURSOR);
|
|---|
| 329 | m_View->CaptureMouse();
|
|---|
| 330 | }
|
|---|
| 331 | }
|
|---|
| 332 |
|
|---|
| 333 | void GUIControl::OnMButtonUp(wxMouseEvent&)
|
|---|
| 334 | {
|
|---|
| 335 | if (m_View->HasData() && m_View->GetLock() == lock_NONE) {
|
|---|
| 336 | m_DraggingMiddle = false;
|
|---|
| 337 | m_View->ReleaseMouse();
|
|---|
| 338 | m_View->DragFinished();
|
|---|
| 339 |
|
|---|
| 340 | RestoreCursor();
|
|---|
| 341 | }
|
|---|
| 342 | }
|
|---|
| 343 |
|
|---|
| 344 | void GUIControl::OnRButtonDown(wxMouseEvent& event)
|
|---|
| 345 | {
|
|---|
| 346 | if (m_View->HasData()) {
|
|---|
| 347 | m_DragStart = wxPoint(event.GetX(), event.GetY());
|
|---|
| 348 |
|
|---|
| 349 | /* FIXME m_ScaleBar.drag_start_offset_x = m_ScaleBar.offset_x;
|
|---|
| 350 | m_ScaleBar.drag_start_offset_y = m_ScaleBar.offset_y; */
|
|---|
| 351 |
|
|---|
| 352 | m_DraggingRight = true;
|
|---|
| 353 |
|
|---|
| 354 | // const wxCursor CURSOR(wxCURSOR_HAND);
|
|---|
| 355 | // m_View->SetCursor(CURSOR);
|
|---|
| 356 | m_View->CaptureMouse();
|
|---|
| 357 | }
|
|---|
| 358 | }
|
|---|
| 359 |
|
|---|
| 360 | void GUIControl::OnRButtonUp(wxMouseEvent&)
|
|---|
| 361 | {
|
|---|
| 362 | m_LastDrag = drag_NONE;
|
|---|
| 363 | m_View->ReleaseMouse();
|
|---|
| 364 |
|
|---|
| 365 | m_DraggingRight = false;
|
|---|
| 366 |
|
|---|
| 367 | RestoreCursor();
|
|---|
| 368 |
|
|---|
| 369 | m_View->DragFinished();
|
|---|
| 370 | }
|
|---|
| 371 |
|
|---|
| 372 | void GUIControl::OnDisplayOverlappingNames()
|
|---|
| 373 | {
|
|---|
| 374 | m_View->ToggleOverlappingNames();
|
|---|
| 375 | }
|
|---|
| 376 |
|
|---|
| 377 | void GUIControl::OnDisplayOverlappingNamesUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 378 | {
|
|---|
| 379 | cmd.Enable(m_View->HasData() && m_View->ShowingStationNames());
|
|---|
| 380 | cmd.Check(m_View->ShowingOverlappingNames());
|
|---|
| 381 | }
|
|---|
| 382 |
|
|---|
| 383 | void GUIControl::OnShowCrosses()
|
|---|
| 384 | {
|
|---|
| 385 | m_View->ToggleCrosses();
|
|---|
| 386 | }
|
|---|
| 387 |
|
|---|
| 388 | void GUIControl::OnShowCrossesUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 389 | {
|
|---|
| 390 | cmd.Enable(m_View->HasData());
|
|---|
| 391 | cmd.Check(m_View->ShowingCrosses());
|
|---|
| 392 | }
|
|---|
| 393 |
|
|---|
| 394 | void GUIControl::OnShowStationNames()
|
|---|
| 395 | {
|
|---|
| 396 | m_View->ToggleStationNames();
|
|---|
| 397 | }
|
|---|
| 398 |
|
|---|
| 399 | void GUIControl::OnShowStationNamesUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 400 | {
|
|---|
| 401 | cmd.Enable(m_View->HasData());
|
|---|
| 402 | cmd.Check(m_View->ShowingStationNames());
|
|---|
| 403 | }
|
|---|
| 404 |
|
|---|
| 405 | void GUIControl::OnShowSurveyLegs()
|
|---|
| 406 | {
|
|---|
| 407 | m_View->ToggleUndergroundLegs();
|
|---|
| 408 | }
|
|---|
| 409 |
|
|---|
| 410 | void GUIControl::OnShowSurveyLegsUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 411 | {
|
|---|
| 412 | cmd.Enable(m_View->HasData() && m_View->GetLock() != lock_POINT && m_View->HasUndergroundLegs());
|
|---|
| 413 | cmd.Check(m_View->ShowingUndergroundLegs());
|
|---|
| 414 | }
|
|---|
| 415 |
|
|---|
| 416 | void GUIControl::OnMoveEast()
|
|---|
| 417 | {
|
|---|
| 418 | m_View->TurnCaveTo(M_PI_2);
|
|---|
| 419 | m_View->ForceRefresh();
|
|---|
| 420 | }
|
|---|
| 421 |
|
|---|
| 422 | void GUIControl::OnMoveEastUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 423 | {
|
|---|
| 424 | cmd.Enable(m_View->HasData() && !(m_View->GetLock() & lock_Y));
|
|---|
| 425 | }
|
|---|
| 426 |
|
|---|
| 427 | void GUIControl::OnMoveNorth()
|
|---|
| 428 | {
|
|---|
| 429 | m_View->TurnCaveTo(0.0);
|
|---|
| 430 | m_View->ForceRefresh();
|
|---|
| 431 | }
|
|---|
| 432 |
|
|---|
| 433 | void GUIControl::OnMoveNorthUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 434 | {
|
|---|
| 435 | cmd.Enable(m_View->HasData() && !(m_View->GetLock() & lock_X));
|
|---|
| 436 | }
|
|---|
| 437 |
|
|---|
| 438 | void GUIControl::OnMoveSouth()
|
|---|
| 439 | {
|
|---|
| 440 | m_View->TurnCaveTo(M_PI);
|
|---|
| 441 | m_View->ForceRefresh();
|
|---|
| 442 | }
|
|---|
| 443 |
|
|---|
| 444 | void GUIControl::OnMoveSouthUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 445 | {
|
|---|
| 446 | cmd.Enable(m_View->HasData() && !(m_View->GetLock() & lock_X));
|
|---|
| 447 | }
|
|---|
| 448 |
|
|---|
| 449 | void GUIControl::OnMoveWest()
|
|---|
| 450 | {
|
|---|
| 451 | m_View->TurnCaveTo(M_PI * 1.5);
|
|---|
| 452 | m_View->ForceRefresh();
|
|---|
| 453 | }
|
|---|
| 454 |
|
|---|
| 455 | void GUIControl::OnMoveWestUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 456 | {
|
|---|
| 457 | cmd.Enable(m_View->HasData() && !(m_View->GetLock() & lock_Y));
|
|---|
| 458 | }
|
|---|
| 459 |
|
|---|
| 460 | void GUIControl::OnStartRotation()
|
|---|
| 461 | {
|
|---|
| 462 | m_View->StartRotation();
|
|---|
| 463 | }
|
|---|
| 464 |
|
|---|
| 465 | void GUIControl::OnStartRotationUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 466 | {
|
|---|
| 467 | cmd.Enable(m_View->HasData() && !m_View->IsRotating() && m_View->CanRotate());
|
|---|
| 468 | }
|
|---|
| 469 |
|
|---|
| 470 | void GUIControl::OnToggleRotation()
|
|---|
| 471 | {
|
|---|
| 472 | m_View->ToggleRotation();
|
|---|
| 473 | }
|
|---|
| 474 |
|
|---|
| 475 | void GUIControl::OnToggleRotationUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 476 | {
|
|---|
| 477 | cmd.Enable(m_View->HasData() && m_View->CanRotate());
|
|---|
| 478 | cmd.Check(m_View->HasData() && m_View->IsRotating());
|
|---|
| 479 | }
|
|---|
| 480 |
|
|---|
| 481 | void GUIControl::OnStopRotation()
|
|---|
| 482 | {
|
|---|
| 483 | m_View->StopRotation();
|
|---|
| 484 | }
|
|---|
| 485 |
|
|---|
| 486 | void GUIControl::OnStopRotationUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 487 | {
|
|---|
| 488 | cmd.Enable(m_View->HasData() && m_View->IsRotating());
|
|---|
| 489 | }
|
|---|
| 490 |
|
|---|
| 491 | void GUIControl::OnReverseControls()
|
|---|
| 492 | {
|
|---|
| 493 | m_ReverseControls = !m_ReverseControls;
|
|---|
| 494 | }
|
|---|
| 495 |
|
|---|
| 496 | void GUIControl::OnReverseControlsUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 497 | {
|
|---|
| 498 | cmd.Enable(m_View->HasData());
|
|---|
| 499 | cmd.Check(m_ReverseControls);
|
|---|
| 500 | }
|
|---|
| 501 |
|
|---|
| 502 | void GUIControl::OnReverseDirectionOfRotation()
|
|---|
| 503 | {
|
|---|
| 504 | m_View->ReverseRotation();
|
|---|
| 505 | }
|
|---|
| 506 |
|
|---|
| 507 | void GUIControl::OnReverseDirectionOfRotationUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 508 | {
|
|---|
| 509 | cmd.Enable(m_View->HasData() && m_View->CanRotate());
|
|---|
| 510 | }
|
|---|
| 511 |
|
|---|
| 512 | void GUIControl::OnSlowDown(bool accel)
|
|---|
| 513 | {
|
|---|
| 514 | m_View->RotateSlower(accel);
|
|---|
| 515 | }
|
|---|
| 516 |
|
|---|
| 517 | void GUIControl::OnSlowDownUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 518 | {
|
|---|
| 519 | cmd.Enable(m_View->HasData() && m_View->CanRotate());
|
|---|
| 520 | }
|
|---|
| 521 |
|
|---|
| 522 | void GUIControl::OnSpeedUp(bool accel)
|
|---|
| 523 | {
|
|---|
| 524 | m_View->RotateFaster(accel);
|
|---|
| 525 | }
|
|---|
| 526 |
|
|---|
| 527 | void GUIControl::OnSpeedUpUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 528 | {
|
|---|
| 529 | cmd.Enable(m_View->HasData() && m_View->CanRotate());
|
|---|
| 530 | }
|
|---|
| 531 |
|
|---|
| 532 | void GUIControl::OnStepOnceAnticlockwise(bool accel)
|
|---|
| 533 | {
|
|---|
| 534 | m_View->TurnCave(accel ? 5.0 * M_PI / 18.0 : M_PI / 18.0);
|
|---|
| 535 | m_View->ForceRefresh();
|
|---|
| 536 | }
|
|---|
| 537 |
|
|---|
| 538 | void GUIControl::OnStepOnceAnticlockwiseUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 539 | {
|
|---|
| 540 | cmd.Enable(m_View->HasData() && m_View->CanRotate() && !m_View->IsRotating());
|
|---|
| 541 | }
|
|---|
| 542 |
|
|---|
| 543 | void GUIControl::OnStepOnceClockwise(bool accel)
|
|---|
| 544 | {
|
|---|
| 545 | m_View->TurnCave(accel ? 5.0 * -M_PI / 18.0 : -M_PI / 18.0);
|
|---|
| 546 | m_View->ForceRefresh();
|
|---|
| 547 | }
|
|---|
| 548 |
|
|---|
| 549 | void GUIControl::OnStepOnceClockwiseUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 550 | {
|
|---|
| 551 | cmd.Enable(m_View->HasData() && m_View->CanRotate() && !m_View->IsRotating());
|
|---|
| 552 | }
|
|---|
| 553 |
|
|---|
| 554 | void GUIControl::OnDefaults()
|
|---|
| 555 | {
|
|---|
| 556 | m_View->Defaults();
|
|---|
| 557 | }
|
|---|
| 558 |
|
|---|
| 559 | void GUIControl::OnDefaultsUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 560 | {
|
|---|
| 561 | cmd.Enable(m_View->HasData());
|
|---|
| 562 | }
|
|---|
| 563 |
|
|---|
| 564 | void GUIControl::OnElevation()
|
|---|
| 565 | {
|
|---|
| 566 | // Switch to elevation view.
|
|---|
| 567 |
|
|---|
| 568 | m_View->SwitchToElevation();
|
|---|
| 569 | }
|
|---|
| 570 |
|
|---|
| 571 | void GUIControl::OnElevationUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 572 | {
|
|---|
| 573 | cmd.Enable(m_View->HasData() && m_View->GetLock() == lock_NONE && !m_View->ShowingElevation());
|
|---|
| 574 | }
|
|---|
| 575 |
|
|---|
| 576 | void GUIControl::OnHigherViewpoint(bool accel)
|
|---|
| 577 | {
|
|---|
| 578 | // Raise the viewpoint.
|
|---|
| 579 | m_View->TiltCave(accel ? 5.0 * M_PI / 18.0 : M_PI / 18.0);
|
|---|
| 580 | m_View->ForceRefresh();
|
|---|
| 581 | }
|
|---|
| 582 |
|
|---|
| 583 | void GUIControl::OnHigherViewpointUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 584 | {
|
|---|
| 585 | cmd.Enable(m_View->HasData() && m_View->CanRaiseViewpoint() && m_View->GetLock() == lock_NONE);
|
|---|
| 586 | }
|
|---|
| 587 |
|
|---|
| 588 | void GUIControl::OnLowerViewpoint(bool accel)
|
|---|
| 589 | {
|
|---|
| 590 | // Lower the viewpoint.
|
|---|
| 591 | m_View->TiltCave(accel ? 5.0 * -M_PI / 18.0 : -M_PI / 18.0);
|
|---|
| 592 | m_View->ForceRefresh(); /* FIXME check if necessary */
|
|---|
| 593 | }
|
|---|
| 594 |
|
|---|
| 595 | void GUIControl::OnLowerViewpointUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 596 | {
|
|---|
| 597 | cmd.Enable(m_View->HasData() && m_View->CanLowerViewpoint() && m_View->GetLock() == lock_NONE);
|
|---|
| 598 | }
|
|---|
| 599 |
|
|---|
| 600 | void GUIControl::OnPlan()
|
|---|
| 601 | {
|
|---|
| 602 | // Switch to plan view.
|
|---|
| 603 | m_View->SwitchToPlan();
|
|---|
| 604 | }
|
|---|
| 605 |
|
|---|
| 606 | void GUIControl::OnPlanUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 607 | {
|
|---|
| 608 | cmd.Enable(m_View->HasData() && m_View->GetLock() == lock_NONE && !m_View->ShowingPlan());
|
|---|
| 609 | }
|
|---|
| 610 |
|
|---|
| 611 | void GUIControl::OnShiftDisplayDown(bool accel)
|
|---|
| 612 | {
|
|---|
| 613 | #ifndef FLYFREE
|
|---|
| 614 | m_View->TranslateCave(0, accel ? 5 * DISPLAY_SHIFT : DISPLAY_SHIFT);
|
|---|
| 615 | #else
|
|---|
| 616 | m_View->MoveViewer(0, accel ? -5.0 : -1.0, 0);
|
|---|
| 617 | #endif
|
|---|
| 618 | }
|
|---|
| 619 |
|
|---|
| 620 | void GUIControl::OnShiftDisplayDownUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 621 | {
|
|---|
| 622 | cmd.Enable(m_View->HasData());
|
|---|
| 623 | }
|
|---|
| 624 |
|
|---|
| 625 | void GUIControl::OnShiftDisplayLeft(bool accel)
|
|---|
| 626 | {
|
|---|
| 627 | #ifndef FLYFREE
|
|---|
| 628 | m_View->TranslateCave(accel ? -5 * DISPLAY_SHIFT : -DISPLAY_SHIFT, 0);
|
|---|
| 629 | #else
|
|---|
| 630 | m_View->MoveViewer(0, 0, accel ? -5.0 : -1.0);
|
|---|
| 631 | #endif
|
|---|
| 632 | }
|
|---|
| 633 |
|
|---|
| 634 | void GUIControl::OnShiftDisplayLeftUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 635 | {
|
|---|
| 636 | cmd.Enable(m_View->HasData());
|
|---|
| 637 | }
|
|---|
| 638 |
|
|---|
| 639 | void GUIControl::OnShiftDisplayRight(bool accel)
|
|---|
| 640 | {
|
|---|
| 641 | #ifndef FLYFREE
|
|---|
| 642 | m_View->TranslateCave(accel ? 5 * DISPLAY_SHIFT : DISPLAY_SHIFT, 0);
|
|---|
| 643 | #else
|
|---|
| 644 | m_View->MoveViewer(0, 0, accel ? 5.0 : 1.0);
|
|---|
| 645 | #endif
|
|---|
| 646 | }
|
|---|
| 647 |
|
|---|
| 648 | void GUIControl::OnShiftDisplayRightUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 649 | {
|
|---|
| 650 | cmd.Enable(m_View->HasData());
|
|---|
| 651 | }
|
|---|
| 652 |
|
|---|
| 653 | void GUIControl::OnShiftDisplayUp(bool accel)
|
|---|
| 654 | {
|
|---|
| 655 | #ifndef FLYFREE
|
|---|
| 656 | m_View->TranslateCave(0, accel ? -5 * DISPLAY_SHIFT : -DISPLAY_SHIFT);
|
|---|
| 657 | #else
|
|---|
| 658 | m_View->MoveViewer(0, accel ? 5.0 : 1.0, 0);
|
|---|
| 659 | #endif
|
|---|
| 660 | }
|
|---|
| 661 |
|
|---|
| 662 | void GUIControl::OnShiftDisplayUpUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 663 | {
|
|---|
| 664 | cmd.Enable(m_View->HasData());
|
|---|
| 665 | }
|
|---|
| 666 |
|
|---|
| 667 | void GUIControl::OnZoomIn(bool accel)
|
|---|
| 668 | {
|
|---|
| 669 | // Increase the scale.
|
|---|
| 670 |
|
|---|
| 671 | #ifndef FLYFREE
|
|---|
| 672 | m_View->SetScale(m_View->GetScale() * (accel ? 1.1236 : 1.06));
|
|---|
| 673 | m_View->ForceRefresh();
|
|---|
| 674 | #else
|
|---|
| 675 | m_View->MoveViewer(accel ? 5.0 : 1.0, 0, 0);
|
|---|
| 676 | #endif
|
|---|
| 677 | }
|
|---|
| 678 |
|
|---|
| 679 | void GUIControl::OnZoomInUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 680 | {
|
|---|
| 681 | cmd.Enable(m_View->HasData() && m_View->GetLock() != lock_POINT);
|
|---|
| 682 | }
|
|---|
| 683 |
|
|---|
| 684 | void GUIControl::OnZoomOut(bool accel)
|
|---|
| 685 | {
|
|---|
| 686 | // Decrease the scale.
|
|---|
| 687 |
|
|---|
| 688 | #ifndef FLYFREE
|
|---|
| 689 | m_View->SetScale(m_View->GetScale() / (accel ? 1.1236 : 1.06));
|
|---|
| 690 | m_View->ForceRefresh();
|
|---|
| 691 | #else
|
|---|
| 692 | m_View->MoveViewer(accel ? -5.0 : -1.0, 0, 0);
|
|---|
| 693 | #endif
|
|---|
| 694 | }
|
|---|
| 695 |
|
|---|
| 696 | void GUIControl::OnZoomOutUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 697 | {
|
|---|
| 698 | cmd.Enable(m_View->HasData() && m_View->GetLock() != lock_POINT);
|
|---|
| 699 | }
|
|---|
| 700 |
|
|---|
| 701 | void GUIControl::OnToggleScalebar()
|
|---|
| 702 | {
|
|---|
| 703 | m_View->ToggleScaleBar();
|
|---|
| 704 | }
|
|---|
| 705 |
|
|---|
| 706 | void GUIControl::OnToggleScalebarUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 707 | {
|
|---|
| 708 | cmd.Enable(m_View->HasData() && m_View->GetLock() != lock_POINT);
|
|---|
| 709 | cmd.Check(m_View->ShowingScaleBar());
|
|---|
| 710 | }
|
|---|
| 711 |
|
|---|
| 712 | void GUIControl::OnToggleDepthbar() /* FIXME naming */
|
|---|
| 713 | {
|
|---|
| 714 | m_View->ToggleDepthBar();
|
|---|
| 715 | }
|
|---|
| 716 |
|
|---|
| 717 | void GUIControl::OnToggleDepthbarUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 718 | {
|
|---|
| 719 | cmd.Enable(m_View->HasData() && !(m_View->GetLock() && lock_Z));
|
|---|
| 720 | cmd.Check(m_View->ShowingDepthBar());
|
|---|
| 721 | }
|
|---|
| 722 |
|
|---|
| 723 | void GUIControl::OnViewCompass()
|
|---|
| 724 | {
|
|---|
| 725 | m_View->ToggleCompass();
|
|---|
| 726 | }
|
|---|
| 727 |
|
|---|
| 728 | void GUIControl::OnViewCompassUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 729 | {
|
|---|
| 730 | cmd.Enable(m_View->HasData() && m_View->CanRotate());
|
|---|
| 731 | cmd.Check(m_View->ShowingCompass());
|
|---|
| 732 | }
|
|---|
| 733 |
|
|---|
| 734 | void GUIControl::OnViewClino()
|
|---|
| 735 | {
|
|---|
| 736 | m_View->ToggleClino();
|
|---|
| 737 | }
|
|---|
| 738 |
|
|---|
| 739 | void GUIControl::OnViewClinoUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 740 | {
|
|---|
| 741 | cmd.Enable(m_View->HasData() && m_View->GetLock() == lock_NONE);
|
|---|
| 742 | cmd.Check(m_View->ShowingClino());
|
|---|
| 743 | }
|
|---|
| 744 |
|
|---|
| 745 | void GUIControl::OnShowSurface()
|
|---|
| 746 | {
|
|---|
| 747 | m_View->ToggleSurfaceLegs();
|
|---|
| 748 | }
|
|---|
| 749 |
|
|---|
| 750 | void GUIControl::OnShowSurfaceUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 751 | {
|
|---|
| 752 | cmd.Enable(m_View->HasData() && m_View->HasSurfaceLegs());
|
|---|
| 753 | cmd.Check(m_View->ShowingSurfaceLegs());
|
|---|
| 754 | }
|
|---|
| 755 |
|
|---|
| 756 | void GUIControl::OnShowEntrances()
|
|---|
| 757 | {
|
|---|
| 758 | m_View->ToggleEntrances();
|
|---|
| 759 | }
|
|---|
| 760 |
|
|---|
| 761 | void GUIControl::OnShowEntrancesUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 762 | {
|
|---|
| 763 | cmd.Enable(m_View->HasData() && (m_View->GetNumEntrances() > 0));
|
|---|
| 764 | cmd.Check(m_View->ShowingEntrances());
|
|---|
| 765 | }
|
|---|
| 766 |
|
|---|
| 767 | void GUIControl::OnShowFixedPts()
|
|---|
| 768 | {
|
|---|
| 769 | m_View->ToggleFixedPts();
|
|---|
| 770 | }
|
|---|
| 771 |
|
|---|
| 772 | void GUIControl::OnShowFixedPtsUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 773 | {
|
|---|
| 774 | cmd.Enable(m_View->HasData() && (m_View->GetNumFixedPts() > 0));
|
|---|
| 775 | cmd.Check(m_View->ShowingFixedPts());
|
|---|
| 776 | }
|
|---|
| 777 |
|
|---|
| 778 | void GUIControl::OnShowExportedPts()
|
|---|
| 779 | {
|
|---|
| 780 | m_View->ToggleExportedPts();
|
|---|
| 781 | }
|
|---|
| 782 |
|
|---|
| 783 | void GUIControl::OnShowExportedPtsUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 784 | {
|
|---|
| 785 | cmd.Enable(m_View->HasData() && (m_View->GetNumExportedPts() > 0));
|
|---|
| 786 | cmd.Check(m_View->ShowingExportedPts());
|
|---|
| 787 | }
|
|---|
| 788 |
|
|---|
| 789 | void GUIControl::OnViewGrid()
|
|---|
| 790 | {
|
|---|
| 791 | m_View->ToggleGrid();
|
|---|
| 792 | }
|
|---|
| 793 |
|
|---|
| 794 | void GUIControl::OnViewGridUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 795 | {
|
|---|
| 796 | cmd.Enable(m_View->HasData());
|
|---|
| 797 | }
|
|---|
| 798 |
|
|---|
| 799 | void GUIControl::OnIndicatorsUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 800 | {
|
|---|
| 801 | cmd.Enable(m_View->HasData());
|
|---|
| 802 | }
|
|---|
| 803 |
|
|---|
| 804 | void GUIControl::OnViewPerspective()
|
|---|
| 805 | {
|
|---|
| 806 | m_View->TogglePerspective();
|
|---|
| 807 | }
|
|---|
| 808 |
|
|---|
| 809 | void GUIControl::OnViewPerspectiveUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 810 | {
|
|---|
| 811 | cmd.Enable(m_View->HasData());
|
|---|
| 812 | cmd.Check(m_View->GetPerspective());
|
|---|
| 813 | }
|
|---|
| 814 |
|
|---|
| 815 | void GUIControl::OnToggleMetric()
|
|---|
| 816 | {
|
|---|
| 817 | m_View->ToggleMetric();
|
|---|
| 818 |
|
|---|
| 819 | wxConfigBase::Get()->Write("metric", m_View->GetMetric());
|
|---|
| 820 | wxConfigBase::Get()->Flush();
|
|---|
| 821 | }
|
|---|
| 822 |
|
|---|
| 823 | void GUIControl::OnToggleMetricUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 824 | {
|
|---|
| 825 | cmd.Enable(m_View->HasData());
|
|---|
| 826 | cmd.Check(m_View->GetMetric());
|
|---|
| 827 | }
|
|---|
| 828 |
|
|---|
| 829 | void GUIControl::OnToggleDegrees()
|
|---|
| 830 | {
|
|---|
| 831 | m_View->ToggleDegrees();
|
|---|
| 832 |
|
|---|
| 833 | wxConfigBase::Get()->Write("degrees", m_View->GetDegrees());
|
|---|
| 834 | wxConfigBase::Get()->Flush();
|
|---|
| 835 | }
|
|---|
| 836 |
|
|---|
| 837 | void GUIControl::OnToggleDegreesUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 838 | {
|
|---|
| 839 | cmd.Enable(m_View->HasData());
|
|---|
| 840 | cmd.Check(m_View->GetDegrees());
|
|---|
| 841 | }
|
|---|
| 842 |
|
|---|
| 843 | void GUIControl::OnToggleTubes()
|
|---|
| 844 | {
|
|---|
| 845 | m_View->ToggleTubes();
|
|---|
| 846 | }
|
|---|
| 847 |
|
|---|
| 848 | void GUIControl::OnToggleTubesUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 849 | {
|
|---|
| 850 | cmd.Enable(m_View->HasData());
|
|---|
| 851 | cmd.Check(m_View->GetTubes());
|
|---|
| 852 | }
|
|---|
| 853 |
|
|---|
| 854 | void GUIControl::OnCancelDistLine()
|
|---|
| 855 | {
|
|---|
| 856 | m_View->ClearTreeSelection();
|
|---|
| 857 | }
|
|---|
| 858 |
|
|---|
| 859 | void GUIControl::OnCancelDistLineUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 860 | {
|
|---|
| 861 | cmd.Enable(m_View->ShowingMeasuringLine());
|
|---|
| 862 | }
|
|---|
| 863 |
|
|---|
| 864 | void GUIControl::OnKeyPress(wxKeyEvent &e)
|
|---|
| 865 | {
|
|---|
| 866 | if (!m_View->HasData()) {
|
|---|
| 867 | e.Skip();
|
|---|
| 868 | return;
|
|---|
| 869 | }
|
|---|
| 870 |
|
|---|
| 871 | /* m_RedrawOffscreen = Animate(); FIXME */
|
|---|
| 872 |
|
|---|
| 873 | switch (e.m_keyCode) {
|
|---|
| 874 | case '/': case '?':
|
|---|
| 875 | if (m_View->CanLowerViewpoint() && m_View->GetLock() == lock_NONE)
|
|---|
| 876 | OnLowerViewpoint(e.m_shiftDown);
|
|---|
| 877 | break;
|
|---|
| 878 | case '\'': case '@': case '"': // both shifted forms - US and UK kbd
|
|---|
| 879 | if (m_View->CanRaiseViewpoint() && m_View->GetLock() == lock_NONE)
|
|---|
| 880 | OnHigherViewpoint(e.m_shiftDown);
|
|---|
| 881 | break;
|
|---|
| 882 | case 'C': case 'c':
|
|---|
| 883 | if (m_View->CanRotate() && !m_View->IsRotating())
|
|---|
| 884 | OnStepOnceAnticlockwise(e.m_shiftDown);
|
|---|
| 885 | break;
|
|---|
| 886 | case 'V': case 'v':
|
|---|
| 887 | if (m_View->CanRotate() && !m_View->IsRotating())
|
|---|
| 888 | OnStepOnceClockwise(e.m_shiftDown);
|
|---|
| 889 | break;
|
|---|
| 890 | case ']': case '}':
|
|---|
| 891 | if (m_View->GetLock() != lock_POINT)
|
|---|
| 892 | OnZoomIn(e.m_shiftDown);
|
|---|
| 893 | break;
|
|---|
| 894 | case '[': case '{':
|
|---|
| 895 | if (m_View->GetLock() != lock_POINT)
|
|---|
| 896 | OnZoomOut(e.m_shiftDown);
|
|---|
| 897 | break;
|
|---|
| 898 | case 'N': case 'n':
|
|---|
| 899 | if (!(m_View->GetLock() & lock_X))
|
|---|
| 900 | OnMoveNorth();
|
|---|
| 901 | break;
|
|---|
| 902 | case 'S': case 's':
|
|---|
| 903 | if (!(m_View->GetLock() & lock_X))
|
|---|
| 904 | OnMoveSouth();
|
|---|
| 905 | break;
|
|---|
| 906 | case 'E': case 'e':
|
|---|
| 907 | if (!(m_View->GetLock() & lock_Y))
|
|---|
| 908 | OnMoveEast();
|
|---|
| 909 | break;
|
|---|
| 910 | case 'W': case 'w':
|
|---|
| 911 | if (!(m_View->GetLock() & lock_Y))
|
|---|
| 912 | OnMoveWest();
|
|---|
| 913 | break;
|
|---|
| 914 | case 'Z': case 'z':
|
|---|
| 915 | if (m_View->CanRotate())
|
|---|
| 916 | OnSpeedUp(e.m_shiftDown);
|
|---|
| 917 | break;
|
|---|
| 918 | case 'X': case 'x':
|
|---|
| 919 | if (m_View->CanRotate())
|
|---|
| 920 | OnSlowDown(e.m_shiftDown);
|
|---|
| 921 | break;
|
|---|
| 922 | case 'R': case 'r':
|
|---|
| 923 | if (m_View->CanRotate())
|
|---|
| 924 | OnReverseDirectionOfRotation();
|
|---|
| 925 | break;
|
|---|
| 926 | case 'P': case 'p':
|
|---|
| 927 | if (m_View->GetLock() == lock_NONE && !m_View->ShowingPlan())
|
|---|
| 928 | OnPlan();
|
|---|
| 929 | break;
|
|---|
| 930 | case 'L': case 'l':
|
|---|
| 931 | if (m_View->GetLock() == lock_NONE && !m_View->ShowingElevation())
|
|---|
| 932 | OnElevation();
|
|---|
| 933 | break;
|
|---|
| 934 | case 'O': case 'o':
|
|---|
| 935 | OnDisplayOverlappingNames();
|
|---|
| 936 | break;
|
|---|
| 937 | case WXK_DELETE:
|
|---|
| 938 | OnDefaults();
|
|---|
| 939 | break;
|
|---|
| 940 | case WXK_RETURN:
|
|---|
| 941 | if (m_View->CanRotate() && !m_View->IsRotating())
|
|---|
| 942 | OnStartRotation();
|
|---|
| 943 | break;
|
|---|
| 944 | case WXK_SPACE:
|
|---|
| 945 | if (m_View->IsRotating())
|
|---|
| 946 | OnStopRotation();
|
|---|
| 947 | break;
|
|---|
| 948 | case WXK_LEFT:
|
|---|
| 949 | if (e.m_controlDown) {
|
|---|
| 950 | if (m_View->CanRotate() && !m_View->IsRotating())
|
|---|
| 951 | OnStepOnceAnticlockwise(e.m_shiftDown);
|
|---|
| 952 | } else {
|
|---|
| 953 | OnShiftDisplayLeft(e.m_shiftDown);
|
|---|
| 954 | }
|
|---|
| 955 | break;
|
|---|
| 956 | case WXK_RIGHT:
|
|---|
| 957 | if (e.m_controlDown) {
|
|---|
| 958 | if (m_View->CanRotate() && !m_View->IsRotating())
|
|---|
| 959 | OnStepOnceClockwise(e.m_shiftDown);
|
|---|
| 960 | } else {
|
|---|
| 961 | OnShiftDisplayRight(e.m_shiftDown);
|
|---|
| 962 | }
|
|---|
| 963 | break;
|
|---|
| 964 | case WXK_UP:
|
|---|
| 965 | if (e.m_controlDown) {
|
|---|
| 966 | if (m_View->CanRaiseViewpoint() && m_View->GetLock() == lock_NONE)
|
|---|
| 967 | OnHigherViewpoint(e.m_shiftDown);
|
|---|
| 968 | } else {
|
|---|
| 969 | OnShiftDisplayUp(e.m_shiftDown);
|
|---|
| 970 | }
|
|---|
| 971 | break;
|
|---|
| 972 | case WXK_DOWN:
|
|---|
| 973 | if (e.m_controlDown) {
|
|---|
| 974 | if (m_View->CanLowerViewpoint() && m_View->GetLock() == lock_NONE)
|
|---|
| 975 | OnLowerViewpoint(e.m_shiftDown);
|
|---|
| 976 | } else {
|
|---|
| 977 | OnShiftDisplayDown(e.m_shiftDown);
|
|---|
| 978 | }
|
|---|
| 979 | break;
|
|---|
| 980 | case WXK_ESCAPE:
|
|---|
| 981 | if (m_View->ShowingMeasuringLine()) {
|
|---|
| 982 | OnCancelDistLine();
|
|---|
| 983 | }
|
|---|
| 984 | break;
|
|---|
| 985 | default:
|
|---|
| 986 | e.Skip();
|
|---|
| 987 | }
|
|---|
| 988 |
|
|---|
| 989 | // OnPaint clears m_RedrawOffscreen so it'll only still be set if we need
|
|---|
| 990 | // to redraw
|
|---|
| 991 | /* FIXME if (m_RedrawOffscreen) */ m_View->ForceRefresh();
|
|---|
| 992 | }
|
|---|
| 993 |
|
|---|
| 994 | void GUIControl::OnViewFullScreenUpdate(wxUpdateUIEvent& cmd)
|
|---|
| 995 | {
|
|---|
| 996 | cmd.Enable(m_View->HasData());
|
|---|
| 997 | cmd.Check(m_View->IsFullScreen());
|
|---|
| 998 | }
|
|---|
| 999 |
|
|---|
| 1000 | void GUIControl::OnViewFullScreen()
|
|---|
| 1001 | {
|
|---|
| 1002 | m_View->FullScreenMode();
|
|---|
| 1003 | }
|
|---|