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