]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetNote.cpp
following rev. 18724 boost/signal is not needed.
[lyx.git] / src / insets / InsetNote.cpp
index 6c35dd45456f36c43c2e8d4c9ca971a7cd97c50f..1a0cadc5feb81cd378243db50320e8613d8e3c0f 100644 (file)
@@ -14,6 +14,7 @@
 
 #include "InsetNote.h"
 
+#include "Buffer.h"
 #include "BufferView.h"
 #include "Cursor.h"
 #include "debug.h"
@@ -23,7 +24,7 @@
 #include "FuncStatus.h"
 #include "gettext.h"
 #include "LaTeXFeatures.h"
-#include "LColor.h"
+#include "Color.h"
 #include "Lexer.h"
 #include "MetricsInfo.h"
 #include "OutputParams.h"
@@ -112,7 +113,6 @@ void InsetNoteParams::read(Lexer & lex)
 
 void InsetNote::init()
 {
-       setInsetName(from_ascii("Note"));
        setButtonLabel();
 }
 
@@ -138,9 +138,9 @@ InsetNote::~InsetNote()
 }
 
 
-auto_ptr<InsetBase> InsetNote::doClone() const
+auto_ptr<Inset> InsetNote::doClone() const
 {
-       return auto_ptr<InsetBase>(new InsetNote(*this));
+       return auto_ptr<Inset>(new InsetNote(*this));
 }
 
 
@@ -150,6 +150,18 @@ docstring const InsetNote::editMessage() const
 }
 
 
+Inset::DisplayType InsetNote::display() const
+{
+       switch (params_.type) {
+       case InsetNoteParams::Framed:
+       case InsetNoteParams::Shaded:
+               return AlignLeft;
+       default:
+               return Inline;
+       }
+}
+
+
 void InsetNote::write(Buffer const & buf, ostream & os) const
 {
        params_.write(os);
@@ -170,30 +182,30 @@ void InsetNote::setButtonLabel()
        docstring const label = notetranslator_loc().find(params_.type);
        setLabel(label);
 
-       LyXFont font(LyXFont::ALL_SANE);
+       Font font(Font::ALL_SANE);
        font.decSize();
        font.decSize();
 
        switch (params_.type) {
        case InsetNoteParams::Note:
-               font.setColor(LColor::note);
-               setBackgroundColor(LColor::notebg);
+               font.setColor(Color::note);
+               setBackgroundColor(Color::notebg);
                break;
        case InsetNoteParams::Comment:
-               font.setColor(LColor::comment);
-               setBackgroundColor(LColor::commentbg);
+               font.setColor(Color::comment);
+               setBackgroundColor(Color::commentbg);
                break;
        case InsetNoteParams::Greyedout:
-               font.setColor(LColor::greyedout);
-               setBackgroundColor(LColor::greyedoutbg);
+               font.setColor(Color::greyedout);
+               setBackgroundColor(Color::greyedoutbg);
                break;
        case InsetNoteParams::Framed:
-               font.setColor(LColor::greyedout);
-               setBackgroundColor(LColor::greyedoutbg);
+               font.setColor(Color::greyedout);
+               setBackgroundColor(Color::greyedoutbg);
                break;
        case InsetNoteParams::Shaded:
-               font.setColor(LColor::greyedout);
-               setBackgroundColor(LColor::shadedbg);
+               font.setColor(Color::greyedout);
+               setBackgroundColor(Color::shadedbg);
                break;
        }
        setLabelFont(font);
@@ -297,7 +309,7 @@ int InsetNote::latex(Buffer const & buf, odocstream & os,
 
 
 int InsetNote::plaintext(Buffer const & buf, odocstream & os,
-                         OutputParams const & runparams_in) const
+                        OutputParams const & runparams_in) const
 {
        if (params_.type == InsetNoteParams::Note)
                return 0;
@@ -308,7 +320,7 @@ int InsetNote::plaintext(Buffer const & buf, odocstream & os,
                // Ignore files that are exported inside a comment
                runparams.exportdata.reset(new ExportData);
        }
-       os << '[' << _("note") << ":\n";
+       os << '[' << buf.B_("note") << ":\n";
        InsetText::plaintext(buf, os, runparams);
        os << "\n]";
 
@@ -317,7 +329,7 @@ int InsetNote::plaintext(Buffer const & buf, odocstream & os,
 
 
 int InsetNote::docbook(Buffer const & buf, odocstream & os,
-                       OutputParams const & runparams_in) const
+                      OutputParams const & runparams_in) const
 {
        if (params_.type == InsetNoteParams::Note)
                return 0;
@@ -337,7 +349,7 @@ int InsetNote::docbook(Buffer const & buf, odocstream & os,
 
        // Return how many newlines we issued.
        //return int(count(str.begin(), str.end(), '\n'));
-        return n + 1 + 2;
+       return n + 1 + 2;
 }
 
 
@@ -400,7 +412,7 @@ void InsetNoteMailer::string2params(string const & in,
                return print_mailer_error("InsetNoteMailer", in, 1, name_);
 
        // This is part of the inset proper that is usually swallowed
-       // by LyXText::readInset
+       // by Text::readInset
        string id;
        lex >> id;
        if (!lex || id != "Note")