Module: _scroll      Library: Clipper 5.3


This module contains the following functions and procedures:



Note: Because this is raw decompiler output, the code is closer
to that seen in a .PPO file, rather than a .PRG file. In other
words, you must allow for the preprocessor conversions normally 
performed based on the contents of STD.CH and other .CH files
 
#include "common.ch"
#include "inkey.ch"

//-----------------------------------------------------------------
//  file-wide static variables
//
static Static1:= .F., Static2

//---------------------------------------------------[top]-
//  DEFINE
//
static function DEFINE

   local Local1 := __classnew("SCROLLBAR", 13)
   __classadd(Local1, "Display", "__sbDisplay")
   __classadd(Local1, "HitTest", "__sbHitTest")
   __classadd(Local1, "Update", "__sbUpdate")
   __classadd(Local1, "Bitmaps", "__sbBitmaps")
   __classadd(Local1, "_Bitmaps", "__sbBitmaps")
   __classadd(Local1, "BarLength", "__sbBarLength")
   __classadd(Local1, "_BarLength", "__sbBarLength")
   __classadd(Local1, "Cargo", "__sbCargo")
   __classadd(Local1, "_Cargo", "__sbCargo")
   __classadd(Local1, "ColorSpec", "__sbColorSpec")
   __classadd(Local1, "_ColorSpec", "__sbColorSpec")
   __classadd(Local1, "Current", "__sbCurrent")
   __classadd(Local1, "_Current", "__sbCurrent")
   __classadd(Local1, "End", "__sbEnd")
   __classadd(Local1, "_End", "__sbEnd")
   __classadd(Local1, "Offset", "__sbOffset")
   __classadd(Local1, "_Offset", "__sbOffset")
   __classadd(Local1, "Orient", "__sbOrient")
   __classadd(Local1, "_Orient", "__sbOrient")
   __classadd(Local1, "sBlock", "__sbsBlock")
   __classadd(Local1, "_sBlock", "__sbsBlock")
   __classadd(Local1, "Stable", "__sbStable")
   __classadd(Local1, "_Stable", "__sbStable")
   __classadd(Local1, "Start", "__sbStart")
   __classadd(Local1, "_Start", "__sbStart")
   __classadd(Local1, "Style", "__sbStyle")
   __classadd(Local1, "_Style", "__sbStyle")
   __classadd(Local1, "ThumbPos", "__sbThumbPos")
   __classadd(Local1, "_ThumbPos", "__sbThumbPos")
   __classadd(Local1, "Total", "__sbTotal")
   __classadd(Local1, "_Total", "__sbTotal")
   return Local1

//---------------------------------------------------[top]-
//  SCROLLBAR( Arg1, Arg2, Arg3, Arg4, Arg5 )
//
function SCROLLBAR( Arg1, Arg2, Arg3, Arg4, Arg5 )

   local Local1, Local2, Local3, Local4 := array(3)
   do case
   case !( ISNUMBER( Arg1 ) )
      return Nil
   case !( ISNUMBER( Arg2 ) )
      return Nil
   case !( ISNUMBER( Arg3 ) )
      return Nil
   case !( ValType(Arg4) $ "BU" )
      return Nil
   case ValType(Arg5) == "U"
      Arg5 := 1
   case !( ISNUMBER( Arg5 ) )
      return Nil
   endcase
   if ( Arg5 == 1 )
      Local2 := ""
   elseif ( Arg5 == 2 )
      Local2 := "" + Chr(26)
   else
      return Nil
   endif
   if ( ValType(Static2) != "N" )
      Static2 := define()
   endif
   Local1 := __classins(Static2)
   Local1[ 1 ] := Arg2 - Arg1 - 1
   Local1[ 2 ] := 1
   Local1[ 3 ] := Nil
   Local3 := SetColor()
   Local1[ 4 ] := __guicolor(Local3, 5) + "," + __guicolor(Local3, 2)
   Local1[ 5 ] := Arg2
   Local1[ 6 ] := Arg3
   Local1[ 7 ] := Arg5
   Local1[ 8 ] := Arg4
   Local1[ 9 ] := Arg1
   Local1[ 10 ] := Local2
   Local1[ 11 ] := 1
   Local1[ 12 ] := 100
   if ( Arg5 == 1 )
      Local4[ 1 ] := "arrow_u.bmu"
      Local4[ 2 ] := "arrow_d.bmu"
   else
      Local4[ 1 ] := "arrow_l.bmu"
      Local4[ 2 ] := "arrow_r.bmu"
   endif
   Local4[ 3 ] := "arrow_e.bmu"
   Local1[ 13 ] := Local4
   return Local1

//---------------------------------------------------[top]-
//  THUMBPOS( Arg1 )
//
static function THUMBPOS( Arg1 )

   local Local1, Local2, Local3, Local4
   if ( Arg1[ 1 ] < 2 )
      return .F.
   endif
   if ( Arg1[ 12 ] < 2 )
      return .F.
   endif
   if ( Static1 )
      return .T.
   endif
   Local2 := Arg1[ 2 ]
   Local3 := Arg1[ 1 ]
   Local4 := Arg1[ 12 ]
   Local1 := ( ( Local3 - 1 ) * Local2 + Local4 - 2 * Local3 + 1 ) / ;
      ( Local4 - Local3 )
   Local1 := Round(Local1, 0)
   if ( Local1 < 1 )
      Local1 := 1
   endif
   if ( Local1 > Local3 )
      Local1 := Local3
   endif
   Arg1[ 11 ] := Local1
   return .T.

//---------------------------------------------------[top]-
//  __SBBARLEN( Arg1 )
//
function __SBBARLEN( Arg1 )

   return qself()[ 1 ]

//---------------------------------------------------[top]-
//  __SBBITMAP( Arg1 )
//
function __SBBITMAP( Arg1 )

   if ( !( ISARRAY( Arg1 ) ) )
   elseif ( Len(Arg1) == 3 )
      qself()[ 13 ] := Arg1
   endif
   return qself()[ 13 ]

//---------------------------------------------------[top]-
//  __SBCARGO( Arg1 )
//
function __SBCARGO( Arg1 )

   qself()[ 3 ] := Arg1
   return qself()[ 3 ]

//---------------------------------------------------[top]-
//  __SBCOLORS( Arg1 )
//
function __SBCOLORS( Arg1 )

   if ( !( ISCHARACTER( Arg1 ) ) )
   elseif ( Empty(__guicolor(Arg1, 2)) )
   elseif ( Empty(__guicolor(Arg1, 3)) )
      qself()[ 4 ] := Arg1
   endif
   return qself()[ 4 ]

//---------------------------------------------------[top]-
//  __SBCURREN( Arg1 )
//
function __SBCURREN( Arg1 )

   if ( !( ISNUMBER( Arg1 ) ) )
   elseif ( Arg1 > qself()[ 12 ] )
   elseif ( Arg1 != qself()[ 2 ] )
      qself()[ 2 ] := Arg1
   endif
   return qself()[ 2 ]

//---------------------------------------------------[top]-
//  __SBDISPLA
//
function __SBDISPLA

   local Local1, Local2, Local3, Local4, Local5, Local6, Local7, ;
      Local8, Local9, Local10, Local11 := .F., Local12, Local13, ;
      Local14, Local15
   Local3 := SetColor()
   Local1 := Row()
   Local2 := Col()
   if ( thumbpos(qself()) )
      Local11 := .T.
      Local4 := qself()[ 10 ]
      Local5 := qself()[ 6 ]
      Local14 := msetcursor(.F.)
      dispbegin()
      Local7 := __guicolor(qself()[ 4 ], 1)
      Local6 := __guicolor(qself()[ 4 ], 2)
      if ( qself()[ 7 ] == 1 )
         set color to (Local7)
         Local8 := qself()[ 9 ]
         Local9 := qself()[ 5 ] - 1
         if ( !_isgraphic() )
            for Local10 := Local8 + 1 to Local9
               SetPos(Local10, Local5)
               ?? SubStr(Local4, 2, 1)
            next
            set color to (Local6)
            SetPos(Local8, Local5)
            ?? SubStr(Local4, 1, 1)
            SetPos(Local8 + qself()[ 11 ], Local5)
            ?? SubStr(Local4, 3, 1)
            SetPos(Local9 + 1, Local5)
            ?? SubStr(Local4, 4, 1)
         else
            Local15 := gmode()[ 5 ]
            gframe(Local5 * 8 + 1, Local8 * Local15 + 1, ( Local5 + ;
               2 ) * 8 + 2, ( Local9 + 2 ) * Local15 - 1, ;
               _getnumcol(Local7), 15, 15, 1, 1, 1, 1, -1, .T.)
            Local13 := qself()[ 13 ]
            Local12 := gbmpload(Local13[ 1 ])
            if ( ISNIL( Local12 ) )
            elseif ( !( ISNIL( Local12[ 1 ] ) ) .AND. !( ISNIL( ;
                  Local12[ 2 ] ) ) )
               gbmpdisp(Local12, Local5 * 8 + 2, ( Local8 + 1 ) * ;
                  Local15 - 14)
            endif
            Local12 := gbmpload(Local13[ 2 ])
            if ( ISNIL( Local12 ) )
            elseif ( !( ISNIL( Local12[ 1 ] ) ) .AND. !( ISNIL( ;
                  Local12[ 2 ] ) ) )
               gbmpdisp(Local12, Local5 * 8 + 2, Local15 * ( Local9 ;
                  + 1 ) - 1)
            endif
            Local12 := gbmpload(Local13[ 3 ])
            if ( ISNIL( Local12 ) )
            elseif ( !( ISNIL( Local12[ 1 ] ) ) .AND. !( ISNIL( ;
                  Local12[ 2 ] ) ) )
               gbmpdisp(Local12, Local5 * 8 + 2, ( Local8 + ;
                  qself()[ 11 ] ) * Local15)
            endif
         endif
      else
         set color to (Local7)
         Local8 := qself()[ 9 ]
         Local9 := qself()[ 5 ] - 1
         if ( !_isgraphic() )
            for Local10 := Local8 + 1 to Local9
               SetPos(Local5, Local10)
               ?? SubStr(Local4, 2, 1)
            next
            set color to (Local6)
            SetPos(Local5, Local8)
            ?? SubStr(Local4, 1, 1)
            SetPos(Local5, Local8 + qself()[ 11 ])
            ?? SubStr(Local4, 3, 1)
            SetPos(Local5, Local9 + 1)
            ?? SubStr(Local4, 4, 1)
         else
            Local15 := gmode()[ 5 ]
            gframe(( Local8 - 1 ) * 8 - 1, Local5 * Local15 - 1, ( ;
               Local9 + 2 ) * 8 - 1, ( Local5 + 1 ) * Local15, ;
               _getnumcol(Local7), 15, 15, 1, 1, 1, 1, -1, .T.)
            Local13 := qself()[ 13 ]
            Local12 := gbmpload(Local13[ 1 ])
            if ( ISNIL( Local12 ) )
            elseif ( !( ISNIL( Local12[ 1 ] ) ) .AND. !( ISNIL( ;
                  Local12[ 2 ] ) ) )
               gbmpdisp(Local12, ( Local8 - 1 ) * 8 + 1, Local5 * ;
                  Local15)
            endif
            Local12 := gbmpload(Local13[ 2 ])
            if ( ISNIL( Local12 ) )
            elseif ( !( ISNIL( Local12[ 1 ] ) ) .AND. !( ISNIL( ;
                  Local12[ 2 ] ) ) )
               gbmpdisp(Local12, Local9 * 8 - 1, Local5 * Local15)
            endif
            Local12 := gbmpload(Local13[ 3 ])
            if ( ISNIL( Local12 ) )
            elseif ( !( ISNIL( Local12[ 1 ] ) ) .AND. !( ISNIL( ;
                  Local12[ 2 ] ) ) )
               gbmpdisp(Local12, ( Local8 + qself()[ 11 ] ) * 8, ;
                  Local5 * Local15)
            endif
         endif
      endif
      dispend()
      msetcursor(Local14)
      set color to (Local3)
      SetPos(Local1, Local2)
   endif
   return Local11

//---------------------------------------------------[top]-
//  __SBEND( Arg1 )
//
function __SBEND( Arg1 )

   if ( !( ISNUMBER( Arg1 ) ) )
   elseif ( Arg1 < qself()[ 9 ] )
   elseif ( Arg1 != qself()[ 5 ] )
      qself()[ 5 ] := Arg1
      qself()[ 1 ] := Arg1 - qself()[ 9 ] - 1
   endif
   return qself()[ 5 ]

//---------------------------------------------------[top]-
//  __SBHITTES( Arg1, Arg2 )
//
function __SBHITTES( Arg1, Arg2 )

   local Local1, Local2
   if ( qself()[ 7 ] == 1 )
      if ( !_isgraphic() )
         do case
         case Arg2 != qself()[ 6 ]
         case Arg1 < qself()[ 9 ]
         case Arg1 > qself()[ 5 ]
         case Arg1 == qself()[ 9 ]
            return -3074
         case Arg1 == qself()[ 5 ]
            return -3075
         case Arg1 < qself()[ 11 ] + qself()[ 9 ]
            return -3076
         case Arg1 > qself()[ 11 ] + qself()[ 9 ]
            return -3077
         case Arg1 == qself()[ 11 ] + qself()[ 9 ]
            return -3073
         endcase
      elseif ( Arg2 == qself()[ 6 ] + 1 .OR. Arg2 == qself()[ 6 ] )
         do case
         case Arg2 != qself()[ 6 ] .AND. Arg2 != qself()[ 6 ] + 1
         case Arg1 < qself()[ 9 ]
         case Arg1 > qself()[ 5 ]
         case Arg1 == qself()[ 9 ]
            return -3074
         case Arg1 == qself()[ 5 ]
            return -3075
         case Arg1 < qself()[ 11 ] + qself()[ 9 ]
            return -3076
         case Arg1 > qself()[ 11 ] + qself()[ 9 ]
            return -3077
         case Arg1 == qself()[ 11 ] + qself()[ 9 ]
            return -3073
         endcase
      endif
   elseif ( qself()[ 7 ] == 2 )
      do case
      case Arg1 != qself()[ 6 ]
      case Arg2 < qself()[ 9 ]
      case Arg2 > qself()[ 5 ]
      case Arg2 == qself()[ 9 ]
         return -3074
      case Arg2 == qself()[ 5 ]
         return -3075
      case Arg2 < qself()[ 11 ] + qself()[ 9 ]
         return -3076
      case Arg2 > qself()[ 11 ] + qself()[ 9 ]
         return -3077
      case Arg2 == qself()[ 11 ] + qself()[ 9 ]
         return -3073
      endcase
   endif
   return 0

//---------------------------------------------------[top]-
//  __SBOFFSET( Arg1 )
//
function __SBOFFSET( Arg1 )

   if ( !( ISNUMBER( Arg1 ) ) )
   elseif ( Arg1 != qself()[ 6 ] )
      qself()[ 6 ] := Arg1
   endif
   return qself()[ 6 ]

//---------------------------------------------------[top]-
//  __SBORIENT( Arg1 )
//
function __SBORIENT( Arg1 )

   if ( !( ISNUMBER( Arg1 ) ) )
   elseif ( Arg1 == 1 .OR. Arg1 == 2 )
      qself()[ 7 ] := Arg1
   endif
   return qself()[ 7 ]

//---------------------------------------------------[top]-
//  __SBSBLOCK( Arg1 )
//
function __SBSBLOCK( Arg1 )

   if ( ISBLOCK( Arg1 ) )
      qself()[ 8 ] := Arg1
   endif
   return qself()[ 8 ]

//---------------------------------------------------[top]-
//  __SBSTART( Arg1 )
//
function __SBSTART( Arg1 )

   if ( !( ISNUMBER( Arg1 ) ) )
   elseif ( Arg1 > qself()[ 5 ] )
   elseif ( Arg1 != qself()[ 9 ] )
      qself()[ 9 ] := Arg1
      qself()[ 1 ] := qself()[ 5 ] - Arg1 - 1
   endif
   return qself()[ 9 ]

//---------------------------------------------------[top]-
//  __SBSTYLE( Arg1 )
//
function __SBSTYLE( Arg1 )

   if ( !( ISCHARACTER( Arg1 ) ) )
   elseif ( Len(Arg1) == 4 )
      qself()[ 10 ] := Arg1
   endif
   return qself()[ 10 ]

//---------------------------------------------------[top]-
//  __SBTHUMBP( Arg1 )
//
function __SBTHUMBP( Arg1 )

   if ( ISNUMBER( Arg1 ) )
      if ( Arg1 < 1 )
         qself()[ 11 ] := 1
      elseif ( Arg1 >= qself()[ 1 ] )
         if ( _isgraphic() .AND. qself()[ 7 ] == 2 )
            qself()[ 11 ] := qself()[ 1 ] - 1
         else
            qself()[ 11 ] := qself()[ 1 ]
         endif
      elseif ( Arg1 >= qself()[ 1 ] - 1 )
         if ( _isgraphic() .AND. qself()[ 7 ] == 2 )
            qself()[ 11 ] := qself()[ 1 ] - 2
         else
            qself()[ 11 ] := Arg1
         endif
      else
         qself()[ 11 ] := Arg1
      endif
      if ( Arg1 == 0 )
         Static1 := .F.
      else
         Static1 := .T.
      endif
   endif
   return qself()[ 11 ]

//---------------------------------------------------[top]-
//  __SBTOTAL( Arg1 )
//
function __SBTOTAL( Arg1 )

   if ( !( ISNUMBER( Arg1 ) ) )
   elseif ( Arg1 < 2 )
   elseif ( Arg1 != qself()[ 12 ] )
      qself()[ 12 ] := Arg1
   endif
   return qself()[ 12 ]

//---------------------------------------------------[top]-
//  __SBUPDATE
//
function __SBUPDATE

   local Local1, Local2, Local3, Local4 := .F., Local5:= ;
      qself()[ 11 ], Local6, Local7, Local8, Local9
   if ( !thumbpos(qself()) )
   elseif ( Local5 != qself()[ 11 ] )
      Local4 := .T.
      Local3 := SetColor()
      Local1 := Row()
      Local2 := Col()
      set color to (__guicolor(qself()[ 4 ], 1))
      Local7 := msetcursor(.F.)
      dispbegin()
      if ( !_isgraphic() )
         if ( qself()[ 7 ] == 1 )
            SetPos(qself()[ 9 ] + Local5, qself()[ 6 ])
            ?? SubStr(qself()[ 10 ], 2, 1)
            set color to (__guicolor(qself()[ 4 ], 2))
            SetPos(qself()[ 9 ] + qself()[ 11 ], qself()[ 6 ])
            ?? SubStr(qself()[ 10 ], 3, 1)
         else
            SetPos(qself()[ 6 ], qself()[ 9 ] + Local5)
            ?? SubStr(qself()[ 10 ], 2, 1)
            set color to (__guicolor(qself()[ 4 ], 2))
            SetPos(qself()[ 6 ], qself()[ 9 ] + qself()[ 11 ])
            ?? SubStr(qself()[ 10 ], 3, 1)
         endif
      else
         Local9 := gmode()[ 5 ]
         if ( qself()[ 7 ] == 1 )
            gframe(qself()[ 6 ] * 8 - 1, qself()[ 9 ] * Local9 + 1, ;
               ( qself()[ 6 ] + 2 ) * 8, ( qself()[ 5 ] + 1 ) * ;
               Local9, _getnumcol(__guicolor(qself()[ 4 ], 1)), 15, ;
               15, 1, 1, 1, 1, -1, .T.)
            Local8 := qself()[ 13 ]
            Local6 := gbmpload(Local8[ 1 ])
            if ( ISNIL( Local6 ) )
            elseif ( !( ISNIL( Local6[ 1 ] ) ) .AND. !( ISNIL( ;
                  Local6[ 2 ] ) ) )
               gbmpdisp(Local6, qself()[ 6 ] * 8, ( qself()[ 9 ] + 1 ;
                  ) * Local9 - ( Local9 - 2 ))
            endif
            Local6 := gbmpload(Local8[ 2 ])
            if ( ISNIL( Local6 ) )
            elseif ( !( ISNIL( Local6[ 1 ] ) ) .AND. !( ISNIL( ;
                  Local6[ 2 ] ) ) )
               gbmpdisp(Local6, qself()[ 6 ] * 8, ( qself()[ 5 ] + 1 ;
                  ) * Local9 - Local9)
            endif
            Local6 := gbmpload(qself()[ 13 ][ 3 ])
            if ( ISNIL( Local6 ) )
            elseif ( !( ISNIL( Local6[ 1 ] ) ) .AND. !( ISNIL( ;
                  Local6[ 2 ] ) ) )
               gbmpdisp(Local6, qself()[ 6 ] * 8, ( qself()[ 9 ] + ;
                  qself()[ 11 ] ) * Local9)
            endif
         else
            gframe(( qself()[ 9 ] - 1 ) * 8 - 1, qself()[ 6 ] * ;
               Local9 - 1, ( qself()[ 5 ] + 1 ) * 8, ( qself()[ 6 ] ;
               + 1 ) * Local9, _getnumcol(__guicolor(qself()[ 4 ], ;
               1)), 15, 15, 1, 1, 1, 1, -1, .T.)
            Local8 := qself()[ 13 ]
            Local6 := gbmpload(Local8[ 1 ])
            if ( ISNIL( Local6 ) )
            elseif ( !( ISNIL( Local6[ 1 ] ) ) .AND. !( ISNIL( ;
                  Local6[ 2 ] ) ) )
               gbmpdisp(Local6, ( qself()[ 9 ] - 1 ) * 8 + 1, ;
                  qself()[ 6 ] * Local9)
            endif
            Local6 := gbmpload(Local8[ 2 ])
            if ( ISNIL( Local6 ) )
            elseif ( !( ISNIL( Local6[ 1 ] ) ) .AND. !( ISNIL( ;
                  Local6[ 2 ] ) ) )
               gbmpdisp(Local6, ( qself()[ 5 ] - 1 ) * 8, ;
                  qself()[ 6 ] * Local9)
            endif
            Local6 := gbmpload(Local8[ 3 ])
            if ( ISNIL( Local6 ) )
            elseif ( !( ISNIL( Local6[ 1 ] ) ) .AND. !( ISNIL( ;
                  Local6[ 2 ] ) ) )
               gbmpdisp(Local6, ( qself()[ 9 ] + qself()[ 11 ] - 1 ) ;
                  * 8, qself()[ 6 ] * Local9)
            endif
         endif
      endif
      dispend()
      msetcursor(Local7)
      set color to (Local3)
      SetPos(Local1, Local2)
   endif
   return Local4

//---EOF


Use your Browser's BACK button to return to Function Listings