diff --git a/uppsrc/CtrlLib/src.tpp/FileSel$en-us.tpp b/uppsrc/CtrlLib/src.tpp/FileSel$en-us.tpp index 52303bb51..410c846f7 100644 --- a/uppsrc/CtrlLib/src.tpp/FileSel$en-us.tpp +++ b/uppsrc/CtrlLib/src.tpp/FileSel$en-us.tpp @@ -38,7 +38,7 @@ ing[@(0.0.255) `&]_path, Image[@(0.0.255) `&]_result)&] for additional resolving of file icon. Note that FileSel, when closed/destroyed, does not wait for this function to finish, so it should not rely on any data outside of function. Only available -when MT is active.&] +when MT is active.devious &] [s3; &] [s4; &] [s5;:FileSel`:`:Serialize`(Stream`&`): [@(0.0.255) void]_[* Serialize]([_^Stream^ Stream][@(0.0.255) `& diff --git a/uppsrc/IconDes/List.cpp b/uppsrc/IconDes/List.cpp index 5a90192cb..010b9b49b 100644 --- a/uppsrc/IconDes/List.cpp +++ b/uppsrc/IconDes/List.cpp @@ -179,6 +179,24 @@ struct ImgPreview : Display { } }; +#ifdef _MULTITHREADED +static void sLoadImage(const String& path, Image& result) +{ + if(findarg(ToLower(GetFileExt(path)), ".png", ".gif", ".jpeg", ".jpg") < 0) + return; + FileIn in(path); + if(!in) + return; + One r = StreamRaster::OpenAny(in); + if(!r) + return; + Size sz = r->GetSize(); + if(sz.cx > 80 || sz.cy > 80) + return; + result = r->GetImage(); +} +#endif + FileSel& IconDes::ImgFile() { static FileSel sel; @@ -186,6 +204,9 @@ FileSel& IconDes::ImgFile() sel.Type("Image files", "*.png *.bmp *.jpg *.jpeg *.gif"); sel.AllFilesType(); sel.Multi(); +#ifdef _MULTITHREADED + sel.WhenIconLazy = sLoadImage; +#endif sel.Preview(Single()); } return sel;