void OutMode::CmdOptions() { const Workspace& wspc = ide.IdeWorkspace(); int pi = wspc.GetCount() > 0 ? 0 : -1; if (pi < 0) { PromptOK("No main package"); return; } VectorMap<String, String> bm = ide.GetMethodVars(~method); if (bm.GetCount() == 0) { PromptOK("Invalid build method"); return; } One<Host> host = ide.CreateHost(false); One<Builder> b = ide.CreateBuilder(~host); const String& p = wspc[pi]; String output = NativePath(ide.OutDir(ide.PackageConfig(wspc, pi, bm, ~config, *host, *b), p, bm, true)); if (output.Right(1) == ".") output = output.Left(output.GetCount() - 1); const ModePane& pane = ~mode == 0 ? debug : release; int blitzpackage = pane.package.Get(0, 2); bool blitzbuild = !wspc.package[pi].noblitz && pane.blitz && (IsNull(blitzpackage) ? true : blitzpackage); CmdBuildOptionsWindow window(p, ~method, ~config, output, ~mode, ide.hydra1_threads, pane.linkmode, blitzbuild, pane.map, ide.console.verbosebuild); LoadFromGlobal(window, "CmdBuildOptionsWindow"); window.GenerateCmd(); window.Run(); StoreToGlobal(window, "CmdBuildOptionsWindow"); }
// get user options, process and save. void Options::onbtnSave() { int dontsplash = optSplash.Get(); // get the value from option control int savewinpos = optSaveWinPos.Get();// get the value from option control Ctrl* owner = GetOwner(); // get a handle to the Options dislog owner which is MyUppApp main window. Rect rc; // create a struct to store window position and size if ( savewinpos != 1 ) { // if Save Window option is not checked. rc.left = 0; // set window position x to 0 rc.top = 0; // set window position y to 0 } else { rc = owner->GetRect(); // get the position and size of MyUppApp main window } String cfg; // create a string to store config data cfg << "Splash=" << dontsplash << "\n" // save user's choice "SaveWinPos=" << savewinpos << "\n" // save user's choice "PosX=" << rc.left << "\n" // save window x position "PosY=" << rc.top << "\n"; // save window y position if( !SaveFile(cfgfile, cfg) ) // save the config file Exclamation("Error saving configuration!"); // if failed show error dialog else PromptOK("Options saved!"); // show success dialog Break(IDOK); // close this dialog }
void ImageMT::LoadImage() { FileSel dlg; dlg.Type("Image files","*.bmp *.png *.tif *.jpg"); dlg.Type("Image: JPEG","*.jpg"); dlg.Type("Image: Portable Nework Graphics","*.png"); dlg.Type("Image: Tagged Image Format","*.tif"); dlg.Type("Image: Windows Bitmap (24bit)","*.bmp"); dlg.ActiveDir(GetCurrentDirectory()); if(!dlg.ExecuteOpen("Open Image"))return; SetCurrentDirectory(dlg.GetActiveDir()); String path = ~dlg; FileIn in(path); if(in.IsError()) { String s = Format("Error opening image file %s",path); PromptOK(s); return; } One<StreamRaster> r = StreamRaster::OpenAny(in); if(!r) { String s = Format("Error opening streamraster file %s",path); PromptOK(s); return; } Layer* pLayer = new Layer; Size sz = GetSize(); pLayer->m_img = r->GetImage(); pLayer->m_rc.left = 0; pLayer->m_rc.right = 1; pLayer->m_rc.top = 0; pLayer->m_rc.bottom = 1; m_pLayers.Add(pLayer); }
void VegaTab1::PromptCell() { String s; if (arr.GetCursor()) { s=AsString(arr.ReadRow(arr.GetCursor())[arr.GetClickColumn()]); PromptOK(s); } }
//What to do if Solution button is clicked void Fifteen::SolutionClick() { if (!usedSolution) { usedSolution = true; endOfGame = true; FindSolution(); } else { PromptOK(SOLUTIONMSG); } }
void Puzzle::LeftDown(Point p, dword) { if(Move(p.x / 32, p.y / 32)) { moves++; Status(); int n = size.cx * size.cy - 1; for(int i = 0; i < n; i++) if(box[i] != i + 1) return; String dim; int& sm = score.GetAdd(String().Cat() << size.cx << "x" << size.cy); if(moves < sm) { sm = moves; PromptOK(t_("You win with the new best score!")); } else PromptOK(t_("You win!")); Generate(); } else BeepExclamation(); }
//Function checks if it's end of game void Fifteen::GameOver() { if(!endOfGame) { if (CorrectGameArea()) { endOfGame = true; if (!usedSolution) { PromptOK(Format(WINMSG, points, time)); } } } }
void VegaTab1::AddPlayer() // body of the callback { if ( IsNull(~editName) ) { PromptOK("The Name field cannot be empty!"); return; } if ( IsNull(~editCountry) ) editCountry <<= "---"; if ( IsNull(~editBirth) ) editBirth <<= "00.00.00"; if ( IsNull(~editIDFIDE) ) editIDFIDE <<= 0; arr.Add(1, ~editName, ~editCountry, ~editBirth, ~tsex?"m":"f", ~editTitle, ~editIDFIDE, ~editRatFIDE, ~editIDNat, ~editRatNat, ~kcoeff, true); // true==1, false==0 arr.GoEnd(); ActiveFocus(editName); MaskDefaultValue(); }
void Ide::CheckUpdatesManual(){ int tmp=UpdaterCfg().ignored; UpdaterCfg().ignored=0; su.ClearError(); if(su.NeedsUpdate(true)){ su.Execute(); }else{ String err=su.GetError(); if(err=="CANCEL") return; if(!err.IsEmpty()){ Exclamation("Unable to check for updates. "+err); }else{ PromptOK("No update found. You are using version "+su.GetLocal()+"."); } UpdaterCfg().ignored=tmp; } SetBar(); }
void Ide::BuildAndExecute() { if(Build()) { int time = msecs(); One<Host> h = CreateHostRunDir(); h->ChDir(Nvl(rundir, GetFileFolder(target))); String cmdline; if(!runexternal) cmdline << '\"' << h->GetHostPath(target) << "\" "; cmdline << ToSystemCharset(runarg); int exitcode; switch(runmode) { case RUN_WINDOW: HideBottom(); h->Launch(cmdline, FindIndex(SplitFlags(mainconfigparam, true), "GUI") < 0); break; case RUN_CONSOLE: ShowConsole(); PutConsole(String().Cat() << "Executing: " << cmdline); console.Sync(); exitcode = h->ExecuteWithInput(cmdline); PutConsole("Finished in " + GetPrintTime(time) + ", exit code: " + AsString(exitcode)); break; case RUN_FILE: { HideBottom(); String fn; if(IsNull(stdout_file)) fn = ForceExt(target, ".ol"); else fn = stdout_file; FileOut out(fn); if(!out) { PromptOK("Unable to open output file [* " + DeQtf(stdout_file) + "] !"); return; } if(h->Execute(cmdline, out) >= 0) { out.Close(); EditFile(fn); } } } } }
//Function set new game GameArray void Fifteen::SetGameArray() { if (!usedSolution) { points = 0; result.SetData(points); time = 0; timeresult.SetData(time); SeedRandom(GetSysTime().Get()); endOfGame = false; usedSolution = false; RandomGameArray(GameArray); //Saving GameArray for solution finder CopyTGameArray(GameStartArray, GameArray); } else { PromptOK(SOLUTIONMSG); } }
void TestLeptonica::onPageLayout() { String fileName; FileSelector fs; Pix source; if(!PromptYesNo( "[= [* Page layout analysis demo]&&" "Please select a 1 bpp scanned image with mixed text and graphics&" "you can take one from TestLeptonica folder if you like&&" "[* CONTINUE ??]]" )) return; fs.ReadOnlyOption(); if(fs.ExecuteOpen("Please select image for page layout analysis:")) { FileIn s; if(!s.Open(~fs)) { PromptOK("Error opening image"); s.Close(); return; } // Loads pixraster from source raster CHECKR(source.Load(s), "Error loading image"); s.Close(); // apply line removal algothithm pixRaster.Clear(); PageLayout(source, pixRaster); // refresh the PixRasterCtrl control with the new image contents pixRasterCtrl.Reload(); pixRasterCtrl.SetPage(0); } }
void TopicEditor::FindBrokenRef() { Uuid codeitem = CodeItemUuid(); Uuid stritem = StructItemUuid();; for(;;) { if(IsNull(topicpath)) return; const RichText& txt = editor.Get(); int c = editor.GetCursor(); int i = txt.FindPart(c); while(++i < txt.GetPartCount()) { if(txt.IsPara(i)) { Uuid style = txt.GetParaStyle(i); if(style == codeitem || style == stritem) { RichPara para = txt.Get(i); if(para.format.label == "noref") continue; if(!IsNull(para.format.label) && GetCodeRefItem(para.format.label)) continue; editor.Move(txt.GetPartPos(i)); return; } } } if(!topic.IsCursor()) break; c = topic.GetCursor() + 1; if(c >= topic.GetCount()) { PromptOK("No more invalid references."); break; } topic.SetCursor(c); if(!IsNull(topicpath)) editor.Move(0); } }
void GUISample1::ToolbarClicked() { PromptOK("Click"); }
bool Pdb::RunToException() { DR_LOG("RunToException"); LLOG("RUN TO EXCEPTION"); TimeStop ts; bool disasfocus = disas.HasFocus(); bool locked = false; bool frestored = false; invalidpage.Clear(); mempage.Clear(); int opn = 0; for(;;) { if(terminated) { if(locked) Unlock(); return false; } opn++; DR_LOG("WaitForDebugEvent"); if(WaitForDebugEvent(&event, 0)) { DR_LOG("WaitForDebugEvent ended"); debug_threadid = event.dwThreadId; opn = 0; running = false; switch(event.dwDebugEventCode) { case EXCEPTION_DEBUG_EVENT: { DR_LOG("EXCEPTION_DEBUG_EVENT"); LLOG("Exception: " << FormatIntHex(event.u.Exception.ExceptionRecord.ExceptionCode) << " at: " << FormatIntHex(event.u.Exception.ExceptionRecord.ExceptionAddress) << " first: " << event.u.Exception.dwFirstChance); SaveForeground(); const EXCEPTION_RECORD& x = event.u.Exception.ExceptionRecord; if(findarg(x.ExceptionCode, EXCEPTION_BREAKPOINT, EXCEPTION_SINGLE_STEP, STATUS_WX86_BREAKPOINT, STATUS_WX86_SINGLE_STEP) < 0) { LLOG("Non-debug EXCEPTION"); if(event.u.Exception.dwFirstChance) { LLOG("First chance " << FormatIntHex(x.ExceptionCode)); break; } String desc = Format("Exception: [* %lX] at [* %16llX]&", (int64)x.ExceptionCode, (int64)x.ExceptionAddress); for(int i = 0; i < __countof(ex_desc); i++) if(ex_desc[i].code == x.ExceptionCode) desc << "[* " << DeQtf(ex_desc[i].text) << "]&"; if(x.ExceptionCode == EXCEPTION_ACCESS_VIOLATION) { desc << (x.ExceptionInformation[0] ? "[*@3 writing]" : "[*@4 reading]"); desc << Format(" at [* %08llX]", (int64)x.ExceptionInformation[1]); } ToForeground(); PromptOK(desc); } #ifdef CPU_64 if(!win64 && x.ExceptionCode == EXCEPTION_BREAKPOINT && !break_running) // Ignore x64 breakpoint in wow64 break; #endif if(break_running) debug_threadid = mainThreadId; break_running = false; ToForeground(); if(disasfocus) disas.SetFocus(); if(locked) Unlock(); if(refreshmodules) LoadModuleInfo(); LLOG("event.dwThreadId = " << event.dwThreadId); bool isbreakpoint = findarg(x.ExceptionCode, EXCEPTION_BREAKPOINT, STATUS_WX86_BREAKPOINT) >= 0; for(int i = 0; i < threads.GetCount(); i++) { Thread& t = threads[i]; (Context&)t = ReadContext(threads[i].hThread); if(event.dwThreadId == threads.GetKey(i)) { LLOG("Setting current context"); if(isbreakpoint #ifdef CPU_64 && bp_set.Find((win64 ? t.context64.Rip : t.context32.Eip) - 1) >= 0 #else && bp_set.Find(t.context32.Eip - 1) >= 0 #endif ) // We have stopped at breakpoint, need to move address back #ifdef CPU_64 if(win64) t.context64.Rip--; else #endif t.context32.Eip--; context = t; } } RemoveBp(); return true; } case CREATE_THREAD_DEBUG_EVENT: DR_LOG("CREATE_THREAD_DEBUG_EVENT"); LLOG("Create thread: " << event.dwThreadId); AddThread(event.dwThreadId, event.u.CreateThread.hThread); break; case EXIT_THREAD_DEBUG_EVENT: DR_LOG("EXIT_THREAD_DEBUG_EVENT"); LLOG("Exit thread: " << event.dwThreadId); RemoveThread(event.dwThreadId); break; case CREATE_PROCESS_DEBUG_EVENT: DR_LOG("CREATE_PROCESS_DEBUG_EVENT"); LLOG("Create process: " << event.dwProcessId); processid = event.dwProcessId; AddThread(event.dwThreadId, event.u.CreateProcessInfo.hThread); CloseHandle(event.u.CreateProcessInfo.hFile); CloseHandle(event.u.CreateProcessInfo.hProcess); break; case EXIT_PROCESS_DEBUG_EVENT: DR_LOG("EXIT_PROCESS_DEBUG_EVENT"); LLOG("Exit process: " << event.dwProcessId); if(locked) Unlock(); terminated = true; return false; case LOAD_DLL_DEBUG_EVENT: { DR_LOG("LOAD_DLL_DEBUG_EVENT"); LLOG("Load dll: " << event.u.LoadDll.lpBaseOfDll); CloseHandle(event.u.LoadDll.hFile); refreshmodules = true; break; } case UNLOAD_DLL_DEBUG_EVENT: DR_LOG("UNLOAD_DLL_DEBUG_EVENT"); LLOG("UnLoad dll: " << event.u.UnloadDll.lpBaseOfDll); refreshmodules = true; break; case RIP_EVENT: DR_LOG("RIP_EVENT"); LLOG("RIP!"); Exclamation("Process being debugged died unexpectedly!"); terminated = true; if(locked) Unlock(); return false; } DR_LOG("ContinueDebugEvent"); ContinueDebugEvent(event.dwProcessId, event.dwThreadId, DBG_EXCEPTION_NOT_HANDLED); running = true; } if(ts.Elapsed() > 200) { DR_LOG("ts.Elpsed() > 200"); if(!lock) { Lock(); locked = true; } if(!frestored) { RestoreForeground(); frestored = true; } } if(lock) { DR_LOG("GuiSleep"); GuiSleep(opn < 1000 ? 0 : 100); Ctrl::ProcessEvents(); } else { DR_LOG("Sleep"); Sleep(opn < 1000 ? 0 : 100); } } }
//What to do if Help button is clicked void Fifteen::HelpClick() { PromptOK(HELPMSG); }
// default set of prompts for installer result // just an handy shortcut good for most cases bool Updater::DefaultPrompts(void) { // fine grained behaviour depending on update state switch(GetState()) { case UninstallFailed: Exclamation(Format(t_("Uninstall of '%s' failed&Press OK to quit"), appName)); return false; case UninstallSucceeded: PromptOK(Format(t_("Uninstall of '%s' complete&Press OK to quit"), appName)); return false; case UninstallAborted: return false ; case InstallFailed: switch(installBehaviour) { case AskUser : if(!PromptYesNo(Format(t_("Install of '%s' failed&Run without installing?"), appName))) return false; break; case AbortExecution: Exclamation(Format(t_("Install of '%s' failed"), appName)); return false; case ContinueExecution: Exclamation(Format(t_("Install of '%s' failed&press OK to run uninstalled"), appName)); return true; default: return false; } return true; case InstallSucceeded: return true; case InstallAborted: switch(installBehaviour) { case AskUser : if(!PromptYesNo(Format(t_("Install of '%s' aborted&Run without installing?"), appName))) return false; break; case AbortExecution: Exclamation(Format(t_("Install of '%s' aborted"), appName)); return false; case ContinueExecution: Exclamation(Format(t_("Install of '%s' aborted&press OK to run uninstalled"), appName)); return true; default: return false; } return true; case UpdateFailed: switch(updateBehaviour) { case AskUser: if(!PromptYesNo(Format(t_("Update of '%s' failed&Run current version?"), appName))) return false; break; case AbortExecution: Exclamation(Format(t_("Update of '%s' failed"), appName)); return false; case ContinueExecution: Exclamation(Format(t_("Update of '%s' failed&press OK to run current version"), appName)); return true; default: return true; } return true; case UpdateSucceeded: return true; // here we're on normal run, no install/uninstall/update process happened // we should continue normal execution default: return true; } }
void Puzzle::About() { PromptOK("[A5 Puzzle]&Using [*^www://upp.sf.net^ Ultimate`+`+] technology."); }
void Test() { PromptOK("Test"); }