mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-29 05:01:49 +00:00
No need to use \fcolorbox with explicit black frame and no background
White background, however, is always treated explicit (think non-white page background)
This commit is contained in:
parent
2854355fe3
commit
343a9749ab
@ -430,9 +430,11 @@ void InsetBox::latex(otexstream & os, OutputParams const & runparams) const
|
|||||||
if (separation_string != defaultSep && thickness_string == defaultThick)
|
if (separation_string != defaultSep && thickness_string == defaultThick)
|
||||||
os << "{\\fboxsep " << from_ascii(separation_string);
|
os << "{\\fboxsep " << from_ascii(separation_string);
|
||||||
if (!params_.inner_box && !width_string.empty()) {
|
if (!params_.inner_box && !width_string.empty()) {
|
||||||
if (params_.framecolor != "default" || params_.backgroundcolor != "none") {
|
if (useFColorBox()) {
|
||||||
os << maybeBeginL << "\\fcolorbox{" << getFrameColor() << "}{" << getBackgroundColor() << "}{";
|
os << maybeBeginL
|
||||||
os << "\\makebox";
|
<< "\\fcolorbox{" << getFrameColor()
|
||||||
|
<< "}{" << getBackgroundColor()
|
||||||
|
<< "}{" << "\\makebox";
|
||||||
needEndL = !maybeBeginL.empty();
|
needEndL = !maybeBeginL.empty();
|
||||||
} else
|
} else
|
||||||
os << "\\framebox";
|
os << "\\framebox";
|
||||||
@ -449,8 +451,10 @@ void InsetBox::latex(otexstream & os, OutputParams const & runparams) const
|
|||||||
if (params_.hor_pos != 'c')
|
if (params_.hor_pos != 'c')
|
||||||
os << "[" << params_.hor_pos << "]";
|
os << "[" << params_.hor_pos << "]";
|
||||||
} else {
|
} else {
|
||||||
if (params_.framecolor != "default" || params_.backgroundcolor != "none") {
|
if (useFColorBox()) {
|
||||||
os << maybeBeginL << "\\fcolorbox{" << getFrameColor() << "}{" << getBackgroundColor() << "}";
|
os << maybeBeginL
|
||||||
|
<< "\\fcolorbox{" << getFrameColor()
|
||||||
|
<< "}{" << getBackgroundColor() << "}";
|
||||||
needEndL = !maybeBeginL.empty();
|
needEndL = !maybeBeginL.empty();
|
||||||
} else {
|
} else {
|
||||||
if (!cprotect.empty() && contains(runparams.active_chars, '^')) {
|
if (!cprotect.empty() && contains(runparams.active_chars, '^')) {
|
||||||
@ -616,8 +620,7 @@ void InsetBox::latex(otexstream & os, OutputParams const & runparams) const
|
|||||||
break;
|
break;
|
||||||
case Boxed:
|
case Boxed:
|
||||||
os << "}";
|
os << "}";
|
||||||
if (!params_.inner_box && !width_string.empty()
|
if (!params_.inner_box && !width_string.empty() && useFColorBox())
|
||||||
&& (params_.framecolor != "default" || params_.backgroundcolor != "none"))
|
|
||||||
os << "}";
|
os << "}";
|
||||||
if (separation_string != defaultSep || thickness_string != defaultThick)
|
if (separation_string != defaultSep || thickness_string != defaultThick)
|
||||||
os << "}";
|
os << "}";
|
||||||
@ -810,8 +813,8 @@ void InsetBox::validate(LaTeXFeatures & features) const
|
|||||||
break;
|
break;
|
||||||
case Boxed:
|
case Boxed:
|
||||||
features.require("calc");
|
features.require("calc");
|
||||||
if (params_.framecolor != "default" || params_.backgroundcolor != "none")
|
if (useFColorBox())
|
||||||
// \fcolorbox, which is part of (x)color, is used
|
// \fcolorbox is provided by [x]color
|
||||||
features.require("xcolor");
|
features.require("xcolor");
|
||||||
break;
|
break;
|
||||||
case ovalbox:
|
case ovalbox:
|
||||||
@ -892,6 +895,15 @@ string const InsetBox::getBackgroundColor() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool InsetBox::useFColorBox() const
|
||||||
|
{
|
||||||
|
// we only need an \fcolorbox if the framecolor is something else
|
||||||
|
// than black in the output or if the backgroundcolor is not none
|
||||||
|
// (also needed with white, consider non-white page coloring)
|
||||||
|
return getFrameColor() != "black" || params_.backgroundcolor != "none";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// InsetBoxParams
|
// InsetBoxParams
|
||||||
|
@ -167,6 +167,8 @@ private:
|
|||||||
std::string const getFrameColor(bool const gui = false) const;
|
std::string const getFrameColor(bool const gui = false) const;
|
||||||
///
|
///
|
||||||
std::string const getBackgroundColor() const;
|
std::string const getBackgroundColor() const;
|
||||||
|
///
|
||||||
|
bool useFColorBox() const;
|
||||||
|
|
||||||
///
|
///
|
||||||
friend class InsetBoxParams;
|
friend class InsetBoxParams;
|
||||||
|
Loading…
Reference in New Issue
Block a user