home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Libraries / EleOfC++ vrs 0.1 / TextEdit / externalPascals.c next >
Encoding:
C/C++ Source or Header  |  1991-07-14  |  1.7 KB  |  65 lines  |  [TEXT/KAHL]

  1. /*
  2. ** this file contanes the "static" function definitions and some variables
  3. **
  4. ** Copyright © 1991 Mark Gross 
  5. ** (RR2, Box 84, Clayville, NY 13322);         
  6. ** this file may be published everywhere, but no charge
  7. ** may be made for its use.  Please contact me about any bugs found.
  8. */
  9.  
  10. #include "TScrollDoc.h"
  11. #include "TTEDoc.h"
  12.     
  13. pascal void ActionProc(ControlHandle theControl, short partCode)
  14. {
  15.     short scrollAmount = 0;
  16.     TScrollDoc *theCurrScrollDoc;
  17.     extern TScrollDoc *gCurrScrollDoc;
  18.     
  19.     theCurrScrollDoc = gCurrScrollDoc;
  20.     if(theControl == theCurrScrollDoc->GetVScroll() )
  21.         scrollAmount = theCurrScrollDoc->GetVertLineScrollAmount();
  22.     if( theControl == theCurrScrollDoc->GetHScroll())
  23.         scrollAmount = theCurrScrollDoc->GetHorizLineScrollAmount();
  24.     
  25.     if(partCode == inUpButton)
  26.         theCurrScrollDoc->Scroll(theControl, -scrollAmount);
  27.     if(partCode == inDownButton)
  28.         theCurrScrollDoc->Scroll(theControl, scrollAmount);
  29. }/*end of function*/
  30.  
  31.  
  32. pascal Boolean MyClickLoop(void)
  33. {
  34.     Point    where;
  35.     Rect    view;
  36.     TScrollDoc *theCurrScrollDoc;
  37.     
  38.     theCurrScrollDoc = gCurrScrollDoc;
  39.     theCurrScrollDoc->GetContentRect(&view);
  40.     GetMouse(&where);
  41.     if (where.v > view.bottom)
  42.     {
  43.         theCurrScrollDoc->Scroll(theCurrScrollDoc->GetVScroll(),
  44.                             theCurrScrollDoc->GetVertLineScrollAmount() );
  45.     }
  46.     if (where.h > view.right)
  47.     {
  48.         theCurrScrollDoc->Scroll(theCurrScrollDoc->GetHScroll(),
  49.                             theCurrScrollDoc->GetHorizLineScrollAmount() );
  50.     }
  51.     if (where.v < view.top)
  52.     {
  53.         theCurrScrollDoc->Scroll(theCurrScrollDoc->GetVScroll(),
  54.                             -(theCurrScrollDoc->GetVertLineScrollAmount()) );
  55.     }
  56.     if (where.h < view.left)
  57.     {
  58.         theCurrScrollDoc->Scroll(theCurrScrollDoc->GetHScroll(),
  59.                             -(theCurrScrollDoc->GetHorizLineScrollAmount()) );
  60.     }
  61.  
  62.     return TRUE;
  63. }/*end of function*/
  64.  
  65.