]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetinfo.C
reformatting and remove using delc
[lyx.git] / src / insets / insetinfo.C
index 1f4e68e7b4627756f56270a15a659ffdddfd7f72..dfc580636b2e938266ae7904f79c91bedf317dbe 100644 (file)
@@ -35,13 +35,19 @@ extern BufferView * current_view;
 
 
 InsetInfo::InsetInfo()
-       : form(0)
-{}
+       : form(0), labelfont(LyXFont::ALL_SANE)
+{
+       labelfont.decSize().decSize()
+               .setColor(LColor::note).setLatex(LyXFont::OFF);
+}
 
 
 InsetInfo::InsetInfo(string const & str)
-       : contents(str), form(0)
-{}
+       : contents(str), form(0), labelfont(LyXFont::ALL_SANE)
+{
+       labelfont.decSize().decSize()
+               .setColor(LColor::note).setLatex(LyXFont::OFF);
+}
 
 
 InsetInfo::~InsetInfo()
@@ -54,52 +60,48 @@ InsetInfo::~InsetInfo()
 }
 
 
-int InsetInfo::ascent(BufferView *, LyXFont const & font) const
+int InsetInfo::ascent(BufferView *, LyXFont const &) const
 {
-       return lyxfont::maxAscent(font) + 1;
+       return lyxfont::maxAscent(labelfont) + 1;
 }
 
 
-int InsetInfo::descent(BufferView *, LyXFont const & font) const
+int InsetInfo::descent(BufferView *, LyXFont const &) const
 {
-       return lyxfont::maxDescent(font) + 1;
+       return lyxfont::maxDescent(labelfont) + 1;
 }
 
 
-int InsetInfo::width(BufferView *, LyXFont const & font) const
+int InsetInfo::width(BufferView *, LyXFont const &) const
 {
-       return 6 + lyxfont::width(_("Note"), font);
+       return 6 + lyxfont::width(_("Note"), labelfont);
 }
 
 
-void InsetInfo::draw(BufferView * bv, LyXFont const & f,
+void InsetInfo::draw(BufferView * bv, LyXFont const &,
                     int baseline, float & x, bool) const
 {
        Painter & pain = bv->painter();
-       LyXFont font(f);
-       
-       /* Info-insets are never LaTeX, so just correct the font */
-       font.setLatex(LyXFont::OFF).setColor(LColor::note);
-       
+
        // Draw as "Note" in a yellow box
        x += 1;
-       pain.fillRectangle(int(x), baseline - ascent(bv, font) + 1,
-                          width(bv, font) - 2,
-                          ascent(bv, font) + descent(bv, font) - 2,
+       pain.fillRectangle(int(x), baseline - ascent(bv, labelfont),
+                          width(bv, labelfont) - 2,
+                          ascent(bv, labelfont) + descent(bv, labelfont) - 2,
                           LColor::notebg);
-       pain.rectangle(int(x), baseline - ascent(bv, font) + 1,
-                      width(bv, font) - 2,
-                      ascent(bv, font) + descent(bv, font) - 2,
+       pain.rectangle(int(x), baseline - ascent(bv, labelfont),
+                      width(bv, labelfont) - 2,
+                      ascent(bv, labelfont) + descent(bv, labelfont) - 2,
                       LColor::noteframe);
        
-       pain.text(int(x + 2), baseline, _("Note"), font);
-       x +=  width(bv, font) - 1;
+       pain.text(int(x + 2), baseline, _("Note"), labelfont);
+       x +=  width(bv, labelfont) - 1;
 }
 
 
 void InsetInfo::Write(Buffer const *, ostream & os) const
 {
-       os << "Info " << contents;
+       os << "Info\n" << contents;
 }
 
 
@@ -137,7 +139,7 @@ int InsetInfo::Latex(Buffer const *, ostream &,
 }
 
 
-int InsetInfo::Ascii(Buffer const *, ostream &) const
+int InsetInfo::Ascii(Buffer const *, ostream &, int) const
 {
        return 0;
 }
@@ -166,7 +168,7 @@ void InsetInfo::CloseInfoCB(FL_OBJECT * ob, long)
        InsetInfo * inset = static_cast<InsetInfo*>(ob->u_vdata);
        string tmp = fl_get_input(inset->strobj);
        Buffer * buffer = current_view->buffer();
-       if(tmp != inset->contents && !(buffer->isReadonly()) ) {
+       if (tmp != inset->contents && !(buffer->isReadonly())) {
                buffer->markDirty();
                inset->contents = tmp;
        }
@@ -186,7 +188,7 @@ void C_InsetInfo_CloseInfoCB(FL_OBJECT * ob, long data)
 }
 
 
-char const * InsetInfo::EditMessage() const 
+string const InsetInfo::EditMessage() const 
 {
        return _("Opened note");
 }
@@ -196,7 +198,7 @@ void InsetInfo::Edit(BufferView *bv, int, int, unsigned int)
 {
        static int ow = -1, oh;
 
-       if(bv->buffer()->isReadonly())
+       if (bv->buffer()->isReadonly())
                WarnReadonly(bv->buffer()->fileName());
        
        if (!form) {
@@ -219,7 +221,8 @@ void InsetInfo::Edit(BufferView *bv, int, int, unsigned int)
        if (form->visible) {
                fl_raise_form(form);
        } else {
-               fl_show_form(form, FL_PLACE_MOUSE | FL_FREE_SIZE, FL_FULLBORDER, 
+               fl_show_form(form,
+                            FL_PLACE_MOUSE | FL_FREE_SIZE, FL_TRANSIENT,
                             _("Note"));
                if (ow < 0) {
                        ow = form->w;
@@ -230,7 +233,7 @@ void InsetInfo::Edit(BufferView *bv, int, int, unsigned int)
 }
 
 
-Inset * InsetInfo::Clone() const
+Inset * InsetInfo::Clone(Buffer const &) const
 {
        return new InsetInfo(contents);
 }