* add "List of Graphics"

* don't append "(embedded)" to embedded list items.
* limit the number of entry to 30 items and offer to open the Navigator if above.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23659 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2008-03-11 10:27:33 +00:00
parent f53467871f
commit 04e46436ad
5 changed files with 49 additions and 18 deletions

View File

@ -145,7 +145,8 @@ bool GuiToc::initialiseParams(string const & data)
new_type = "table";
else if (str.contains("\"algorithm"))
new_type = "algorithm";
}
} else
new_type = toqstr(data);
types_.clear();
type_names_.clear();
@ -225,6 +226,8 @@ docstring GuiToc::guiName(string const & type) const
return _("Child Documents");
if (type == "embedded")
return _("Embedded Files");
if (type == "graphics")
return _("List of Graphics");
if (type == "equation")
return _("List of Equations");
if (type == "footnote")

View File

@ -904,15 +904,6 @@ void MenuDefinition::expandToc(Buffer const * buf)
if (cit->first == "tableofcontents")
continue;
// All the rest is for floats
MenuDefinition submenu;
TocIterator ccit = cit->second.begin();
TocIterator eend = cit->second.end();
for (; ccit != eend; ++ccit) {
QString const label = limitStringLength(ccit->str());
submenu.add(MenuItem(MenuItem::Command, label,
FuncRequest(ccit->action())));
}
string const & floatName = floatlist.getType(cit->first).listName();
QString label;
bool in_other_list = true;
@ -925,6 +916,8 @@ void MenuDefinition::expandToc(Buffer const * buf)
in_other_list = false;
} else if (cit->first == "embedded")
label = qt_("Embedded Files");
else if (cit->first == "graphics")
label = qt_("List of Graphics");
else if (cit->first == "equation")
label = qt_("List of Equations");
else if (cit->first == "index")
@ -945,6 +938,21 @@ void MenuDefinition::expandToc(Buffer const * buf)
// This should not happen unless the entry is missing above.
label = qt_("Other floats: ") + toqstr(cit->first);
MenuDefinition submenu;
if (cit->second.size() >= 30) {
FuncRequest f(LFUN_DIALOG_SHOW, "toc " + cit->first);
submenu.add(MenuItem(MenuItem::Command, qt_("Open Navigator..."), f));
} else {
TocIterator ccit = cit->second.begin();
TocIterator eend = cit->second.end();
for (; ccit != eend; ++ccit) {
QString const label = limitStringLength(ccit->str());
submenu.add(MenuItem(MenuItem::Command, label,
FuncRequest(ccit->action())));
}
}
MenuItem item(MenuItem::Submenu, label);
item.setSubmenu(submenu);
if (in_other_list)

View File

@ -54,6 +54,7 @@ TODO
#include "Converter.h"
#include "Cursor.h"
#include "DispatchResult.h"
#include "EmbeddedFiles.h"
#include "ErrorList.h"
#include "Exporter.h"
#include "Format.h"
@ -66,7 +67,7 @@ TODO
#include "Mover.h"
#include "OutputParams.h"
#include "sgml.h"
#include "EmbeddedFiles.h"
#include "TocBackend.h"
#include "frontends/alert.h"
@ -915,6 +916,19 @@ void InsetGraphics::editGraphics(InsetGraphicsParams const & p,
}
void InsetGraphics::addToToc(ParConstIterator const & cpit) const
{
TocBackend & backend = buffer().tocBackend();
docstring str = params_.filename.displayName();
if (params_.filename.embedded()) {
backend.toc("embedded").push_back(TocItem(cpit, 0, str));
str += _(" (embedded)");
}
backend.toc("graphics").push_back(TocItem(cpit, 0, str));
}
string const InsetGraphicsMailer::name_("graphics");
InsetGraphicsMailer::InsetGraphicsMailer(InsetGraphics & inset)

View File

@ -34,6 +34,7 @@ public:
///
~InsetGraphics();
///
bool isLabeled() const { return true; }
void metrics(MetricsInfo &, Dimension &) const;
///
EDITABLE editable() const;
@ -79,6 +80,9 @@ public:
void registerEmbeddedFiles(EmbeddedFileList &) const;
///
void updateEmbeddedFile(EmbeddedFile const &);
///
void addToToc(ParConstIterator const &) const;
/// Force inset into LTR environment if surroundings are RTL?
virtual bool forceLTR() const { return true; }
protected:

View File

@ -875,13 +875,15 @@ void InsetInclude::addToToc(ParConstIterator const & cpit) const
if (caption.empty())
return;
Toc & toc = backend.toc("listing");
docstring const str = convert<docstring>(toc.size() + 1)
docstring str = convert<docstring>(toc.size() + 1)
+ ". " + from_utf8(caption);
if (embedded_status) {
backend.toc("embedded").push_back(TocItem(cpit, 0, str));
str += _(" (embedded)");
}
ParConstIterator pit = cpit;
pit.push_back(*this);
toc.push_back(TocItem(pit, 0, str));
if (embedded_status)
backend.toc("embedded").push_back(TocItem(cpit, 0, str));
return;
}
Buffer const * const childbuffer = getChildBuffer(buffer(), params());
@ -895,11 +897,11 @@ void InsetInclude::addToToc(ParConstIterator const & cpit) const
Toc & toc = backend.toc("child");
docstring str = childbuffer->fileName().displayName();
if (embedded_status)
str += _(" (embedded)");
toc.push_back(TocItem(cpit, 0, str));
if (embedded_status)
if (embedded_status) {
backend.toc("embedded").push_back(TocItem(cpit, 0, str));
str += _(" (embedded)");
}
toc.push_back(TocItem(cpit, 0, str));
TocList & toclist = backend.tocs();
TocList const & childtoclist = childbuffer->tocBackend().tocs();