Ejemplo n.º 1
0
static void
CopyList()
{
  const ProtectedAirspaceWarningManager::Lease lease(*airspace_warnings);

  warning_list.clear();
  for (auto i = lease->begin(), end = lease->end();
       i != end && !warning_list.full(); ++i)
    warning_list.push_back(*i);
}
Ejemplo n.º 2
0
void
dlgAirspaceWarningsShowModal(SingleWindow &parent,
                             ProtectedAirspaceWarningManager &_warnings,
                             bool _auto_close)
{
  if (dlgAirspaceWarningVisible())
    return;

  assert(warning_list.empty());

  airspace_warnings = &_warnings;

  dialog = LoadDialog(CallBackTable, parent, _T("IDR_XML_AIRSPACEWARNINGS"));
  assert(dialog != NULL);

  ack_warn_button = (WndButton *)dialog->FindByName(_T("frmAck1"));
  ack_day_button = (WndButton *)dialog->FindByName(_T("frmAck2"));
  ack_space_button = (WndButton *)dialog->FindByName(_T("frmAck"));
  enable_button = (WndButton *)dialog->FindByName(_T("frmEnable"));
  assert(ack_warn_button != NULL);
  assert(ack_day_button != NULL);
  assert(ack_space_button != NULL);
  assert(enable_button != NULL);

  dialog->SetKeyDownFunction(OnKeyDown);

  warning_list_frame =
    (ListControl*)dialog->FindByName(_T("frmAirspaceWarningList"));
  assert(warning_list_frame != NULL);

  AirspaceWarningListHandler handler;
  warning_list_frame->SetHandler(&handler);

  auto_close = _auto_close;
  UpdateList();

  // JMW need to deselect everything on new reopening of dialog
  selected_airspace = NULL;
  focused_airspace = NULL;

  auto update_timer = MakeLambdaTimer([](){ UpdateList(); });
  update_timer.Schedule(500);

  warning_list_frame->SetCursorIndex(0);
  dialog->ShowModal();
  update_timer.Cancel();

  delete dialog;

  // Needed for dlgAirspaceWarningVisible()
  dialog = NULL;

  warning_list.clear();
}
Ejemplo n.º 3
0
void
dlgAirspaceWarningsShowModal(SingleWindow &parent,
                             ProtectedAirspaceWarningManager &_warnings,
                             bool _auto_close)
{
  if (dlgAirspaceWarningVisible())
    return;

  assert(warning_list.empty());

  airspace_warnings = &_warnings;

  dialog = LoadDialog(CallBackTable, parent, _T("IDR_XML_AIRSPACEWARNINGS"));
  assert(dialog != NULL);

  ack_warn_button = (WndButton *)dialog->FindByName(_T("frmAck1"));
  ack_day_button = (WndButton *)dialog->FindByName(_T("frmAck2"));
  ack_space_button = (WndButton *)dialog->FindByName(_T("frmAck"));
  enable_button = (WndButton *)dialog->FindByName(_T("frmEnable"));
  assert(ack_warn_button != NULL);
  assert(ack_day_button != NULL);
  assert(ack_space_button != NULL);
  assert(enable_button != NULL);

  dialog->SetKeyDownNotify(OnKeyDown);

  warning_list_frame =
    (ListControl*)dialog->FindByName(_T("frmAirspaceWarningList"));
  assert(warning_list_frame != NULL);
  warning_list_frame->SetPaintItemCallback(OnAirspaceListItemPaint);
  warning_list_frame->SetCursorCallback(AirspaceWarningCursorCallback);
  warning_list_frame->SetActivateCallback(OnAirspaceListEnter);

  auto_close = _auto_close;
  UpdateList();

  // JMW need to deselect everything on new reopening of dialog
  selected_airspace = NULL;
  focused_airspace = NULL;

  dialog->SetTimerNotify(OnTimer);
  warning_list_frame->SetCursorIndex(0);
  dialog->ShowModal();
  dialog->SetTimerNotify(NULL);

  delete dialog;

  // Needed for dlgAirspaceWarningVisible()
  dialog = NULL;

  warning_list.clear();
}