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

  1. // dfhelp_b.src (secondary help maintenance program [B])
  2. // January 21, 1992
  3. // LS
  4.  
  5. use dfhelp_b  // secondary help maintenance program [B] header package
  6.  
  7. DEFINE_SYMBOL LEFT_SERVER_TYPE  FOR 0 // used in cross reference maintenance
  8. DEFINE_SYMBOL RIGHT_SERVER_TYPE FOR 1 // area to determine which server to use
  9.  
  10. //////////////////////////////////
  11. ////////////////////////////////// global variables
  12. //////////////////////////////////
  13.  
  14. string cmd_option  // option passed on cmd line (via chain wait)
  15. move EMPTY_STRING to cmd_option
  16.  
  17. string current_grp current_sbj current_xrf current_ctx current_pth
  18. move EMPTY_STRING to current_grp   // names of currently open help data files
  19. move EMPTY_STRING to current_sbj   // passed on cmd line (via chain wait)
  20. move EMPTY_STRING to current_xrf
  21. move EMPTY_STRING to current_ctx
  22. move EMPTY_STRING to current_pth
  23.  
  24. //////////////////////////////////
  25. ////////////////////////////////// global procedures
  26. //////////////////////////////////
  27.  
  28. procedure deactivate_area for desktop
  29.     send deactivate AREA_TYPE
  30. end_procedure
  31.  
  32. procedure insert_cb for desktop string val integer itm
  33.     local integer flag
  34.  
  35.     get insert_mode of clipboard to flag
  36.     set insert_mode of clipboard to true
  37.  
  38.     send goto_line to clipboard itm
  39.     set right_margin of clipboard to 56
  40.     send key to clipboard kenter
  41.     set value of clipboard item itm to val
  42.  
  43.     set insert_mode of clipboard to flag
  44. end_procedure
  45.  
  46. function next_cmd_arg for desktop returns string
  47.     local string arg
  48.  
  49.     cmdline arg
  50.     if arg le EMPTY_STRING begin
  51.         error 57 ("Command line argument not specified")
  52.         send insert_cb FAIL_REPLY 0
  53.         abort
  54.     end
  55.     if arg eq EMPTY_REPL_STRING function_return EMPTY_STRING
  56.     else function_return arg
  57. end_function
  58.  
  59. // retrieve option passed on command line to determine which objects to use
  60.  
  61. procedure init_program for desktop // retrieve option passed on command line to determine which objects to use
  62.     cmdline cmd_option
  63.  
  64.     if cmd_option le EMPTY_STRING begin
  65.         error 57 ("Option not specified for program")
  66.         send insert_cb FAIL_REPLY 0
  67.         abort
  68.     end
  69.  
  70.     left cmd_option to cmd_option 1
  71.     uppercase cmd_option
  72.  
  73.     if not cmd_option in VALID_OPTIONS begin
  74.         error 57 ("Invalid option passed to program: " + cmd_option)
  75.         send insert_cb FAIL_REPLY 0
  76.         abort
  77.     end
  78.  
  79.     get next_cmd_arg to current_grp
  80.     get next_cmd_arg to current_sbj
  81.     get next_cmd_arg to current_xrf
  82.     get next_cmd_arg to current_ctx
  83.     get next_cmd_arg to current_pth
  84. end_procedure
  85.  
  86. procedure exit_program for desktop
  87.     send insert_cb SUCCESS_REPLY 0
  88.     send exit_application
  89. end_procedure
  90.  
  91. send init_program
  92.  
  93. //////////////////////////////////
  94. ////////////////////////////////// augmentation to help_object class to
  95. ////////////////////////////////// override default help access
  96. //////////////////////////////////
  97.  
  98. procedure request_help for (class(help_object.obj)) integer msg_id integer arg
  99.     local integer orig_grp orig_sbj orig_xrf orig_ctx
  100.     local string old_grp_filename old_sbj_filename old_xrf_filename old_ctx_filename
  101.     local string cur_grp_filename cur_sbj_filename cur_xrf_filename cur_ctx_filename
  102.  
  103.     move current_pth to cur_grp_filename
  104.     append cur_grp_filename current_grp
  105.     move current_pth to cur_sbj_filename
  106.     append cur_sbj_filename current_sbj
  107.     move current_pth to cur_xrf_filename
  108.     append cur_xrf_filename current_xrf
  109.     move current_pth to cur_ctx_filename
  110.     append cur_ctx_filename current_ctx
  111.  
  112.     if cur_grp_filename gt EMPTY_STRING begin
  113.         move grp.recnum to orig_grp
  114.         close grp
  115.     end
  116.     if cur_sbj_filename gt EMPTY_STRING begin
  117.         move sbj.recnum to orig_sbj
  118.         close sbj
  119.     end
  120.     if cur_xrf_filename gt EMPTY_STRING begin
  121.         move xrf.recnum to orig_xrf
  122.         close xrf
  123.     end
  124.     if cur_ctx_filename gt EMPTY_STRING begin
  125.         move ctx.recnum to orig_ctx
  126.         close ctx
  127.     end
  128.  
  129.     if num_arguments gt 1 send msg_id arg
  130.     else send msg_id
  131.  
  132.     if cur_grp_filename gt EMPTY_STRING begin
  133.         open cur_grp_filename as grp
  134.         clear grp
  135.         if orig_grp ne 0 begin
  136.             move orig_grp to grp.recnum
  137.             find eq grp.recnum
  138.         end
  139.     end
  140.     if cur_sbj_filename gt EMPTY_STRING begin
  141.         open cur_sbj_filename as sbj
  142.         clear sbj
  143.         if orig_sbj ne 0 begin
  144.             move orig_sbj to sbj.recnum
  145.             find eq sbj.recnum
  146.         end
  147.     end
  148.     if cur_xrf_filename gt EMPTY_STRING begin
  149.         open cur_xrf_filename as xrf
  150.         clear xrf
  151.         if orig_xrf ne 0 begin
  152.             move orig_xrf to xrf.recnum
  153.             find eq xrf.recnum
  154.         end
  155.     end
  156.     if cur_ctx_filename gt EMPTY_STRING begin
  157.         open cur_ctx_filename as ctx
  158.         clear ctx
  159.         if orig_ctx ne 0 begin
  160.             move orig_ctx to ctx.recnum
  161.             find eq ctx.recnum
  162.         end
  163.     end
  164. end_procedure
  165.  
  166. //////////////////////////////////
  167. //////////////////////////////////  main object definitions
  168. //////////////////////////////////
  169.  
  170. register_object grp_prompt
  171. register_object sbj_prompt
  172. register_object verify_del
  173. register_function verify string filename string related returns integer
  174.  
  175. class prompt_client is a help_maintenance_prompt_client
  176.     procedure construct_object integer img
  177.         forward send construct_object img
  178.  
  179.         property integer list_object public 0
  180.     end_procedure
  181.  
  182.     procedure request_cancel_area
  183.         local integer obj svr
  184.         
  185.         get list_object to to obj
  186.  
  187.         send request_cancel to obj
  188.         send cancel to obj
  189.  
  190.         forward send request_cancel_area
  191.     end_procedure
  192.  
  193.     procedure quit_help_maint
  194.         send request_cancel_area
  195.         send exit_program to (focus(desktop))
  196.     end_procedure
  197. end_class
  198.  
  199. if cmd_option eq GRP_MAINT_OPTION begin
  200.  
  201. /grp_menu_img
  202.   ______  ____                                  
  203. /grp_maint_img
  204. ╔════════════════════════════════════════════════╗
  205. ║________________________________________________║
  206. ║                                                ║
  207. ║                                                ║
  208. ║                                                ║
  209. ║                                                ║
  210. ║                                                ║
  211. ║                                                ║
  212. ╚════════════════════════════════════════════════╝
  213. /grp_maint_entry_img
  214. Group name: _________________________________
  215. /grp_maint_keys_img
  216.            ___________      _________           
  217. /*
  218. //         <F4=Prompt>      <F1=Help>
  219.                                              
  220.     object grp_maint is a data_set grp_maint_img main_file grp ring popup
  221.         register_function verify_grp_delete returns integer
  222.  
  223.         integer old_grp_recnum
  224.  
  225.         set block_mouse_state to true
  226.         set location          to 5 16 relative
  227.         set scope_state       to true
  228.         set verify_delete_msg to get_verify_grp_delete
  229.     
  230.         set center_state item 0 to true
  231.         set value        item 0 to "Group Maintenance"
  232.  
  233.         object xrf_data is a data_set no_image main_file xrf // for deletion
  234.             set focus_mode to no_activate
  235.             object ctx_data is a data_set no_image main_file ctx
  236.                 set focus_mode to no_activate
  237.             end_object
  238.         end_object
  239.  
  240.         create_menu grp_menu grp_menu_img location 2 1 relative
  241.             set action_bar_keys_msg to grp_menu_keys
  242.  
  243.             #INCLUDE RECDE_PD.INC
  244.             set value of (record_pull_down(current_object)) ;
  245.                 item (item_count(record_pull_down(current_object)) - 1) to ;
  246.                 "Exit Group Maint.      Alt+F4"
  247.  
  248.             #INCLUDE HELP_PD.INC
  249.  
  250.             on_key kcancel send exit_area private
  251.         end_menu
  252.  
  253.         procedure grp_menu_keys for desktop integer obj
  254.             on_key key_alt+key_r send activate to (record_pull_down(obj)) private
  255.             on_key key_alt+key_h send activate to (help_pull_down(obj))   private
  256.         end_procedure
  257.  
  258.         set action_bar_id to (grp_menu(current_object))
  259.     
  260.         object grp_entry is an entry_form grp_maint_entry_img 
  261.             set location to 5 2 relative
  262.       
  263.             item_list
  264.                 entry_item grp.grp_name { autofind, required, iprompt=(grp_prompt(desktop)) }
  265.             end_item_list
  266.  
  267.             on_key kcancel send activate to (grp_menu(grp_maint.obj)) private
  268.         end_object
  269.  
  270.         object keys is a key_button grp_maint_keys_img
  271.             set location to 7 1 relative
  272.  
  273.             item_list
  274.                 on_item F4_PROMPT_TEXT send prompt
  275.                 on_item F1_HELP_TEXT   send help
  276.             end_item_list
  277.         end_object
  278.  
  279.         procedure add_focus integer obj
  280.             move grp.recnum to old_grp_recnum
  281.             forward send add_focus obj
  282.         end_procedure
  283.  
  284.         procedure release_focus
  285.             forward send release_focus
  286.             clear grp
  287.             if old_grp_recnum ne 0 begin
  288.                 move old_grp_recnum to grp.recnum
  289.                 find eq grp.recnum
  290.             end
  291.         end_procedure
  292.  
  293.         function verify_grp_delete returns integer
  294.             if status grp function_return (verify(verify_del(desktop), "Group", "Link and Context"))
  295.             error 71 "GRP"
  296.             function_return 1
  297.         end_function
  298.     end_object // grp_maint
  299.  
  300.     send popup to grp_maint
  301.  
  302. end
  303. else if cmd_option eq SBJ_MAINT_OPTION begin
  304.  
  305.     class import_export_client is a client
  306.         register_function filename returns string
  307.  
  308.         procedure construct_object integer img integer form_img integer btns_img
  309.             forward send construct_object img
  310.  
  311.             set block_mouse_state to true
  312.             set popup_state       to true
  313.             set scope_state       to true
  314.  
  315.             set center_state item 0 to true
  316.         
  317.             object file is a form form_img
  318.                 item_list
  319.                     on_item EMPTY_STRING send next
  320.                     set autoclear_state to true
  321.                 end_item_list
  322.  
  323.                 on_key ksave_record send request_ok private
  324.                 on_key kcancel      send cancel     private
  325.             end_object
  326.  
  327.             object buttons is a button btns_img
  328.                 item_list
  329.                     on_item F2_OK_TEXT      send request_ok
  330.                     on_item ESC_CANCEL_TEXT send cancel
  331.                     on_item F1_HELP_TEXT    send help
  332.                 end_item_list
  333.  
  334.                 on_key ksave_record send request_ok private
  335.                 on_key kcancel      send cancel     private
  336.             end_object
  337.         end_procedure
  338.  
  339.         procedure request_ok
  340.             if (filename(current_object)) le EMPTY_STRING procedure_return
  341.             else procedure_return msg_ok
  342.         end_procedure
  343.  
  344.         function filename returns string
  345.             function_return (value(file(current_object), 0))
  346.         end_function
  347.  
  348.         procedure set title_name string val
  349.             set value item 0 to val
  350.         end_procedure
  351.     end_class
  352.  
  353. /sbj_menu_img
  354.   ______  ____  ____                                         
  355. /sbj_text_pd_img
  356. ┌─────────────────────────────┐
  357. │ ___________________________ │
  358. │ ___________________________ │
  359. ├─────────────────────────────┤
  360. │ ___________________________ │
  361. │ ___________________________ │
  362. │ ___________________________ │
  363. │ ___________________________ │
  364. │ ___________________________ │
  365. │ ___________________________ │
  366. │ ___________________________ │
  367. └─────────────────────────────┘
  368. /sbj_maint_img
  369. ╔═════════════════════════════════════════════════════════════╗
  370. ║_____________________________________________________________║
  371. ║                                                             ║
  372. ║                                                             ║
  373. ║                                                             ║
  374. ║                                                             ║
  375. ║ ┌ Subject text: ──────────────────────────────────────────┐ ║
  376. ║ │                                                         │ ║
  377. ║ │                                                         │ ║
  378. ║ │                                                         │ ║
  379. ║ │                                                         │ ║
  380. ║ │                                                         │ ║
  381. ║ │                                                         │ ║
  382. ║ │                                                         │ ║
  383. ║ │                                                         │ ║
  384. ║ │                                                         │ ║
  385. ║ │                                                         │ ║
  386. ║ └─────────────────────────────────────────────────────────┘ ║
  387. ║                                                             ║
  388. ╚═════════════════════════════════════════════════════════════╝
  389. /sbj_maint_entry_img
  390.    Subject name: _________________________________          
  391. /sbj_maint_keys_img
  392.               ___________              _________             
  393. /*
  394. //            <F4=Prompt>              <F1=Help>
  395.  
  396.     object sbj_maint is a data_set sbj_maint_img main_file sbj popup ring
  397.         register_function verify_sbj_delete returns integer
  398.  
  399.         integer old_sbj_recnum
  400.  
  401.         set block_mouse_state to true
  402.         set location          to 2 9 relative
  403.         set scope_state       to true
  404.         set verify_delete_msg to get_verify_sbj_delete
  405.     
  406.         set center_state item 0 to true
  407.         set value        item 0 to "Subject Maintenance"
  408.  
  409.         object xrf_data is a data_set no_image main_file xrf // for deletion
  410.             set focus_mode to no_activate
  411.  
  412.             object ctx_data is a data_set no_image main_file ctx
  413.                 set focus_mode to no_activate
  414.             end_object
  415.         end_object
  416.  
  417.         create_menu sbj_menu sbj_menu_img location 2 1 relative
  418.             set action_bar_keys_msg to sbj_menu_keys
  419.  
  420.             #INCLUDE RECDE_PD.INC
  421.             set value of (record_pull_down(current_object)) ;
  422.                 item (item_count(record_pull_down(current_object)) - 1) to ;
  423.                 "Exit Subject Maint.    Alt+F4"
  424.  
  425.             register_object text_pull_down
  426.             on_item "Text" send activate_pull_down to (text_pull_down(current_object))
  427.  
  428.             object text_pull_down is a shadow_text_pull_down_menu sbj_text_pd_img
  429.                 item_list
  430.                     on_item "Start of text     Ctrl+Home" send beginning_of_data
  431.                     on_item "End of text        Ctrl+End" send end_of_data
  432.                     on_item "Block mark           Ctrl+\" send mark_block
  433.                     on_item "Column mark"                 send mark_column
  434.                     on_item "Cut marked text       Alt+-" send cut_marked_area
  435.                     on_item "Copy marked text     Ctrl+-" send copy_marked_area
  436.                     on_item "Paste text            Alt+=" send paste_block
  437.                     on_item "Export marked text..."       send export_marked_area
  438.                     on_item "Import text..."              send import_text
  439.                 end_item_list
  440.             end_object
  441.  
  442.             #INCLUDE HELP_PD.INC
  443.  
  444.             on_key kcancel send exit_area private
  445.         end_menu
  446.  
  447.         procedure sbj_menu_keys for desktop integer obj
  448.             on_key key_alt+key_r send activate to (record_pull_down(obj)) private 
  449.             on_key key_alt+key_t send activate to (text_pull_down(obj))   private
  450.             on_key key_alt+key_h send activate to (help_pull_down(obj))   private
  451.         end_procedure
  452.  
  453.         set action_bar_id to (sbj_menu(current_object))
  454.       
  455.         object sbj_entry_form is an entry_form sbj_maint_entry_img
  456.             set location to 4 2 relative
  457.  
  458.             item_list
  459.                 entry_item sbj.sbj_name { required, iprompt=(sbj_prompt(desktop)) }
  460.             end_item_list
  461.  
  462.             on_key kcancel send activate to (sbj_menu(sbj_maint.obj)) private
  463.         end_object // sbj_entry_form
  464.  
  465.         object sbj_text is a help_maintenance_text_window
  466.             set location to 7 3 relative
  467.             set size     to 10 56
  468.  
  469.             assign_dbms_field sbj.sbj_text
  470.  
  471. /sbj_maint_export_img
  472. ╔════════════════════════════════════════════╗
  473. ║____________________________________________║
  474. ║                                            ║
  475. ║  File to export text to:                   ║
  476. ║  ________________________________________  ║
  477. ║                                            ║
  478. ║    _______    ____________    _________    ║
  479. ╚════════════════════════════════════════════╝
  480. /*
  481. //   <F2=OK>    <Esc=Cancel>    <F1=Help>
  482. sub_page sbj_maint_export_file_img  from sbj_maint_export_img 2
  483. sub_page sbj_maint_export_btns_img  from sbj_maint_export_img 3 4 5
  484.  
  485. /sbj_maint_import_img
  486. ╔════════════════════════════════════════════╗
  487. ║____________________________________________║
  488. ║                                            ║
  489. ║  File to import text from:                 ║
  490. ║  ________________________________________  ║
  491. ║                                            ║
  492. ║    _______    ____________    _________    ║
  493. ╚════════════════════════════════════════════╝
  494. /*
  495. //   <F2=OK>    <Esc=Cancel>    <F1=Help>
  496. sub_page sbj_maint_import_file_img  from sbj_maint_import_img 2
  497. sub_page sbj_maint_import_btns_img  from sbj_maint_import_img 3 4 5
  498.  
  499.             object export is an import_export_client sbj_maint_export_img sbj_maint_export_file_img sbj_maint_export_btns_img
  500.                 set location   to 3 5 relative
  501.                 set title_name to "Export marked text"
  502.             end_object
  503.  
  504.             set export_object to (export(current_object))
  505.  
  506.             object import is an import_export_client sbj_maint_import_img sbj_maint_import_file_img sbj_maint_import_btns_img
  507.                 set location   to 3 5 relative
  508.                 set title_name to "Import text"
  509.             end_object
  510.  
  511.             set import_object to (import(current_object))
  512.  
  513.             on_key kprompt send popup to    (sbj_prompt(desktop))     private
  514.             on_key kcancel send activate to (sbj_menu(sbj_maint.obj)) private
  515.         end_object // sbj_text
  516.  
  517.         object keys is a key_button sbj_maint_keys_img
  518.             set location to 18 1 relative
  519.  
  520.             item_list
  521.                 on_item F4_PROMPT_TEXT send prompt
  522.                 on_item F1_HELP_TEXT   send help
  523.             end_item_list
  524.         end_object
  525.  
  526.         procedure add_focus integer obj
  527.             move sbj.recnum to old_sbj_recnum
  528.             forward send add_focus obj
  529.         end_procedure
  530.  
  531.         procedure release_focus
  532.             forward send release_focus
  533.             clear sbj
  534.             if old_sbj_recnum ne 0 begin
  535.                 move old_sbj_recnum to sbj.recnum
  536.                 find eq sbj.recnum
  537.             end
  538.         end_procedure
  539.  
  540.         function verify_sbj_delete returns integer
  541.             if status sbj function_return (verify(verify_del(desktop), "Subject", "Link and Context"))
  542.             error 71 "SBJ"
  543.             function_return 1
  544.         end_function
  545.     end_object // sbj_maint
  546.  
  547.     send popup to sbj_maint
  548.  
  549. end
  550. else if cmd_option eq XRF_MAINT_OPTION begin
  551.  
  552.     class cross_ref_entry_form is an entry_form
  553.         procedure construct_object integer img
  554.             forward send construct_object img
  555.  
  556.             property integer server_type public 0
  557.         end_procedure
  558.  
  559.         procedure entering returns integer
  560.             local integer svr_typ ret_val
  561.  
  562.             forward get msg_entering to ret_val
  563.             if ret_val procedure_return ret_val
  564.  
  565.             get server_type to svr_typ
  566.             delegate send reset_servers svr_typ
  567.             delegate send shadow_prompt_button false
  568.  
  569.         end_procedure
  570.  
  571.         procedure request_delete
  572.         end_procedure
  573.     end_class
  574.  
  575.     class cross_ref_table is a table
  576.         procedure construct_object integer img
  577.             forward send construct_object img
  578.  
  579.             property integer server_type      public 0
  580.             property integer new_record_state public 0
  581.  
  582.             set wrap_state to true
  583.  
  584.             on_key knext_item     send switch      private
  585.             on_key kprevious_item send switch_back private
  586.         end_procedure
  587.  
  588.         procedure exiting integer obj returns integer
  589.             local integer ret_val
  590.             forward get msg_exiting obj to ret_val
  591.             if not ret_val set select_state item current to true
  592.             else procedure_return ret_val
  593.         end_procedure
  594.  
  595.         procedure display
  596.             forward send display
  597.  
  598.             if (current_scope(desktop) = find_scope(current_object) and ;
  599.                     focus(desktop) <> current_object) ;
  600.                     set select_state item current to true
  601.         end_procedure
  602.  
  603.         procedure request_find integer mode integer flag
  604.             if (current_record(current_object)) eq 0 forward send request_find mode flag
  605.         end_procedure
  606.  
  607.         procedure request_superfind integer mode
  608.             if (current_record(current_object)) eq 0 forward send request_superfind mode
  609.         end_procedure
  610.  
  611.         function row_changed integer row# returns integer
  612.             local integer ret_val
  613.  
  614.             if (new_record_state(current_object)) function_return 0
  615.  
  616.             forward get row_changed row# to ret_val
  617.             function_return ret_val
  618.         end_function
  619.  
  620.         procedure add_or_remove_row
  621.             local integer new_rec
  622.  
  623.             get new_record_state to new_rec
  624.             set new_record_state to (current_record(current_object) = 0)
  625.             forward send add_or_remove_row
  626.             set new_record_state to new_rec
  627.         end_procedure
  628.  
  629.         procedure prompt
  630.             if (current_record(current_object)) eq 0 forward send prompt
  631.         end_procedure
  632.  
  633.         procedure entering returns integer
  634.             local integer svr_typ cur_rec ret_val
  635.  
  636.             forward get msg_entering to ret_val
  637.             if ret_val procedure_return ret_val
  638.  
  639.             get server_type to svr_typ
  640.             delegate send reset_servers svr_typ
  641.             if (item_count(current_object)) gt 0 set select_state item current to false
  642.             get current_record to cur_rec
  643.             delegate send shadow_prompt_button (cur_rec <> 0)
  644.         end_procedure
  645.  
  646.         procedure item_change integer from_itm integer to_itm returns integer
  647.             local integer ret_val row_num rec_num
  648.  
  649.             forward get msg_item_change from_itm to_itm to ret_val
  650.  
  651.             if (focus(desktop)) eq current_object begin
  652.                 get row ret_val to row_num
  653.                 get record_number row_num to rec_num
  654.                 delegate send shadow_prompt_button (rec_num <> 0)
  655.             end
  656.  
  657.             procedure_return ret_val
  658.         end_procedure
  659.     end_class
  660.  
  661.     object cross_ref_left_grp_data is a data_set no_image main_file grp
  662.     end_object
  663.  
  664.     object cross_ref_left_xrf_data is a data_set no_image main_file xrf ;
  665.             updating cross_ref_left_grp_data sbj
  666.  
  667.         begin_constraints
  668.             constrain xrf relates to grp
  669.         end_constraints
  670.  
  671.         object ctx_data is a data_set no_image main_file ctx // for deletion
  672.         end_object
  673.     end_object
  674.  
  675.     object cross_ref_right_sbj_data is a data_set no_image main_file sbj
  676.     end_object
  677.  
  678.     object cross_ref_right_xrf_data is a data_set no_image main_file xrf ;
  679.                 updating grp cross_ref_right_sbj_data
  680.  
  681.         begin_constraints
  682.             constrain xrf relates to sbj
  683.         end_constraints
  684.  
  685.         object ctx_data is a data_set no_image main_file ctx // for deletion
  686.         end_object
  687.     end_object
  688.  
  689. /cross_ref_img
  690. ╔══════════════════════════════════════════════════════════════════════════════╗
  691. ║______________________________________________________________________________║
  692. ║                                                                              ║
  693. ║                                                                              ║
  694. ║                                                                              ║
  695. ║                                                                              ║
  696. ║                                                                              ║
  697. ║                                                                              ║
  698. ║                                                                              ║
  699. ║                                                                              ║
  700. ║                                                                              ║
  701. ║                                                                              ║
  702. ║                                                                              ║
  703. ║                                                                              ║
  704. ║         ┌ Subject text: ──────────────────────────────────────────┐          ║
  705. ║         │                                                         │          ║
  706. ║         │                                                         │          ║
  707. ║         │                                                         │          ║
  708. ║         └─────────────────────────────────────────────────────────┘          ║
  709. ║                                                                              ║
  710. ╚══════════════════════════════════════════════════════════════════════════════╝
  711. /cross_ref_action_bar_img
  712.   ______  ____                                                                
  713. /cross_ref_left_entry_img
  714. ┌─ Group: ───────────────────────────┐
  715. │ _________________________________  │
  716. ├─ Subjects: ────────────────────────┤
  717. │ _________________________________  │
  718. │ _________________________________  │
  719. │ _________________________________  │
  720. │ _________________________________  │
  721. │ _________________________________  │
  722. │ _________________________________  │
  723. │ _________________________________  │
  724. └────────────────────────────────────┘
  725. /*
  726. sub_page cross_ref_grp_form_img from cross_ref_left_entry_img 1
  727. sub_page cross_ref_sbj_list_img from cross_ref_left_entry_img vertical 2 7
  728. /cross_ref_right_entry_img
  729. ┌─ Subject: ─────────────────────────┐
  730. │ _________________________________  │
  731. ├─ Groups: ──────────────────────────┤
  732. │ _________________________________  │
  733. │ _________________________________  │
  734. │ _________________________________  │
  735. │ _________________________________  │
  736. │ _________________________________  │
  737. │ _________________________________  │
  738. │ _________________________________  │
  739. └────────────────────────────────────┘
  740. /*
  741. sub_page cross_ref_sbj_form_img from cross_ref_right_entry_img 1
  742. sub_page cross_ref_grp_list_img from cross_ref_right_entry_img vertical 2 7
  743. /cross_ref_keys_img
  744.                       ___________                _________                    
  745. /*
  746. //                    <F4=Prompt>                <F1=Help>
  747.  
  748.     object cross_ref is a client cross_ref_img
  749.         register_object left_entry
  750.         register_object grp_form
  751.         register_object sbj_list
  752.         register_object right_entry
  753.         register_object sbj_form
  754.         register_object grp_list
  755.  
  756.         set location    to 1 0 relative
  757.         set popup_state to true
  758.  
  759.         set center_state item 0 to true
  760.         set value        item 0 to "Cross Reference Maintenance"
  761.  
  762.         create_menu action_bar cross_ref_action_bar_img location 2 1 relative
  763.             set action_bar_keys_msg to xrf_menu_keys 
  764.             
  765.             #INCLUDE RECDE_PD.INC
  766.             set value of (record_pull_down(current_object)) ;
  767.                 item (item_count(record_pull_down(current_object)) - 1) to ;
  768.                 "Exit Cross Ref. Maint. Alt+F4"
  769.  
  770.             #INCLUDE HELP_PD.INC
  771.  
  772.             on_key kcancel send exit_area private
  773.         end_menu
  774.  
  775.         procedure xrf_menu_keys for desktop integer obj
  776.             on_key key_alt+key_r send activate to (record_pull_down(obj)) private
  777.             on_key key_alt+key_h send activate to (help_pull_down(obj))   private
  778.         end_procedure
  779.  
  780.         object left_entry is an entry_client cross_ref_left_entry_img ;
  781.                 action_bar (action_bar(cross_ref(desktop)))
  782.  
  783.             set location to 3 2 relative
  784.  
  785.             object grp_form is a cross_ref_entry_form cross_ref_grp_form_img ;
  786.                     using (cross_ref_left_grp_data(desktop))
  787.  
  788.                 set server_type to LEFT_SERVER_TYPE
  789.  
  790.                 item_list
  791.                     entry_item grp.grp_name { autofind, noput, ;
  792.                             iprompt=(grp_prompt(desktop)) }
  793.                 end_item_list
  794.  
  795.                 on_key kcancel      send activate to (action_bar(cross_ref.obj))  private
  796.                 on_key kswitch      send activate to (right_entry(cross_ref.obj)) private
  797.                 on_key kswitch_back send activate to (right_entry(cross_ref.obj)) private
  798.             end_object
  799.  
  800.             object sbj_list is a cross_ref_table cross_ref_sbj_list_img ;
  801.                     using (cross_ref_left_xrf_data(desktop)) ;
  802.                     main_file xrf by index.1
  803.  
  804.                 set server_type to LEFT_SERVER_TYPE
  805.  
  806.                 begin_row
  807.                     entry_item sbj.sbj_name  { autofind, iprompt=(sbj_prompt(desktop)) }
  808.                 end_row
  809.  
  810.                 on_key kcancel      send activate to (action_bar(cross_ref.obj))  private
  811.                 on_key kswitch      send activate to (right_entry(cross_ref.obj)) private
  812.                 on_key kswitch_back send activate to (right_entry(cross_ref.obj)) private
  813.             end_object
  814.         end_object // left_entry
  815.  
  816.         object right_entry is an entry_client cross_ref_right_entry_img ;
  817.                 action_bar (action_bar(cross_ref(desktop)))
  818.  
  819.             set location to 3 40 relative
  820.  
  821.             object sbj_form is a cross_ref_entry_form cross_ref_sbj_form_img ;
  822.                    using (cross_ref_right_sbj_data(desktop))
  823.  
  824.                 set server_type to RIGHT_SERVER_TYPE
  825.  
  826.                 item_list
  827.                     entry_item sbj.sbj_name { autofind, noput, iprompt=(sbj_prompt(desktop)) }
  828.                 end_item_list
  829.  
  830.                 on_key kcancel      send activate to (action_bar(cross_ref.obj)) private
  831.                 on_key kswitch      send activate to (left_entry(cross_ref.obj)) private
  832.                 on_key kswitch_back send activate to (left_entry(cross_ref.obj)) private
  833.             end_object
  834.  
  835.             object grp_list is a cross_ref_table cross_ref_grp_list_img ;
  836.                     using (cross_ref_right_xrf_data(desktop)) ;
  837.                     main_file xrf by index.2
  838.  
  839.                 set server_type to RIGHT_SERVER_TYPE
  840.  
  841.                 begin_row
  842.                     entry_item grp.grp_name { autofind, iprompt=(grp_prompt(desktop)) }
  843.                 end_row
  844.  
  845.                 on_key kcancel      send activate to (action_bar(cross_ref.obj)) private
  846.                 on_key kswitch      send activate to (left_entry(cross_ref.obj)) private
  847.                 on_key kswitch_back send activate to (left_entry(cross_ref.obj)) private
  848.             end_object
  849.         end_object // right_entry
  850.  
  851.         object sbj_text is a help_maintenance_text_window
  852.             set focus_mode      to nonfocusable
  853.             set location        to 15 11 relative
  854.             set read_only_state to true
  855.             set size            to 3 56
  856.  
  857.             assign_dbms_field sbj.sbj_text
  858.         end_object
  859.  
  860.         object keys is a key_button cross_ref_keys_img
  861.             set location to 19 1 relative
  862.  
  863.             item_list
  864.                 on_item F4_PROMPT_TEXT send prompt
  865.                 on_item F1_HELP_TEXT   send help
  866.             end_item_list
  867.         end_object
  868.  
  869.         procedure reset_servers integer svr_type
  870.             local integer obj new_svr old_svr rec
  871.  
  872.             clear grp sbj xrf
  873.  
  874.             if svr_type eq LEFT_SERVER_TYPE ;
  875.                     move (cross_ref_left_xrf_data(desktop)) to new_svr
  876.             else move (cross_ref_right_xrf_data(desktop)) to new_svr
  877.  
  878.             get current_record of new_svr to rec
  879.             if rec ne 0 send read_by_recnum to new_svr xrf.file_number rec
  880.  
  881.             if svr_type eq LEFT_SERVER_TYPE begin
  882.                 move (cross_ref_left_grp_data(desktop)) to new_svr
  883.                 get current_record of new_svr to rec
  884.                 if rec ne 0 send read_by_recnum to new_svr grp.file_number rec
  885.                 else clear grp
  886.             end
  887.  
  888.             if svr_type eq RIGHT_SERVER_TYPE begin
  889.                 move (cross_ref_right_sbj_data(desktop)) to new_svr
  890.                 get current_record of new_svr to rec
  891.                 if rec ne 0 send read_by_recnum to new_svr sbj.file_number rec
  892.                 else clear sbj
  893.             end
  894.  
  895.             if svr_type eq LEFT_SERVER_TYPE ;
  896.                     move (cross_ref_left_xrf_data(desktop)) to new_svr
  897.             else move (cross_ref_right_sbj_data(desktop)) to new_svr
  898.  
  899.             move (sbj_text(current_object)) to obj
  900.             get server of obj to old_svr
  901.  
  902.             if old_svr ne new_svr begin
  903.                 set server of obj to new_svr
  904.                 if sbj.recnum ne 0 send entry_display to obj 0 true
  905.                 else send entry_clear to obj 0
  906.             end
  907.         end_procedure
  908.  
  909.         procedure shadow_prompt_button integer flag
  910.             set shadow_state of (keys(current_object)) item 0 to flag
  911.         end_procedure
  912.  
  913.         procedure activate
  914.             if not (active_state(current_object)) clear grp sbj xrf
  915.             forward send activate
  916.             send activate to (left_entry(current_object))
  917.         end_procedure
  918.     end_object
  919.  
  920.     send popup to cross_ref
  921.  
  922. end
  923.  
  924. // data sets for prompt objects
  925.  
  926. /grp_prompt_img
  927. ╔══════════════════════════════════════════════╗
  928. ║______________________________________________║
  929. ║                                              ║
  930. ║                                              ║
  931. ║                                              ║
  932. ║                                              ║
  933. ║                                              ║
  934. ║                                              ║
  935. ║                                              ║
  936. ║                                              ║
  937. ║                                              ║
  938. ║                                              ║
  939. ║                                              ║
  940. ╚══════════════════════════════════════════════╝
  941. /grp_prompt_list_img
  942. _________________________________
  943. _________________________________
  944. _________________________________
  945. _________________________________
  946. _________________________________
  947. _________________________________
  948. _________________________________
  949. _________________________________
  950. /grp_prompt_keys_img
  951.         ____________         _________        
  952. /*
  953. //     <Esc=Cancel>         <F1=Help>
  954.  
  955. object grp_prompt is a prompt_client grp_prompt_img
  956.     set location to 3 16 relative
  957.  
  958.     set center_state item 0 to true
  959.     set value        item 0 to "Groups"
  960.  
  961.     object list is a help_maintenance_selection_list grp_prompt_list_img ;
  962.             main_file grp by index.1
  963.  
  964.         set location to 3 7 relative
  965.  
  966.         begin_row
  967.             entry_item grp.grp_name
  968.         end_row
  969.  
  970.         on_key kcancel           send request_cancel_area
  971.         on_key kexit_application send quit_help_maint
  972.     end_object
  973.  
  974.     set list_object to (list(current_object))
  975.  
  976.     object keys is a key_button grp_prompt_keys_img
  977.         set location to 12 1 relative
  978.  
  979.         item_list
  980.             on_item ESC_CANCEL_TEXT send request_cancel
  981.             on_item F1_HELP_TEXT    send help
  982.         end_item_list
  983.     end_object
  984. end_object // grp_prompt
  985.  
  986. /sbj_prompt_img
  987. ╔═══════════════════════════════════════════════════════════╗
  988. ║___________________________________________________________║
  989. ║                                                           ║
  990. ║            ┌──────────────────────────────────┐           ║
  991. ║            │                                  │           ║
  992. ║            │                                  │           ║
  993. ║            │                                  │           ║
  994. ║            │                                  │           ║
  995. ║            │                                  │           ║
  996. ║            │                                  │           ║
  997. ║            │                                  │           ║
  998. ║            └──────────────────────────────────┘           ║
  999. ║┌─────────────────────────────────────────────────────────┐║
  1000. ║│                                                         │║
  1001. ║│                                                         │║
  1002. ║│                                                         │║
  1003. ║└─────────────────────────────────────────────────────────┘║
  1004. ║                                                           ║
  1005. ║                                                           ║
  1006. ╚═══════════════════════════════════════════════════════════╝
  1007. /sbj_prompt_list_img
  1008. _________________________________
  1009. _________________________________
  1010. _________________________________
  1011. _________________________________
  1012. _________________________________
  1013. _________________________________
  1014. _________________________________
  1015. /sbj_prompt_keys_img
  1016.               ____________           _________             
  1017. /*
  1018. //            <Esc=Cancel>           <F1=Help>
  1019.  
  1020. object sbj_prompt is a prompt_client sbj_prompt_img
  1021.     set location to 2 10 relative
  1022.  
  1023.     set center_state item 0 to true
  1024.     set value        item 0 to "Subjects"
  1025.  
  1026.     object list is a help_maintenance_selection_list sbj_prompt_list_img ;
  1027.             main_file sbj by index.1
  1028.  
  1029.         set location to 4 14 relative
  1030.  
  1031.         begin_row
  1032.             entry_item sbj.sbj_name
  1033.         end_row
  1034.  
  1035.         object text is a help_maintenance_text_window
  1036.             set location        to 9 -12 relative
  1037.             set focus_mode      to nonfocusable
  1038.             set read_only_state to true
  1039.             set size            to 3 56
  1040.  
  1041.             assign_dbms_field sbj.sbj_text
  1042.         end_object
  1043.  
  1044.         on_key kcancel           send request_cancel_area
  1045.         on_key kexit_application send quit_help_maint
  1046.  
  1047.         procedure add_focus integer obj
  1048.             forward send add_focus obj
  1049.             send entry_display to (text(current_object)) 0 0
  1050.         end_procedure
  1051.  
  1052.         procedure find_record integer rec
  1053.             forward send find_record rec
  1054.             send entry_display to (text(current_object)) 0 0
  1055.         end_procedure
  1056.  
  1057.         procedure beginning_of_data
  1058.             forward send beginning_of_data
  1059.             send entry_display to (text(current_object)) 0 0
  1060.         end_procedure
  1061.  
  1062.         procedure end_of_data
  1063.             forward send end_of_data
  1064.             send find_record (current_record(current_object))
  1065.             send entry_display to (text(current_object)) 0 0
  1066.         end_procedure
  1067.     end_object // list
  1068.  
  1069.     set list_object to (list(current_object))
  1070.  
  1071.     object keys is a key_button sbj_prompt_keys_img
  1072.         set location to 18 1 relative
  1073.  
  1074.         item_list
  1075.             on_item ESC_CANCEL_TEXT send request_cancel
  1076.             on_item F1_HELP_TEXT    send help
  1077.         end_item_list
  1078.     end_object
  1079. end_object // sbj_prompt
  1080.  
  1081. /verify_del_img
  1082. ╔═══════════════════════════════════════════════════════════╗
  1083. ║___________________________________________________________║
  1084. ║                                                           ║
  1085. ║                                                           ║
  1086. ║                                                           ║
  1087. ║                                                           ║
  1088. ║                                                           ║
  1089. ║                                                           ║
  1090. ╚═══════════════════════════════════════════════════════════╝
  1091. /verify_del_btn_img
  1092.          ____           ________           ______          
  1093. /*
  1094.  
  1095. object verify_del is a client verify_del_img
  1096.     set block_mouse_state to true
  1097.     set location          to 9 9 relative
  1098.     set popup_state       to true
  1099.     set scope_state       to true
  1100.  
  1101.     set center_state item 0 to true
  1102.     set value        item 0 to "Verify deletion"
  1103.     
  1104.     object text is an edit
  1105.         set focus_mode   to nonfocusable
  1106.         set location     to 3 2 relative
  1107.         set object_color to (hi(object_color(parent(current_object)))) ;
  1108.             (low(object_color(parent(current_object))))
  1109.         set size         to 2 56
  1110.     end_object
  1111.     
  1112.     object buttons is a button verify_del_btn_img
  1113.         set location to 6 1 relative
  1114.  
  1115.         item_list
  1116.             on_item '<OK>'     send ok
  1117.             on_item '<Cancel>' send cancel
  1118.             on_item '<Help>'   send help
  1119.         end_item_list
  1120.     end_object
  1121.     
  1122.     on_key kcancel send stop_ui
  1123.     
  1124.     function verify string filename string related returns integer
  1125.         local string txt
  1126.         local integer result
  1127.  
  1128.         move 'Delete the ' to txt
  1129.         append txt filename ' record and ' related ' records that relate to it?' 
  1130.         send delete_data (text(current_object))
  1131.         send insert to (text(current_object)) txt
  1132.  
  1133.         ui_accept current_object to result
  1134.  
  1135.         // 0 means delete, 1 means cancel
  1136.  
  1137.         if result eq msg_ok function_return 0
  1138.         else function_return 1
  1139.     end_function
  1140. end_object // verify_del
  1141.  
  1142. on_key kexit_application send exit_program
  1143.  
  1144. //////////////////////////////////
  1145. ////////////////////////////////// main logic
  1146. //////////////////////////////////
  1147.  
  1148. start_ui
  1149.  
  1150. send insert_cb SUCCESS_REPLY 0
  1151.  
  1152. abort
  1153.