qvolray

diff src/ui_xferview.cc @ 35:6ca076bf5084

sucks ass
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 15 Apr 2012 02:22:13 +0300
parents 40df2cdc6323
children
line diff
     1.1 --- a/src/ui_xferview.cc	Sun Apr 15 00:11:38 2012 +0300
     1.2 +++ b/src/ui_xferview.cc	Sun Apr 15 02:22:13 2012 +0300
     1.3 @@ -1,6 +1,9 @@
     1.4 +#include <QtGui>
     1.5  #include "ui_xferview.h"
     1.6  #include "volray.h"
     1.7  
     1.8 +static int prev_x, prev_y;
     1.9 +
    1.10  XFerGLView::XFerGLView(QGLWidget *share_widget)
    1.11  	: QGLWidget(QGLFormat(QGL::DoubleBuffer), 0, share_widget)
    1.12  {
    1.13 @@ -24,3 +27,25 @@
    1.14  {
    1.15  	volray_draw_xfer();
    1.16  }
    1.17 +
    1.18 +void XFerGLView::mousePressEvent(QMouseEvent *ev)
    1.19 +{
    1.20 +	prev_x = ev->x();
    1.21 +	prev_y = ev->y();
    1.22 +}
    1.23 +
    1.24 +void modxfer(int dx, int dy, int max_x, int max_y);
    1.25 +
    1.26 +void XFerGLView::mouseMoveEvent(QMouseEvent *ev)
    1.27 +{
    1.28 +	int x = ev->x();
    1.29 +	int y = ev->y();
    1.30 +
    1.31 +	int dx = x - prev_x;
    1.32 +	int dy = y - prev_y;
    1.33 +
    1.34 +	prev_x = x;
    1.35 +	prev_y = y;
    1.36 +
    1.37 +	modxfer(dx, dy, width(), height());
    1.38 +}