home *** CD-ROM | disk | FTP | other *** search
/ The Developer Connection…ice Driver Kit for OS/2 3 / DEV3-D1.ISO / devtools / dataflex / helpedit.pkg < prev    next >
Encoding:
Text File  |  1993-05-19  |  81.8 KB  |  2,308 lines

  1. // HELPEDIT.PKG
  2. // January 22, 1991
  3. // LS
  4. //
  5. // Context-sensitive Help Editing object
  6.  
  7. #CHKSUB 1 1 // Verify the UI subsystem.
  8.  
  9. use Data_Set
  10. use EntryFrm
  11. use HelpMsgs
  12. use Key_Btn
  13. use Menu
  14. use Msg_Btn
  15. use Dfh_Util
  16.  
  17. #COMMAND DEFINE_SYMBOL R "FOR" R .
  18.   #IFDEF !1
  19.   #ELSE
  20.     #REPLACE !1 !3
  21.   #ENDIF
  22. #ENDCOMMAND
  23.  
  24. #COMMAND USE_FILE R
  25.   #IFDEF !1.RECNUM
  26.   #ELSE
  27.     #INCLUDE !1.FD
  28.   #ENDIF
  29.  
  30.   #IFDEF !1.FILE_NUMBER
  31.   #ELSE
  32.     #SET Q$ !1.RECNUM
  33.     #REPLACE !1.FILE_NUMBER |CI!q
  34.   #ENDIF
  35.  
  36.   #IF (!0>1)
  37.     USE_FILE !2 !3 !4 !5 !6 !7 !8 !9
  38.   #ENDIF
  39. #ENDCOMMAND
  40.  
  41. DEFINE_SYMBOL HELP_FOR_HELP_NAME   FOR 'HELP FOR HELP' // value of HELP_NAME
  42. DEFINE_SYMBOL HELP_NAME_LENGTH     FOR 40
  43. DEFINE_SYMBOL HELP_GRP_FILENAME    FOR 'helpgrp' // default filenames
  44. DEFINE_SYMBOL HELP_SBJ_FILENAME    FOR 'helpsbj'
  45. DEFINE_SYMBOL HELP_XRF_FILENAME    FOR 'helpxrf'
  46. DEFINE_SYMBOL HELP_CTX_FILENAME    FOR 'helpctx'
  47. DEFINE_SYMBOL HELP_FILENAME_PREFIX FOR 'help'
  48.  
  49. DEFINE_SYMBOL MAX_LINES_ALLOWED FOR 32767
  50.  
  51. DEFINE_SYMBOL YES_STATUS_STRING FOR 'Yes'
  52. DEFINE_SYMBOL NO_STATUS_STRING  FOR 'No'
  53.  
  54. #IFDEF POINTED_CURSOR_TYPE
  55. #ELSE
  56.   #REPLACE POINTED_CURSOR_TYPE |CI2
  57. #ENDIF
  58.  
  59. use_file grp sbj xrf ctx
  60.  
  61. //////////////////////////////////
  62. ////////////////////////////////// global variables
  63. //////////////////////////////////
  64.  
  65. integer Original_Grp Original_Sbj Original_Xrf Original_Ctx
  66.                                      // temporary storage for record numbers
  67.  
  68. string Original_Group_Filename Original_Subject_Filename
  69. string Original_Link_Filename  Original_Context_Filename
  70.                               // temporary storage for help system filenames
  71.  
  72. register_object Help_Object  // to allow testing of access method for existence
  73. register_object Help_Editor  // to allow forward reference
  74.  
  75. //////////////////////////////////
  76. ////////////////////////////////// desktop procedures and functions
  77. //////////////////////////////////
  78.  
  79. procedure Deactivate_Area for Desktop
  80.     send Deactivate AREA_TYPE
  81. end_procedure
  82.  
  83. function Context_Help_Name for Desktop returns string
  84.     function_return (Trim( Right( Help_Name( Current_Object ), ;
  85.       HELP_NAME_LENGTH ) ))
  86. end_function
  87.  
  88. // global procedures for accessing Help while inside Help_Edit
  89.  
  90. procedure Request_Help_In_Help_Edit for Desktop integer Msg integer Arg
  91.     local integer Obj Ed_Obj
  92.  
  93.     move (Help_Object( Desktop )) to Obj
  94.  
  95.     if Obj NE Null_Object begin
  96.         move (Help_Editor( Desktop )) to Ed_Obj
  97.  
  98.         if (Active_State( Ed_Obj )) send Use_System_Help_Files to Ed_Obj
  99.  
  100.         if Num_Arguments GT 1 send Request_Help to Obj Msg Arg
  101.         else send Request_Help to Obj Msg
  102.  
  103.         if (Active_State( Ed_Obj )) send Use_Original_Help_Files to Ed_Obj
  104.     end
  105. end_procedure
  106.  
  107. procedure Extended_Help for Desktop
  108.     send Request_Help_In_Help_Edit Msg_View_Context_Help Current_Object
  109. end_procedure
  110.  
  111. procedure Help for Desktop
  112.     send Request_Help_In_Help_Edit Msg_View_Context_Help Current_Object
  113. end_procedure
  114.  
  115. procedure Help_For_Help for Desktop
  116.     send Request_Help_In_Help_Edit Msg_View_Help_For_Help
  117. end_procedure
  118.  
  119. procedure Help_Index for Desktop
  120.     send Request_Help_In_Help_Edit Msg_View_Help_Index
  121. end_procedure
  122.  
  123. procedure Keys_Help for Desktop
  124.     send Request_Help_In_Help_Edit Msg_View_Keys_Help
  125. end_procedure
  126.  
  127. /Help_Edit_Message_Img
  128. ╔══════════════════════════════════════════════════════════════╗
  129. ║                                                              ║
  130. ║                                                              ║
  131. ║                                                              ║
  132. ║                                                              ║
  133. ║                                                              ║
  134. ║                                                              ║
  135. ║                                                              ║
  136. ╚══════════════════════════════════════════════════════════════╝
  137. /Help_Edit_Ok_Help_Btns_Img
  138.                    ____           ______                    
  139. /*
  140. //                 <OK>           <Help>
  141.  
  142. /Help_Edit_Save_Ctx_Btns_Img
  143.         _______________________     ________________        
  144.              ________                    ______             
  145. /*
  146. //      <Save Link and Context>     <Save Link only>
  147. //           <Cancel>                    <Help>
  148.  
  149. /Help_Edit_Delete_Ctx_Xrf_Btns_Img
  150.     _____________________      _________________________    
  151.          ________                       ______              
  152. /*
  153. //  <Delete Context only>      <Delete Link and Context>
  154. //       <Cancel>                       <Help>
  155.  
  156. /Help_Edit_Delete_Ctx_Btns_Img
  157.          ________________      ________      ______         
  158. /*
  159. //       <Delete Context>      <Cancel>      <Help>
  160.  
  161. /Help_Edit_Delete_Xrf_Btns_Img
  162.         _____________        ________        ______        
  163. /*
  164. //      <Delete Link>        <Cancel>        <Help>
  165.  
  166. object Help_Edit_Message is a Message_Button Help_Edit_Message_Img
  167.     set Delegation_Mode to Delegate_Prior_Level
  168.     set Location        to 7 8 Relative
  169.     set Text_Size       to 4 60
  170.  
  171.     object Ok_Help_Buttons is a Button Help_Edit_Ok_Help_Btns_Img
  172.         set Focus_Mode to No_Activate
  173.         set Location   to 6 1 Relative
  174.  
  175.         item_list
  176.             on_item "<OK>"   send Ok
  177.             on_item "<Help>" send Help
  178.         end_item_list
  179.  
  180.         on_key kCancel           send None
  181.         on_key kExit_Application send Quit_Help_Edit
  182.     end_object
  183.  
  184.     object Save_Ctx_Buttons is a Button Help_Edit_Save_Ctx_Btns_Img
  185.         set Focus_Mode to No_Activate
  186.         set Location   to 6 1 Relative
  187.  
  188.         item_list
  189.             on_item "<Save Link and Context>" send Save_Both
  190.             on_item "<Save Link only>"        send Save_Link
  191.             on_item "<Cancel>"                send Cancel
  192.             on_item "<Help>"                  send Help
  193.         end_item_list
  194.  
  195.         on_key kExit_Application send Quit_Help_Edit
  196.     end_object
  197.  
  198.     object Delete_Ctx_Xrf_Buttons is a Button Help_Edit_Delete_Ctx_Xrf_Btns_Img
  199.         set Focus_Mode to No_Activate
  200.         set Location   to 6 1 Relative
  201.  
  202.         item_list
  203.             on_item "<Delete Context only>"     send Delete_Ctx
  204.             on_item "<Delete Link and Context>" send Delete_Both
  205.             on_item "<Cancel>"                  send Cancel
  206.             on_item "<Help>"                    send Help
  207.         end_item_list
  208.  
  209.         on_key kExit_Application send Quit_Help_Edit
  210.     end_object
  211.  
  212.     object Delete_Ctx_Buttons is a Button Help_Edit_Delete_Ctx_Btns_Img
  213.         set Focus_Mode to No_Activate
  214.         set Location   to 6 1 Relative
  215.  
  216.         item_list
  217.             on_item "<Delete Context>" send Delete_Ctx
  218.             on_item "<Cancel>"         send Cancel
  219.             on_item "<Help>"           send Help
  220.         end_item_list
  221.  
  222.         on_key kExit_Application send Quit_Help_Edit
  223.     end_object
  224.  
  225.     object Delete_Xrf_Buttons is a Button Help_Edit_Delete_Xrf_Btns_Img
  226.         set Focus_Mode to No_Activate
  227.         set Location   to 6 1 Relative
  228.  
  229.         item_list
  230.             on_item "<Delete Link>" send Delete_Link
  231.             on_item "<Cancel>"      send Cancel
  232.             on_item "<Help>"        send Help
  233.         end_item_list
  234.  
  235.         on_key kExit_Application send Quit_Help_Edit
  236.     end_object
  237.  
  238.     on_key kCancel send Cancel
  239.  
  240.     DEFINE_SYMBOL HELP_OK_HELP_BTN_TYPE        FOR 1
  241.     DEFINE_SYMBOL HELP_SAVE_CTX_BTN_TYPE       FOR 2
  242.     DEFINE_SYMBOL HELP_DELETE_CTX_XRF_BTN_TYPE FOR 3
  243.     DEFINE_SYMBOL HELP_DELETE_CTX_BTN_TYPE     FOR 4
  244.     DEFINE_SYMBOL HELP_DELETE_XRF_BTN_TYPE     FOR 5
  245.  
  246.     procedure Set Button_Type integer Val
  247.         set Focus_Mode of (Ok_Help_Buttons( Current_Object ))        to No_Activate
  248.         set Focus_Mode of (Save_Ctx_Buttons( Current_Object ))       to No_Activate
  249.         set Focus_Mode of (Delete_Ctx_Xrf_Buttons( Current_Object )) to No_Activate
  250.         set Focus_Mode of (Delete_Ctx_Buttons( Current_Object ))     to No_Activate
  251.         set Focus_Mode of (Delete_Xrf_Buttons( Current_Object ))     to No_Activate
  252.  
  253.              if Val EQ HELP_OK_HELP_BTN_TYPE        set Focus_Mode of (Ok_Help_Buttons( Current_Object ))        to Focusable
  254.         else if Val EQ HELP_SAVE_CTX_BTN_TYPE       set Focus_Mode of (Save_Ctx_Buttons( Current_Object ))       to Focusable
  255.         else if Val EQ HELP_DELETE_CTX_XRF_BTN_TYPE set Focus_Mode of (Delete_Ctx_Xrf_Buttons( Current_Object )) to Focusable
  256.         else if Val EQ HELP_DELETE_CTX_BTN_TYPE     set Focus_Mode of (Delete_Ctx_Buttons( Current_Object ))     to Focusable
  257.         else if Val EQ HELP_DELETE_XRF_BTN_TYPE     set Focus_Mode of (Delete_Xrf_Buttons( Current_Object ))     to Focusable
  258.     end_procedure
  259.  
  260.     procedure quit_help_edit
  261.         procedure_return msg_quit_help_edit
  262.     end_procedure
  263. end_object
  264.  
  265. //------------------- HELP_EDIT_CONSTRAINTED_DATA_SET ----------------//
  266.  
  267. class Help_Edit_Constrained_Data_Set is a Data_Set
  268.     procedure Construct_Object integer Img
  269.         forward send Construct_Object Img
  270.  
  271.         property integer Constrain_To_Grp Public 1
  272.         property integer Constrain_To_Sbj Public 1
  273.     end_procedure
  274.  
  275.     begin_constraints
  276.         if (Constrain_To_Grp( Current_Object )) constrain xrf relates to grp
  277.         if (Constrain_To_Sbj( Current_Object )) constrain xrf relates to sbj
  278.     end_constraints
  279. end_class
  280.  
  281. class help_edit_prompt_client_button is a key_button
  282.     procedure construct_object integer img
  283.         forward send construct_object img
  284.  
  285.         item_list
  286.             on_item "<F4=Prompt>"  send prompt to (parent(current_object))
  287.             on_item "<Esc=Cancel>" send request_cancel_area
  288.             on_item "<F1=Help>"    send help
  289.         end_item_list
  290.  
  291.         on_key kcancel           send request_cancel_area
  292.         on_key kprompt           send prompt to (parent(current_object))
  293.         on_key ksave_record      send request_ok
  294.     end_procedure
  295.  
  296.     procedure set shadow_prompt_state integer flag
  297.         set shadow_state item 0 to flag
  298.     end_procedure
  299.  
  300.     function shadow_prompt_state returns integer
  301.         function_return (shadow_state(current_object,0))
  302.     end_function
  303. end_class
  304.  
  305. class Help_Edit_Import_Export_Client is a Client
  306.     procedure Construct_Object integer Img integer File_Img integer Btns_Img
  307.  
  308.         set Block_Mouse_State to True
  309.         set Popup_State       to True
  310.         set Scope_State       to True
  311.  
  312.         object Path is a Form File_Img
  313.             item_list
  314.                 on_item "" send Ok
  315.             end_item_list
  316.  
  317.             on_key kExit_Application send Quit_Help_Edit
  318.         end_object
  319.  
  320.         object Buttons is a Button Btns_Img
  321.             item_list
  322.                 on_item "<F2=OK>"      send Ok
  323.                 on_item "<Esc=Cancel>" send Cancel
  324.                 on_item "<F1=Help>"    send Help
  325.             end_item_list
  326.  
  327.             on_key kExit_Application send Quit_Help_Edit
  328.         end_object
  329.  
  330.         on_key kSave_Record      send Ok
  331.         on_key kCancel           send Cancel
  332.     end_procedure
  333.  
  334.     function Filename returns string
  335.         function_return (Value( Path( Current_Object ), 0 ))
  336.     end_function
  337.  
  338.     procedure Quit_Help_Edit
  339.         delegate send Quit_Help_Edit
  340.         procedure_return Msg_Cancel
  341.     end_procedure
  342. end_class
  343.  
  344. //---------------------  HELP_EDIT_OBJECT_BROWSER class  -----------------//
  345.  
  346. class help_edit_object_browser is a client
  347.   procedure construct_object integer img integer parent_img ;
  348.     integer current_img integer child_img
  349.  
  350.     forward send construct_object img
  351.  
  352.     set scope_state to true
  353.   
  354.     object parent_button is a button parent_img
  355.       item_list
  356.         on_item "" send select_parent
  357.       end_item_list
  358.     end_object
  359.  
  360.     object current_button is a button current_img
  361.       item_list
  362.         on_item "" send select_current
  363.       end_item_list
  364.     end_object
  365.   
  366.     object child_list is a list child_img
  367.     end_object
  368.   end_procedure
  369.  
  370.   procedure delete_data
  371.     send delete_data to (parent_button(current_object))
  372.     set checkbox_item_state of (parent_button(current_object)) to false
  373.     send delete_data to (current_button(current_object))
  374.     set checkbox_item_state of (current_button(current_object)) to false
  375.     send delete_data to (child_list(current_object))
  376.   end_procedure
  377.  
  378.   procedure set select_mode integer sel_mode
  379.     set select_mode of (parent_button(current_object)) to sel_mode
  380.     set select_mode of (current_button(current_object)) to sel_mode
  381.     set select_mode of (child_list(current_object)) to sel_mode
  382.   end_procedure
  383.  
  384.   function select_mode returns integer
  385.     function_return (select_mode( child_list( current_object ) ))
  386.   end_function
  387.  
  388.   function browse_name integer obj returns string
  389.     function_return (name(obj)) // can be overridden
  390.   end_function
  391.   
  392.   procedure select_parent
  393.     send display_object (aux_value( parent_button( current_object), 0 ))
  394.   end_procedure
  395.     
  396.   procedure select_current
  397.     // for override
  398.   end_procedure
  399.  
  400.   procedure select_child
  401.     send display_object (aux_value( child_list(current_object), current ))
  402.   end_procedure
  403.  
  404.   procedure store_object integer id integer obj integer itm
  405.     if id ne 0 set value of obj item itm to (browse_name(current_object,id))
  406.     else set value of obj item itm to ""
  407.  
  408.     set aux_value of obj item itm to id
  409.   end_procedure
  410.  
  411.   procedure display_object integer id
  412.     local integer counter old_obj chd chd_count
  413.  
  414.     if id ne 0 begin
  415.       set dynamic_update_state of (parent_button( current_object )) to false
  416.       set dynamic_update_state of (current_button( current_object )) to false
  417.       set dynamic_update_state of (child_list( current_object )) to false
  418.       send delete_data
  419.       send store_object id (current_button( current_object )) 0
  420.  
  421.       if id ne desktop send store_object (parent(id)) ;
  422.         (parent_button(current_object)) 0
  423.       else send store_object 0 (parent_button(current_object)) 0
  424.  
  425.       move 1 to counter
  426.       get child_count of id to chd_count
  427.       move current_object to old_obj
  428.  
  429.       while counter le chd_count
  430.         move id to current_object
  431.         get object_id of (-counter) to chd
  432.         move old_obj to current_object
  433.  
  434.         if chd ne 0 begin
  435.           send add_item to (child_list(current_object)) msg_select_child ""
  436.           send store_object chd (child_list(current_object)) ;
  437.             (item_count( child_list(current_object ) ) - 1)
  438.         end
  439.  
  440.         increment counter
  441.       end
  442.  
  443.       set current_item of (child_list( current_object )) to 0
  444.       set dynamic_update_state of (parent_button(current_object)) to true
  445.       set dynamic_update_state of (current_button(current_object)) to true
  446.       set dynamic_update_state of (child_list(current_object)) to true
  447.       if not (active_state(current_object)) send activate
  448.       send activate to (current_button(current_object))
  449.     end
  450.   end_procedure
  451. end_class
  452.  
  453. //---------------------  HELP_EDIT_CONTEXT_BROWSER class  -----------------//
  454.  
  455. class Help_Edit_Context_Browser is a help_edit_Object_Browser
  456.     procedure Construct_Object integer Img integer Par_Img ;
  457.       integer Cur_Img integer Chd_Img
  458.         forward send Construct_Object Img Par_Img cur_Img Chd_Img
  459.  
  460.         property integer Invoking_Object Public
  461.  
  462.         set Block_Mouse_State to True
  463.         set Popup_State       to True
  464.         set Scope_State       to True
  465.         set Select_Mode       to Multi_Select
  466.  
  467.         on_key key_Alt+key_F1    send Original_Context
  468.         on_key key_Alt+key_F2    send Display_Topic
  469.         on_key kCancel           send Exit_Object
  470.         on_key kDelete_Record    send Delete_Context
  471.         on_key kExit_Application send Quit_Help_Edit
  472.         on_key kSave_Record      send Save_Context
  473.         on_key kSpace            send None
  474.     end_procedure
  475.  
  476.     procedure Activate returns integer
  477.         local integer Retval
  478.         set Invoking_Object to (Focus( Desktop ))
  479.         forward get Msg_Activate to Retval
  480.         procedure_return Retval
  481.     end_procedure
  482.  
  483.     function Browse_Name integer Obj returns string
  484.         function_return (Context_Help_Name( Obj ))
  485.     end_function
  486.  
  487.     function Find_Context integer Obj returns integer
  488.         clear Ctx
  489.         get Application_Name  of Obj to Ctx.App_Name
  490.         get Module_Name       of Obj to Ctx.Mod_Name
  491.         get Context_Help_Name of Obj to Ctx.Hlp_Name
  492.         find EQ Ctx.Hlp_Name
  493.         [ Found ] function_return 1
  494.     end_function
  495.  
  496.     function Find_Valid_Context integer Obj integer Cur_Xrf returns integer
  497.         local integer Ret_Val
  498.  
  499.         get Find_Context Obj to Ret_Val
  500.         if (Ret_Val and Ctx.Xrf_Recnum = Cur_Xrf) function_return 1
  501.     end_function
  502.  
  503.     procedure Store_Object integer Ctx_Obj integer Obj integer Itm
  504.         forward send Store_Object Ctx_Obj Obj Itm
  505.  
  506.         set Checkbox_Item_State of Obj item Itm to (Ctx_Obj <> 0)
  507.         set Select_State of Obj item Itm ;
  508.           to (if( Ctx_Obj = 0, 0, Find_Valid_Context( Current_Object, Ctx_Obj, ;
  509.           Current_Record( Invoking_Object( Current_Object ) ) ) ))
  510.     end_procedure
  511.  
  512.     procedure Popup
  513.         local integer Obj
  514.  
  515.         forward send Popup
  516.         send Original_Context
  517.     end_procedure
  518.  
  519.     procedure Original_Context
  520.         local integer Obj
  521.  
  522.         get Original_Focus of (Invoking_Object( Current_Object )) to Obj
  523.         send Display_Object Obj
  524.     end_procedure
  525.  
  526.     procedure Display_Topic
  527.         local integer Obj Ret_Val
  528.  
  529.         get Aux_Value of (Focus(Desktop)) item Current to Obj
  530.         get Find_Context Obj to Ret_Val
  531.  
  532.         if Ret_Val begin
  533.             get Server of (Invoking_Object( Current_Object )) to Obj
  534.  
  535.             set Constrain_To_Grp of Obj to False
  536.             set Constrain_To_Sbj of Obj to False
  537.             send Rebuild_Constraints to Obj
  538.             send Find_By_Recnum to Obj Xrf.File_Number Ctx.Xrf_Recnum
  539.             set Constrain_To_Grp of Obj to True
  540.             set Constrain_To_Sbj of Obj to True
  541.             send Rebuild_Constraints to Obj
  542.  
  543.             send Exit_Object
  544.         end
  545.         else send Bell // no context exists
  546.     end_procedure
  547.  
  548.     procedure Save_Context
  549.         local integer Cur_Xrf Foc Inv_Obj
  550.  
  551.         get Focus of Desktop to Foc
  552.         if (Select_State( Foc, Current )) procedure_return
  553.  
  554.         get Invoking_Object to Inv_Obj
  555.  
  556.         indicate Err False
  557.         send Save_Help to Help_Editor Inv_Obj False
  558.         get Current_Record of Inv_Obj to Cur_Xrf
  559.  
  560.         if Cur_Xrf EQ 0 procedure_return // could not/did not save
  561.  
  562.         clear Ctx
  563.         get Application_Name to Ctx.App_Name
  564.         get Module_Name to Ctx.Mod_Name
  565.         get Value of Foc to Ctx.Hlp_Name
  566.  
  567.         indicate Err False
  568.         lock
  569.         [ not Err ] find EQ Ctx.Hlp_Name
  570.         [ not Err ] move Cur_Xrf to Ctx.Xrf_Recnum
  571.         [ not Err ] saverecord Ctx
  572.         unlock
  573.         [ not Err ] set Select_State of Foc to True
  574.     end_procedure
  575.  
  576.     procedure Delete_Context
  577.         local integer Cur_Xrf Foc
  578.  
  579.         get Focus of Desktop to Foc
  580.         if not (Select_State( Foc, Current )) procedure_return
  581.  
  582.         get Current_Record of (Invoking_Object( Current_Object )) to Cur_Xrf
  583.  
  584.         clear Ctx
  585.         get Application_Name to Ctx.App_Name
  586.         get Module_Name to Ctx.Mod_Name
  587.         get Value of Foc to Ctx.Hlp_Name
  588.         find EQ Ctx.Hlp_Name
  589.  
  590.         indicate Err False
  591.         reread Ctx
  592.         [ not Err ] delete Ctx
  593.         unlock
  594.         [ not Err ] set Select_State of Foc to False
  595.     end_procedure
  596.  
  597.     procedure Deactivating returns integer
  598.         local integer Retval
  599.         forward get Msg_Deactivating to Retval
  600.         send Delete_Data
  601.         procedure_return Retval
  602.     end_procedure
  603.  
  604.     procedure Exit_Object
  605.         local integer Obj
  606.  
  607.         get Prior_Scope to Obj
  608.         if Obj EQ 0 move Desktop to Obj
  609.         set Current_Scope to Obj
  610.         send Deactivate
  611.     end_procedure
  612.  
  613.     procedure quit_help_edit
  614.         send exit_object
  615.         send quit_help_edit to (focus(desktop))
  616.     end_procedure
  617. end_class
  618.  
  619. //---------------------------  HELP_SYSTEM_EDITOR class  -------------------//
  620.  
  621. class Help_System_Editor is a HELP
  622.     procedure Construct_Object integer Img
  623.         local integer Obj
  624.  
  625.         forward send Construct_Object Img
  626.  
  627.         property string  Context_Filename        Public  HELP_CTX_FILENAME
  628.         property string  Filename_Prefix         Private HELP_FILENAME_PREFIX
  629.         property string  Group_Filename          Public  HELP_GRP_FILENAME
  630.         property string  Link_Filename           Public  HELP_XRF_FILENAME
  631.         property integer Original_Focus          Public  0
  632.         property integer Remain_Open_State       Public  0
  633.         property string  Subject_Filename        Public  HELP_SBJ_FILENAME
  634.  
  635.         move Current_Object to Obj
  636.  
  637.         object Grp_Data is a Data_Set no_image main_file Grp
  638.             set Focus_Mode to No_Activate
  639.         end_object
  640.  
  641.         object Sbj_Data is a Data_Set no_image main_file Sbj
  642.             set Focus_Mode to No_Activate
  643.         end_object
  644.  
  645.         object Xrf_Data is a Help_Edit_Constrained_Data_Set no_image ;
  646.           main_file Xrf updating (Grp_Data( Obj )) (Sbj_Data( Obj ))
  647.             set Focus_Mode to No_Activate
  648.         end_object
  649.     end_procedure
  650.  
  651.     procedure Open_Help integer Local_Open
  652.         if (Active_State( Current_Object )) procedure_return
  653.         if Num_Arguments LE 0 set Remain_Open_State to True
  654.         open (Group_Filename( Current_Object ))   as Grp // language
  655.         open (Subject_Filename( Current_Object )) as Sbj // dependent file
  656.         open (Link_Filename( Current_Object ))    as Xrf // names are in
  657.         open (Context_Filename( Current_Object )) as Ctx // properties
  658.     end_procedure
  659.  
  660.     procedure Close_Help integer Local_Close
  661.         if (Num_Arguments Min 1) NE (Remain_Open_State( Current_Object )) begin
  662.             close Grp
  663.             close Sbj
  664.             close Xrf
  665.             close Ctx
  666.         end
  667.     end_procedure
  668.  
  669.     procedure Set Filename_Prefix string Prefix
  670.         local integer Old_Pre_Len
  671.         local string Old_Name
  672.  
  673.         length (!$.Filename_Prefix( Current_Object )) to Old_Pre_Len
  674.         set !$.Filename_Prefix to Prefix
  675.  
  676.         get Group_Filename to Old_Name
  677.         set Group_Filename to ;
  678.           (Prefix + mid( Old_Name, length( Old_Name ) - Old_Pre_Len, Old_Pre_Len + 1 ))
  679.  
  680.         get Subject_Filename to Old_Name
  681.         set Subject_Filename to ;
  682.           (Prefix + mid( Old_Name, length( Old_Name ) - Old_Pre_Len, Old_Pre_Len + 1 ))
  683.  
  684.         get Link_Filename to Old_Name
  685.         set Link_Filename to ;
  686.           (Prefix + mid( Old_Name, length( Old_Name ) - Old_Pre_Len, Old_Pre_Len + 1 ))
  687.  
  688.         get Context_Filename to Old_Name
  689.         set Context_Filename to ;
  690.           (Prefix + mid( Old_Name, length( Old_Name ) - Old_Pre_Len, Old_Pre_Len + 1 ))
  691.     end_procedure
  692.  
  693.     function Filename_Prefix returns string
  694.         function_return (!$.Filename_Prefix( Current_Object ))
  695.     end_function
  696.  
  697.     procedure Request_Cancel
  698.         send Deactivate_Area
  699.     end_procedure
  700. end_class
  701.  
  702. //-------------------------------------------------------------------------//
  703. //-------------------------  CTX_ASSIGNMENT object  -----------------------//
  704. //-------------------------------------------------------------------------//
  705.  
  706. /Help_Edit_Ctx_Img
  707. ╔═════════════════════════════════════════════════════╗
  708. ║                 Context Maintenance                 ║
  709. ║ Parent:                                             ║
  710. ║ ___________________________________________________ ║
  711. ║─────────────────────────────────────────────────────║
  712. ║ Current:                                            ║
  713. ║ ___________________________________________________ ║
  714. ║─────────────────────────────────────────────────────║
  715. ║ Children:                                           ║
  716. ║ ___________________________________________________ ║
  717. ║ ___________________________________________________ ║
  718. ║ ___________________________________________________ ║
  719. ║ ___________________________________________________ ║
  720. ║ ___________________________________________________ ║
  721. ║─────────────────────────────────────────────────────║
  722. ║ ___________  ___________________  _________________ ║
  723. ║  ______________________   ___________   _________   ║
  724. ╚═════════════════════════════════════════════════════╝
  725. /*
  726. //<F2=Select>  <Shift+F2=Deselect>  <Alt+F1=Original>
  727. // <Alt+F2=Display topic>   <Esc=Close>   <F1=Help>
  728.  
  729. sub_page Help_Edit_Parent_Ctx_Img  from Help_Edit_Ctx_Img 1
  730. sub_page Help_Edit_Current_Ctx_Img from Help_Edit_Ctx_Img 2
  731. sub_page Help_Edit_Child_Ctx_Img   from Help_Edit_Ctx_Img Vertical 3 5
  732. sub_page Help_Edit_Ctx_Keys_Img    from Help_Edit_Ctx_Img Horizontal 8 6
  733.  
  734. object Ctx_Assignment is a Help_Edit_Context_Browser Help_Edit_Ctx_Img ;
  735.   Help_Edit_Parent_Ctx_Img Help_Edit_Current_Ctx_Img ;
  736.   Help_Edit_Child_Ctx_Img
  737.  
  738.     set Location to 7 13 Relative
  739.  
  740.     object Keys is a Key_Button Help_Edit_Ctx_Keys_Img
  741.         set Focus_Mode to Pointer_Only
  742.  
  743.         item_list
  744.             on_item "<F2=Select>"            send Save_Context
  745.             on_item "<Shift+F2=Deselect>"    send Delete_Context
  746.             on_item "<Alt+F1=Original>"      send Original_Context
  747.             on_item "<Alt+F2=Display topic>" send Display_Topic
  748.             on_item "<Esc=Close>"            send Exit_Object
  749.             on_item "<F1=Help>"              send Help
  750.         end_item_list
  751.     end_object
  752. end_object
  753.  
  754. //--------------------------------------------------------------------------//
  755. //------------------------------  HELP_EDITOR object  ------------------------//
  756. //--------------------------------------------------------------------------//
  757.  
  758. /Help_Edit_Img
  759. ╔═══════════════════════ Edit Help ═══════════════════════╗
  760. ║                                                         ║
  761. ║                                                         ║
  762. ║                                                         ║
  763. ║                                                         ║
  764. ║─────────────────────────────────────────────────────────║
  765. ║                                                         ║
  766. ║                                                         ║
  767. ║                                                         ║
  768. ║                                                         ║
  769. ║                                                         ║
  770. ║                                                         ║
  771. ║                                                         ║
  772. ║                                                         ║
  773. ║                                                         ║
  774. ║                                                         ║
  775. ║─────────────────────────────────────────────────────────║
  776. ║                                                         ║
  777. ║                                                         ║
  778. ║                                                         ║
  779. ╚═════════════════════════════════════════════════════════╝
  780. /Help_Edit_Zoom_Keys_Img
  781.          ____________________         _________          
  782. /Help_Edit_Action_Bar_Img
  783.   ______  ____  ___________  ____                        
  784. /Help_Edit_Record_Exit_Pull_Down_Img
  785. ┌───────────────────────────────┐
  786. │ _____________________________ │
  787. │ _____________________________ │
  788. │ _____________________________ │
  789. │ _____________________________ │
  790. │ _____________________________ │
  791. │ _____________________________ │
  792. │ _____________________________ │
  793. │ _____________________________ │
  794. │ _____________________________ │
  795. │ _____________________________ │
  796. │ _____________________________ │
  797. │ _____________________________ │
  798. ├───────────────────────────────┤
  799. │ _____________________________ │
  800. └───────────────────────────────┘
  801. /Help_Edit_Text_Pull_Down_Img
  802. ┌─────────────────────────┐
  803. │ _______________________ │
  804. │ _______________________ │
  805. │ _______________________ │
  806. │ _______________________ │
  807. │ _______________________ │
  808. │ _______________________ │
  809. │ _______________________ │
  810. └─────────────────────────┘
  811. /Help_Edit_Maint_Pull_Down_Img
  812. ┌───────────────────────┐
  813. │ _____________________ │
  814. │ _____________________ │
  815. └───────────────────────┘
  816. /Help_Edit_Help_Pull_Down_Img
  817. ┌──────────────────┐
  818. │ ________________ │
  819. │ ________________ │
  820. │ ________________ │
  821. │ ________________ │
  822. └──────────────────┘
  823. /*
  824. /Help_Edit_Topic_Img
  825.      Group: _________________________________ 
  826.    Subject: _________________________________ 
  827. /Help_Edit_Link_Status_Img
  828.  Linked:   
  829.    ___     
  830. /Help_Edit_Keys_Img
  831.     ___________      __________    __________________    
  832.     _________________      ___________      _________    
  833. /*
  834. //  <F4=Prompt>      <F5=Clear>    <Alt+F9=Zoom text>
  835. //  <Alt+F1=Original>      <Esc=Close>      <F1=Help>
  836.  
  837. /Help_Edit_Export_Img
  838. ╔════════════════════════════════════════════╗
  839. ║  File to export text to:                   ║
  840. ║  ________________________________________  ║ 
  841. ║                                            ║
  842. ║    _______    ____________    _________    ║
  843. ╚════════════════════════════════════════════╝
  844. /*
  845. //   <F2=OK>    <Esc=Cancel>    <F1=Help>
  846. sub_page Help_Edit_Export_File_Img from Help_Edit_Export_Img 1
  847. sub_page Help_Edit_Export_Btns_Img from Help_Edit_Export_Img 2 3 4
  848.  
  849. /Help_Edit_Import_Img
  850. ╔════════════════════════════════════════════╗
  851. ║  File to import text from:                 ║
  852. ║  ________________________________________  ║ 
  853. ║                                            ║
  854. ║    _______    ____________    _________    ║
  855. ╚════════════════════════════════════════════╝
  856. /*
  857. //   <F2=OK>    <Esc=Cancel>    <F1=Help>
  858. sub_page Help_Edit_Import_File_Img from Help_Edit_Import_Img 1
  859. sub_page Help_Edit_Import_Btns_Img from Help_Edit_Import_Img 2 3 4
  860.  
  861. object Help_Editor is a Help_System_Editor Help_Edit_Img
  862.     register_object help_edit_grp_prompt
  863.     register_object help_edit_sbj_prompt
  864.  
  865.     set Block_Mouse_State to True
  866.     set Client_Area_State to True
  867.     set Location          to 2 11 Relative
  868.     set Popup_State       to True
  869.     set Ring_State        to True
  870.     set Scope_State       to True
  871.  
  872. //- - - - - - - - - - - - - HELP_EDIT_ACTION_BAR object  - - - - - - - - - -//
  873.  
  874.     create_menu Action_Bar Help_Edit_Action_Bar_Img
  875.         set Action_Bar_Keys_Msg to Help_Editor_Keys
  876.         set Location            to 1 1 Relative
  877.  
  878.         on_item "Record" begin_pull_down Record_Pull_Down Help_Edit_Record_Exit_Pull_Down_Img
  879.             on_item "Clear/Add                  F5" send Request_Clear
  880.             on_item "Clear all             Ctrl+F5" send Request_Clear_All
  881.             on_item "Delete               Shift+F2" send Request_Delete
  882.             on_item "Find                       F9" send Find_GE
  883.             on_item "Next                       F8" send Find_Next
  884.             on_item "Previous                   F7" send Find_Previous
  885.             on_item "Superfind            Shift+F9" send Superfind
  886.             on_item "Superfind next       Shift+F8" send Superfind_Next
  887.             on_item "Superfind previous   Shift+F7" send Superfind_Previous
  888.             on_item "Find first          Ctrl+Home" send Beginning_Of_Data
  889.             on_item "Find last            Ctrl+End" send End_Of_Data
  890.             on_item "Save                       F2" send Request_Save
  891.             on_item "Exit"                          send Exit_Area
  892.         
  893.             on_key kexit_application send quit_help_edit
  894.         end_pull_down
  895.  
  896.         register_object Text_Pull_Down
  897.         on_item "Text" send Activate_Pull_Down to (Text_Pull_Down( Current_Object ))
  898.  
  899.         object Text_Pull_Down is a Shadow_Text_Pull_Down_Menu Help_Edit_Text_Pull_Down_Img
  900.             multi$ register_procedure Mark_Block Mark_Column Cut_Marked_Area
  901.             multi$ register_procedure Copy_Marked_Area Paste_Block
  902.  
  903.             item_list
  904.                 on_item "Block mark"            send Mark_Block
  905.                 on_item "Column mark"           send Mark_Column
  906.                 on_item "Cut marked text"       send Cut_Marked_Area
  907.                 on_item "Copy marked text"      send Copy_Marked_Area
  908.                 on_item "Paste text"            send Paste_Block
  909.                 on_item "Import file..."        send Import_Text
  910.                 on_item "Export marked text..." send Export_Marked_Area
  911.             end_item_list
  912.  
  913.             on_key kexit_application send quit_help_edit
  914.         end_object
  915.  
  916.         on_item "Maintenance" begin_pull_down Maint_Pull_Down Help_Edit_Maint_Pull_Down_Img
  917.             on_item "Context assignment..." send Context_Assignment
  918.             on_item "Cleanup..."            send Cleanup
  919.  
  920.             on_key kexit_application send quit_help_edit
  921.         end_pull_down
  922.  
  923.         on_item "Help" begin_pull_down Help_Pull_Down Help_Edit_Help_Pull_Down_Img
  924.             on_item "Help for help..." send Help_For_Help to Desktop
  925.             on_item "Extended help..." send Extended_Help to Desktop
  926.             on_item "Keys help..."     send Keys_Help     to Desktop
  927.             on_item "Help index..."    send Help_Index    to Desktop
  928.  
  929.             on_key kexit_application send quit_help_edit
  930.         end_pull_down
  931.     end_menu
  932.  
  933.     procedure Help_Editor_Keys for Desktop integer Obj
  934.         on_key key_Alt+key_R send Activate to (Record_Pull_Down( Obj )) Private
  935.         on_key key_Alt+key_T send Activate to (Text_Pull_Down( Obj )) Private
  936.         on_key key_Alt+key_M send Activate to (Maint_Pull_Down( Obj )) Private
  937.         on_key key_Alt+key_H send Activate to (Help_Pull_Down( Obj )) Private
  938.     end_procedure
  939.   
  940.     object topic is an entry_form Help_Edit_topic_img ;
  941.             using (Xrf_Data( Help_Editor( Desktop ) )) ;
  942.             action_bar (Action_Bar( Help_Editor( Desktop ) ))
  943.  
  944.         set auto_clear_deo_state to false
  945.         set Location         to 3 1 Relative
  946.  
  947.         item_list
  948.             entry_item grp.grp_name { autofind, iprompt=(Help_Edit_grp_prompt(desktop)) }
  949.             entry_item sbj.sbj_name { iprompt=(Help_Edit_sbj_prompt(desktop)) }
  950.         end_item_list
  951.  
  952.         on_key key_Alt+key_F1     send Original_Help     Private
  953.         on_key kExit_Application  send Request_Cancel    Private
  954.         on_key kZoom              send Toggle_Zoom_Text  Private
  955.         on_key kSwitch_Panel      send None              Private
  956.         on_key kSwitch_Panel_Back send None              Private
  957.  
  958.         procedure request_cancel
  959.             delegate send request_cancel
  960.         end_procedure
  961.  
  962.         procedure request_clear
  963.             send request_clear_all
  964.         end_procedure
  965.  
  966.         procedure request_delete
  967.             delegate send delete_help
  968.         end_procedure
  969.  
  970.         procedure request_save
  971.             local integer cur_grp cur_sbj cur_xrf
  972.  
  973.             get current_record of (grp_data(help_editor(desktop))) to cur_grp
  974.             get current_record of (sbj_data(help_editor(desktop))) to cur_sbj
  975.             get current_record of (xrf_data(help_editor(desktop))) to cur_xrf
  976.             if ((cur_grp or cur_sbj) and not(cur_xrf)) set changed_state to true
  977.  
  978.             delegate send save_help (focus(desktop)) true
  979.         end_procedure
  980.  
  981.         procedure request_superfind integer mode
  982.             local integer Obj
  983.  
  984.             get Server to Obj
  985.             set Constrain_To_Grp of Obj to False
  986.             set Constrain_To_Sbj of Obj to False
  987.             send rebuild_constraints to Obj
  988.             forward send request_superfind mode
  989.             set Constrain_To_Grp of Obj to True
  990.             set Constrain_To_Sbj of Obj to True
  991.             send rebuild_constraints to Obj
  992.         end_procedure
  993.     end_object
  994.  
  995.     object link_status is an entry_form Help_Edit_link_status_img ;
  996.             using (Xrf_Data( Help_Editor( Desktop ) ))
  997.         register_function link_value returns string
  998.  
  999.         set auto_fill_state to true
  1000.         set skip_state      to true
  1001.         set location        to 3 47 relative
  1002.  
  1003.         item_list
  1004.             entry_item (link_value(current_object))
  1005.         end_item_list
  1006.  
  1007.         function link_value returns string
  1008.             if xrf.recnum eq 0 function_return NO_STATUS_STRING
  1009.             else function_return YES_STATUS_STRING
  1010.         end_function
  1011.  
  1012.         procedure entry_clear integer flag
  1013.             forward send entry_clear flag
  1014.             send clear_item_value
  1015.         end_procedure
  1016.  
  1017.         procedure entry_clear_all integer flag
  1018.             forward send entry_clear_all flag
  1019.             send clear_item_value
  1020.         end_procedure
  1021.  
  1022.         procedure clear_item_value
  1023.             if (grp.recnum <> 0 and sbj.recnum <> 0) ;
  1024.                 set value item 0 to "No"
  1025.         end_procedure
  1026.     end_object
  1027.  
  1028.     object text is a Help_Maintenance_Text_Window using (Xrf_Data( Help_Editor( Desktop ) )) ;
  1029.             action_bar (Action_Bar( Help_Editor( Desktop ) ))
  1030.  
  1031.         set Auto_Clear_Deo_State to False
  1032.         set Location             to 6 1 Relative
  1033.         set Size                 to 10 56
  1034.  
  1035.         assign_dbms_field Sbj.Sbj_Text
  1036.  
  1037.         object zoom_keys is a key_button help_edit_zoom_keys_img
  1038.             set Location   to 18 0 Relative
  1039.             set Focus_Mode to No_Activate
  1040.  
  1041.             item_list
  1042.                 on_item "<Alt+F9=Cancel zoom>" send Toggle_Zoom_Text
  1043.                 on_item "<F1=Help>"            send Help
  1044.             end_item_list
  1045.         end_object
  1046.  
  1047.         object Export_File is a Help_Edit_Import_Export_Client Help_Edit_Export_Img Help_Edit_Export_File_Img Help_Edit_Export_Btns_Img
  1048.             set Location to 3 5 Relative
  1049.         end_object
  1050.  
  1051.         set Export_Object to (Export_File( Current_Object ))
  1052.  
  1053.         object Import_File is a Help_Edit_Import_Export_Client Help_Edit_Import_Img Help_Edit_Import_File_Img Help_Edit_Import_Btns_Img
  1054.             set Location to 3 5 Relative
  1055.         end_object
  1056.  
  1057.         set Import_Object to (Import_File( Current_Object ))
  1058.  
  1059.         on_key key_Alt+key_F1     send Original_Help      Private
  1060.         on_key key_Alt+key_A      send Context_Assignment Private
  1061.         on_key kCancel            send Request_Cancel     Private
  1062.         on_key kExit_Application  send Request_Cancel     Private
  1063.         on_key kZoom              send Toggle_Zoom_Text   Private
  1064.  
  1065.         procedure Prompt
  1066.             if not (Zoom_State( Current_Object )) ;
  1067.                     send Popup to (Help_Edit_Sbj_Prompt( Desktop ))
  1068.         end_procedure
  1069.  
  1070.         procedure Request_Save
  1071.             local integer Cur_Grp Cur_Sbj Cur_Xrf
  1072.  
  1073.             get Current_Record of (Grp_Data( Help_Editor( Desktop ) )) to Cur_Grp
  1074.             get Current_Record of (Sbj_Data( Help_Editor( Desktop ) )) to Cur_Sbj
  1075.             get Current_Record of (Xrf_Data( Help_Editor( Desktop ) )) to Cur_Xrf
  1076.             if ((Cur_Grp or Cur_Sbj) and not( Cur_Xrf )) set Changed_State to True
  1077.  
  1078.             delegate send Save_Help (Focus( Desktop )) True
  1079.         end_procedure
  1080.  
  1081.         procedure Request_Delete
  1082.             delegate send Delete_Help
  1083.         end_procedure
  1084.  
  1085.         procedure Request_Cancel
  1086.             delegate send Request_Cancel
  1087.             if (Zoom_State( Current_Object )) send Shrink_Text
  1088.         end_procedure
  1089.  
  1090.         procedure Request_Clear
  1091.             send Request_Clear_All
  1092.         end_procedure
  1093.  
  1094.         procedure Request_Clear_All
  1095.             forward send Request_Clear_All
  1096.             if (Zoom_State( Current_Object )) send Shrink_Text
  1097.             set Current_Item of (Topic( Parent( Current_Object ) )) to 0
  1098.             send Activate to (Topic( Parent( Current_Object ) ))
  1099.         end_procedure
  1100.  
  1101.         procedure Toggle_Zoom_Text
  1102.             if not (Zoom_State( Current_Object )) send Zoom_Text
  1103.             else send Shrink_Text
  1104.         end_procedure
  1105.  
  1106.         procedure Zoom_Text
  1107.             set Location to 1 1 Relative
  1108.             set Size to 18 56
  1109.  
  1110.             set Focus_Mode of (Zoom_Keys( Current_Object )) to Pointer_Only
  1111.             send Add_Focus to (zoom_keys( Current_Object )) Current_Object
  1112.             if (Focus( Desktop )) NE Current_Object send Activate
  1113.  
  1114.             set Zoom_State to True
  1115.         end_procedure
  1116.  
  1117.         procedure Shrink_Text
  1118.             send Deactivate to (Zoom_Keys( Current_Object ))
  1119.             set Focus_mode of (Zoom_Keys( Current_Object )) to No_Activate
  1120.  
  1121.             set Size to 10 56
  1122.             set Location to 6 1 Relative
  1123.  
  1124.             set Zoom_State to False
  1125.         end_procedure
  1126.     end_object // Text
  1127.  
  1128. //- - - - - - - - - - - - - - - -  KEYS object  - - - - - - - - - - - - - - -//
  1129.  
  1130.     object Keys is a Key_Button Help_Edit_Keys_Img
  1131.         set Location to 18 1 Relative
  1132.  
  1133.         item_list
  1134.             on_item "<F4=Prompt>"                 send Prompt
  1135.             on_item "<F5=Clear>"                  send Request_Clear
  1136.             on_item "<Alt+F9=Zoom text>"          send Toggle_Zoom_Text
  1137.             on_item "<Alt+F1=Original>"           send Original_Help
  1138.             on_item "<Esc=Close>"                 send Request_Cancel
  1139.             on_item "<F1=Help>"                   send Help
  1140.         end_item_list
  1141.     end_object
  1142.  
  1143. /help_edit_cleanup_img
  1144. ╔══════════════════════════════════════════════════════════════╗
  1145. ║______________________________________________________________║
  1146. ║                                                              ║
  1147. ║       This option deletes Context records for the current    ║
  1148. ║       Application and Module names, but with Help names      ║
  1149. ║       that do not match any Object names in the current      ║
  1150. ║       program.                                               ║
  1151. ║                                                              ║
  1152. ║       Warning: Using this option in programs with modified   ║
  1153. ║       Help name functions may delete valid Context           ║
  1154. ║       records.                                               ║
  1155. ║                                                              ║
  1156. ║          ________________________________________            ║
  1157. ║                                                              ║
  1158. ║  __________  _____________________  ___________  _________   ║
  1159. ╚══════════════════════════════════════════════════════════════╝
  1160. /*
  1161. // <F2=Begin>  <Alt+F2=Display only>  <Esc=Close>  <F1=Help>
  1162. sub_page help_edit_cleanup_title_img     from help_edit_cleanup_img 1
  1163. sub_page help_edit_cleanup_write_del_img from help_edit_cleanup_img 2
  1164. sub_page help_edit_cleanup_buttons_img   from help_edit_cleanup_img 3 4 5 6
  1165.  
  1166.     object cleanup is a client help_edit_cleanup_img
  1167.         set block_mouse_state to true
  1168.         set location          to 2 -2 relative
  1169.         set popup_state       to true
  1170.         set scope_state       to true
  1171.  
  1172.         object title_box is a title help_edit_cleanup_title_img
  1173.             set center_state item 0 to true
  1174.             set value item 0 to "Cleanup"
  1175.         end_object
  1176.  
  1177.         object write_del is a checkbox help_edit_cleanup_write_del_img
  1178.             set select_mode to single_select
  1179.  
  1180.             item_list
  1181.                 on_item "Write to .DEL file" send next
  1182.             end_item_list
  1183.  
  1184.             on_key key_alt+key_f2    send display_only   private
  1185.             on_key ksave_record      send request_begin  private
  1186.             on_key kcancel           send request_cancel private
  1187.             on_key kexit_application send quit_help_edit private
  1188.         end_object
  1189.  
  1190.         object buttons is a button help_edit_cleanup_buttons_img
  1191.             item_list
  1192.                 on_item "<F2=Begin>"            send request_begin
  1193.                 on_item "<Alt+F2=Display only>" send display_only
  1194.                 on_item "<Esc=Close>"          send request_cancel
  1195.                 on_item "<F1=Help>"            send help
  1196.             end_item_list
  1197.  
  1198.             on_key key_alt+key_f2    send display_only   private
  1199.             on_key ksave_record      send request_begin  private
  1200.             on_key kcancel           send request_cancel private
  1201.             on_key kexit_application send quit_help_edit private
  1202.         end_object
  1203.  
  1204. /help_edit_cleanup_process_img
  1205. ╔═══════════════════════════════════════════════════════════════╗
  1206. ║       Deleting invalid Context records for this program.      ║
  1207. ║                                                               ║
  1208. ║             Validated: _____.     Deleted: _____.             ║
  1209. ║                                                               ║
  1210. ║                                                               ║
  1211. ║                                                               ║
  1212. ╚═══════════════════════════════════════════════════════════════╝
  1213. /help_edit_cleanup_process_cancel_btn_img
  1214. ____________
  1215. /*
  1216.         object process is a client help_edit_cleanup_process_img
  1217.             set popup_state to true
  1218.             set location    to 2 -1 relative
  1219.  
  1220.             object button is a button help_edit_cleanup_process_cancel_btn_img
  1221.                 set location to 5 26 relative
  1222.  
  1223.                 item_list
  1224.                     on_item "<Esc=Cancel>" send none
  1225.                 end_item_list
  1226.  
  1227. /help_edit_cleanup_interrupt_img
  1228. ╔═══════════════════════════════════════════════════════╗
  1229. ║                 Cleanup interrupted.                  ║
  1230. ║                                                       ║
  1231. ║             _____________     ___________             ║
  1232. ╚═══════════════════════════════════════════════════════╝
  1233. /*
  1234.  
  1235.                 object interrupt is a button help_edit_cleanup_interrupt_img
  1236.                     set block_mouse_state to true
  1237.                     set location          to 0 -23 relative
  1238.                     set popup_state       to true
  1239.                     set scope_state       to true
  1240.  
  1241.                     item_list
  1242.                         on_item "<F2=Continue>" send ok
  1243.                         on_item "<Esc=Abort>"   send cancel
  1244.                     end_item_list
  1245.  
  1246.                     on_key ksave_record      send ok
  1247.                     on_key kcancel           send cancel
  1248.                     on_key kexit_application send cancel
  1249.                 end_object
  1250.  
  1251.                 function check_interrupt returns integer
  1252.                     local string trash
  1253.                     local integer wloc mloc ret_val
  1254.  
  1255.                     inkey trash
  1256.  
  1257.                     if (termchar eq kexit_application or ;
  1258.                         termchar eq kcancel or ;
  1259.                         termchar eq kmouse) begin
  1260.  
  1261.                         if (termchar eq kmouse) begin
  1262.                             get window_location item 1 to wloc
  1263.                             move (wloc + location(current_object)) to wloc
  1264.                             get absolute_mouse_location to mloc
  1265.                             if not (mloc >= wloc and mloc < (wloc + length(value(current_object,0)))) ;
  1266.                                 function_return 0
  1267.                         end
  1268.  
  1269.                         set kbd_input_mode to 1
  1270.                         set highlight_state to false
  1271.                         ui_accept (interrupt(current_object)) to ret_val
  1272.                         if ret_val ne msg_ok function_return 1
  1273.                         set highlight_state to true
  1274.                         set kbd_input_mode to 2
  1275.                     end
  1276.  
  1277.                     function_return 0
  1278.                 end_function
  1279.             end_object // button
  1280.  
  1281.             procedure init_process
  1282.                 set value item 0 to 0
  1283.                 set value item 1 to 0
  1284.             end_procedure
  1285.  
  1286.             function scan_for_key integer itm returns integer
  1287.                 local integer ret_val obj
  1288.  
  1289.                 set value item itm to (value(current_object,itm) + 1)
  1290.                 get check_interrupt of (button(current_object)) to ret_val
  1291.                 function_return ret_val
  1292.             end_function
  1293.         end_object // process
  1294.  
  1295. /help_edit_cleanup_display_list_img
  1296. ╔═══════════════════════════════════════════╗
  1297. ║___________________________________________║
  1298. ║                                           ║
  1299. ║                                           ║
  1300. ║                                           ║
  1301. ║                                           ║
  1302. ║                                           ║
  1303. ║                                           ║
  1304. ║                                           ║
  1305. ║                                           ║
  1306. ║                                           ║
  1307. ║                                           ║
  1308. ╚═══════════════════════════════════════════╝
  1309. /help_edit_cleanup_display_list_btn_img
  1310.          _______         _________        
  1311. /*
  1312. //       <F2=OK>         <F1=Help>
  1313.  
  1314.         object display_list is a client help_edit_cleanup_display_list_img
  1315.             set block_mouse_state   to true
  1316.             set center_state item 0 to true
  1317.             set location            to 0 8 relative
  1318.             set popup_state         to true
  1319.             set scope_state         to true
  1320.             set value        item 0 to "Records to be deleted"
  1321.  
  1322.             object button is a button help_edit_cleanup_display_list_btn_img
  1323.                 set location to 11 1 relative
  1324.  
  1325.                 item_list
  1326.                     on_item "<F2=OK>"   send request_ok
  1327.                     on_item "<F1=Help>" send help
  1328.                 end_item_list
  1329.  
  1330.                 on_key ksave_record      send request_ok     private
  1331.                 on_key kexit_application send quit_help_edit private
  1332.             end_object
  1333.  
  1334. // button before list places focus on button during default activate of client
  1335.  
  1336.             object list is a help_maintenance_text_window
  1337.                 set size            to 8 42
  1338.                 set location        to 3 1 relative
  1339.                 set read_only_state to true
  1340.  
  1341.                 on_key ksave_record send request_ok private
  1342.             end_object
  1343.  
  1344.             procedure insert_line string txt
  1345.                 local integer obj
  1346.                 local string newline
  1347.  
  1348.                 move (list(current_object)) to obj
  1349.  
  1350.                 set read_only_state of obj to false
  1351.                 send insert to obj txt
  1352.                 send process_key to obj kenter
  1353.                 set read_only_state of obj to true
  1354.             end_procedure
  1355.  
  1356.             procedure request_ok
  1357.                 send deactivate_area
  1358.                 send delete_data
  1359.                 delegate send restart
  1360.             end_procedure
  1361.  
  1362.             procedure delete_data
  1363.                 send delete_data to (list(current_object))
  1364.             end_procedure
  1365.  
  1366.             procedure release_focus returns integer
  1367.                 local integer retval
  1368.                 forward get msg_release_focus to retval
  1369.                 if retval procedure_return retval
  1370.                 send delete_data
  1371.             end_procedure
  1372.  
  1373.             procedure show_del_grp string grp_name
  1374.                 send insert_line "DELETE GROUP:"
  1375.                 send insert_line (trim(grp_name))
  1376.             end_procedure
  1377.  
  1378.             procedure show_del_sbj string sbj_name
  1379.                 send insert_line "DELETE SUBJECT:"
  1380.                 send insert_line (trim(sbj_name))
  1381.             end_procedure
  1382.  
  1383.             procedure show_del_xrf string grp_name string sbj_name
  1384.                 send insert_line "DELETE LINK FOR:"
  1385.                 send insert_line (trim(grp_name))
  1386.                 send insert_line (trim(sbj_name))
  1387.             end_procedure
  1388.  
  1389.             procedure show_del_ctx string app_name string mod_name string hlp_name
  1390.                 send insert_line "DELETE CONTEXT:"
  1391.                 send insert_line (trim(app_name))
  1392.                 send insert_line (trim(mod_name))
  1393.                 send insert_line (trim(hlp_name))
  1394.             end_procedure
  1395.         end_object // display_list
  1396.  
  1397. /help_edit_cleanup_done_img
  1398. ╔═══════════════════════════════════════════════════════╗
  1399. ║                    Cleanup complete.                  ║
  1400. ║                                                       ║
  1401. ║                     ____    ______                    ║
  1402. ╚═══════════════════════════════════════════════════════╝
  1403. /*
  1404.         object done is a button help_edit_cleanup_done_img
  1405.             set block_mouse_state to true
  1406.             set location          to 6 2 relative
  1407.             set popup_state       to true
  1408.             set scope_state       to true
  1409.  
  1410.             item_list
  1411.                 on_item "<OK>"   send request_cancel
  1412.                 on_item "<Help>" send help
  1413.             end_item_list
  1414.  
  1415.             on_key kexit_application send quit_help_edit private
  1416.         end_object
  1417.  
  1418.         object sbj_text is an edit
  1419.             set focus_mode to no_activate
  1420.             set size to 1 56
  1421.         end_object
  1422.  
  1423.         procedure restart
  1424.             set kbd_input_mode to 1
  1425.             send deactivate to (process(current_object))
  1426.             send deactivate to (display_list(current_object))
  1427.         end_procedure
  1428.  
  1429.         procedure init_process integer live
  1430.             local integer obj
  1431.  
  1432.             if not live begin
  1433.                 set max_lines of (list(display_list(current_object))) to MAX_LINES_ALLOWED
  1434.                 send delete_data to (display_list(current_object))
  1435.                 send popup to (display_list(current_object))
  1436.             end
  1437.  
  1438.             move (process(current_object)) to obj
  1439.             send delete_data to obj
  1440.             send popup to obj
  1441.             set highlight_state of (button(obj)) to true
  1442.             set kbd_input_mode to 2
  1443.         end_procedure
  1444.  
  1445.         procedure process_complete integer live
  1446.             set kbd_input_mode to 1
  1447.             set highlight_state of (button(process(current_object))) to false
  1448.  
  1449.             if live send popup to (done(current_object))
  1450.             else begin
  1451.                 set max_lines of (list(display_list(current_object))) to (line_count(list(display_list(current_object))) + 1)
  1452.                 send deactivate to (process(current_object))
  1453.             end
  1454.         end_procedure
  1455.  
  1456.         procedure request_begin
  1457.             send request_cleanup true
  1458.         end_procedure
  1459.  
  1460.         procedure display_only
  1461.             send request_cleanup false
  1462.         end_procedure
  1463.  
  1464.         function help_name_exists integer obj returns integer
  1465.             local integer chd_cnt chd_num chd_obj cur_obj
  1466.  
  1467.             get child_count of obj to chd_cnt
  1468.             if chd_cnt le 0 function_return 0
  1469.  
  1470.             for chd_num from 1 to chd_cnt
  1471.                 move current_object to cur_obj
  1472.                 move obj to current_object
  1473.                 get object_id of (-chd_num) to chd_obj
  1474.                 move cur_obj to current_object
  1475.                 if chd_obj ne 0 begin
  1476.                         if (uppercase(trim(name(chd_obj)))) ;
  1477.                             eq (uppercase(trim(ctx.hlp_name))) function_return 1
  1478.                         if (help_name_exists(current_object,chd_obj)) function_return 1
  1479.                 end
  1480.             loop
  1481.  
  1482.             function_return 0
  1483.         end_function
  1484.  
  1485.         procedure request_cleanup integer live
  1486.             local integer disp wr_del
  1487.             local string app_val mod_val hlp_val
  1488.  
  1489.             move (display_list(current_object)) to disp
  1490.  
  1491.             send init_process live
  1492.  
  1493.             get select_state of (write_del(current_object)) item 0 to wr_del
  1494.  
  1495.             send init_process to (process(current_object))
  1496.             if wr_del direct_output (context_filename(help_editor.obj) + ".DEL")
  1497.  
  1498.             uppercase (trim(application_name(desktop))) to app_val
  1499.             uppercase (trim(module_name(desktop))) to mod_val
  1500.  
  1501.             clear ctx
  1502.             move app_val to ctx.app_name
  1503.             move mod_val to ctx.mod_name
  1504.             find ge ctx.hlp_name
  1505.             [found] indicate found as app_val eq (uppercase(trim(ctx.app_name)))
  1506.             [found] indicate found as mod_val eq (uppercase(trim(ctx.mod_name)))
  1507.  
  1508.             [found] repeat
  1509.                 if (scan_for_key(current_object,0)) begin
  1510.                     if wr_del close_output
  1511.                     send restart
  1512.                     procedure_return
  1513.                 end
  1514.  
  1515.                 if not (help_name_exists(current_object,desktop)) begin
  1516.                     if live begin
  1517.                         move ctx.hlp_name to hlp_val
  1518.                         if wr_del send write_del_ctx
  1519.  
  1520.                         indicate err false
  1521.  
  1522.                         reread ctx
  1523.                         [not err] delete ctx
  1524.                         unlock
  1525.  
  1526.                         clear ctx
  1527.                         move app_val to ctx.app_name
  1528.                         move mod_val to ctx.mod_name
  1529.                         move hlp_val to ctx.hlp_name
  1530.                     end
  1531.                     else send show_del_ctx to disp ctx.app_name ctx.mod_name ctx.hlp_name
  1532.  
  1533.                     if (scan_for_key(current_object,1)) begin
  1534.                         if wr_del close_output
  1535.                         send restart
  1536.                         procedure_return
  1537.                     end
  1538.                 end
  1539.  
  1540.                 find gt ctx.hlp_name
  1541.                 [found] indicate found as app_val eq (uppercase(trim(ctx.app_name)))
  1542.                 [found] indicate found as mod_val eq (uppercase(trim(ctx.mod_name)))
  1543.             [found] loop
  1544.  
  1545.             close_output
  1546.             send process_complete live
  1547.         end_procedure
  1548.  
  1549.         procedure write_del_grp
  1550.             writeln grp.recnum
  1551.             writeln grp.grp_name
  1552.         end_procedure
  1553.  
  1554.         procedure write_del_sbj
  1555.             writeln sbj.recnum
  1556.             writeln sbj.sbj_name
  1557.             close_output
  1558.             send write to (sbj_text(current_object)) ;
  1559.                 (context_filename(help_editor.obj) + ".DEL") true // true=append
  1560.             append_output (context_filename(help_editor.obj) + ".DEL")
  1561.             writeln (character(255))
  1562.         end_procedure
  1563.  
  1564.         procedure Write_Del_Xrf
  1565.             writeln Xrf.Recnum
  1566.             writeln Xrf.Grp_Recnum
  1567.             writeln Xrf.Sbj_Recnum
  1568.         end_procedure
  1569.  
  1570.         procedure Write_del_ctx
  1571.             writeln ctx.recnum
  1572.             writeln ctx.app_name
  1573.             writeln ctx.mod_name
  1574.             writeln ctx.hlp_name
  1575.             writeln ctx.xrf_recnum
  1576.         end_procedure
  1577.  
  1578.         function scan_for_key integer itm returns integer
  1579.             function_return (scan_for_key(process(current_object),itm))
  1580.         end_function
  1581.  
  1582.         procedure request_cancel
  1583.             send deactivate_area
  1584.         end_procedure
  1585.  
  1586.         procedure quit_help_edit
  1587.             send request_cancel
  1588.             delegate send quit_help_edit
  1589.         end_procedure
  1590.     end_object // cleanup
  1591.  
  1592. // - - - - - - - - - - - - -  PROCEDURES AND FUNCTIONS  - - - - - - - - - - -//
  1593.  
  1594.     function Current_Group returns string
  1595.         function_return (Value( Topic( Current_Object ), 0 ))
  1596.     end_function
  1597.     
  1598.     function Current_Subject returns string
  1599.         function_return (Value( Topic( Current_Object ), 1 ))
  1600.     end_function
  1601.     
  1602.     function Current_Record returns integer
  1603.         function_return (current_record(xrf_data(current_object)))
  1604.     end_function
  1605.  
  1606.     function Find_Help_Context string App_Name string Mod_Name string Hlp_Name ;
  1607.             returns integer
  1608.         local integer Ret_Val
  1609.  
  1610.         clear Ctx
  1611.         move App_Name to Ctx.App_Name
  1612.         move Mod_Name to Ctx.Mod_Name
  1613.         trim Hlp_Name to Ctx.Hlp_Name
  1614.         find EQ Ctx.Hlp_Name
  1615.         move 0 to Ret_Val
  1616.         [Found] move 1 to Ret_Val
  1617.         function_return Ret_Val
  1618.     end_function
  1619.  
  1620.     procedure Context_Assignment
  1621.        send Popup to Ctx_Assignment
  1622.     end_procedure
  1623.  
  1624.     procedure Cleanup
  1625.        send Popup to (Cleanup( Current_Object ))
  1626.     end_procedure
  1627.  
  1628.     procedure Original_Help
  1629.         local integer Orig_Foc Obj Ret_Val
  1630.         local string App_Name Mod_Name
  1631.  
  1632.         get Original_Focus to Orig_Foc
  1633.         move Orig_Foc to Obj
  1634.  
  1635.         repeat
  1636.             get Find_Help_Context (Application_Name( Obj )) (Module_Name( Obj )) ;
  1637.               (Context_Help_Name( Obj )) to Ret_Val
  1638.  
  1639.             if not Ret_Val begin
  1640.                 if Obj EQ Desktop move -1 to Ret_Val
  1641.                 else get Parent of Obj to Obj
  1642.             end
  1643.         until Ret_Val NE 0
  1644.  
  1645.         if Ret_Val LE 0 begin
  1646.             set Text_Value of Help_Edit_Message to ;
  1647. 'There is no help assigned to Application "%1", Module "%2", Context "%3".'
  1648.  
  1649.             set Arguments of Help_Edit_Message to ;
  1650.                     (Application_Name( Orig_Foc )) ;
  1651.                     (Module_Name( Orig_Foc )) ;
  1652.                     (Help_Name( Orig_Foc ))
  1653.  
  1654.             set Button_Type of Help_Edit_Message to HELP_OK_HELP_BTN_TYPE
  1655.  
  1656.             ui_accept Help_Edit_Message to Ret_Val
  1657.  
  1658.             if Ret_Val ne Msg_Cancel send Request_Clear to (Topic( Current_Object ))
  1659.             if Ret_Val eq Msg_Quit_Help_Edit send Quit_Help_Edit
  1660.         end
  1661.         else send Find_By_Recnum to (Xrf_Data( Current_Object )) ;
  1662.             Xrf.File_Number Ctx.Xrf_Recnum
  1663.     end_procedure
  1664.  
  1665.     procedure Toggle_Zoom_Text
  1666.         local integer Obj
  1667.  
  1668.         move (Text( Current_Object )) to Obj
  1669.         if not (Zoom_State( Obj )) begin
  1670.             send Zoom_Text to Obj
  1671.             send Activate to Obj
  1672.         end
  1673.         else send Shrink_Text to Obj
  1674.     end_procedure
  1675.  
  1676.     procedure Save_Both returns integer
  1677.         procedure_return Current_Message
  1678.     end_procedure
  1679.  
  1680.     procedure Save_Link returns integer
  1681.         procedure_return Current_Message
  1682.     end_procedure
  1683.  
  1684.     procedure Save_Help integer Obj integer Confirm_Flag
  1685.         local integer Ret_Val Orig_Foc
  1686.         local string Hlp_Name Cur_Grp_Name Cur_Sbj_Name
  1687.  
  1688.         get Current_Group to Cur_Grp_Name
  1689.         get Current_Subject to Cur_Sbj_Name
  1690.  
  1691.         if (Cur_Grp_Name = "" or Cur_Sbj_Name = "") procedure_return
  1692.                                                     // don't save blank names
  1693.  
  1694.         move (Original_Focus( Current_Object )) to Orig_Foc
  1695.         get Context_Help_Name of Orig_Foc to Hlp_Name
  1696.         get Find_Help_Context (Application_Name( Orig_Foc )) (Module_Name( Orig_Foc )) ;
  1697.               Hlp_Name False to Ret_Val
  1698.  
  1699.         if Confirm_Flag begin
  1700.             set Text_Value of Help_Edit_Message to ;
  1701. 'Confirm save of Link for Group "%1" and Subject "%2", assigning Link to Context "%3".'
  1702.  
  1703.             set Arguments of Help_Edit_Message to Cur_Grp_Name Cur_Sbj_Name ;
  1704.                     Ctx.Hlp_Name
  1705.                     
  1706.             set Button_Type of Help_Edit_Message to HELP_SAVE_CTX_BTN_TYPE
  1707.             ui_accept Help_Edit_Message to Ret_Val
  1708.         end
  1709.         else move Msg_Save_Both to Ret_Val
  1710.  
  1711.         if Ret_Val ne Msg_Cancel send Save_Help_Records Ret_Val Obj Hlp_Name
  1712.         if Ret_Val eq Msg_Quit_Help_Edit send Quit_Help_Edit
  1713.     end_procedure
  1714.  
  1715.     procedure Save_Help_Records integer Save_Type integer Obj string Hlp_Name
  1716.         local integer Cur_Xrf Fail Old_State Orig_foc
  1717.         local string App_Name Mod_Name
  1718.  
  1719.         if Save_Type EQ Msg_Save_Both begin
  1720.             move 0 to Fail
  1721.             indicate Err False
  1722.             get Auto_Clear_DEO_State of Obj to Old_State
  1723.             set Auto_Clear_DEO_State of Obj to False
  1724.             send Request_Save to (Server( Obj ))
  1725.             [ Err ] move 1 to Fail
  1726.             set Auto_Clear_DEO_State of Obj to Old_State
  1727.             if Fail procedure_return
  1728.  
  1729.             get Current_Record of (Server( Obj )) to Cur_Xrf
  1730.  
  1731.             get Original_Focus to Orig_Foc
  1732.             get Application_Name of Orig_Foc to App_Name
  1733.             get Module_Name of Orig_Foc to Mod_Name
  1734.             indicate Err False
  1735.             lock
  1736.  
  1737.             if status Ctx begin
  1738.                 find EQ Ctx.Recnum
  1739.                 [ not Found ] error 25 "CTX"
  1740.             end
  1741.  
  1742.             [ not Err ] move App_Name to Ctx.App_Name
  1743.             [ not Err ] move Mod_Name to Ctx.Mod_Name
  1744.             [ not Err ] move Hlp_Name to Ctx.Hlp_Name
  1745.             [ not Err ] move Cur_Xrf to Ctx.Xrf_Recnum
  1746.             [ not Err ] saverecord Ctx
  1747.             unlock
  1748.             [ not Err ] if (Auto_Clear_DEO_State( Obj )) ;
  1749.               send Request_Clear to Obj
  1750.         end
  1751.  
  1752.         if Save_Type EQ Msg_Save_Link begin
  1753.             send Request_Save to (Server( Obj ))
  1754.         end
  1755.     end_procedure
  1756.  
  1757.     procedure Delete_Both returns integer
  1758.         procedure_return Current_Message
  1759.     end_procedure
  1760.  
  1761.     procedure Delete_Ctx returns integer
  1762.         procedure_return Current_Message
  1763.     end_procedure
  1764.  
  1765.     procedure Delete_Link returns integer
  1766.         procedure_return Current_Message
  1767.     end_procedure
  1768.  
  1769.     procedure Delete_Ctx_Record
  1770.         indicate Err False
  1771.         reread Ctx
  1772.         [ not Err ] delete Ctx
  1773.         unlock
  1774.     end_procedure
  1775.  
  1776.     procedure Delete_Help
  1777.         local integer Ret_Val Obj Orig_Foc Del_Type Cur_Xrf
  1778.  
  1779.         get Current_Record of (Xrf_Data( Current_Object )) to Cur_Xrf
  1780.  
  1781.         if Cur_Xrf EQ 0 begin
  1782.             error 71 "XRF"
  1783.             procedure_return
  1784.         end
  1785.  
  1786. DEFINE_SYMBOL NO_DEL_TYPE      FOR 0
  1787. DEFINE_SYMBOL DEL_CTX_XRF_TYPE FOR 1
  1788. DEFINE_SYMBOL DEL_CTX_TYPE     FOR 2
  1789. DEFINE_SYMBOL DEL_LINK_TYPE    FOR 3
  1790.  
  1791.         move DEL_LINK_TYPE to Del_Type
  1792.  
  1793.         clear Ctx
  1794.         move Cur_Xrf to Ctx.Xrf_Recnum
  1795.         find GE Ctx.Xrf_Recnum
  1796.         [ Found ] indicate Found as Ctx.Xrf_Recnum EQ Cur_Xrf
  1797.         [ Found ] move DEL_CTX_XRF_TYPE to Del_Type
  1798.  
  1799.         [ Found ] find GT Ctx.Xrf_Recnum
  1800.         [ Found ] indicate Found as Ctx.Xrf_Recnum EQ Cur_Xrf
  1801.         [ Found ] move DEL_CTX_TYPE to Del_type
  1802.  
  1803.         get Original_Focus to Orig_Foc
  1804.         get Find_Help_Context (Application_Name( Orig_Foc )) (Module_Name( Orig_Foc )) ;
  1805.               (Context_Help_Name( Orig_Foc )) to Ret_Val
  1806.  
  1807.         [ not Found ] if Del_Type NE DEL_LINK_TYPE ;
  1808.               move NO_DEL_TYPE to Del_Type
  1809.  
  1810.         get Focus to Obj
  1811.  
  1812.         if (Del_Type = DEL_CTX_XRF_TYPE or Del_Type = DEL_CTX_TYPE) begin
  1813.             set Text_Value of Help_Edit_Message to ;
  1814. 'Confirm deletion of Context "%1" for Linked Group "%2" and Subject "%3".'
  1815.  
  1816.             set Arguments of Help_Edit_Message to ;
  1817.                     Ctx.Hlp_Name ;
  1818.                     Grp.Grp_Name ;
  1819.                     Sbj.Sbj_Name
  1820.                     
  1821.             if Del_Type eq DEL_CTX_XRF_TYPE ;
  1822.                   set Button_Type of Help_Edit_Message to HELP_DELETE_CTX_XRF_BTN_TYPE
  1823.             else set Button_Type of Help_Edit_Message to HELP_DELETE_CTX_BTN_TYPE
  1824.  
  1825.             ui_accept Help_Edit_Message to Ret_Val
  1826.  
  1827.             if Ret_Val EQ Msg_Delete_Both begin
  1828.                 send Request_Delete to (Server( Obj ))
  1829.                 send Clear to (Server(Obj))
  1830.                 send Delete_Ctx_Record
  1831.             end
  1832.  
  1833.             if Ret_Val EQ Msg_Delete_Ctx send Delete_Ctx_Record
  1834.             if Ret_Val eq Msg_Quit_Help_Edit send Quit_Help_Edit
  1835.         end
  1836.  
  1837.         if Del_Type EQ DEL_LINK_TYPE begin
  1838.             set Text_Value of Help_Edit_Message to ;
  1839. 'Confirm deletion of Link only.  Link for Group "%1" and Subject "%2" is not assigned to a Context.'
  1840.  
  1841.             set Arguments of Help_Edit_Message to ;
  1842.                     Grp.Grp_Name ;
  1843.                     Sbj.Sbj_Name
  1844.                     
  1845.             set Button_Type of Help_Edit_Message to HELP_DELETE_XRF_BTN_TYPE
  1846.  
  1847.             ui_accept Help_Edit_Message to Ret_Val
  1848.  
  1849.             if Ret_Val EQ Msg_Delete_Link begin
  1850.                 send Request_Delete to (Server( Obj ))
  1851.                 send Clear to (Server(Obj))
  1852.             end
  1853.  
  1854.             if Ret_Val eq Msg_Quit_Help_Edit send Quit_Help_Edit
  1855.         end
  1856.  
  1857.         if Del_Type EQ NO_DEL_TYPE begin
  1858.             set Text_Value of Help_Edit_Message to ;
  1859. 'Deletion not allowed.  Link for Group "%1" Subject "%2" is assigned to Context(s) other than "%3".'
  1860.  
  1861.             set Arguments of Help_Edit_Message to ;
  1862.                     Grp.Grp_Name ;
  1863.                     Sbj.Sbj_Name ;
  1864.                     Ctx.Hlp_Name
  1865.                     
  1866.             set Button_Type of Help_Edit_Message to HELP_OK_HELP_BTN_TYPE
  1867.  
  1868.             ui_accept Help_Edit_Message to Ret_Val
  1869.  
  1870.             if Ret_Val eq Msg_Quit_Help_Edit send Quit_Help_Edit
  1871.         end
  1872.     end_procedure
  1873.  
  1874.     procedure Request_Edit_Help integer Obj
  1875.         if (Active_State( Current_Object )) procedure_return // no nested access
  1876.  
  1877.         send Open_Help True
  1878.         set Original_Focus to Obj
  1879.         send Popup
  1880.         send Activate to (Topic( Current_Object ))
  1881.         send Original_Help
  1882.     end_procedure
  1883.  
  1884.     procedure Release_Focus returns integer
  1885.         local integer Retval
  1886.         send Request_Clear to (Topic( Current_Object ))
  1887.         forward get Msg_Release_Focus to Retval
  1888.         if Retval procedure_return Retval
  1889.         send Close_Help True
  1890.     end_procedure
  1891.  
  1892.     procedure Use_System_Help_Files
  1893.         local integer Obj
  1894.  
  1895.         move (Help_Object( Desktop )) to Obj
  1896.  
  1897.         get Group_Filename of Obj to Original_Group_Filename
  1898.         set Group_Filename of Obj to HELP_GRP_FILENAME
  1899.  
  1900.         move Grp.Recnum to Original_Grp
  1901.         close Grp
  1902.  
  1903.         get Subject_Filename of Obj to Original_Subject_Filename
  1904.         set Subject_Filename of Obj to HELP_SBJ_FILENAME
  1905.  
  1906.         move Sbj.Recnum to Original_Sbj
  1907.         close Sbj
  1908.  
  1909.         get Link_Filename of Obj to Original_Link_Filename
  1910.         set Link_Filename of Obj to HELP_XRF_FILENAME
  1911.  
  1912.         move Xrf.Recnum to Original_Xrf
  1913.         close Xrf
  1914.  
  1915.         get Context_Filename of Obj to Original_Context_Filename
  1916.         set Context_Filename of Obj to HELP_CTX_FILENAME
  1917.  
  1918.         move Ctx.Recnum to Original_Ctx
  1919.         close Ctx
  1920.  
  1921.         send Open_Help to Obj True
  1922.     end_procedure
  1923.  
  1924.     procedure Use_Original_Help_Files
  1925.         local integer Obj
  1926.         local string Fname
  1927.  
  1928.         move (Help_Object( Desktop )) to Obj
  1929.  
  1930.         send Close_Help to Obj // unconditional close
  1931.  
  1932.         set Group_Filename of Obj to Original_Group_Filename
  1933.  
  1934.         get Group_Filename to Fname
  1935.         open Fname as Grp
  1936.         clear Grp
  1937.         if Original_Grp NE 0 begin
  1938.             move Original_Grp to Grp.Recnum
  1939.             find EQ Grp.Recnum
  1940.         end
  1941.  
  1942.         set Subject_Filename of Obj to Original_Subject_Filename
  1943.  
  1944.         get Subject_Filename to Fname
  1945.         open Fname as Sbj
  1946.         clear Sbj
  1947.         if Original_Sbj NE 0 begin
  1948.             move Original_Sbj to Sbj.Recnum
  1949.             find EQ Sbj.Recnum
  1950.         end
  1951.  
  1952.         set Link_Filename of Obj to Original_Link_Filename
  1953.  
  1954.         get Link_Filename to Fname
  1955.         open Fname as Xrf
  1956.         clear Xrf
  1957.         if Original_Xrf NE 0 begin
  1958.             move Original_Xrf to Xrf.Recnum
  1959.             find EQ Xrf.Recnum
  1960.         end
  1961.  
  1962.         set Context_Filename of Obj to Original_Context_Filename
  1963.  
  1964.         get Context_Filename to Fname
  1965.         open Fname as Ctx
  1966.         clear Ctx
  1967.         if Original_Ctx NE 0 begin
  1968.             move Original_Ctx to Ctx.Recnum
  1969.             find EQ Ctx.Recnum
  1970.         end
  1971.     end_procedure
  1972.  
  1973.     procedure Quit_Help_Edit
  1974.         send Request_Cancel
  1975.     end_procedure
  1976. end_object // Help_Editor
  1977.  
  1978. object Help_Edit_Grp_Prompt_Data is a Data_Set no_image main_file Grp
  1979.     set Focus_Mode to No_Activate
  1980. end_object
  1981.  
  1982. object Help_Edit_Sbj_Prompt_Data is a Data_Set no_image main_file Sbj
  1983.     set Focus_Mode to No_Activate
  1984. end_object
  1985.  
  1986. object Help_Edit_Xrf_Prompt_Data is a Help_Edit_Constrained_Data_Set no_image ;
  1987.   main_file Xrf updating Help_Edit_Grp_Prompt_Data Help_Edit_Sbj_Prompt_Data
  1988.     set Focus_Mode to No_Activate
  1989. end_object
  1990.  
  1991. /Help_Edit_Grp_Prompt_Img
  1992. ╔══════════════════════════════════════════════╗
  1993. ║______________________________________________║
  1994. ║                                              ║
  1995. ║                                              ║
  1996. ║                                              ║
  1997. ║                                              ║
  1998. ║                                              ║
  1999. ║                                              ║
  2000. ║                                              ║
  2001. ║                                              ║
  2002. ║                                              ║
  2003. ║                                              ║
  2004. ║                                              ║
  2005. ╚══════════════════════════════════════════════╝
  2006. /*
  2007. sub_page Help_Edit_Grp_Prompt_Title_Img from Help_Edit_Grp_Prompt_Img 1
  2008. /Help_Edit_Grp_Prompt_List_Img
  2009. _________________________________
  2010. _________________________________
  2011. _________________________________
  2012. _________________________________
  2013. _________________________________
  2014. _________________________________
  2015. _________________________________
  2016. _________________________________
  2017. /Help_Edit_Grp_Prompt_Btn_Img
  2018.    ___________    ____________    _________   
  2019. /*
  2020.  
  2021. object Help_Edit_Grp_Prompt is a Help_Maintenance_Prompt_Client Help_Edit_Grp_Prompt_Img
  2022.     set Location to 3 16 Relative
  2023.  
  2024.     object Title_Box is a Title Help_Edit_Grp_Prompt_Title_Img
  2025.         set Center_state item 0 to True
  2026.         set Value        item 0 to "Groups"
  2027.     end_object
  2028.  
  2029.     object List is a Help_Maintenance_Selection_List Help_Edit_Grp_Prompt_List_Img ;
  2030.             using Help_Edit_Grp_Prompt_Data main_file Grp by Index.1
  2031.  
  2032.         set Export_Server to (Grp_Data(Help_Editor(Desktop)))
  2033.         set Location      to 3 7 Relative
  2034.         set Select_Mode   to Auto_Select
  2035.  
  2036.         begin_row
  2037.             entry_item Grp.Grp_Name
  2038.         end_row
  2039.  
  2040.         on_key kCancel           send Request_Cancel_Area
  2041.         on_key kEnter            send Request_Ok
  2042.         on_key kExit_Application send Quit_Help_Edit
  2043.         on_key kPrompt           send Prompt to (Parent(Current_Object))
  2044.     end_object
  2045.  
  2046.     object Buttons is a Help_Edit_Prompt_Client_Button Help_Edit_Grp_Prompt_Btn_Img
  2047.         set Location to 12 1 Relative
  2048.     end_object
  2049.  
  2050.     procedure Quit_Help_Edit
  2051.         local integer Obj
  2052.  
  2053.         send Request_Cancel_Area
  2054.         move (Help_Edit_Sbj_Prompt( Desktop )) to Obj
  2055.         if (Active_State( Obj )) send Request_Cancel_Area to Obj
  2056.         send Quit_Help_Edit to (Help_Editor(Desktop))
  2057.     end_procedure
  2058.  
  2059.     procedure Popup_For_Xrf
  2060.         local integer obj
  2061.  
  2062.         set value of (title_box(current_object)) item 0 to ("Groups for " + trim(sbj.sbj_name))
  2063.  
  2064.         set shadow_prompt_state of (buttons(current_object)) to true
  2065.  
  2066.         move (list(current_object)) to obj
  2067.         set export_server of obj to (xrf_data(help_editor(desktop)))
  2068.         set main_file     of obj to xrf.file_number
  2069.         set ordering      of obj to index.2
  2070.         set server        of obj to (help_edit_xrf_prompt_data(desktop))
  2071.         send scan_servers to obj
  2072.  
  2073.         set constrain_to_sbj of help_Edit_xrf_prompt_data to true
  2074.         send rebuild_constraints to help_Edit_xrf_prompt_data
  2075.  
  2076.         set focus_mode to focusable
  2077.         send activate
  2078.     end_procedure
  2079.  
  2080.     procedure Popup
  2081.         send Reset
  2082.         forward send Popup
  2083.     end_procedure
  2084.  
  2085.     procedure Prompt
  2086.         if not (Shadow_Prompt_State(Buttons(Current_Object))) ;
  2087.             send Popup_For_Xrf to Help_Edit_Sbj_Prompt
  2088.     end_procedure
  2089.  
  2090.     procedure Request_Cancel_Area
  2091.         local integer Obj Svr Flag
  2092.  
  2093.         move (List(Current_Object)) to Obj
  2094.         send Request_Cancel to Obj
  2095.  
  2096.         send Cancel to Obj
  2097.  
  2098.         get Active_State of Help_Edit_Sbj_Prompt to Flag
  2099.         if Flag send Reset
  2100.  
  2101.         forward send Request_Cancel_Area
  2102.     end_procedure
  2103.  
  2104.     procedure Request_Ok
  2105.         local integer Obj
  2106.  
  2107.         send Ok to (List(Current_Object))
  2108.         move (Help_Edit_Sbj_Prompt(Desktop)) to Obj
  2109.         if (Active_State(Obj)) begin
  2110.             send Reset
  2111.             send Request_Cancel to (List(Obj))
  2112.         end
  2113.     end_procedure
  2114.  
  2115.     procedure Reset
  2116.         local integer obj
  2117.  
  2118.         set value of (title_box(current_object)) item 0 to "Groups"
  2119.  
  2120.         set shadow_prompt_state of (buttons(current_object)) to false
  2121.  
  2122.         move (list(current_object)) to obj
  2123.         set export_server of obj to (grp_data(help_editor(desktop)))
  2124.         set main_file     of obj to grp.file_number
  2125.         set ordering      of obj to index.1
  2126.         set server        of obj to (help_Edit_grp_prompt_data(desktop))
  2127.         send scan_servers to obj
  2128.  
  2129.         set constrain_to_sbj of help_edit_xrf_prompt_data to false
  2130.     end_procedure
  2131. end_object // Help_Edit_Grp_Prompt
  2132.  
  2133. /Help_Edit_Sbj_Prompt_Img
  2134. ╔═══════════════════════════════════════════════════════════╗
  2135. ║___________________________________________________________║
  2136. ║                                                           ║
  2137. ║            ┌──────────────────────────────────┐           ║
  2138. ║            │                                  │           ║
  2139. ║            │                                  │           ║
  2140. ║            │                                  │           ║
  2141. ║            │                                  │           ║
  2142. ║            │                                  │           ║
  2143. ║            │                                  │           ║
  2144. ║            │                                  │           ║
  2145. ║            └──────────────────────────────────┘           ║
  2146. ║┌─────────────────────────────────────────────────────────┐║
  2147. ║│                                                         │║
  2148. ║│                                                         │║
  2149. ║│                                                         │║
  2150. ║└─────────────────────────────────────────────────────────┘║
  2151. ║                                                           ║
  2152. ║                                                           ║
  2153. ╚═══════════════════════════════════════════════════════════╝
  2154. /*
  2155. sub_page Help_Edit_Sbj_Prompt_Title_Img from Help_Edit_Sbj_Prompt_Img 1
  2156. /Help_Edit_Sbj_Prompt_List_Img
  2157. _________________________________
  2158. _________________________________
  2159. _________________________________
  2160. _________________________________
  2161. _________________________________
  2162. _________________________________
  2163. _________________________________
  2164. /Help_Edit_Sbj_Prompt_Btn_Img
  2165.         ___________      ____________      _________       
  2166. /*
  2167.  
  2168. object Help_Edit_Sbj_Prompt is a Help_Maintenance_Prompt_Client Help_Edit_Sbj_Prompt_Img
  2169.     set Location to 1 10 Relative
  2170.  
  2171.     object Title_Box is a Title Help_Edit_Sbj_Prompt_Title_Img
  2172.         set Center_State item 0 to True
  2173.         set Value        item 0 to "Subjects"
  2174.     end_object
  2175.  
  2176.     object List is a Help_Maintenance_Selection_List Help_Edit_Sbj_Prompt_List_Img ;
  2177.             using Help_Edit_Sbj_Prompt_Data main_file Sbj by Index.1
  2178.  
  2179.         set Export_Server to (Sbj_Data(Help_Editor(Desktop)))
  2180.         set Location      to 4 14 Relative
  2181.         set Select_Mode   to Auto_Select
  2182.  
  2183.         begin_row
  2184.             entry_item Sbj.Sbj_Name
  2185.         end_row
  2186.  
  2187.         object Text is a Help_Maintenance_Text_Window
  2188.             set Focus_Mode      to Nonfocusable
  2189.             set Location        to 9 -12 Relative
  2190.             set Read_Only_State to True
  2191.             set Size            to 3 56
  2192.  
  2193.             assign_dbms_field Sbj.Sbj_Text
  2194.         end_object
  2195.  
  2196.         on_key kCancel           send Request_Cancel_Area
  2197.         on_key kEnter            send Request_Ok
  2198.         on_key kExit_Application send Quit_Help_Edit
  2199.         on_key kPrompt           send Prompt to (Parent( Current_Object ))
  2200.  
  2201.         procedure Find_Record integer Rec
  2202.             forward send Find_Record Rec
  2203.             send Entry_Display to (Text(Current_Object)) 0 0
  2204.         end_procedure
  2205.  
  2206.         procedure Beginning_Of_Data
  2207.             forward send Beginning_Of_Data
  2208.             send Entry_Display to (Text(Current_Object)) 0 0
  2209.         end_procedure
  2210.  
  2211.         procedure End_Of_Data
  2212.             forward send End_Of_Data
  2213.             send Read_By_Recnum to (Server( Current_Object )) (Main_File( Current_Object )) (Current_Record( Current_Object ))
  2214.             send Entry_Display to (Text( Current_Object )) 0 0
  2215.         end_procedure
  2216.     end_object // List
  2217.  
  2218.     object Buttons is a Help_Edit_Prompt_Client_Button Help_Edit_Sbj_Prompt_Btn_Img
  2219.         set Location to 18 1 Relative
  2220.     end_object
  2221.  
  2222.     procedure Quit_Help_Edit
  2223.         local integer Obj
  2224.  
  2225.         send Request_Cancel_Area
  2226.         move (Help_Edit_Grp_Prompt( Desktop )) to Obj
  2227.         if (Active_State( Obj )) send Request_Cancel_Area to Obj
  2228.         send Quit_Help_Edit to (Help_Editor(Desktop))
  2229.     end_procedure
  2230.  
  2231.     procedure Popup_For_Xrf
  2232.         local integer obj
  2233.  
  2234.         set value of (title_box(current_object)) item 0 to ("Subjects for " + trim(grp.grp_name))
  2235.         set shadow_prompt_state of (buttons(current_object)) to true
  2236.  
  2237.         move (list(current_object)) to obj
  2238.         set export_server of obj to (xrf_data(help_editor(desktop)))
  2239.         set main_file     of obj to xrf.file_number
  2240.         set ordering      of obj to index.1
  2241.         set server        of obj to (Help_Edit_xrf_prompt_data(desktop))
  2242.         send scan_servers to obj
  2243.  
  2244.         set constrain_to_grp of Help_Edit_xrf_prompt_data to true
  2245.         send rebuild_constraints to Help_Edit_xrf_prompt_data
  2246.  
  2247.         set focus_mode to focusable
  2248.         send activate
  2249.     end_procedure
  2250.  
  2251.     procedure Popup
  2252.         send Reset
  2253.         forward send Popup
  2254.     end_procedure
  2255.  
  2256.     procedure Prompt
  2257.         if not (Shadow_Prompt_State(Buttons(Current_Object))) ;
  2258.             send Popup_For_Xrf to Help_Edit_Grp_Prompt
  2259.     end_procedure
  2260.  
  2261.     procedure Request_Cancel_Area
  2262.         local integer Obj Svr
  2263.         
  2264.         move (List(Current_Object)) to Obj
  2265.         send Request_Cancel to Obj
  2266.  
  2267.         send Cancel to Obj
  2268.  
  2269.         if (Active_State(Help_Edit_Grp_Prompt(Desktop))) send Reset
  2270.  
  2271.         forward send Request_Cancel_Area
  2272.     end_procedure
  2273.  
  2274.     procedure Request_Ok
  2275.         local integer Obj
  2276.  
  2277.         send Ok to (List(Current_Object))
  2278.         move (Help_Edit_Grp_Prompt(Desktop)) to Obj
  2279.         if (Active_State(Obj)) begin
  2280.             send Reset
  2281.             send Request_Cancel to (List(Obj))
  2282.         end
  2283.     end_procedure
  2284.  
  2285.     procedure Reset
  2286.         local integer obj
  2287.  
  2288.         set value of (title_box(current_object)) item 0 to "Subjects"
  2289.  
  2290.         set shadow_prompt_state of (buttons(current_object)) to false
  2291.  
  2292.         move (list(current_object)) to obj
  2293.  
  2294.         set export_server of obj to (sbj_data(help_editor(desktop)))
  2295.         set main_file     of obj to sbj.file_number
  2296.         set ordering      of obj to index.1
  2297.         set server        of obj to (Help_Edit_sbj_prompt_data(desktop))
  2298.         send scan_servers to obj
  2299.  
  2300.         set constrain_to_grp of Help_Edit_xrf_prompt_data to false
  2301.     end_procedure
  2302. end_object // Help_Edit_Sbj_Prompt
  2303.  
  2304. // global accelerator key to activate help edit object:
  2305. on_key key_Shift+key_F1 send Edit_Help
  2306.  
  2307.  
  2308.