home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / cursor / cursor42.pas < prev   
Pascal/Delphi Source File  |  1988-09-30  |  5KB  |  103 lines

  1. { =========================================================================== }
  2. { Cursor42.pas - Restores cursor for any video card.        ver 4.2, 10-01-88 }
  3. { by  James H. LeMay, CIS 76011,217                                           }
  4. { for Eagle Performance Software                                              }
  5. {     P.O. Box 122237                                                         }
  6. {     Ft. Worth, TX 76121                                                     }
  7. {     (817)-735-4833                                                          }
  8. {                                                                             }
  9. { This program will let you restore your cursor automatically on whatever     }
  10. { system you have:                                                            }
  11. {                                                                             }
  12. {   Usage: Cursor                               << Underline cursor           }
  13. {          Cursor [-bh?]                        << Block cursor or help       }
  14. {          Cursor [TopScanLine BottomScanLine]  << Custom shape               }
  15. {   No parameters makes an underline cursor.                                  }
  16. {   -b makes a block cursor.                                                  }
  17. {   Two decimal parameters shape the scan lines.                              }
  18. {   Anything else just displays the usage.                                    }
  19. {   The "-" and "/" are optional
  20. {                                                                             }
  21. { For more information on cursor shapes for different video devices, get      }
  22. { QWIK42.ARC.  QWIK.TPU is required to compile this program which is also in  }
  23. { QWIK42.ARC.  This source code is public domain, but QWIK is shareware.      }
  24. { QWIK is initialized in the unit and detects your video system including:    }
  25. {                                                                             }
  26. {    IBM PC, XT, AT, PCjr, PC convertible, all PS/2 models, 3270 PC.          }
  27. {    MDA, CGA, EGA, MCGA, VGA, 8214/A, all Hercules.                          }
  28. {    And all compatibles.                                                     }
  29. {    Operating in all text modes, column modes, and row modes.                }
  30. {                                                                             }
  31. { QWIK turns on the cursor emulation mode for the VGA.                        }
  32. {                                                                             }
  33. { EXAMPLES:                                                                   }
  34. {   cursor -b                  << Restores block cursor                       }
  35. {   cursor -h                  << Displays help                               }
  36. {   cursor 0 13                << Makes a block-type cursor (MDA)             }
  37. {
  38. {                                                                             }
  39. { Revisions:                                                                  }
  40. {   Version 1.1, 04-08-88                                                     }
  41. {     . Accounted for CGA emulation on EGA with CheckCgaEmulation.            }
  42. {   Version 5.0, 08-01-88                                                     }
  43. {     . Revised program for QWIK42.TPU                                        }
  44. { =========================================================================== }
  45.  
  46. program RestoreCursor;
  47.  
  48. {$M 1500, 0, 0}
  49. {$R-,S-,I-,D-,T-,F-,V-,B-,N-,L+ }
  50.  
  51. uses Qwik;  { QWIK.TPU is found in QWIK42.ARC or a later version. }
  52.  
  53. var
  54.   BottomScanLine,TopScanLine: byte;
  55.   CursorMode:                 word absolute BottomScanLine;
  56.   ParameterError:             boolean;
  57.   Attr:                       integer;
  58.  
  59. procedure GetBlockCursor;
  60. var P: string[10];
  61. begin
  62.   P := ParamStr(1);
  63.   if (pos('b',P)>0) or (pos('B',P)>0) then
  64.        CursorMode := CursorBlock
  65.   else ParameterError:=true;  { Show command usage. }
  66. end;
  67.  
  68. procedure GetCustomCursor;
  69. var  Error1,Error2: integer;
  70. begin
  71.   val (ParamStr(1),TopScanLine   ,Error1);
  72.   val (ParamStr(2),BottomScanLine,Error2);
  73.   if Error1+Error2<>0 then
  74.     ParameterError:=true;  { Show command usage. }
  75. end;
  76.  
  77. begin
  78.   ParameterError:=false;
  79.   case ParamCount of
  80.     0: CursorMode := CursorUnderline;
  81.     1: GetBlockCursor;
  82.     2: GetCustomCursor;
  83.   else ParameterError := true;
  84.   end;
  85.   if ParameterError then
  86.     begin
  87.       ScrollAttr := QreadAttr (WhereR,WhereC);
  88.       Attr       := ScrollAttr;
  89.       EosToCursor;
  90.       QwriteEos (Attr,'CURSOR 4.2 (c) 1988 Eagle Performance Software');QEosLn;
  91.       QwriteEos (Attr,'Restores default cursor on any system.');        QEosLn;
  92.       QwriteEos (Attr,'Usage: Cursor');                                 QEosLn;
  93.       QwriteEos (Attr,'       Cursor [-bh?]');                          QEosLn;
  94.       QwriteEos (Attr,'       Cursor [TopScanLine BottomScanLine]');    QEosLn;
  95.       QwriteEos (Attr,'No parameters makes an underline cursor.');      QEosLn;
  96.       QwriteEos (Attr,'-b makes a block cursor.');                      QEosLn;
  97.       QwriteEos (Attr,'Two decimal parameters shape the scan lines.');  QEosLn;
  98.       GotoEos;
  99.     end
  100.   else
  101.     SetCursor (CursorMode);
  102. end.
  103.