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

  1. head     1.7;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.7
  10. date     94.09.18.22.45.21;  author jcooper;  state Exp;
  11. branches ;
  12. next     1.6;
  13.  
  14. 1.6
  15. date     94.09.16.00.58.09;  author jcooper;  state Exp;
  16. branches ;
  17. next     1.5;
  18.  
  19. 1.5
  20. date     94.08.11.00.09.17;  author jcooper;  state Exp;
  21. branches ;
  22. next     1.4;
  23.  
  24. 1.4
  25. date     94.07.25.20.13.40;  author jcooper;  state Exp;
  26. branches ;
  27. next     1.3;
  28.  
  29. 1.3
  30. date     94.02.24.21.36.10;  author jcoop;  state Exp;
  31. branches ;
  32. next     1.2;
  33.  
  34. 1.2
  35. date     94.01.24.17.40.28;  author jcoop;  state Exp;
  36. branches ;
  37. next     1.1;
  38.  
  39. 1.1
  40. date     94.01.16.12.10.59;  author jcoop;  state Exp;
  41. branches ;
  42. next     ;
  43.  
  44.  
  45. desc
  46. @jcoop's coding status window routines
  47. @
  48.  
  49.  
  50. 1.7
  51. log
  52. @Better handling of status window.  
  53. @
  54. text
  55. @/********************************************************************
  56.  *                                                                  *
  57.  *  MODULE    :  WVCODEWN.C                                         *
  58.  *                                                                  *
  59.  *  PURPOSE   : This file contains the window proc for coding       *
  60.  *        status windows                                      *                                 
  61.  *                                                                  *
  62.  * Author: John S. Cooper (jcooper@@netcom.com)                      *
  63.  *   Date: Sept 30, 1993                                            *
  64.  ********************************************************************/
  65. /* 
  66.  * $Id: wvcodewn.c 1.6 1994/09/16 00:58:09 jcooper Exp $
  67.  * $Log: wvcodewn.c $
  68.  * Revision 1.6  1994/09/16  00:58:09  jcooper
  69.  * always-on-top option, and general cleanup for 92.6
  70.  * 
  71.  * Revision 1.5  1994/08/11  00:09:17  jcooper
  72.  * Enhancements to Mime and article encoding/encoding
  73.  *
  74.  * Revision 1.4  1994/07/25  20:13:40  jcooper
  75.  * execution of decoded files
  76.  *
  77.  * Revision 1.3  1994/02/24  21:36:10  jcoop
  78.  * jcoop changes
  79.  *
  80.  * Revision 1.2  1994/01/24  17:40:28  jcoop
  81.  * 90.2 changes
  82.  *
  83.  * Revision 1.1  1994/01/16  12:10:59  jcoop
  84.  * Initial revision
  85.  *
  86.  */ 
  87. #include <windows.h>
  88. #include <windowsx.h>
  89. #include "wvglob.h"
  90. #include "winvn.h"
  91. #pragma hdrstop
  92. #include <string.h>
  93. #include <stdio.h>
  94. #include <stdlib.h>
  95.  
  96. /* ------------------------------------------------------------------------
  97.  *     Window Proc for block coding status window
  98.  *    Simple fixed text display 
  99.  *    Associated with TypCoded  (always currentCoded)
  100.  *    Fixed size, only ever one on screen, destroyed on block coding complete
  101.  *    To avoid redrawing the entire status window on each update,
  102.  *    wParam in association with WM_PAINT decides what to draw this time:
  103.  */
  104. long FAR PASCAL
  105. WinVnCodedBlockWndProc (hWnd, message, wParam, lParam)
  106.     HWND hWnd;
  107.     UINT message;
  108.     WPARAM wParam;
  109.     LPARAM lParam;
  110. {
  111.     HDC          hDC;
  112.     HMENU        hMenu;
  113.     PAINTSTRUCT  ps;
  114.     void    DrawStatusFrame (HDC hDC);
  115.     void    DrawStatusName (HDC hDC);
  116.     void    DrawStatusLines (HDC hDC);
  117.     void    DrawStatusBytes (HDC hDC);
  118.     void    DrawStatusSeq (HDC hDC);
  119.     void    DrawStatusActivity (HDC hDC);
  120.  
  121.     switch (message)
  122.     {
  123.     case WM_CREATE:
  124.         hMenu = GetSystemMenu(hWnd, FALSE);
  125.         AppendMenu(hMenu, MF_SEPARATOR, 0, (LPSTR) NULL);
  126.         AppendMenu(hMenu, MF_STRING, IDM_ALWAYSONTOP, "Always On Top");
  127.         if (BlockCodingStatusAlwaysOnTop) {
  128.                 SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
  129.             CheckMenuItem(hMenu, IDM_ALWAYSONTOP, MF_BYCOMMAND|MF_CHECKED);
  130.         } else {
  131.                 SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
  132.             CheckMenuItem(hMenu, IDM_ALWAYSONTOP, MF_BYCOMMAND|MF_UNCHECKED);
  133.         }
  134.         break;
  135.  
  136.     case WM_SYSCOMMAND:
  137.         if (wParam == IDM_ALWAYSONTOP) 
  138.         {
  139.             hMenu = GetSystemMenu(hWnd, FALSE);
  140.             BlockCodingStatusAlwaysOnTop = !(GetMenuState(hMenu, IDM_ALWAYSONTOP, 
  141.                 MF_BYCOMMAND) & MF_CHECKED);
  142.             if (BlockCodingStatusAlwaysOnTop) {
  143.                     SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
  144.                 CheckMenuItem(hMenu, IDM_ALWAYSONTOP, MF_BYCOMMAND|MF_CHECKED);
  145.             } else {
  146.                     SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
  147.                 CheckMenuItem(hMenu, IDM_ALWAYSONTOP, MF_BYCOMMAND|MF_UNCHECKED);
  148.             }
  149.         }
  150.         else
  151.             return (DefWindowProc (hWnd, message, wParam, lParam));
  152.  
  153.     case WM_SIZE:
  154.     {
  155.         RECT client;
  156.         if (wParam != SIZE_MINIMIZED)
  157.         {
  158.             GetWindowRect (hWnd, &client);
  159.                 MoveWindow (hWnd, client.left, client.top, STATUSWIDTH,
  160.                                STATUSHEIGHT, TRUE);
  161.         }
  162.               break;
  163.     }
  164.             
  165.     case WM_PAINT:
  166.         hDC = BeginPaint (hWnd, &ps);
  167.         SetBkColor (hDC, StatusBackgroundColor);
  168.         SetTextColor (hDC, StatusTextColor);
  169.         SelectObject (hDC, hStatusFont);
  170.         if (currentCoded == NULL)
  171.             DrawStatusFrame (hDC);
  172.         else
  173.         {
  174.             DrawStatusFrame (hDC);
  175.             DrawStatusName (hDC);        
  176.             DrawStatusLines (hDC);        
  177.             DrawStatusBytes (hDC);        
  178.             DrawStatusSeq (hDC);        
  179.             DrawStatusActivity (hDC);        
  180.                 }
  181.         EndPaint (hWnd, &ps);
  182.         break;
  183.  
  184.     case WM_CLOSE:
  185.         if (CodingState)
  186.            MessageBox (hWnd,
  187.              "Please wait until en/decoding is complete",
  188.              "Cannot close status window", MB_OK|MB_ICONSTOP);
  189.         else                             
  190.            DestroyWindow (hWnd);
  191.  
  192.         break;
  193.     
  194.     default:
  195.         return (DefWindowProc (hWnd, message, wParam, lParam));
  196.     }
  197.     
  198.     return (0);
  199. }
  200.  
  201. /* ------------------------------------------------------------------------
  202.  *   Routines for drawing coding block status window
  203.  *   2 columns, 3 lines
  204.  *
  205.  *   HTITLE1       HTEXT1        HTITLE2  HTEXT2
  206.  *   !             !             !        !
  207.  *   Retrieving    ___________   Sequence ___________   <- YOFFSET
  208.  *   Lines Read    __________    Activity ___________   <- YOFFSET+YSPACE
  209.  *   Bytes Decoded __________                           <- YOFFSET+2*YSPACE
  210.  */
  211. #define HTITLE1 (3*StatusCharWidth)
  212. #define HTITLE2 (45*StatusCharWidth)
  213. #define HTEXT1    (22*StatusCharWidth)
  214. #define HTEXT2    (57*StatusCharWidth)
  215. #define YOFFSET (StatusLineHeight)
  216. #define YSPACE    (int)(StatusLineHeight*1.5)
  217.  
  218. void
  219. DrawStatusFrame (HDC hDC)
  220. {
  221.     if (CodingState >= ATTACH_PROCESSING)
  222.     {
  223.       TextOut (hDC, HTITLE1, YOFFSET, "Reading file", 12);
  224.       if (CodingState == ATTACH_PROCESSING)
  225.         TextOut (hDC, HTITLE1, YOFFSET + YSPACE, "Lines encoded", 13);
  226.       else
  227.         TextOut (hDC, HTITLE1, YOFFSET + YSPACE, "Lines posted", 12);
  228.       TextOut (hDC, HTITLE1, YOFFSET + 2*YSPACE, "Bytes read", 10);
  229.       if (CodingState == ATTACH_POSTING)
  230.         TextOut (hDC, HTITLE2, YOFFSET, "Sequence", 8);
  231.     } 
  232.     else
  233.     {
  234.       TextOut (hDC, HTITLE1, YOFFSET, "Retrieving", 10);
  235.       TextOut (hDC, HTITLE1, YOFFSET + YSPACE, "Lines Read", 10);
  236.       TextOut (hDC, HTITLE1, YOFFSET + 2*YSPACE, "Bytes Decoded", 13);
  237.       TextOut (hDC, HTITLE2, YOFFSET, "Sequence", 8);
  238.     } 
  239.     TextOut (hDC, HTITLE2, YOFFSET + YSPACE, "Activity", 8);
  240. }
  241.  
  242. void
  243. DrawStatusName (HDC hDC)
  244. {
  245.     char temp[MAXINTERNALLINE];
  246.     RECT aRect;
  247.         
  248.     if (currentCoded->name[0] == '\0' && currentCoded->ident[0] == '\0')
  249.         strcpy (temp, "Name unknown");
  250.     else
  251.     {
  252.         if (currentCoded->name[0] != '\0')    // len must be <= 20    
  253.         {
  254.             NameWithoutPath (str, currentCoded->name);// cut off any path
  255.             sprintf(temp, "%s", str);
  256.         }
  257.         else
  258.         {
  259.             NameWithoutPath (str, currentCoded->ident);//cut off any path
  260.             sprintf(temp, "%s", str); 
  261.         }
  262.     }
  263.  
  264.     // be sure to erase old name 
  265.     SetRect (&aRect, HTEXT1, YOFFSET, HTITLE2-1, YOFFSET+YSPACE-1);
  266.     ExtTextOut (hDC, HTEXT1, YOFFSET, ETO_OPAQUE|ETO_CLIPPED, &aRect, 
  267.                 temp, lstrlen(temp), (LPINT)NULL); 
  268. }
  269. void
  270. DrawStatusLines (HDC hDC)
  271. {
  272.     int len;
  273.     RECT aRect;
  274.     
  275.     len = sprintf (str, "%lu", currentCoded->numLines);
  276.     SetRect (&aRect, HTEXT1, YOFFSET+YSPACE, HTITLE2-1, YOFFSET+2*YSPACE-1);
  277.     ExtTextOut (hDC, HTEXT1, YOFFSET+YSPACE, ETO_OPAQUE|ETO_CLIPPED, 
  278.                 &aRect, str, len, (LPINT)NULL); 
  279. }
  280. void
  281. DrawStatusBytes (HDC hDC)
  282. {
  283.     int len;
  284.     RECT aRect;
  285.     
  286.     len = sprintf (str, "%lu", currentCoded->numBytes);
  287.     TextOut (hDC, HTEXT1, YOFFSET + 2*YSPACE, str, len);
  288.     SetRect (&aRect, HTEXT1, YOFFSET+2*YSPACE, HTITLE2-1, YOFFSET+3*YSPACE-1);
  289.     ExtTextOut (hDC, HTEXT1, YOFFSET+2*YSPACE, ETO_OPAQUE|ETO_CLIPPED, 
  290.                 &aRect, str, len, (LPINT)NULL); 
  291. }
  292. void
  293. DrawStatusSeq (HDC hDC)
  294. {
  295.     int len;
  296.     RECT aRect;
  297.     
  298.     if (CodingState == ATTACH_PROCESSING)
  299.         return;
  300.         
  301.     if (currentCoded->sequence == -1)
  302.         len = sprintf (str, "%s", "Unknown");
  303.     else    
  304.         len = sprintf (str, "%d", currentCoded->sequence);
  305.         
  306.     SetRect (&aRect, HTEXT2, YOFFSET, STATUSWIDTH-1, YOFFSET+YSPACE-1);
  307.     ExtTextOut (hDC, HTEXT2, YOFFSET, ETO_OPAQUE|ETO_CLIPPED, 
  308.                 &aRect, str, len, (LPINT)NULL); 
  309. }
  310.  
  311. void
  312. DrawStatusActivity (HDC hDC)
  313. {
  314. //    static int prevState = -1;
  315.     COLORREF backColor;
  316.     int len;
  317.     SIZE size;
  318.     RECT aRect;
  319. //    if (CodingState == prevState)
  320. //        return;
  321.     
  322.     switch (CodingState)
  323.     {
  324.     case DECODE_SKIPPING:
  325.          backColor = RGB(128, 0, 0);             // red
  326.         strcpy (str, "Skipping");
  327.         break;
  328.         
  329.     case DECODE_GET_TABLE:
  330.          backColor = RGB(0, 128, 128);           // purple?
  331.         strcpy (str, "Getting table");
  332.         break;                                                     
  333.         
  334.     case DECODE_PROCESSING:
  335.          backColor = RGB(0, 128, 0);             // green
  336.         strcpy (str, "Decoding");
  337.         break;
  338.  
  339.     case ATTACH_PROCESSING:
  340.          backColor = RGB(0, 128, 0);        // green
  341.         strcpy (str, "Encoding");
  342.         break;
  343.  
  344.     case ATTACH_POSTING:    
  345.          backColor = RGB(128, 128, 0);        // yellow
  346.         if (ReviewAttach)
  347.            strcpy (str, "Creating review");
  348.         else
  349.            strcpy (str, "Posting");
  350.         break;
  351.  
  352.     case ATTACH_READFILE:
  353.          backColor = RGB(0, 128, 0);        // green
  354.         strcpy (str, "Reading file");
  355.         break;
  356.     }
  357.  
  358.     len = lstrlen(str);
  359.     // Create colored rectangle behind text
  360.     SetRect (&aRect, HTEXT2, YOFFSET+YSPACE, HTEXT2 + 20*StatusCharWidth, 
  361.              YOFFSET+YSPACE + StatusLineHeight+1);
  362.     
  363.     SetTextColor (hDC, RGB(0,0,0));
  364.     SetBkColor (hDC, backColor);
  365.  
  366.     // center the text in the rectangle
  367.     GetTextExtentPoint (hDC, str, len, &size);
  368.     ExtTextOut (hDC, HTEXT2 + (20*StatusCharWidth - size.cx)/2,
  369.                 YOFFSET+YSPACE, ETO_OPAQUE|ETO_CLIPPED, &aRect, 
  370.                 str, len, (LPINT)NULL); 
  371.  
  372.     SetTextColor (hDC, StatusTextColor);
  373.     SetBkColor (hDC, StatusBackgroundColor);
  374.  
  375. //    prevState = CodingState;
  376. }
  377.  
  378. /* ------------------------------------------------------------------------
  379.  *     Window Proc for Coding status window
  380.  *    Simple text display window w/ scroll bars
  381.  *    Associated with TypDecodeThread
  382.  *    One per decode thread, variable size, user must delete it
  383.  *
  384.  *    Mostly copied from Petzold
  385.  */
  386. long FAR PASCAL
  387. WinVnCodingWndProc  (hWnd, message, wParam, lParam)
  388.      HWND hWnd;
  389.      UINT message;
  390.      WPARAM wParam;
  391.      LPARAM lParam;
  392. {
  393.     static int   cxClient, cyClient, nVscrollPos, nVscrollMax,
  394.              nHscrollPos, nHscrollMax;
  395.     int rangeTemp;
  396.     RECT         client;
  397.     HDC          hDC;
  398.     int          i, x, y, nPaintBeg, nPaintEnd, nVscrollInc, nHscrollInc;
  399.     PAINTSTRUCT  ps;
  400.     TypTextBlock *ThisText;
  401.     int      ThisTextNum;
  402.     int       CtrlState;
  403.     
  404.     for (ThisTextNum = 0; ThisTextNum < NumStatusTexts; ThisTextNum++)
  405.         if (CodingStatusText[ThisTextNum]->hTextWnd == hWnd)
  406.             break;
  407.     
  408.     if (ThisTextNum == NumStatusTexts)
  409.         ThisTextNum = NumStatusTexts - 1;    // new status window
  410.  
  411.     ThisText = CodingStatusText[ThisTextNum];
  412.  
  413.     switch (message)
  414.     {
  415.     case WM_CREATE:
  416. //        nVscrollPos = nHscrollPos = 0;
  417.                 break;
  418.  
  419.     case WM_SIZE:
  420.         GetClientRect (hWnd, &client);
  421.         cxClient = client.right - client.left;
  422.         cyClient = client.bottom - client.top;
  423.         // nVscrollMax is # lines that won't fit in client y area
  424.         rangeTemp = ((int)(ThisText->numLines + 2) * (int)StatusLineHeight - cyClient) / (int)StatusLineHeight;
  425.         nVscrollMax = max (0, rangeTemp);
  426.         nVscrollPos = min (nVscrollPos, nVscrollMax);
  427.  
  428.         SetScrollRange (hWnd, SB_VERT, 0, nVscrollMax, FALSE);
  429.         SetScrollPos   (hWnd, SB_VERT, nVscrollPos, TRUE);
  430.  
  431.         // nHscrollMax is # chars that won't fit in client x area
  432.         rangeTemp = ((int)(ThisText->maxLineLen + 2) * (int)StatusCharWidth - cxClient) / (int)StatusCharWidth;
  433.         nHscrollMax = max (0, rangeTemp);
  434.         nHscrollPos = min (nHscrollPos, nHscrollMax);
  435.  
  436.         SetScrollRange (hWnd, SB_HORZ, 0, nHscrollMax, FALSE);
  437.         SetScrollPos   (hWnd, SB_HORZ, nHscrollPos, TRUE);
  438.         break;
  439.      
  440.     case WM_VSCROLL:
  441.         switch (wParam)
  442.         {
  443.         case SB_TOP:
  444.             nVscrollInc = -nVscrollPos;
  445.             break;
  446.     
  447.         case SB_BOTTOM:
  448.             nVscrollInc = nVscrollMax - nVscrollPos;
  449.             break;
  450.  
  451.         case SB_LINEUP:
  452.             nVscrollInc = -1;
  453.             break;
  454.     
  455.         case SB_LINEDOWN:
  456.             nVscrollInc = 1;
  457.             break;
  458.  
  459.         case SB_PAGEUP:
  460.             nVscrollInc = min (-1, -cyClient / (int)StatusLineHeight);
  461.             break;
  462.  
  463.         case SB_PAGEDOWN:
  464.             nVscrollInc = max (1, cyClient / (int)StatusLineHeight);
  465.             break;
  466.  
  467.         case SB_THUMBTRACK:
  468.             nVscrollInc = LOWORD (lParam) - nVscrollPos;
  469.             break;
  470.  
  471.         default:
  472.             nVscrollInc = 0;
  473.         }
  474.         nVscrollInc = max (-nVscrollPos,
  475.                   min (nVscrollInc, nVscrollMax - nVscrollPos));
  476.  
  477.         if (nVscrollInc != 0)
  478.         {
  479.             nVscrollPos += nVscrollInc;
  480.             ScrollWindow (hWnd, 0, -1 * (int)StatusLineHeight * nVscrollInc, NULL, NULL);
  481.             SetScrollPos (hWnd, SB_VERT, nVscrollPos, TRUE);
  482.         
  483.             UpdateWindow (hWnd);
  484.         }
  485.         break;
  486.  
  487.     case WM_HSCROLL:
  488.         switch (wParam)
  489.         {
  490.         case SB_LINEUP:
  491.             nHscrollInc = -1;
  492.             break;
  493.  
  494.         case SB_LINEDOWN:
  495.             nHscrollInc = 1;
  496.             break;
  497.  
  498.         case SB_PAGEUP:
  499.             nHscrollInc = -8;
  500.             break;            
  501.  
  502.         case SB_PAGEDOWN:
  503.             nHscrollInc = 8;
  504.             break;
  505.  
  506.         case SB_THUMBPOSITION:
  507.             nHscrollInc = LOWORD (lParam) - nHscrollPos;
  508.             break;
  509.         default:
  510.             nHscrollInc = 0;
  511.         }
  512.         nHscrollInc = max (-nHscrollPos,
  513.             min (nHscrollInc, nHscrollMax - nHscrollPos));
  514.  
  515.         if (nHscrollInc != 0)
  516.         {
  517.              nHscrollPos += nHscrollInc;
  518.              ScrollWindow (hWnd, -1 * (int)StatusCharWidth * nHscrollInc, 0, NULL, NULL);
  519.              SetScrollPos (hWnd, SB_HORZ, nHscrollPos, TRUE);
  520.  
  521.         }
  522.         break;
  523.  
  524.           case WM_PAINT:
  525.         if (ThisText->numLines == 0)
  526.             break;
  527.        
  528.         hDC = BeginPaint (hWnd, &ps);
  529.         SetBkColor (hDC, StatusBackgroundColor);
  530.         SetTextColor (hDC, StatusTextColor);
  531.         SelectObject (hDC, hStatusFont);
  532.  
  533.         nPaintBeg = max (0, (nVscrollPos + ps.rcPaint.top / (int)StatusLineHeight - 1));
  534.         nPaintEnd = min ((int)ThisText->numLines,
  535.             (nVscrollPos + ps.rcPaint.bottom / (int)StatusLineHeight));
  536.  
  537.         SetTextAlign (hDC, TA_LEFT | TA_TOP);
  538.  
  539.         for (i = nPaintBeg; i < nPaintEnd; i++)
  540.         {
  541.             x = (int)StatusCharWidth * (1 - nHscrollPos);
  542.             y = (int)StatusLineHeight * (1 - nVscrollPos + i);
  543.  
  544.             TextOut (hDC, x, y, TextBlockLine (ThisText, i), 
  545.                 lstrlen (TextBlockLine (ThisText, i)));
  546.         }
  547.  
  548. /*        GetClientRect (hWnd, &client);
  549.         cyClient = client.bottom - client.top;
  550.         cxClient = client.right - client.left;
  551. */
  552.         // nVscrollMax is # lines that won't fit in client y area
  553.         rangeTemp = ((int)(ThisText->numLines + 2) * (int)StatusLineHeight - cyClient) / (int)StatusLineHeight;
  554.         nVscrollMax = max (0, rangeTemp);
  555.         SetScrollRange (hWnd, SB_VERT, 0, nVscrollMax, TRUE);
  556.         // nHscrollMax is # chars that won't fit in client x area
  557.         rangeTemp = ((int)(ThisText->maxLineLen + 2) * (int)StatusCharWidth - cxClient) / (int)StatusCharWidth;
  558.         nHscrollMax = max (0, rangeTemp);
  559.         SetScrollRange (hWnd, SB_HORZ, 0, nHscrollMax, TRUE);
  560.  
  561.         EndPaint (hWnd, &ps);
  562.         break;
  563.  
  564.           case WM_KEYDOWN:
  565.         /* See if this key should be mapped to a scrolling event
  566.         * for which we have programmed the mouse.  If so,
  567.         * construct the appropriate mouse call and call the mouse code.
  568.         */
  569.     
  570.         CtrlState = GetKeyState (VK_CONTROL) < 0;
  571.         for (i = 0; i < NUMKEYS; i++)
  572.         {
  573.            if (wParam == key2scroll[i].wVirtKey &&
  574.             CtrlState == key2scroll[i].CtlState)
  575.            {
  576.             SendMessage (hWnd, key2scroll[i].iMessage,
  577.             key2scroll[i].wRequest, 0L);
  578.            }
  579.         }
  580.         break;
  581.  
  582.     case WM_CLOSE:
  583.         if (CodingState && ThisText->IsBusy)
  584.            MessageBox (hWnd,
  585.              "Please wait until en/decoding is complete",
  586.              "Cannot close status window", MB_OK|MB_ICONSTOP);
  587.         else
  588.            DestroyWindow (hWnd);
  589.         break;
  590.         
  591.     case WM_DESTROY:
  592.         for (i = ThisTextNum; i < NumStatusTexts; i++)
  593.             CodingStatusText[i] = CodingStatusText[i+1];
  594.         FreeTextBlock (ThisText);
  595.         NumStatusTexts--;
  596.         break;
  597.     
  598.     default:
  599.         return (DefWindowProc (hWnd, message, wParam, lParam));
  600.     }
  601.     
  602.     return (0);
  603. }
  604.  
  605.  
  606. @
  607.  
  608.  
  609. 1.6
  610. log
  611. @always-on-top option, and general cleanup for 92.6
  612. @
  613. text
  614. @d12 1
  615. a12 1
  616.  * $Id: wvcodewn.c 1.5 1994/08/11 00:09:17 jcooper Exp $
  617. d14 3
  618. a98 1
  619. #if 0
  620. a109 1
  621. #endif
  622. d350 2
  623. a351 2
  624.     for (ThisTextNum = 0; ThisTextNum < numStatusTexts; ThisTextNum++)
  625.         if (codingStatusText[ThisTextNum]->hTextWnd == hWnd)
  626. d354 2
  627. a355 2
  628.     if (ThisTextNum == numStatusTexts)
  629.         ThisTextNum = numStatusTexts - 1;    // new status window
  630. d357 1
  631. a357 1
  632.     ThisText = codingStatusText[ThisTextNum];
  633. d529 1
  634. a529 1
  635.         if (CodingState)
  636. d538 2
  637. a539 2
  638.         for (i = ThisTextNum; i < numStatusTexts; i++)
  639.             codingStatusText[i] = codingStatusText[i+1];
  640. d541 1
  641. a541 1
  642.         numStatusTexts--;
  643. @
  644.  
  645.  
  646. 1.5
  647. log
  648. @Enhancements to Mime and article encoding/encoding
  649. @
  650. text
  651. @d12 1
  652. a12 1
  653.  * $Id: wvcodewn.c 1.4 1994/07/25 20:13:40 jcooper Exp $
  654. d14 3
  655. a29 2
  656. #include <stdio.h>
  657. #include <stdlib.h>
  658. a31 1
  659. #include <string.h>
  660. d34 4
  661. d55 1
  662. a56 1
  663.     RECT         client;
  664. d67 10
  665. d79 18
  666. d98 2
  667. d107 2
  668. d138 1
  669. a138 1
  670.  
  671. @
  672.  
  673.  
  674. 1.4
  675. log
  676. @execution of decoded files
  677. @
  678. text
  679. @d8 1
  680. a8 1
  681.  * Author: John S. Cooper (jcoop@@apl.com)                           *
  682. d12 1
  683. a12 1
  684.  * $Id: wvcodewn.c 1.3 1994/02/24 21:36:10 jcoop Exp $
  685. d14 3
  686. d66 6
  687. a71 3
  688.         GetWindowRect (hWnd, &client);
  689.             MoveWindow (hWnd, client.left, client.top, STATUSWIDTH,
  690.                            STATUSHEIGHT, TRUE);
  691. @
  692.  
  693.  
  694. 1.3
  695. log
  696. @jcoop changes
  697. @
  698. text
  699. @d12 1
  700. a12 1
  701.  * $Id: wvcodewn.c 1.2 1994/01/24 17:40:28 jcoop Exp $
  702. d14 3
  703. d305 1
  704. d427 1
  705. a427 1
  706.      case WM_PAINT:
  707. d465 18
  708. @
  709.  
  710.  
  711. 1.2
  712. log
  713. @90.2 changes
  714. @
  715. text
  716. @d12 1
  717. a12 1
  718.  * $Id: wvcodewn.c 1.1 1994/01/16 12:10:59 jcoop Exp $
  719. d14 3
  720. d61 2
  721. a62 2
  722.             MoveWindow (hWnd, client.left, client.top, 85 * StatusCharWidth, 
  723.                     9 * StatusLineHeight, TRUE);
  724. d89 1
  725. a89 1
  726.         else
  727. d102 2
  728. a103 2
  729.  *     Routines for drawing coding block status window
  730.  *    2 columns, 3 lines
  731. d105 5
  732. a109 5
  733.  *    HTITLE1       HTEXT1        HTITLE2  HTEXT2
  734.  *    !             !             !        !
  735.  *    Retrieving    ___________   Sequence ___________
  736.  *    Lines Read    __________    Activity ___________
  737.  *    Bytes Decoded __________    
  738. d112 4
  739. a115 4
  740. #define HTITLE2 (43*StatusCharWidth)
  741. #define HTEXT1    (20*StatusCharWidth)
  742. #define HTEXT2    (56*StatusCharWidth)
  743. #define YOFFSET (int)(StatusLineHeight*1.5)
  744. a144 1
  745.     HBRUSH hBrOld;
  746. d146 1
  747. d149 1
  748. a149 1
  749.         strcpy (str, "Name unknown");
  750. d155 1
  751. a155 1
  752.             sprintf(temp, "%-20.20s", str);
  753. d160 1
  754. a160 1
  755.             sprintf(temp, "%-20.20s", str); 
  756. d164 4
  757. a167 4
  758.     hBrOld = SelectObject(hDC, hStatusBackgroundBrush);
  759.     PatBlt (hDC, HTEXT1, YOFFSET, HTITLE2-HTEXT1-1, YSPACE-1, PATCOPY);
  760.     TextOut (hDC, HTEXT1, YOFFSET, temp, lstrlen(temp)); 
  761.     SelectObject(hDC, hBrOld);
  762. d173 1
  763. d175 4
  764. a178 2
  765.     len = sprintf (str, "%-20lu", currentCoded->numLines);
  766.     TextOut (hDC, HTEXT1, YOFFSET + YSPACE, str, len);
  767. d184 1
  768. d186 1
  769. a186 1
  770.     len = sprintf (str, "%-20lu", currentCoded->numBytes);
  771. d188 3
  772. d196 1
  773. d202 1
  774. a202 1
  775.         len = sprintf (str, "%-20.20s", "Unknown");
  776. d204 5
  777. a208 2
  778.         len = sprintf (str, "%-20d", currentCoded->sequence);
  779.     TextOut (hDC, HTEXT2, YOFFSET, str, len);
  780. a214 1
  781.     HBRUSH hBrOld, hBr;
  782. d216 3
  783. a218 1
  784.     
  785. d225 2
  786. a226 2
  787.          backColor = RGB(200, 0, 0);             // red
  788.         strcpy (str, "      Skipping");
  789. d230 2
  790. a231 2
  791.          backColor = RGB(0, 200, 200);           // purple?
  792.         strcpy (str, "   Getting table");
  793. d235 2
  794. a236 2
  795.          backColor = RGB(0, 200, 0);             // green
  796.         strcpy (str, "      Decoding");
  797. d240 2
  798. a241 2
  799.          backColor = RGB(0, 200, 0);        // green
  800.         strcpy (str, "      Encoding");
  801. d245 1
  802. a245 1
  803.          backColor = RGB(210, 210, 0);        // yellow
  804. d247 1
  805. a247 1
  806.            strcpy (str, "  Creating review");
  807. d249 1
  808. a249 1
  809.            strcpy (str, "      Posting");
  810. d253 2
  811. a254 2
  812.          backColor = RGB(0, 200, 0);        // green
  813.         strcpy (str, "    Reading file");
  814. d258 5
  815. a262 4
  816.     hBr = CreateSolidBrush(backColor);
  817.     hBrOld = SelectObject(hDC, hBr);
  818.     PatBlt(hDC, HTEXT2, YOFFSET+YSPACE, 20*StatusCharWidth, StatusLineHeight+1, PATCOPY);
  819.  
  820. d265 7
  821. a271 2
  822.     TextOut (hDC, HTEXT2, YOFFSET + YSPACE, str, strlen(str));
  823.     DeleteObject (SelectObject(hDC, hBrOld));
  824. @
  825.  
  826.  
  827. 1.1
  828. log
  829. @Initial revision
  830. @
  831. text
  832. @d12 5
  833. a16 2
  834.  * $Id: $
  835.  * $Log: $
  836. d81 10
  837. d287 1
  838. a287 1
  839.         ThisTextNum = numStatusTexts - 1;
  840. d442 9
  841. @
  842.