]> git.lyx.org Git - features.git/commitdiff
Get a sensible prefix inside figure and tabular floats (bug 1999).
authorJürgen Spitzmüller <spitz@lyx.org>
Thu, 16 Mar 2006 13:35:53 +0000 (13:35 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Thu, 16 Mar 2006 13:35:53 +0000 (13:35 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13392 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/text.C

index 1c0e9aac38e23eac0198ef85f2c8ae3e875a7cc7..b29558cacca178c4388baa55b30cb479ed65d667 100644 (file)
@@ -1,3 +1,8 @@
+2006-03-16  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
+
+       * text.C (getPossibleLabel): get a sensible prefix inside figure and 
+       tabular floats (bug 1999).
+
 2006-03-16  John Spray  <spray@lyx.org>
 
        * lyxfunc.C (getStatus): disable LFUN_MENUWRITE when document is
index a0f31e80fb3e08f3976001c8b0f5b115eea0b1e1..9746afc7b25d30288466e8e429ddf42dbdc2d48c 100644 (file)
@@ -2321,8 +2321,25 @@ string LyXText::getPossibleLabel(LCursor & cur) const
                }
        }
 
-       string text = layout->latexname().substr(0, 3);
-       if (layout->latexname() == "theorem")
+       string name = layout->latexname();
+
+       // for captions, we want the abbreviation of the float type
+       if (layout->labeltype == LABEL_SENSITIVE) {
+               // Search for the first float or wrap inset in the iterator
+               size_t i = cur.depth();
+               while (i > 0) {
+                       --i;
+                       InsetBase * const in = &cur[i].inset();
+                       if (in->lyxCode() == InsetBase::FLOAT_CODE
+                           || in->lyxCode() == InsetBase::WRAP_CODE) {
+                               name = in->getInsetName();
+                               break;
+                       }
+               }
+       }
+
+       string text = name.substr(0, 3);
+       if (name == "theorem")
                text = "thm"; // Create a correct prefix for prettyref
 
        text += ':';