Ejemplo n.º 1
0
static void OnPassiveButton(WndButton* pWnd){
  if (HoldOff ==0)
  {
   int res = dlgWayPointSelect(0, 90.0, 1,3);
//   LKASSERT(res>=0);
//   LKASSERT(ValidWayPointFast(res));
   if(res > RESWP_END )
     if(ValidWayPoint(res)) 
    {
      double Frequency = StrToDouble(WayPointList[res].Freq,NULL);
      if(Frequency < 100.0)
      {
     //    DoStatusMessage(_T("No valid Frequency!") );
        return;
      }
      devPutFreqStandby(devA(), Frequency, WayPointList[res].Name);
      devPutFreqStandby(devB(), Frequency, WayPointList[res].Name);

      _stprintf(RadioPara.PassiveName,_T("%s"), WayPointList[res].Name);
      RadioPara.PassiveFrequency = Frequency;
      PassiveRadioIndex = res;
    }
    OnUpdate();
    HoldOff = HOLDOFF_TIME;
  }
}
Ejemplo n.º 2
0
static void
OnSetWaypointClicked(gcc_unused WndButton &button)
{
  const Waypoint* wp = dlgWayPointSelect(XCSoarInterface::main_window,
                                         XCSoarInterface::Basic().Location);
  if (wp != NULL) {
    XCSoarInterface::SetSettingsComputer().TeamCodeRefWaypoint = wp->id;
    Profile::Set(szProfileTeamcodeRefWaypoint, wp->id);
  }
}
Ejemplo n.º 3
0
static void
OnStartPointListEnter(unsigned ItemIndex) {
  if (ItemIndex>=MAXSTARTPOINTS) {
    ItemIndex = MAXSTARTPOINTS-1;
  }

  int res;
  res = dlgWayPointSelect(XCSoarInterface::Basic().Location);
  if (res>=0) {
    task.SetStartPoint(ItemIndex, res);
    changed = true;
  }
}
Ejemplo n.º 4
0
static void OnSelectClicked(WindowControl * Sender){
	(void)Sender;
  int res;
  res = dlgWayPointSelect();
  if (res != -1){
    SelectedWaypoint = res;    
    if (Task[twItemIndex].Index != res) {
      if (CheckDeclaration()) {
        LockTaskData();
        ResetTaskWaypoint(twItemIndex);
        Task[twItemIndex].Index = res;
        TaskModified = true;
        UnlockTaskData();
      }
    }
    UpdateCaption();
  };
}
Ejemplo n.º 5
0
static void
OnWaypointDeleteClicked(WndButton &Sender)
{
  (void)Sender;
#ifdef OLD_TASK
  int res;
  res = dlgWayPointSelect(XCSoarInterface::Basic().Location);
  if (res != -1){
    if(MessageBoxX(way_points.get(res).Name,
                   _("Delete Waypoint?"),
                   MB_YESNO|MB_ICONQUESTION) == IDYES) {

      way_points.set(res).FileNum = -1;
      WaypointsNeedSave = true;
    }
  }
#endif
}
Ejemplo n.º 6
0
static void
OnWaypointEditClicked(WndButton &Sender)
{
  (void)Sender;

  const Waypoint *way_point = dlgWayPointSelect(XCSoarInterface::main_window,
                                                XCSoarInterface::Basic().Location);
  if (way_point) {
    if (way_points.get_writable(*way_point)) {
      Waypoint wp_copy = *way_point;
      if (dlgWaypointEditShowModal(wp_copy)) {
        WaypointsNeedSave = true;
        way_points.replace(*way_point, wp_copy);
      }
    } else {
      MessageBoxX(_("Waypoint not editable"), _("Error"), MB_OK);
    }
  }
}
Ejemplo n.º 7
0
static void OnSelectClicked(WndButton* pWnd){
  int res;
  res = dlgWayPointSelect();
  if (res != -1){
    SelectedWaypoint = res;    
    LKASSERT(twItemIndex>=0);
    if (Task[twItemIndex].Index != res) {
      if (CheckDeclaration()) {
        LockTaskData();
        ResetTaskWaypoint(twItemIndex);
        Task[twItemIndex].Index = res;
        Task[twItemIndex].PGConeBase = WayPointList[res].Altitude;
        TaskModified = true;
        UnlockTaskData();
      }
    }
    UpdateCaption();
  };
}
Ejemplo n.º 8
0
static void OnStartPointListEnter(WindowControl * Sender,
                                  WndListFrame::ListInfo_t *ListInfo) {
    (void)Sender;
    ItemIndex = ListInfo->ItemIndex + ListInfo->ScrollIndex;
    if (ItemIndex>=MAXSTARTPOINTS) {
        ItemIndex = -1;
        while(ValidStartPoint(ItemIndex++)) { }
    }
    if (ItemIndex>=0) {
        int res;
        res = dlgWayPointSelect();
        if (res>=0) {
            // TODO bug: don't add it if it's already present!
            LockTaskData();
            StartPoints[ItemIndex].Index = res;
            StartPoints[ItemIndex].Active = true;
            UnlockTaskData();
            changed = true;
            UpdateList();
        }
    }
}
Ejemplo n.º 9
0
static void OnSelectClicked(WindowControl * Sender){
	(void)Sender;
  int res;
  res = dlgWayPointSelect();
  if (res != -1){
    SelectedWaypoint = res;    
    if (Task[twItemIndex].Index != res) {
      if (CheckDeclaration()) {
        LockTaskData();
	Task[twItemIndex].Index = res;
        Task[twItemIndex].AATTargetOffsetRadius = 0.0;
        Task[twItemIndex].AATTargetOffsetRadial = 0.0;
        Task[twItemIndex].AATSectorRadius = SectorRadius;
        Task[twItemIndex].AATCircleRadius = SectorRadius;
        Task[twItemIndex].AATTargetLocked = false;
        TaskModified = true;
        UnlockTaskData();
      }
    }
    UpdateCaption();
  };
}
Ejemplo n.º 10
0
static void OnSelectClicked(WindowControl * Sender){
	(void)Sender;
  int res;
  res = dlgWayPointSelect(XCSoarInterface::Basic().Location);
  if (res != -1){
    task.setSelected(res);
    TASK_POINT tp = task.getTaskPoint(twItemIndex);
    if (tp.Index != res) {
      if (logger.CheckDeclaration()) {

	tp.Index = res;
        tp.AATSectorRadius = settings_task.SectorRadius;
        tp.AATCircleRadius = settings_task.SectorRadius;
        tp.AATTargetOffsetRadius = 0.0;
        tp.AATTargetOffsetRadial = 0.0;
        tp.AATTargetLocked = false;
        task.setTaskPoint(twItemIndex, tp);
        task.SetTaskModified();

      }
    }
    UpdateCaption();
  };
}
Ejemplo n.º 11
0
static void OnActiveButton(WndButton* pWnd){

  if (HoldOff ==0)
  {
    int res = dlgWayPointSelect(0, 90.0, 1, 3);
    if(res > RESWP_END )
    if(ValidWayPoint(res))
    {
      double  Frequency = StrToDouble(WayPointList[res].Freq,NULL);
      if(!ValidFrequency(Frequency))
      {
   // 	DoStatusMessage(_T("No valid Frequency!") );
	return;
      }
      devPutFreqActive(Frequency, WayPointList[res].Name);
      _stprintf(RadioPara.ActiveName,_T("%s"), WayPointList[res].Name);
      RadioPara.ActiveFrequency = Frequency;

      ActiveRadioIndex = res;
    }
    OnUpdate();
    HoldOff = HOLDOFF_TIME;
  }
}
Ejemplo n.º 12
0
static void OnTaskListEnter(WindowControl * Sender,
		     WndListFrame::ListInfo_t *ListInfo) {
  (void)Sender;
  bool isfinish = false;

  ItemIndex = ListInfo->ItemIndex+ListInfo->ScrollIndex;

  // If we are clicking on Add Waypoint
  if ((ItemIndex>=0) && (ItemIndex == UpLimit) && (UpLimit<MAXTASKPOINTS)) {

	// add new waypoint
	if (CheckDeclaration()) {

		if (ItemIndex>0) {
#ifdef LAST_TASKPOINT_QUESTION
			if (MessageBoxX(
			// LKTOKEN  _@M817_ = "Will this be the finish?"
			MsgToken(817),
			// LKTOKEN  _@M54_ = "Add Waypoint"
			MsgToken(54),
			mbYesNo) == IdYes)
#else
		    if(0)
#endif
			{

				isfinish = true;

				// Set initial wp as the finish by default, or home if nonex
				LockTaskData();
                // ItemIndex is already checked for > 0 no need to test twice
				Task[ItemIndex].Index = Task[0].Index;
				UnlockTaskData();

			} else {
				isfinish = false;
			}
		}

		int res;
		res = dlgWayPointSelect();

		if (ValidWayPoint(res)){

			LockTaskData();
            ResetTaskWaypoint(ItemIndex);
			Task[ItemIndex].Index = res;
            Task[ItemIndex].PGConeBase = WayPointList[res].Altitude;

			UnlockTaskData();
			if (ItemIndex==0) {
				dlgTaskWaypointShowModal(ItemIndex, 0, true); // start waypoint
			} else if (isfinish) {
				dlgTaskWaypointShowModal(ItemIndex, 2, true); // finish waypoint
			} else {
				if (AATEnabled || DoOptimizeRoute()) {
					// only need to set properties for finish
					dlgTaskWaypointShowModal(ItemIndex, 1, true); // normal waypoint
				}
			}

		} // ValidWaypoint
		OverviewRefreshTask();

	} // CheckDeclaration

	return;

  } // Index==UpLimit, clicking on Add Waypoint

  if (ItemIndex<UpLimit) {

	if (ItemIndex==0) {
		dlgTaskWaypointShowModal(ItemIndex, 0); // start waypoint
	} else {
		if (ItemIndex==UpLimit-1) {
			dlgTaskWaypointShowModal(ItemIndex, 2); // finish waypoint
		} else {
			dlgTaskWaypointShowModal(ItemIndex, 1); // turnpoint
		}
	}
	  OverviewRefreshTask();
  }

} // OnTaskListEnter