fix the resize bug, make some more inset funcs const, cleanup in lyxscreen, painter, workarea

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@561 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2000-02-18 22:22:42 +00:00
parent a0cf758d5a
commit 5ba861bb09
47 changed files with 326 additions and 354 deletions

View File

@ -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> 2000-02-17 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/Makefile.am: add missing direction.h * src/Makefile.am: add missing direction.h

View File

@ -185,7 +185,7 @@ dnl Check the version of g++
case $gxx_version in case $gxx_version in
2.7*) CXXFLAGS="$lyx_opt";; 2.7*) CXXFLAGS="$lyx_opt";;
2.95.1) CXXFLAGS="-g $lyx_opt -fpermissive -fno-rtti";; 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";; *2.91.*) CXXFLAGS="-g $lyx_opt -Wno-return-type -fno-exceptions -fno-rtti";;
*) CXXFLAGS="-g $lyx_opt -fno-exceptions -fno-rtti";; *) CXXFLAGS="-g $lyx_opt -fno-exceptions -fno-rtti";;
esac esac

View File

@ -185,7 +185,7 @@ dnl Check the version of g++
case $gxx_version in case $gxx_version in
2.7*) CXXFLAGS="$lyx_opt";; 2.7*) CXXFLAGS="$lyx_opt";;
2.95.1) CXXFLAGS="-g $lyx_opt -fpermissive -fno-rtti";; 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";; *2.91.*) CXXFLAGS="-g $lyx_opt -Wno-return-type -fno-exceptions -fno-rtti";;
*) CXXFLAGS="-g $lyx_opt -fno-exceptions -fno-rtti";; *) CXXFLAGS="-g $lyx_opt -fno-exceptions -fno-rtti";;
esac esac

View File

@ -32,6 +32,7 @@ using std::for_each;
#include "LyXView.h" #include "LyXView.h"
#include "lyxfunc.h" #include "lyxfunc.h"
#include "insets/lyxinset.h" #include "insets/lyxinset.h"
#include "insets/insetbib.h"
#include "minibuffer.h" #include "minibuffer.h"
#include "lyxscreen.h" #include "lyxscreen.h"
@ -70,8 +71,8 @@ BufferView::BufferView(LyXView * o, int xpos, int ypos,
{ {
buffer_ = 0; buffer_ = 0;
text = 0; text = 0;
screen = 0;
workarea = new WorkArea(this, xpos, ypos, width, height); workarea = new WorkArea(this, xpos, ypos, width, height);
screen = 0;
timer_cursor = 0; timer_cursor = 0;
create_view(); create_view();
current_scrollbar_value = 0; current_scrollbar_value = 0;
@ -170,14 +171,7 @@ void BufferView::updateScreen()
{ {
// Regenerate the screen. // Regenerate the screen.
delete screen; delete screen;
screen = new LyXScreen(this, screen = new LyXScreen(*workarea, text);
workarea->getWin(),
workarea->getPixmap(),
workarea->workWidth(),
workarea->height(),
workarea->xpos(),
workarea->ypos(),
text);
} }

View File

@ -709,7 +709,7 @@ void BufferView::showLockedInsetCursor(long x, long y, int asc, int desc)
void BufferView::hideLockedInsetCursor() void BufferView::hideLockedInsetCursor()
{ {
if (the_locking_inset && available()) { if (the_locking_inset && available()) {
screen->HideManualCursor(); screen->HideCursor();
} }
} }

View File

@ -27,6 +27,7 @@
#include "lyxfont.h" #include "lyxfont.h"
#include "support/LAssert.h" #include "support/LAssert.h"
#include "support/lstrings.h" #include "support/lstrings.h"
#include "WorkArea.h"
Painter::Painter(WorkArea & wa) Painter::Painter(WorkArea & wa)
: PainterBase(wa) : PainterBase(wa)
@ -54,6 +55,12 @@ Painter::~Painter() {
} }
Drawable Painter::drawable() const
{
return owner.getPixmap();
}
/* Basic drawing routines */ /* Basic drawing routines */
extern bool Lgb_bug_find_hack; 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) if (!Lgb_bug_find_hack)
lyxerr << "point not called from " lyxerr << "point not called from "
"workarea::workhandler\n"; "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; return *this;
} }
@ -81,10 +88,10 @@ PainterBase & Painter::line(int x1, int y1, int x2, int y2,
if (!Lgb_bug_find_hack) if (!Lgb_bug_find_hack)
lyxerr << "line not called from " lyxerr << "line not called from "
"workarea::workhandler\n"; "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); getGCLinepars(ls, lw, col), x1, y1, x2, y2);
return *this; return *this;
} }
@ -99,7 +106,7 @@ PainterBase & Painter::lines(int const * xp, int const * yp, int np,
if (!Lgb_bug_find_hack) if (!Lgb_bug_find_hack)
lyxerr << "lines not called from " lyxerr << "lines not called from "
"workarea::workhandler\n"; "workarea::workhandler\n";
lyxerr.debug() << "Painter drawable: " << drawable << endl; lyxerr.debug() << "Painter drawable: " << drawable() << endl;
} }
#ifndef HAVE_AUTO_PTR #ifndef HAVE_AUTO_PTR
@ -112,7 +119,7 @@ PainterBase & Painter::lines(int const * xp, int const * yp, int np,
points[i].y = yp[i]; points[i].y = yp[i];
} }
XDrawLines(display, drawable, getGCLinepars(ls, lw, col), XDrawLines(display, drawable(), getGCLinepars(ls, lw, col),
points, np, CoordModeOrigin); points, np, CoordModeOrigin);
#ifndef HAVE_AUTO_PTR #ifndef HAVE_AUTO_PTR
@ -131,10 +138,10 @@ PainterBase & Painter::rectangle(int x, int y, int w, int h,
if (!Lgb_bug_find_hack) if (!Lgb_bug_find_hack)
lyxerr << "rectangle not called from " lyxerr << "rectangle not called from "
"workarea::workhandler\n"; "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); x, y, w, h);
return *this; return *this;
} }
@ -147,10 +154,10 @@ PainterBase & Painter::fillRectangle(int x, int y, int w, int h,
if (!Lgb_bug_find_hack) if (!Lgb_bug_find_hack)
lyxerr << "fillrectangle not called from " lyxerr << "fillrectangle not called from "
"workarea::workhandler\n"; "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; return *this;
} }
@ -162,7 +169,7 @@ PainterBase & Painter::fillPolygon(int const * xp, int const * yp, int np,
if (!Lgb_bug_find_hack) if (!Lgb_bug_find_hack)
lyxerr <<"fillpolygon not called from " lyxerr <<"fillpolygon not called from "
"workarea::workhandler\n"; "workarea::workhandler\n";
lyxerr << "Painter drawable: " << drawable << endl; lyxerr << "Painter drawable: " << drawable() << endl;
} }
#ifndef HAVE_AUTO_PTR #ifndef HAVE_AUTO_PTR
@ -175,7 +182,7 @@ PainterBase & Painter::fillPolygon(int const * xp, int const * yp, int np,
points[i].y = yp[i]; points[i].y = yp[i];
} }
XFillPolygon(display, drawable, getGCForeground(col), points, np, XFillPolygon(display, drawable(), getGCForeground(col), points, np,
Nonconvex, CoordModeOrigin); Nonconvex, CoordModeOrigin);
#ifndef HAVE_AUTO_PTR #ifndef HAVE_AUTO_PTR
delete[] points; delete[] points;
@ -192,10 +199,10 @@ PainterBase & Painter::arc(int x, int y,
if (!Lgb_bug_find_hack) if (!Lgb_bug_find_hack)
lyxerr << "arc not called from " lyxerr << "arc not called from "
"workarea::workhandler\n"; "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); x, y, w, h, a1, a2);
return *this; return *this;
} }
@ -211,7 +218,7 @@ PainterBase & Painter::segments(int const * x1, int const * y1,
if (!Lgb_bug_find_hack) if (!Lgb_bug_find_hack)
lyxerr << "segments not called from " lyxerr << "segments not called from "
"workarea::workhandler\n"; "workarea::workhandler\n";
lyxerr << "Painter drawable: " << drawable << endl; lyxerr << "Painter drawable: " << drawable() << endl;
} }
#ifndef HAVE_AUTO_PTR #ifndef HAVE_AUTO_PTR
@ -225,7 +232,7 @@ PainterBase & Painter::segments(int const * x1, int const * y1,
s[i].x2 = x2[i]; s[i].x2 = x2[i];
s[i].y2 = y2[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 #ifndef HAVE_AUTO_PTR
delete [] s; delete [] s;
@ -240,14 +247,14 @@ PainterBase & Painter::pixmap(int x, int y, int w, int h, Pixmap bitmap)
if (!Lgb_bug_find_hack) if (!Lgb_bug_find_hack)
lyxerr << "workAreaExpose not called from " lyxerr << "workAreaExpose not called from "
"workarea::workhandler\n"; "workarea::workhandler\n";
lyxerr << "Painter drawable: " << drawable << endl; lyxerr << "Painter drawable: " << drawable() << endl;
} }
XGCValues val; XGCValues val;
val.function = GXcopy; val.function = GXcopy;
GC gc = XCreateGC(display, drawable, GC gc = XCreateGC(display, drawable(),
GCFunction, &val); GCFunction, &val);
XCopyArea(display, bitmap, drawable, gc, XCopyArea(display, bitmap, drawable(), gc,
0, 0, w, h, x, y); 0, 0, w, h, x, y);
XFreeGC(display, gc); XFreeGC(display, gc);
return *this; return *this;
@ -274,12 +281,12 @@ PainterBase & Painter::text(int x, int y, char const * s, int ls,
if (!Lgb_bug_find_hack) if (!Lgb_bug_find_hack)
lyxerr << "text not called from " lyxerr << "text not called from "
"workarea::workhandler\n"; "workarea::workhandler\n";
lyxerr << "Painter drawable: " << drawable << endl; lyxerr << "Painter drawable: " << drawable() << endl;
} }
GC gc = getGCForeground(f.realColor()); GC gc = getGCForeground(f.realColor());
XSetFont(display, gc, f.getFontID()); 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)); underline(f, x, y, this->width(s, ls, f));
return *this; return *this;
} }
@ -303,7 +310,7 @@ void Painter::underline(LyXFont const & f, int x, int y, int width)
GC Painter::getGCForeground(LColor::color c) GC Painter::getGCForeground(LColor::color c)
{ {
if (lyxerr.debugging()) { if (lyxerr.debugging()) {
lyxerr << "Painter drawable: " << drawable << endl; lyxerr << "Painter drawable: " << drawable() << endl;
} }
if (colorGCcache[c] != 0) return colorGCcache[c]; if (colorGCcache[c] != 0) return colorGCcache[c];
@ -387,7 +394,7 @@ GC Painter::getGCForeground(LColor::color c)
} }
val.function = GXcopy; val.function = GXcopy;
return colorGCcache[c] = XCreateGC(display, drawable, return colorGCcache[c] = XCreateGC(display, drawable(),
GCForeground | GCFunction, &val); GCForeground | GCFunction, &val);
} }
@ -397,7 +404,7 @@ GC Painter::getGCLinepars(enum line_style ls,
enum line_width lw, LColor::color c) enum line_width lw, LColor::color c)
{ {
if (lyxerr.debugging()) { if (lyxerr.debugging()) {
lyxerr << "Painter drawable: " << drawable << endl; lyxerr << "Painter drawable: " << drawable() << endl;
} }
int index = lw + (ls << 1) + (c << 3); int index = lw + (ls << 1) + (c << 3);
@ -425,7 +432,7 @@ GC Painter::getGCLinepars(enum line_style ls,
val.function = GXcopy; val.function = GXcopy;
return lineGCcache[index] = return lineGCcache[index] =
XCreateGC(display, drawable, XCreateGC(display, drawable(),
GCForeground | GCLineStyle | GCLineWidth | GCForeground | GCLineStyle | GCLineWidth |
GCCapStyle | GCJoinStyle | GCFunction, &val); GCCapStyle | GCJoinStyle | GCFunction, &val);
} }

View File

@ -109,9 +109,6 @@ protected:
/// ///
PainterBase & setDisplay(Display * d) { display = d; return *this; } PainterBase & setDisplay(Display * d) { display = d; return *this; }
///
PainterBase & setDrawable(Drawable d) { drawable = d; return *this; }
/// Get foreground color in ordinary GC /// Get foreground color in ordinary GC
GC getGCForeground(LColor::color c); GC getGCForeground(LColor::color c);
@ -124,8 +121,10 @@ protected:
/**@Low level X parameters */ /**@Low level X parameters */
/// ///
Display * display; Display * display;
/// ///
Drawable drawable; Drawable drawable() const;
/// ///
Colormap colormap; Colormap colormap;

View File

@ -192,7 +192,7 @@ public:
int & width = PainterBase::dummy1, int & width = PainterBase::dummy1,
int & ascent = PainterBase::dummy2, int & ascent = PainterBase::dummy2,
int & descent = PainterBase::dummy3); int & descent = PainterBase::dummy3);
private: protected:
WorkArea & owner; WorkArea & owner;
}; };

View File

@ -164,7 +164,6 @@ WorkArea::WorkArea(BufferView * o, int xpos, int ypos, int width, int height)
// setup the painter // setup the painter
painter_.setDisplay(fl_display); painter_.setDisplay(fl_display);
painter_.setDrawable(workareapixmap);
// We add this object as late as possible to avoit problems // We add this object as late as possible to avoit problems
// with drawing. // with drawing.
@ -223,9 +222,6 @@ void WorkArea::resize(int xpos, int ypos, int width, int height)
// Create the workarea pixmap // Create the workarea pixmap
createPixmap(width - 15 - 2 * bw, height - 2 * bw); createPixmap(width - 15 - 2 * bw, height - 2 * bw);
// reset the painter
painter_.setDrawable(workareapixmap);
// the free object // the free object
fl_set_object_geometry(work_area, xpos + bw, ypos + bw, fl_set_object_geometry(work_area, xpos + bw, ypos + bw,
width - 15 - 2 * bw, width - 15 - 2 * bw,

View 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(); Regenerate();
os << "Figure size " << wid << " " << hgh << "\n"; 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(); Regenerate();
if (!cmd.empty()) os << cmd << " "; 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(); Regenerate();
file += cmd + ' '; 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; return 0;
} }
int InsetFig::DocBook(string & file) int InsetFig::DocBook(string & file) const
{ {
string figurename = fname; string figurename = fname;
@ -1330,7 +1330,7 @@ Inset::Code InsetFig::LyxCode() const
} }
void InsetFig::Regenerate() void InsetFig::Regenerate() const
{ {
string cmdbuf; string cmdbuf;
string resizeW, resizeH; string resizeW, resizeH;

View File

@ -34,17 +34,17 @@ public:
void draw(Painter &, LyXFont const & font, void draw(Painter &, LyXFont const & font,
int baseline, float & x) const; int baseline, float & x) const;
/// ///
void Write(ostream &); void Write(ostream &) const;
/// ///
void Read(LyXLex & lex); 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. /// Updates needed features for this inset.
void Validate(LaTeXFeatures & features) const; void Validate(LaTeXFeatures & features) const;
@ -117,7 +117,7 @@ public:
float angle; float angle;
/// graphics command, latex version /// graphics command, latex version
string cmd; mutable string cmd;
/// Caption for subfigure package /// Caption for subfigure package
string subcaption; string subcaption;
@ -139,7 +139,7 @@ private:
/// recompute screen params /// recompute screen params
void Recompute(); void Recompute();
/// regenerate \includegraphics{} command /// regenerate \includegraphics{} command
void Regenerate(); void Regenerate() const;
/// regenerate \inlcudegraphics{} command in temporary buffer /// regenerate \inlcudegraphics{} command in temporary buffer
void TempRegenerate(); void TempRegenerate();
/// get sizes from .eps file /// get sizes from .eps file

View File

@ -226,7 +226,7 @@ void InsetBibKey::setCounter(int c)
// as a LyX 2.x command, and lyxlex is not enough smart to understand // 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 // real LaTeX commands. Yes, that could be fixed, but would be a waste
// of time cause LyX3 won't use lyxlex anyway. (ale) // of time cause LyX3 won't use lyxlex anyway. (ale)
void InsetBibKey::Write(ostream & os) void InsetBibKey::Write(ostream & os) const
{ {
string s; string s;
if (!options.empty()) { 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; string bib;
signed char dummy = 0; 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 // this looks like an horrible hack and it is :) The problem
// is that owner is not initialized correctly when the bib // is that owner is not initialized correctly when the bib

View File

@ -64,7 +64,7 @@ public:
/// ///
Inset * Clone() const { return new InsetBibKey(this); } Inset * Clone() const { return new InsetBibKey(this); }
/// Currently \bibitem is used as a LyX2.x command, so we need this method. /// 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; virtual string getScreenLabel() const;
/// ///
@ -111,9 +111,9 @@ public:
/// ///
void Edit(int, int); 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); string getKeys(char delim);
/// ///
@ -128,7 +128,7 @@ public:
bool display() const { return true; } bool display() const { return true; }
private: private:
/// ///
Buffer * owner; mutable Buffer * owner;
}; };
#endif #endif

View File

@ -164,7 +164,7 @@ void InsetCommand::draw(Painter & pain, LyXFont const &,
// In lyxf3 this will be just LaTeX // In lyxf3 this will be just LaTeX
void InsetCommand::Write(ostream & os) void InsetCommand::Write(ostream & os) const
{ {
os << "LatexCommand " << getCommand() << "\n"; 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(); os << getCommand();
return 0; return 0;
} }
int InsetCommand::Latex(string & file, signed char /*fragile*/) int InsetCommand::Latex(string & file, signed char /*fragile*/) const
{ {
file += getCommand(); file += getCommand();
return 0; return 0;
} }
int InsetCommand::Linuxdoc(string &/*file*/) int InsetCommand::Linuxdoc(string &/*file*/) const
{ {
return 0; return 0;
} }
int InsetCommand::DocBook(string &/*file*/) int InsetCommand::DocBook(string &/*file*/) const
{ {
return 0; return 0;
} }

View File

@ -41,19 +41,19 @@ public:
/// ///
void draw(Painter &, LyXFont const &, int baseline, float & x) const; void draw(Painter &, LyXFont const &, int baseline, float & x) const;
/// ///
void Write(ostream &); void Write(ostream &) const;
/// Parse the command. /// Parse the command.
void scanCommand(string const & cmd); void scanCommand(string const & cmd);
/// Will not be used when lyxf3 /// Will not be used when lyxf3
void Read(LyXLex & lex); 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; Inset * Clone() const;
/// ///

View 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; return 0;
} }
int InsetError::Latex(string &, signed char /*fragile*/) int InsetError::Latex(string &, signed char /*fragile*/) const
{ {
return 0; return 0;
} }
int InsetError::Linuxdoc(string &) int InsetError::Linuxdoc(string &) const
{ {
return 0; return 0;
} }
int InsetError::DocBook(string &) int InsetError::DocBook(string &) const
{ {
return 0; return 0;
} }

View File

@ -44,17 +44,17 @@ public:
void draw(Painter &, LyXFont const & font, void draw(Painter &, LyXFont const & font,
int baseline, float & x) const; int baseline, float & x) const;
/// ///
void Write(ostream &); void Write(ostream &) const;
/// ///
void Read(LyXLex & lex); 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; bool AutoDelete() const;
/// what appears in the minibuffer when opening /// what appears in the minibuffer when opening

View 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"; 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; string include_file;
signed char dummy = 0; 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; string writefile, incfile;

View File

@ -54,13 +54,13 @@ public:
return 1; return 1;
} }
/// With lyx3 we won't overload these 3 methods /// With lyx3 we won't overload these 3 methods
void Write(ostream &); void Write(ostream &) const;
/// ///
void Read(LyXLex &); 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; void Validate(LaTeXFeatures &) const;

View 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; 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; return 0;
} }
int InsetInfo::Latex(string &, signed char /*fragile*/) int InsetInfo::Latex(string &, signed char /*fragile*/) const
{ {
return 0; return 0;
} }
int InsetInfo::Linuxdoc(string &) int InsetInfo::Linuxdoc(string &) const
{ {
return 0; return 0;
} }
int InsetInfo::DocBook(string &) int InsetInfo::DocBook(string &) const
{ {
return 0; return 0;
} }

View File

@ -45,17 +45,17 @@ public:
/// ///
void draw(Painter &, LyXFont const &, int baseline, float & x) const; void draw(Painter &, LyXFont const &, int baseline, float & x) const;
/// ///
void Write(ostream &); void Write(ostream &) const;
/// ///
void Read(LyXLex & lex); 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 /// what appears in the minibuffer when opening
char const * EditMessage() const {return _("Opened note");} char const * EditMessage() const {return _("Opened note");}
/// ///

View 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()); os << escape(getCommand());
return 0; return 0;
} }
int InsetLabel::Latex(string & file, signed char /*fragile*/) int InsetLabel::Latex(string & file, signed char /*fragile*/) const
{ {
file += escape(getCommand()); file += escape(getCommand());
return 0; return 0;
} }
int InsetLabel::Linuxdoc(string & file) int InsetLabel::Linuxdoc(string & file) const
{ {
file += "<label id=\"" + getContents() +"\" >"; file += "<label id=\"" + getContents() +"\" >";
return 0; return 0;
} }
int InsetLabel::DocBook(string & file) int InsetLabel::DocBook(string & file) const
{ {
file += "<anchor id=\"" + getContents() +"\" >"; file += "<anchor id=\"" + getContents() +"\" >";
return 0; return 0;

View File

@ -39,13 +39,13 @@ public:
/// ///
unsigned char Editable() const { return 0; } 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: private:
/// This function escapes 8-bit characters /// This function escapes 8-bit characters
string escape(string const &) const; string escape(string const &) const;

View 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"; 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; os << contents;
return 0; return 0;
} }
int InsetLatexAccent::Latex(string & file, signed char /*fragile*/) int InsetLatexAccent::Latex(string & file, signed char /*fragile*/) const
{ {
file += contents; file += contents;
return 0; return 0;
} }
int InsetLatexAccent::Linuxdoc(string & file) int InsetLatexAccent::Linuxdoc(string & file) const
{ {
file += contents; file += contents;
return 0; return 0;
} }
int InsetLatexAccent::DocBook(string & file) int InsetLatexAccent::DocBook(string & file) const
{ {
file += contents; file += contents;
return 0; return 0;

View File

@ -49,17 +49,17 @@ public:
bool DisplayISO8859_9(Painter &, LyXFont const & font, bool DisplayISO8859_9(Painter &, LyXFont const & font,
int baseline, float & x) const; int baseline, float & x) const;
/// ///
void Write(ostream &); void Write(ostream &) const;
/// ///
void Read(LyXLex & lex); 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; bool Deletable() const;
/// ///

View File

@ -46,7 +46,7 @@ void InsetParent::Edit(int, int)
// LaTeX must just ignore this command // 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}"; os << "%%#{lyx}";
InsetCommand::Latex(os, fragile); InsetCommand::Latex(os, fragile);
@ -55,7 +55,7 @@ int InsetParent::Latex(ostream & os, signed char fragile)
// LaTeX must just ignore this command // 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}"; file += "%%#{lyx}";
InsetCommand::Latex(file, fragile); InsetCommand::Latex(file, fragile);

View File

@ -31,9 +31,9 @@ public:
/// ///
InsetParent(string const & fn, Buffer * owner = 0); 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()); } Inset * Clone() const { return new InsetParent(getContents()); }
/// ///

View 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; string text;
text += language_char[language]; 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; string quote;
int res = Latex(quote, 0); 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 = string doclang =
current_view->buffer()->GetLanguage(); 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 += "\""; 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(times == InsetQuotes::DoubleQ) {
if (side == InsetQuotes::LeftQ) if (side == InsetQuotes::LeftQ)

View File

@ -81,17 +81,17 @@ public:
/// ///
LyXFont ConvertFont(LyXFont font); LyXFont ConvertFont(LyXFont font);
/// ///
void Write(ostream &); void Write(ostream &) const;
/// ///
void Read(LyXLex & lex); 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; void Validate(LaTeXFeatures &) const;
/// ///

View 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()) if(getOptions().empty())
os << escape(getCommand()); 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()) if(getOptions().empty())
file += escape(getCommand()); 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() file += "<ref id=\"" + getContents()
+ "\" name=\""+ getOptions() +"\" >" ; + "\" 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() file += "<link linkend=\"" + getContents()
+ "\">"+ getOptions() +"</link>" ; + "\">"+ getOptions() +"</link>" ;

View File

@ -61,13 +61,13 @@ public:
/// ///
void gotoLabel(); 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: private:
/// This function escapes 8-bit characters /// This function escapes 8-bit characters
string escape(string const &) const; string escape(string const &) const;

View File

@ -110,7 +110,7 @@ void InsetSpecialChar::draw(Painter & pain, LyXFont const & f,
// In lyxf3 this will be just LaTeX // In lyxf3 this will be just LaTeX
void InsetSpecialChar::Write(ostream & os) void InsetSpecialChar::Write(ostream & os) const
{ {
string command; string command;
switch (kind) { 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; string command;
signed char dummy = 0; 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) { switch (kind) {
case HYPHENATION: file += "\\-"; break; 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) { switch (kind) {
case HYPHENATION: file += ""; break; 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) { switch (kind) {
case HYPHENATION: file += ""; break; case HYPHENATION: file += ""; break;

View File

@ -49,17 +49,17 @@ public:
/// ///
void draw(Painter &, LyXFont const &, int baseline, float & x) const; void draw(Painter &, LyXFont const &, int baseline, float & x) const;
/// ///
void Write(ostream &); void Write(ostream &) const;
/// Will not be used when lyxf3 /// Will not be used when lyxf3
void Read(LyXLex & lex); 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; Inset * Clone() const;
/// ///

View 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; string latex_output;
int res = Latex(latex_output, fragile); 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()) if (!getOptions().empty())
file += getOptions() + ' '; 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() + file += "<"+ getCmdName() +
" url=\"" + getContents()+"\"" + " 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() + "\">" + file += "<ulink url=\"" + getContents() + "\">" +
getOptions() +"</ulink>"; getOptions() +"</ulink>";

View File

@ -70,13 +70,13 @@ public:
/// ///
void gotoLabel(); 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); static void CloseUrlCB(FL_OBJECT *, long data);
private: private:

View File

@ -99,20 +99,20 @@ public:
/// ///
virtual bool AutoDelete() const; virtual bool AutoDelete() const;
/// ///
virtual void Write(ostream &) = 0; virtual void Write(ostream &) const = 0;
/// ///
virtual void Read(LyXLex & lex) = 0; virtual void Read(LyXLex & lex) = 0;
/** returns the number of rows (\n's) of generated tex code. /** returns the number of rows (\n's) of generated tex code.
fragile != 0 means, that the inset should take care about fragile != 0 means, that the inset should take care about
fragile commands by adding a \protect before. 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. /// Updates needed features for this inset.
virtual void Validate(LaTeXFeatures & features) const; virtual void Validate(LaTeXFeatures & features) const;
/// ///

View File

@ -180,7 +180,7 @@ public:
LyXFont(LyXFont::FONT_INIT3); LyXFont(LyXFont::FONT_INIT3);
/// LyXFont x, y; x = y; /// LyXFont x, y; x = y;
LyXFont& operator=(LyXFont const & x); LyXFont & operator=(LyXFont const & x);
/// Decreases font size by one /// Decreases font size by one
LyXFont & decSize(); LyXFont & decSize();

View File

@ -20,7 +20,6 @@
#include <list> #include <list>
#include "insets/lyxinset.h" #include "insets/lyxinset.h"
#include "insets/insetbib.h"
#include "table.h" #include "table.h"
#include "vspace.h" #include "vspace.h"
#include "layout.h" #include "layout.h"
@ -31,6 +30,7 @@ class BufferParams;
class LyXBuffer; class LyXBuffer;
class TexRow; class TexRow;
struct LaTeXFeatures; struct LaTeXFeatures;
class InsetBibKey;
using std::list; using std::list;

View File

@ -23,7 +23,7 @@ class LyXText;
struct Row; struct Row;
typedef unsigned short Dimension; typedef unsigned short Dimension;
class BufferView; class WorkArea;
/** The class LyXScreen is used for the main Textbody. /** The class LyXScreen is used for the main Textbody.
Concretely, the screen is held in a pixmap. This pixmap is kept up to Concretely, the screen is held in a pixmap. This pixmap is kept up to
@ -33,15 +33,7 @@ class BufferView;
class LyXScreen { class LyXScreen {
public: public:
/// ///
LyXScreen(BufferView *, Window window, LyXScreen(WorkArea &, LyXText * text_ptr);
Pixmap p,
Dimension width,
Dimension height,
Dimension offset_x,
Dimension offset_y,
LyXText * text_ptr);
///
~LyXScreen();
/** Draws the screen form textposition y. Uses as much of /** Draws the screen form textposition y. Uses as much of
the already printed pixmap as possible */ the already printed pixmap as possible */
@ -62,8 +54,6 @@ public:
void CursorToggle(); void CursorToggle();
/// ///
void ShowManualCursor(long x, long y, int asc, int desc); void ShowManualCursor(long x, long y, int asc, int desc);
///
void HideManualCursor();
/// returns 1 if first has changed, otherwise 0 /// returns 1 if first has changed, otherwise 0
int FitManualCursor(long, long, int, int); int FitManualCursor(long, long, int, int);
/// ///
@ -98,13 +88,11 @@ private:
void DrawOneRow(Row * row, long & y_text); void DrawOneRow(Row * row, long & y_text);
/// ///
BufferView * owner; WorkArea & owner;
/// ///
LyXText * text; LyXText * text;
///
Pixmap foreground;
/// ///
Pixmap cursor_pixmap; Pixmap cursor_pixmap;
/// ///
@ -116,16 +104,6 @@ private:
/// ///
int cursor_pixmap_h; int cursor_pixmap_h;
/// ///
Window _window;
///
Dimension _width;
///
Dimension _height;
///
Dimension _offset_x;
///
Dimension _offset_y;
///
long screen_refresh_y; long screen_refresh_y;
/// ///
Row * screen_refresh_row; Row * screen_refresh_row;

View File

@ -298,14 +298,14 @@ Inset * InsetFormula::Clone() const
} }
void InsetFormula::Write(ostream & os) void InsetFormula::Write(ostream & os) const
{ {
os << "Formula "; os << "Formula ";
Latex(os, 0); Latex(os, 0);
} }
int InsetFormula::Latex(ostream & os, signed char fragile) int InsetFormula::Latex(ostream & os, signed char fragile) const
{ {
int ret = 0; int ret = 0;
//#warning Alejandro, the number of lines is not returned in this case //#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; int ret = 0;
//#warning Alejandro, the number of lines is not returned in this case //#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; return 0;
} }
int InsetFormula::DocBook(string &/*file*/) int InsetFormula::DocBook(string &/*file*/) const
{ {
return 0; return 0;
} }

View File

@ -45,17 +45,17 @@ public:
/// ///
void draw(Painter &, LyXFont const &, int baseline, float & x) const; void draw(Painter &, LyXFont const &, int baseline, float & x) const;
/// ///
void Write(ostream &); void Write(ostream &) const;
/// ///
void Read(LyXLex & lex); 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; void Validate(LaTeXFeatures &) const;
/// ///

View File

@ -64,14 +64,14 @@ Inset * InsetFormulaMacro::Clone() const
} }
void InsetFormulaMacro::Write(ostream & os) void InsetFormulaMacro::Write(ostream & os) const
{ {
os << "FormulaMacro "; os << "FormulaMacro ";
Latex(os, 0); Latex(os, 0);
} }
int InsetFormulaMacro::Latex(ostream & os, signed char /*fragile*/) int InsetFormulaMacro::Latex(ostream & os, signed char /*fragile*/) const
{ {
int ret = 1; int ret = 1;
tmacro->WriteDef(os); 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; int ret = 1;
tmacro->WriteDef(file); 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; return 0;
} }
int InsetFormulaMacro::DocBook(string &/*file*/) int InsetFormulaMacro::DocBook(string &/*file*/) const
{ {
return 0; return 0;
} }

View File

@ -46,15 +46,15 @@ public:
/// ///
void Read(LyXLex & lex); 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; Inset * Clone() const;

View File

@ -29,6 +29,7 @@ using std::ios;
#include "debug.h" #include "debug.h"
#include "LaTeXFeatures.h" #include "LaTeXFeatures.h"
#include "insets/insetinclude.h" #include "insets/insetinclude.h"
#include "insets/insetbib.h"
#include "support/filetools.h" #include "support/filetools.h"
#include "lyx_gui_misc.h" #include "lyx_gui_misc.h"
#include "texrow.h" #include "texrow.h"

View File

@ -14,12 +14,16 @@
#pragma implementation "lyxscreen.h" #pragma implementation "lyxscreen.h"
#endif #endif
#include <algorithm>
#include "lyxscreen.h" #include "lyxscreen.h"
#include "lyxtext.h" #include "lyxtext.h"
#include "lyxrow.h" #include "lyxrow.h"
#include "BufferView.h"
#include "Painter.h" #include "Painter.h"
#include "WorkArea.h"
using std::max;
using std::min;
static static
GC createGC() GC createGC()
@ -39,16 +43,8 @@ GC createGC()
// Constructor // Constructor
LyXScreen::LyXScreen(BufferView * o, Window window, LyXScreen::LyXScreen(WorkArea & o, LyXText * text_ptr)
Pixmap p, : owner(o), text(text_ptr)
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)
{ {
first = 0; first = 0;
@ -56,9 +52,6 @@ LyXScreen::LyXScreen(BufferView * o, Window window,
cursor_visible = false; cursor_visible = false;
screen_refresh_y = -1; screen_refresh_y = -1;
/* create the foreground pixmap */
foreground = p;
cursor_pixmap = 0; cursor_pixmap = 0;
cursor_pixmap_x = 0; cursor_pixmap_x = 0;
cursor_pixmap_y = 0; cursor_pixmap_y = 0;
@ -70,15 +63,11 @@ LyXScreen::LyXScreen(BufferView * o, Window window,
} }
// Destructor
LyXScreen::~LyXScreen() {}
void LyXScreen::Redraw() void LyXScreen::Redraw()
{ {
DrawFromTo(0, _height); DrawFromTo(0, owner.height());
screen_refresh_y = -1; screen_refresh_y = -1;
expose(0, 0, _width, _height); expose(0, 0, owner.workWidth(), owner.height());
if (cursor_visible) { if (cursor_visible) {
cursor_visible = false; cursor_visible = false;
ShowCursor(); ShowCursor();
@ -89,12 +78,13 @@ void LyXScreen::Redraw()
void LyXScreen::expose(int x, int y, int exp_width, int exp_height) void LyXScreen::expose(int x, int y, int exp_width, int exp_height)
{ {
XCopyArea(fl_display, XCopyArea(fl_display,
foreground, owner.getPixmap(),
_window, owner.getWin(),
gc_copy, gc_copy,
x, y, x, y,
exp_width, exp_height, 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 */ /* y1 is now the real beginning of row on the screen */
while (row != 0 && y < y2) { while (row != 0 && y < y2) {
text->GetVisibleRow(y, row, y + first); text->GetVisibleRow(y, row, y + first);
y += row->height; y += row->height;
row = row -> next; row = row->next;
} }
/* maybe we have to clear the screen at the bottom */ /* maybe we have to clear the screen at the bottom */
if (y < y2) { if (y < y2) {
owner->painter().fillRectangle(0, y, _width, y2 - y, owner.getPainter().fillRectangle(0, y,
owner.workWidth(),
y2 - y,
LColor::bottomarea); LColor::bottomarea);
} }
} }
@ -129,11 +119,11 @@ void LyXScreen::DrawOneRow(Row * row, long & y_text)
{ {
long y = y_text - first; 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 */ /* ok there is something visible */
text->GetVisibleRow(y, row, y + first); 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; first = y;
/* is any optimiziation possible? */ /* is any optimiziation possible? */
if ((y - old_first) < _height if ((y - old_first) < owner.height()
&& (old_first - y) < _height) { && (old_first - y) < owner.height()) {
if (first < old_first) { if (first < old_first) {
DrawFromTo(0, old_first - first); DrawFromTo(0, old_first - first);
XCopyArea (fl_display, XCopyArea (fl_display,
_window, owner.getWin(),
_window, owner.getWin(),
gc_copy, gc_copy,
_offset_x, _offset_y, owner.xpos(),
_width , _height - old_first + first, owner.ypos(),
_offset_x, _offset_y + old_first - first); owner.workWidth(),
owner.height() - old_first + first,
owner.xpos(),
owner.ypos() + old_first - first
);
// expose the area drawn // expose the area drawn
expose(0, 0, _width, old_first - first); expose(0, 0,
owner.workWidth(),
old_first - first);
} else { } else {
DrawFromTo(_height + old_first - first, _height); DrawFromTo(
owner.height() + old_first - first,
owner.height());
XCopyArea (fl_display, XCopyArea (fl_display,
_window, owner.getWin(),
_window, owner.getWin(),
gc_copy, gc_copy,
_offset_x, _offset_y + first - old_first, owner.xpos(),
_width , _height + old_first - first, owner.ypos() + first - old_first,
_offset_x, _offset_y); owner.workWidth(),
owner.height() + old_first - first,
owner.xpos(),
owner.ypos());
// expose the area drawn // expose the area drawn
expose(0, _height + old_first - first, expose(0, owner.height() + old_first - first,
_width, first - old_first); owner.workWidth(), first - old_first);
} }
} else { } else {
/* make a dumb new-draw */ /* make a dumb new-draw */
DrawFromTo(0, _height); DrawFromTo(0, owner.height());
expose(0, 0, _width, _height); expose(0, 0, owner.workWidth(), owner.height());
} }
} }
void LyXScreen::ShowCursor() void LyXScreen::ShowCursor()
{ {
long x = 0;
long y1 = 0;
long y2 = 0;
if (cursor_visible) return; if (cursor_visible) return;
x = text->cursor.x; long x = text->cursor.x;
y1 = text->cursor.y - text->real_current_font.maxAscent() - first; long y1 = max(text->cursor.y -
if (y1 < 0) y1 = 0; text->real_current_font.maxAscent() - first, 0L);
y2 = text->cursor.y + text->real_current_font.maxDescent() - first; long y2 = min(text->cursor.y +
if (y2 > _height) y2 = _height; text->real_current_font.maxDescent() - first,
long(owner.height()));
// Secure against very strange situations // Secure against very strange situations
if (y2 < y1) y2 = y1; if (y2 < y1) y2 = y1;
@ -206,7 +204,7 @@ void LyXScreen::ShowCursor()
cursor_pixmap = 0; cursor_pixmap = 0;
} }
if (y2 > 0 && y1 < _height) { if (y2 > 0 && y1 < owner.height()) {
cursor_pixmap_w = 1; cursor_pixmap_w = 1;
cursor_pixmap_h = y2 - y1 + 1; cursor_pixmap_h = y2 - y1 + 1;
cursor_pixmap_x = x; cursor_pixmap_x = x;
@ -218,19 +216,20 @@ void LyXScreen::ShowCursor()
cursor_pixmap_h, cursor_pixmap_h,
fl_get_visual_depth()); fl_get_visual_depth());
XCopyArea(fl_display, XCopyArea(fl_display,
_window, owner.getWin(),
cursor_pixmap, cursor_pixmap,
gc_copy, gc_copy,
_offset_x + cursor_pixmap_x, owner.xpos() + cursor_pixmap_x,
_offset_y + cursor_pixmap_y, owner.ypos() + cursor_pixmap_y,
cursor_pixmap_w, cursor_pixmap_h, cursor_pixmap_w, cursor_pixmap_h,
0, 0); 0, 0);
XDrawLine(fl_display, XDrawLine(fl_display,
_window, gc_copy, owner.getWin(),
x + _offset_x, gc_copy,
y1 + _offset_y, x + owner.xpos(),
x + _offset_x, y1 + owner.ypos(),
y2 + _offset_y); x + owner.xpos(),
y2 + owner.ypos());
cursor_visible = true; cursor_visible = true;
} }
} }
@ -241,11 +240,11 @@ int LyXScreen::FitManualCursor(long /*x*/, long y, int asc, int desc)
{ {
long newtop = first; long newtop = first;
if (y + desc - first >= _height) if (y + desc - first >= owner.height())
newtop = y - 3*_height / 4; /* the scroll region must be so big!! */ newtop = y - 3 * owner.height() / 4; /* the scroll region must be so big!! */
else if (y - asc < first else if (y - asc < first
&& first > 0) { && first > 0) {
newtop = y - _height / 4; newtop = y - owner.height() / 4;
} }
if (newtop < 0) if (newtop < 0)
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) void LyXScreen::ShowManualCursor(long x, long y, int asc, int desc)
{ {
long y1 = 0; long y1 = max(y - first - asc, 0L);
long y2 = 0; long y2 = min(y - first + desc, long(owner.height()));
y1 = y - first - asc;
if (y1 < 0)
y1 = 0;
y2 = y -first + desc;
if (y2 > _height)
y2 = _height;
if (cursor_pixmap){ if (cursor_pixmap){
XFreePixmap(fl_display, cursor_pixmap); XFreePixmap(fl_display, cursor_pixmap);
cursor_pixmap = 0; cursor_pixmap = 0;
} }
if (y2 > 0 && y1 < _height) { if (y2 > 0 && y1 <
owner.height()) {
cursor_pixmap_w = 1; cursor_pixmap_w = 1;
cursor_pixmap_h = y2 - y1 + 1; cursor_pixmap_h = y2 - y1 + 1;
cursor_pixmap_x = x, cursor_pixmap_x = x,
@ -294,20 +281,21 @@ void LyXScreen::ShowManualCursor(long x, long y, int asc, int desc)
cursor_pixmap_h, cursor_pixmap_h,
fl_get_visual_depth()); fl_get_visual_depth());
XCopyArea (fl_display, XCopyArea (fl_display,
_window, owner.getWin(),
cursor_pixmap, cursor_pixmap,
gc_copy, gc_copy,
_offset_x + cursor_pixmap_x, owner.xpos() + cursor_pixmap_x,
_offset_y + cursor_pixmap_y, owner.ypos() + cursor_pixmap_y,
cursor_pixmap_w, cursor_pixmap_w,
cursor_pixmap_h, cursor_pixmap_h,
0, 0); 0, 0);
XDrawLine(fl_display, XDrawLine(fl_display,
_window, gc_copy, owner.getWin(),
x+_offset_x, gc_copy,
y1+_offset_y, x + owner.xpos(),
x+_offset_x, y1 + owner.ypos(),
y2+_offset_y); x + owner.xpos(),
y2 + owner.ypos());
} }
cursor_visible = true; cursor_visible = true;
} }
@ -320,12 +308,12 @@ void LyXScreen::HideCursor()
if (cursor_pixmap){ if (cursor_pixmap){
XCopyArea (fl_display, XCopyArea (fl_display,
cursor_pixmap, cursor_pixmap,
_window, owner.getWin(),
gc_copy, gc_copy,
0, 0, 0, 0,
cursor_pixmap_w, cursor_pixmap_h, cursor_pixmap_w, cursor_pixmap_h,
cursor_pixmap_x + _offset_x, cursor_pixmap_x + owner.xpos(),
cursor_pixmap_y + _offset_y); cursor_pixmap_y + owner.ypos());
} }
cursor_visible = false; cursor_visible = false;
} }
@ -348,22 +336,22 @@ long LyXScreen::TopCursorVisible()
if (text->cursor.y if (text->cursor.y
- text->cursor.row->baseline - text->cursor.row->baseline
+ text->cursor.row->height + text->cursor.row->height
- first >= _height) { - first >= owner.height()) {
if (text->cursor.row->height < _height if (text->cursor.row->height < owner.height()
&& text->cursor.row->height > _height/4) && text->cursor.row->height > owner.height() / 4)
newtop = text->cursor.y newtop = text->cursor.y
+ text->cursor.row->height + text->cursor.row->height
- text->cursor.row->baseline - _height; - text->cursor.row->baseline - owner.height();
else else
newtop = text->cursor.y 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 } else if (text->cursor.y - text->cursor.row->baseline < first
&& first > 0) { && first > 0) {
if (text->cursor.row->height < _height if (text->cursor.row->height < owner.height()
&& text->cursor.row->height > _height/4) && text->cursor.row->height > owner.height() / 4)
newtop = text->cursor.y - text->cursor.row->baseline; newtop = text->cursor.y - text->cursor.row->baseline;
else { else {
newtop = text->cursor.y - _height / 4; newtop = text->cursor.y - owner.height() / 4;
if (newtop > first) if (newtop > first)
newtop = first; newtop = first;
} }
@ -390,10 +378,9 @@ int LyXScreen::FitCursor()
void LyXScreen::Update() void LyXScreen::Update()
{ {
long y = 0;
if (text->status == LyXText::NEED_MORE_REFRESH if (text->status == LyXText::NEED_MORE_REFRESH
|| screen_refresh_y > -1 ) { || screen_refresh_y > -1 ) {
long y = 0;
if (screen_refresh_y > -1 if (screen_refresh_y > -1
&& screen_refresh_y < text->refresh_y) && screen_refresh_y < text->refresh_y)
y = screen_refresh_y; y = screen_refresh_y;
@ -402,40 +389,39 @@ void LyXScreen::Update()
if (y < first) y = first; if (y < first) y = first;
DrawFromTo(y - first, _height); DrawFromTo(y - first, owner.height());
text->refresh_y = 0; text->refresh_y = 0;
text->status = LyXText::UNCHANGED; text->status = LyXText::UNCHANGED;
screen_refresh_y = -1; 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) { } else if (text->status == LyXText::NEED_VERY_LITTLE_REFRESH) {
/* ok I will update the current cursor row */ /* ok I will update the current cursor row */
y = text->refresh_y; long y = text->refresh_y;
DrawOneRow(text->refresh_row, y); DrawOneRow(text->refresh_row, y);
text->status = LyXText::UNCHANGED; text->status = LyXText::UNCHANGED;
expose(0, text->refresh_y-first, expose(0, text->refresh_y - first,
_width, text->refresh_row->height); owner.workWidth(), text->refresh_row->height);
} }
} }
void LyXScreen::SmallUpdate() void LyXScreen::SmallUpdate()
{ {
Row * row = 0; if (text->status == LyXText::NEED_MORE_REFRESH) {
long y = 0;
long y2 = 0;
if (text->status == LyXText::NEED_MORE_REFRESH){
/* ok I will update till the current cursor row */ /* ok I will update till the current cursor row */
row = text->refresh_row; Row * row = text->refresh_row;
y = text->refresh_y; long y = text->refresh_y;
y2 = y; long y2 = y;
if (y > text->cursor.y) { if (y > text->cursor.y) {
Update(); Update();
return; return;
} }
while (row && row != text->cursor.row && y < first + _height) { while (row
&& row != text->cursor.row
&& y < first + owner.height()) {
DrawOneRow(row, y); DrawOneRow(row, y);
row = row->next; row = row->next;
} }
@ -445,15 +431,15 @@ void LyXScreen::SmallUpdate()
screen_refresh_row = row->next; screen_refresh_row = row->next;
text->status = LyXText::UNCHANGED; text->status = LyXText::UNCHANGED;
// Is the right regin exposed? // 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) { } else if (text->status == LyXText::NEED_VERY_LITTLE_REFRESH) {
/* ok I will update the current cursor row */ /* ok I will update the current cursor row */
row = text->refresh_row; long y = text->refresh_y;
y = text->refresh_y; DrawOneRow(text->refresh_row, y);
DrawOneRow(row, y);
text->status = LyXText::UNCHANGED; text->status = LyXText::UNCHANGED;
expose(0, text->refresh_y - first, expose(0, text->refresh_y - first,
_width, row->height); owner.workWidth(), text->refresh_row->height);
} }
} }
@ -461,8 +447,7 @@ void LyXScreen::SmallUpdate()
void LyXScreen::ToggleSelection(bool kill_selection) void LyXScreen::ToggleSelection(bool kill_selection)
{ {
/* only if there is a selection */ /* only if there is a selection */
if (!text->selection) if (!text->selection) return;
return;
long top = text->sel_start_cursor.y long top = text->sel_start_cursor.y
- text->sel_start_cursor.row->baseline; - text->sel_start_cursor.row->baseline;
@ -470,20 +455,22 @@ void LyXScreen::ToggleSelection(bool kill_selection)
- text->sel_end_cursor.row->baseline - text->sel_end_cursor.row->baseline
+ text->sel_end_cursor.row->height; + text->sel_end_cursor.row->height;
if (top - first < 0) if (top < first)
top = first; top = max(top, first);
if (bottom - first < 0) if (bottom < first)
bottom = first; bottom = max(bottom, first);
if (bottom - first > _height) if (bottom > first + owner.height())
bottom = first + _height; bottom = first + owner.height();
if (top - first > _height) if (top > first + owner.height())
top = first + _height; top = first + owner.height();
if (kill_selection) if (kill_selection)
text->selection = 0; text->selection = 0;
DrawFromTo(top - first, bottom - first); 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) if (bottom - first < 0)
bottom = first; bottom = first;
if (bottom - first > _height) if (bottom - first > owner.height())
bottom = first + _height; bottom = first + owner.height();
if (top - first > _height) if (top - first > owner.height())
top = first + _height; top = first + owner.height();
DrawFromTo(top - first, bottom - first); DrawFromTo(top - first, bottom - first);
expose(0, top - first, _width, bottom - first - (top - first)); expose(0, top - first, owner.workWidth(),
bottom - first - (top - first));
} }

View File

@ -20,6 +20,7 @@
#include "lyxparagraph.h" #include "lyxparagraph.h"
#include "lyxtext.h" #include "lyxtext.h"
#include "support/textutils.h" #include "support/textutils.h"
#include "insets/insetbib.h"
#include "lyx_gui_misc.h" #include "lyx_gui_misc.h"
#include "gettext.h" #include "gettext.h"
#include "bufferparams.h" #include "bufferparams.h"

View File

@ -21,6 +21,7 @@
#include "LString.h" #include "LString.h"
#include "lyxparagraph.h" #include "lyxparagraph.h"
#include "insets/inseterror.h" #include "insets/inseterror.h"
#include "insets/insetbib.h"
#include "layout.h" #include "layout.h"
#include "LyXView.h" #include "LyXView.h"
#include "support/textutils.h" #include "support/textutils.h"