!+
!	NO_WRITE.TPU	 - Routine to mark a buffer as NO_WRITE and cause
!			   status line to blink for all NO_WRITE buffers.
!-
procedure eve_set_nowrite	! Write enable buffer

    local buffer_name;

    if (get_info (current_buffer, "system") = 0) then
        buffer_name := get_info(current_buffer,"name");
        set(no_write, current_buffer, on);
        message("Buffer " + buffer_name + " is write locked.");
        eve$update_status_lines;
    endif;

endprocedure;

procedure eve_set_write		! Write lock buffer

    local buffer_name;

    if (get_info (current_buffer, "system") = 0) then
        buffer_name := get_info(current_buffer,"name");
        set(no_write, current_buffer, off);
        message("Buffer " + buffer_name + " is write enabled.");
        eve$update_status_lines;
    endif;

endprocedure;
! Set status line of a window to include buffer name and mode indications.
! Used primarily to indicate insert/overstrike and forward/reverse toggling.
!
! Parameters:
!
!	this_window		Window whose status line is being set - input

procedure eve$set_status_line (this_window)	! Set buffer status line

local this_buffer,		! Current buffer
      mode_string,		! String version of current mode
      direction_string,		! String version of current direction
      buffer_name;		! String containing name of current buffer

this_buffer := get_info (this_window, "buffer");

! Don't add a status line to windows without a status line

if (this_buffer = 0) or (get_info (this_window, "status_line") = 0) then
    return;
endif;

if get_info (this_buffer, "mode") = insert then
    mode_string := "Insert    ";
else
    mode_string := "Overstrike";
endif;

if get_info (this_buffer, "direction") = reverse then
    direction_string := "Reverse";
else
    direction_string := "Forward";
endif;

buffer_name := get_info (this_buffer, "name");
if length (buffer_name) > eve$x_max_buffer_name_length then
    buffer_name := substr (buffer_name, 1, eve$x_max_buffer_name_length);
else
    buffer_name := buffer_name +
		   substr (eve$x_spaces, 1,
			   eve$x_max_buffer_name_length - length (buffer_name));
endif;

if (get_info (this_buffer, "no_write")) and
   (get_info (this_buffer, "system") = 0) then
    set (status_line, this_window, bold, "X");
    set (status_line, this_window, underline, "X");
else
    set (status_line, this_window, none, "X");
endif;

set (status_line, this_window, reverse,
     " Buffer " + buffer_name + "    " + mode_string + "    " +
     direction_string);

endprocedure;
