! LSE$EVE_FORMAT.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$FORMAT.TPU. ! ! ENVIRONMENT: ! VAX/VMS ! ! CREATION DATE: 21-DEC-1989 ! ! MODIFIED BY: ! ! X3.1-1 DAS 21-Dec-89 First pass. ! Renamed FIRST_VISIBLE_REC_MARK to have LSE$$ prefix. ! X3.1-2 GAF 15-Mar-90 Change LSE$MOVE_VERTICAL to LSE$MOVE_HORIZONTAL in ! eve_fill_paragraph, to fix a bug where FILL was ! using the wrong left margin setting. ! X4.0-1 DAS 15-Nov-91 Remove empty module init ! ! X4.3-2 RKB 17-Jan-95 Add support for UNDO to eve$fill_range ! X4.4-2 RKB 04-Aug-95 Add support for UNDO to eve_fill_paragraph !- procedure lse$eve_format_module_ident return "X4.0-1"; endprocedure; ! LSE$FORMAT.TPU 21-Jun-1987 10:27 Page 1 procedure eve$current_word ! Make range for current word !+ ! superseded by lse$$current_word !- return( lse$$current_word) ; endprocedure; ! EVE$FORMAT.TPU Page 1 procedure eve_capitalize_word ! Capitalize word (or select/find ranges) local the_range, start_word, word_range, ! Range for current word word_string, ! String for current word saved_mark, ! Original location first_word; ! Boolean for first word in range if not eve$test_if_modifiable (current_buffer) then eve$learn_abort; return (FALSE); endif; if not eve$declare_intention (eve$k_action_change_case) then return (FALSE); endif; position (TEXT); ! no padding blank lines saved_mark := mark (NONE); the_range := eve$selection (FALSE); if the_range <> 0 then ! ! *** LSE change : check for overview records if NOT lse$source_only(the_range) then MESSAGE('Attempt to modify an overview line'); eve$learn_abort; RETURN(false); endif; position (beginning_of (the_range)); first_word := TRUE; loop exitif mark (NONE) > end_of (the_range); ! *** LSE add the following line word_range := eve$current_word; ! LSE comments the following code ! if first_word ! then ! ! capitalize current character of the 1st word (skipping ! ! punctuation), don't go back to start of word ! ! start_word := mark (NONE); ! eve$end_of_word; ! move_horizontal (-1); ! word_range := create_range (start_word, mark (NONE), NONE); ! move_horizontal (1); ! ! else ! word_range := eve$current_word; ! endif; ! don't go past the_range if (not first_word) and (word_range = 0) then position (end_of (the_range)); eve$end_of_word; exitif; endif; if (word_range <> 0) and (current_offset > 0) then if (first_word) or (not first_word) and (beginning_of (word_range) >= beginning_of (the_range)) then word_string := substr (word_range, 1, length (word_range)); ! insure leading punctuation is skipped over eve$capitalize_string (word_string); eve$insert_text (word_string); erase (word_range); endif; endif; first_word := FALSE; endloop; return (TRUE); endif; ! *** LSE change for no range active ! if lse$is_overview() ! use cursor as default marker then MESSAGE('Attempt to modify an overview line'); eve$learn_abort; RETURN(false); endif; word_range := eve$current_word; if (word_range <> 0) and (current_offset > 0) then word_string := erase_character (-length (word_range)); eve$capitalize_string (word_string); eve$insert_text (word_string); endif; return (TRUE); endprocedure; ! Supersede EVE_FILL to support VIEW ! procedure eve_fill ! Fill select range or paragraph local the_selection; the_selection := eve$selection (FALSE); if the_selection <> 0 then ! ! ***LSE change: check overview records IF lse$source_only(the_selection) then return (eve$fill_range (the_selection)); else MESSAGE('Attempt to modify an overview line'); eve$learn_abort; return (false); endif; else return (eve_fill_paragraph); endif; endprocedure; ! EVE$FORMAT.TPU Page 11 procedure eve$fill_range (range_arg) local the_range, start_mark, ! Start of the range to fill the_right_margin, the_left_margin, the_indent, end_mark; ! Marker for end of range on_error [OTHERWISE]: endon_error; if not eve$declare_intention (eve$k_action_format) then return (FALSE); endif; the_range := range_arg; if the_range <> 0 then if beginning_of (the_range) <= end_of (the_range) then start_mark := beginning_of (the_range); end_mark := end_of (the_range); else end_mark := beginning_of (the_range); start_mark := end_of (the_range); endif; ! ! Save the above range to use in SUBSTITUTE command for UNDO ! lse$$save_selected_range (start_mark, end_mark); ! the_range := 0; position (start_mark); ! Move start_mark if on an DOCUMENT tag or runoff command line if search_quietly (eve$pattern_skip_paragraph_break, FORWARD) <> 0 then ! skip past DOCUMENT tag, runoff command line, ff's position (LINE_END); move_horizontal (1); start_mark := mark (NONE); endif; loop ! Find the paragraph bounds for all paragraphs loop position (LINE_END); exitif mark (NONE) = end_of (current_buffer); move_horizontal (1); exitif mark (NONE) > end_mark; exitif eve$paragraph_break; endloop; move_horizontal (-1); if mark (NONE) > end_mark then position (end_mark); endif; ! ### Modified by LSE to delete margin and indent setttings, and to call ! ### LSE$$FILL_RANGE. ### ! the_right_margin := get_info (current_buffer, "right_margin"); ! ! if eve$$x_word_wrap_indent {current_buffer} <> tpu$k_unspecified ! then ! the_left_margin := eve$$x_word_wrap_indent {current_buffer}; ! else ! the_left_margin := get_info (current_buffer, "left_margin"); ! endif; ! ! if eve$$x_paragraph_indent {current_buffer} <> tpu$k_unspecified ! then ! the_indent := eve$$x_paragraph_indent {current_buffer} ! -the_left_margin; ! else ! the_indent := get_info (current_buffer, "left_margin") - ! the_left_margin; ! endif; ! ! the_range := create_range (start_mark, mark (NONE), NONE); ! edit (the_range, TRIM_LEADING, OFF); ! fill (the_range, eve$x_fill_separators, the_left_margin, ! the_right_margin, the_indent); lse$$fill_range(create_range (start_mark, mark (NONE), NONE)); ! ### End of LSE modification. ### loop ! Skip the inter-paragraph break; position (LINE_END); move_horizontal (1); exitif not eve$paragraph_break; endloop; start_mark := mark (NONE); exitif start_mark >= end_mark; endloop; position (end_mark); ! ! Save the text that replaced the range saved above for UNDO of this command ! lse$$save_modified_text; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!! screen manager issue !!!!!!!!!!!!!!!!!!!!!!!!!! update (current_window); !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! else eve$message (EVE$_SELFIRST); eve$learn_abort; return (FALSE); endif; eve$clear_message; return (TRUE); endprocedure; ! EVE$FORMAT.TPU Page 9 ! Fills the current paragraph procedure eve_fill_paragraph ! Fill paragraph between margins using spaces local saved_mark, ! Marker for current cursor position start_paragraph, ! Marker for start of current paragraph stop_paragraph, ! Marker for end of current paragraph the_right_margin, the_left_margin, the_indent, first_mark, ! marker for the first visible record fill_range; ! Range for current paragraph on_error [OTHERWISE]: endon_error; if get_info (current_buffer, "system") then eve$message (EVE$_CANTSYSTEMBUF); eve$learn_abort; return (FALSE); endif; ! Can't fill an empty buffer - avoid additional checks later on if beginning_of (current_buffer) = end_of (current_buffer) then eve$message (EVE$_NOFILL); eve$learn_abort; return (FALSE); endif; if not eve$declare_intention (eve$k_action_format) then return (FALSE); endif; position (TEXT); saved_mark := mark (NONE); ! find the first visible record first_mark := lse$$first_visible_rec_mark; ! Find beginning of paragraph. Paragraph breaks are blank lines, DOCUMENT tags, ! runoff commands, FF (hard FF), or FF+NL (soft FF). If on a paragraph break ! other than a DOCUMENT tag or runoff command line, then do preceding paragraph. position (LINE_BEGIN); if search_quietly (ANCHOR + LINE_BEGIN + (("." | "<") + any (eve$x_runoff_characters)), FORWARD) <> 0 then ! on DOCUMENT tag or runoff command line, go to next line position (LINE_END); move_horizontal (1); start_paragraph := mark (NONE); else loop ! stop at top of buffer ! ! ***LSE change, check if current position is the first VISIBLE line ! exitif mark (NONE) = beginning_of (current_buffer); exitif mark (NONE) = first_mark; ! ! LSE change: use lse$move_vertical to get rid of invisible line ! move_vertical (-1); lse$move_vertical(-1); position (LINE_BEGIN); ! incase set(column_move_vertical,on) ! stop at a break and move to start of next line if eve$paragraph_break then position (LINE_END); ! ! LSE change: use lse$move_horizontal to skip over invisible lines ! move_horizontal (1); lse$move_horizontal (1); exitif; endif; endloop; start_paragraph := mark (NONE); position (saved_mark); endif; ! find end of paragraph loop position (LINE_BEGIN); exitif mark (NONE) = end_of (current_buffer); exitif eve$paragraph_break; ! ! LSE change: use lse$move_vertical to get rid of invisible line lse$move_vertical(1); endloop; if start_paragraph = mark (NONE) then eve$message (EVE$_NOFILL); position (saved_mark); eve$learn_abort; return (FALSE); else ! ! LSE change: use lse$move_horizontal to get rid of invisible line lse$move_horizontal(-1); stop_paragraph := mark (NONE); ! Now fill the paragraph ! ### LSE change: comment out the following for hard left margin ! ! the_right_margin := get_info (current_buffer, "right_margin"); ! ! if eve$$x_word_wrap_indent {current_buffer} <> tpu$k_unspecified ! then ! the_left_margin := eve$$x_word_wrap_indent {current_buffer}; ! else ! the_left_margin := get_info (current_buffer, "left_margin"); ! endif; ! if eve$$x_paragraph_indent {current_buffer} <> tpu$k_unspecified ! then ! the_indent := eve$$x_paragraph_indent {current_buffer} ! - the_left_margin; ! else ! the_indent := get_info (current_buffer, "left_margin") - ! the_left_margin; ! endif; ! ! fill_range := create_range (start_paragraph, stop_paragraph, NONE); ! ! LSE change: check overview records ! fill_range := create_range (start_paragraph, stop_paragraph, NONE); IF NOT lse$source_only(fill_range) then position (saved_mark); MESSAGE('Attempt to modify an overview line'); eve$learn_abort; return(FALSE); endif; ! ### end of LSE change ! ! ! ### LSE change ! ! fill_range := create_range (start_paragraph, stop_paragraph, NONE); ! edit (fill_range, TRIM_LEADING, OFF); ! fill (fill_range, eve$x_fill_separators, ! the_left_margin, the_right_margin, the_indent); ! ! Save range selected for FILL for UNDO ! lse$$save_selected_range(start_paragraph, stop_paragraph); lse$$fill_range(create_range (start_paragraph, stop_paragraph, NONE)); position (stop_paragraph); eve$show_first_line; ! ! Save text modified by above fill for UNDO ! lse$$save_modified_text; endif; return (TRUE); endprocedure; procedure eve_lowercase_word ! Lowercase current word local the_range; position (TEXT); ! snap to text if not eve$test_if_modifiable (current_buffer) then eve$learn_abort; return (FALSE); endif; if not eve$declare_intention (eve$k_action_change_case) then return (FALSE); endif; the_range := eve$selection (FALSE); if the_range = 0 then ! ***LSE change ! if lse$is_overview() ! use cursor as default marker then MESSAGE('Attempt to modify an overview line'); eve$learn_abort; RETURN(false); endif; the_range := eve$current_word; endif; if the_range <> 0 then ! *** LSE change; check overview records in the range ! if NOT lse$source_only(the_range) then MESSAGE('Attempt to modify an overview line'); eve$learn_abort; RETURN(false); endif; change_case (the_range, LOWER); position (end_of (the_range)); eve$end_of_word; if the_range = eve$x_found_range then eve$$remove_found_range; endif; endif; return (TRUE); endprocedure; ! Put word in all uppercase letters procedure eve_uppercase_word ! Uppercase current word local the_range; position (TEXT); ! snap to text if not eve$test_if_modifiable (current_buffer) then eve$learn_abort; return (FALSE); endif; if not eve$declare_intention (eve$k_action_change_case) then return (FALSE); endif; the_range := eve$selection (FALSE); if the_range = 0 then ! ***LSE change ! if lse$is_overview() ! use cursor as default marker then MESSAGE('Attempt to modify an overview line'); eve$learn_abort; RETURN(false); endif; the_range := eve$current_word; endif; if the_range <> 0 then ! *** LSE change; check overview records in the range ! if NOT lse$source_only(the_range) then MESSAGE('Attempt to modify an overview line'); eve$learn_abort; RETURN(false); endif; change_case (the_range, UPPER); position (end_of (the_range)); eve$end_of_word; if the_range = eve$x_found_range then eve$$remove_found_range; endif; endif; return (TRUE); endprocedure;