Example #1
0
bool
AnalysisWidget::KeyPress(unsigned key_code)
{
  switch (key_code) {
  case KEY_LEFT:
#ifdef GNAV
  case '6':
    // Key F14 added in order to control the Analysis-Pages with the Altair RemoteStick
  case KEY_F14:
#endif
    previous_button.SetFocus();
    NextPage(-1);
    return true;

  case KEY_RIGHT:
#ifdef GNAV
  case '7':
    // Key F13 added in order to control the Analysis-Pages with the Altair RemoteStick
  case KEY_F13:
#endif
    next_button.SetFocus();
    NextPage(+1);
    return true;

  default:
    return false;
  }
}
Example #2
0
void dlgTeamCodeShowModal(void)
{
    WndProperty* wp = NULL;
    WndButton *buttonCode = NULL;
    wf = NULL;
    char filename[MAX_PATH];
    if (InfoBoxLayout::landscape)
    {
        LocalPathS(filename, TEXT("dlgTeamCode_L.xml"));
        wf = dlgLoadFromXML(CallBackTable,

                            filename,
                            hWndMainWindow,
                            TEXT("IDR_XML_TEAMCODE_L"));
        if (!wf) return;
    }
    else
    {
        LocalPathS(filename, TEXT("dlgTeamCode.xml"));
        wf = dlgLoadFromXML(CallBackTable,

                            filename,
                            hWndMainWindow,
                            TEXT("IDR_XML_TEAMCODE"));
        if (!wf) return;
    }

    TCHAR sTmp[32] = { 0 };
    if( WayPointList && ValidWayPoint(TeamCodeRefWaypoint)) {
        // LKTOKEN _@M1230_ "Team Ref.: "
        _tcsncpy(sTmp, gettext(TEXT("_@M1230_")), 20);
        _tcsncat(sTmp, WayPointList[TeamCodeRefWaypoint].Name,10);
    } else {
        // LKTOKEN _@M1231_ "Team code: SET REF!"
        _tcsncpy(sTmp, gettext(TEXT("_@M1231_")), 30);
    }
    wf->SetCaption(sTmp);

    // set event for button
    buttonCode = ((WndButton *)wf->FindByName(TEXT("cmdSetCode")));
    if (buttonCode) {
        buttonCode->SetOnClickNotify(OnCodeClicked);
    }

    // Set unit for range
    wp = (WndProperty*)wf->FindByName(TEXT("prpRange"));
    if (wp) {
        wp->GetDataField()->SetUnits(Units::GetDistanceName());
    }

    Update();

    wf->SetTimerNotify(OnTimerNotify);

    wf->ShowModal();

    delete wf;
    wf=NULL;

}
Example #3
0
void
AnalysisWidget::Prepare(ContainerWindow &parent, const PixelRect &rc)
{
  const Layout layout(rc);

  ButtonWindowStyle button_style;
  button_style.Hide();
  button_style.TabStop();

  info.Create(parent, layout.info);

  const auto &button_look = dialog.GetLook().button;
  details_button.Create(parent, button_look, _T("Calc"), layout.details_button,
                        button_style, *this, DETAILS);
  previous_button.Create(parent, button_look, _T("<"), layout.previous_button,
                         button_style, *this, PREVIOUS);
  next_button.Create(parent, button_look, _T(">"), layout.next_button,
                     button_style, *this, NEXT);
  close_button.Create(parent, button_look, _("Close"), layout.close_button,
                      button_style, dialog, mrOK);

  WindowStyle style;
  style.Hide();

  chart.Create(parent, layout.main, style);
}
Example #4
0
static void
UpdateButton(const TCHAR *button, const TCHAR *caption)
{
  WndButton* b = (WndButton*)dialog->FindByName(button);
  assert(b != NULL);
  b->SetCaption(caption);
}
Example #5
0
static void
UpdateList()
{
  list.clear();

  PlaneFileVisitor pfv;
  VisitDataFiles(_T("*.xcp"), pfv);

  unsigned len = list.size();

  if (len > 0)
    std::sort(list.begin(), list.end());

  plane_list->SetLength(len);
  plane_list->invalidate();

  WndButton* b = (WndButton*)dialog->FindByName(_T("LoadButton"));
  assert(b != NULL);
  b->set_enabled(len > 0);

  b = (WndButton*)dialog->FindByName(_T("EditButton"));
  assert(b != NULL);
  b->set_enabled(len > 0);

  b = (WndButton*)dialog->FindByName(_T("DeleteButton"));
  assert(b != NULL);
  b->set_enabled(len > 0);
}
Example #6
0
void
dlgTeamCodeShowModal(void)
{
  WndProperty* wp = NULL;
  WndButton *buttonCode = NULL;

  wf = LoadDialog(CallBackTable, XCSoarInterface::main_window,
                  Layout::landscape ? _T("IDR_XML_TEAMCODE_L") :
                                      _T("IDR_XML_TEAMCODE"));

  if (!wf)
    return;

  // set event for buttons
  buttonCode = ((WndButton *)wf->FindByName(_T("cmdSetCode")));
  if (buttonCode)
    buttonCode->SetOnClickNotify(OnCodeClicked);

  WndButton* cmdSetWaypoint = ((WndButton *)wf->FindByName(_T("cmdSetWaypoint")));
  assert(cmdSetWaypoint != NULL);
  cmdSetWaypoint->SetOnClickNotify(OnSetWaypointClicked);

  // Set unit for range
  wp = (WndProperty*)wf->FindByName(_T("prpRange"));
  if (wp)
    wp->GetDataField()->SetUnits(Units::GetDistanceName());

  Update();

  wf->SetTimerNotify(OnTimerNotify);

  wf->ShowModal();

  delete wf;
}
Example #7
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);
}
Example #8
0
  void UpdateButtons() {
    unsigned length = GetList().GetLength();
    unsigned cursor = GetList().GetCursorIndex();

    add_button->SetEnabled(length < settings.MAX_PAGES);
    delete_button->SetEnabled(length >= 2);
    move_up_button->SetEnabled(cursor > 0);
    move_down_button->SetEnabled(cursor + 1 < length);
  }
void
AirspaceConfigPanel::SetButtonsVisible(bool active)
{
  if (buttonColors != NULL)
    buttonColors->SetVisible(active);

  if (buttonMode != NULL)
    buttonMode->SetVisible(active);
}
Example #10
0
  void UpdateVisibility() {
    assert(visible);

    edit_button->SetVisible(show_edit);
    mutate_button->SetVisible(show_mutate);
    down_button->SetVisible(show_down);
    up_button->SetVisible(show_up);
    clear_all_button->Show();
  }
Example #11
0
void
InterfaceConfigPanel::Show(const PixelRect &rc)
{
  buttonFonts->SetText(_("Fonts"));
  buttonFonts->SetOnClickNotify(dlgConfigFontsShowModal);
  buttonFonts->Show();

  RowFormWidget::Show(rc);
}
Example #12
0
  void Move(const PixelRect &rc) override {
    const Layout layout(rc, geometry);

    RowFormWidget::Move(layout.form);

    copy_button.Move(layout.copy_button);
    paste_button.Move(layout.paste_button);
    close_button.Move(layout.close_button);
  }
void
InterfaceConfigPanel::Show(const PixelRect &rc)
{
  buttonFonts->set_text(_("Fonts"));
  buttonFonts->SetOnClickNotify(OnFonts);
  buttonFonts->show();

  RowFormWidget::Show(rc);
}
Example #14
0
void
FlightSetupPanel::SetButtons()
{
  dump_button->SetVisible(polar_settings.glide_polar_task.HasBallast());

  const ComputerSettings &settings = CommonInterface::GetComputerSettings();
  dump_button->SetCaption(settings.polar.ballast_timer_active
                          ? _("Stop") : _("Dump"));
}
Example #15
0
void
PolarConfigPanel::Prepare(ContainerWindow &parent, const PixelRect &rc)
{
  instance = this;
  loading = true;

  LoadWindow(polar_callbacks, parent,
             Layout::landscape
             ? _T("IDR_XML_POLARCONFIGPANEL_L")
             : _T("IDR_XML_POLARCONFIGPANEL"));

  buttonList = (WndButton *)ConfigPanel::GetForm()
    .FindByName(_T("cmdLoadInternalPolar"));
  assert(buttonList != NULL);
  buttonList->SetOnClickNotify(OnLoadInternal);

  buttonImport = (WndButton *)ConfigPanel::GetForm()
    .FindByName(_T("cmdLoadPolarFile"));
  assert(buttonImport != NULL);
  buttonImport->SetOnClickNotify(OnLoadFromFile);

  buttonExport = (WndButton *)ConfigPanel::GetForm()
    .FindByName(_T("cmdSavePolarFile"));
  assert(buttonExport != NULL);
  buttonExport->SetOnClickNotify(OnExport);

  SetLiftFieldStepAndMax(_T("prpPolarW1"));
  SetLiftFieldStepAndMax(_T("prpPolarW2"));
  SetLiftFieldStepAndMax(_T("prpPolarW3"));

  const ComputerSettings &settings = XCSoarInterface::GetComputerSettings();
  UpdatePolarPoints(settings.plane.v1, settings.plane.v2, settings.plane.v3,
                    settings.plane.w1, settings.plane.w2, settings.plane.w3);

  LoadFormProperty(form, _T("prpPolarReferenceMass"),
                   settings.plane.reference_mass);
  LoadFormProperty(form, _T("prpPolarDryMass"), settings.plane.dry_mass);
  LoadFormProperty(form, _T("prpPolarMaxBallast"), settings.plane.max_ballast);

  LoadFormProperty(form, _T("prpPolarWingArea"), settings.plane.wing_area);
  LoadFormProperty(form, _T("prpMaxManoeuveringSpeed"), ugHorizontalSpeed,
                   settings.plane.max_speed);

  UpdatePolarTitle();
  UpdatePolarInvalidLabel();

  const ComputerSettings &settings_computer = XCSoarInterface::GetComputerSettings();

  LoadFormProperty(form, _T("prpHandicap"),
                   settings_computer.plane.handicap);

  LoadFormProperty(form, _T("prpBallastSecsToEmpty"),
                   settings_computer.plane.dump_time);

  loading = false;
}
Example #16
0
void
PolarConfigPanel::Prepare(ContainerWindow &parent, const PixelRect &rc)
{
  instance = this;
  loading = true;

  LoadWindow(polar_callbacks, parent,
             Layout::landscape
             ? _T("IDR_XML_POLARCONFIGPANEL_L")
             : _T("IDR_XML_POLARCONFIGPANEL"));

  buttonList = (WndButton *)ConfigPanel::GetForm()
    .FindByName(_T("cmdLoadInternalPolar"));
  assert(buttonList != NULL);
  buttonList->SetOnClickNotify(OnLoadInternal);

  buttonImport = (WndButton *)ConfigPanel::GetForm()
    .FindByName(_T("cmdLoadPolarFile"));
  assert(buttonImport != NULL);
  buttonImport->SetOnClickNotify(OnLoadFromFile);

  buttonExport = (WndButton *)ConfigPanel::GetForm()
    .FindByName(_T("cmdSavePolarFile"));
  assert(buttonExport != NULL);
  buttonExport->SetOnClickNotify(OnExport);

  const ComputerSettings &settings = CommonInterface::GetComputerSettings();

  DockWindow &dock = *(DockWindow *)form.FindByName(_T("shape"));
  PolarShapeEditWidget *shape_editor =
    new PolarShapeEditWidget(settings.plane.polar_shape);
  dock.SetWidget(shape_editor);
  shape_editor->SetDataAccessCallback(OnFieldData);

  LoadFormProperty(form, _T("prpPolarReferenceMass"),
                   settings.plane.reference_mass);
  LoadFormProperty(form, _T("prpPolarDryMass"), settings.plane.dry_mass);
  LoadFormProperty(form, _T("prpPolarMaxBallast"), settings.plane.max_ballast);

  LoadFormProperty(form, _T("prpPolarWingArea"), settings.plane.wing_area);
  LoadFormProperty(form, _T("prpMaxManoeuveringSpeed"), UnitGroup::HORIZONTAL_SPEED,
                   settings.plane.max_speed);

  UpdatePolarTitle();
  UpdatePolarInvalidLabel();

  const ComputerSettings &settings_computer = CommonInterface::GetComputerSettings();

  LoadFormProperty(form, _T("prpHandicap"),
                   settings_computer.plane.handicap);

  LoadFormProperty(form, _T("prpBallastSecsToEmpty"),
                   settings_computer.plane.dump_time);

  loading = false;
}
Example #17
0
  void Hide() override {
    RowFormWidget::Hide();

    copy_button.Hide();
    paste_button.Hide();
    close_button.Hide();

    for (auto &i : previews)
      i.Hide();
  }
Example #18
0
  virtual void Hide() override {
    assert(visible);
    visible = false;

    edit_button->Hide();
    mutate_button->Hide();
    down_button->Hide();
    up_button->Hide();
    clear_all_button->Hide();
  }
Example #19
0
  void Hide() override {
    Timer::Cancel();

    info.Hide();
    details_button.Hide();
    previous_button.Hide();
    next_button.Hide();
    close_button.Hide();
    chart.Hide();
  }
Example #20
0
  void Move(const PixelRect &rc) override {
    const Layout layout(rc);

    info.Move(layout.info);
    details_button.Move(layout.details_button);
    previous_button.Move(layout.previous_button);
    next_button.Move(layout.next_button);
    close_button.Move(layout.close_button);
    chart.Move(layout.main);
  }
Example #21
0
  void UpdatePositions(const PixelRect &rc) {
    assert(visible);

    const Layout layout = CalculateLayout(rc);

    edit_button->Move(layout.edit);
    mutate_button->Move(layout.down);
    down_button->Move(layout.down);
    up_button->Move(layout.up);
    clear_all_button->Move(layout.clear_all);
  }
Example #22
0
  /* virtual methods from Widget */
  virtual void Prepare(ContainerWindow &parent,
                       const PixelRect &rc) override {
    Layout layout(rc);

    ButtonWindowStyle style;
    style.Hide();
    style.TabStop();

    demo_button.Create(parent, _("Demo"), layout.demo, style, *this, DEMO);
    save_button.Create(parent, _("Save"), layout.save, style, *this, SAVE);
  }
Example #23
0
static void
SetButtons()
{
  WndButton* wb;

  if ((wb = (WndButton *)wf->FindByName(_T("cmdDump"))) != NULL) {
    wb->set_visible(glide_polar.HasBallast());
    wb->SetCaption(XCSoarInterface::GetComputerSettings().ballast_timer_active ?
        _("Stop") : _("Dump"));
  }
}
Example #24
0
  void Show(const PixelRect &rc) override {
    const Layout layout(rc, geometry);

    RowFormWidget::Show(layout.form);

    copy_button.MoveAndShow(layout.copy_button);
    paste_button.MoveAndShow(layout.paste_button);
    close_button.MoveAndShow(layout.close_button);

    for (unsigned i = 0; i < previews.size(); ++i)
      previews[i].MoveAndShow(layout.info_boxes.positions[i]);
  }
Example #25
0
void
PolarConfigPanel::SetVisible(bool active)
{
  if (buttonList != NULL)
    buttonList->set_visible(active);

  if (buttonImport != NULL)
    buttonImport->set_visible(active);

  if (buttonExport != NULL)
    buttonExport->set_visible(active);
}
Example #26
0
static void
UpdateDeviceSetupButton(unsigned DeviceIdx, const TCHAR *Name)
{
  assert(DeviceIdx < 26);

  TCHAR button_name[] = _T("cmdSetupDeviceA");
  button_name[(sizeof(button_name) / sizeof(button_name[0])) - 2] += DeviceIdx;

  WndButton *wb = (WndButton *)wf->FindByName(button_name);
  if (wb != NULL)
    wb->set_visible(Name != NULL && _tcscmp(Name, _T("Vega")) == 0);
}
Example #27
0
void
PortMonitorGlue::TogglePause()
{
  paused = !paused;

  if (paused) {
    pause_button->SetCaption(_("Resume"));
    device.SetMonitor(nullptr);
  } else {
    pause_button->SetCaption(_("Pause"));
    device.SetMonitor(&bridge);
  }
}
Example #28
0
void
ManagedFileListWidget::UpdateButtons()
{
#ifdef HAVE_DOWNLOAD_MANAGER
  if (Net::DownloadManager::IsAvailable()) {
    const unsigned current = GetList().GetCursorIndex();

    download_button->SetEnabled(!items.empty() &&
                                CanDownload(repository, items[current].name));
    cancel_button->SetEnabled(!items.empty() && items[current].downloading);
  }
#endif
}
Example #29
0
  void MoveChildren(const Layout &layout) {
    waypoint_name.Move(layout.waypoint_name);
    waypoint_details.Move(layout.waypoint_details);
    waypoint_remove.Move(layout.waypoint_remove);
    waypoint_relocate.Move(layout.waypoint_relocate);

    type_label.Move(layout.type_label);
    change_type.Move(layout.change_type);
    map.Move(layout.map);
    properties_dock.Move(layout.properties);
    optional_starts.Move(layout.optional_starts);
    score_exit.Move(layout.score_exit);
  }
Example #30
0
static void
UpdateAckButton()
{
  assert(airspace);

  if (airspace_warnings == NULL)
    return;

  WndButton* ack = (WndButton*)wf->FindByName(_T("cmdAcknowledge"));
  assert(ack != NULL);
  ack->SetCaption(airspace_warnings->get_ack_day(*airspace) ?
                  _("Enable") : _("Ack Day"));
}