home *** CD-ROM | disk | FTP | other *** search
/ The Developer Connection…ice Driver Kit for OS/2 3 / DEV3-D1.ISO / editors / epm / e_macros / stdctrl.e < prev    next >
Encoding:
Text File  |  1993-09-29  |  184.0 KB  |  4,313 lines

  1. compile if EVERSION < 5
  2.    *** Error:  This file supports EPM only, not earlier versions of E.
  3. compile endif
  4. include 'menuhelp.H'
  5.  
  6. /*
  7. ╔════════════════════════════════════════════════════════════════════════════╗
  8. ║ What's it called: stdctrl.e                                                ║
  9. ║                                                                            ║
  10. ║ What does it do : contains special PM procedures and commands that enable  ║
  11. ║                   the following from the EPM editor:                       ║
  12. ║                                                                            ║
  13. ║                   listbox support - enables the dynamic creation of PM     ║
  14. ║                                     list boxes.   A macro can pop up a     ║
  15. ║                                     list of items and have a the users     ║
  16. ║                                     selection returned to the macro.       ║
  17. ║                                                                            ║
  18. ║                   menu support    - enables the dynamic creation and       ║
  19. ║                                     maintenance of named menus.            ║
  20. ║                                     A macro can create several menus that  ║
  21. ║                                     when shown and selected can execute    ║
  22. ║                                     editor commands.                       ║
  23. ║                                                                            ║
  24. ║                   EPM - E.DLL communication :                              ║
  25. ║                                     gives a EPM macro the ability to       ║
  26. ║                                     converse with EPM.EXE controls.        ║
  27. ║                                     For Example, popping EPM's commandline ║
  28. ║                                     message dialog, etc.                   ║
  29. ║                                                                            ║
  30. ║ Who and When    : Gennaro (Jerry) Cuomo                          3 -88     ║
  31. ║                                                                            ║
  32. ╚════════════════════════════════════════════════════════════════════════════╝
  33. */
  34.  
  35. /*
  36. ┌────────────────────────────────────────────────────────────────────────────┐
  37. │ The following are constant values that are to be used as parameters to     │
  38. │ the getpminfo internal function or as control id's for control toggle.     │
  39. │                                                                            │
  40. │ HAB           0  PARENTFRAME     4  EDITORMSGAREA      8   EDITVIOPS    12 │
  41. │ OWNERCLIENT   1  EDITCLIENT      5  EDITORVSCROLL      9   EDITTITLEBAR 13 │
  42. │ OWNERFRAME    2  EDITFRAME       6  EDITORHSCROLL      10  EDITCURSOR   14 │
  43. │ PARENTCLIENT  3  EDITSTATUSAREA  7  EDITORINTERPRETER  11  PARTIALTEXT  15 │
  44. │ EDITEXSEARCH  16 EDITMENUHWND    17 HDC                18  HINI         19 │
  45. │ RINGICONS     20                    FILEICONS          22  EXTRAWNDPOS  23 │
  46. │ CursorBounce  24 CUA_marking     25 Arrows_Internal    26                  │
  47. └────────────────────────────────────────────────────────────────────────────┘
  48. */
  49.  
  50. define
  51. compile if EVERSION >= '5.20'  -- 5.20 adds a HINI to the *Profile calls.
  52.    HINI_PARM = 'app_hini,'
  53.    HINI_PARMU ='HINI_PROFILE,'
  54. compile else
  55.    HINI_PARM = ' '
  56.    HINI_PARMU = ' '
  57. compile endif
  58.  
  59.  
  60. /*
  61. ┌────────────────────────────────────────────────────────────────────────────┐
  62. │ List Box Functions:                                                        │
  63. │                                                                            │
  64. │      listbox()                                                             │
  65. │      listboxdemo()                                                         │
  66. └────────────────────────────────────────────────────────────────────────────┘
  67. */
  68.  
  69. /************************************************************************
  70. listbox()
  71.     param1 - Listbox title
  72.  
  73.     param2 - string of items, separated by a common separator.  The common
  74.              separator is the first character in the string.
  75.              example:     /cat/dog/fish/
  76.                           separator='/'        list=cat, dog, fish
  77.              example:     $cat/ground$fish/water$
  78.                           separator='$'        list=cat/ground, fish/water
  79.  
  80.              If this parameter starts with an x'00', then it will be assumed to
  81.              represent a buffer, in the format:
  82.                 x'00' || atoi(length(text)) || selector(text) || offset(text)
  83.  
  84.     param3 - (optional) button names.  A maximum of seven button names can be
  85.              specified to allow multiple buttons.
  86.  
  87.     param4 - (optional) row of text in which list box will go under.
  88.              If this parameter is not specified or if a parameter of zero (0)
  89.              is specified, the box will be placed under the cursor.
  90.     param5 - (optional) column of text in which list box will go under.
  91.              If this parameter is not specified or if a parameter of zero (0)
  92.              is specified, the box will be placed under the cursor.
  93.              (NOTE: If the row parameter is selected the column parameter
  94.               must be selected as well.)
  95.     param6 - (optional) height of the listbox in characters
  96.              (NOTE:Since the default PM font is proportional the character
  97.               height and width are approximate values.)
  98.     param7 - (optional) width of listbox in characters.
  99.     param8 - (optional) buffer string (see below)
  100.  
  101. The following procedure creates a PM list box dialog.  The listbox will
  102. wait for user input and return a value that corresponds to the users input.
  103. If the user presses Enter or double clicks on an entry, that entry will
  104. be returned as the result of the listbox function.  If Cancel is selected
  105. or Esc is pressed, the listbox function will return null.   The listbox
  106. is a modal listbox, therefore user input is required before any thing
  107. else can happen.
  108.  
  109. Jerry Cuomo   1-89
  110.  
  111. EPM 5.21 / 5.50 added some new features to the ETOOLKIT interface.  Parameter
  112. 8 is used to expose this to the caller of listbox().  If present, it is a string
  113. consisting of (5.51 & below):  item# || button# || help_ID || handle || prompt
  114. or, in 5.60 & above, of:  handle || item# || button# || help_ID || prompt
  115. where item# is the listbox entry to be initially selected, button# is the button
  116. that will be the default, help_ID is a help panel ID (all shorts), handle is the
  117. window handle of the OWNERCLIENT (needed to call help; ignored if help_ID is 0),
  118. and prompt is an ASCIIZ string to be displayed below the title bar.  If help_ID
  119. is non-zero, the rightmost button is assumed to be the help button.  The new
  120. parameters are passed to the toolkit in the return buffer, which is padded with
  121. nulls, so only the minimum needed string need be sent.  The old way only supported
  122. returning a string if button 1 was pressed; button 2 was assumed to be Cancel, and
  123. returned null; anything else returned the button number.  The new way returns one
  124. byte representing the button number (in hex) followed by the selected item.
  125. A button number of 0 means Esc was pressed or the dialog was closed.  If param8
  126. was passed, the listbox() routine returns this entire string; if not, it parses
  127. it and returns what the old callers expected.
  128.  
  129. Larry Margolis / John Ponzo 6/91
  130.  
  131. ****************************************************************************/
  132.  
  133. defproc listbox(title,listbuf)
  134.  
  135.    if leftstr(listbuf,1)=\0 then
  136. compile if EPM32
  137.       liststuff = substr(listbuf,2,8)
  138.       flags = substr(listbuf,10)
  139. compile else
  140.       liststuff = substr(listbuf,2,6)
  141.       flags = substr(listbuf,8)
  142. compile endif -- EPM32
  143.    else
  144.       listbuf=listbuf \0
  145. compile if EPM32
  146.       liststuff = atol(length(listbuf)-1)    ||   /* length of list                */
  147.                   address(listbuf)                /* list                          */
  148. compile else
  149.       liststuff = atoi(length(listbuf)-1)    ||   /* length of list                */
  150.                   address(listbuf)                /* list                          */
  151. compile endif -- EPM32
  152.       flags = ''
  153.    endif
  154.    title  = title \0
  155.  
  156.    if arg(3)<>'' then                      /* button names were specified    */
  157.       parse value arg(3) with delim 2 but1 (delim) but2 (delim) but3 (delim) but4 (delim) but5 (delim) but6 (delim) but7 (delim)
  158.       nb=0
  159.       if but1<>'' then but1=but1\0; nb=nb+1; else sayerror 'LISTBOX:' BUTTON_ERROR__MSG; return 0; endif
  160.       if but2<>'' then but2=but2\0; nb=nb+1; else but2=\0; endif
  161.       if but3<>'' then but3=but3\0; nb=nb+1; else but3=\0; endif
  162.       if but4<>'' then but4=but4\0; nb=nb+1; else but4=\0; endif
  163.       if but5<>'' then but5=but5\0; nb=nb+1; else but5=\0; endif
  164.       if but6<>'' then but6=but6\0; nb=nb+1; else but6=\0; endif
  165.       if but7<>'' then but7=but7\0; nb=nb+1; else but7=\0; endif
  166.    else
  167.       but1=ENTER__MSG\0; but2=CANCEL__MSG\0; but3=\0; but4=\0; but5=\0 ; but6=\0; but7=\0 -- default buttons
  168.       nb=2
  169.    endif
  170.  
  171.    if arg()>3 then                         /* were row and column specified  */
  172.       row = arg(4); col = arg(5)            /* row and col were passed        */
  173.       if not row then row=.cursory-1 endif  /* zero means current cursor pos  */
  174.       if not col then col=.cursorx endif
  175.    else
  176.       col=.cursorx; row=.cursory-1          /* default: current cursor pos    */
  177.    endif
  178.    if arg()>5 then                         /* were height and width specified*/
  179.       height = arg(6)                      /* height was passed   */
  180.    else
  181.       height = 0                           /* default: 0=use listbox default */
  182.    endif
  183.    if arg()>6 then                         /* were height and width specified*/
  184.       width = arg(7)                       /* width was passed   */
  185.    else
  186.       width = 0                            /* default: 0=use listbox default */
  187.    endif
  188.  
  189.    x = .fontwidth * col                    /* convert row and column into...*/
  190. compile if EVERSION < 5.50
  191.    y = .windowy+.fontheight*(screenheight()-row-1)  /* x,y coordinates in pels */
  192. compile else
  193.    y = .windowy+screenheight()-.fontheight*(row+1)-4  /* (Add a fudge factor temporarily */
  194. compile endif
  195.  
  196. compile if EVERSION >= 5.21
  197.    if arg()>7 then                         /* New way!                       */
  198.       selectbuf = leftstr(arg(8), 255, \0)
  199.    else
  200.       selectbuf = copies(\0,255)  -- Was 85     /* null terminate return buffer  */
  201.    endif
  202. compile else
  203.    selectbuf = leftstr(\0,85)        /* null terminate return buffer  */
  204. compile endif
  205.  
  206.    if flags='' then
  207.       flags=3   -- bit 0=position below pts, bit 1=map to desktop
  208.    endif
  209. compile if EPM32
  210.    call dynalink32( ERES_DLL,               /* list box control in EDLL dyna */
  211.                    'LISTBOX',                    /* function name                 */
  212.                     gethwndc(EPMINFO_EDITFRAME)||   /* edit frame handle             */
  213.                     atol(flags)                ||
  214.                     atol(x)                    ||   /* coordinates                   */
  215.                     atol(y)                    ||
  216.                     atol(height)               ||
  217.                     atol(width)                ||
  218.                     atol(nb)                   ||
  219. compile else
  220.    call dynalink(   ERES_DLL,                /* list box control in EDLL dyna */
  221.                    'LISTBOX',                    /* function name                 */
  222.                     gethwnd(EPMINFO_EDITFRAME) ||   /* edit frame handle             */
  223.                     atoi(flags)                ||
  224.                     atoi(x)                    ||   /* coordinates                   */
  225.                     atoi(y)                    ||
  226.                     atoi(height)               ||
  227.                     atoi(width)                ||
  228.                     atoi(nb)                   ||
  229. compile endif
  230.                     address(title)             ||   /* list box dialog title         */
  231.                     address(but1)              ||   /* text to appear in buttons     */
  232.                     address(but2)              ||   /*                               */
  233.                     address(but3)              ||   /*                               */
  234.                     address(but4)              ||   /*                               */
  235.                     address(but5)              ||   /*                               */
  236.                     address(but6)              ||   /*                               */
  237.                     address(but7)              ||   /*                               */
  238.                     liststuff                  ||
  239.                     address(selectbuf))             /* return string buffer          */
  240.  
  241. compile if EVERSION >= 5.21
  242.    button = asc(leftstr(selectbuf,1))
  243.    if arg(8) then return selectbuf; endif  -- New way
  244.    if button=0 | button=2 then return ''; endif  -- Old way...
  245.    if button<>1 then return button; endif
  246.    EOS = pos(\0,selectbuf,2)        -- CHR(0) signifies End Of String
  247.    if not EOS then return 'error'; endif
  248.    return substr(selectbuf,2,EOS-2)
  249. compile else
  250.    EOS = pos(\0,selectbuf)        -- CHR(0) signifies End Of String
  251.    if not EOS then return 'error'; endif
  252.    return leftstr(selectbuf,EOS-1)
  253. compile endif
  254.  
  255. /*********** Sample command that uses the old list box function *********
  256. defc listdemo
  257.    select = listbox('My List','/Bryan/Jason/Jerry Cuomo/Ralph/Larry/Richard/');
  258.    if select=='' then
  259.       sayerror 'Nothing Selected'
  260.    else
  261.       sayerror 'list box selection =<' select '>'
  262.    endif
  263. **/
  264. /*********** Sample command that uses the new list box function *********
  265. defc listdemo
  266.    sayerror 'Selected entry 3; default button 2; help panel 9300.'
  267.    selectbuf = listbox('My List','/One/Two/Three',
  268.       '/Go to/Delete/Cancel/Help',0,0,0,0,
  269.   compile if EVERSION >= 5.60
  270.       gethwnd(APP_HANDLE) || atoi(3) || atoi(2) || atoi(9300) ||
  271.   compile else
  272.       atoi(3) || atoi(2) || atoi(9300) || gethwnd(APP_HANDLE) ||
  273.   compile endif
  274.       'Prompt text'\0);
  275.    button = asc(leftstr(selectbuf,1))
  276.    if button=0 then
  277.       sayerror 'Nothing Selected'
  278.    else
  279.       EOS = pos(\0,selectbuf,2)        -- CHR(0) signifies End Of String
  280.       select= substr(selectbuf,2,EOS-2)
  281.       sayerror 'Button' button 'was pressed; string =' select
  282.    endif
  283. **/
  284.  
  285. /*
  286. ┌────────────────────────────────────────────────────────────────────────────┐
  287. │                                                                            │
  288. │ What's it called: EntryBox                                                 │
  289. │                                                                            │
  290. │ What does it do : Creates a System-Modal Dialog Box.  (A System-Modal box  │
  291. │                   must be processed before the function can continue.)     │
  292. │                   The dialog box contains a entry field and 2 push buttons.│
  293. │                   (Up to 4 as of EPM 5.21 / 5.50.  See below.)             │
  294. │                                                                            │
  295. │                   hwnd    -  handle of owner window                        │
  296. │                   title   -  question to appear on dialog title bar        │
  297. │                   x,y     -  coordinates of lower left of entry box        │
  298. │                              if (0,0) then centered to screen.             │
  299. │                   cols    -  approximate number of cols in entry field     │
  300. │                              in PM font characters                         │
  301. │                   max     -  maximum number of chars                       │
  302. │                   entry   -  entry field string returned                   │
  303. │                                                                            │
  304. │ Who and when    : Gennaro (Jerry) Cuomo            4-89                    │
  305. │                                                                            │
  306. └────────────────────────────────────────────────────────────────────────────┘
  307.  
  308. EPM 5.21 / 5.50 added some new features to the ETOOLKIT interface.  Parameter
  309. 6 is used to expose this to the caller of entrybox().  If present, it is a string
  310. consisting of:  button# || help_ID || handle || prompt
  311.  
  312. See the listbox() comments to see what these represent, and what is returned.
  313.  
  314. Larry Margolis / John Ponzo 6/91
  315. */
  316.  
  317. -- entrybox title [,buttons][,entrytext][,cols][,maxchars][,param6]
  318. defproc entrybox(title)
  319.    columns = arg(4)
  320. ;  if columns=0 then columns=length(title); endif  -- Now handled (better) internally
  321.  
  322.    title = title \0
  323.    nb = 2                                  -- default number of buttons
  324.    if arg(2)<>'' then                      /* button names were specified    */
  325.       parse value arg(2) with delim 2 but1 (delim) but2 (delim) but3 (delim) but4 (delim)
  326. ;;    sayerror 'but1=<'but1'> but2=<'but2'> but3=<'but3'> but4=<'but4'>'
  327.       if but1<>'' then but1=but1 \0;  else sayerror 'ENTRYBOX:' BUTTON_ERROR__MSG; return 0; endif
  328.       if but2<>'' then but2=but2 \0;  else but2=''\0; endif
  329.       if but3<>'' then but3=but3 \0;nb=3;  else but3=''\0; endif
  330.       if but4<>'' then but4=but4 \0;nb=4;  else but4=''\0; endif
  331.    else
  332.       but1=\0; but2=\0; but3=\0; but4=\0
  333.    endif
  334.  
  335.    if arg()>2 then entrytext=arg(3) \0;     else  entrytext = \0;  endif
  336. ;; if arg()>3 then columns  =max(arg(4),1); else  columns   = 30;  endif
  337.    if columns<0 then columns = 30; endif
  338.    if arg()>4 then maxchars =max(arg(5),1); else  maxchars  = 254; endif
  339.  
  340.    /* null terminate return buffer  */
  341.    if arg()>5 then
  342.       selectbuf = leftstr(arg(6), MAXCOL, \0)
  343.    else
  344.       selectbuf = copies(\0, MAXCOL)
  345.    endif
  346. compile if EPM32
  347.    call dynalink32( ERES_DLL,                /* list box control in EDLL dyna */
  348.              'ENTRYBOX',                   /* function name                 */
  349.               gethwndc(EPMINFO_EDITFRAME)||   /* edit frame handle             */
  350.               address(title)             ||   /*                               */
  351.               atol(0)                    ||   /* x coordinate                  */
  352.               atol(0)                    ||   /* y coordinate (0,0) = center   */
  353.               atol(columns)              ||
  354.               atol(maxchars)             ||
  355.               address(entrytext)         ||   /* (optional text in entry field)*/
  356.               atol(nb)                   ||   /* Number of buttons             */
  357.               address(but1)              ||   /* (optional button 1 text )     */
  358.               address(but2)              ||   /* (optional button 2 text )     */
  359.               address(but3)              ||   /* (optional button 3 text )     */
  360.               address(but4)              ||   /* (optional button 4 text )     */
  361.               address(selectbuf))             /* return string buffer          */
  362. compile else
  363.    call dynalink( ERES_DLL,                /* list box control in EDLL dyna */
  364.              'ENTRYBOX',                   /* function name                 */
  365.               gethwnd(EPMINFO_EDITFRAME) ||   /* edit frame handle             */
  366.               --atoi(0) || atoi(1)       ||
  367.               address(title)             ||   /*                               */
  368.               atoi(0)                    ||   /* x coordinate                  */
  369.               atoi(0)                    ||   /* y coordinate (0,0) = center   */
  370.               atoi(columns)              ||
  371.               atoi(maxchars)             ||
  372.               address(entrytext)         ||   /* (optional text in entry field)*/
  373.  compile if EVERSION >= 5.21
  374.               atoi(nb)                   ||   /* Number of buttons             */
  375.  compile endif
  376.               address(but1)              ||   /* (optional button 1 text )     */
  377.               address(but2)              ||   /* ( optional button 2 text )    */
  378.  compile if EVERSION >= 5.21
  379.               address(but3)              ||   /* (optional button 3 text )     */
  380.               address(but4)              ||   /* (optional button 4 text )     */
  381.  compile endif
  382.               address(selectbuf) )            /* return string buffer          */
  383. compile endif  -- EPM32
  384.  
  385. compile if EVERSION >= '5.21'
  386.    if arg(6) then return selectbuf; endif  -- New way
  387.    button = asc(leftstr(selectbuf,1))
  388.    if button=0 | button=2 then return ''; endif  -- Old way...
  389.    if button<>1 then return button; endif
  390.    EOS = pos(\0,selectbuf,2)        -- CHR(0) signifies End Of String
  391.    if not EOS then return 'error'; endif
  392.    return substr(selectbuf,2,EOS-2)
  393. compile else
  394.    EOS = pos(\0,selectbuf)        -- CHR(0) signifies End Of String
  395.    if not EOS then return 'error'; endif
  396.    return leftstr(selectbuf,EOS-1)
  397. compile endif
  398.  
  399. /*
  400. ╔════════════════════════════════════════════════════════════════════════════╗
  401. ║ EPM macro - EPM.EXE communication commands.                                ║
  402. ║                                                                            ║
  403. ║      togglefont      - toggle from large to small to large font            ║
  404. ║      commandline     - show commandline dialog [initialize with text]      ║
  405. ║      messagebox      - show message dialog box [optionally add to it]      ║
  406. ║      opendlg         - show open dialog box                                ║
  407. ║                                                                            ║
  408. ╚════════════════════════════════════════════════════════════════════════════╝
  409. */
  410.  
  411. /*
  412. ┌────────────────────────────────────────────────────────────────────────────┐
  413. │ what's it called: togglecontrol                                            │
  414. │                                                                            │
  415. │ what does it do : The command either toggles a EPM control window on or off│
  416. │                   or forces a EPM control window on or off.                │
  417. │                   arg1   = EPM control window handle ID.  Control window   │
  418. │                            ids given above.  The following windows handles │
  419. │                            are currently supported.                        │
  420. │                            EDITSTATUS, EDITVSCROLL, EDITHSCROLL, and       │
  421. │                            EDITMSGLINE.                                    │
  422. │                   arg2   [optional] = force option.                        │
  423. │                            a value of 0, forces control window off         │
  424. │                            a value of 1, forces control window on          │
  425. │                           IF this argument is not specified the window     │
  426. │                           in question is toggled.                          │
  427. │                                                                            │
  428. │                   This command is possible because of the EPM_EDIT_CONTROL │
  429. │                   EPM_EDIT_CONTROLSTATUS message.                          │
  430. │                   (All EPM_EDIT_xxx messages are defined in the ETOOLKT    │
  431. │                    PACKAGE available on PCTOOLS.)                          │
  432. │                                                                            │
  433. │ who and when    : Jerry C.   2/27/89                                       │
  434. └────────────────────────────────────────────────────────────────────────────┘
  435. */
  436. defc togglecontrol
  437. compile if WANT_DYNAMIC_PROMPTS
  438.    universal menu_prompt
  439. compile endif
  440.    forceon=0
  441.    parse arg controlid fon
  442.    if fon<>'' then
  443.       forceon=(fon+1)*65536
  444. compile if WANT_NODISMISS_MENUS | WANT_DYNAMIC_PROMPTS
  445.    else
  446.       fon = not querycontrol(controlid)  -- Query now, since toggling is asynch.
  447. compile endif  -- WANT_NODISMISS_MENUS
  448.    endif
  449.  
  450.    call windowmessage(0,  getpminfo(EPMINFO_EDITFRAME),
  451.                       5388,               -- EPM_EDIT_CONTROLTOGGLE
  452.                       controlid + forceon,
  453.                       0)
  454. compile if WANT_DYNAMIC_PROMPTS & EVERSION < 5.53 & not ALLOW_PROMPTING_AT_TOP
  455.    if controlid=23 then
  456.       if fon then  -- 1=top; 0=bottom.  If now top, turn off.
  457.          menu_prompt = 0
  458.  compile if WANT_NODISMISS_MENUS
  459.          SetMenuAttribute( 422, 8192, 1)
  460.  compile endif  -- WANT_NODISMISS_MENUS
  461.       endif
  462.    endif
  463. compile endif
  464. compile if WANT_NODISMISS_MENUS
  465.    p = wordpos(controlid, '  7   8  10 20  22  23')
  466.    if p then       -->     === === === === === ===
  467.       menuid =       word('413 414 415 417 416 421', p)
  468.       SetMenuAttribute( menuid, 8192, not fon)
  469.    endif
  470. compile endif  -- WANT_NODISMISS_MENUS
  471.  
  472. compile if EVERSION >= 5.53
  473. defc toggleframe
  474.  compile if WANT_DYNAMIC_PROMPTS
  475.    universal menu_prompt
  476.  compile endif
  477.    forceon=0
  478.    parse arg controlid fon
  479.    if fon<>'' then
  480.       forceon=(fon+1)*65536
  481. compile if WANT_NODISMISS_MENUS | WANT_DYNAMIC_PROMPTS
  482.    else
  483.       fon = not queryframecontrol(controlid)  -- Query now, since toggling is asynch.
  484. compile endif  -- WANT_NODISMISS_MENUS
  485.    endif
  486.  
  487.    call windowmessage(0,  getpminfo(EPMINFO_EDITFRAME),
  488.                       5907,               -- EFRAMEM_TOGGLECONTROL
  489.                       controlid + forceon,
  490.                       0)
  491.  compile if WANT_DYNAMIC_PROMPTS & not ALLOW_PROMPTING_AT_TOP
  492.    if controlid=32 then
  493.       if fon then  -- 1=top; 0=bottom.  If now top, turn off.
  494.          menu_prompt = 0
  495.   compile if WANT_NODISMISS_MENUS
  496.          SetMenuAttribute( 422, 8192, 1)
  497.   compile endif  -- WANT_NODISMISS_MENUS
  498.       endif
  499.    endif
  500.  compile endif
  501.  compile if WANT_NODISMISS_MENUS
  502.    p = wordpos(controlid, '  1   2   4  16 32')
  503.    if p then       -->     === === === === ===
  504.       menuid =       word('413 414 417 415 421', p)
  505.       SetMenuAttribute( menuid, 8192, not fon)
  506.    endif
  507.  compile endif  -- WANT_NODISMISS_MENUS
  508.  
  509. defproc queryframecontrol(controlid)
  510.    return windowmessage(1,  getpminfo(EPMINFO_EDITFRAME),   -- Send message to edit client
  511.                         5907,               -- EFRAMEM_TOGGLECONTROL
  512.                         controlid,
  513.                         1)
  514. compile endif -- EVERSION >= 5.53
  515.  
  516. compile if WANT_DYNAMIC_PROMPTS
  517. defc toggleprompt
  518.    universal menu_prompt
  519.    menu_prompt = not menu_prompt
  520.  compile if not ALLOW_PROMPTING_AT_TOP
  521.    if menu_prompt then
  522.  compile if EVERSION < 5.53
  523.       'togglecontrol 23 0'    -- Force Extra window to bottom.
  524.  compile else
  525.       'toggleframe 32 0'      -- Force Extra window to bottom.
  526.  compile endif
  527.    endif
  528.  compile endif  -- not ALLOW_PROMPTING_AT_TOP
  529.  compile if WANT_NODISMISS_MENUS
  530.    SetMenuAttribute( 422, 8192, not menu_prompt)
  531.  compile endif  -- WANT_NODISMISS_MENUS
  532. compile endif
  533.  
  534. defc setscrolls
  535. compile if EVERSION >= 5.53
  536.    'toggleframe 8'
  537.    'toggleframe 16'
  538. compile else
  539.    'togglecontrol 9'
  540.    'togglecontrol 10'
  541.  compile if EVERSION < '5.50'
  542.    if not querycontrol(10) & not querycontrol(23) then
  543.       'togglecontrol 23 1'    -- Force Extra window to top.
  544.       sayerror 'Can not have info at bottom w/o scroll bars in EPM' EVERSION
  545.    endif
  546.  
  547.  
  548. defc toggle_info
  549.    'togglecontrol 23'
  550.    if not querycontrol(10) & not querycontrol(23) then
  551.       'togglecontrol 9 1'
  552.       'togglecontrol 10 1'
  553.       sayerror 'Can not have info at bottom w/o scroll bars in EPM' EVERSION
  554.    endif
  555.  compile endif
  556. compile endif  -- EVERSION >= 5.53
  557.  
  558. compile if EVERSION >= 5.60
  559. defc toggle_bitmap
  560.    universal bitmap_present
  561.    bitmap_present = not bitmap_present
  562.    call windowmessage(0, getpminfo(EPMINFO_EDITCLIENT),
  563.                       5498 - (44*bitmap_present), 0, 0)
  564.  compile if WANT_NODISMISS_MENUS
  565.    SetMenuAttribute( 437, 8192, not bitmap_present)
  566.  compile endif  -- WANT_NODISMISS_MENUS
  567. compile endif  -- EVERSION >= 5.60
  568.  
  569. defproc querycontrol(controlid)
  570.    return windowmessage(1,  getpminfo(EPMINFO_EDITCLIENT),   -- Send message to edit client
  571.                         5388,               -- EPM_EDIT_CONTROLTOGGLE
  572.                         controlid,
  573.                         1)
  574.  
  575. defc cursoroff=call cursoroff()    -- Turn cursor off
  576. defproc cursoroff           -- Turn cursor off
  577.     'togglecontrol 14 0'
  578.  
  579. ; Trim window so it's an exact multiple of the font size.
  580. defc trim=call windowsize1(.windowheight,.windowwidth,0,0,1)
  581.  
  582. defc windowsize1
  583.    parse arg row col x y flag junk
  584.    if x='' | junk<>'' then
  585.       sayerror -263  -- Invalid argument
  586.    else
  587.       call windowsize1(row,col,x,y,flag)
  588.    endif
  589.  
  590. defproc windowsize1(row,col,x,y)
  591.  
  592.    if upcase(leftstr(row,1))='P' then  -- Already in pels
  593.       cy = substr(row,2)
  594.    else
  595.       cy = .fontheight *  row          -- convert row into y coordinate in pels
  596.    endif
  597.    if upcase(leftstr(col,1))='P' then  -- Already in pels
  598.       cx = substr(col,2)
  599.    else
  600.       cx = .fontwidth * col            -- convert col into x coordinate in pels
  601.    endif
  602.  
  603.    if arg(5)<>'' then opts=arg(5); else opts=3; endif  -- Default = SWP_SIZE (1) + SWP_MOVE (2)
  604.  
  605.    if opts // 2 then                        -- Don't bother calculating unless SWP_SIZE on
  606. compile if EPM32
  607.       swp1 = copies(\0, 36)
  608.       swp2 = swp1
  609.       call dynalink32('PMWIN',
  610.                       '#837',
  611.                       gethwndc(EPMINFO_EDITCLIENT)  ||
  612.                       address(swp1) )
  613.       call dynalink32('PMWIN',
  614.                       '#837',
  615.                       gethwndc(EPMINFO_EDITFRAME)   ||
  616.                       address(swp2) )
  617.       cx = cx + ltoa(substr(swp2,9,4),10) - ltoa(substr(swp1,9,4),10)
  618.       cy = cy + ltoa(substr(swp2,5,4),10) - ltoa(substr(swp1,5,4),10)
  619.    endif
  620.  
  621.    call dynalink32( 'PMWIN',
  622.                     '#875',
  623.                     gethwndc(EPMINFO_EDITFRAME) ||
  624.                     atol(3)                    ||      /* HWND_TOP   */
  625.                     atol(x)                    ||
  626.                     atol(y)                    ||
  627.                     atol(cx)                   ||
  628.                     atol(cy)                   ||
  629.                     atol(opts))                        /* SWP_MOVE | SWP_SIZE */
  630. compile else
  631.       swp1 = copies(\0,18)
  632.       swp2 = swp1
  633.       call dynalink('PMWIN',
  634.                     'WINQUERYWINDOWPOS',
  635.                      gethwnd(EPMINFO_EDITCLIENT)  ||
  636.                      address(swp1) )
  637.       call dynalink('PMWIN',
  638.                     'WINQUERYWINDOWPOS',
  639.                      gethwnd(EPMINFO_EDITFRAME)   ||
  640.                      address(swp2) )
  641.       cx = cx + itoa(substr(swp2,5,2),10) - itoa(substr(swp1,5,2),10)
  642.       cy = cy + itoa(substr(swp2,3,2),10) - itoa(substr(swp1,3,2),10)
  643.    endif
  644.  
  645.    call dynalink( 'PMWIN',
  646.              'WINSETWINDOWPOS',
  647.               gethwnd(EPMINFO_EDITFRAME) ||
  648.               atoi(0) || atoi(3)         ||      /* HWND_TOP   */
  649.               atoi(x)                    ||
  650.               atoi(y)                    ||
  651.               atoi(cx)                   ||
  652.               atoi(cy)                   ||
  653.               atoi(opts))                        /* SWP_MOVE | SWP_SIZE */
  654. compile endif  -- EPM32
  655.  
  656. compile if 0  -- Unused, so don't waste space.  LAM
  657. defc qcontrol
  658.    if querycontrol(arg(1))  then
  659.       sayerror 'control on'
  660.    else
  661.       sayerror 'control off'
  662.    endif
  663. compile endif
  664.  
  665. /*
  666. ┌────────────────────────────────────────────────────────────────────────────┐
  667. │ what's it called: fontlist                                                 │
  668. │                                                                            │
  669. │ what does it do : Display a listbox containing the possible font cell sizes│
  670. │                   for the particular display type being used.              │
  671. │                   The font dimensions are extracted from the fontlist str. │
  672. │                                                                            │
  673. │ who and when    : Jerry C.  11/04/89                                       │
  674. └────────────────────────────────────────────────────────────────────────────┘
  675. */
  676. compile if EVERSION < 5.50      -- AVIO version
  677.    defc fontlist
  678.  compile if EVERSION >= 5.20  -- 5.20 beta 5; added a change font dialog.
  679.       call windowmessage(0,  getpminfo(APP_HANDLE),
  680.                          5138,               -- EPM_POPAVIOFONTDIALOG
  681.                          0,
  682.                          .fontwidth*65536 + .fontheight )
  683.  compile else
  684.       fontlist= '/1. 8 x 14  (Large)  '||
  685.                 '/2. 8 x 8  (Small)  '
  686.       if dos_version()>=1020 then
  687.  compile if EVERSION < 5.20
  688.          fontlist= '/8. 12 x 30  (Large)'||
  689.                    '/7. 12 x 22'  ||
  690.                    '/6. 12 x 20'  ||
  691.                    '/5. 12 x 16'  ||
  692.                    '/4. 8 x 17  (Medium)  '||
  693.                    '/3. 8 x 8'    ||
  694.                    '/2. 7 x 25'   ||
  695.                    '/1. 7 x 15  (Small)'
  696.  compile else
  697.          outcount = atol(248)        -- Room for 31 pairs of longs
  698.          outdata = copies(' ',248)
  699.          r =  dynalink( 'PMGPI',     -- Returns 1 if OK; 0 if not implemented; -1 if error
  700.                         'DEVESCAPE',
  701.                         gethwnd(EPMINFO_HDC)  ||
  702.                         atol_swap(2)          ||  -- DEVESC_QUERYVIOCELLSIZES
  703.                         atol(0)               ||  -- incount
  704.                         atol(0)               ||  -- indata
  705.                         address(outcount)    ||
  706.                         address(outdata) )
  707.          if r=1 then
  708.             n = ltoa(substr(outdata,5,4),10)
  709.             fontlist = ''
  710.             do i = (n*8+1) to 9 by -8
  711.                fontlist = fontlist'/'n'.' ltoa(substr(outdata,i,4),10) 'x' ltoa(substr(outdata,i+4,4),10)
  712.                n=n-1
  713.             enddo
  714.          endif
  715.  compile endif
  716.       endif
  717.  
  718.       do forever
  719.         retvalue=listbox(FONTLIST_PROMPT__MSG .fontwidth 'x' .fontheight,fontlist,'/'SELECT__MSG'/'CANCEL__MSG'/'HELP__MSG,2,screenwidth()/2)
  720.         if retvalue<>3 then leave; endif
  721.         'helpmenu 6010'
  722.       enddo
  723.  
  724.       if retvalue then
  725.          parse value retvalue with . width . height .
  726.          -- sayerror 'height and width =('height','width')'
  727.          call setfont(width, height)
  728.       endif
  729.  compile endif
  730. compile else      -- GPI version
  731.  
  732.    defc fontlist
  733.        call windowmessage(0,  getpminfo(APP_HANDLE),
  734.                          5130,               -- EPM_POPFONTDLG
  735.                          put_in_buffer(queryfont(.font)'.'trunc(.textcolor//16)'.'.textcolor%16),
  736.                          0)
  737.    defc processfontrequest
  738.    universal default_font
  739.       parse value arg(1) with fontname '.' fontsize '.' fontsel '.' setfont '.' markedonly '.' fg '.' bg
  740.       -- sayerror 'Fontname=' fontname ' Fontsize=' fontsize 'Fontsel=' fontsel
  741.       fontid=registerfont(fontname, fontsize, fontsel)
  742.  
  743.       if setfont & not markedonly then
  744. compile if WANT_APPLICATION_INI_FILE
  745.          call setini( INI_FONT, fontname'.'fontsize'.'fontsel, 1)
  746. compile endif
  747.          default_font = fontid
  748.       endif
  749.  
  750.       if markedonly then
  751.         -- insert font attribute within marked area only!
  752.  
  753.          themarktype = marktype()
  754.          if not themarktype then             /* check if mark exists              */
  755.             sayerror NO_MARK__MSG
  756.             return                           /* if mark doesn't exist, return     */
  757.          endif
  758.          getmark fstline,                    /* returned:  first line of mark     */
  759.                  lstline,                    /* returned:  last  line of mark     */
  760.                  fstcol,                     /* returned:  first column of mark   */
  761.                  lstcol,                     /* returned:  last  column of mark   */
  762.                  mkfileid                    /* returned:  file id of marked file */
  763.          if fontid <> .font then
  764.             call attribute_on(4)  -- Mixed fonts flag
  765.             addfont = 1
  766.          else
  767.             addfont = .levelofattributesupport%4 - 2*(.levelofattributesupport%(8))
  768.          endif
  769.          if bg<>'' then
  770.             fg = bg*16+fg
  771.             call attribute_on(1)  -- Colors flag
  772.          endif
  773.          if themarktype='BLOCK' then
  774.             do i = fstline to lstline
  775.                if addfont then
  776.                   Insert_Attribute_Pair(16, fontid, i, i, fstcol, lstcol, mkfileid)
  777.                endif
  778.                if bg<>'' then
  779.                   Insert_Attribute_Pair(1, fg, i, i, fstcol, lstcol, mkfileid)
  780.                endif
  781.             enddo
  782.          else
  783.             if themarktype='LINE' then
  784.                getline line, lstline, mkfileid
  785.                lstcol=length(line)
  786.             endif
  787.             if addfont then
  788.                Insert_Attribute_Pair(16, fontid, fstline, lstline, fstcol, lstcol, mkfileid)
  789.             endif
  790.             if bg<>'' then
  791.                Insert_Attribute_Pair(1, fg, fstline, lstline, fstcol, lstcol, mkfileid)
  792.             endif
  793.          endif
  794.          call attribute_on(8)  -- "Save attributes" flag
  795.       else
  796.          .font = fontid
  797.       endif
  798.  
  799. defc Process_Style
  800. compile if WANT_APPLICATION_INI_FILE
  801.    universal app_hini
  802.    universal EPM_utility_array_ID
  803.    call checkmark()     -- verify there is a marked area,
  804.    parse arg stylename   -- can include spaces
  805.    stylestuff = queryprofile(app_hini, 'Style', stylename)
  806.    if stylestuff='' then return; endif  -- Shouldn't happen
  807.    parse value stylestuff with fontname '.' fontsize '.' fontsel '.' fg '.' bg
  808.    getmark fstline, lstline, fstcol, lstcol, mkfileid
  809.    if get_array_value(EPM_utility_array_ID, 'sn.'stylename, styleindex) then  -- See if we have an index
  810.       do_array 3, EPM_utility_array_ID, 'si.0', styleindex          -- Get the
  811.       styleindex = styleindex + 1                                 --   next index
  812.       do_array 2, EPM_utility_array_ID, 'si.0', styleindex          -- Save next index
  813.       do_array 2, EPM_utility_array_ID, 'si.'styleindex, stylename  -- Save index.name
  814.       do_array 2, EPM_utility_array_ID, 'sn.'stylename, styleindex  -- Save name.index
  815.    endif
  816.    oldmod = .modify
  817.    if bg<>'' then
  818. ;;    fg = 256 + bg*16 + fg
  819.       fg = bg*16 + fg
  820.       if marktype()='BLOCK' then
  821.          do i = fstline to lstline
  822.             Insert_Attribute_Pair(1, fg, i, i, fstcol, lstcol, mkfileid)
  823.          enddo
  824.       else
  825.          if marktype()='LINE' then
  826.             getline line, lstline, mkfileid
  827.             lstcol=length(line)
  828.          endif
  829.          Insert_Attribute_Pair(1, fg, fstline, lstline, fstcol, lstcol, mkfileid)
  830.       endif
  831.       call attribute_on(1)  -- Colors flag
  832.    endif
  833.    if fontsel<>'' then
  834.       call attribute_on(4)  -- Mixed fonts flag
  835.       fontid=registerfont(fontname, fontsize, fontsel)
  836.       if marktype()='BLOCK' then
  837.          do i = fstline to lstline
  838.             Insert_Attribute_Pair(16, fontid, i, i, fstcol, lstcol, mkfileid)
  839.          enddo
  840.       else
  841.          Insert_Attribute_Pair(16, fontid, fstline, lstline, fstcol, lstcol, mkfileid)
  842.       endif
  843.    endif
  844.    Insert_Attribute_Pair(14, styleindex, fstline, lstline, fstcol, lstcol, mkfileid)
  845.    call attribute_on(8)  -- "Save attributes" flag
  846.    .modify = oldmod + 1
  847. compile else
  848.    sayerror 'WANT_APPLICATION_INI_FILE = 0'
  849. compile endif -- WANT_APPLICATION_INI_FILE
  850.  
  851. defc ChangeStyle
  852. compile if WANT_APPLICATION_INI_FILE
  853.    universal app_hini
  854.    universal EPM_utility_array_ID
  855.    parse arg stylename  -- Can include spaces
  856.    if get_array_value(EPM_utility_array_ID, 'sn.'stylename, styleindex) then
  857.       return  -- If not known, then we're not using it, so nothing to do.
  858.    endif
  859.    stylestuff = queryprofile(app_hini, 'Style', stylename)
  860.    if stylestuff='' then return; endif  -- Shouldn't happen
  861.    parse value stylestuff with fontname '.' fontsize '.' fontsel '.' fg '.' bg
  862.    getfileid startid
  863.    fontid=registerfont(fontname, fontsize, fontsel)
  864.    fg = bg*16 + fg
  865.    do i=1 to filesinring(1)  -- Provide an upper limit; prevent looping forever
  866.       if not (.levelofattributesupport%8 - 2*(.levelofattributesupport%16)) then  -- Is attribute 8 off?
  867.          iterate   -- Not using styles in this file
  868.       endif  -- "Save attributes" flag
  869.       line=0; col=1; offst=0
  870.       do forever
  871.          class = 14  -- STYLE_CLASS
  872.          attribute_action 1, class, offst, col, line -- 1=FIND NEXT ATTR
  873.          if class=0 then leave; endif  -- not found
  874.          query_attribute class, val, IsPush, offst, col, line
  875.          if val=styleindex then  -- If it's this style, then...
  876.             offst = offst+1
  877.             query_attribute class, val, IsPush, offst, col, line
  878.             if class=16 & val<>fontid then  -- Replace the font ID (if changed)
  879.                insert_attribute class, fontid, IsPush, offst, col, line
  880.                attribute_action 16, class, offst, col, line -- 16=DELETE_ATTR_SUBOP
  881.             endif
  882.             offst = offst+1
  883.             query_attribute class, val, IsPush, offst, col, line
  884.             if class=1 & val<>fg then  -- Replace the color attribute (if changed)
  885.                insert_attribute class, fg, IsPush, offst, col, line
  886.                attribute_action 16, class, offst, col, line -- 16=DELETE_ATTR_SUBOP
  887.             endif
  888.          endif
  889.       enddo  -- Loop looking for STYLE_CLASS in current file
  890.       next_file
  891.       getfileid curfile
  892.       if curfile = startid then leave; endif
  893.    enddo  -- Loop through all files in ring
  894.    activatefile startid  -- Make sure we're back where we started (in case was .HIDDEN)
  895. compile else
  896.    sayerror 'WANT_APPLICATION_INI_FILE = 0'
  897. compile endif -- WANT_APPLICATION_INI_FILE
  898.  
  899. defc monofont
  900.    parse value queryfont(.font) with fontname '.' fontsize '.'
  901.    if fontname<>'Courier' & fontname<>'System Monospaced' then
  902.       if rightstr(fontsize,2)='BB' then  -- Bitmapped font
  903.          parse value fontsize with 'DD' decipoints 'WW' width 'HH' height 'BB'
  904.          if width & height then  -- It's fixed pitch
  905.             return
  906.          endif
  907.       endif
  908.       .font = registerfont('System Monospaced',0,0)
  909.    endif
  910. compile endif  -- GPI version
  911.  
  912. /*
  913. ┌────────────────────────────────────────────────────────────────────────────┐
  914. │ what's it called: Get_Array_Value(array_ID, array_index, value)            │
  915. │                                                                            │
  916. │ what does it do : Looks up the index in the array, and if found, puts the  │
  917. │                   value in VALUE.  The result returned for the function    │
  918. │                   is the return code from the array lookup - 0 if          │
  919. │                   successful.  If the index wasn't found, VALUE will       │
  920. │                   contain the null string.                                 │
  921. │                                                                            │
  922. │ who and when    : Larry M.   9/12/91                                       │
  923. └────────────────────────────────────────────────────────────────────────────┘
  924. */
  925. defproc get_array_value(array_ID, array_index, var array_value)
  926.    rc = 0
  927.    array_value = ''
  928.    display -2
  929.    do_array 3, array_ID, array_index, array_value
  930.    display 2
  931.    return rc
  932.  
  933. defproc Insert_Attribute_Pair(attribute, val, fstline, lstline, fstcol, lstcol, fileid)
  934. ;sayerror 'Insert_Attribute_Pair('attribute',' val',' fstline',' lstline',' fstcol',' lstcol',' fileid')'
  935.    class = attribute
  936.    offst1 = -255
  937.    col = fstcol
  938.    line = fstline
  939.    pairoffst = -255
  940.    attribute_action 1, class, offst1, col, line, fileid -- 1=FIND NEXT ATTR
  941. ;sayerror 'attribute_action FIND NEXT ATTR,' class',' offst1',' col',' line',' fileid -- 1=FIND NEXT ATTR
  942.    if class & col = fstcol & line = fstline  then  -- Found one!
  943.       offst2 = offst1
  944.       attribute_action 3, class, offst2, col, line, fileid -- 3=FIND MATCH ATTR
  945. ;sayerror 'attribute_action FIND MATCH ATTR,' class',' offst2',' col',' line',' fileid -- 1=FIND NEXT ATTR
  946.       if class then
  947.          lc1 = lstcol + 1
  948.          if line=lstline & col=lc1 then  -- beginning and end match, so replace the old attributes
  949.             attribute_action 16, class, offst1, fstcol, fstline, fileid -- 16=DELETE ATTR
  950. ;sayerror 'attribute_action DELETE ATTR,' class',' offst1',' fstcol',' fstline',' fileid -- 1=FIND NEXT ATTR
  951.             attribute_action 16, class, offst2, lc1, lstline, fileid -- 16=DELETE ATTR
  952. ;sayerror 'attribute_action DELETE ATTR,' class',' offst2',' lc1',' lstline',' fileid -- 1=FIND NEXT ATTR
  953.             pairoffst = offst1 + 1
  954.             if not pairoffst then
  955.                lstcol = lc1
  956.             endif
  957.          elseif line>lstline | (line=lstline & col>lstcol) then  -- old range larger then new
  958. ;sayerror 'pair offset set to 0'
  959.             pairoffst = 0  -- so add attributes on the inside.
  960.             lstcol = lc1
  961.          endif
  962.       endif
  963.    endif
  964.    insert_attribute attribute, val, 1, pairoffst, fstcol, fstline, fileid
  965.    insert_attribute attribute, val, 0, -pairoffst, lstcol, lstline, fileid
  966.  
  967. ; Turns on the specified bit (1, 2, 4, etc.) and returns 0 or 1 depending
  968. ; on whether it was originally off or on.
  969. defproc attribute_on(bit)
  970.    flag = .levelofattributesupport%bit - 2*(.levelofattributesupport%(bit*2))
  971.    if not flag then  -- Is that bit off?
  972.       .levelofattributesupport = .levelofattributesupport + bit  -- Turn it on!
  973.    endif
  974.    return flag
  975.  
  976. /*
  977. ┌────────────────────────────────────────────────────────────────────────────┐
  978. │ what's it called: setfont                                                  │
  979. │                                                                            │
  980. │ what does it do : Send change font message to editor.                      │
  981. │                   Arguments are the font cell width and the font cell      │
  982. │                   height.  example:  setfont(7, 15)                        │
  983. │                                                                            │
  984. │                                                                            │
  985. │ who and when    : Jerry C.  11/04/89                                       │
  986. └────────────────────────────────────────────────────────────────────────────┘
  987. */
  988. defproc setfont(width, height)
  989.    call windowmessage(0,  getpminfo(EPMINFO_EDITCLIENT),   -- Post message to edit client
  990.                       5381,               -- EPM_EDIT_CHANGEFONT
  991.                       height,
  992.                       width)
  993.  
  994. compile if EVERSION < 5.21
  995. /*
  996. ┌────────────────────────────────────────────────────────────────────────────┐
  997. │ what's it called: togglefont                                               │
  998. │                                                                            │
  999. │ what does it do : toggle from large to small font using by sending the     │
  1000. │                   current edit window a EPM_EDIT_CHANGEFONT message.       │
  1001. │                   (All EPM_EDIT_xxx messages are defined in the ETOOLKT    │
  1002. │                    PACKAGE available on PCTOOLS.)                          │
  1003. │                                                                            │
  1004. │ universals      : the universal variable 'font' is used to keep track of   │
  1005. │                   the current font state.                                  │
  1006. │                                                                            │
  1007. │ who and when    : Jerry C.   2/27/89                                       │
  1008. └────────────────────────────────────────────────────────────────────────────┘
  1009. */
  1010. defc togglefont
  1011.    universal font,defaultmenu
  1012.  compile if INCLUDE_MENU_SUPPORT
  1013.    if font then                                 /* large font is active    */
  1014.       font = FALSE                              /* about to change to small*/
  1015.       buildmenuitem  defaultmenu,               /* replace text in option..*/
  1016.                      4, 408,                    /* menu.                   */
  1017.                      LARGE_FONT_MENU__MSG,
  1018.                      'togglefont'LARGE_FONT_MENUP__MSG,0,mpfrom2short(HP_OPTIONS_FONT, 0)
  1019.    else                                         /* small font is active    */
  1020.       font = TRUE                               /* about to change to large*/
  1021.       buildmenuitem  defaultmenu,               /* replace text in option..*/
  1022.                      4, 408,                    /* menu.                   */
  1023.                      SMALL_FONT_MENU__MSG,
  1024.                      'togglefont'SMALL_FONT_MENUP__MSG,0,mpfrom2short(HP_OPTIONS_FONT, 0)
  1025.    endif
  1026.  
  1027.    showmenu defaultmenu                         /* activate above changes  */
  1028.                                                 /* in the menu             */
  1029.  compile endif
  1030.    call setfont(0, 0)                           /* change font             */
  1031. compile endif
  1032.  
  1033. compile if EVERSION > 5.19
  1034. ----------------------------------------------------------------------------
  1035. ----  UNDO   JAC 11/90
  1036. ----------------------------------------------------------------------------
  1037. defc processundo
  1038.    --undoaction 1, PresentState;
  1039.    --undoaction 2, OldestState;
  1040.    CurrentUndoState=arg(1)
  1041.    --
  1042.    --if CurrentUndoState<OldestState then
  1043.    --  return
  1044.    --endif
  1045.    --sayerror 'Undoing State ' CurrentUndoState ' old='OldestState ' new='PresentState
  1046.    undoaction 7, CurrentUndoState;
  1047.    --refresh;
  1048.  
  1049. defc restoreundo
  1050.    action=1
  1051.    undoaction 5, action;
  1052.  
  1053. defc renderundoinfo
  1054.     undoaction 1, PresentState        -- Do to fix range, not for value.
  1055. ;   undoaction 2, OldestState;
  1056. ;   statestr=PresentState OldestState \0
  1057.     undoaction 6, StateRange               -- query range
  1058.     parse value staterange with oldeststate neweststate
  1059.     statestr=newestState oldeststate\0
  1060.     action=1
  1061.     undoaction 4, action
  1062.     -- sayerror '<'statestr'>'
  1063.     call windowmessage(1,  arg(1),   -- send message back to dialog
  1064.                        32,               -- WM_COMMAND - 0x0020
  1065.                        9999,
  1066.                        ltoa(offset(statestr) || selector(statestr), 10) )
  1067.  
  1068. defc undodlg
  1069. ;   undoaction 1, PresentState        -- Do to fix range, not for value.
  1070. ;   undoaction 6, StateRange               -- query range
  1071. ;   parse value staterange with oldeststate neweststate
  1072. ;   if oldeststate=neweststate  then
  1073. ;      sayerror 'No other undo states recorded.'
  1074. ;   else
  1075.        call windowmessage(0,  getpminfo(APP_HANDLE),
  1076.                          5131,               -- EPM_POPFONTDLG
  1077.                          0,
  1078.                          0)
  1079. ;   endif
  1080. compile endif
  1081.  
  1082. /*
  1083. ┌────────────────────────────────────────────────────────────────────────────┐
  1084. │ what's it called: commandline     syntax:  commandline [optional text]     │
  1085. │                                                                            │
  1086. │ what does it do : ask EPM.EXE to pop up its internal commandline control.  │
  1087. │                   This is done by posting a EPM_POPCMDLINE message to the  │
  1088. │                   EPM Book window.                                         │
  1089. │                   An optional string of text can be specified.  If a string│
  1090. │                   is specified then it will be inserted on the command line│
  1091. │                                                                            │
  1092. │                   (All EPM_EDIT_xxx messages are defined in the ETOOLKT    │
  1093. │                    PACKAGE available on PCTOOLS.)                          │
  1094. │                                                                            │
  1095. │ who and when    : Jerry C.   2/27/89                                       │
  1096. └────────────────────────────────────────────────────────────────────────────┘
  1097. */
  1098. defc commandline  -- The application will free the buffer allocated by this macro !!!
  1099.    call windowmessage(0,  getpminfo(APP_HANDLE),
  1100.                       5124,               -- EPM_POPCMDLINE
  1101.                       0,
  1102.                       put_in_buffer(arg(1)) )
  1103.  
  1104.  
  1105. /*
  1106. ┌────────────────────────────────────────────────────────────────────────────┐
  1107. │ what's it called: PostCmdToEditWindow(cmd, winhandle [, mp2 [, buflg]] )   │
  1108. │                                                                            │
  1109. │ what does it do : ask EPM.EXE to post a command to an edit window.  MP2 is │
  1110. │                   optional MP2 for the WinPostMsg.  Default is 1 (EPM      │
  1111. │                   should free the command buffer).  4 means process        │
  1112. │                   synchronously (not safe), and 8 means that EPM should do │
  1113. │                   a DosGetBuf to get the buffer.  Optional 4th argument is │
  1114. │                   passed to put_in_buffer (flag for DosAllocSeg; see       │
  1115. │                   put_in_buffer routine for details).                      │
  1116. │                                                                            │
  1117. │ who and when    : Larry M.   7/23/90                                       │
  1118. └────────────────────────────────────────────────────────────────────────────┘
  1119. */
  1120. defproc PostCmdToEditWindow(cmd,winhndl)
  1121.    if arg(3)<>'' then mp2=arg(3); else mp2=1; endif
  1122.    call windowmessage(0,  winhndl,
  1123.                       5377,               -- EPM_EDIT_COMMAND
  1124.                       put_in_buffer(cmd,arg(4)),
  1125.                       mp2)
  1126.  
  1127. /*
  1128. ┌────────────────────────────────────────────────────────────────────────────┐
  1129. │ what's it called: PostMe          syntax:   PostMe command                 │
  1130. │                                                                            │
  1131. │ what does it do : Ask EPM.EXE to post a command to the current edit window.│
  1132. │                   Useful if you want to send a command on an OPEN but      │
  1133. │                   don't want to tie up the main queue while the command is │
  1134. │                   executing.  By posting the command back to the window,   │
  1135. │                   it will execute from the EI queue, and not keep everyone │
  1136. │                   else waiting.                                            │
  1137. │                                                                            │
  1138. │                   Example of usage:                                        │
  1139. │                      "open 'PostMe long_running_command'"                  │
  1140. │                                                                            │
  1141. │ who and when    : Larry M.   89/08/14                                      │
  1142. └────────────────────────────────────────────────────────────────────────────┘
  1143. */
  1144. defc PostMe
  1145.    call PostCmdToEditWindow(arg(1),getpminfo(EPMINFO_EDITCLIENT))
  1146.  
  1147. /*
  1148. ┌────────────────────────────────────────────────────────────────────────────┐
  1149. │ what's it called: buffer_command    syntax:   buffer_command buff_address  │
  1150. │                                                                            │
  1151. │ what does it do : Executes the command that's stored in the buffer, then   │
  1152. │                   frees the buffer.  Useful if you want to send a command  │
  1153. │                   to another window but don't want to worry about length   │
  1154. │                   or invalid characters.                                   │
  1155. │                                                                            │
  1156. │                   Example of usage:                                        │
  1157. │                      "open 'buffer_command" put_in_buffer(cmd_string)      │
  1158. │                                                                            │
  1159. │ who and when    : Larry M.   91/09/03                                      │
  1160. └────────────────────────────────────────────────────────────────────────────┘
  1161. */
  1162. defc buffer_command
  1163.    parse arg buff .
  1164.    if not buff then return; endif  -- Null pointer = no command
  1165.    buffer_long = atol(buff)
  1166.    peekz(buffer_long)              -- Get the command from the buffer, & execute it
  1167.    call dynalink('DOSCALLS',       -- dynamic link library name
  1168.             '#39',                 -- DosFreeSeg
  1169.             rightstr(buffer_long,2) )
  1170.  
  1171. /*
  1172. ┌────────────────────────────────────────────────────────────────────────────┐
  1173. │ what's it called: messagebox      syntax:   messagebox [optional string]   │
  1174. │                                                                            │
  1175. │ what does it do : ask EPM.EXE to pop up its internal message box control.  │
  1176. │                   This is done by posting a EPM_POPMSGBOX  message to the  │
  1177. │                   EPM Book window.                                         │
  1178. │                   An optional string of text can be specified.  If a string│
  1179. │                   is specified then it will be inserted into the message bx│
  1180. │                                                                            │
  1181. │                   (All EPM_EDIT_xxx messages are defined in the ETOOLKT    │
  1182. │                    PACKAGE available on PCTOOLS.)                          │
  1183. │                                                                            │
  1184. │ who and when    : Jerry C.   2/27/89                                       │
  1185. └────────────────────────────────────────────────────────────────────────────┘
  1186. */
  1187. defc messagebox  -- The application will free the buffer allocated by this macro !!!
  1188.    call windowmessage(0,  getpminfo(APP_HANDLE),
  1189.                       5125,               -- EPM_POPMSGBOX
  1190.                       0,
  1191.                       put_in_buffer(arg(1)) )
  1192.  
  1193. /*
  1194. ┌────────────────────────────────────────────────────────────────────────────┐
  1195. │ what's it called: opendlg         syntax:   opendlg [EDIT  |  GET]         │
  1196. │                                                                            │
  1197. │ what does it do : ask EPM.EXE to pop up its internal message box control.  │
  1198. │                   This is done by posting a EPM_POPOPENDLG message to the  │
  1199. │                   EPM Book window.                                         │
  1200. │                   If a file    is selected, by default, it will be present-│
  1201. │                   ed in a new window.  If the 'EDIT' option is specified   │
  1202. │                   the file specified will be opened in the active edit     │
  1203. │                   window.                                                  │
  1204. │                                                                            │
  1205. │                   (All EPM_EDIT_xxx messages are defined in the ETOOLKT    │
  1206. │                    PACKAGE available on PCTOOLS.)                          │
  1207. │                                                                            │
  1208. │ who and when    : Jerry C.   2/27/89                                       │
  1209. └────────────────────────────────────────────────────────────────────────────┘
  1210. */
  1211. defc opendlg
  1212. compile if RING_OPTIONAL
  1213.    universal ring_enabled
  1214. compile endif
  1215.    call windowmessage(0,  getpminfo(APP_HANDLE),
  1216.                       5126,               -- EPM_POPOPENDLG
  1217. compile if RING_OPTIONAL
  1218.                       ring_enabled,
  1219. compile else
  1220.                       1,
  1221. compile endif
  1222.                       pos(upcase(arg(1)),'   EDITGET')%4 * 65536)  -- OPEN=0; EDIT=1; GET=2
  1223.  
  1224. /*
  1225. ┌────────────────────────────────────────────────────────────────────────────┐
  1226. │ what's it called: searchdlg       syntax:   searchdlg [next]               │
  1227. │                                                                            │
  1228. │ what does it do : ask EPM.EXE to pop up its internal search & replace dlg. │
  1229. │                   This is done by posting a EPM_POPCHANGEDLG message to the│
  1230. │                   EPM Book window.                                         │
  1231. │                   if the [next] param = 'F'  a find next will take place   │
  1232. │                   if the [next] param = 'C'  a change next will take place │
  1233. │                                                                            │
  1234. │                   (All EPM_EDIT_xxx messages are defined in the ETOOLKT    │
  1235. │                    PACKAGE available on PCTOOLS.)                          │
  1236. │                                                                            │
  1237. │ who and when    : Jerry C.   2/27/89                                       │
  1238. └────────────────────────────────────────────────────────────────────────────┘
  1239. */
  1240. defc searchdlg
  1241.    universal default_search_options, search_len
  1242.  
  1243.    parse value upcase(arg(1)) with uparg .
  1244.  
  1245.    if uparg='C' then
  1246.       'c'                             /* repeat last change */
  1247.    elseif uparg='F' then
  1248.       repeat_find
  1249. compile if defined(HIGHLIGHT_COLOR)
  1250.       if not rc then
  1251.  compile if EVERSION < '5.50'
  1252.          refresh
  1253.          sayat '', .cursory, .cursorx, HIGHLIGHT_COLOR, min(search_len, .windowwidth - .cursorx + 1)
  1254.  compile elseif EVERSION >= '5.60'
  1255.          circleit LOCATE_CIRCLE_STYLE, .line, .col, .col+search_len-1, LOCATE_CIRCLE_COLOR1, LOCATE_CIRCLE_COLOR2
  1256.  compile else
  1257.          circleit LOCATE_CIRCLE_STYLE, .line, .col, .col+search_len-1, HIGHLIGHT_COLOR
  1258.  compile endif
  1259.       endif
  1260. compile endif
  1261.    else  -- The application will free the buffer allocated by this macro !!!
  1262.       call windowmessage(0,  getpminfo(APP_HANDLE),
  1263.                          5128,               -- EPM_POPCHANGEDLG
  1264.                          0,
  1265.                          put_in_buffer(default_search_options))
  1266.    endif
  1267.  
  1268. /*
  1269. ┌────────────────────────────────────────────────────────────────────────────┐
  1270. │ what's it called: configdlg       syntax:   configdlg                      │
  1271. │                                                                            │
  1272. │ what does it do : ask EPM.EXE to pop up its internal configuration dialog. │
  1273. │                   This is done by posting a EPM_POPCONFIGDLG message to the│
  1274. │                   EPM Book window.                                         │
  1275. │                                                                            │
  1276. │                   (All EPM_EDIT_xxx messages are defined in the ETOOLKT    │
  1277. │                    PACKAGE available on PCTOOLS.)                          │
  1278. │                                                                            │
  1279. │ who and when    : Jerry C.   7/20/89                                       │
  1280. └────────────────────────────────────────────────────────────────────────────┘
  1281. */
  1282. compile if WANT_APPLICATION_INI_FILE
  1283. defc configdlg
  1284.  compile if CHECK_FOR_LEXAM
  1285.    universal LEXAM_is_available
  1286.  compile endif
  1287.    call windowmessage(0,  getpminfo(APP_HANDLE),
  1288.  compile if EVERSION < 5.60
  1289.                       5129,               -- EPM_POPCONFIGDLG
  1290.  compile else
  1291.                       5129+(18*(arg(1)='SYS')),  -- EPM_POPCONFIGDLG / EPM_POPSYSCONFIGDLG
  1292.  compile endif
  1293.  compile if ENHANCED_ENTER_KEYS
  1294.                       0,           -- Omit no pages
  1295.  compile else
  1296.                     64,           -- Bit 7 on means omit page 7
  1297.  compile endif
  1298.  compile if SPELL_SUPPORT
  1299.   compile if CHECK_FOR_LEXAM
  1300.                       not LEXAM_is_available)
  1301.   compile else
  1302.                       0)
  1303.   compile endif
  1304.  compile else
  1305.                       1)           -- Bit 0 on means omit spell stuff from page 4
  1306.  compile endif  -- SPELL_SUPPORT
  1307.  
  1308.  
  1309. /*
  1310. ┌────────────────────────────────────────────────────────────────────────────┐
  1311. │ what's it called: renderconfig    syntax:   renderconfig reply_window_hwnd │
  1312. │                                                                            │
  1313. │ what does it do : Upon the request of a external window, sent configuration│
  1314. │                   information in the form of special WM_COMMAND messages   │
  1315. │                   to the window handle specified in parameter one.         │
  1316. │                                                                            │
  1317. │                   WM_COMMAND's first parameter is a ID number which informs│
  1318. │                   the recieving window what type of information is in      │
  1319. │                   the second window parameter.  SEND_DEFAULT is a flag:    │
  1320. │                      0 -> send value from .ini file                        │
  1321. │                      1 -> send default value (ignoring .ini)               │
  1322. │                      2 -> send current value (5.60 only)                   │
  1323. │                                                                            │
  1324. │                   The fuction is used by EPM to fill in the EPM CONFIG     │
  1325. │                   dialog box.                                              │
  1326. │                                                                            │
  1327. │ who and when    : Jerry C. & LAM  7/20/89                                  │
  1328. └────────────────────────────────────────────────────────────────────────────┘
  1329. */
  1330. defc renderconfig
  1331.    universal  ADDENDA_FILENAME
  1332.    universal  DICTIONARY_FILENAME
  1333.    universal  vAUTOSAVE_PATH, vTEMP_PATH
  1334.    universal vDEFAULT_TABS, vDEFAULT_MARGINS, vDEFAULT_AUTOSAVE
  1335.    universal appname, app_hini
  1336. compile if ENHANCED_ENTER_KEYS
  1337.    universal enterkey, a_enterkey, c_enterkey, s_enterkey
  1338.    universal padenterkey, a_padenterkey, c_padenterkey, s_padenterkey
  1339. compile endif
  1340. compile if CHECK_FOR_LEXAM
  1341.    universal LEXAM_is_available
  1342. compile endif
  1343. compile if EVERSION >= '5.50'
  1344.    universal default_font
  1345. compile endif
  1346. compile if EVERSION >= 5.60
  1347.    universal vMESSAGECOLOR, vSTATUSCOLOR
  1348. compile endif
  1349.  
  1350.    parse arg hndle page send_default .
  1351. compile if EVERSION >= 5.21
  1352.    help_panel = 5300 + page
  1353.    if page=1 then     b= 3; e= 3;    -- Page 1 is tabs
  1354.    elseif page=2 then b= 1; e= 1;    -- Page 2 is margins
  1355.    elseif page=3 then b= 4; e= 7;    -- Page 3 is colors
  1356.    elseif page=4 then b= 9; e=12;    -- Page 4 is paths
  1357. compile if SPELL_SUPPORT                -- Enable IUO fields (dictionary & addenda paths)
  1358.  compile if CHECK_FOR_LEXAM
  1359.    if LEXAM_is_available then
  1360.  compile endif
  1361.       help_panel = 5390                 -- Different help panel
  1362.  compile if CHECK_FOR_LEXAM
  1363.    endif
  1364.  compile endif
  1365. compile endif
  1366.    elseif page=5 then b= 2; e= 2;    -- Page 5 is autosave
  1367.    elseif page=6 then b=13; e=13;    -- Page 6 is fonts
  1368.  compile if ENHANCED_ENTER_KEYS
  1369.    elseif page=7 then b=14; e=14;    -- Page 7 is enter keys
  1370.  compile endif
  1371.    else               b= 1; e=12;    -- No notebook control; send all 12
  1372.       help_panel = 0  -- The old config dlg doesn't expect a help panel number
  1373.    endif
  1374. compile elseif EPATH='LAMPATH'  -- Includes Enter_keys panel as a separate dialog.
  1375.    if page=7 then     b=14; e=14;    -- Page 7 is enter keys
  1376.       help_panel = 5307
  1377.    else
  1378.                       b= 1; e=12;    -- No notebook control; send all 12
  1379.       help_panel = 0
  1380.    endif
  1381. compile else
  1382.                       b= 1; e=12;    -- No notebook control; send all 12
  1383.       help_panel = 0
  1384. compile endif
  1385.    if b<=4 & e>=4 then
  1386. compile if EVERSION >= 5.60
  1387.       if send_default = 2 then
  1388.          tempstr = .textcolor .markcolor vSTATUSCOLOR vMESSAGECOLOR
  1389.       else
  1390. compile endif
  1391.          tempstr= queryprofile( $HINI_PARM appname, INI_STUFF)
  1392.          if tempstr='' | tempstr=1 | send_default then
  1393.             tempstr=TEXTCOLOR MARKCOLOR STATUSCOLOR MESSAGECOLOR
  1394.          endif
  1395. compile if EVERSION >= 5.60
  1396.       endif
  1397. compile endif
  1398.       parse value tempstr with ttextcolor tmarkcolor tstatuscolor tmessagecolor .
  1399.    endif
  1400.    for i=b to e                -- Send config info
  1401.       if i=1        then tempstr= checkini(send_default, INI_MARGINS, DEFAULT_MARGINS)
  1402. compile if EVERSION >= 5.60
  1403.                          if send_default=2 then tempstr=.margins; endif
  1404. compile endif
  1405.         elseif i=2  then tempstr= checkini(send_default, INI_AUTOSAVE, DEFAULT_AUTOSAVE)
  1406. compile if EVERSION >= 5.60
  1407.                          if send_default=2 then tempstr=.autosave; endif
  1408. compile endif
  1409.         elseif i=3  then tempstr= checkini(send_default, INI_TABS, DEFAULT_TABS)
  1410. compile if EVERSION >= 5.60
  1411.                          if send_default=2 then tempstr=.tabs; endif
  1412. compile endif
  1413.         elseif i=4  then tempstr= ttextcolor
  1414.         elseif i=5  then tempstr= tmarkcolor
  1415.         elseif i=6  then tempstr= tstatuscolor
  1416.         elseif i=7  then tempstr= tmessagecolor
  1417. compile if SPELL_SUPPORT          -- Enable IUO fields (dictionary & addenda paths)
  1418.  compile if CHECK_FOR_LEXAM
  1419.         elseif i=8  then if not LEXAM_is_available then iterate; endif; tempstr= ''
  1420.  compile else
  1421.         elseif i=8  then tempstr= ''
  1422.  compile endif
  1423. compile else
  1424.         elseif i=8 | i=11 | i=12 then iterate
  1425. compile endif
  1426.         elseif i=9  then tempstr= checkini(send_default, INI_AUTOSPATH, vAUTOSAVE_PATH, AUTOSAVE_PATH)
  1427.         elseif i=10 then tempstr= checkini(send_default, INI_TEMPPATH, vTEMP_PATH, TEMP_PATH)
  1428. compile if SPELL_SUPPORT
  1429.         elseif i=11 then tempstr= checkini(send_default, INI_DICTIONARY, DICTIONARY_FILENAME)
  1430.         elseif i=12 then tempstr= checkini(send_default, INI_ADDENDA, ADDENDA_FILENAME)
  1431. compile endif
  1432. compile if EVERSION >= 5.50  -- GPI
  1433.         elseif i=13 then tempstr= queryfont(word(default_font 0 .font, send_default+1))'.'trunc(.textcolor//16)'.'.textcolor%16
  1434. compile endif
  1435. compile if ENHANCED_ENTER_KEYS
  1436.         elseif i=14 then
  1437.            if send_default=1 then
  1438.  compile if ENTER_ACTION='' | ENTER_ACTION='ADDLINE'  -- The default
  1439.               ek = \1
  1440.  compile elseif ENTER_ACTION='NEXTLINE'
  1441.               ek = \2
  1442.  compile elseif ENTER_ACTION='ADDATEND'
  1443.               ek = \3
  1444.  compile elseif ENTER_ACTION='DEPENDS'
  1445.               ek = \4
  1446.  compile elseif ENTER_ACTION='DEPENDS+'
  1447.               ek = \5
  1448.  compile elseif ENTER_ACTION='STREAM'
  1449.               ek = \6
  1450.  compile endif
  1451.  compile if C_ENTER_ACTION='ADDLINE'
  1452.               c_ek = \1
  1453.  compile elseif C_ENTER_ACTION='' | C_ENTER_ACTION='NEXTLINE'  -- The default
  1454.               c_ek = \2
  1455.  compile elseif C_ENTER_ACTION='ADDATEND'
  1456.               c_ek = \3
  1457.  compile elseif C_ENTER_ACTION='DEPENDS'
  1458.               c_ek = \4
  1459.  compile elseif C_ENTER_ACTION='DEPENDS+'
  1460.               c_ek = \5
  1461.  compile elseif C_ENTER_ACTION='STREAM'
  1462.               c_ek = \6
  1463.  compile endif
  1464.               tempstr = ek || ek || c_ek || ek || ek || ek || c_ek || ek
  1465.            else
  1466.               tempstr = chr(enterkey) || chr(a_enterkey) || chr(c_enterkey) || chr(s_enterkey) || chr(padenterkey) || chr(a_padenterkey) || chr(c_padenterkey) || chr(s_padenterkey)
  1467.            endif
  1468. compile endif
  1469.       endif
  1470.       tempstr = tempstr\0          -- null terminate (asciiz)
  1471.       call windowmessage(1,  hndle,
  1472.                          32,               -- WM_COMMAND - 0x0020
  1473.                          mpfrom2short(help_panel, i),
  1474.                          ltoa(offset(tempstr) || selector(tempstr), 10) )
  1475.    endfor
  1476. ;;sayerror 'page='page'; hndl='hndle'; help_panel='help_panel'; b='b';e='e'; ENHANCED_ENTER='ENHANCED_ENTER_KEYS
  1477.  
  1478. compile if ENHANCED_ENTER_KEYS
  1479. defc enterkeys =
  1480.    universal enterkey, a_enterkey, c_enterkey, s_enterkey
  1481.    universal padenterkey, a_padenterkey, c_padenterkey, s_padenterkey
  1482.    universal appname, app_hini
  1483.    parse arg perm enterkey a_enterkey c_enterkey s_enterkey padenterkey a_padenterkey c_padenterkey s_padenterkey
  1484.    if perm then
  1485.       call setprofile($HINI_PARM appname,INI_ENTERKEYS, enterkey a_enterkey c_enterkey s_enterkey padenterkey a_padenterkey c_padenterkey s_padenterkey)
  1486.    endif
  1487. compile endif
  1488.  
  1489. ; send_default is a flag that says we're reverting to the default product options.
  1490. ; defaultdata is the value to be used as the window default if INIKEY isn't found
  1491. ; in the EPM.INI; it will also be used as the product default if no fourth parameter
  1492. ; is given.
  1493. defproc checkini(send_default, inikey, defaultdata )
  1494.    universal appname, app_hini
  1495.    if send_default then
  1496.       if send_default=1 & arg()>3 then
  1497.          return arg(4)
  1498.       endif
  1499.       return defaultdata
  1500.    endif
  1501.    inidata=queryprofile($HINI_PARM appname,inikey)
  1502.    if inidata<>'' then
  1503.       return inidata
  1504.    endif
  1505.    return defaultdata
  1506.  
  1507. ; 5.21 lets you apply without saving, so we add an optional 3rd parameter.
  1508. ; If omitted, assume the old way - save.  If present, only save if 1.
  1509. defproc setini( inikey, inidata )
  1510.    universal appname, app_hini
  1511.    if arg()>=3 then
  1512.       perm=arg(3)
  1513.    else
  1514.       perm=1
  1515.    endif
  1516.    if perm then
  1517.       call setprofile($HINI_PARM appname, inikey, inidata)
  1518.    endif
  1519.    return inidata
  1520.  
  1521. /*
  1522. ┌────────────────────────────────────────────────────────────────────────────┐
  1523. │ what's it called: setconfig       syntax:   setconfig configid  newvalue   │
  1524. │                                                                            │
  1525. │ what does it do : The function is called by the EPM CONFIG dialog box to   │
  1526. │                   return values set by the user.                           │
  1527. │                                                                            │
  1528. │                                                                            │
  1529. │ who and when    : Jerry C. & LAM  7/20/89                                  │
  1530. └────────────────────────────────────────────────────────────────────────────┘
  1531. */
  1532. defc setconfig
  1533.    universal  ADDENDA_FILENAME
  1534.    universal  DICTIONARY_FILENAME
  1535.    universal  vTEMP_FILENAME, vTEMP_PATH
  1536.    universal  vAUTOSAVE_PATH
  1537.    universal vDEFAULT_TABS, vDEFAULT_MARGINS, vDEFAULT_AUTOSAVE
  1538.    universal  appname, app_hini
  1539. compile if EPATH = 'LAMPATH'
  1540.    universal mail_list_wid
  1541. compile endif
  1542. compile if EVERSION >= 5.21
  1543.    universal vMESSAGECOLOR, vSTATUSCOLOR
  1544. compile endif
  1545.  
  1546. compile if EVERSION >= 5.21
  1547.    parse value upcase(arg(1)) with configid perm newcmd
  1548. compile else
  1549.    parse value upcase(arg(1)) with configid newcmd; perm=1
  1550. compile endif
  1551.  
  1552.    if     configid= 1 then
  1553.       if .margins<>newcmd then 'postme maybe_reflow_all'; endif
  1554.       .margins=newcmd; vDEFAULT_MARGINS=setini(INI_MARGINS, .margins, perm);
  1555.    elseif configid= 2 then .autosave=setini(INI_AUTOSAVE,newcmd, perm); vDEFAULT_AUTOSAVE=newcmd
  1556.    elseif configid= 3 then rc=0; .tabs=newcmd; if not rc then vDEFAULT_TABS=setini(INI_TABS,newcmd, perm); endif
  1557.    elseif configid= 4 then .textcolor=newcmd
  1558.    elseif configid= 5 then .markcolor=newcmd
  1559. compile if EVERSION < 5.21
  1560.    elseif configid= 6 then .statuscolor=newcmd
  1561.    elseif configid= 7 then .messagecolor=newcmd
  1562.       call setprofile( $HINI_PARM appname, INI_STUFF, .textcolor .markcolor .statuscolor .messagecolor)
  1563. compile else
  1564.    elseif configid= 6 & newcmd<>vSTATUSCOLOR then
  1565.                            vSTATUSCOLOR=newcmd
  1566.                            'setstatusline'
  1567.    elseif configid= 7 & newcmd<>vMESSAGECOLOR then
  1568.                            vMESSAGECOLOR=newcmd
  1569.                            'setmessageline'
  1570. compile endif
  1571.    elseif configid= 9 then
  1572.       if newcmd<>'' & rightstr(newcmd,1)<>'\' then
  1573.          newcmd=newcmd'\'
  1574.       endif
  1575.       if rightstr(newcmd,2)='\\' then             -- Temp fix for dialog bug
  1576.          newcmd=leftstr(newcmd,length(newcmd)-1)
  1577.       endif
  1578.       vAUTOSAVE_PATH=setini(INI_AUTOSPATH,newcmd, perm)
  1579.    elseif configid=10 then
  1580.       if newcmd<>'' & rightstr(newcmd,1)<>'\' then
  1581.          newcmd=newcmd'\'
  1582.       endif
  1583.       if rightstr(newcmd,2)='\\' then             -- Temp fix for dialog bug
  1584.          newcmd=leftstr(newcmd,length(newcmd)-1)
  1585.       endif
  1586.       if upcase(leftstr(vTEMP_FILENAME,length(vTEMP_PATH))) = upcase(vTEMP_PATH) then
  1587.          vTEMP_FILENAME=newcmd||substr(vTEMP_FILENAME,length(vTEMP_PATH)+1)
  1588.       elseif not verify(vTEMP_FILENAME,':\','M') then   -- if not fully qualified
  1589.          vTEMP_FILENAME=newcmd||vTEMP_FILENAME
  1590.       endif
  1591.       vTEMP_PATH=setini(INI_TEMPPATH,newcmd, perm)
  1592.    elseif configid=11 then DICTIONARY_FILENAME = setini(INI_DICTIONARY,newcmd, perm)
  1593.    elseif configid=12 then ADDENDA_FILENAME    = setini(INI_ADDENDA,newcmd, perm)
  1594. compile if EVERSION >= 5.21  -- Now, only do this once
  1595.    elseif configid= 0 then call setprofile( $HINI_PARM appname, INI_STUFF, .textcolor .markcolor vstatuscolor vmessagecolor)
  1596. compile endif
  1597.    endif
  1598.  
  1599. compile if EPATH = 'LAMPATH'
  1600.  compile if IBM_IUO          -- last item = 12
  1601.    if mail_list_wid<>'' & configid=12 then
  1602.  compile else                -- last item = 10; no spell checking
  1603.    if mail_list_wid<>'' & configid=10 then
  1604.  compile endif
  1605.       cmd = 'initconfig'\0
  1606.       call windowmessage(1,  mail_list_wid,
  1607.                          5515,             -- x158B; LAM BROADCAST COM
  1608.                          ltoa(offset(cmd) || selector(cmd), 10),
  1609.                          65536)
  1610.    endif
  1611. compile endif
  1612.  
  1613. /*
  1614. ┌────────────────────────────────────────────────────────────────────────────┐
  1615. │ what's it called: initconfig                                               │
  1616. │                                                                            │
  1617. │ what does it do : Set universal variables according to the  values         │
  1618. │                   previously saved in the EPM.INI file.                    │
  1619. │                                                                            │
  1620. └────────────────────────────────────────────────────────────────────────────┘
  1621. */
  1622. defc initconfig
  1623.    universal  ADDENDA_FILENAME
  1624.    universal  DICTIONARY_FILENAME
  1625.    universal  vTEMP_FILENAME, vTEMP_PATH
  1626.    universal  vAUTOSAVE_PATH
  1627.    universal  appname, app_hini, font, bitmap_present, optflag_extrastuff
  1628.    universal vDEFAULT_TABS, vDEFAULT_MARGINS, vDEFAULT_AUTOSAVE
  1629. compile if EVERSION >= 5.60
  1630.    universal statfont, msgfont
  1631. compile endif
  1632. compile if EVERSION >= '5.50'
  1633.    universal default_font
  1634. compile endif
  1635. compile if WANT_CUA_MARKING = 'SWITCH'
  1636.    universal CUA_marking_switch
  1637. compile endif
  1638. compile if WANT_DYNAMIC_PROMPTS
  1639.    universal  menu_prompt
  1640. compile endif
  1641. compile if (HOST_SUPPORT='EMUL' | HOST_SUPPORT='E3EMUL') and not defined(my_SAVEPATH)
  1642.    universal savepath
  1643. compile endif
  1644. compile if EVERSION >= 5.21
  1645.    universal vMESSAGECOLOR, vSTATUSCOLOR
  1646.  compile if EVERSION >= 5.60
  1647.    universal vDESKTOPColor
  1648.  compile endif
  1649. compile endif
  1650. compile if ENHANCED_ENTER_KEYS
  1651.    universal enterkey, a_enterkey, c_enterkey, s_enterkey
  1652.    universal padenterkey, a_padenterkey, c_padenterkey, s_padenterkey
  1653. compile endif
  1654. compile if WANT_STREAM_MODE = 'SWITCH'
  1655.    universal stream_mode
  1656. compile endif
  1657. compile if RING_OPTIONAL
  1658.    universal ring_enabled
  1659. compile endif
  1660. compile if WANT_LONGNAMES='SWITCH'
  1661.    universal SHOW_LONGNAMES
  1662. compile endif
  1663. compile if WANT_PROFILE='SWITCH'
  1664.    universal REXX_PROFILE
  1665. compile endif
  1666. compile if TOGGLE_ESCAPE
  1667.    universal ESCAPE_KEY
  1668. compile endif
  1669. compile if TOGGLE_TAB
  1670.    universal TAB_KEY
  1671. compile endif
  1672.  
  1673.    newcmd= queryprofile( $HINI_PARM appname, INI_STUFF)
  1674.    if newcmd then
  1675. compile if EVERSION < 5.21
  1676.       parse value newcmd with ttextcolor tmarkcolor tstatuscolor tmessagecolor .
  1677.       .textcolor=ttextcolor; .markcolor=tmarkcolor; .statuscolor=tstatuscolor; .messagecolor=tmessagecolor
  1678. compile else
  1679.       parse value newcmd with ttextcolor tmarkcolor tstatuscolor tmessagecolor .
  1680.       .textcolor=ttextcolor; .markcolor=tmarkcolor
  1681.       if tstatuscolor<>'' & tstatuscolor<>vSTATUSCOLOR then vSTATUSCOLOR=tstatuscolor; 'setstatusline'; endif
  1682.       if tmessagecolor<>'' & tmessagecolor<>vMESSAGECOLOR then vMESSAGECOLOR=tmessagecolor; 'setmessageline'; endif
  1683. compile endif
  1684.       newcmd=queryprofile( $HINI_PARM appname, INI_MARGINS)
  1685.       if newcmd then
  1686. compile if EVERSION < 5.60
  1687.          if word(newcmd,2)>MAXMARGIN then  -- Avoid error messages if 5.51 sees 5.60's huge margins
  1688.             newcmd = word(newcmd,1) MAXMARGIN word(newcmd,3)
  1689.          endif
  1690. compile endif
  1691.          .margins=newcmd; vDEFAULT_MARGINS=newcmd; endif
  1692.       newcmd=queryprofile( $HINI_PARM appname, INI_AUTOSAVE)
  1693.       if newcmd<>'' then .autosave=newcmd; vDEFAULT_AUTOSAVE=newcmd; endif
  1694.       newcmd=queryprofile( $HINI_PARM appname, INI_TABS)
  1695.       if newcmd then .tabs=newcmd; vDEFAULT_TABS=newcmd; endif
  1696.       newcmd=queryprofile( $HINI_PARM appname, INI_TEMPPATH)
  1697.       if newcmd then vTEMP_PATH=newcmd
  1698.                      if rightstr(vTemp_Path,1)<>'\' then
  1699.                         vTemp_Path = vTemp_Path'\'          -- Must end with a backslash.
  1700.                      endif
  1701.                      if not verify(vTEMP_FILENAME,':\','M') then   -- if not fully qualified
  1702.                         vTEMP_FILENAME=vTEMP_PATH||vTEMP_FILENAME
  1703.                      endif
  1704.       endif
  1705.       newcmd=queryprofile( $HINI_PARM appname, INI_AUTOSPATH)
  1706.       if newcmd then vAUTOSAVE_PATH=newcmd
  1707.                      if rightstr(vAUTOSAVE_Path,1)<>'\' then
  1708.                         vAUTOSAVE_Path = vAUTOSAVE_Path'\'  -- Must end with a backslash.
  1709.                      endif
  1710. compile if (HOST_SUPPORT='EMUL' | HOST_SUPPORT='E3EMUL') and not defined(my_SAVEPATH)
  1711.                      savepath=vAUTOSAVE_PATH
  1712. compile endif
  1713.       endif
  1714.       newcmd=queryprofile( $HINI_PARM appname, INI_DICTIONARY)
  1715.       if newcmd then DICTIONARY_FILENAME=newcmd endif
  1716.       newcmd=queryprofile( $HINI_PARM appname, INI_ADDENDA)
  1717.       if newcmd then ADDENDA_FILENAME=newcmd endif
  1718.    endif
  1719.  
  1720.        -- Options from Option pulldown
  1721.    newcmd=queryprofile( $HINI_PARM appname, INI_OPTFLAGS)
  1722.    if newcmd='' then
  1723.       optflag_extrastuff = ''
  1724.    else
  1725.       parse value newcmd with statflg msgflg vscrollflg hscrollflg fileiconflg rotflg extraflg markflg menu_prompt streamflg longnames profile escapekey tabkey bitmap_present optflag_extrastuff
  1726. compile if EVERSION >= '5.53'
  1727.       'toggleframe 1' statflg
  1728.       'toggleframe 2' msgflg
  1729.       'toggleframe 8' vscrollflg
  1730.       'toggleframe 16' hscrollflg
  1731.  compile if RING_OPTIONAL
  1732.        if ring_enabled then 'toggleframe 4' rotflg; endif
  1733.  compile else
  1734.       'toggleframe 4' rotflg
  1735.  compile endif
  1736.       'toggleframe 32' extraflg
  1737.       if bitmap_present='' then
  1738.          bitmap_present = 1
  1739.       elseif not bitmap_present then
  1740.          call windowmessage(0, getpminfo(EPMINFO_EDITCLIENT), 5498, 0, 0)
  1741.       endif
  1742. compile else
  1743.       'togglecontrol 7' statflg
  1744.       'togglecontrol 8' msgflg
  1745.       'togglecontrol 9' vscrollflg
  1746.       'togglecontrol 10' hscrollflg
  1747.  compile if EVERSION < 5.50  -- File icon not optional in 5.50
  1748.       'togglecontrol 22' fileiconflg
  1749.  compile endif
  1750.  compile if RING_OPTIONAL
  1751.        if ring_enabled then 'togglecontrol 20' rotflg; endif
  1752.  compile else
  1753.       'togglecontrol 20' rotflg
  1754.  compile endif
  1755.       'togglecontrol 23' extraflg
  1756. compile endif
  1757. compile if WANT_CUA_MARKING = 'SWITCH'
  1758.        if markflg<>CUA_marking_switch then
  1759.           'CUA_mark_toggle'
  1760.        endif
  1761. compile endif
  1762. compile if WANT_STREAM_MODE = 'SWITCH'
  1763.       if streamflg<>stream_mode then 'stream_toggle'; endif
  1764. compile endif
  1765. compile if WANT_LONGNAMES='SWITCH'
  1766.       if longnames<>'' then
  1767.          SHOW_LONGNAMES = longnames
  1768.       endif
  1769. compile endif
  1770. compile if WANT_PROFILE='SWITCH'
  1771.       if PROFILE<>'' then
  1772.          REXX_PROFILE = PROFILE
  1773.       endif
  1774. compile endif
  1775. compile if TOGGLE_ESCAPE
  1776.       if ESCAPEKEY<>'' then
  1777.          ESCAPE_KEY = ESCAPEKEY
  1778.       endif
  1779. compile endif
  1780. compile if TOGGLE_TAB
  1781.       if TABKEY<>'' then
  1782.          TAB_KEY = TABKEY
  1783.       endif
  1784. compile endif
  1785. compile if EVERSION >= 5.50  -- 5.50 configures enter keys as part of
  1786. endif                        -- Settings dlg, not as part of Save Options
  1787. compile endif
  1788. compile if WANT_STREAM_MODE <> 1 and ENHANCED_ENTER_KEYS
  1789.       newcmd=queryprofile( $HINI_PARM appname, INI_ENTERKEYS)
  1790.       if newcmd<>'' then
  1791.          parse value newcmd with enterkey a_enterkey c_enterkey s_enterkey padenterkey a_padenterkey c_padenterkey s_padenterkey .
  1792.       endif
  1793. compile endif
  1794. compile if EVERSION >= 5.60
  1795.       newcmd=queryprofile( $HINI_PARM appname, INI_STATUSFONT)
  1796.       if newcmd<>'' then
  1797.          statfont = newcmd  -- Need to keep?
  1798.          parse value newcmd with psize"."facename"."attr
  1799.          "setstatface" getpminfo(EPMINFO_EDITSTATUSHWND) facename
  1800.          "setstatptsize" getpminfo(EPMINFO_EDITSTATUSHWND) psize
  1801.       endif
  1802.       newcmd=queryprofile( $HINI_PARM appname, INI_MESSAGEFONT)
  1803.       if newcmd<>'' then
  1804.          msgfont = newcmd   -- Need to keep?
  1805.          parse value newcmd with psize"."facename"."attr
  1806.          "setstatface" getpminfo(EPMINFO_EDITMSGHWND) facename
  1807.          "setstatptsize" getpminfo(EPMINFO_EDITMSGHWND) psize
  1808.       endif
  1809. compile endif
  1810. compile if EVERSION >= 5.21 & EVERSION < 5.50 -- 5.21 configures font on config panel,
  1811. endif                        -- not as part of Save Options
  1812. compile endif
  1813.  
  1814. compile if EVERSION < 5.50
  1815.       newcmd =queryprofile( $HINI_PARM appname, INI_FONTCY)
  1816.       if newcmd<>'' then
  1817.  compile if EVERSION < 5.20  -- Earlier EPM versions didn't do DEVESCAPE
  1818.          if screenxysize('X')>1000 and dos_version()>=1020 then  -- BGA and 1.2 or above
  1819.  compile else                -- We can assume 1.2 or above; 1.1 no longer supported
  1820.          if screenxysize('X')>1000 or dos_version()>=1030 then  -- BGA *or* 1.3 for many fonts
  1821.  compile endif
  1822.             call setfont(queryprofile($HINI_PARM appname, INI_FONTCX),newcmd) -- don't care what pulldown says
  1823.          elseif font = (newcmd=8) then  -- if font true and smallfont, or font false and largefont
  1824.             'togglefont'  -- this changes the font and updates the "change to xxx font" pulldown
  1825.          endif
  1826.       endif
  1827. compile else
  1828.       newcmd =queryprofile( $HINI_PARM appname, INI_FONT)
  1829.       parse value newcmd with fontname '.' fontsize '.' fontsel
  1830.       if newcmd<>'' then .font=registerfont(fontname, fontsize, fontsel); default_font = .font endif
  1831. compile endif
  1832.  
  1833. compile if EVERSION < 5.21   -- Before 5.21 saves font as part
  1834. endif                        -- of Save Options processing.
  1835. compile endif
  1836.  
  1837. compile if WANT_TOOLBAR
  1838.    newcmd= queryprofile(app_hini, INI_UCMENU_APP, 'Default')
  1839.    if newcmd<>'' then
  1840.       call windowmessage(0, getpminfo(EPMINFO_EDITFRAME), 5916, app_hini, put_in_buffer('Default'))
  1841.    else
  1842.       'loaddefaulttoolbar'
  1843.    endif
  1844. compile endif
  1845.  
  1846. compile if EVERSION >= 5.60
  1847.    newcmd = queryprofile($HINI_PARM appname, INI_DTCOLOR)
  1848.    if newcmd<>'' then
  1849.       vDESKTOPColor = newcmd
  1850.       call windowmessage( 0,  getpminfo(EPMINFO_EDITCLIENT),  -- post
  1851.                          5497,      -- EPM_EDIT_SETDTCOLOR
  1852.                          vDESKTOPColor,
  1853.                          0)
  1854.    endif
  1855. compile endif
  1856.  
  1857. /*
  1858. ┌────────────────────────────────────────────────────────────────────────────┐
  1859. │ what's it called: saveoptions                                              │
  1860. │                                                                            │
  1861. │ what does it do : save state of items on options pull down in os2ini       │
  1862. │                                                                            │
  1863. └────────────────────────────────────────────────────────────────────────────┘
  1864. */
  1865. defc saveoptions
  1866.    universal appname, app_hini, bitmap_present, optflag_extrastuff
  1867. compile if EVERSION >= 5.60
  1868.    universal statfont, msgfont
  1869. compile endif
  1870. compile if WANT_DYNAMIC_PROMPTS
  1871.    universal menu_prompt
  1872. compile endif
  1873. compile if EPATH = 'LAMPATH'
  1874.    universal mail_list_wid
  1875. compile endif
  1876. compile if ENHANCED_ENTER_KEYS & EVERSION < 5.21
  1877.    universal enterkey, a_enterkey, c_enterkey, s_enterkey
  1878.    universal padenterkey, a_padenterkey, c_padenterkey, s_padenterkey
  1879. compile endif
  1880. compile if RING_OPTIONAL
  1881.    universal ring_enabled
  1882. compile endif
  1883. compile if WANT_STACK_CMDS = 'SWITCH'
  1884.    universal stack_cmds
  1885. compile endif
  1886. compile if WANT_STREAM_MODE = 'SWITCH'
  1887.    universal stream_mode
  1888. compile endif
  1889. compile if WANT_LONGNAMES='SWITCH'
  1890.    universal SHOW_LONGNAMES
  1891. compile endif
  1892. compile if WANT_PROFILE='SWITCH'
  1893.    universal REXX_PROFILE
  1894. compile endif
  1895. compile if TOGGLE_ESCAPE
  1896.    universal ESCAPE_KEY
  1897. compile endif
  1898. compile if TOGGLE_TAB
  1899.    universal TAB_KEY
  1900. compile endif
  1901. compile if BLOCK_ACTIONBAR_ACCELERATORS = 'SWITCH'
  1902.    universal CUA_MENU_ACCEL
  1903. compile endif
  1904. compile if WANT_CUA_MARKING = 'SWITCH'
  1905.    universal CUA_marking_switch
  1906. compile else
  1907.    CUA_marking_switch = 0
  1908. compile endif
  1909.  
  1910. compile if not WANT_DYNAMIC_PROMPTS
  1911.    menu_prompt = 1
  1912. compile endif
  1913. compile if WANT_STREAM_MODE <> 'SWITCH'
  1914.    stream_mode = 0
  1915. compile endif
  1916. compile if WANT_LONGNAMES<>'SWITCH'
  1917.    show_longnames = 0
  1918. compile endif
  1919. compile if WANT_PROFILE<>'SWITCH'
  1920.    REXX_PROFILE = 0
  1921. compile endif
  1922. compile if not TOGGLE_ESCAPE
  1923.    ESCAPE_KEY = 1
  1924. compile endif
  1925. compile if not TOGGLE_TAB
  1926.    TAB_KEY = 0
  1927. compile endif
  1928.  
  1929.    call setprofile($HINI_PARM appname,INI_OPTFLAGS,
  1930. compile if EVERSION >= 5.53
  1931.       queryframecontrol(1) queryframecontrol(2) queryframecontrol(8) queryframecontrol(16) queryframecontrol(64) queryframecontrol(4) queryframecontrol(32) CUA_marking_switch menu_prompt stream_mode show_longnames rexx_profile escape_key tab_key ||
  1932.       ' 'bitmap_present optflag_extrastuff)
  1933. compile else
  1934.       querycontrol(7) querycontrol(8) querycontrol(9) querycontrol(10) querycontrol(22) querycontrol(20) querycontrol(23) CUA_marking_switch menu_prompt stream_mode show_longnames rexx_profile escape_key tab_key bitmap_present optflag_extrastuff)
  1935. compile endif
  1936. ;     messageline     statusline      vert. scroll    horiz. scroll    file icon        rotate buttons   info window pos.
  1937. compile if EVERSION < 5.50
  1938.    call setprofile($HINI_PARM appname,INI_FONTCX,  .fontwidth      ) -- font width
  1939.    call setprofile($HINI_PARM appname,INI_FONTCY,  .fontheight     ) -- font height
  1940. compile endif
  1941. compile if WANT_STREAM_MODE <> 1 & ENHANCED_ENTER_KEYS & EVERSION < 5.21
  1942.    call setprofile($HINI_PARM appname,INI_ENTERKEYS, enterkey a_enterkey c_enterkey s_enterkey padenterkey a_padenterkey c_padenterkey s_padenterkey)
  1943. compile endif
  1944. compile if RING_OPTIONAL
  1945.    call setprofile($HINI_PARM appname,INI_RINGENABLED,   ring_enabled)
  1946. compile endif
  1947. compile if WANT_STACK_CMDS = 'SWITCH'
  1948.    call setprofile($HINI_PARM appname,INI_STACKCMDS,     stack_cmds)
  1949. compile endif
  1950. compile if BLOCK_ACTIONBAR_ACCELERATORS = 'SWITCH'
  1951.    call setprofile($HINI_PARM appname,INI_CUAACCEL,      CUA_MENU_ACCEL)
  1952. compile endif
  1953. compile if EVERSION >= 5.60
  1954.    if statfont <> '' then
  1955.       call setprofile($HINI_PARM appname,INI_STATUSFONT, statfont)
  1956.    endif
  1957.    if msgfont <> '' then
  1958.       call setprofile($HINI_PARM appname,INI_MESSAGEFONT, msgfont)
  1959.    endif
  1960. compile endif
  1961.    call windowmessage(0,  getpminfo(APP_HANDLE),
  1962.                       62, 0, 0)               -- x'003E' = WM_SAVEAPPLICATION
  1963. compile if EPATH = 'LAMPATH'
  1964.    cmd = 'initconfig'\0
  1965.    if mail_list_wid<>'' then
  1966.       call windowmessage(1,  mail_list_wid,   -- This updates LaMail's hidden window
  1967.                          5515,                -- x158B; LAM BROADCAST COM
  1968.                          ltoa(offset(cmd) || selector(cmd), 10),
  1969.                          65536)
  1970.    endif
  1971. compile endif
  1972.  
  1973. compile if EVERSION >= 5.60
  1974. /*
  1975. ┌────────────────────────────────────────────────────────────────────────────┐
  1976. │ what's it called: savefont                                                 │
  1977. │                                                                            │
  1978. │ what does it do : save fonts in the ini file                               │
  1979. │ who&when : GLS  09/16/93                                                   │
  1980. └────────────────────────────────────────────────────────────────────────────┘
  1981. */
  1982. defc savefont
  1983.    universal appname, app_hini, bitmap_present, optflag_extrastuff
  1984.    universal statfont, msgfont
  1985.  compile if EPATH = 'LAMPATH'
  1986.    universal mail_list_wid
  1987.  compile endif
  1988.  
  1989.    parse value upcase(arg(1)) with prefix
  1990.    if prefix == 'EDIT' then
  1991.       call setini( INI_FONT, queryfont(.font), 1)
  1992.    elseif prefix == 'STAT' & statfont <> '' then
  1993.       call setprofile(app_hini, appname, INI_STATUSFONT, statfont)
  1994.    elseif prefix == 'MSG' & msgfont <> '' then
  1995.       call setprofile(app_hini, appname, INI_MESSAGEFONT, msgfont)
  1996.  compile if EPATH = 'LAMPATH'
  1997.    else
  1998.       return
  1999.  compile endif
  2000.    endif
  2001.  compile if EPATH = 'LAMPATH'
  2002.    cmd = 'initconfig'\0
  2003.    if mail_list_wid<>'' then
  2004.       call windowmessage(1,  mail_list_wid,   -- This updates LaMail's hidden window
  2005.                          5515,                -- x158B; LAM BROADCAST COM
  2006.                          ltoa(offset(cmd) || selector(cmd), 10),
  2007.                          65536)
  2008.    endif
  2009.  compile endif
  2010.  
  2011. /*
  2012. ┌────────────────────────────────────────────────────────────────────────────┐
  2013. │ what's it called: savecolor                                                │
  2014. │                                                                            │
  2015. │ what does it do : save color in the ini file                               │
  2016. │ who&when : GLS  09/16/93                                                   │
  2017. └────────────────────────────────────────────────────────────────────────────┘
  2018. */
  2019. defc savecolor
  2020.    universal appname, app_hini
  2021.    universal vstatuscolor, vmessagecolor, vDESKTOPCOLOR
  2022.  
  2023.  compile if EPATH = 'LAMPATH'
  2024.    universal mail_list_wid
  2025.  compile endif
  2026.  
  2027. -- for now we save the mark edit status and message color in one block
  2028. -- (INI_STUFF topic in the ini file)
  2029.  
  2030.    call setprofile( $HINI_PARM appname, INI_DTCOLOR, vDESKTOPColor)
  2031.    call setprofile( app_hini, appname, INI_STUFF, .textcolor .markcolor vstatuscolor vmessagecolor)
  2032.  
  2033.  compile if EPATH = 'LAMPATH'
  2034.    cmd = 'initconfig'\0
  2035.    if mail_list_wid<>'' then
  2036.       call windowmessage(1,  mail_list_wid,   -- This updates LaMail's hidden window
  2037.                          5515,                -- x158B; LAM BROADCAST COM
  2038.                          ltoa(offset(cmd) || selector(cmd), 10),
  2039.                          65536)
  2040.    endif
  2041.  compile endif
  2042.  
  2043.  
  2044. /*
  2045. ┌────────────────────────────────────────────────────────────────────────────┐
  2046. │ what's it called: savewindowsize                                           │
  2047. │                                                                            │
  2048. │ what does it do : save size of the edit window in the ini file             │
  2049. │ who did it&when : GLS 09/15/93                                             │
  2050. └────────────────────────────────────────────────────────────────────────────┘
  2051. */
  2052. defc savewindowsize
  2053.    call windowmessage(0,  getpminfo(APP_HANDLE),
  2054.                       62, 0, 0)               -- x'003E' = WM_SAVEAPPLICATION
  2055.  
  2056. compile endif -- EVERSION >= 5.60
  2057.  
  2058. compile endif  -- WANT_APPLICATION_INI_FILE
  2059.  
  2060.  
  2061. /*
  2062. ┌────────────────────────────────────────────────────────────────────────────┐
  2063. │ what's it called: processdragdrop                                          │
  2064. │                                                                            │
  2065. │ what does it do : this defc is automatically called by the                 │
  2066. │                   toolkit when a drag drop event is successfully made      │
  2067. │                                                                            │
  2068. │ what are the args:    cmdid =  1   - epm edit window                       │
  2069. │                                2   - File icon window (self)               │
  2070. │                                3   - epm book icon                         │
  2071. │                                4   - system editor                         │
  2072. │                                5   - File Manager folder                   │
  2073. │                                10  - Print manager                         │
  2074. │                                                                            │
  2075. │                       hwnd  =  handle of target window's frame             │
  2076. └────────────────────────────────────────────────────────────────────────────┘
  2077. */
  2078. defc PROCESSDRAGDROP
  2079.    parse arg cmdid hwnd
  2080. ;  hwnd=atol_swap(hwnd)
  2081.  
  2082.    if cmdid=10 then
  2083. compile if EVERSION >= '5.51'
  2084.     call windowmessage(0,
  2085.                        getpminfo(APP_HANDLE),
  2086.                        5144,               -- EPM_PRINTDLG
  2087.                        hwnd='M',
  2088.                        0)
  2089. compile elseif ENHANCED_PRINT_SUPPORT
  2090.       'printdlg'
  2091. compile else
  2092.       sayerror PRINTING__MSG .filename
  2093.  compile if EVERSION < '5.50'
  2094.       'xcom save' default_printer()
  2095.  compile else
  2096.       'xcom save /ne' default_printer()
  2097.  compile endif
  2098.       sayerror 0
  2099. compile endif
  2100.    elseif cmdid=1 and hwnd<>getpminfo(EPMINFO_EDITFRAME) and leftstr(.filename,1)<>'.' then
  2101.       call PostCmdToEditWindow('e '.filename,hwnd,9,2)  -- Get-able
  2102.    elseif cmdid=3 then
  2103.       if .filename=UNNAMED_FILE_NAME then name=''; else name=.filename; endif
  2104.       call windowmessage(0,  getpminfo(APP_HANDLE),
  2105.                          5386,                   -- EPM_EDIT_NEWFILE
  2106.                          put_in_buffer(name,2),  -- share = GETable
  2107.                          9)                      -- EPM does a GET first & a FREE after.
  2108. compile if IBM_IUO
  2109.    elseif cmdid=4 then
  2110.       call winmessagebox(SYS_ED__MSG,SYS_ED1__MSG\10'   :-)', 16406) -- CANCEL + ICONQUESTION + MB_MOVEABLE
  2111. compile endif
  2112.    elseif cmdid=5 then
  2113.       str=leftstr('',MAXCOL)
  2114. compile if EPM32
  2115.       len= dynalink32( 'PMWIN',
  2116.                 '#841',             --   'WINQUERYWINDOWTEXT',
  2117.                  atol(hwnd)         ||
  2118.                  atol(MAXCOL)       ||
  2119.                  address(str), 2)
  2120. compile else
  2121.       len= dynalink( 'PMWIN',
  2122.                 'WINQUERYWINDOWTEXT',
  2123.                  atol_swap(hwnd)         ||
  2124.                  atoi(MAXCOL)            ||
  2125.                  address(str) )
  2126. compile endif  -- EPM32
  2127.       p = lastpos('\',leftstr(str,len))
  2128.       if p then
  2129.          str = leftstr(str,p)'='
  2130.          call parse_filename(str, .filename)
  2131.          if exist(str) then
  2132.             if 1<>winmessagebox(str, EXISTS_OVERLAY__MSG, 16417) then -- OKCANCEL + CUANWARNING + MOVEABLE
  2133.                return  -- 1 = MB OK
  2134.             endif
  2135.          endif
  2136.          'save' str
  2137.          if not rc then sayerror SAVED_TO__MSG str; endif
  2138.       else
  2139.          call winmessagebox('"'leftstr(str,len)'"',NO_SLASH__MSG, 16406) -- CANCEL + ICONQUESTION + MB_MOVEABLE
  2140.       endif
  2141.    endif
  2142.  
  2143.  
  2144. /*
  2145. ┌────────────────────────────────────────────────────────────────────────────┐
  2146. │ what's it called: repaint_window                                           │
  2147. │                                                                            │
  2148. │ what does it do : send a paint message to the editor.                      │
  2149. │                                                                            │
  2150. └────────────────────────────────────────────────────────────────────────────┘
  2151. */
  2152. defproc repaint_window()
  2153.    call windowmessage(0, getpminfo(EPMINFO_EDITCLIENT), 35, 0, 0)   -- WM_PAINT
  2154.  
  2155. compile if EVERSION >= 5.21
  2156. /*
  2157. ┌────────────────────────────────────────────────────────────────────────────┐
  2158. │ what's it called: saveas_dlg      syntax:   saveas_dlg                     │
  2159. │                                                                            │
  2160. │ what does it do : ask EPM.EXE to pop up its "Save as" dialog box control.  │
  2161. │                   This is done by posting a EPM_POPOPENDLG message to the  │
  2162. │                   EPM Book window.                                         │
  2163. │                                                                            │
  2164. │                   (All EPM_EDIT_xxx messages are defined in the ETOOLKT    │
  2165. │                    PACKAGE available on PCTOOLS.)                          │
  2166. │                                                                            │
  2167. │ who and when    : Larry M.   6/12/91                                       │
  2168. └────────────────────────────────────────────────────────────────────────────┘
  2169. */
  2170. defc saveas_dlg
  2171.  compile if WANT_LONGNAMES='SWITCH'
  2172.    universal SHOW_LONGNAMES
  2173.  compile endif
  2174.  compile if WANT_LAN_SUPPORT | EVERSION >= '5.51'
  2175.    if .lockhandle then
  2176.       sayerror LOCKED__MSG
  2177.       return
  2178.    endif
  2179.  compile endif
  2180.    if not saveas_dlg(name, type) then
  2181.  compile if EVERSION >= '5.50'
  2182.       if leftstr(name,1)='"' & rightstr(name,1)='"' then
  2183.          name=substr(name,2,length(name)-2)
  2184.       endif
  2185.  compile endif
  2186.       autosave_name = MakeTempName()
  2187.       oldname = .filename
  2188.       .filename = name
  2189.  compile if WANT_LONGNAMES
  2190.   compile if WANT_LONGNAMES='SWITCH'
  2191.       if SHOW_LONGNAMES then
  2192.   compile endif
  2193.          if get_EAT_ASCII_value('.LONGNAME')<>'' then
  2194.             call delete_ea('.LONGNAME')
  2195.             .titletext = ''
  2196.          endif
  2197.   compile if WANT_LONGNAMES='SWITCH'
  2198.       endif
  2199.   compile endif
  2200.  compile endif  -- WANT_LONGNAMES
  2201.  compile if SUPPORT_USER_EXITS
  2202.       if isadefproc('rename_exit') then
  2203.          call rename_exit(oldname, .filename, 1)
  2204.       endif
  2205.  compile endif
  2206.  compile if INCLUDE_BMS_SUPPORT
  2207.       if isadefproc('BMS_rename_exit') then
  2208.          call BMS_rename_exit(oldname, .filename, 1)
  2209.       endif
  2210.  compile endif
  2211.       'save'
  2212.       if rc then  -- Problem saving?
  2213.          call dosmove(autosave_name, MakeTempName())  -- Rename the autosave file
  2214.       else
  2215.          call erasetemp(autosave_name)
  2216.       endif
  2217.    endif
  2218.  
  2219. defproc saveas_dlg(var name, var type)
  2220.    type = copies(\0,255)
  2221.    if .filename=UNNAMED_FILE_NAME then
  2222.       name = type
  2223.    else
  2224.       name = leftstr(.filename,255,\0)
  2225.    endif
  2226.  compile if EPM32
  2227.    res= dynalink32( ERES_DLL,                  -- library name
  2228.                    'ERESSaveas',              -- function name
  2229.                    gethwndc(EPMINFO_EDITCLIENT)  ||
  2230.                    gethwndc(APP_HANDLE)          ||
  2231.                    address(name)                 ||
  2232.                    address(type) )
  2233.  compile else
  2234.    res= dynalink( ERES_DLL,                  -- library name
  2235.                   'ERESSAVEAS',              -- function name
  2236.                   gethwnd(EPMINFO_EDITCLIENT)  ||
  2237.                   gethwnd(APP_HANDLE)          ||
  2238.                   address(name)                ||
  2239.                   address(type) )
  2240.  compile endif  -- EPM32
  2241. ; Return codes:  0=OK; 1=memory problem; 2=bad string; 3=couldn't load control from DLL
  2242.    if res=2 then      -- File dialog didn't like the .filename;
  2243.       name = copies(\0,255)  -- try again with no file name
  2244.  compile if EPM32
  2245.       call dynalink32( ERES_DLL,                  -- library name
  2246.                       'ERESSaveas',              -- function name
  2247.                       gethwndc(EPMINFO_EDITCLIENT)  ||
  2248.                       gethwndc(APP_HANDLE)          ||
  2249.                       address(name)                 ||
  2250.                       address(type) )
  2251.  compile else
  2252.       call dynalink( ERES_DLL,                  -- library name
  2253.                      'ERESSAVEAS',              -- function name
  2254.                      gethwnd(EPMINFO_EDITCLIENT)  ||
  2255.                      gethwnd(APP_HANDLE)          ||
  2256.                      address(name)                ||
  2257.                      address(type) )
  2258.  compile endif  -- EPM32
  2259.    endif
  2260.    parse value name with name \0
  2261.    parse value type with type \0
  2262.    if name='' then return -275; endif  -- sayerror('Missing filename')
  2263.    if exist(name) then
  2264.       if 1<>winmessagebox(SAVE_AS__MSG, name\10\10||EXISTS_OVERLAY__MSG, 16417) then -- OKCANCEL + CUANWARNING + MOVEABLE
  2265.          return -5  -- sayerror('Access denied')
  2266.       endif
  2267.    endif
  2268.    if type then
  2269.       call delete_ea('.TYPE')
  2270.       'add_ea .TYPE' type
  2271.    endif
  2272. compile endif  -- EVERSION >= 5.21
  2273.  
  2274. /*
  2275. ┌────────────────────────────────────────────────────────────────────────────┐
  2276. │ what's it called: showwindow                                               │
  2277. │                                                                            │
  2278. │ what does it do : allows the edit window to become invisible or visible    │
  2279. │                                                                            │
  2280. └────────────────────────────────────────────────────────────────────────────┘
  2281. */
  2282. defproc showwindow
  2283.    -- post the EPM_EDIT_SHOW message
  2284.    call windowmessage(0, getpminfo(EPMINFO_EDITCLIENT),
  2285.                       5385,
  2286.                       upcase(arg(1))<>'OFF', -- 0 if OFF, else 1
  2287.                       0)
  2288.  
  2289. /*
  2290. ┌────────────────────────────────────────────────────────────────────────────┐
  2291. │ what's it called: settitletext                                             │
  2292. │                                                                            │
  2293. │ what does it do : set the text in the editors active title bar.            │
  2294. │                                                                            │
  2295. └────────────────────────────────────────────────────────────────────────────┘
  2296. */
  2297. defproc settitletext()
  2298.    text = arg(1)
  2299.  
  2300. compile if SHOW_MODIFY_METHOD = 'TITLE'
  2301.    if .modify then
  2302.       text = text || SHOW_MODIFY_TEXT
  2303.    endif
  2304. compile endif
  2305.    .titletext = text
  2306.  
  2307. /*
  2308. ┌────────────────────────────────────────────────────────────────────────────┐
  2309. │ what's it called: updateringmenu                                           │
  2310. │                                                                            │
  2311. │ what does it do : update ring menu                                         │
  2312. │                                                                            │
  2313. └────────────────────────────────────────────────────────────────────────────┘
  2314. */
  2315. compile if MENU_LIMIT
  2316. defproc updateringmenu()
  2317.    universal activemenu,defaultmenu
  2318.    universal EPM_utility_array_ID
  2319.  
  2320.  compile if 0  -- LAM: Delete this feature; nobody used it, and it slowed things down.
  2321.    do_array 3, EPM_utility_array_ID, 'menu.0', menucount     -- Item 0 is count of menus.
  2322.    if menucount=0 then return; endif
  2323.  compile endif
  2324.    getfileid fid
  2325.    if fid<>'' then
  2326.  compile if 0  -- LAM: Delete this feature; nobody used it, and it slowed things down.
  2327.       showmenu_flag = 0
  2328.       do i=1 to menucount
  2329.          do_array 3, EPM_utility_array_ID, 'menu.'i, menuname   -- Get menuname[i]
  2330.          deletemenu menuname, 5, 0, 1                  -- Delete its ring menu
  2331.          if activemenu=menuname then showmenu_flag = 1; endif
  2332.       end
  2333.  compile else
  2334.       deletemenu defaultmenu, 5, 0, 1                  -- Delete its ring menu
  2335.  compile endif
  2336.  
  2337.       startid = fid
  2338. ;;    len = 1  -- Will be length of buffer required.  Init to 1 for null terminator.
  2339.       do menuid = 500 to 500+MENU_LIMIT     -- Prevent looping forever.
  2340. ;;       len = len + length(.filename) + 7  -- 7 = 1 sep '/' + max 4 for index + 2 blanks
  2341.  compile if 0  -- LAM: Delete this feature; nobody used it, and it slowed things down.
  2342.          do i=1 to menucount
  2343.             do_array 3, EPM_utility_array_ID, 'menu.'i, menuname   -- Get menuname[i]
  2344.             if menuid < 500 + MENU_LIMIT then
  2345.                buildmenuitem menuname, 5, menuid, .filename, 'activatefileid 'fid, 0, 0
  2346.             elseif menuid = 500 + MENU_LIMIT then
  2347.                buildmenuitem menuname, 5, menuid, '~'MORE__MSG'...', 'Ring_More', 0, 0
  2348.             endif
  2349.          end
  2350.  compile else
  2351.          if menuid < 500 + MENU_LIMIT then
  2352.             if .titletext=='' then
  2353.                buildmenuitem defaultmenu, 5, menuid, .filename, 'activatefileid 'fid, 0, 0
  2354.             else
  2355.                buildmenuitem defaultmenu, 5, menuid, .titletext, 'activatefileid 'fid, 0, 0
  2356.             endif
  2357.          elseif menuid = 500 + MENU_LIMIT then
  2358.             buildmenuitem defaultmenu, 5, menuid, '~'MORE__MSG'...', 'Ring_More', 0, 0
  2359.             activatefile startid
  2360.             leave
  2361.          endif
  2362.  compile endif
  2363.          nextfile
  2364.          getfileid fid
  2365.          if fid=startid then leave; endif
  2366.       enddo
  2367. ;;    do_array 2, EPM_utility_array_ID, 'NS', len   -- Item NS is NameSize - size of buffer.
  2368.       if activemenu=defaultmenu  then
  2369. compile if EVERSION < 5.60
  2370.          showmenu activemenu, 5
  2371. compile else
  2372.          showmenu activemenu
  2373. compile endif
  2374.       endif
  2375.    endif
  2376. compile endif
  2377.  
  2378. /*
  2379. ┌────────────────────────────────────────────────────────────────────────────┐
  2380. │ what's it called: WinMessageBox                                            │
  2381. │                                                                            │
  2382. │ what does it do : This routine issues a PM WinMessageBox call, and returns │
  2383. │                   the result.                                              │
  2384. │                                                                            │
  2385. └────────────────────────────────────────────────────────────────────────────┘
  2386. */
  2387. defproc winmessagebox(caption, text)
  2388.  
  2389. ; msgtype = 4096                                        -- must be system modal.
  2390. ; if arg(3) then
  2391. ;    msgtype=arg(3) + 4096 * (1 - (arg(3)%4096 - 2 * (arg(3)%8192)))  -- ensure x'1000' on
  2392. ; endif
  2393.   if arg(3) then
  2394.      msgtype=arg(3)
  2395.   else
  2396.      msgtype = 0
  2397.   endif
  2398.   caption = caption\0
  2399.   text    = text\0
  2400. compile if EPM32
  2401.   return dynalink32( 'PMWIN',
  2402. --                   'WINMESSAGEBOX',
  2403.                    "#789",
  2404.                    atol(1) ||   -- Parent
  2405.                    gethwndc(EPMINFO_EDITFRAME) ||   /* edit frame handle             */
  2406.                    address(text)      ||   -- Text
  2407.                    address(caption)   ||   -- Title
  2408.                    atol(0)            ||   -- Window
  2409.                    atol(msgtype) )         -- Style
  2410. compile else
  2411.   return dynalink( 'PMWIN',
  2412.                    'WINMESSAGEBOX',
  2413.                    atoi(0) || atoi(1) ||   -- Parent
  2414.                    -- atoi(0) || atoi(1) ||   -- Owner
  2415.                    gethwnd(EPMINFO_EDITFRAME) ||   /* edit frame handle             */
  2416.                    address(text)      ||   -- Text
  2417.                    address(caption)   ||   -- Title
  2418.                    atoi(0)            ||   -- Window
  2419.                    atoi(msgtype) )         -- Style
  2420. compile endif  -- EPM32
  2421.  
  2422.  
  2423. /*
  2424. ┌────────────────────────────────────────────────────────────────────────────┐
  2425. │ what's it called: activatefileid                                           │
  2426. │                                                                            │
  2427. │ what does it do : This command is used when a RING menu item is selected   │
  2428. │                   it switches view to the file that was just selected.     │
  2429. │                                                                            │
  2430. └────────────────────────────────────────────────────────────────────────────┘
  2431. */
  2432. compile if MENU_LIMIT
  2433. defc activatefileid
  2434.    fid = arg(1)
  2435.    activatefile fid
  2436. compile endif
  2437.  
  2438. define
  2439. compile if MENU_LIMIT
  2440.    list_col=33                 -- Under 'Ring' on action bar
  2441. compile else
  2442.    list_col=23                 -- Under 'Options' on action bar
  2443. compile endif
  2444. /*
  2445. ┌────────────────────────────────────────────────────────────────────────────┐
  2446. │ what's it called: Ring_More                                                │
  2447. │                                                                            │
  2448. │ what does it do : This command is called when the More... selection on     │
  2449. │                   the ring menu is selected.  (Or by the Ring action bar   │
  2450. │                   item if MENU_LIMIT = 0.)  It generates a listbox         │
  2451. │                   containing all the filenames, and selects the            │
  2452. │                   appropriate fileid if a filename is selected.            │
  2453. │                                                                            │
  2454. └────────────────────────────────────────────────────────────────────────────┘
  2455. */
  2456. defc Ring_More
  2457. compile if EVERSION >= 5.20   -- The new way; easy and fast.
  2458.    if filesinring()=1 then
  2459.       sayerror ONLY_FILE__MSG
  2460.       return
  2461.    endif
  2462.    call windowmessage(0,  getpminfo(APP_HANDLE),
  2463.                       5141,               -- EPM_POPRINGDIALOG
  2464.                       0,
  2465.                       0)
  2466. compile else          -- The old way; slow and complicated.
  2467.    universal EPM_utility_array_ID
  2468.  
  2469.    sayerror LISTING__MSG
  2470.    getfileid fid
  2471.    startid = fid
  2472.  
  2473. ;; do_array 3, EPM_utility_array_ID, 'NS', len    -- Item NS is size of names buffer required
  2474.    len = 1  -- Will be length of buffer required.  Init to 1 for null terminator.
  2475.    tmp_str = ''  -- In case we don't need a buffer
  2476.    longest=0
  2477.    do i = 1 to FilesInRing(2)     -- Prevent looping forever.
  2478.       do_array 2, EPM_utility_array_ID, 'F'i, fid  -- Put fileid into array index [i]
  2479.       if .titletext=='' then
  2480.          fname=.filename
  2481.       else
  2482.          fname=.titletext
  2483.       endif
  2484.       len = len + length(fname) + length(i) + 3  -- 3 = 1 sep '/' + 2 blanks
  2485.       longest=max(longest, length(fname) + length(i) + 2)
  2486.       tmp_str = tmp_str || \1 || i || ' 'substr('. ',(.modify=0)+1,1) || fname
  2487.       nextfile
  2488.       getfileid fid
  2489.       if fid=startid then leave; endif
  2490.    enddo
  2491.    if i=1 then
  2492.       sayerror ONLY_FILE__MSG
  2493.       return
  2494.    endif
  2495.  
  2496.    if length(tmp_str)<MAXCOL then  -- We can use the string; no need to bother with a buffer.
  2497.       filesbuffer = selector(tmp_str)
  2498.       filesbuf_offset = offset(tmp_str)
  2499.       buf_offset = length(tmp_str)
  2500.       tmp_str = tmp_str\0                      -- null terminate
  2501.       free_the_buffer = 0
  2502.    else                         -- Have to allocate and fill a buffer.
  2503.       filesbuffer = "??"                  -- initialize string pointer
  2504.       r =  dynalink('DOSCALLS',           -- dynamic link library name
  2505.                '#34',                     -- DosAllocSeg
  2506.                atoi(min(len+1,65535)) ||  -- Number of Bytes requested
  2507.                address(filesbuffer)   ||  -- string address
  2508.                atoi(0))                   -- Share information
  2509.  
  2510.       if r then sayerror ERROR__MSG r ALLOC_HALTED__MSG; stop; endif
  2511.  
  2512.       filesbufseg = itoa(filesbuffer,10)
  2513.       buf_offset = 0
  2514.       filesbuf_offset = atoi(0)
  2515.  
  2516.       do i = 1 to FilesInRing(2)
  2517. ;;       do_array 2, EPM_utility_array_ID, 'F'i, fid  -- Put fileid into array index [i]
  2518.          if .titletext=='' then
  2519.             fname=.filename
  2520.          else
  2521.             fname=.titletext
  2522.          endif
  2523.          tmp_str = \1 || i || ' 'substr('. ',(.modify=0)+1,1) || fname
  2524.                                                     -- \1 || "1  D:\E_MACROS\STDCTRL.E"
  2525.          if buf_offset+length(tmp_str) >= 65535 then
  2526.             activatefile startid
  2527.             call WinMessageBox(TOO_MANY_FILES__MSG, NOT_FIT__MSG, 16416)
  2528.             leave
  2529.          endif
  2530.          poke filesbufseg,buf_offset,tmp_str
  2531.          buf_offset=buf_offset+length(tmp_str)
  2532.          nextfile
  2533.          getfileid fid
  2534.          if fid=startid then leave; endif
  2535.       enddo
  2536.       poke filesbufseg,buf_offset,\0        -- Null terminate
  2537.       free_the_buffer = 1
  2538.    endif
  2539.  
  2540.    but1=SELECT__MSG\0; but2=CANCEL__MSG\0; but3=\0; but4=\0; but5=\0; but6=\0; but7=\0   /* default butts*/
  2541.  
  2542.    if longest<.windowwidth-LIST_COL then
  2543.       col=LIST_COL           -- Under appropriate pulldown on action bar.
  2544.    else
  2545.       col=0                  -- At left edge of edit window.
  2546.    endif
  2547. ;; row = -2 - querycontrol(7) - querycontrol(8)  -- Allow for status and message line
  2548.  
  2549.    /* null terminate return buffer  */
  2550.    selectbuf = leftstr(\0,255)  -- If this were used for 5.53 or above, would have to change this...
  2551.  
  2552.    rect = '????????????????'     -- Left, Bottom, Right, Top
  2553.    call dynalink( 'PMWIN',
  2554.              'WINQUERYWINDOWRECT',
  2555.               gethwnd(EPMINFO_EDITCLIENT) ||
  2556.               address(rect) )
  2557.  
  2558. ; LAM:  Originally, I placed the listbox more or less below the action bar menu
  2559. ;       title.  But, on some machines, it didn't wind up in the right place.
  2560. ;       Also, it got thrown off if the user had partial text displayed.  So, I
  2561. ;       changed from (a) to (b), which gets the exact position in pels (using
  2562. ;       the WinQueryWindowRect call, above) rather than multiplying an
  2563. ;       approximate character position by the font height.  (c) was an attempt
  2564. ;       to place the list box immediately under the pulldown, by taking into
  2565. ;       account the status line and message line.  I decided that I wanted to
  2566. ;       see the status line (so the "nnn files" wouldn't be covered), so I went
  2567. ;       back to (b).  It's more efficient, and I'm willing to not worry about
  2568. ;       whether or not the message line is covered by the listbox.
  2569.  
  2570.    title=FILES_IN_RING__MSG\0
  2571.  
  2572.    sayerror 0; refresh
  2573.  
  2574.    call dynalink( ERES_DLL,                -- list box control in EDLL dynalink
  2575.              'LISTBOX',                    -- function name
  2576.               gethwnd(EPMINFO_EDITFRAME)||   -- edit frame handle
  2577.               atoi(3)                   ||
  2578.               atoi(.fontwidth * col)    ||   -- coordinates
  2579. ;;  (a)       atoi(.fontheight*(screenheight()+querycontrol(7)+querycontrol(8))) ||
  2580.               substr(rect,13,2)         ||   -- (b)
  2581. ;;  (c)       atoi(itoa(substr(rect,13,2),10)+.fontheight*(querycontrol(7)+querycontrol(8))) ||
  2582.               atoi(min(i,16))           ||   -- height = smaller of # files or 16
  2583.               atoi(0)                   ||   -- width - 0 means as much as needed
  2584.               atoi(2)                   ||   -- Number of buttons
  2585.               address(title)            ||   -- title
  2586.               address(but1)             ||   -- text to appear in buttons
  2587.               address(but2)             ||
  2588.               address(but3)             ||
  2589.               address(but4)             ||
  2590.               address(but5)             ||
  2591.               address(but6)             ||
  2592.               address(but7)             ||
  2593.               atoi(buf_offset)          ||   -- length of list
  2594.               filesbuffer               ||   -- list segment
  2595.               filesbuf_offset           ||   -- list offset
  2596.               address(selectbuf) )           -- return string buffer
  2597.  
  2598.    if free_the_buffer then
  2599.       call dynalink('DOSCALLS',         -- dynamic link library name
  2600.                '#39',                   -- DosFreeSeg
  2601.                filesbuffer)
  2602.    endif
  2603.  
  2604.    EOS = pos(\0,selectbuf)        -- CHR(0) signifies End Of String
  2605.    if EOS = 1 then return; endif
  2606.    parse value selectbuf with idx .
  2607.    if not isnum(idx) then sayerror UNEXPECTED__MSG; return; endif
  2608.    do_array 3, EPM_utility_array_ID, 'F'idx, fileid
  2609.    activatefile fileid
  2610. compile endif         -- The old way; slow and complicated.
  2611.  
  2612. defproc mpfrom2short(mphigh, mplow)
  2613.    return ltoa( atoi(mplow) || atoi(mphigh), 10 )
  2614.  
  2615. /* Returns the edit window handle, as a 4-digit decimal string. */
  2616. defproc gethwnd(w)
  2617. ;  EditHwnd = getpminfo(w)         /* get edit window handle          */
  2618.  
  2619.    /* String handling in E language :                                 */
  2620.    /*    EditHwnd = '1235:1234'   <-  address in string form          */
  2621.    /*    atol(EditHwnd)= '11GF'   <-  four byte pointer, represented  */
  2622.    /*                                 as its ascii character          */
  2623.    /*                                 equivalent.                     */
  2624.    /*    Flipping (substr(...) ) <-  places 4 bytes in correct order. */
  2625.    /*    Note:    2byte vars are converted with atoi   ie.  USHORT    */
  2626.    /*    Note:    4byte vars are converted with atol   ie.  HWND,HAB  */
  2627.  
  2628.                                   /* get edit window handle           */
  2629.                                   /* convert string to string pointer */
  2630.                                   /* interchange upper two bytes with */
  2631.                                   /* lower two bytes. (flip words)    */
  2632.    return atol_swap(getpminfo(w))
  2633.  
  2634.  
  2635. defproc gethwndc(w)
  2636.    return atol(getpminfo(w))
  2637.  
  2638.  
  2639. /*
  2640. ┌────────────────────────────────────────────────────────────────────────────┐
  2641. │ what's it called: dupmark                                                  │
  2642. │                                                                            │
  2643. │ what does it do : This command is used when a Mark menu item is selected   │
  2644. │                                                                            │
  2645. └────────────────────────────────────────────────────────────────────────────┘
  2646. */
  2647. defc dupmark
  2648.    mt = upcase(arg(1))
  2649.    if     mt = 'M' then
  2650. ;     if marktype() then
  2651.          call pmove_mark()
  2652. ;     else                 -- If no mark, look in Shared Text buffer
  2653. ;       'GetSharBuff'      -- See clipbrd.e for details
  2654. ;     endif
  2655.    elseif mt = 'C' then
  2656.       if marktype() then
  2657.          call pcopy_mark()
  2658.       else                 -- If no mark, look in Shared Text buffer
  2659.          'GetSharBuff'     -- See clipbrd.e for details
  2660.       endif
  2661.    elseif mt = 'O' then
  2662.       if marktype() then
  2663. compile if WANT_CHAR_OPS
  2664.          call pcommon_adjust_overlay('O')
  2665. compile else
  2666.          overlay_block
  2667. compile endif
  2668.       else                 -- If no mark, look in Shared Text buffer
  2669.          'GetSharBuff O'   -- See clipbrd.e for details
  2670.       endif
  2671.    elseif mt = 'A' then
  2672. compile if WANT_CHAR_OPS
  2673.       call pcommon_adjust_overlay('A')
  2674. compile else
  2675.       adjustblock
  2676. compile endif
  2677.    elseif mt = 'U' then
  2678.       unmark
  2679.       'ClearSharBuff'
  2680.    elseif mt = 'U2' then  -- Unmark w/o clearing buffer, for drag/drop
  2681.       unmark
  2682.    elseif mt = 'D' then  -- Normal delete mark
  2683. compile if WANT_DM_BUFFER
  2684.       'Copy2DMBuff'        -- See clipbrd.e for details
  2685. compile endif  -- WANT_DM_BUFFER
  2686.       call pdelete_mark()
  2687.       'ClearSharBuff'
  2688.    elseif mt = 'D2' then  -- special for drag/drop; only deletes mark w/o touching buffers
  2689.       call pdelete_mark()
  2690.    elseif mt = 'P' then    -- Print marked area
  2691.       call checkmark()     -- verify there is a marked area,
  2692. ;compile if ENHANCED_PRINT_SUPPORT  -- DUPMARK P is only called if no enhanced print support
  2693. ;      printer=get_printer()
  2694. ;      if printer<>'' then 'print' printer; endif
  2695. ;compile else
  2696.       'print'              -- then print it.
  2697. ;compile endif
  2698.    endif
  2699.  
  2700. /*
  2701. ╔════════════════════════════════════════════════════════════════════════════╗
  2702. ║ MENU support.                                                              ║
  2703. ║      EPM's menu support is achieved through the use of the MENU manager.   ║
  2704. ║      This menu manager is located in EUTIL.DLL in versions prior to 5.20;  ║
  2705. ║      in E.DLL for EPM 5.20 and above.  The menu manager contains powerful  ║
  2706. ║      functions that allow an application to create there own named menus.  ║
  2707. ║      Building Menus with the Menu Manager:                                 ║
  2708. ║        The menu manager provides two fuctions which allow the creating     ║
  2709. ║        or replacing of items in a named menu.                              ║
  2710. ║        Note: A menu is first built and then displayed in the window.       ║
  2711. ║        BUILDSUBMENU  - creates or modifies a sub menu                      ║
  2712. ║        BUILDMENUITEM - create  or modifies a menu item under a sub menu    ║
  2713. ║                                                                            ║
  2714. ║      Showing a named Menu                                                  ║
  2715. ║        SHOWMENU      - show the specified named menu in the specified      ║
  2716. ║                        window frame.                                       ║
  2717. ║                                                                            ║
  2718. ║      Deleting a name menu                                                  ║
  2719. ║        DELETEMENU    - remove a named menu from the internal menory        ║
  2720. ║                        manager.                                            ║
  2721. ╚════════════════════════════════════════════════════════════════════════════╝
  2722. */
  2723.  
  2724. defexit
  2725.    universal defaultmenu
  2726.  
  2727.    deletemenu defaultmenu
  2728.    defaultmenu=''
  2729.  
  2730. /*
  2731. ┌─────────────────────────────────────────────────────────────────────────────┐
  2732. │What's it called  : processmenu | processcommand                             │
  2733. │                                                                             │
  2734. │What does it do   : This command is not called by macros.  It is called by   │
  2735. │                    the internal editor message handler.   When a menu       │
  2736. │                    selected messaged is received by the internal message    │
  2737. │                    handler, (WM_COMMAND) this function is called with       │
  2738. │                    the menu id as a parameter.                              │
  2739. │                                                                             │
  2740. │                                                                             │
  2741. │Who and When      : Jerry C.     3/4/89                                      │
  2742. └─────────────────────────────────────────────────────────────────────────────┘
  2743. */
  2744. compile if EVERSION > 5.19
  2745.   defc processcommand    -- Now called processcommand
  2746.  compile if EVERSION > 5.20
  2747.    universal activeaccel
  2748.  compile endif
  2749. compile else
  2750.   defc processmenu
  2751. compile endif
  2752.  
  2753.    universal activemenu
  2754.  
  2755.    menuid = arg(1)
  2756.    if menuid='' then
  2757.       sayerror PROCESS_ERROR__MSG
  2758.       return
  2759.    endif
  2760.  
  2761. compile if EVERSION > 5.19
  2762.    -- first test if command was generated by the
  2763.    -- next/prev buttons on the editor frame.
  2764.    if menuid=44 then
  2765.       nextfile
  2766.    elseif menuid=45 then
  2767.       prevfile
  2768.  compile if EVERSION >= 5.60
  2769.    elseif menuid=8101 then  -- Temporarily hardcode this
  2770.       'configdlg SYS'
  2771.  compile endif
  2772.    else
  2773.  compile if EVERSION > 5.20
  2774.       accelstr=queryaccelstring(activeaccel, menuid)
  2775.       if accelstr<>'' then
  2776.          accelstr
  2777.       else
  2778.  compile endif
  2779. compile endif
  2780.          if activemenu='' then
  2781.             sayerror 'Error in active menu'
  2782.             return
  2783.          endif
  2784.          -- execute user string, after stripping off null terminating char
  2785.          parse value querymenustring(activemenu,menuid) with command \1 helpstr
  2786.          strip(command,'T',\0)
  2787. compile if EVERSION > 5.19
  2788.  compile if EVERSION > 5.20
  2789.       endif
  2790.  compile endif
  2791.    endif
  2792. compile endif
  2793.  
  2794. compile if EVERSION >= 5.51 & 0  -- Not used...
  2795. defc processaccel
  2796.    universal activeaccel
  2797.    menuid = arg(1)
  2798.    if menuid='' then
  2799.       sayerror PROCESS_ERROR__MSG
  2800.       return
  2801.    endif
  2802.    queryaccelstring(activeaccel, menuid)
  2803. compile endif
  2804.  
  2805. defc processmenuselect  -- Called when a menu item is activated; used for prompting
  2806. compile if INCLUDE_MENU_SUPPORT
  2807.    universal activemenu
  2808. compile if WANT_DYNAMIC_PROMPTS
  2809.    universal menu_prompt
  2810. compile endif
  2811.  
  2812. compile if EVERSION >= 5.60
  2813.    universal previouslyactivemenu
  2814.    parse arg menutype menuid .
  2815. ;  if menutype = 'A' & previouslyactivemenu<>'' then
  2816.    if menuid < 80 & menuid <> '' & previouslyactivemenu<>'' then  -- Temp kludge
  2817.       activemenu = previouslyactivemenu
  2818.       previouslyactivemenu = ''
  2819.    endif
  2820. compile else
  2821.    menuid = arg(1)
  2822. compile endif
  2823. compile if WANT_DYNAMIC_PROMPTS
  2824.    if menuid='' | activemenu='' | not menu_prompt then
  2825.       sayerror 0
  2826.       return
  2827.    endif
  2828.    parse value querymenustring(activemenu,menuid) with command \1 helpstr
  2829.    if helpstr<>'' then
  2830.  compile if EVERSION >= '5.21'
  2831.       display -8
  2832.  compile endif
  2833.       sayerror helpstr
  2834.  compile if EVERSION >= '5.21'
  2835.       display 8
  2836.  compile endif
  2837.    else
  2838.       sayerror 0
  2839.    endif
  2840. compile else
  2841.    sayerror 0
  2842. compile endif  -- WANT_DYNAMIC_PROMPTS
  2843. compile endif  -- INCLUDE_MENU_SUPPORT
  2844.  
  2845. ; Note:  this routine does *not* get called when Command (menuid 1) is selected.
  2846. defc PROCESSMENUINIT  -- Called when a pulldown or pullright is initialized.
  2847.  compile if INCLUDE_MENU_SUPPORT
  2848.    universal activemenu, defaultmenu
  2849.    universal EPM_utility_array_ID
  2850.  compile if WANT_DYNAMIC_PROMPTS
  2851.    universal menu_prompt
  2852.  compile endif
  2853.    universal lastchangeargs
  2854.  compile if WANT_STACK_CMDS
  2855.    universal mark_stack, position_stack
  2856.   compile if WANT_STACK_CMDS = 'SWITCH'
  2857.    universal stack_cmds
  2858.   compile endif
  2859.  compile endif
  2860.  compile if WANT_CUA_MARKING = 'SWITCH'
  2861.    universal CUA_marking_switch
  2862.  compile endif
  2863.  compile if WANT_STREAM_MODE = 'SWITCH'
  2864.    universal stream_mode
  2865.  compile endif
  2866.  compile if RING_OPTIONAL
  2867.    universal ring_enabled
  2868.  compile endif
  2869.  compile if BLOCK_ACTIONBAR_ACCELERATORS = 'SWITCH'
  2870.    universal CUA_MENU_ACCEL
  2871.  compile endif
  2872.  
  2873.    if activemenu<>defaultmenu then return; endif
  2874.    menuid = arg(1)
  2875.  compile if EVERSION >= 5.51
  2876.   compile if defined(SITE_MENUINIT)
  2877.       compile if SITE_MENUINIT
  2878.          include SITE_MENUINIT
  2879.       compile endif
  2880.   compile endif
  2881.    if isadefc('menuinit_'menuid) then
  2882. ;  -- Bug?  Above doesn't work...
  2883. ;  tmp = 'menuinit_'menuid
  2884. ;  if isadefc(tmp) then
  2885.       'menuinit_'menuid
  2886.       return
  2887.    endif
  2888.    tryinclude 'mymnuini.e'  -- For user-supplied additions to this routine.
  2889.  compile endif -- EVERSION >= 5.51
  2890.  
  2891. ; The following is individual commands on 5.51+; all part of ProcessMenuInit cmd on earlier versions.
  2892.  
  2893.  compile if EVERSION >= 5.51    ------------- Menu id 8 -- Edit -------------------------
  2894.    defc menuinit_8
  2895.   compile if WANT_STACK_CMDS
  2896.    universal mark_stack, position_stack
  2897.    compile if WANT_STACK_CMDS = 'SWITCH'
  2898.    universal stack_cmds
  2899.    compile endif
  2900.   compile endif
  2901.  compile else -- EVERSION >= 5.51
  2902.    if menuid=8 then
  2903.  compile endif -- EVERSION >= 5.51
  2904.  compile if EVERSION < '5.50'
  2905.       getline current
  2906.       undo
  2907.       getline original
  2908.       undo
  2909.       SetMenuAttribute( 816, 16384, original/==current)
  2910.  compile else
  2911.       SetMenuAttribute( 816, 16384, isadirtyline())
  2912.  compile endif
  2913.  compile if EVERSION > 5.19
  2914.       undoaction 1, PresentState        -- Do to fix range, not for value.
  2915.       undoaction 6, StateRange               -- query range
  2916.       parse value staterange with oldeststate neweststate .
  2917.       SetMenuAttribute( 818, 16384, oldeststate<>neweststate )  -- Set to 1 if different
  2918.  compile endif
  2919.  compile if EPM32
  2920.       paste = clipcheck(format) & (format=1024) & browse()=0
  2921.  compile else
  2922.       paste = clipcheck(format) & (format=256) & browse()=0
  2923.  compile endif  -- EPM32
  2924.       SetMenuAttribute( 810, 16384, paste)
  2925.       SetMenuAttribute( 811, 16384, paste)
  2926.       SetMenuAttribute( 812, 16384, paste)
  2927.       on = marktype()<>''
  2928.       buf_flag = 0
  2929.       if not on then                             -- Only check buffer if no mark
  2930.          bufhndl = buffer(OPENBUF, EPMSHAREDBUFFER)
  2931.          if bufhndl then                         -- If the buffer exists, check the
  2932.             buf_flag=itoa(peek(bufhndl,2,2),10)  -- amount of used space in buffer
  2933.             call buffer(FREEBUF, bufhndl)        -- then free it.
  2934.          endif
  2935.       endif
  2936.       SetMenuAttribute( 800, 16384, on | buf_flag)  -- Can copy if mark or buffer has data
  2937.       SetMenuAttribute( 801, 16384, on)
  2938.       SetMenuAttribute( 802, 16384, on | buf_flag)  -- Ditto for Overlay mark
  2939.       SetMenuAttribute( 803, 16384, on)
  2940.       SetMenuAttribute( 805, 16384, on)
  2941.       SetMenuAttribute( 806, 16384, on)
  2942.       SetMenuAttribute( 808, 16384, on)
  2943.       SetMenuAttribute( 809, 16384, on)
  2944.       SetMenuAttribute( 814, 16384, on)
  2945.  compile if WANT_STACK_CMDS
  2946.   compile if WANT_STACK_CMDS = 'SWITCH'
  2947.    if stack_cmds then
  2948.   compile endif
  2949.       SetMenuAttribute( 820, 16384, on)
  2950.       SetMenuAttribute( 821, 16384, mark_stack<>'')
  2951.       SetMenuAttribute( 822, 16384, on & mark_stack<>'')
  2952.       SetMenuAttribute( 824, 16384, position_stack<>'')
  2953.       SetMenuAttribute( 825, 16384, position_stack<>'')
  2954.   compile if WANT_STACK_CMDS = 'SWITCH'
  2955.    endif
  2956.   compile endif
  2957.  compile endif
  2958.  compile if EVERSION < 5.51
  2959.       return
  2960.    endif
  2961.  compile endif -- EVERSION < 5.51
  2962.  
  2963.  compile if EVERSION >= 5.51    ------------- Menu id 4 -- Options ---------------------
  2964.    defc menuinit_4
  2965.   compile if RING_OPTIONAL
  2966.    universal ring_enabled
  2967.   compile endif
  2968.  compile else -- EVERSION >= 5.51
  2969.    if menuid=4 then
  2970.  compile endif -- EVERSION >= 5.51
  2971.  compile if RING_OPTIONAL
  2972.       if ring_enabled then
  2973.  compile endif
  2974.          SetMenuAttribute( 410, 16384, filesinring()>1)
  2975.  compile if RING_OPTIONAL
  2976.       endif
  2977.  compile endif
  2978.  compile if EVERSION < 5.51
  2979.       return
  2980.    endif
  2981.  compile endif -- EVERSION < 5.51
  2982.  
  2983.  compile if WANT_CUA_MARKING = 'SWITCH' | WANT_STREAM_MODE = 'SWITCH' | RING_OPTIONAL | WANT_STACK_CMDS = 'SWITCH'
  2984.   compile if EVERSION >= 5.51    ------------- Menu id 400 -- Options / Preferences -------
  2985.    defc menuinit_400
  2986.   compile if WANT_STACK_CMDS = 'SWITCH'
  2987.    universal stack_cmds
  2988.   compile endif
  2989.   compile if WANT_CUA_MARKING = 'SWITCH'
  2990.    universal CUA_marking_switch
  2991.   compile endif
  2992.   compile if WANT_STREAM_MODE = 'SWITCH'
  2993.    universal stream_mode
  2994.   compile endif
  2995.   compile if RING_OPTIONAL
  2996.    universal ring_enabled
  2997.   compile endif
  2998.   compile if BLOCK_ACTIONBAR_ACCELERATORS = 'SWITCH'
  2999.    universal CUA_MENU_ACCEL
  3000.   compile endif
  3001.   compile else -- EVERSION >= 5.51
  3002.    if menuid=400 then              -- Options / Preferences
  3003.   compile endif -- EVERSION >= 5.51
  3004.   compile if WANT_CUA_MARKING = 'SWITCH'
  3005.       SetMenuAttribute( 441, 8192, CUA_marking_switch)
  3006.   compile endif
  3007.   compile if WANT_STREAM_MODE = 'SWITCH'
  3008.       SetMenuAttribute( 442, 8192, not stream_mode)
  3009.   compile endif
  3010.   compile if RING_OPTIONAL
  3011.       SetMenuAttribute( 443, 8192, not ring_enabled)
  3012.   compile endif
  3013.   compile if WANT_STACK_CMDS = 'SWITCH'
  3014.       SetMenuAttribute( 445, 8192, not stack_cmds)
  3015.   compile endif
  3016.   compile if BLOCK_ACTIONBAR_ACCELERATORS = 'SWITCH'
  3017.     SetMenuAttribute( 446, 8192, not CUA_MENU_ACCEL)
  3018.   compile endif
  3019.   compile if EVERSION < 5.51
  3020.       return
  3021.    endif
  3022.   compile endif -- EVERSION < 5.51
  3023.  compile endif  -- WANT_CUA_MARKING, WANT_STREAM_MODE, RING_OPTIONAL, WANT_STACK_CMDS
  3024.  
  3025.  compile if EVERSION >= 5.51    ------------- Menu id 425 -- Options / Frame controls  ---
  3026.    defc menuinit_425
  3027.    universal bitmap_present
  3028.   compile if RING_OPTIONAL
  3029.       universal ring_enabled
  3030.   compile endif
  3031.   compile if WANT_DYNAMIC_PROMPTS
  3032.       universal menu_prompt
  3033.   compile endif
  3034.  compile else -- EVERSION >= 5.51
  3035.    if menuid=425 then              -- Options / Frame controls
  3036.  compile endif -- EVERSION >= 5.51
  3037.  compile if EVERSION >= 5.53
  3038.       SetMenuAttribute( 413, 8192, not queryframecontrol(1) )
  3039.       SetMenuAttribute( 414, 8192, not queryframecontrol(2) )
  3040.       SetMenuAttribute( 415, 8192, not queryframecontrol(16))
  3041.   compile if EVERSION < 5.50  -- File icon not optional in 5.50
  3042.       SetMenuAttribute( 416, 8192, not queryframecontrol(64))
  3043.   compile endif
  3044.  compile else
  3045.       SetMenuAttribute( 413, 8192, not querycontrol(7) )
  3046.       SetMenuAttribute( 414, 8192, not querycontrol(8) )
  3047.       SetMenuAttribute( 415, 8192, not querycontrol(10))
  3048. ;;    SetMenuAttribute( 416, 8192, not querycontrol(15))
  3049.   compile if EVERSION < 5.50  -- File icon not optional in 5.50
  3050.       SetMenuAttribute( 416, 8192, not querycontrol(22))
  3051.   compile endif
  3052.  compile endif
  3053.  compile if RING_OPTIONAL
  3054.       if ring_enabled then
  3055.  compile endif
  3056.  compile if EVERSION >= 5.53
  3057.          SetMenuAttribute( 417, 8192, not queryframecontrol(4))
  3058.   compile if WANT_TOOLBAR
  3059.          SetMenuAttribute( 430, 8192, not queryframecontrol(EFRAMEF_TOOLBAR))
  3060.   compile endif
  3061.          SetMenuAttribute( 437, 8192, not bitmap_present)
  3062.  compile else
  3063.          SetMenuAttribute( 417, 8192, not querycontrol(20))
  3064.  compile endif
  3065.  compile if RING_OPTIONAL
  3066.       else
  3067.          SetMenuAttribute( 417, 16384, 1)  -- Grey out Rotate Buttons if ring not enabled
  3068.       endif
  3069.  compile endif
  3070.  compile if EVERSION >= 5.53
  3071.       SetMenuAttribute( 421, 8192, not queryframecontrol(32))
  3072.  compile else
  3073.       SetMenuAttribute( 421, 8192, not querycontrol(23))
  3074.  compile endif
  3075.  compile if WANT_DYNAMIC_PROMPTS
  3076.       SetMenuAttribute( 422, 8192, not menu_prompt)
  3077.  compile endif
  3078.  compile if EVERSION < 5.51
  3079.       return
  3080.    endif
  3081.  compile endif -- EVERSION < 5.51
  3082.  
  3083.  compile if EVERSION >= 5.51    ------------- Menu id 3 -- Search -----------------------
  3084.    defc menuinit_3
  3085.       universal lastchangeargs
  3086.  compile else -- EVERSION >= 5.51
  3087.    if menuid=3 then              -- Search
  3088.  compile endif -- EVERSION >= 5.51
  3089.       getsearch strng
  3090.       parse value strng with . c .       -- blank, 'c', or 'l'
  3091.       SetMenuAttribute( 302, 16384, c<>'')  -- Find Next OK if not blank
  3092.       SetMenuAttribute( 303, 16384, lastchangeargs<>'')  -- Change Next only if 'c'
  3093.  compile if EVERSION < 5.51
  3094.       return
  3095.    endif
  3096.  compile endif -- EVERSION < 5.51
  3097.  
  3098.  compile if WANT_BOOKMARKS
  3099.   compile if EVERSION >= 5.51    ------------- Menu id 3 -- Search -----------------------
  3100.    defc menuinit_305
  3101.       universal EPM_utility_array_ID
  3102.   compile else -- EVERSION >= 5.51
  3103.    if menuid=305 then              -- Search
  3104.   compile endif -- EVERSION >= 5.51
  3105.       do_array 3, EPM_utility_array_ID, 'bmi.0', bmcount          -- Index says how many bookmarks there are
  3106.       SetMenuAttribute( 306, 16384, browse()=0)  -- Set
  3107.       SetMenuAttribute( 308, 16384, bmcount>0)   -- List
  3108.       SetMenuAttribute( 311, 16384, bmcount>0)   -- Next
  3109.       SetMenuAttribute( 312, 16384, bmcount>0)   -- Prev
  3110.   compile if EVERSION < 5.51
  3111.       return
  3112.    endif
  3113.   compile endif -- EVERSION < 5.51
  3114.  compile endif  -- WANT_BOOKMARKS
  3115.  
  3116. ; Also will need to handle 204 (Name) on File menu if 5.60 & LaMail...
  3117.  
  3118.  compile if EVERSION < 5.51  -- The old way:
  3119.    compile if defined(SITE_MENUINIT)
  3120.       compile if SITE_MENUINIT
  3121.          include SITE_MENUINIT
  3122.       compile endif
  3123.    compile endif
  3124.    tryinclude 'mymnuini.e'  -- For user-supplied additions to this routine.
  3125.  compile endif -- EVERSION < 5.51
  3126. ; The above is all part of ProcessMenuInit cmd on old versions.  -----------------
  3127. compile endif  -- INCLUDE_MENU_SUPPORT
  3128.  
  3129. defproc SetMenuAttribute( menuid, attr, on)
  3130. ;  universal EditMenuHwnd
  3131. ;  if not EditMenuHwnd then
  3132. ;     EditMenuHwnd = getpminfo(EPMINFO_EDITMENUHWND)  -- cache; relatively expensive to obtain.
  3133. ;  endif
  3134.    if not on then
  3135.       attr=mpfrom2short(attr, attr)
  3136.    endif
  3137.    call windowmessage(1,
  3138. ;                     EditMenuHwnd,  -- Doesn't work; EditMenuHwnd changes.
  3139.                       getpminfo(EPMINFO_EDITMENUHWND),
  3140.                       402,
  3141.                       menuid + 65536,
  3142.                       attr)
  3143.  
  3144.  
  3145. defc processname =
  3146.    newname = arg(1)
  3147.    if newname<>'' & newname<>.filename then
  3148. compile if defined(PROCESSNAME_CMD)  -- Let the user override this, if desired.
  3149.       PROCESSNAME_CMD newname
  3150. compile else
  3151.       'name' newname
  3152. compile endif
  3153.    endif
  3154.  
  3155. defc undo = undo
  3156.  
  3157. defc popbook =
  3158. compile if EVERSION >= 5.50 & EPATH<>'LAMPATH'
  3159.    call windowmessage(0,  getpminfo(APP_HANDLE),
  3160.                       13,                   -- WM_ACTIVATE
  3161.                       1,
  3162.                       getpminfo(APP_HANDLE))
  3163. compile elseif EVERSION >= 5.21 & EPATH<>'LAMPATH'
  3164.    call windowmessage(0,  getpminfo(APP_HANDLE),
  3165.                       5142,                   -- EPM_POP_BOOK_ICON
  3166.                       0,
  3167.                       0)
  3168. compile else
  3169.    call dynalink( 'PMWIN',
  3170.              'WINSETWINDOWPOS',
  3171.               gethwnd(EPMINFO_OWNERFRAME) ||
  3172.               atoi(0) || atoi(3)          ||      /* HWND_TOP   */
  3173.               atoi(0)                     ||
  3174.               atoi(0)                     ||
  3175.               atoi(0 )                    ||
  3176.               atoi(0 )                    ||
  3177.               atoi(132 ))                        /* SWP_ACTIVATE + SWP_ZORDER */
  3178. compile endif
  3179.  
  3180.  
  3181. defc printdlg
  3182. compile if EVERSION >= '5.51'
  3183.    call windowmessage(0,
  3184.                       getpminfo(APP_HANDLE),
  3185.                       5144,               -- EPM_PRINTDLG
  3186.                       arg(1)='M',
  3187.                       0)
  3188. compile else
  3189.  compile if EVERSION >= '5.50'
  3190.     if arg(1)<>'M' then
  3191.        call windowmessage(0,
  3192.                           getpminfo(APP_HANDLE),
  3193.                           5144,               -- EPM_PRINTDLG
  3194.                           0,
  3195.   compile if EVERSION >= '5.51'  -- I don't know if this was ever used, but it's not
  3196.                           0)     -- used (or freed) in any current version.  LAM
  3197.   compile else
  3198.                           put_in_buffer(.filename))
  3199.   compile endif
  3200.        return
  3201.     endif
  3202.  compile else
  3203.     if arg(1)='M' then
  3204.  compile endif
  3205.        call checkmark()     -- verify there is a marked area,
  3206.  compile if EVERSION < '5.50'
  3207.     endif
  3208.  compile endif
  3209.     App = 'PM_SPOOLER_PRINTER'\0
  3210.     inidata = copies(' ',255)
  3211.  compile if EPM32
  3212.     retlen = \0\0\0\0
  3213.     l = dynalink32('PMSHAPI',
  3214.                    'PRF32QUERYPROFILESTRING',
  3215.                    atol(0)           ||  -- HINI_PROFILE
  3216.                    address(App)      ||  -- pointer to application name
  3217.                    atol(0)           ||  -- Key name is NULL; returns all keys
  3218.                    atol(0)           ||  -- Default return string is NULL
  3219.                    address(inidata)  ||  -- pointer to returned string buffer
  3220.                    atol(255)    ||       -- max length of returned string
  3221.                    address(retlen), 2)         -- length of returned string
  3222.  compile else
  3223.     l =  dynalink( 'PMSHAPI',
  3224.                    'PRFQUERYPROFILESTRING',
  3225.                    atol(0)          ||  -- HINI_PROFILE
  3226.                    address(App)     ||  -- pointer to application name
  3227.                    atol(0)          ||  -- Key name is NULL; returns all keys
  3228.                    atol(0)          ||  -- Default return string is NULL
  3229.                    address(inidata) ||  -- pointer to returned string buffer
  3230.                    atol_swap(255), 2)        -- max length of returned string
  3231.  compile endif
  3232.  
  3233.     if not l then sayerror NO_PRINTERS__MSG; return; endif
  3234.     parse value queryprofile($HINI_PARMU 'PM_SPOOLER', 'PRINTER') with default_printername ';'
  3235.     inidata=leftstr(inidata,l)
  3236.     'xcom e /c /q tempfile'
  3237.     if rc<>-282 then  -- sayerror('New file')
  3238.        sayerror ERROR__MSG rc BAD_TMP_FILE__MSG sayerrortext(rc)
  3239.        return
  3240.     endif
  3241.     .autosave = 0
  3242.     browse_mode = browse()     -- query current state
  3243.     if browse_mode then call browse(0); endif
  3244. ;;; deleteline 1
  3245. ;;compile if EVERSION < 5.50
  3246.     parse value queryprofile($HINI_PARMU 'PM_SPOOLER_PRINTER_DESCR', default_printername) with descr ';'
  3247.     insertline default_printername '('descr')', .last+1    -- Place default first.
  3248. ;;compile else
  3249. ;;   default_entry = 1
  3250. ;;compile endif
  3251.     do while inidata<>''
  3252.        parse value inidata with printername \0 inidata
  3253.        if printername=default_printername then
  3254. ;;compile if EVERSION < 5.50
  3255.           iterate
  3256. ;;compile else
  3257. ;;         default_entry = .last
  3258. ;;compile endif
  3259.        endif
  3260.        parse value queryprofile($HINI_PARMU 'PM_SPOOLER_PRINTER_DESCR', printername) with descr ';'
  3261.        insertline printername '('descr')', .last+1
  3262.     enddo
  3263.     if browse_mode then call browse(1); endif  -- restore browse state
  3264.     buflen = filesize() + .last + 1
  3265.     bufhndl = buffer(CREATEBUF, 'LISTBOX', buflen, 1 )  -- create a private buffer
  3266.     if not bufhndl then sayerror 'CREATEBUF' ERROR_NUMBER__MSG RC; return; endif
  3267.     noflines = buffer(PUTBUF,   bufhndl, 1, 0, APPENDCR)
  3268.     last = .last
  3269.     .modify = 0
  3270.     'xcom quit'
  3271.     if not noflines then sayerror 'PUTBUF' ERROR_NUMBER__MSG RC; return; endif
  3272.     usedsize = buffer(USEDSIZEBUF,bufhndl)
  3273.  compile if EVERSION < 5.50
  3274.     ret = listbox(SELECT_PRINTER__MSG, \0 || atoi(usedsize) || atoi(bufhndl) || atoi(32),'',1,5)
  3275.  compile else
  3276.   compile if EPM32
  3277.     parse value listbox(PRINT__MSG, \0 || atol(usedsize) || atoi(32) || atoi(bufhndl),
  3278.   compile else
  3279.     parse value listbox(PRINT__MSG, \0 || atoi(usedsize) || atoi(bufhndl) || atoi(32),
  3280.   compile endif
  3281.                         '/'DRAFT__MSG'/'WYSIWYG__MSG'/'Cancel__MSG'/'Help__MSG,1,5,min(noflines,12),0,
  3282.   compile if EVERSION >= 5.60
  3283.                         gethwndc(APP_HANDLE) || atoi(1/*default_entry*/) || atoi(1) || atoi(6060) ||
  3284.   compile else
  3285.                         atoi(1/*default_entry*/) || atoi(1) || atoi(6060) || gethwndc(APP_HANDLE) ||
  3286.   compile endif
  3287.                         SELECT_PRINTER__MSG) with button 2 printername ' (' \0
  3288.  compile endif
  3289.     call buffer(FREEBUF, bufhndl)
  3290.  compile if EVERSION < 5.50
  3291.     if ret='' then return; endif
  3292.     parse value ret with printername ' ('
  3293.  compile else
  3294.     if button<>\1 & button<>\2 then return; endif
  3295.  compile endif
  3296.     parse value queryprofile($HINI_PARMU 'PM_SPOOLER_PRINTER', printername) with dev ';' . ';' queue ';'
  3297.  compile if EVERSION >= 5.50
  3298.     if button=\1 then  -- Draft
  3299.  compile endif
  3300.        if dev='' then
  3301.           sayerror PRINTER__MSG printername NO_DEVICE__MSG
  3302.        else
  3303.           if arg(1)='M' then
  3304.              'print' dev   -- PRINT command will print the marked area
  3305.           else
  3306.  compile if EVERSION < '5.50'
  3307.              'xcom save' dev  -- Save the file to the printer
  3308.  compile else
  3309.              'xcom save /ne' dev  -- Save the file to the printer
  3310.  compile endif
  3311.           endif
  3312.        endif
  3313.  compile if EVERSION >= 5.50
  3314.     elseif button=\2 then  -- WYSIWYG
  3315.        if queue='' then
  3316.           sayerror PRINTER__MSG printername NO_QUEUE__MSG
  3317.        else
  3318.           if arg(1)='M' then
  3319.              getmark firstline,lastline,firstcol,lastcol,markfileid
  3320.              getfileid fileid
  3321.              mt=marktype()
  3322.              'xcom e /n'             /*  Create a temporary no-name file. */
  3323.              if rc=-282 then  -- sayerror("New file")
  3324.                 if browse_mode then call browse(0); endif  -- Turn off browse state
  3325.                 if mt='LINE' then deleteline endif
  3326.              elseif rc then
  3327.                 stop
  3328.              endif
  3329.              getfileid tempofid
  3330.              .levelofattributesupport = markfileid.levelofattributesupport
  3331.              .font = markfileid.font
  3332.              call pcopy_mark()
  3333.              if browse_mode then call browse(1); endif  -- restore browse state
  3334.              if rc then stop endif
  3335.              call pset_mark(firstline,lastline,firstcol,lastcol,mt,markfileid)
  3336.              activatefile tempofid
  3337.              sayerror PRINTING_MARK__MSG
  3338.           else
  3339.              sayerror PRINTING__MSG .filename
  3340.           endif
  3341.           mouse_setpointer WAIT_POINTER
  3342. ;;;       qprint queue
  3343.           qprint printername
  3344.           if arg(1)='M' then .modify=0; 'xcom q' endif
  3345.           mouse_setpointer EPM_POINTER
  3346.           sayerror 0    /* clear 'printing' message */
  3347.        endif  -- have queue
  3348.     endif  -- button 2
  3349.  compile endif
  3350. compile endif -- >= 5.51
  3351.  
  3352. defc printfile
  3353.    if arg(1)<>'' then
  3354. compile if EVERSION < '5.50'
  3355.       'xcom save' arg(1)  -- Save the file to the printer
  3356. compile else
  3357.       'xcom save /ne' arg(1)  -- Save the file to the printer
  3358. compile endif
  3359.    endif
  3360.  
  3361. compile if EVERSION >= 5.51
  3362. defc process_qprint
  3363.    if arg(1)='' then
  3364.       sayerror PRINTER__MSG /*printername*/ NO_QUEUE__MSG
  3365.    else
  3366.       mouse_setpointer WAIT_POINTER
  3367.       qprint arg(1)
  3368.       mouse_setpointer EPM_POINTER
  3369.    endif
  3370.  
  3371. defc qprint
  3372.    flags = 4           -- Queue name given
  3373.    parse arg what queue_name
  3374.    if upcase(what)='M' then
  3375.       flags = 5        -- Queue name given + marked area only
  3376.    elseif upcase(what)<>'F' then  -- Not a flag;
  3377.       queue_name = arg(1)         -- assume part of the queue name.
  3378.    endif
  3379.    call windowmessage(0,
  3380.                       getpminfo(APP_HANDLE),
  3381.                       5144,               -- EPM_PRINTDLG
  3382.                       flags,
  3383.                       put_in_buffer(queue_name) )
  3384.  
  3385. compile elseif EVERSION >= 5.50
  3386.  
  3387. defc qprint
  3388.    if arg(1)='' then
  3389.       sayerror PRINTER__MSG /*printername*/ NO_QUEUE__MSG
  3390.    else
  3391.       mouse_setpointer WAIT_POINTER
  3392.       qprint arg(1)
  3393.       mouse_setpointer EPM_POINTER
  3394.    endif
  3395. compile endif
  3396.  
  3397. compile if WANT_CUA_MARKING = 'SWITCH'
  3398. defc CUA_mark_toggle
  3399.    universal CUA_marking_switch
  3400.    CUA_marking_switch = not CUA_marking_switch
  3401.    'togglecontrol 25' CUA_marking_switch
  3402.  compile if WANT_NODISMISS_MENUS
  3403.    SetMenuAttribute( 441, 8192, CUA_marking_switch)
  3404.  compile endif  -- WANT_NODISMISS_MENUS
  3405.    call MH_set_mouse()
  3406. compile endif
  3407.  
  3408. compile if WANT_STREAM_MODE = 'SWITCH'
  3409. defc stream_toggle
  3410.    universal stream_mode
  3411.    stream_mode = not stream_mode
  3412.    'togglecontrol 24' stream_mode
  3413.  compile if WANT_NODISMISS_MENUS
  3414.    SetMenuAttribute( 442, 8192, not stream_mode)
  3415.  compile endif  -- WANT_NODISMISS_MENUS
  3416. compile endif
  3417.  
  3418. compile if RING_OPTIONAL
  3419. defc ring_toggle
  3420.    universal ring_enabled
  3421.    universal activemenu, defaultmenu
  3422.    ring_enabled = not ring_enabled
  3423.  compile if EVERSION < 5.53
  3424.    'togglecontrol 20' ring_enabled
  3425.  compile else
  3426.    'toggleframe 4' ring_enabled
  3427.  compile endif
  3428.  compile if INCLUDE_STD_MENUS
  3429.    deletemenu defaultmenu, 2, 0, 1                  -- Delete the file menu
  3430.    call add_file_menu(defaultmenu)
  3431.    deletemenu defaultmenu, 4, 0, 1                  -- Delete the options menu
  3432.    call add_options_menu(defaultmenu, dos_version()>=1020)
  3433.    if activemenu=defaultmenu  then
  3434.       showmenu activemenu
  3435.    endif
  3436. ; compile if WANT_NODISMISS_MENUS & EVERSION < 5.60
  3437. ;  SetMenuAttribute( 443, 8192, not ring_enabled)  -- We're rebuilding this menu; give it up.
  3438. ; compile endif  -- WANT_NODISMISS_MENUS
  3439.  compile endif  -- INCLUDE_STD_MENUS
  3440. compile endif
  3441.  
  3442. compile if WANT_STACK_CMDS = 'SWITCH'
  3443. defc stack_toggle
  3444.    universal stack_cmds
  3445.    universal activemenu, defaultmenu
  3446.    stack_cmds = not stack_cmds
  3447.  compile if INCLUDE_STD_MENUS
  3448.    deletemenu defaultmenu, 8, 0, 1                  -- Delete the edit menu
  3449.    call add_edit_menu(defaultmenu)
  3450.    if activemenu=defaultmenu  then
  3451.       showmenu activemenu
  3452.    endif
  3453. ; compile if WANT_NODISMISS_MENUS & EVERSION < 5.60
  3454. ;  SetMenuAttribute( 445, 8192, not stack_cmds)
  3455. ; compile endif  -- WANT_NODISMISS_MENUS
  3456.  compile endif  -- INCLUDE_STD_MENUS
  3457. compile endif
  3458.  
  3459. compile if BLOCK_ACTIONBAR_ACCELERATORS = 'SWITCH' & INCLUDE_STD_MENUS
  3460. defc accel_toggle
  3461.    universal CUA_MENU_ACCEL
  3462.    universal activemenu, defaultmenu
  3463.    CUA_MENU_ACCEL = not CUA_MENU_ACCEL
  3464.    deleteaccel 'defaccel'
  3465.    'loadaccel'
  3466.    deletemenu defaultmenu, 8, 0, 1                  -- Delete the edit menu
  3467.    call add_edit_menu(defaultmenu)
  3468.    if activemenu=defaultmenu  then
  3469.  compile if 0   -- Don't need to actually show the menu; can just update the affected text.
  3470.       showmenu activemenu
  3471.  compile else
  3472.       call update_edit_menu_text()
  3473.  compile endif
  3474.    endif
  3475.  compile if WANT_NODISMISS_MENUS
  3476.    SetMenuAttribute( 446, 8192, not CUA_MENU_ACCEL)
  3477.  compile endif  -- WANT_NODISMISS_MENUS
  3478. compile endif
  3479.  
  3480. compile if WANT_STREAM_MODE <> 1 & ENHANCED_ENTER_KEYS & EVERSION < 5.21
  3481. ; This will be moved into the notebook control, so no NLS translation for the temporary macro code.
  3482. defc config_enter
  3483.  compile if EPATH = 'LAMPATH'
  3484.    call dynalink( 'LAMRES',
  3485.                   'LAMRESENTERKEYDIALOG',
  3486.                   gethwnd(EPMINFO_EDITFRAME) ||
  3487.                   gethwnd(EPMINFO_EDITFRAME) )
  3488.  compile else
  3489.    universal enterkey, a_enterkey, c_enterkey, s_enterkey
  3490.    universal padenterkey, a_padenterkey, c_padenterkey, s_padenterkey
  3491.   compile if WANT_STREAM_MODE = 'SWITCH'
  3492.    universal stream_mode
  3493.   compile endif
  3494.    k = listbox('Select a key to configure','/1.  Enter/2.  Alt+Enter/3.  Ctrl+Enter/4.  Shift+Enter/5.  PadEnter/6.  Alt+PadEnter/7.  Ctrl+PadEnter/8.  Shift+PadEnter/');
  3495.    if k=='' then
  3496.       return
  3497.    endif
  3498.    parse value k with k '.  ' keyname
  3499.    select = listbox('Select an action for the' keyname 'key:',
  3500.  '/1.  Add a new line after cursor/2.  Move to beginning of next line/3.  Like (2), but add a line if at end of file/4.  Add a line if in insert mode, else move to next line/5.  Like (4), but always add a line if on last line/6.  Split line at cursor/')
  3501.    if select=='' then
  3502.       return
  3503.    endif
  3504.    parse value select with select '.'
  3505.    if k=1 then     enterkey=      select
  3506.    elseif k=2 then a_enterkey=    select
  3507.    elseif k=3 then c_enterkey=    select
  3508.    elseif k=4 then s_enterkey=    select
  3509.    elseif k=5 then padenterkey=   select
  3510.    elseif k=6 then a_padenterkey= select
  3511.    elseif k=7 then c_padenterkey= select
  3512.    else            s_padenterkey= select
  3513.    endif
  3514.   compile if WANT_STREAM_MODE = 'SWITCH'
  3515.    if stream_mode then
  3516.       call winmessagebox('Stream mode active','Key change will not be visible until stream mode is turned off.', 16432) -- MB_OK + MB_INFORMATION + MB_MOVEABLE
  3517.    endif
  3518.   compile endif
  3519.  compile endif  -- LAMPATH
  3520. compile endif  -- WANT_STREAM_MODE <> 1 & ENHANCED_ENTER_KEYS & EVERSION < 5.21
  3521.  
  3522. defc helpmenu   -- send EPM icon window a help message.
  3523.    call windowmessage(0,  getpminfo(APP_HANDLE),
  3524.                       5133,      -- EPM_HelpMgrPanel
  3525.                       arg(1),    -- mp1 = 0=Help for help, 1=index; 2=TOC; 256... =panel #
  3526.                       0)         -- mp2 = NULL
  3527.  
  3528.  
  3529. defc ibmmsg
  3530.    ever = EVERSION
  3531.    if \0 = rightstr(EVERSION,1) then
  3532.       ever=leftstr(EVERSION,length(eversion)-1)
  3533.    endif
  3534. compile if EPATH = 'LAMPATH'
  3535.    call WinMessageBox("LaMail", LAMAIL_VER__MSG "2.0"\13EDITOR_VER__MSG ver(0)\13MACROS_VER__MSG ever\13\13COPYRIGHT__MSG, 16384)
  3536. ;;compile elseif EVERSION >= 5.51 & NLS_LANGUAGE = 'ENGLISH'
  3537. compile elseif EVERSION >= 5.51 & EDITOR__MSG = "EPM Editor - Product Information"
  3538.    -- verstr = EDITOR_VER__MSG ver(0)\0
  3539.    verstr = EDITOR_VER__MSG ver(0)\0MACROS_VER__MSG ever
  3540.    call windowmessage(0, getpminfo(APP_HANDLE),
  3541.                       5146,               -- EPM_POPABBOUTBOX
  3542.                       0,
  3543.                       put_in_buffer(verstr) )
  3544. compile else
  3545.    call WinMessageBox(EDITOR__MSG, EDITOR_VER__MSG ver(0)\13MACROS_VER__MSG ever\13\13COPYRIGHT__MSG, 16384)
  3546. compile endif
  3547.  
  3548.  
  3549. defproc screenxysize( cxcy )     -- syntax :   retvalue =screenxysize( 'Y' or 'X' )
  3550.    return dynalink( 'PMWIN',
  3551.                     'WINQUERYSYSVALUE',
  3552.                      atoi(0) || atoi(1)      ||
  3553.                      atoi(20 + (upcase(cxcy)='Y')))
  3554.  
  3555.  
  3556. defproc put_in_buffer(string)
  3557.    if string='' then                   -- Was a string given?
  3558.       return 0                         -- If not, return a null pointer.
  3559.    endif
  3560. compile if EPM32
  3561.    if arg(2)='' then share=83;  -- PAG_READ | PAG_WRITE | PAG_COMMIT | OBJ_TILE
  3562.    else share=arg(2); endif
  3563.    strbuffer = "????"                  -- Initialize string pointer.
  3564.    r =  dynalink32('DOSCALLS',          -- Dynamic link library name
  3565.             '#299',                    -- DosAllocSeg
  3566.             address(strbuffer)     ||
  3567.             atol(length(string)+1) ||  -- Number of bytes requested
  3568.             atol(share))               -- Share information
  3569. compile else
  3570.    if arg(2)='' then share=0; else share=arg(2); endif
  3571.    strbuffer = "??"                    -- Initialize string pointer.
  3572.    r =  dynalink('DOSCALLS',           -- Dynamic link library name
  3573.             '#34',                     -- DosAllocSeg
  3574.             atoi(length(string)+1) ||  -- Number of bytes requested
  3575.             address(strbuffer)     ||
  3576.             atoi(share))               -- Share information
  3577. compile endif  -- EPM32
  3578.  
  3579.    if r then sayerror ERROR__MSG r ALLOC_HALTED__MSG; stop; endif
  3580. compile if EPM32
  3581.    strbuffer = itoa(substr(strbuffer,3,2),10)
  3582. compile else
  3583.    strbuffer = itoa(strbuffer,10)
  3584. compile endif  -- EPM32
  3585.    poke strbuffer,0,string    -- Copy string to new allocated buf
  3586.    poke strbuffer,length(string),\0  -- Add a null at the end
  3587.    return mpfrom2short(strbuffer,0)  -- Return a long pointer to buffer
  3588.  
  3589.  compile if not defined(MAIL_ACCEL__L)  -- LaMail not NLS-translated.
  3590.   const MAIL_ACCEL__L = 'M'
  3591.         MAIL_ACCEL__A1 =  77
  3592.         MAIL_ACCEL__A2 = 109
  3593.  compile endif
  3594. define  -- Prepare for some conditional tests
  3595.  compile if EPATH = 'LAMPATH'  -- If LaMail, "Mail" will be on action bar
  3596.    maybe_mail_accel = 'MAIL_ACCEL__L <>'
  3597.  compile else                  -- otherwise, it won't
  3598.    maybe_mail_accel = "' ' <"    -- Will be true for any letter
  3599.  compile endif
  3600.  compile if MENU_LIMIT
  3601.    maybe_ring_accel = 'RING_ACCEL__L <>'
  3602.  compile else
  3603.    maybe_ring_accel = "' ' <"  -- Will be true for any letter
  3604.  compile endif
  3605.  compile if defined(ACTIONS_ACCEL__L)  -- For CUSTEPM support
  3606.    maybe_actions_accel = 'ACTIONS_ACCEL__L <>'
  3607.  compile else
  3608.    maybe_actions_accel = "' ' <"  -- Will be true for any letter
  3609.  compile endif
  3610.  
  3611. compile if EVERSION > 5.20
  3612. defc loadaccel
  3613.    universal activeaccel
  3614.   compile if BLOCK_ACTIONBAR_ACCELERATORS = 'SWITCH'
  3615.    universal CUA_MENU_ACCEL
  3616.   compile endif
  3617.    activeaccel='defaccel'
  3618.  compile if INCLUDE_MENU_SUPPORT & INCLUDE_STD_MENUS
  3619.                        -- Help key
  3620. ;; buildacceltable activeaccel, 'helpmenu 4000', AF_VIRTUALKEY, VK_F1, 1000
  3621.  
  3622.                        -- Build keys on File menu
  3623.    buildacceltable activeaccel, 'dokey F8',  AF_VIRTUALKEY,                VK_F8, 1101  -- F8
  3624.    buildacceltable activeaccel, 'dokey c+O', AF_CHAR+AF_CONTROL,              79, 1102  -- c+O
  3625.    buildacceltable activeaccel, 'dokey c+O', AF_CHAR+AF_CONTROL,             111, 1103  -- c+o
  3626.    buildacceltable activeaccel, 'dokey F7',  AF_VIRTUALKEY,                VK_F7, 1104  -- F7
  3627.    buildacceltable activeaccel, 'dokey F2',  AF_VIRTUALKEY,                VK_F2, 1105  -- F2
  3628.    buildacceltable activeaccel, 'dokey F3',  AF_VIRTUALKEY,                VK_F3, 1106  -- F3
  3629.    buildacceltable activeaccel, 'dokey F4',  AF_VIRTUALKEY,                VK_F4, 1107  -- F4
  3630.  
  3631.                        -- Build keys on Edit menu  ('C' & 'O' appear under Action bar keys for English)
  3632.   compile if FILE_ACCEL__L <> 'C' & EDIT_ACCEL__L <> 'C' & SEARCH_ACCEL__L <> 'C' & OPTIONS_ACCEL__L <> 'C' & COMMAND_ACCEL__L <> 'C' & HELP_ACCEL__L <> 'C' & $maybe_mail_accel 'C' & $maybe_ring_accel 'C' & $maybe_actions_accel 'C'
  3633.    buildacceltable activeaccel, 'dokey a+C', AF_CHAR+AF_ALT,                  67, 1201  -- a+C
  3634.    buildacceltable activeaccel, 'dokey a+C', AF_CHAR+AF_ALT,                  99, 1202  -- a+c
  3635.   compile endif
  3636.   compile if FILE_ACCEL__L <> 'M' & EDIT_ACCEL__L <> 'M' & SEARCH_ACCEL__L <> 'M' & OPTIONS_ACCEL__L <> 'M' & COMMAND_ACCEL__L <> 'M' & HELP_ACCEL__L <> 'M' & $maybe_mail_accel 'M' & $maybe_ring_accel 'M' & $maybe_actions_accel 'M'
  3637.    buildacceltable activeaccel, 'dokey a+M', AF_CHAR+AF_ALT,                  77, 1203  -- a+M
  3638.    buildacceltable activeaccel, 'dokey a+M', AF_CHAR+AF_ALT,                 109, 1204  -- a+m
  3639.   compile endif
  3640.   compile if FILE_ACCEL__L <> 'O' & EDIT_ACCEL__L <> 'O' & SEARCH_ACCEL__L <> 'O' & OPTIONS_ACCEL__L <> 'O' & COMMAND_ACCEL__L <> 'O' & HELP_ACCEL__L <> 'O' & $maybe_mail_accel 'O' & $maybe_ring_accel 'O' & $maybe_actions_accel 'O'
  3641.    buildacceltable activeaccel, 'dokey a+O', AF_CHAR+AF_ALT,                  79, 1205  -- a+O
  3642.    buildacceltable activeaccel, 'dokey a+O', AF_CHAR+AF_ALT,                 111, 1206  -- a+o
  3643.   compile endif
  3644.   compile if FILE_ACCEL__L <> 'A' & EDIT_ACCEL__L <> 'A' & SEARCH_ACCEL__L <> 'A' & OPTIONS_ACCEL__L <> 'A' & COMMAND_ACCEL__L <> 'A' & HELP_ACCEL__L <> 'A' & $maybe_mail_accel 'A' & $maybe_ring_accel 'A' & $maybe_actions_accel 'A'
  3645.    buildacceltable activeaccel, 'dokey a+A', AF_CHAR+AF_ALT,                  65, 1207  -- a+A
  3646.    buildacceltable activeaccel, 'dokey a+A', AF_CHAR+AF_ALT,                  97, 1208  -- a+a
  3647.   compile endif
  3648.   compile if FILE_ACCEL__L <> 'U' & EDIT_ACCEL__L <> 'U' & SEARCH_ACCEL__L <> 'U' & OPTIONS_ACCEL__L <> 'U' & COMMAND_ACCEL__L <> 'U' & HELP_ACCEL__L <> 'U' & $maybe_mail_accel 'U' & $maybe_ring_accel 'U' & $maybe_actions_accel 'U'
  3649.    buildacceltable activeaccel, 'dokey a+U', AF_CHAR+AF_ALT,                  85, 1209  -- a+U
  3650.    buildacceltable activeaccel, 'dokey a+U', AF_CHAR+AF_ALT,                 117, 1210  -- a+u
  3651.   compile endif
  3652.   compile if FILE_ACCEL__L <> 'D' & EDIT_ACCEL__L <> 'D' & SEARCH_ACCEL__L <> 'D' & OPTIONS_ACCEL__L <> 'D' & COMMAND_ACCEL__L <> 'D' & HELP_ACCEL__L <> 'D' & $maybe_mail_accel 'D' & $maybe_ring_accel 'D' & $maybe_actions_accel 'D'
  3653.    buildacceltable activeaccel, 'dokey a+D', AF_CHAR+AF_ALT,                  68, 1211  -- a+D
  3654.    buildacceltable activeaccel, 'dokey a+D', AF_CHAR+AF_ALT,                 100, 1212  -- a+d
  3655.   compile endif
  3656.    buildacceltable activeaccel, 'copy2clip', AF_VIRTUALKEY+AF_CONTROL, VK_INSERT, 1213  -- c+Insert
  3657.    buildacceltable activeaccel, 'cut',       AF_VIRTUALKEY+AF_SHIFT,   VK_DELETE, 1214  -- s+Delete
  3658.    buildacceltable activeaccel, 'paste' DEFAULT_PASTE, AF_VIRTUALKEY+AF_SHIFT,   VK_INSERT, 1215  -- s+Insert
  3659.    buildacceltable activeaccel, 'dokey F9',  AF_VIRTUALKEY,                VK_F9, 1216  -- F9
  3660.   compile if EVERSION >= 5.50
  3661.    buildacceltable activeaccel, 'dokey c+Y', AF_CHAR+AF_CONTROL,              89, 1217  -- c+Y
  3662.    buildacceltable activeaccel, 'dokey c+Y', AF_CHAR+AF_CONTROL,             121, 1218  -- c+y
  3663.   compile endif
  3664.    buildacceltable activeaccel, 'select_all',AF_CHAR+AF_CONTROL,              47, 1219  -- c+/
  3665.    buildacceltable activeaccel, 'DUPMARK U', AF_CHAR+AF_CONTROL,              92, 1220  -- c+\
  3666.  
  3667.                        -- Build keys on Search menu
  3668.    buildacceltable activeaccel, 'dokey c+S', AF_CHAR+AF_CONTROL,              83, 1301  -- c+S
  3669.    buildacceltable activeaccel, 'dokey c+S', AF_CHAR+AF_CONTROL,             115, 1302  -- c+s
  3670.    buildacceltable activeaccel, 'dokey c+F', AF_CHAR+AF_CONTROL,              70, 1303  -- c+F
  3671.    buildacceltable activeaccel, 'dokey c+F', AF_CHAR+AF_CONTROL,             102, 1304  -- c+f
  3672.    buildacceltable activeaccel, 'dokey c+C', AF_CHAR+AF_CONTROL,              67, 1305  -- c+C
  3673.    buildacceltable activeaccel, 'dokey c+C', AF_CHAR+AF_CONTROL,              99, 1306  -- c+c
  3674.                        -- Build keys on Bookmark submenu
  3675.   compile if WANT_BOOKMARKS
  3676.    buildacceltable activeaccel, 'dokey c+B', AF_CHAR+AF_CONTROL,              66, 1331  -- c+B
  3677.    buildacceltable activeaccel, 'dokey c+B', AF_CHAR+AF_CONTROL,              98, 1332  -- c+b
  3678.    buildacceltable activeaccel, 'dokey c+M', AF_CHAR+AF_CONTROL,              77, 1333  -- c+M
  3679.    buildacceltable activeaccel, 'dokey c+M', AF_CHAR+AF_CONTROL,             109, 1334  -- c+m
  3680.    buildacceltable activeaccel, 'nextbookmark',  AF_CHAR+AF_ALT,              47, 1335  -- a+/
  3681.    buildacceltable activeaccel, 'nextbookmark P',AF_CHAR+AF_ALT,              92, 1336  -- a+\
  3682.   compile endif
  3683.                        -- Build keys on Tags submenu
  3684.   compile if WANT_TAGS
  3685.    buildacceltable activeaccel, 'dokey s+F6', AF_VIRTUALKEY+AF_SHIFT,      VK_F6, 1361  -- s+F6
  3686.    buildacceltable activeaccel, 'dokey s+F7', AF_VIRTUALKEY+AF_SHIFT,      VK_F7, 1362  -- s+F7
  3687.    buildacceltable activeaccel, 'dokey s+F8', AF_VIRTUALKEY+AF_SHIFT,      VK_F8, 1363  -- s+F8
  3688.    buildacceltable activeaccel, 'dokey s+F9', AF_VIRTUALKEY+AF_SHIFT,      VK_F9, 1364  -- s+F9
  3689.   compile endif
  3690.  
  3691.                        -- Build keys on Options menu
  3692.    buildacceltable activeaccel, 'dokey c+G', AF_CHAR+AF_CONTROL,              71, 1401  -- c+G
  3693.    buildacceltable activeaccel, 'dokey c+G', AF_CHAR+AF_CONTROL,             103, 1402  -- c+g
  3694.  
  3695.                        -- Build keys on Command menu
  3696.    buildacceltable activeaccel, 'dokey c+I', AF_CHAR+AF_CONTROL,              73, 1501  -- c+I
  3697.    buildacceltable activeaccel, 'dokey c+I', AF_CHAR+AF_CONTROL,             105, 1502  -- c+i
  3698.  
  3699.                        -- Block action bar accelerator keys (English)
  3700.   compile if BLOCK_ACTIONBAR_ACCELERATORS
  3701.    compile if BLOCK_ACTIONBAR_ACCELERATORS = 'SWITCH'
  3702.    if not CUA_MENU_ACCEL then
  3703.    compile endif
  3704.    buildacceltable activeaccel, 'dokey a+'FILE_ACCEL__L,    AF_CHAR+AF_ALT, FILE_ACCEL__A1   , 1001  -- a+F
  3705.    buildacceltable activeaccel, 'dokey a+'FILE_ACCEL__L,    AF_CHAR+AF_ALT, FILE_ACCEL__A2   , 1002  -- a+f
  3706.    buildacceltable activeaccel, 'dokey a+'EDIT_ACCEL__L,    AF_CHAR+AF_ALT, EDIT_ACCEL__A1   , 1003  -- a+E
  3707.    buildacceltable activeaccel, 'dokey a+'EDIT_ACCEL__L,    AF_CHAR+AF_ALT, EDIT_ACCEL__A2   , 1004  -- a+e
  3708.    buildacceltable activeaccel, 'dokey a+'SEARCH_ACCEL__L,  AF_CHAR+AF_ALT, SEARCH_ACCEL__A1 , 1005  -- a+S
  3709.    buildacceltable activeaccel, 'dokey a+'SEARCH_ACCEL__L,  AF_CHAR+AF_ALT, SEARCH_ACCEL__A2 , 1006  -- a+s
  3710.    buildacceltable activeaccel, 'dokey a+'OPTIONS_ACCEL__L, AF_CHAR+AF_ALT, OPTIONS_ACCEL__A1, 1007  -- a+O
  3711.    buildacceltable activeaccel, 'dokey a+'OPTIONS_ACCEL__L, AF_CHAR+AF_ALT, OPTIONS_ACCEL__A2, 1008  -- a+o
  3712.    buildacceltable activeaccel, 'dokey a+'COMMAND_ACCEL__L, AF_CHAR+AF_ALT, COMMAND_ACCEL__A1, 1009  -- a+C
  3713.    buildacceltable activeaccel, 'dokey a+'COMMAND_ACCEL__L, AF_CHAR+AF_ALT, COMMAND_ACCEL__A2, 1010  -- a+c
  3714.    buildacceltable activeaccel, 'dokey a+'HELP_ACCEL__L,    AF_CHAR+AF_ALT, HELP_ACCEL__A1   , 1011  -- a+H
  3715.    buildacceltable activeaccel, 'dokey a+'HELP_ACCEL__L,    AF_CHAR+AF_ALT, HELP_ACCEL__A2   , 1012  -- a+h
  3716.    compile if MENU_LIMIT
  3717.    buildacceltable activeaccel, 'dokey a+'RING_ACCEL__L,    AF_CHAR+AF_ALT, RING_ACCEL__A1   , 1013  -- a+R
  3718.    buildacceltable activeaccel, 'dokey a+'RING_ACCEL__L,    AF_CHAR+AF_ALT, RING_ACCEL__A2   , 1014  -- a+r
  3719.    compile endif
  3720.    compile if EPATH = 'LAMPATH'
  3721.    buildacceltable activeaccel, 'dokey a+'MAIL_ACCEL__L,    AF_CHAR+AF_ALT, MAIL_ACCEL__A1   , 1015  -- a+M
  3722.    buildacceltable activeaccel, 'dokey a+'MAIL_ACCEL__L,    AF_CHAR+AF_ALT, MAIL_ACCEL__A2   , 1016  -- a+m
  3723.    compile endif
  3724.    compile if defined(ACTIONS_ACCEL__L)  -- For CUSTEPM support
  3725.    buildacceltable activeaccel, 'dokey a+'ACTIONS_ACCEL__L, AF_CHAR+AF_ALT, ACTIONS_ACCEL__A1, 1017  -- a+A
  3726.    buildacceltable activeaccel, 'dokey a+'ACTIONS_ACCEL__L, AF_CHAR+AF_ALT, ACTIONS_ACCEL__A2, 1018  -- a+a
  3727.    compile endif
  3728.    compile if BLOCK_ACTIONBAR_ACCELERATORS = 'SWITCH'
  3729.    endif -- CUA_MENU_ACCEL
  3730.    compile endif
  3731.   compile endif -- BLOCK_ACTIONBAR_ACCELERATORS
  3732.  compile endif -- INCLUDE_MENU_SUPPORT & INCLUDE_STD_MENUS
  3733.  
  3734.    buildacceltable activeaccel, 'Alt_enter 1', AF_VIRTUALKEY+AF_ALT,  VK_NEWLINE, 1080  -- Alt+Enter
  3735.    buildacceltable activeaccel, 'Alt_enter 2', AF_VIRTUALKEY+AF_ALT,    VK_ENTER, 1081  -- Alt+PadEnter
  3736.    buildacceltable activeaccel, 'Alt_enter 3', AF_VIRTUALKEY+AF_SHIFT,VK_NEWLINE, 1082  -- Shift+Enter
  3737.    buildacceltable activeaccel, 'Alt_enter 4', AF_VIRTUALKEY+AF_SHIFT,  VK_ENTER, 1083  -- Shift+PadEnter
  3738.  
  3739.  compile if defined(BLOCK_ALT_KEY)
  3740.    buildacceltable activeaccel, 'beep 2000 50', AF_VIRTUALKEY+AF_LONEKEY, VK_ALT, 1020
  3741.    buildacceltable activeaccel, 'beep 2000 50', AF_VIRTUALKEY+AF_LONEKEY, VK_ALTGRAF, 1021
  3742.  compile endif
  3743.  
  3744.    activateacceltable activeaccel
  3745.  
  3746.  compile if defined(BLOCK_ALT_KEY)
  3747. defc beep = a=arg(1); do while a<>''; parse value a with pitch duration a; call beep(pitch, duration); enddo
  3748.  compile endif
  3749.  
  3750. defc alt_enter =
  3751.  compile if ENHANCED_ENTER_KEYS & ENTER_ACTION <> ''  -- define each key separately
  3752.    universal a_enterkey, a_padenterkey, s_enterkey, s_padenterkey
  3753.    call enter_common(substr(a_enterkey||a_padenterkey||s_enterkey||s_padenterkey,arg(1),1))
  3754.  compile else
  3755.    executekey enter
  3756.  compile endif
  3757.  
  3758. defc dokey
  3759.    executekey resolve_key(arg(1))
  3760.  
  3761. defc keyin
  3762.    keyin arg(1)
  3763.  
  3764. compile endif -- EVERSION >= 5.20  (Started above loadaccel command)  ---------
  3765.  
  3766. defc rename
  3767.    name = .filename
  3768.    if name=UNNAMED_FILE_NAME then name=''; endif
  3769. compile if EVERSION >= 5.21
  3770.    parse value entrybox(RENAME__MSG, '', name, 0, 240,
  3771. ;         atoi(1) || atoi(0) || gethwndc(APP_HANDLE) ||
  3772.           atoi(1) || atoi(0) || atol(0) ||
  3773.           RENAME_PROMPT__MSG '<' directory() '>') with button 2 name \0
  3774.    if button=\1 & name<>'' then 'name' name; endif
  3775. compile else
  3776.    name = entrybox(RENAME__MSG, '', name)
  3777.    if name<>'' then 'name' name; endif
  3778. compile endif
  3779.  
  3780. defc maybe_reflow_ALL
  3781.    do i = 1 to .last
  3782.       if textline(i)<>'' then  -- Only ask if there's text in the file.
  3783.          if askyesno(REFLOW_ALL__MSG,1) = YES_CHAR then
  3784.             'reflow_all'
  3785.          endif
  3786.          leave
  3787.       endif
  3788.    enddo
  3789.  
  3790. compile if EVERSION >= 5.51
  3791. defc edit_list =
  3792.    getfileid startfid
  3793.    firstloaded = startfid
  3794.    parse arg list_sel list_ofs .
  3795.    orig_ofs = list_ofs
  3796.    do forever
  3797.       list_ptr = peek(list_sel, list_ofs, 4)
  3798.       if list_ptr == \0\0\0\0 then leave; endif
  3799.       fn = peekz(list_ptr)
  3800.       if pos(' ', fn) then
  3801.          fn = '"'fn'"'
  3802.       endif
  3803.       'e' fn
  3804.       list_ofs = list_ofs + 4
  3805.       if startfid = firstloaded then
  3806.          getfileid firstloaded
  3807.       endif
  3808.    enddo
  3809.  compile if 1  -- Now, the macros free the buffer.
  3810.    call buffer(FREEBUF, list_sel)
  3811.  compile else
  3812.    call windowmessage(1,  getpminfo(EPMINFO_OWNERCLIENT),   -- Send message to owner client
  3813.                       5486,               -- Tell it to free the buffer.
  3814.                       mpfrom2short(list_sel, orig_ofs),
  3815.                       0)
  3816.  compile endif
  3817.    activatefile firstloaded
  3818. compile endif
  3819.  
  3820. compile if EVERSION >= 5.21
  3821. ; Called with a string to set the statusline text to that string; with no argument
  3822. ; to just set the statusline color.
  3823. defc setstatusline
  3824.    universal vSTATUSCOLOR, current_status_template
  3825.    if arg(1) then
  3826.       current_status_template = arg(1)
  3827. compile if EVERSION >= 5.53
  3828.          template=atoi(length(current_status_template)) || current_status_template
  3829. compile else
  3830.          template=chr(length(current_status_template)) || current_status_template
  3831. compile endif
  3832.       template_ptr=put_in_buffer(template)
  3833.    else
  3834.       template_ptr=0
  3835.    endif
  3836.    call windowmessage(1,  getpminfo(EPMINFO_EDITCLIENT),
  3837.                       5431,      -- EPM_FRAME_STATUSLINE
  3838.                       template_ptr,
  3839.                       vSTATUSCOLOR)
  3840.  
  3841. ; Called with a string to set the messageline text to that string; with no argument
  3842. ; to just set the messageline color.
  3843. defc setmessageline
  3844.    universal vMESSAGECOLOR
  3845.    if arg(1) then
  3846. compile if EVERSION >= 5.53
  3847.       template=atoi(length(arg(1))) || arg(1)
  3848. compile else
  3849.       template=chr(length(arg(1))) || arg(1)
  3850. compile endif
  3851.       template_ptr=put_in_buffer(template)
  3852.    else
  3853.       template_ptr=0
  3854.    endif
  3855.    call windowmessage(1,  getpminfo(EPMINFO_EDITCLIENT),
  3856.                       5432,      -- EPM_FRAME_MESSAGELINE
  3857.                       template_ptr,
  3858.                       vMESSAGECOLOR)
  3859. compile endif
  3860.  
  3861. defc new
  3862.    getfileid startfid
  3863.    'xcom e /n'
  3864.    if rc<>-282 then return; endif  -- sayerror 'New file'
  3865.    getfileid newfid
  3866.    activatefile startfid
  3867.    temp = startfid  -- temp fix for some bug
  3868.    'quit'
  3869.    getfileid curfid
  3870.    activatefile newfid
  3871.    if curfid=startfid then  -- Wasn't quit; user must have said Cancel to Quit dlg
  3872.       'xcom quit'
  3873.    endif
  3874.  
  3875. compile if SUPPORT_USERS_GUIDE | SUPPORT_TECHREF
  3876. defc viewword  -- arg(1) is name of .inf file
  3877.    if find_token(startcol, endcol) then
  3878.       'view' arg(1) substr(textline(.line), startcol, (endcol-startcol)+1)
  3879.    endif
  3880. compile endif
  3881.  
  3882. defc cascade_menu
  3883.    parse arg menuid defmenuid .
  3884. ; if dos_version()>=2000 then
  3885.    menuitem = copies(\0, 16)  -- 2 bytes ea. pos'n, style, attribute, identity; 4 bytes submenu hwnd, long item
  3886.    if not windowmessage(1,
  3887.                         getpminfo(EPMINFO_EDITMENUHWND),
  3888.                         386,                  -- x182, MM_QueryItem
  3889.                         menuid + 65536,
  3890.                         ltoa(offset(menuitem) || selector(menuitem), 10) )
  3891.    then return; endif
  3892.    hwnd = substr(menuitem, 9, 4)
  3893.  
  3894.    call dynalink('PMWIN',
  3895.                  'WINSETWINDOWBITS',
  3896.                   rightstr(hwnd,2)   || leftstr(hwnd,2) ||
  3897.                   atoi(-2)           ||  -- QWL_STYLE
  3898.                   atol_swap(64)      ||  -- MS_CONDITIONALCASCADE
  3899.                   atol_swap(64) )        -- MS_CONDITIONALCASCADE
  3900.    if defmenuid<>'' then  -- Default menu item
  3901.       call windowmessage(1,
  3902.                          ltoa(hwnd,10),
  3903.                          1074,                  -- x432, MM_SETDEFAULTITEMID
  3904.                          defmenuid, 0)  -- Make arg(2) the default menu item
  3905.    endif
  3906. ; endif
  3907.  
  3908. compile if 0
  3909. defc QueryHLP = sayerror '"'QueryCurrentHLPFiles()'"'
  3910. defproc QueryCurrentHLPFiles()
  3911.    universal CurrentHLPFiles;
  3912.    return CurrentHLPFiles;
  3913.  
  3914. defc setHLP = sayerror '"'SetCurrentHLPFiles(arg(1))'"'
  3915. defproc SetCurrentHLPFiles(newlist)
  3916.    universal CurrentHLPFiles;
  3917.    hwndHelpInst = windowmessage(1,  getpminfo(APP_HANDLE),
  3918.  compile if EPM32
  3919.                       5429,      -- EPM_Edit_Query_Help_Instance
  3920.  compile else
  3921.                       5139,      -- EPM_QueryHelpInstance
  3922.  compile endif -- EPM32
  3923.                       0,
  3924.                       0)
  3925.    if hwndHelpInst==0 then
  3926.       -- there isn't a help instance deal with.
  3927.       return "No Help Instance";
  3928.    endif
  3929.  
  3930.    newlist2 = newlist || chr(0);
  3931.    retval = windowmessage(1,  hwndHelpInst,
  3932.                        557,    -- HM_SET_HELP_LIBRARY_NAME
  3933.                        ltoa(offset(newlist2) || selector(newlist2), 10),
  3934.                        0)
  3935.    if retval==0 then
  3936.       -- it worked, now remember what you told it.
  3937.       CurrentHLPFiles = newlist;
  3938.    else
  3939.       -- failed for some reason, anyway, we had better revert to
  3940.       --   the previous version of the HLP list.
  3941.       if CurrentHLPFiles=="" then
  3942.          CurrentHLPFiles = " ";
  3943.       endif
  3944.       newlist2 = CurrentHLPFiles || chr(0);
  3945.       retval2 = windowmessage(1,  hwndHelpInst,
  3946.                           557,    -- HM_SET_HELP_LIBRARY_NAME
  3947.                           ltoa(offset(newlist2) || selector(newlist2), 10),
  3948.                           0)
  3949.       if retval2==0 then
  3950.          -- whew, we were able to revert to the old list
  3951.          return retval;
  3952.       else
  3953.          return "two errors" retval retval2;
  3954.       endif
  3955.    endif
  3956.  
  3957. compile endif
  3958.  
  3959. compile if KEEP_CURSOR_ON_SCREEN & EVERSION >= 5.60
  3960. -- This should move the cursor at the end of every scroll bar action.  The
  3961. -- position to which it is moved should correspond to the location of the
  3962. -- cursor (relative to the window) at the time when the scroll began.
  3963.  
  3964. defc processendscroll
  3965.    universal beginscroll_x, beginscroll_y;
  3966.    .cursorx = beginscroll_x;
  3967.    .cursory = beginscroll_y;
  3968.  
  3969. defc processbeginscroll
  3970.    universal beginscroll_x, beginscroll_y;
  3971.    beginscroll_x = .cursorx;
  3972.    beginscroll_y = .cursory;
  3973. compile endif  -- KEEP_CURSOR_ON_SCREEN & EVERSION >= 5.60
  3974.  
  3975. compile if EVERSION >= 5.60
  3976. defc setpresparam
  3977.    universal statfont, msgfont
  3978.    universal vSTATUSCOLOR, vMESSAGECOLOR, vDESKTOPColor
  3979.    parse value arg(1) with whichctrl " hwnd="hwnd " x="x "y="y rest
  3980.    if (whichctrl=="STATFONTSIZENAME") or (whichctrl=="MSGFONTSIZENAME") then
  3981.       parse value rest with "string="psize"."facename"."attr
  3982.       -- psize is pointsize, facename is facename, attr is "Bold" etc
  3983.       "setstatface" hwnd facename
  3984.       "setstatptsize" hwnd psize
  3985.       if leftstr(whichctrl,1)='S' then  -- "STATFONTSIZENAME"
  3986.          statfont = substr(rest,8)
  3987.       else                              -- "MSGFONTSIZENAME"
  3988.          msgfont = substr(rest,8)
  3989.          sayerror MESSAGELINE_FONT__MSG
  3990.       endif
  3991.    elseif (whichctrl=="STATFGCOLOR") or (whichctrl=="MSGFGCOLOR") then
  3992.       parse value rest with "rgb="rgb "clrattr="clrattr "oldfgattr="oldfgattr "oldbgattr="oldbgattr
  3993.       call windowmessage(0,  hwnd,
  3994.                          4099,      -- STATWNDM_SETCOLOR
  3995.                          clrattr,
  3996.                          oldbgattr)
  3997.       if leftstr(whichctrl,1)='M' then
  3998.          sayerror MESSAGELINE_FGCOLOR__MSG
  3999.          vMESSAGECOLOR = clrattr + 16 * oldbgattr
  4000.       else
  4001.          vSTATUSCOLOR = clrattr  + 16 * oldbgattr
  4002.       endif
  4003.    elseif (whichctrl=="STATBGCOLOR") or (whichctrl=="MSGBGCOLOR") then
  4004.       parse value rest with "rgb="rgb "clrattr="clrattr "oldfgattr="oldfgattr "oldbgattr="oldbgattr
  4005.       call windowmessage(0,  hwnd,
  4006.                          4099,      -- STATWNDM_SETCOLOR
  4007.                          oldfgattr,
  4008.                          clrattr)
  4009.       if leftstr(whichctrl,1)='M' then
  4010.          sayerror MESSAGELINE_BGCOLOR__MSG
  4011.          vMESSAGECOLOR = clrattr * 16 + oldfgattr
  4012.       else
  4013.          vSTATUSCOLOR = clrattr  * 16 + oldfgattr
  4014.       endif
  4015.    elseif (whichctrl=="EDITBGCOLOR") then
  4016.       parse value rest with "rgb="rgb "clrattr="clrattr "oldfgattr="oldfgattr "oldbgattr="oldbgattr
  4017.       map_point 5, x, y, off, comment;  -- map screen to line
  4018.       if x<1 | x>.last then
  4019.          vDESKTOPColor = clrattr
  4020.          call windowmessage(0, getpminfo(EPMINFO_EDITCLIENT), 5497, clrattr, 0)
  4021.       else
  4022.          .textcolor = (.textcolor // 16) + 16 * clrattr;
  4023.       endif
  4024.    elseif (whichctrl=="EDITFGCOLOR") then
  4025.       parse value rest with "rgb="rgb "clrattr="clrattr "oldfgattr="oldfgattr "oldbgattr="oldbgattr
  4026.       .textcolor = .textcolor - (.textcolor // 16) + clrattr;
  4027.    elseif whichctrl=="EDITFONTSIZENAME" then
  4028.       parse value rest with "string="psize"."facename"."attr
  4029.       -- psize is pointsize, facename is facename, attr is "Bold" etc
  4030.       fontsel = 0
  4031.       do while attr<>''
  4032.          parse value attr with thisattr '.' attr
  4033.          if     thisattr='Italic'     then fontsel = fontsel + 1
  4034.          elseif thisattr='Underscore' then fontsel = fontsel + 2
  4035.          elseif thisattr='Outline'    then fontsel = fontsel + 8
  4036.          elseif thisattr='Strikeout'  then fontsel = fontsel + 16
  4037.          elseif thisattr='Bold'       then fontsel = fontsel + 32
  4038.          endif
  4039.       enddo
  4040.       .font = registerfont(facename ,psize, fontsel)
  4041.    else
  4042.       sayerror "unknown presentation parameter change '"whichctrl"'"
  4043.       return;
  4044.    endif
  4045. ;   sayerror "set presparm with" hwnd " as the window" arg(1);
  4046.  
  4047. defc setstatface
  4048.    parse value arg(1) with hwnd face
  4049.    return windowmessage(0,  hwnd /*getpminfo(EPMINFO_EDITFRAME)*/,   -- Post message to edit client
  4050.                         4104,        -- STATWNDM_PREFFONTFACE
  4051.                         put_in_buffer(face),
  4052.                         1);  -- COMMAND_FREESEL
  4053.  
  4054. defc setstatptsize
  4055.    parse value arg(1) with hwnd ptsize
  4056.    return windowmessage(0,  hwnd /*getpminfo(EPMINFO_EDITFRAME)*/,   -- Post message to edit client
  4057.                         4106,        -- STATWNDM_PREFFONTPTSIZE
  4058.                         ptsize,
  4059.                         0);
  4060. compile endif  -- EVERSION >= 5.60
  4061.  
  4062. compile if EPM32
  4063. defproc Thunk(pointer)
  4064.   return atol_swap(dynalink32('ETKE600',
  4065.                               'FlatToSel',
  4066.                               pointer, 2) )
  4067. compile endif -- EPM32
  4068.  
  4069. compile if not EXTRA_EX
  4070. include 'EPM_EA.E'
  4071. compile endif
  4072.  
  4073. defc echoback
  4074.    parse arg postorsend hwnd messageid mp1 mp2 .
  4075.    call windowmessage(postorsend,
  4076.                       hwnd,
  4077.                       messageid,
  4078.                       mp1,
  4079.                       mp2)
  4080.  
  4081. compile if WANT_TOOLBAR
  4082. ;  load_actions
  4083. ;     This defc is called by the etke*.dll to generate the list of actions
  4084. ;     for UCMENUS in the hidden file called actlist.
  4085. ;     If called with a pointer parameter a buffer is create in which
  4086. ;     the list of actions are placed. If called without any parameter
  4087. ;     the actlist file is generated.
  4088. ;     John Ponzo 8/93
  4089. ;     Optimized by LAM
  4090.  
  4091. defc load_actions
  4092.    universal ActionsList_FileID
  4093.  
  4094. ;Keep track of the active file
  4095.    getfileid ActiveFileID
  4096.  
  4097. ;See if the actlist file is already loaded, if not load it
  4098. ;; getfileid ActionsList_FileID, 'actlist'
  4099.  
  4100.    if ActionsList_FileID <> '' then  -- Make sure it's still loaded.
  4101.       rc = 0
  4102.       display -2
  4103.       activatefile ActionsList_FileID
  4104.       display 2
  4105.       if rc=-260 then ActionsList_FileID = ''; endif
  4106.    endif
  4107.  
  4108.    if ActionsList_FileID == '' then  -- Must create
  4109.       'xcom e /c actlist'
  4110.       if rc<>-282 then  -- sayerror('New file')
  4111.          sayerror ERROR__MSG rc BAD_TMP_FILE__MSG sayerrortext(rc)
  4112.          return
  4113.       endif
  4114.       getfileid ActionsList_FileID
  4115.       .visible = 0
  4116.  
  4117. ;load the actions.lst file which contain the names of all the EX modules
  4118. ;that have UCMENU actions defined.
  4119.       getfileid ActionsEXModuleList_FileID, 'actions.lst'
  4120.  
  4121.       if ActionsEXModuleList_FileID == '' then
  4122. compile if USE_APPEND or (WANT_SEARCH_PATH and WANT_GET_ENV and not SMALL)
  4123.          'ep actions.lst'  -- Search EPMPATH also.
  4124. compile else
  4125.          'e actions.lst'
  4126. compile endif
  4127.          if rc=-282 then  -- "New file"
  4128.             deleteline 1
  4129.             .modify = 0
  4130.          elseif rc then
  4131.             sayerror ERROR__MSG rc '"actions.lst"' sayerrortext(rc)
  4132.             return
  4133.          endif
  4134.          getfileid ActionsEXModuleList_FileID
  4135. ;;       ActionsEXModuleList_FileID.visible = 0
  4136.          quit_list = 1
  4137.       else
  4138.          quit_list = 0
  4139.       endif
  4140. ;load all the EX Modules in actlist.lst, and call EX modules
  4141. ;actionlist defc.
  4142.       for i = 1 to ActionsEXModuleList_FileID.last
  4143.          getline  exmodule, i, ActionsEXModuleList_FileID
  4144.          not_linked = linked(exmodule) < 0
  4145.          if not_linked then
  4146.             'link' exmodule
  4147.          endif
  4148.          exmodule'_actionlist'
  4149.          if not_linked then
  4150.             'unlink' exmodule
  4151.          endif
  4152.       endfor
  4153.       if quit_list then
  4154.          activatefile ActionsEXModuleList_FileID
  4155.          'quit'
  4156.       endif
  4157.    endif  -- ActionsList_FileID == ''
  4158.  
  4159. ;if called with a parameter send EFRAME_ACTIONSLIST message to the frame
  4160. ;of the edit window. mp1 is a buffer containing all of the actions loaded
  4161. ;in the hidden file actlist.
  4162.    if arg(1)  then
  4163.       activatefile ActionsList_FileID
  4164.       buflen = filesize() + .last + 1
  4165.       bufhandle = buffer(CREATEBUF, '', buflen, 1)
  4166.       if not bufhandle then sayerror 'CREATEBUF' ERROR_NUMBER__MSG RC; return; endif
  4167.       buffer(PUTBUF, bufhandle, 1, ActionsList_FileID.last, NOHEADER+FINALNULL+APPENDCR)
  4168.       if word(arg(1),1) <> 'ITEMCHANGED' then
  4169.          windowmessage(0, getpminfo(EPMINFO_EDITFRAME), 5913, bufhandle, arg(1))
  4170.       else
  4171.          windowmessage(0, getpminfo(EPMINFO_EDITFRAME), 5918, bufhandle, subword(arg(1),2))
  4172.       endif
  4173.    endif
  4174.    activatefile ActiveFileID
  4175.  
  4176. ;  ExecuteAction
  4177. ;     This defc is called to resolve UCMENU actions.
  4178. ;     It is called with the first parameter being the action name,
  4179. ;     and the second parameter being an action sub-op.
  4180. ;     If the action (Which is a Defc) is not defined the actions list
  4181. ;     is generated in order to try resolving the defc.
  4182.  
  4183. defc ExecuteAction
  4184.    universal ActionsList_FileID
  4185.    parse arg DefcModule DefcName DefcParameter
  4186. ;sayerror 'executeaction: "'arg(1)'"'
  4187.  
  4188.    if DefcName='*' then
  4189.       DefcParameter
  4190.    else
  4191.       if defcmodule<>'*' then
  4192.          if linked(defcmodule) < 0 then
  4193.             link defcmodule
  4194.          endif
  4195.       endif
  4196.       if isadefc(DefcName) then
  4197. ;sayerror 'executeaction: executing cmd "'DefcName'" with parm "'DefcParameter'"'
  4198.          DefcName DefcParameter
  4199.       else
  4200.         sayerror 'Can not resolve action' DefcName
  4201.       endif
  4202.    endif
  4203.  
  4204. defc load_toolbar
  4205.    call list_toolbars(LOAD_TOOLBAR__MSG, SELECT_TOOLBAR__MSG, 7000, 5916)
  4206.  
  4207. defproc list_toolbars(list_title, list_prompt, help_panel, msgid)
  4208.    universal app_hini
  4209.    App = INI_UCMENU_APP\0
  4210.    inidata = copies(' ',1600)
  4211.  compile if EPM32
  4212.    retlen = \0\0\0\0
  4213.    l = dynalink32('PMSHAPI',
  4214.                   'PRF32QUERYPROFILESTRING',
  4215.                   atol(app_hini)    ||  -- HINI_PROFILE
  4216.                   address(App)      ||  -- pointer to application name
  4217.                   atol(0)           ||  -- Key name is NULL; returns all keys
  4218.                   atol(0)           ||  -- Default return string is NULL
  4219.                   address(inidata)  ||  -- pointer to returned string buffer
  4220.                   atol(1600)        ||  -- max length of returned string
  4221.                   address(retlen), 2)   -- length of returned string
  4222.  compile else
  4223.    l =  dynalink( 'PMSHAPI',
  4224.                   'PRFQUERYPROFILESTRING',
  4225.                   atol(app_hini)   ||  -- HINI_PROFILE
  4226.                   address(App)     ||  -- pointer to application name
  4227.                   atol(0)          ||  -- Key name is NULL; returns all keys
  4228.                   atol(0)          ||  -- Default return string is NULL
  4229.                   address(inidata) ||  -- pointer to returned string buffer
  4230.                   atol_swap(1600), 2)  -- max length of returned string
  4231.  compile endif
  4232.  
  4233.    if not l then sayerror NO_TOOLBARS__MSG; return; endif
  4234.    inidata=leftstr(inidata,l)
  4235.    'xcom e /c /q tempfile'
  4236.    if rc<>-282 then  -- sayerror('New file')
  4237.       sayerror ERROR__MSG rc BAD_TMP_FILE__MSG sayerrortext(rc)
  4238.       return
  4239.    endif
  4240.    .autosave = 0
  4241.    browse_mode = browse()     -- query current state
  4242.    if browse_mode then call browse(0); endif
  4243.    do while inidata<>''
  4244.       parse value inidata with menuname \0 inidata
  4245.       insertline menuname, .last+1
  4246.    enddo
  4247.    if browse_mode then call browse(1); endif  -- restore browse state
  4248.    buflen = filesize() + .last + 1
  4249.    bufhndl = buffer(CREATEBUF, 'LISTBOX', buflen, 1 )  -- create a private buffer
  4250.    if not bufhndl then sayerror 'CREATEBUF' ERROR_NUMBER__MSG RC; return; endif
  4251.    noflines = buffer(PUTBUF,   bufhndl, 1, 0, APPENDCR)
  4252.    last = .last
  4253.    .modify = 0
  4254.    'xcom quit'
  4255.    if not noflines then sayerror 'PUTBUF' ERROR_NUMBER__MSG RC; return; endif
  4256.    usedsize = buffer(USEDSIZEBUF,bufhndl)
  4257.    parse value listbox(list_title, \0 || atol(usedsize) || atoi(32) || atoi(bufhndl),
  4258.                        '/'OK__MSG'/'Cancel__MSG'/'Help__MSG,1,5,min(noflines,12),0,
  4259.                        gethwndc(APP_HANDLE) || atoi(1) || atoi(1) || atoi(help_panel) ||
  4260.                        list_prompt) with button 2 menuname \0
  4261.    call buffer(FREEBUF, bufhndl)
  4262.    if button<>\1 then return; endif
  4263.    call windowmessage(0, getpminfo(EPMINFO_EDITFRAME), msgid, app_hini, put_in_buffer(menuname))
  4264.  
  4265. defc delete_toolbar
  4266.    call list_toolbars(DELETE_TOOLBAR__MSG, SELECT_TOOLBAR__MSG, 7001, 5919)
  4267.  
  4268. defc save_toolbar
  4269.    universal app_hini
  4270.    parse value entrybox(SAVEBAR__MSG,'/'SAVE__MSG'/'Cancel__MSG'/'Help__MSG'/',\0,'',200,
  4271.           atoi(1) || atoi(7010) || gethwndc(APP_HANDLE) ||
  4272.           SAVEBAR_PROMPT__MSG) with button 2 menuname \0
  4273.    if button <> \1 then return; endif
  4274.    if menuname='' then
  4275.       menuname = 'Default'
  4276.    endif
  4277.    call windowmessage(0, getpminfo(EPMINFO_EDITFRAME), 5915, app_hini, put_in_buffer(menuname))
  4278.  
  4279. defc loaddefaulttoolbar
  4280.   universal activeucmenu
  4281. ; activeucmenu = 10
  4282.   activeucmenu = 'Toolbar'
  4283. ;                              Button text # Button bitmap # command # .ex file
  4284.   buildsubmenu activeucmenu,  1, "Msgs#info.bmp#a_Messages#sampactn", '', 0, 0
  4285.   buildsubmenu activeucmenu,  2, "Add New#EPMadd.bmp#a_Add_New#sampactn", '', 0, 0
  4286.   buildsubmenu activeucmenu,  3, "Open#EPM.bmp#a_Open_empty#sampactn", '', 0, 0
  4287.   buildsubmenu activeucmenu,  4, "NewWind#newwindw.bmp#a_NewWindow#sampactn", '', 0, 0
  4288.   buildsubmenu activeucmenu,  5, "Settings#settings.bmp#a_Settings#sampactn", '', 0, 0
  4289.   buildsubmenu activeucmenu,  6, "Time#clock.bmp#a_Time#sampactn", '', 0, 0
  4290.   buildsubmenu activeucmenu,  7, "MonoFont#monofont.bmp#a_MonoFont#sampactn", '', 0, 0
  4291.   buildsubmenu activeucmenu,  8, "Reflow#reflow.bmp#reflow_prompt#reflow", '', 0, 0
  4292.   buildsubmenu activeucmenu,  9, "Jot#idea.bmp#jot_a_note#jot", '', 0, 0
  4293.   buildsubmenu activeucmenu, 10, "Shell#epmshell.bmp#a_Shell#sampactn", '', 0, 0
  4294.   buildsubmenu activeucmenu, 11, "List Ring#ringlist.bmp#a_List_Ring#sampactn", '', 0, 0
  4295.   showmenu activeucmenu, 3
  4296.  
  4297. defc deletetemplate
  4298.    universal app_hini
  4299.    parse arg template_name
  4300.    if template_name='' then
  4301.       template_name = 'Default'
  4302.    endif
  4303.    call windowmessage(0, getpminfo(EPMINFO_EDITFRAME), 5919, app_hini, put_in_buffer(template_name))
  4304.  
  4305.  compile if WANT_NODISMISS_MENUS
  4306. defc toggle_toolbar
  4307.    fon = queryframecontrol(EFRAMEF_TOOLBAR)  -- Query now, since toggling is asynch.
  4308.    'toggleframe' EFRAMEF_TOOLBAR
  4309.    SetMenuAttribute( 430, 8192, fon)
  4310.  compile endif  -- WANT_NODISMISS_MENUS
  4311.  
  4312. compile endif -- WANT_TOOLBAR
  4313.