home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 16 / 16.iso / w / w048 / 2.ddi / MSSRC.ARC / MSCURSOR.INC < prev    next >
Encoding:
Text File  |  1987-12-21  |  1.9 KB  |  61 lines

  1. {                            MSCURSOR.INC
  2.                                MS 4.0
  3.                 Copyright (c) 1985, 87 by Borland International, Inc.         }
  4.  
  5.   procedure EdGotoxy(C, R : Byte);
  6.     {-move the "cursor" to the specified row and column}
  7.  
  8.   begin                      {EdGotoxy}
  9.     if SolidCursor then
  10.       if (CurScrCol <> C) or (CurScrRow <> R) then
  11.         {Erase current cursor}
  12.         EdEraseSolidCursor;
  13.     {Keep the hardware cursor positioned even if it is invisible}
  14.     GoToXY(C, R);
  15.     CurScrCol := C;
  16.     CurScrRow := R;
  17.   end;                       {EdGotoxy}
  18.  
  19.   procedure EdUpdateCursor;
  20.     {-Move the cursor to the right spot}
  21.   var
  22.     Col : Integer;
  23.  
  24.   begin                      {EdUpdateCursor}
  25.     with Curwin^ do begin
  26.       {Position cursor within a window}
  27.       Col := EdComputeEffectiveColNo(AT, Curline, Colno);
  28.       if AT then begin
  29.         if SolidCursor then
  30.           EdSetInsertMode(Insertflag)
  31.         else if (Colno <= Curline^.Bufflen) and (PrintMap[Curline^.Txt^[Colno]] <> PrtNone) then
  32.           {Use a solid block to indicate control char}
  33.           EdSetCursor(CenterCursor)
  34.         else
  35.           EdSetInsertMode(Insertflag);
  36.       end else
  37.         EdSetInsertMode(Insertflag);
  38.  
  39.       EdGotoxy(Succ(Col-Leftedge+Leftcol), Pred(Firsttextno+Lineno));
  40.     end;
  41.     UpdateCursor := False;
  42.   end;                       {EdUpdateCursor}
  43.  
  44.   procedure EdSetInsertMode(Inserting : Boolean);
  45.     {-Keep the cursor appearance and BIOS keyboard flag up to date}
  46.   var
  47.     BiosKbdFlag : Byte absolute $0040 : $0017;
  48.  
  49.   begin                      {EdSetInsertMode}
  50.     if Inserting then begin
  51.       if not(SolidCursor) then
  52.         EdSetCursor(BigCursor);
  53.       BiosKbdFlag := BiosKbdFlag or $80;
  54.     end else begin
  55.       if not(SolidCursor) then
  56.         EdSetCursor(CursorType);
  57.       BiosKbdFlag := BiosKbdFlag and $7F;
  58.     end;
  59.   end;                       {EdSetInsertMode}
  60.  
  61.