From 22ae5c8873f21d9455f464c4701c05ac5d4f2034 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Thu, 4 Apr 2002 14:39:55 +0000 Subject: [PATCH] proper support for "List of XXX" insets; fix error when there is a list of algorithms but no algorithm git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3903 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 14 ++++++++++++++ src/FloatList.C | 9 ++++++--- src/Floating.C | 10 ++++++++-- src/Floating.h | 6 +++++- src/MenuBackend.C | 6 +++--- src/insets/ChangeLog | 6 ++++++ src/insets/insetfloatlist.C | 14 ++++++++++---- src/insets/insetfloatlist.h | 2 ++ 8 files changed, 54 insertions(+), 13 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 36b4607739..986e02e69f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,17 @@ +2002-04-04 Jean-Marc Lasgouttes + + * MenuBackend.C (expand): use Floating::listName + + * FloatList.C (FloatList): add listName argument to the built-in + floats + + * Floating.[Ch]: add listName member, which is the 'List of XXX' + text associated with the float. + +2002-04-03 Jean-Marc Lasgouttes + + * MenuBackend.C (expand): change label "Wide xxx" to "xxx (wide)". + 2002-04-03 Lars Gullik Bjønnes * ShareContainer.h: add a couple of missing typenames. diff --git a/src/FloatList.C b/src/FloatList.C index c3b45c5017..61d0aadff7 100644 --- a/src/FloatList.C +++ b/src/FloatList.C @@ -30,19 +30,22 @@ FloatList::FloatList() // (these will later be read from a layout file) // table - Floating table("table", "htbp", "lot", "", "plain", N_("Table"), true); + Floating table("table", "htbp", "lot", "", "plain", N_("Table"), + N_("List of Tables"), true); newFloat(table); // figure Floating figure("figure", "htbp", "lof", - "", "plain", N_("Figure"), true); + "", "plain", N_("Figure"), + N_("List of Figures"), true); newFloat(figure); // And we add algorithm too since LyX has // supported that for a long time, // but support for this should probably be moved to a layout file. Floating algorithm("algorithm", "htbp", "loa", - "", "ruled", N_("Algorithm")); + "", "ruled", N_("Algorithm"), + N_("List of Algorithms")); newFloat(algorithm); } diff --git a/src/Floating.C b/src/Floating.C index e4e528014e..61a269ef1c 100644 --- a/src/Floating.C +++ b/src/Floating.C @@ -24,9 +24,9 @@ Floating::Floating() Floating::Floating(string const & type, string const & placement, string const & ext, string const & within, string const & style, string const & name, - bool builtin) + string const & listName, bool builtin) : type_(type), placement_(placement), ext_(ext), within_(within), - style_(style), name_(name), builtin_(builtin) + style_(style), name_(name), listName_(listName), builtin_(builtin) {} @@ -66,6 +66,12 @@ string const & Floating::name() const } +string const & Floating::listName() const +{ + return listName_; +} + + bool Floating::builtin() const { return builtin_; diff --git a/src/Floating.h b/src/Floating.h index 2f0e5270f6..6f65b1162b 100644 --- a/src/Floating.h +++ b/src/Floating.h @@ -32,7 +32,7 @@ public: Floating(string const & type, string const & placement, string const & ext, string const & within, string const & style, string const & name, - bool builtin = false); + string const & listName, bool builtin = false); /// string const & type() const; /// @@ -46,6 +46,8 @@ public: /// string const & name() const; /// + string const & listName() const; + /// bool builtin() const; private: /// @@ -61,6 +63,8 @@ private: /// string name_; /// + string listName_; + /// bool builtin_; }; diff --git a/src/MenuBackend.C b/src/MenuBackend.C index f094ef3ed8..b852d14c3c 100644 --- a/src/MenuBackend.C +++ b/src/MenuBackend.C @@ -377,9 +377,9 @@ void Menu::expand(Menu & tomenu, Buffer * buf) const int const action = lyxaction .getPseudoAction(LFUN_FLOAT_LIST, cit->second.type()); - string const label = _(cit->second.name()) + _(" List"); tomenu.add(MenuItem(MenuItem::Command, - label, action)); + _(cit->second.listName()), + action)); } } break; @@ -401,7 +401,7 @@ void Menu::expand(Menu & tomenu, Buffer * buf) const int const action2 = lyxaction .getPseudoAction(LFUN_INSET_WIDE_FLOAT, cit->second.type()); - string const label2 = _("Wide ") + label; + string const label2 = label + _(" (wide)"); tomenu.add(MenuItem(MenuItem::Command, label2, action2)); } diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index d6ceb93948..3e112a1d9b 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,9 @@ +2002-04-04 Jean-Marc Lasgouttes + + * insetfloatlist.C (getScreenLabel): + (latex): use Floating::listName + (validate): new method + 2002-04-03 José Matos * insetlabel.C (docbook): the anchor is an empty element in docbook. diff --git a/src/insets/insetfloatlist.C b/src/insets/insetfloatlist.C index e40876460e..cb2785b519 100644 --- a/src/insets/insetfloatlist.C +++ b/src/insets/insetfloatlist.C @@ -6,6 +6,7 @@ #include "insetfloatlist.h" #include "FloatList.h" +#include "LaTeXFeatures.h" #include "frontends/Dialogs.h" #include "LyXView.h" #include "BufferView.h" @@ -33,10 +34,9 @@ InsetFloatList::InsetFloatList(string const & type) string const InsetFloatList::getScreenLabel(Buffer const *) const { - string const guiName = floatList[getCmdName()]->second.name(); + string const guiName = floatList[getCmdName()]->second.listName(); if (!guiName.empty()) { - string const res = _(guiName) + _(" List"); - return res; + return _(guiName); } return _("ERROR: Nonexistent float type!"); } @@ -105,7 +105,7 @@ int InsetFloatList::latex(Buffer const *, ostream & os, bool, bool) const } } else { os << "\\listof{" << getCmdName() << "}{" - << _("List of ") << cit->second.name() << "}\n"; + << cit->second.listName() << "}\n"; } } else { os << "%%\\listof{" << getCmdName() << "}{" @@ -133,3 +133,9 @@ int InsetFloatList::ascii(Buffer const * buffer, ostream & os, int) const os << "\n"; return 0; } + + +void InsetFloatList::validate(LaTeXFeatures & features) const +{ + features.useFloat(getCmdName()); +} diff --git a/src/insets/insetfloatlist.h b/src/insets/insetfloatlist.h index bde0436c43..7452a2448e 100644 --- a/src/insets/insetfloatlist.h +++ b/src/insets/insetfloatlist.h @@ -54,6 +54,8 @@ public: int docbook(Buffer const *, std::ostream &) const { return 0; } /// int ascii(Buffer const *, std::ostream &, int linelen) const; + /// + void validate(LaTeXFeatures & features) const; }; #endif -- 2.39.2