commit 3f34ebbaf932ea645e584a17d643c9b7f19b2a86
Author: Jean-Marc Lasgouttes <[email protected]>
Date:   Tue May 23 16:50:53 2017 +0200

    Revert "Add possibility for command inset to inherit enclosing font"
    
    The new method was badly named, it was not supposed to override the
    existing inheritFont.
    
    Fixes bug #10682.
    
    This reverts commit 555338048d417d4532fe954239a0e9e29dd5ee6d.
---
 src/insets/InsetBibtex.h     |    2 --
 src/insets/InsetCitation.h   |    2 --
 src/insets/InsetCommand.cpp  |    3 +--
 src/insets/InsetCommand.h    |    2 --
 src/insets/InsetExternal.cpp |    2 +-
 src/insets/InsetInclude.cpp  |    4 ++--
 src/insets/InsetRef.h        |    4 +---
 src/insets/RenderButton.cpp  |   10 ++++------
 src/insets/RenderButton.h    |    3 +--
 src/mathed/CommandInset.cpp  |    2 +-
 10 files changed, 11 insertions(+), 23 deletions(-)

diff --git a/src/insets/InsetBibtex.h b/src/insets/InsetBibtex.h
index 4f6f68c..038065f 100644
--- a/src/insets/InsetBibtex.h
+++ b/src/insets/InsetBibtex.h
@@ -48,8 +48,6 @@ public:
        ///
        bool hasSettings() const { return true; }
        ///
-       bool inheritFont() const { return true; }
-       ///
        InsetCode lyxCode() const { return BIBTEX_CODE; }
        ///
        DisplayType display() const { return AlignCenter; }
diff --git a/src/insets/InsetCitation.h b/src/insets/InsetCitation.h
index 18a9305..992a85e 100644
--- a/src/insets/InsetCitation.h
+++ b/src/insets/InsetCitation.h
@@ -43,8 +43,6 @@ public:
        ///
        bool hasSettings() const { return true; }
        ///
-       bool inheritFont() const { return true; }
-       ///
        docstring toolTip(BufferView const & bv, int x, int y) const;
        ///
        void doDispatch(Cursor & cur, FuncRequest & cmd);
diff --git a/src/insets/InsetCommand.cpp b/src/insets/InsetCommand.cpp
index fe10466..f4f1692 100644
--- a/src/insets/InsetCommand.cpp
+++ b/src/insets/InsetCommand.cpp
@@ -96,8 +96,7 @@ InsetCommand::~InsetCommand()
 
 void InsetCommand::metrics(MetricsInfo & mi, Dimension & dim) const
 {
-       button_.update(screenLabel(), editable() || clickable(*mi.base.bv, 0, 
0),
-                      inheritFont());
+       button_.update(screenLabel(), editable() || clickable(*mi.base.bv, 0, 
0));
        button_.metrics(mi, dim);
 }
 
diff --git a/src/insets/InsetCommand.h b/src/insets/InsetCommand.h
index 78e6d7f..0514e09 100644
--- a/src/insets/InsetCommand.h
+++ b/src/insets/InsetCommand.h
@@ -125,8 +125,6 @@ private:
        RenderButton & button() const { return button_; }
        /// This should provide the text for the button
        virtual docstring screenLabel() const = 0;
-       /// This should return true when font is inherited from text
-       virtual bool inheritFont() const { return false; }
 
        /// \name Static public methods obligated for InsetCommand derived 
classes
        //@{
diff --git a/src/insets/InsetExternal.cpp b/src/insets/InsetExternal.cpp
index 8efdd3e..a88769b 100644
--- a/src/insets/InsetExternal.cpp
+++ b/src/insets/InsetExternal.cpp
@@ -623,7 +623,7 @@ void InsetExternal::setParams(InsetExternalParams const & p)
                        renderer_.reset(new RenderButton);
                        button_ptr = renderer_->asButton();
                }
-               button_ptr->update(screenLabel(params_, buffer()), true, false);
+               button_ptr->update(screenLabel(params_, buffer()), true);
                return;
        }
 
diff --git a/src/insets/InsetInclude.cpp b/src/insets/InsetInclude.cpp
index 06b5238..3fc35fe 100644
--- a/src/insets/InsetInclude.cpp
+++ b/src/insets/InsetInclude.cpp
@@ -1022,7 +1022,7 @@ void InsetInclude::metrics(MetricsInfo & mi, Dimension & 
dim) const
        } else {
                if (!set_label_) {
                        set_label_ = true;
-                       button_.update(screenLabel(), true, false);
+                       button_.update(screenLabel(), true);
                }
                button_.metrics(mi, dim);
        }
@@ -1207,7 +1207,7 @@ void InsetInclude::updateCommand()
 
 void InsetInclude::updateBuffer(ParIterator const & it, UpdateType utype)
 {
-       button_.update(screenLabel(), true, false);
+       button_.update(screenLabel(), true);
 
        Buffer const * const childbuffer = getChildBuffer();
        if (childbuffer) {
diff --git a/src/insets/InsetRef.h b/src/insets/InsetRef.h
index 15f1225..066a596 100644
--- a/src/insets/InsetRef.h
+++ b/src/insets/InsetRef.h
@@ -45,12 +45,10 @@ public:
        docstring toolTip(BufferView const &, int, int) const
                { return tooltip_; }
        ///
-       docstring getTOCString() const;
+  docstring getTOCString() const;
        ///
        bool hasSettings() const { return true; }
        ///
-       bool inheritFont() const { return true; }
-       ///
        InsetCode lyxCode() const { return REF_CODE; }
        ///
        DisplayType display() const { return Inline; }
diff --git a/src/insets/RenderButton.cpp b/src/insets/RenderButton.cpp
index 7f983c5..430b8dd 100644
--- a/src/insets/RenderButton.cpp
+++ b/src/insets/RenderButton.cpp
@@ -32,18 +32,16 @@ RenderBase * RenderButton::clone(Inset const *) const
 }
 
 
-void RenderButton::update(docstring const & text, bool editable,
-                          bool inherit_font)
+void RenderButton::update(docstring const & text, bool editable)
 {
        text_ = text;
        editable_ = editable;
-       inherit_font_ = inherit_font;
 }
 
 
-void RenderButton::metrics(MetricsInfo & mi, Dimension & dim) const
+void RenderButton::metrics(MetricsInfo &, Dimension & dim) const
 {
-       FontInfo font = inherit_font_ ? mi.base.font : sane_font;
+       FontInfo font = sane_font;
        font.decSize();
        frontend::FontMetrics const & fm =
                theFontMetrics(font);
@@ -60,7 +58,7 @@ void RenderButton::metrics(MetricsInfo & mi, Dimension & dim) 
const
 void RenderButton::draw(PainterInfo & pi, int x, int y) const
 {
        // Draw it as a box with the LaTeX text
-       FontInfo font = inherit_font_ ? pi.base.font : sane_font;
+       FontInfo font = sane_font;
        font.setColor(Color_command);
        font.decSize();
 
diff --git a/src/insets/RenderButton.h b/src/insets/RenderButton.h
index 480effd..5e6ad35 100644
--- a/src/insets/RenderButton.h
+++ b/src/insets/RenderButton.h
@@ -33,7 +33,7 @@ public:
        virtual void draw(PainterInfo & pi, int x, int y) const;
 
        /// Provide the text for the button
-       void update(docstring const &, bool editable, bool inherit_font);
+       void update(docstring const &, bool editable);
 
        /// The "sensitive area" box, i.e., the button area
        Box box() const { return button_box_; }
@@ -47,7 +47,6 @@ private:
        /// The stored data.
        docstring text_;
        bool editable_;
-       bool inherit_font_;
        Box button_box_;
 };
 
diff --git a/src/mathed/CommandInset.cpp b/src/mathed/CommandInset.cpp
index 344c570..0c9e585 100644
--- a/src/mathed/CommandInset.cpp
+++ b/src/mathed/CommandInset.cpp
@@ -40,7 +40,7 @@ void CommandInset::metrics(MetricsInfo & mi, Dimension & dim) 
const
 {
        if (!set_label_) {
                set_label_ = true;
-               button_.update(screenLabel(), true, false);
+               button_.update(screenLabel(), true);
        }
        button_.metrics(mi, dim);
 }

Reply via email to