home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 15 / CD_ASCQ_15_070894.iso / vrac / 4utils83.zip / DMOUSE.PAS < prev    next >
Pascal/Delphi Source File  |  1994-04-28  |  3KB  |  102 lines

  1. UNIT dmouse;
  2. {$F+}  (* FAR calls are required for the mouse. *)
  3.  
  4. (* ----------------------------------------------------------------------
  5.    Part of 4DESC - A Simple 4DOS File Description Editor
  6.  
  7.    (c) Copyright 1993 by
  8.  
  9.        David Frey,         & Tom Bowden
  10.        Urdorferstrasse 30    1575 Canberra Drive
  11.        8952 Schlieren ZH     Stone Mountain, GA 30088-3629
  12.        Switzerland           USA
  13.  
  14.        Code created using Turbo Pascal 6.0 (c) Borland International 1990
  15.  
  16.    DISCLAIMER: This unit is freeware: you are allowed to use, copy
  17.                and change it free of charge, but you may not sell or hire
  18.                this part of 4DESC. The copyright remains in our hands.
  19.  
  20.                If you make any (considerable) changes to the source code,
  21.                please let us know. (send a copy or a listing).
  22.                We would like to see what you have done.
  23.  
  24.                We, David Frey and Tom Bowden, the authors, provide absolutely
  25.                no warranty of any kind. The user of this software takes the
  26.                entire risk of damages, failures, data losses or other
  27.                incidents.
  28.  
  29.    This unit handles the (very rudimentary) mouse functions of 4DESC.
  30.  
  31.    ----------------------------------------------------------------------- *)
  32.  
  33.  
  34. INTERFACE USES Dos;
  35.  
  36. CONST  Left  = 0;  (* Mouse buttons *)
  37.        Right = 1;
  38.  
  39. VAR    UseMouse     : BOOLEAN;
  40.  
  41. VAR    Regs         : Registers;
  42.        MouseLoaded  : Boolean;     (* TRUE if mouse driver is active *)
  43.        ReleaseCount : Integer;     (* Number of button releases *)
  44.        VMickey      : Integer;     (* Vertical mouse movement in mickeys *)
  45.        HMickey      : Integer;     (* Horizontal mouse movement in mickeys *)
  46.        VMickeysPerKeyPress: INTEGER; (* After a move of
  47.                                         VMickeysPerKeyPress mickeys an
  48.                                         up/down keypress will be emulated *)
  49.        HMickeysPerKeyPress: INTEGER; (* After a move of
  50.                                         VMickeysPerKeyPress mickeys an
  51.                                         up/down keypress will be emulated *)
  52.  
  53. PROCEDURE MouseReset;
  54. PROCEDURE ButtonReleased (Button : INTEGER);
  55. PROCEDURE MouseMotion;
  56.  
  57. PROCEDURE EvaluateINIFileSettings;
  58.  
  59. IMPLEMENTATION USES HandleINIFile;
  60.  
  61. PROCEDURE MouseReset;
  62. BEGIN
  63.   Regs.ax := 0;
  64.   Intr ($33, Regs);        (* The mouse driver uses interrupt $33 *)
  65.   IF Regs.ax <> 0 THEN
  66.       MouseLoaded := TRUE
  67.   ELSE
  68.       MouseLoaded := FALSE;
  69. END; (* MouseReset *)
  70.  
  71.  
  72. PROCEDURE ButtonReleased;
  73. BEGIN
  74.   Regs.ax := 6;
  75.   Regs.bx := Button;
  76.   Intr ($33, Regs);
  77.   ReleaseCount := Regs.bx;
  78. END; (* ButtonReleased *)
  79.  
  80.  
  81. PROCEDURE MouseMotion;
  82. BEGIN
  83.   Regs.ax := 11;
  84.   Intr ($33, Regs);
  85.   VMickey := Regs.dx;
  86.   HMickey := Regs.cx;
  87. END; (* MouseMotion *)
  88.  
  89. PROCEDURE EvaluateINIFileSettings;
  90.  
  91. VAR s: STRING;
  92.  
  93. BEGIN
  94.   VMickeysPerKeyPress := ReadSettingsInt('mouse','VMickeysPerKeypress',2);
  95.   HMickeysPerKeyPress := ReadSettingsInt('mouse','HMickeysPerKeypress',2);
  96.  
  97.   s := ReadSettingsChar('mouse','UseMouse','y');
  98.   UseMouse := (s[1] = 'y');
  99. END;
  100.  
  101. END.
  102.