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