*ide: Fixed issue with importing .png file into icondesigner, filename starting with digit (RM #241)

git-svn-id: svn://ultimatepp.org/upp/trunk@4481 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2012-01-28 14:16:14 +00:00
parent 24fef42f2f
commit 8495b4edb0
2 changed files with 15 additions and 5 deletions

View file

@ -199,12 +199,19 @@ bool LoadIml(const String& data, Array<ImlImage>& img, int& format)
while(p.Id("IMAGE_ID")) {
p.PassChar('(');
String n;
if(p.IsId())
if(p.IsId()) {
n = p.ReadId();
if(n.StartsWith("im__", 4))
n = Null;
if(n.StartsWith("im__", 4))
n = Null;
p.PassChar(')');
}
else
while(!p.IsEof()) {
if(p.Char(')'))
break;
p.SkipTerm();
}
name.Add(n);
p.PassChar(')');
bool e = false;
if(p.Id("IMAGE_META")) {
p.PassChar('(');

View file

@ -177,7 +177,10 @@ void IconDes::InsertFile()
Image m = StreamRaster::LoadFileAny(fn);
if(IsNull(m))
Exclamation(DeQtf(fn) + " not an image.");
ImageInsert(Filter(GetFileTitle(fn), CharFilterImageId), m);
String id = Filter(GetFileTitle(fn), CharFilterImageId);
if(!IsAlpha(*id) && *id != '_')
id = '_' + id;
ImageInsert(id, m);
}
}