home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / e / epmmac2.zip / HELP.E < prev    next >
Text File  |  1992-12-18  |  8KB  |  234 lines

  1. /*      HELP.E       --- Used By EPM  G.C.       */
  2. include 'STDCONST.E'  -- LAM:  Need IBM_IUO
  3.  define INCLUDING_FILE = 'HELP.E'
  4. tryinclude 'MYCNF.E'
  5.  
  6.  compile if not defined(SITE_CONFIG)
  7.     const SITE_CONFIG = 'SITECNF.E'
  8.  compile endif
  9.  compile if SITE_CONFIG
  10.     tryinclude SITE_CONFIG
  11.  compile endif
  12.  
  13.  compile if not defined(NLS_LANGUAGE)
  14.   const NLS_LANGUAGE = 'ENGLISH'
  15.  compile endif
  16. include NLS_LANGUAGE'.e'
  17.  
  18. const
  19.    PAGESIZE = 21
  20.  
  21. defmain    /* defmain should be used to parse the command line arguments */
  22.    'xcom e 'arg(1)
  23.    prevfile; 'xcom quit'
  24.  
  25. ;  .titletext    = 'EPM Help Browser'
  26.    .titletext    = QUICK_REF__MSG
  27.    .textcolor    =  240            -- WhiteB
  28.    .markcolor    =  240            -- WhiteB
  29.    .tabs         = '1 2 3 4 5 6'
  30.    .margins      = '1 80 1'
  31.    .autosave     = 0
  32.    keys help
  33.    call repaint_window()
  34.    call showwindow('ON')
  35.    'togglecontrol 14 0'     -- Turn cursor off
  36. compile if EVERSION >= '5.50'
  37.    if upcase(rightstr(.filename,8))='DBCS.QHL' then
  38.       .font = registerfont('Mincho', 10, 0)
  39.    else
  40.       .font = registerfont('System Monospaced', 10, 0)
  41.    endif
  42. compile endif
  43. compile if EVERSION < '5.21'
  44.    .statuscolor  =  16+15          -- BlueB + White
  45.    .messagecolor =  16+14          -- BlueB + Yellow
  46.    .statusline=HELP_STATUS__MSG
  47. compile else
  48.    'togglecontrol 26 0'     -- Don't use internal key definitions.
  49.    call windowmessage(1,  getpminfo(EPMINFO_EDITCLIENT),
  50.                       5431,      -- EPM_FRAME_STATUSLINE
  51. compile if EVERSION >= 5.53
  52.                       put_in_buffer(atoi(length(HELP_STATUS__MSG)) || HELP_STATUS__MSG, 0),
  53. compile else
  54.                       put_in_buffer(chr(length(HELP_STATUS__MSG)) || HELP_STATUS__MSG, 0),
  55. compile endif
  56.                       31)        -- BlueB + White
  57.  
  58.    call windowmessage(1,  getpminfo(EPMINFO_EDITCLIENT),
  59.                       4873,      -- EII_EDIT_REFRESHSTATUSLINE
  60.                       1, 1);
  61.  compile if EVERSION < 5.53
  62.    'togglecontrol 23 1'     -- Move status & message line to top
  63.  compile else
  64.    call windowmessage(0,  getpminfo(EPMINFO_EDITFRAME),
  65.                       5907,            -- EFRAMEM_TOGGLECONTROL
  66.                       32 + 2 * 65536,  -- Move extra window to top
  67.                       0)
  68.  compile endif
  69. compile endif
  70. ;  mouse_setpointer 12
  71.    .cursory = 1
  72.    '0'
  73.  
  74. defc e =  -- Only called by someone else posting a command to us.
  75.    call winmessagebox(QUICK_REF__MSG, NO_DROP__MSG, 16454) -- CANCEL + ICONHAND + MOVEABLE
  76.  
  77. defkeys help base clear
  78.  
  79. def pgup=
  80.    .cursory = 1
  81.    PAGESIZE * (max(.line-1,0) % PAGESIZE)
  82.  
  83. def pgdn=
  84.    .cursory = 1
  85.    PAGESIZE * (min(.line+PAGESIZE,.last) % PAGESIZE)
  86.  
  87. def home, c_Home = .cursory=1; '0'
  88.  
  89. def end, c_End = .cursory=1; .last % PAGESIZE * PAGESIZE
  90.  
  91. def esc,F3=  -- 'close'
  92. ; defc close=
  93.    call windowmessage(0,  getpminfo(EPMINFO_EDITCLIENT),
  94.                       41,                 -- WM_CLOSE
  95.                       0,
  96.                       0)
  97.  
  98. defproc max(a,b)  -- Support as many arguments as E3 will allow.
  99.    maximum=a
  100.    do i=2 to arg()
  101.       if maximum<arg(i) then maximum=arg(i); endif
  102.    end
  103.    return maximum
  104.  
  105. defproc min(a,b)  -- Support as many arguments as E3 will allow.
  106.    minimum=a
  107.    do i=2 to arg()
  108.       if minimum>arg(i) then minimum=arg(i); endif
  109.    end
  110.    return minimum
  111.  
  112. /* allows the edit window to become invisible or visible  */
  113. defproc showwindow
  114.    call windowmessage(0, getpminfo(EPMINFO_EDITCLIENT),
  115.                       5385,
  116.                       upcase(arg(1))<>'OFF', -- 0 if OFF, else 1
  117.                       0)
  118.  
  119. /*
  120. ┌────────────────────────────────────────────────────────────────────────────┐
  121. │ what's it called: repaint_window                                           │
  122. │                                                                            │
  123. │ what does it do : send a paint message to the editor.                      │
  124. │                                                                            │
  125. └────────────────────────────────────────────────────────────────────────────┘
  126. */
  127. defproc repaint_window()
  128.    call windowmessage(0, getpminfo(EPMINFO_EDITCLIENT), 35, 0, 0)   -- WM_PAINT
  129.  
  130. defc togglecontrol
  131.    forceon=0
  132.    parse arg controlid fon
  133.    if fon<>'' then
  134.       forceon=(fon+1)*65536
  135.    endif
  136.  
  137.    call windowmessage(0,  getpminfo(EPMINFO_EDITFRAME),   -- Post message to frame
  138.                       5388,               -- EPM_EDIT_CONTROLTOGGLE
  139.                       controlid + forceon,
  140.                       0)
  141.  
  142. defc PROCESSDRAGDROP
  143.    parse arg cmdid hwnd .
  144. ;  hwnd=atol_swap(hwnd)
  145.  
  146.    if cmdid=10 then
  147.       sayerror PRINTING__MSG .filename
  148.       'xcom save /q lpt1'
  149.    elseif cmdid=1 and hwnd<>getpminfo(EPMINFO_EDITCLIENT) and leftstr(.filename,1)<>'.' then
  150.       call PostCmdToEditWindow('e '.filename,hwnd,9,2)
  151.    elseif cmdid=3 then                       -- Open
  152.       call windowmessage(0,  getpminfo(APP_HANDLE),
  153.                          5386,                   -- EPM_EDIT_NEWFILE
  154.                          put_in_buffer(name,2),  -- share = GETable
  155.                          9)                      -- EPM does a GET first & a FREE after.
  156. compile if IBM_IUO
  157.    elseif cmdid=4 then
  158.       call winmessagebox(SYS_ED__MSG,SYS_ED1__MSG\10'   :-)', 16406) -- CANCEL + ICONQUESTION
  159. compile endif
  160.    endif
  161.  
  162. defproc PostCmdToEditWindow(cmd,winhndl)
  163. ;; if arg(3)<>'' then mp2=arg(3); else mp2=1; endif
  164.    call windowmessage(0,  winhndl,
  165.                       5377,               -- EPM_EDIT_COMMAND
  166.                       put_in_buffer(cmd,arg(4)),
  167.                       arg(3))
  168.  
  169. defproc put_in_buffer(string)
  170. ;; if arg(2)='' then share=0; else share=arg(2); endif
  171.  
  172. compile if  EPM32
  173.       strbuffer = atol(dynalinkc(E_DLL,
  174.                             'mymalloc',
  175.                             atol(length(string)+1), 2))
  176.  
  177.       strbuffer  = ltoa(substr(strbuffer, 3, 2)\0\0, 10)
  178.  
  179.       r = 0
  180.  
  181. compile else
  182.    strbuffer = "??"                    -- Initialize string pointer.
  183.    r =  dynalink('DOSCALLS',           -- Dynamic link library name
  184.             '#34',                     -- DosAllocSeg
  185.             atoi(length(string)+1) ||  -- Number of bytes requested
  186.             selector(strbuffer)    ||  -- String selector
  187.             offset(strbuffer)      ||  -- String offset
  188.             atoi(arg(2)) )             -- Share information
  189.  
  190. compile endif
  191.  
  192.    if r then sayerror ERROR__MSG r ALLOC_HALTED__MSG; stop; endif
  193.    strbuffer = itoa(strbuffer,10)
  194.    poke strbuffer,0,string\0  -- Copy string to new allocated buf
  195.    return mpfrom2short(strbuffer,0)    -- Return a long pointer to buffer
  196.  
  197. defproc winmessagebox(caption, text)
  198.  
  199.   msgtype = 4096                                        -- must be system modal.
  200.   if arg(3) then
  201.      msgtype=arg(3) + 4096 * (1 - (arg(3)%4096 - 2 * (arg(3)%8192)))  -- ensure x'1000' on
  202.   endif
  203.   caption = caption\0
  204.   text    = text\0
  205. compile if EPM32
  206.   return dynalinkc( 'PMWIN',
  207.                    '#789',      -- WINMESSAGEBOX
  208.                    atol(1) ||   -- Parent
  209.                    atoi(1) ||   -- Owner
  210.                    offset(text)       ||
  211.                    selector(text)     ||   -- Text
  212.                    offset(caption)    ||
  213.                    selector(caption)  ||   -- Title
  214.                    atol(0)            ||   -- Window
  215.                    atol(msgtype) )         -- Style
  216. compile else
  217.   return dynalink( 'PMWIN',
  218.                    'WINMESSAGEBOX',
  219.                    atoi(0) || atoi(1) ||   -- Parent
  220.                    atoi(0) || atoi(1) ||   -- Owner
  221.                    selector(text)     ||   -- Text
  222.                    offset(text)       ||
  223.                    selector(caption)  ||   -- Title
  224.                    offset(caption)    ||
  225.                    atoi(0)            ||   -- Window
  226.                    atoi(msgtype) )         -- Style
  227. compile endif  -- EPM32
  228.  
  229. defproc mpfrom2short(mphigh, mplow)
  230.    return ltoa( atoi(mplow) || atoi(mphigh), 10 )
  231.  
  232. defc processendscroll
  233.  
  234.