2

The Delphi IDE allows extensions and plugins via the Open Tools API (OTAPI). It's not very well documented and I am not sure where to look to find out a comprehensive list of what the API allows access to and can achieve, apart from browsing ToolsAPI.pas itself.

Specifically, I would like to access a list of all bookmarks in all open files in the IDE (and preferably, be able to add, remove and navigate to them, the last being the most important.) Is this possible, and what interface do you use to do it?

The closest I have found is this interface in ToolsAPI.pas:

  IOTAEditView140 = interface(IOTAEditView40)
    ['{9C510462-C7BC-11D2-9AEB-00A02457621F}']
    function BookmarkGoto(BookmarkID: Integer): Boolean;
    function BookmarkRecord(BookmarkID: Integer): Boolean;
    function BookmarkToggle(BookmarkID: Integer): Boolean;

That seems, for one view (edit window?), to let you navigate to a bookmark, turn it on or off, and record (?) it, if you know the ID of an existing bookmark or know how to create a new unique ID. (I'm speculating.) But I can't see any enumeration capabilities nor do I feel very sure of how to use the above interface reliably - where do the BookMarkIDs come from, for example? How do you know what they are? How do you generate one? Etc.

David
  • 13,360
  • 7
  • 66
  • 130

1 Answers1

1

From the question Global bookmarks in Delphi editor you can look into the Bookmark Browse code from CNPack (under http://code.google.com/p/cnpack/) to see how it was made.

Community
  • 1
  • 1
RBA
  • 12,337
  • 16
  • 79
  • 126
  • Thanks, although I feel worried about looking at open-source code in case I accidentally copy it. Could you perhaps expand your answer to explain the technique they use? – David Jan 11 '14 at 21:40
  • I don't have the time to put bookmarks or to create a small log mechanism in the code of CnPack in order to see what's there and how could I use it.I'm not in the CnPack team and I didn't worked on it, so I can not tell you the technique. You have the code, so it will be easy for you to investigate it and see how it's working. – RBA Jan 13 '14 at 08:03