home *** CD-ROM | disk | FTP | other *** search
/ POINT Software Programming / PPROG1.ISO / pascal / gtmouse / gtmouse.txt < prev    next >
Encoding:
Text File  |  1993-02-27  |  5.4 KB  |  142 lines

  1. {▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒}
  2. {▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ UNIT GTMouse.pas v.1.1▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒}
  3. {▒▒  (c) 1993 Copyright JINR, Dubna  by I. Evsikov, S. Shmakov, P. Sychov  ▒▒}
  4. {▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒}
  5.  
  6. UNIT GTMouse;
  7.  
  8. interface
  9.  
  10. uses DOS;
  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.  UpperHandler   : pointer = nil;
  35.  SaveHandle     : pointer=nil;
  36.  grMouse        : boolean = false;
  37.  grShow         : boolean = false;      { True if arrow curros is visible    }
  38.  _ScreenWidth   : integer = 80;         { Screen Width                       }
  39.  _ScreenHeight  : integer = 25;         { Screen Height                      }
  40.  _ButtonCount   : integer = 0;
  41.  
  42. var
  43.  
  44.  crMouseStatus  : byte;
  45.  ImageNoPressed : ImageNames;
  46.  ImagePressed   : ImageNames;
  47.  DisplayType    : tDisplay;
  48.  _VideoSegment  : WORD;   {Segment of Video Memory                         }
  49.  _MouseWhere    : dPoint;         { Current Mouse position }
  50.  
  51.  
  52.  
  53. {                            MAIN PROCEDURES                                 }
  54. {                            ---------------                                 }
  55.  
  56.  
  57.  
  58. Procedure InitGtMouse; 
  59.  
  60. {     Reactivate GTMouse.                                                    }
  61. {     Detect mouse driver, reinitiate Arrow Mouse, set Event  Handler,       } 
  62. {     initiate variables, select default Mouse Image etc.                    }
  63. {     GTMouse initiates automatically, so this procedure is nessesary only   }
  64. {     after deactivating of GTMouse by DoneMouse.                            } 
  65.  
  66.  
  67. Procedure DoneGtMouse;
  68.  
  69. {     Deactivate GTMouse CORRECTLY.                                          }
  70. {     Use this procedure before exit to DOS or start child process           }
  71. {     or before any screen mode changing                                     }
  72.  
  73.  
  74.  
  75. Procedure DrawArrow; 
  76.  
  77. {     Redraw mouse cursor.                                                   }
  78. {     GTMouse call this procedure at any timer tick (about 18 times per sec) }
  79. {     To improve the smoothnes of cursor movement include this procedure     }
  80. {     to any event wait cycle of your program                                }
  81.  
  82.  
  83.  
  84.  
  85.  
  86. {                           ADDITIONAL PROCEDURES                            }
  87.  
  88.  
  89.  
  90. Procedure SelectNotPressedImage( NameOfImage : ImageNames);
  91.  
  92. {     Select new notpressed mouse cursor image.                              }
  93. {     For example:                                                           }
  94. {             SelectNotPressedImage(FootArrow);                              }
  95.  
  96.  
  97.  
  98. Procedure SelectPressedImage( NameOfImage : ImageNames); 
  99.  
  100. {     Select new pressed mouse cursor image.                                 }
  101. {     For example:                                                           }
  102. {                        ...                                                 }
  103. {                        SelectPressedImage(ClockArrow);                     }
  104.  
  105.  
  106.  
  107. Procedure SetNewCharacters( var CharSet);
  108.  
  109. {     Set new Character Array for mouse cursor building.                     }
  110. {     Parameter is 8-bytes array of chars.                                   }
  111. {     This array is used to construct the grahics mouse cursor form          }
  112. {     as superposition of four characters adjacent to mouse position         }
  113. {     and mouse cursor image. Eight symbols are used because of VGA          }
  114. {     peculiarities in text mode. Last four symbols must be in pseudo        }
  115. {     graphics range ($c0..$df), first ones have not to be in this range.    }
  116. {     You have to avoid usage of these symbols on your screen images.        }
  117. {     Null symbol at any position means not to change this symbol.           }
  118. {     Default array is (^A,^B,^C,^D,'╨','╥','╫','╪').                        }
  119. {     For example:                                                           }
  120. {         CONST newarray : Array[1..8] of Char =                             }
  121. {                                   (^A,^B,^C,^T,'╠','═','╬','╧);            }
  122. {            ...                                                             }
  123. {          (*Hide mouse cursor befor set new characters*)                    }
  124. {            SetNewCharacters(newarray);                                     }
  125.  
  126.  
  127.  
  128. Procedure LinkUserImageWith(
  129.                ArrowName                 : ImageNames;
  130.                var UserImage             : ImageArray);
  131.  
  132. {     Define User Mouse Cursor Image with ArrowName from ImageNames.         }
  133. {     Example:                                                               }
  134. {     CONST MyArrow : ImageArray =                                           }
  135. {       ($00,$00,$18,$18,$18,$18,$00,$C3,$00,$18,$18,$18,$18,$00,$00,$00);   }
  136. {                        ...                                                 }
  137. {       LinkUserImageWith(UserArrow,MyArrow);                                }
  138. {       SelectNotPressedImage(UserArrow);                                    }
  139.  
  140.  
  141.  
  142.