MODULE TPUPlus_BULL IDENT "900409" !**************************************** PROCEDURE EVE_BULLET (ARG1,ARG2,ARG3) !------------------------------------------------------------------------------- ! format a bullet !------------------------------------------------------------------------------- local current, ! marker - current position in buffer save_left_margin, save_right_margin, narg1, ! integer - parameter numeric value narg2, ! integer - parameter numeric value narg3, ! integer - parameter numeric value item_range, ! range - range of bullet item item_string, ! string - bullet item string item_area_size, ! integer - size of bullet item area start_bullet, ! marker - start of bullet marker end_bullet, ! marker - end of bullet marker bullet_range; ! range - range to be formatted into a bullet on_error endon_error; ! set the working direction set (forward, current_buffer); ! calculate the bullet item and text columns saved_left_margin := get_info (current_buffer, "left_margin"); saved_right_margin := get_info (current_buffer, "right_margin"); if bullet_item_left = 0 then bullet_item_left := saved_left_margin; endif; if bullet_text_left= 0 then bullet_text_left := bullet_item_left + 10; endif; if bullet_text_right = 0 then bullet_item_right := saved_right_margin; endif; ! calculate the maximum size of the item area in front of the bullet text item_area_size := bullet_text_left - bullet_item_left; narg1 := int (arg1); narg2 := int (arg2); narg3 := int (arg3); if length (arg1) > 0 then if (narg1 = 0) then message (fao ( 'Bullet item margin !SL; item area size !SL; text margins !SL to !SL', bullet_item_left, item_area_size, bullet_text_left, bullet_text_right)); return (1); endif; if (narg1 > 0) and (narg2 = 0) and (narg3 = 0) then bullet_text_left := bullet_item_left + narg1; item_area_size := bullet_text_left - bullet_item_left; else if (narg1 > 0) and (narg2 > 0) and (narg3 > 0) and (narg1 < narg2) and (narg2 < narg3) then bullet_item_left := narg1; bullet_text_left := narg2; bullet_text_right := narg3; item_area_size := bullet_text_left - bullet_item_left; else message ('ERROR - Illegal bullet command parameters'); return (1); endif; endif; endif; ! save the current position current := mark (free_cursor); ! mark the start of the bullet text move_horizontal (-current_offset); loop exitif mark (none) = beginning_of (current_buffer); move_vertical (-1); if check_for_paragraph_break then move_vertical (1); exitif 1; endif; endloop; start_bullet := mark (none); ! mark the end of the bullet text position (current); move_horizontal (-current_offset); loop exitif mark (none) = end_of (current_buffer); if check_for_paragraph_break then move_vertical (-1); exitif 1; endif; move_vertical (1); endloop; move_horizontal (length (current_line)); end_bullet := mark (none); ! create a range for the bullet text bullet_range := create_range (start_bullet, end_bullet, none); if bullet_range = 0 then return (1); endif; ! extract the bullet item from the bullet text position (beginning_of (bullet_range)); !move_horizontal (-1); item_range := search (item_pattern, forward); if item_range = 0 then return (1); endif; ! test if the bullet item fits in the bullet item area if item_area_size < length (item_range) then message (fao ('ERROR - Bullet item is to large for the item space')); return (1); endif; ! remove item string from bullet buffer position (beginning_of (item_range)); item_string := erase_character (length (item_range)); ! format the bullet text fill (bullet_range, ' ', bullet_text_left, bullet_text_right, 0); ! insert item in front of the bullet text position (beginning_of (bullet_range)); cursor_horizontal (bullet_item_left - 1 - get_info (current_buffer, "offset_column")); erase_character (length (item_string)); copy_text (item_string); ! move to the end of the bullet range eve$position_in_middle (end_of (bullet_range)); return (1); ENDPROCEDURE; ! definitions for the bullet formatter eve$arg1_bullet := 'string'; eve$arg2_bullet := 'string'; eve$arg3_bullet := 'string'; bullet_item_left := 0; bullet_text_left := 0; bullet_text_right := 0; item_characters := 'abcdefghijklmnopqrstuvwxyz' + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + '[]{}<>()0123456789;:."''' + '!@#$%^&*~|/\?-_+='; item_pattern := span(item_characters); ENDMODULE;