Example #1
0
void
RASPSettingsPanel::Prepare(ContainerWindow &parent, const PixelRect &rc)
{
  WndProperty *wp;

  wp = AddEnum(_("Field"), nullptr);
  DataFieldEnum *dfe = (DataFieldEnum *)wp->GetDataField();
  dfe->EnableItemHelp(true);
  dfe->addEnumText(_("Terrain"));
  for (unsigned i = 1; i < RasterWeather::MAX_WEATHER_MAP; i++) {
    const TCHAR *label = RASP.ItemLabel(i);
    if (label != NULL)
      dfe->AddChoice(i, label, nullptr, RASP.ItemHelp(i));
  }

  dfe->Set(RASP.GetParameter());
  wp->RefreshDisplay();

  wp = AddEnum(_("Time"), nullptr);
  dfe = (DataFieldEnum *)wp->GetDataField();
  dfe->addEnumText(_("Now"));
  for (unsigned i = 1; i < RasterWeather::MAX_WEATHER_TIMES; i++) {
    if (RASP.isWeatherAvailable(i)) {
      TCHAR timetext[10];
      _stprintf(timetext, _T("%04d"), RASP.IndexToTime(i));
      dfe->addEnumText(timetext, i);
    }
  }

  dfe->Set(RASP.GetTime());
  wp->RefreshDisplay();
}
Example #2
0
//
// We cannot use setVariables from here, otherwise we would be adding more
// enum text to the selection list, each time we reset.
// We simply set the value, because the enum text list is already set.
//
static void OnResetClicked(WindowControl * Sender){

  WndProperty *wp;
  extern void Reset_Multimap_Mode(void);
  Reset_Multimap_Mode();

  wp = (WndProperty*)wf->FindByName(TEXT("prpMultimap1"));
  if (wp) {
	DataFieldEnum* dfe;
	dfe = (DataFieldEnum*)wp->GetDataField();
	dfe->Set(Multimap1);
	wp->RefreshDisplay();
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpMultimap2"));
  if (wp) {
	DataFieldEnum* dfe;
	dfe = (DataFieldEnum*)wp->GetDataField();
	dfe->Set(Multimap2);
	wp->RefreshDisplay();
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpMultimap3"));
  if (wp) {
	DataFieldEnum* dfe;
	dfe = (DataFieldEnum*)wp->GetDataField();
	dfe->Set(Multimap3);
	wp->RefreshDisplay();
  }

}
Example #3
0
void
dlgWeatherShowModal()
{

  wf = LoadDialog(CallBackTable, UIGlobals::GetMainWindow(),
                  _T("IDR_XML_WEATHER"));
  if (wf == NULL)
    return;

  WndProperty* wp;

  wp = (WndProperty*)wf->FindByName(_T("prpTime"));
  if (wp) {
    DataFieldEnum* dfe;
    dfe = (DataFieldEnum*)wp->GetDataField();
    dfe->addEnumText(_T("Now"));
    for (unsigned i = 1; i < RasterWeather::MAX_WEATHER_TIMES; i++) {
      if (RASP.isWeatherAvailable(i)) {
        TCHAR timetext[10];
        _stprintf(timetext, _T("%04d"), RASP.IndexToTime(i));
        dfe->addEnumText(timetext, i);
      }
    }

    dfe->Set(RASP.GetTime());

    wp->RefreshDisplay();
  }

  wp = (WndProperty*)wf->FindByName(_T("prpDisplayItem"));
  DataFieldEnum* dfe;
  if (wp) {
    dfe = (DataFieldEnum*)wp->GetDataField();
    dfe->addEnumText(_("Terrain"));

    for (int i = 1; i <= 15; i++) {
      const TCHAR *label = RASP.ItemLabel(i);
      if (label != NULL)
        dfe->addEnumText(label, i);
    }
    dfe->Set(RASP.GetParameter());
    wp->RefreshDisplay();
  }

  wf->ShowModal();

  wp = (WndProperty*)wf->FindByName(_T("prpTime"));
  if (wp) {
    DataFieldEnum* dfe;
    dfe = (DataFieldEnum*)wp->GetDataField();
    RASP.SetTime(dfe->GetAsInteger());
  }

  wp = (WndProperty*)wf->FindByName(_T("prpDisplayItem"));
  if (wp)
    RASP.SetParameter(wp->GetDataField()->GetAsInteger());

  delete wf;
}
Example #4
0
static void
SetPort(DataFieldEnum &df, DeviceConfig::PortType type, const TCHAR *value)
{
  assert(value != NULL);

  if (!df.Set(value))
    df.Set(AddPort(df, type, value));
}
Example #5
0
static void
LoadGUI()
{
  assert(!locked);
  locked = true;

  WndProperty* wp;

  wp = (WndProperty*)wf->FindByName(_T("prpFontName"));
  if (wp) {
    DataFieldEnum* dfe = (DataFieldEnum*)wp->GetDataField();
    if (dfe) {
      dfe->Set(0);

      unsigned i;
      for (i = 0; i < dfe->Count(); i++) {
        if (_tcsncmp(dfe->GetAsString(), NewLogFont.lfFaceName, LF_FACESIZE)
            == 0)
          break;

        dfe->Inc();
      }

      if (i == dfe->Count())
        dfe->Set(dfe->addEnumText(NewLogFont.lfFaceName));
    }
    wp->RefreshDisplay();
  }

  wp = (WndProperty*)wf->FindByName(_T("prpFontHeight"));
  if (wp) {
    DataFieldInteger* dfi = (DataFieldInteger*)wp->GetDataField();
    if (dfi)
      dfi->Set(NewLogFont.lfHeight);

    wp->RefreshDisplay();
  }
  wp = (WndProperty*)wf->FindByName(_T("prpFontWeight"));
  if (wp) {
    DataFieldBoolean* dfi = (DataFieldBoolean*)wp->GetDataField();
    if (dfi)
      dfi->Set(NewLogFont.lfWeight > 500);

    wp->RefreshDisplay();
  }
  wp = (WndProperty*)wf->FindByName(_T("prpFontItalic"));
  if (wp) {
    DataFieldBoolean* dfb = (DataFieldBoolean*)wp->GetDataField();
    if (dfb)
      dfb->Set(NewLogFont.lfItalic);

    wp->RefreshDisplay();
  }

  locked = false;

  RedrawSampleFont();
}
Example #6
0
void
RouteConfigPanel::Init(WndForm *_wf)
{
  assert(_wf != NULL);
  wf = _wf;
  WndProperty *wp;
  const SETTINGS_COMPUTER &settings_computer = XCSoarInterface::SettingsComputer();

  wp = (WndProperty*)wf->FindByName(_T("prpFinalGlideTerrain"));
  if (wp) {
    DataFieldEnum* dfe;
    dfe = (DataFieldEnum*)wp->GetDataField();
    dfe->addEnumText(_("Off"), SETTINGS_COMPUTER::FGT_OFF);
    dfe->addEnumText(_("Line"), SETTINGS_COMPUTER::FGT_LINE);
    dfe->addEnumText(_("Shade"), SETTINGS_COMPUTER::FGT_SHADE);
    dfe->Set(settings_computer.FinalGlideTerrain);
    wp->RefreshDisplay();
  }

  wp = (WndProperty*)wf->FindByName(_T("prpRoutePlannerMode"));
  if (wp) {
    DataFieldEnum* dfe;
    dfe = (DataFieldEnum*)wp->GetDataField();
    dfe->addEnumText(_("None"));
    dfe->addEnumText(_("Terrain"));
    dfe->addEnumText(_("Airspace"));
    dfe->addEnumText(_("Both"));
    dfe->Set(settings_computer.route_planner.mode);
    wp->RefreshDisplay();
  }

  LoadFormProperty(*wf, _T("prpRoutePlannerAllowClimb"),
                   settings_computer.route_planner.allow_climb);

  LoadFormProperty(*wf, _T("prpRoutePlannerUseCeiling"),
                   settings_computer.route_planner.use_ceiling);

  wp = (WndProperty*)wf->FindByName(_T("prpTurningReach"));
  if (wp) {
    DataFieldEnum* dfe;
    dfe = (DataFieldEnum*)wp->GetDataField();
    dfe->addEnumText(_("Off"));
    dfe->addEnumText(_("Straight"));
    dfe->addEnumText(_("Turning"));
    dfe->Set(settings_computer.route_planner.reach_calc_mode);
    wp->RefreshDisplay();
  }

  wp = (WndProperty*)wf->FindByName(_T("prpReachPolarMode"));
  if (wp) {
    DataFieldEnum* dfe;
    dfe = (DataFieldEnum*)wp->GetDataField();
    dfe->addEnumText(_("Task"));
    dfe->addEnumText(_("Safety MC"));
    dfe->Set(settings_computer.route_planner.reach_polar_mode);
    wp->RefreshDisplay();
  }
}
Example #7
0
static void setVariables(void) {
    WndProperty *wp;

    wp = (WndProperty*)wf->FindByName(TEXT("prpPGOptimizeRoute"));
    if (wp) {
        DataFieldEnum* dfe;
        dfe = (DataFieldEnum*)wp->GetDataField();
        // LKTOKEN  _@M239_ = "Disabled"
        dfe->addEnumText(gettext(TEXT("_@M239_")));
        // LKTOKEN  _@M259_ = "Enabled"
        dfe->addEnumText(gettext(TEXT("_@M259_")));
        dfe = (DataFieldEnum*)wp->GetDataField();
        dfe->Set(PGOptimizeRoute);
        wp->RefreshDisplay();
    }
    wp = (WndProperty*)wf->FindByName(TEXT("prpPGNumberOfGates"));
    if (wp) {
        wp->GetDataField()->SetAsInteger(PGNumberOfGates);
        wp->RefreshDisplay();
    }
    wp = (WndProperty*)wf->FindByName(TEXT("prpPGOpenTimeH"));
    if (wp) {
        wp->GetDataField()->SetAsInteger(PGOpenTimeH);
        wp->RefreshDisplay();
    }
    wp = (WndProperty*)wf->FindByName(TEXT("prpPGOpenTimeM"));
    if (wp) {
        wp->GetDataField()->SetAsInteger(PGOpenTimeM);
        wp->RefreshDisplay();
    }
    wp = (WndProperty*)wf->FindByName(TEXT("prpPGCloseTimeH"));
    if (wp) {
        wp->GetDataField()->SetAsInteger(PGCloseTimeH);
        wp->RefreshDisplay();
    }
    wp = (WndProperty*)wf->FindByName(TEXT("prpPGCloseTimeM"));
    if (wp) {
        wp->GetDataField()->SetAsInteger(PGCloseTimeM);
        wp->RefreshDisplay();
    }
    wp = (WndProperty*)wf->FindByName(TEXT("prpPGGateIntervalTime"));
    if (wp) {
        wp->GetDataField()->SetAsInteger(PGGateIntervalTime);
        wp->RefreshDisplay();
    }
    wp = (WndProperty*)wf->FindByName(TEXT("prpPGStartOut"));
    if (wp) {
        DataFieldEnum* dfe;
        dfe = (DataFieldEnum*)wp->GetDataField();
        // LKTOKEN  _@M343_ = "IN (Exit)"
        dfe->addEnumText(gettext(TEXT("_@M343_")));
        // LKTOKEN  _@M498_ = "OUT (Enter)"
        dfe->addEnumText(gettext(TEXT("_@M498_")));
        dfe->Set(PGStartOut);
        wp->RefreshDisplay();
    }
}
Example #8
0
void
dlgWeatherShowModal()
{
  WndForm *wf = LoadDialog(nullptr, UIGlobals::GetMainWindow(),
                           _T("IDR_XML_WEATHER"));
  if (wf == NULL)
    return;

  WndProperty* wp;

  wp = (WndProperty*)wf->FindByName(_T("prpTime"));
  assert(wp != nullptr);
  DataFieldEnum *dfe = (DataFieldEnum *)wp->GetDataField();
  dfe->addEnumText(_("Now"));
  for (unsigned i = 1; i < RasterWeather::MAX_WEATHER_TIMES; i++) {
    if (RASP.isWeatherAvailable(i)) {
      TCHAR timetext[10];
      _stprintf(timetext, _T("%04d"), RASP.IndexToTime(i));
      dfe->addEnumText(timetext, i);
    }
  }

  dfe->Set(RASP.GetTime());
  wp->RefreshDisplay();

  wp = (WndProperty *)wf->FindByName(_T("prpDisplayItem"));
  assert(wp != nullptr);
  dfe = (DataFieldEnum *)wp->GetDataField();
  dfe->EnableItemHelp(true);
  dfe->addEnumText(_("Terrain"));

  for (int i = 1; i <= 15; i++) {
    const TCHAR *label = RASP.ItemLabel(i);
    if (label != NULL)
      dfe->AddChoice(i, label, nullptr, RASP.ItemHelp(i));
  }
  dfe->Set(RASP.GetParameter());
  wp->RefreshDisplay();

  wf->ShowModal();

  wp = (WndProperty *)wf->FindByName(_T("prpTime"));
  assert(wp != nullptr);
  dfe = (DataFieldEnum *)wp->GetDataField();
  RASP.SetTime(dfe->GetValue());

  wp = (WndProperty *)wf->FindByName(_T("prpDisplayItem"));
  assert(wp != nullptr);
  dfe = (DataFieldEnum *)wp->GetDataField();
  RASP.SetParameter(dfe->GetValue());

  delete wf;
}
Example #9
0
static void setVariables(void) {
  WndProperty *wp;

  wp = (WndProperty*)wf->FindByName(TEXT("prpMultimap1"));
  if (wp) {
	DataFieldEnum* dfe;
	dfe = (DataFieldEnum*)wp->GetDataField();

	dfe->addEnumText(MsgToken(239)); // Disabled
	dfe->addEnumText(MsgToken(259)); // Enabled


	dfe->Set(Multimap1);
	wp->RefreshDisplay();
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpMultimap2"));
  if (wp) {
	DataFieldEnum* dfe;
	dfe = (DataFieldEnum*)wp->GetDataField();

	dfe->addEnumText(MsgToken(239)); // Disabled
	dfe->addEnumText(MsgToken(259)); // Enabled


	dfe->Set(Multimap2);
	wp->RefreshDisplay();
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpMultimap3"));
  if (wp) {
	DataFieldEnum* dfe;
	dfe = (DataFieldEnum*)wp->GetDataField();

	dfe->addEnumText(MsgToken(239)); // Disabled
	dfe->addEnumText(MsgToken(259)); // Enabled


	dfe->Set(Multimap3);
	wp->RefreshDisplay();
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpMultimap4"));
  if (wp) {
	DataFieldEnum* dfe;
	dfe = (DataFieldEnum*)wp->GetDataField();

	dfe->addEnumText(MsgToken(239)); // Disabled
	dfe->addEnumText(MsgToken(259)); // Enabled


	dfe->Set(Multimap4);
	wp->RefreshDisplay();
  }
}
Example #10
0
void
TaskRulesConfigPanel::Init(WndForm *_wf)
{
  assert(_wf != NULL);
  wf = _wf;
  WndProperty *wp;
  const SETTINGS_COMPUTER &settings_computer = XCSoarInterface::SettingsComputer();

  LoadFormProperty(*wf, _T("prpStartMaxSpeed"), ugHorizontalSpeed,
                   settings_computer.ordered_defaults.start_max_speed);

  LoadFormProperty(*wf, _T("prpStartMaxSpeedMargin"), ugHorizontalSpeed,
                   settings_computer.start_max_speed_margin);

  LoadFormProperty(*wf, _T("prpStartMaxHeight"), ugAltitude,
                   settings_computer.ordered_defaults.start_max_height);

  LoadFormProperty(*wf, _T("prpStartMaxHeightMargin"), ugAltitude,
                   settings_computer.start_max_height_margin);

  wp = (WndProperty*)wf->FindByName(_T("prpStartHeightRef"));
  if (wp) {
    DataFieldEnum* dfe;
    dfe = (DataFieldEnum*)wp->GetDataField();
    dfe->addEnumText(_("AGL"));
    dfe->addEnumText(_("MSL"));
    dfe->Set(settings_computer.ordered_defaults.start_max_height_ref);
    wp->RefreshDisplay();
  }

  LoadFormProperty(*wf, _T("prpFinishMinHeight"), ugAltitude,
                   settings_computer.ordered_defaults.finish_min_height);

  wp = (WndProperty*)wf->FindByName(_T("prpContests"));
  if (wp) {
    DataFieldEnum* dfe;
    dfe = (DataFieldEnum*)wp->GetDataField();
    dfe->addEnumText(ContestToString(OLC_FAI), OLC_FAI);
    dfe->addEnumText(ContestToString(OLC_Classic), OLC_Classic);
    dfe->addEnumText(ContestToString(OLC_League), OLC_League);
    dfe->addEnumText(ContestToString(OLC_Plus), OLC_Plus);
    dfe->addEnumText(ContestToString(OLC_XContest), OLC_XContest);
    dfe->addEnumText(ContestToString(OLC_DHVXC), OLC_DHVXC);
    dfe->addEnumText(ContestToString(OLC_SISAT), OLC_SISAT);
    dfe->Set(settings_computer.contest);
    wp->RefreshDisplay();
  }
}
Example #11
0
/*
 * Reads task points from the
 * protected task manager
 * and loads the Task Point UI
 * and initializes the pan mode on the map
 */
static void
InitTargetPoints()
{
  WndProperty *wp = (WndProperty*)wf->FindByName(_T("prpTaskPoint"));
  GetTaskData();
  DataFieldEnum* dfe;
  dfe = (DataFieldEnum*)wp->GetDataField();
  TCHAR tp_label[80];
  TCHAR tp_short[21];

  if (TaskSize <= target_point)
    target_point = ActiveTaskPointOnEntry;
  else
    target_point = max(target_point, ActiveTaskPointOnEntry);

  target_point = max(0, min((int)target_point, (int)TaskSize - 1));
  for (unsigned i = ActiveTaskPointOnEntry; i < TaskSize; i++) {
    _tcsncpy(tp_short, protected_task_manager.get_ordered_taskpoint_name(i), 20);
    tp_short[20] = 0;
    _stprintf(tp_label, _T("%d %s"), i, tp_short);
    dfe->addEnumText(tp_label);
  }
  dfe->Set(max(0, (int)target_point - (int)ActiveTaskPointOnEntry));

  if (TaskSize > target_point) {
    const GeoPoint t = protected_task_manager.get_ordered_taskpoint_location(target_point,
        XCSoarInterface::Basic().Location);
    SetZoom();
    XCSoarInterface::SetSettingsMap().TargetPan = true;
    XCSoarInterface::SetSettingsMap().EnablePan = true;
    XCSoarInterface::SetSettingsMap().PanLocation = t;
    XCSoarInterface::SetSettingsMap().TargetPanIndex = target_point;
  }
  wp->RefreshDisplay();
}
Example #12
0
/**
 * Reads task points from the protected task manager
 * and loads the Task Point UI and initializes the pan mode on the map
 */
static bool
InitTargetPoints()
{
  WndProperty *wp = (WndProperty*)wf->FindByName(_T("prpTaskPoint"));
  DataFieldEnum* dfe;
  dfe = (DataFieldEnum*)wp->GetDataField();

  if (!GetTaskData(*dfe))
    return false;

  if (TaskSize <= target_point)
    target_point = ActiveTaskPointOnEntry;
  else
    target_point = max(target_point, ActiveTaskPointOnEntry);

  target_point = max(0, min((int)target_point, (int)TaskSize - 1));

  dfe->Set(max(0, (int)target_point - (int)ActiveTaskPointOnEntry));

  if (TaskSize > target_point) {
    SetTarget();
  }

  wp->RefreshDisplay();
  return true;
}
Example #13
0
void
ExperimentalConfigPanel::Init(WndForm *_wf)
{
  assert(_wf != NULL);
  wf = _wf;
  WndProperty *wp;

  if (!is_windows_ce() || is_altair()) {
    wp = (WndProperty*)wf->FindByName(_T("prpAppInfoBoxModel"));
    if (wp) {
      wp->hide();
    }
  }

#if defined(_WIN32_WCE) && !defined(GNAV)
// VENTA-ADDON Model change config menu 11
  wp = (WndProperty*)wf->FindByName(_T("prpAppInfoBoxModel"));
  if (wp) {
    DataFieldEnum* dfe;
    dfe = (DataFieldEnum*)wp->GetDataField();
    dfe->addEnumText(_("Generic"));
    dfe->addEnumText(_T("HP31x"));
    dfe->addEnumText(_T("MedionP5"));
    dfe->addEnumText(_T("MIO"));
    dfe->addEnumText(_T("Nokia500")); // VENTA3
    dfe->addEnumText(_T("PN6000"));
    dfe->Set((int)GlobalModelType);
    wp->RefreshDisplay();
  }
#endif
}
Example #14
0
void
RASPSettingsPanel::Prepare(ContainerWindow &parent, const PixelRect &rc)
{
  const WeatherUIState &state = CommonInterface::GetUIState().weather;
  time = state.time;

  WndProperty *wp;

  wp = AddEnum(_("Field"), nullptr, this);
  DataFieldEnum *dfe = (DataFieldEnum *)wp->GetDataField();
  dfe->EnableItemHelp(true);
  for (unsigned i = 0; i < rasp.GetItemCount(); i++) {
    const auto &mi = rasp.GetItemInfo(i);
    const TCHAR *label = mi.label;
    if (label != nullptr)
      label = gettext(label);

    const TCHAR *help = mi.help;
    if (help != nullptr)
      help = gettext(help);

    dfe->AddChoice(i, mi.name, label, help);
  }

  dfe->Set(state.map);
  wp->RefreshDisplay();

  AddEnum(_("Time"), nullptr, this);
  UpdateTimeControl();
}
Example #15
0
static void setVariables(void) {
  WndProperty *wp;

  wp = (WndProperty*)wf->FindByName(TEXT("prpFAIFinishHeight"));
  if (wp) {
    wp->GetDataField()->Set(EnableFAIFinishHeight);
    wp->RefreshDisplay();
  }

  wp = (WndProperty*)wf->FindByName(TEXT("prpStartHeightRef"));
  if (wp) {
    DataFieldEnum* dfe;
    dfe = (DataFieldEnum*)wp->GetDataField();
    dfe->addEnumText(gettext(TEXT("AGL")));
    dfe->addEnumText(gettext(TEXT("MSL")));
    dfe->Set(StartHeightRef);
    wp->RefreshDisplay();
  }


  wp = (WndProperty*)wf->FindByName(TEXT("prpFinishMinHeight"));
  if (wp) {
    wp->GetDataField()->SetAsFloat(iround(FinishMinHeight*ALTITUDEMODIFY/1000));
    wp->GetDataField()->SetUnits(Units::GetAltitudeName());
    wp->RefreshDisplay();
  }

  wp = (WndProperty*)wf->FindByName(TEXT("prpStartMaxHeight"));
  if (wp) {
    wp->GetDataField()->SetAsFloat(iround(StartMaxHeight*ALTITUDEMODIFY/1000));
    wp->GetDataField()->SetUnits(Units::GetAltitudeName());
    wp->RefreshDisplay();
  }

  wp = (WndProperty*)wf->FindByName(TEXT("prpStartMaxHeightMargin"));
  if (wp) {
    wp->GetDataField()->SetAsFloat(iround(StartMaxHeightMargin*ALTITUDEMODIFY/1000));
    wp->GetDataField()->SetUnits(Units::GetAltitudeName());
    wp->RefreshDisplay();
  }

  wp = (WndProperty*)wf->FindByName(TEXT("prpStartMaxSpeed"));
  if (wp) {
    wp->GetDataField()->SetAsFloat(iround(StartMaxSpeed*SPEEDMODIFY/1000));
    wp->GetDataField()->SetUnits(Units::GetHorizontalSpeedName());
    wp->RefreshDisplay();
  }

  wp = (WndProperty*)wf->FindByName(TEXT("prpStartMaxSpeedMargin"));
  if (wp) {
    wp->GetDataField()->SetAsFloat(iround(StartMaxSpeedMargin*SPEEDMODIFY/1000));
    wp->GetDataField()->SetUnits(Units::GetHorizontalSpeedName());
    wp->RefreshDisplay();
  }


}
Example #16
0
static void
FilterMode(bool direction)
{
  if (direction) {
    dialog_state.distance = fixed(-1);
    dialog_state.direction = WILDCARD;

    DataFieldEnum *df = (DataFieldEnum *)distance_control->GetDataField();
    df->Set(WILDCARD);
    distance_control->RefreshDisplay();

    df = (DataFieldEnum *)direction_control->GetDataField();
    df->Set(WILDCARD);
    direction_control->RefreshDisplay();
  } else {
    DataFieldString *df = (DataFieldString *)name_control->GetDataField();
    df->Set(_T(""));
    name_control->RefreshDisplay();
  }
}
Example #17
0
static void
FillPortTypes(DataFieldEnum &df, const DeviceConfig &config)
{
  for (unsigned i = 0; port_types[i].label != NULL; i++) {
    unsigned id = AddPort(df, port_types[i].type, port_types[i].label,
                          gettext(port_types[i].label));

    if (port_types[i].type == config.port_type)
      df.Set(id);
  }
}
Example #18
0
static DataField *
CreateDirectionDataField(DataFieldListener *listener)
{
  TCHAR buffer[12];
  DataFieldEnum *df = new DataFieldEnum(listener);
  for (unsigned i = 0; i < ARRAY_SIZE(direction_filter_items); i++)
    df->addEnumText(GetDirectionData(buffer, ARRAY_SIZE(buffer), i));

  df->Set(dialog_state.direction_index);
  return df;
}
Example #19
0
static void
SetPort(DataFieldEnum &df, const DeviceConfig &config)
{
  switch (config.port_type) {
  case DeviceConfig::PortType::DISABLED:
  case DeviceConfig::PortType::AUTO:
  case DeviceConfig::PortType::INTERNAL:
  case DeviceConfig::PortType::DROIDSOAR_V2:
  case DeviceConfig::PortType::NUNCHUCK:
  case DeviceConfig::PortType::I2CPRESSURESENSOR:
  case DeviceConfig::PortType::IOIOVOLTAGE:
  case DeviceConfig::PortType::TCP_CLIENT:
  case DeviceConfig::PortType::TCP_LISTENER:
  case DeviceConfig::PortType::UDP_LISTENER:
  case DeviceConfig::PortType::PTY:
  case DeviceConfig::PortType::RFCOMM_SERVER:
    break;

  case DeviceConfig::PortType::SERIAL:
    SetPort(df, config.port_type, config.path);
    return;

  case DeviceConfig::PortType::RFCOMM:
    SetPort(df, config.port_type, config.bluetooth_mac);
    return;

  case DeviceConfig::PortType::IOIOUART:
    StaticString<16> buffer;
    buffer.UnsafeFormat(_T("%d"), config.ioio_uart_id);
    df.Set(buffer);
    return;
  }

  for (unsigned i = 0; port_types[i].label != NULL; i++) {
    if (port_types[i].type == config.port_type) {
      df.Set(port_types[i].label);
      break;
    }
  }
}
Example #20
0
static void SetWaypointValues(bool first=false) {
  WndProperty* wp;

  wp = (WndProperty*)wf->FindByName(TEXT("prpAATType"));
  if (wp) {
    DataFieldEnum* dfe;
    dfe = (DataFieldEnum*)wp->GetDataField();
    if (first) {
	// LKTOKEN  _@M210_ = "Cylinder" 
      dfe->addEnumText(gettext(TEXT("_@M210_")));
	// LKTOKEN  _@M590_ = "Sector" 
      dfe->addEnumText(gettext(TEXT("_@M590_")));
    }
    dfe->SetDetachGUI(true); // disable call to OnAATEnabled
    dfe->Set(Task[twItemIndex].AATType);
    dfe->SetDetachGUI(false);
    wp->RefreshDisplay();
  }

  wp = (WndProperty*)wf->FindByName(TEXT("prpAATCircleRadius"));
  if (wp) {
    wp->GetDataField()->SetAsFloat(lround(Task[twItemIndex].AATCircleRadius
                                          *DISTANCEMODIFY*DISTANCE_ROUNDING)/DISTANCE_ROUNDING);
    wp->GetDataField()->SetUnits(Units::GetDistanceName());
    wp->SetVisible(Task[twItemIndex].AATType==0);
    wp->RefreshDisplay();
  }

  wp = (WndProperty*)wf->FindByName(TEXT("prpAATSectorRadius"));
  if (wp) {
    wp->GetDataField()->SetAsFloat(lround(Task[twItemIndex].AATSectorRadius
                                          *DISTANCEMODIFY*DISTANCE_ROUNDING)/DISTANCE_ROUNDING);
    wp->GetDataField()->SetUnits(Units::GetDistanceName());
    wp->SetVisible(Task[twItemIndex].AATType>0);
    wp->RefreshDisplay();    
  }

  wp = (WndProperty*)wf->FindByName(TEXT("prpAATStartRadial"));
  if (wp) {
    wp->GetDataField()->SetAsFloat(Task[twItemIndex].AATStartRadial);
    wp->SetVisible(Task[twItemIndex].AATType>0);
    wp->RefreshDisplay();
  }

  wp = (WndProperty*)wf->FindByName(TEXT("prpAATFinishRadial"));
  if (wp) {
    wp->GetDataField()->SetAsFloat(Task[twItemIndex].AATFinishRadial);
    wp->SetVisible(Task[twItemIndex].AATType>0);
    wp->RefreshDisplay();
  }

}
Example #21
0
static void SetWaypointValues(bool first=false) {
  WndProperty* wp;

  TASK_POINT tp = task.getTaskPoint(twItemIndex);

  wp = (WndProperty*)wf->FindByName(_T("prpAATType"));
  if (wp) {
    DataFieldEnum* dfe;
    dfe = (DataFieldEnum*)wp->GetDataField();
    if (first) {
      dfe->addEnumText(gettext(_T("Cylinder")));
      dfe->addEnumText(gettext(_T("Sector")));
    }
    dfe->SetDetachGUI(true); // disable call to OnAATEnabled
    dfe->Set(tp.AATType);
    dfe->SetDetachGUI(false);
    wp->RefreshDisplay();
  }

  wp = (WndProperty*)wf->FindByName(_T("prpAATCircleRadius"));
  if (wp) {
    wp->GetDataField()->SetAsFloat(lround(tp.AATCircleRadius
                                          *DISTANCEMODIFY*DISTANCE_ROUNDING)/DISTANCE_ROUNDING);
    wp->GetDataField()->SetUnits(Units::GetDistanceName());
    wp->set_visible(tp.AATType == 0);
    wp->RefreshDisplay();
  }

  wp = (WndProperty*)wf->FindByName(_T("prpAATSectorRadius"));
  if (wp) {
    wp->GetDataField()->SetAsFloat(lround(tp.AATSectorRadius
                                          *DISTANCEMODIFY*DISTANCE_ROUNDING)/DISTANCE_ROUNDING);
    wp->GetDataField()->SetUnits(Units::GetDistanceName());
    wp->set_visible(tp.AATType > 0);
    wp->RefreshDisplay();
  }

  wp = (WndProperty*)wf->FindByName(_T("prpAATStartRadial"));
  if (wp) {
    wp->GetDataField()->SetAsFloat(tp.AATStartRadial);
    wp->set_visible(tp.AATType > 0);
    wp->RefreshDisplay();
  }

  wp = (WndProperty*)wf->FindByName(_T("prpAATFinishRadial"));
  if (wp) {
    wp->GetDataField()->SetAsFloat(tp.AATFinishRadial);
    wp->set_visible(tp.AATType > 0);
    wp->RefreshDisplay();
  }

}
Example #22
0
static void
OnNextClicked(gcc_unused WndButton &Sender)
{
  if (target_point < (TaskSize - 1))
    target_point++;
  else
    target_point = ActiveTaskPointOnEntry;
  WndProperty *wp = (WndProperty*)wf->FindByName(_T("prpTaskPoint"));
  DataFieldEnum* dfe = (DataFieldEnum*)wp->GetDataField();
  dfe->Set(target_point - ActiveTaskPointOnEntry);
  RefreshTargetPoint();
  wp->RefreshDisplay();
}
Example #23
0
Window*
InfoBoxContentWind::PnlSetupLoad(SingleWindow &parent, TabBarControl* wTabBar,
                                 WndForm* wf, const int id)
{
  assert(wTabBar);
  assert(wf);

  InfoBoxID = id;

  Window *wInfoBoxAccessSetup =
      LoadWindow(CallBackTable, wf, *wTabBar, _T("IDR_XML_INFOBOXWINDSETUP"));
  assert(wInfoBoxAccessSetup);

  const NMEAInfo &basic = XCSoarInterface::Basic();
  const SETTINGS_COMPUTER &settings_computer =
    XCSoarInterface::SettingsComputer();
  const bool external_wind = basic.external_wind_available &&
    settings_computer.ExternalWind;

  WndProperty* wp;

  wp = (WndProperty*)wf->FindByName(_T("prpAutoWind"));
  if (external_wind) {
    wp->set_enabled(false);
    DataFieldEnum &df = *(DataFieldEnum *)wp->GetDataField();
    df.addEnumText(_("External"));
    df.Set(0);
    wp->RefreshDisplay();
  } else {
    DataFieldEnum* dfe;
    dfe = (DataFieldEnum*)wp->GetDataField();
    dfe->addEnumText(_("Manual"));
    dfe->addEnumText(_("Circling"));
    dfe->addEnumText(_("ZigZag"));
    dfe->addEnumText(_("Both"));
    dfe->Set(settings_computer.AutoWindMode);
    wp->RefreshDisplay();
  }

  wp = (WndProperty*)dlgInfoBoxAccess::GetWindowForm()->FindByName(_T("prpTrailDrift"));
  if (wp) {
    DataFieldBoolean &df = *(DataFieldBoolean *)wp->GetDataField();
    df.Set(XCSoarInterface::SettingsMap().EnableTrailDrift);
    wp->RefreshDisplay();
  }

  return wInfoBoxAccessSetup;
}
Example #24
0
static DataField *
CreateDistanceDataField(DataFieldListener *listener)
{
  DataFieldEnum *df = new DataFieldEnum(listener);
  df->addEnumText(_T("*"));

  TCHAR buffer[15];
  for (unsigned i = 1; i < ARRAY_SIZE(distance_filter_items); i++) {
    FormatUserDistance(Units::ToSysDistance(fixed(distance_filter_items[i])),
                       buffer);
    df->addEnumText(buffer);
  }

  df->Set(dialog_state.distance_index);
  return df;
}
Example #25
0
static DataField *
CreateTypeDataField(DataFieldListener *listener)
{
  DataFieldEnum *df = new DataFieldEnum(listener);
  df->addEnumTexts(type_filter_items);

  const TCHAR *p = Profile::GetPathBase(ProfileKeys::WaypointFile);
  if (p != nullptr)
    df->replaceEnumText((unsigned)TypeFilter::FILE_1, p);

  p = Profile::GetPathBase(ProfileKeys::AdditionalWaypointFile);
  if (p != nullptr)
    df->replaceEnumText((unsigned)TypeFilter::FILE_2, p);

  df->Set((int)dialog_state.type_index);
  return df;
}
Example #26
0
static void
FillDirectionEnum(DataFieldEnum &df)
{
  TCHAR buffer[64];

  df.AddChoice(WILDCARD, _T("*"));
  df.AddChoice(0, GetHeadingString(buffer));

  static constexpr unsigned directions[] = {
    360, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330
  };

  for (unsigned i = 0; i < ARRAY_SIZE(directions); ++i)
    df.AddChoice(directions[i], FormatBearing(directions[i]).c_str());

  df.Set(WILDCARD);
}
Example #27
0
void
InfoBoxManager::SetupFocused()
{
  int i = GetFocused();
  if (i < 0)
    return;

  const enum mode mode = GetCurrentMode();
  int old_type = GetType(i, mode);

  /* create a fake WndProperty for dlgComboPicker() */
  /* XXX reimplement properly */

  DataFieldEnum *dfe = new DataFieldEnum(old_type, NULL);
  for (unsigned i = 0; i < InfoBoxFactory::NUM_TYPES; i++)
    dfe->addEnumText(gettext(GetTypeDescription(i)));
  dfe->Sort(0);
  dfe->Set(old_type);

  ComboList *list = dfe->CreateComboList();
  delete dfe;

  /* let the user select */

  info_box_combo_list = list;
  int result = ComboPicker(XCSoarInterface::main_window, _("InfoBox"), *list,
                           OnInfoBoxHelp);
  if (result < 0) {
    delete list;
    return;
  }

  /* was there a modification? */

  int new_type = (*list)[result].DataFieldIndex;
  delete list;
  if (new_type == old_type)
    return;

  /* yes: apply and save it */

  SetType(i, new_type, mode);
  DisplayInfoBox();
  Profile::SetInfoBoxes(i, GetTypes(i));
}
static void
FillDistanceEnum(DataFieldEnum &df)
{
  df.AddChoice(0, _T("*"));

  static constexpr unsigned distances[] = {
    25, 50, 75, 100, 150, 250, 500, 1000
  };

  TCHAR buffer[64];
  const TCHAR *unit = Units::GetDistanceName();
  for (unsigned i = 0; i < ARRAY_SIZE(distances); ++i) {
    _stprintf(buffer, _T("%u %s"), distances[i], unit);
    df.AddChoice(distances[i], buffer);
  }

  df.Set(0u);
}
Example #29
0
WndProperty *
RowFormWidget::AddEnum(const TCHAR *label, const TCHAR *help,
                       const StaticEnumChoice *list, unsigned value,
                       DataFieldListener *listener)
{
  assert(list != nullptr);

  WndProperty *edit = Add(label, help);
  DataFieldEnum *df = new DataFieldEnum(listener);

  if (list[0].help != nullptr)
    df->EnableItemHelp(true);

  df->AddChoices(list);
  df->Set(value);

  edit->SetDataField(df);
  return edit;
}
Example #30
0
WndProperty *
RowFormWidget::AddEnum(const TCHAR *label, const TCHAR *help,
                       const StaticEnumChoice *list, unsigned value,
                       DataField::DataAccessCallback callback)
{
  assert(list != NULL);

  WndProperty *edit = Add(label, help);
  DataFieldEnum *df = new DataFieldEnum(callback);

  if (list[0].help != NULL)
    df->EnableItemHelp(true);

  df->AddChoices(list);
  df->Set(value);

  edit->SetDataField(df);
  return edit;
}