Add list of labels. If I have the time and energy the next step is to cleanup the cross-reference lookup so that we can integrate the cross references in the tree, hence the name "Labels and References".

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23282 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2008-02-27 15:23:22 +00:00
parent 52a6cc6f7d
commit 39ccaa2ea7
4 changed files with 24 additions and 1 deletions

View File

@ -778,6 +778,8 @@ void expandToc(Menu & tomenu, Buffer const * buf)
label = _("List of Notes");
else if (cit->first == "footnote")
label = _("List of Foot notes");
else if (cit->first == "label")
label = _("Labels and References");
// this should not happen now, but if something else like
// listings is added later, this can avoid an empty menu name.
else

View File

@ -233,6 +233,8 @@ docstring GuiToc::guiName(string const & type) const
return _("List of Marginal notes");
if (type == "note")
return _("List of Notes");
if (type == "label")
return _("Labels and References");
FloatList const & floats = buffer().params().textClass().floats();
if (floats.typeExist(type))

View File

@ -16,8 +16,10 @@
#include "BufferView.h"
#include "DispatchResult.h"
#include "FuncRequest.h"
#include "Text.h"
#include "ParIterator.h"
#include "sgml.h"
#include "Text.h"
#include "TocBackend.h"
#include "support/lstrings.h"
#include "support/lyxalgo.h"
@ -61,6 +63,21 @@ docstring const InsetLabel::getScreenLabel(Buffer const &) const
}
void InsetLabel::addToToc(Buffer const & buf,
ParConstIterator const & cpit) const
{
ParConstIterator pit = cpit;
pit.push_back(*this);
//FIXME: It would be really, really, really nice if we could
// construct a tree here with all the cross-reference to this
// label.
Toc & toc = buf.tocBackend().toc("label");
toc.push_back(TocItem(pit, 0, getScreenLabel(buf)));
}
void InsetLabel::doDispatch(Cursor & cur, FuncRequest & cmd)
{
switch (cmd.action) {

View File

@ -42,6 +42,8 @@ public:
///
static bool isCompatibleCommand(std::string const & s)
{ return s == "label"; }
///
void addToToc(Buffer const &, ParConstIterator const &) const;
protected:
///
virtual void doDispatch(Cursor & cur, FuncRequest & cmd);