X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2Finsetnote.C;h=da3c39bfd6449a9f938261ad331b4db4b86358aa;hb=4a5b7a5952ad2381fcdf4830511293e184c7c5a1;hp=c8945ee3c8e53b9e92b1fbdc5c9806141026039f;hpb=cb8bb668e768b6e13863a0988779070297e33e6d;p=lyx.git diff --git a/src/insets/insetnote.C b/src/insets/insetnote.C index c8945ee3c8..da3c39bfd6 100644 --- a/src/insets/insetnote.C +++ b/src/insets/insetnote.C @@ -17,6 +17,7 @@ #include "insetnote.h" #include "gettext.h" #include "lyxfont.h" +#include "language.h" #include "buffer.h" #include "BufferView.h" #include "lyxtext.h" @@ -27,16 +28,14 @@ using std::ostream; + void InsetNote::init() { LyXFont font(LyXFont::ALL_SANE); font.decSize(); font.setColor(LColor::note); setLabelFont(font); - - setAutoCollapse(false); - setBackgroundColor(LColor::note); - + setBackgroundColor(LColor::notebg); setLabel(_("note")); setInsetName("Note"); } @@ -49,6 +48,20 @@ InsetNote::InsetNote() } +InsetNote::InsetNote(InsetNote const & in, bool same_id) + : InsetCollapsable(in, same_id) +{ + init(); +} + + +Inset * InsetNote::clone(Buffer const &, bool same_id) const +{ + return new InsetNote(*const_cast(this), same_id); +} + + +// This constructor is used for reading old InsetInfo InsetNote::InsetNote(Buffer const * buf, string const & contents, bool collapsed) : InsetCollapsable(collapsed) @@ -56,21 +69,15 @@ InsetNote::InsetNote(Buffer const * buf, string const & contents, init(); Paragraph * par = inset.paragraph(); - Paragraph::size_type pos = 0; - buf->insertStringAsLines(par, pos, LyXFont(LyXFont::ALL_INHERIT), - strip(contents, '\n')); -} - + LyXFont font(LyXFont::ALL_INHERIT, buf->params.language); -Inset * InsetNote::clone(Buffer const &, bool same_id) const -{ - InsetNote * result = new InsetNote; - result->inset.init(&inset, same_id); + // Since XForms doesn't support RTL, we can assume that old notes + // in RTL documents are written in English. + if (font.language()->RightToLeft()) + font.setLanguage(default_language); - result->collapsed_ = collapsed_; - if (same_id) - result->id_ = id_; - return result; + lyx::pos_type pos = 0; + buf->insertStringAsLines(par, pos, font, strip(contents, '\n')); }