void Ide::SaveConfig() { SaveChangedFile(ConfigFile(), StoreAsString(*this)); if(GetIniKey("DebugClipboard") == "1") { SaveChangedFile(ConfigFile() + ".bak", StoreAsString(*this)); StoreToFile(*this, ConfigFile() + ".bak1"); } SaveChangedFile(ConfigFile("ide.key"), StoreKeys()); SaveChangedFile(ConfigFile("ide.colors"), editor.StoreHlStyles()); config_time = ConfigTime(); }
void IdeIconDes::Save() { if(format == 1) { for(int i = 0; i < GetCount(); i++) { Image m = GetImage(i); Point p = m.Get2ndSpot(); if(m.GetKind() == IMAGE_ALPHA || p.x || p.y) { if(PromptYesNo("Legacy file format does not support images " "with full alpha channel or 2nd hotspot - " "the information would be lost.&" "Do you wish to convert the file to the new format?")) { format = 0; } break; } } } StoreToGlobal(*this, "icondes-ctrl"); Array<ImlImage> m; VectorMap<Size, Image> exp; String folder = GetFileFolder(filename); for(int i = 0; i < GetCount(); i++) { ImlImage& c = m.Add(); c.name = GetName(i); c.image = GetImage(i); c.exp = GetExport(i); if(c.exp) { Size sz = c.image.GetSize(); exp.GetAdd(sz) = c.image; PNGEncoder png; SaveChangedFile(AppendFileName(folder, String().Cat() << "icon" << sz.cx << 'x' << sz.cy << ".png"), png.SaveString(c.image)); } } String d = SaveIml(m, format); if(!SaveChangedFileFinish(filename, d)) return; filetime = FileGetTime(filename); if(exp.GetCount()) SaveChangedFile(AppendFileName(folder, "icon.ico"), WriteIcon(exp.GetValues())); }
void WorkspaceWork::SavePackage() { if(IsNull(actualpackage) || actualpackage == METAPACKAGE) return; InvalidatePackageInfo(actualpackage); String pp = PackagePathA(actualpackage); RealizePath(pp); if(organizer && backup.Find(pp) < 0) { Backup& b = backup.Add(pp); FindFile ff(pp); if(ff) { b.time = ff.GetLastWriteTime(); b.data = LoadFile(pp); } else b.data = String::GetVoid(); } actual.Save(pp); String init; String mnm = Filter('_' + actualpackage + "_icpp_init_stub", CharFilterMacro); init << "#ifndef " << mnm << "\r\n"; init << "#define " << mnm << "\r\n"; Index<String> once; for(int i = 0; i < actual.uses.GetCount(); i++) { String u = actual.uses[i].text; if(once.Find(u) < 0) { once.Add(u); init << "#include \"" << actual.uses[i].text << "/init\"\r\n"; } } for(int i = 0; i < actual.GetCount(); i++) { String f = actual[i]; if(ToLower(GetFileExt(f)) == ".icpp") init << "#define BLITZ_INDEX__ " << "F" << MD5String(f) << "\r\n" << "#include \"" << f << "\"\r\n" << "#undef BLITZ_INDEX__\r\n"; } init << "#endif\r\n"; SaveChangedFile(SourcePath(actualpackage, "init"), init); }
bool MakeBuild::Build(const Workspace& wspc, String mainparam, String outfile, bool clear_console) { String hfile = outfile + ".xxx"; SaveFile(hfile, ""); FileTime start_time = GetFileTime(hfile); // Defensive way to get correct filetime of start DeleteFile(hfile); ClearErrorEditor(); BeginBuilding(true, clear_console); bool ok = true; if(wspc.GetCount()) { for(int i = 0; i < wspc.GetCount(); i++) { const Package& pk = wspc.package[i]; for(int j = 0; j < pk.GetCount(); j++) if(pk[j] == "main.conf") { String pn = wspc[i]; String p = SourcePath(pn, "main.conf"); main_conf << "// " << pn << "\r\n" << LoadFile(p) << "\r\n"; PutConsole("Found " + p); } } if(main_conf.GetCount()) { VectorMap<String, String> bm = GetMethodVars(method); One<Host> host = CreateHost(false); One<Builder> b = CreateBuilder(~host); if(b) { Index<String> mcfg = PackageConfig(wspc, 0, bm, mainparam, *host, *b, NULL); String outdir = OutDir(mcfg, wspc[0], bm, false); String path = AppendFileName(outdir, "main.conf.h"); RealizePath(path); SaveChangedFile(path, main_conf); PutConsole("Saving " + path); add_includes << outdir << ';'; } } Vector<int> build_order; if(GetTargetMode().linkmode != 2) { for(int i = 1; i < wspc.GetCount(); i++) build_order.Add(i); } else { Index<int> remaining; for(int i = 1; i < wspc.GetCount(); i++) remaining.Add(i); while(!remaining.IsEmpty()) { int t; for(t = 0; t < remaining.GetCount(); t++) { const Package& pk = wspc.package[remaining[t]]; bool delay = false; for(int u = 0; u < pk.uses.GetCount(); u++) if(remaining.Find(wspc.package.Find(pk.uses[u].text)) >= 0) { delay = true; break; } if(!delay) break; } if(t >= remaining.GetCount()) t = 0; build_order.Add(remaining[t]); remaining.Remove(t); } } String mainpackage = wspc[0]; Vector<String> linkfile; String linkopt = GetMethodVars(method).Get(targetmode ? "RELEASE_LINK" : "DEBUG_LINK", Null); if(linkopt.GetCount()) linkopt << ' '; ok = true; int ms = msecs(); for(int i = 0; i < build_order.GetCount() && (ok || !stoponerrors); i++) { int px = build_order[i]; ok = BuildPackage(wspc, px, i, build_order.GetCount() + 1, mainparam, Null, linkfile, linkopt) && ok; if(msecs() - ms >= 200) { DoProcessEvents(); ms = msecs(); } } if(ok || !stoponerrors) { ok = BuildPackage(wspc, 0, build_order.GetCount(), build_order.GetCount() + 1, mainparam, outfile, linkfile, linkopt, ok) && ok; // Set the time of target to start-time, so that if any file changes during // compilation, it is recompiled during next build SetFileTime(target, start_time); } } EndBuilding(ok); ReQualifyCodeBase(); SetErrorEditor(); return ok; }