summaryrefslogtreecommitdiff
authorzecke <zecke>2004-04-07 23:33:48 (UTC)
committer zecke <zecke>2004-04-07 23:33:48 (UTC)
commit61cb9c9ad238e5aec6aaa1384549e0aab99d14bf (patch) (side-by-side diff)
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) (show whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/imagescrollview.cpp36
-rw-r--r--noncore/graphics/opie-eye/gui/imagescrollview.h7
-rw-r--r--noncore/graphics/opie-eye/lib/oimagezoomer.cpp14
3 files changed, 51 insertions, 6 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()
odebug << "init " << oendl;
+
+ /*
+ * create the zoomer
+ * and connect ther various signals
+ */
+ _zoomer = new Opie::MM::OImageZoomer( this, "The Zoomer" );
+ connect(_zoomer, SIGNAL( zoomAreaRel(int,int)),
+ this, SLOT(scrollBy(int,int)) );
+ connect(this,SIGNAL(contentsMoving(int,int)),
+ _zoomer, (SLOT(setVisiblePoint(int,int))) );
+ connect(this,SIGNAL(imageSizeChanged(const QSize&)),
+ _zoomer, SLOT(setImageSize(const QSize&)) );
+ connect(this,SIGNAL(viewportSizeChanged(const QSize&)),
+ _zoomer, SLOT(setViewPortSize(const QSize&)) );
+
viewport()->setBackgroundColor(white);
@@ -253,2 +268,13 @@ void ImageScrollView::generateImage()
_pdata.convertFromImage(_image_data);
+
+ /*
+ * update the zoomer
+ */
+ emit imageSizeChanged( _image_data.size() );
+ rescaleImage( 128, 128 );
+ _zoomer->setImage( _image_data );
+
+ /*
+ * invalidate
+ */
_image_data=QImage();
@@ -262,2 +288,8 @@ void ImageScrollView::resizeEvent(QResizeEvent * e)
first_resize_done = true;
+ emit viewportSizeChanged( viewport()->size() );
+
+ /*
+ * move scrollbar
+ */
+ _zoomer->setGeometry( viewport()->width()-100, viewport()->height()-50, 100, 50 );
}
@@ -322,2 +354,3 @@ void ImageScrollView::viewportMouseMoveEvent(QMouseEvent* e)
{
+ odebug << "Move X and Y " << e->x() << " " << e->y() << oendl;
int mx, my;
@@ -348,4 +381,5 @@ void ImageScrollView::viewportMouseMoveEvent(QMouseEvent* e)
-void ImageScrollView::contentsMousePressEvent ( QMouseEvent * )
+void ImageScrollView::contentsMousePressEvent ( QMouseEvent * e)
{
+ odebug << " X and Y " << e->x() << " " << e->y() << oendl;
/* this marks the beginning of a possible mouse move. Due internal reasons of QT
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 @@
+#include <lib/oimagezoomer.h>
+
#include <qscrollview.h>
@@ -9,2 +11,4 @@
+
+
class QPainter;
@@ -36,2 +40,4 @@ signals:
void sig_return();
+ void imageSizeChanged( const QSize& );
+ void viewportSizeChanged( const QSize& );
@@ -41,2 +47,3 @@ protected:
+ Opie::MM::OImageZoomer *_zoomer;
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
+OImageZoomer::~OImageZoomer() {
+
+}
+
void OImageZoomer::init() {
@@ -95,3 +99,3 @@ void OImageZoomer::drawContents( QPainter* p ) {
void OImageZoomer::mousePressEvent( QMouseEvent* ) {
-
+ m_mouseX = m_mouseY = -1;
}
@@ -104,6 +108,6 @@ void OImageZoomer::mouseMoveEvent( QMouseEvent* ev ) {
if ( m_mouseX != -1 && m_mouseY != -1 ) {
- int diffx = m_mouseX-mx;
- int diffy = m_mouseY-my;
-// emit zoomAreaRel( diffx, diffy );
-// emit zoomArea(
+ int diffx = ( mx - m_mouseX ) * m_imgSize.width() / width();
+ int diffy = ( my - m_mouseY ) * m_imgSize.height() / height();
+ emit zoomAreaRel( diffx, diffy );
+ emit zoomArea(m_visPt.x()+diffx, m_visPt.y()+diffy );
}