home *** CD-ROM | disk | FTP | other *** search
/ Borland Programmer's Resource / Borland_Programmers_Resource_CD_1995.iso / winsock / wvnsc926 / rcs / wvscreen.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-19  |  35.8 KB  |  1,556 lines

  1. head     1.14;
  2. branch   ;
  3. access   ;
  4. symbols  V80:1.2 V76d:1.1;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.14
  10. date     94.09.16.00.52.27;  author jcooper;  state Exp;
  11. branches ;
  12. next     1.13;
  13.  
  14. 1.13
  15. date     94.08.24.18.00.29;  author jcooper;  state Exp;
  16. branches ;
  17. next     1.12;
  18.  
  19. 1.12
  20. date     94.07.27.21.12.19;  author gardnerd;  state Exp;
  21. branches ;
  22. next     1.11;
  23.  
  24. 1.11
  25. date     94.07.12.19.51.26;  author cnolan;  state Exp;
  26. branches ;
  27. next     1.10;
  28.  
  29. 1.10
  30. date     94.06.01.19.08.20;  author gardnerd;  state Exp;
  31. branches ;
  32. next     1.9;
  33.  
  34. 1.9
  35. date     94.02.24.21.34.08;  author jcoop;  state Exp;
  36. branches ;
  37. next     1.8;
  38.  
  39. 1.8
  40. date     94.02.09.18.01.08;  author cnolan;  state Exp;
  41. branches ;
  42. next     1.7;
  43.  
  44. 1.7
  45. date     94.01.12.19.27.32;  author mrr;  state Exp;
  46. branches ;
  47. next     1.6;
  48.  
  49. 1.6
  50. date     93.12.08.01.28.01;  author rushing;  state Exp;
  51. branches ;
  52. next     1.5;
  53.  
  54. 1.5
  55. date     93.07.06.20.53.23;  author rushing;  state Exp;
  56. branches ;
  57. next     1.4;
  58.  
  59. 1.4
  60. date     93.07.06.20.52.28;  author cnolan;  state Exp;
  61. branches ;
  62. next     1.3;
  63.  
  64. 1.3
  65. date     93.06.28.17.51.39;  author rushing;  state Exp;
  66. branches ;
  67. next     1.2;
  68.  
  69. 1.2
  70. date     93.05.26.18.30.40;  author rushing;  state Exp;
  71. branches ;
  72. next     1.1;
  73.  
  74. 1.1
  75. date     93.02.16.20.54.22;  author rushing;  state Exp;
  76. branches ;
  77. next     ;
  78.  
  79.  
  80. desc
  81. @winvn version 0.76 placed into RCS
  82. @
  83.  
  84.  
  85. 1.14
  86. log
  87. @cleanup for 92.6
  88. @
  89. text
  90. @
  91. /*
  92.  *
  93.  * $Id: wvscreen.c 1.13 1994/08/24 18:00:29 jcooper Exp $
  94.  * $Log: wvscreen.c $
  95.  * Revision 1.13  1994/08/24  18:00:29  jcooper
  96.  * misc encoding/decoding changes
  97.  *
  98.  * Revision 1.12  1994/07/27  21:12:19  gardnerd
  99.  * copy to clipboard
  100.  *
  101.  * Revision 1.11  1994/07/12  19:51:26  cnolan
  102.  * win32ism
  103.  *
  104.  * Revision 1.10  1994/06/01  19:08:20  gardnerd
  105.  * horizontal scrolling support
  106.  *
  107.  * Revision 1.9  1994/02/24  21:34:08  jcoop
  108.  * jcoop changes
  109.  *
  110.  * Revision 1.8  1994/02/09  18:01:08  cnolan
  111.  * cnolan 90.2 changes
  112.  *
  113.  * Revision 1.7  1994/01/12  19:27:32  mrr
  114.  * mrr mods 4
  115.  *
  116.  * Revision 1.6  1993/12/08  01:28:01  rushing
  117.  * new version box and cr lf consistency
  118.  *
  119.  * Revision 1.5  1993/07/06  20:53:23  rushing
  120.  * type fixed
  121.  *
  122.  * Revision 1.4  1993/07/06  20:52:28  cnolan
  123.  * win32 changes
  124.  *
  125.  * Revision 1.3  1993/06/28  17:51:39  rushing
  126.  * fixed compiler warnings
  127.  *
  128.  * Revision 1.2  1993/05/26  18:30:40  rushing
  129.  * fixed page down bug (GPE when #arts < what can fit in window)
  130.  *
  131.  * Revision 1.1  1993/02/16  20:54:22  rushing
  132.  * Initial revision
  133.  *
  134.  *
  135.  */
  136.  
  137. /*-- First Line of WVSCREEN.C -- Contains Screen-related functions.  */
  138. #include <windows.h>
  139. #include <windowsx.h>
  140. #include "wvglob.h"
  141. #include "winvn.h"
  142. #pragma hdrstop
  143.  
  144. /*--- function ScreenDown ----------------------------------------------
  145.  *
  146.  *  Advance a pointer "nLines" lines through the textlines.
  147.  *  However, do not go so far that less than LinesOnScreen lines
  148.  *  are left past the pointer.
  149.  *
  150.  *  This is used to implement "PageDown" and "LineDown" functions.
  151.  *
  152.  *    Entry    nLines         Number of lines to move the pointer.
  153.  *             LinesOnScreen  is the number of lines on the screen.
  154.  *             BlockPtr       Pointer to block containing line.
  155.  *             LinePtr        Pointer to the given line.
  156.  *
  157.  *    Exit     BlockPtr and LinePtr (may) have been moved to a new line.
  158.  *             LinesAdvanced  is the number of lines actually moved--can be
  159.  *                            less than nLines if we hit the top of the
  160.  *                            last screen.
  161.  */
  162. void
  163. ScreenDown (nLines, LinesOnScreen, BlockPtr, LinePtr, LinesAdvanced)
  164.      int nLines;
  165.      int LinesOnScreen;
  166.      TypBlock far **BlockPtr;
  167.      TypLine far **LinePtr;
  168.      int *LinesAdvanced;
  169. {
  170.   TypBlock far *MyBlock = *BlockPtr;
  171.   TypLine far *MyLine = *LinePtr;
  172.   int LinesGone;
  173.   int TestAdvance;
  174.   HANDLE hBlock, hBlockGarbage;
  175.   unsigned int Offset, OffsetGarbage;
  176.   TypLineID LineIDGarbage, MyLineID;
  177.  
  178.   /* Skip forward nLines, plus one screen's worth, just to see      */
  179.   /* if there are enough lines ahead of us in the document.         */
  180.  
  181.   PtrToOffset (MyBlock, MyLine, &hBlock, &Offset, &MyLineID);
  182.   TestAdvance = nLines + LinesOnScreen - 1;
  183.   for (LinesGone = TestAdvance; LinesGone ;) {
  184.       if(!NextLine (&MyBlock, &MyLine)) break;
  185.       /* Count only active lines. */
  186.       if(MyLine->active) LinesGone--;
  187.   }
  188.   UnlockLine (MyBlock, MyLine, &hBlockGarbage, &OffsetGarbage, &LineIDGarbage);
  189.  
  190.   nLines -= LinesGone;
  191.   if (nLines < 0)
  192.     nLines = 0;
  193.   *LinesAdvanced = nLines;
  194.  
  195.   LockLine (hBlock, Offset, MyLineID, &MyBlock, &MyLine);
  196.   while (nLines)
  197.     {
  198.       NextLine (BlockPtr, LinePtr);
  199.       if((*LinePtr)->active) nLines--;
  200.     }
  201. }
  202.  
  203. /*--- function ScreenUp ----------------------------------------------
  204.  *
  205.  *  Back up a pointer "nLines" lines through the textlines.
  206.  *  However, do not go past the beginning of the document.
  207.  *
  208.  *  This is used to implement "PageUp" and "LineUp" functions.
  209.  *
  210.  *    Entry    nLines         Number of lines to move the pointer.
  211.  *             BlockPtr       Pointer to block containing line.
  212.  *             LinePtr        Pointer to the given line.
  213.  *
  214.  *    Exit     BlockPtr and LinePtr (may) have been moved to a new line.
  215.  *             LinesBackedUp  is the number of lines actually moved--can be
  216.  *                            less than nLines if we hit beginning of doc.
  217.  */
  218. void
  219. ScreenUp (nLines, BlockPtr, LinePtr, LinesBackedUp)
  220.      int nLines;
  221.      TypBlock far **BlockPtr;
  222.      TypLine far **LinePtr;
  223.      int *LinesBackedUp;
  224. {
  225.   *LinesBackedUp = 0;
  226.  
  227.   while (nLines && PrevLine (BlockPtr, LinePtr))
  228.     {          
  229.       if((*LinePtr)->active) {
  230.          nLines--;
  231.          (*LinesBackedUp)++;
  232.       }
  233.     }
  234. }
  235.  
  236. /*--- function NewScrollIt ----------------------------------------------
  237.  *
  238.  *  Perform a scrolling action.
  239.  *
  240.  *    Entry    Document points to a document
  241.  *             wParam   is the wParam argument given from a WM_VSCROLL
  242.  *                      window message.  (One of the SB_ symbols.)
  243.  *             lParam   is the lParam argument.
  244.  *
  245.  *   except in WIN32 ...
  246.  *
  247.  *          wParam   LOWORD: SB_code, HIWORD: position.
  248.  */
  249. void
  250. NewScrollIt (Document, wParam, lParam)
  251.      TypDoc *Document;
  252.      WPARAM wParam;
  253.      LPARAM lParam;
  254. {
  255.   int LinesGone;
  256.   unsigned int LineOrd;
  257.   RECT Rect;
  258.   int window_lineheight, window_topspace;
  259.  
  260.   if (Document->DocType == DOCTYPE_ARTICLE)
  261.   {
  262.    window_lineheight = ArtLineHeight;
  263.    window_topspace = ArtTopSpace; 
  264.   }
  265.   else
  266.   {
  267.    window_lineheight = LineHeight;
  268.    window_topspace = TopSpace;
  269.   }
  270.  
  271.   switch (LOWORD(wParam))
  272.     {
  273.     case SB_LINEUP:
  274.       /* Move up a line by scrolling the window down one line     */
  275.       /* and introducing 1 new line at the top.                   */
  276.  
  277.    if (Document->TopLineOrd > 0) {
  278.       LinesGone = 1;
  279.     }
  280.     else LinesGone = 0;
  281.  
  282.     doscrollup:;
  283.       if (LinesGone)
  284.    {
  285.      Rect.left = 0;
  286.      Rect.right = Document->ScXWidth;
  287.      Document->TopLineOrd -= LinesGone;
  288.  
  289.      ScrollWindow (Document->hDocWnd, 0, LinesGone * window_lineheight, NULL, NULL);
  290.  
  291.      Rect.top = window_topspace;
  292.      Rect.bottom = window_topspace + LinesGone * window_lineheight;
  293.  
  294.      InvalidateRect (Document->hDocWnd, &Rect, FALSE);
  295.  
  296.      /* Make sure garbage at bottom is erased in WM_PAINT processing */
  297.      Rect.top = window_topspace + Document->ScYLines * window_lineheight;
  298.      Rect.bottom = Document->ScYHeight;
  299.      InvalidateRect (Document->hDocWnd, &Rect, FALSE);
  300.    }
  301.       break;
  302.  
  303.     case SB_LINEDOWN:
  304.       /* Should change TotalLines below to ActiveLines for 
  305.        * suppression of already-read articles, but it's not that simple.
  306.        *  /mrr
  307.        */
  308.    if (Document->TopLineOrd < (Document->ActiveLines - Document->ScYLines)) {
  309.       LinesGone = 1;
  310.     }
  311.    else LinesGone = 0;
  312.  
  313.     doscrolldown:;
  314.       if (LinesGone)
  315.    {
  316.      Document->TopLineOrd += LinesGone;
  317.      Rect.left = 0;
  318.      Rect.right = Document->ScXWidth;
  319.      ScrollWindow (Document->hDocWnd, 0, -LinesGone * window_lineheight, NULL, NULL);
  320.      Rect.top = window_topspace + (Document->ScYLines - LinesGone) * window_lineheight;
  321.      Rect.bottom = Document->ScYHeight;
  322.      InvalidateRect (Document->hDocWnd, &Rect, FALSE);
  323.      /* Make sure garbage at top is erased in WM_PAINT processing */
  324.      Rect.top = 0;
  325.      Rect.bottom = window_topspace;
  326.      InvalidateRect (Document->hDocWnd, &Rect, FALSE);
  327.    }
  328.       break;
  329.  
  330.     case SB_PAGEUP:
  331. /*      LockLine (Document->hCurTopScBlock, Document->TopScOffset, Document->TopScLineID, &BlockPtr, &LinePtr); */
  332. /*      ScreenUp (Document->ScYLines - 1, &BlockPtr, &LinePtr, &LinesGone); */
  333.       LinesGone= Document->TopLineOrd - (Document->ScYLines - 1);
  334.       if (LinesGone > 0) {
  335.    LinesGone = Document->ScYLines - 1;
  336.       }
  337.    else {
  338.    LinesGone = Document->TopLineOrd;
  339.    }
  340.  
  341.       Document->TopLineOrd -= LinesGone;
  342.       InvalidateRect (Document->hDocWnd, NULL, FALSE);
  343.       break;
  344.  
  345.  case SB_PAGEDOWN:
  346.  
  347.    if (Document->ActiveLines > Document->ScYLines) { /* do we even need to scroll? */
  348.      if ((Document->ActiveLines -
  349.      (Document->TopLineOrd + Document->ScYLines)) > Document->ScYLines)
  350.        LinesGone = Document->ScYLines - 1;
  351.      else
  352.        LinesGone = Document->ActiveLines - (Document->TopLineOrd + Document->ScYLines );
  353.  
  354.      Document->TopLineOrd += LinesGone;
  355.      InvalidateRect (Document->hDocWnd, NULL, FALSE);
  356.    }
  357.    break;
  358.  
  359.  case SB_THUMBPOSITION:
  360. #ifdef WIN32
  361.        LineOrd = (int)HIWORD (wParam);
  362. #else
  363.        LineOrd = LOWORD (lParam);
  364. #endif
  365. /*       if (!FindLineOrd (Document, LineOrd, &BlockPtr, &LinePtr))
  366.    {
  367.      return;
  368.    }
  369. */
  370.     doposition:;
  371.       Document->TopLineOrd = LineOrd;
  372.       InvalidateRect (Document->hDocWnd, NULL, FALSE);
  373.       break;
  374.  
  375.     case SB_THUMBTRACK:
  376.  
  377. #ifdef WIN32
  378.        LineOrd = (int)HIWORD (wParam);
  379. #else
  380.        LineOrd = LOWORD (lParam);
  381. #endif
  382. /*      if (!FindLineOrd (Document, LineOrd, &BlockPtr, &LinePtr))
  383.    {
  384.      return;
  385.    }
  386. */
  387.       LinesGone = LineOrd - Document->TopLineOrd;
  388.       if (LinesGone > 0)
  389.    {
  390.      if (LinesGone >= (int) (Document->ScYLines - 1))
  391.        {
  392.          goto doposition;
  393.        }
  394.      else
  395.        {
  396.          goto doscrolldown;
  397.        }
  398.    }
  399.       else if (LinesGone < 0)
  400.    {
  401.      LinesGone = -LinesGone;
  402.      if (LinesGone >= (int) (Document->ScYLines - 1))
  403.        {
  404.          goto doposition;
  405.        }
  406.      else
  407.        {
  408.          goto doscrollup;
  409.        }
  410.    }
  411.  
  412.       break;
  413.  
  414.     default:
  415.       return;
  416.       break;
  417.     }
  418.  
  419. /*  UnlockLine (BlockPtr, LinePtr, &(Document->hCurTopScBlock),
  420.          &(Document->TopScOffset), &(Document->TopScLineID));
  421. */
  422.  
  423. }
  424. /*--- function ScrollIt ----------------------------------------------
  425.  *
  426.  *  Perform a scrolling action.
  427.  *
  428.  *    Entry    Document points to a document
  429.  *             wParam   is the wParam argument given from a WM_VSCROLL
  430.  *                      window message.  (One of the SB_ symbols.)
  431.  *             lParam   is the lParam argument.
  432.  */
  433. void
  434. ScrollIt (Document, wParam, lParam)
  435.      TypDoc *Document;
  436.      WPARAM wParam;
  437.      LPARAM lParam;
  438. {
  439.   TypBlock far *BlockPtr;
  440.   TypLine far *LinePtr;
  441.   int LinesGone;
  442.   unsigned int LineOrd;
  443.   RECT Rect;
  444.   int window_lineheight, window_topspace;
  445.   
  446.   if(Document->DocType == DOCTYPE_ARTICLE)
  447.   {
  448.     window_lineheight = ArtLineHeight;
  449.     window_topspace = ArtTopSpace;
  450.   }
  451.   else
  452.   {
  453.     window_lineheight = LineHeight;
  454.     window_topspace = TopSpace;
  455.   }  
  456.     
  457.   switch (LOWORD(wParam))
  458.     {
  459.     case SB_LINEUP:
  460.       /* Move up a line by scrolling the window down one line     */
  461.       /* and introducing 1 new line at the top.                   */
  462.       LockLine (Document->hCurTopScBlock, Document->TopScOffset, Document->TopScLineID, &BlockPtr, &LinePtr); 
  463.       AdvanceToActive(&BlockPtr,&LinePtr);
  464.       ScreenUp (1, &BlockPtr, &LinePtr, &LinesGone);
  465.     doscrollup:;
  466.       if (LinesGone)
  467.    {
  468.      Rect.left = 0;
  469.      Rect.right = Document->ScXWidth;
  470.      Document->TopLineOrd -= LinesGone;
  471.      ScrollWindow (Document->hDocWnd, 0, LinesGone * (window_lineheight), NULL, NULL);
  472.  
  473.      Rect.top = window_topspace;
  474.      Rect.bottom = window_topspace + LinesGone * window_lineheight;
  475.  
  476.      InvalidateRect (Document->hDocWnd, &Rect, FALSE);
  477.      /* Make sure garbage at bottom is erased in WM_PAINT processing */
  478.      Rect.top = window_topspace + Document->ScYLines * window_lineheight;
  479.      Rect.bottom = Document->ScYHeight;
  480.      InvalidateRect (Document->hDocWnd, &Rect, FALSE);
  481.    }
  482.       break;
  483.  
  484.     case SB_LINEDOWN:
  485.       LockLine (Document->hCurTopScBlock, Document->TopScOffset, Document->TopScLineID, &BlockPtr, &LinePtr);
  486.       AdvanceToActive(&BlockPtr,&LinePtr);
  487.       ScreenDown (1, Document->ScYLines, &BlockPtr, &LinePtr, &LinesGone);
  488.     doscrolldown:;
  489.       if (LinesGone)
  490.    {
  491.      Document->TopLineOrd += LinesGone;
  492.      Rect.left = 0;
  493.      Rect.right = Document->ScXWidth;
  494.      ScrollWindow (Document->hDocWnd, 0, -LinesGone * (window_lineheight), NULL, NULL);
  495.      Rect.top = window_topspace + (Document->ScYLines - LinesGone) * window_lineheight;
  496.      Rect.bottom = Document->ScYHeight;
  497.      InvalidateRect (Document->hDocWnd, &Rect, FALSE);
  498.      /* Make sure garbage at top is erased in WM_PAINT processing */
  499.      Rect.top = 0;
  500.      Rect.bottom = window_topspace;
  501.      InvalidateRect (Document->hDocWnd, &Rect, FALSE);
  502.    }
  503.       break;
  504.  
  505.     case SB_PAGEUP:
  506.       LockLine (Document->hCurTopScBlock, Document->TopScOffset, Document->TopScLineID, &BlockPtr, &LinePtr);
  507.       AdvanceToActive(&BlockPtr,&LinePtr);
  508.       ScreenUp (Document->ScYLines - 1, &BlockPtr, &LinePtr, &LinesGone);
  509.       Document->TopLineOrd -= LinesGone;
  510.       InvalidateRect (Document->hDocWnd, NULL, FALSE);
  511.       break;
  512.  
  513.     case SB_PAGEDOWN:
  514.       LockLine (Document->hCurTopScBlock, Document->TopScOffset, Document->TopScLineID, &BlockPtr, &LinePtr);
  515.       AdvanceToActive(&BlockPtr,&LinePtr);
  516.       ScreenDown (Document->ScYLines - 1, Document->ScYLines,
  517.         &BlockPtr, &LinePtr, &LinesGone);
  518.       Document->TopLineOrd += LinesGone;
  519.       InvalidateRect (Document->hDocWnd, NULL, FALSE);
  520.       break;
  521.  
  522.     case SB_THUMBPOSITION:
  523. #ifdef WIN32
  524.        LineOrd = (int)HIWORD (wParam);
  525. #else
  526.        LineOrd = LOWORD (lParam);
  527. #endif
  528.       if (!FindLineOrd (Document, LineOrd, &BlockPtr, &LinePtr))
  529.    {
  530.      return;
  531.    }
  532.     doposition:;
  533.       Document->TopLineOrd = LineOrd;
  534.       InvalidateRect (Document->hDocWnd, NULL, FALSE);
  535.       break;
  536.  
  537.     case SB_THUMBTRACK:
  538.                                                   
  539. #ifdef WIN32
  540.        LineOrd = (int)HIWORD (wParam);
  541. #else
  542.        LineOrd = LOWORD (lParam);
  543. #endif
  544.       if (!FindLineOrd (Document, LineOrd, &BlockPtr, &LinePtr))
  545.    {
  546.      return;
  547.    }
  548.       LinesGone = LineOrd - Document->TopLineOrd;
  549.       if (LinesGone > 0)
  550.    {
  551.      if (LinesGone >= (int) (Document->ScYLines - 1))
  552.        {
  553.          goto doposition;
  554.        }
  555.      else
  556.        {
  557.          goto doscrolldown;
  558.        }
  559.    }
  560.       else if (LinesGone < 0)
  561.    {
  562.      LinesGone = -LinesGone;
  563.      if (LinesGone >= (int) (Document->ScYLines - 1))
  564.        {
  565.          goto doposition;
  566.        }
  567.      else
  568.        {
  569.          goto doscrollup;
  570.        }
  571.    }
  572.  
  573.       break;
  574.  
  575.     default:
  576.       return;
  577.       break;
  578.     }
  579.  
  580.   UnlockLine (BlockPtr, LinePtr, &(Document->hCurTopScBlock),
  581.          &(Document->TopScOffset), &(Document->TopScLineID));
  582.  
  583. }
  584.  
  585.  
  586.  
  587. /*--- function HScrollIt ----------------------------------------------
  588.  *
  589.  *  Perform a horizontal scrolling action.
  590.  *
  591.  *    Entry    Document points to a document
  592.  *             wParam   is the wParam argument given from a WM_HSCROLL
  593.  *                      window message.  (One of the SB_ symbols.)
  594.  *             lParam   is the lParam argument (scroll box position).
  595.  */
  596. void
  597. HScrollIt (Document, wParam, lParam)
  598.      TypDoc *Document;
  599.      WPARAM wParam;
  600.      LPARAM lParam;
  601.  
  602. switch (LOWORD(wParam))
  603.   {
  604.   
  605.   case SB_LINEUP:
  606.     if(Document->ScXOffset > 0)
  607.     { 
  608.       RECT Rect;
  609.       
  610.       Document->ScXOffset--;          
  611.       Rect.top = 0;
  612.       Rect.bottom = Document->ScYHeight; 
  613.       
  614.       if(Document->DocType == DOCTYPE_ARTICLE)
  615.       {
  616.         Rect.left = -((int)ArtCharWidth + 1);
  617.       }
  618.       else
  619.       {
  620.         Rect.left = -((int)CharWidth + 1);
  621.       }    
  622.       Rect.right = Document->ScXWidth - Rect.left;  
  623.       ScrollWindow(Document->hDocWnd, -Rect.left, 0, &Rect, NULL);
  624.       Rect.right = -Rect.left;  
  625.  
  626.       InvalidateRect(Document->hDocWnd, &Rect, FALSE);
  627.     }
  628.     break;
  629.  
  630.   case SB_LINEDOWN:
  631.     if(Document->ScXOffset < Document->LongestLine - Document->ScXChars)
  632.     { 
  633.       RECT Rect;
  634.       
  635.       Document->ScXOffset++; 
  636.       Rect.top = 0;
  637.       Rect.bottom = Document->ScYHeight; 
  638.       
  639.       if(Document->DocType == DOCTYPE_ARTICLE)
  640.       {
  641.         Rect.left = ArtCharWidth + 1;  
  642.       }
  643.       else
  644.       {
  645.         Rect.left = CharWidth +1;
  646.       }    
  647.       Rect.right =  Document->ScXWidth + Rect.left;
  648.       ScrollWindow(Document->hDocWnd, -Rect.left, 0, &Rect, NULL);
  649.       Rect.right = Rect.left;
  650.       Rect.left = 0;    
  651.  
  652.       InvalidateRect(Document->hDocWnd, &Rect, FALSE);
  653.     }
  654.     break;                  
  655.   
  656.   case SB_PAGEUP:
  657.     if(((int)Document->ScXOffset - (int)Document->ScXChars) > 0)
  658.     {
  659.       Document->ScXOffset = Document->ScXOffset -
  660.                             Document->ScXChars + 5;
  661.     }
  662.     else
  663.     {
  664.       Document->ScXOffset = 0;
  665.     }
  666.     InvalidateRect(Document->hDocWnd, NULL, FALSE);
  667.     break;
  668.           
  669.   case SB_PAGEDOWN:
  670.     if((Document->ScXOffset + Document->ScXChars) < 
  671.        (Document->LongestLine - Document->ScXChars))
  672.     {
  673.       Document->ScXOffset = Document->ScXOffset +
  674.                             Document->ScXChars - 5;                            
  675.     }
  676.     else
  677.     {
  678.       Document->ScXOffset = Document->LongestLine - 
  679.                             Document->ScXChars;
  680.     }                                          
  681.     InvalidateRect(Document->hDocWnd, NULL, FALSE);
  682.     break;
  683.   
  684.   case SB_THUMBPOSITION:
  685.   case SB_THUMBTRACK:
  686.  
  687. #ifdef _WIN32
  688.     Document->ScXOffset = (int)HIWORD(wParam);
  689. #else
  690.     Document->ScXOffset = LOWORD(lParam);
  691. #endif
  692.  
  693.  
  694.     InvalidateRect (Document->hDocWnd, NULL, FALSE);
  695.     break;
  696.  
  697.   default:         
  698.     return;
  699.     break;
  700.       
  701.   }
  702. }
  703.  
  704.  
  705.  
  706.  
  707. /*--- function LineOnScreen ----------------------------------------
  708.  *
  709.  *  Determine whether a given line is displayed on the screen.
  710.  *  If it is, give the ordinal line number on the screen.
  711.  *
  712.  *  Entry   Doc         points to the document.
  713.  *          hTargBlock  is the handle of the block containing the line.
  714.  *          TargOffset  is the offset of the target line.
  715.  *          TargLineID  is the line's ID.
  716.  *
  717.  *  Exit    returns -1 if the line is not on the screen, else
  718.  *          the ordinal line number (0 = top line, etc.)
  719.  */
  720. int
  721. LineOnScreen (Doc, hTargBlock, TargOffset, TargLineID)
  722.      TypDoc *Doc;
  723.      HANDLE hTargBlock;
  724.      unsigned int TargOffset;
  725.      TypLineID TargLineID;
  726. {
  727.   TypBlock far *CurBlockPtr, far * TargBlockPtr;
  728.   TypLine far *CurLinePtr, far * TargLinePtr;
  729.   int iline;
  730.   BOOL found = FALSE, gotnext=TRUE;
  731.   HANDLE hBlock;
  732.   unsigned int Offset;
  733.   TypLineID MyLineID;
  734.  
  735.   LockLine (Doc->hCurTopScBlock, Doc->TopScOffset, Doc->TopScLineID, &CurBlockPtr, &CurLinePtr);
  736.   LockLine (hTargBlock, TargOffset, TargLineID, &TargBlockPtr, &TargLinePtr);
  737.  
  738.   for (iline = 0; gotnext && !found && (unsigned) iline < Doc->ScYLines;)
  739.     {
  740.       found = (TargLinePtr == CurLinePtr);
  741.       if(CurLinePtr->active) iline++;
  742.       if (!found)
  743.    {
  744.      gotnext = NextLine (&CurBlockPtr, &CurLinePtr);
  745.    }
  746.     }
  747.  
  748.   UnlockLine (CurBlockPtr, CurLinePtr, &hBlock, &Offset, &MyLineID);
  749.   UnlockLine (TargBlockPtr, TargLinePtr, &hBlock, &Offset, &MyLineID);
  750.  
  751.   if (!found)
  752.     iline = 0;
  753.   return (iline - 1);
  754. }
  755.  
  756. /*--- function NextWindow ----------------------------------------------
  757.  *
  758.  *  Makes another window the active window with input focus.
  759.  *  This function would typically be used to implement a keystroke
  760.  *  (usually F6) that switches windows.
  761.  *
  762.  *    Entry    Doc   points to the current document.
  763.  */
  764. void
  765. NextWindow (Doc)
  766.      TypDoc *Doc;
  767. {
  768.   int idoc;
  769.   int trydoctype;
  770.   TypDoc *NewDoc;
  771.  
  772.   /* First, locate the current window in our data structures.       */
  773.  
  774.   switch (Doc->DocType)
  775.     {
  776.     case DOCTYPE_NET:
  777.       idoc = 0;
  778.       trydoctype = DOCTYPE_GROUP;
  779.       break;
  780.     case DOCTYPE_GROUP:
  781.       for (idoc = 0; idoc < MAXGROUPWNDS && Doc != &(GroupDocs[idoc]); idoc++);
  782.       if (idoc >= MAXGROUPWNDS)
  783.    {
  784.      MessageBox (Doc->hDocWnd, "Error finding next window", "System error", MB_ICONHAND | MB_OK);
  785.    }
  786.       trydoctype = DOCTYPE_GROUP;
  787.       idoc++;
  788.       break;
  789.     case DOCTYPE_ARTICLE:
  790.       for (idoc = 0; idoc < MAXARTICLEWNDS && Doc != &(ArticleDocs[idoc]); idoc++);
  791.       if (idoc >= MAXARTICLEWNDS)
  792.    {
  793.      MessageBox (Doc->hDocWnd, "Error finding next window", "System error", MB_ICONHAND | MB_OK);
  794.    }
  795.       trydoctype = DOCTYPE_ARTICLE;
  796.       idoc++;
  797.       break;
  798.     }
  799.  
  800.   /* Now, find the next window in the sequence.                     */
  801.  
  802.   if (trydoctype == DOCTYPE_GROUP)
  803.     {
  804.       for (; idoc < MAXGROUPWNDS; idoc++)
  805.    {
  806.      if (GroupDocs[idoc].InUse)
  807.        {
  808.          NewDoc = ActiveGroupDoc = &(GroupDocs[idoc]);
  809.          goto foundit;
  810.        }
  811.    }
  812.       idoc = 0;
  813.     }
  814.  
  815.   /* Not found yet--try to find an Article doc.                     */
  816.  
  817.   for (; idoc < MAXARTICLEWNDS; idoc++)
  818.     {
  819.       if (ArticleDocs[idoc].InUse)
  820.    {
  821.      NewDoc = ActiveArticleDoc = &(ArticleDocs[idoc]);
  822.      goto foundit;
  823.    }
  824.     }
  825.  
  826.   /* Still not found--just make the Net document the next one.      */
  827.  
  828.   NewDoc = &NetDoc;
  829.  
  830. foundit:;
  831.  
  832.   SetActiveWindow (NewDoc->hDocWnd);
  833.   SetFocus (NewDoc->hDocWnd);
  834.  
  835. }
  836.  
  837. /*--- function AdjustScTop -----------------------------------
  838.  *
  839.  *  Adjust the top line of the screen so that a given line is sure
  840.  *  to appear on the screen.
  841.  *  Don't do anything if the document is one screen's length or smaller.
  842.  *
  843.  *    Entry
  844.  *             BlockPtr and LinePtr  point to the line we want to
  845.  *                      make sure is visible.
  846.  *
  847.  *    Exit     Doc's TopSc fields have been set to ensure that
  848.  *               the line will appear on the screen.
  849.  *             The line has been unlocked.
  850.  */
  851.  
  852. void
  853. AdjustTopSc (BlockPtr, LinePtr)
  854.      TypBlock far *BlockPtr;
  855.      TypLine far *LinePtr;
  856. {
  857.   unsigned int lineord;
  858.   TypDoc *Doc;
  859.   HANDLE hBlock;
  860.   unsigned int Offset;
  861.   TypLineID MyLineID;
  862.  
  863.   Doc = BlockPtr->OwnerDoc;
  864.   if (Doc->TotalLines > Doc->ScYLines)
  865.   //if (Doc->ActiveLines > Doc->ScYLines)  //??
  866.     {
  867.       lineord = WhatLine (BlockPtr, LinePtr);
  868.  
  869.       while (lineord > Doc->TotalLines - Doc->ScYLines)
  870.       //while (lineord > Doc->ActiveLines - Doc->ScYLines)  //??
  871.    {
  872.      PrevLine (&BlockPtr, &LinePtr);
  873.      lineord--;
  874.    }
  875.       Doc->TopLineOrd = lineord;
  876.       UnlockLine (BlockPtr, LinePtr, &(Doc->hCurTopScBlock),
  877.         &(Doc->TopScOffset), &(Doc->TopScLineID));
  878.     }
  879.   else
  880.     {
  881.       UnlockLine (BlockPtr, LinePtr, &hBlock, &Offset, &MyLineID);
  882.     }
  883. }
  884.  
  885. /*
  886.  * This is a Doc/line-index version of AdjustScTop
  887.  * Don't you wish we could overload the function?!
  888.  * JSC 8/13/94
  889.  */
  890. void
  891. AdjustTopScByDoc (TypDoc *aDoc, unsigned int index)
  892. {
  893.     if (aDoc->TotalLines < aDoc->ScYLines ||
  894.        index >= aDoc->TopLineOrd && index < aDoc->TopLineOrd + aDoc->ScYLines)
  895.         return;        // already on screen
  896.     
  897.     if (index <= aDoc->ScYLines/2)
  898.         aDoc->TopLineOrd = 0;
  899.     else
  900.         aDoc->TopLineOrd = index - aDoc->ScYLines/2;    // center it
  901.  
  902.     InvalidateRect(aDoc->hDocWnd, NULL, FALSE);
  903. }
  904.  
  905. /*--- function ScreenToTop -------------------------------------
  906.  *
  907.  *  Sets a document so that the screen is scrolled to the top.
  908.  *
  909.  *  Entry   Doc     points to the document.
  910.  *
  911.  *  Exit    The document has been set to display starting at
  912.  *            the first line.
  913.  */
  914.  
  915. void
  916. ScreenToTop (TypDoc * Doc)
  917.   TypBlock far *BlockPtr;
  918.   TypLine far *LinePtr;
  919.   
  920.   Doc->hCurTopScBlock = Doc->hFirstBlock;
  921.   Doc->TopScOffset = sizeof (TypBlock);
  922.   Doc->TopScLineID = 0;
  923.   Doc->TopLineOrd = 0;
  924.   
  925.   LockLine(Doc->hFirstBlock,Doc->TopScOffset,Doc->TopScLineID,&BlockPtr,&LinePtr);
  926.   AdvanceToActive(&BlockPtr,&LinePtr);
  927.   UnlockLine(BlockPtr,LinePtr,&(Doc->hFirstBlock),&(Doc->TopScOffset),&(Doc->TopScLineID));
  928. }   
  929.  
  930. /*--- function AdvanceToActive ---------------------------------------
  931.  *
  932.  *  Advances a block/line pointer pair to an active line.
  933.  *  The pointers are unchanged if the current line is active.
  934.  *
  935.  *  Entry:  BlockPtr, LinePtr points to a line.
  936.  *
  937.  *  Exit:   BlockPtr,LinePtr  points to an active line, if possible.
  938.  *          Returns TRUE if successful, else FALSE if no line from
  939.  *            this point to the end of the document was active.
  940.  */
  941. BOOL
  942. AdvanceToActive(BlockPtr, LinePtr)
  943.      TypBlock far **BlockPtr;
  944.      TypLine far **LinePtr;
  945. {
  946.    BOOL ok=TRUE;
  947.    
  948.    while(!((*LinePtr)->active)) {
  949.       if(!NextLine(BlockPtr,LinePtr)) {
  950.          ok = FALSE;
  951.          break;
  952.       }
  953.    }   
  954.    
  955.    return ok;
  956. }
  957.  
  958.  
  959. /*--- function SetHandleBkBrush ---------------------------------------
  960.  *
  961.  *  Sets a new handle of a background brush.
  962.  *  This uses SetClassWord in a portable way and makes code look tidier.
  963.  *
  964.  *  Entry:  hwnd     Identifies window whose brush is to be changed.
  965.  *            handle    Handle to the new brush.
  966.  *
  967.  */
  968. void SetHandleBkBrush(HWND hwnd, HBRUSH handle)
  969. {
  970.     #ifdef _WIN32
  971.       SetClassLong (hwnd, GCL_HBRBACKGROUND, (LONG)handle);
  972.     #else
  973.       SetClassWord(hwnd, GCW_HBRBACKGROUND, (WORD)handle);
  974.     #endif
  975. }
  976.  
  977.  
  978. /*-- Last Line of WVSCREEN.C ----------------- */
  979. @
  980.  
  981.  
  982. 1.13
  983. log
  984. @misc encoding/decoding changes
  985. @
  986. text
  987. @d4 1
  988. a4 1
  989.  * $Id: wvscreen.c 1.12 1994/07/27 21:12:19 gardnerd Exp $
  990. d6 3
  991. d49 2
  992. a50 2
  993.  
  994. #include "windows.h"
  995. d53 1
  996. d886 1
  997. a886 1
  998.       SetClassWord(hwnd, GCW_HBRBACKGROUND, handle);
  999. @
  1000.  
  1001.  
  1002. 1.12
  1003. log
  1004. @copy to clipboard
  1005. @
  1006. text
  1007. @d4 1
  1008. a4 1
  1009.  * $Id: wvscreen.c 1.11 1994/07/12 19:51:26 cnolan Exp $
  1010. d6 3
  1011. d791 20
  1012. @
  1013.  
  1014.  
  1015. 1.11
  1016. log
  1017. @win32ism
  1018. @
  1019. text
  1020. @d4 1
  1021. a4 1
  1022.  * $Id: wvscreen.c 1.10 1994/06/01 19:08:20 gardnerd Exp $
  1023. d6 3
  1024. d349 2
  1025. a350 2
  1026.  
  1027.   if (Document->DocType == DOCTYPE_ARTICLE)
  1028. d352 2
  1029. a353 2
  1030.    window_lineheight = ArtLineHeight;
  1031.    window_topspace = ArtTopSpace; 
  1032. d357 4
  1033. a360 4
  1034.    window_lineheight = LineHeight;
  1035.    window_topspace = TopSpace;
  1036.   }
  1037.  
  1038. d375 1
  1039. a375 1
  1040.      ScrollWindow (Document->hDocWnd, 0, LinesGone * window_lineheight, NULL, NULL);
  1041. d398 1
  1042. a398 1
  1043.      ScrollWindow (Document->hDocWnd, 0, -LinesGone * window_lineheight, NULL, NULL);
  1044. d512 20
  1045. a531 3
  1046.     {
  1047.       Document->ScXOffset--; 
  1048.       InvalidateRect(Document->hDocWnd, NULL, FALSE);
  1049. d537 3
  1050. a539 1
  1051.     {
  1052. d541 17
  1053. a557 1
  1054.       InvalidateRect(Document->hDocWnd, NULL, FALSE);
  1055. @
  1056.  
  1057.  
  1058. 1.10
  1059. log
  1060. @horizontal scrolling support
  1061. @
  1062. text
  1063. @d4 1
  1064. a4 1
  1065.  * $Id: wvscreen.c 1.9 1994/02/24 21:34:08 jcoop Exp $
  1066. d6 3
  1067. d553 4
  1068. d558 3
  1069. @
  1070.  
  1071.  
  1072. 1.9
  1073. log
  1074. @jcoop changes
  1075. @
  1076. text
  1077. @d4 1
  1078. a4 1
  1079.  * $Id: wvscreen.c 1.8 1994/02/09 18:01:08 cnolan Exp $
  1080. d6 3
  1081. d436 1
  1082. a436 1
  1083.  
  1084. d482 80
  1085. @
  1086.  
  1087.  
  1088. 1.8
  1089. log
  1090. @cnolan 90.2 changes
  1091. @
  1092. text
  1093. @d4 1
  1094. a4 1
  1095.  * $Id: wvscreen.c 1.7 1994/01/12 19:27:32 mrr Exp $
  1096. d6 3
  1097. d153 12
  1098. d184 1
  1099. a184 1
  1100.      ScrollWindow (Document->hDocWnd, 0, LinesGone * LineHeight, NULL, NULL);
  1101. d186 2
  1102. a187 2
  1103.      Rect.top = TopSpace;
  1104.      Rect.bottom = TopSpace + LinesGone * LineHeight;
  1105. d192 1
  1106. a192 1
  1107.      Rect.top = TopSpace + Document->ScYLines * LineHeight;
  1108. d214 2
  1109. a215 2
  1110.      ScrollWindow (Document->hDocWnd, 0, -LinesGone * LineHeight, NULL, NULL);
  1111.      Rect.top = TopSpace + (Document->ScYLines - LinesGone) * LineHeight;
  1112. d220 1
  1113. a220 1
  1114.      Rect.bottom = TopSpace;
  1115. d339 1
  1116. a339 1
  1117.   int window_lineheight;
  1118. d342 1
  1119. d344 2
  1120. d347 1
  1121. d349 2
  1122. d368 2
  1123. a369 2
  1124.      Rect.top = TopSpace;
  1125.      Rect.bottom = TopSpace + LinesGone * window_lineheight;
  1126. d373 1
  1127. a373 1
  1128.      Rect.top = TopSpace + Document->ScYLines * window_lineheight;
  1129. d390 1
  1130. a390 1
  1131.      Rect.top = TopSpace + (Document->ScYLines - LinesGone) * window_lineheight;
  1132. d395 1
  1133. a395 1
  1134.      Rect.bottom = TopSpace;
  1135. @
  1136.  
  1137.  
  1138. 1.7
  1139. log
  1140. @mrr mods 4
  1141. @
  1142. text
  1143. @d4 1
  1144. a4 1
  1145.  * $Id: wvscreen.c 1.6 1993/12/08 01:28:01 rushing Exp $
  1146. d6 3
  1147. d617 2
  1148. a618 1
  1149.   if (Doc->ActiveLines > Doc->ScYLines)
  1150. d622 2
  1151. a623 1
  1152.       while (lineord > Doc->ActiveLines - Doc->ScYLines)
  1153. d692 19
  1154. @
  1155.  
  1156.  
  1157. 1.6
  1158. log
  1159. @new version box and cr lf consistency
  1160. @
  1161. text
  1162. @d4 1
  1163. a4 1
  1164.  * $Id: wvscreen.c 1.5 1993/07/06 20:53:23 rushing Exp rushing $
  1165. d6 3
  1166. d72 5
  1167. a76 2
  1168.   for (LinesGone = TestAdvance; LinesGone && NextLine (&MyBlock, &MyLine);
  1169.        LinesGone--);
  1170. d85 1
  1171. a85 1
  1172.   while (nLines--)
  1173. d88 1
  1174. d116 6
  1175. a121 3
  1176.   while (nLines-- && PrevLine (BlockPtr, LinePtr))
  1177.     {
  1178.       (*LinesBackedUp)++;
  1179. d125 1
  1180. a125 1
  1181. /*--- function ScrollIt ----------------------------------------------
  1182. d134 1
  1183. a134 1
  1184.  *      except in WIN32 ...
  1185. d136 1
  1186. a136 1
  1187.  *               wParam    LOWORD: SB_code, HIWORD: position.
  1188. d161 17
  1189. a177 17
  1190.     {
  1191.       Rect.left = 0;
  1192.       Rect.right = Document->ScXWidth;
  1193.       Document->TopLineOrd -= LinesGone;
  1194.  
  1195.       ScrollWindow (Document->hDocWnd, 0, LinesGone * LineHeight, NULL, NULL);
  1196.  
  1197.       Rect.top = TopSpace;
  1198.       Rect.bottom = TopSpace + LinesGone * LineHeight;
  1199.  
  1200.       InvalidateRect (Document->hDocWnd, &Rect, FALSE);
  1201.  
  1202.       /* Make sure garbage at bottom is erased in WM_PAINT processing */
  1203.       Rect.top = TopSpace + Document->ScYLines * LineHeight;
  1204.       Rect.bottom = Document->ScYHeight;
  1205.       InvalidateRect (Document->hDocWnd, &Rect, FALSE);
  1206.     }
  1207. d181 5
  1208. a185 2
  1209.  
  1210.    if (Document->TopLineOrd < (Document->TotalLines - Document->ScYLines)) {
  1211. d192 13
  1212. a204 13
  1213.     {
  1214.       Document->TopLineOrd += LinesGone;
  1215.       Rect.left = 0;
  1216.       Rect.right = Document->ScXWidth;
  1217.       ScrollWindow (Document->hDocWnd, 0, -LinesGone * LineHeight, NULL, NULL);
  1218.       Rect.top = TopSpace + (Document->ScYLines - LinesGone) * LineHeight;
  1219.       Rect.bottom = Document->ScYHeight;
  1220.       InvalidateRect (Document->hDocWnd, &Rect, FALSE);
  1221.       /* Make sure garbage at top is erased in WM_PAINT processing */
  1222.       Rect.top = 0;
  1223.       Rect.bottom = TopSpace;
  1224.       InvalidateRect (Document->hDocWnd, &Rect, FALSE);
  1225.     }
  1226. d212 1
  1227. a212 1
  1228.     LinesGone = Document->ScYLines - 1;
  1229. d214 3
  1230. a216 3
  1231.     else {
  1232.     LinesGone = Document->TopLineOrd;
  1233.     }
  1234. d224 3
  1235. a226 3
  1236.    if (Document->TotalLines > Document->ScYLines) { /* do we even need to scroll? */
  1237.      if ((Document->TotalLines -
  1238.       (Document->TopLineOrd + Document->ScYLines)) > Document->ScYLines)
  1239. d229 1
  1240. a229 1
  1241.        LinesGone = Document->TotalLines - (Document->TopLineOrd + Document->ScYLines );
  1242. d243 3
  1243. a245 3
  1244.     {
  1245.       return;
  1246.     }
  1247. d260 3
  1248. a262 3
  1249.     {
  1250.       return;
  1251.     }
  1252. d266 10
  1253. a275 10
  1254.     {
  1255.       if (LinesGone >= (int) (Document->ScYLines - 1))
  1256.         {
  1257.           goto doposition;
  1258.         }
  1259.       else
  1260.         {
  1261.           goto doscrolldown;
  1262.         }
  1263.     }
  1264. d277 11
  1265. a287 11
  1266.     {
  1267.       LinesGone = -LinesGone;
  1268.       if (LinesGone >= (int) (Document->ScYLines - 1))
  1269.         {
  1270.           goto doposition;
  1271.         }
  1272.       else
  1273.         {
  1274.           goto doscrollup;
  1275.         }
  1276.     }
  1277. d297 1
  1278. a297 1
  1279.           &(Document->TopScOffset), &(Document->TopScLineID));
  1280. d334 1
  1281. a334 1
  1282.  
  1283. d338 15
  1284. a352 15
  1285.     {
  1286.       Rect.left = 0;
  1287.       Rect.right = Document->ScXWidth;
  1288.       Document->TopLineOrd -= LinesGone;
  1289.       ScrollWindow (Document->hDocWnd, 0, LinesGone * window_lineheight, NULL, NULL);
  1290.  
  1291.       Rect.top = TopSpace;
  1292.       Rect.bottom = TopSpace + LinesGone * window_lineheight;
  1293.  
  1294.       InvalidateRect (Document->hDocWnd, &Rect, FALSE);
  1295.       /* Make sure garbage at bottom is erased in WM_PAINT processing */
  1296.       Rect.top = TopSpace + Document->ScYLines * window_lineheight;
  1297.       Rect.bottom = Document->ScYHeight;
  1298.       InvalidateRect (Document->hDocWnd, &Rect, FALSE);
  1299.     }
  1300. d357 1
  1301. d361 13
  1302. a373 13
  1303.     {
  1304.       Document->TopLineOrd += LinesGone;
  1305.       Rect.left = 0;
  1306.       Rect.right = Document->ScXWidth;
  1307.       ScrollWindow (Document->hDocWnd, 0, -LinesGone * window_lineheight, NULL, NULL);
  1308.       Rect.top = TopSpace + (Document->ScYLines - LinesGone) * window_lineheight;
  1309.       Rect.bottom = Document->ScYHeight;
  1310.       InvalidateRect (Document->hDocWnd, &Rect, FALSE);
  1311.       /* Make sure garbage at top is erased in WM_PAINT processing */
  1312.       Rect.top = 0;
  1313.       Rect.bottom = TopSpace;
  1314.       InvalidateRect (Document->hDocWnd, &Rect, FALSE);
  1315.     }
  1316. d378 1
  1317. d386 1
  1318. d388 1
  1319. a388 1
  1320.           &BlockPtr, &LinePtr, &LinesGone);
  1321. d400 3
  1322. a402 3
  1323.     {
  1324.       return;
  1325.     }
  1326. d416 3
  1327. a418 3
  1328.     {
  1329.       return;
  1330.     }
  1331. d421 10
  1332. a430 10
  1333.     {
  1334.       if (LinesGone >= (int) (Document->ScYLines - 1))
  1335.         {
  1336.           goto doposition;
  1337.         }
  1338.       else
  1339.         {
  1340.           goto doscrolldown;
  1341.         }
  1342.     }
  1343. d432 11
  1344. a442 11
  1345.     {
  1346.       LinesGone = -LinesGone;
  1347.       if (LinesGone >= (int) (Document->ScYLines - 1))
  1348.         {
  1349.           goto doposition;
  1350.         }
  1351.       else
  1352.         {
  1353.           goto doscrollup;
  1354.         }
  1355.     }
  1356. d452 1
  1357. a452 1
  1358.           &(Document->TopScOffset), &(Document->TopScLineID));
  1359. d480 1
  1360. a480 1
  1361.   BOOL found = FALSE;
  1362. d488 1
  1363. a488 1
  1364.   for (iline = 0; !found && (unsigned) iline < Doc->ScYLines; iline++)
  1365. d491 1
  1366. d493 3
  1367. a495 3
  1368.     {
  1369.       NextLine (&CurBlockPtr, &CurLinePtr);
  1370.     }
  1371. d533 3
  1372. a535 3
  1373.     {
  1374.       MessageBox (Doc->hDocWnd, "Error finding next window", "System error", MB_ICONHAND | MB_OK);
  1375.     }
  1376. d542 3
  1377. a544 3
  1378.     {
  1379.       MessageBox (Doc->hDocWnd, "Error finding next window", "System error", MB_ICONHAND | MB_OK);
  1380.     }
  1381. d555 7
  1382. a561 7
  1383.     {
  1384.       if (GroupDocs[idoc].InUse)
  1385.         {
  1386.           NewDoc = ActiveGroupDoc = &(GroupDocs[idoc]);
  1387.           goto foundit;
  1388.         }
  1389.     }
  1390. d570 4
  1391. a573 4
  1392.     {
  1393.       NewDoc = ActiveArticleDoc = &(ArticleDocs[idoc]);
  1394.       goto foundit;
  1395.     }
  1396. d614 1
  1397. a614 1
  1398.   if (Doc->TotalLines > Doc->ScYLines)
  1399. d618 5
  1400. a622 5
  1401.       while (lineord > Doc->TotalLines - Doc->ScYLines)
  1402.     {
  1403.       PrevLine (&BlockPtr, &LinePtr);
  1404.       lineord--;
  1405.     }
  1406. d625 1
  1407. a625 1
  1408.           &(Doc->TopScOffset), &(Doc->TopScLineID));
  1409. d639 2
  1410. a640 2
  1411.  *  Exit     The document has been set to display starting at
  1412.  *               the first line.
  1413. d645 4
  1414. a648 1
  1415. {
  1416. d653 32
  1417. a684 1
  1418.  
  1419. d686 1
  1420. @
  1421.  
  1422.  
  1423. 1.5
  1424. log
  1425. @type fixed
  1426. @
  1427. text
  1428. @d1 1
  1429. d4 1
  1430. a4 1
  1431.  * $Id: wvscreen.c 1.4 1993/07/06 20:52:28 cnolan Exp rushing $
  1432. d6 3
  1433. @
  1434.  
  1435.  
  1436. 1.4
  1437. log
  1438. @win32 changes
  1439. @
  1440. text
  1441. @d3 1
  1442. a3 1
  1443.  * $Id: wvscreen.c 1.3 1993/06/28 17:51:39 rushing Exp $
  1444. d5 3
  1445. d223 1
  1446. a223 1
  1447.        LineOrd = LOWORS (lParam);
  1448. d240 1
  1449. a240 1
  1450.        LineOrd = LOWORS (lParam);
  1451. d377 1
  1452. a377 1
  1453.        LineOrd = LOWORS (lParam);
  1454. d393 1
  1455. a393 1
  1456.        LineOrd = LOWORS (lParam);
  1457. @
  1458.  
  1459.  
  1460. 1.3
  1461. log
  1462. @fixed compiler warnings
  1463. @
  1464. text
  1465. @d3 1
  1466. a3 1
  1467.  * $Id: wvscreen.c 1.2 1993/05/26 18:30:40 rushing Exp rushing $
  1468. d5 3
  1469. d116 4
  1470. d124 2
  1471. a125 2
  1472.      WORD wParam;
  1473.      DWORD lParam;
  1474. d131 1
  1475. a131 1
  1476.   switch (wParam)
  1477. d217 5
  1478. a221 1
  1479.       LineOrd = LOWORD (lParam);
  1480. d234 5
  1481. a238 1
  1482.       LineOrd = LOWORD (lParam);
  1483. d293 2
  1484. a294 2
  1485.      WORD wParam;
  1486.      DWORD lParam;
  1487. d308 1
  1488. a308 1
  1489.   switch (wParam)
  1490. d371 5
  1491. a375 1
  1492.       LineOrd = LOWORD (lParam);
  1493. d387 5
  1494. a391 1
  1495.       LineOrd = LOWORD (lParam);
  1496. @
  1497.  
  1498.  
  1499. 1.2
  1500. log
  1501. @fixed page down bug (GPE when #arts < what can fit in window)
  1502. @
  1503. text
  1504. @d3 1
  1505. a3 1
  1506.  * $Id: wvscreen.c 1.1 1993/02/16 20:54:22 rushing Exp rushing $
  1507. d5 3
  1508. d232 1
  1509. a232 1
  1510.       if (LinesGone >= (Document->ScYLines - 1))
  1511. d244 1
  1512. a244 1
  1513.       if (LinesGone >= (Document->ScYLines - 1))
  1514. d376 1
  1515. a376 1
  1516.       if (LinesGone >= (Document->ScYLines - 1))
  1517. d388 1
  1518. a388 1
  1519.       if (LinesGone >= (Document->ScYLines - 1))
  1520. d442 1
  1521. a442 1
  1522.   for (iline = 0; !found && iline < Doc->ScYLines; iline++)
  1523. @
  1524.  
  1525.  
  1526. 1.1
  1527. log
  1528. @Initial revision
  1529. @
  1530. text
  1531. @d3 4
  1532. a6 2
  1533.  * $Id$
  1534.  * $Log$
  1535. d8 1
  1536. d192 1
  1537. a192 7
  1538.     case SB_PAGEDOWN:
  1539.  
  1540.       if ((Document->TotalLines - (Document->TopLineOrd + Document->ScYLines)) > Document->ScYLines)
  1541.     LinesGone = Document->ScYLines - 1;
  1542.       else
  1543.         LinesGone = Document->TotalLines
  1544.                     - (Document->TopLineOrd + Document->ScYLines );
  1545. d194 11
  1546. a204 3
  1547.       Document->TopLineOrd += LinesGone;
  1548.       InvalidateRect (Document->hDocWnd, NULL, FALSE);
  1549.       break;
  1550. d206 1
  1551. a206 1
  1552.     case SB_THUMBPOSITION:
  1553. @
  1554.