EControl Ltd. Forum Index EControl Ltd.
VCL libraries and software support forum
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Number of bookmarks and BookmarkChanged

 
Post new topic   Reply to topic    EControl Ltd. Forum Index -> EControl Syntax Editor
View previous topic :: View next topic  
Author Message
itsatomic



Joined: 12 Jun 2006
Posts: 38

PostPosted: Sat Jul 22, 2006 12:30 pm    Post subject: Number of bookmarks and BookmarkChanged Reply with quote

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
View user's profile Send private message
econtrol
Site Admin


Joined: 09 Jun 2006
Posts: 202

PostPosted: Sat Jul 22, 2006 7:20 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
itsatomic



Joined: 12 Jun 2006
Posts: 38

PostPosted: Sun Jul 23, 2006 10:07 am    Post subject: Reply with quote

Thanks, I will give this a try.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    EControl Ltd. Forum Index -> EControl Syntax Editor All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group