Bookmark

May 14, 2007 at 9:23 AM
Hi,
I know scintillaNet supports bookmark but i am not sure how to use it.
Can someone help me with the code to set the bookmark?

Regards,
Shweta.
May 14, 2007 at 1:29 PM
Hi,

I tried the code below and is working fine for toggling the bookmark.

scintillaEditor.MarkerDefine((int)Scintilla.Enums.MarkerOutline.Folder,
Scintilla.Enums.MarkerSymbol.Arrow );

if (scintillaEditor.MarkerGet(scintillaEditor.LineFromPosition(scintillaEditor.CurrentPos)) != 0)
scintillaEditor.MarkerDelete(scintillaEditor.LineFromPosition(scintillaEditor.CurrentPos),
(int)Scintilla.Enums.MarkerOutline.Folder);
else
scintillaEditor.MarkerAdd(scintillaEditor.LineFromPosition(scintillaEditor.CurrentPos),
(int)Scintilla.Enums.MarkerOutline.Folder);

Still working with MarkerPrevious and MarkerNext. I am not clear with the second parameter passed to these method.
Jun 1, 2007 at 1:52 PM
Any luck on figuring this all out?
Jun 2, 2007 at 10:34 AM

cuppm wrote:
Any luck on figuring this all out?


No Luck Sir.

This code is working fine for bookmark alone but when used along with folding it does not work properly.
Reason being i have used Scintilla.Enums.MarkerOutline.Folder as a first parameter to
scintillaEditor.MarkerDefine((int)Scintilla.Enums.MarkerOutline.Folder,Scintilla.Enums.MarkerSymbol.Arrow );
which is reserved for folding symbol.

//Marker Number could be any number between 0 - 31 where 25 - 31 are reservered for folding symbols.
If i use any marker number between 0 - 25 book mark does not work.
I could not understand why this is happening. Any Help ??
Jun 4, 2007 at 10:24 PM
I was able to use the following code to successfully navigate to the next bookmark:

int i = scintillaEditor.MarkerNext(scintillaEditor.LineFromPosition(scintillaEditor.CurrentPos) + 1, 1073741824);
if (i != -1)
{
scintillaEditor.GotoLine(i);
}

The second argument for MarkerNext and MarkerPrevious is a bitmask representing the MarkerSymbol you want to look for. It seems that the MarkerDefine method defines which symbol is associated with which bit in the mask. Anyway when you're searching for a marker, you need to set all the bit flags for each symbol you've defined that you want to search for. 1073741824 sets only the first bit to 1, leaving the rest 0. That way it will only find matches where the MarkerSymbol was the first one defined (in this case the Arrow).

As for why using marker numbers between 0-25 doesn't work, I have no clue. Maybe it's buried in the Scintilla documentation?

Hopefully this all makes sense. I'm fighting with a headache right now and it's a bit hard to concentrate.