mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Further cleanup of collapsable insets. The layouts are now properly read and applied.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21392 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
c08309a9e2
commit
d45d7de8c3
@ -190,6 +190,9 @@ static bool doInsertInset(Cursor & cur, Text * text,
|
||||
if (!inset)
|
||||
return false;
|
||||
|
||||
if (InsetCollapsable * ci = inset->asInsetCollapsable())
|
||||
ci->setLayout(cur.bv().buffer().params());
|
||||
|
||||
cur.recordUndo();
|
||||
if (cmd.action == LFUN_INDEX_INSERT) {
|
||||
docstring ds = support::subst(text->getStringToIndex(cur), '\n', ' ');
|
||||
|
@ -35,6 +35,7 @@ class Dimension;
|
||||
class FuncRequest;
|
||||
class FuncStatus;
|
||||
class InsetIterator;
|
||||
class InsetCollapsable;
|
||||
class InsetLayout;
|
||||
class InsetList;
|
||||
class InsetMath;
|
||||
@ -88,6 +89,10 @@ public:
|
||||
virtual InsetText * asTextInset() { return 0; }
|
||||
/// is this inset based on the TextInset class?
|
||||
virtual InsetText const * asTextInset() const { return 0; }
|
||||
/// is this inset based on the InsetCollapsable class?
|
||||
virtual InsetCollapsable * asInsetCollapsable() { return 0; }
|
||||
/// is this inset based on the InsetCollapsable class?
|
||||
virtual InsetCollapsable const * asInsetCollapsable() const { return 0; }
|
||||
|
||||
/// the real dispatcher
|
||||
void dispatch(Cursor & cur, FuncRequest & cmd);
|
||||
|
@ -199,7 +199,6 @@ void InsetBox::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
//lyxerr << "InsetBox::dispatch MODIFY" << endl;
|
||||
InsetBoxMailer::string2params(to_utf8(cmd.argument()), params_);
|
||||
setLayout(cur.buffer().params());
|
||||
setButtonLabel();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -81,8 +81,6 @@ InsetCollapsable::InsetCollapsable
|
||||
setAutoBreakRows(true);
|
||||
setDrawFrame(true);
|
||||
setFrameColor(Color_collapsableframe);
|
||||
setButtonLabel();
|
||||
setLayout(bp);
|
||||
}
|
||||
|
||||
|
||||
@ -108,15 +106,11 @@ void InsetCollapsable::setLayout(BufferParams const & bp)
|
||||
layout_.bgcolor = Color_background;
|
||||
|
||||
layout_ = getLayout(bp);
|
||||
if (layout_.labelfont != inherit_font)
|
||||
return;
|
||||
|
||||
// FIXME: put this in the InsetLayout parsing?
|
||||
// Fallback for lacking inset layout labelfont.
|
||||
layout_.labelfont = sane_font;
|
||||
layout_.labelfont.decSize();
|
||||
layout_.labelfont.decSize();
|
||||
layout_.labelfont.setColor(Color_collapsable);
|
||||
layout_.labelfont.realize(sane_font);
|
||||
|
||||
setButtonLabel();
|
||||
}
|
||||
|
||||
|
||||
@ -170,7 +164,6 @@ void InsetCollapsable::read(Buffer const & buf, Lexer & lex)
|
||||
if (!token_found)
|
||||
status_ = isOpen() ? Open : Collapsed;
|
||||
|
||||
setButtonLabel();
|
||||
setLayout(buf.params());
|
||||
|
||||
// Force default font, if so requested
|
||||
|
@ -41,7 +41,9 @@ public:
|
||||
InsetCollapsable(BufferParams const &, CollapseStatus status = Inset::Open);
|
||||
///
|
||||
InsetCollapsable(InsetCollapsable const & rhs);
|
||||
///
|
||||
|
||||
InsetCollapsable * asInsetCollapsable() { return this; }
|
||||
InsetCollapsable const * asInsetCollapsable() const { return this; }
|
||||
docstring name() const { return from_ascii("Collapsable"); }
|
||||
///
|
||||
void setLayout(BufferParams const &);
|
||||
|
Loading…
Reference in New Issue
Block a user