View previous topic :: View next topic |
Author |
Message |
itsatomic
Joined: 12 Jun 2006 Posts: 38
|
Posted: Sat Jul 22, 2006 12:30 pm Post subject: Number of bookmarks and BookmarkChanged |
|
|
Hi Michael
I have had a quick look at the source. Am I right in thinking that you can have an unlimited number of bookmarks (up to MAXINT)? Hope so.
Code: | property BmIndex : integer; // Should be unique |
Would it be possible to add some information to the bookmark(s) class to indicate whether any of them have changed? I was going to ask for an event but if there are 100 bookmarks and I insert a line then the event would be fired 100 times, which is inefficient.
Suggestion 1:
Code: | TSyntaxMemo.BookmarksModified : Boolean; |
Indicates that one or more bookmarks have been modified.
Suggestion 2:
Code: | TSyntaxMemo.BookmarkModified : Integer; |
Indicates the first bookmark index that has been modified. (ie this one and all bookmarks after it will have changed).
If you do something, I would like the ability to clear the flag also.
Thanks
Aaron |
|
Back to top |
|
|
econtrol Site Admin
Joined: 09 Jun 2006 Posts: 202
|
Posted: Sat Jul 22, 2006 7:20 pm Post subject: |
|
|
Hi Aaron,
Yes, number of bookmarks is unlimited. BmIndex may not be unique.
BmIndex is used only in TSyntaxMemo.Bookmarks[Index] property.
You may use TSyntaxMemo.BookmarkObj: TBookmarks property (collection) to control
bookmarks.
As I understand you want to backtrace changing bookmar position.
I suggest next modification in this case:
Code: | TBookmark = class(TCustomGutterObject)
private
FBmIndex: integer;
FPosition: integer;
FModified: Boolean;
procedure SetPosition(const Value: integer);
public
property BmIndex: integer read FBmIndex;
property Position: integer read FPosition write SetPosition;
property Modified: Boolean read FModified write FModified; // <==
end;
procedure TBookmark.SetPosition(const Value: integer);
begin
if FPosition <> Value then
begin
FPosition := Value;
FModified := True;
end;
FLine := TBookmarks(Collection).FOwner.StrPosToCaretPos(FPosition).Y;
end; |
Michael. |
|
Back to top |
|
|
itsatomic
Joined: 12 Jun 2006 Posts: 38
|
Posted: Sun Jul 23, 2006 10:07 am Post subject: |
|
|
Thanks, I will give this a try. |
|
Back to top |
|
|
|