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
This commit is contained in:
Jean-Marc Lasgouttes 2002-04-04 14:39:55 +00:00
parent c70e6fea61
commit 22ae5c8873
8 changed files with 54 additions and 13 deletions

View File

@ -1,3 +1,17 @@
2002-04-04 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* 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 <lasgouttes@freesurf.fr>
* MenuBackend.C (expand): change label "Wide xxx" to "xxx (wide)".
2002-04-03 Lars Gullik Bjønnes <larsbj@birdstep.com> 2002-04-03 Lars Gullik Bjønnes <larsbj@birdstep.com>
* ShareContainer.h: add a couple of missing typenames. * ShareContainer.h: add a couple of missing typenames.

View File

@ -30,19 +30,22 @@ FloatList::FloatList()
// (these will later be read from a layout file) // (these will later be read from a layout file)
// table // 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); newFloat(table);
// figure // figure
Floating figure("figure", "htbp", "lof", Floating figure("figure", "htbp", "lof",
"", "plain", N_("Figure"), true); "", "plain", N_("Figure"),
N_("List of Figures"), true);
newFloat(figure); newFloat(figure);
// And we add algorithm too since LyX has // And we add algorithm too since LyX has
// supported that for a long time, // supported that for a long time,
// but support for this should probably be moved to a layout file. // but support for this should probably be moved to a layout file.
Floating algorithm("algorithm", "htbp", "loa", Floating algorithm("algorithm", "htbp", "loa",
"", "ruled", N_("Algorithm")); "", "ruled", N_("Algorithm"),
N_("List of Algorithms"));
newFloat(algorithm); newFloat(algorithm);
} }

View File

@ -24,9 +24,9 @@ Floating::Floating()
Floating::Floating(string const & type, string const & placement, Floating::Floating(string const & type, string const & placement,
string const & ext, string const & within, string const & ext, string const & within,
string const & style, string const & name, string const & style, string const & name,
bool builtin) string const & listName, bool builtin)
: type_(type), placement_(placement), ext_(ext), within_(within), : 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 bool Floating::builtin() const
{ {
return builtin_; return builtin_;

View File

@ -32,7 +32,7 @@ public:
Floating(string const & type, string const & placement, Floating(string const & type, string const & placement,
string const & ext, string const & within, string const & ext, string const & within,
string const & style, string const & name, string const & style, string const & name,
bool builtin = false); string const & listName, bool builtin = false);
/// ///
string const & type() const; string const & type() const;
/// ///
@ -46,6 +46,8 @@ public:
/// ///
string const & name() const; string const & name() const;
/// ///
string const & listName() const;
///
bool builtin() const; bool builtin() const;
private: private:
/// ///
@ -61,6 +63,8 @@ private:
/// ///
string name_; string name_;
/// ///
string listName_;
///
bool builtin_; bool builtin_;
}; };

View File

@ -377,9 +377,9 @@ void Menu::expand(Menu & tomenu, Buffer * buf) const
int const action = lyxaction int const action = lyxaction
.getPseudoAction(LFUN_FLOAT_LIST, .getPseudoAction(LFUN_FLOAT_LIST,
cit->second.type()); cit->second.type());
string const label = _(cit->second.name()) + _(" List");
tomenu.add(MenuItem(MenuItem::Command, tomenu.add(MenuItem(MenuItem::Command,
label, action)); _(cit->second.listName()),
action));
} }
} }
break; break;
@ -401,7 +401,7 @@ void Menu::expand(Menu & tomenu, Buffer * buf) const
int const action2 = lyxaction int const action2 = lyxaction
.getPseudoAction(LFUN_INSET_WIDE_FLOAT, .getPseudoAction(LFUN_INSET_WIDE_FLOAT,
cit->second.type()); cit->second.type());
string const label2 = _("Wide ") + label; string const label2 = label + _(" (wide)");
tomenu.add(MenuItem(MenuItem::Command, tomenu.add(MenuItem(MenuItem::Command,
label2, action2)); label2, action2));
} }

View File

@ -1,3 +1,9 @@
2002-04-04 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* insetfloatlist.C (getScreenLabel):
(latex): use Floating::listName
(validate): new method
2002-04-03 José Matos <jamatos@fep.up.pt> 2002-04-03 José Matos <jamatos@fep.up.pt>
* insetlabel.C (docbook): the anchor is an empty element in docbook. * insetlabel.C (docbook): the anchor is an empty element in docbook.

View File

@ -6,6 +6,7 @@
#include "insetfloatlist.h" #include "insetfloatlist.h"
#include "FloatList.h" #include "FloatList.h"
#include "LaTeXFeatures.h"
#include "frontends/Dialogs.h" #include "frontends/Dialogs.h"
#include "LyXView.h" #include "LyXView.h"
#include "BufferView.h" #include "BufferView.h"
@ -33,10 +34,9 @@ InsetFloatList::InsetFloatList(string const & type)
string const InsetFloatList::getScreenLabel(Buffer const *) const string const InsetFloatList::getScreenLabel(Buffer const *) const
{ {
string const guiName = floatList[getCmdName()]->second.name(); string const guiName = floatList[getCmdName()]->second.listName();
if (!guiName.empty()) { if (!guiName.empty()) {
string const res = _(guiName) + _(" List"); return _(guiName);
return res;
} }
return _("ERROR: Nonexistent float type!"); return _("ERROR: Nonexistent float type!");
} }
@ -105,7 +105,7 @@ int InsetFloatList::latex(Buffer const *, ostream & os, bool, bool) const
} }
} else { } else {
os << "\\listof{" << getCmdName() << "}{" os << "\\listof{" << getCmdName() << "}{"
<< _("List of ") << cit->second.name() << "}\n"; << cit->second.listName() << "}\n";
} }
} else { } else {
os << "%%\\listof{" << getCmdName() << "}{" os << "%%\\listof{" << getCmdName() << "}{"
@ -133,3 +133,9 @@ int InsetFloatList::ascii(Buffer const * buffer, ostream & os, int) const
os << "\n"; os << "\n";
return 0; return 0;
} }
void InsetFloatList::validate(LaTeXFeatures & features) const
{
features.useFloat(getCmdName());
}

View File

@ -54,6 +54,8 @@ public:
int docbook(Buffer const *, std::ostream &) const { return 0; } int docbook(Buffer const *, std::ostream &) const { return 0; }
/// ///
int ascii(Buffer const *, std::ostream &, int linelen) const; int ascii(Buffer const *, std::ostream &, int linelen) const;
///
void validate(LaTeXFeatures & features) const;
}; };
#endif #endif