mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-12 22:14:35 +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)
|
if (!inset)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (InsetCollapsable * ci = inset->asInsetCollapsable())
|
||||||
|
ci->setLayout(cur.bv().buffer().params());
|
||||||
|
|
||||||
cur.recordUndo();
|
cur.recordUndo();
|
||||||
if (cmd.action == LFUN_INDEX_INSERT) {
|
if (cmd.action == LFUN_INDEX_INSERT) {
|
||||||
docstring ds = support::subst(text->getStringToIndex(cur), '\n', ' ');
|
docstring ds = support::subst(text->getStringToIndex(cur), '\n', ' ');
|
||||||
|
@ -35,6 +35,7 @@ class Dimension;
|
|||||||
class FuncRequest;
|
class FuncRequest;
|
||||||
class FuncStatus;
|
class FuncStatus;
|
||||||
class InsetIterator;
|
class InsetIterator;
|
||||||
|
class InsetCollapsable;
|
||||||
class InsetLayout;
|
class InsetLayout;
|
||||||
class InsetList;
|
class InsetList;
|
||||||
class InsetMath;
|
class InsetMath;
|
||||||
@ -88,6 +89,10 @@ public:
|
|||||||
virtual InsetText * asTextInset() { return 0; }
|
virtual InsetText * asTextInset() { return 0; }
|
||||||
/// is this inset based on the TextInset class?
|
/// is this inset based on the TextInset class?
|
||||||
virtual InsetText const * asTextInset() const { return 0; }
|
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
|
/// the real dispatcher
|
||||||
void dispatch(Cursor & cur, FuncRequest & cmd);
|
void dispatch(Cursor & cur, FuncRequest & cmd);
|
||||||
|
@ -199,7 +199,6 @@ void InsetBox::doDispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
//lyxerr << "InsetBox::dispatch MODIFY" << endl;
|
//lyxerr << "InsetBox::dispatch MODIFY" << endl;
|
||||||
InsetBoxMailer::string2params(to_utf8(cmd.argument()), params_);
|
InsetBoxMailer::string2params(to_utf8(cmd.argument()), params_);
|
||||||
setLayout(cur.buffer().params());
|
setLayout(cur.buffer().params());
|
||||||
setButtonLabel();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,8 +81,6 @@ InsetCollapsable::InsetCollapsable
|
|||||||
setAutoBreakRows(true);
|
setAutoBreakRows(true);
|
||||||
setDrawFrame(true);
|
setDrawFrame(true);
|
||||||
setFrameColor(Color_collapsableframe);
|
setFrameColor(Color_collapsableframe);
|
||||||
setButtonLabel();
|
|
||||||
setLayout(bp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -108,15 +106,11 @@ void InsetCollapsable::setLayout(BufferParams const & bp)
|
|||||||
layout_.bgcolor = Color_background;
|
layout_.bgcolor = Color_background;
|
||||||
|
|
||||||
layout_ = getLayout(bp);
|
layout_ = getLayout(bp);
|
||||||
if (layout_.labelfont != inherit_font)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// FIXME: put this in the InsetLayout parsing?
|
// FIXME: put this in the InsetLayout parsing?
|
||||||
// Fallback for lacking inset layout labelfont.
|
layout_.labelfont.realize(sane_font);
|
||||||
layout_.labelfont = sane_font;
|
|
||||||
layout_.labelfont.decSize();
|
setButtonLabel();
|
||||||
layout_.labelfont.decSize();
|
|
||||||
layout_.labelfont.setColor(Color_collapsable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -170,7 +164,6 @@ void InsetCollapsable::read(Buffer const & buf, Lexer & lex)
|
|||||||
if (!token_found)
|
if (!token_found)
|
||||||
status_ = isOpen() ? Open : Collapsed;
|
status_ = isOpen() ? Open : Collapsed;
|
||||||
|
|
||||||
setButtonLabel();
|
|
||||||
setLayout(buf.params());
|
setLayout(buf.params());
|
||||||
|
|
||||||
// Force default font, if so requested
|
// Force default font, if so requested
|
||||||
|
@ -41,7 +41,9 @@ public:
|
|||||||
InsetCollapsable(BufferParams const &, CollapseStatus status = Inset::Open);
|
InsetCollapsable(BufferParams const &, CollapseStatus status = Inset::Open);
|
||||||
///
|
///
|
||||||
InsetCollapsable(InsetCollapsable const & rhs);
|
InsetCollapsable(InsetCollapsable const & rhs);
|
||||||
///
|
|
||||||
|
InsetCollapsable * asInsetCollapsable() { return this; }
|
||||||
|
InsetCollapsable const * asInsetCollapsable() const { return this; }
|
||||||
docstring name() const { return from_ascii("Collapsable"); }
|
docstring name() const { return from_ascii("Collapsable"); }
|
||||||
///
|
///
|
||||||
void setLayout(BufferParams const &);
|
void setLayout(BufferParams const &);
|
||||||
|
Loading…
Reference in New Issue
Block a user