mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Fix insetwrap
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5339 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
51b7adb110
commit
36617cee5f
@ -1,3 +1,7 @@
|
||||
2002-09-24 Dekel Tsur <dekelts@tau.ac.il>
|
||||
|
||||
* toc.C (getTocList): Get TOC from InsetWrap.
|
||||
|
||||
2002-09-16 John Levon <levon@movementarian.org>
|
||||
|
||||
* lyxfunc.C: check tabular for cut/copy too
|
||||
|
@ -1,3 +1,8 @@
|
||||
2002-09-24 Dekel Tsur <dekelts@tau.ac.il>
|
||||
|
||||
* insetwrap.C (addToToc): New method.
|
||||
(InsetWrap): Set layout to caption.
|
||||
|
||||
2002-09-24 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* Makefile.am (INCLUDES): loose SIGC_INCLUDES
|
||||
|
@ -28,16 +28,34 @@
|
||||
#include "frontends/LyXView.h"
|
||||
#include "frontends/Dialogs.h"
|
||||
#include "lyxlex.h"
|
||||
#include "FloatList.h"
|
||||
|
||||
using std::ostream;
|
||||
using std::endl;
|
||||
|
||||
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();
|
||||
FloatList::const_iterator it = floats[type];
|
||||
if (it == floats.end())
|
||||
return type;
|
||||
|
||||
return _(it->second.name());
|
||||
}
|
||||
|
||||
} // namespace anon
|
||||
|
||||
|
||||
InsetWrap::InsetWrap(BufferParams const & bp, string const & type)
|
||||
: InsetCollapsable(bp), width_(50, LyXLength::PCW)
|
||||
{
|
||||
string lab(_("wrap"));
|
||||
lab += type;
|
||||
string lab(_("wrap: "));
|
||||
lab += floatname(type, bp);
|
||||
setLabel(lab);
|
||||
LyXFont font(LyXFont::ALL_SANE);
|
||||
font.decSize();
|
||||
@ -46,6 +64,9 @@ InsetWrap::InsetWrap(BufferParams const & bp, string const & type)
|
||||
setLabelFont(font);
|
||||
Type_ = type;
|
||||
setInsetName(type);
|
||||
LyXTextClass const & tclass = bp.getLyXTextClass();
|
||||
if (tclass.hasLayout(caplayout))
|
||||
inset.paragraph()->layout(tclass[caplayout]);
|
||||
}
|
||||
|
||||
|
||||
@ -229,3 +250,22 @@ bool InsetWrap::showInsetDialog(BufferView * bv) const
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void InsetWrap::addToToc(toc::TocList & toclist, Buffer const * buf) const
|
||||
{
|
||||
// Now find the caption in the float...
|
||||
// We now tranverse the paragraphs of
|
||||
// the inset...
|
||||
Paragraph * tmp = inset.paragraph();
|
||||
while (tmp) {
|
||||
if (tmp->layout()->name() == caplayout) {
|
||||
string const str =
|
||||
tostr(toclist[type()].size() + 1)
|
||||
+ ". " + tmp->asString(buf, false);
|
||||
toc::TocItem const item(tmp, 0 , str);
|
||||
toclist[type()].push_back(item);
|
||||
}
|
||||
tmp = tmp->next();
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
#endif
|
||||
|
||||
#include "insetcollapsable.h"
|
||||
#include "toc.h"
|
||||
#include "lyxlength.h"
|
||||
|
||||
#include <boost/signals/signal0.hpp>
|
||||
@ -64,6 +65,8 @@ public:
|
||||
///
|
||||
string const & placement() const;
|
||||
///
|
||||
void addToToc(toc::TocList &, Buffer const *) const;
|
||||
///
|
||||
bool showInsetDialog(BufferView *) const;
|
||||
///
|
||||
boost::signal0<void> hideDialog;
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "LyXAction.h"
|
||||
#include "paragraph.h"
|
||||
#include "insets/insetfloat.h"
|
||||
#include "insets/insetwrap.h"
|
||||
#include "debug.h"
|
||||
|
||||
using std::vector;
|
||||
@ -91,7 +92,7 @@ TocList const getTocList(Buffer const * buf)
|
||||
}
|
||||
|
||||
// For each paragraph, traverse its insets and look for
|
||||
// FLOAT_CODE
|
||||
// FLOAT_CODE or WRAP_CODE
|
||||
InsetList::iterator it = par->insetlist.begin();
|
||||
InsetList::iterator end = par->insetlist.end();
|
||||
for (; it != end; ++it) {
|
||||
@ -99,6 +100,10 @@ TocList const getTocList(Buffer const * buf)
|
||||
InsetFloat * il =
|
||||
static_cast<InsetFloat*>(it.getInset());
|
||||
il->addToToc(toclist, buf);
|
||||
} else if (it.getInset()->lyxCode() == Inset::WRAP_CODE) {
|
||||
InsetWrap * il =
|
||||
static_cast<InsetWrap*>(it.getInset());
|
||||
il->addToToc(toclist, buf);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user