cosmetics

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15487 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2006-10-22 17:58:09 +00:00
parent 73facfc164
commit 153c997228
4 changed files with 24 additions and 30 deletions

View File

@ -170,11 +170,6 @@ GuiWorkArea::GuiWorkArea(int w, int h, LyXView & lyx_view)
}
GuiWorkArea::~GuiWorkArea()
{
}
void GuiWorkArea::setScrollbarParams(int h, int scroll_pos, int scroll_line_step)
{
verticalScrollBar()->setTracking(false);
@ -431,6 +426,10 @@ void GuiWorkArea::update(int x, int y, int w, int h)
void GuiWorkArea::paintEvent(QPaintEvent * e)
{
lyxerr << "paintEvent begin: x: " << e->rect().x()
<< " y: " << e->rect().y()
<< " w: " << e->rect().width()
<< " h: " << e->rect().height() << endl;
/*
lyxerr[Debug::GUI] << BOOST_CURRENT_FUNCTION
<< "\n QWidget width\t" << this->width()
@ -454,32 +453,31 @@ void GuiWorkArea::paintEvent(QPaintEvent * e)
if (show_hcursor_)
q.drawPixmap(cursor_x_, cursor_y_ + cursor_h_ - 1, hcursor_);
lyxerr << "paintEvent end" << endl;
}
QPixmap GuiWorkArea::copyScreen(int x, int y, int w, int h) const
{
lyxerr << "copyScreen begin: x: " << x << " y: " << y << endl;
return paint_device_.copy(x, y, w, h);
lyxerr << "copyScreen end " << endl;
}
void GuiWorkArea::drawScreen(int x, int y, QPixmap pixmap)
void GuiWorkArea::drawScreen(int x, int y, const QPixmap & pixmap)
{
lyxerr << "drawScreen begin: x: " << x << " y: " << y << endl;
QPainter q(&paint_device_);
q.drawPixmap(x, y, pixmap);
update(x, y, pixmap.width(), pixmap.height());
lyxerr << "drawScreen end" << endl;
}
void GuiWorkArea::expose(int x, int y, int w, int h)
{
/*
if (x == 0 && y == 0 && w == viewport()->width() && h == viewport()->height()) {
viewport()->repaint(x, y, w, h);
return;
}
*/
update(x, y, w, h);
}

View File

@ -22,24 +22,23 @@
#include <QAbstractScrollArea>
#include <QMouseEvent>
#include <QWheelEvent>
#include <QResizeEvent>
#include <QKeyEvent>
#include <QPaintEvent>
#include <QTimer>
#include <QImage>
#include <QPixmap>
#include <queue>
class Painter;
class QWidget;
class QDragEnterEvent;
class QDropEvent;
class QMouseEvent;
class QWheelEvent;
class QPaintEvent;
namespace lyx {
class Painter;
namespace frontend {
class GuiView;
@ -95,13 +94,11 @@ class GuiWorkArea: public QAbstractScrollArea, public WorkArea
Q_OBJECT
public:
///
GuiWorkArea(int width, int height, LyXView & lyx_view);
virtual ~GuiWorkArea();
/// return the width of the content pane
virtual int width() const { return viewport()->width(); }
/// return the height of the content pane
virtual int height() const { return viewport()->height(); }
///
@ -126,10 +123,7 @@ public:
QPixmap copyScreen(int x, int y, int w, int h) const;
/// Draw a pixmap onto the backing pixmap.
/**
QPixmap is implicitely shared so no need to pass by reference.
*/
void drawScreen(int x, int y, QPixmap pixmap);
void drawScreen(int x, int y, const QPixmap & pixmap);
/// copies specified area of pixmap to screen
virtual void expose(int x, int y, int exp_width, int exp_height);

View File

@ -55,6 +55,7 @@ QLPainter::QLPainter(GuiWorkArea * qwa)
void QLPainter::start()
{
lyxerr << "QLPainter::start()" << endl;
qp_.reset(new QPainter(qwa_->paintDevice()));
// new QPainter has default QPen:
current_color_ = LColor::black;
@ -66,6 +67,7 @@ void QLPainter::start()
void QLPainter::end()
{
qp_->end();
lyxerr << "QLPainter::end()" << endl;
}

View File

@ -34,7 +34,7 @@ using std::vector;
namespace lyx {
int const button_size = 40;
int const button_size = 32;
IconPalette::IconPalette(QWidget * parent)
@ -63,11 +63,11 @@ void IconPalette::add(QPixmap const & pixmap, string name, string tooltip)
void IconPalette::clicked()
{
vector<Button>::const_iterator it(buttons_.begin());
vector<Button>::const_iterator const end(buttons_.end());
vector<Button>::const_iterator it = buttons_.begin();
vector<Button>::const_iterator const end = buttons_.end();
for (; it != end; ++it) {
if (sender() == it->first) {
// emit signal
// emit signal
button_clicked(it->second);
return;
}