home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / epmmac.zip / LOAD.E < prev    next >
Text File  |  1996-04-10  |  7KB  |  218 lines

  1. ;  LOAD.E                                                Bryan Lewis 1/2/89
  2. ;
  3. ;  This event is triggered immediately after a file is loaded.  It will be
  4. ;  invoked after loading an existing file from disk, or opening a new file,
  5. ;  but not after an error such as "Not enough memory".
  6. ;  In other words, a new file must be entered into the ring.
  7. ;
  8. ;  This is the place to select a keyset (like c_keys for .C files) since
  9. ;  keysets now stay bound to a file once assigned.
  10. ;  This is also a good place to do other one-time processing like returning to
  11. ;  a saved bookmark.
  12. ;
  13. ;  No argument is passed.  Check .filename if you want the name of the file.
  14. ;  Use the function filetype() for the filetype.
  15. ;  1993/01/07:  put the result of filetype() in a universal so others needn't call it.
  16. const
  17. compile if not defined(C_KEYWORD_HIGHLIGHTING)
  18.    C_KEYWORD_HIGHLIGHTING = 0
  19. compile endif
  20. compile if not defined(E_KEYWORD_HIGHLIGHTING)
  21.    E_KEYWORD_HIGHLIGHTING = 0
  22. compile endif
  23. compile if not defined(FORTRAN_KEYWORD_HIGHLIGHTING)
  24.    FORTRAN_KEYWORD_HIGHLIGHTING = 0
  25. compile endif
  26. compile if not defined(HTML_KEYWORD_HIGHLIGHTING)
  27.    HTML_KEYWORD_HIGHLIGHTING = 0
  28. compile endif
  29. compile if not defined(IPF_KEYWORD_HIGHLIGHTING)
  30.    IPF_KEYWORD_HIGHLIGHTING = 0
  31. compile endif
  32. compile if not defined(JAVA_KEYWORD_HIGHLIGHTING)
  33.    JAVA_KEYWORD_HIGHLIGHTING = 0
  34. compile endif
  35. compile if not defined(PERL_KEYWORD_HIGHLIGHTING)
  36.    PERL_KEYWORD_HIGHLIGHTING = 0
  37. compile endif
  38. compile if not defined(REXX_KEYWORD_HIGHLIGHTING)
  39.    REXX_KEYWORD_HIGHLIGHTING = 0
  40. compile endif
  41. compile if not defined(RC_KEYWORD_HIGHLIGHTING)
  42.    RC_KEYWORD_HIGHLIGHTING = 0
  43. compile endif
  44. compile if not defined(SCRIPT_KEYWORD_HIGHLIGHTING)
  45.    SCRIPT_KEYWORD_HIGHLIGHTING = 0
  46. compile endif
  47. compile if not defined(TEX_KEYWORD_HIGHLIGHTING)
  48.    TEX_KEYWORD_HIGHLIGHTING = 0
  49. compile endif
  50. compile if not defined(MAKE_KEYWORD_HIGHLIGHTING)
  51.    MAKE_KEYWORD_HIGHLIGHTING = 0
  52. compile endif
  53.  
  54. defload
  55.    universal load_ext
  56.    universal defload_profile_name
  57. compile if WANT_EBOOKIE = 'DYNALINK'
  58.    universal bkm_avail
  59. compile endif
  60. compile if EPM
  61.    universal vDEFAULT_TABS, vDEFAULT_MARGINS, vDEFAULT_AUTOSAVE, load_var
  62.  compile if EVERSION >= '5.50'
  63.    universal default_font
  64.  compile endif
  65.  compile if WANT_LONGNAMES='SWITCH'
  66.    universal SHOW_LONGNAMES
  67.  compile endif
  68.  
  69.    load_var = 0
  70.  
  71.    .tabs     = vDEFAULT_TABS
  72.    .margins  = vDEFAULT_MARGINS
  73.    .autosave = vDEFAULT_AUTOSAVE
  74.  compile if EVERSION < 5.21
  75.    .statusline=STATUS_TEMPLATE
  76.  compile endif
  77.  compile if WANT_LONGNAMES
  78.   compile if WANT_LONGNAMES='SWITCH'
  79.    if SHOW_LONGNAMES then
  80.   compile endif
  81.    longname = get_EAT_ASCII_value('.LONGNAME')
  82.    if longname<>'' then
  83.       filepath = leftstr(.filename, lastpos('\',.filename))
  84.       .titletext = filepath || longname
  85.    endif
  86.   compile if WANT_LONGNAMES='SWITCH'
  87.    endif
  88.   compile endif
  89.  compile endif
  90. compile else
  91.    .tabs     = DEFAULT_TABS
  92.    .margins  = DEFAULT_MARGINS
  93.    .autosave = DEFAULT_AUTOSAVE
  94. compile endif
  95.    load_ext = filetype()
  96.    keys edit_keys    -- defaults for non-special filetypes
  97. compile if EVERSION >= '5.50'
  98.    if .font < 2 then    -- If being called from a NAME, and font was set, don't change it.
  99.       .font = default_font
  100.    endif
  101. compile endif
  102. compile if WANT_BOOKMARKS
  103.    if .levelofattributesupport < 2 then  -- If not already set (e.g., NAME does a DEFLOAD)
  104.       'loadattributes'
  105.    endif
  106. compile endif
  107. compile if WANT_EBOOKIE
  108.  compile if WANT_EBOOKIE = 'DYNALINK'
  109.    if bkm_avail <> '' then
  110.  compile endif
  111.       if bkm_defload()<>0 then keys bkm_keys; endif
  112.  compile if WANT_EBOOKIE = 'DYNALINK'
  113.    endif
  114.  compile endif
  115. compile endif  -- WANT_EBOOKIE
  116. compile if C_KEYWORD_HIGHLIGHTING and EPM32 and not (C_SYNTAX_ASSIST and ALTERNATE_KEYSETS)
  117.    if wordpos(load_ext, 'C H SQC CPP HPP CXX HXX SQX') & .visible then
  118.       'toggle_parse 1 epmkwds.c'
  119.    endif
  120. compile endif
  121. compile if E_KEYWORD_HIGHLIGHTING and EPM32 and not (E_SYNTAX_ASSIST and ALTERNATE_KEYSETS)
  122.    if load_ext='E' & .visible then
  123.       'toggle_parse 1 epmkwds.e'
  124.    endif
  125. compile endif
  126. compile if FORTRAN_KEYWORD_HIGHLIGHTING and EPM32
  127.    if wordpos(load_ext, 'FOR FORTRAN F90') & .visible then
  128.       'toggle_parse 1 epmkwds.F90'
  129.    endif
  130. compile endif
  131. compile if HTML_KEYWORD_HIGHLIGHTING and EPM32
  132.    if wordpos(load_ext, 'HTM HTML') & .visible then
  133.       'toggle_parse 1 epmkwds.HTM'
  134.    endif
  135. compile endif
  136. compile if IPF_KEYWORD_HIGHLIGHTING and EPM32
  137.    if load_ext = 'IPF' & .visible then
  138.       'toggle_parse 1 epmkwds.IPF'
  139.    endif
  140. compile endif
  141. compile if JAVA_KEYWORD_HIGHLIGHTING and EPM32 and not (C_SYNTAX_ASSIST and ALTERNATE_KEYSETS)
  142.    if wordpos(load_ext, 'JAV JAVA') & .visible then
  143.       'toggle_parse 1 epmkwds.jav'
  144.    endif
  145. compile endif
  146. compile if PERL_KEYWORD_HIGHLIGHTING and EPM32
  147.    if wordpos(load_ext, 'PL PRL PERL') & .visible then
  148.       'toggle_parse 1 epmkwds.PL'
  149.    elseif load_ext = 'CMD' & .visible then
  150.       if .last then
  151.          line = upcase(textline(1))
  152.       else
  153.          line = ''
  154.       endif
  155.       if word(line,1)='EXTPROC' & pos('PERL', line) then
  156.          'toggle_parse 1 epmkwds.PL'
  157.       endif
  158.    endif
  159. compile endif
  160. compile if REXX_KEYWORD_HIGHLIGHTING and EPM32 and not (REXX_SYNTAX_ASSIST and ALTERNATE_KEYSETS)
  161.    if wordpos(load_ext, 'BAT CMD ERX EXC EXEC XEDIT REX REXX VRX') & .visible then
  162.       if load_ext = 'CMD' & .last then
  163.          line = upcase(textline(1))
  164.       else
  165.          line = ''
  166.       endif
  167.       if word(line,1)<>'EXTPROC' then
  168.          'toggle_parse 1 epmkwds.cmd'
  169.       endif
  170.    endif
  171. compile endif
  172. compile if RC_KEYWORD_HIGHLIGHTING and EPM32
  173.    if load_ext='RC' & .visible then
  174.       'toggle_parse 1 epmkwds.rc'
  175.    endif
  176. compile endif
  177. compile if SCRIPT_KEYWORD_HIGHLIGHTING and EPM32
  178.  compile if defined(my_SCRIPT_FILE_TYPE)
  179.    if wordpos(load_ext, 'SCR SCT SCRIPT IPF' my_SCRIPT_FILE_TYPE)>0 & .visible then
  180.  compile else
  181.    if wordpos(load_ext, 'SCR SCT SCRIPT IPF')>0 & .visible then
  182.  compile endif
  183.       'toggle_parse 1 epmkwds.scr'
  184.    endif
  185. compile endif
  186. compile if TEX_KEYWORD_HIGHLIGHTING and EPM32
  187.  compile if defined(TEX_FILE_TYPES)
  188.    if wordpos(load_ext, TEX_FILETYPES)>0 & .visible then
  189.  compile else
  190.    if wordpos(load_ext, 'TEX LATEX') & .visible then
  191.  compile endif
  192.       'toggle_parse 1 epmkwds.TEX'
  193.    endif
  194. compile endif
  195. compile if MAKE_KEYWORD_HIGHLIGHTING and EPM32
  196.    if (upcase(rightstr(.filename,8))='MAKEFILE' | load_ext='MAK') & .visible then
  197.       'toggle_parse 1 epmkwds.mak'
  198.    endif
  199. compile endif
  200. compile if INCLUDE_BMS_SUPPORT
  201.    if isadefproc('BMS_defload_exit') then
  202.       call BMS_defload_exit()
  203.    endif
  204. compile endif
  205.    if defload_profile_name then
  206.       if not verify(defload_profile_name, ':\', 'M') then  -- Not fully qualified?  Search for it...
  207.          findfile profile1, defload_profile_name, EPATH
  208.          if rc then findfile profile1, defload_profile_name, 'PATH'; endif
  209.          if not rc then
  210.             defload_profile_name = profile1  -- Remember where it was found.
  211.             'rx' defload_profile_name arg(1)
  212.          endif
  213.       else  -- Fully qualified
  214.          'rx' defload_profile_name arg(1)
  215.       endif
  216.    endif
  217. -- sayerror 'DEFLOAD occurred for file '.filename'.'  -- for testing
  218.