summaryrefslogtreecommitdiff
authoralwin <alwin>2004-04-05 00:09:04 (UTC)
committer alwin <alwin>2004-04-05 00:09:04 (UTC)
commitb0ceb8843ebe9ee3054faa98f08bd255df955aa3 (patch) (unidiff)
tree0ff209155b8b442b7810bc33b5e49cdd34d1fad2
parent7485cd42befd86ad035ef4fa29d6e8f728b1e211 (diff)
downloadopie-b0ceb8843ebe9ee3054faa98f08bd255df955aa3.zip
opie-b0ceb8843ebe9ee3054faa98f08bd255df955aa3.tar.gz
opie-b0ceb8843ebe9ee3054faa98f08bd255df955aa3.tar.bz2
ok, found the problem with moving the image via pen/mouse
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/imagescrollview.cpp22
-rw-r--r--noncore/graphics/opie-eye/gui/imagescrollview.h4
2 files changed, 17 insertions, 9 deletions
diff --git a/noncore/graphics/opie-eye/gui/imagescrollview.cpp b/noncore/graphics/opie-eye/gui/imagescrollview.cpp
index f36b717..019f376 100644
--- a/noncore/graphics/opie-eye/gui/imagescrollview.cpp
+++ b/noncore/graphics/opie-eye/gui/imagescrollview.cpp
@@ -1,6 +1,10 @@
1#include "imagescrollview.h" 1#include "imagescrollview.h"
2 2
3#include <opie2/odebug.h>
4
5using namespace Opie::Core;
6
3#include <qimage.h> 7#include <qimage.h>
4#include <qlayout.h> 8#include <qlayout.h>
5 9
6ImageScrollView::ImageScrollView (const QImage&img, QWidget * parent, const char * name, WFlags f) 10ImageScrollView::ImageScrollView (const QImage&img, QWidget * parent, const char * name, WFlags f)
@@ -9,9 +13,9 @@ ImageScrollView::ImageScrollView (const QImage&img, QWidget * parent, const char
9 init(); 13 init();
10} 14}
11 15
12ImageScrollView::ImageScrollView (const QString&img, QWidget * parent, const char * name, WFlags f) 16ImageScrollView::ImageScrollView (const QString&img, QWidget * parent, const char * name, WFlags f)
13 :QScrollView(parent,name,f/*|Qt::WRepaintNoErase*/),_image_data(img) 17 :QScrollView(parent,name,f|Qt::WRepaintNoErase),_image_data(img)
14{ 18{
15 init(); 19 init();
16} 20}
17 21
@@ -59,27 +63,31 @@ void ImageScrollView::drawContents(QPainter * p, int clipx, int clipy, int clipw
59 } 63 }
60 p->drawImage(clipx,clipy,_image_data,x,y,w,h); 64 p->drawImage(clipx,clipy,_image_data,x,y,w,h);
61} 65}
62 66
67/* using the real geometry points and not the translated points is wanted! */
63void ImageScrollView::viewportMouseMoveEvent(QMouseEvent* e) 68void ImageScrollView::viewportMouseMoveEvent(QMouseEvent* e)
64{ 69{
65 int mx, my; 70 int mx, my;
66 viewportToContents( e->x(), e->y(), mx, my ); 71 mx = e->x();
67 72 my = e->y();
68 scrollBy(_mouseStartPosX-mx,my-_mouseStartPosY); 73 int diffx = _mouseStartPosX-mx;
69 74 int diffy = _mouseStartPosY-my;
75 scrollBy(diffx,diffy);
70 _mouseStartPosX=mx; 76 _mouseStartPosX=mx;
71 _mouseStartPosY=my; 77 _mouseStartPosY=my;
72} 78}
73 79
74void ImageScrollView::contentsMouseReleaseEvent ( QMouseEvent * e) 80void ImageScrollView::contentsMouseReleaseEvent ( QMouseEvent * e)
75{ 81{
76 viewportToContents( e->x(), e->y(), _mouseStartPosX,_mouseStartPosY ); 82 _mouseStartPosX = e->x();
83 _mouseStartPosY = e->y();
77} 84}
78 85
79void ImageScrollView::contentsMousePressEvent ( QMouseEvent * e) 86void ImageScrollView::contentsMousePressEvent ( QMouseEvent * e)
80{ 87{
81 viewportToContents( e->x(), e->y(), _mouseStartPosX,_mouseStartPosY ); 88 _mouseStartPosX = e->x();
89 _mouseStartPosY = e->y();
82} 90}
83 91
84/* for testing */ 92/* for testing */
85ImageDlg::ImageDlg(const QString&fname,QWidget * parent, const char * name) 93ImageDlg::ImageDlg(const QString&fname,QWidget * parent, const char * name)
diff --git a/noncore/graphics/opie-eye/gui/imagescrollview.h b/noncore/graphics/opie-eye/gui/imagescrollview.h
index 5836c8d..edea235 100644
--- a/noncore/graphics/opie-eye/gui/imagescrollview.h
+++ b/noncore/graphics/opie-eye/gui/imagescrollview.h
@@ -1,6 +1,6 @@
1#ifndef __IMAGE_SCROLL_VIEW_H 1#ifndef _IMAGE_SCROLL_VIEW_H
2#define __IMAGE_SCROLL_VIEW_H 2#define _IMAGE_SCROLL_VIEW_H
3 3
4#include <qscrollview.h> 4#include <qscrollview.h>
5#include <qimage.h> 5#include <qimage.h>
6#include <qstring.h> 6#include <qstring.h>