]> git.lyx.org Git - features.git/commitdiff
fix the resize bug, make some more inset funcs const, cleanup in lyxscreen, painter...
authorLars Gullik Bjønnes <larsbj@gullik.org>
Fri, 18 Feb 2000 22:22:42 +0000 (22:22 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Fri, 18 Feb 2000 22:22:42 +0000 (22:22 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@561 a592a061-630c-0410-9148-cb99ea01b6c8

47 files changed:
ChangeLog
acinclude.m4
config/lyxinclude.m4
src/BufferView.C
src/BufferView2.C
src/Painter.C
src/Painter.h
src/PainterBase.h
src/WorkArea.C
src/insets/figinset.C
src/insets/figinset.h
src/insets/insetbib.C
src/insets/insetbib.h
src/insets/insetcommand.C
src/insets/insetcommand.h
src/insets/inseterror.C
src/insets/inseterror.h
src/insets/insetinclude.C
src/insets/insetinclude.h
src/insets/insetinfo.C
src/insets/insetinfo.h
src/insets/insetlabel.C
src/insets/insetlabel.h
src/insets/insetlatexaccent.C
src/insets/insetlatexaccent.h
src/insets/insetparent.C
src/insets/insetparent.h
src/insets/insetquotes.C
src/insets/insetquotes.h
src/insets/insetref.C
src/insets/insetref.h
src/insets/insetspecialchar.C
src/insets/insetspecialchar.h
src/insets/inseturl.C
src/insets/inseturl.h
src/insets/lyxinset.h
src/lyxfont.h
src/lyxparagraph.h
src/lyxscreen.h
src/mathed/formula.C
src/mathed/formula.h
src/mathed/formulamacro.C
src/mathed/formulamacro.h
src/paragraph.C
src/screen.C
src/text.C
src/text2.C

index 2664a8b08f51f0db40e06c6be9e8893515e0c5f9..a83b224a55681f618d2a50d5ae41b525e5d41ff2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2000-02-18  Lars Gullik Bjønnes  <larsbj@lyx.org>
+
+       * WorkArea, Painter, LyXScreen: Fixed the crash that occured on
+       resize due to wrong pixmap beeing used. Also took the opurtunity
+       to make the LyXScreen stateless on regard to WorkArea and some
+       general cleanup in the same files.
+       
 2000-02-17  Lars Gullik Bjønnes  <larsbj@lyx.org>
 
        * src/Makefile.am: add missing direction.h
index 5a04deef980ab62e5a094a1af3bde6df4aa8aa77..2330a68bc0edd4e2de05f560f007042a99be14a5 100644 (file)
@@ -185,7 +185,7 @@ dnl Check the version of g++
     case $gxx_version in
       2.7*) CXXFLAGS="$lyx_opt";;
       2.95.1) CXXFLAGS="-g $lyx_opt -fpermissive -fno-rtti";;
-      2.95.*) CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";;
+      2.95.*) CXXFLAGS="-g $lyx_opt -Woverloaded-virtual -fno-rtti -fno-exceptions";;
       *2.91.*) CXXFLAGS="-g $lyx_opt -Wno-return-type -fno-exceptions -fno-rtti";;
       *)    CXXFLAGS="-g $lyx_opt -fno-exceptions -fno-rtti";;
     esac
index 7209fa1b7a1d35c4eb55db98cc538cca0de784b2..c8f8cc85d4bb680094116d796f149adf89e0f0c9 100644 (file)
@@ -185,7 +185,7 @@ dnl Check the version of g++
     case $gxx_version in
       2.7*) CXXFLAGS="$lyx_opt";;
       2.95.1) CXXFLAGS="-g $lyx_opt -fpermissive -fno-rtti";;
-      2.95.*) CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";;
+      2.95.*) CXXFLAGS="-g $lyx_opt -Woverloaded-virtual -fno-rtti -fno-exceptions";;
       *2.91.*) CXXFLAGS="-g $lyx_opt -Wno-return-type -fno-exceptions -fno-rtti";;
       *)    CXXFLAGS="-g $lyx_opt -fno-exceptions -fno-rtti";;
     esac
index 157d4a1ae44874563c4413f03f04a9b8918829a5..ef52862ca43c6a846252122995c4022e9cfdf717 100644 (file)
@@ -32,6 +32,7 @@ using std::for_each;
 #include "LyXView.h"
 #include "lyxfunc.h"
 #include "insets/lyxinset.h"
+#include "insets/insetbib.h"
 #include "minibuffer.h"
 #include "lyxscreen.h"
 
@@ -70,8 +71,8 @@ BufferView::BufferView(LyXView * o, int xpos, int ypos,
 {
        buffer_ = 0;
        text = 0;
-       screen = 0;
        workarea = new WorkArea(this, xpos, ypos, width, height);
+       screen = 0;
        timer_cursor = 0;
        create_view();
        current_scrollbar_value = 0;
@@ -170,14 +171,7 @@ void BufferView::updateScreen()
 {
        // Regenerate the screen.
        delete screen;
-       screen = new LyXScreen(this,
-                              workarea->getWin(),
-                              workarea->getPixmap(),
-                              workarea->workWidth(),
-                              workarea->height(),
-                              workarea->xpos(),
-                              workarea->ypos(),
-                              text);
+       screen = new LyXScreen(*workarea, text);
 }
 
 
index e38a0ca2bd16a4565b39d018c221e80ae6ea547a..f6cc6a41c407f5a943fe7c694645d7fc5f5e9be4 100644 (file)
@@ -709,7 +709,7 @@ void BufferView::showLockedInsetCursor(long x, long y, int asc, int desc)
 void BufferView::hideLockedInsetCursor()
 {
        if (the_locking_inset && available()) {
-               screen->HideManualCursor();
+               screen->HideCursor();
        }
 }
 
index f12c833bbd65ad229c8271c3a5405875b1f679bb..4396ab1408173227ae00195ccac8c8c79db245bd 100644 (file)
@@ -27,6 +27,7 @@
 #include "lyxfont.h"
 #include "support/LAssert.h"
 #include "support/lstrings.h"
+#include "WorkArea.h"
 
 Painter::Painter(WorkArea & wa)
        : PainterBase(wa)
@@ -54,6 +55,12 @@ Painter::~Painter() {
 }
 
 
+Drawable Painter::drawable() const 
+{
+       return owner.getPixmap();
+}
+
+
 /* Basic drawing routines */
 
 extern bool Lgb_bug_find_hack;
@@ -64,10 +71,10 @@ PainterBase & Painter::point(int x, int y, LColor::color c)
                if (!Lgb_bug_find_hack)
                        lyxerr << "point not called from "
                                "workarea::workhandler\n";
-               lyxerr.debug() << "Painter drawable: " << drawable << endl;
+               lyxerr.debug() << "Painter drawable: " << drawable() << endl;
        }
        
-       XDrawPoint(display, drawable, getGCForeground(c), x, y);
+       XDrawPoint(display, drawable(), getGCForeground(c), x, y);
        return *this;
 }
 
@@ -81,10 +88,10 @@ PainterBase & Painter::line(int x1, int y1, int x2, int y2,
                if (!Lgb_bug_find_hack)
                        lyxerr << "line not called from "
                                "workarea::workhandler\n";
-               lyxerr.debug() << "Painter drawable: " << drawable << endl;
+               lyxerr.debug() << "Painter drawable: " << drawable() << endl;
        }
        
-       XDrawLine(display, drawable, 
+       XDrawLine(display, drawable()
                  getGCLinepars(ls, lw, col), x1, y1, x2, y2);
        return *this;
 }
@@ -99,7 +106,7 @@ PainterBase & Painter::lines(int const * xp, int const * yp, int np,
                if (!Lgb_bug_find_hack)
                        lyxerr << "lines not called from "
                                "workarea::workhandler\n";
-               lyxerr.debug() << "Painter drawable: " << drawable << endl;
+               lyxerr.debug() << "Painter drawable: " << drawable() << endl;
        }
        
 #ifndef HAVE_AUTO_PTR
@@ -112,7 +119,7 @@ PainterBase & Painter::lines(int const * xp, int const * yp, int np,
                points[i].y = yp[i];
        }
 
-        XDrawLines(display, drawable, getGCLinepars(ls, lw, col), 
+        XDrawLines(display, drawable(), getGCLinepars(ls, lw, col), 
                   points, np, CoordModeOrigin);
 
 #ifndef HAVE_AUTO_PTR
@@ -131,10 +138,10 @@ PainterBase & Painter::rectangle(int x, int y, int w, int h,
                if (!Lgb_bug_find_hack)
                        lyxerr << "rectangle not called from "
                                "workarea::workhandler\n";
-               lyxerr << "Painter drawable: " << drawable << endl;
+               lyxerr << "Painter drawable: " << drawable() << endl;
        }
        
-       XDrawRectangle(display, drawable, getGCLinepars(ls, lw, col), 
+       XDrawRectangle(display, drawable(), getGCLinepars(ls, lw, col), 
                       x, y, w, h);
        return *this;
 }
@@ -147,10 +154,10 @@ PainterBase & Painter::fillRectangle(int x, int y, int w, int h,
                if (!Lgb_bug_find_hack)
                        lyxerr << "fillrectangle not called from "
                                "workarea::workhandler\n";
-               lyxerr << "Painter drawable: " << drawable << endl;
+               lyxerr << "Painter drawable: " << drawable() << endl;
        }
        
-       XFillRectangle(display, drawable, getGCForeground(col), x, y, w, h);
+       XFillRectangle(display, drawable(), getGCForeground(col), x, y, w, h);
        return *this;
 }
 
@@ -162,7 +169,7 @@ PainterBase & Painter::fillPolygon(int const * xp, int const * yp, int np,
                if (!Lgb_bug_find_hack)
                        lyxerr <<"fillpolygon not called from "
                                "workarea::workhandler\n";
-               lyxerr << "Painter drawable: " << drawable << endl;
+               lyxerr << "Painter drawable: " << drawable() << endl;
        }
        
 #ifndef HAVE_AUTO_PTR
@@ -175,7 +182,7 @@ PainterBase & Painter::fillPolygon(int const * xp, int const * yp, int np,
                points[i].y = yp[i];
        }
 
-       XFillPolygon(display, drawable, getGCForeground(col), points, np, 
+       XFillPolygon(display, drawable(), getGCForeground(col), points, np, 
                     Nonconvex, CoordModeOrigin);
 #ifndef HAVE_AUTO_PTR
        delete[] points;
@@ -192,10 +199,10 @@ PainterBase & Painter::arc(int x, int y,
                if (!Lgb_bug_find_hack)
                        lyxerr << "arc not called from "
                                "workarea::workhandler\n";
-               lyxerr << "Painter drawable: " << drawable << endl;
+               lyxerr << "Painter drawable: " << drawable() << endl;
        }
        
-        XDrawArc(display, drawable, getGCForeground(col),
+        XDrawArc(display, drawable(), getGCForeground(col),
                  x, y, w, h, a1, a2);
        return *this;
 }     
@@ -211,7 +218,7 @@ PainterBase & Painter::segments(int const * x1, int const * y1,
                if (!Lgb_bug_find_hack)
                        lyxerr << "segments not called from "
                                "workarea::workhandler\n";
-               lyxerr << "Painter drawable: " << drawable << endl;
+               lyxerr << "Painter drawable: " << drawable() << endl;
        }
        
 #ifndef HAVE_AUTO_PTR
@@ -225,7 +232,7 @@ PainterBase & Painter::segments(int const * x1, int const * y1,
                s[i].x2 = x2[i];
                s[i].y2 = y2[i];
        }
-       XDrawSegments(display, drawable, getGCLinepars(ls, lw, col), s, ns);
+       XDrawSegments(display, drawable(), getGCLinepars(ls, lw, col), s, ns);
 
 #ifndef HAVE_AUTO_PTR
        delete [] s;
@@ -240,14 +247,14 @@ PainterBase & Painter::pixmap(int x, int y, int w, int h, Pixmap bitmap)
                if (!Lgb_bug_find_hack)
                        lyxerr << "workAreaExpose not called from "
                                "workarea::workhandler\n";
-               lyxerr << "Painter drawable: " << drawable << endl;
+               lyxerr << "Painter drawable: " << drawable() << endl;
        }
        
        XGCValues val;
        val.function = GXcopy;
-       GC gc = XCreateGC(display, drawable,
+       GC gc = XCreateGC(display, drawable(),
                          GCFunction, &val);
-       XCopyArea(display, bitmap, drawable, gc,
+       XCopyArea(display, bitmap, drawable(), gc,
                  0, 0, w, h, x, y);
        XFreeGC(display, gc);
        return *this;
@@ -274,12 +281,12 @@ PainterBase & Painter::text(int x, int y, char const * s, int ls,
                if (!Lgb_bug_find_hack)
                        lyxerr << "text not called from "
                                "workarea::workhandler\n";
-               lyxerr << "Painter drawable: " << drawable << endl;
+               lyxerr << "Painter drawable: " << drawable() << endl;
        }
        
        GC gc = getGCForeground(f.realColor());
        XSetFont(display, gc, f.getFontID());
-       XDrawString(display, drawable, gc, x, y, s, ls);
+       XDrawString(display, drawable(), gc, x, y, s, ls);
        underline(f, x, y, this->width(s, ls, f));
        return *this;
 }
@@ -303,7 +310,7 @@ void Painter::underline(LyXFont const & f, int x, int y, int width)
 GC Painter::getGCForeground(LColor::color c)
 {
        if (lyxerr.debugging()) {
-               lyxerr << "Painter drawable: " << drawable << endl;
+               lyxerr << "Painter drawable: " << drawable() << endl;
        }
        
        if (colorGCcache[c] != 0) return colorGCcache[c];
@@ -387,7 +394,7 @@ GC Painter::getGCForeground(LColor::color c)
        }
 
        val.function = GXcopy;
-       return colorGCcache[c] = XCreateGC(display, drawable,
+       return colorGCcache[c] = XCreateGC(display, drawable(),
                                    GCForeground | GCFunction, &val);
 }
 
@@ -397,7 +404,7 @@ GC Painter::getGCLinepars(enum line_style ls,
                          enum line_width lw, LColor::color c)
 {
        if (lyxerr.debugging()) {
-               lyxerr << "Painter drawable: " << drawable << endl;
+               lyxerr << "Painter drawable: " << drawable() << endl;
        }
        
        int index = lw + (ls << 1) + (c << 3);
@@ -425,7 +432,7 @@ GC Painter::getGCLinepars(enum line_style ls,
        val.function = GXcopy;
 
        return lineGCcache[index] =
-               XCreateGC(display, drawable, 
+               XCreateGC(display, drawable()
                          GCForeground | GCLineStyle | GCLineWidth | 
                          GCCapStyle | GCJoinStyle | GCFunction, &val);
 }
index 3a8bad6ab59cca18f970da2d50f057b3febcc053..780aad225bf97f5eec43d2dcf5692d759f99a5a9 100644 (file)
@@ -109,9 +109,6 @@ protected:
        ///
        PainterBase & setDisplay(Display * d) { display = d; return *this; }
        
-       ///
-       PainterBase & setDrawable(Drawable d) { drawable = d; return *this; }
-       
        /// Get foreground color in ordinary GC
        GC getGCForeground(LColor::color c);
        
@@ -124,8 +121,10 @@ protected:
        /**@Low level X parameters */
        ///
        Display * display;
+
        ///
-       Drawable drawable;
+       Drawable drawable() const;
+               
        ///
        Colormap colormap;
        
index 24e174857775204b8c08ae07bc43b94f74082a41..9657322df14f056625bae711bda872eb161d1104 100644 (file)
@@ -192,7 +192,7 @@ public:
                             int & width = PainterBase::dummy1,
                             int & ascent = PainterBase::dummy2, 
                             int & descent = PainterBase::dummy3);
-private:
+protected:
        WorkArea & owner;
 };
 
index 899beb71dc238b5e7ea00933cf4347d0784f62ad..cc409b11e5c718f61c8e2d476a1953620829f575 100644 (file)
@@ -164,7 +164,6 @@ WorkArea::WorkArea(BufferView * o, int xpos, int ypos, int width, int height)
 
        // setup the painter
        painter_.setDisplay(fl_display);
-       painter_.setDrawable(workareapixmap);
        
        // We add this object as late as possible to avoit problems
        // with drawing.
@@ -223,9 +222,6 @@ void WorkArea::resize(int xpos, int ypos, int width, int height)
        // Create the workarea pixmap
        createPixmap(width - 15 - 2 * bw, height - 2 * bw);
 
-       // reset the painter
-       painter_.setDrawable(workareapixmap);
-       
        // the free object
        fl_set_object_geometry(work_area, xpos + bw, ypos + bw,
                               width - 15 - 2 * bw,
index 69b6ae70ae2f95d2e8ce8566a5a8ba5fc70bc9cd..3f0a2cb1d767bd2da11f4fda1eab37ef2c685572 100644 (file)
@@ -1097,7 +1097,7 @@ void InsetFig::draw(Painter & pain, LyXFont const & f,
 }
 
 
-void InsetFig::Write(ostream & os)
+void InsetFig::Write(ostream & os) const
 {
        Regenerate();
        os << "Figure size " << wid << " " << hgh << "\n";
@@ -1200,7 +1200,7 @@ void InsetFig::Read(LyXLex & lex)
 }
 
 
-int InsetFig::Latex(ostream & os, signed char /* fragile*/ )
+int InsetFig::Latex(ostream & os, signed char /* fragile*/ ) const
 {
        Regenerate();
        if (!cmd.empty()) os << cmd << " ";
@@ -1208,7 +1208,7 @@ int InsetFig::Latex(ostream & os, signed char /* fragile*/ )
 }
 
 
-int InsetFig::Latex(string & file, signed char /* fragile*/ )
+int InsetFig::Latex(string & file, signed char /* fragile*/ ) const
 {
        Regenerate();
        file += cmd + ' ';
@@ -1216,13 +1216,13 @@ int InsetFig::Latex(string & file, signed char /* fragile*/ )
 }
 
 
-int InsetFig::Linuxdoc(string &/*file*/)
+int InsetFig::Linuxdoc(string &/*file*/) const
 {
        return 0;
 }
 
 
-int InsetFig::DocBook(string & file)
+int InsetFig::DocBook(string & file) const
 {
        string figurename = fname;
 
@@ -1330,7 +1330,7 @@ Inset::Code InsetFig::LyxCode() const
 }
 
 
-void InsetFig::Regenerate()
+void InsetFig::Regenerate() const
 {
        string cmdbuf;
        string resizeW, resizeH;
index dc47ae8c9f22c9ce372b3255173e2887d4629bb6..cba75e4f71861f384e01b118fe5d1fa11d0332c4 100644 (file)
@@ -34,17 +34,17 @@ public:
        void draw(Painter &, LyXFont const & font,
                  int baseline, float & x) const;
        ///
-       void Write(ostream &);
+       void Write(ostream &) const;
        ///
        void Read(LyXLex & lex);
        ///
-       int Latex(ostream &, signed char fragile);
+       int Latex(ostream &, signed char fragile) const;
        ///
-       int Latex(string & file, signed char fragile);
+       int Latex(string & file, signed char fragile) const;
        ///
-       int Linuxdoc(string & file);
+       int Linuxdoc(string & file) const;
        ///
-       int DocBook(string & file);
+       int DocBook(string & file) const;
        /// Updates needed features for this inset.
        void Validate(LaTeXFeatures & features) const;
 
@@ -117,7 +117,7 @@ public:
        float angle;
        
        /// graphics command, latex version
-       string cmd;
+       mutable string cmd;
        
        /// Caption for subfigure package
        string subcaption;
@@ -139,7 +139,7 @@ private:
        /// recompute screen params
        void Recompute();
        /// regenerate \includegraphics{} command
-       void Regenerate();
+       void Regenerate() const;
        /// regenerate \inlcudegraphics{} command in temporary buffer
        void TempRegenerate();
        /// get sizes from .eps file
index 826c3cc34c533873802b95c684c04aed6fb933ff..01f5ae9c6b98367e0fad0f1ec67b3620ac634d1b 100644 (file)
@@ -226,7 +226,7 @@ void InsetBibKey::setCounter(int c)
 // as a LyX 2.x command, and lyxlex is not enough smart to understand
 // real LaTeX commands. Yes, that could be fixed, but would be a waste 
 // of time cause LyX3 won't use lyxlex anyway.  (ale)
-void InsetBibKey::Write(ostream & os)
+void InsetBibKey::Write(ostream & os) const
 {
        string s;
        if (!options.empty()) {
@@ -296,7 +296,7 @@ string InsetBibtex::getScreenLabel() const
 }
 
 
-int InsetBibtex::Latex(ostream & os, signed char /*fragile*/)
+int InsetBibtex::Latex(ostream & os, signed char /*fragile*/) const
 {
        string bib;
        signed char dummy = 0;
@@ -306,7 +306,7 @@ int InsetBibtex::Latex(ostream & os, signed char /*fragile*/)
 }
 
 
-int InsetBibtex::Latex(string & file, signed char /*fragile*/)
+int InsetBibtex::Latex(string & file, signed char /*fragile*/) const
 {
        // this looks like an horrible hack and it is :) The problem
        // is that owner is not initialized correctly when the bib
index 04ec9d3d5ec987643525d6460359ff407a6ea794..493e0112075812e061c34630996e611ba7d4530a 100644 (file)
@@ -64,7 +64,7 @@ public:
        ///
         Inset * Clone() const { return new InsetBibKey(this); }
        /// Currently \bibitem is used as a LyX2.x command, so we need this method.
-        void Write(ostream &);
+        void Write(ostream &) const;
        ///
        virtual string getScreenLabel() const;
         ///
@@ -111,9 +111,9 @@ public:
        ///
        void Edit(int, int);
        /// 
-       int Latex(ostream &, signed char);
+       int Latex(ostream &, signed char) const;
        ///
-       int Latex(string & file, signed char fragile);
+       int Latex(string & file, signed char fragile) const;
        ///
        string getKeys(char delim);
        ///
@@ -128,7 +128,7 @@ public:
        bool display() const { return true; }    
 private:
        ///
-       Buffer * owner;
+       mutable Buffer * owner;
 };
 
 #endif
index d6af5cc01726bac1657d714fc054773ee4473796..61d516961a976674cba60fa71cec0ce93a60fd93 100644 (file)
@@ -164,7 +164,7 @@ void InsetCommand::draw(Painter & pain, LyXFont const &,
 
 
 // In lyxf3 this will be just LaTeX
-void InsetCommand::Write(ostream & os)
+void InsetCommand::Write(ostream & os) const
 {
        os << "LatexCommand " << getCommand() << "\n";
 }
@@ -244,27 +244,27 @@ void InsetCommand::Read(LyXLex & lex)
 }
 
 
-int InsetCommand::Latex(ostream & os, signed char /*fragile*/)
+int InsetCommand::Latex(ostream & os, signed char /*fragile*/) const
 {
        os << getCommand();
        return 0;
 }
 
 
-int InsetCommand::Latex(string & file, signed char /*fragile*/)
+int InsetCommand::Latex(string & file, signed char /*fragile*/) const
 {
        file += getCommand();
        return 0;
 }
 
 
-int InsetCommand::Linuxdoc(string &/*file*/)
+int InsetCommand::Linuxdoc(string &/*file*/) const
 {
        return 0;
 }
 
 
-int InsetCommand::DocBook(string &/*file*/)
+int InsetCommand::DocBook(string &/*file*/) const
 {
        return 0;
 }
index 87c7e4049542960e3930fe4658c8ce5191948922..c784b195441d99afe9243f36b0c0e2fcef0c6b30 100644 (file)
@@ -41,19 +41,19 @@ public:
        ///
        void draw(Painter &, LyXFont const &, int baseline, float & x) const;
        ///
-       void Write(ostream &);
+       void Write(ostream &) const;
        /// Parse the command.
        void scanCommand(string const & cmd);
        /// Will not be used when lyxf3
        void Read(LyXLex & lex);
        /// 
-       virtual int Latex(ostream &, signed char fragile);
+       virtual int Latex(ostream &, signed char fragile) const;
        ///
-       virtual int Latex(string & file, signed char fragile);
+       virtual int Latex(string & file, signed char fragile) const;
        ///
-       virtual int Linuxdoc(string & file);
+       virtual int Linuxdoc(string & file) const;
        ///
-       virtual int DocBook(string & file);
+       virtual int DocBook(string & file) const;
        ///
        Inset * Clone() const;
        ///  
index 75b118fea7bea3148eb836f46bb89df66b086f5d..b0c1ad29b909c8a2a9acdbe8579e10f4ef9870b5 100644 (file)
@@ -91,7 +91,7 @@ void InsetError::draw(Painter & pain, LyXFont const & font,
 }
 
 
-void InsetError::Write(ostream &)
+void InsetError::Write(ostream &) const
 {
 }
 
@@ -101,25 +101,25 @@ void InsetError::Read(LyXLex &)
 }
 
 
-int InsetError::Latex(ostream &, signed char /*fragile*/)
+int InsetError::Latex(ostream &, signed char /*fragile*/) const
 {
        return 0;
 }
 
 
-int InsetError::Latex(string &, signed char /*fragile*/)
+int InsetError::Latex(string &, signed char /*fragile*/) const
 {
        return 0;
 }
 
 
-int InsetError::Linuxdoc(string &)
+int InsetError::Linuxdoc(string &) const
 {
        return 0;
 }
 
 
-int InsetError::DocBook(string &)
+int InsetError::DocBook(string &) const
 {
        return 0;
 }
index 030b585527ae7037a9ad8e800abed4712d1136e3..b863091d7b9f41e9d974b4c631029e2708f81590 100644 (file)
@@ -44,17 +44,17 @@ public:
        void draw(Painter &, LyXFont const & font,
                  int baseline, float & x) const;
        ///
-       void Write(ostream &);
+       void Write(ostream &) const;
        ///
        void Read(LyXLex & lex);
        ///
-       int Latex(ostream &, signed char fragile);
+       int Latex(ostream &, signed char fragile) const;
        ///
-       int Latex(string & file, signed char fragile);
+       int Latex(string & file, signed char fragile) const;
        ///
-       int Linuxdoc(string & file);
+       int Linuxdoc(string & file) const;
        ///
-       int DocBook(string & file);
+       int DocBook(string & file) const;
        ///
        bool AutoDelete() const;
        /// what appears in the minibuffer when opening
index a8b37408f28e57a1767c4a866add79211083dd61..c27268d0f70f9a0818784ce46835489aa4055fce 100644 (file)
@@ -260,7 +260,7 @@ void InsetInclude::Edit(int, int)
 }
 
 
-void InsetInclude::Write(ostream & os)
+void InsetInclude::Write(ostream & os) const
 {
        os << "Include " << getCommand() << "\n";
 }
@@ -316,7 +316,7 @@ bool InsetInclude::loadIfNeeded() const
 }
 
 
-int InsetInclude::Latex(ostream & os, signed char /*fragile*/)
+int InsetInclude::Latex(ostream & os, signed char /*fragile*/) const
 {
        string include_file;
        signed char dummy = 0;
@@ -326,7 +326,7 @@ int InsetInclude::Latex(ostream & os, signed char /*fragile*/)
 }
 
 
-int InsetInclude::Latex(string & file, signed char /*fragile*/)
+int InsetInclude::Latex(string & file, signed char /*fragile*/) const
 {
        string writefile, incfile;
 
index b0e1e84f5c11d22ffcebcb6e2ac23086e85c54f4..6cc19d7519714bf4168dfe5df6b31c3e417a1a3f 100644 (file)
@@ -54,13 +54,13 @@ public:
                return 1;
        }
         /// With lyx3 we won't overload these 3 methods
-        void Write(ostream &);
+        void Write(ostream &) const;
         ///
        void Read(LyXLex &);
        /// 
-       int Latex(ostream &, signed char fragile);
+       int Latex(ostream &, signed char fragile) const;
        ///
-       int Latex(string & file, signed char fragile);
+       int Latex(string & file, signed char fragile) const;
        
        ///
        void Validate(LaTeXFeatures &) const;
index 93d5f604f8920a2029ec04a1850ed125e0bafd4a..4dcc96f6747dbc197677e168f2b84b57a66ba91d 100644 (file)
@@ -93,7 +93,7 @@ void InsetInfo::draw(Painter & pain, LyXFont const & f,
 }
 
 
-void InsetInfo::Write(ostream & os)
+void InsetInfo::Write(ostream & os) const
 {
        os << "Info " << contents;
 }
@@ -126,25 +126,25 @@ void InsetInfo::Read(LyXLex & lex)
 }
       
 
-int InsetInfo::Latex(ostream &, signed char /*fragile*/)
+int InsetInfo::Latex(ostream &, signed char /*fragile*/) const
 {
        return 0;
 }
 
 
-int InsetInfo::Latex(string &, signed char /*fragile*/)
+int InsetInfo::Latex(string &, signed char /*fragile*/) const
 {
        return 0;
 }
 
 
-int InsetInfo::Linuxdoc(string &)
+int InsetInfo::Linuxdoc(string &) const
 {
        return 0;
 }
 
 
-int InsetInfo::DocBook(string &)
+int InsetInfo::DocBook(string &) const
 {
        return 0;
 }
index a08e46df38d3c0caa3846384d6afa29744e9dbaa..da159fb252cacdfeaa82e4087c6c199f49cfe54e 100644 (file)
@@ -45,17 +45,17 @@ public:
        ///
        void draw(Painter &, LyXFont const &, int baseline, float & x) const;
        ///
-       void Write(ostream &);
+       void Write(ostream &) const;
        ///
        void Read(LyXLex & lex);
        ///
-       int Latex(ostream &, signed char fragile);
+       int Latex(ostream &, signed char fragile) const;
        ///
-       int Latex(string & file, signed char fragile);
+       int Latex(string & file, signed char fragile) const;
        ///
-       int Linuxdoc(string & file);
+       int Linuxdoc(string & file) const;
        ///
-       int DocBook(string & file);
+       int DocBook(string & file) const;
        /// what appears in the minibuffer when opening
        char const * EditMessage() const {return _("Opened note");}
        ///
index b669e72b24318cb303be0bed3cb22627675a5a51..9e5143df54f8e7d4046b4f3cafe507a7a008eef7 100644 (file)
@@ -43,28 +43,28 @@ string InsetLabel::getLabel(int) const
 }
 
 
-int InsetLabel::Latex(ostream & os, signed char /*fragile*/)
+int InsetLabel::Latex(ostream & os, signed char /*fragile*/) const
 {
        os << escape(getCommand());
        return 0;
 }
 
 
-int InsetLabel::Latex(string & file, signed char /*fragile*/)
+int InsetLabel::Latex(string & file, signed char /*fragile*/) const
 {
        file += escape(getCommand());
        return 0;
 }
 
 
-int InsetLabel::Linuxdoc(string & file)
+int InsetLabel::Linuxdoc(string & file) const
 {
        file += "<label id=\"" + getContents() +"\" >";
        return 0;
 }
 
 
-int InsetLabel::DocBook(string & file)
+int InsetLabel::DocBook(string & file) const
 {
        file += "<anchor id=\"" + getContents() +"\" >";
        return 0;
index 8e96117873a6c06850815328966c92694b960343..d4366befd68144213d013b3ce8663a7f7954ba5f 100644 (file)
@@ -39,13 +39,13 @@ public:
        ///
        unsigned char Editable() const { return 0; }
        ///
-       int Latex(ostream &, signed char fragile);
+       int Latex(ostream &, signed char fragile) const;
        ///
-       int Latex(string & file, signed char fragile);
+       int Latex(string & file, signed char fragile) const;
        ///
-       int Linuxdoc(string & file);
+       int Linuxdoc(string & file) const;
        ///
-       int DocBook(string & file);
+       int DocBook(string & file) const;
 private:
        /// This function escapes 8-bit characters
        string escape(string const &) const;
index 3aaf2c50c3f5b92b46d48502092ea36173a1fc20..671c97d38b262a1614b2dbf61202ffd32d8074fb 100644 (file)
@@ -731,7 +731,7 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
 }
 
 
-void InsetLatexAccent::Write(ostream & os)
+void InsetLatexAccent::Write(ostream & os) const
 {
        os << "\\i " << contents << "\n";
 }
@@ -745,28 +745,28 @@ void InsetLatexAccent::Read(LyXLex & lex)
 }
 
 
-int InsetLatexAccent::Latex(ostream & os, signed char /*fragile*/)
+int InsetLatexAccent::Latex(ostream & os, signed char /*fragile*/) const
 {
        os << contents;
        return 0;
 }
 
 
-int InsetLatexAccent::Latex(string & file, signed char /*fragile*/)
+int InsetLatexAccent::Latex(string & file, signed char /*fragile*/) const
 {
        file += contents;
        return 0;
 }
 
 
-int InsetLatexAccent::Linuxdoc(string & file)
+int InsetLatexAccent::Linuxdoc(string & file) const
 {
        file += contents;
        return 0;
 }
 
 
-int InsetLatexAccent::DocBook(string & file)
+int InsetLatexAccent::DocBook(string & file) const
 {
        file += contents;
        return 0;
index 025058749c0afc63ffafda5bec4f9f665f1ee9e1..53fef7fb1ecadde47da231a1f8a133908266de34 100644 (file)
@@ -49,17 +49,17 @@ public:
        bool DisplayISO8859_9(Painter &, LyXFont const & font,
                              int baseline, float & x) const;
        ///
-       void Write(ostream &);
+       void Write(ostream &) const;
        ///
        void Read(LyXLex & lex);
        ///
-       int Latex(ostream &, signed char fragile);
+       int Latex(ostream &, signed char fragile) const;
        ///
-       int Latex(string & file, signed char fragile);
+       int Latex(string & file, signed char fragile) const;
        ///
-       int Linuxdoc(string & file);
+       int Linuxdoc(string & file) const;
        ///
-       int DocBook(string & file);
+       int DocBook(string & file) const;
        ///
        bool Deletable() const;
        ///
index 8738e04d5bfae65e4cc4aeb76bca21d83cbd64b5..b5b3db8548a83d67a24c984e03ccc5e75b16bc69 100644 (file)
@@ -46,7 +46,7 @@ void InsetParent::Edit(int, int)
 
 
 // LaTeX must just ignore this command
-int InsetParent::Latex(ostream & os, signed char fragile)
+int InsetParent::Latex(ostream & os, signed char fragile) const
 {
        os << "%%#{lyx}";
        InsetCommand::Latex(os, fragile);
@@ -55,7 +55,7 @@ int InsetParent::Latex(ostream & os, signed char fragile)
 
 
 // LaTeX must just ignore this command
-int InsetParent::Latex(string & file, signed char fragile)
+int InsetParent::Latex(string & file, signed char fragile) const
 {
        file += "%%#{lyx}";
        InsetCommand::Latex(file, fragile);
index fda6378d4a4f89b130252a8f8d90c36ad7f2fb62..1dad22b5cf47828e67bbf55cee826f880e2b6f63 100644 (file)
@@ -31,9 +31,9 @@ public:
        ///
         InsetParent(string const & fn, Buffer * owner = 0);
        /// 
-       int Latex(ostream &, signed char fragile);
+       int Latex(ostream &, signed char fragile) const;
        ///
-       int Latex(string & file, signed char fragile);
+       int Latex(string & file, signed char fragile) const;
         ///
         Inset * Clone() const { return new InsetParent(getContents()); }
        ///
index 23b2175b5689be613982b73403314d96c7284121..de2790db471288ad13ea977a94d9585fe1bb50c4 100644 (file)
@@ -204,7 +204,7 @@ void InsetQuotes::draw(Painter & pain, LyXFont const & font,
 }
 
 
-void InsetQuotes::Write(ostream & os)
+void InsetQuotes::Write(ostream & os) const
 {
        string text;
        text += language_char[language];
@@ -221,7 +221,7 @@ void InsetQuotes::Read(LyXLex & lex)
 }
 
 
-int InsetQuotes::Latex(ostream & os, signed char /*fragile*/)
+int InsetQuotes::Latex(ostream & os, signed char /*fragile*/) const
 {
        string quote;
        int res = Latex(quote, 0);
@@ -230,7 +230,7 @@ int InsetQuotes::Latex(ostream & os, signed char /*fragile*/)
 }
 
 
-int InsetQuotes::Latex(string & file, signed char /*fragile*/)
+int InsetQuotes::Latex(string & file, signed char /*fragile*/) const
 {
        string doclang = 
                current_view->buffer()->GetLanguage();
@@ -264,7 +264,7 @@ int InsetQuotes::Latex(string & file, signed char /*fragile*/)
 }
 
 
-int InsetQuotes::Linuxdoc(string & file)
+int InsetQuotes::Linuxdoc(string & file) const
 {
        file += "\"";
 
@@ -272,7 +272,7 @@ int InsetQuotes::Linuxdoc(string & file)
 }
 
 
-int InsetQuotes::DocBook(string & file)
+int InsetQuotes::DocBook(string & file) const
 {
        if(times == InsetQuotes::DoubleQ) {
                if (side == InsetQuotes::LeftQ)
index bbf244ae22a4e407a714fdf9cb3ccb82eb6983b9..69fbc5605d06a0bc370f4a4c238a3123e8986a3b 100644 (file)
@@ -81,17 +81,17 @@ public:
        ///
        LyXFont ConvertFont(LyXFont font);
        ///
-       void Write(ostream &);
+       void Write(ostream &) const;
        ///
        void Read(LyXLex & lex);
        ///
-       int Latex(ostream &, signed char fragile);
+       int Latex(ostream &, signed char fragile) const;
        ///
-       int Latex(string & file, signed char fragile);
+       int Latex(string & file, signed char fragile) const;
        ///
-       int Linuxdoc(string & file);
+       int Linuxdoc(string & file) const;
        ///
-       int DocBook(string & file);
+       int DocBook(string & file) const;
        ///
        void Validate(LaTeXFeatures &) const;
        ///
index fa0f3fc89245d198762a152500fbb87af9cc19a7..8286659a370f58658a83fb2b7976ca94f41d206c 100644 (file)
@@ -67,7 +67,7 @@ string InsetRef::getScreenLabel() const
 }
 
 
-int InsetRef::Latex(ostream & os, signed char /*fragile*/)
+int InsetRef::Latex(ostream & os, signed char /*fragile*/) const
 {
        if(getOptions().empty())
                os << escape(getCommand());
@@ -81,7 +81,7 @@ int InsetRef::Latex(ostream & os, signed char /*fragile*/)
 }
 
 
-int InsetRef::Latex(string & file, signed char /*fragile*/)
+int InsetRef::Latex(string & file, signed char /*fragile*/) const
 {
        if(getOptions().empty())
                file += escape(getCommand());
@@ -95,7 +95,7 @@ int InsetRef::Latex(string & file, signed char /*fragile*/)
 }
 
 
-int InsetRef::Linuxdoc(string & file)
+int InsetRef::Linuxdoc(string & file) const
 {
        file += "<ref id=\"" + getContents()
                + "\" name=\""+ getOptions() +"\" >" ;
@@ -104,7 +104,7 @@ int InsetRef::Linuxdoc(string & file)
 }
 
 
-int InsetRef::DocBook(string & file)
+int InsetRef::DocBook(string & file) const
 {
        file += "<link linkend=\"" + getContents()
                + "\">"+ getOptions() +"</link>" ;
index 10a742c1ce0895dc97f657609ef17f9d954833c9..b1c5fe3f4eef308fcb765c9fb32155d744699a65 100644 (file)
@@ -61,13 +61,13 @@ public:
         ///
         void gotoLabel();
        ///
-       int Latex(ostream &, signed char fragile);
+       int Latex(ostream &, signed char fragile) const;
        ///
-       int Latex(string & file, signed char fragile);
+       int Latex(string & file, signed char fragile) const;
        ///
-       int Linuxdoc(string & file);
+       int Linuxdoc(string & file) const;
        ///
-       int DocBook(string & file);
+       int DocBook(string & file) const;
 private:
        /// This function escapes 8-bit characters
        string escape(string const &) const;
index 3f38317bbab0534a3f3a19d0da018ebd2c0f0f49..eea2bc00bcfa810aecd5fc4dd667bd68e34ee3bb 100644 (file)
@@ -110,7 +110,7 @@ void InsetSpecialChar::draw(Painter & pain, LyXFont const & f,
 
 
 // In lyxf3 this will be just LaTeX
-void InsetSpecialChar::Write(ostream & os)
+void InsetSpecialChar::Write(ostream & os) const
 {
        string command;
        switch (kind) {
@@ -142,7 +142,7 @@ void InsetSpecialChar::Read(LyXLex & lex)
 }
 
 
-int InsetSpecialChar::Latex(ostream & os, signed char /*fragile*/)
+int InsetSpecialChar::Latex(ostream & os, signed char /*fragile*/) const
 {
        string command;
        signed char dummy = 0;
@@ -152,7 +152,7 @@ int InsetSpecialChar::Latex(ostream & os, signed char /*fragile*/)
 }
 
 
-int InsetSpecialChar::Latex(string & file, signed char /*fragile*/)
+int InsetSpecialChar::Latex(string & file, signed char /*fragile*/) const
 {
        switch (kind) {
        case HYPHENATION:       file += "\\-";  break;
@@ -164,7 +164,7 @@ int InsetSpecialChar::Latex(string & file, signed char /*fragile*/)
 }
 
 
-int InsetSpecialChar::Linuxdoc(string & file)
+int InsetSpecialChar::Linuxdoc(string & file) const
 {
        switch (kind) {
        case HYPHENATION:       file += "";     break;
@@ -176,7 +176,7 @@ int InsetSpecialChar::Linuxdoc(string & file)
 }
 
 
-int InsetSpecialChar::DocBook(string & file)
+int InsetSpecialChar::DocBook(string & file) const
 {
        switch (kind) {
        case HYPHENATION:       file += "";     break;
index e70a93d84754289047a34b0794af5168caf7b8b0..b933802fa61d44bf3adf4947c9466082e536766c 100644 (file)
@@ -49,17 +49,17 @@ public:
        ///
        void draw(Painter &, LyXFont const &, int baseline, float & x) const;
        ///
-       void Write(ostream &);
+       void Write(ostream &) const;
        /// Will not be used when lyxf3
        void Read(LyXLex & lex);
        /// 
-       int Latex(ostream &, signed char fragile);
+       int Latex(ostream &, signed char fragile) const;
        ///
-       int Latex(string & file, signed char fragile);
+       int Latex(string & file, signed char fragile) const;
        ///
-       int Linuxdoc(string & file);
+       int Linuxdoc(string & file) const;
        ///
-       int DocBook(string & file);
+       int DocBook(string & file) const;
        ///
        Inset * Clone() const;
        ///  
index c6904e8477bb1238a9d1f71d4e882ddb3c425135..d2fb64253128cc1c43f3e053c180d40c9e53ff7f 100644 (file)
@@ -162,7 +162,7 @@ string InsetUrl::getScreenLabel() const
 }
 
 
-int InsetUrl::Latex(ostream & os, signed char fragile)
+int InsetUrl::Latex(ostream & os, signed char fragile) const
 {
        string latex_output;
        int res = Latex(latex_output, fragile);
@@ -172,7 +172,7 @@ int InsetUrl::Latex(ostream & os, signed char fragile)
 }
 
 
-int InsetUrl::Latex(string & file, signed char fragile)
+int InsetUrl::Latex(string & file, signed char fragile) const
 {
        if (!getOptions().empty())
                file += getOptions() + ' ';
@@ -185,7 +185,7 @@ int InsetUrl::Latex(string & file, signed char fragile)
 }
 
 
-int InsetUrl::Linuxdoc(string & file)
+int InsetUrl::Linuxdoc(string & file) const
 {
        file +=  "<"+ getCmdName() +
                 " url=\""  + getContents()+"\"" +
@@ -195,7 +195,7 @@ int InsetUrl::Linuxdoc(string & file)
 }
 
 
-int InsetUrl::DocBook(string & file)
+int InsetUrl::DocBook(string & file) const
 {
        file +=  "<ulink url=\""  + getContents() + "\">" +
                 getOptions() +"</ulink>";
index f008ea88bfc6f7b9979e1dc587503aea8fa3896f..fbf25fdd39a9b8b617b62b64515f3d3c10020586 100644 (file)
@@ -70,13 +70,13 @@ public:
         ///
         void gotoLabel();
        ///
-       int Latex(ostream &, signed char fragile);
+       int Latex(ostream &, signed char fragile) const;
        ///
-       int Latex(string & file, signed char fragile);
+       int Latex(string & file, signed char fragile) const;
        ///
-       int Linuxdoc(string & file);
+       int Linuxdoc(string & file) const;
        ///
-       int DocBook(string & file);
+       int DocBook(string & file) const;
        ///
        static void CloseUrlCB(FL_OBJECT *, long data);
 private:
index 4beeec434799f8bbc34595a83e6f383e9f10fe6c..aa866d1afd9c9d2f9d8068d1018cf708018ea166 100644 (file)
@@ -99,20 +99,20 @@ public:
        ///
        virtual bool AutoDelete() const;
        ///
-       virtual void Write(ostream &) = 0;
+       virtual void Write(ostream &) const = 0;
        ///
        virtual void Read(LyXLex & lex) = 0;
        /** returns the number of rows (\n's) of generated tex code.
         fragile != 0 means, that the inset should take care about
         fragile commands by adding a \protect before.
         */
-       virtual int Latex(ostream &, signed char fragile) = 0;
+       virtual int Latex(ostream &, signed char fragile) const = 0;
        ///
-       virtual int Latex(string & file, signed char fragile) = 0;
+       virtual int Latex(string & file, signed char fragile) const = 0;
        ///
-       virtual int Linuxdoc(string & /*file*/) = 0;
+       virtual int Linuxdoc(string & /*file*/) const = 0;
        ///
-       virtual int DocBook(string & /*file*/) = 0;
+       virtual int DocBook(string & /*file*/) const = 0;
        /// Updates needed features for this inset.
        virtual void Validate(LaTeXFeatures & features) const;
        ///
index 37102fc18686a0b44f0f77fb15756708a1cb804b..0c7c26ec43ac03fb1677b5a3d2c1fdc7cea274d3 100644 (file)
@@ -180,7 +180,7 @@ public:
        LyXFont(LyXFont::FONT_INIT3);
 
        /// LyXFont x, y; x = y;
-       LyXFont& operator=(LyXFont const & x);
+       LyXFont & operator=(LyXFont const & x);
  
        /// Decreases font size by one
        LyXFont & decSize();
index 75d49444ee94c8a9c0f2d67da7777bbf08bb63d6..618ff96f4d9fc4a4fea53ec93ac569aedece47f8 100644 (file)
@@ -20,7 +20,6 @@
 #include <list>
 
 #include "insets/lyxinset.h"
-#include "insets/insetbib.h"
 #include "table.h"
 #include "vspace.h"
 #include "layout.h"
@@ -31,6 +30,7 @@ class BufferParams;
 class LyXBuffer;
 class TexRow;
 struct LaTeXFeatures;
+class InsetBibKey;
 
 using std::list;
 
index 58c09de15f2c7a69ac9828a9830bfff152373b32..e30921b7606b2ada331bdb5a1bbca89605ac22eb 100644 (file)
@@ -23,7 +23,7 @@ class LyXText;
 struct Row;
 typedef unsigned short Dimension;
 
-class BufferView;
+class WorkArea;
 
 /** The class LyXScreen is used for the main Textbody.
     Concretely, the screen is held in a pixmap.  This pixmap is kept up to
@@ -33,15 +33,7 @@ class BufferView;
 class LyXScreen {
 public:
        ///
-       LyXScreen(BufferView *, Window window,
-                 Pixmap p,
-                 Dimension width, 
-                 Dimension height,
-                 Dimension offset_x,
-                 Dimension offset_y,
-                 LyXText * text_ptr);
-       ///
-       ~LyXScreen();
+       LyXScreen(WorkArea &, LyXText * text_ptr);
 
        /** Draws the screen form textposition y. Uses as much of
            the already printed pixmap as possible */
@@ -62,8 +54,6 @@ public:
        void CursorToggle();
        ///
        void ShowManualCursor(long x, long y, int asc, int desc);
-       ///
-       void HideManualCursor();
        /// returns 1 if first has changed, otherwise 0
        int  FitManualCursor(long, long, int, int);
        ///
@@ -98,13 +88,11 @@ private:
        void DrawOneRow(Row * row, long & y_text);
 
        ///
-       BufferView * owner;
+       WorkArea & owner;
        
        ///
        LyXText * text;
 
-       ///
-       Pixmap foreground;
        ///
        Pixmap cursor_pixmap;
        ///
@@ -116,16 +104,6 @@ private:
        ///
        int cursor_pixmap_h;
        ///
-       Window _window;
-        ///
-       Dimension _width;
-       ///
-       Dimension _height;
-        ///
-       Dimension _offset_x;
-       ///
-       Dimension _offset_y;
-       ///
        long screen_refresh_y;
        ///
        Row * screen_refresh_row;
index 15bf10be8685c53f127dad73fcf6909a2772898d..9c82374ded67fdc5c26d1527ffeaa5fdb85a1e4c 100644 (file)
@@ -298,14 +298,14 @@ Inset * InsetFormula::Clone() const
 }
 
 
-void InsetFormula::Write(ostream & os)
+void InsetFormula::Write(ostream & os) const
 {
        os << "Formula ";
        Latex(os, 0);
 }
 
 
-int InsetFormula::Latex(ostream & os, signed char fragile)
+int InsetFormula::Latex(ostream & os, signed char fragile) const
 {
     int ret = 0;      
 //#warning Alejandro, the number of lines is not returned in this case
@@ -317,7 +317,7 @@ int InsetFormula::Latex(ostream & os, signed char fragile)
 }
 
 
-int InsetFormula::Latex(string & file, signed char fragile)
+int InsetFormula::Latex(string & file, signed char fragile) const
 {
     int ret = 0;
 //#warning Alejandro, the number of lines is not returned in this case
@@ -330,13 +330,13 @@ int InsetFormula::Latex(string & file, signed char fragile)
 }
 
 
-int InsetFormula::Linuxdoc(string &/*file*/)
+int InsetFormula::Linuxdoc(string &/*file*/) const
 {
     return 0;
 }
 
 
-int InsetFormula::DocBook(string &/*file*/)
+int InsetFormula::DocBook(string &/*file*/) const
 {
     return 0;
 }
index a0bd20b8c521643779c53fbff9976eab1e1af7be..b59728d7f882ceff9534dfff1806ca6b6e860693 100644 (file)
@@ -45,17 +45,17 @@ public:
        ///
        void draw(Painter &, LyXFont const &, int baseline, float & x) const;
        ///
-       void Write(ostream &);
+       void Write(ostream &) const;
        ///
        void Read(LyXLex & lex);
        ///
-       int Latex(ostream &, signed char fragile);
+       int Latex(ostream &, signed char fragile) const;
        ///
-       int Latex(string & file, signed char fragile);
+       int Latex(string & file, signed char fragile) const;
        ///
-       int Linuxdoc(string & file);
+       int Linuxdoc(string & file) const;
        ///
-       int DocBook(string & file);
+       int DocBook(string & file) const;
        ///
        void Validate(LaTeXFeatures &) const;
        ///
index 0663a4c2d01f13924bb95f46bd03aea07649950b..ac81cbaea6d8ab18bfc4d3c0b993767cf13acd03 100644 (file)
@@ -64,14 +64,14 @@ Inset * InsetFormulaMacro::Clone() const
 }
 
 
-void InsetFormulaMacro::Write(ostream & os)
+void InsetFormulaMacro::Write(ostream & os) const
 {
        os << "FormulaMacro ";
        Latex(os, 0);
 }
 
 
-int InsetFormulaMacro::Latex(ostream & os, signed char /*fragile*/)
+int InsetFormulaMacro::Latex(ostream & os, signed char /*fragile*/) const
 {
     int ret = 1;
     tmacro->WriteDef(os);
@@ -79,7 +79,7 @@ int InsetFormulaMacro::Latex(ostream & os, signed char /*fragile*/)
 }
 
 
-int InsetFormulaMacro::Latex(string &file, signed char /*fragile*/)
+int InsetFormulaMacro::Latex(string &file, signed char /*fragile*/) const
 {
     int ret = 1;
     tmacro->WriteDef(file);
@@ -87,13 +87,13 @@ int InsetFormulaMacro::Latex(string &file, signed char /*fragile*/)
 }
 
 
-int InsetFormulaMacro::Linuxdoc(string &/*file*/)
+int InsetFormulaMacro::Linuxdoc(string &/*file*/) const
 {
     return 0;
 }
 
 
-int InsetFormulaMacro::DocBook(string &/*file*/)
+int InsetFormulaMacro::DocBook(string &/*file*/) const
 {
     return 0;
 }
index 938eab80cfe21c14e5917e4935a4cb2935b29bb3..911aea99c5fdabb4d2812b298cc5b448b407c6af 100644 (file)
@@ -46,15 +46,15 @@ public:
        ///
        void Read(LyXLex & lex);
         ///
-       void Write(ostream & os);
+       void Write(ostream & os) const;
        ///
-       int Latex(ostream & os, signed char fragile);
+       int Latex(ostream & os, signed char fragile) const;
        ///
-       int Latex(string & file, signed char fragile);
+       int Latex(string & file, signed char fragile) const;
        ///
-       int Linuxdoc(string & file);
+       int Linuxdoc(string & file) const;
        ///
-       int DocBook(string & file);
+       int DocBook(string & file) const;
        ///
        Inset * Clone() const;
 
index 6315d810a59395314992168ae661619e082ae838..fe6ed73b4528b7da3331820409264a009afbde90 100644 (file)
@@ -29,6 +29,7 @@ using std::ios;
 #include "debug.h"
 #include "LaTeXFeatures.h"
 #include "insets/insetinclude.h"
+#include "insets/insetbib.h"
 #include "support/filetools.h"
 #include "lyx_gui_misc.h"
 #include "texrow.h"
index 452fe295eb10683cb8bbcb4766c1976a79aaef7b..cc379034d94c5db37e667f7693a82f55e05fc4bd 100644 (file)
 #pragma implementation "lyxscreen.h"
 #endif
 
+#include <algorithm>
+
 #include "lyxscreen.h"
 #include "lyxtext.h"
 #include "lyxrow.h"
-#include "BufferView.h"
 #include "Painter.h"
+#include "WorkArea.h"
 
+using std::max;
+using std::min;
 
 static
 GC createGC()
@@ -39,16 +43,8 @@ GC createGC()
 
 
 // Constructor
-LyXScreen::LyXScreen(BufferView * o, Window window,
-                    Pixmap p,
-                    Dimension width, 
-                    Dimension height,
-                    Dimension offset_x,
-                    Dimension offset_y,
-                    LyXText *text_ptr)
-       : owner(o), text(text_ptr), _window(window), 
-       _width(width), _height(height),
-       _offset_x(offset_x), _offset_y(offset_y)
+LyXScreen::LyXScreen(WorkArea & o, LyXText * text_ptr)
+       : owner(o), text(text_ptr)
 {
        first = 0;
    
@@ -56,9 +52,6 @@ LyXScreen::LyXScreen(BufferView * o, Window window,
        cursor_visible = false;
        screen_refresh_y = -1;
 
-       /* create the foreground pixmap */
-       foreground = p;
-
        cursor_pixmap = 0;
        cursor_pixmap_x = 0;
        cursor_pixmap_y = 0;
@@ -70,15 +63,11 @@ LyXScreen::LyXScreen(BufferView * o, Window window,
 }
 
 
-// Destructor
-LyXScreen::~LyXScreen() {}
-
-
 void LyXScreen::Redraw()
 {
-       DrawFromTo(0, _height);
+       DrawFromTo(0, owner.height());
        screen_refresh_y = -1;
-       expose(0, 0, _width, _height);
+       expose(0, 0, owner.workWidth(), owner.height());
        if (cursor_visible) {
                cursor_visible = false;
                ShowCursor();
@@ -89,12 +78,13 @@ void LyXScreen::Redraw()
 void LyXScreen::expose(int x, int y, int exp_width, int exp_height)
 {
        XCopyArea(fl_display,
-                 foreground,
-                 _window,
+                 owner.getPixmap(),
+                 owner.getWin(),
                  gc_copy,
                  x, y,
                  exp_width, exp_height,
-                 x+_offset_x, y+_offset_y);
+                 x + owner.xpos(),
+                 y + owner.ypos());
 }
 
 
@@ -110,16 +100,16 @@ void LyXScreen::DrawFromTo(int y1, int y2)
        /* y1 is now the real beginning of row on the screen */
        
        while (row != 0 && y < y2) {
-
                text->GetVisibleRow(y, row, y + first);
                y += row->height;
-               row = row -> next;
-
+               row = row->next;
        }
    
        /* maybe we have to clear the screen at the bottom */ 
        if (y < y2) {
-               owner->painter().fillRectangle(0, y, _width, y2 - y,
+               owner.getPainter().fillRectangle(0, y,
+                                                owner.workWidth(),
+                                                y2 - y,
                                               LColor::bottomarea);
        }
 }
@@ -129,11 +119,11 @@ void LyXScreen::DrawOneRow(Row * row, long & y_text)
 {
        long y = y_text - first;
       
-       if (y + row->height > 0 && y - row->height <= _height) {
+       if (y + row->height > 0 && y - row->height <= owner.height()) {
                /* ok there is something visible */
                text->GetVisibleRow(y, row, y + first);
        }
-       y_text+= row->height;
+       y_text += row->height;
 }
 
 
@@ -148,55 +138,63 @@ void LyXScreen::Draw(long  y)
        first = y;
 
        /* is any optimiziation possible? */ 
-       if ((y - old_first) < _height 
-           && (old_first - y) < _height) {
+       if ((y - old_first) < owner.height()
+           && (old_first - y) < owner.height()) {
                if (first < old_first) {
                        DrawFromTo(0, old_first - first);
                        XCopyArea (fl_display,
-                                  _window,
-                                  _window,
+                                  owner.getWin(),
+                                  owner.getWin(),
                                   gc_copy,
-                                  _offset_x, _offset_y, 
-                                  _width , _height - old_first + first,
-                                  _offset_x, _offset_y + old_first - first);
+                                  owner.xpos(),
+                                  owner.ypos(),
+                                  owner.workWidth(),
+                                  owner.height() - old_first + first,
+                                  owner.xpos(),
+                                  owner.ypos() + old_first - first
+                               );
                        // expose the area drawn
-                       expose(0, 0, _width, old_first - first);
+                       expose(0, 0,
+                              owner.workWidth(),
+                              old_first - first);
                } else  {
-                       DrawFromTo(_height + old_first - first, _height);
+                       DrawFromTo(
+                               owner.height() + old_first - first,
+                                  owner.height());
                        XCopyArea (fl_display,
-                                  _window,
-                                  _window,
+                                  owner.getWin(),
+                                  owner.getWin(),
                                   gc_copy,
-                                  _offset_x, _offset_y + first - old_first, 
-                                  _width , _height + old_first - first, 
-                                  _offset_x, _offset_y);
+                                  owner.xpos(),
+                                  owner.ypos() + first - old_first,
+                                  owner.workWidth(),
+                                  owner.height() + old_first - first,
+                                  owner.xpos(),
+                                  owner.ypos());
                        // expose the area drawn
-                       expose(0, _height + old_first - first, 
-                              _width, first - old_first);
+                       expose(0, owner.height() + old_first - first,
+                              owner.workWidth(), first - old_first);
                }
        } else {
                /* make a dumb new-draw */ 
-               DrawFromTo(0, _height);
-               expose(0, 0, _width, _height);
+               DrawFromTo(0, owner.height());
+               expose(0, 0, owner.workWidth(), owner.height());
        }
 }
 
 
 void LyXScreen::ShowCursor()
 {
-       long x = 0;
-       long y1 = 0;
-       long y2 = 0;
-   
        if (cursor_visible) return;
    
-       x = text->cursor.x;
+       long x = text->cursor.x;
        
-       y1 = text->cursor.y - text->real_current_font.maxAscent() - first;
-       if (y1 < 0) y1 = 0;
+       long y1 = max(text->cursor.y -
+                     text->real_current_font.maxAscent() - first, 0L);
        
-       y2 = text->cursor.y + text->real_current_font.maxDescent() - first;
-       if (y2 > _height) y2 = _height;
+       long y2 = min(text->cursor.y +
+                     text->real_current_font.maxDescent() - first,
+                     long(owner.height()));
 
        // Secure against very strange situations
        if (y2 < y1) y2 = y1;
@@ -206,7 +204,7 @@ void LyXScreen::ShowCursor()
                cursor_pixmap = 0;
        }
    
-       if (y2 > 0 && y1 < _height) {
+       if (y2 > 0 && y1 < owner.height()) {
                cursor_pixmap_w = 1;
                cursor_pixmap_h = y2 - y1 + 1;
                cursor_pixmap_x = x;
@@ -218,19 +216,20 @@ void LyXScreen::ShowCursor()
                                      cursor_pixmap_h,
                                      fl_get_visual_depth());
                XCopyArea(fl_display,
-                         _window,
+                         owner.getWin(),
                          cursor_pixmap,
                          gc_copy,
-                         _offset_x + cursor_pixmap_x, 
-                         _offset_y + cursor_pixmap_y,
+                         owner.xpos() + cursor_pixmap_x,
+                         owner.ypos() + cursor_pixmap_y,
                          cursor_pixmap_w, cursor_pixmap_h,
                          0, 0);
                XDrawLine(fl_display,
-                         _window, gc_copy,
-                         x + _offset_x,
-                         y1 + _offset_y,
-                         x + _offset_x,
-                         y2 + _offset_y);
+                         owner.getWin(),
+                         gc_copy,
+                         x + owner.xpos(),
+                         y1 + owner.ypos(),
+                         x + owner.xpos(),
+                         y2 + owner.ypos());
                cursor_visible = true;
        }
 }
@@ -241,11 +240,11 @@ int LyXScreen::FitManualCursor(long /*x*/, long y, int asc, int desc)
 {
        long  newtop = first;
   
-       if (y + desc  - first >= _height)
-               newtop = y - 3*_height / 4;   /* the scroll region must be so big!! */
+       if (y + desc  - first >= owner.height())
+               newtop = y - 3 * owner.height() / 4;   /* the scroll region must be so big!! */
        else if (y - asc < first 
                 && first > 0) {
-               newtop = y - _height / 4;
+               newtop = y - owner.height() / 4;
        }
        if (newtop < 0)
                newtop = 0;
@@ -259,30 +258,18 @@ int LyXScreen::FitManualCursor(long /*x*/, long y, int asc, int desc)
 }
 
 
-void  LyXScreen::HideManualCursor()
-{
-       HideCursor();
-}
-
-
 void  LyXScreen::ShowManualCursor(long x, long y, int asc, int desc)
 {
-       long y1 = 0;
-       long y2 = 0;
-       
-       y1 = y - first - asc;
-       if (y1 < 0)
-               y1 = 0;
-       y2 = y -first + desc;
-       if (y2 > _height)
-               y2 = _height;
+       long y1 = max(y - first - asc, 0L);
+       long y2 = min(y - first + desc, long(owner.height()));
 
        if (cursor_pixmap){
                XFreePixmap(fl_display, cursor_pixmap);
                cursor_pixmap = 0;
        }
                
-       if (y2 > 0 && y1 < _height) {
+       if (y2 > 0 && y1 <
+           owner.height()) {
                cursor_pixmap_w = 1;
                cursor_pixmap_h = y2 - y1 + 1;
                cursor_pixmap_x = x,
@@ -294,20 +281,21 @@ void  LyXScreen::ShowManualCursor(long x, long y, int asc, int desc)
                                       cursor_pixmap_h,
                                       fl_get_visual_depth());
                XCopyArea (fl_display,
-                          _window,
+                          owner.getWin(),
                           cursor_pixmap,
                           gc_copy,
-                          _offset_x + cursor_pixmap_x,
-                          _offset_y + cursor_pixmap_y,
+                          owner.xpos() + cursor_pixmap_x,
+                          owner.ypos() + cursor_pixmap_y,
                           cursor_pixmap_w,
                           cursor_pixmap_h,
                           0, 0);
                XDrawLine(fl_display,
-                         _window, gc_copy,
-                         x+_offset_x,
-                         y1+_offset_y,
-                         x+_offset_x,
-                         y2+_offset_y);
+                         owner.getWin(),
+                         gc_copy,
+                         x + owner.xpos(),
+                         y1 + owner.ypos(),
+                         x + owner.xpos(),
+                         y2 + owner.ypos());
        }
        cursor_visible = true;
 }
@@ -320,12 +308,12 @@ void LyXScreen::HideCursor()
        if (cursor_pixmap){
                XCopyArea (fl_display, 
                           cursor_pixmap,
-                          _window,
+                          owner.getWin(),
                           gc_copy,
                           0, 0, 
                           cursor_pixmap_w, cursor_pixmap_h,
-                          cursor_pixmap_x + _offset_x,
-                          cursor_pixmap_y + _offset_y);
+                          cursor_pixmap_x + owner.xpos(),
+                          cursor_pixmap_y + owner.ypos());
        }
        cursor_visible = false;
 }
@@ -348,22 +336,22 @@ long LyXScreen::TopCursorVisible()
        if (text->cursor.y
            - text->cursor.row->baseline
            + text->cursor.row->height
-           - first >= _height) {
-               if (text->cursor.row->height < _height
-                   && text->cursor.row->height > _height/4)
+           - first >= owner.height()) {
+               if (text->cursor.row->height < owner.height()
+                   && text->cursor.row->height > owner.height() / 4)
                        newtop = text->cursor.y
                                + text->cursor.row->height
-                               - text->cursor.row->baseline - _height;
+                               - text->cursor.row->baseline - owner.height();
                else
                        newtop = text->cursor.y
-                               - 3*_height / 4;   /* the scroll region must be so big!! */
+                               - 3 * owner.height() / 4;   /* the scroll region must be so big!! */
        } else if (text->cursor.y - text->cursor.row->baseline < first 
                   && first > 0) {
-               if (text->cursor.row->height < _height
-                   && text->cursor.row->height > _height/4)
+               if (text->cursor.row->height < owner.height()
+                   && text->cursor.row->height > owner.height() / 4)
                        newtop = text->cursor.y - text->cursor.row->baseline;
                else {
-                       newtop = text->cursor.y - _height / 4;
+                       newtop = text->cursor.y - owner.height() / 4;
                        if (newtop > first)
                                newtop = first;
                }
@@ -390,10 +378,9 @@ int LyXScreen::FitCursor()
    
 void LyXScreen::Update()
 {
-       long y = 0;
-
        if (text->status == LyXText::NEED_MORE_REFRESH
            || screen_refresh_y > -1 ) {
+               long y = 0;
                if (screen_refresh_y > -1
                    && screen_refresh_y < text->refresh_y)
                        y = screen_refresh_y;
@@ -402,40 +389,39 @@ void LyXScreen::Update()
                
                if (y < first) y = first;
                
-               DrawFromTo(y - first, _height);
+               DrawFromTo(y - first, owner.height());
                text->refresh_y = 0;
                text->status = LyXText::UNCHANGED;
                screen_refresh_y = -1;
-               expose(0, y-first, _width, _height - (y - first));
+               expose(0, y - first,
+                      owner.workWidth(), owner.height() - (y - first));
        } else if (text->status == LyXText::NEED_VERY_LITTLE_REFRESH) {
                /* ok I will update the current cursor row */
-               y = text->refresh_y;
+               long y = text->refresh_y;
                DrawOneRow(text->refresh_row, y);
                text->status = LyXText::UNCHANGED;
-               expose(0, text->refresh_y-first,
-                      _width, text->refresh_row->height);
+               expose(0, text->refresh_y - first,
+                      owner.workWidth(), text->refresh_row->height);
        }
 }
 
 
 void LyXScreen::SmallUpdate()
 {
-       Row * row = 0;
-       long y = 0;
-       long y2 = 0;
-       
-       if (text->status == LyXText::NEED_MORE_REFRESH){
+       if (text->status == LyXText::NEED_MORE_REFRESH) {
                /* ok I will update till the current cursor row */
-               row = text->refresh_row;
-               y = text->refresh_y;
-               y2 = y;
+               Row * row = text->refresh_row;
+               long y = text->refresh_y;
+               long y2 = y;
       
                if (y > text->cursor.y) {
                        Update();
                        return;
                }
         
-               while (row && row != text->cursor.row && y < first + _height) {
+               while (row
+                      && row != text->cursor.row
+                      && y < first + owner.height()) {
                        DrawOneRow(row, y);
                        row = row->next;
                }
@@ -445,15 +431,15 @@ void LyXScreen::SmallUpdate()
                screen_refresh_row = row->next;
                text->status = LyXText::UNCHANGED;
                // Is the right regin exposed?
-               expose(0, y2-first, _width, y-y2);
+               expose(0, y2 - first,
+                      owner.workWidth(), y - y2);
        } else if (text->status == LyXText::NEED_VERY_LITTLE_REFRESH) {
                /* ok I will update the current cursor row */
-               row = text->refresh_row;
-               y = text->refresh_y;
-               DrawOneRow(row, y);
+               long y = text->refresh_y;
+               DrawOneRow(text->refresh_row, y);
                text->status = LyXText::UNCHANGED;
                expose(0, text->refresh_y - first,
-                      _width, row->height);
+                      owner.workWidth(), text->refresh_row->height);
        }
 }
 
@@ -461,29 +447,30 @@ void LyXScreen::SmallUpdate()
 void LyXScreen::ToggleSelection(bool kill_selection)
 {
        /* only if there is a selection */ 
-       if (!text->selection)
-               return;
+       if (!text->selection) return;
 
        long top = text->sel_start_cursor.y
                - text->sel_start_cursor.row->baseline;
        long bottom = text->sel_end_cursor.y
                - text->sel_end_cursor.row->baseline 
                + text->sel_end_cursor.row->height;
+
+       if (top < first)
+               top = max(top, first);
+        if (bottom < first)
+               bottom = max(bottom, first);
        
-       if (top - first < 0)
-               top = first;
-       if (bottom - first < 0)
-               bottom = first;
-       
-       if (bottom - first > _height)
-               bottom = first + _height;
-       if (top - first > _height)
-               top = first + _height;
-       
+       if (bottom > first + owner.height())
+               bottom = first + owner.height();
+       if (top > first + owner.height())
+               top = first + owner.height();
+
        if (kill_selection)
                text->selection = 0;
        DrawFromTo(top - first, bottom - first);
-       expose(0, top - first, _width, bottom - first - (top - first));
+       expose(0, top - first,
+              owner.workWidth(),
+              bottom - first - (top - first));
 }
   
    
@@ -504,11 +491,12 @@ void LyXScreen::ToggleToggle()
        if (bottom - first < 0)
                bottom = first;
        
-       if (bottom - first > _height)
-               bottom = first + _height;
-       if (top - first > _height)
-               top = first + _height;
+       if (bottom - first > owner.height())
+               bottom = first + owner.height();
+       if (top - first > owner.height())
+               top = first + owner.height();
        
        DrawFromTo(top - first, bottom - first);
-       expose(0, top - first, _width, bottom - first - (top - first));
+       expose(0, top - first, owner.workWidth(),
+              bottom - first - (top - first));
 }
index eee12076218d7448349d6bc2387f2a9d4a4be5b7..abd212ef3cedb678a8955be5e51fdaf6a299cebe 100644 (file)
@@ -20,6 +20,7 @@
 #include "lyxparagraph.h"
 #include "lyxtext.h"
 #include "support/textutils.h"
+#include "insets/insetbib.h"
 #include "lyx_gui_misc.h"
 #include "gettext.h"
 #include "bufferparams.h"
index 268167929e5abe7de8dd16e7c2939432a0397400..2ec866dfb52965866d0e4fb3b243a48e8303ebe7 100644 (file)
@@ -21,6 +21,7 @@
 #include "LString.h"
 #include "lyxparagraph.h"
 #include "insets/inseterror.h"
+#include "insets/insetbib.h"
 #include "layout.h"
 #include "LyXView.h"
 #include "support/textutils.h"