Ejemplo n.º 1
0
static void OnAATEnabled(DataField *Sender, DataField::DataAccessKind_t Mode) {
  switch(Mode){
    case DataField::daGet:
    break;
    case DataField::daPut:
    case DataField::daChange:
      ReadValues();
      SetValues();
      GetWaypointValues();
      SetWaypointValues();
    break;
  }
}
Ejemplo n.º 2
0
static void OnTaskPointPicto(WindowControl * Sender, LKSurface& Surface) {
    (void) Sender;

    WndFrame *wPicto = ((WndFrame *) wf->FindByName(TEXT("frmTaskPointPicto")));
    if(wPicto) {
        /********************/
        ReadValues();
        GetWaypointValues();
        //  CalculateTaskSectors();
        //  if (AATEnabled)
        //    CalculateAATTaskSectors();
        RefreshTask();
        /*******************/
        const RECT rc = wPicto->GetClientRect();

        MapWindow::DrawWaypointPictoBg(Surface, rc);
        MapWindow::DrawTaskPicto(Surface, twItemIndex, rc, 2000);
    }
}
Ejemplo n.º 3
0
void dlgTaskWaypointShowModal(int itemindex, int tasktype, bool addonly){
  wf = NULL;
 
  if (!ScreenLandscape) {
    char filename[MAX_PATH];
    LocalPathS(filename, TEXT("dlgTaskWaypoint_L.xml"));
    wf = dlgLoadFromXML(CallBackTable, 
                        
                        filename, 
                        hWndMainWindow,
                        TEXT("IDR_XML_TASKWAYPOINT_L"));
  } else {
    char filename[MAX_PATH];
    LocalPathS(filename, TEXT("dlgTaskWaypoint.xml"));
    wf = dlgLoadFromXML(CallBackTable, 
                        filename, 
                        hWndMainWindow,
                        TEXT("IDR_XML_TASKWAYPOINT"));    
  }

  if (ISPARAGLIDER) {
    if(DoOptimizeRoute()) 
		AATEnabled=TRUE;
	EnableMultipleStartPoints=false;
  }

  twItemIndex = itemindex;
  twType = tasktype;

  if (!wf) return;

  //ASSERT(wf!=NULL);
  //  wf->SetKeyDownNotify(FormKeyDown);

  wStart     = ((WndFrame *)wf->FindByName(TEXT("frmStart")));
  wTurnpoint = ((WndFrame *)wf->FindByName(TEXT("frmTurnpoint")));
  wAATTurnpoint = ((WndFrame *)wf->FindByName(TEXT("frmAATTurnpoint")));
  wFinish    = ((WndFrame *)wf->FindByName(TEXT("frmFinish")));

  //ASSERT(wStart!=NULL);
  //ASSERT(wTurnpoint!=NULL);
  //ASSERT(wAATTurnpoint!=NULL);
  //ASSERT(wFinish!=NULL);

  WndButton* wb;
  if (addonly) {
    wb = (WndButton *)wf->FindByName(TEXT("butSelect"));
    if (wb) {
      wb->SetVisible(false);
    }
    wb = (WndButton *)wf->FindByName(TEXT("butRemove"));
    if (wb) {
      wb->SetVisible(false);
    }
    wb = (WndButton *)wf->FindByName(TEXT("butDetails"));
    if (wb) {
      wb->SetVisible(false);
    }
    wb = (WndButton *)wf->FindByName(TEXT("butDown"));
    if (wb) {
      wb->SetVisible(false);
    }
    wb = (WndButton *)wf->FindByName(TEXT("butUp"));
    if (wb) {
      wb->SetVisible(false);
    }
  } else {
    if (!ValidTaskPoint(twItemIndex-1)) {
      wb = (WndButton *)wf->FindByName(TEXT("butUp"));
      if (wb) {
        wb->SetVisible(false);
      }
    }
    if (!ValidTaskPoint(twItemIndex+1)) {
      wb = (WndButton *)wf->FindByName(TEXT("butDown"));
      if (wb) {
        wb->SetVisible(false);
      }
    }
  }

  SetWaypointValues(true);

  switch (twType) {
    case 0:
      wStart->SetVisible(1);
      wTurnpoint->SetVisible(0);
      wAATTurnpoint->SetVisible(0);
      wFinish->SetVisible(0);
      break;
    case 1:
      wStart->SetVisible(0);
      if (AATEnabled) {
	wTurnpoint->SetVisible(0);
	wAATTurnpoint->SetVisible(1);
      } else {
	wTurnpoint->SetVisible(1);
	wAATTurnpoint->SetVisible(0);
      }
      wFinish->SetVisible(0);
    break;
    case 2:
      wStart->SetVisible(0);
      wTurnpoint->SetVisible(0);
      wAATTurnpoint->SetVisible(0);
      wFinish->SetVisible(1);
    break;
  }

  // set properties...

  SetValues(true);

  UpdateCaption();

  wf->ShowModal();

  // now retrieve changes

  GetWaypointValues();

  ReadValues();

  delete wf;

  wf = NULL;

}
Ejemplo n.º 4
0
void dlgTaskWaypointShowModal(int itemindex, int tasktype, bool addonly){
  wf = NULL;

  if (!Layout::landscape) {
    wf = dlgLoadFromXML(CallBackTable,
                        _T("dlgTaskWaypoint_L.xml"),
                        XCSoarInterface::main_window,
                        _T("IDR_XML_TASKWAYPOINT_L"));
  } else {
    wf = dlgLoadFromXML(CallBackTable,
                        _T("dlgTaskWaypoint.xml"),
                        XCSoarInterface::main_window,
                        _T("IDR_XML_TASKWAYPOINT"));
  }

  twItemIndex = itemindex;
  twType = tasktype;

  if (!wf) return;

  assert(wf!=NULL);
  //  wf->SetKeyDownNotify(FormKeyDown);

  settings_task = task.getSettings();

  wStart     = ((WndFrame *)wf->FindByName(_T("frmStart")));
  wTurnpoint = ((WndFrame *)wf->FindByName(_T("frmTurnpoint")));
  wAATTurnpoint = ((WndFrame *)wf->FindByName(_T("frmAATTurnpoint")));
  wFinish    = ((WndFrame *)wf->FindByName(_T("frmFinish")));

  assert(wStart!=NULL);
  assert(wTurnpoint!=NULL);
  assert(wAATTurnpoint!=NULL);
  assert(wFinish!=NULL);

  WndButton* wb;
  if (addonly) {
    wb = (WndButton *)wf->FindByName(_T("butSelect"));
    if (wb) {
      wb->hide();
    }
    wb = (WndButton *)wf->FindByName(_T("butRemove"));
    if (wb) {
      wb->hide();
    }
    wb = (WndButton *)wf->FindByName(_T("butDetails"));
    if (wb) {
      wb->hide();
    }
    wb = (WndButton *)wf->FindByName(_T("butDown"));
    if (wb) {
      wb->hide();
    }
    wb = (WndButton *)wf->FindByName(_T("butUp"));
    if (wb) {
      wb->hide();
    }
  } else {
    if (!task.ValidTaskPoint(twItemIndex-1)) {
      wb = (WndButton *)wf->FindByName(_T("butUp"));
      if (wb) {
        wb->hide();
      }
    }
    if (!task.ValidTaskPoint(twItemIndex+1)) {
      wb = (WndButton *)wf->FindByName(_T("butDown"));
      if (wb) {
        wb->hide();
      }
    }
  }

  SetWaypointValues(true);

  switch (twType) {
    case 0:
      wStart->show();
      wTurnpoint->hide();
      wAATTurnpoint->hide();
      wFinish->hide();
      break;
    case 1:
      wStart->hide();
      wTurnpoint->set_visible(!settings_task.AATEnabled);
      wAATTurnpoint->set_visible(settings_task.AATEnabled);
      wFinish->hide();
    break;
    case 2:
      wStart->hide();
      wTurnpoint->hide();
      wAATTurnpoint->hide();
      wFinish->show();
    break;
  }

  // set properties...

  SetValues(true);

  UpdateCaption();

  wf->ShowModal();

  // now retrieve changes

  GetWaypointValues();

  ReadValues();

  delete wf;

  wf = NULL;

}