Ejemplo n.º 1
0
void
MacCreadyEditPanel::Prepare(ContainerWindow &parent, const PixelRect &rc)
{
  LoadWindow(call_back_table, parent, _T("IDR_XML_INFOBOXMACCREADYEDIT"));

  TCHAR caption[16];

  WndButton *button = (WndButton *)form.FindByName(_T("cmdPlusBig"));
  assert(button != NULL);
  FormatUserVerticalSpeed(
      Units::ToSysVSpeed(GetUserVerticalSpeedStep() * 5), caption, false);
  button->SetCaption(caption);

  button = (WndButton *)form.FindByName(_T("cmdPlusSmall"));
  assert(button != NULL);
  FormatUserVerticalSpeed(
      Units::ToSysVSpeed(GetUserVerticalSpeedStep()), caption, false);
  button->SetCaption(caption);

  button = (WndButton *)form.FindByName(_T("cmdMinusBig"));
  assert(button != NULL);
  FormatUserVerticalSpeed(
      Units::ToSysVSpeed(-GetUserVerticalSpeedStep() * 5), caption, false);
  button->SetCaption(caption);

  button = (WndButton *)form.FindByName(_T("cmdMinusSmall"));
  assert(button != NULL);
  FormatUserVerticalSpeed(
      Units::ToSysVSpeed(-GetUserVerticalSpeedStep()), caption, false);
  button->SetCaption(caption);
}
Ejemplo n.º 2
0
Widget *
LoadMacCreadyEditPanel(unsigned id)
{
  const fixed step = Units::ToSysVSpeed(GetUserVerticalSpeedStep());
  return new MacCreadyOffsetButtons(UIGlobals::GetDialogLook(),
                                    GetUserVerticalSpeedFormat(false, true),
                                    step, 5 * step);
}
Ejemplo n.º 3
0
// MacCready
// Adjusts MacCready settings
// up, down, auto on, auto off, auto toggle, auto show
void
InputEvents::eventMacCready(const TCHAR *misc)
{
  if (protected_task_manager == NULL)
    return;

  const GlidePolar &polar =
    CommonInterface::GetComputerSettings().polar.glide_polar_task;
  fixed mc = polar.GetMC();

  TaskBehaviour &task_behaviour = CommonInterface::SetComputerSettings().task;

  if (StringIsEqual(misc, _T("up"))) {
    mc = std::min(mc + Units::ToSysVSpeed(GetUserVerticalSpeedStep()),
                  fixed(5));
    ActionInterface::SetManualMacCready(mc);
  } else if (StringIsEqual(misc, _T("down"))) {
    mc = std::max(mc - Units::ToSysVSpeed(GetUserVerticalSpeedStep()),
                  fixed_zero);
    ActionInterface::SetManualMacCready(mc);
  } else if (StringIsEqual(misc, _T("auto toggle"))) {
    task_behaviour.auto_mc = !task_behaviour.auto_mc;
    Profile::Set(szProfileAutoMc, task_behaviour.auto_mc);
  } else if (StringIsEqual(misc, _T("auto on"))) {
    task_behaviour.auto_mc = true;
    Profile::Set(szProfileAutoMc, true);
  } else if (StringIsEqual(misc, _T("auto off"))) {
    task_behaviour.auto_mc = false;
    Profile::Set(szProfileAutoMc, false);
  } else if (StringIsEqual(misc, _T("auto show"))) {
    if (task_behaviour.auto_mc) {
      Message::AddMessage(_("Auto. MacCready on"));
    } else {
      Message::AddMessage(_("Auto. MacCready off"));
    }
  } else if (StringIsEqual(misc, _T("show"))) {
    TCHAR Temp[100];
    FormatUserVerticalSpeed(mc, Temp, false);
    Message::AddMessage(_("MacCready "), Temp);
  }
}
Ejemplo n.º 4
0
void
TaskCalculatorPanel::Prepare(ContainerWindow &parent, const PixelRect &rc)
{
  assert(protected_task_manager != nullptr);

  instance = this;

  Add(new TextWidget());
  SetRowVisible(WARNING, false);

  AddReadOnly(_("Assigned task time"));
  AddReadOnly(_("Estimated task time"));
  AddReadOnly(_("Task distance"), nullptr, _T("%.0f %s"),
              UnitGroup::DISTANCE, fixed(0));

  AddFloat(_("Set MacCready"),
           _("Adjusts MC value used in the calculator.  "
             "Use this to determine the effect on estimated task time due to changes in conditions.  "
             "This value will not affect the main computer's setting if the dialog is exited with the Cancel button."),
           _T("%.1f %s"), _T("%.1f"),
           fixed(0), Units::ToUserVSpeed(fixed(5)),
           GetUserVerticalSpeedStep(), false, fixed(0),
           this);
  DataFieldFloat &mc_df = (DataFieldFloat &)GetDataField(MC);
  mc_df.SetFormat(GetUserVerticalSpeedFormat(false, false));

  AddReadOnly(_("AAT range"),
              /* xgettext:no-c-format */
              _("For AAT tasks, this value tells you how far based on the targets of your task you will fly relative to the minimum and maximum possible tasks. -100% indicates the minimum AAT distance.  0% is the nominal AAT distance.  +100% is maximum AAT distance."),
              _T("%.0f %%"), fixed(0));

  AddReadOnly(_("Speed remaining"), nullptr, _T("%.0f %s"),
              UnitGroup::TASK_SPEED, fixed(0));

  AddReadOnly(_("Achieved MacCready"), nullptr, _T("%.1f %s"),
              UnitGroup::VERTICAL_SPEED, fixed(0));
  DataFieldFloat &emc_df = (DataFieldFloat &)GetDataField(EFFECTIVE_MC);
  emc_df.SetFormat(GetUserVerticalSpeedFormat(false, false));

  AddReadOnly(_("Achieved speed"), nullptr, _T("%.0f %s"),
              UnitGroup::TASK_SPEED, fixed(0));

  AddFloat(_("Cruise efficiency"),
           _("Efficiency of cruise.  100 indicates perfect MacCready performance, greater than 100 indicates better than MacCready performance is achieved through flying in streets.  Less than 100 is appropriate if you fly considerably off-track.  This value estimates your cruise efficiency according to the current flight history with the set MC value.  Calculation begins after task is started."),
           _T("%.0f %%"), _T("%.0f"),
           fixed(0), fixed(100), fixed(1), false, fixed(0),
           this);
}
Ejemplo n.º 5
0
void
SafetyFactorsConfigPanel::Prepare(ContainerWindow &parent, const PixelRect &rc)
{
  RowFormWidget::Prepare(parent, rc);

  const ComputerSettings &settings_computer = CommonInterface::GetComputerSettings();
  const TaskBehaviour &task_behaviour = settings_computer.task;

  AddFloat(_("Arrival height"),
           _("The height above terrain that the glider should arrive at for a safe landing."),
           _T("%.0f %s"), _T("%.0f"),
           fixed(0), fixed(10000), fixed(100), false,
           UnitGroup::ALTITUDE, task_behaviour.safety_height_arrival);

  AddFloat(_("Terrain height"),
           _("The height above terrain that the glider must clear during final glide."),
           _T("%.0f %s"), _T("%.0f"),
           fixed(0), fixed(10000), fixed(100), false,
           UnitGroup::ALTITUDE, task_behaviour.route_planner.safety_height_terrain);

  static constexpr StaticEnumChoice abort_task_mode_list[] = {
    { (unsigned)AbortTaskMode::SIMPLE, N_("Simple"),
      N_("The alternates will only be sorted by waypoint type (airport/outlanding field) and arrival height.") },
    { (unsigned)AbortTaskMode::TASK, N_("Task"),
      N_("The sorting will also take the current task direction into account.") },
    { (unsigned)AbortTaskMode::HOME, N_("Home"),
      N_("The sorting will try to find landing options in the current direction to the configured home waypoint.") },
    { 0 }
  };

  AddEnum(_("Alternates mode"),
          _("Determines sorting of alternates in the alternates dialog and in abort mode."),
          abort_task_mode_list, (unsigned)task_behaviour.abort_task_mode);

  AddFloat(_("Polar degradation"), /* xgettext:no-c-format */
           _("A permanent polar degradation. "
             "0% means no degradation, "
             "50% indicates the glider's sink rate is doubled."),
           _T("%.0f %%"), _T("%.0f"),
           fixed(0), fixed(50), fixed(1), false,
           (fixed(1) - settings_computer.polar.degradation_factor) * 100);
  SetExpertRow(PolarDegradation);

  AddBoolean(_("Auto bugs"), /* xgettext:no-c-format */
           _("If enabled, adds 1% to the bugs setting after each full hour while flying."),
             settings_computer.polar.auto_bugs);
  SetExpertRow(AutoBugs);

  AddFloat(_("Safety MC"),
           _("The MacCready setting used, when safety MC is enabled for reach calculations, in task abort mode and for determining arrival altitude at airfields."),
           _T("%.1f %s"), _T("%.1f"),
           fixed(0), Units::ToUserVSpeed(fixed(10)), GetUserVerticalSpeedStep(),
           false, UnitGroup::VERTICAL_SPEED, task_behaviour.safety_mc);
  SetExpertRow(SafetyMC);
  DataFieldFloat &safety_mc = (DataFieldFloat &)GetDataField(SafetyMC);
  safety_mc.SetFormat(GetUserVerticalSpeedFormat(false, false));

  AddFloat(_("STF risk factor"),
           _("The STF risk factor reduces the MacCready setting used to calculate speed to fly as the glider gets low, in order to compensate for risk. Set to 0.0 for no compensation, 1.0 scales MC linearly with current height (with reference to height of the maximum climb). If considered, 0.3 is recommended."),
           _T("%.1f %s"), _T("%.1f"),
           fixed(0), fixed(1), fixed(0.1), false,
           task_behaviour.risk_gamma);
  SetExpertRow(RiskFactor);
}
Ejemplo n.º 6
0
void
AudioVarioConfigPanel::Prepare(ContainerWindow &parent, const PixelRect &rc)
{
  RowFormWidget::Prepare(parent, rc);

  if (!AudioVarioGlue::HaveAudioVario())
    return;

  const auto &settings = CommonInterface::GetUISettings().sound.vario;

  AddBoolean(_("Audio vario"),
             _("Emulate the sound of an electronic vario."),
             settings.enabled);

  AddInteger(_("Volume"), nullptr, _T("%u %%"), _T("%u"),
             0, 100, 1, settings.volume);

  AddBoolean(_("Enable Deadband"),
             _("Mute the audio output in when the current lift is in a certain "
               "range around zero"), settings.dead_band_enabled);

  AddSpacer();
  SetExpertRow(SPACER);

  AddInteger(_("Min. Frequency"),
             _("The tone frequency that is played at maximum sink rate."),
             _T("%u Hz"), _T("%u"),
             50, 3000, 50, settings.min_frequency);
  SetExpertRow(MIN_FREQUENCY);

  AddInteger(_("Zero Frequency"),
             _("The tone frequency that is played at zero climb rate."),
             _T("%u Hz"), _T("%u"),
             50, 3000, 50, settings.zero_frequency);
  SetExpertRow(ZERO_FREQUENCY);

  AddInteger(_("Max. Frequency"),
             _("The tone frequency that is played at maximum climb rate."),
             _T("%u Hz"), _T("%u"),
             50, 3000, 50, settings.max_frequency);
  SetExpertRow(MAX_FREQUENCY);

  AddSpacer();
  SetExpertRow(SPACER2);

  AddFloat(_("Deadband min. lift"),
           _("Below this lift threshold the vario will start to play sounds if the 'Deadband' feature is enabled."),
           _T("%.1f %s"), _T("%.1f"),
           Units::ToUserVSpeed(-5), 0,
           GetUserVerticalSpeedStep(), false, UnitGroup::VERTICAL_SPEED,
           settings.min_dead);
  SetExpertRow(DEAD_BAND_MIN);
  DataFieldFloat &db_min = (DataFieldFloat &)GetDataField(DEAD_BAND_MIN);
  db_min.SetFormat(GetUserVerticalSpeedFormat(false, true));

  AddFloat(_("Deadband max. lift"),
           _("Above this lift threshold the vario will start to play sounds if the 'Deadband' feature is enabled."),
           _T("%.1f %s"), _T("%.1f"),
           0, Units::ToUserVSpeed(2),
           GetUserVerticalSpeedStep(), false, UnitGroup::VERTICAL_SPEED,
           settings.max_dead);
  SetExpertRow(DEAD_BAND_MAX);
  DataFieldFloat &db_max = (DataFieldFloat &)GetDataField(DEAD_BAND_MAX);
  db_max.SetFormat(GetUserVerticalSpeedFormat(false, true));
}