本文整理汇总了C++中DataFieldFileReader类的典型用法代码示例。如果您正苦于以下问题:C++ DataFieldFileReader类的具体用法?C++ DataFieldFileReader怎么用?C++ DataFieldFileReader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DataFieldFileReader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dlgStartupShowModal
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;
}
示例2: OnSaveClicked
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 [email protected]_ = "Task file already exists"
gettext(TEXT("[email protected]_")),
dfe->GetAsString());
if(MessageBoxX(
file_name,
// LKTOKEN [email protected]_ = "Overwrite?"
gettext(TEXT("[email protected]_")),
mbYesNo) != IdYes) {
return;
}
}
SaveTask(dfe->GetPathFile());
UpdateCaption();
}
示例3: dlgStartupShowModal
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: setVariables
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); // [email protected]_ "Waypoint File"
wp->SetCaption(tmp);
}
wp->RefreshDisplay();
}
}
}
示例5: FilePicker
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: OnSaveExistingClicked
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 [email protected]_ = "Overwrite profile?"
gettext(TEXT("[email protected]_")),
MB_YESNO|MB_ICONQUESTION) == IDYES) {
WriteProfile(dfe->GetPathFile());
// LKTOKEN [email protected]_ = "Profile saved!"
MessageBoxX(hWndMapWindow, gettext(TEXT("[email protected]_")),_T(""), MB_OK|MB_ICONEXCLAMATION);
return;
}
dfe->Set(0);
}
}
示例7: dlgProfilesShowModal
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: OnDeleteClicked
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: OnLoadClicked
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("[email protected]_")), dfe->GetAsString()); // Clear old task and load
if(MessageBoxX(hWndMapWindow, file_name, _T(" "), MB_YESNO|MB_ICONQUESTION) == IDNO) {
return;
}
}
} else {
// LKTOKEN [email protected]_ = "No Task to load"
MessageBoxX(hWndMapWindow, gettext(TEXT("[email protected]_")),_T(" "), MB_OK|MB_ICONEXCLAMATION);
return;
}
if (file_index>0) {
LoadNewTask(dfe->GetPathFile());
OverviewRefreshTask();
UpdateFilePointer();
UpdateCaption();
}
}
示例10: OnLoadClicked
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 [email protected]_ = "Load this profile?"
gettext(TEXT("[email protected]_")),
MB_YESNO|MB_ICONQUESTION) == IDYES) {
SettingsEnter();
ReadProfile(dfe->GetPathFile());
WAYPOINTFILECHANGED=true;
SettingsLeave();
MessageBoxX(hWndMapWindow,
// LKTOKEN [email protected]_ = "Profile loaded!"
gettext(TEXT("[email protected]_")),
_T(""), MB_OK|MB_ICONEXCLAMATION);
return;
}
dfe->Set(0);
}
}
示例11: dlgLoggerReplayShowModal
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: dlgStartupShowModal
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: dlgStartupShowModal
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: dlgTaskOverviewShowModal
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: OnLoadClicked
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 [email protected]_ = "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();
}
}
}