void MainWindow::SetBottomWidget(Widget *_widget) { if (bottom_widget == nullptr && _widget == nullptr) return; if (map == nullptr) { /* this doesn't work without a map */ delete _widget; return; } KillBottomWidget(); bottom_widget = _widget; const PixelRect main_rect = GetMainRect(); const PixelRect bottom_rect = GetBottomWidgetRect(main_rect, bottom_widget); if (bottom_widget != nullptr) { bottom_widget->Initialise(*this, bottom_rect); bottom_widget->Prepare(*this, bottom_rect); if (widget == nullptr) bottom_widget->Show(bottom_rect); } map->Move(GetMapRectAbove(main_rect, bottom_rect)); map->FullRedraw(); }
void MainWindow::SetWidget(Widget *_widget) { assert(_widget != NULL); restore_page_pending = false; /* delete the old widget */ KillWidget(); /* hide the map (might be hidden already) */ if (map != NULL) { map->FastHide(); #ifndef ENABLE_OPENGL if (!draw_suspended) { draw_suspended = true; draw_thread->BeginSuspend(); } #endif } if (bottom_widget != nullptr) bottom_widget->Hide(); widget = _widget; const PixelRect rc = GetMainRect(); widget->Initialise(*this, rc); widget->Prepare(*this, rc); widget->Show(rc); if (!widget->SetFocus()) SetFocus(); }
GlueMapWindow * MainWindow::ActivateMap() { restore_page_pending = false; if (map == NULL) return NULL; if (widget != NULL) { KillWidget(); map->Show(); map->SetFocus(); if (bottom_widget != nullptr) bottom_widget->Show(GetBottomWidgetRect(GetMainRect(), bottom_widget)); #ifndef ENABLE_OPENGL if (draw_suspended) { draw_suspended = false; draw_thread->Resume(); } #endif } return map; }
void MainWindow::SetBottomWidget(Widget *_widget) { if (bottom_widget == nullptr && _widget == nullptr) return; if (map == nullptr) { /* this doesn't work without a map */ delete _widget; return; } KillBottomWidget(); bottom_widget = _widget; const PixelRect main_rect = GetMainRect(); const PixelRect bottom_rect = GetBottomWidgetRect(main_rect, bottom_widget); if (bottom_widget != nullptr) { bottom_widget->Initialise(*this, bottom_rect); bottom_widget->Prepare(*this, bottom_rect); if (widget == nullptr) /* the bottom widget is only visible below the map, but not below a custom main widget; see HaveBottomWidget() */ bottom_widget->Show(bottom_rect); } map->Move(GetMapRectAbove(main_rect, bottom_rect)); map->FullRedraw(); }
void MainWindow::SetFullScreen(bool _full_screen) { if (_full_screen == FullScreen) return; FullScreen = _full_screen; if (FullScreen) InfoBoxManager::Hide(); else InfoBoxManager::Show(); if (widget != NULL) widget->Move(GetMainRect()); if (map != NULL) map->FastMove(GetMainRect()); // the repaint will be triggered by the DrawThread UpdateVarioGaugeVisibility(); }
void MainWindow::ReinitialiseLayout() { if (map == NULL) { #ifdef ANDROID if (HasDialog()) dialogs.top()->ReinitialiseLayout(); // adapt simulator prompt #endif /* without the MapWindow, it is safe to assume that the MainWindow is just being initialized, and the InfoBoxes aren't initialized yet either, so there is nothing to do here */ return; } #ifndef ENABLE_OPENGL if (draw_thread == NULL) /* no layout changes during startup */ return; #endif InfoBoxManager::Destroy(); const UISettings &ui_settings = CommonInterface::GetUISettings(); const PixelRect rc = GetClientRect(); const InfoBoxLayout::Layout ib_layout = InfoBoxLayout::Calculate(rc, ui_settings.info_boxes.geometry); Fonts::SizeInfoboxFont(ib_layout.control_width); InfoBoxManager::Create(*this, ib_layout, look->info_box, look->units); InfoBoxManager::ProcessTimer(); map_rect = ib_layout.remaining; popup.Destroy(); popup.Create(rc); ReinitialiseLayout_vario(ib_layout); ReinitialiseLayout_flarm(rc, ib_layout); ReinitialiseLayoutTA(rc, ib_layout); if (map != NULL) { if (FullScreen) InfoBoxManager::Hide(); else InfoBoxManager::Show(); const PixelRect main_rect = GetMainRect(); const PixelRect bottom_rect = GetBottomWidgetRect(main_rect, bottom_widget); if (bottom_widget != nullptr) bottom_widget->Move(bottom_rect); map->Move(GetMapRectAbove(main_rect, bottom_rect)); map->FullRedraw(); } if (widget != NULL) widget->Move(GetMainRect(rc)); #ifdef ANDROID // move topmost dialog to fit into the current layout, or close it if (HasDialog()) dialogs.top()->ReinitialiseLayout(); #endif if (map != NULL) map->BringToBottom(); }
void MainWindow::ReinitialiseLayout() { if (map == nullptr) /* without the MapWindow, it is safe to assume that the MainWindow is just being initialized, and the InfoBoxes aren't initialized yet either, so there is nothing to do here */ return; const PixelRect rc = GetClientRect(); #ifndef ENABLE_OPENGL if (draw_thread == nullptr) /* no layout changes during startup */ return; #endif InfoBoxManager::Destroy(); const UISettings &ui_settings = CommonInterface::GetUISettings(); const InfoBoxLayout::Layout ib_layout = InfoBoxLayout::Calculate(rc, ui_settings.info_boxes.geometry); look->ReinitialiseLayout(ib_layout.control_size.cx); InfoBoxManager::Create(*this, ib_layout, look->info_box, look->units); InfoBoxManager::ProcessTimer(); map_rect = ib_layout.remaining; popup->UpdateLayout(rc); ReinitialiseLayout_vario(ib_layout); ReinitialiseLayout_flarm(rc, ib_layout); ReinitialiseLayoutTA(rc, ib_layout); if (map != nullptr) { if (FullScreen) InfoBoxManager::Hide(); else InfoBoxManager::Show(); const PixelRect main_rect = GetMainRect(); const PixelRect bottom_rect = GetBottomWidgetRect(main_rect, bottom_widget); if (HaveBottomWidget()) bottom_widget->Move(bottom_rect); map->Move(GetMapRectAbove(main_rect, bottom_rect)); map->FullRedraw(); } if (widget != nullptr) widget->Move(GetMainRect(rc)); #ifdef HAVE_SHOW_MENU_BUTTON if (show_menu_button != nullptr) show_menu_button->Move(GetShowMenuButtonRect(GetMainRect())); #endif if (map != nullptr) map->BringToBottom(); }