#undef emit
#endif
-#include "funcrequest.h"
-#include "frontends/Timeout.h"
-
#include "WorkArea.h"
#include "QLPainter.h"
#include "LyXView.h"
+#include "funcrequest.h"
+#include "frontends/Timeout.h"
+
#include <QAbstractScrollArea>
#include <QMouseEvent>
#include <QWheelEvent>
#include <QKeyEvent>
#include <QPaintEvent>
#include <QTimer>
-
-#include <boost/scoped_ptr.hpp>
+#include <QImage>
+#include <QPixmap>
#include <queue>
///
virtual std::string const getClipboard() const;
-
+
///
virtual void putClipboard(std::string const &) const;
-
+
///
virtual void dragEnterEvent(QDragEnterEvent * event);
-
+
///
virtual void dropEvent(QDropEvent* event);
-
+
/// return the widget's painter
virtual Painter & getPainter() { return (Painter &) painter_; }
- ///
- //virtual QPaintDevice & paintDevice() { return content_->pixmap(); }
-
/// return the backing pixmap
- QPixmap * pixmap() const { return pixmap_.get(); }
+ QPaintDevice * paintDevice() { return &paint_device_; }
- /// return the widget's painter
- //virtual QLPainter & getQLPainter() const { return painter_; }
+ /// update the passed area.
+ void update(int x, int y, int w, int h);
+
+ /// return a screen copy of the defined area.
+ QPixmap copyScreen(int x, int y, int w, int h) const;
- /// get the content pane widget
- QWidget * getContent() const { return viewport(); }
+ /// 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);
+ LyXView & view()
+ {
+ return view_;
+ }
protected:
/// repaint part of the widget
#if USE_INPUT_METHODS
protected:
/// IM events
- void QWorkArea::inputMethodEvent(QInputMethodEvent * e)
+ void QWorkArea::inputMethodEvent(QInputMethodEvent * e)
#endif
public slots:
+ /// Timeout event Slot for keyboard bufferring.
+ /// \todo This is not used currently in the code, remove?
void keyeventTimeout();
- void adjustViewWithScrollBar(int action);
-private:
+ /// Adjust the LyX buffer view with the position of the scrollbar.
+ /**
+ * The action argument is not used in the the code, it is there
+ * only for the connection to the vertical srollbar signal which
+ * emits an 'int' action.
+ */
+ void adjustViewWithScrollBar(int action = 0);
- ///
+private:
+ ///
+ LyXView & view_;
+
+ /// Buffer view width.
int workWidth_;
- ///
+
+ /// Buffer view height.
int workHeight_;
- /// our painter
+ /// Our painter.
QLPainter painter_;
/// The slot connected to SyntheticMouseEvent::timeout.
void generateSyntheticMouseEvent();
+ ///
SyntheticMouseEvent synthetic_mouse_event_;
- /// the double buffered pixmap
- boost::scoped_ptr<QPixmap> pixmap_;
+ /// Our client side painting device.
+ QImage paint_device_;
+
+ /// Our server side painting device.
+ QPixmap screen_device_;
+ /// \todo remove
QTimer step_timer_;
+
+ /// \todo remove
std::queue<boost::shared_ptr<QKeyEvent> > keyeventQueue_;
double_click dc_event_;
-
- bool scrolled_with_mouse_;
- bool scrolled_with_keyboard_;
};
#endif // QWORKAREA_H