///
bool hasSettings() const { return true; }
///
+ bool inheritFont() const { return true; }
+ ///
InsetCode lyxCode() const { return BIBTEX_CODE; }
///
DisplayType display() const { return AlignCenter; }
///
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);
void InsetCommand::metrics(MetricsInfo & mi, Dimension & dim) const
{
- button_.update(screenLabel(), editable() || clickable(*mi.base.bv, 0, 0));
+ button_.update(screenLabel(), editable() || clickable(*mi.base.bv, 0, 0),
+ inheritFont());
button_.metrics(mi, dim);
}
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
//@{
renderer_.reset(new RenderButton);
button_ptr = renderer_->asButton();
}
- button_ptr->update(screenLabel(params_, buffer()), true);
+ button_ptr->update(screenLabel(params_, buffer()), true, false);
return;
}
} else {
if (!set_label_) {
set_label_ = true;
- button_.update(screenLabel(), true);
+ button_.update(screenLabel(), true, false);
}
button_.metrics(mi, dim);
}
void InsetInclude::updateBuffer(ParIterator const & it, UpdateType utype)
{
- button_.update(screenLabel(), true);
+ button_.update(screenLabel(), true, false);
Buffer const * const childbuffer = getChildBuffer();
if (childbuffer) {
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; }
}
-void RenderButton::update(docstring const & text, bool editable)
+void RenderButton::update(docstring const & text, bool editable,
+ bool inherit_font)
{
text_ = text;
editable_ = editable;
+ inherit_font_ = inherit_font;
}
-void RenderButton::metrics(MetricsInfo &, Dimension & dim) const
+void RenderButton::metrics(MetricsInfo & mi, Dimension & dim) const
{
- FontInfo font = sane_font;
+ FontInfo font = inherit_font_ ? mi.base.font : sane_font;
font.decSize();
frontend::FontMetrics const & fm =
theFontMetrics(font);
void RenderButton::draw(PainterInfo & pi, int x, int y) const
{
// Draw it as a box with the LaTeX text
- FontInfo font = sane_font;
+ FontInfo font = inherit_font_ ? pi.base.font : sane_font;
font.setColor(Color_command);
font.decSize();
virtual void draw(PainterInfo & pi, int x, int y) const;
/// Provide the text for the button
- void update(docstring const &, bool editable);
+ void update(docstring const &, bool editable, bool inherit_font);
/// The "sensitive area" box, i.e., the button area
Box box() const { return button_box_; }
/// The stored data.
docstring text_;
bool editable_;
+ bool inherit_font_;
Box button_box_;
};
{
if (!set_label_) {
set_label_ = true;
- button_.update(screenLabel(), true);
+ button_.update(screenLabel(), true, false);
}
button_.metrics(mi, dim);
}