mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-10 18:58:10 +00:00
Further cleanup of InsetFlex, InsetCollapsable and InsetLayout:
- Getting rid of some unneeded init() methods. - InsetCollapsable::layout_ is now a const pointer. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21396 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
09df753df4
commit
85f80979fc
@ -448,7 +448,7 @@ void switchBetweenClasses(TextClassPtr const & c1,
|
|||||||
InsetFlex & inset =
|
InsetFlex & inset =
|
||||||
static_cast<InsetFlex &>(*it);
|
static_cast<InsetFlex &>(*it);
|
||||||
string const name = inset.params().name;
|
string const name = inset.params().name;
|
||||||
InsetLayout const il =
|
InsetLayout const & il =
|
||||||
tclass2.insetlayout(from_utf8(name));
|
tclass2.insetlayout(from_utf8(name));
|
||||||
inset.setLayout(il);
|
inset.setLayout(il);
|
||||||
if (il.labelstring == from_utf8("UNDEFINED")) {
|
if (il.labelstring == from_utf8("UNDEFINED")) {
|
||||||
|
@ -707,6 +707,9 @@ void TextClass::readInsetLayout(Lexer & lexrc, docstring const & name)
|
|||||||
break;
|
break;
|
||||||
case IL_LABELFONT:
|
case IL_LABELFONT:
|
||||||
labelfont = lyxRead(lexrc, inherit_font);
|
labelfont = lyxRead(lexrc, inherit_font);
|
||||||
|
// The label font is generally used as-is without
|
||||||
|
// any realization against a given context.
|
||||||
|
labelfont.realize(sane_font);
|
||||||
break;
|
break;
|
||||||
case IL_FORCELTR:
|
case IL_FORCELTR:
|
||||||
lexrc.next();
|
lexrc.next();
|
||||||
|
@ -104,8 +104,8 @@ Inset * createInset(BufferView * bv, FuncRequest const & cmd)
|
|||||||
|
|
||||||
case LFUN_FLEX_INSERT: {
|
case LFUN_FLEX_INSERT: {
|
||||||
string s = cmd.getArg(0);
|
string s = cmd.getArg(0);
|
||||||
TextClass tclass = params.getTextClass();
|
TextClass const & tclass = params.getTextClass();
|
||||||
InsetLayout il = tclass.insetlayout(from_utf8(s));
|
InsetLayout const & il = tclass.insetlayout(from_utf8(s));
|
||||||
return new InsetFlex(params, il);
|
return new InsetFlex(params, il);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -392,7 +392,7 @@ Inset * readInset(Lexer & lex, Buffer const & buf)
|
|||||||
|
|
||||||
auto_ptr<Inset> inset;
|
auto_ptr<Inset> inset;
|
||||||
|
|
||||||
TextClass tclass = buf.params().getTextClass();
|
TextClass const & tclass = buf.params().getTextClass();
|
||||||
|
|
||||||
lex.next();
|
lex.next();
|
||||||
string tmptok = lex.getString();
|
string tmptok = lex.getString();
|
||||||
@ -487,7 +487,7 @@ Inset * readInset(Lexer & lex, Buffer const & buf)
|
|||||||
} else if (tmptok == "Flex") {
|
} else if (tmptok == "Flex") {
|
||||||
lex.next();
|
lex.next();
|
||||||
string s = lex.getString();
|
string s = lex.getString();
|
||||||
InsetLayout il = tclass.insetlayout(from_utf8(s));
|
InsetLayout const & il = tclass.insetlayout(from_utf8(s));
|
||||||
inset.reset(new InsetFlex(buf.params(), il));
|
inset.reset(new InsetFlex(buf.params(), il));
|
||||||
} else if (tmptok == "Branch") {
|
} else if (tmptok == "Branch") {
|
||||||
inset.reset(new InsetBranch(buf.params(),
|
inset.reset(new InsetBranch(buf.params(),
|
||||||
|
@ -85,24 +85,14 @@ BoxTranslatorLoc const & boxtranslator_loc()
|
|||||||
} // anon
|
} // anon
|
||||||
|
|
||||||
|
|
||||||
void InsetBox::init()
|
|
||||||
{
|
|
||||||
setButtonLabel();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
InsetBox::InsetBox(BufferParams const & bp, string const & label)
|
InsetBox::InsetBox(BufferParams const & bp, string const & label)
|
||||||
: InsetCollapsable(bp), params_(label)
|
: InsetCollapsable(bp), params_(label)
|
||||||
{
|
{}
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
InsetBox::InsetBox(InsetBox const & in)
|
InsetBox::InsetBox(InsetBox const & in)
|
||||||
: InsetCollapsable(in), params_(in.params_)
|
: InsetCollapsable(in), params_(in.params_)
|
||||||
{
|
{}
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
InsetBox::~InsetBox()
|
InsetBox::~InsetBox()
|
||||||
@ -134,7 +124,6 @@ void InsetBox::read(Buffer const & buf, Lexer & lex)
|
|||||||
{
|
{
|
||||||
params_.read(lex);
|
params_.read(lex);
|
||||||
InsetCollapsable::read(buf, lex);
|
InsetCollapsable::read(buf, lex);
|
||||||
setButtonLabel();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,16 +39,12 @@ using std::ostringstream;
|
|||||||
InsetBranch::InsetBranch(BufferParams const & bp,
|
InsetBranch::InsetBranch(BufferParams const & bp,
|
||||||
InsetBranchParams const & params)
|
InsetBranchParams const & params)
|
||||||
: InsetCollapsable(bp), params_(params)
|
: InsetCollapsable(bp), params_(params)
|
||||||
{
|
{}
|
||||||
setButtonLabel();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
InsetBranch::InsetBranch(InsetBranch const & in)
|
InsetBranch::InsetBranch(InsetBranch const & in)
|
||||||
: InsetCollapsable(in), params_(in.params_)
|
: InsetCollapsable(in), params_(in.params_)
|
||||||
{
|
{}
|
||||||
setButtonLabel();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
InsetBranch::~InsetBranch()
|
InsetBranch::~InsetBranch()
|
||||||
|
@ -101,14 +101,8 @@ InsetCollapsable::InsetCollapsable(InsetCollapsable const & rhs)
|
|||||||
|
|
||||||
void InsetCollapsable::setLayout(BufferParams const & bp)
|
void InsetCollapsable::setLayout(BufferParams const & bp)
|
||||||
{
|
{
|
||||||
// FIXME: put this in the InsetLayout parsing?
|
layout_ = &getLayout(bp);
|
||||||
// Fallback for lacking inset layout background
|
labelstring_ = layout_->labelstring;
|
||||||
layout_.bgcolor = Color_background;
|
|
||||||
|
|
||||||
layout_ = getLayout(bp);
|
|
||||||
|
|
||||||
// FIXME: put this in the InsetLayout parsing?
|
|
||||||
layout_.labelfont.realize(sane_font);
|
|
||||||
|
|
||||||
setButtonLabel();
|
setButtonLabel();
|
||||||
}
|
}
|
||||||
@ -180,8 +174,8 @@ void InsetCollapsable::read(Buffer const & buf, Lexer & lex)
|
|||||||
Dimension InsetCollapsable::dimensionCollapsed() const
|
Dimension InsetCollapsable::dimensionCollapsed() const
|
||||||
{
|
{
|
||||||
Dimension dim;
|
Dimension dim;
|
||||||
theFontMetrics(layout_.labelfont).buttonText(
|
theFontMetrics(layout_->labelfont).buttonText(
|
||||||
layout_.labelstring, dim.wid, dim.asc, dim.des);
|
labelstring_, dim.wid, dim.asc, dim.des);
|
||||||
return dim;
|
return dim;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,7 +185,7 @@ void InsetCollapsable::metrics(MetricsInfo & mi, Dimension & dim) const
|
|||||||
autoOpen_ = mi.base.bv->cursor().isInside(this);
|
autoOpen_ = mi.base.bv->cursor().isInside(this);
|
||||||
|
|
||||||
FontInfo tmpfont = mi.base.font;
|
FontInfo tmpfont = mi.base.font;
|
||||||
mi.base.font = layout_.font;
|
mi.base.font = layout_->font;
|
||||||
mi.base.font.realize(tmpfont);
|
mi.base.font.realize(tmpfont);
|
||||||
|
|
||||||
switch (geometry()) {
|
switch (geometry()) {
|
||||||
@ -206,15 +200,14 @@ void InsetCollapsable::metrics(MetricsInfo & mi, Dimension & dim) const
|
|||||||
case SubLabel: {
|
case SubLabel: {
|
||||||
InsetText::metrics(mi, dim);
|
InsetText::metrics(mi, dim);
|
||||||
// consider width of the inset label
|
// consider width of the inset label
|
||||||
FontInfo font(layout_.labelfont);
|
FontInfo font(layout_->labelfont);
|
||||||
font.realize(sane_font);
|
font.realize(sane_font);
|
||||||
font.decSize();
|
font.decSize();
|
||||||
font.decSize();
|
font.decSize();
|
||||||
int w = 0;
|
int w = 0;
|
||||||
int a = 0;
|
int a = 0;
|
||||||
int d = 0;
|
int d = 0;
|
||||||
docstring s = layout_.labelstring;
|
theFontMetrics(font).rectText(labelstring_, w, a, d);
|
||||||
theFontMetrics(font).rectText(s, w, a, d);
|
|
||||||
dim.des += a + d;
|
dim.des += a + d;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -258,7 +251,7 @@ void InsetCollapsable::draw(PainterInfo & pi, int x, int y) const
|
|||||||
pi.background_color = backgroundColor();
|
pi.background_color = backgroundColor();
|
||||||
|
|
||||||
FontInfo tmpfont = pi.base.font;
|
FontInfo tmpfont = pi.base.font;
|
||||||
pi.base.font = layout_.font;
|
pi.base.font = layout_->font;
|
||||||
pi.base.font.realize(tmpfont);
|
pi.base.font.realize(tmpfont);
|
||||||
|
|
||||||
// Draw button first -- top, left or only
|
// Draw button first -- top, left or only
|
||||||
@ -272,7 +265,8 @@ void InsetCollapsable::draw(PainterInfo & pi, int x, int y) const
|
|||||||
button_dim.y1 = y - dimc.asc;
|
button_dim.y1 = y - dimc.asc;
|
||||||
button_dim.y2 = y + dimc.des;
|
button_dim.y2 = y + dimc.des;
|
||||||
|
|
||||||
pi.pain.buttonText(x, y, layout_.labelstring, layout_.labelfont, mouse_hover_);
|
pi.pain.buttonText(x, y, labelstring_, layout_->labelfont,
|
||||||
|
mouse_hover_);
|
||||||
} else {
|
} else {
|
||||||
button_dim.x1 = 0;
|
button_dim.x1 = 0;
|
||||||
button_dim.y1 = 0;
|
button_dim.y1 = 0;
|
||||||
@ -317,37 +311,36 @@ void InsetCollapsable::draw(PainterInfo & pi, int x, int y) const
|
|||||||
const int xx2 = x + textdim.wid - TEXT_TO_INSET_OFFSET + 1;
|
const int xx2 = x + textdim.wid - TEXT_TO_INSET_OFFSET + 1;
|
||||||
pi.pain.line(xx1, y + desc - 4,
|
pi.pain.line(xx1, y + desc - 4,
|
||||||
xx1, y + desc,
|
xx1, y + desc,
|
||||||
layout_.labelfont.color());
|
layout_->labelfont.color());
|
||||||
if (internalStatus() == Open)
|
if (internalStatus() == Open)
|
||||||
pi.pain.line(xx1, y + desc,
|
pi.pain.line(xx1, y + desc,
|
||||||
xx2, y + desc,
|
xx2, y + desc,
|
||||||
layout_.labelfont.color());
|
layout_->labelfont.color());
|
||||||
else {
|
else {
|
||||||
// Make status_ value visible:
|
// Make status_ value visible:
|
||||||
pi.pain.line(xx1, y + desc,
|
pi.pain.line(xx1, y + desc,
|
||||||
xx1 + 4, y + desc,
|
xx1 + 4, y + desc,
|
||||||
layout_.labelfont.color());
|
layout_->labelfont.color());
|
||||||
pi.pain.line(xx2 - 4, y + desc,
|
pi.pain.line(xx2 - 4, y + desc,
|
||||||
xx2, y + desc,
|
xx2, y + desc,
|
||||||
layout_.labelfont.color());
|
layout_->labelfont.color());
|
||||||
}
|
}
|
||||||
pi.pain.line(x + textdim.wid - 3, y + desc, x + textdim.wid - 3, y + desc - 4,
|
pi.pain.line(x + textdim.wid - 3, y + desc, x + textdim.wid - 3, y + desc - 4,
|
||||||
layout_.labelfont.color());
|
layout_->labelfont.color());
|
||||||
|
|
||||||
// the label below the text. Can be toggled.
|
// the label below the text. Can be toggled.
|
||||||
if (geometry() == SubLabel) {
|
if (geometry() == SubLabel) {
|
||||||
FontInfo font(layout_.labelfont);
|
FontInfo font(layout_->labelfont);
|
||||||
font.realize(sane_font);
|
font.realize(sane_font);
|
||||||
font.decSize();
|
font.decSize();
|
||||||
font.decSize();
|
font.decSize();
|
||||||
int w = 0;
|
int w = 0;
|
||||||
int a = 0;
|
int a = 0;
|
||||||
int d = 0;
|
int d = 0;
|
||||||
docstring s = layout_.labelstring;
|
theFontMetrics(font).rectText(labelstring_, w, a, d);
|
||||||
theFontMetrics(font).rectText(s, w, a, d);
|
|
||||||
int const ww = max(textdim.wid, w);
|
int const ww = max(textdim.wid, w);
|
||||||
pi.pain.rectText(x + (ww - w) / 2, y + desc + a,
|
pi.pain.rectText(x + (ww - w) / 2, y + desc + a,
|
||||||
s, font, Color_none, Color_none);
|
labelstring_, font, Color_none, Color_none);
|
||||||
desc += d;
|
desc += d;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -356,12 +349,12 @@ void InsetCollapsable::draw(PainterInfo & pi, int x, int y) const
|
|||||||
if (cur.isInside(this)) {
|
if (cur.isInside(this)) {
|
||||||
y -= textdim.asc;
|
y -= textdim.asc;
|
||||||
y += 3;
|
y += 3;
|
||||||
pi.pain.line(xx1, y + 4, xx1, y, layout_.labelfont.color());
|
pi.pain.line(xx1, y + 4, xx1, y, layout_->labelfont.color());
|
||||||
pi.pain.line(xx1 + 4, y, xx1, y, layout_.labelfont.color());
|
pi.pain.line(xx1 + 4, y, xx1, y, layout_->labelfont.color());
|
||||||
pi.pain.line(xx2, y + 4, xx2, y,
|
pi.pain.line(xx2, y + 4, xx2, y,
|
||||||
layout_.labelfont.color());
|
layout_->labelfont.color());
|
||||||
pi.pain.line(xx2 - 4, y, xx2, y,
|
pi.pain.line(xx2 - 4, y, xx2, y,
|
||||||
layout_.labelfont.color());
|
layout_->labelfont.color());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -580,7 +573,7 @@ void InsetCollapsable::doDispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (layout_.forceltr) {
|
if (layout_->forceltr) {
|
||||||
// Force any new text to latex_language
|
// Force any new text to latex_language
|
||||||
// FIXME: This should only be necessary in constructor, but
|
// FIXME: This should only be necessary in constructor, but
|
||||||
// new paragraphs that are created by pressing enter at the
|
// new paragraphs that are created by pressing enter at the
|
||||||
@ -598,7 +591,7 @@ void InsetCollapsable::doDispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
|
|
||||||
bool InsetCollapsable::allowMultiPar() const
|
bool InsetCollapsable::allowMultiPar() const
|
||||||
{
|
{
|
||||||
return layout_.multipar;
|
return layout_->multipar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -606,9 +599,9 @@ void InsetCollapsable::resetParagraphsFont()
|
|||||||
{
|
{
|
||||||
Font font;
|
Font font;
|
||||||
font.fontInfo() = sane_font;
|
font.fontInfo() = sane_font;
|
||||||
if (layout_.forceltr)
|
if (layout_->forceltr)
|
||||||
font.setLanguage(latex_language);
|
font.setLanguage(latex_language);
|
||||||
if (layout_.passthru) {
|
if (layout_->passthru) {
|
||||||
ParagraphList::iterator par = paragraphs().begin();
|
ParagraphList::iterator par = paragraphs().begin();
|
||||||
ParagraphList::iterator const end = paragraphs().end();
|
ParagraphList::iterator const end = paragraphs().end();
|
||||||
while (par != end) {
|
while (par != end) {
|
||||||
@ -715,7 +708,7 @@ bool InsetCollapsable::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|||||||
case LFUN_TABULAR_INSERT:
|
case LFUN_TABULAR_INSERT:
|
||||||
case LFUN_TOC_INSERT:
|
case LFUN_TOC_INSERT:
|
||||||
case LFUN_WRAP_INSERT:
|
case LFUN_WRAP_INSERT:
|
||||||
if (layout_.passthru) {
|
if (layout_->passthru) {
|
||||||
flag.enabled(false);
|
flag.enabled(false);
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else
|
||||||
@ -730,12 +723,12 @@ bool InsetCollapsable::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
case LFUN_LANGUAGE:
|
case LFUN_LANGUAGE:
|
||||||
flag.enabled(!layout_.forceltr);
|
flag.enabled(!layout_->forceltr);
|
||||||
return InsetText::getStatus(cur, cmd, flag);
|
return InsetText::getStatus(cur, cmd, flag);
|
||||||
|
|
||||||
case LFUN_BREAK_PARAGRAPH:
|
case LFUN_BREAK_PARAGRAPH:
|
||||||
case LFUN_BREAK_PARAGRAPH_SKIP:
|
case LFUN_BREAK_PARAGRAPH_SKIP:
|
||||||
flag.enabled(layout_.multipar);
|
flag.enabled(layout_->multipar);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -746,7 +739,7 @@ bool InsetCollapsable::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|||||||
|
|
||||||
void InsetCollapsable::setLabel(docstring const & l)
|
void InsetCollapsable::setLabel(docstring const & l)
|
||||||
{
|
{
|
||||||
layout_.labelstring = l;
|
labelstring_ = l;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -770,11 +763,11 @@ docstring InsetCollapsable::floatName(string const & type, BufferParams const &
|
|||||||
|
|
||||||
InsetCollapsable::Decoration InsetCollapsable::decoration() const
|
InsetCollapsable::Decoration InsetCollapsable::decoration() const
|
||||||
{
|
{
|
||||||
if (layout_.decoration == "classic")
|
if (layout_->decoration == "classic")
|
||||||
return Classic;
|
return Classic;
|
||||||
if (layout_.decoration == "minimalistic")
|
if (layout_->decoration == "minimalistic")
|
||||||
return Minimalistic;
|
return Minimalistic;
|
||||||
if (layout_.decoration == "conglomerate")
|
if (layout_->decoration == "conglomerate")
|
||||||
return Conglomerate;
|
return Conglomerate;
|
||||||
if (name() == from_ascii("Flex"))
|
if (name() == from_ascii("Flex"))
|
||||||
return Conglomerate;
|
return Conglomerate;
|
||||||
@ -789,32 +782,32 @@ int InsetCollapsable::latex(Buffer const & buf, odocstream & os,
|
|||||||
// a collapsable inset, either a command or an environment. Standard
|
// a collapsable inset, either a command or an environment. Standard
|
||||||
// collapsable insets should not redefine this, non-standard ones may
|
// collapsable insets should not redefine this, non-standard ones may
|
||||||
// call this.
|
// call this.
|
||||||
if (!layout_.latexname.empty()) {
|
if (!layout_->latexname.empty()) {
|
||||||
if (layout_.latextype == "command") {
|
if (layout_->latextype == "command") {
|
||||||
// FIXME UNICODE
|
// FIXME UNICODE
|
||||||
if (runparams.moving_arg)
|
if (runparams.moving_arg)
|
||||||
os << "\\protect";
|
os << "\\protect";
|
||||||
os << '\\' << from_utf8(layout_.latexname);
|
os << '\\' << from_utf8(layout_->latexname);
|
||||||
if (!layout_.latexparam.empty())
|
if (!layout_->latexparam.empty())
|
||||||
os << from_utf8(layout_.latexparam);
|
os << from_utf8(layout_->latexparam);
|
||||||
os << '{';
|
os << '{';
|
||||||
} else if (layout_.latextype == "environment") {
|
} else if (layout_->latextype == "environment") {
|
||||||
os << "%\n\\begin{" << from_utf8(layout_.latexname) << "}\n";
|
os << "%\n\\begin{" << from_utf8(layout_->latexname) << "}\n";
|
||||||
if (!layout_.latexparam.empty())
|
if (!layout_->latexparam.empty())
|
||||||
os << from_utf8(layout_.latexparam);
|
os << from_utf8(layout_->latexparam);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OutputParams rp = runparams;
|
OutputParams rp = runparams;
|
||||||
if (layout_.passthru)
|
if (layout_->passthru)
|
||||||
rp.verbatim = true;
|
rp.verbatim = true;
|
||||||
if (layout_.needprotect)
|
if (layout_->needprotect)
|
||||||
rp.moving_arg = true;
|
rp.moving_arg = true;
|
||||||
int i = InsetText::latex(buf, os, rp);
|
int i = InsetText::latex(buf, os, rp);
|
||||||
if (!layout_.latexname.empty()) {
|
if (!layout_->latexname.empty()) {
|
||||||
if (layout_.latextype == "command") {
|
if (layout_->latextype == "command") {
|
||||||
os << "}";
|
os << "}";
|
||||||
} else if (layout_.latextype == "environment") {
|
} else if (layout_->latextype == "environment") {
|
||||||
os << "\n\\end{" << from_utf8(layout_.latexname) << "}\n";
|
os << "\n\\end{" << from_utf8(layout_->latexname) << "}\n";
|
||||||
i += 4;
|
i += 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -825,7 +818,7 @@ int InsetCollapsable::latex(Buffer const & buf, odocstream & os,
|
|||||||
void InsetCollapsable::validate(LaTeXFeatures & features) const
|
void InsetCollapsable::validate(LaTeXFeatures & features) const
|
||||||
{
|
{
|
||||||
// Force inclusion of preamble snippet in layout file
|
// Force inclusion of preamble snippet in layout file
|
||||||
features.require(layout_.name);
|
features.require(layout_->name);
|
||||||
InsetText::validate(features);
|
InsetText::validate(features);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ public:
|
|||||||
///
|
///
|
||||||
bool setMouseHover(bool mouse_hover);
|
bool setMouseHover(bool mouse_hover);
|
||||||
///
|
///
|
||||||
virtual ColorCode backgroundColor() const {return layout_.bgcolor; }
|
virtual ColorCode backgroundColor() const {return layout_->bgcolor; }
|
||||||
|
|
||||||
int latex(Buffer const &, odocstream &,
|
int latex(Buffer const &, odocstream &,
|
||||||
OutputParams const &) const;
|
OutputParams const &) const;
|
||||||
@ -136,9 +136,9 @@ public:
|
|||||||
virtual InsetCode lyxCode() const { return COLLAPSABLE_CODE; }
|
virtual InsetCode lyxCode() const { return COLLAPSABLE_CODE; }
|
||||||
|
|
||||||
/// Allow multiple blanks
|
/// Allow multiple blanks
|
||||||
virtual bool isFreeSpacing() const { return layout_.freespacing; }
|
virtual bool isFreeSpacing() const { return layout_->freespacing; }
|
||||||
/// Don't eliminate empty paragraphs
|
/// Don't eliminate empty paragraphs
|
||||||
virtual bool allowEmpty() const { return layout_.keepempty; }
|
virtual bool allowEmpty() const { return layout_->keepempty; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
///
|
///
|
||||||
@ -164,10 +164,12 @@ protected:
|
|||||||
///
|
///
|
||||||
mutable int topbaseline;
|
mutable int topbaseline;
|
||||||
///
|
///
|
||||||
mutable InsetLayout layout_;
|
InsetLayout const * layout_;
|
||||||
///
|
///
|
||||||
CollapseStatus internalStatus() const { return status_; }
|
CollapseStatus internalStatus() const { return status_; }
|
||||||
private:
|
private:
|
||||||
|
///
|
||||||
|
docstring labelstring_;
|
||||||
///
|
///
|
||||||
mutable CollapseStatus status_;
|
mutable CollapseStatus status_;
|
||||||
/// a substatus of the Open status, determined automatically in metrics
|
/// a substatus of the Open status, determined automatically in metrics
|
||||||
|
@ -49,27 +49,14 @@ using std::ostringstream;
|
|||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
|
|
||||||
void InsetERT::init()
|
|
||||||
{
|
|
||||||
setButtonLabel();
|
|
||||||
// FIXME: what to do with those?
|
|
||||||
//text_.current_font.setLanguage(latex_language);
|
|
||||||
//text_.real_current_font.setLanguage(latex_language);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
InsetERT::InsetERT(BufferParams const & bp, CollapseStatus status)
|
InsetERT::InsetERT(BufferParams const & bp, CollapseStatus status)
|
||||||
: InsetCollapsable(bp, status)
|
: InsetCollapsable(bp, status)
|
||||||
{
|
{}
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
InsetERT::InsetERT(InsetERT const & in)
|
InsetERT::InsetERT(InsetERT const & in)
|
||||||
: InsetCollapsable(in)
|
: InsetCollapsable(in)
|
||||||
{
|
{}
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Inset * InsetERT::clone() const
|
Inset * InsetERT::clone() const
|
||||||
@ -78,21 +65,6 @@ Inset * InsetERT::clone() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
InsetERT::InsetERT(BufferParams const & bp,
|
|
||||||
Language const *, string const & contents, CollapseStatus status)
|
|
||||||
: InsetCollapsable(bp, status)
|
|
||||||
{
|
|
||||||
Font font(FONT_INHERIT, latex_language);
|
|
||||||
paragraphs().begin()->insert(0, contents, font);
|
|
||||||
|
|
||||||
// the init has to be after the initialization of the paragraph
|
|
||||||
// because of the label settings (draw_label for ert insets).
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
InsetERT::~InsetERT()
|
InsetERT::~InsetERT()
|
||||||
{
|
{
|
||||||
InsetERTMailer(*this).hideDialog();
|
InsetERTMailer(*this).hideDialog();
|
||||||
@ -180,7 +152,7 @@ void InsetERT::doDispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
// Force any new text to latex_language
|
// Force any new text to latex_language
|
||||||
// FIXME: This should only be necessary in init(), but
|
// FIXME: This should not be necessary but
|
||||||
// new paragraphs that are created by pressing enter at the
|
// new paragraphs that are created by pressing enter at the
|
||||||
// start of an existing paragraph get the buffer language
|
// start of an existing paragraph get the buffer language
|
||||||
// and not latex_language, so we take this brute force
|
// and not latex_language, so we take this brute force
|
||||||
|
@ -80,8 +80,6 @@ protected:
|
|||||||
private:
|
private:
|
||||||
virtual Inset * clone() const;
|
virtual Inset * clone() const;
|
||||||
///
|
///
|
||||||
void init();
|
|
||||||
///
|
|
||||||
void setButtonLabel();
|
void setButtonLabel();
|
||||||
///
|
///
|
||||||
bool allowSpellCheck() const { return false; }
|
bool allowSpellCheck() const { return false; }
|
||||||
|
@ -44,7 +44,7 @@ using std::ostream;
|
|||||||
|
|
||||||
|
|
||||||
InsetFlex::InsetFlex(BufferParams const & bp,
|
InsetFlex::InsetFlex(BufferParams const & bp,
|
||||||
InsetLayout il)
|
InsetLayout const & il)
|
||||||
: InsetCollapsable(bp, Collapsed)
|
: InsetCollapsable(bp, Collapsed)
|
||||||
{
|
{
|
||||||
params_.name = il.name;
|
params_.name = il.name;
|
||||||
@ -54,7 +54,9 @@ InsetFlex::InsetFlex(BufferParams const & bp,
|
|||||||
|
|
||||||
InsetFlex::InsetFlex(InsetFlex const & in)
|
InsetFlex::InsetFlex(InsetFlex const & in)
|
||||||
: InsetCollapsable(in), params_(in.params_)
|
: InsetCollapsable(in), params_(in.params_)
|
||||||
{}
|
{
|
||||||
|
setLayout(*in.layout_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Inset * InsetFlex::clone() const
|
Inset * InsetFlex::clone() const
|
||||||
@ -65,13 +67,13 @@ Inset * InsetFlex::clone() const
|
|||||||
|
|
||||||
bool InsetFlex::undefined() const
|
bool InsetFlex::undefined() const
|
||||||
{
|
{
|
||||||
return layout_.labelstring == from_utf8("UNDEFINED");
|
return layout_->labelstring == from_utf8("UNDEFINED");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetFlex::setLayout(InsetLayout il)
|
void InsetFlex::setLayout(InsetLayout const & il)
|
||||||
{
|
{
|
||||||
layout_ = il;
|
layout_ = &il;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -111,8 +113,8 @@ int InsetFlex::docbook(Buffer const & buf, odocstream & os,
|
|||||||
|
|
||||||
if (!undefined())
|
if (!undefined())
|
||||||
// FIXME UNICODE
|
// FIXME UNICODE
|
||||||
sgml::openTag(os, layout_.latexname,
|
sgml::openTag(os, layout_->latexname,
|
||||||
par->getID(buf, runparams) + layout_.latexparam);
|
par->getID(buf, runparams) + layout_->latexparam);
|
||||||
|
|
||||||
for (; par != end; ++par) {
|
for (; par != end; ++par) {
|
||||||
par->simpleDocBookOnePar(buf, os, runparams,
|
par->simpleDocBookOnePar(buf, os, runparams,
|
||||||
@ -121,7 +123,7 @@ int InsetFlex::docbook(Buffer const & buf, odocstream & os,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!undefined())
|
if (!undefined())
|
||||||
sgml::closeTag(os, layout_.latexname);
|
sgml::closeTag(os, layout_->latexname);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -37,16 +37,17 @@ public:
|
|||||||
class InsetFlex : public InsetCollapsable {
|
class InsetFlex : public InsetCollapsable {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
InsetFlex(BufferParams const &, InsetLayout);
|
InsetFlex(BufferParams const &, InsetLayout const &);
|
||||||
///
|
///
|
||||||
docstring name() const { return from_ascii("Flex"); }
|
docstring name() const { return from_ascii("Flex"); }
|
||||||
///
|
///
|
||||||
InsetLayout const & getLayout(BufferParams const &) const { return layout_; }
|
InsetLayout const & getLayout(BufferParams const &) const
|
||||||
|
{ return *layout_; }
|
||||||
/// Is this character style defined in the document's textclass?
|
/// Is this character style defined in the document's textclass?
|
||||||
/// May be wrong after textclass change or paste from another document
|
/// May be wrong after textclass change or paste from another document
|
||||||
bool undefined() const;
|
bool undefined() const;
|
||||||
/// (Re-)set the character style parameters from \p il
|
/// (Re-)set the character style parameters from \p il
|
||||||
void setLayout(InsetLayout il);
|
void setLayout(InsetLayout const & il);
|
||||||
///
|
///
|
||||||
virtual docstring const editMessage() const;
|
virtual docstring const editMessage() const;
|
||||||
///
|
///
|
||||||
|
@ -116,15 +116,12 @@ InsetNote::InsetNote(BufferParams const & bp, string const & label)
|
|||||||
: InsetCollapsable(bp)
|
: InsetCollapsable(bp)
|
||||||
{
|
{
|
||||||
params_.type = notetranslator().find(label);
|
params_.type = notetranslator().find(label);
|
||||||
setButtonLabel();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
InsetNote::InsetNote(InsetNote const & in)
|
InsetNote::InsetNote(InsetNote const & in)
|
||||||
: InsetCollapsable(in), params_(in.params_)
|
: InsetCollapsable(in), params_(in.params_)
|
||||||
{
|
{}
|
||||||
setButtonLabel();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
InsetNote::~InsetNote()
|
InsetNote::~InsetNote()
|
||||||
|
Loading…
Reference in New Issue
Block a user