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

List:       kde-bugs-dist
Subject:    [Bug 7738] fit to page wdith
From:       Luis Pedro Coelho <luis_pedro () netcabo ! pt>
Date:       2003-08-31 22:02:27
[Download RAW message or body]

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
     
http://bugs.kde.org/show_bug.cgi?id=7738     




------- Additional Comments From luis_pedro@netcabo.pt  2003-09-01 00:02 -------
Subject: kdegraphics/kghostview

CVS commit by luis_pedro: 

Fit the page in a single screen with one key ("S").

(Doesn't work 100 % with Maximize. Ie. you cannot do M,S and get the desired effect.
I will fix this and then close the wishitem)

CCMAIL: 7738@bugs.kde.org


  M +3 -0      kghostviewui.rc   1.18
  M +10 -0     kgv_miniwidget.cpp   1.181
  M +1 -0      kgv_miniwidget.h   1.97
  M +13 -0     kgvshell.cpp   1.76
  M +1 -0      kgvshell.h   1.27


--- kdegraphics/kghostview/kghostviewui.rc  #1.17:1.18
@@ -6,4 +6,5 @@
         <Action name="view_redisplay" />
         <Action name="fit_to_page" />
+        <Action name="fit_to_screen" />
     <Action name="maximize"/>
     <Action name="fullscreen"/>
@@ -16,4 +17,5 @@
         <Action name="view_redisplay" />
         <Action name="fit_to_page" />
+        <Action name="fit_to_screen" />
     <Action name="fullscreen"/>
     <Action name="showmenubar"/>
@@ -31,4 +33,5 @@
   <Menu name="view">
     <Action name="fit_to_page"/>
+    <Action name="fit_to_screen" />
     <Action name="maximize"/>
     <Action name="fullscreen"/>

--- kdegraphics/kghostview/kgv_miniwidget.cpp  #1.180:1.181
@@ -181,4 +181,14 @@ void KGVMiniWidget::fitHeight( unsigned 
 }
 
+void KGVMiniWidget::fitWidthHeight( unsigned int w, unsigned int h )
+{
+    double magnification = std::min<double>( 
+            ( ( double )h / QPaintDevice::x11AppDpiY() ) /
+            ( ( double )boundingBox().height() / 72.0 ),
+            ( ( double )w / QPaintDevice::x11AppDpiX() ) /
+            ( ( double )boundingBox().width() / 72.0 ) );
+    setMagnification( magnification );
+}
+
 void KGVMiniWidget::firstPage()
 {

--- kdegraphics/kghostview/kgv_miniwidget.h  #1.96:1.97
@@ -101,4 +101,5 @@ public slots:
     void fitWidth( unsigned int );
     void fitHeight( unsigned int );
+    void fitWidthHeight( unsigned int, unsigned int );
 
     void info();

--- kdegraphics/kghostview/kgvshell.cpp  #1.75:1.76
@@ -80,4 +80,7 @@ KGVShell::KGVShell() :
                          SLOT( slotFitToPage() ), actionCollection(),
                          "fit_to_page");
+            new KAction( i18n( "&Fit to Screen" ), Key_S, this,
+                         SLOT( slotFitToScreen() ), actionCollection(),
+                         "fit_to_page");
             new KAction( i18n( "&Maximize" ), Key_M, this,
                          SLOT( slotMaximize() ), actionCollection(),
@@ -283,4 +286,14 @@ void KGVShell::slotFitToPage()
     // We subtract 16 pixels because of the page decoration.
 }
+
+
+void KGVShell::slotFitToScreen()
+{
+    disconnect( 0, 0, this, SLOT( slotFitToPage() ) );
+    if( m_gvpart->pageView()->page() )
+        m_gvpart->miniWidget()->fitWidthHeight( m_gvpart->pageView()->viewport()->width() - 16,
+                                                m_gvpart->pageView()->viewport()->height() - 16 );
+}
+
 void KGVShell::slotMaximize()
 {

--- kdegraphics/kghostview/kgvshell.h  #1.26:1.27
@@ -55,4 +55,5 @@ protected slots:
     void slotQuit();
     void slotFitToPage();
+    void slotFitToScreen();
     void slotMaximize();
     void slotResize();
[prev in list] [next in list] [prev in thread] [next in thread] 

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