! LSE$EVE_MENUS.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$MENUS.TPU. ! ! ENVIRONMENT: ! VAX/VMS ! ! CREATION DATE: 21-DEC-1989 ! ! MODIFIED BY: ! ! X3.1-1 DAS 21-Dec-89 First pass. ! X3.1-2 CCC 15-Jan-90 Modified eve$$widget_attr_ok to call ! lse$do_command('save section '...). ! X3.1-3 CCC 22-Jan-90 Oh, the previous is wrong, the bug should be ! fixed in lse$menus.tpu (for saving attributes) ! X3.1-4 CCC 2-Apr-90 Modify eve$$widget_attr_ok() and remove ! eve$$widget_clear_attr. ! X3.2-0 CCC 11-Jun-90 Rename eve$$build_attr_code to lse$$build_attr_code ! X3.2-1 NMC 13-Jul-90 Remove lse$$decwindows_v1 support in ! eve$init_menu_arrays and eve$$get_parent_widget ! X3.2-2 WC3 27-Jul-90 Add call to lse$$save_current_attributes when ! saving attributes in a command file. ! X3.2-3 GJJ 27-Feb-91 Applied TPU 3.0 FT3 conversions for widget ! resouce names and callback reasons; updated ! the copyright date. ! X4.0 SHE 30-Apr-91 Simplified eve$help_widget to use lse$$x_help_dialog. ! X4.0-1 SHE 04-Jun-91 Motif conversion. ! X4.0-2 SHE 07-Jun-91 Change nvalue to nset for ATTR_DIALOG toggle buttons. ! X4.0-3 SHE 11-Jun-91 lse$$widget_find_each_cancel renamed to ! lse$$widget_search_each_cancel. ! X4.0-4 SHE 13-Jun-91 Added CURRENT_ATTRSSW to ATTR_DIALOG.CURRENT_ ! ATTRSW.CURRENT_ATTRS. ! X4.0-5 SHE 01-Aug-91 Changed calls to CREATE_WIDGET to calls to ! lse$create_dialog_box to getting min. widths ! and heights for resizeable dialog boxes. ! X4.0-6 SHE 23-Aug-91 Added current_attrs_subform to attr_dialog path ! X4.0-7 SHE 18-Aug-91 Removed EVE's menu customization stuff ! X4.0-8 LRH 07-Nov-91 Removed lse$do_command from eve$$widget_attr_ok ! X4.0-9 DAS 14-Nov-91 Empty module init ! X4.0-10 WC3 21-Nov-91 Allow multiple DECwindows prompt in one menu item ! X4.0-11 SHE 05-Dec-91 Moved superseded eve$init_menu_arrays here. ! X4.0-12 WC3 13-Jan-92 Re-write Extended attribute support. !- procedure lse$eve_menus_module_ident return "X4.0-12"; endprocedure; ! EVE$MENUS.TPU Page 4 procedure eve$callback_dispatch ! DECwindows event callback ! Handles event callbacks from all EVE widgets. ! Get_info's an array containing: ! array {"widget"} = widget from CREATE_WIDGET ! array {"closure"} = widget integer tag (from eve$constants.sdl) ! array {"reason_code"} = reason code local an_array, an_index, the_program, saved_command_line_flag, status, the_topic, the_facility, the_legend, the_library, the_arg_list, the_help, temp_array; on_error [TPU$_CONTROLC]: eve$$x_state_array {eve$$k_command_line_flag} := eve$k_invoked_by_key; eve$learn_abort; abort; [OTHERWISE]: eve$$x_state_array {eve$$k_command_line_flag} := eve$k_invoked_by_key; endon_error if not eve$x_decwindows_active then return (FALSE); endif; ! ! LSE CHANGE if eve$check_bad_window then eve$message (EVE$_CURSINTEXT); eve$learn_abort; return (FALSE); endif; saved_command_line_flag := eve$$x_state_array {eve$$k_command_line_flag}; ! END OF CHANGE ! eve$$x_state_array {eve$$k_command_line_flag} := eve$k_invoked_by_menu; status := get_info (WIDGET, "callback_parameters", temp_array); !### LSE change: LSE superseeds the dispatch part of this procedure ! in it's entirety. ! ! make the following available to all the eve$$widget_xxx procedures eve$x_widget := temp_array {eve$k_widget}; ! widget (from CREATE_WIDGET) eve$x_widget_tag := temp_array {eve$k_closure}; ! widget tag (see UIL file) eve$x_widget_reason := temp_array {eve$k_reason_code};! reason code if eve$x_widget_reason = eve$x_callback_array {eve$k_cr_help} then ! ! Determine the type of help to use (WINDOW or WIDGET or PROGRAM) ! if get_info (eve$x_widget_tag, "type") = STRING then eve$$x_cs_handler := WIDGET; else if get_info (eve$$x_cs_help_type, "type") <> ARRAY then eve$$x_cs_handler := WINDOW; !*** will be WIDGET else eve$$x_cs_handler := eve$$x_cs_help_type {eve$x_widget_tag and %xffff0000}; if eve$$x_cs_handler = tpu$k_unspecified then eve$$x_cs_handler := WINDOW; !*** will be WIDGET endif; endif; endif; ! ! Process the help based on the type ! case get_info (eve$$x_cs_handler, "type") [PROGRAM]: execute (eve$$x_cs_handler); [KEYWORD]: ! ! Get the help facility and topic either out of the array or ! out of the string (if provided). ! case get_info (eve$x_widget_tag, "type") [STRING]: eve$$parse_comment (eve$x_widget_tag, "", the_facility, the_legend, the_topic); [INTEGER]: an_index := get_info (eve$$x_widget_help_arrays, "first"); loop exitif an_index = tpu$k_unspecified; ! silence if no widget matches an_array := eve$$x_widget_help_arrays {an_index}; the_help := an_array {eve$x_widget_tag}; if the_help <> tpu$k_unspecified then eve$$parse_comment (the_help, "", the_facility, the_legend, the_topic); exitif; endif; an_index := get_info (eve$$x_widget_help_arrays, "next"); endloop; endcase; ! ! Process this help frame in a window or a widget ! case eve$$x_cs_handler [WINDOW]: eve$clear_message; eve$$x_help_mode := 0; ! save context only if entering help for first time eve$help_setup ("", (get_info (eve$prompt_window, "buffer") <> eve$help_prompt_buffer)); eve$help_text (the_facility, the_topic); eve$help_enter_prompt (message_text (EVE$_HELPPROMPT, 1)); eve$$x_ctx_sensitive_help := TRUE; [WIDGET]: the_library := eve$get_help_item (eve$k_help_library, the_facility); the_arg_list := eve$get_help_item (eve$k_help_arg_list, the_facility); eve$help_widget (eve$x_widget, the_library, the_topic, the_arg_list); eve$$x_help_mode := 0; eve$$x_ctx_sensitive_help := TRUE; endcase; [OTHERWISE]: endcase; else ! ! We have a non-help callback code. If we have a string tag, then we ! will simply execute that string. If we have an integer, then we will ! look up the code in an array. ! case get_info (eve$x_widget_tag, "type") [STRING]: the_program := eve$x_widget_tag; [INTEGER]: an_array := get_info (eve$$x_widget_arrays, "first"); loop exitif an_array = tpu$k_unspecified; ! silence if no widget matches an_array := eve$$x_widget_arrays {an_array}; the_program := an_array {eve$x_widget_tag}; exitif the_program <> tpu$k_unspecified; an_array := get_info (eve$$x_widget_arrays, "next"); endloop; endcase; ! ! Execute the_program if we have one. It may either be of datatype ! string or of program based on the mechanism used to retrieve it. ! if the_program <> tpu$k_unspecified then ! ! Not all widgets expect a callback ! if the_program <> 0 then ! ! remove context-sensitive help ! if eve$$x_ctx_sensitive_help then eve$help_cleanup; endif; ! ! Execute the string or program ! execute (the_program); ! ! In case menu function moved cursor ! eve$$found_post_filter; endif; endif; endif; ! LSE change eve$$x_state_array {eve$$k_command_line_flag} := saved_command_line_flag; !eve$$x_state_array {eve$$k_command_line_flag} := eve$k_invoked_by_key; ! end LSE change return; endprocedure; ! eve$callback_dispatch ! EVE$MENUS.TPU Page 18 procedure eve$$widget_needfilename_ok ! OK callback - got filename (loop_flag) ! true if called from eve$$exit_loop local the_file, ! name of the file to write buffer to ! status, the_prompt, yesno; eve$unmanage_widget (eve$x_needfilename_dialog); ! get the filename from the text widget eve$$x_exit_array {"the_file"} := get_info (get_info (WIDGET, "widget_id", eve$x_needfilename_dialog, "NEEDFILENAME_DIALOG.NEEDFILENAME_TEXT" ), "text"); ! test the file name if (eve$$x_exit_array {"the_file"} = 0) or (eve$$x_exit_array {"the_file"} = "") then ! ! ### LSE change: ! ! change message box OK button program to finish the exit ! eve$$set_responder (eve$$k_message_ok, ! "eve$$widget_nofilespecexit_ok(" + ! str (loop_flag) + ")"); ! eve$popup_message (message_text (EVE$_NOFILESPECEXIT, 0, ! eve$$x_exit_array {"the_buffer_name"})); ! the_prompt := message_text (EVE$_NOFILESPECEXIT, 0, eve$$x_exit_array {"the_buffer_name"}); ! status := lse$$prompt_yesno(the_prompt, yesno); lse$prompt_boolean_decw (tpu$k_unspecified, yesno, the_prompt, "", "", FALSE); if yesno then eve$$x_exit_array {"state"} := 2; if loop_flag then eve$$x_exit_array {"the_buffer"} := get_info (BUFFERS, "next"); eve$$exit_loop; ! go write next buffer else ! state = 2 causes eve$$exit2 to be a nop for the current buffer, and ! then eve$$exit_loop to start looping thru the buffers eve$$exit1; endif; return; else eve$$x_exit_array {"state"} := 0; eve$$exit2(loop_flag); return; endif; endif; eve$$x_exit_array {"state"} := 1; if loop_flag then eve$$exit_loop; ! go write all buffers in a loop else eve$$exit1; ! write current buffer endif; endprocedure; ! eve$$widget_needfilename_ok procedure eve$$widget_needfilename_cancel ! Cancel - No filename (loop_flag) ! true if called from eve$$exit_loop ! change message box OK button program to finish the exit eve$unmanage_widget (eve$x_needfilename_dialog); ! ! ### LSE change ! lse$$widget_nofilespecexit_cancel(loop_flag); !eve$$set_responder (eve$$k_message_ok, ! "eve$$widget_nofilespecexit_ok(" + ! str (loop_flag) + ")"); !eve$popup_message (message_text (EVE$_NOFILESPECEXIT, 0, ! eve$$x_exit_array {"the_buffer_name"})); ! endprocedure; ! eve$$widget_needfilename_cancel procedure eve$$widget_replace_go_each_ok ! Ok go other direction (replace) on_error [TPU$_CONTROLC]: eve$message (EVE$_REPLCTRLC, 0, eve$$x_replace_array {eve$$k_replace_occurrences}); eve$$replace_error_handler; eve$learn_abort; abort; [OTHERWISE]: eve$$replace_error_handler; endon_error; eve$unmanage_widget (eve$x_replace_go_each_dialog); ! go to the find string (eve$$find's in eve$$replace_search_fail do not ! position to the string, just find it) position (eve$$x_replace_array {eve$$k_replace_range}); if eve$$x_replace_array {eve$$k_other_direction} = FORWARD then ! flip dir for next find eve$$x_replace_array {eve$$k_other_direction} := REVERSE; else eve$$x_replace_array {eve$$k_other_direction} := FORWARD; endif; !+ ! lse add to set up direction radio box !- if eve$x_old_find_direction = FORWARD then eve$x_old_find_direction := REVERSE; else eve$x_old_find_direction := FORWARD; endif; lse$$widget_set_search_direction; ! ! LSE V3.0 change, we don't do replacement ! ! eve$$replace_loop (0); ! ! end of LSE V3.0 CHANGE ! endprocedure; ! eve$$widget_replace_go_each_ok ! EVE$MENUS.TPU Page 21 procedure eve$$widget_find_each_yes ! Find in opposite direction (replacing, ! 0 called by find, [1 by replace,] 2 by wildcard_find move_flag, ! 1 to move to found range, 0 to not move new_direction; ! 1 for FORWARD, 0 for REVERSE old_find) ! 1 called by eve$find, else tpu$k_unspecified ! go ahead and find next occurrence of eve$x_target in other direction local saved_direction; on_error [TPU$_CONTROLC]: if (saved_direction <> current_direction) and (get_info (saved_direction, "type") = KEYWORD) then set (saved_direction, current_buffer); endif; eve$learn_abort; abort; [OTHERWISE]: if (saved_direction <> current_direction) and (get_info (saved_direction, "type") = KEYWORD) then set (saved_direction, current_buffer); endif; endon_error; lse$$widget_search_each_cancel; saved_direction := current_direction; if move_flag then if new_direction then set (FORWARD, current_buffer); else set (REVERSE, current_buffer); endif; eve$position_in_middle (beginning_of (eve$$x_saved_found_range)); eve$x_old_find_direction := current_direction; set (saved_direction, current_buffer); endif; !+ ! LSE add to change toggle button of direction in FIND dialog box !- lse$$widget_set_search_direction; if (replacing = 0) and (old_find <> tpu$k_unspecified) then return; endif; ! ! LSE V3.0 change: add the following code. ! if replacing = 1 then if index(lse$$subs_qual_string, "ALL") > 0 then eve$$replace_loop(0,eve$x_all); else eve$$replace_loop(0); endif; endif; ! ! end of LSE V3.0 change ! eve$remember_found (eve$$x_saved_found_range); endprocedure; ! eve$$widget_find_each_yes ! EVE$MENUS.TPU Page 25 procedure eve$$widget_attr ! SAVE ATTRIBUTES menu entry logic ! This implements the logic which creates, formats, and displays the user ! attributes dialog box as invoked from the SAVE ATTRIBUTES menu entry. local status, the_widget_id, ! List box widget id list_box_attributes; ! DECwindows argument list for list box if get_info (eve$x_attr_dialog, "type") <> WIDGET then eve$x_attr_dialog := create_widget ("ATTR_DIALOG", eve$x_widget_hierarchy, SCREEN, eve$kt_callback_routine); endif; ! ! set widgets to reflect current values ! ! ! ### LSE changes ! status := set (WIDGET, get_info (WIDGET, "widget_id", eve$x_attr_dialog, "ATTR_DIALOG.SAVE_ATTR_BOX.ATTR_SECTION"), eve$x_resource_array {eve$k_nset}, (eve$$x_prompt_for_section <> TRUE)); status := set (WIDGET, get_info (WIDGET, "widget_id", eve$x_attr_dialog, "ATTR_DIALOG.SAVE_ATTR_BOX.ATTR_COMMAND"), eve$x_resource_array {eve$k_nset}, (eve$$x_prompt_for_section = TRUE)); ! status := set (WIDGET, ! get_info (WIDGET, "widget_id", eve$x_attr_dialog, ! "ATTR_DIALOG.SAVE_ATTR_BOX.ATTR_DONT_SAVE"), ! eve$x_resouce_array {eve$k_nset}, FALSE); ! ! ### end of LSE change ! status := set (TEXT, get_info (WIDGET, "widget_id", eve$x_attr_dialog, "ATTR_DIALOG.ATTR_SECTION_TEXT"), eve$$x_section_default); status := set (TEXT, get_info (WIDGET, "widget_id", eve$x_attr_dialog, "ATTR_DIALOG.ATTR_COMMAND_TEXT"), eve$$get_default_command_file); ! ! Show the current user settings by loading them into the list box ! list_box_attributes := create_array; !+ ! LSE change: LSE needs to re-initialize display array and attributes array !- list_box_attributes := create_array; !### LSE Change: ! list_box_attributes eve$x_resource_array {eve$k_nitems_count} := ! eve$$x_display_array; ! list_box_attributes {eve$x_resource_array {eve$k_nitems_count}} := lse$$x_display_array; the_widget_id := get_info (WIDGET, "widget_id", eve$x_attr_dialog, "ATTR_DIALOG.CURRENT_ATTRS_SUBFORM.CURRENT_ATTRSSW.CURRENT_ATTRS"); set (WIDGET, the_widget_id, list_box_attributes); eve$manage_widget (eve$x_attr_dialog, "ATTR_DIALOG"); endprocedure; ! eve$$widget_attr ! EVE$MENUS.TPU Page 53 procedure eve$$set_list_box ! set the contents of a list box (the_array, ! array to put into the list box the_listbox_name; ! name of the list box the_label) ! optional name of label to highlight local the_widget_id, temp_array, last_index, function_array; ! Update the contents of the list box function_array := create_array; ! ! ### LSE change: fix bugs (removing trailing spaces in "the_label") ! if the_label <> tpu$k_unspecified then EDIT(the_label, COMPRESS,TRIM); endif; ! ! ### LSE change ! if ( the_label <> 0 ) AND ( the_label <> tpu$k_unspecified ) ! label is specified then temp_array := create_array; ! selected item must be string table temp_array {0} := the_label; function_array {eve$x_resource_array {eve$k_nselected_items_count}} := temp_array; else ! don't want anything selected function_array {eve$x_resource_array {eve$k_nselected_count}} := 0; endif; function_array {eve$x_resouce_array {eve$k_nitems_count}} := the_array; the_widget_id := get_info (WIDGET, "widget_id", eve$x_extend_menu_dialog, the_listbox_name); set (WIDGET, the_widget_id, function_array); endprocedure; ! eve$$set_list_box ! ! This procedure is superceded in order to work on MIPS/ULTRIX. ! ! EVE$MENUS.TPU Page 6 procedure eve$help_widget ! Help displayed in Help Widget (widget_id, library, topic; arg_list) ! ! This procedure is invoked when help is to be displayed using the DECwindows ! help widget. It returns if we are not in that environment. ! ! Note that the unmap callback will be the routine that marks help widgets in ! the array as being available. ! local status; ! ! If we don't have a widget identifier, then create a new widget and set the ! shell dedicated to this help widget. Do the assignment here since widgets ! cannot be reparented. ! if get_info (lse$$x_help_dialog, "TYPE") <> WIDGET then lse$$x_help_dialog := create_widget ("HELP_DIALOG", eve$x_widget_hierarchy, SCREEN, eve$kt_callback_routine); endif; ! ! Set the arg_list information if passed by the user. ! if arg_list <> tpu$k_unspecified then status := set (WIDGET, lse$$x_help_dialog, arg_list); endif; ! ! Next set the library and topic that are required. ! status := set (WIDGET, lse$$x_help_dialog, "DXmfirstTopic", topic, "DXmlibrarySpec", library, "DXmlibraryType", 1); manage_widget (lse$$x_help_dialog); endprocedure; ! eve$help_widget ! Since we have our own menu customization facility now, we don't want to ! both initializing all of EVE's menu arrays ! procedure eve$init_menu_arrays endprocedure; variable lse$$x_help_dialog;