]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetERT.cpp
* src/insets/InsetInclude.cpp: formatting (in response to r18445)
[lyx.git] / src / insets / InsetERT.cpp
index 1ed5ae91b979c9ec680a7ff9a66e9c7f1882c91c..fbe18a8c2e4670fb6c285a86ac82ec6238108c65 100644 (file)
 #include "FuncStatus.h"
 #include "gettext.h"
 #include "Language.h"
-#include "LColor.h"
+#include "Color.h"
 #include "LyXAction.h"
 #include "Lexer.h"
-#include "LyXTextClass.h"
+#include "TextClass.h"
 #include "MetricsInfo.h"
 #include "ParagraphParameters.h"
 #include "Paragraph.h"
 
-#include "frontends/Alert.h"
+#include "frontends/alert.h"
 
 #include <sstream>
 
@@ -53,16 +53,13 @@ using std::string;
 void InsetERT::init()
 {
        setButtonLabel();
-
-       LyXFont font(LyXFont::ALL_SANE);
+       Font font(Font::ALL_SANE);
        font.decSize();
        font.decSize();
-       font.setColor(LColor::latex);
+       font.setColor(Color::latex);
        setLabelFont(font);
        text_.current_font.setLanguage(latex_language);
        text_.real_current_font.setLanguage(latex_language);
-
-       setInsetName(from_ascii("ERT"));
 }
 
 
@@ -80,9 +77,9 @@ InsetERT::InsetERT(InsetERT const & in)
 }
 
 
-auto_ptr<InsetBase> InsetERT::doClone() const
+auto_ptr<Inset> InsetERT::doClone() const
 {
-       return auto_ptr<InsetBase>(new InsetERT(*this));
+       return auto_ptr<Inset>(new InsetERT(*this));
 }
 
 
@@ -91,7 +88,7 @@ InsetERT::InsetERT(BufferParams const & bp,
                   Language const *, string const & contents, CollapseStatus status)
        : InsetCollapsable(bp, status)
 {
-       LyXFont font(LyXFont::ALL_INHERIT, latex_language);
+       Font font(Font::ALL_INHERIT, latex_language);
        paragraphs().begin()->insert(0, contents, font);
 
        // the init has to be after the initialization of the paragraph
@@ -125,7 +122,7 @@ void InsetERT::read(Buffer const & buf, Lexer & lex)
        // inherits the language from the last position of the existing text.
        // As a side effect this makes us also robust against bugs in LyX
        // that might lead to font changes in ERT in .lyx files.
-       LyXFont font(LyXFont::ALL_INHERIT, latex_language);
+       Font font(Font::ALL_INHERIT, latex_language);
        ParagraphList::iterator par = paragraphs().begin();
        ParagraphList::iterator const end = paragraphs().end();
        while (par != end) {
@@ -206,7 +203,7 @@ void InsetERT::doDispatch(Cursor & cur, FuncRequest & cmd)
        switch (cmd.action) {
 
        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;
@@ -227,9 +224,9 @@ void InsetERT::doDispatch(Cursor & cur, FuncRequest & cmd)
                // FIXME: Change only the pasted paragraphs
 
                BufferParams const & bp = cur.buffer().params();
-               LyXLayout_ptr const layout =
-                       bp.getLyXTextClass().defaultLayout();
-               LyXFont font = layout->font;
+               Layout_ptr const layout =
+                       bp.getTextClass().defaultLayout();
+               Font font = layout->font;
                // ERT contents has always latex_language
                font.setLanguage(latex_language);
                ParagraphList::iterator const end = paragraphs().end();
@@ -391,7 +388,7 @@ void InsetERT::setButtonLabel()
 }
 
 
-bool InsetERT::insetAllowed(InsetBase::Code /* code */) const
+bool InsetERT::insetAllowed(Inset::Code /* code */) const
 {
        return false;
 }
@@ -399,7 +396,7 @@ bool InsetERT::insetAllowed(InsetBase::Code /* code */) const
 
 bool InsetERT::metrics(MetricsInfo & mi, Dimension & dim) const
 {
-       LyXFont tmpfont = mi.base.font;
+       Font tmpfont = mi.base.font;
        getDrawFont(mi.base.font);
        mi.base.font.realize(tmpfont);
        InsetCollapsable::metrics(mi, dim);
@@ -412,7 +409,7 @@ bool InsetERT::metrics(MetricsInfo & mi, Dimension & dim) const
 
 void InsetERT::draw(PainterInfo & pi, int x, int y) const
 {
-       LyXFont tmpfont = pi.base.font;
+       Font tmpfont = pi.base.font;
        getDrawFont(pi.base.font);
        pi.base.font.realize(tmpfont);
        InsetCollapsable::draw(pi, x, y);
@@ -427,11 +424,11 @@ bool InsetERT::showInsetDialog(BufferView * bv) const
 }
 
 
-void InsetERT::getDrawFont(LyXFont & font) const
+void InsetERT::getDrawFont(Font & font) const
 {
-       font = LyXFont(LyXFont::ALL_INHERIT, latex_language);
-       font.setFamily(LyXFont::TYPEWRITER_FAMILY);
-       font.setColor(LColor::latex);
+       font = Font(Font::ALL_INHERIT, latex_language);
+       font.setFamily(Font::TYPEWRITER_FAMILY);
+       font.setColor(Color::latex);
 }