bool GlueMapWindow::OnTimer(WindowTimer &timer) { if (timer == map_item_timer) { map_item_timer.Cancel(); if (!InputEvents::IsDefault() && !IsPanning()) { InputEvents::HideMenu(); return true; } ShowMapItems(drag_start_geopoint, false); return true; #ifdef ENABLE_OPENGL } else if (timer == kinetic_timer) { if (kinetic_x.IsSteady() && kinetic_y.IsSteady()) { kinetic_timer.Cancel(); } else { auto location = drag_projection.ScreenToGeo(kinetic_x.GetPosition(), kinetic_y.GetPosition()); location = drag_projection.GetGeoLocation() + drag_start_geopoint - location; visible_projection.SetGeoLocation(location); QuickRedraw(); } return true; #endif } else return MapWindow::OnTimer(timer); }
void InputEvents::sub_SetZoom(fixed value) { MapSettings &settings_map = CommonInterface::SetMapSettings(); GlueMapWindow *map_window = PageActions::ShowMap(); if (map_window == NULL) return; const DisplayMode displayMode = CommonInterface::GetUIState().display_mode; if (settings_map.auto_zoom_enabled && !(displayMode == DisplayMode::CIRCLING && settings_map.circle_zoom_enabled) && !IsPanning()) { settings_map.auto_zoom_enabled = false; // disable autozoom if user manually changes zoom Profile::Set(ProfileKeys::AutoZoom, false); Message::AddMessage(_("Auto. zoom off")); } fixed vmin = CommonInterface::GetComputerSettings().polar.glide_polar_task.GetVMin(); fixed scale_2min_distance = vmin * 12; const fixed scale_100m = fixed(10); const fixed scale_1600km = fixed(1600*100); fixed minreasonable = displayMode == DisplayMode::CIRCLING ? scale_100m : std::max(scale_100m, scale_2min_distance); value = Clamp(value, minreasonable, scale_1600km); map_window->SetMapScale(value); map_window->QuickRedraw(); }
void GlueMapWindow::OnPaintBuffer(Canvas &canvas) { #ifdef ENABLE_OPENGL ExchangeBlackboard(); EnterDrawThread(); /* update terrain, topography, ... */ if (Idle()) /* still dirty: schedule a redraw to load more data */ data_timer.Schedule(500); else data_timer.Cancel(); #endif MapWindow::OnPaintBuffer(canvas); DrawMapScale(canvas, GetClientRect(), render_projection); if (IsPanning()) DrawPanInfo(canvas); #ifdef ENABLE_OPENGL LeaveDrawThread(); #endif }
InputEvents::Mode InputEvents::getModeID() { if (current_mode == MODE_DEFAULT && IsPanning()) return MODE_PAN; return current_mode; }
void TogglePan() { if (IsPanning()) LeavePan(); else EnterPan(); }
void GlueMapWindow::OnPaint(Canvas &canvas) { MapWindow::OnPaint(canvas); // Draw center screen cross hair in pan mode if (IsPanning()) DrawCrossHairs(canvas); DrawGesture(canvas); }
void MapWindow::DrawWind(Canvas &canvas, const RasterPoint &Start, const PixelRect &rc) const { if (IsPanning()) return; WindArrowRenderer wind_arrow_renderer(look.wind); wind_arrow_renderer.Draw(canvas, render_projection.GetScreenAngle(), Start, rc, Calculated(), GetMapSettings()); }
void GlueMapWindow::OnPaintBuffer(Canvas &canvas) { #ifdef ENABLE_OPENGL ExchangeBlackboard(); EnterDrawThread(); /* update terrain, topography, ... */ Idle(); #endif MapWindow::OnPaintBuffer(canvas); DrawMapScale(canvas, GetClientRect(), render_projection); if (IsPanning()) DrawPanInfo(canvas); #ifdef ENABLE_OPENGL LeaveDrawThread(); #endif }
void InputEvents::HideMenu() { setMode(IsPanning() ? MODE_PAN : MODE_DEFAULT); }