Adding a Tooltype by 3rd party app
  • Moderator
    Kronos
    Posts: 2236 from 2003/2/24
    One of the ideas I have for PastePass 1.0 is that the PassTool (to encrypt you password against your registered username) should get a GUI and do all what is need for your.

    For that it needs to be able to write crypted pass into the Tooltype of an icon and to my suprise there isn't a proper API for that.

    Tooltypes seem to be stored as a pointer to array of strings in struct DiskObject, so my guess is:

    add: create an array of STRPTR 1 bigger than the one in the DiskObject, copy all existing entries into it, add new Tooltype at end, put that pointer into *do_ToolTypes and call PutDiskObject().
    In order to leave no dangling memory I would than have to put the old pointer back in before calling FreeDiskObject()

    change: all the same, just replacing that one string instead of the whole array.

    Sounds like an awfully complicated and not really clean method....

    [ Edited by Kronos 21.05.2015 - 18:00 ]
  • »21.05.15 - 17:55
    Profile
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    polluks
    Posts: 779 from 2007/10/23
    From: Gelsenkirchen,...
    That's the way it is. You may take a look at the Ambient source, how to set tooltypes...
    Pegasos II G4: MorphOS 3.9, Zalman M220W · iMac G5 12,1 17", MorphOS 3.18
    Power Mac G3: OSX 10.3 · PowerBook 5,8: OSX 10.5, MorphOS 3.18
  • »21.05.15 - 18:33
    Profile
  • Moderator
    Kronos
    Posts: 2236 from 2003/2/24
    Did that, got confused ;)
  • »21.05.15 - 18:38
    Profile
  • MorphOS Developer
    geit
    Posts: 1031 from 2004/9/23
    It is the only official way.

    obtain diskobject
    copy tooltype array to a bigger array
    add own tooltype to the new array
    terminate new array with NULL
    swap pointer in diskobj
    write icon to disk
    swap pointer in diskobj back to the original
    free disk object

    You must not free or change any data on your own, so cloning is the only way to e.g. remove tooltypes in the same way.
  • »21.05.15 - 18:47
    Profile