#include "FuncStatus.h"
#include "gettext.h"
#include "Language.h"
+#include "Layout.h"
#include "Color.h"
#include "LyXAction.h"
#include "Lexer.h"
using std::endl;
using std::min;
-using std::auto_ptr;
using std::istringstream;
using std::ostream;
using std::ostringstream;
{
setButtonLabel();
setLabelFont(layout_.labelfont);
- 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);
}
}
-auto_ptr<Inset> InsetERT::doClone() const
+Inset * InsetERT::clone() const
{
- return auto_ptr<Inset>(new InsetERT(*this));
+ return new InsetERT(*this);
}
void InsetERT::doDispatch(Cursor & cur, FuncRequest & cmd)
{
+ BufferParams const & bp = cur.buffer().params();
+ LayoutPtr const layout =
+ bp.getTextClass().defaultLayout();
//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 Text
FuncRequest f(LFUN_SELF_INSERT, "\"");
// attributes.
// FIXME: Change only the pasted paragraphs
- BufferParams const & bp = cur.buffer().params();
- LayoutPtr const layout =
- bp.getTextClass().defaultLayout();
Font font = layout->font;
// ERT contents has always latex_language
font.setLanguage(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);
-
+ cur.current_font = layout->font;
+ cur.real_current_font = layout->font;
+ cur.current_font.setLanguage(latex_language);
+ cur.real_current_font.setLanguage(latex_language);
InsetCollapsable::doDispatch(cur, cmd);
break;
}
case LFUN_FLOAT_WIDE_INSERT:
case LFUN_WRAP_INSERT:
case LFUN_FONT_BOLD:
- case LFUN_FONT_CODE:
+ case LFUN_FONT_TYPEWRITER:
case LFUN_FONT_DEFAULT:
case LFUN_FONT_EMPH:
case LFUN_FONT_FREE_APPLY:
case LFUN_MENU_OPEN:
case LFUN_MENU_SEPARATOR_INSERT:
case LFUN_BRANCH_INSERT:
- case LFUN_CHARSTYLE_INSERT:
+ case LFUN_FLEX_INSERT:
case LFUN_NOTE_INSERT:
case LFUN_BOX_INSERT:
case LFUN_NOTE_NEXT:
void InsetERT::setButtonLabel()
{
// FIXME UNICODE
- setLabel(isOpen() ? _("ERT") : getNewLabel(_("ERT")));
+ if (decoration() == Classic)
+ setLabel(isOpen() ? _("ERT") : getNewLabel(_("ERT")));
+ else
+ setLabel(getNewLabel(_("ERT")));
}
}
-bool InsetERT::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetERT::metrics(MetricsInfo & mi, Dimension & dim) const
{
Font tmpfont = mi.base.font;
getDrawFont(mi.base.font);
mi.base.font.realize(tmpfont);
InsetCollapsable::metrics(mi, dim);
mi.base.font = tmpfont;
- bool const changed = dim_ != dim;
- dim_ = dim;
- return changed;
}