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())); }
ValueMap::ValueMap(const VectorMap<Value, Value>& m, int deep) { Data& d = Create(); d.key = clone(m.GetKeys()); d.value = ValueArray(m.GetValues(), 0); }