! LSE$EVE_WINDOWS.TPU ! !************************************************************************* ! * ! © Copyright 2005 Hewlett-Packard Development Company, L.P. * ! * ! Confidential computer software. Valid license from HP required for * ! possession, use or copying. Consistent with FAR 12.211 and 12.212, * ! Commercial Computer Software, Computer Software Documentation, and * ! Technical Data for Commercial Items are licensed to the U.S. * ! Government under vendor's standard commercial license. * ! * !************************************************************************* ! !++ ! FACILITY: ! VAX Language-Sensitive Editor ! ! ABSTRACT: ! This file contains superceded EVE procedures that are located in the ! file EVE$WINDOWS.TPU. ! ! ENVIRONMENT: ! VAX/VMS ! ! CREATION DATE: 21-DEC-1989 ! ! MODIFIED BY: ! ! X3.1-1 DAS 21-Dec-89 First pass. ! X3.1-2 WC3 09-Apr-90 Supercede EVE$SET_STATUS_LINE ! X4.0-1 DAS 14-Nov-91 No module/endmodule !- procedure lse$eve_windows_module_ident return "X4.0-1"; endprocedure; ! Supersede eve$set_status_line to make LSE$SET_STATUS_LINE work as documented. ! ! All the EVE code uses eve$set_status_line to update the status line. Thus, ! changing superseding LSE$SET_STATUS_LINE does not work for those command LSE ! uses EVE for. So the fix is to move the guts of eve$set_status_line to ! LSE$SET_STATUS_LINE and supersede eve$set_status_line to call ! LSE$SET_STATUS_LINE. ! ! If EVE supports edit handlers in eve$set_status_line then LSE wouldn't ! have to supersede eve$set_status_line. ! procedure eve$set_status_line( this_window ) LSE$SET_STATUS_LINE( this_window ); endprocedure; ! supersede eve$$system_window_status. Because the message for status line ! for vt100 is not grammatically correct. It was "Press up arrow or down ! arrow to see more" which turns out to ! "To see more, use:Press up arrow or down arrow to see more". ! Change it so the message to be ! "To see more, use: | Up Arrow | Down Arrow" to be compatible to vt200 series ! message. procedure eve$$sys_window_status local left_side, ! The "Buffer: " part right_side, ! The next/prev screen indicators the_width; ! Unused width in the status line left_side := eve$buffer_name_field (current_buffer); right_side := ""; the_width := get_info (current_window, "width") - (length (left_side) + 1); if get_info(current_buffer, "record_count") > get_info (current_window, "length", text) then if eve$on_a_pre_lk201 then !# LSE CHANGE ! right_side := message_text (EVE$_UPDOWNMORE); right_side := " | Up Arrow | Down Arrow "; !*** !# END LSE CHANGE else right_side := fao (eve$$x_extra_field_format, message_text (EVE$_PREVEVESCREEN)) + fao (eve$$x_extra_field_format, message_text (EVE$_NEXTSCREEN)); endif; the_width := the_width - length (right_side); if the_width < 0 then right_side := ""; else the_width := the_width - length (eve$$x_sys_window_caption); if the_width > 0 then right_side := eve$$x_sys_window_caption + right_side; endif; endif; endif; if the_width < 0 then the_width := 0; endif; return (left_side + (" " * the_width) + right_side); endprocedure; ! Superceded because LSE has a learn message window that may be hiding the ! command window. ! ! ! EVE$WINDOWS.TPU Page 4 ! Routine to position to the command window, making sure that it is mapped ! and on-screen. ! procedure eve$goto_command_window ! Pre-command window positioning on_error [TPU$_WINDNOTMAPPED]: map (eve$command_window, eve$command_buffer); position (eve$command_window); [TPU$_WINDNOTVIS]: map (eve$command_window, eve$command_buffer); position (eve$command_window); [OTHERWISE]: endon_error if eve$eve_in_control then position (eve$command_window); else return (FALSE); endif; endprocedure; ! EVE$WINDOWS.TPU Page 45 ! Procedure to move by screen - used by eve_next_screen and eve_previous_screen ! Positive numbers move forward (like next screen), negative numbers backward. ! Returns false if an error is encountered; otherwise returns true. ! ! Parameters: ! ! how_many_screens Number of screens to move - input procedure eve$move_by_screen (how_many_screens) ! Next/prev screen subprocedure local how_much_scroll, ! How many lines to scroll scroll_window, ! Window to be scrolled saved_window, ! Current window saved_window_mark, ! Current window's position saved_mark, ! Position to move from (may be choices/cmd) this_column, ! Column were in now this_row, ! Current row in scroll_window new_top, ! Temporary top scroll margin new_bottom, ! Temporary bottom scroll margin saved_scrolls, ! Boolean set if saved_scroll_xxx are valid saved_scroll_top, ! Original value of scroll_top saved_scroll_bottom, ! Original value of scroll_bottom saved_scroll_amount; ! Original value of scroll_amount on_error [TPU$_CONTROLC]: eve$$restore_position (scroll_window); if (get_info (saved_mark, "type") = MARKER) and (not eve$x_bound_cursor) then ! restore the cursor position when free cursoring position (LINE_BEGIN); ! snap cursor to column 1 if mark (NONE) = end_of (current_buffer) then cursor_horizontal (get_info (saved_mark, "offset_column") - 1); else cursor_horizontal (get_info (saved_mark, "offset_column") - get_info (mark (FREE_CURSOR), "offset_column")); endif; endif; if saved_scrolls then set (SCROLLING, scroll_window, ON, saved_scroll_top, saved_scroll_bottom, saved_scroll_amount); update (scroll_window); endif; if saved_window <> scroll_window then eve$$restore_position (saved_window, saved_window_mark); endif; eve$learn_abort; abort; [TPU$_BEGOFBUF, TPU$_ENDOFBUF]: ! Ignore beyond buffer errors, move to eve$move_by_screen := FALSE; ! boundary and continue. [OTHERWISE]: eve$$restore_position (scroll_window); if (get_info (saved_mark, "type") = MARKER) and (not eve$x_bound_cursor) then ! restore the cursor position when free cursoring position (LINE_BEGIN); ! snap cursor to column 1 if mark (NONE) = end_of (current_buffer) then cursor_horizontal (get_info (saved_mark, "offset_column") - 1); else cursor_horizontal (get_info (saved_mark, "offset_column") - get_info (mark (FREE_CURSOR), "offset_column")); endif; endif; if saved_scrolls then set (SCROLLING, scroll_window, ON, saved_scroll_top, saved_scroll_bottom, saved_scroll_amount); update (scroll_window); endif; if saved_window <> scroll_window then eve$$restore_position (saved_window, saved_window_mark); endif; endon_error; saved_window := current_window; saved_window_mark := mark (FREE_CURSOR); eve$move_by_screen := TRUE; if saved_window = eve$command_window then if eve$$x_state_array {eve$$k_ambiguous_parse} then scroll_window := eve$choice_window; else scroll_window := eve$$x_pre_command_window; endif; position (scroll_window); else scroll_window := saved_window; endif; saved_mark := mark (FREE_CURSOR); this_column := get_info (saved_mark, "offset_column"); position (LINE_BEGIN); ! snap cursor to column 1 how_much_scroll := get_info (scroll_window, "visible_length"); !*** V2.0 Compat ! Provide an overlap of so some old text remains in the window if get_info (scroll_window, "status_line") <> "" then how_much_scroll := how_much_scroll - 3; else how_much_scroll := how_much_scroll - 2; endif; if how_much_scroll <= 0 then how_much_scroll := 1; endif; if eve$x_units = COORDINATES then how_much_scroll := how_much_scroll * get_info (CHARACTERS, "height"); endif; ! Move, keeping the cursor stationary and scrolling the text under the cursor ! (except when within scroll margin at either top or bottom of buffer, in ! which case the cursor will have to move to the scroll margin after movement). ! By using a scrolling region and move_vertical, we can move to the first or ! last line on the screen when on the first or last screen in the buffer. Also ! is much faster for scrolling a select range than using the scroll builtin. this_row := get_info (scroll_window, "current_row"); if this_row = 0 then ! Screen info is not all updated yet this_row := get_info (scroll_window, "visible_top"); !*** V2.0 Compat endif; saved_scroll_top := get_info (scroll_window, "scroll_top"); saved_scroll_bottom := get_info (scroll_window, "scroll_bottom"); saved_scroll_amount := get_info (scroll_window, "scroll_amount"); saved_scrolls := TRUE; ! for error handler ! adjust temporary scroll margins to preclude screen manager adjusting for ! scroll margins (when cursor is at top or bottom of buffer) new_top := this_row - get_info (scroll_window, "visible_top"); !*** V2.0 Compat new_bottom := get_info (scroll_window, "visible_bottom") - this_row; !*** V2.0 Compat if how_many_screens >= 0 then if new_top < saved_scroll_top then new_top := saved_scroll_top; new_bottom := new_bottom - new_top; endif; else if new_bottom < saved_scroll_bottom then new_bottom := saved_scroll_bottom; new_top := new_top - new_bottom; endif; endif; set (SCROLLING, scroll_window, ON, new_top, new_bottom, 0); ! ! ### LSE CHANGE ### for PDS support ! ! move_vertical (how_many_screens * how_much_scroll); ! MOVE ! lse$move_vertical (how_many_screens * how_much_scroll); ! MOVE ! if not eve$x_bound_cursor then ! restore the cursor position when free cursoring if mark (NONE) = end_of (current_buffer) then cursor_horizontal (this_column - 1); else cursor_horizontal (this_column - get_info (mark (FREE_CURSOR), "offset_column")); endif; endif; ! *** Someday we should not have to force a screen update *** update (scroll_window); set (SCROLLING, scroll_window, ON, saved_scroll_top, saved_scroll_bottom, saved_scroll_amount); if saved_window <> scroll_window then eve$$restore_position (saved_window, saved_window_mark); endif; endprocedure; ! This procedure is superceded to fix a bug specific to DECwindows. EVE fails ! to subtract off 1 for the DECwindows scroll bar. Code if enclosed in LSE ! comment brackets. ! ! EVE$WINDOWS.TPU Page 38 procedure eve_set_scroll_margins ! Set window scroll margins (top_margin, ! Number of lines in current window's top margin, ! of type string (integers are converted) - input, ! or percentage of window visible length in top margin bottom_margin) ! Number of lines in current window's bottom margin, ! of type string (integers are converted) - input, or ! Percentage of window visible length in bottom margin ! Description ! Set scroll regions in EVE windows. Scroll margins are the lines ! at the top and bottoms of windows that the cursor is NOT allowed to ! enter. ! Scroll margin may be specified in two ways: ! 1. Number of lines in the CURRENT WINDOW. ! A line count of 0 = no margins, count of 1 = cursor can not enter ! the top or bottom line of the windows (i.e., scrolling occurs), etc. ! The line count is changed into a percentage of the window length. ! 2. % of the CURRENT WINDOW. ! Sum of both margins > 100% of the length of the current window (excluding ! the status line) are rejected. ! Once the top and bottom percentages are determined, then procedure ! EVE$SET_ALL_WINDOWS is called for all known windows. Smaller or ! bigger windows have their margins set proportionally. ! ! NOTE: If cross_window_bounds is set on, then ! free cursor motion WILL let the cursor ! enter the scroll margins. local percent_index, scroll_top_percent, scroll_bottom_percent, which_parameter, the_window, window_length, top_null, bottom_null, top_adjust_flag, ! indicate if truncation occurs when number- bottom_adjust_flag, ! of-lines is converted to percentage-of-window temp_top_percent, temp_bottom_percent, the_top_percent, the_bottom_percent, status; on_error [TPU$_INVNUMSTR]: if which_parameter = 0 then eve$message (EVE$_BADTOPSCROLL, 0, the_top_percent); else eve$message (EVE$_BADBOTSCROLL, 0, the_bottom_percent); endif; eve$learn_abort; return (FALSE); [OTHERWISE]: endon_error; if current_window = eve$command_window then eve$message (EVE$_CANTCMDWINDOW); eve$learn_abort; return (FALSE); endif; the_window := current_window; window_length := (get_info (the_window, "visible_length") - !*** V2.0 Compat (get_info (the_window, "status_line") <> "")); ! LSE Change to account for scroll bar in DECwindows ! if eve$x_decwindows_active then window_length := window_length - 1; endif; ! ! LSE End of change ! TOP MARGIN if get_info (top_margin, "type") = STRING then status := eve$prompt_string (top_margin, the_top_percent, message_text (EVE$_TOPSCROLLPROMPT), ""); if not status then eve$learn_abort; return (FALSE); endif; edit (the_top_percent, COMPRESS, TRIM); if the_top_percent <> "" then ! look for a "%" character percent_index := index (the_top_percent, "%"); if percent_index = 1 ! invalid then eve$message (EVE$_BADTOPSCROLL, 0, the_top_percent); eve$learn_abort; return (FALSE); endif; else top_null := TRUE; endif; else eve$prompt_number (top_margin, the_top_percent, message_text (EVE$_TOPSCROLLPROMPT), ""); endif; if percent_index <> 0 then ! % temp_top_percent := int (substr (the_top_percent, 1, percent_index - 1)); else ! number of lines if not top_null then if get_info (the_top_percent, "type") = STRING then the_top_percent := int (the_top_percent); endif; temp_top_percent := (the_top_percent * 100) / window_length; if (10000 * the_top_percent / window_length) <> (temp_top_percent * 100) then top_adjust_flag := TRUE; ! percent has been truncated endif; endif; endif; which_parameter := TRUE; percent_index := 0; ! BOTTOM MARGIN if get_info (bottom_margin, "type") = STRING then status := eve$prompt_string (bottom_margin, the_bottom_percent, message_text (EVE$_BOTSCROLLPROMPT), ""); if not status then eve$learn_abort; return (FALSE); endif; edit (the_bottom_percent, COMPRESS, TRIM); if the_bottom_percent <> "" then ! look for a "%" character percent_index := index (the_bottom_percent, "%"); if percent_index = 1 ! invalid then eve$message (EVE$_BADBOTSCROLL, 0, the_bottom_percent); eve$learn_abort; return (FALSE); endif; else bottom_null := TRUE; endif; else eve$prompt_number (bottom_margin, the_bottom_percent, message_text (EVE$_BOTSCROLLPROMPT), ""); endif; ! look for a "%" character if percent_index <> 0 then ! % temp_bottom_percent := int (substr (the_bottom_percent, 1, percent_index - 1)); else ! number of lines if not bottom_null then if get_info (the_bottom_percent, "type") = STRING then the_bottom_percent := int (the_bottom_percent); endif; temp_bottom_percent := (the_bottom_percent * 100) / window_length; if (10000 * the_bottom_percent / window_length) <> (temp_bottom_percent * 100) then bottom_adjust_flag := TRUE; ! percent has been truncated endif; endif; endif; if (top_null) and (bottom_null) ! "" "" = no change then eve$message (EVE$_SCROLLNOTCHNG); return (FALSE); ! no learn_abort here endif; if (temp_top_percent + temp_bottom_percent) > 100 then eve$message (EVE$_NOOVERLAP); eve$learn_abort; return (FALSE); endif; eve$x_top_margin_adjust := top_adjust_flag; eve$x_bottom_margin_adjust := bottom_adjust_flag; eve$x_scroll_top := temp_top_percent; eve$x_scroll_bottom := temp_bottom_percent; eve$set_all_windows (SCROLLING, eve$x_scroll_top, eve$x_scroll_bottom); eve$message (EVE$_SCROLLSET, 0, eve$x_scroll_top, eve$x_scroll_bottom); return (TRUE); endprocedure; ! eve_set_scroll_margins ! This procedure is superceded to fix a bug specific to DECwindows. EVE fails ! to subtract off 1 for the DECwindows scroll bar. Code if enclosed in LSE ! comment brackets. ! ! EVE$WINDOWS.TPU Page 39 procedure eve$set_scroll_margins ! Change window scroll margins (the_window, ! window in which to set scroll margins top_percent, ! top margin as % of window length - input bottom_percent) ! bottom margin as % of window length - input ! Description ! Set the scroll regions in a window. ! Implicit Inputs ! eve$x_top_margin_adjust = flag indicating truncation occurred when numbers ! of lines was converted to a percentage of the ! window - adds 1 to number of lines in margin ! eve$x_bottom_margin_adjust = ditto local total_lines, top_lines, bottom_lines; on_error [OTHERWISE]: endon_error; total_lines := get_info (the_window, "length", WINDOW) - (get_info (the_window, "status_line") <> ""); ! LSE Change to account for scroll bar in DECwindows ! if eve$x_decwindows_active then total_lines := total_lines - 1; endif; ! ! LSE End of change top_lines := (total_lines * top_percent / 100) + eve$x_top_margin_adjust; bottom_lines := (total_lines * bottom_percent / 100) + eve$x_bottom_margin_adjust; if top_lines >= total_lines then top_lines := total_lines - 1; endif; if (top_lines + bottom_lines) >= total_lines then bottom_lines := total_lines - (top_lines + 1); endif; set (SCROLLING, the_window, ON, top_lines, bottom_lines, 0); endprocedure; ! eve$set_scroll_margins