bool GuiPackageResolver(const String& error, const String& path, int line) { prompt: switch(Prompt(Ctrl::GetAppName(), CtrlImg::exclamation(), error + "&while parsing package " + DeQtf(path), "Edit \\& Retry", "Ignore", "Stop")) { case 0: if(!PromptYesNo("Ignoring will damage package. Everything past the " "point of error will be lost.&Do you want to continue ?")) goto prompt; return false; case 1: { TopWindow win; LineEdit edit; edit.Set(LoadFile(path)); edit.SetCursor(edit.GetPos(line)); win.Title(path); win.Add(edit.SizePos()); win.Run(); SaveFile(path, edit.Get()); } return true;; case -1: exit(1); } return false; }
void MakeTutorial() { String log = LoadFile(GetStdLogPath()); StringStream ss(log); VectorMap<String, Vector<Tuple<int, String>>> logline; String path; int line; while(!ss.IsEof()) { String ln = ss.GetLine(); if(ln.StartsWith("-=>")) { SplitTo(ln.Mid(4), '@', path, ln); line = atoi(ln) - 1; } else if(path.GetCount()) logline.GetAdd(path).Add(MakeTuple(line, ln)); } for(auto&& f : ~logline) { Vector<String> src = Split(Filter(LoadFile(f.key), [] (int c) { return c == '\r' ? 0 : c; }), '\n', false); int i = 0; int logi = 0; bool wasdoc = false; Vector<String> code; while(i < src.GetCount()) { String block; while(i < src.GetCount() && TrimLeft(src[i]).StartsWith("///")) { FlushCode(code); Vector<String> logblock; while(logi < f.value.GetCount() && f.value[logi].a <= i) logblock.Add(f.value[logi++].b); FlushLog(logblock); String line = src[i++]; int q = line.FindAfter("///"); if(TrimRight(line).GetCount() > q) { if(block.GetCount()) block << ' '; block << TrimBoth(line.Mid(q)); } else FlushDoc(block); wasdoc = true; } FlushDoc(block); while(i < src.GetCount() && !TrimLeft(src[i]).StartsWith("///")) { String tl = TrimLeft(src[i]); if(!tl.StartsWith("#if") && !tl.StartsWith("#end")) code.Add(src[i]); i++; } DUMPC(code); if(!wasdoc) code.Clear(); } } LOG("--------------------------------------------"); LOG(out); LOG("--------------------------------------------"); LOG(qtf); RichEditWithToolBar edit; edit.SetReadOnly(); edit <<= qtf; TopWindow win; win.Add(edit.SizePos()); win.Run(); }