示例#1
0
void dlgOracleShowModal(void){

  SHOWTHREAD(_T("dlgOracleShowModal"));

  wf=NULL;
 
  if (!ScreenLandscape) {
    TCHAR filename[MAX_PATH];
    LocalPathS(filename, TEXT("dlgOracle_L.xml"));
    wf = dlgLoadFromXML(CallBackTable, filename, TEXT("IDR_XML_ORACLE_L"));
  } else  {
    TCHAR filename[MAX_PATH];
    LocalPathS(filename, TEXT("dlgOracle.xml"));
    wf = dlgLoadFromXML(CallBackTable, filename, TEXT("IDR_XML_ORACLE"));
  }

  if (!wf) return;

  // Since the topology search is made in the cache, and the cache has only items that
  // are ok to be printed for the current scale, and we want also items for high zoom,
  // we force high zoom and refresh. First we save current scale, of course.
  double oldzoom=MapWindow::zoom.Scale();

  // set a zoom level for topology visibility scan
  MapWindow::zoom.EventSetZoom(3);
  MapWindow::RefreshMap(); 

  // Make the current nearest invalid
  ResetNearestTopology();

  WaitToCallForce=2;

  // We must wait for data ready, so we shall do it  with timer notify.
  wf->SetTimerNotify(OnTimerNotify);
  wf->ShowModal();

  delete wf;
  wf = NULL;
  // Now we restore old zoom
  MapWindow::zoom.EventSetZoom(oldzoom);
  // And force rescan of topology in the cache
  MapWindow::ForceVisibilityScan=true;
  MapWindow::RefreshMap();

}
/*
 * only called by #CAirspaceManager::ProcessAirspaceDetailQueue()
 * for display AirspaceDetails, use #PopupAirspaceDetail
 */
void dlgAirspaceDetails() {

  SHOWTHREAD(_T("dlgAirspaceDetails"));

  TCHAR filename[MAX_PATH];
  LocalPathS(filename, TEXT("dlgAirspaceDetails.xml"));
  wf = dlgLoadFromXML(CallBackTable,
		      filename, 
		      TEXT("IDR_XML_AIRSPACEDETAILS"));

  if (!wf) return;
  wf->SetTimerNotify(1000, OnTimer);
  
  SetValues();

  wf->ShowModal();

  delete wf;
  wf = NULL;

  return;
}
示例#3
0
// Intercept messages destined for the Status Message window
LRESULT CALLBACK MessageWindowProc(HWND hwnd, UINT message, 
				   WPARAM wParam, LPARAM lParam)
{

  POINT pt;
  RECT  rc;
  static bool capturedMouse = false;

  SHOWTHREAD(_T("MessageWindowProc"));

  switch (message) {
  case WM_LBUTTONDOWN:

    // Intercept mouse messages while stylus is being dragged
    // This is necessary to simulate a WM_LBUTTONCLK event
    SetCapture(hwnd);
    capturedMouse = TRUE;

    return 0;
  case WM_LBUTTONUP :

    ReleaseCapture();
    if (!capturedMouse) return 0;
    capturedMouse = FALSE;

    // Is stylus still within this window?
    pt.x = LOWORD(lParam);
    pt.y = HIWORD(lParam);
    GetClientRect(hwnd, &rc);

    if (!PtInRect(&rc, pt)) return 0;

    DestroyWindow(hwnd);
    return 0;
  }
  return DefWindowProc(hwnd, message, wParam, lParam);
}
示例#4
0
void dlgRadioSettingsShowModal(void){
  SHOWTHREAD(_T("dlgRadioSettingsShowModal"));

//  WndProperty *wp;
//  int ival;

    wf = dlgLoadFromXML(CallBackTable,                        
		      TEXT("dlgRadioSettings.xml"), 
		           IDR_XML_RADIOSETTINGS );
  if (!wf) return;
  
  VolMode = VOL; // start with volume
  
  if (wf) {
    wpnewActive = (WndButton*)wf->FindByName(TEXT("cmdActive"));
    LKASSERT( wpnewActive !=NULL);
    wpnewActive->SetOnClickNotify(OnActiveButton);

    wpnewActiveFreq = (WndButton*)wf->FindByName(TEXT("cmdActiveFreq"));
    LKASSERT( wpnewActiveFreq !=NULL);    
    wpnewActiveFreq->SetOnClickNotify(OnActiveFreq);

    wpnewPassive  = (WndButton*)wf->FindByName(TEXT("cmdPassive"));
    LKASSERT(   wpnewPassive   !=NULL)  
    wpnewPassive->SetOnClickNotify(OnPassiveButton);

    wpnewPassiveFreq = (WndButton*)wf->FindByName(TEXT("cmdPassiveFreq"));    
    LKASSERT(   wpnewPassiveFreq   !=NULL)  
    wpnewPassiveFreq->SetOnClickNotify(OnPassiveFreq);

   wpnewVol  = (WndButton*)wf->FindByName(TEXT("cmdVol"));
    LKASSERT(   wpnewVol   !=NULL)  
    wpnewVol->SetOnClickNotify(OnMuteButton);
 
   wpnewDual  = (WndButton*)wf->FindByName(TEXT("cmdDual"));
   LKASSERT(   wpnewDual   !=NULL)  
   wpnewDual->SetOnClickNotify(OnDualButton);

   wpnewVolDwn = ((WndButton *)wf->FindByName(TEXT("cmdVolDown")));
   LKASSERT(   wpnewVolDwn   !=NULL)  
   wpnewVolDwn->SetOnClickNotify(OnVolDownButton);
     
   wpnewVolUp =     ((WndButton *)wf->FindByName(TEXT("cmdVolUp")));
   LKASSERT(   wpnewVolUp   !=NULL)  
   wpnewVolUp->SetOnClickNotify(OnVolUpButton);

   wpnewExChg  =        ((WndButton *)wf->FindByName(TEXT("cmdXchange")));
   LKASSERT(   wpnewExChg    !=NULL)  
   wpnewExChg ->SetOnClickNotify(OnExchange);

//    wf->SetTimerNotify(OnTimerNotify);

   wf->SetTimerNotify(300, OnTimerNotify);
   RadioPara.Changed = true;

   OnUpdate();
   OnRemoteUpdate();

   wf->ShowModal();

    delete wf;
  }
  wf = NULL;
  return ;
}
示例#5
0
void dlgBasicSettingsShowModal(void){

  SHOWTHREAD(_T("dlgBasicSettingsShowModal"));

  char filename[MAX_PATH];
  if (!ScreenLandscape) {
	LocalPathS(filename, TEXT("dlgBasicSettings_L.xml"));
	wf = dlgLoadFromXML(CallBackTable, filename, hWndMainWindow, TEXT("IDR_XML_BASICSETTINGS_L"));
  } else {
	LocalPathS(filename, TEXT("dlgBasicSettings.xml"));
	wf = dlgLoadFromXML(CallBackTable, filename, hWndMainWindow, TEXT("IDR_XML_BASICSETTINGS"));
  }

  WndProperty* wp;

//  BallastTimerActive = false;

  if (wf) {

    wf->SetTimerNotify(OnTimerNotify);

    ((WndButton *)wf->FindByName(TEXT("buttonDumpBallast")))->SetVisible(!BallastTimerActive);
    ((WndButton *)wf->FindByName(TEXT("buttonStopDump")))->SetVisible(BallastTimerActive);

    wp = (WndProperty*)wf->FindByName(TEXT("prpAltitude"));
    if (wp) {
      wp->GetDataField()->SetAsFloat(
	       Units::ToUserAltitude(GPS_INFO.BaroAltitude));
      wp->GetDataField()->SetUnits(Units::GetAltitudeName());
      if (!GPS_INFO.BaroAltitudeAvailable) wp->SetReadOnly(1);
      wp->RefreshDisplay();
    }

    wp = (WndProperty*)wf->FindByName(TEXT("prpBallastPercent"));
    if (wp) {
      if (WEIGHTS[2]==0) wp->SetReadOnly(1);
      wp->RefreshDisplay();
    }

    wp = (WndProperty*)wf->FindByName(TEXT("prpBallastLitres"));
    if (wp) {
      if (WEIGHTS[2]>0) {
        wp->GetDataField()-> SetAsFloat(GlidePolar::BallastLitres);
      } else {
	wp->SetReadOnly(1);
      }
      wp->RefreshDisplay();
    }
    wp = (WndProperty*)wf->FindByName(TEXT("prpWingLoading"));
    if (wp) {
      if (GlidePolar::WingLoading>0.1) {
	if (ISPARAGLIDER) {
		wp->GetDataField()->SetDisplayFormat(_T("%.1f kg/m2"));
		wp->GetDataField()->SetEditFormat(_T("%1.1f"));
		wp->GetDataField()->SetMin(1.0);
		wp->GetDataField()->SetStep(0.1);
	} 
	if (ISGLIDER) {
		wp->GetDataField()->SetDisplayFormat(_T("%.1f kg/m2"));
		wp->GetDataField()->SetEditFormat(_T("%1.1f"));
		wp->GetDataField()->SetMin(5.0);
		wp->GetDataField()->SetStep(0.5);
	}
	wp->GetDataField()-> SetAsFloat(GlidePolar::WingLoading);
      } else {
	wp->SetVisible(false);
      }
      wp->RefreshDisplay();
    }
    if (CALCULATED_INFO.Flying) {
	wp = (WndProperty*)wf->FindByName(TEXT("prpQNH"));
	if (wp) {
		wp->GetDataField()->SetDisplayFormat(_T("%.0f"));
	}
    }

    wf->ShowModal();
    delete wf;
  }
  wf = NULL;

}
示例#6
0
void StartLogger()
{

  SHOWTHREAD(_T("StartLogger"));

  HANDLE hFile;
  int i;
  TCHAR path[MAX_PATH+1];
  TCHAR cAsset[3];

  // strAsset is initialized with DUM.
  if (_tcslen(PilotName_Config)>0) {
	strAssetNumber[0]= IsAlphaNum(PilotName_Config[0]) ? PilotName_Config[0] : _T('A');
	strAssetNumber[1]= IsAlphaNum(PilotName_Config[1]) ? PilotName_Config[1] : _T('A');
  } else {
	strAssetNumber[0]= _T('D');
	strAssetNumber[1]= _T('U');
  }
  if (_tcslen(AircraftType_Config)>0) {
	strAssetNumber[2]= IsAlphaNum(AircraftType_Config[0]) ? AircraftType_Config[0] : _T('A');
  } else {
	strAssetNumber[2]= _T('M');
  }
  strAssetNumber[0]= towupper(strAssetNumber[0]);
  strAssetNumber[1]= towupper(strAssetNumber[1]);
  strAssetNumber[2]= towupper(strAssetNumber[2]);
  strAssetNumber[3]= _T('\0');

  for (i=0; i < 3; i++) { // chars must be legal in file names
    cAsset[i] = IsAlphaNum(strAssetNumber[i]) ? strAssetNumber[i] : _T('A');
  }

  LocalPath(path,TEXT(LKD_LOGS));

  if (TaskModified) {
    SaveDefaultTask();
  }
  wsprintf(szLoggerFileName, TEXT("%s\\LOGGER_TMP.IGC"), path);

  wsprintf(szSLoggerFileName, TEXT("%s\\LOGGER_SIG.IGC"), path);
  TCHAR newfile[MAX_PATH+20];
  if (GetFileAttributes(szLoggerFileName) != 0xffffffff) {
	StartupStore(_T("---- Logger recovery: Existing LOGGER_TMP.IGC found, renamed to LOST%s"),NEWLINE);
	wsprintf(newfile, TEXT("%s\\LOST_%02d%02d%02d.IGC"), path, GPS_INFO.Hour, GPS_INFO.Minute, GPS_INFO.Second);
	CopyFile(szLoggerFileName,newfile,TRUE);
	DeleteFile(szLoggerFileName);
  }
  if (GetFileAttributes(szSLoggerFileName) != 0xffffffff) {
	StartupStore(_T("---- Logger recovery (G): Existing LOGGER_SIG.IGC found, renamed to LOSTG%s"),NEWLINE);
	wsprintf(newfile, TEXT("%s\\LOSTG_%02d%02d%02d.IGC"), path, GPS_INFO.Hour, GPS_INFO.Minute, GPS_INFO.Second);
	CopyFile(szSLoggerFileName,newfile,TRUE);
	DeleteFile(szSLoggerFileName);
  }

  
  for(i=1;i<99;i++)
    {
      // 2003-12-31-XXX-987-01.IGC
      // long filename form of IGC file.
      // XXX represents manufacturer code

      if (!LoggerShortName) {
        // Long file name
        wsprintf(szFLoggerFileName,
                 TEXT("%s\\%04d-%02d-%02d-%s-%c%c%c-%02d.IGC"),
                 path,
                 GPS_INFO.Year,
                 GPS_INFO.Month,
                 GPS_INFO.Day,
		 _T(LOGGER_MANUFACTURER),
                 cAsset[0],
                 cAsset[1],
                 cAsset[2],
                 i);
 
        wsprintf(szFLoggerFileNameRoot,
                 TEXT("%s\\%04d-%02d-%02d-%s-%c%c%c-%02d.IGC"),
                 TEXT(""), // this creates it in root if MoveFile() fails
                 GPS_INFO.Year,
                 GPS_INFO.Month,
                 GPS_INFO.Day,
		 _T(LOGGER_MANUFACTURER),
                 cAsset[0],
                 cAsset[1],
                 cAsset[2],
                 i);
      } else {
        // Short file name
        TCHAR cyear, cmonth, cday, cflight;
        cyear = NumToIGCChar((int)GPS_INFO.Year % 10);
        cmonth = NumToIGCChar(GPS_INFO.Month);
        cday = NumToIGCChar(GPS_INFO.Day);
        cflight = NumToIGCChar(i);
        wsprintf(szFLoggerFileName,
                 TEXT("%s\\%c%c%cX%c%c%c%c.IGC"),
                 path,
                 cyear,
                 cmonth,
                 cday,
                 cAsset[0],
                 cAsset[1],
                 cAsset[2],
                 cflight);

        wsprintf(szFLoggerFileNameRoot,
                 TEXT("%s\\%c%c%cX%c%c%c%c.IGC"),
                 TEXT(""), // this creates it in root if MoveFile() fails
                 cyear,
                 cmonth,
                 cday,
                 cAsset[0],
                 cAsset[1],
                 cAsset[2],
                 cflight);
      } // end if

      hFile = CreateFile(szFLoggerFileName, GENERIC_WRITE,
			 FILE_SHARE_WRITE, NULL, CREATE_NEW,
			 FILE_ATTRIBUTE_NORMAL, 0);
      if(hFile!=INVALID_HANDLE_VALUE )
	{
          // file already exists
      CloseHandle(hFile);
      DeleteFile(szFLoggerFileName);
      break;
	}
  } // end while

  StartupStore(_T(". Logger Started %s  File <%s>%s"),
	WhatTimeIsIt(), szFLoggerFileName,NEWLINE);


  return;
}