English Amiga Board


Go Back   English Amiga Board > Coders > Coders. System

 
 
Thread Tools
Old 18 February 2016, 20:42   #1
AGS
XoXo/Tasko Developer
 
AGS's Avatar
 
Join Date: Dec 2013
Location: Munich
Age: 48
Posts: 450
Question Access the DefIcons filetypes settings?

Hi,

is there a way to use the filetype associations that are specified in the DefIcons Preferences App? I found the "deficons.prefs" in Envarc: but no documentation of its format. I looked inside and found that it is executable.

Or is it possible to let the OS retrieve the correct deficon for a certain file to use in my prog? If yes, I would be able to get the command to execute for a particular file from the related deficon.

greets
ags
AGS is offline  
Old 19 February 2016, 00:24   #2
PeterK
Registered User
 
Join Date: Apr 2005
Location: digital hell, Germany, after 1984, but worse
Posts: 3,365
Please read the autodocs for icon.library GetIconTagList(name, tags).

I've never tried it myself, but you should get the associated DefIcon for a given file when you set the tag "ICONGETA_FailIfUnavailable" to "FALSE". This will call the "global identifikation hook" if no real icon exists for your file. The hook should be provided by the DefIcons program if that is installed in WBStartup.
PeterK is offline  
Old 19 February 2016, 19:10   #3
AGS
XoXo/Tasko Developer
 
AGS's Avatar
 
Join Date: Dec 2013
Location: Munich
Age: 48
Posts: 450
Great! And thanks alot. This works. There is no need to have something like "deficons" in the WBStartup folder.

Do you also know how the default tools are started best? Where is the flag that tells me if I should start the tool as WB or as CLI? What about using SystemTagList() to start them, but does this apply to WB-Type and also CLI-Type tools?

Btw, how do I put away the icon correctly after using it to read the default tool?

Last edited by AGS; 19 February 2016 at 19:15.
AGS is offline  
Old 19 February 2016, 19:54   #4
PeterK
Registered User
 
Join Date: Apr 2005
Location: digital hell, Germany, after 1984, but worse
Posts: 3,365
For my understanding you need calling the DefIcons tool in order to get the "global identifikation hook" that reads the deficon.prefs, or not ??

The only other tool providing such a hook I know is Eastern, which can be used to supply picture files with matching preview image icons (thumbnails).

Without the DefIcons or Eastern tool I would expect that the identification is only done by the icon.library based on the file name, like RAM: => def_RAM.info.

Quote:
Do you also know how the default tools are started best? Where is the flag that tells me if I should start the tool as WB or as CLI? What about using SystemTagList() to start them, but does this apply to WB-Type and also CLI-Type tools?
No sorry, I've no idea how to decide that.
But you can use FindToolType() and scan the DiskObject=>do_ToolTypes array for "CLI".
Quote:
Btw, how do I put away the icon correctly after using it to read the default tool?
Call FreeDiskObject(diskobject). It will release all the memory used by the icon.

Last edited by PeterK; 19 February 2016 at 20:21.
PeterK is offline  
Old 19 February 2016, 20:26   #5
AGS
XoXo/Tasko Developer
 
AGS's Avatar
 
Join Date: Dec 2013
Location: Munich
Age: 48
Posts: 450
I am sure it decides correctly what is an ASCII file and what not. I've got the texteditor opening for a file named "ahr" or something. And this w/o deficons in WBStartup.
AGS is offline  
Old 19 February 2016, 20:29   #6
PeterK
Registered User
 
Join Date: Apr 2005
Location: digital hell, Germany, after 1984, but worse
Posts: 3,365
Hmm, that's magic or a hook which I don't know yet
Maybe, you have DefIcons already in your startup-sequence or user-startup ??
Or do you use the tool NewIcons ?
PeterK is offline  
Old 19 February 2016, 20:33   #7
AGS
XoXo/Tasko Developer
 
AGS's Avatar
 
Join Date: Dec 2013
Location: Munich
Age: 48
Posts: 450
I have not.

But how could I invoke my own identifier stuff, e.g. to generate thumbnails? As of yet I would use datatypes to check for format before asking the iconlibrary.


ps: And I am not using that tool.
AGS is offline  
Old 19 February 2016, 20:45   #8
PeterK
Registered User
 
Join Date: Apr 2005
Location: digital hell, Germany, after 1984, but worse
Posts: 3,365
Are you sure ?

You will have to fight with IconControlA() and all the ugly hook stuff that has to be passed with tag "ICONCTRLA_SetGlobalIdentifyHook".

Writing a hook must be a lot of fun !

Code:
	ICONCTRLA_SetGlobalIdentifyHook (struct Hook *) -- Set the
	    hook that is invoked when trying to find an icon
	    for a file/drawer/volume that does not have an
	    icon associated with it. If set to NULL, no hook
	    will be called. The hook will be called with the
	    following parameters:

	    hookFunc(hook,reserved,iim)
	              A0     A2    A1

	    VOID hookFunc(struct Hook *hook,APTR reserved,
	                  struct IconIdentifyMsg *iim);

	    The reserved parameter will be set to NULL (V44).

	    The icon identification message contents are as follows:

	        iim_SysBase
	        iim_DOSBase
	        iim_UtilityBase
	        iim_IconBase
	            Library base pointers set up for your use.

	        iim_FileLock
	            A lock on the object to return an icon for.
	            This lock is guaranteed to be non-NULL.

	        iim_ParentLock
	            A lock on the object's parent directory. This
	            may be NULL if iim_FileLock points to a volume's
	            root directory. In such a case you should return
	            a WBDISK type icon instead of a WBDRAWER icon.

	        iim_FIB
	            An initialized FileInfoBlock structure; prior
	            to passing iim_FIB to you, Examine(iim_FileLock,iim_FIB)
	            was called. Unlike the other members of this data
	            structure, you may modify the contents of iim_FIB.

	        iim_FileHandle
	            If the object to return an icon for is a file,
	            this member will contain a file handle that can
	            be used to Read() its contents. The file read
	            position will be set to the beginning of
	            the file. Note that this member can be NULL.

	        iim_Tags
	            A copy of the tag item list passed to GetIconTagList();
	            if you are going to call GetIconTagList() in your
	            hook, be sure to include this list as part of the
	            tag list you pass to it.

	            NOTE: This list does not include the tag
	                  ICONA_FailIfUnavailable. Keep in mind that
	                  the use of this tag can trigger a recursion
	                  if the icon you tried to retrieve via
	                  GetIconTagList() does not exist: your hook
	                  code will be invoked again.

	    With the exception of iim_FIB, all members of the
	    IconIdentifyMsg are read-only; you may pass them to
	    functions like Read(), Examine(), etc. but you
	    may not Close() files, UnLock() locks or perform
	    other functions that may result in the data structures
	    getting deallocated or trashed.

	    When you manage to find the right icon type for the object
	    to be examined, you should return a pointer to a
	    struct DiskObject that can be freed using FreeDiskObject()
	    lateron. Note that you cannot just return a pointer to a
	    statically initialized data structure in your code, you
	    must return a pointer to a DiskObject allocated by icon.library
	    itself, such as through GetIconTagList(), DupDiskObjectA()
	    or NewDiskObject().

	    The icon you return will be checked to make sure that its
	    type matches the corresponding object. For example, returning
	    a WBDRAWER icon for a volume root directory will cause that
	    icon to be released and to be ignored.

Last edited by PeterK; 19 February 2016 at 21:01.
PeterK is offline  
Old 19 February 2016, 20:45   #9
AGS
XoXo/Tasko Developer
 
AGS's Avatar
 
Join Date: Dec 2013
Location: Munich
Age: 48
Posts: 450
Orgh, I m issed it. There IS a "deficons" in my WBStartup folder! (: Hey ...
AGS is offline  
Old 19 February 2016, 20:52   #10
PeterK
Registered User
 
Join Date: Apr 2005
Location: digital hell, Germany, after 1984, but worse
Posts: 3,365
I see
PeterK is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
ClassicWB OS39 : Default tool for doc FileTypes Amon_RA project.ClassicWB 1 09 May 2016 12:24
DirOpus 4.16 Filetypes squidbass support.Apps 2 08 February 2015 10:09
DefIcons editor for OS 3.1 Leandro Jardim request.Apps 10 07 March 2014 22:11
DefIcons Smiley support.Apps 2 11 June 2006 22:33
How do I associate filetypes with programs? Valhoudini support.WinUAE 8 04 February 2006 18:22

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 17:50.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.08829 seconds with 15 queries