Esempio n. 1
0
void
WindSetupPanel::Prepare(ContainerWindow &parent, const PixelRect &rc)
{
  LoadWindow(CallBackTable, parent, _T("IDR_XML_INFOBOXWINDSETUP"));

  const NMEAInfo &basic = XCSoarInterface::Basic();
  const WindSettings &settings = CommonInterface::GetComputerSettings().wind;
  const bool external_wind = basic.external_wind_available &&
    settings.use_external_wind;

  if (external_wind) {
    static gcc_constexpr_data StaticEnumChoice external_wind_list[] = {
      { 0, N_("External") },
      { 0 }
    };

    SetFormControlEnabled(form, _T("prpAutoWind"), false);
    LoadFormProperty(form, _T("prpAutoWind"), external_wind_list, 0);
  } else {
    static gcc_constexpr_data StaticEnumChoice auto_wind_list[] = {
      { AUTOWIND_NONE, N_("Manual") },
      { AUTOWIND_CIRCLING, N_("Circling") },
      { AUTOWIND_ZIGZAG, N_("ZigZag") },
      { AUTOWIND_CIRCLING | AUTOWIND_ZIGZAG, N_("Both") },
      { 0 }
    };

    LoadFormProperty(form, _T("prpAutoWind"), auto_wind_list,
                     settings.GetLegacyAutoWindMode());
  }
}
Esempio n. 2
0
static void
SetButtonsEnabled(bool enabled)
{
  SetFormControlEnabled(*wf, _T("cmdSwitchData"), enabled);
  SetFormControlEnabled(*wf, _T("cmdDetails"), enabled);
  SetFormControlEnabled(*wf, _T("cmdZoomIn"), enabled);
  SetFormControlEnabled(*wf, _T("cmdZoomOut"), enabled);
  SetFormControlEnabled(*wf, _T("cmdPrev"), enabled);
  SetFormControlEnabled(*wf, _T("cmdNext"), enabled);
}
Esempio n. 3
0
/**
 * Locks target fields if turnpoint does not have adjustable target
 */
static void
LockCalculatorUI()
{
  SetFormControlEnabled(*wf, _T("prpRange"), is_locked);
  SetFormControlEnabled(*wf, _T("prpRadial"), is_locked);
}
Esempio n. 4
0
static void
RefreshView()
{
  wTaskView->Invalidate();

  OrderedTaskPoint &tp = ordered_task->GetPoint(active_index);

  dock->SetWidget(new PanelWidget());

  ObservationZonePoint &oz = tp.GetObservationZone();
  const bool is_fai_general =
    ordered_task->GetFactoryType() == TaskFactoryType::FAI_GENERAL;
  properties_widget = CreateObservationZoneEditWidget(oz, is_fai_general);
  if (properties_widget != nullptr) {
    properties_widget->SetListener(&listener);
    dock->SetWidget(properties_widget);
  }

  WndFrame* wfrm = nullptr;
  wfrm = ((WndFrame*)wf->FindByName(_T("lblType")));
  if (wfrm)
    wfrm->SetCaption(OrderedTaskPointName(ordered_task->GetFactory().GetType(tp)));

  SetFormControlEnabled(*wf, _T("butPrevious"), active_index > 0);
  SetFormControlEnabled(*wf, _T("butNext"),
                        active_index < (ordered_task->TaskSize() - 1));

  WndButton* wb;
  wb = (WndButton*)wf->FindByName(_T("cmdOptionalStarts"));
  assert(wb);
  wb->SetVisible(active_index == 0);
  if (!ordered_task->HasOptionalStarts())
    wb->SetCaption(_("Enable Alternate Starts"));
  else {
    StaticString<50> tmp;
    tmp.Format(_T("%s (%d)"), _("Edit Alternates"),
               ordered_task->GetOptionalStartPointCount());
    wb->SetCaption(tmp);
  }

  CheckBoxControl &score_exit = *(CheckBoxControl *)
    wf->FindByName(_T("ScoreExit"));
  if (tp.GetType() == TaskPointType::AST) {
    const ASTPoint &ast = (const ASTPoint &)tp;
    score_exit.Show();
    score_exit.SetState(ast.GetScoreExit());
  } else
    score_exit.Hide();

  StaticString<100> name_prefix_buffer, type_buffer;

  switch (tp.GetType()) {
  case TaskPointType::START:
    type_buffer = _("Start point");
    name_prefix_buffer = _T("Start: ");
    break;

  case TaskPointType::AST:
    type_buffer = _("Task point");
    name_prefix_buffer.Format(_T("%d: "), active_index);
    break;

  case TaskPointType::AAT:
    type_buffer = _("Assigned area point");
    name_prefix_buffer.Format(_T("%d: "), active_index);
    break;

  case TaskPointType::FINISH:
    type_buffer = _("Finish point");
    name_prefix_buffer = _T("Finish: ");
    break;

  default:
    gcc_unreachable();
  }

  wf->SetCaption(type_buffer);

  wfrm = ((WndFrame*)wf->FindByName(_T("lblLocation")));
  if (wfrm) {
    StaticString<100> buffer;
    buffer.Format(_T("%s %s"), name_prefix_buffer.c_str(),
                  tp.GetWaypoint().name.c_str());
    wfrm->SetCaption(buffer);
  }
}
Esempio n. 5
0
static void
RefreshView()
{
  wTaskView->invalidate();

  OrderedTaskPoint* tp = ordered_task->get_tp(active_index);
  if (!tp)
    return;

  Refreshing = true; // tell onChange routines not to save form!

  ShowFormControl(*wf, _T("frmOZLine"), false);
  ShowFormControl(*wf, _T("frmOZSector"), false);
  ShowFormControl(*wf, _T("frmOZCylinder"), false);

  const ObservationZonePoint &oz = *tp->get_oz();

  switch (oz.shape) {
  case ObservationZonePoint::SECTOR:
  case ObservationZonePoint::ANNULAR_SECTOR:
    ShowFormControl(*wf, _T("frmOZSector"), true);

    LoadFormProperty(*wf, _T("prpOZSectorRadius"),
                     ugDistance, ((const SectorZone &)oz).getRadius());
    LoadFormProperty(*wf, _T("prpOZSectorStartRadial"),
                     ((const SectorZone &)oz).getStartRadial().value_degrees());
    LoadFormProperty(*wf, _T("prpOZSectorFinishRadial"),
                     ((const SectorZone &)oz).getEndRadial().value_degrees());

    if (oz.shape == ObservationZonePoint::ANNULAR_SECTOR) {
      LoadFormProperty(*wf, _T("prpOZSectorInnerRadius"),
                       ugDistance, ((const AnnularSectorZone &)oz).getInnerRadius());

      ShowFormControl(*wf, _T("prpOZSectorInnerRadius"), true);
    } else
      ShowFormControl(*wf, _T("prpOZSectorInnerRadius"), false);

    break;

  case ObservationZonePoint::LINE:
    ShowFormControl(*wf, _T("frmOZLine"), true);

    LoadFormProperty(*wf, _T("prpOZLineLength"), ugDistance,
                     ((const LineSectorZone &)oz).getLength());
    break;

  case ObservationZonePoint::CYLINDER:
    ShowFormControl(*wf, _T("frmOZCylinder"), true);

    LoadFormProperty(*wf, _T("prpOZCylinderRadius"), ugDistance,
                     ((const CylinderZone &)oz).getRadius());
    break;

  default:
    break;
  }

  WndFrame* wfrm = NULL;
  wfrm = ((WndFrame*)wf->FindByName(_T("lblType")));
  if (wfrm)
    wfrm->SetCaption(OrderedTaskPointName(ordered_task->get_factory().getType(*tp)));

  SetFormControlEnabled(*wf, _T("butPrevious"), active_index > 0);
  SetFormControlEnabled(*wf, _T("butNext"),
                        active_index < (ordered_task->TaskSize() - 1));

  WndButton* wb;
  wb = (WndButton*)wf->FindByName(_T("cmdOptionalStarts"));
  assert(wb);
  wb->set_visible(active_index == 0);
  if (ordered_task->optional_start_points_size() == 0)
    wb->SetCaption(_("Enable Alternate Starts"));
  else {
    TCHAR tmp[50];
    _stprintf(tmp, _T("%s (%d)"), _("Edit Alternates"),
        ordered_task->optional_start_points_size());
    wb->SetCaption(tmp);
  }

  EnableSizeEdit(ordered_task->get_factory_type() != TaskBehaviour::FACTORY_FAI_GENERAL);

  TCHAR bufType[100];
  TCHAR bufNamePrefix[100];

  switch (tp->GetType()) {
  case TaskPoint::START:
    _tcscpy(bufType, _T("Start point"));
    _tcscpy(bufNamePrefix, _T("Start: "));
    break;

  case TaskPoint::AST:
    _tcscpy(bufType, _T("Task point"));
    _stprintf(bufNamePrefix, _T("%d: "), active_index);
    break;

  case TaskPoint::AAT:
    _tcscpy(bufType, _T("Assigned area point"));
    _stprintf(bufNamePrefix, _T("%d: "), active_index);
    break;

  case TaskPoint::FINISH:
    _tcscpy(bufType, _T("Finish point"));
    _tcscpy(bufNamePrefix, _T("Finish: "));
    break;

  default:
    assert(true);
    break;
  }

  wf->SetCaption(bufType);

  wfrm = ((WndFrame*)wf->FindByName(_T("lblLocation")));
  if (wfrm) {
    TCHAR buff[100];
    _stprintf(buff, _T("%s %s"), bufNamePrefix, tp->GetWaypoint().name.c_str());
    wfrm->SetCaption(buff);
  }

  Refreshing = false; // reactivate onChange routines
}
Esempio n. 6
0
/**
 * for FAI tasks, make the zone sizes disabled so the user can't alter them
 * @param enable
 */
static void
EnableSizeEdit(bool enable)
{
  SetFormControlEnabled(*wf, _T("prpOZLineLength"), enable);
  SetFormControlEnabled(*wf, _T("prpOZCylinderRadius"), enable);
}