home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / epm603b.zip / EPMMAC.ZIP / LOAD.E < prev    next >
Text File  |  1996-05-31  |  8KB  |  226 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(ADA_KEYWORD_HIGHLIGHTING)
  18.    ADA_KEYWORD_HIGHLIGHTING = 0
  19. compile endif
  20. compile if not defined(C_KEYWORD_HIGHLIGHTING)
  21.    C_KEYWORD_HIGHLIGHTING = 0
  22. compile endif
  23. compile if not defined(E_KEYWORD_HIGHLIGHTING)
  24.    E_KEYWORD_HIGHLIGHTING = 0
  25. compile endif
  26. compile if not defined(FORTRAN_KEYWORD_HIGHLIGHTING)
  27.    FORTRAN_KEYWORD_HIGHLIGHTING = 0
  28. compile endif
  29. compile if not defined(HTML_KEYWORD_HIGHLIGHTING)
  30.    HTML_KEYWORD_HIGHLIGHTING = 0
  31. compile endif
  32. compile if not defined(IPF_KEYWORD_HIGHLIGHTING)
  33.    IPF_KEYWORD_HIGHLIGHTING = 0
  34. compile endif
  35. compile if not defined(JAVA_KEYWORD_HIGHLIGHTING)
  36.    JAVA_KEYWORD_HIGHLIGHTING = 0
  37. compile endif
  38. compile if not defined(PERL_KEYWORD_HIGHLIGHTING)
  39.    PERL_KEYWORD_HIGHLIGHTING = 0
  40. compile endif
  41. compile if not defined(REXX_KEYWORD_HIGHLIGHTING)
  42.    REXX_KEYWORD_HIGHLIGHTING = 0
  43. compile endif
  44. compile if not defined(RC_KEYWORD_HIGHLIGHTING)
  45.    RC_KEYWORD_HIGHLIGHTING = 0
  46. compile endif
  47. compile if not defined(SCRIPT_KEYWORD_HIGHLIGHTING)
  48.    SCRIPT_KEYWORD_HIGHLIGHTING = 0
  49. compile endif
  50. compile if not defined(TEX_KEYWORD_HIGHLIGHTING)
  51.    TEX_KEYWORD_HIGHLIGHTING = 0
  52. compile endif
  53. compile if not defined(MAKE_KEYWORD_HIGHLIGHTING)
  54.    MAKE_KEYWORD_HIGHLIGHTING = 0
  55. compile endif
  56.  
  57. defload
  58.    universal load_ext
  59.    universal defload_profile_name
  60. compile if WANT_EBOOKIE = 'DYNALINK'
  61.    universal bkm_avail
  62. compile endif
  63. compile if EPM
  64.    universal vDEFAULT_TABS, vDEFAULT_MARGINS, vDEFAULT_AUTOSAVE, load_var
  65.  compile if EVERSION >= '5.50'
  66.    universal default_font
  67.  compile endif
  68.  compile if WANT_LONGNAMES='SWITCH'
  69.    universal SHOW_LONGNAMES
  70.  compile endif
  71.  
  72.    load_var = 0
  73.  
  74.    .tabs     = vDEFAULT_TABS
  75.    .margins  = vDEFAULT_MARGINS
  76.    .autosave = vDEFAULT_AUTOSAVE
  77.  compile if EVERSION < 5.21
  78.    .statusline=STATUS_TEMPLATE
  79.  compile endif
  80.  compile if WANT_LONGNAMES
  81.   compile if WANT_LONGNAMES='SWITCH'
  82.    if SHOW_LONGNAMES then
  83.   compile endif
  84.    longname = get_EAT_ASCII_value('.LONGNAME')
  85.    if longname<>'' then
  86.       filepath = leftstr(.filename, lastpos('\',.filename))
  87.       .titletext = filepath || longname
  88.    endif
  89.   compile if WANT_LONGNAMES='SWITCH'
  90.    endif
  91.   compile endif
  92.  compile endif
  93. compile else
  94.    .tabs     = DEFAULT_TABS
  95.    .margins  = DEFAULT_MARGINS
  96.    .autosave = DEFAULT_AUTOSAVE
  97. compile endif
  98.    load_ext = filetype()
  99.    keys edit_keys    -- defaults for non-special filetypes
  100. compile if EVERSION >= '5.50'
  101.    if .font < 2 then    -- If being called from a NAME, and font was set, don't change it.
  102.       .font = default_font
  103.    endif
  104. compile endif
  105. compile if WANT_BOOKMARKS
  106.    if .levelofattributesupport < 2 then  -- If not already set (e.g., NAME does a DEFLOAD)
  107.       'loadattributes'
  108.    endif
  109. compile endif
  110. compile if WANT_EBOOKIE
  111.  compile if WANT_EBOOKIE = 'DYNALINK'
  112.    if bkm_avail <> '' then
  113.  compile endif
  114.       if bkm_defload()<>0 then keys bkm_keys; endif
  115.  compile if WANT_EBOOKIE = 'DYNALINK'
  116.    endif
  117.  compile endif
  118. compile endif  -- WANT_EBOOKIE
  119. compile if ADA_KEYWORD_HIGHLIGHTING and EPM32
  120.    if wordpos(load_ext, 'ADA ADB ADS') & .visible then
  121.       'toggle_parse 1 epmkwds.Ada'
  122.    endif
  123. compile endif
  124. compile if C_KEYWORD_HIGHLIGHTING and EPM32 and not (C_SYNTAX_ASSIST and ALTERNATE_KEYSETS)
  125.    if wordpos(load_ext, 'C H SQC CPP HPP CXX HXX SQX') & .visible then
  126.       'toggle_parse 1 epmkwds.c'
  127.    endif
  128. compile endif
  129. compile if E_KEYWORD_HIGHLIGHTING and EPM32 and not (E_SYNTAX_ASSIST and ALTERNATE_KEYSETS)
  130.    if load_ext='E' & .visible then
  131.       'toggle_parse 1 epmkwds.e'
  132.    endif
  133. compile endif
  134. compile if FORTRAN_KEYWORD_HIGHLIGHTING and EPM32
  135.    if wordpos(load_ext, 'FOR FORTRAN F90') & .visible then
  136.       'toggle_parse 1 epmkwds.F90'
  137.    endif
  138. compile endif
  139. compile if HTML_KEYWORD_HIGHLIGHTING and EPM32
  140.    if wordpos(load_ext, 'HTM HTML') & .visible then
  141.       'toggle_parse 1 epmkwds.HTM'
  142.    endif
  143. compile endif
  144. compile if IPF_KEYWORD_HIGHLIGHTING and EPM32
  145.    if load_ext = 'IPF' & .visible then
  146.       'toggle_parse 1 epmkwds.IPF'
  147.    endif
  148. compile endif
  149. compile if JAVA_KEYWORD_HIGHLIGHTING and EPM32 and not (C_SYNTAX_ASSIST and ALTERNATE_KEYSETS)
  150.    if wordpos(load_ext, 'JAV JAVA') & .visible then
  151.       'toggle_parse 1 epmkwds.jav'
  152.    endif
  153. compile endif
  154. compile if PERL_KEYWORD_HIGHLIGHTING and EPM32
  155.    if wordpos(load_ext, 'PL PRL PERL') & .visible then
  156.       'toggle_parse 1 epmkwds.PL'
  157.    elseif load_ext = 'CMD' & .visible then
  158.       if .last then
  159.          line = upcase(textline(1))
  160.       else
  161.          line = ''
  162.       endif
  163.       if word(line,1)='EXTPROC' & pos('PERL', line) then
  164.          'toggle_parse 1 epmkwds.PL'
  165.       endif
  166.    endif
  167. compile endif
  168. compile if REXX_KEYWORD_HIGHLIGHTING and EPM32 and not (REXX_SYNTAX_ASSIST and ALTERNATE_KEYSETS)
  169.    if wordpos(load_ext, 'BAT CMD ERX EXC EXEC XEDIT REX REXX VRX') & .visible then
  170.       if load_ext = 'CMD' & .last then
  171.          line = upcase(textline(1))
  172.       else
  173.          line = ''
  174.       endif
  175.       if word(line,1)<>'EXTPROC' then
  176.          'toggle_parse 1 epmkwds.cmd'
  177.       endif
  178.    endif
  179. compile endif
  180. compile if RC_KEYWORD_HIGHLIGHTING and EPM32
  181.    if load_ext='RC' & .visible then
  182.       'toggle_parse 1 epmkwds.rc'
  183.    endif
  184. compile endif
  185. compile if SCRIPT_KEYWORD_HIGHLIGHTING and EPM32
  186.  compile if defined(my_SCRIPT_FILE_TYPE)
  187.    if wordpos(load_ext, 'SCR SCT SCRIPT IPF' my_SCRIPT_FILE_TYPE)>0 & .visible then
  188.  compile else
  189.    if wordpos(load_ext, 'SCR SCT SCRIPT IPF')>0 & .visible then
  190.  compile endif
  191.       'toggle_parse 1 epmkwds.scr'
  192.    endif
  193. compile endif
  194. compile if TEX_KEYWORD_HIGHLIGHTING and EPM32
  195.  compile if defined(TEX_FILE_TYPES)
  196.    if wordpos(load_ext, TEX_FILETYPES)>0 & .visible then
  197.  compile else
  198.    if wordpos(load_ext, 'TEX LATEX') & .visible then
  199.  compile endif
  200.       'toggle_parse 1 epmkwds.TEX'
  201.    endif
  202. compile endif
  203. compile if MAKE_KEYWORD_HIGHLIGHTING and EPM32
  204.    if (upcase(rightstr(.filename,8))='MAKEFILE' | load_ext='MAK') & .visible then
  205.       'toggle_parse 1 epmkwds.mak'
  206.    endif
  207. compile endif
  208. compile if INCLUDE_BMS_SUPPORT
  209.    if isadefproc('BMS_defload_exit') then
  210.       call BMS_defload_exit()
  211.    endif
  212. compile endif
  213.    if defload_profile_name then
  214.       if not verify(defload_profile_name, ':\', 'M') then  -- Not fully qualified?  Search for it...
  215.          findfile profile1, defload_profile_name, EPATH
  216.          if rc then findfile profile1, defload_profile_name, 'PATH'; endif
  217.          if not rc then
  218.             defload_profile_name = profile1  -- Remember where it was found.
  219.             'rx' defload_profile_name arg(1)
  220.          endif
  221.       else  -- Fully qualified
  222.          'rx' defload_profile_name arg(1)
  223.       endif
  224.    endif
  225. -- sayerror 'DEFLOAD occurred for file '.filename'.'  -- for testing
  226.