]> git.lyx.org Git - features.git/commitdiff
Fix for bug 2951. Adds default fn: prefix tolabels in footnotes.
authorRichard Heck <rgheck@comcast.net>
Tue, 8 May 2007 15:10:08 +0000 (15:10 +0000)
committerRichard Heck <rgheck@comcast.net>
Tue, 8 May 2007 15:10:08 +0000 (15:10 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18235 a592a061-630c-0410-9148-cb99ea01b6c8

src/Text.cpp

index 8a168e8140fa589b31dbfbc7b3486a10c48cad70..7f7a3a140d993dc081d052a72765ea1ca4800a1e 100644 (file)
@@ -1813,20 +1813,29 @@ docstring Text::getPossibleLabel(Cursor & cur) const
        if (caption_inset)
                name = from_ascii(static_cast<InsetCaption *>(caption_inset)->type());
 
-       // Inside floats or wraps, if none of the above worked
-       // we want by default the abbreviation of the float type.
+       // If none of the above worked, we'll see if we're inside various
+       // types of insets and take our abbreviation from them.
        if (name.empty()) {
-               Inset * float_inset = cur.innerInsetOfType(Inset::FLOAT_CODE);
-               if (!float_inset)
-                       float_inset = cur.innerInsetOfType(Inset::WRAP_CODE);
-               if (float_inset)
-                       name = float_inset->name();
+               Inset::Code const codes[] = {
+                       Inset::FLOAT_CODE, 
+                       Inset::WRAP_CODE,
+                       Inset::FOOT_CODE
+               };
+               for (unsigned int i = 0; i < (sizeof codes / sizeof codes[0]); ++i) {
+                       Inset * float_inset = cur.innerInsetOfType(codes[i]);
+                       if (float_inset) {
+                               name = float_inset->name();
+                               break;
+                       }
+               }
        }
-
+       
        // Create a correct prefix for prettyref
        if (name == "theorem")
                name = from_ascii("thm");
-
+       else if (name == "Foot")
+               name = from_ascii("fn");
+               
        if (!name.empty())
                text = name.substr(0, 3) + ':' + text;