remove harcoding for Caption layout

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9828 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2005-04-19 08:55:19 +00:00
parent 1b2e0411ef
commit e609bd9925
3 changed files with 16 additions and 16 deletions

View File

@ -1,3 +1,10 @@
2005-04-14 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* insetwrap.C (addToToc): copy the code from InsetFloat::addToToc.
* insetfloat.C (addToToc): do not use the harcoded "Caption" name,
but the SENSITIVE label type.
2005-04-18 Angus Leeming <leeming@lyx.org>
* ExternalSupport.[Ch] (doSubstitution): passed an extra boolean

View File

@ -114,10 +114,6 @@ using std::ostringstream;
namespace {
// this should not be hardcoded, but be part of the definition
// of the float (JMarc)
string const caplayout("Caption");
string floatname(string const & type, BufferParams const & bp)
{
FloatList const & floats = bp.getLyXTextClass().floats();
@ -421,7 +417,7 @@ void InsetFloat::addToToc(lyx::toc::TocList & toclist, Buffer const & buf) const
// Find a caption layout in one of the (child inset's) pars
for (; pit != end; ++pit) {
if (pit->layout()->name() == caplayout) {
if (pit->layout()->labeltype == LABEL_SENSITIVE) {
string const name = floatname(params_.type, buf.params());
string const str =
convert<string>(toclist[name].size() + 1)

View File

@ -27,6 +27,7 @@
#include "lyxlex.h"
#include "outputparams.h"
#include "paragraph.h"
#include "pariterator.h"
#include "support/convert.h"
@ -42,10 +43,6 @@ using std::ostringstream;
namespace {
// this should not be hardcoded, but be part of the definition
// of the float (JMarc)
string const caplayout("Caption");
string floatname(string const & type, BufferParams const & bp)
{
FloatList const & floats = bp.getLyXTextClass().floats();
@ -224,17 +221,17 @@ bool InsetWrap::showInsetDialog(BufferView * bv) const
void InsetWrap::addToToc(lyx::toc::TocList & toclist, Buffer const & buf) const
{
// Now find the caption in the float...
ParagraphList::const_iterator tmp = paragraphs().begin();
ParagraphList::const_iterator end = paragraphs().end();
ParConstIterator pit = par_const_iterator_begin(*this);
ParConstIterator end = par_const_iterator_end(*this);
for (; tmp != end; ++tmp) {
if (tmp->layout()->name() == caplayout) {
// Find a caption layout in one of the (child inset's) pars
for (; pit != end; ++pit) {
if (pit->layout()->labeltype == LABEL_SENSITIVE) {
string const name = floatname(params_.type, buf.params());
string const str =
convert<string>(toclist[name].size() + 1)
+ ". " + tmp->asString(buf, false);
lyx::toc::TocItem const item(tmp->id(), 0 , str);
+ ". " + pit->asString(buf, false);
lyx::toc::TocItem const item(pit->id(), 0 , str);
toclist[name].push_back(item);
}
}