mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 10:58:52 +00:00
Add Requires to float definition.
This commit is contained in:
parent
b4e871e9ca
commit
cbfce678d8
@ -18406,6 +18406,46 @@ OFF
|
||||
\end_inset
|
||||
|
||||
, which must be all caps.
|
||||
\change_inserted -712698321 1565605014
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
|
||||
\change_inserted -712698321 1565605014
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -712698321 1565605014
|
||||
Requires
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
[
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -712698321 1565605014
|
||||
string
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
] As with paragraph styles, see
|
||||
\begin_inset CommandInset ref
|
||||
LatexCommand ref
|
||||
reference "subsec:Paragraph-Styles"
|
||||
|
||||
\end_inset
|
||||
|
||||
.
|
||||
\change_unchanged
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
|
@ -16513,6 +16513,36 @@ OFF
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
Requires
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
[
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
string
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
] Wie bei Absatz-Layouts, siehe
|
||||
\begin_inset CommandInset ref
|
||||
LatexCommand ref
|
||||
reference "subsec:Einzelne-Absatz-Layouts"
|
||||
|
||||
\end_inset
|
||||
|
||||
.
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
Style
|
||||
\end_layout
|
||||
|
@ -11,7 +11,7 @@
|
||||
# This script will update a .layout file to current format
|
||||
|
||||
# The latest layout format is also defined in src/TextClass.cpp
|
||||
currentFormat = 79
|
||||
currentFormat = 80
|
||||
|
||||
|
||||
# Incremented to format 4, 6 April 2007, lasgouttes
|
||||
@ -265,6 +265,9 @@ currentFormat = 79
|
||||
# Incremented to format 79, 7 August 2019 by spitz
|
||||
# New textclass tag PagesizeFormat
|
||||
|
||||
# Incremented to format 80, 12 August 2019 by spitz
|
||||
# New float option Requires
|
||||
|
||||
# Do not forget to document format change in Customization
|
||||
# Manual (section "Declaring a new text class").
|
||||
|
||||
@ -514,7 +517,7 @@ def convert(lines, end_format):
|
||||
i += 1
|
||||
continue
|
||||
|
||||
if format >= 65 and format <= 78:
|
||||
if format >= 65 and format <= 79:
|
||||
# nothing to do.
|
||||
i += 1
|
||||
continue
|
||||
|
@ -30,11 +30,12 @@ Floating::Floating(string const & type, string const & placement,
|
||||
string const & listName, std::string const & listCmd,
|
||||
string const & refPrefix, std::string const & allowedplacement,
|
||||
string const & htmlTag, string const & htmlAttrib,
|
||||
docstring const & htmlStyle, bool usesfloat, bool ispredefined,
|
||||
docstring const & htmlStyle, string const & requires,
|
||||
bool usesfloat, bool ispredefined,
|
||||
bool allowswide, bool allowssideways)
|
||||
: floattype_(type), placement_(placement), ext_(ext), within_(within),
|
||||
style_(style), name_(name), listname_(listName), listcommand_(listCmd),
|
||||
refprefix_(refPrefix), allowedplacement_(allowedplacement),
|
||||
refprefix_(refPrefix), allowedplacement_(allowedplacement), requires_(requires),
|
||||
usesfloatpkg_(usesfloat), ispredefined_(ispredefined),
|
||||
allowswide_(allowswide), allowssideways_(allowssideways),
|
||||
html_tag_(htmlTag), html_attrib_(htmlAttrib), html_style_(htmlStyle)
|
||||
|
@ -37,7 +37,8 @@ public:
|
||||
std::string const & listName, std::string const & listCmd,
|
||||
std::string const & refPrefix, std::string const & allowedplacement,
|
||||
std::string const & htmlType, std::string const & htmlClass,
|
||||
docstring const & htmlStyle, bool usesfloat, bool isprefined,
|
||||
docstring const & htmlStyle, std::string const & requires,
|
||||
bool usesfloat, bool isprefined,
|
||||
bool allowswide, bool allowssideways);
|
||||
///
|
||||
std::string const & floattype() const { return floattype_; }
|
||||
@ -64,6 +65,8 @@ public:
|
||||
std::string const & allowedPlacement() const { return allowedplacement_; }
|
||||
///
|
||||
bool usesFloatPkg() const { return usesfloatpkg_; }
|
||||
/// allowed placement options
|
||||
std::string const & requires() const { return requires_; }
|
||||
///
|
||||
bool isPredefined() const { return ispredefined_; }
|
||||
///
|
||||
@ -100,6 +103,8 @@ private:
|
||||
///
|
||||
std::string allowedplacement_;
|
||||
///
|
||||
std::string requires_;
|
||||
///
|
||||
bool usesfloatpkg_;
|
||||
///
|
||||
bool ispredefined_;
|
||||
|
@ -736,8 +736,14 @@ void LaTeXFeatures::useFloat(string const & name, bool subfloat)
|
||||
// use the "H" modifier. This includes modified table and
|
||||
// figure floats. (Lgb)
|
||||
Floating const & fl = params_.documentClass().floats().getType(name);
|
||||
if (!fl.floattype().empty() && fl.usesFloatPkg()) {
|
||||
require("float");
|
||||
if (!fl.floattype().empty()) {
|
||||
if (fl.usesFloatPkg())
|
||||
require("float");
|
||||
if (!fl.requires().empty()) {
|
||||
vector<string> reqs = getVectorFromString(fl.requires());
|
||||
for (auto const req : reqs)
|
||||
require(req);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ namespace lyx {
|
||||
// You should also run the development/tools/updatelayouts.py script,
|
||||
// to update the format of all of our layout files.
|
||||
//
|
||||
int const LAYOUT_FORMAT = 79; // spitz: PagesizeFormat
|
||||
int const LAYOUT_FORMAT = 80; // spitz: Requires for floats
|
||||
|
||||
|
||||
// Layout format for the current lyx file format. Controls which format is
|
||||
@ -1392,7 +1392,8 @@ bool TextClass::readFloat(Lexer & lexrc)
|
||||
FT_REFPREFIX,
|
||||
FT_ALLOWED_PLACEMENT,
|
||||
FT_ALLOWS_SIDEWAYS,
|
||||
FT_ALLOWS_WIDE,
|
||||
FT_ALLOWS_WIDE,
|
||||
FT_REQUIRES,
|
||||
FT_END
|
||||
};
|
||||
|
||||
@ -1412,6 +1413,7 @@ bool TextClass::readFloat(Lexer & lexrc)
|
||||
{ "numberwithin", FT_WITHIN },
|
||||
{ "placement", FT_PLACEMENT },
|
||||
{ "refprefix", FT_REFPREFIX },
|
||||
{ "requires", FT_REQUIRES },
|
||||
{ "style", FT_STYLE },
|
||||
{ "type", FT_TYPE },
|
||||
{ "usesfloatpkg", FT_USESFLOAT }
|
||||
@ -1432,6 +1434,7 @@ bool TextClass::readFloat(Lexer & lexrc)
|
||||
string style;
|
||||
string type;
|
||||
string within;
|
||||
string requires;
|
||||
bool usesfloat = true;
|
||||
bool ispredefined = false;
|
||||
bool allowswide = true;
|
||||
@ -1507,6 +1510,10 @@ bool TextClass::readFloat(Lexer & lexrc)
|
||||
lexrc.next();
|
||||
usesfloat = lexrc.getBool();
|
||||
break;
|
||||
case FT_REQUIRES:
|
||||
lexrc.next();
|
||||
requires = lexrc.getString();
|
||||
break;
|
||||
case FT_PREDEFINED:
|
||||
lexrc.next();
|
||||
ispredefined = lexrc.getBool();
|
||||
@ -1560,8 +1567,8 @@ bool TextClass::readFloat(Lexer & lexrc)
|
||||
}
|
||||
Floating fl(type, placement, ext, within, style, name,
|
||||
listname, listcommand, refprefix, allowed_placement,
|
||||
htmltag, htmlattr, htmlstyle, usesfloat, ispredefined,
|
||||
allowswide, allowssideways);
|
||||
htmltag, htmlattr, htmlstyle, requires, usesfloat,
|
||||
ispredefined, allowswide, allowssideways);
|
||||
floatlist_.newFloat(fl);
|
||||
// each float has its own counter
|
||||
counters_.newCounter(from_ascii(type), from_ascii(within),
|
||||
|
@ -1211,6 +1211,8 @@ void MenuDefinition::expandFloatInsert(Buffer const * buf)
|
||||
FloatList::const_iterator end = floats.end();
|
||||
for (; cit != end; ++cit) {
|
||||
// normal float
|
||||
if (cit->second.name().empty())
|
||||
continue;
|
||||
QString const label = qt_(cit->second.name());
|
||||
addWithStatusCheck(MenuItem(MenuItem::Command, label,
|
||||
FuncRequest(LFUN_FLOAT_INSERT,
|
||||
|
Loading…
Reference in New Issue
Block a user