On Sun, 2006-01-22 at 17:17 +0530, samar j. singh wrote:
> Hi
> 
> I am currently writing a report using Lyx1.4.0pre3 and note that the  
> bookmarks frequently get corrupted. 
> 
> I have tried testing the bookmark when setting it by moving the cursor a few 
> lines away and checking that Ctrl n brings it back to the original position. 
> However, after some minutes of working in other parts of the document I find 
> that I can no longer return to the same position. 
> 
> This used to be a problem prior to 1.3.6 and I wonder if some bug has 
> resurfaced.
> 
> best regards
> 
> samar

I understand this is an old bug. It is caused by the practice of
identifying a paragraph by "id". Every time a new paragraph is created
it gets a new (the next) id number. id's just aren't stable.

I have tried a proof-of-concept for an alternative type of bookmarks.
See the attached. It is based on the existing floats mechanism, and uses
insets as bookmarks. These are stable, and can be named instead of
numbered. Being floats, they end up in the navigation menu.

This is a very rough prototype, but is this the way to go? The nice
thing is that is uses existing infrastructure.

- Martin

Index: src/insets/insetfloat.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetfloat.C,v
retrieving revision 1.141
diff -u -p -r1.141 insetfloat.C
--- src/insets/insetfloat.C	27 Jul 2005 15:22:07 -0000	1.141
+++ src/insets/insetfloat.C	24 Jan 2006 15:29:31 -0000
@@ -131,7 +131,10 @@ string floatname(string const & type, Bu
 InsetFloat::InsetFloat(BufferParams const & bp, string const & type)
 	: InsetCollapsable(bp)
 {
-	setLabel(_("float: ") + floatname(type, bp));
+	if (type == "bookmark")
+		setLabel(floatname(type, bp));
+	else
+	        setLabel(_("float: ") + floatname(type, bp));
 	LyXFont font(LyXFont::ALL_SANE);
 	font.decSize();
 	font.decSize();
@@ -295,6 +298,8 @@ string const InsetFloat::editMessage() c
 int InsetFloat::latex(Buffer const & buf, ostream & os,
 		      OutputParams const & runparams) const
 {
+	if (params_.type == "bookmark")
+		return 0;
 	FloatList const & floats = buf.params().getLyXTextClass().floats();
 	string tmptype = (params_.wide ? params_.type + "*" : params_.type);
 	if (params_.sideways) {
Index: lib/ui/stdmenus.ui
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/ui/stdmenus.ui,v
retrieving revision 1.50
diff -u -p -r1.50 stdmenus.ui
--- lib/ui/stdmenus.ui	24 Jun 2005 10:14:32 -0000	1.50
+++ lib/ui/stdmenus.ui	24 Jan 2006 15:29:31 -0000
@@ -395,7 +395,7 @@ Menuset
 # NAVIGATE MENU
 #
 	Menu "navigate"
-		Submenu "Bookmarks|B" "navigate_bookmarks"
+#		Submenu "Bookmarks|B" "navigate_bookmarks"
 		Item "Next Note|N" "note-next"
 		Item "Go to Label|L" "label-goto"
 		Separator
Index: lib/layouts/stdcounters.inc
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/layouts/stdcounters.inc,v
retrieving revision 1.5
diff -u -p -r1.5 stdcounters.inc
--- lib/layouts/stdcounters.inc	21 Oct 2005 16:11:35 -0000	1.5
+++ lib/layouts/stdcounters.inc	24 Jan 2006 15:29:31 -0000
@@ -76,3 +76,7 @@ End
 Counter
 	Name                 equation
 End
+
+Counter
+	Name                 bookmark
+End
Index: lib/layouts/stdfloats.inc
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/layouts/stdfloats.inc,v
retrieving revision 1.5
diff -u -p -r1.5 stdfloats.inc
--- lib/layouts/stdfloats.inc	21 Oct 2005 16:11:35 -0000	1.5
+++ lib/layouts/stdfloats.inc	24 Jan 2006 15:29:31 -0000
@@ -30,6 +30,18 @@ End
 
 
 Float
+	Type                  bookmark
+	GuiName               Bookmark
+	Placement             none
+	Extension             none
+	NumberWithin          none
+	Style                 none
+	ListName              "Bookmarks"
+	LaTeXBuiltin          false
+End
+
+
+Float
 	Type                  algorithm
 	GuiName               Algorithm
 	Placement             tbp
@@ -39,3 +51,4 @@ Float
 	ListName              "List of Algorithms"
 	LaTeXBuiltin          false
 End
+

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to