[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: patch for KGhostView (solution?)
From:       Matthias Posseldt <matthi () gmx ! li>
Date:       2002-12-05 18:25:40
[Download RAW message or body]

On Thursday 05 December 2002 18:32, Jos van den Oever wrote:
> > > Sinde readDown/readUp take care up switching page already, this
> > > would work well, I think. I'm not sending this as a patch, since I
> > > don't have a wheel right now, so I can't test it.
> >
> > No, that doesn't work since readDown() doesn't switch pages:
> > bool KGVPageView::readDown()
> > {
> >     if( atBottom() )
> >         return false;
> >     else {
>
> It does work if the patch I sent is applied. After applying kgv view.cpp
> looks like this:
>
> void KGVPart::slotReadUp()
> {
>     if( ! isDocumentOpen )
>         return;
>
>     if( ! pageView->readUp() ) {
>         if ( docManager->prevPage())
>              pageView->scrollBottom();
>     }
> }
>
> void KGVPart::slotReadDown()
> {
>     if( ! isDocumentOpen )
>         return;
>
>     if( ! pageView->readDown() ) {
>         if ( docManager->nextPage())
>               pageView->scrollTop();
>     }
> }
>
> void KGVPart::slotPrevPage()
> {
>      docManager->prevPage();
> }
>
> void KGVPart::slotNextPage()
> {
>      docManager->nextPage();
> }
>
> > Here is a different patch which should solve the problem without
> > introducing new slots, and it should not change any other
> > functionality, since slotPrevPage() is only called when wheel-mousing,
> > I think.
>
> slotPrevPage is called by pressing PgUp. It is important that when
> calling slotPrevPage scrolling is not changed. This is exactly what my
> patch fixes. When using the PgUp/PgDn buttons, one doesn't want any
> scrolling. E.g. when editing a text in Latex, I have a preview opened in
> kghostview. I want the largest magnification and tune the page position
> to display all text on the screen. Then with PgUp/PgDn I traverse the
> pages.

Your patch works, but it does not solve the wheel mouse problem. Now the 
opposite of expected behaviour happens: If you scroll down with the mouse 
wheel the bottom of the next page will be shown, and if you scroll up the 
top of the previous page.

I think the simplest solution would be to introduce the new signals 
prevPageBottom() and nextPageTop() and there slot counterparts.

Therefore I attach your patch (kghostview-pgup-pgdown-no-scroll.patch) and 
my patch which uses the new signals/slots 
(kghostview-mouse-wheel-scrolling-43993.patch).

Ciao, Matthias
["kghostview-pgup-pgdown-no-scroll.patch" (text/x-diff)]

Index: kgv_view.cpp
===================================================================
RCS file: /home/kde/kdegraphics/kghostview/kgv_view.cpp,v
retrieving revision 1.110
diff -u -3 -p -r1.110 kgv_view.cpp
--- kgv_view.cpp	12 Nov 2002 20:15:37 -0000	1.110
+++ kgv_view.cpp	5 Dec 2002 18:13:06 -0000
@@ -350,37 +350,34 @@ void KGVPart::slotScrollDown()
 
 void KGVPart::slotReadUp()
 {
-    if( !_isDocumentOpen )
-	return;
-    
-    if( !_pageView->readUp() ) {
-	_docManager->prevPage();
-	_pageView->scrollBottom();
+    if( ! _isDocumentOpen )
+        return;
+
+    if( ! _pageView->readUp() ) {
+        if ( _docManager->prevPage())
+            _pageView->scrollBottom();
     }
 }
 
 void KGVPart::slotReadDown()
 {
-    if( !_isDocumentOpen )
-	return;
-    
-    if( !_pageView->readDown() )
-	slotNextPage();
+    if( ! _isDocumentOpen )
+        return;
+
+    if( ! _pageView->readDown() ) {
+        if ( _docManager->nextPage())
+            _pageView->scrollTop();
+    }
 }
 
 void KGVPart::slotPrevPage()
 {
     _docManager->prevPage();
-    _pageView->scrollTop();
 }
 
 void KGVPart::slotNextPage()
 {
-    if( _docManager->nextPage() ) {
-	_pageView->scrollTop();
-    }
-    else
-	_pageView->scrollBottom();
+    _docManager->nextPage();
 }
 
 void KGVPart::slotGotoStart()

["kghostview-mouse-wheel-scrolling-43993.diff" (text/x-diff)]

? Doxyfile
? kghostview.kdevelop
Index: kgv_view.cpp
===================================================================
RCS file: /home/kde/kdegraphics/kghostview/kgv_view.cpp,v
retrieving revision 1.110
diff -u -3 -p -r1.110 kgv_view.cpp
--- kgv_view.cpp	12 Nov 2002 20:15:37 -0000	1.110
+++ kgv_view.cpp	4 Dec 2002 22:34:54 -0000
@@ -374,6 +374,14 @@ void KGVPart::slotPrevPage()
     _pageView->scrollTop();
 }
 
+void KGVPart::slotPrevPageBottom()
+{
+    if ( _docManager->prevPage() )
+    {
+        _pageView->scrollBottom();
+    }
+}
+
 void KGVPart::slotNextPage()
 {
     if( _docManager->nextPage() ) {
@@ -383,6 +391,13 @@ void KGVPart::slotNextPage()
 	_pageView->scrollBottom();
 }
 
+void KGVPart::slotNextPageTop()
+{
+    if ( _docManager->nextPage() ) {
+        _pageView->scrollTop();
+    }
+}
+
 void KGVPart::slotGotoStart()
 {
     _docManager->firstPage();
@@ -536,6 +551,8 @@ void KGVPart::slotOpenFileCompleted()
 	stateChanged( "documentState" );
 	connect( _pageView, SIGNAL( nextPage() ), SLOT( slotNextPage() ));
 	connect( _pageView, SIGNAL( prevPage() ), SLOT( slotPrevPage() ));
+	connect( _pageView, SIGNAL( nextPageTop() ), SLOT( slotNextPageTop() ));
+	connect( _pageView, SIGNAL( prevPageBottom() ), SLOT( slotPrevPageBottom() ));
         connect( _pageView, SIGNAL( zoomIn() ), SLOT( slotZoomIn() ));
         connect( _pageView, SIGNAL( zoomOut() ), SLOT( slotZoomOut() ));
 	if ( !_fileWatcher->contains( m_file ) ) 
Index: kgv_view.h
===================================================================
RCS file: /home/kde/kdegraphics/kghostview/kgv_view.h,v
retrieving revision 1.54
diff -u -3 -p -r1.54 kgv_view.h
--- kgv_view.h	29 Jul 2002 09:34:26 -0000	1.54
+++ kgv_view.h	4 Dec 2002 22:34:54 -0000
@@ -92,7 +92,9 @@ public slots:
     void slotReadDown();
     void slotReadUp();
     void slotPrevPage();
+    void slotPrevPageBottom();
     void slotNextPage();
+    void slotNextPageTop();
     void slotGotoStart();
     void slotGotoEnd();
     // void slotFitWidth();
Index: kgvpageview.cpp
===================================================================
RCS file: /home/kde/kdegraphics/kghostview/kgvpageview.cpp,v
retrieving revision 1.11
diff -u -3 -p -r1.11 kgvpageview.cpp
--- kgvpageview.cpp	30 Oct 2002 12:02:52 -0000	1.11
+++ kgvpageview.cpp	4 Dec 2002 22:34:54 -0000
@@ -97,9 +97,9 @@ void KGVPageView::wheelEvent( QWheelEven
                        emit zoomIn();
     }
     else if ( delta <= -120 && atBottom() )
-        emit nextPage();
+        emit nextPageTop();
     else if ( delta >= 120 && atTop() )
-        emit prevPage();
+        emit prevPageBottom();
 
     else
         QScrollView::wheelEvent( e );
Index: kgvpageview.h
===================================================================
RCS file: /home/kde/kdegraphics/kghostview/kgvpageview.h,v
retrieving revision 1.6
diff -u -3 -p -r1.6 kgvpageview.h
--- kgvpageview.h	30 Oct 2002 12:02:52 -0000	1.6
+++ kgvpageview.h	4 Dec 2002 22:34:54 -0000
@@ -69,9 +69,11 @@ signals:
     void viewSizeChanged( QSize size );
     void pageSizeChanged( QSize size );
     void nextPage();
+    void nextPageTop();
     void zoomOut();
     void zoomIn();
     void prevPage();
+    void prevPageBottom();
     
 protected:
     virtual void keyPressEvent( QKeyEvent* );

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic