Your support is needed and is appreciated as Amigaworld.net is primarily dependent upon the support of its users.
|
|
|
22 crawler(s) on-line.
95 guest(s) on-line.
0 member(s) on-line.
You are an anonymous user. Register Now! |
|
|
|
| Poster | Thread | Wanderer
|  |
Get source of icon image... Posted on 7-Mar-2013 14:10:23
| | [ #1 ] |
| |
 |
Cult Member  |
Joined: 16-Aug-2008 Posts: 654
From: Germany | | |
|
| Hello!
Is there a quick way to determine what kind of icon will be loaded for a given file?
My actual problem is, that I have a file lister, that should display nice icons along with the filenames. All works fine, but it is a little inefficient because if I have a folder with thousands of files, it takes quite some time to load the icons. Even though all the icons are the same deficon. So what I would like to do is to find out if GetIconTagList() will give me a "real" icon or a default icon, so I can use the images I have already loaded previously. Therfore, I not only must know if the icon is a default icon, but also what was the real file name of the icon to choose it correctly from the pool of already-loaded-icons.
Even if I have to load the icon to get this information, it would help me since there is more overhead like remapping, resizing the image which has then only to be done once instead of n times.
_________________ -- Author of HD-Rec, Sweeper, Samplemanager, ArTKanoid, Monkeyscript, Toadies, AsteroidsTR, TuiTED, PosTED, TKPlayer, AudioConverter, ScreenCam, PerlinFX, MapEdit, AB3 Includes and many more... Homepage: http://www.hd-rec.de |
| | Status: Offline |
| | itix
|  |
Re: Get source of icon image... Posted on 7-Mar-2013 14:27:09
| | [ #2 ] |
| |
 |
Elite Member  |
Joined: 22-Dec-2004 Posts: 3398
From: Freedom world | | |
|
| @Wanderer
Determining the file type is the slowest part. I would just spawn another thread to load icons and display them dynamically as icons get resolved.
AFAIK there is no way to get file type nor deficon path. Last edited by itix on 07-Mar-2013 at 02:29 PM.
_________________ Amiga Developer Amiga 500, Efika, Mac Mini and PowerBook |
| | Status: Offline |
| | Wanderer
|  |
Re: Get source of icon image... Posted on 7-Mar-2013 14:38:18
| | [ #3 ] |
| |
 |
Cult Member  |
Joined: 16-Aug-2008 Posts: 654
From: Germany | | |
|
| @itix
Sure, I will initialize it with my "own" default images that get resolved asynchroneously.
However, it feels kind of wrong to load lots of images that are all the same. There must be a way to find out what is the origin of the icon, other than diff'ing the bitmaps themselves... _________________ -- Author of HD-Rec, Sweeper, Samplemanager, ArTKanoid, Monkeyscript, Toadies, AsteroidsTR, TuiTED, PosTED, TKPlayer, AudioConverter, ScreenCam, PerlinFX, MapEdit, AB3 Includes and many more... Homepage: http://www.hd-rec.de |
| | Status: Offline |
| | thomas
|  |
Re: Get source of icon image... Posted on 7-Mar-2013 16:54:34
| | [ #4 ] |
| |
 |
Super Member  |
Joined: 28-May-2003 Posts: 1155
From: Germany | | |
|
| @Wanderer
I don't think it is (or will ever be) possible with icon.library.
The problem is that DefIcons44 is only one program which installs an identify hook. There may be others which don't care about file types.
What you can do is to load deficons.prefs and examine the file types yourself. So you'd call GetIconTags with FailIfBad = TRUE and if it fails, open the file and check it against deficons.prefs.
However, I think the file type checking routine is not public, so you need to write your own one.
The source code of deficons.prefs is contained in the NewIcons archive on Aminet.
_________________ Email: thomas-rapp@web.de Home: thomas-rapp.homepage.t-online.de |
| | Status: Offline |
| | Wanderer
|  |
Re: Get source of icon image... Posted on 7-Mar-2013 17:27:45
| | [ #5 ] |
| |
 |
Cult Member  |
Joined: 16-Aug-2008 Posts: 654
From: Germany | | |
|
| @thomas
Actually, what I would need is
iconname = GetDefIconFileName(filename)
... and then check against my Image-Cache if iconname is already in memory.
But I understand, DefIcons is something private I dont have access too. Implementing my own or using the source is not really what I want.
So what I can do is NOT to allow the deficon with the Fail Tag. And if there is no icon, I can:
- either use my own images, depending on own (simple) file identification (but images would feel "alien")
- use WBPROJECT / WBDRAWER images and dont to any identification other than file/drawer
_________________ -- Author of HD-Rec, Sweeper, Samplemanager, ArTKanoid, Monkeyscript, Toadies, AsteroidsTR, TuiTED, PosTED, TKPlayer, AudioConverter, ScreenCam, PerlinFX, MapEdit, AB3 Includes and many more... Homepage: http://www.hd-rec.de |
| | Status: Offline |
| | thomas
|  |
Re: Get source of icon image... Posted on 7-Mar-2013 17:33:01
| | [ #6 ] |
| |
 |
Super Member  |
Joined: 28-May-2003 Posts: 1155
From: Germany | | |
|
| | | Status: Offline |
| |
|
|
|
[ home ][ about us ][ privacy ]
[ forums ][ classifieds ]
[ links ][ news archive ]
[ link to us ][ user account ]
|