]> git.lyx.org Git - features.git/commitdiff
* InsetCollapsable:
authorAbdelrazak Younes <younes@lyx.org>
Fri, 2 Nov 2007 17:47:51 +0000 (17:47 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Fri, 2 Nov 2007 17:47:51 +0000 (17:47 +0000)
- InsetCollapsable(): Move labelfont initialisation to InsetCollapsable::setLayout().
- read(): reset the inset layout.

All other insets: get rid of redundant setLayout() calls.

This commit fixes the multiple crashes in trunk but the color used for text and background are completely wrong...

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21382 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/InsetBox.cpp
src/insets/InsetBranch.cpp
src/insets/InsetCollapsable.cpp
src/insets/InsetERT.cpp
src/insets/InsetFoot.cpp
src/insets/InsetIndex.cpp
src/insets/InsetListings.cpp
src/insets/InsetMarginal.cpp
src/insets/InsetNote.cpp

index 7def781ac28dfa21bca8b8f9ac4af6478226e3c7..ed131d50934a1f0a86dcbf0dc5b9ce7650442241 100644 (file)
@@ -94,7 +94,6 @@ void InsetBox::init()
 InsetBox::InsetBox(BufferParams const & bp, string const & label)
        : InsetCollapsable(bp), params_(label)
 {
-       setLayout(bp);
        init();
 }
 
@@ -135,7 +134,6 @@ void InsetBox::read(Buffer const & buf, Lexer & lex)
 {
        params_.read(lex);
        InsetCollapsable::read(buf, lex);
-       setLayout(buf.params());
        setButtonLabel();
 }
 
index 126c8e5a168d66e2f2c7af06e104efdf437335f3..e374f51e606bdae75f684ea609dc81e6b575b87c 100644 (file)
@@ -45,7 +45,6 @@ InsetBranch::InsetBranch(BufferParams const & bp,
                         InsetBranchParams const & params)
        : InsetCollapsable(bp), params_(params)
 {
-       setLayout(bp);
        init();
 }
 
@@ -86,8 +85,6 @@ void InsetBranch::read(Buffer const & buf, Lexer & lex)
 {
        params_.read(lex);
        InsetCollapsable::read(buf, lex);
-       setLayout(buf.params());
-       setButtonLabel();
 }
 
 
@@ -137,7 +134,6 @@ void InsetBranch::doDispatch(Cursor & cur, FuncRequest & cmd)
                InsetBranchMailer::string2params(to_utf8(cmd.argument()), params);
                params_.branch = params.branch;
                setLayout(cur.buffer().params());
-               setButtonLabel();
                break;
        }
 
index b08e20fe446d466f19dda1a6051a6bf4e4a47269..cab612a1920f0c0281f269e4c2eae52cccd1aa5a 100644 (file)
@@ -82,14 +82,7 @@ InsetCollapsable::InsetCollapsable
        setDrawFrame(true);
        setFrameColor(Color_collapsableframe);
        setButtonLabel();
-       // Fallback for lacking inset layout item
-       layout_.bgcolor = Color_background;
-
-       // FIXME: it seems some insets don't properly initialise that!
-       layout_.labelfont = sane_font;
-       layout_.labelfont.decSize();
-       layout_.labelfont.decSize();
-       layout_.labelfont.setColor(Color_collapsable);
+       setLayout(bp);
 }
 
 
@@ -110,7 +103,25 @@ InsetCollapsable::InsetCollapsable(InsetCollapsable const & rhs)
 
 void  InsetCollapsable::setLayout(BufferParams const & bp)
 {
+       // Fallback for lacking inset layout item
+       layout_.bgcolor = Color_background;
+
+       // FIXME: it seems the default background is red!
        layout_ = getLayout(bp);
+
+
+       // FIXME: it seems the provided font is partly realized... so we
+       // re-initialize the label font in any case.
+       /*
+       if (layout_.labelfont != inherit_font)
+               return;
+       */
+
+       // FIXME: it seems some insets don't properly initialise that...
+       layout_.labelfont = sane_font;
+       layout_.labelfont.decSize();
+       layout_.labelfont.decSize();
+       layout_.labelfont.setColor(Color_collapsable);
 }
 
 
@@ -165,6 +176,7 @@ void InsetCollapsable::read(Buffer const & buf, Lexer & lex)
                status_ = isOpen() ? Open : Collapsed;
 
        setButtonLabel();
+       setLayout(buf.params());
 
        // Force default font, if so requested
        // This avoids paragraphs in buffer language that would have a
index 0a9a3e9f86201fb87eb052dfae1cc54978cb5584..650b7811c9f845831a13f168d34a9086cdda5320 100644 (file)
@@ -61,7 +61,6 @@ void InsetERT::init()
 InsetERT::InsetERT(BufferParams const & bp, CollapseStatus status)
        : InsetCollapsable(bp, status)
 {
-       setLayout(bp);
        init();
 }
 
index 993e79e69fa14a4dcc1f264c058007b2271b6f61..fe15a64f92a843a08f727817815967d24f76125c 100644 (file)
@@ -36,9 +36,7 @@ using std::ostream;
 
 InsetFoot::InsetFoot(BufferParams const & bp)
        : InsetFootlike(bp)
-{
-       setLayout(bp);
-}
+{}
 
 
 InsetFoot::InsetFoot(InsetFoot const & in)
index 7a396808698cc1a2367141d45783fb3433f6edfc..aaef4d43c5479aeec2046a272e89c78500ed3d7f 100644 (file)
@@ -30,9 +30,7 @@ using std::ostream;
 
 InsetIndex::InsetIndex(BufferParams const & bp)
        : InsetCollapsable(bp)
-{
-       setLayout(bp);
-}
+{}
 
 
 InsetIndex::InsetIndex(InsetIndex const & in)
index fd8810a867603f233643cb9ceb93d9c5d2f949c9..c43240bfe61eb25b563a27cebc6435521aad837d 100644 (file)
@@ -59,7 +59,6 @@ void InsetListings::init()
 InsetListings::InsetListings(BufferParams const & bp, InsetListingsParams const & par)
        : InsetCollapsable(bp, par.status())
 {
-       setLayout(bp);
        init();
 }
 
index 0193f5b33b84c59b12ce85fabfe7851bd8f9f817..3a4ed9407dfff51bd27a5dd4bbdad9589550752d 100644 (file)
@@ -25,9 +25,7 @@ namespace lyx {
 
 InsetMarginal::InsetMarginal(BufferParams const & bp)
        : InsetFootlike(bp)
-{
-       setLayout(bp);
-}
+{}
 
 
 InsetMarginal::InsetMarginal(InsetMarginal const & in)
index de060487deab26ab4e309d7b982d21a6474e47e9..f6e278347478a97814007c5cff07394871cc5a6e 100644 (file)
@@ -116,7 +116,6 @@ InsetNote::InsetNote(BufferParams const & bp, string const & label)
        : InsetCollapsable(bp)
 {
        params_.type = notetranslator().find(label);
-       setLayout(bp);
        setButtonLabel();
 }
 
@@ -175,8 +174,6 @@ void InsetNote::read(Buffer const & buf, Lexer & lex)
 {
        params_.read(lex);
        InsetCollapsable::read(buf, lex);
-       setLayout(buf.params());
-       setButtonLabel();
 }
 
 
@@ -202,7 +199,6 @@ void InsetNote::doDispatch(Cursor & cur, FuncRequest & cmd)
                InsetNoteMailer::string2params(to_utf8(cmd.argument()), params_);
                // get a bp from cur:
                setLayout(cur.buffer().params());
-               setButtonLabel();
                break;
 
        case LFUN_INSET_DIALOG_UPDATE: