Exemplo n.º 1
0
void
DeviceEditWidget::Prepare(ContainerWindow &parent, const PixelRect &rc)
{
  instance = this;

  RowFormWidget::Prepare(parent, rc);

  DataFieldEnum *port_df = new DataFieldEnum(OnDataField);
  port_df->SetDetachGUI(true);
  FillPorts(*port_df, config);
  Add(_("Port"), NULL, port_df);

  DataFieldEnum *baud_rate_df = new DataFieldEnum(NULL);
  FillBaudRates(*baud_rate_df);
  baud_rate_df->Set(config.baud_rate);
  Add(_("Baudrate"), NULL, baud_rate_df);

  DataFieldEnum *bulk_baud_rate_df = new DataFieldEnum(NULL);
  bulk_baud_rate_df->addEnumText(_T("Default"), 0u);
  FillBaudRates(*bulk_baud_rate_df);
  bulk_baud_rate_df->Set(config.bulk_baud_rate);
  Add(_("Bulk baud rate"),
      _("The baud rate used for bulk transfers, such as task declaration or flight download."),
      bulk_baud_rate_df);

  DataFieldEnum *tcp_port_df = new DataFieldEnum(NULL);
  FillTCPPorts(*tcp_port_df);
  tcp_port_df->Set(config.tcp_port);
  Add(_("TCP Port"), NULL, tcp_port_df);

  DataFieldEnum *driver_df = new DataFieldEnum(OnDataField);
  driver_df->SetDetachGUI(true);
  const TCHAR *driver_name;
  for (unsigned i = 0; (driver_name = GetDriverNameByIndex(i)) != NULL; i++)
    driver_df->addEnumText(driver_name, GetDriverDisplayNameByIndex(i));

  driver_df->Sort(1);
  driver_df->SetAsString(config.driver_name);

  Add(_("Driver"), NULL, driver_df);

  port_df->SetDetachGUI(false);
  driver_df->SetDetachGUI(false);

  UpdateVisibilities();
}
Exemplo n.º 2
0
void
DeviceEditWidget::Prepare(ContainerWindow &parent, const PixelRect &rc)
{
  RowFormWidget::Prepare(parent, rc);

  DataFieldEnum *port_df = new DataFieldEnum(this);
  FillPorts(*port_df, config);
  auto *port_control = Add(_("Port"), NULL, port_df);
  port_control->SetEditCallback(EditPortCallback);

  DataFieldEnum *baud_rate_df = new DataFieldEnum(this);
  FillBaudRates(*baud_rate_df);
  baud_rate_df->Set(config.baud_rate);
  Add(_("Baud rate"), NULL, baud_rate_df);

  DataFieldEnum *bulk_baud_rate_df = new DataFieldEnum(this);
  bulk_baud_rate_df->addEnumText(_T("Default"), 0u);
  FillBaudRates(*bulk_baud_rate_df);
  bulk_baud_rate_df->Set(config.bulk_baud_rate);
  Add(_("Bulk baud rate"),
      _("The baud rate used for bulk transfers, such as task declaration or flight download."),
      bulk_baud_rate_df);

  DataFieldString *ip_address_df = new DataFieldString(_T(""), this);
  ip_address_df->Set(config.ip_address);
  Add(_("IP Address"), NULL, ip_address_df);

  DataFieldEnum *tcp_port_df = new DataFieldEnum(this);
  FillTCPPorts(*tcp_port_df);
  tcp_port_df->Set(config.tcp_port);
  Add(_("TCP Port"), NULL, tcp_port_df);

  DataFieldEnum *i2c_bus_df = new DataFieldEnum(this);
  FillI2CBus(*i2c_bus_df);
  i2c_bus_df->Set(config.i2c_bus);
  Add(_("I2C Bus"), _("Select the description or bus number that matches your configuration."),
                      i2c_bus_df);

  DataFieldEnum *i2c_addr_df = new DataFieldEnum(this);
  FillI2CAddr(*i2c_addr_df);
  i2c_addr_df->Set(config.i2c_addr);
  Add(_("I2C Addr"), _("The i2c address that matches your configuration."
                        "This field is not used when your selection in the I2C Bus field is not an i2c bus number. "
                        "In case you do not understand the previous sentence you may assume that this field is not used."),
                        i2c_addr_df);

  DataFieldEnum *press_df = new DataFieldEnum(this);
  FillPress(*press_df);
  press_df->Set((unsigned)config.press_use);
  Add(_("Pressure use"), _("Select the purpose of this pressure sensor. "
                           "This sensor measures some pressure. Here you tell the system "
                           "what pressure this is and what its should be used for."),
                           press_df);

  DataFieldEnum *driver_df = new DataFieldEnum(this);

  const struct DeviceRegister *driver;
  for (unsigned i = 0; (driver = GetDriverByIndex(i)) != NULL; i++)
    driver_df->addEnumText(driver->name, driver->display_name);

  driver_df->Sort(1);
  driver_df->Set(config.driver_name);

  Add(_("Driver"), NULL, driver_df);

  AddBoolean(_("Sync. from device"),
             _("This option lets you configure if XCSoar should use settings "
               "like the MacCready value, bugs and ballast from the device."),
             config.sync_from_device, this);
  SetExpertRow(SyncFromDevice);

  AddBoolean(_("Sync. to device"),
             _("This option lets you configure if XCSoar should send settings "
               "like the MacCready value, bugs and ballast to the device."),
             config.sync_to_device, this);
  SetExpertRow(SyncToDevice);

  AddBoolean(_T("K6Bt"),
             _("Enable this if you use a K6Bt to connect the device."),
             config.k6bt, this);
  SetExpertRow(K6Bt);

  UpdateVisibilities();
}
Exemplo n.º 3
0
void
DeviceEditWidget::Prepare(ContainerWindow &parent, const PixelRect &rc)
{
  instance = this;

  RowFormWidget::Prepare(parent, rc);

  DataFieldEnum *port_df = new DataFieldEnum(OnDataField);
  port_df->SetDetachGUI(true);
  FillPorts(*port_df, config);
  Add(_("Port"), NULL, port_df);

  DataFieldEnum *baud_rate_df = new DataFieldEnum(NULL);
  FillBaudRates(*baud_rate_df);
  baud_rate_df->Set(config.baud_rate);
  Add(_("Baudrate"), NULL, baud_rate_df);

  DataFieldEnum *bulk_baud_rate_df = new DataFieldEnum(NULL);
  bulk_baud_rate_df->addEnumText(_T("Default"), 0u);
  FillBaudRates(*bulk_baud_rate_df);
  bulk_baud_rate_df->Set(config.bulk_baud_rate);
  Add(_("Bulk baud rate"),
      _("The baud rate used for bulk transfers, such as task declaration or flight download."),
      bulk_baud_rate_df);

  DataFieldEnum *tcp_port_df = new DataFieldEnum(NULL);
  FillTCPPorts(*tcp_port_df);
  tcp_port_df->Set(config.tcp_port);
  Add(_("TCP Port"), NULL, tcp_port_df);

  DataFieldEnum *driver_df = new DataFieldEnum(OnDataField);
  driver_df->SetDetachGUI(true);
  const TCHAR *driver_name;
  for (unsigned i = 0; (driver_name = GetDriverNameByIndex(i)) != NULL; i++)
    driver_df->addEnumText(driver_name, GetDriverDisplayNameByIndex(i));

  driver_df->Sort(1);
  driver_df->SetAsString(config.driver_name);

  Add(_("Driver"), NULL, driver_df);

  AddBoolean(_("Sync. from device"),
             _("This option lets you configure if XCSoar should use settings "
               "like the MacCready value, bugs and ballast from the device."),
             config.sync_from_device);
  SetExpertRow(SyncFromDevice);

  AddBoolean(_("Sync. to device"),
             _("This option lets you configure if XCSoar should send settings "
               "like the MacCready value, bugs and ballast to the device."),
             config.sync_to_device);
  SetExpertRow(SyncToDevice);

  AddBoolean(_("Ignore checksum"),
             _("If your GPS device outputs invalid NMEA checksums, this will "
               "allow it's data to be used anyway."),
             config.ignore_checksum);
  SetExpertRow(IgnoreCheckSum);

  port_df->SetDetachGUI(false);
  driver_df->SetDetachGUI(false);

  UpdateVisibilities();
}