Implement gradual zoom in print preview

Implement gradual zoom in print preview

Postby hua » Fri Dec 27, 2019 9:16 am

I used to link in an old version of rpreview.prg which has been customized to add the following feature:
1) Pressing Ctrl - Minus at preview screen will zoom out in small decrement
2) Pressing Ctrl - Plus at preview screen will zoom in in small increment

I don't want to maintain and link in the old rpreview.prg anymore when using latest FWH libs.
So what's the best way to achieve, just by recompiling, all the preview will:
1) not show the small page icons on the left side (TPrinter():lListViewHide := .t. right?)
2) be able to use Ctrl - Minus and Ctrl - Plus to have zoom in/out in small increment

In the old rpreview I amended CheckKey()
Code: Select all  Expand view

static function CheckKey (nKey,nFlags) // Thanks to Joerg K.

   if GetKeyState( VK_CONTROL )

      do case

         case nKey == 37                   //Left
              Adjust( 1 )

         case nKey == 39                   //Right
              Adjust( 2 )

         case nKey == 38                   //Up
              Adjust( 3 )

         case nKey == 40                   //Down
              Adjust( 4 )

         case nKey == 80                   //P
              PrintPage()

         case nKey == 109 .or. nKey == 189 //-
              SetFactor( nil, -.05 )

         case nKey == 107 .or. nKey == 187 //+
              SetFactor( nil, +.05 )
 


and SetFactor()
Code: Select all  Expand view

static function SetFactor(nValue, nFine)

     local lInit := .F.

     if nValue == nil .and. nFine == nil
          Aeval(aFactor, {|v,e| v:nHelpId := e})
          nValue := nZFactor
          lInit  := .T.
     endif

     if nFine != nil
        nZFactor += nFine
     endif

     Aeval(aFactor, {|val,elem| val:SetCheck( (elem == nZFactor) ) })

     oMeta1:SetZoomFactor(nZFactor, nZFactor*2)


     if !lZoom .AND. !lInit
          Zoom(.T.)
     endif

     if lZoom
          oWnd:oVScroll:SetRange( 1, VSCROLL_RANGE )
          if nZFactor > 1
             oWnd:oHScroll:SetRange( 1, HSCROLL_RANGE )
          else
             oWnd:oHScroll:SetRange( 0, 0 )
          endif
     endif

     oMeta1:SetFocus()

return nil
 


TIA
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 57 guests