예제 #1
0
void dlgCustomKeysShowModal(void){

  WndProperty *wp;
  char filename[MAX_PATH];
  LocalPathS(filename, TEXT("dlgCustomKeys.xml"));
  wf = dlgLoadFromXML(CallBackTable,                        
		      filename, 
		      hWndMainWindow,
		      TEXT("IDR_XML_CUSTOMKEYS"));

  if (!wf) return;

  setVariables();

  changed = false;

  wf->ShowModal();

  wp = (WndProperty*)wf->FindByName(TEXT("prpCustomKeyModeLeftUpCorner"));
  if (wp) {
	if (CustomKeyModeLeftUpCorner != (wp->GetDataField()->GetAsInteger())) {
		CustomKeyModeLeftUpCorner = (wp->GetDataField()->GetAsInteger());
		changed=true;
	}
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpCustomKeyModeRightUpCorner"));
  if (wp) {
	if (CustomKeyModeRightUpCorner != (wp->GetDataField()->GetAsInteger())) {
		CustomKeyModeRightUpCorner = (wp->GetDataField()->GetAsInteger());
		changed=true;
	}
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpCustomKeyModeCenter"));
  if (wp) {
	if (CustomKeyModeCenter != (wp->GetDataField()->GetAsInteger())) {
		CustomKeyModeCenter = (wp->GetDataField()->GetAsInteger());
		changed=true;
	}
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpCustomKeyModeCenterScreen"));
  if (wp) {
	if (CustomKeyModeCenterScreen != (wp->GetDataField()->GetAsInteger())) {
		CustomKeyModeCenterScreen = (wp->GetDataField()->GetAsInteger());
		changed=true;
	}
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpCustomKeyTime"));
  if (wp) {
	if (CustomKeyTime != wp->GetDataField()->GetAsInteger()) {
		CustomKeyTime = wp->GetDataField()->GetAsInteger();
		changed = true;
	}
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpCustomKeyModeLeft"));
  if (wp) {
	if (CustomKeyModeLeft != (wp->GetDataField()->GetAsInteger())) {
		CustomKeyModeLeft = (wp->GetDataField()->GetAsInteger());
		changed=true;
	}
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpCustomKeyModeRight"));
  if (wp) {
	if (CustomKeyModeRight != (wp->GetDataField()->GetAsInteger())) {
		CustomKeyModeRight = (wp->GetDataField()->GetAsInteger());
		changed=true;
	}
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpCustomKeyModeAircraftIcon"));
  if (wp) {
	if (CustomKeyModeAircraftIcon != (wp->GetDataField()->GetAsInteger())) {
		CustomKeyModeAircraftIcon = (wp->GetDataField()->GetAsInteger());
		changed=true;
	}
  }


  delete wf;
  wf = NULL;

}
예제 #2
0
static void setVariables(void) {
  WndProperty *wp;

  wp = (WndProperty*)wf->FindByName(TEXT("prpCustomKeyTime"));
  if (wp) {
	wp->GetDataField()->SetAsFloat(CustomKeyTime);
	wp->RefreshDisplay();
  }

  wp = (WndProperty*)wf->FindByName(TEXT("prpCustomKeyModeLeftUpCorner"));
  if (wp) {
	DataFieldEnum* dfe;
	dfe = (DataFieldEnum*)wp->GetDataField();
	AddCustomKeyList(dfe);
	dfe->Set(CustomKeyModeLeftUpCorner);
	wp->RefreshDisplay();
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpCustomKeyModeRightUpCorner"));
  if (wp) {
	DataFieldEnum* dfe;
	dfe = (DataFieldEnum*)wp->GetDataField();
	AddCustomKeyList(dfe);
	dfe->Set(CustomKeyModeRightUpCorner);
	dfe->Set(CustomKeyModeRightUpCorner);
	// if (ISPARAGLIDER) wp->SetReadOnly(true); 2.3q also PGs can use it
	wp->RefreshDisplay();
  }


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

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

  wp = (WndProperty*)wf->FindByName(TEXT("prpCustomKeyModeLeft"));
  if (wp) {
	DataFieldEnum* dfe;
	dfe = (DataFieldEnum*)wp->GetDataField();
	AddCustomKeyList(dfe);
	dfe->Set(CustomKeyModeLeft);
	wp->RefreshDisplay();
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpCustomKeyModeRight"));
  if (wp) {
	DataFieldEnum* dfe;
	dfe = (DataFieldEnum*)wp->GetDataField();
	AddCustomKeyList(dfe);
	dfe->Set(CustomKeyModeRight);
	wp->RefreshDisplay();
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpCustomKeyModeAircraftIcon"));
  if (wp) {
	DataFieldEnum* dfe;
	dfe = (DataFieldEnum*)wp->GetDataField();
	AddCustomKeyList(dfe);
	dfe->Set(CustomKeyModeAircraftIcon);
	wp->RefreshDisplay();
  }

}
예제 #3
0
static void
GetValues()
{
  global_wpt->name = GetFormValueString(*wf, _T("Name"));
  global_wpt->comment = GetFormValueString(*wf, _T("Comment"));

  WndProperty* wp;
  bool sign = false;
  int dd = 0;
  // mm,ss are numerators (division) so don't want to lose decimals
  double num = 0, mm = 0, ss = 0;

  sign = GetFormValueInteger(*wf, _T("prpLongitudeSign")) == 1;
  dd = GetFormValueInteger(*wf, _T("prpLongitudeD"));

  switch (CommonInterface::GetUISettings().coordinate_format) {
  case CoordinateFormat::DDMMSS: // ("DDMMSS");
  case CoordinateFormat::DDMMSS_SS: // ("DDMMSS.ss");
    mm = GetFormValueInteger(*wf, _T("prpLongitudeM"));
    ss = GetFormValueInteger(*wf, _T("prpLongitudeS"));
    num = dd + mm / 60.0 + ss / 3600.0;
    break;
  case CoordinateFormat::DDMM_MMM: // ("DDMM.mmm");
    mm = GetFormValueInteger(*wf, _T("prpLongitudeM"));
    ss = GetFormValueInteger(*wf, _T("prpLongitudemmm"));
    num = dd + (mm + ss / 1000.0) / 60.0;
    break;
  case CoordinateFormat::DD_DDDD: // ("DD.dddd");
    mm = GetFormValueInteger(*wf, _T("prpLongitudeDDDD"));
    num = dd + mm / 10000;
    break;
  case CoordinateFormat::UTM:
    break;
  }

  if (!sign)
    num = -num;

  global_wpt->location.longitude = Angle::Degrees(fixed(num));

  sign = GetFormValueInteger(*wf, _T("prpLatitudeSign")) == 1;
  dd = GetFormValueInteger(*wf, _T("prpLatitudeD"));

  switch (CommonInterface::GetUISettings().coordinate_format) {
  case CoordinateFormat::DDMMSS: // ("DDMMSS");
  case CoordinateFormat::DDMMSS_SS: // ("DDMMSS.ss");
    mm = GetFormValueInteger(*wf, _T("prpLatitudeM"));
    ss = GetFormValueInteger(*wf, _T("prpLatitudeS"));
    num = dd + mm / 60.0 + ss / 3600.0;
    break;
  case CoordinateFormat::DDMM_MMM: // ("DDMM.mmm");
    mm = GetFormValueInteger(*wf, _T("prpLatitudeM"));
    ss = GetFormValueInteger(*wf, _T("prpLatitudemmm"));
    num = dd + (mm + ss / 1000.0) / 60.0;
    break;
  case CoordinateFormat::DD_DDDD: // ("DD.dddd");
    mm = GetFormValueInteger(*wf, _T("prpLatitudeDDDD"));
    num = dd + mm / 10000;
    break;
  case CoordinateFormat::UTM:
    break;
  }

  if (!sign)
    num = -num;

  global_wpt->location.latitude = Angle::Degrees(fixed(num));

  ss = GetFormValueInteger(*wf, _T("prpAltitude"));
  global_wpt->elevation = (ss == 0 && terrain != NULL)
    ? fixed(terrain->GetTerrainHeight(global_wpt->location))
    : Units::ToSysAltitude(fixed(ss));

  wp = (WndProperty*)wf->FindByName(_T("prpFlags"));
  assert(wp != NULL);
  switch (((const DataFieldEnum *)wp->GetDataField())->GetValue()) {
  case 1:
    global_wpt->flags.turn_point = true;
    global_wpt->type = Waypoint::Type::AIRFIELD;
    break;
  case 2:
    global_wpt->type = Waypoint::Type::OUTLANDING;
    break;
  default:
    global_wpt->type = Waypoint::Type::NORMAL;
    global_wpt->flags.turn_point = true;
  };
}
예제 #4
0
void
WindSettingsPanel::Prepare(ContainerWindow &parent, const PixelRect &rc)
{
  RowFormWidget::Prepare(parent, rc);

  const WindSettings &settings = CommonInterface::GetComputerSettings().wind;
  const MapSettings &map_settings = CommonInterface::GetMapSettings();

  static constexpr StaticEnumChoice auto_wind_list[] = {
    { AUTOWIND_NONE, N_("Manual"),
      N_("When the algorithm is switched off, the pilot is responsible for setting the wind estimate.") },
    { AUTOWIND_CIRCLING, N_("Circling"),
      N_("Requires only a GPS source.") },
    { AUTOWIND_ZIGZAG, N_("ZigZag"),
      N_("Requires GPS and an intelligent vario with airspeed output.") },
    { AUTOWIND_CIRCLING | AUTOWIND_ZIGZAG, N_("Both"),
      N_("Use ZigZag and circling.") },
    { 0 }
  };

  AddEnum(_("Auto wind"),
          _("This allows switching on or off the automatic wind algorithm."),
          auto_wind_list, settings.GetLegacyAutoWindMode());

  AddBoolean(_("Prefer external wind"),
             _("If enabled, then the wind vector received from external devices overrides "
                 "XCSoar's internal wind calculation."),
             settings.use_external_wind,
             this);

  if (edit_trail_drift)
    AddBoolean(_("Trail drift"),
               _("Determines whether the snail trail is drifted with the wind "
                 "when displayed in circling mode. Switched Off, "
                 "the snail trail stays uncompensated for wind drift."),
               map_settings.trail.wind_drift_enabled);
  else
    AddDummy();

  if (edit_manual_wind) {
    SpeedVector manual_wind = CommonInterface::Calculated().GetWindOrZero();

    AddReadOnly(_("Source"));

    WndProperty *wp =
      AddFloat(_("Speed"), _("Manual adjustment of wind speed."),
               _T("%.0f %s"), _T("%.0f"),
               fixed(0),
               Units::ToUserWindSpeed(Units::ToSysUnit(fixed(200),
                                                       Unit::KILOMETER_PER_HOUR)),
               fixed(1), false,
               Units::ToUserWindSpeed(manual_wind.norm),
               this);
    DataFieldFloat &df = *(DataFieldFloat *)wp->GetDataField();
    df.SetUnits(Units::GetWindSpeedName());
    wp->RefreshDisplay();

    wp = AddAngle(_("Direction"), _("Manual adjustment of wind direction."),
                  manual_wind.bearing, 5u, false,
                  this);

    manual_modified = false;
  }

  if (clear_manual_button)
    AddButton(_("Clear"), *this, CLEAR_MANUAL);

  UpdateVector();
}
예제 #5
0
static void
SetValues()
{
  LoadFormProperty(*wf, _T("Name"), global_wpt->name.c_str());
  LoadFormProperty(*wf, _T("Comment"), global_wpt->comment.c_str());

  WndProperty* wp;
  bool sign;
  unsigned dd,mm,ss;

  global_wpt->location.longitude.ToDMS(dd, mm, ss, sign);

  wp = (WndProperty*)wf->FindByName(_T("prpLongitudeSign"));
  assert(wp != NULL);

  DataFieldEnum* dfe;
  dfe = (DataFieldEnum*)wp->GetDataField();
  dfe->addEnumText((_T("W")));
  dfe->addEnumText((_T("E")));
  dfe->Set(sign);
  wp->RefreshDisplay();

  LoadFormProperty(*wf, _T("prpLongitudeD"), dd);

  switch (CommonInterface::GetUISettings().coordinate_format) {
  case CoordinateFormat::DDMMSS: // ("DDMMSS");
  case CoordinateFormat::DDMMSS_SS: // ("DDMMSS.ss");
    LoadFormProperty(*wf, _T("prpLongitudeM"), mm);
    LoadFormProperty(*wf, _T("prpLongitudeS"), ss);
    break;
  case CoordinateFormat::DDMM_MMM: // ("DDMM.mmm");
    LoadFormProperty(*wf, _T("prpLongitudeM"), mm);
    LoadFormProperty(*wf, _T("prpLongitudemmm"), 1000 * fixed(ss) / 60);
    break;
  case CoordinateFormat::DD_DDDD: // ("DD.dddd");
    LoadFormProperty(*wf, _T("prpLongitudeDDDD"),
                     10000 * (fixed)(mm + ss) / 3600);
    break;
  case CoordinateFormat::UTM:
    break;
  }

  global_wpt->location.latitude.ToDMS(dd, mm, ss, sign);

  LoadFormProperty(*wf, _T("prpLatitudeD"), dd);

  wp = (WndProperty*)wf->FindByName(_T("prpLatitudeSign"));
  assert(wp != NULL);
  dfe = (DataFieldEnum*)wp->GetDataField();
  dfe->addEnumText((_T("S")));
  dfe->addEnumText((_T("N")));
  dfe->Set(sign);
  wp->RefreshDisplay();

  wp = (WndProperty*)wf->FindByName(_T("prpLatitudeD"));
  assert(wp != NULL);
  wp->GetDataField()->SetAsInteger(dd);
  wp->RefreshDisplay();

  switch (CommonInterface::GetUISettings().coordinate_format) {
  case CoordinateFormat::DDMMSS: // ("DDMMSS");
  case CoordinateFormat::DDMMSS_SS: // ("DDMMSS.ss");
    LoadFormProperty(*wf, _T("prpLatitudeM"), mm);
    LoadFormProperty(*wf, _T("prpLatitudeS"), ss);
    break;
  case CoordinateFormat::DDMM_MMM: // ("DDMM.mmm");
    LoadFormProperty(*wf, _T("prpLatitudeM"), mm);
    LoadFormProperty(*wf, _T("prpLatitudemmm"), 1000 * fixed(ss) / 60);
    break;
  case CoordinateFormat::DD_DDDD: // ("DD.dddd");
    LoadFormProperty(*wf, _T("prpLatitudeDDDD"),
                     10000 * (fixed)(mm + ss) / 3600);
    break;
  case CoordinateFormat::UTM:
    break;
  }

  LoadFormProperty(*wf, _T("prpAltitude"), UnitGroup::ALTITUDE, global_wpt->elevation);

  wp = (WndProperty*)wf->FindByName(_T("prpFlags"));
  assert(wp != NULL);
  dfe = (DataFieldEnum*)wp->GetDataField();

  dfe->addEnumText(_T("Turnpoint"));
  dfe->addEnumText(_T("Airport"));
  dfe->addEnumText(_T("Landpoint"));

  if (global_wpt->IsAirport())
    dfe->Set(1u);
  else if (global_wpt->IsLandable())
    dfe->Set(2u);
  else
    dfe->Set(0u);

  wp->RefreshDisplay();
}
예제 #6
0
void
UnitsConfigPanel::Prepare(ContainerWindow &parent, const PixelRect &rc)
{
  const UnitSetting &config = CommonInterface::GetUISettings().format.units;
  const CoordinateFormat coordinate_format =
      CommonInterface::GetUISettings().format.coordinate_format;

  RowFormWidget::Prepare(parent, rc);

  WndProperty *wp = AddEnum(_("Preset"), _("Load a set of units."));
  DataFieldEnum &df = *(DataFieldEnum *)wp->GetDataField();

  df.addEnumText(_("Custom"), (unsigned)0, _("My individual set of units."));
  unsigned len = Units::Store::Count();
  for (unsigned i = 0; i < len; i++)
    df.addEnumText(Units::Store::GetName(i), i+1);

  LoadValueEnum(UnitsPreset, Units::Store::EqualsPresetUnits(config));
  wp->GetDataField()->SetListener(this);

  AddSpacer();
  SetExpertRow(spacer_1);

  static constexpr StaticEnumChoice units_speed_list[] = {
    { (unsigned)Unit::STATUTE_MILES_PER_HOUR, _T("mph") },
    { (unsigned)Unit::KNOTS, N_("knots") },
    { (unsigned)Unit::KILOMETER_PER_HOUR, _T("km/h") },
    { (unsigned)Unit::METER_PER_SECOND, _T("m/s") },
    { 0 }
  };
  AddEnum(_("Aircraft/Wind speed"),
          _("Units used for airspeed and ground speed.  "
            "A separate unit is available for task speeds."),
          units_speed_list,
          (unsigned int)config.speed_unit, this);
  SetExpertRow(UnitsSpeed);

  static constexpr StaticEnumChoice units_distance_list[] = {
    { (unsigned)Unit::STATUTE_MILES, _T("sm") },
    { (unsigned)Unit::NAUTICAL_MILES, _T("nm") },
    { (unsigned)Unit::KILOMETER, _T("km") },
    { 0 }
  };
  AddEnum(_("Distance"),
          _("Units used for horizontal distances e.g. "
            "range to waypoint, distance to go."),
          units_distance_list,
          (unsigned)config.distance_unit, this);
  SetExpertRow(UnitsDistance);

  static constexpr StaticEnumChoice units_lift_list[] = {
    { (unsigned)Unit::KNOTS, N_("knots") },
    { (unsigned)Unit::METER_PER_SECOND, _T("m/s") },
    { (unsigned)Unit::FEET_PER_MINUTE, _T("ft/min") },
    { 0 }
  };
  AddEnum(_("Lift"), _("Units used for vertical speeds (variometer)."),
          units_lift_list,
          (unsigned)config.vertical_speed_unit, this);
  SetExpertRow(UnitsLift);

  static constexpr StaticEnumChoice units_altitude_list[] = {
    { (unsigned)Unit::FEET,  N_("foot") },
    { (unsigned)Unit::METER, N_("meter") },
    { 0 }
  };
  AddEnum(_("Altitude"), _("Units used for altitude and heights."),
          units_altitude_list,
          (unsigned)config.altitude_unit, this);
  SetExpertRow(UnitsAltitude);

  static constexpr StaticEnumChoice units_temperature_list[] = {
    { (unsigned)Unit::DEGREES_CELCIUS, _T(DEG "C") },
    { (unsigned)Unit::DEGREES_FAHRENHEIT, _T(DEG "F") },
    { 0 }
  };
  AddEnum(_("Temperature"), _("Units used for temperature."),
          units_temperature_list,
          (unsigned)config.temperature_unit, this);
  SetExpertRow(UnitsTemperature);

  static constexpr StaticEnumChoice units_taskspeed_list[] = {
    { (unsigned)Unit::STATUTE_MILES_PER_HOUR, _T("mph") },
    { (unsigned)Unit::KNOTS, N_("knots") },
    { (unsigned)Unit::KILOMETER_PER_HOUR, _T("km/h") },
    { (unsigned)Unit::METER_PER_SECOND, _T("m/s") },
    { 0 }
  };
  AddEnum(_("Task speed"), _("Units used for task speeds."),
          units_taskspeed_list,
          (unsigned)config.task_speed_unit, this);
  SetExpertRow(UnitsTaskSpeed);

  static constexpr StaticEnumChoice pressure_labels_list[] = {
    { (unsigned)Unit::HECTOPASCAL, _T("hPa") },
    { (unsigned)Unit::MILLIBAR, _T("mb") },
    { (unsigned)Unit::INCH_MERCURY, _T("inHg") },
    { 0 }
  };
  AddEnum(_("Pressure"), _("Units used for pressures."),
          pressure_labels_list,
          (unsigned)config.pressure_unit, this);
  SetExpertRow(UnitsPressure);

  static constexpr StaticEnumChoice mass_labels_list[] = {
    { (unsigned)Unit::KG, _T("kg") },
    { (unsigned)Unit::LB, _T("lb") },
    { 0 }
  };
  AddEnum(_("Mass"), _("Units used mass."),
          mass_labels_list,
          (unsigned)config.mass_unit, this);
  SetExpertRow(UnitsMass);

  static constexpr StaticEnumChoice wing_loading_labels_list[] = {
    { (unsigned)Unit::KG_PER_M2, _T("kg/m²") },
    { (unsigned)Unit::LB_PER_FT2, _T("lb/ft²") },
    { 0 }
  };
  AddEnum(_("Wing loading"), _("Units used for wing loading."),
          wing_loading_labels_list,
          (unsigned)config.wing_loading_unit, this);
  SetExpertRow(UnitsWingLoading);

  AddSpacer();
  SetExpertRow(spacer_2);

  static constexpr StaticEnumChoice units_lat_lon_list[] = {
    { (unsigned)CoordinateFormat::DDMMSS, _T("DDMMSS") },
    { (unsigned)CoordinateFormat::DDMMSS_S, _T("DDMMSS.s") },
    { (unsigned)CoordinateFormat::DDMM_MMM, _T("DDMM.mmm") },
    { (unsigned)CoordinateFormat::DD_DDDDD, _T("DD.ddddd") },
    { (unsigned)CoordinateFormat::UTM, _T("UTM") },
    { 0 }
  };
  AddEnum(_("Lat./Lon."), _("Units used for latitude and longitude."),
          units_lat_lon_list,
          (unsigned)coordinate_format);
  SetExpertRow(UnitsLatLon);
}
예제 #7
0
static void
RefreshCalculator(void)
{
  WndProperty* wp;

  // update outputs
  wp = (WndProperty*)wf->FindByName(_T("prpAATEst"));
  if (wp) {
    wp->GetDataField()->SetAsFloat((
        XCSoarInterface::Calculated().common_stats.task_time_remaining +
        XCSoarInterface::Calculated().common_stats.task_time_elapsed) / 60);
    wp->RefreshDisplay();
  }

  // update outputs
  wp = (WndProperty*)wf->FindByName(_T("prpAATTime"));
  if (wp) {
    if (XCSoarInterface::Calculated().task_stats.has_targets) {
      wp->GetDataField()->SetAsFloat(
          protected_task_manager.get_ordered_task_behaviour().aat_min_time / 60);
      wp->RefreshDisplay();
    } else {
      wp->hide();
    }
  }

  wp = (WndProperty*)wf->FindByName(_T("prpDistance"));
  if (wp) {
    wp->GetDataField()->SetAsFloat(Units::ToUserDistance(
        XCSoarInterface::Calculated().task_stats.total.solution_planned.Vector.Distance));
    wp->GetDataField()->SetUnits(Units::GetDistanceName());
    wp->RefreshDisplay();
  }

  wp = (WndProperty*)wf->FindByName(_T("prpMacCready"));
  if (wp) {
    wp->GetDataField()->SetUnits(Units::GetVerticalSpeedName());
    wp->RefreshDisplay();
  }

  wp = (WndProperty*)wf->FindByName(_T("prpEffectiveMacCready"));
  if (wp) {
    wp->GetDataField()->SetUnits(Units::GetVerticalSpeedName());
    wp->GetDataField()->SetAsFloat(Units::ToUserVSpeed(emc));
    wp->RefreshDisplay();
  }

  /*
  wp = (WndProperty*)wf->FindByName(_T("prpRange"));
  if (wp) {
    wp->RefreshDisplay();
    wp->set_visible(task.getSettings().AATEnabled &&
                    task.ValidTaskPoint(task.getActiveIndex() + 1));
    wp->GetDataField()->SetAsFloat(Range*100.0);
    wp->RefreshDisplay();
  }

  fixed v1;
  if (XCSoarInterface::Calculated().TaskTimeToGo>0) {
    v1 = XCSoarInterface::Calculated().TaskDistanceToGo/
      XCSoarInterface::Calculated().TaskTimeToGo;
  } else {
    v1 = 0;
  }
  */

  wp = (WndProperty*)wf->FindByName(_T("prpSpeedRemaining"));
  if (wp) {
    wp->GetDataField()->SetAsFloat(Units::ToUserTaskSpeed(
        XCSoarInterface::Calculated().task_stats.total.remaining_effective.get_speed()));
    wp->GetDataField()->SetUnits(Units::GetTaskSpeedName());
    wp->RefreshDisplay();
  }

  wp = (WndProperty*)wf->FindByName(_T("prpSpeedAchieved"));
  if (wp) {
    wp->GetDataField()->SetAsFloat(Units::ToUserTaskSpeed(
        XCSoarInterface::Calculated().task_stats.total.travelled.get_speed()));
    wp->GetDataField()->SetUnits(Units::GetTaskSpeedName());
    wp->RefreshDisplay();
  }

  wp = (WndProperty*)wf->FindByName(_T("prpCruiseEfficiency"));
  if (wp) {
    wp->GetDataField()->SetAsFloat(cruise_efficiency * 100);
    wp->RefreshDisplay();
  }
}
예제 #8
0
static void setVariables(void) {
  WndProperty *wp;

  wp = (WndProperty*)wf->FindByName(TEXT("prpCat10"));
  if (wp) {
	if (HaveZoomTopology(10)) {
		wp->GetDataField()->SetAsFloat( ReadZoomTopology(10));
	} else {
		wp->GetDataField()->SetAsFloat( 0 );
		wp->SetReadOnly(true);    
	}
	wp->RefreshDisplay();
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpCat20"));
  if (wp) {
	if (HaveZoomTopology(20)) {
		wp->GetDataField()->SetAsFloat( ReadZoomTopology(20));
	} else {
		wp->GetDataField()->SetAsFloat( 0 );
		wp->SetReadOnly(true);    
	}
	wp->RefreshDisplay();
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpCat30"));
  if (wp) {
	if (HaveZoomTopology(30)) {
		wp->GetDataField()->SetAsFloat( ReadZoomTopology(30));
	} else {
		wp->GetDataField()->SetAsFloat( 0 );
		wp->SetReadOnly(true);    
	}
	wp->RefreshDisplay();
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpCat40"));
  if (wp) {
	if (HaveZoomTopology(40)) {
		wp->GetDataField()->SetAsFloat( ReadZoomTopology(40));
	} else {
		wp->GetDataField()->SetAsFloat( 0 );
		wp->SetReadOnly(true);    
	}
	wp->RefreshDisplay();
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpCat50"));
  if (wp) {
	if (HaveZoomTopology(50)) {
		wp->GetDataField()->SetAsFloat( ReadZoomTopology(50));
	} else {
		wp->GetDataField()->SetAsFloat( 0 );
		wp->SetReadOnly(true);    
	}
	wp->RefreshDisplay();
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpCat60"));
  if (wp) {
	if (HaveZoomTopology(60)) {
		wp->GetDataField()->SetAsFloat( ReadZoomTopology(60));
	} else {
		wp->GetDataField()->SetAsFloat( 0 );
		wp->SetReadOnly(true);    
	}
	wp->RefreshDisplay();
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpCat70"));
  if (wp) {
	if (HaveZoomTopology(70)) {
		wp->GetDataField()->SetAsFloat( ReadZoomTopology(70));
	} else {
		wp->GetDataField()->SetAsFloat( 0 );
		wp->SetReadOnly(true);    
	}
	wp->RefreshDisplay();
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpCat80"));
  if (wp) {
	if (HaveZoomTopology(80)) {
		wp->GetDataField()->SetAsFloat( ReadZoomTopology(80));
	} else {
		wp->GetDataField()->SetAsFloat( 0 );
		wp->SetReadOnly(true);    
	}
	wp->RefreshDisplay();
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpCat90"));
  if (wp) {
	if (HaveZoomTopology(90)) {
		wp->GetDataField()->SetAsFloat( ReadZoomTopology(90));
	} else {
		wp->GetDataField()->SetAsFloat( 0 );
		wp->SetReadOnly(true);    
	}
	wp->RefreshDisplay();
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpCat100"));
  if (wp) {
	if (HaveZoomTopology(100)) {
		wp->GetDataField()->SetAsFloat( ReadZoomTopology(100));
	} else {
		wp->GetDataField()->SetAsFloat( 0 );
		wp->SetReadOnly(true);    
	}
	wp->RefreshDisplay();
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpCat110"));
  if (wp) {
	if (HaveZoomTopology(110)) {
		wp->GetDataField()->SetAsFloat( ReadZoomTopology(110));
	} else {
		wp->GetDataField()->SetAsFloat( 0 );
		wp->SetReadOnly(true);    
	}
	wp->RefreshDisplay();
  }

}
예제 #9
0
void dlgTopologyShowModal(void){

  if (LKTopo<1) { 
	MessageBoxX (hWndMainWindow, 
	// LKTOKEN  _@M502_ = "Only LKMaps can be configured, sorry!" 
		gettext(TEXT("_@M502_")), 
		TEXT(""), MB_OK);
  	return;
  }

  WndProperty *wp;
  char filename[MAX_PATH];
  LocalPathS(filename, TEXT("dlgTopology.xml"));
  wf = dlgLoadFromXML(CallBackTable,                        
		      filename, 
		      hWndMainWindow,
		      TEXT("IDR_XML_TOPOLOGY"));

  if (!wf) return;

  setVariables();

  changed = false;

  wf->ShowModal();


  wp = (WndProperty*)wf->FindByName(TEXT("prpCat10"));
  if (wp) {
	if (HaveZoomTopology(5)) 
	if ( LKTopoZoomCat05 != wp->GetDataField()->GetAsFloat()) {
		LKTopoZoomCat05 = wp->GetDataField()->GetAsFloat();
		SetToRegistry(szRegistryLKTopoZoomCat05, (DWORD)LKTopoZoomCat05);
		ChangeZoomTopology(5,LKTopoZoomCat05,0);
		changed = true;
	}
  }
  if (wp) {
	if (HaveZoomTopology(10)) 
	if ( LKTopoZoomCat10 != wp->GetDataField()->GetAsFloat()) {
		LKTopoZoomCat10 = wp->GetDataField()->GetAsFloat();
		SetToRegistry(szRegistryLKTopoZoomCat10, (DWORD)LKTopoZoomCat10);
		ChangeZoomTopology(10,LKTopoZoomCat10,0);
		changed = true;
	}
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpCat20"));
  if (wp) {
	if (HaveZoomTopology(20)) 
	if ( LKTopoZoomCat20 != wp->GetDataField()->GetAsFloat()) {
		LKTopoZoomCat20 = wp->GetDataField()->GetAsFloat();
		SetToRegistry(szRegistryLKTopoZoomCat20, (DWORD)LKTopoZoomCat20);
		ChangeZoomTopology(20,LKTopoZoomCat20,0);
		changed = true;
	}
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpCat30"));
  if (wp) {
	if (HaveZoomTopology(30)) 
	if ( LKTopoZoomCat30 != wp->GetDataField()->GetAsFloat()) {
		LKTopoZoomCat30 = wp->GetDataField()->GetAsFloat();
		SetToRegistry(szRegistryLKTopoZoomCat30, (DWORD)LKTopoZoomCat30);
		ChangeZoomTopology(30,LKTopoZoomCat30,0);
		changed = true;
	}
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpCat40"));
  if (wp) {
	if (HaveZoomTopology(40)) 
	if ( LKTopoZoomCat40 != wp->GetDataField()->GetAsFloat()) {
		LKTopoZoomCat40 = wp->GetDataField()->GetAsFloat();
		SetToRegistry(szRegistryLKTopoZoomCat40, (DWORD)LKTopoZoomCat40);
		ChangeZoomTopology(40,LKTopoZoomCat40,0);
		changed = true;
	}
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpCat50"));
  if (wp) {
	if (HaveZoomTopology(50)) 
	if ( LKTopoZoomCat50 != wp->GetDataField()->GetAsFloat()) {
		LKTopoZoomCat50 = wp->GetDataField()->GetAsFloat();
		SetToRegistry(szRegistryLKTopoZoomCat50, (DWORD)LKTopoZoomCat50);
		ChangeZoomTopology(50,LKTopoZoomCat50,0);
		changed = true;
	}
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpCat60"));
  if (wp) {
	if (HaveZoomTopology(60)) 
	if ( LKTopoZoomCat60 != wp->GetDataField()->GetAsFloat()) {
		LKTopoZoomCat60 = wp->GetDataField()->GetAsFloat();
		SetToRegistry(szRegistryLKTopoZoomCat60, (DWORD)LKTopoZoomCat60);
		ChangeZoomTopology(60,LKTopoZoomCat60,0);
		changed = true;
	}
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpCat70"));
  if (wp) {
	if (HaveZoomTopology(70)) 
	if ( LKTopoZoomCat70 != wp->GetDataField()->GetAsFloat()) {
		LKTopoZoomCat70 = wp->GetDataField()->GetAsFloat();
		SetToRegistry(szRegistryLKTopoZoomCat70, (DWORD)LKTopoZoomCat70);
		ChangeZoomTopology(70,LKTopoZoomCat70,0);
		changed = true;
	}
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpCat80"));
  if (wp) {
	if (HaveZoomTopology(80)) 
	if ( LKTopoZoomCat80 != wp->GetDataField()->GetAsFloat()) {
		LKTopoZoomCat80 = wp->GetDataField()->GetAsFloat();
		SetToRegistry(szRegistryLKTopoZoomCat80, (DWORD)LKTopoZoomCat80);
		ChangeZoomTopology(80,LKTopoZoomCat80,0);
		changed = true;
	}
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpCat90"));
  if (wp) {
	if (HaveZoomTopology(90)) 
	if ( LKTopoZoomCat90 != wp->GetDataField()->GetAsFloat()) {
		LKTopoZoomCat90 = wp->GetDataField()->GetAsFloat();
		SetToRegistry(szRegistryLKTopoZoomCat90, (DWORD)LKTopoZoomCat90);
		ChangeZoomTopology(90,LKTopoZoomCat90,0);
		changed = true;
	}
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpCat100"));
  if (wp) {
	if (HaveZoomTopology(100)) 
	if ( LKTopoZoomCat100 != wp->GetDataField()->GetAsFloat()) {
		LKTopoZoomCat100 = wp->GetDataField()->GetAsFloat();
		SetToRegistry(szRegistryLKTopoZoomCat100, (DWORD)LKTopoZoomCat100);
		ChangeZoomTopology(100,LKTopoZoomCat100,0);
		changed = true;
	}
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpCat110"));
  if (wp) {
	if (HaveZoomTopology(110)) 
	if ( LKTopoZoomCat110 != wp->GetDataField()->GetAsFloat()) {
		LKTopoZoomCat110 = wp->GetDataField()->GetAsFloat();
		SetToRegistry(szRegistryLKTopoZoomCat110, (DWORD)LKTopoZoomCat110);
		ChangeZoomTopology(110,LKTopoZoomCat110,0);
		changed = true;
	}
  }


  if (changed) {
    StoreRegistry();
    MessageBoxX (hWndMainWindow, 
	// LKTOKEN  _@M732_ = "Topology configuration saved." 
		 gettext(TEXT("_@M732_")), 
		 TEXT(""), MB_OK);
  }


  delete wf;
  wf = NULL;

}