예제 #1
0
파일: MainWindow.cpp 프로젝트: ppara/XCSoar
void
MainWindow::InitialiseConfigured()
{
  const UISettings &ui_settings = CommonInterface::GetUISettings();

#ifndef GNAV
  if (ui_settings.scale != UISettings::Scale::NORMAL)
    /* call Initialise() again to reload fonts with the new scale */
    Initialise();
#endif

  PixelRect rc = GetClientRect();

  const InfoBoxLayout::Layout ib_layout =
    InfoBoxLayout::Calculate(rc, ui_settings.info_boxes.geometry);

  Fonts::SizeInfoboxFont(ib_layout.control_size.cx);

  assert(look != nullptr);
  look->InitialiseConfigured(CommonInterface::GetUISettings(),
                             Fonts::dialog, Fonts::dialog_bold,
                             Fonts::dialog_small,
                             Fonts::map, Fonts::map_bold,
                             Fonts::map_label,
                             Fonts::map_label_important,
                             Fonts::cdi, Fonts::monospace,
                             Fonts::infobox, Fonts::infobox_small,
#ifndef GNAV
                             Fonts::infobox_units,
#endif
                             Fonts::title);

  InfoBoxManager::Create(*this, ib_layout, look->info_box, look->units);
  map_rect = ib_layout.remaining;

  ButtonLabel::CreateButtonLabels(*this, look->dialog.button);

  ReinitialiseLayout_vario(ib_layout);

  ReinitialiseLayoutTA(rc, ib_layout);

  WindowStyle hidden_border;
  hidden_border.Hide();
  hidden_border.Border();

  ReinitialiseLayout_flarm(rc, ib_layout);

#ifdef HAVE_SHOW_MENU_BUTTON
  show_menu_button = new ShowMenuButton();
  show_menu_button->Create(*this, GetShowMenuButtonRect(map_rect));
#endif

  map = new GlueMapWindow(*look);
  map->SetComputerSettings(CommonInterface::GetComputerSettings());
  map->SetMapSettings(CommonInterface::GetMapSettings());
  map->SetUIState(CommonInterface::GetUIState());
  map->Create(*this, map_rect);

  popup.Create(rc);
}
예제 #2
0
void
MainWindow::InitialiseConfigured()
{
  const UISettings &ui_settings = CommonInterface::GetUISettings();

  if (ui_settings.scale != 100)
    /* call Initialise() again to reload fonts with the new scale */
    Initialise();

  PixelRect rc = GetClientRect();

  const InfoBoxLayout::Layout ib_layout =
    InfoBoxLayout::Calculate(rc, ui_settings.info_boxes.geometry);

  assert(look != nullptr);
  look->InitialiseConfigured(CommonInterface::GetUISettings(),
                             Fonts::map, Fonts::map_bold,
                             ib_layout.control_size.cx);

  InfoBoxManager::Create(*this, ib_layout, look->info_box, look->units);
  map_rect = ib_layout.remaining;

  ButtonLabel::CreateButtonLabels(*this, look->dialog.button);

  ReinitialiseLayout_vario(ib_layout);

  ReinitialiseLayoutTA(rc, ib_layout);

  WindowStyle hidden_border;
  hidden_border.Hide();
  hidden_border.Border();

  ReinitialiseLayout_flarm(rc, ib_layout);

#ifdef HAVE_SHOW_MENU_BUTTON
  const UISettings &settings = CommonInterface::GetUISettings();
  if (settings.show_menu_button){
    show_menu_button = new ShowMenuButton();
    show_menu_button->Create(*this, GetShowMenuButtonRect(map_rect));
  }
#endif

  map = new GlueMapWindow(*look);
  map->SetComputerSettings(CommonInterface::GetComputerSettings());
  map->SetMapSettings(CommonInterface::GetMapSettings());
  map->SetUIState(CommonInterface::GetUIState());
  map->Create(*this, map_rect);

  popup = new PopupMessage(*this, look->dialog, ui_settings);
  popup->Create(rc);
}
예제 #3
0
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();
}