-rw-r--r-- | noncore/graphics/opie-eye/gui/imagescrollview.cpp | 38 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imagescrollview.h | 7 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/lib/oimagezoomer.cpp | 14 |
3 files changed, 52 insertions, 7 deletions
diff --git a/noncore/graphics/opie-eye/gui/imagescrollview.cpp b/noncore/graphics/opie-eye/gui/imagescrollview.cpp index ad19219..5b12258 100644 --- a/noncore/graphics/opie-eye/gui/imagescrollview.cpp +++ b/noncore/graphics/opie-eye/gui/imagescrollview.cpp | |||
@@ -62,2 +62,17 @@ void ImageScrollView::init() | |||
62 | odebug << "init " << oendl; | 62 | odebug << "init " << oendl; |
63 | |||
64 | /* | ||
65 | * create the zoomer | ||
66 | * and connect ther various signals | ||
67 | */ | ||
68 | _zoomer = new Opie::MM::OImageZoomer( this, "The Zoomer" ); | ||
69 | connect(_zoomer, SIGNAL( zoomAreaRel(int,int)), | ||
70 | this, SLOT(scrollBy(int,int)) ); | ||
71 | connect(this,SIGNAL(contentsMoving(int,int)), | ||
72 | _zoomer, (SLOT(setVisiblePoint(int,int))) ); | ||
73 | connect(this,SIGNAL(imageSizeChanged(const QSize&)), | ||
74 | _zoomer, SLOT(setImageSize(const QSize&)) ); | ||
75 | connect(this,SIGNAL(viewportSizeChanged(const QSize&)), | ||
76 | _zoomer, SLOT(setViewPortSize(const QSize&)) ); | ||
77 | |||
63 | viewport()->setBackgroundColor(white); | 78 | viewport()->setBackgroundColor(white); |
@@ -253,2 +268,13 @@ void ImageScrollView::generateImage() | |||
253 | _pdata.convertFromImage(_image_data); | 268 | _pdata.convertFromImage(_image_data); |
269 | |||
270 | /* | ||
271 | * update the zoomer | ||
272 | */ | ||
273 | emit imageSizeChanged( _image_data.size() ); | ||
274 | rescaleImage( 128, 128 ); | ||
275 | _zoomer->setImage( _image_data ); | ||
276 | |||
277 | /* | ||
278 | * invalidate | ||
279 | */ | ||
254 | _image_data=QImage(); | 280 | _image_data=QImage(); |
@@ -262,2 +288,8 @@ void ImageScrollView::resizeEvent(QResizeEvent * e) | |||
262 | first_resize_done = true; | 288 | first_resize_done = true; |
289 | emit viewportSizeChanged( viewport()->size() ); | ||
290 | |||
291 | /* | ||
292 | * move scrollbar | ||
293 | */ | ||
294 | _zoomer->setGeometry( viewport()->width()-100, viewport()->height()-50, 100, 50 ); | ||
263 | } | 295 | } |
@@ -322,2 +354,3 @@ void ImageScrollView::viewportMouseMoveEvent(QMouseEvent* e) | |||
322 | { | 354 | { |
355 | odebug << "Move X and Y " << e->x() << " " << e->y() << oendl; | ||
323 | int mx, my; | 356 | int mx, my; |
@@ -348,4 +381,5 @@ void ImageScrollView::viewportMouseMoveEvent(QMouseEvent* e) | |||
348 | 381 | ||
349 | void ImageScrollView::contentsMousePressEvent ( QMouseEvent * ) | 382 | void ImageScrollView::contentsMousePressEvent ( QMouseEvent * e) |
350 | { | 383 | { |
384 | odebug << " X and Y " << e->x() << " " << e->y() << oendl; | ||
351 | /* this marks the beginning of a possible mouse move. Due internal reasons of QT | 385 | /* this marks the beginning of a possible mouse move. Due internal reasons of QT |
@@ -353,3 +387,3 @@ void ImageScrollView::contentsMousePressEvent ( QMouseEvent * ) | |||
353 | why). For getting them in real context, we use the first move-event to set the start | 387 | why). For getting them in real context, we use the first move-event to set the start |
354 | position ;) | 388 | position ;) |
355 | */ | 389 | */ |
diff --git a/noncore/graphics/opie-eye/gui/imagescrollview.h b/noncore/graphics/opie-eye/gui/imagescrollview.h index eb91dbd..1b25103 100644 --- a/noncore/graphics/opie-eye/gui/imagescrollview.h +++ b/noncore/graphics/opie-eye/gui/imagescrollview.h | |||
@@ -3,2 +3,4 @@ | |||
3 | 3 | ||
4 | #include <lib/oimagezoomer.h> | ||
5 | |||
4 | #include <qscrollview.h> | 6 | #include <qscrollview.h> |
@@ -9,2 +11,4 @@ | |||
9 | 11 | ||
12 | |||
13 | |||
10 | class QPainter; | 14 | class QPainter; |
@@ -36,2 +40,4 @@ signals: | |||
36 | void sig_return(); | 40 | void sig_return(); |
41 | void imageSizeChanged( const QSize& ); | ||
42 | void viewportSizeChanged( const QSize& ); | ||
37 | 43 | ||
@@ -41,2 +47,3 @@ protected: | |||
41 | 47 | ||
48 | Opie::MM::OImageZoomer *_zoomer; | ||
42 | QImage _image_data; | 49 | QImage _image_data; |
diff --git a/noncore/graphics/opie-eye/lib/oimagezoomer.cpp b/noncore/graphics/opie-eye/lib/oimagezoomer.cpp index 178fbd4..ffa3c0c 100644 --- a/noncore/graphics/opie-eye/lib/oimagezoomer.cpp +++ b/noncore/graphics/opie-eye/lib/oimagezoomer.cpp | |||
@@ -28,2 +28,6 @@ OImageZoomer::OImageZoomer( const QSize& pSize, const QSize& vSize, QWidget* par | |||
28 | 28 | ||
29 | OImageZoomer::~OImageZoomer() { | ||
30 | |||
31 | } | ||
32 | |||
29 | void OImageZoomer::init() { | 33 | void OImageZoomer::init() { |
@@ -95,3 +99,3 @@ void OImageZoomer::drawContents( QPainter* p ) { | |||
95 | void OImageZoomer::mousePressEvent( QMouseEvent* ) { | 99 | void OImageZoomer::mousePressEvent( QMouseEvent* ) { |
96 | 100 | m_mouseX = m_mouseY = -1; | |
97 | } | 101 | } |
@@ -104,6 +108,6 @@ void OImageZoomer::mouseMoveEvent( QMouseEvent* ev ) { | |||
104 | if ( m_mouseX != -1 && m_mouseY != -1 ) { | 108 | if ( m_mouseX != -1 && m_mouseY != -1 ) { |
105 | int diffx = m_mouseX-mx; | 109 | int diffx = ( mx - m_mouseX ) * m_imgSize.width() / width(); |
106 | int diffy = m_mouseY-my; | 110 | int diffy = ( my - m_mouseY ) * m_imgSize.height() / height(); |
107 | // emit zoomAreaRel( diffx, diffy ); | 111 | emit zoomAreaRel( diffx, diffy ); |
108 | // emit zoomArea( | 112 | emit zoomArea(m_visPt.x()+diffx, m_visPt.y()+diffy ); |
109 | } | 113 | } |