{***********************************************************************}
{									}
{ __WrAttWin  Write attributes only directly to a window		}
{									}
{ procedure __WrAttWin(X,Y : byte; Count : word; Fore,Back : byte);	}
{									}
{	      X,Y	Column and row position relative to the current }
{			window where the attributes are to be written.	}
{	      Count	The number of attributes to write.		}
{	      Fore,Back Foreground and background attributes to be	}
{			written to the screen buffer.			}
{									}
{ Description __WrAttWin writes copies of the attribute specified by	}
{	      Fore and Back at the specified cursor position relative	}
{	      to the current window.  As with __WrAttScn, which this	}
{	      routine calls, only the attributes are altered, leaving	}
{	      the characters unchanged. 				}
{									}
{ Version     4.00 (C)Copyright Blaise Computing Inc.  1987		}
{_______________________________________________________________________}

procedure __WrAttWin(X,Y : byte; Count : word; Fore,Back : byte);

  var
    XOff,YOff	 : byte;
    Width,Height : byte;

  begin {__WrAttWin}

    { Determine the correct values for X, Y and Count to pass to	}
    { __WrAttScn.							}

    with _CurWindow do
      begin
	XOff   := _XUpper - 1;
	YOff   := _YUpper - 1;
	Width  := _XLower - XOff;	     { Number of legal columns	}
	Height := _YLower - YOff	     { Number of legal rows	}
      end;

    if (X < 1) then
       X := 1
    else if (X > Width) then
       Exit;
    if (Y < 1) then
       Y := 1
    else if (Y > Height) then
       Exit;

    if (Count <= 0) then
       Exit
    else if (Count > (Width - X + 1)) then
       Count := Width - X + 1;

    __WrAttScn(X + XOff,Y + YOff,Count,Fore,Back)

  end;	{__WrAttWin}
