示例#1
0
bool
dlgStartupShowModal()
{
  LogStartUp(_T("Startup dialog"));

  logo = new LogoView();

  wf = LoadDialog(CallBackTable, XCSoarInterface::main_window,
                  Layout::landscape ? _T("IDR_XML_STARTUP_L") :
                                      _T("IDR_XML_STARTUP"));
  assert(wf != NULL);

  WndProperty* wp = ((WndProperty *)wf->FindByName(_T("prpProfile")));
  assert(wp != NULL);

  DataFieldFileReader* dfe = (DataFieldFileReader*)wp->GetDataField();
  assert(dfe != NULL);

  ((WndButton *)wf->FindByName(_T("cmdClose")))
    ->SetOnClickNotify(OnCloseClicked);

  ((WndButton *)wf->FindByName(_T("cmdQuit")))->SetOnClickNotify(OnQuit);

  dfe->ScanDirectoryTop(is_altair() ? _T("config/*.prf") : _T("*.prf"));
  dfe->Lookup(startProfileFile);
  wp->RefreshDisplay();

  if (dfe->GetNumFiles() <= 2) {
    delete wf;
    return true;
  }

  if (wf->ShowModal() != mrOK) {
    delete wf;
    return false;
  }

  const TCHAR *path = dfe->GetPathFile();
  if (!string_is_empty(path)) {
    _tcscpy(startProfileFile, path);

    /* When a profile from a secondary data path is used, this path
       becomes the primary data path */
    TCHAR temp[MAX_PATH];
    SetPrimaryDataPath(DirName(path, temp));
  }

  delete wf;
  delete logo;
  return true;
}
static void OnSaveClicked(WndButton* pWnd){

  int file_index; 
  TCHAR task_name[MAX_PATH];
  TCHAR file_name[MAX_PATH];
  WndProperty* wp;
  DataFieldFileReader *dfe;

  wp = (WndProperty*)wf->FindByName(TEXT("prpFile"));
  if (!wp) return;
  dfe = (DataFieldFileReader*)wp->GetDataField();

  file_index = dfe->GetAsInteger();

  // TODO enhancement: suggest a good new name not already in the list
  _tcscpy(task_name,TEXT("NEW"));
  dlgTextEntryShowModal(task_name, 10); // max length

  if (_tcslen(task_name)>0) {

	_tcscat(task_name, TEXT(LKS_TSK));
	LocalPath(file_name,TEXT(LKD_TASKS));
	_tcscat(file_name,TEXT(DIRSEP));
	_tcscat(file_name,task_name); // 091101

	dfe->Lookup(file_name);
	file_index = dfe->GetAsInteger();

	if (file_index==0) {
		// good, this file is unique..
		dfe->addFile(task_name, file_name);
		dfe->Lookup(file_name);
		wp->RefreshDisplay();
	}

  } else {
	// TODO code: report error, task not saved since no name was given
	return;
  }

  if (file_index>0) {
	// file already exists! ask if want to overwrite
	_stprintf(file_name, TEXT("%s: '%s'"), 
	// LKTOKEN  _@M696_ = "Task file already exists" 
		gettext(TEXT("_@M696_")),
		dfe->GetAsString());

		if(MessageBoxX(
			file_name,
			// LKTOKEN  _@M510_ = "Overwrite?" 
			gettext(TEXT("_@M510_")),
			mbYesNo) != IdYes) {

			return;
		}
  }

  SaveTask(dfe->GetPathFile());
  UpdateCaption();
}
示例#3
0
bool
dlgStartupShowModal()
{
  LogFormat("Startup dialog");

  logo = new LogoView();

  wf = LoadDialog(CallBackTable, UIGlobals::GetMainWindow(),
                  Layout::landscape ? _T("IDR_XML_STARTUP_L") :
                                      _T("IDR_XML_STARTUP"));
  assert(wf != NULL);

  WndProperty* wp = ((WndProperty *)wf->FindByName(_T("prpProfile")));
  assert(wp != NULL);

  DataFieldFileReader* dfe = (DataFieldFileReader*)wp->GetDataField();
  assert(dfe != NULL);

  dfe->ScanDirectoryTop(_T("*.prf"));

  if (dfe->GetNumFiles() <= 1) {
    SelectProfile(dfe->GetPathFile());

    delete wf;
    delete logo;
    return true;
  }

  unsigned best_index = 0;
  uint64_t best_timestamp = 0;
  unsigned length = dfe->size();

  for (unsigned i = 0; i < length; ++i) {
    const TCHAR *path = dfe->GetItem(i);
    uint64_t timestamp = File::GetLastModification(path);
    if (timestamp > best_timestamp) {
      best_timestamp = timestamp;
      best_index = i;
    }
  }
  dfe->Set(best_index);
  wp->RefreshDisplay();

  if (wf->ShowModal() != mrOK) {
    delete wf;
    delete logo;
    return false;
  }

  SelectProfile(dfe->GetPathFile());

  delete wf;
  delete logo;
  return true;
}
示例#4
0
static void setVariables(void) {
WndProperty *wp;
TCHAR temptext[MAX_PATH];
TCHAR tmp[MAX_PATH];

  for (unsigned int i=0 ; i < NO_WP_FILES; i++)
  {
    _tcscpy(temptext,szWaypointFile[i]);
    _sntprintf(tmp,MAX_PATH,_T("prpFile%1u"),i+1);
    wp = (WndProperty*)wf->FindByName(tmp);

    if (wp) {
      DataFieldFileReader* dfe = static_cast<DataFieldFileReader*>(wp->GetDataField());
      if(dfe) {
          dfe->ScanDirectoryTop(_T(LKD_WAYPOINTS), _T("*" LKS_WP_WINPILOT));
          dfe->ScanDirectoryTop(_T(LKD_WAYPOINTS), _T("*" LKS_WP_XCSOAR));
          dfe->ScanDirectoryTop(_T(LKD_WAYPOINTS), _T("*" LKS_WP_CUP));
          dfe->ScanDirectoryTop(_T(LKD_WAYPOINTS), _T("*" LKS_WP_COMPE));
          dfe->ScanDirectoryTop(_T(LKD_WAYPOINTS), _T("*" LKS_OPENAIP));
          dfe->Lookup(temptext);



        _sntprintf(tmp,MAX_PATH,_T("%s %1u "), MsgToken(2341),i+1);  // _@M2341_ "Waypoint File"
        wp->SetCaption(tmp);
      }
      wp->RefreshDisplay();
    }
  }
}
示例#5
0
bool
FilePicker(const TCHAR *caption, const TCHAR *patterns, TCHAR *buffer)
{
  assert(patterns != NULL);

  DataFieldFileReader df;
  df.ScanMultiplePatterns(patterns);
  const ComboList combo_list = df.CreateComboList(nullptr);
  if (combo_list.size() == 0)
    return false;

  int i = ComboPicker(caption, combo_list, nullptr);
  if (i < 0)
    return false;

  const ComboList::Item &item = combo_list[i];
  df.SetFromCombo(item.DataFieldIndex, item.StringValue);

  _tcscpy(buffer, df.GetAsString());
  return true;
}
示例#6
0
static void OnSaveExistingClicked(WindowControl * Sender) {
  (void)Sender;

  int file_index; 
  TCHAR file_name[MAX_PATH];
  WndProperty* wp;
  DataFieldFileReader *dfe;

  if ( CheckClubVersion() ) {
	ClubForbiddenMsg();
	return;
  }

  wp = (WndProperty*)wf->FindByName(TEXT("prpFile"));
  if (!wp) return;

  HWND hwnd = wp->GetHandle();
  SendMessage(hwnd,WM_LBUTTONDOWN,0,0);
  dfe = (DataFieldFileReader*) wp->GetDataField();


  file_index = dfe->GetAsInteger();

  if (file_index>0) {
	_tcscpy(file_name,dfe->GetAsString());
	if(MessageBoxX(hWndMapWindow, file_name, 
	// LKTOKEN  _@M509_ = "Overwrite profile?" 
		gettext(TEXT("_@M509_")), 
		MB_YESNO|MB_ICONQUESTION) == IDYES) {

		WriteProfile(dfe->GetPathFile());
	// LKTOKEN  _@M535_ = "Profile saved!" 
		MessageBoxX(hWndMapWindow, gettext(TEXT("_@M535_")),_T(""), MB_OK|MB_ICONEXCLAMATION);
		return;
	}
  	dfe->Set(0);
  } 

}
示例#7
0
void dlgProfilesShowModal(void){

  wf = NULL;

  char filename[MAX_PATH];
  LocalPathS(filename, TEXT("dlgProfiles.xml"));
  wf = dlgLoadFromXML(CallBackTable, filename, hWndMainWindow, TEXT("IDR_XML_PROFILES"));

  if (!wf) return;

  ASSERT(wf!=NULL);

  ((WndButton *)wf->FindByName(TEXT("cmdClose"))) ->SetOnClickNotify(OnCloseClicked);
  ((WndButton *)wf->FindByName(TEXT("cmdLoad"))) ->SetOnClickNotify(OnLoadClicked);
  ((WndButton *)wf->FindByName(TEXT("cmdSaveExisting"))) ->SetOnClickNotify(OnSaveExistingClicked);
  ((WndButton *)wf->FindByName(TEXT("cmdSaveNew"))) ->SetOnClickNotify(OnSaveNewClicked);



  WndProperty* wp;
  wp = (WndProperty*)wf->FindByName(TEXT("prpFile"));
  if (wp) {
	DataFieldFileReader* dfe;
	dfe = (DataFieldFileReader*)wp->GetDataField();

	TCHAR suff[10];
	_stprintf(suff,_T("*%S"),LKS_PRF);
	dfe->ScanDirectoryTop(_T(LKD_CONF),suff);
  	dfe->Set(0);
  }

  wf->ShowModal();

  delete wf;

  wf = NULL;

}
示例#8
0
static void OnDeleteClicked(WndButton* pWnd){

  TCHAR file_name[MAX_PATH];

  WndProperty* wp;
  DataFieldFileReader *dfe;

  wp = (WndProperty*)wf->FindByName(TEXT("prpFile"));
  if (!wp) return;

  wp->OnLButtonDown((POINT){0,0});

  dfe = (DataFieldFileReader*) wp->GetDataField();

  int file_index = dfe->GetAsInteger();
  if (file_index>0) {
	_stprintf(file_name, TEXT("%s '%s' ?"), MsgToken(1789), dfe->GetAsString()); // Delete task file?
	if(MessageBoxX(file_name, _T(" "), mbYesNo) == IdNo) {
		return;
	}
  } else {
	MessageBoxX(MsgToken(1790),_T(" "), mbOk); // No task file to delete
	return;
  }

  if (file_index>0) {
    lk::filesystem::deleteFile(dfe->GetPathFile());
    // Cannot update dfe list, so we force exit.
    ItemIndex = -1;
    if(pWnd) {
      WndForm * pForm = pWnd->GetParentWndForm();
      if(pForm) {
        pForm->SetModalResult(mrOK);
      }
    }
    return;
  }
}
示例#9
0
static void OnLoadClicked(WindowControl * Sender, WndListFrame::ListInfo_t *ListInfo){ // 091216
  (void)ListInfo; (void)Sender;

  TCHAR file_name[MAX_PATH];

  WndProperty* wp;
  DataFieldFileReader *dfe;

  wp = (WndProperty*)wf->FindByName(TEXT("prpFile"));
  if (!wp) return;

  HWND hwnd = wp->GetHandle();
  SendMessage(hwnd,WM_LBUTTONDOWN,0,0);
  dfe = (DataFieldFileReader*) wp->GetDataField();

  int file_index = dfe->GetAsInteger();
  if (file_index>0) {
	if (ValidTaskPoint(ActiveWayPoint) && ValidTaskPoint(1)) {
		// _stprintf(file_name, TEXT("Clear old task and load '%s' ?"), dfe->GetAsString()); REMOVE FIXV2 101229
		_stprintf(file_name, TEXT("%s '%s' ?"), gettext(TEXT("_@M891_")), dfe->GetAsString()); // Clear old task and load
		if(MessageBoxX(hWndMapWindow, file_name, _T(" "), MB_YESNO|MB_ICONQUESTION) == IDNO) {
			return;
		}
	}
  } else {
	// LKTOKEN  _@M467_ = "No Task to load" 
	MessageBoxX(hWndMapWindow, gettext(TEXT("_@M467_")),_T(" "), MB_OK|MB_ICONEXCLAMATION);
	return;
  }

  if (file_index>0) {
    LoadNewTask(dfe->GetPathFile());
    OverviewRefreshTask();
    UpdateFilePointer();
    UpdateCaption();
  }
}
示例#10
0
static void OnLoadClicked(WindowControl * Sender){

 TCHAR file_name[MAX_PATH];

  WndProperty* wp;
  DataFieldFileReader *dfe;

  wp = (WndProperty*)wf->FindByName(TEXT("prpFile"));
  if (!wp) return;

  HWND hwnd = wp->GetHandle();
  SendMessage(hwnd,WM_LBUTTONDOWN,0,0);
  dfe = (DataFieldFileReader*) wp->GetDataField();

  int file_index = dfe->GetAsInteger();
  if (file_index>0) {
	_tcscpy(file_name,dfe->GetAsString());

	if(MessageBoxX(hWndMapWindow, file_name, 
	// LKTOKEN  _@M397_ = "Load this profile?" 
		gettext(TEXT("_@M397_")), 
		MB_YESNO|MB_ICONQUESTION) == IDYES) {
		SettingsEnter();
		ReadProfile(dfe->GetPathFile());
		WAYPOINTFILECHANGED=true;
		SettingsLeave();
		MessageBoxX(hWndMapWindow, 
	// LKTOKEN  _@M534_ = "Profile loaded!" 
		gettext(TEXT("_@M534_")),
		_T(""), MB_OK|MB_ICONEXCLAMATION);
		return;
	}
  	dfe->Set(0);
  }
  
}
示例#11
0
void dlgLoggerReplayShowModal(void){

  TCHAR tsuf[10];
  char filename[MAX_PATH];
  LocalPathS(filename, TEXT("dlgLoggerReplay.xml"));
  wf = dlgLoadFromXML(CallBackTable, 
                      filename, 
		      hWndMainWindow,
		      TEXT("IDR_XML_LOGGERREPLAY"));

  WndProperty* wp;

  if (wf) {

    wp = (WndProperty*)wf->FindByName(TEXT("prpRate"));
    if (wp) {
      wp->GetDataField()->SetAsFloat(ReplayLogger::TimeScale);
      wp->RefreshDisplay();
    }

    wp = (WndProperty*)wf->FindByName(TEXT("prpIGCFile"));
    if (wp) {
      DataFieldFileReader* dfe;
      dfe = (DataFieldFileReader*)wp->GetDataField();
      // dfe->ScanDirectoryTop(_T(""),TEXT("*.igc")); 
      _stprintf(tsuf,_T("*%S"),LKS_IGC);
      dfe->ScanDirectoryTop(_T(LKD_LOGS),tsuf);
      dfe->Lookup(ReplayLogger::GetFilename());
      wp->RefreshDisplay();
    }

    wf->ShowModal();
    delete wf;
  }
  wf = NULL;
}
示例#12
0
bool
dlgStartupShowModal()
{
  LogStartUp(_T("Startup dialog"));

  logo = new LogoView();

  wf = LoadDialog(CallBackTable, XCSoarInterface::main_window,
                  Layout::landscape ? _T("IDR_XML_STARTUP_L") :
                                      _T("IDR_XML_STARTUP"));
  assert(wf != NULL);

  WndProperty* wp = ((WndProperty *)wf->FindByName(_T("prpProfile")));
  assert(wp != NULL);

  DataFieldFileReader* dfe = (DataFieldFileReader*)wp->GetDataField();
  assert(dfe != NULL);

  ((WndButton *)wf->FindByName(_T("cmdClose")))
    ->SetOnClickNotify(OnCloseClicked);

  ((WndButton *)wf->FindByName(_T("cmdQuit")))->SetOnClickNotify(OnQuit);

  dfe->SetNotNullable();
  dfe->ScanDirectoryTop(_T("*.prf"));
  dfe->Lookup(Profile::GetPath());
  wp->RefreshDisplay();

  if (dfe->GetNumFiles() <= 1) {
    SelectProfile(dfe->GetPathFile());

    delete wf;
    delete logo;
    return true;
  }

  if (wf->ShowModal() != mrOK) {
    delete wf;
    delete logo;
    return false;
  }

  SelectProfile(dfe->GetPathFile());

  delete wf;
  delete logo;
  return true;
}
示例#13
0
bool
dlgStartupShowModal()
{
  LogFormat("Startup dialog");

  /* scan all profile files */
  DataFieldFileReader *dfe = new DataFieldFileReader();
  dfe->ScanDirectoryTop(_T("*.prf"));

  /* skip this dialog if there is only one (or none) */
  if (dfe->GetNumFiles() <= 1) {
    SelectProfile(dfe->GetPathFile());
    delete dfe;
    return true;
  }

  /* preselect the most recently used profile */
  unsigned best_index = 0;
  uint64_t best_timestamp = 0;
  unsigned length = dfe->size();

  for (unsigned i = 0; i < length; ++i) {
    const TCHAR *path = dfe->GetItem(i);
    uint64_t timestamp = File::GetLastModification(path);
    if (timestamp > best_timestamp) {
      best_timestamp = timestamp;
      best_index = i;
    }
  }

  dfe->Set(best_index);

  /* show the dialog */
  const DialogLook &look = UIGlobals::GetDialogLook();
  WidgetDialog dialog(look);
  TwoWidgets widget(new LogoQuitWidget(look.button, dialog),
                    new StartupWidget(look, dialog, dfe));

  dialog.CreateFull(UIGlobals::GetMainWindow(), _T(""), &widget);

  const int result = dialog.ShowModal();
  dialog.StealWidget();

  return result == mrOK;
}
示例#14
0
void dlgTaskOverviewShowModal(int Idx){

  UpLimit = 0;
  LowLimit = 0;
  ItemIndex = Idx; //-1;

  showAdvanced = false;

  wf = dlgLoadFromXML(CallBackTable, ScreenLandscape ? IDR_XML_TASKOVERVIEW_L : IDR_XML_TASKOVERVIEW_P);

  if (!wf) return;

  WndButton *wb = (WndButton*)wf->FindByName(TEXT("cmdTimegates"));
  if (wb) wb->SetVisible(false);

  if (ISPARAGLIDER) {
	if (PGOptimizeRoute) AATEnabled=true; // force it on
        EnableMultipleStartPoints=false;
        if (wb) wb->SetVisible(true);
	wb = (WndButton*)wf->FindByName(TEXT("cmdDelete"));
	if (wb) wb->SetVisible(false);
  }

  UpdateCaption();

  wfAdvanced = ((WndFrame *)wf->FindByName(TEXT("frmAdvanced")));

  wTaskList = (WndListFrame*)wf->FindByName(TEXT("frmTaskList"));
  wTaskList->SetBorderKind(BORDERLEFT);
  wTaskList->SetEnterCallback(OnTaskListEnter);

  wTaskListEntry = (WndOwnerDrawFrame*)wf->FindByName(TEXT("frmTaskListEntry"));
  wTaskListEntry->SetCanFocus(true);

  WndProperty* wp;

  wp = (WndProperty*)wf->FindByName(TEXT("prpFile"));
  if (wp) {
    wp->SetVisible(false);
    DataFieldFileReader* dfe = static_cast<DataFieldFileReader*>(wp->GetDataField());
    if(dfe) {
      dfe->ScanDirectoryTop(_T(LKD_TASKS), _T("*" LKS_TSK));
#ifdef OLDTASK_COMPAT
	  dfe->ScanDirectoryTop(_T(LKD_TASKS), _T("*" LKS_OLD_TSK));
#endif
	  dfe->ScanDirectoryTop(_T(LKD_TASKS), _T("*" LKS_WP_CUP));
	  dfe->ScanDirectoryTop(_T(LKD_TASKS), _T("*" LKS_WP_GPX));
    }
	wp->RefreshDisplay();
  }
  UpdateFilePointer();

  // initialise and turn on the display
  OverviewRefreshTask();

  UpdateAdvanced();



  wTaskList->SetItemIndexPos(Idx);
  wTaskList->Redraw();
  wTaskListEntry->SetFocus();

  wf->ShowModal();

  // now retrieve back the properties...

  RefreshTask();

  delete wf;

  wf = NULL;

}
示例#15
0
static void OnLoadClicked(WndButton* pWnd){ // 091216
  TCHAR file_name[MAX_PATH];

  WndProperty* wp;
  DataFieldFileReader *dfe;

  wp = (WndProperty*)wf->FindByName(TEXT("prpFile"));
  if (!wp) return;

  wp->OnLButtonDown((POINT){0,0});

  dfe = (DataFieldFileReader*) wp->GetDataField();

  int file_index = dfe->GetAsInteger();
  if (file_index>0) {
	if (ValidTaskPoint(ActiveTaskPoint) && ValidTaskPoint(1)) {
		_stprintf(file_name, TEXT("%s '%s' ?"), MsgToken(891), dfe->GetAsString()); // Clear old task and load
		if(MessageBoxX(file_name, _T(" "), mbYesNo) == IdNo) {
			return;
		}
	}
  } else {
	// LKTOKEN  _@M467_ = "No Task to load"
	MessageBoxX(MsgToken(467),_T(" "), mbOk);
	return;
  }

  if (file_index>0) {

      LPCTSTR szFileName = dfe->GetPathFile();
      LPCTSTR wextension = _tcsrchr(szFileName, _T('.'));
      if(wextension) {

          TCHAR szFilePath[MAX_PATH];
          LocalPath(szFilePath, _T(LKD_TASKS), szFileName);

          bool bOK = false;
          if(_tcsicmp(wextension,_T(LKS_TSK))==0) {
              CTaskFileHelper helper;
              bOK = helper.Load(szFilePath);
          }
#ifdef OLDTASK_COMPAT
          else if (_tcsicmp(wextension,_T(LKS_OLD_TSK))==0) {
              LoadNewTask(szFilePath);
              bOK = true;
          }
#endif
          else if (_tcsicmp(wextension,_T(LKS_WP_CUP))==0) {
              bOK = LoadCupTask(szFilePath);
          } else if (_tcsicmp(wextension,_T(LKS_WP_GPX))==0) {
              bOK = LoadGpxTask(szFilePath);
          }
          if(!bOK) {
              MessageBoxX(MsgToken(467),_T(" "), mbOk);
              return;
          }
          OverviewRefreshTask();
          UpdateFilePointer();
          UpdateCaption();
      }
  }
}
示例#16
0
short dlgStartupShowModal(void) {
    WndProperty* wp = nullptr;

#if TESTBENCH
    StartupStore(TEXT(". Startup dialog, RUN_MODE=%d %s"), RUN_MODE, NEWLINE);
#endif

    switch(RUN_MODE) {
        case RUN_WELCOME: // FLY SIM PROFILE EXIT
            wf = InitFlySim();
            break;
        case RUN_DUALPROF: //  PROFILE AIRCRAFT  CLOSE
            wf = InitDualProfile();
            break;
        case RUN_PROFILE:
        case RUN_AIRCRAFT:
        case RUN_PILOT:
        case RUN_DEVICE:
            // CHOOSE PROFILE
            wf = InitStartup(RUN_MODE);
            break;
    }
    if (!wf) {
        return 0;
    }

    wf->SetHeight(ScreenSizeY);
    wf->SetWidth(ScreenSizeX);

    WindowControl* wSplash = wf->FindByName(TEXT("frmSplash"));
    if(wSplash) {
        wSplash->SetWidth(ScreenSizeX);
        // wSplash->SetHeight(ScreenSizeY);// - IBLSCALE(55));
    }




    if (!CheckRootDir()) {
        TCHAR mydir[MAX_PATH];
        TCHAR mes[MAX_PATH];

        LocalPath(mydir, _T(""));
        _stprintf(mes, _T("%s"), mydir);
        MessageBoxX(_T("NO LK8000 DIRECTORY\nCheck Installation!"), _T("FATAL ERROR 000"), mbOk);
        MessageBoxX(mes, _T("NO LK8000 DIRECTORY"), mbOk, true);
        RUN_MODE = RUN_EXIT;
        Shutdown();
        goto _exit;
    }

    if (!CheckDataDir()) {
        TCHAR mydir[MAX_PATH];
        TCHAR mes[MAX_PATH];

        SystemPath(mydir, _T(LKD_SYSTEM));
        _stprintf(mes, _T("%s"), mydir);
        MessageBoxX(_T("NO SYSTEM DIRECTORY\nCheck Installation!"), _T("FATAL ERROR 001"), mbOk);
        MessageBoxX(mes, _T("NO SYSTEM DIRECTORY"), mbOk, true);
        RUN_MODE = RUN_EXIT;
        Shutdown();
        goto _exit;
    }

    if (!CheckLanguageDir()) {
        TCHAR mydir[MAX_PATH];
        TCHAR mes[MAX_PATH];
        StartupStore(_T("... CHECK LANGUAGE DIRECTORY FAILED!%s"), NEWLINE);

        LocalPath(mydir, _T(LKD_LANGUAGE));
        _stprintf(mes, _T("%s"), mydir);
        MessageBoxX(_T("LANGUAGE DIRECTORY CHECK FAIL\nCheck Language Install"), _T("FATAL ERROR 002"), mbOk);
        MessageBoxX(mes, _T("NO LANGUAGE DIRECTORY"), mbOk, true);
        RUN_MODE = RUN_EXIT;
        Shutdown();
        goto _exit;
    }
    if (!CheckLanguageEngMsg()) {
        TCHAR mydir[MAX_PATH];
        TCHAR mes[MAX_PATH];
        StartupStore(_T("... CHECK LANGUAGE ENG_MSG FAILED!%s"), NEWLINE);
        LocalPath(mydir, _T(LKD_LANGUAGE));
        _stprintf(mes, _T("%s/ENG_MSG.TXT"), mydir);
        MessageBoxX(_T("ENG_MSG.TXT MISSING in LANGUAGE\nCheck Language Install"), _T("FATAL ERROR 012"), mbOk);
        MessageBoxX(mes, _T("MISSING FILE!"), mbOk, true);
        RUN_MODE = RUN_EXIT;
        Shutdown();
        goto _exit;
    }
    if (!CheckSystemDefaultMenu()) {
        TCHAR mydir[MAX_PATH];
        TCHAR mes[MAX_PATH];
        StartupStore(_T("... CHECK SYSTEM DEFAULT_MENU.TXT FAILED!%s"), NEWLINE);
        SystemPath(mydir, _T(LKD_SYSTEM));
        _stprintf(mes, _T("%s/DEFAULT_MENU.TXT"), mydir);
        MessageBoxX(_T("DEFAULT_MENU.TXT MISSING in SYSTEM\nCheck System Install"), _T("FATAL ERROR 022"), mbOk);
        MessageBoxX(mes, _T("MISSING FILE!"), mbOk, true);
        RUN_MODE = RUN_EXIT;
        Shutdown();
        goto _exit;
    }

    if (!CheckSystemBitmaps()) {
        TCHAR mydir[MAX_PATH];
        TCHAR mes[MAX_PATH];
        StartupStore(_T("... CHECK SYSTEM _BITMAPSH FAILED!%s"), NEWLINE);
        SystemPath(mydir, _T(LKD_BITMAPS));
        _stprintf(mes, _T("%s/_BITMAPSH"), mydir);
        MessageBoxX(_T("_BITMAPSH MISSING in SYSTEM Bitmaps\nCheck System Install"), _T("FATAL ERROR 032"), mbOk);
        MessageBoxX(mes, _T("MISSING FILE!"), mbOk, true);
        RUN_MODE = RUN_EXIT;
        Shutdown();
        goto _exit;
    }

    extern unsigned short Bitmaps_Errors;
    if (Bitmaps_Errors) {
        TCHAR mes[MAX_PATH];
        _stprintf(mes, _T("MISSING %d SYSTEM BITMAPS! CHECK INSTALLATION."), Bitmaps_Errors);
        MessageBoxX(mes, _T("MISSING FILES!"), mbOk, true);
    }

    if (!CheckPolarsDir()) {
        TCHAR mydir[MAX_PATH];
        TCHAR mes[MAX_PATH];
        StartupStore(_T("... CHECK POLARS DIRECTORY FAILED!%s"), NEWLINE);

        LocalPath(mydir, _T(LKD_POLARS));
        _stprintf(mes, _T("%s"), mydir);
        MessageBoxX(_T("NO POLARS DIRECTORY\nCheck Install"), _T("FATAL ERROR 003"), mbOk);
        MessageBoxX(mes, _T("NO POLARS DIRECTORY"), mbOk, true);
        RUN_MODE = RUN_EXIT;
        Shutdown();
        goto _exit;
    }

    extern bool CheckFilesystemWritable(void);
    if (!CheckFilesystemWritable()) {
        MessageBoxX(_T("LK8000 CANNOT WRITE IN MEMORY CARD!\nCARD IS LOCKED, OR DAMAGED, OR FULL."), _T("CRITICAL PROBLEM"), mbOk);
        RUN_MODE = RUN_EXIT;
        Shutdown();
        goto _exit;
    }



    // Standby for a system request to close the application during this phase.
    wf->SetTimerNotify(500, OnTimerNotify);
    if (wf->ShowModal() == mrCancel) {
        RUN_MODE = RUN_EXIT;
    }
    if (RUN_MODE == RUN_SHUTDOWN) goto _exit;

    wp = (WndProperty*) wf->FindByName(TEXT("prpProfile"));
    if (wp) {
        DataFieldFileReader* dfe = (DataFieldFileReader*) wp->GetDataField();

        if (RUN_MODE == RUN_PROFILE) {
            if (_tcslen(dfe->GetPathFile()) > 0) {
                if (_tcscmp(dfe->GetPathFile(), startProfileFile)) { // if they are not the same
                    _tcscpy(startProfileFile, dfe->GetPathFile());
                    if (_tcscmp(startProfileFile, _T("PROFILE_RESET")) == 0) {
#if TESTBENCH
                        StartupStore(_T("... Selected FULL RESET virtual profile\n"));
#endif
                        MessageBoxX(MsgToken(1758), MsgToken(1757), mbOk);
                        FullResetAsked = true;
                    } else {
#if TESTBENCH
                        StartupStore(_T("... Selected new profile, preloading..\n"));
#endif
                        FullResetAsked = false;
                    }
                }
            }
        }
        if (RUN_MODE == RUN_AIRCRAFT) {
            if (_tcslen(dfe->GetPathFile()) > 0) {
                if (_tcscmp(dfe->GetPathFile(), startAircraftFile)) { // if they are not the same
                    _tcscpy(startAircraftFile, dfe->GetPathFile());
#if TESTBENCH
                    StartupStore(_T("... Selected new aircraft, preloading..\n"));
#endif
                }
            }
        }
        if (RUN_MODE == RUN_DEVICE) {
            if (_tcslen(dfe->GetPathFile()) > 0) {
                if (_tcscmp(dfe->GetPathFile(), startDeviceFile)) { // if they are not the same
                    _tcscpy(startDeviceFile, dfe->GetPathFile());
#if TESTBENCH
                    StartupStore(_T("... Selected new device, preloading..\n"));
#endif
                }
            }
        }
        if (RUN_MODE == RUN_PILOT) {
            if (_tcslen(dfe->GetPathFile()) > 0) {
                if (_tcscmp(dfe->GetPathFile(), startPilotFile)) { // if they are not the same
                    _tcscpy(startPilotFile, dfe->GetPathFile());
#if TESTBENCH
                    StartupStore(_T("... Selected new pilot, preloading..\n"));
#endif
                }
            }
        }
        RUN_MODE = RUN_DUALPROF;
    }
    if (RUN_MODE == RUN_EXIT) {
#if __linux__
        RUN_MODE = RUN_WELCOME;
#endif
        LKSound(_T("LK_SLIDE.WAV"));
        if (MessageBoxX(
                // LKTOKEN  _@M198_ = "Confirm Exit?"
                MsgToken(198),
                TEXT("LK8000"), mbYesNo) == IdYes) {
            Shutdown();
        } else {
            RUN_MODE = RUN_WELCOME;
        }
    }


_exit:
    if (wf != NULL) {
        delete wf;
        wf = NULL;
    }

    StartBitmap.Release();
    ProfileBitmap.Release();


    if (RUN_MODE == RUN_FLY || RUN_MODE == RUN_SIM) {
        LKSound(_T("LK_SLIDE.WAV"));
        return 0; // do not repeat dialog
    }

    if (RUN_MODE == RUN_EXIT || RUN_MODE == RUN_SHUTDOWN)
        return -1; // terminate
    else
        return 1; // repeat dialog

}
示例#17
0
void dlgTaskOverviewShowModal(int Idx){

  UpLimit = 0;
  LowLimit = 0;
  ItemIndex = Idx; //-1;

  showAdvanced = false;

  wf = NULL;

  if (!ScreenLandscape) {
    char filename[MAX_PATH];
    LocalPathS(filename, TEXT("dlgTaskOverview_L.xml"));
    wf = dlgLoadFromXML(CallBackTable, 
                        
                        filename, 
                        hWndMainWindow,
                        TEXT("IDR_XML_TASKOVERVIEW_L"));
  } else {
    char filename[MAX_PATH];
    LocalPathS(filename, TEXT("dlgTaskOverview.xml"));
    wf = dlgLoadFromXML(CallBackTable, 
                        filename, 
                        hWndMainWindow,
                        TEXT("IDR_XML_TASKOVERVIEW"));
  }

  if (!wf) return;

  WndButton *wb = (WndButton*)wf->FindByName(TEXT("cmdTimegates"));
  if (wb) wb->SetVisible(false);
  
  if (ISPARAGLIDER) {
	if (PGOptimizeRoute) AATEnabled=true; // force it on
        EnableMultipleStartPoints=false;
        if (wb) wb->SetVisible(true);
	wb = (WndButton*)wf->FindByName(TEXT("cmdDelete"));
	if (wb) wb->SetVisible(false);
  }

  UpdateCaption();

  wfAdvanced = ((WndFrame *)wf->FindByName(TEXT("frmAdvanced")));

  wTaskList = (WndListFrame*)wf->FindByName(TEXT("frmTaskList"));
  wTaskList->SetBorderKind(BORDERLEFT);
  wTaskList->SetEnterCallback(OnTaskListEnter);

  wTaskList->SetWidth(wf->GetWidth() - wTaskList->GetLeft()-2);

  wTaskListEntry = (WndOwnerDrawFrame*)wf->FindByName(TEXT("frmTaskListEntry"));

   // ScrollbarWidth is initialised from DrawScrollBar in WindowControls, so it might not be ready here
  if ( wTaskList->ScrollbarWidth == -1) {
   #if defined (PNA)
   #define SHRINKSBFACTOR 1.0 // shrink width factor.  Range .1 to 1 where 1 is very "fat"
   #else
   #define SHRINKSBFACTOR 0.75  // shrink width factor.  Range .1 to 1 where 1 is very "fat"
   #endif
   wTaskList->ScrollbarWidth = (int) (SCROLLBARWIDTH_INITIAL * ScreenDScale * SHRINKSBFACTOR);
  }
  wTaskListEntry->SetWidth(wTaskList->GetWidth() - wTaskList->ScrollbarWidth - 5);

  wTaskListEntry = (WndOwnerDrawFrame*)wf-> FindByName(TEXT("frmTaskListEntry"));

  wTaskListEntry->SetCanFocus(true);

  WndProperty* wp;

  wp = (WndProperty*)wf->FindByName(TEXT("prpFile"));
  if (wp) {
	DataFieldFileReader* dfe;
	dfe = (DataFieldFileReader*)wp->GetDataField();

	TCHAR suff[10];
	_stprintf(suff,_T("*%S"),LKS_TSK);
	dfe->ScanDirectoryTop(_T(LKD_TASKS),suff);
	_stprintf(suff,_T("*%S"),LKS_OLD_TSK);
	dfe->ScanDirectoryTop(_T(LKD_TASKS),suff);
	_stprintf(suff,_T("*%S"),LKS_WP_CUP);
	dfe->ScanDirectoryTop(_T(LKD_TASKS),suff);
	wp->RefreshDisplay();
  }
  UpdateFilePointer();

  // initialise and turn on the display
  OverviewRefreshTask();

  UpdateAdvanced(); 



  wTaskList->SetItemIndexPos(Idx);
  wTaskList->Redraw();
  wTaskListEntry->SetFocused(true,NULL);

  wf->ShowModal();

  // now retrieve back the properties...

  RefreshTask();

  delete wf;

  wf = NULL;

}
示例#18
0
static void OnSaveNewClicked(WindowControl * Sender) {
  (void)Sender;

  int file_index; 
  TCHAR file_name[MAX_PATH];
  TCHAR profile_name[MAX_PATH];
  TCHAR tmptext[MAX_PATH];
  WndProperty* wp;
  DataFieldFileReader *dfe;

  wp = (WndProperty*)wf->FindByName(TEXT("prpFile"));
  if (!wp) return;
  dfe = (DataFieldFileReader*) wp->GetDataField();

  _tcscpy(profile_name,_T(""));
  dlgTextEntryShowModal(profile_name, 13); // max length including termination 0

  if (_tcslen(profile_name)<=0) return;


  _tcscat(profile_name, TEXT(LKS_PRF));
  LocalPath(file_name,TEXT(LKD_CONF));
  _tcscat(file_name,TEXT("\\"));
  _tcscat(file_name,profile_name);

  dfe->Lookup(file_name);
  file_index = dfe->GetAsInteger();

  if (file_index==0) {
	_stprintf(tmptext, TEXT("%s: %s"), 
	// LKTOKEN  _@M458_ = "New profile" 
		gettext(TEXT("_@M458_")), 
		profile_name);

	if(MessageBoxX(hWndMapWindow, tmptext, 
	// LKTOKEN  _@M579_ = "Save ?" 
		gettext(TEXT("_@M579_")), 
		MB_YESNO|MB_ICONQUESTION) == IDYES) {

		WriteProfile(file_name);
		dfe->addFile(profile_name, file_name);

		MessageBoxX(hWndMapWindow, 
	// LKTOKEN  _@M535_ = "Profile saved!" 
		gettext(TEXT("_@M535_")), 
		_T(""), MB_OK|MB_ICONEXCLAMATION);

  		dfe->Set(0);
		return;
	}
  }

  if (file_index>0) {
	_stprintf(tmptext, TEXT("%s: %s"), 
	// LKTOKEN  _@M533_ = "Profile already exists" 
		gettext(TEXT("_@M533_")), 	
		profile_name);

	if (CheckClubVersion() ) {
		MessageBoxX(hWndMapWindow, tmptext,
	// LKTOKEN  _@M162_ = "Cannot overwrite!" 
		gettext(TEXT("_@M162_")),
		MB_OK|MB_ICONEXCLAMATION);
	} else {
		if(MessageBoxX(hWndMapWindow, tmptext, 
	// LKTOKEN  _@M510_ = "Overwrite?" 
		gettext(TEXT("_@M510_")), 
		MB_YESNO|MB_ICONQUESTION) == IDYES) {

			WriteProfile(file_name);
			MessageBoxX(hWndMapWindow, 
	// LKTOKEN  _@M535_ = "Profile saved!" 
			gettext(TEXT("_@M535_")),
			_T(""), MB_OK|MB_ICONEXCLAMATION);
			return;
		}
	}
  	dfe->Set(0);
  }


}
示例#19
0
void dlgTaskOverviewShowModal(void){

  UpLimit = 0;
  LowLimit = 0;
  ItemIndex = -1;

  showAdvanced = false;

  wf = NULL;

  if (!ScreenLandscape) {
    char filename[MAX_PATH];
    LocalPathS(filename, TEXT("dlgTaskOverview_L.xml"));
    wf = dlgLoadFromXML(CallBackTable, 
                        
                        filename, 
                        hWndMainWindow,
                        TEXT("IDR_XML_TASKOVERVIEW_L"));
  } else {
    char filename[MAX_PATH];
    LocalPathS(filename, TEXT("dlgTaskOverview.xml"));
    wf = dlgLoadFromXML(CallBackTable, 
                        filename, 
                        hWndMainWindow,
                        TEXT("IDR_XML_TASKOVERVIEW"));
  }

  if (!wf) return;

  ASSERT(wf!=NULL);

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


  UpdateCaption();

  wfAdvanced = ((WndFrame *)wf->FindByName(TEXT("frmAdvanced")));
  ASSERT(wfAdvanced!=NULL);

  wTaskList = (WndListFrame*)wf->FindByName(TEXT("frmTaskList"));
  ASSERT(wTaskList!=NULL);
  wTaskList->SetBorderKind(BORDERLEFT);
  wTaskList->SetEnterCallback(OnTaskListEnter);
  wTaskListEntry = (WndOwnerDrawFrame*)wf->
    FindByName(TEXT("frmTaskListEntry"));

  ASSERT(wTaskListEntry!=NULL);
  wTaskListEntry->SetCanFocus(true);
  // wTaskListEntry->SetWidth(wTaskList->GetWidth() - wTaskList->GetScrollbarWidth() - 5); // patch 091126

  WndProperty* wp;

  wp = (WndProperty*)wf->FindByName(TEXT("prpFile"));
  if (wp) {
    DataFieldFileReader* dfe;
    dfe = (DataFieldFileReader*)wp->GetDataField();

    TCHAR suff[10];
    _stprintf(suff,_T("*%S"),LKS_TSK);
    dfe->ScanDirectoryTop(_T(LKD_TASKS),suff); // TESTFIX 091101
    wp->RefreshDisplay();
  }
  UpdateFilePointer();

  // CALCULATED_INFO.AATTimeToGo
  // 

  // initialise and turn on the display
  OverviewRefreshTask();

  UpdateAdvanced(); 

  wf->ShowModal();

  // now retrieve back the properties...

  RefreshTask();

  delete wf;

  wf = NULL;

}
示例#20
0
static void OnSaveClicked(WindowControl * Sender, WndListFrame::ListInfo_t *ListInfo){
  (void)ListInfo; (void)Sender;

  int file_index; 
  TCHAR task_name[MAX_PATH];
  TCHAR file_name[MAX_PATH];
  WndProperty* wp;
  DataFieldFileReader *dfe;

  wp = (WndProperty*)wf->FindByName(TEXT("prpFile"));
  if (!wp) return;
  dfe = (DataFieldFileReader*)wp->GetDataField();

  file_index = dfe->GetAsInteger();

  // if (file_index==0) { 
  if (1) {

    // TODO enhancement: suggest a good new name not already in the list
    _tcscpy(task_name,TEXT("NEW")); // 091216 era 0
    dlgTextEntryShowModal(task_name, 10); // max length

    if (_tcslen(task_name)>0) {

      _tcscat(task_name, TEXT(LKS_TSK));

#if (!defined(WINDOWSPC) || (WINDOWSPC <=0) )
  LocalPath(file_name,TEXT(LKD_TASKS));
  _tcscat(file_name,TEXT("\\"));
  _tcscat(file_name,task_name); // 091101

#else
  SHGetSpecialFolderPath(hWndMainWindow, file_name, CSIDL_PERSONAL, false);
  _tcscat(file_name,TEXT("\\"));
  _tcscat(file_name,TEXT(XCSDATADIR));
  _tcscat(file_name,_T("\\"));
  _tcscat(file_name,TEXT(LKD_TASKS)); // 091101
  _tcscat(file_name,_T("\\"));
  _tcscat(file_name,task_name); // 091101
#endif



      dfe->Lookup(file_name);
      file_index = dfe->GetAsInteger();

      if (file_index==0) {
        // good, this file is unique..
        dfe->addFile(task_name, file_name);
        dfe->Lookup(file_name);
        wp->RefreshDisplay();
      }

    } else {
      // TODO code: report error, task not saved since no name was given
      return;
    }
  }

  if (file_index>0) {
    // file already exists! ask if want to overwrite

    _stprintf(file_name, TEXT("%s: '%s'"), 
	// LKTOKEN  _@M696_ = "Task file already exists" 
              gettext(TEXT("_@M696_")),
              dfe->GetAsString());
    if(MessageBoxX(hWndMapWindow,
                   file_name,
	// LKTOKEN  _@M510_ = "Overwrite?" 
                   gettext(TEXT("_@M510_")),
                   MB_YESNO|MB_ICONQUESTION) != IDYES) {
      return;
    }
  }

  SaveTask(dfe->GetPathFile());
  UpdateCaption();
}
示例#21
0
void dlgStartupShowModal(void){
  WndProperty* wp;
  StartupStore(TEXT("Startup dialog\n"));

  if (!InfoBoxLayout::landscape) {
    wf = dlgLoadFromXML(CallBackTable,
                        TEXT("dlgStartup_L.xml"),
                        XCSoarInterface::main_window,
                        TEXT("IDR_XML_STARTUP_L"));
  } else {
    wf = dlgLoadFromXML(CallBackTable,
                        TEXT("dlgStartup.xml"),
                        XCSoarInterface::main_window,
                        TEXT("IDR_XML_STARTUP"));
  }
  if (!wf) return;

  wSplash = (WndOwnerDrawFrame*)wf->FindByName(TEXT("frmSplash"));

  ((WndButton *)wf->FindByName(TEXT("cmdClose")))
    ->SetOnClickNotify(OnCloseClicked);

  TCHAR temp[MAX_PATH];

  _stprintf(temp,TEXT("XCSoar: Version %s"), XCSoar_Version);
  wf->SetCaption(temp);

  wp = ((WndProperty *)wf->FindByName(TEXT("prpDisclaimer")));
  if (wp)
    wp->SetText(TEXT("Pilot assumes complete\r\nresponsibility to operate\r\nthe aircraft safely.\r\nMaintain effective lookout.\r\n"));

  wp = ((WndProperty *)wf->FindByName(TEXT("prpProfile")));
  if (wp) {
    DataFieldFileReader* dfe;
    dfe = (DataFieldFileReader*)wp->GetDataField();
    if (is_altair())
      dfe->ScanDirectoryTop(TEXT("config/*.prf"));
    else
      dfe->ScanDirectoryTop(TEXT("*.prf"));
    dfe->Lookup(startProfileFile);
    wp->RefreshDisplay();
    if (dfe->GetNumFiles()<=2) {
      delete wf;
      wf = NULL;
      return;
    }
  }

  wf->ShowModal();

  wp = (WndProperty*)wf->FindByName(TEXT("prpProfile"));
  if (wp) {
    DataFieldFileReader* dfe;
    dfe = (DataFieldFileReader*)wp->GetDataField();
    if (_tcslen(dfe->GetPathFile())>0) {
      _tcscpy(startProfileFile,dfe->GetPathFile());
    }
  }

  delete wf;

  wf = NULL;

}
示例#22
0
short dlgStartupShowModal(void){
  WndProperty* wp;

  #if TESTBENCH
  StartupStore(TEXT(". Startup dialog, RUN_MODE=%d %s"),RUN_MODE,NEWLINE);
  #endif

  char filename[MAX_PATH];
  strcpy(filename,"");

  // FLY SIM PROFILE EXIT
  if (RUN_MODE==RUN_WELCOME) {
	if (!ScreenLandscape) {
		LocalPathS(filename, TEXT("dlgFlySim_L.xml"));
		wf = dlgLoadFromXML(CallBackTable, filename, hWndMainWindow, TEXT("IDR_XML_FLYSIM_L"));
	} else {
		LocalPathS(filename, TEXT("dlgFlySim.xml"));
		wf = dlgLoadFromXML(CallBackTable, filename, hWndMainWindow, TEXT("IDR_XML_FLYSIM"));
	}
	if (!wf) {
		return 0;
	}
  }

  //  PROFILE AIRCRAFT  CLOSE
  if (RUN_MODE==RUN_DUALPROF) {
	if (!ScreenLandscape) {
		LocalPathS(filename, TEXT("dlgDualProfile_L.xml"));
		wf = dlgLoadFromXML(CallBackTable, filename, hWndMainWindow, TEXT("IDR_XML_DUALPROFILE_L"));
	} else {
		LocalPathS(filename, TEXT("dlgDualProfile.xml"));
		wf = dlgLoadFromXML(CallBackTable, filename, hWndMainWindow, TEXT("IDR_XML_DUALPROFILE"));
	}
	if (!wf) return 0;
  }

  // CHOOSE PROFILE
  if (RUN_MODE==RUN_PROFILE || RUN_MODE==RUN_AIRCRAFT || RUN_MODE==RUN_PILOT) {
	if (!ScreenLandscape) {
		LocalPathS(filename, TEXT("dlgStartup_L.xml"));
		wf = dlgLoadFromXML(CallBackTable, filename, hWndMainWindow, TEXT("IDR_XML_STARTUP_L"));
	} else {
		LocalPathS(filename, TEXT("dlgStartup.xml"));
		wf = dlgLoadFromXML(CallBackTable, filename, hWndMainWindow, TEXT("IDR_XML_STARTUP"));
	}
	if (!wf) return 0;
  }

  wSplash = (WndOwnerDrawFrame*)wf->FindByName(TEXT("frmSplash")); 
  wSplash->SetWidth(ScreenSizeX);


  int  PROFWIDTH=0, PROFACCEPTWIDTH=0, PROFHEIGHT=0, PROFSEPARATOR=0;

  if (RUN_MODE==RUN_WELCOME) {
	((WndButton *)wf->FindByName(TEXT("cmdFLY"))) ->SetOnClickNotify(OnFLYClicked);
	((WndButton *)wf->FindByName(TEXT("cmdSIM"))) ->SetOnClickNotify(OnSIMClicked);
	((WndButton *)wf->FindByName(TEXT("cmdDUALPROFILE"))) ->SetOnClickNotify(OnDUALPROFILEClicked);
	((WndButton *)wf->FindByName(TEXT("cmdEXIT"))) ->SetOnClickNotify(OnEXITClicked);
	if (ScreenLandscape) {
		
		PROFWIDTH=(ScreenSizeX-IBLSCALE(320))/3; 


		switch(ScreenSize) {
			case ss800x480:
			case ss400x240:
				((WndButton *)wf->FindByName(TEXT("cmdFLY"))) ->SetWidth(IBLSCALE(110));
				((WndButton *)wf->FindByName(TEXT("cmdSIM"))) ->SetWidth(IBLSCALE(110));
				((WndButton *)wf->FindByName(TEXT("cmdSIM"))) ->SetLeft(IBLSCALE(208)+PROFWIDTH*3);
				((WndButton *)wf->FindByName(TEXT("cmdDUALPROFILE"))) ->SetLeft(IBLSCALE(88)+PROFWIDTH);
				((WndButton *)wf->FindByName(TEXT("cmdDUALPROFILE"))) ->SetWidth(IBLSCALE(92)+PROFWIDTH/6);
				((WndButton *)wf->FindByName(TEXT("cmdEXIT"))) ->SetLeft(IBLSCALE(161)+PROFWIDTH*2);
				((WndButton *)wf->FindByName(TEXT("cmdEXIT"))) ->SetWidth(IBLSCALE(65)+PROFWIDTH/5);
				break;
			case ss480x272:
				((WndButton *)wf->FindByName(TEXT("cmdFLY"))) ->SetWidth(IBLSCALE(117));
				((WndButton *)wf->FindByName(TEXT("cmdFLY"))) ->SetHeight(IBLSCALE(38));
				((WndButton *)wf->FindByName(TEXT("cmdFLY"))) ->SetTop(IBLSCALE(197));
				((WndButton *)wf->FindByName(TEXT("cmdSIM"))) ->SetWidth(IBLSCALE(117));
				((WndButton *)wf->FindByName(TEXT("cmdSIM"))) ->SetLeft(IBLSCALE(201)+PROFWIDTH*3);
				((WndButton *)wf->FindByName(TEXT("cmdSIM"))) ->SetHeight(IBLSCALE(38));
				((WndButton *)wf->FindByName(TEXT("cmdSIM"))) ->SetTop(IBLSCALE(197));
				((WndButton *)wf->FindByName(TEXT("cmdDUALPROFILE"))) ->SetLeft(IBLSCALE(88)+PROFWIDTH);
				((WndButton *)wf->FindByName(TEXT("cmdDUALPROFILE"))) ->SetWidth(IBLSCALE(99)+PROFWIDTH/6);
				((WndButton *)wf->FindByName(TEXT("cmdDUALPROFILE"))) ->SetHeight(IBLSCALE(38));
				((WndButton *)wf->FindByName(TEXT("cmdDUALPROFILE"))) ->SetTop(IBLSCALE(197));
				((WndButton *)wf->FindByName(TEXT("cmdEXIT"))) ->SetLeft(IBLSCALE(161)+PROFWIDTH*2);
				((WndButton *)wf->FindByName(TEXT("cmdEXIT"))) ->SetWidth(IBLSCALE(65)+PROFWIDTH/5);
				((WndButton *)wf->FindByName(TEXT("cmdEXIT"))) ->SetHeight(IBLSCALE(38));
				((WndButton *)wf->FindByName(TEXT("cmdEXIT"))) ->SetTop(IBLSCALE(197));
				break;
			case ss640x480:
			case ss320x240:
				((WndButton *)wf->FindByName(TEXT("cmdDUALPROFILE"))) ->SetLeft(IBLSCALE(93)+PROFWIDTH);
				((WndButton *)wf->FindByName(TEXT("cmdDUALPROFILE"))) ->SetWidth(IBLSCALE(73)+PROFWIDTH/6);
				((WndButton *)wf->FindByName(TEXT("cmdEXIT"))) ->SetLeft(IBLSCALE(166)+PROFWIDTH*2);
				((WndButton *)wf->FindByName(TEXT("cmdEXIT"))) ->SetWidth(IBLSCALE(60)+PROFWIDTH/5);
				((WndButton *)wf->FindByName(TEXT("cmdSIM"))) ->SetLeft(IBLSCALE(228)+PROFWIDTH*3);
				((WndButton *)wf->FindByName(TEXT("cmdSIM"))) ->SetWidth(IBLSCALE(88));
				break;
			default:
				((WndButton *)wf->FindByName(TEXT("cmdDUALPROFILE"))) ->SetLeft(IBLSCALE(93)+PROFWIDTH);
				((WndButton *)wf->FindByName(TEXT("cmdDUALPROFILE"))) ->SetWidth(IBLSCALE(73)+PROFWIDTH/6);
				((WndButton *)wf->FindByName(TEXT("cmdEXIT"))) ->SetLeft(IBLSCALE(166)+PROFWIDTH*2);
				((WndButton *)wf->FindByName(TEXT("cmdEXIT"))) ->SetWidth(IBLSCALE(60)+PROFWIDTH/5);
				((WndButton *)wf->FindByName(TEXT("cmdSIM"))) ->SetLeft(IBLSCALE(228)+PROFWIDTH*3);
				break;
		}	
	} else {
		PROFWIDTH=IBLSCALE(236);
		PROFACCEPTWIDTH=NIBLSCALE(45);
		PROFHEIGHT=NIBLSCALE(25);
		PROFSEPARATOR=NIBLSCALE(2);
	}
  }

  if (RUN_MODE==RUN_DUALPROF) {
	((WndButton *)wf->FindByName(TEXT("cmdAIRCRAFT"))) ->SetOnClickNotify(OnAIRCRAFTClicked);
	((WndButton *)wf->FindByName(TEXT("cmdPROFILE"))) ->SetOnClickNotify(OnPROFILEClicked);
	((WndButton *)wf->FindByName(TEXT("cmdPILOT"))) ->SetOnClickNotify(OnPILOTClicked);
	((WndButton *)wf->FindByName(TEXT("cmdCLOSE"))) ->SetOnClickNotify(OnCloseClicked);

	//((WndButton *)wf->FindByName(TEXT("cmdFLY"))) ->SetOnClickNotify(OnFLYClicked);
	//((WndButton *)wf->FindByName(TEXT("cmdSIM"))) ->SetOnClickNotify(OnSIMClicked);
	//((WndButton *)wf->FindByName(TEXT("cmdDUALPROFILE"))) ->SetOnClickNotify(OnDUALPROFILEClicked);
	//((WndButton *)wf->FindByName(TEXT("cmdEXIT"))) ->SetOnClickNotify(OnEXITClicked);
	if (ScreenLandscape) {
		
		PROFWIDTH=(ScreenSizeX-IBLSCALE(320))/3; 


		switch(ScreenSize) {
			case ss800x480:
			case ss400x240:
				((WndButton *)wf->FindByName(TEXT("cmdAIRCRAFT"))) ->SetWidth(IBLSCALE(110));
				((WndButton *)wf->FindByName(TEXT("cmdCLOSE"))) ->SetWidth(IBLSCALE(110));
				((WndButton *)wf->FindByName(TEXT("cmdCLOSE"))) ->SetLeft(IBLSCALE(208)+PROFWIDTH*3);
				((WndButton *)wf->FindByName(TEXT("cmdPROFILE"))) ->SetLeft(IBLSCALE(88)+PROFWIDTH);
				((WndButton *)wf->FindByName(TEXT("cmdPROFILE"))) ->SetWidth(IBLSCALE(92)+PROFWIDTH/6);
				((WndButton *)wf->FindByName(TEXT("cmdPILOT"))) ->SetLeft(IBLSCALE(161)+PROFWIDTH*2);
				((WndButton *)wf->FindByName(TEXT("cmdPILOT"))) ->SetWidth(IBLSCALE(65)+PROFWIDTH/5);
				break;
			case ss480x272:
				((WndButton *)wf->FindByName(TEXT("cmdAIRCRAFT"))) ->SetWidth(IBLSCALE(117));
				((WndButton *)wf->FindByName(TEXT("cmdAIRCRAFT"))) ->SetHeight(IBLSCALE(38));
				((WndButton *)wf->FindByName(TEXT("cmdAIRCRAFT"))) ->SetTop(IBLSCALE(197));
				((WndButton *)wf->FindByName(TEXT("cmdCLOSE"))) ->SetWidth(IBLSCALE(117));
				((WndButton *)wf->FindByName(TEXT("cmdCLOSE"))) ->SetLeft(IBLSCALE(201)+PROFWIDTH*3);
				((WndButton *)wf->FindByName(TEXT("cmdCLOSE"))) ->SetHeight(IBLSCALE(38));
				((WndButton *)wf->FindByName(TEXT("cmdCLOSE"))) ->SetTop(IBLSCALE(197));
				((WndButton *)wf->FindByName(TEXT("cmdPROFILE"))) ->SetLeft(IBLSCALE(88)+PROFWIDTH);
				((WndButton *)wf->FindByName(TEXT("cmdPROFILE"))) ->SetWidth(IBLSCALE(99)+PROFWIDTH/6);
				((WndButton *)wf->FindByName(TEXT("cmdPROFILE"))) ->SetHeight(IBLSCALE(38));
				((WndButton *)wf->FindByName(TEXT("cmdPROFILE"))) ->SetTop(IBLSCALE(197));
				((WndButton *)wf->FindByName(TEXT("cmdPILOT"))) ->SetLeft(IBLSCALE(161)+PROFWIDTH*2);
				((WndButton *)wf->FindByName(TEXT("cmdPILOT"))) ->SetWidth(IBLSCALE(65)+PROFWIDTH/5);
				((WndButton *)wf->FindByName(TEXT("cmdPILOT"))) ->SetHeight(IBLSCALE(38));
				((WndButton *)wf->FindByName(TEXT("cmdPILOT"))) ->SetTop(IBLSCALE(197));
				break;
			case ss640x480:
			case ss320x240:
				((WndButton *)wf->FindByName(TEXT("cmdPROFILE"))) ->SetLeft(IBLSCALE(93)+PROFWIDTH);
				((WndButton *)wf->FindByName(TEXT("cmdPROFILE"))) ->SetWidth(IBLSCALE(73)+PROFWIDTH/6);
				((WndButton *)wf->FindByName(TEXT("cmdPILOT"))) ->SetLeft(IBLSCALE(166)+PROFWIDTH*2);
				((WndButton *)wf->FindByName(TEXT("cmdPILOT"))) ->SetWidth(IBLSCALE(60)+PROFWIDTH/5);
				((WndButton *)wf->FindByName(TEXT("cmdCLOSE"))) ->SetLeft(IBLSCALE(228)+PROFWIDTH*3);
				((WndButton *)wf->FindByName(TEXT("cmdCLOSE"))) ->SetWidth(IBLSCALE(88));
				break;
			default:
				((WndButton *)wf->FindByName(TEXT("cmdPROFILE"))) ->SetLeft(IBLSCALE(93)+PROFWIDTH);
				((WndButton *)wf->FindByName(TEXT("cmdPROFILE"))) ->SetWidth(IBLSCALE(73)+PROFWIDTH/6);
				((WndButton *)wf->FindByName(TEXT("cmdPILOT"))) ->SetLeft(IBLSCALE(166)+PROFWIDTH*2);
				((WndButton *)wf->FindByName(TEXT("cmdPILOT"))) ->SetWidth(IBLSCALE(60)+PROFWIDTH/5);
				((WndButton *)wf->FindByName(TEXT("cmdCLOSE"))) ->SetLeft(IBLSCALE(228)+PROFWIDTH*3);
				break;
		}	
	} else {
		PROFWIDTH=IBLSCALE(236);
		PROFACCEPTWIDTH=NIBLSCALE(45);
		PROFHEIGHT=NIBLSCALE(25);
		PROFSEPARATOR=NIBLSCALE(2);
	}
  }



  if (RUN_MODE==RUN_PROFILE || RUN_MODE==RUN_AIRCRAFT || RUN_MODE==RUN_PILOT) {
	((WndButton *)wf->FindByName(TEXT("cmdClose"))) ->SetOnClickNotify(OnCloseClicked);
	if (ScreenLandscape) {
		PROFWIDTH=IBLSCALE(256);
		PROFACCEPTWIDTH=NIBLSCALE(60);
		PROFHEIGHT=NIBLSCALE(30);
		PROFSEPARATOR=NIBLSCALE(4);
		((WndButton *)wf->FindByName(TEXT("cmdClose"))) ->SetWidth(PROFACCEPTWIDTH);
		((WndButton *)wf->FindByName(TEXT("cmdClose"))) ->
			SetLeft((((ScreenSizeX-PROFWIDTH-PROFSEPARATOR-PROFACCEPTWIDTH)/2)+PROFSEPARATOR+PROFWIDTH)-NIBLSCALE(2));
		((WndButton *)wf->FindByName(TEXT("cmdClose"))) ->SetHeight(PROFHEIGHT-NIBLSCALE(4));
	} else {
		PROFWIDTH=IBLSCALE(236);
		PROFACCEPTWIDTH=NIBLSCALE(45);
		PROFHEIGHT=NIBLSCALE(25);
		PROFSEPARATOR=NIBLSCALE(2);
		((WndButton *)wf->FindByName(TEXT("cmdClose"))) ->SetWidth(ScreenSizeX-NIBLSCALE(6));
		((WndButton *)wf->FindByName(TEXT("cmdClose"))) -> SetLeft(NIBLSCALE(2));
	}
  }

  TCHAR temp[MAX_PATH];

  wf->SetHeight(ScreenSizeY);
  wf->SetWidth(ScreenSizeX);

  wp = ((WndProperty *)wf->FindByName(TEXT("prpProfile")));
  if (wp) {
    DataFieldFileReader* dfe;
    dfe = (DataFieldFileReader*)wp->GetDataField();

    if (RUN_MODE==RUN_PROFILE) {
	    _stprintf(temp,_T("*%S"),LKS_PRF); 
	    dfe->ScanDirectoryTop(_T(LKD_CONF),temp); 
	    dfe->addFile(gettext(_T("_@M1741_")),_T("PROFILE_RESET")); 
	    dfe->Lookup(startProfileFile);
    } 
    if (RUN_MODE==RUN_AIRCRAFT) {
	    _stprintf(temp,_T("*%S"),LKS_AIRCRAFT); 
	    dfe->ScanDirectoryTop(_T(LKD_CONF),temp); 
	    dfe->Lookup(startAircraftFile);
    }
    if (RUN_MODE==RUN_PILOT) {
	    _stprintf(temp,_T("*%S"),LKS_PILOT); 
	    dfe->ScanDirectoryTop(_T(LKD_CONF),temp); 
	    dfe->Lookup(startPilotFile);
    }

    wp->SetHeight(PROFHEIGHT);
    wp->SetWidth(PROFWIDTH);
    if (ScreenLandscape)
    	wp->SetLeft(((ScreenSizeX-PROFWIDTH-PROFSEPARATOR-PROFACCEPTWIDTH)/2)-NIBLSCALE(2));
    else
    	wp->SetLeft(0);

    wp->RefreshDisplay();
  }



  if  (!CheckRootDir()) {
	TCHAR mydir[MAX_PATH];
	TCHAR mes[MAX_PATH];

	LocalPath(mydir,_T(""));
	_stprintf(mes,_T("%s"),mydir);
	MessageBoxX(hWndMainWindow, _T("NO LK8000 DIRECTORY\nCheck Installation!"), _T("FATAL ERROR 000"), MB_OK|MB_ICONQUESTION);
	MessageBoxX(hWndMainWindow, mes, _T("NO LK8000 DIRECTORY"), MB_OK|MB_ICONQUESTION, true);
	RUN_MODE=RUN_EXIT;
	Shutdown();
	goto _exit;
  }

  if  (!CheckDataDir()) {
	TCHAR mydir[MAX_PATH];
	TCHAR mes[MAX_PATH];

	LocalPath(mydir,_T(LKD_SYSTEM));
	_stprintf(mes,_T("%s"),mydir);
	MessageBoxX(hWndMainWindow, _T("NO SYSTEM DIRECTORY\nCheck Installation!"), _T("FATAL ERROR 001"), MB_OK|MB_ICONQUESTION);
	MessageBoxX(hWndMainWindow, mes, _T("NO SYSTEM DIRECTORY"), MB_OK|MB_ICONQUESTION, true);
	RUN_MODE=RUN_EXIT;
	Shutdown();
	goto _exit;
  }

  if  (!CheckLanguageDir()) {
	TCHAR mydir[MAX_PATH];
	TCHAR mes[MAX_PATH];
	StartupStore(_T("... CHECK LANGUAGE DIRECTORY FAILED!%s"),NEWLINE);

	LocalPath(mydir,_T(LKD_LANGUAGE));
	_stprintf(mes,_T("%s"),mydir);
	MessageBoxX(hWndMainWindow, _T("LANGUAGE DIRECTORY CHECK FAIL\nCheck Language Install"), _T("FATAL ERROR 002"), MB_OK|MB_ICONQUESTION);
	MessageBoxX(hWndMainWindow, mes, _T("NO LANGUAGE DIRECTORY"), MB_OK|MB_ICONQUESTION, true);
	RUN_MODE=RUN_EXIT;
	Shutdown();
	goto _exit;
  }
  if  (!CheckLanguageEngMsg()) {
	TCHAR mydir[MAX_PATH];
	TCHAR mes[MAX_PATH];
	StartupStore(_T("... CHECK LANGUAGE ENG_MSG FAILED!%s"),NEWLINE);
	LocalPath(mydir,_T(LKD_LANGUAGE));
	_stprintf(mes,_T("%s/ENG_MSG.TXT"),mydir);
	MessageBoxX(hWndMainWindow, _T("ENG_MSG.TXT MISSING in LANGUAGE\nCheck Language Install"), _T("FATAL ERROR 012"), MB_OK|MB_ICONQUESTION);
	MessageBoxX(hWndMainWindow, mes, _T("MISSING FILE!"), MB_OK|MB_ICONQUESTION, true);
	RUN_MODE=RUN_EXIT;
	Shutdown();
	goto _exit;
  }
  if  (!CheckSystemDefaultMenu()) {
	TCHAR mydir[MAX_PATH];
	TCHAR mes[MAX_PATH];
	StartupStore(_T("... CHECK SYSTEM DEFAULT_MENU.TXT FAILED!%s"),NEWLINE);
	LocalPath(mydir,_T(LKD_SYSTEM));
	_stprintf(mes,_T("%s/DEFAULT_MENU.TXT"),mydir);
	MessageBoxX(hWndMainWindow, _T("DEFAULT_MENU.TXT MISSING in SYSTEM\nCheck System Install"), _T("FATAL ERROR 022"), MB_OK|MB_ICONQUESTION);
	MessageBoxX(hWndMainWindow, mes, _T("MISSING FILE!"), MB_OK|MB_ICONQUESTION, true);
	RUN_MODE=RUN_EXIT;
	Shutdown();
	goto _exit;
  }

  if  (!CheckSystemBitmaps()) {
	TCHAR mydir[MAX_PATH];
	TCHAR mes[MAX_PATH];
	StartupStore(_T("... CHECK SYSTEM _BITMAPSH FAILED!%s"),NEWLINE);
	LocalPath(mydir,_T(LKD_BITMAPS));
	_stprintf(mes,_T("%s/_BITMAPSH"),mydir);
	MessageBoxX(hWndMainWindow, _T("_BITMAPSH MISSING in SYSTEM Bitmaps\nCheck System Install"), _T("FATAL ERROR 032"), MB_OK|MB_ICONQUESTION);
	MessageBoxX(hWndMainWindow, mes, _T("MISSING FILE!"), MB_OK|MB_ICONQUESTION, true);
	RUN_MODE=RUN_EXIT;
	Shutdown();
	goto _exit;
  }

  if  (!CheckPolarsDir()) {
	TCHAR mydir[MAX_PATH];
	TCHAR mes[MAX_PATH];
	StartupStore(_T("... CHECK POLARS DIRECTORY FAILED!%s"),NEWLINE);

	LocalPath(mydir,_T(LKD_POLARS));
	_stprintf(mes,_T("%s"),mydir);
	MessageBoxX(hWndMainWindow, _T("NO POLARS DIRECTORY\nCheck Install"), _T("FATAL ERROR 003"), MB_OK|MB_ICONQUESTION);
	MessageBoxX(hWndMainWindow, mes, _T("NO POLARS DIRECTORY"), MB_OK|MB_ICONQUESTION, true);
	RUN_MODE=RUN_EXIT;
	Shutdown();
	goto _exit;
  }


  // Standby for a system request to close the application during this phase.
  wf->SetTimerNotify(OnTimerNotify);
  #if 0
  srand(GetTickCount());
  #endif

  wf->ShowModal();
  if (RUN_MODE==RUN_SHUTDOWN) goto _exit;

  wp = (WndProperty*)wf->FindByName(TEXT("prpProfile"));
  if (wp) {
	DataFieldFileReader* dfe;
	dfe = (DataFieldFileReader*)wp->GetDataField();

	if (RUN_MODE==RUN_PROFILE) {
		if (_tcslen(dfe->GetPathFile())>0) {
			if (_tcscmp(dfe->GetPathFile(),startProfileFile) ) { // if they are not the same
				_tcscpy(startProfileFile,dfe->GetPathFile());
				if (_tcscmp(startProfileFile,_T("PROFILE_RESET"))==0) {
					#if TESTBENCH
					StartupStore(_T("... Selected FULL RESET virtual profile\n"));
					#endif
					if (MessageBoxX(NULL, gettext(TEXT("_@M1758_")), 
						gettext(TEXT("_@M1757_")), MB_OK|MB_ICONQUESTION));
					fullresetasked=true;
				} else {
					#if TESTBENCH
					StartupStore(_T("... Selected new profile, preloading..\n"));
					#endif
					LKProfileLoad(startProfileFile);
					fullresetasked=false;
				}
			}
		}
	}
	if (RUN_MODE==RUN_AIRCRAFT) {
		if (_tcslen(dfe->GetPathFile())>0) {
			if (_tcscmp(dfe->GetPathFile(),startAircraftFile) ) { // if they are not the same
				_tcscpy(startAircraftFile,dfe->GetPathFile());
				#if TESTBENCH
				StartupStore(_T("... Selected new aircraft, preloading..\n"));
				#endif
				LKProfileLoad(startAircraftFile);
			}
		}
	}
	if (RUN_MODE==RUN_PILOT) {
		if (_tcslen(dfe->GetPathFile())>0) {
			if (_tcscmp(dfe->GetPathFile(),startPilotFile) ) { // if they are not the same
				_tcscpy(startPilotFile,dfe->GetPathFile());
				#if TESTBENCH
				StartupStore(_T("... Selected new pilot, preloading..\n"));
				#endif
				LKProfileLoad(startPilotFile);
			}
		}
	}
	RUN_MODE=RUN_DUALPROF;
  }
  if (RUN_MODE==RUN_EXIT) {
	if (EnableSoundModes) LKSound(_T("LK_SLIDE.WAV"));
	if (MessageBoxX(hWndMainWindow, 
	// LKTOKEN  _@M198_ = "Confirm Exit?" 
		gettext(TEXT("_@M198_")), 
		TEXT("LK8000"), MB_YESNO|MB_ICONQUESTION) == IDYES) {
		Shutdown();
	} else
		RUN_MODE=RUN_WELCOME;
  }


_exit:
  if (wf!=NULL) {
	delete wf;
	wf = NULL;
  }

  if (RUN_MODE==RUN_FLY || RUN_MODE==RUN_SIM) {
	if (EnableSoundModes) LKSound(_T("LK_SLIDE.WAV"));
	return 0;	// do not repeat dialog
  }

  if (RUN_MODE==RUN_EXIT || RUN_MODE==RUN_SHUTDOWN)
	return -1;	// terminate
  else
	return 1;	// repeat dialog

}
示例#23
0
static WndForm* InitStartup(BYTE mode) {
    WndForm * pWndForm = dlgLoadFromXML(CallBackTable, ScreenLandscape ? IDR_XML_STARTUP_L : IDR_XML_STARTUP_P);
    if(pWndForm) {

        WindowControl * pWndClose = pWndForm->FindByName(TEXT("cmdClose"));
        WndProperty* pWndProfile = static_cast<WndProperty*>(pWndForm->FindByName(TEXT("prpProfile")));

        if (ScreenLandscape) {
            const int PROFWIDTH = IBLSCALE(256);
            const int PROFACCEPTWIDTH = NIBLSCALE(60);
            const int PROFHEIGHT = NIBLSCALE(30);
            const int PROFSEPARATOR = NIBLSCALE(4);

            if(pWndClose) {
                pWndClose->SetWidth(PROFACCEPTWIDTH);
                pWndClose->SetLeft((((ScreenSizeX - PROFWIDTH - PROFSEPARATOR - PROFACCEPTWIDTH) / 2) + PROFSEPARATOR + PROFWIDTH) - NIBLSCALE(2));
                pWndClose->SetHeight(PROFHEIGHT - NIBLSCALE(4));
            }

            if(pWndProfile) {
                pWndProfile->SetLeft(((ScreenSizeX - PROFWIDTH - PROFSEPARATOR - PROFACCEPTWIDTH) / 2) - NIBLSCALE(2));
                pWndProfile->SetHeight(PROFHEIGHT);
                pWndProfile->SetWidth(PROFWIDTH);
            }


        } else {
            const int PROFWIDTH = IBLSCALE(236);
            const int PROFHEIGHT = NIBLSCALE(25);
            int h = ScreenSizeY - IBLSCALE(65); //

            if(pWndClose) {
                pWndClose->SetWidth(ScreenSizeX - NIBLSCALE(6));
                pWndClose->SetLeft(NIBLSCALE(2));
                pWndClose->SetTop(h);
            }
            if(pWndProfile) {
                pWndProfile->SetTop(h + IBLSCALE(35));
                pWndProfile->SetLeft(0);
                pWndProfile->SetHeight(PROFHEIGHT);
                pWndProfile->SetWidth(PROFWIDTH);
            }

        }
        //
        // File selection shared  by PROFILEs choices
        //
        if (pWndProfile) {
            DataFieldFileReader* dfe = static_cast<DataFieldFileReader*>(pWndProfile->GetDataField());
            if(dfe) {
                if (mode == RUN_PROFILE) {
                    dfe->ScanDirectoryTop(_T(LKD_CONF), _T("*" LKS_PRF));
                    dfe->addFile(MsgToken(1741), _T("PROFILE_RESET"));
                    dfe->Lookup(startProfileFile);

                } else if (mode == RUN_AIRCRAFT) {
                    dfe->ScanDirectoryTop(_T(LKD_CONF), _T("*" LKS_AIRCRAFT));
                    dfe->Lookup(startAircraftFile);

                } else if (mode == RUN_DEVICE) {
                    dfe->ScanDirectoryTop(_T(LKD_CONF), _T("*" LKS_DEVICE));
                    dfe->Lookup(startDeviceFile);

                } else if (mode == RUN_PILOT) {
                    dfe->ScanDirectoryTop(_T(LKD_CONF), _T("*" LKS_PILOT));
                    dfe->Lookup(startPilotFile);
                }
            }
            pWndProfile->RefreshDisplay();
        }

    }
    return pWndForm;
}