home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / turbopas / gtmous13.zip / GTMOUSE.TXT < prev    next >
Text File  |  1993-07-07  |  7KB  |  160 lines

  1. {▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒}
  2. {▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒UNIT GTMouse.pas ver 1.3, date 07-07-93▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒}
  3. {▒▒ (c) Copyright JINR, Dubna, 1992,1993 by I.Evsikov, S.Shmakov, P.Sychov ▒▒}
  4. {▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒}
  5.  
  6. {$R-,L-,D-,S-,F-,V-,A+,O+,I+,B-,E-,N-,G-}
  7.  
  8. UNIT GTMouse;
  9.  
  10. interface
  11.  
  12. Type
  13.  
  14.  tDisplay     = (VGA,EGA,NogrMouse);
  15.  imageArray = array[0..15] of byte;
  16.  ImageNames = (
  17.                          NormalArrow, DragArrow,
  18.                          DragArrowL,  DragArrowR,
  19.                          ClockArrow,  HandArrow,
  20.                          Hand1Arrow,  Clock2Arrow,
  21.                          Hand2Arrow,  BigArrow,
  22.                          SU29Arrow,   Hand3Arrow,
  23.                          PencilArrow, FootArrow,
  24.                          PlusArrow,   Big2Arrow,
  25.                          SightArrow,  UserArrow);
  26.  
  27.  dPoint=record
  28.    X:WORD;
  29.    Y:WORD;
  30.  end;
  31.  
  32. const
  33.  
  34. {$IfNDef VER70}
  35.  SEGB800        : word = $B800;   { For Protected mode compatible           }
  36.  SEGA000        : word = $A000;
  37.  SEG0040        : word = $0040;
  38. {$EndIf}
  39.  
  40.  grMouse        : boolean = false;
  41.  grShow         : boolean = false;      { True if arrow curros is visible    }
  42.  _ScreenWidth   : integer = 80;         { Screen Width                       }
  43.  _ScreenHeight  : integer = 25;         { Screen Height                      }
  44.  _ButtonCount   : integer = 0;          { The number of Mouse Buttons        }
  45.  
  46. var
  47.  
  48.  crMouseStatus  : byte;
  49.  ImageNoPressed : ImageNames;
  50.  ImagePressed   : ImageNames;
  51.  DisplayType    : tDisplay;
  52.  _VideoSegment  : WORD;                 { Segment of Video Memory for init   }
  53.  _MouseWhere    : dPoint;               { Current Mouse position             }
  54.  _MouseWindow   : dPoint;               { Current Window mouse               }
  55.  Sleepper       : boolean;
  56.  grMouseWhere   : dPoint;
  57.  
  58. {                            MAIN PROCEDURES                                 }
  59. {                            ---------------                                 }
  60.  
  61.  
  62.  
  63. Procedure InitGtMouse;
  64.  
  65. {     Reactivate GTMouse.                                                    }
  66. {     Detect mouse driver, reinitiate Arrow Mouse, set Event  Handler,       }
  67. {     initiate variables, select default Mouse Image etc.                    }
  68. {     GTMouse initiates automatically, so this procedure is nessesary only   }
  69. {     after deactivating of GTMouse by DoneMouse.                            }
  70.  
  71.  
  72. Procedure DoneGtMouse;
  73.  
  74. {     Deactivate GTMouse CORRECTLY.                                          }
  75. {     Use this procedure before exit to DOS or start child process           }
  76. {     or before any screen mode changing                                     }
  77.  
  78.  
  79.  
  80. Procedure DrawArrow;
  81.  
  82. {     Redraw mouse cursor.                                                   }
  83. {     GTMouse call this procedure at any timer tick (about 18 times per sec) }
  84. {     To improve the smoothnes of cursor movement include this procedure     }
  85. {     to any event wait cycle of your program                                }
  86.  
  87.  
  88. Procedure ShowGtMouse;
  89.  
  90. {     Show mouse cursor                                                      }
  91.  
  92.  
  93. Procedure HideGtMouse;
  94.  
  95. {     Hide mouse cursor                                                      }
  96.  
  97.  
  98. {                           ADDITIONAL PROCEDURES                            }
  99.  
  100.  
  101.  
  102. Procedure SelectNotPressedImage( NameOfImage : ImageNames);
  103.  
  104. {     Select new notpressed mouse cursor image.                              }
  105. {     For example:                                                           }
  106. {             SelectNotPressedImage(FootArrow);                              }
  107.  
  108.  
  109.  
  110. Procedure SelectPressedImage( NameOfImage : ImageNames);
  111.  
  112. {     Select new pressed mouse cursor image.                                 }
  113. {     For example:                                                           }
  114. {                        ...                                                 }
  115. {                        SelectPressedImage(ClockArrow);                     }
  116.  
  117.  
  118.  
  119. Procedure SetNewCharacters( var CharSet);
  120.  
  121. {     Set new Character Array for mouse cursor building.                     }
  122. {     Parameter is 8-bytes array of chars.                                   }
  123. {     This array is used to construct the grahics mouse cursor form          }
  124. {     as superposition of four characters adjacent to mouse position         }
  125. {     and mouse cursor image. Eight symbols are used because of VGA          }
  126. {     peculiarities in text mode. Last four symbols must be in pseudo        }
  127. {     graphics range ($c0..$df), first ones have not to be in this range.    }
  128. {     You have to avoid usage of these symbols on your screen images.        }
  129. {     Null symbol at any position means not to change this symbol.           }
  130. {     Default array is (^A,^B,^C,^D,'╨','╥','╫','╪').                        }
  131. {     For example:                                                           }
  132. {         CONST newarray : Array[1..8] of Char =                             }
  133. {                                   (^A,^B,^C,^T,'╠','═','╬','╧');           }
  134. {            ...                                                             }
  135. {          (*Hide mouse cursor befor set new characters*)                    }
  136. {            SetNewCharacters(newarray);                                     }
  137.  
  138.  
  139.  
  140. Procedure LinkUserImageWith(
  141.                ArrowName                 : ImageNames;
  142.                var UserImage             : ImageArray);
  143.  
  144. {     Define User Mouse Cursor Image with ArrowName from ImageNames.         }
  145. {     Example:                                                               }
  146. {     CONST MyArrow : ImageArray =                                           }
  147. {       ($00,$00,$18,$18,$18,$18,$00,$C3,$00,$18,$18,$18,$18,$00,$00,$00);   }
  148. {                        ...                                                 }
  149. {       LinkUserImageWith(UserArrow,MyArrow);                                }
  150. {       SelectNotPressedImage(UserArrow);                                    }
  151.  
  152. procedure InitSleepper( TimeDelay,
  153.                         LeftUpX,  LeftUpY,
  154.                         RightDnX, RightDnY : integer);
  155. {    Init "Sleep" coordinates and time (sec) without event to sleep Screen   }
  156. {    By Default:   InitSleeper(30,80,1,80,1);                                }
  157. {     Example:                                                               }
  158. {                        ...                                                 }
  159. {        InitSleepper(10,1,25,80,25);                                           }
  160.