bool dlgTaskManager::CommitTaskChanges() { if (!task_modified) return true; task_modified |= active_task->get_factory().CheckAddFinish(); if (!active_task->task_size() || active_task->check_task()) { { // this must be done in thread lock because it potentially changes the // waypoints database ScopeSuspendAllThreads suspend; active_task->check_duplicate_waypoints(way_points); } protected_task_manager->task_commit(*active_task); protected_task_manager->task_save_default(); task_modified = false; return true; } MessageBoxX(getTaskValidationErrors( active_task->get_factory().getValidationErrors()), _("Validation Errors"), MB_ICONEXCLAMATION); return (MessageBoxX(_("Task not valid. Changes will be lost.\nContinue?"), _("Task Manager"), MB_YESNO | MB_ICONQUESTION) == IDYES); }
static void NewClicked(gcc_unused WndButton &button) { Plane plane = CommonInterface::GetComputerSettings().plane; while (dlgPlaneDetailsShowModal(*(SingleWindow*)dialog->get_root_owner(), plane)) { if (plane.registration.empty()) { MessageBoxX(_("Please enter the registration of the plane!"), _("Error"), MB_OK); continue; } StaticString<42> filename(plane.registration); filename += _T(".xcp"); StaticString<MAX_PATH> path; LocalPath(path.buffer(), filename); if (File::Exists(path)) { StaticString<256> tmp; tmp.Format(_("A plane profile \"%s\" already exists. " "Do you want to overwrite it?"), filename.c_str()); if (MessageBoxX(tmp, _("Overwrite"), MB_YESNO) != IDYES) continue; } PlaneGlue::WriteFile(plane, path); UpdateList(); break; } }
void TaskListPanel::DeleteTask() { const TCHAR *fname = get_cursor_name(); tstring upperstring = fname; std::transform(upperstring.begin(), upperstring.end(), upperstring.begin(), ::toupper); if (upperstring.find(_T(".CUP")) != tstring::npos) { MessageBoxX(_("Can't delete .CUP files"), _("Delete Error"), MB_ICONEXCLAMATION); return; } tstring text = _("Delete the selected task?"); text += _T("\n("); text += fname; text += _T(")"); if (MessageBoxX(text.c_str(), _("Task Browser"), MB_YESNO | MB_ICONQUESTION) != IDYES) return; TCHAR path[MAX_PATH]; LocalPath(path, fname); File::Delete(path); task_store->Scan(); RefreshView(); }
static void OnRemoveFromTaskClicked(gcc_unused WndButton &button) { if (protected_task_manager == NULL) return; switch (remove_from_task(*selected_waypoint)) { case SUCCESS: protected_task_manager->task_save_default(); wf->SetModalResult(mrOK); break; case NOTASK: MessageBoxX(_("No task defined."), _("Error"), MB_OK | MB_ICONEXCLAMATION); break; case UNMODIFIED: MessageBoxX(_("Waypoint not in task."), _("Remove from task"), MB_OK | MB_ICONINFORMATION); break; case INVALID: MessageBoxX(_("Task would not be valid after the change."), _("Error"), MB_OK | MB_ICONEXCLAMATION); break; } }
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; wf->SetModalResult(mrOK); return; } }
static void OnDeleteClicked(WindowControl * Sender, WndListFrame::ListInfo_t *ListInfo){ (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) { _stprintf(file_name, TEXT("%s '%s' ?"), MsgToken(1789), dfe->GetAsString()); // Delete task file? if(MessageBoxX(hWndMapWindow, file_name, _T(" "), MB_YESNO|MB_ICONQUESTION) == IDNO) { return; } } else { MessageBoxX(hWndMapWindow, MsgToken(1790),_T(" "), MB_OK|MB_ICONEXCLAMATION); // No task file to delete return; } if (file_index>0) { DeleteFile(dfe->GetPathFile()); // Cannot update dfe list, so we force exit. ItemIndex = -1; wf->SetModalResult(mrOK); return; } }
void LoggerImpl::guiStartLogger(const NMEA_INFO& gps_info, const SETTINGS_COMPUTER& settings, bool noAsk) { int i; if (!LoggerActive) { if (gps_info.Replay) { if (LoggerActive) guiStopLogger(gps_info, true); return; } TCHAR TaskMessage[1024]; _tcscpy(TaskMessage,TEXT("Start Logger With Declaration\r\n")); if (task.Valid()) { for (i = 0; task.ValidTaskPoint(i); i++) { _tcscat(TaskMessage, task.getWaypoint(i).Name); _tcscat(TaskMessage,TEXT("\r\n")); } } else { _tcscat(TaskMessage,TEXT("None")); } if(noAsk || (MessageBoxX(TaskMessage,gettext(TEXT("Start Logger")), MB_YESNO|MB_ICONQUESTION) == IDYES)) { if (LoggerClearFreeSpace(gps_info)) { StartLogger(gps_info, settings, strAssetNumber); LoggerHeader(gps_info); LoggerActive = true; // start logger after Header is completed. Concurrency if (task.Valid()) { int ntp = task.getFinalWaypoint(); StartDeclaration(gps_info,ntp); for (i = 0; task.ValidTaskPoint(i); i++) { const WAYPOINT &way_point = task.getWaypoint(i); AddDeclaration(way_point.Location.Latitude, way_point.Location.Longitude, way_point.Name); } EndDeclaration(); } ResetFRecord(); // reset timer & lastRecord string so if // logger is restarted, FRec appears at top // of file } else { MessageBoxX( gettext(TEXT("Logger inactive, insufficient storage!")), gettext(TEXT("Logger Error")), MB_OK| MB_ICONERROR); StartupStore(TEXT("Logger not started: Insufficient Storage\r\n")); } } } }
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(ActiveWayPoint) && ValidTaskPoint(1)) { _stprintf(file_name, TEXT("%s '%s' ?"), gettext(TEXT("_@M891_")), dfe->GetAsString()); // Clear old task and load if(MessageBoxX(file_name, _T(" "), mbYesNo) == IdNo) { return; } } } else { // LKTOKEN _@M467_ = "No Task to load" MessageBoxX(gettext(TEXT("_@M467_")),_T(" "), mbOk); return; } if (file_index>0) { LPCTSTR szFileName = dfe->GetPathFile(); LPCTSTR wextension = _tcsrchr(szFileName, _T('.')); if(wextension) { bool bOK = false; if(_tcsicmp(wextension,_T(LKS_TSK))==0) { CTaskFileHelper helper; bOK = helper.Load(szFileName); } #ifdef OLDTASK_COMPAT else if (_tcsicmp(wextension,_T(LKS_OLD_TSK))==0) { LoadNewTask(szFileName); bOK = true; } #endif else if (_tcsicmp(wextension,_T(LKS_WP_CUP))==0) { bOK = LoadCupTask(szFileName); } else if (_tcsicmp(wextension,_T(LKS_WP_GPX))==0) { bOK = LoadGpxTask(szFileName); } if(!bOK) { MessageBoxX(gettext(TEXT("_@M467_")),_T(" "), mbOk); return; } OverviewRefreshTask(); UpdateFilePointer(); UpdateCaption(); } } }
WAYPOINT* GrowWaypointList() { // memory allocation if (!AllocateWaypointList()) { return 0; } if (((NumberOfWayPoints+1) % 50) == 0) { WAYPOINT *p; if ((p = (WAYPOINT *)LocalReAlloc(WayPointList, (((NumberOfWayPoints+1)/50)+1) * 50 * sizeof(WAYPOINT), LMEM_MOVEABLE | LMEM_ZEROINIT)) == NULL){ StartupStore(_T("+++ GrowWaypointList FAILED!%s"),NEWLINE); MessageBoxX(hWndMainWindow, // LKTOKEN _@M486_ = "Not Enough Memory For Waypoints" gettext(TEXT("_@M486_")), // LKTOKEN _@M266_ = "Error" gettext(TEXT("_@M266_")),MB_OK|MB_ICONSTOP); return 0; // failed to allocate } if (p != WayPointList){ WayPointList = p; } WPCALC *q; if ((q = (WPCALC *)LocalReAlloc(WayPointCalc, (((NumberOfWayPoints+1)/50)+1) * 50 * sizeof(WPCALC), LMEM_MOVEABLE | LMEM_ZEROINIT)) == NULL){ StartupStore(_T("+++ GrowWaypointCalc FAILED!%s"),NEWLINE); MessageBoxX(hWndMainWindow, // LKTOKEN _@M486_ = "Not Enough Memory For Waypoints" gettext(TEXT("_@M486_")), // LKTOKEN _@M266_ = "Error" gettext(TEXT("_@M266_")),MB_OK|MB_ICONSTOP); return 0; // failed to allocate } if (q != WayPointCalc){ WayPointCalc = q; } } NumberOfWayPoints++; return WayPointList + NumberOfWayPoints-1; // returns the newly created waypoint }
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("%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) { LPCTSTR szFileName = dfe->GetPathFile(); LPCTSTR wextension = _tcsrchr(szFileName, _T('.')); if(wextension) { bool bOK = false; if(_tcsicmp(wextension,_T(LKS_TSK))==0) { CTaskFileHelper helper; bOK = helper.Load(szFileName); } else if (_tcsicmp(wextension,_T(LKS_OLD_TSK))==0) { LoadNewTask(szFileName); bOK = true; } else if (_tcsicmp(wextension,_T(LKS_WP_CUP))==0) { bOK = LoadCupTask(szFileName); } else if (_tcsicmp(wextension,_T(LKS_WP_GPX))==0) { bOK = LoadGpxTask(szFileName); } if(!bOK) { MessageBoxX(hWndMapWindow, gettext(TEXT("_@M467_")),_T(" "), MB_OK|MB_ICONEXCLAMATION); return; } OverviewRefreshTask(); UpdateFilePointer(); UpdateCaption(); } } }
static void EditClicked(gcc_unused WndButton &button) { assert(plane_list->GetCursorIndex() < list.size()); const unsigned index = plane_list->GetCursorIndex(); const TCHAR *old_path = list[index].path; const TCHAR *old_filename = list[index].name; Plane plane; PlaneGlue::ReadFile(plane, old_path); while (dlgPlaneDetailsShowModal(*(SingleWindow*)dialog->get_root_owner(), plane)) { if (plane.registration.empty()) { MessageBoxX(_("Please enter the registration of the plane!"), _("Error"), MB_OK); continue; } StaticString<42> filename(plane.registration); filename += _T(".xcp"); if (filename != old_filename) { StaticString<MAX_PATH> path; DirName(old_path, path.buffer()); path += _T(DIR_SEPARATOR_S); path += filename; if (File::Exists(path)) { StaticString<256> tmp; tmp.Format(_("A plane profile \"%s\" already exists. " "Do you want to overwrite it?"), filename.c_str()); if (MessageBoxX(tmp, _("Overwrite"), MB_YESNO) != IDYES) continue; } File::Delete(old_path); PlaneGlue::WriteFile(plane, path); if (Profile::GetPathIsEqual(_T("PlanePath"), old_path)) { list[index].path = path; list[index].name = filename; Load(index); } } else { PlaneGlue::WriteFile(plane, old_path); if (Profile::GetPathIsEqual(_T("PlanePath"), old_path)) Load(index); } UpdateList(); break; } }
static void OnSaveClicked(WndButton &Sender) { (void)Sender; if (!ordered_task->check_task()) { MessageBoxX (_("Task invalid. Not saved."), _T("Task Edit"), MB_OK); return; } if (OrderedTaskSave(*ordered_task, true)) { MessageBoxX (_("Task saved"), _T("Task Edit"), MB_OK); } }
/** * This event handler is called when the "Team" button is pressed */ static void OnTeamClicked(gcc_unused WndButton &Sender) { // Ask for confirmation if (MessageBoxX(_T("Do you want to set this FLARM contact as your ") _T("new teammate?"), _T("New Teammate"), MB_YESNO) != IDYES) return; SETTINGS_TEAMCODE &settings = CommonInterface::SetSettingsComputer(); // Set the Teammate callsign const TCHAR *callsign = FlarmDetails::LookupCallsign(target_id); if (callsign == NULL || string_is_empty(callsign)) { settings.TeamFlarmCNTarget.clear(); } else { // copy the 3 first chars from the name settings.TeamFlarmCNTarget = callsign; } // Start tracking settings.TeamFlarmIdTarget = target_id; settings.TeamFlarmTracking = true; settings.TeammateCodeValid = false; // Close the dialog wf->SetModalResult(mrOK); }
void ComPort::StatusMessage(MsgType_t type, const TCHAR *caption, const TCHAR *fmt, ...) { TCHAR tmp[127]; va_list ap; LKASSERT(fmt!=NULL); va_start(ap, fmt); #ifdef TESTBENCH int n = _vsntprintf(tmp, 127, fmt, ap); #else _vsntprintf(tmp, 127, fmt, ap); #endif va_end(ap); #ifdef TESTBENCH LKASSERT(n>=0); // Message to long for "tmp" buffer #endif tmp[126] = _T('\0'); if (caption) { MessageBoxX(tmp, LKGetText(caption), type); } else { DoStatusMessage(tmp); } }
static void OnFlarmLockClicked(gcc_unused WndButton &button) { TCHAR newTeamFlarmCNTarget[4]; _tcsncpy(newTeamFlarmCNTarget, XCSoarInterface::SetSettingsComputer().TeamFlarmCNTarget, 4); if (!dlgTextEntryShowModal(newTeamFlarmCNTarget, 4)) return; _tcsncpy(XCSoarInterface::SetSettingsComputer().TeamFlarmCNTarget, newTeamFlarmCNTarget, 4); XCSoarInterface::SetSettingsComputer().TeammateCodeValid = false; if (string_is_empty(XCSoarInterface::SettingsComputer().TeamFlarmCNTarget)) { XCSoarInterface::SetSettingsComputer().TeamFlarmTracking = false; XCSoarInterface::SetSettingsComputer().TeamFlarmIdTarget.clear(); return; } FlarmId flarmId = FlarmDetails::LookupId( XCSoarInterface::SettingsComputer().TeamFlarmCNTarget); if (!flarmId.defined()) { MessageBoxX(_("Unknown Competition Number"), _("Not Found"), MB_OK | MB_ICONINFORMATION); XCSoarInterface::SetSettingsComputer().TeamFlarmTracking = false; XCSoarInterface::SetSettingsComputer().TeamFlarmIdTarget.clear(); XCSoarInterface::SetSettingsComputer().TeamFlarmCNTarget[0] = 0; } else { XCSoarInterface::SetSettingsComputer().TeamFlarmIdTarget = flarmId; XCSoarInterface::SetSettingsComputer().TeamFlarmTracking = true; } }
void dlgVoiceShowModal(void){ wf = dlgLoadFromXML(CallBackTable, _T("dlgVoice.xml"), XCSoarInterface::main_window, _T("IDR_XML_VOICE")); if (!wf) return; LoadIntoForm(*wf, XCSoarInterface::SettingsComputer()); wf->ShowModal(); bool changed = false; changed = SaveFromForm(*wf, XCSoarInterface::SetSettingsComputer()); if (changed) { Profile::StoreRegistry(); MessageBoxX(gettext(_T("Changes to configuration saved.")), _T(""), MB_OK); } delete wf; wf = NULL; }
static void OnSaveClicked(WndButton* pWnd){ int file_index; TCHAR task_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)); dfe->Lookup(task_name); file_index = dfe->GetAsInteger(); if (file_index==0) { // good, this file is unique.. dfe->addFile(task_name, task_name); dfe->Lookup(task_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 TCHAR sTmp[500]; _sntprintf(sTmp, array_size(sTmp), TEXT("%s: '%s'"), // LKTOKEN _@M696_ = "Task file already exists" MsgToken(696), dfe->GetAsString()); if(MessageBoxX( sTmp, // LKTOKEN _@M510_ = "Overwrite?" MsgToken(510), mbYesNo) != IdYes) { return; } } TCHAR file_name[MAX_PATH]; LocalPath(file_name,TEXT(LKD_TASKS), task_name); SaveTask(file_name); UpdateCaption(); }
static void OnFlarmLockClicked(WindowControl * Sender) { (void)Sender; dlgTextEntryShowModal(XCSoarInterface::SetSettingsComputer().TeamFlarmCNTarget, 4); XCSoarInterface::SetSettingsComputer().TeammateCodeValid = false; int flarmId = LookupFLARMDetails(XCSoarInterface::SettingsComputer().TeamFlarmCNTarget); if (flarmId == 0) { MessageBoxX(gettext(TEXT("Unknown Competition Number")), gettext(TEXT("Not Found")), MB_OK|MB_ICONINFORMATION); XCSoarInterface::SetSettingsComputer().TeamFlarmTracking = false; XCSoarInterface::SetSettingsComputer().TeamFlarmIdTarget = 0; XCSoarInterface::SetSettingsComputer().TeamFlarmCNTarget[0] = 0; } else { XCSoarInterface::SetSettingsComputer().TeamFlarmIdTarget = flarmId; XCSoarInterface::SetSettingsComputer().TeamFlarmTracking = true; } }
void LoggerImpl::LoggerDeviceDeclare() { bool found_logger = false; Declaration_t Decl; int i; GetRegistryString(szRegistryPilotName, Decl.PilotName, 64); GetRegistryString(szRegistryAircraftType, Decl.AircraftType, 32); GetRegistryString(szRegistryAircraftRego, Decl.AircraftRego, 32); for (i = 0; task.ValidTaskPoint(i); i++) { Decl.waypoint[i] = &task.getWaypoint(i); } Decl.num_waypoints = i; DeclaredToDevice = false; if (LoggerDeclare(devA(), &Decl)) found_logger = true; if (LoggerDeclare(devB(), &Decl)) found_logger = true; if (!found_logger) { MessageBoxX(gettext(TEXT("No logger connected")), devB()->Name, MB_OK| MB_ICONINFORMATION); DeclaredToDevice = true; // testing only } }
void GotoWaypoint(const int wpnum) { if (!ValidWayPoint(wpnum)) { DoStatusMessage(_T("ERR-639 INVALID GOTO WPT")); return; } if (ValidTaskPoint(ActiveWayPoint) && ValidTaskPoint(1)) { TCHAR wpname[NAME_SIZE+1]; _tcscpy(wpname,WayPointList[wpnum].Name); wpname[10] = '\0'; if (MessageBoxX( // LKTOKEN _@M158_ = "CONFIRM GOTO, ABORTING TASK?" gettext(TEXT("_@M158_")), // LKTOKEN _@M40_ = "A task is running!" gettext(TEXT("_@M40_")), mbYesNo) == IdYes) { LockTaskData(); FlyDirectTo(wpnum); OvertargetMode=OVT_TASK; UnlockTaskData(); } } else { LockTaskData(); FlyDirectTo(wpnum); OvertargetMode=OVT_TASK; UnlockTaskData(); } }
static int ParseWayPointError(int LineNumber, const TCHAR *FileName, const TCHAR *String) { TCHAR szTemp[250]; if (_tcslen(FileName)> 0) { _stprintf(szTemp, TEXT("%s\r\n%s %s %s %d\r\n%s"), gettext(TEXT("Waypointfile Parse Error")), gettext(TEXT("File")), FileName, gettext(TEXT("Line")), LineNumber, String); } else { _stprintf(szTemp, TEXT("%s\r\n%s %s %d\r\n%s"), gettext(TEXT("Waypointfile Parse Error")), gettext(TEXT("(Map file)")), gettext(TEXT("Line")), LineNumber, String); } MessageBoxX(szTemp, gettext(TEXT("Error")), MB_OK | MB_ICONWARNING); return(1); }
void TaskListPanel::RenameTask() { const TCHAR *oldname = get_cursor_name(); StaticString<40> newname(oldname); if (ClearSuffix(newname.buffer(), _T(".cup"))) { MessageBoxX(_("Can't rename .CUP files"), _("Rename Error"), MB_ICONEXCLAMATION); return; } ClearSuffix(newname.buffer(), _T(".tsk")); if (!TextEntryDialog(*(SingleWindow *)wf.get_root_owner(), newname)) return; newname.append(_T(".tsk")); TCHAR oldpath[MAX_PATH]; TCHAR newpath[MAX_PATH]; LocalPath(oldpath, oldname); LocalPath(newpath, newname.c_str()); File::Rename(oldpath, newpath); task_store->Scan(); RefreshView(); }
void dlgConfigurationShowModal(void) { PrepareConfigurationDialog(); wf->ShowModal(); /* save page number for next time this dialog is opened */ current_page = wTabMenu->GetLastContentPage(); // TODO enhancement: implement a cancel button that skips all this // below after exit. bool changed = false; bool requirerestart = false; wTabMenu->Save(changed, requirerestart); if (changed) { Profile::Save(); LogDebug(_T("Configuration: Changes saved")); if (requirerestart) MessageBoxX(_("Changes to configuration saved. Restart XCSoar to apply changes."), _T(""), MB_OK); } delete wf; wf = NULL; }
void TaskListPanel::LoadTask() { const OrderedTask* orig = get_cursor_task(); if (orig == NULL) return; tstring text = _("Load the selected task?"); text += _T("\n("); text += get_cursor_name(); text += _T(")"); if (MessageBoxX(text.c_str(), _("Task Browser"), MB_YESNO | MB_ICONQUESTION) != IDYES) return; // create new task first to guarantee pointers are different OrderedTask* temptask = protected_task_manager->TaskCopy(*orig); delete *active_task; *active_task = temptask; RefreshView(); *task_modified = true; tab_bar.SetCurrentPage(dlgTaskManager::GetTurnpointTab()); tab_bar.set_focus(); }
static void OnCloseClicked(WndButton* pWnd){ if(pWnd) { WndForm * pForm = pWnd->GetParentWndForm(); bool bIdenti = false; getVariables(); for (unsigned int i=0 ; i < NO_WP_FILES-1; i++) { if((szWaypointFile[i] != NULL) && (_tcslen (szWaypointFile[i])> 0)) for (unsigned int j=(i+1) ; j < NO_WP_FILES; j++) { TCHAR tmp[MAX_PATH]; if((szWaypointFile[j] != NULL) && (_tcslen (szWaypointFile[j])> 0)) { if(_tcscmp(szWaypointFile[i],szWaypointFile[j])==0) { _sntprintf(tmp, MAX_PATH, _T("%s %u %s %u %s!"), MsgToken(2340), // _@M2340_ "Waypoint Files" i+1, MsgToken(2345) , //_@M2345_ "and" j+1, MsgToken(2346) //_@M2346_ "are identical" ); MessageBoxX( tmp, MsgToken(356), mbOk) ; // _@M356_ "Information" bIdenti = true; } } } } if( bIdenti) return ; if(pForm) { pForm->SetModalResult(mrOK); } } }
void Logger::guiStartLogger(const NMEA_INFO& gps_info, const SETTINGS_COMPUTER& settings, const ProtectedTaskManager &protected_task_manager, bool noAsk) { if (isLoggerActive() || gps_info.gps.Replay) return; OrderedTask* task = protected_task_manager.task_clone(); Declaration decl(task); Profile::GetDeclarationConfig(decl, settings.plane); if (task) { delete task; if (!noAsk) { TCHAR TaskMessage[1024]; _tcscpy(TaskMessage, _T("Start Logger With Declaration\r\n")); if (decl.size()) { for (unsigned i = 0; i< decl.size(); ++i) { _tcscat(TaskMessage, decl.get_name(i)); _tcscat(TaskMessage, _T("\r\n")); } } else { _tcscat(TaskMessage, _T("None")); } if (MessageBoxX(TaskMessage, _("Start Logger"), MB_YESNO | MB_ICONQUESTION) != IDYES) return; } } if (!LoggerClearFreeSpace(gps_info)) { MessageBoxX(_("Logger inactive, insufficient storage!"), _("Logger Error"), MB_OK| MB_ICONERROR); LogStartUp(_T("Logger not started: Insufficient Storage")); return; } Poco::ScopedRWLock protect(lock, true); _logger.StartLogger(gps_info, settings, strAssetNumber, decl); }
static bool LoggerDeclare(PDeviceDescriptor_t dev, Declaration_t *decl) { if (!devIsLogger(dev)) return FALSE; // If a Flarm is reset while we are here, then it will come up with isFlarm set to false, // and task declaration will fail. The solution is to let devices have a flag for "HaveFlarm". LKDoNotResetComms=true; // LKTOKEN _@M221_ = "Declare Task?" if (MessageBoxX(hWndMapWindow, gettext(TEXT("_@M221_")), dev->Name, MB_YESNO| MB_ICONQUESTION) == IDYES) { const unsigned ERROR_BUFFER_LEN = 64; TCHAR errorBuffer[ERROR_BUFFER_LEN] = { '\0' }; if (devDeclare(dev, decl, ERROR_BUFFER_LEN, errorBuffer)) { // LKTOKEN _@M686_ = "Task Declared!" MessageBoxX(hWndMapWindow, gettext(TEXT("_@M686_")), dev->Name, MB_OK| MB_ICONINFORMATION); DeclaredToDevice = true; } else { TCHAR buffer[2*ERROR_BUFFER_LEN]; if(errorBuffer[0] == '\0') { // LKTOKEN _@M1410_ = "Unknown error" _sntprintf(errorBuffer, ERROR_BUFFER_LEN, gettext(_T("_@M1410_"))); } else { // do it just to be sure errorBuffer[ERROR_BUFFER_LEN - 1] = '\0'; } // LKTOKEN _@M265_ = "Error! Task NOT declared!" _sntprintf(buffer, 2*ERROR_BUFFER_LEN, _T("%s\n%s"), gettext(_T("_@M265_")), errorBuffer); MessageBoxX(hWndMapWindow, buffer, dev->Name, MB_OK| MB_ICONERROR); DeclaredToDevice = false; } } LKDoNotResetComms=false; return TRUE; }
bool XCSoarInterface::CheckShutdown() { if (force_shutdown) return true; return MessageBoxX(_("Quit program?"), _T("XCSoar"), MB_YESNO | MB_ICONQUESTION) == IDYES; }
static bool SetPointType(AbstractTaskFactory::LegalPointType type) { bool apply = false; if (!point) { apply = true; // empty point, don't ask confirmation } else { if (type == get_point_type()) // no change return true; if (MessageBoxX(_("Change point type?"), _("Task Point"), MB_YESNO | MB_ICONQUESTION) == IDYES) apply = true; } if (apply) { AbstractTaskFactory &factory = ordered_task->GetFactory(); if (point) { point = factory.CreateMutatedPoint(*point, type); if (point == NULL) return false; if (factory.Replace(*point, active_index, true)) task_modified = true; delete point; } else { if (factory.IsValidFinishType(type) && ordered_task->get_ordered_task_behaviour().is_closed) way_point = &(ordered_task->get_tp(0)->GetWaypoint()); else way_point = dlgWaypointSelect(wf->GetMainWindow(), ordered_task->TaskSize() > 0 ? ordered_task->get_tp(ordered_task-> TaskSize() - 1)->GetLocation() : XCSoarInterface::Basic().location); if (!way_point) return false; point = factory.CreatePoint(type, *way_point); if (point == NULL) return false; if (factory.Append(*point, true)) task_modified = true; delete point; } return true; } return false; }
void dlgConfigFontsShowModal() { wf = LoadDialog(CallBackTable, XCSoarInterface::main_window, Layout::landscape ? _T("IDR_XML_CONFIG_FONTS_L") : _T("IDR_XML_CONFIG_FONTS")); if (wf == NULL) return; ((WndButton *)wf->FindByName(_T("cmdClose")))->SetOnClickNotify(OnCloseClicked); WndProperty *wp; wp = (WndProperty*)wf->FindByName(_T("prpUseCustomFonts")); if (wp) { DataFieldBoolean * dfb = (DataFieldBoolean*)wp->GetDataField(); dfb->Set(Appearance.UseCustomFonts); ShowFontEditButtons(dfb->GetAsBoolean()); wp->RefreshDisplay(); RefreshFonts(); } FontRegistryChanged = false; changed = false; wf->ShowModal(); if (wp) { DataFieldBoolean * dfb = (DataFieldBoolean*) wp->GetDataField(); if (dfb) { if (Appearance.UseCustomFonts != dfb->GetAsBoolean()) { Appearance.UseCustomFonts = !Appearance.UseCustomFonts; Profile::Set(szProfileUseCustomFonts, Appearance.UseCustomFonts); changed = true; } } } TempInfoWindowFont.reset(); TempTitleWindowFont.reset(); TempMapWindowFont.reset(); TempTitleSmallWindowFont.reset(); TempMapWindowBoldFont.reset(); TempCDIWindowFont.reset(); TempMapLabelFont.reset(); TempMapLabelImportantFont.reset(); if (changed) { Profile::Save(); MessageBoxX(_("Changes to configuration saved. Restart XCSoar to apply changes."), _T(""), MB_OK); } delete wf; }