summaryrefslogtreecommitdiff
authorzecke <zecke>2004-04-07 23:33:48 (UTC)
committer zecke <zecke>2004-04-07 23:33:48 (UTC)
commit61cb9c9ad238e5aec6aaa1384549e0aab99d14bf (patch) (unidiff)
treeb96da732386aa45060bd80890cd7466cbcf77afb
parent0a21abab4eed64d17c4b1475569194117dab709c (diff)
downloadopie-61cb9c9ad238e5aec6aaa1384549e0aab99d14bf.zip
opie-61cb9c9ad238e5aec6aaa1384549e0aab99d14bf.tar.gz
opie-61cb9c9ad238e5aec6aaa1384549e0aab99d14bf.tar.bz2
First version of the zoomer placement still needs some work though
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/imagescrollview.cpp38
-rw-r--r--noncore/graphics/opie-eye/gui/imagescrollview.h7
-rw-r--r--noncore/graphics/opie-eye/lib/oimagezoomer.cpp14
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
@@ -61,4 +61,19 @@ void ImageScrollView::init()
61{ 61{
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);
64 setFocusPolicy(QWidget::StrongFocus); 79 setFocusPolicy(QWidget::StrongFocus);
@@ -252,4 +267,15 @@ void ImageScrollView::generateImage()
252 } 267 }
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();
255} 281}
@@ -261,4 +287,10 @@ void ImageScrollView::resizeEvent(QResizeEvent * e)
261 generateImage(); 287 generateImage();
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}
264 296
@@ -321,4 +353,5 @@ void ImageScrollView::drawContents(QPainter * p, int clipx, int clipy, int clipw
321void ImageScrollView::viewportMouseMoveEvent(QMouseEvent* e) 353void 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;
324 mx = e->x(); 357 mx = e->x();
@@ -347,10 +380,11 @@ void ImageScrollView::viewportMouseMoveEvent(QMouseEvent* e)
347} 380}
348 381
349void ImageScrollView::contentsMousePressEvent ( QMouseEvent * ) 382void 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
352 the geometry values here may real differ from that set in MoveEvent (I don't know 386 the geometry values here may real differ from that set in MoveEvent (I don't know
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 */
356 _mouseStartPosX = -1; 390 _mouseStartPosX = -1;
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
@@ -2,4 +2,6 @@
2#define _IMAGE_SCROLL_VIEW_H 2#define _IMAGE_SCROLL_VIEW_H
3 3
4#include <lib/oimagezoomer.h>
5
4#include <qscrollview.h> 6#include <qscrollview.h>
5#include <qimage.h> 7#include <qimage.h>
@@ -8,4 +10,6 @@
8#include <qdialog.h> 10#include <qdialog.h>
9 11
12
13
10class QPainter; 14class QPainter;
11 15
@@ -35,4 +39,6 @@ public:
35signals: 39signals:
36 void sig_return(); 40 void sig_return();
41 void imageSizeChanged( const QSize& );
42 void viewportSizeChanged( const QSize& );
37 43
38protected: 44protected:
@@ -40,4 +46,5 @@ protected:
40 void init(); 46 void init();
41 47
48 Opie::MM::OImageZoomer *_zoomer;
42 QImage _image_data; 49 QImage _image_data;
43 QImage _original_data; 50 QImage _original_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
@@ -27,4 +27,8 @@ OImageZoomer::OImageZoomer( const QSize& pSize, const QSize& vSize, QWidget* par
27} 27}
28 28
29OImageZoomer::~OImageZoomer() {
30
31}
32
29void OImageZoomer::init() { 33void OImageZoomer::init() {
30 setFrameStyle( Panel | Sunken ); 34 setFrameStyle( Panel | Sunken );
@@ -94,5 +98,5 @@ void OImageZoomer::drawContents( QPainter* p ) {
94 98
95void OImageZoomer::mousePressEvent( QMouseEvent* ) { 99void OImageZoomer::mousePressEvent( QMouseEvent* ) {
96 100 m_mouseX = m_mouseY = -1;
97} 101}
98 102
@@ -103,8 +107,8 @@ void OImageZoomer::mouseMoveEvent( QMouseEvent* ev ) {
103 107
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 }
110 m_mouseX = mx; 114 m_mouseX = mx;