using std::endl;
using std::min;
-using std::auto_ptr;
using std::istringstream;
using std::ostream;
using std::ostringstream;
void InsetERT::init()
{
setButtonLabel();
- Font font(Font::ALL_SANE);
- font.decSize();
- font.decSize();
- font.setColor(Color::latex);
- setLabelFont(font);
- text_.current_font.setLanguage(latex_language);
- text_.real_current_font.setLanguage(latex_language);
+ setLabelFont(layout_.labelfont);
+ // FIXME: what to do with those?
+ //text_.current_font.setLanguage(latex_language);
+ //text_.real_current_font.setLanguage(latex_language);
}
InsetERT::InsetERT(BufferParams const & bp, CollapseStatus status)
: InsetCollapsable(bp, status)
{
+ setLayout(bp);
init();
}
}
-auto_ptr<Inset> InsetERT::doClone() const
+Inset * InsetERT::clone() const
{
- return auto_ptr<Inset>(new InsetERT(*this));
+ return new InsetERT(*this);
}
int InsetERT::plaintext(Buffer const &, odocstream &,
- OutputParams const &) const
+ OutputParams const &) const
{
return 0; // do not output TeX code
}
//lyxerr << "\nInsetERT::doDispatch (begin): cmd: " << cmd << endl;
switch (cmd.action) {
+ case LFUN_MOUSE_PRESS:
+ if (cmd.button() != mouse_button::button3)
+ InsetCollapsable::doDispatch(cur, cmd);
+ else
+ // This makes the cursor leave the
+ // inset when it collapses on mouse-3
+ cur.undispatched();
+ break;
+
case LFUN_QUOTE_INSERT: {
- // We need to bypass the fancy quotes in LyXText
+ // We need to bypass the fancy quotes in Text
FuncRequest f(LFUN_SELF_INSERT, "\"");
dispatch(cur, f);
break;
// FIXME: Change only the pasted paragraphs
BufferParams const & bp = cur.buffer().params();
- Layout_ptr const layout =
+ LayoutPtr const layout =
bp.getTextClass().defaultLayout();
Font font = layout->font;
// ERT contents has always latex_language
// start of an existing paragraph get the buffer language
// and not latex_language, so we take this brute force
// approach.
- text_.current_font.setLanguage(latex_language);
- text_.real_current_font.setLanguage(latex_language);
+ // FIXME: what to do with those?
+ //text_.current_font.setLanguage(latex_language);
+ //text_.real_current_font.setLanguage(latex_language);
InsetCollapsable::doDispatch(cur, cmd);
break;
case LFUN_URL_INSERT:
case LFUN_FLOAT_LIST:
case LFUN_INSET_INSERT:
+ case LFUN_PARAGRAPH_PARAMS:
case LFUN_PARAGRAPH_PARAMS_APPLY:
case LFUN_PARAGRAPH_UPDATE:
case LFUN_NOMENCL_INSERT:
void InsetERT::setButtonLabel()
{
// FIXME UNICODE
- setLabel(isOpen() ? _("ERT") : getNewLabel(_("ERT")));
+ if (decoration() == Classic)
+ setLabel(isOpen() ? _("ERT") : getNewLabel(_("ERT")));
+ else
+ setLabel(getNewLabel(_("ERT")));
}
Font tmpfont = pi.base.font;
getDrawFont(pi.base.font);
pi.base.font.realize(tmpfont);
+ const_cast<InsetERT &>(*this).setButtonLabel();
InsetCollapsable::draw(pi, x, y);
pi.base.font = tmpfont;
}
void InsetERT::getDrawFont(Font & font) const
{
font = Font(Font::ALL_INHERIT, latex_language);
- font.setFamily(Font::TYPEWRITER_FAMILY);
- font.setColor(Color::latex);
+ font.realize(layout_.font);
}