From: John Levon Date: Tue, 6 May 2003 06:16:59 +0000 (+0000) Subject: fix bad InsetWrap cast X-Git-Tag: 1.6.10~16850 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=ebdfad1c623d046f545fe06d080025a62ecc403d;p=lyx.git fix bad InsetWrap cast git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6936 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/ChangeLog b/src/ChangeLog index 903eb5b7ab..5a76c667b1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,6 @@ +2003-05-06 John Levon + + * text2.C: don't cast wrap inset to float 2003-05-05 André Pönitz diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 8f663e758a..6e0ebbe8af 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,9 @@ +2003-05-06 John Levon + + * insetcaption.C: don't cast wrap inset to InsetFloat + + * insetfloat.h: + * insetfloat.C: remove unneeded type() function 2003-05-05 André Pönitz diff --git a/src/insets/insetcaption.C b/src/insets/insetcaption.C index 892c1e6132..236017a9c6 100644 --- a/src/insets/insetcaption.C +++ b/src/insets/insetcaption.C @@ -18,10 +18,11 @@ #include "buffer.h" #include "FloatList.h" #include "insets/insetfloat.h" +#include "insets/insetwrap.h" #include "debug.h" #include "gettext.h" #include "support/lstrings.h" - +#include "support/LAssert.h" #include "support/BoostFormat.h" using std::ostream; @@ -78,7 +79,14 @@ void InsetCaption::draw(BufferView * bv, LyXFont const & f, // belongs to. Inset * i1 = owner(); Inset * i2 = i1 ? i1->owner() : 0; - string const type = static_cast(i2)->type(); + string type; + if (i2->lyxCode() == FLOAT_CODE) + type = static_cast(i2)->params().type; + else if (i2->lyxCode() == WRAP_CODE) + type = static_cast(i2)->params().type; + else + lyx::Assert(0); + FloatList const & floats = bv->buffer()->params.getLyXTextClass().floats(); string const fl = i2 ? floats.getType(type).name() : N_("Float"); diff --git a/src/insets/insetfloat.C b/src/insets/insetfloat.C index 4b4e8202ba..93a5dd0a97 100644 --- a/src/insets/insetfloat.C +++ b/src/insets/insetfloat.C @@ -342,12 +342,6 @@ bool InsetFloat::showInsetDialog(BufferView * bv) const } -string const & InsetFloat::type() const -{ - return params_.type; -} - - void InsetFloat::wide(bool w, BufferParams const & bp) { params_.wide = w; @@ -372,7 +366,7 @@ void InsetFloat::addToToc(toc::TocList & toclist, Buffer const * buf) const Paragraph * tmp = *pit; if (tmp->layout()->name() == caplayout) { - string const name = floatname(type(), buf->params); + string const name = floatname(params_.type, buf->params); string const str = tostr(toclist[name].size() + 1) + ". " + tmp->asString(buf, false); diff --git a/src/insets/insetfloat.h b/src/insets/insetfloat.h index 7eb8a54e31..8658f5a6c9 100644 --- a/src/insets/insetfloat.h +++ b/src/insets/insetfloat.h @@ -70,8 +70,6 @@ public: insets that may contain several paragraphs */ bool noFontChange() const { return true; } /// - string const & type() const; - /// void wide(bool w, BufferParams const &); /// void addToToc(toc::TocList &, Buffer const *) const; diff --git a/src/text2.C b/src/text2.C index 8ae8109bbd..cbb515d116 100644 --- a/src/text2.C +++ b/src/text2.C @@ -34,6 +34,7 @@ #include "insets/insetbibitem.h" #include "insets/insetfloat.h" +#include "insets/insetwrap.h" #include "support/LAssert.h" #include "support/textutils.h" @@ -1173,8 +1174,16 @@ void LyXText::setCounter(Buffer const * buf, ParagraphList::iterator pit) } if (isOK) { - Floating const & fl - = textclass.floats().getType(static_cast(in)->type()); + string type; + + if (in->lyxCode() == Inset::FLOAT_CODE) + type = static_cast(in)->params().type; + else if (in->lyxCode() == Inset::WRAP_CODE) + type = static_cast(in)->params().type; + else + lyx::Assert(0); + + Floating const & fl = textclass.floats().getType(type); textclass.counters().step(fl.type());