From d1bf49434eb4e25ba0ed9f230125bc17b1afbd30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Thu, 16 Mar 2006 14:03:29 +0000 Subject: [PATCH] Get a sensible prefix inside figure and tabular floats (bug 1999). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_4_X@13393 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 5 +++++ src/text.C | 21 +++++++++++++++++++-- status.14x | 2 ++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index f71f0eb012..f7181d8ca6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2006-03-16 Jürgen Spitzmüller + + * text.C (getPossibleLabel): get a sensible prefix inside figure and + tabular floats (bug 1999). + 2006-03-16 John Spray * lyxfunc.C (getStatus): disable LFUN_MENUWRITE when document is diff --git a/src/text.C b/src/text.C index 3e3c2afea3..744de94816 100644 --- a/src/text.C +++ b/src/text.C @@ -2264,8 +2264,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 += ':'; diff --git a/status.14x b/status.14x index d388c39880..003822d5b2 100644 --- a/status.14x +++ b/status.14x @@ -41,6 +41,8 @@ What's new - Fix jurabib error with Spanish documents (bug 2365). +- More sensible default label in table and figure captions (bug 1999). + - Do not skip change in "Merge changes..." dialog (bug 2212). - Improve handling of the labeling environment in KOMA letters (bug 2246).