Martin Vermeer wrote:
On Wed, 2007-01-17 at 13:36 +0100, Abdelrazak Younes wrote:
...
ID Sev Pri Plt Owner State Result Summary
675 maj P2 Oth [EMAIL PROTECTED] REOP avoid insertion of figure in
caption environment
There are two proposed patches for this, one fix-up, and one caption
inset based, more fundamental one. Both are with Georg like so many
other things...
Here the "right" one. It is so short that I am tempted to commit it and
fix the remaining drawing issues.
Abdel.
Index: buffer_funcs.C
===================================================================
--- buffer_funcs.C (revision 16724)
+++ buffer_funcs.C (working copy)
@@ -38,6 +38,7 @@
#include "frontends/Alert.h"
#include "insets/insetbibitem.h"
+#include "insets/insetcaption.h"
#include "insets/insetinclude.h"
#include "support/filetools.h"
@@ -477,7 +478,8 @@
par.params().labelString(
par.translateIfPossible(layout->labelstring(),
buf.params()));
// In biblio shouldn't be following counters but...
- } else if (layout->labeltype == LABEL_SENSITIVE) {
+ } else if (!par.insetlist.empty() &&
+ par.insetlist.begin()->inset->lyxCode() ==
InsetBase::CAPTION_CODE) {
// Search for the first float or wrap inset in the iterator
size_t i = it.depth();
InsetBase * in;
@@ -493,17 +495,12 @@
if (!type.empty()) {
Floating const & fl =
textclass.floats().getType(to_ascii(type));
// FIXME UNICODE
- counters.step(from_ascii(fl.type()));
-
- // Doesn't work... yet.
- par.params().labelString(par.translateIfPossible(
- bformat(from_ascii("%1$s #:"),
from_utf8(fl.name())),
- buf.params()));
- } else {
- // par->SetLayout(0);
- par.params().labelString(par.translateIfPossible(
- layout->labelstring(), buf.params()));
+ docstring const counter(from_ascii(fl.type()));
+ counters.step(counter);
+ InsetCaption * icap = static_cast<InsetCaption
*>(par.insetlist.begin()->inset);
+ icap->setCount(counters.value(counter));
}
+ par.params().labelString(docstring());
} else if (layout->labeltype == LABEL_NO_LABEL)
par.params().labelString(docstring());
Index: text3.C
===================================================================
--- text3.C (revision 16724)
+++ text3.C (working copy)
@@ -1125,8 +1125,8 @@
#if 0
case LFUN_LIST_INSERT:
case LFUN_THEOREM_INSERT:
- case LFUN_CAPTION_INSERT:
#endif
+ case LFUN_CAPTION_INSERT:
case LFUN_NOTE_INSERT:
case LFUN_CHARSTYLE_INSERT:
case LFUN_BOX_INSERT:
@@ -1157,9 +1157,8 @@
case LFUN_WRAP_INSERT:
doInsertInset(cur, this, cmd, true, true);
cur.posRight();
- // FIXME: the "Caption" name should not be hardcoded,
- // but given by the float definition.
- cur.dispatch(FuncRequest(LFUN_LAYOUT, "Caption"));
+ cur.dispatch(FuncRequest(LFUN_CAPTION_INSERT));
+ updateLabels(cur.buffer());
break;
case LFUN_INDEX_INSERT: