okular/kpdf/pixmapwidget.h
Enrico Ros f8dfcf3289 1) Dealing with the QScrollView (introduced for continous navigation) is a
real PITA. Tons of unneeded repaints are casted everywhere, even when
hiding or covering widgets.
Here we fix a big-bad-bug that repainted all the already viewed pages on
a zoom operation. That means that if zooming on a page after viewing 150
pages, then *at least* 150 pages got repainted :-(.
Tried to disable clipper(), but got weird results.
2) Adding devel only debug code to check for a possible bug Aaron told me,
but I actually wasn't unable to reproduce.

svn path=/branches/kpdf_experiments/kdegraphics/kpdf/; revision=357273
2004-10-24 09:17:24 +00:00

100 lines
2.5 KiB
C++

/***************************************************************************
* Copyright (C) 2004 by Enrico Ros <eros.kde@email.it> *
* Copyright (C) 2004 by Albert Astals Cid <tsdgeos@terra.es> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#ifndef _PIXMAPWIDGET_H_
#define _PIXMAPWIDGET_H_
#include <qwidget.h>
#include <qrect.h>
class KPDFPage;
/**
* @short Graphical representation of a page.
* ...
*/
class PixmapWidget : public QWidget
{
public:
PixmapWidget( QWidget * parent, const KPDFPage * page, const char * name = 0 );
// internal size/placements evaluators
void setZoomFixed( double magFactor = 1.0 );
void setZoomFitWidth( int width );
void setZoomFitRect( int rectWidth, int rectHeight );
float zoomFactor() const { return m_zoomFactor; }
// full size (for resizing) and inner pixmap size
int widthHint() const;
int heightHint() const;
int pixmapWidth() const;
int pixmapHeight() const;
// other queries
int pageNumber() const;
const KPDFPage * page() const;
protected:
void setPixmapMargins( int left, int top, int right, int bottom );
const KPDFPage * m_page;
int m_marginLeft, m_marginTop, m_marginRight, m_marginBottom;
int m_pixmapWidth, m_pixmapHeight;
float m_zoomFactor;
};
/**
* @short ThumbnailList's selectable page.
* ...
*/
class ThumbnailWidget : public PixmapWidget
{
public:
ThumbnailWidget( QWidget *parent, const KPDFPage *page );
// set the thumbnail selected state
void setSelected( bool selected );
protected:
void paintEvent(QPaintEvent *);
private:
bool m_selected;
int m_labelNumber;
int m_labelHeight;
};
/**
* @short PageView's editable page. Renders page, selection and overlay GFX.
* ...
*/
class PageWidget : public PixmapWidget
{
public:
PageWidget( QWidget * parent, const KPDFPage * page );
void clearSelection();
void setBeginCorner( int x, int y );
void setEndCorner( int x, int y );
QString selectedText() const;
protected:
void paintEvent(QPaintEvent *);
private:
int m_selBeginX;
int m_selBeginY;
QRect m_selectionRect;
};
#endif