home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / tvision / gtmous / gtmouse.txt < prev    next >
Encoding:
Text File  |  1993-09-30  |  6.8 KB  |  164 lines

  1. {▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒}
  2. {▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒UNIT GTMouse.pas ver 1.40, date 30-09-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.  ReturnVGA      : boolean = false;      { True if VGA convert to EGA mode    }
  46.  AnyEvent       : boolean = false;      { if true not sleep                  }
  47.  
  48. var
  49.  
  50.  crMouseStatus  : byte;
  51.  ImageNoPressed : ImageNames;
  52.  ImagePressed   : ImageNames;
  53.  DisplayType    : tDisplay;
  54.  _VideoSegment  : WORD;                 { Segment of Video Memory for init   }
  55.  _MouseWhere    : dPoint;               { Current Mouse position             }
  56.  _MouseWindow   : dPoint;               { Current Window mouse               }
  57.  grMouseWhere   : dPoint;
  58.  crTimer        : ^longint;
  59.  olTimer        : longint;
  60.  lsTimer        : longInt;
  61.  dlTimer        : longint;
  62.  
  63. {                            MAIN PROCEDURES                                 }
  64. {                            ---------------                                 }
  65.  
  66.  
  67.  
  68. Procedure InitGtMouse;
  69.  
  70. {     Reactivate GTMouse.                                                    }
  71. {     Detect mouse driver, reinitiate Arrow Mouse, set Event  Handler,       }
  72. {     initiate variables, select default Mouse Image etc.                    }
  73. {     GTMouse initiates automatically, so this procedure is nessesary only   }
  74. {     after deactivating of GTMouse by DoneMouse.                            }
  75.  
  76.  
  77. Procedure DoneGtMouse;
  78.  
  79. {     Deactivate GTMouse CORRECTLY.                                          }
  80. {     Use this procedure before exit to DOS or start child process           }
  81. {     or before any screen mode changing                                     }
  82.  
  83.  
  84.  
  85. Procedure DrawArrow;
  86.  
  87. {     Redraw mouse cursor.                                                   }
  88. {     GTMouse call this procedure at any timer tick (about 18 times per sec) }
  89. {     To improve the smoothnes of cursor movement include this procedure     }
  90. {     to any event wait cycle of your program                                }
  91.  
  92.  
  93. Procedure ShowGtMouse;
  94.  
  95. {     Show mouse cursor                                                      }
  96.  
  97.  
  98. Procedure HideGtMouse;
  99.  
  100. {     Hide mouse cursor                                                      }
  101.  
  102.  
  103. {                           ADDITIONAL PROCEDURES                            }
  104.  
  105. Procedure SetVGA8x16;
  106.  
  107. {Symbols in VGA have 8x16 dots, but really                                   }
  108. {each character on the screen occupies 9x16 dots. VGA "glues" neighbour      }
  109. {semigraphical characters (in the range $C0-$DF) to supply contiguity of     }
  110. {the horizontal lines by inserting an additional point(s) in the             }
  111. {place(s) where these chars occupy rightmost (8-th) pixel(s). This           }
  112. {procedure set VGA mode 8x16 dots.                                           }
  113.  
  114.  
  115. Procedure SelectNotPressedImage( NameOfImage : ImageNames);
  116.  
  117. {     Select new notpressed mouse cursor image.                              }
  118. {     For example:                                                           }
  119. {             SelectNotPressedImage(FootArrow);                              }
  120.  
  121.  
  122.  
  123. Procedure SelectPressedImage( NameOfImage : ImageNames);
  124.  
  125. {     Select new pressed mouse cursor image.                                 }
  126. {     For example:                                                           }
  127. {                        ...                                                 }
  128. {                        SelectPressedImage(ClockArrow);                     }
  129.  
  130.  
  131.  
  132. Procedure SetNewCharacters( var CharSet);
  133.  
  134. {     Set new Character Array for mouse cursor building.                     }
  135. {     Parameter is 8-bytes array of chars.                                   }
  136. {     This array is used to construct the grahics mouse cursor form          }
  137. {     as superposition of four characters adjacent to mouse position         }
  138. {     and mouse cursor image. Eight symbols are used because of VGA          }
  139. {     peculiarities in text mode. Last four symbols must be in pseudo        }
  140. {     graphics range ($c0..$df), first ones have not to be in this range.    }
  141. {     You have to avoid usage of these symbols on your screen images.        }
  142. {     Null symbol at any position means not to change this symbol.           }
  143. {     Default array is (^A,^B,^C,^D,'╨','╥','╫','╪').                        }
  144. {     For example:                                                           }
  145. {         CONST newarray : Array[1..8] of Char =                             }
  146. {                                   (^A,^B,^C,^T,'╠','═','╬','╧);            }
  147. {            ...                                                             }
  148. {          (*Hide mouse cursor befor set new characters*)                    }
  149. {            SetNewCharacters(newarray);                                     }
  150.  
  151.  
  152.  
  153. Procedure LinkUserImageWith(
  154.                ArrowName                 : ImageNames;
  155.                var UserImage             : ImageArray);
  156.  
  157. {     Define User Mouse Cursor Image with ArrowName from ImageNames.         }
  158. {     Example:                                                               }
  159. {     CONST MyArrow : ImageArray =                                           }
  160. {       ($00,$00,$18,$18,$18,$18,$00,$C3,$00,$18,$18,$18,$18,$00,$00,$00);   }
  161. {                        ...                                                 }
  162. {       LinkUserImageWith(UserArrow,MyArrow);                                }
  163. {       SelectNotPressedImage(UserArrow);                                    }
  164.