From 54bdecdb48bde9babe53e529f2f1a6a62bb69688 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Sat, 28 Oct 2006 09:36:22 +0000 Subject: [PATCH] remove paperHeight() and paperWidth() in Painter and inherited classes. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15589 a592a061-630c-0410-9148-cb99ea01b6c8 --- development/scons/scons_manifest.py | 1 - src/frontends/Makefile.am | 1 - src/frontends/Painter.h | 5 ----- src/frontends/nullpainter.C | 30 ----------------------------- src/frontends/nullpainter.h | 5 ----- src/frontends/qt4/QLPainter.C | 12 ------------ src/frontends/qt4/QLPainter.h | 5 ----- src/mathed/MathData.C | 13 ++++++------- 8 files changed, 6 insertions(+), 66 deletions(-) delete mode 100644 src/frontends/nullpainter.C diff --git a/development/scons/scons_manifest.py b/development/scons/scons_manifest.py index 1332ee7dc5..b3db3ac346 100644 --- a/development/scons/scons_manifest.py +++ b/development/scons/scons_manifest.py @@ -463,7 +463,6 @@ src_frontends_files = Split(''' Toolbars.C WorkArea.C guiapi.C - nullpainter.C ''') diff --git a/src/frontends/Makefile.am b/src/frontends/Makefile.am index 9c9f417f4f..7678c7bcd0 100644 --- a/src/frontends/Makefile.am +++ b/src/frontends/Makefile.am @@ -45,5 +45,4 @@ libfrontends_la_SOURCES = \ guiapi.C \ key_state.h \ mouse_state.h \ - nullpainter.C \ nullpainter.h diff --git a/src/frontends/Painter.h b/src/frontends/Painter.h index df9e5dbd65..5f8e2250b7 100644 --- a/src/frontends/Painter.h +++ b/src/frontends/Painter.h @@ -68,11 +68,6 @@ public: /// end painting ////virtual void end() {} - /// return the width of the work area in pixels - virtual int paperWidth() const = 0; - /// return the height of the work area in pixels - virtual int paperHeight() const = 0; - /// draw a line from point to point virtual void line( int x1, int y1, diff --git a/src/frontends/nullpainter.C b/src/frontends/nullpainter.C deleted file mode 100644 index 085cd82117..0000000000 --- a/src/frontends/nullpainter.C +++ /dev/null @@ -1,30 +0,0 @@ -/** - * \file nullpainter.C - * This file is part of LyX, the document processor. - * Licence details can be found in the file COPYING. - * - * \author Alfredo Braunstein - * \author John Levon - * - * Full author contact details are available in file CREDITS. - */ - -#include - -#include "nullpainter.h" - -#include "LColor.h" - -#include - - -namespace lyx { -namespace frontend { - -int NullPainter::paperHeight() const -{ - return std::numeric_limits::max(); -} - -} // namespace frontend -} // namespace lyx diff --git a/src/frontends/nullpainter.h b/src/frontends/nullpainter.h index da563bf92f..f2449a9318 100644 --- a/src/frontends/nullpainter.h +++ b/src/frontends/nullpainter.h @@ -31,11 +31,6 @@ public: /// end painting void end() {} - /// - int paperWidth() const { return 0; } - /// - int paperHeight() const; - /// void line(int, int, int, int, LColor_color, line_style = line_solid, line_width = line_thin) {} diff --git a/src/frontends/qt4/QLPainter.C b/src/frontends/qt4/QLPainter.C index 72a5ce5903..ddfcb9f9a9 100644 --- a/src/frontends/qt4/QLPainter.C +++ b/src/frontends/qt4/QLPainter.C @@ -52,18 +52,6 @@ QLPainter::~QLPainter() } -int QLPainter::paperWidth() const -{ - return qwa_->width(); -} - - -int QLPainter::paperHeight() const -{ - return qwa_->height(); -} - - void QLPainter::setQPainterPen(LColor_color col, Painter::line_style ls, Painter::line_width lw) { diff --git a/src/frontends/qt4/QLPainter.h b/src/frontends/qt4/QLPainter.h index 8961fc29c0..06d0b59676 100644 --- a/src/frontends/qt4/QLPainter.h +++ b/src/frontends/qt4/QLPainter.h @@ -32,11 +32,6 @@ class GuiWorkArea; */ class QLPainter : public QPainter, public Painter { public: - /// return the width of the work area in pixels - virtual int paperWidth() const; - /// return the height of the work area in pixels - virtual int paperHeight() const; - /// draw a line from point to point virtual void line( int x1, int y1, diff --git a/src/mathed/MathData.C b/src/mathed/MathData.C index 41cb2458b4..a8b31f9b6e 100644 --- a/src/mathed/MathData.C +++ b/src/mathed/MathData.C @@ -278,7 +278,8 @@ void MathArray::metrics(MetricsInfo & mi) const void MathArray::draw(PainterInfo & pi, int x, int y) const { //lyxerr << "MathArray::draw: x: " << x << " y: " << y << endl; - setXY(*pi.base.bv, x, y); + BufferView & bv = *pi.base.bv; + setXY(bv, x, y); if (empty()) { pi.pain.rectangle(x, y - ascent(), width(), height(), LColor::mathline); @@ -287,16 +288,15 @@ void MathArray::draw(PainterInfo & pi, int x, int y) const // don't draw outside the workarea if (y + descent() <= 0 - || y - ascent() >= pi.pain.paperHeight() + || y - ascent() >= bv.workHeight() || x + width() <= 0 - || x >= pi.pain.paperWidth()) + || x >= bv. workWidth()) return; - //BufferView & bv = *pi.base.bv; for (size_t i = 0, n = size(); i != n; ++i) { MathAtom const & at = operator[](i); #if 0 - Buffer const & buf = *bv.buffer(); + Buffer const & buf = bv.buffer(); // special macro handling MathMacro const * mac = at->asMacro(); if (mac && buf.hasMacro(mac->name())) { @@ -312,8 +312,7 @@ void MathArray::draw(PainterInfo & pi, int x, int y) const } } #endif - //BufferView & bv = *pi.base.bv; - pi.base.bv->coordCache().insets().add(at.nucleus(), x, y); + bv.coordCache().insets().add(at.nucleus(), x, y); at->drawSelection(pi, x, y); at->draw(pi, x, y); x += at->width(); -- 2.39.5