Is there a way to access (add, remove, and navigate to) IDE bookmarks with the OTAPI?

252 views Asked by At

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.

1

There are 1 answers

2
RBA On

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.