+using std::ostringstream;
+
+
+namespace {
+
+typedef Translator<std::string, InsetNoteParams::Type> NoteTranslator;
+typedef Translator<docstring, InsetNoteParams::Type> NoteTranslatorLoc;
+
+NoteTranslator const init_notetranslator()
+{
+ NoteTranslator translator("Note", InsetNoteParams::Note);
+ translator.addPair("Comment", InsetNoteParams::Comment);
+ translator.addPair("Greyedout", InsetNoteParams::Greyedout);
+ translator.addPair("Framed", InsetNoteParams::Framed);
+ translator.addPair("Shaded", InsetNoteParams::Shaded);
+ return translator;
+}
+
+
+NoteTranslatorLoc const init_notetranslator_loc()
+{
+ NoteTranslatorLoc translator(_("Note"), InsetNoteParams::Note);
+ translator.addPair(_("Comment"), InsetNoteParams::Comment);
+ translator.addPair(_("Greyed out"), InsetNoteParams::Greyedout);
+ translator.addPair(_("Framed"), InsetNoteParams::Framed);
+ translator.addPair(_("Shaded"), InsetNoteParams::Shaded);
+ return translator;
+}
+
+
+NoteTranslator const & notetranslator()
+{
+ static NoteTranslator translator = init_notetranslator();
+ return translator;
+}
+
+
+NoteTranslatorLoc const & notetranslator_loc()
+{
+ static NoteTranslatorLoc translator = init_notetranslator_loc();
+ return translator;
+}
+
+} // anon
+
+
+
+
+InsetNoteParams::InsetNoteParams()
+ : type(Note)
+{}
+
+
+void InsetNoteParams::write(ostream & os) const
+{
+ string const label = notetranslator().find(type);
+ os << "Note " << label << "\n";
+}
+
+
+void InsetNoteParams::read(LyXLex & lex)
+{
+ string label;
+ lex >> label;
+ if (lex)
+ type = notetranslator().find(label);
+}
+
+
+void InsetNote::init()
+{
+ setInsetName(from_ascii("Note"));
+ setButtonLabel();
+}
+
+
+InsetNote::InsetNote(BufferParams const & bp, string const & label)
+ : InsetCollapsable(bp)
+{
+ params_.type = notetranslator().find(label);
+ init();
+}
+
+
+InsetNote::InsetNote(InsetNote const & in)
+ : InsetCollapsable(in), params_(in.params_)
+{
+ init();
+}
+
+
+InsetNote::~InsetNote()
+{
+ InsetNoteMailer(*this).hideDialog();
+}
+
+
+auto_ptr<InsetBase> InsetNote::doClone() const
+{
+ return auto_ptr<InsetBase>(new InsetNote(*this));
+}
+
+
+docstring const InsetNote::editMessage() const
+{
+ return _("Opened Note Inset");
+}