home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / wps / editor / epmtools / epmmac / mouse.e < prev    next >
Text File  |  1993-07-21  |  35KB  |  877 lines

  1. compile if EVERSION < 5
  2.    *** Error:  This file supports EPM only, not earlier versions of E.
  3. compile endif
  4.  
  5. compile if not defined(SMALL)  -- If SMALL not defined, then being separately compiled
  6.    include 'stdconst.e'
  7.    include 'colors.e'
  8.  define INCLUDING_FILE = 'MOUSE.E'
  9.    tryinclude 'MYCNF.E'        -- Include the user's configuration customizations.
  10.  
  11.  compile if not defined(SITE_CONFIG)
  12.     const SITE_CONFIG = 'SITECNF.E'
  13.  compile endif
  14.  compile if SITE_CONFIG
  15.     tryinclude SITE_CONFIG
  16.  compile endif
  17.  
  18. const
  19.  compile if not defined(WANT_CUA_MARKING)
  20.    WANT_CUA_MARKING = 0
  21.  compile endif
  22.  compile if not defined(WANT_STREAM_MODE)
  23.    WANT_STREAM_MODE = 0
  24.  compile endif
  25.  compile if not defined(NLS_LANGUAGE)
  26.    NLS_LANGUAGE = 'ENGLISH'
  27.  compile endif
  28.  compile if not defined(WANT_KEYWORD_HELP)
  29.    WANT_KEYWORD_HELP = 0
  30.  compile endif
  31.  include NLS_LANGUAGE'.e'
  32. compile endif
  33.  
  34. const
  35. compile if not defined(EPM_POINTER)
  36.  compile if EVERSION < 5.50
  37.    EPM_POINTER = SYSTEM_POINTER    -- AVIO version gets arrow pointer
  38.  compile else
  39.    EPM_POINTER = TEXT_POINTER      -- GPI version gets text pointer
  40.  compile endif
  41. compile endif
  42. compile if not defined(LOCAL_MOUSE_SUPPORT)
  43.    LOCAL_MOUSE_SUPPORT = 0
  44. compile endif
  45. compile if not defined(TOP_OF_FILE_VALID)
  46.    TOP_OF_FILE_VALID = 1
  47. compile endif
  48. compile if not defined(DRAG_ALWAYS_MARKS)
  49.    DRAG_ALWAYS_MARKS = 0
  50. compile endif
  51. compile if not defined(WANT_MMEDIA)
  52.    WANT_MMEDIA = 0
  53. compile endif
  54. compile if not defined(WANT_SPEECH)
  55.    WANT_SPEECH = 0
  56. compile endif
  57. compile if not defined(UNDERLINE_CURSOR)
  58.    UNDERLINE_CURSOR = 0
  59. compile endif
  60.  
  61.  
  62. const
  63.   BlankMouseHandler = "BlankMouseHandler"
  64.   TransparentMouseHandler = "TransparentMouseHandler"
  65.  
  66. define
  67. compile if EVERSION < 5.50
  68.    CHARG_MARK =  'CHAR'
  69.    BLOCKG_MARK = 'BLOCK'
  70. compile else                -- New mark types
  71.    CHARG_MARK =  'CHARG'
  72.    BLOCKG_MARK = 'BLOCKG'
  73. compile endif
  74.  
  75. compile if EVERSION >= 5.20
  76. defproc prestore_pos2(save_pos)
  77.    parse value save_pos with svline svcol svsx svsy
  78.    compile if EVERSION >= 5.50
  79.       .lineg = min(svline, .last);                       -- set .line
  80.    compile else
  81.       min(svline, .last);                       -- set .line
  82.    compile endif
  83.    .col = svcol;
  84.    .scrollx = svsx;
  85.    compile if EVERSION >= 5.50
  86.       .cursoryg= svsy;
  87.    compile else
  88.       .scrolly = svsy;
  89.    compile endif
  90.  
  91. defproc psave_pos2(var save_pos)
  92.    compile if EVERSION >= 5.50
  93.       save_pos=.line .col .scrollx .cursoryg
  94.    compile else
  95.       save_pos=.line .col .scrollx .scrolly
  96.    compile endif
  97. compile endif
  98.  
  99. defproc MouseLineColOff(var MouseLine, var MouseCol, var MouseOff, minline)
  100.                         -- MIN = 0 for positioning, 1 for marking.
  101.    xxx = .mousex; mx = xxx
  102.    yyy = .mousey
  103.  
  104.    -- saying 5.21, below, but not sure if it will work for that.
  105.    --    it will work for 5.50.
  106.  
  107.    compile if EVERSION >= 5.21
  108.       --call messagenwait("xxx1="xxx "yyy1="yyy);
  109.       map_point 5, xxx, yyy, off, comment;  -- map screen to line
  110.       --call messagenwait("doc xxx2="xxx "yyy2="yyy);
  111.    compile else
  112.       --call messagenwait("xxx1="xxx "yyy1="yyy);
  113.       map_point 1, xxx, yyy, off, comment;  -- map screen to doc
  114.       --call messagenwait("doc xxx2="xxx "yyy2="yyy);
  115.       map_point 2, xxx, yyy, off, comment;  -- map doc to line/col/offset
  116.       --call messagenwait("line="xxx "col="yyy "off="off);
  117.    compile endif
  118.    MouseLine = min(max(xxx, minline), .last)
  119.    MouseOff  = off
  120. compile if EVERSION >= 5.50  -- can go to MAXCOL+1 for GPI-style marking
  121.    if arg(6) then  -- Flag we want character we're on, not nearest intersection.
  122.       lne = xxx
  123.       col = yyy
  124.       map_point 6, lne, col, off, comment;  -- map line/col/offset to screen
  125.       if lne>mx then  -- The intersection selected is to the right of the mouse pointer;
  126.          yyy = yyy - 1  -- the character clicked on is the one to the left.
  127.       endif             -- Note:  could get col. 0 this way, the but following takes care of that.
  128.    endif
  129.    MouseCol  = min(max(yyy, 1), MAXCOL + (rightstr(arg(5),1)='G' and minline))
  130. compile else
  131.    MouseCol  = min(max(yyy, 1), MAXCOL)
  132. compile endif
  133.    return xxx
  134.  
  135. defproc SetMouseSet(IsGlobal, NewMSName)
  136.    universal GMousePrefix
  137.    universal LMousePrefix
  138.    universal EPM_utility_array_ID
  139.    if IsGlobal then
  140.       GMousePrefix = NewMSName"."
  141. compile if LOCAL_MOUSE_SUPPORT
  142.    else
  143.       LMousePrefix = NewMSName"."
  144.       -- Remember Local MouseSet
  145.       getfileid ThisFile;
  146.       do_array 2, EPM_utility_array_ID, "LocalMausSet."ThisFile, NewMSName
  147. compile endif
  148.    endif
  149.  
  150. compile if 0  -- Now in SELECT.E, only if LOCAL_MOUSE_SUPPORT = 1
  151. defselect
  152.    universal LMousePrefix
  153.    universal EPM_utility_array_ID
  154.    getfileid ThisFile
  155.    OldRC = Rc
  156.    rc = get_array_value(EPM_utility_array_ID, "LocalMausSet."ThisFile, NewMSName)
  157.    if RC then
  158.       if rc=-330 then
  159.          -- no mouseset bound to file yet, assume blank.
  160.          LMousePrefix = TransparentMouseHandler"."
  161.       else
  162.          call messagenwait('RC='RC)
  163.       endif
  164.       RC = OldRC
  165.    else
  166.       LMousePrefix = NewMSName"."
  167.    endif
  168. compile endif
  169.  
  170. defc processmousedropping
  171.    call psave_pos(savepos)
  172.    'MH_gotoposition'
  173.    'GetSharBuff'     -- See clipbrd.e for details
  174.    call prestore_pos(savepos)
  175.  
  176. defc processmouse
  177.    universal EPM_utility_array_ID
  178.    universal GMousePrefix
  179.    universal LMousePrefix
  180.    if LMousePrefix<>BlankMouseHandler"." then
  181.       OldRc = rc
  182. compile if LOCAL_MOUSE_SUPPORT
  183.       rc = get_array_value(EPM_utility_array_ID, LMousePrefix||arg(1), CommandString)
  184.       if not rc then
  185.          -- Found it.
  186.          Rc = oldRC
  187.          if CommandString<>'' then
  188.             CommandString
  189.             return
  190.          endif
  191.       else
  192.          if rc<>-330 then
  193.             sayerror UNKNOWN_MOUSE_ERROR__MSG rc
  194.             rc = OldRc
  195.             return
  196.          endif
  197.          -- rc==-330 (no local handler found), now try to find a global one.
  198.       endif
  199. compile endif
  200.       if GMousePrefix<>BlankMouseHandler"." then
  201.          rc = get_array_value(EPM_utility_array_ID, GMousePrefix||arg(1), CommandString)
  202.          if not rc then
  203.             -- Found it.
  204.             Rc = oldRC
  205.             if CommandString<>'' then
  206.                CommandString
  207.             endif
  208.             return
  209.          else
  210.             if rc<>-330 then
  211.                sayerror UNKNOWN_MOUSE_ERROR__MSG rc
  212.             else
  213.                -- nothing assigned to that action
  214.             endif
  215.             rc = OldRc
  216.             return
  217.          endif
  218.       endif
  219.    endif
  220.  
  221.  
  222. defproc register_mousehandler(IsGlobal, event, mcommand)
  223.    universal EPM_utility_array_ID
  224.    universal GMousePrefix
  225.    universal LMousePrefix
  226.    if IsGlobal then
  227.       MousePrefix = GMousePrefix
  228.    else
  229. compile if LOCAL_MOUSE_SUPPORT
  230.       if (LMousePrefix=BlankMouseHandler".") or
  231.          (LMousePrefix=TransparentMouseHandler".") then
  232.          -- can't assign to that mouse handler.
  233. compile endif
  234.          return
  235. compile if LOCAL_MOUSE_SUPPORT
  236.       endif
  237.       MousePrefix = LMousePrefix
  238. compile endif
  239.    endif
  240.    do_array 2, EPM_utility_array_ID, MousePrefix||event, mcommand   -- assign
  241.  
  242. defc MH_gotoposition
  243. compile if WANT_STREAM_MODE = 'SWITCH'
  244.    universal stream_mode
  245. compile endif
  246.    -- this procedure moves the cursor to the current mouse location.
  247. ;;
  248. ;;  Old way
  249. ;;
  250. ;;   .cursory = .mousey
  251. ;;   .cursorx = .mousex
  252. ;;
  253. compile if TOP_OF_FILE_VALID
  254.  compile if UNDERLINE_CURSOR
  255.    ml = MouseLineColOff(MouseLine, MouseCol, MouseOff, 0, '', 1)
  256.  compile else
  257.    ml = MouseLineColOff(MouseLine, MouseCol, MouseOff, 0)
  258.  compile endif
  259. compile else
  260.  compile if UNDERLINE_CURSOR
  261.    ml = MouseLineColOff(MouseLine, MouseCol, MouseOff, 1, '', 1)
  262.  compile else
  263.    ml = MouseLineColOff(MouseLine, MouseCol, MouseOff, 1)
  264.  compile endif
  265. compile endif
  266. compile if EVERSION >= 5.20
  267.    oldsx = .scrollx;
  268.  compile if EVERSION >= 5.50
  269.    .lineg = MouseLine
  270.  compile else
  271.    oldsy = .scrolly;
  272.    MouseLine
  273.  compile endif
  274. compile else
  275.    MouseLine
  276. compile endif
  277. compile if WANT_STREAM_MODE
  278.  compile if WANT_STREAM_MODE = 'SWITCH'
  279.    if stream_mode & ml > .last then
  280.  compile else
  281.    if ml > .last then      -- If click below "Bottom of File",
  282.  compile endif
  283.       end_line             --   go to end of last line.
  284.    else
  285. compile endif  -- WANT_STREAM_MODE
  286.       .col  = MouseCol
  287.       while MouseOff<0 do
  288.          left
  289.          MouseOff = MouseOff + 1
  290.       endwhile
  291.       while MouseOff>0 do
  292.          right
  293.          MouseOff = MouseOff - 1
  294.       endwhile
  295. compile if WANT_STREAM_MODE
  296.    endif
  297. compile endif  -- WANT_STREAM_MODE
  298. compile if WANT_STREAM_MODE
  299.  compile if WANT_STREAM_MODE = 'SWITCH'
  300.    if stream_mode then
  301.  compile endif
  302.    if .col > length(textline(.line)) then
  303.       end_line
  304.    endif
  305.  compile if WANT_STREAM_MODE = 'SWITCH'
  306.    endif
  307.  compile endif
  308. compile endif
  309. compile if EVERSION >= 5.20
  310.    .scrollx = oldsx;
  311.    compile if EVERSION >= 5.50
  312.    compile else
  313.       .scrolly = oldsy;
  314.    compile endif
  315. compile endif
  316.  
  317. defc MH_begin_mark
  318.    universal BeginningLineOfDrag
  319.    universal BeginningColOfDrag
  320. compile if WANT_CUA_MARKING = 'SWITCH'
  321.    universal CUA_marking_switch
  322. compile endif
  323. compile if WANT_STREAM_MODE = 'SWITCH'
  324.    universal stream_mode
  325. compile endif
  326. compile if 0
  327.    mt = upcase(arg(1))
  328.    if marktype() then
  329.       getfileid curfileid
  330.       getmark markfirstline,marklastline,markfirstcol,marklastcol,markfileid
  331.       if marktype() <> mt or markfileid <> curfileid then
  332.          sayerror -279  -- sayerror('Text already marked')
  333.          return
  334.       endif
  335.    endif
  336. compile elseif WANT_CUA_MARKING = 1 | DRAG_ALWAYS_MARKS
  337.    unmark
  338.    'ClearSharBuff'       /* Remove Content in EPM shared text buffer */
  339. compile else
  340.  compile if WANT_CUA_MARKING = 'SWITCH'
  341.    if CUA_marking_switch then
  342.       unmark
  343.       'ClearSharBuff'       /* Remove Content in EPM shared text buffer */
  344.    endif
  345.  compile endif
  346.    if marktype() then
  347.       sayerror-279  --  sayerror('Text already marked')
  348.       return
  349.    endif
  350. compile endif
  351.    ml = MouseLineColOff(BeginningLineOfDrag, BeginningColOfDrag, MouseOff, 1, arg(1));
  352. compile if WANT_STREAM_MODE
  353.  compile if WANT_STREAM_MODE = 'SWITCH'
  354.    if stream_mode & ml > .last then
  355.  compile else
  356.    if ml > .last then      -- If click below "Bottom of File" ...
  357.  compile endif
  358.       BeginningLineOfDrag = .last
  359.       BeginningColOfDrag = length(textline(.last))+1
  360.    endif
  361. compile endif  -- WANT_STREAM_MODE
  362.    call register_mousehandler(1, 'ENDDRAG',    'MH_end_mark '||arg(1))  -- shifted
  363.    call register_mousehandler(1, 'CANCELDRAG', 'MH_cancel_mark')  -- shifted
  364.    if upcase(arg(1))='LINE' then
  365.       .DragStyle = 2
  366.    elseif leftstr(upcase(arg(1)),5)='BLOCK' then
  367.       .DragStyle = 1
  368.    elseif leftstr(upcase(arg(1)),4)='CHAR' then
  369.       .DragStyle = 3
  370.    endif
  371.    mouse_setpointer MARK_POINTER
  372. compile if DRAGCOLOR<>''
  373.    .DragColor = DRAGCOLOR
  374. compile else
  375.    .DragColor = .markcolor
  376. compile endif
  377.  
  378. defc MH_end_mark
  379.    universal BeginningLineOfDrag
  380.    universal BeginningColOfDrag
  381. compile if WANT_CUA_MARKING = 'SWITCH'
  382.    universal CUA_marking_switch
  383. compile endif
  384. compile if WANT_STREAM_MODE = 'SWITCH'
  385.    universal stream_mode
  386. compile endif
  387.    ml = MouseLineColOff(endingline, endingcol, MouseOff, 1, arg(1));
  388. compile if WANT_STREAM_MODE
  389.  compile if WANT_STREAM_MODE = 'SWITCH'
  390.    if stream_mode & ml > .last then
  391.  compile else
  392.    if ml > .last then      -- If click below "Bottom of File" ...
  393.  compile endif
  394.       endingline = .last
  395.       endingcol = length(textline(.last))+1
  396.    endif
  397.    if not (ml > .last & BeginningLineOfDrag = endingline & BeginningColOfDrag = endingcol) then
  398. compile endif  -- WANT_STREAM_MODE
  399.       unmark
  400.       getfileid CurrentFile
  401.       call pset_mark(BeginningLineOfDrag, endingline,
  402.                      BeginningColOfDrag,  max(endingcol,1),  arg(1), CurrentFile)
  403.       /* Copy the marked area to the clipboard in case we want to copy it */
  404.       /* into a different editor window.                                  */
  405.       'Copy2SharBuff'
  406. compile if WANT_STREAM_MODE
  407.    else
  408.       refresh  -- Get rid of the drag-mark highlighting
  409.    endif
  410. compile endif  -- WANT_STREAM_MODE
  411.    mouse_setpointer EPM_POINTER
  412. compile if WANT_CUA_MARKING
  413.  compile if WANT_CUA_MARKING = 'SWITCH'
  414.    if CUA_marking_switch then
  415.  compile endif
  416.  compile if EVERSION >= '5.50'  -- GPI version allows cursor to be off screen
  417.    if .cursorx > 0 & .cursorx <= .windowwidth & .cursory > 0 & .cursory <= .windowheight then
  418.  compile endif
  419.    getmark  firstline,lastline,firstcol,lastcol,fileid
  420.    if marktype()<>'LINE' then
  421.       .col=lastcol
  422.    endif
  423.    if lastline<>.line then
  424.       if lastline>.line then '+'lastline-.line; else lastline-.line; endif
  425.    endif
  426.  compile if EVERSION >= '5.50'
  427.    endif
  428.  compile endif
  429.    'MH_gotoposition'
  430.  compile if WANT_CUA_MARKING = 'SWITCH'
  431.    endif
  432.  compile endif
  433. compile endif
  434. ;  refresh                                          ???
  435.    call register_mousehandler(1, 'ENDDRAG', ' ')
  436.    call register_mousehandler(1, 'CANCELDRAG', ' ')
  437.  
  438. defc MH_cancel_mark
  439.    mouse_setpointer EPM_POINTER
  440.    call register_mousehandler(1, 'ENDDRAG', ' ')
  441.    call register_mousehandler(1, 'CANCELDRAG', ' ')
  442.    refresh
  443.  
  444. defc markword
  445.    if arg(1) then
  446.       'MH_gotoposition'
  447.       unmark
  448.    endif
  449.    call pmark_word()
  450.  
  451. defc marktoken
  452.    if arg(1) then
  453.       'MH_gotoposition'
  454.    endif
  455.    if find_token(startcol, endcol) then
  456.       getfileid fid
  457.       call pset_mark(.line, .line, startcol, endcol, 'BLOCK', fid)
  458.    endif
  459.  
  460. defc findword
  461.    if arg(1) then
  462.       'MH_gotoposition'
  463.    endif
  464.    if find_token(startcol, endcol) then
  465.       .col = endcol
  466.       'l '\1 || substr(textline(.line), startcol, (endcol-startcol)+1)
  467.    endif
  468.  
  469. compile if WANT_CUA_MARKING
  470. defc MH_singleclick
  471.    unmark
  472.    'ClearSharBuff'       /* Remove Content in EPM shared text buffer */
  473.    'MH_gotoposition'
  474.  
  475. defc MH_dblclick
  476.    unmark
  477.    if .line then
  478. ;;    call pmark_word()  -- pmark_word doesn't include white space; the following does:
  479.       call pbegin_word()
  480.       mark_block
  481.       startcol = .col
  482.       tab_word
  483.       if .col<length(textline(.line)) then .col = .col - 1; endif
  484.       mark_block
  485.       .col = startcol
  486.    endif
  487.    'Copy2SharBuff'       /* Copy mark to shared text buffer */
  488.  
  489. compile endif
  490.  
  491. defc MH_double  -- Used to be just 'dupmark U', but now overloaded in a DIR listing:
  492.    if upcase(subword(.filename,1,2)) = '.DOS DIR' then
  493.       executekey a_1  -- For simplicity, assume user hasn't redefined this key:
  494.    else
  495.       unmark
  496.       'ClearSharBuff'
  497.    endif
  498.  
  499. defc MH_shiftclick
  500.    if marktype() then
  501.       getmark markfirstline,marklastline,markfirstcol,marklastcol,markfileid
  502.    else
  503.       markfileid=''
  504.    endif
  505.    unmark
  506.    getfileid CurrentFile
  507.    if CurrentFile<>markfileid then
  508.       markfirstline=.line; markfirstcol=.col
  509.    elseif markfirstline=.line & markfirstcol=.col then
  510.       markfirstline=marklastline; markfirstcol=marklastcol
  511.    endif
  512.    call MouseLineColOff(MouseLine, MouseCol, MouseOff, 1, arg(1))
  513.    call pset_mark(markfirstline, MouseLine, markfirstcol, MouseCol, 'CHAR', CurrentFile)
  514.    'MH_gotoposition'
  515.    'Copy2SharBuff'
  516.  
  517. define
  518.    SUPPORT_DRAGDROP_FOR_BOTH = 1  -- Let's see if this works; make it easy to remove if not.
  519.  
  520. definit
  521.    universal EPM_utility_array_ID, MouseStyle
  522. compile if WANT_MMEDIA
  523.    universal mmedia_font
  524.    mmedia_font = registerfont('Multimedia Icons', 0, 0)
  525. compile endif
  526. compile if (EVERSION < 5.21 & EPM_POINTER<>SYSTEM_POINTER) | (EVERSION >= 5.21 & EPM_POINTER<>TEXT_POINTER)
  527.    mouse_setpointer EPM_POINTER
  528. compile endif
  529.    -- set initial mousesets
  530.    SetMouseSet(1, "BaseMouseHandlers") -- default global mouseset
  531. compile if LOCAL_MOUSE_SUPPORT
  532.    SetMouseSet(0, TransparentMouseHandler)  -- default local mouseset is blank.
  533. compile endif
  534. compile if SUPPORT_DRAGDROP_FOR_BOTH
  535.    call register_mousehandler(1, '2 BEGINDRAG 0', 'MH_begin_drag_2 0')
  536.    call register_mousehandler(1, '2 BEGINDRAG 2', 'MH_begin_drag_2 1')
  537. compile endif
  538. compile if WANT_MMEDIA
  539.    call register_mousehandler(1, '1 SECONDCLK 0', 'MH_MM_dblclick')
  540. compile elseif WANT_SPEECH
  541.    call register_mousehandler(1, '1 SECONDCLK 0', 'SPPopUp')
  542. compile endif
  543. compile if WANT_SPEECH
  544.    call register_mousehandler(1, '1 SECONDCLK 2', 'SPPlay')
  545. compile endif
  546. compile if WANT_CUA_MARKING = 'SWITCH'
  547.    call MH_SET_Mouse()
  548.  
  549. defproc MH_set_mouse
  550.    universal CUA_marking_switch, MouseStyle
  551.  
  552.  
  553.    if CUA_marking_switch then
  554. compile endif
  555.  
  556.       -- 1 == shift, 2 = control, 4 = alt.
  557. compile if WANT_CUA_MARKING
  558.    call register_mousehandler(1, '1 CLICK 0',     'MH_singleclick')
  559.    call register_mousehandler(1, '1 CLICK 1',     'MH_shiftclick')
  560.    call register_mousehandler(1, '1 CLICK 2',     'MH_singleclick')
  561.    call register_mousehandler(1, '1 CLICK 3',     'MH_shiftclick')
  562.    call register_mousehandler(1, '1 CLICK 4',     'MH_singleclick')
  563.    call register_mousehandler(1, '1 CLICK 5',     'MH_shiftclick')
  564.    call register_mousehandler(1, '1 CLICK 6',     'MH_singleclick')
  565.    call register_mousehandler(1, '1 CLICK 7',     'MH_shiftclick')
  566. compile if not WANT_MMEDIA and not WANT_SPEECH
  567.    call register_mousehandler(1, '1 SECONDCLK 0', 'MH_dblclick')
  568. compile endif
  569. compile if not WANT_SPEECH
  570.    call register_mousehandler(1, '1 SECONDCLK 2', 'MH_dblclick')
  571. compile endif
  572.    call register_mousehandler(1, '1 SECONDCLK 4', 'MH_dblclick')
  573.    call register_mousehandler(1, '1 SECONDCLK 6', 'MH_dblclick')
  574.    call register_mousehandler(1, '1 BEGINDRAG 0', 'MH_begin_mark' CHARG_MARK)
  575.    call register_mousehandler(1, '1 BEGINDRAG 1', 'MH_begin_mark' CHARG_MARK)
  576.    call register_mousehandler(1, '1 BEGINDRAG 2', 'MH_begin_mark' CHARG_MARK)
  577.    call register_mousehandler(1, '1 BEGINDRAG 3', 'MH_begin_mark' CHARG_MARK)
  578.    call register_mousehandler(1, '1 BEGINDRAG 4', 'MH_begin_mark' CHARG_MARK)
  579.    call register_mousehandler(1, '1 BEGINDRAG 5', 'MH_begin_mark' CHARG_MARK)
  580.    call register_mousehandler(1, '1 BEGINDRAG 6', 'MH_begin_mark' CHARG_MARK)
  581.    call register_mousehandler(1, '1 BEGINDRAG 7', 'MH_begin_mark' CHARG_MARK)
  582. compile endif  -- WANT_CUA_MARKING
  583.  
  584. compile if WANT_CUA_MARKING = 'SWITCH'
  585.  compile if not SUPPORT_DRAGDROP_FOR_BOTH
  586.       call register_mousehandler(1, '2 BEGINDRAG 0', '')  -- Delete the defs
  587.   compile if EVERSION >= 5.50
  588.       call register_mousehandler(1, '2 BEGINDRAG 2', '')
  589.   compile endif
  590.  compile endif  -- not SUPPORT_DRAGDROP_FOR_BOTH
  591.       call register_mousehandler(1, '3 BEGINDRAG 0', '')  -- from the other style.
  592.  compile if EVERSION >= 5.60
  593.       call register_mousehandler(1, '2 CLICK 0',     '')
  594.  compile endif
  595.       call register_mousehandler(1, '2 SECONDCLK 0', '')
  596.       call register_mousehandler(1, '2 SECONDCLK 2', '')
  597.       call register_mousehandler(1, '2 SECONDCLK 1', '')
  598.    else
  599.  compile if EVERSION < 5.50
  600.       call register_mousehandler(1, '1 CLICK 2',     '')  -- (ditto)
  601.  compile endif
  602.       call register_mousehandler(1, '1 CLICK 4',     '')
  603.       call register_mousehandler(1, '1 CLICK 6',     '')
  604.  compile if not WANT_SPEECH
  605.       call register_mousehandler(1, '1 SECONDCLK 2', '')
  606.  compile endif
  607.       call register_mousehandler(1, '1 SECONDCLK 4', '')
  608.       call register_mousehandler(1, '1 SECONDCLK 6', '')
  609.       call register_mousehandler(1, '1 BEGINDRAG 1', '')
  610.       call register_mousehandler(1, '1 BEGINDRAG 3', '')
  611.       call register_mousehandler(1, '1 BEGINDRAG 4', '')
  612.       call register_mousehandler(1, '1 BEGINDRAG 5', '')
  613.       call register_mousehandler(1, '1 BEGINDRAG 6', '')
  614.       call register_mousehandler(1, '1 BEGINDRAG 7', '')
  615. compile endif
  616.  
  617. compile if WANT_CUA_MARKING = 'SWITCH' or WANT_CUA_MARKING = 0
  618.    call register_mousehandler(1, '1 CLICK 0',     'MH_gotoposition')
  619.    call register_mousehandler(1, '1 CLICK 1',     'MH_shiftclick')
  620.    if MouseStyle = 1 then but_1 = BLOCKG_MARK; c_but_1 = CHARG_MARK
  621.                      else but_1 = CHARG_MARK;  c_but_1 = BLOCKG_MARK
  622.    endif
  623.    call register_mousehandler(1, '1 BEGINDRAG 0', 'MH_begin_mark 'but_1)
  624.    call register_mousehandler(1, '1 BEGINDRAG 2', 'MH_begin_mark 'c_but_1)
  625.  compile if EVERSION < 5.50
  626.    call register_mousehandler(1, '2 BEGINDRAG 0', 'MH_begin_mark LINE')
  627.  compile else
  628.   compile if not SUPPORT_DRAGDROP_FOR_BOTH
  629.    call register_mousehandler(1, '2 BEGINDRAG 0', 'MH_begin_drag_2 0')
  630.    call register_mousehandler(1, '2 BEGINDRAG 2', 'MH_begin_drag_2 1')
  631.   compile endif  -- not SUPPORT_DRAGDROP_FOR_BOTH
  632.    call register_mousehandler(1, '1 CLICK 2',     'MH_gotoposition')
  633.  compile endif
  634.    call register_mousehandler(1, '3 BEGINDRAG 0', 'MH_begin_mark 'c_but_1)
  635.  compile if not WANT_MMEDIA and not WANT_SPEECH
  636.    call register_mousehandler(1, '1 SECONDCLK 0', 'MH_double')
  637.  compile endif
  638.  compile if EVERSION >= 5.60
  639.    call register_mousehandler(1, '2 CLICK 0',     'MH_popup')
  640.  compile endif
  641.    call register_mousehandler(1, '2 SECONDCLK 0', 'markword 1')
  642.    call register_mousehandler(1, '2 SECONDCLK 2', 'marktoken 1')
  643.    call register_mousehandler(1, '2 SECONDCLK 1', 'findword 1')
  644.  compile if WANT_KEYWORD_HELP and not WANT_SPEECH
  645.    call register_mousehandler(1, '1 SECONDCLK 2', 'kwhelp')
  646.  compile endif
  647. compile endif
  648.  
  649. compile if WANT_CUA_MARKING = 'SWITCH'
  650.    endif
  651. compile endif
  652.  
  653. compile if EVERSION >= 5.50
  654. defc MH_begin_drag_2  -- Determine if a click is within the selected area
  655.  compile if WANT_CUA_MARKING = 'SWITCH'
  656.    universal CUA_marking_switch
  657.  compile endif
  658.    if mouse_in_mark() then
  659.       call WindowMessage(0,  getpminfo(EPMINFO_EDITCLIENT),
  660.                          5434,               -- EPM_DRAGDROP_DIRECTMINP
  661.                          arg(1),
  662.                          0)
  663.  compile if WANT_CUA_MARKING <> 1      -- If 1, we never do a line mark
  664.   compile if WANT_CUA_MARKING = 'SWITCH'
  665.    elseif not CUA_marking_switch then  -- If 'SWITCH', we line mark if CUA switch is off
  666.   compile else                         -- Else WANT_CUA_MARKING = 0
  667.    else                                -- so if not drag/drop, we always line mark.
  668.   compile endif  -- WANT_CUA_MARKING = 'SWITCH'
  669.       'MH_begin_mark LINE'
  670.  compile endif  -- WANT_CUA_MARKING <> 1
  671.    endif
  672.  
  673. defproc mouse_in_mark()
  674.    -- First we query the position of the mouse
  675.    call MouseLineColOff(MouseLine, MouseCol, MouseOff, 0)
  676.    -- Now determine if the mouse is in the selected text area.
  677.    mt=leftstr(marktype(),1)
  678.    if mt then
  679.       getfileid curfileid
  680.       getmark markfirstline,marklastline,markfirstcol,marklastcol,markfileid
  681.       if  (markfileid == curfileid) and
  682.           (MouseLine >= markfirstline) and (MouseLine <= marklastline) then
  683.  
  684.           -- assert:  at this point the only case where the text is outside
  685.           --          the selected area is on a single line char mark and a
  686.           --          block mark.  Any place else is a valid selection
  687.           if not ((mt=='C' & (markfirstline=MouseLine & MouseCol < markfirstcol) or (marklastline=MouseLine & MouseCol > marklastcol)) or
  688.                   (mt=='B' & (MouseCol < markfirstcol or MouseCol > marklastcol)) ) then
  689.              return 1
  690.           endif
  691.       endif
  692.    endif
  693. compile endif
  694.  
  695. compile if WANT_MMEDIA
  696. defc MH_MM_dblclick
  697.    universal mmedia_font
  698.  compile if WANT_CUA_MARKING = 'SWITCH'
  699.    universal CUA_marking_switch
  700.  compile endif
  701.    -- First we query the position of the mouse
  702.    call MouseLineColOff(MouseLine, MouseCol, MouseOff, 0, '', 1)
  703.    class = 0; offst = -2
  704.    query_attribute class, val, IsPush, offst, MouseCol, MouseLine
  705.    if class=32 /* | (class=16 & val=mmedia_font & IsPush) */ then
  706. ;;    if class=16 then  -- If we got the font class, go for the mmedia class.
  707. ;;       offst = -2
  708. ;;       query_attribute class, val, IsPush, offst, MouseCol, MouseLine
  709. ;;    endif
  710.       .col = MouseCol
  711.       ch = asc(substr(textline(MouseLine), MouseCol, 1))
  712.       sayerror 'selected MMedia type' ch 'with value' val
  713.       circleit 1, MouseLine, MouseCol-1, MouseCol+1, 16777220
  714.  compile if WANT_SPEECH
  715.    else  -- not mmedia, so do the standard action
  716.       'SPPopUp'  -- Speech support always does this
  717.  compile else
  718.   compile if WANT_CUA_MARKING = 'SWITCH'
  719.    elseif CUA_marking_switch then
  720.   compile else
  721.    else
  722.   compile endif
  723.   compile if WANT_CUA_MARKING
  724.       'MH_dblclick'  -- This is the CUA-marking-mode action
  725.   compile endif
  726.   compile if WANT_CUA_MARKING = 'SWITCH'
  727.    else
  728.   compile endif
  729.   compile if WANT_CUA_MARKING <> 1
  730.       'MH_Double'    -- This is the normal EPM marking mode action
  731.   compile endif
  732.  compile endif
  733.    endif
  734. compile endif
  735.  
  736. compile if EVERSION >= 5.60
  737. const
  738.    FILL_MARK_MENU__MSG = 'Fill mark'
  739.    FILL_MARK_MENUP__MSG = \1'Fill marked region with a character, overlaying current contents.'
  740.    HP_POPUP_FILL = 0
  741.    REFLOW_MARK_MENU__MSG = 'Reflow mark'
  742.    REFLOW_MARK_MENUP__MSG = \1'Reflow text in marked region.'
  743.    HP_POPUP_REFLOW = 0
  744.    MARK_WORD_MENU__MSG = 'Mark word'
  745.    MARK_WORD_MENUP__MSG = \1'Mark space-delimited word under mouse pointer.'
  746.    HP_POPUP_MARKWORD = 0
  747.    MARK_TOKEN_MENU__MSG = 'Mark identifier'
  748.    MARK_TOKEN_MENUP__MSG = \1'Mark the C-language identifier under the mouse pointer.'
  749.    HP_POPUP_MARKTOKEN = 0
  750.    FIND_TOKEN_MENU__MSG = 'Find identifier'
  751.    FIND_TOKEN_MENUP__MSG = \1'Find the next occurrence of the identifier under the mouse pointer.'
  752.    HP_POPUP_FINDTOKEN = 0
  753.    UPCASE_MARK_MENU__MSG = 'Uppercase selection'
  754.    UPCASE_MARK_MENUP__MSG = \1'Translate selected text to upper case.'
  755.    HP_POPUP_UPCASEMARK = 0
  756.    LOCASE_MARK_MENU__MSG = 'Lowercase selection'
  757.    LOCASE_MARK_MENUP__MSG = \1'Translate selected text to lower case.'
  758.    HP_POPUP_LOCASEMARK = 0
  759.    UPCASE_WORD_MENU__MSG = 'Uppercase word'
  760.    UPCASE_WORD_MENUP__MSG = \1'Translate word under mouse pointer to upper case.'
  761.    HP_POPUP_UPCASEWORD = 0
  762.    LOCASE_WORD_MENU__MSG = 'Lowercase word'
  763.    LOCASE_WORD_MENUP__MSG = \1'Translate word under mouse pointer to lower case.'
  764.    HP_POPUP_LOCASEWORD = 0
  765.    SHIFT_MENU__MSG = 'Shift'
  766.    SHIFT_MENUP__MSG = \1'Shift marked text left or right.'
  767.    HP_POPUP_SHIFT = 0
  768.    SHIFTLEFT_MENU__MSG = 'Shift left 1'
  769.    SHIFTLEFT_MENUP__MSG = \1'Shift marked text left 1 character.'
  770.    HP_POPUP_SHIFTLEFT = 0
  771.    SHIFTLEFT3_MENU__MSG = 'Shift left 3'
  772.    SHIFTLEFT3_MENUP__MSG = \1'Shift marked text left 3 characters.'
  773.    HP_POPUP_SHIFTLEFT3 = 0
  774.    SHIFTLEFT8_MENU__MSG = 'Shift left 8'
  775.    SHIFTLEFT8_MENUP__MSG = \1'Shift marked text left 8 characters.'
  776.    HP_POPUP_SHIFTLEFT8 = 0
  777.    SHIFTRIGHT_MENU__MSG = 'Shift right 1'
  778.    SHIFTRIGHT_MENUP__MSG = \1'Shift marked text right 1 character.'
  779.    HP_POPUP_SHIFTRIGHT = 0
  780.    SHIFTRIGHT3_MENU__MSG = 'Shift right 3'
  781.    SHIFTRIGHT3_MENUP__MSG = \1'Shift marked text right 3 characters.'
  782.    HP_POPUP_SHIFTRIGHT3 = 0
  783.    SHIFTRIGHT8_MENU__MSG = 'Shift right 8'
  784.    SHIFTRIGHT8_MENUP__MSG = \1'Shift marked text right 8 characters.'
  785.    HP_POPUP_SHIFTRIGHT8 = 0
  786.    CENTER_LINE_MENU__MSG = 'Center line'
  787.    CENTER_LINE_MENUP__MSG = \1'Center line under mouse pointer vertically in window.'
  788.    HP_POPUP_CENTERLINE = 0
  789.    CENTER_MARK_MENU__MSG = 'Center text'
  790.    CENTER_MARK_MENUP__MSG = \1'Center marked text within margins or block mark.'
  791.    HP_POPUP_CENTERMARK = 0
  792.    SORT_MARK_MENU__MSG = 'Sort'
  793.    SORT_MARK_MENUP__MSG = \1'Sort marked lines, using block mark (if present) as key.'
  794.    HP_POPUP_SORT = 0
  795.    TOP_LINE_MENU__MSG = 'Scroll to top'
  796.    TOP_LINE_MENUP__MSG = \1'Scroll so line under mouse pointer is at top of window.'
  797.    HP_POPUP_TOP = 0
  798.  
  799. defc MH_popup
  800.    universal activemenu, previouslyactivemenu
  801. compile if CHECK_FOR_LEXAM
  802.    universal LEXAM_is_available
  803. compile endif
  804.    if previouslyactivemenu = '' then
  805.       previouslyactivemenu = activemenu
  806.    endif
  807.    menuname = 'popup1'
  808.    activemenu = menuname
  809.  
  810.    deletemenu menuname, 0, 0, 0
  811.    buildsubmenu  menuname, 80, '', '', 0 , 0
  812.    mt = leftstr(marktype(),1)
  813.    if mouse_in_mark() then  -- Build Inside-Mark pop-up
  814.       gray_if_charmark = 16384*(MT='C')
  815.       buildmenuitem menuname, 80, 8000, UNMARK_MARK_MENU__MSG\9'Alt+U',   'DUPMARK U'UNMARK_MARK_MENUP__MSG, 0, mpfrom2short(HP_EDIT_UNMARK, 0)
  816.       buildmenuitem menuname, 80, 8001, DELETE_MARK_MENU__MSG\9'Alt+D',   'DUPMARK D'DELETE_MARK_MENUP__MSG, 0, mpfrom2short(HP_EDIT_DELETE, 0)
  817.       buildmenuitem menuname, 80, 8002, FILL_MARK_MENU__MSG\9'Alt+F',     'Fill'FILL_MARK_MENUP__MSG, 0, mpfrom2short(HP_POPUP_FILL, 0)
  818.       buildmenuitem menuname, 80, 8003, REFLOW_MARK_MENU__MSG\9'Alt+P',   'key 1 a+P'REFLOW_MARK_MENUP__MSG, 0, mpfrom2short(HP_POPUP_REFLOW, gray_if_charmark)
  819.       buildmenuitem menuname, 80, 8004, UPCASE_MARK_MENU__MSG\9'Ctrl+F3', 'key 1 c+f3'UPCASE_MARK_MENUP__MSG, 0, mpfrom2short(HP_POPUP_UPCASEMARK, 0)
  820.       buildmenuitem menuname, 80, 8005, LOCASE_MARK_MENU__MSG\9'Ctrl+F4', 'key 1 c+f4'LOCASE_MARK_MENUP__MSG, 0, mpfrom2short(HP_POPUP_LOCASEMARK, 0)
  821.       buildmenuitem menuname, 80, 8006, SORT_MARK_MENU__MSG,              'Sort'SORT_MARK_MENUP__MSG, 0, mpfrom2short(HP_POPUP_SORT, gray_if_charmark)
  822.       buildmenuitem menuname, 80, 8007, \0,                               '',          4, 0
  823.       buildmenuitem menuname, 80, 8008, SHIFT_MENU__MSG,   ''SHIFT_MENUP__MSG, 17, mpfrom2short(HP_POPUP_SHIFT, gray_if_charmark)
  824.       nodismiss_gifc = gray_if_charmark + 32  -- 32 = MIA_NODISMISS
  825.       buildmenuitem menuname, 80, 8009, SHIFTLEFT_MENU__MSG\9'Ctrl+F7',   'key 1 a+F7'SHIFTLEFT_MENUP__MSG, 1, mpfrom2short(HP_POPUP_SHIFTLEFT, nodismiss_gifc)
  826.       buildmenuitem menuname, 80, 8010, SHIFTLEFT3_MENU__MSG,             'key 3 a+F7'SHIFTLEFT3_MENUP__MSG, 1, mpfrom2short(HP_POPUP_SHIFTLEFT3, nodismiss_gifc)
  827.       buildmenuitem menuname, 80, 8011, SHIFTLEFT8_MENU__MSG,             'key 8 a+F7'SHIFTLEFT8_MENUP__MSG, 1, mpfrom2short(HP_POPUP_SHIFTLEFT8, nodismiss_gifc)
  828.       buildmenuitem menuname, 80, 8013, SHIFTRIGHT_MENU__MSG\9'Ctrl+F8',  'key 1 a+F8'SHIFTRIGHT_MENUP__MSG, 2049, mpfrom2short(HP_POPUP_SHIFTRIGHT, nodismiss_gifc)
  829.       buildmenuitem menuname, 80, 8014, SHIFTRIGHT3_MENU__MSG,            'key 3 a+F8'SHIFTRIGHT3_MENUP__MSG, 1, mpfrom2short(HP_POPUP_SHIFTRIGHT3, nodismiss_gifc)
  830.       buildmenuitem menuname, 80, 8015, SHIFTRIGHT8_MENU__MSG,            'key 8 a+F8'SHIFTRIGHT8_MENUP__MSG, 32769, mpfrom2short(HP_POPUP_SHIFTRIGHT8, nodismiss_gifc)
  831.       buildmenuitem menuname, 80, 8016, CENTER_MARK_MENU__MSG\9'Alt+T',   'key 1 a+t'CENTER_MARK_MENUP__MSG, 0, mpfrom2short(HP_POPUP_CENTERMARK, gray_if_charmark)
  832.       buildmenuitem menuname, 80, 8017, \0,                               '',          4, 0
  833.       buildmenuitem menuname, 80, 8018, CLIP_COPY_MENU__MSG\9 || CTRL_KEY__MSG'+'INSERT_KEY__MSG ,  'Copy2Clip'CLIP_COPY_MENUP__MSG, 0, mpfrom2short(HP_EDIT_COPY, 0)
  834.       buildmenuitem menuname, 80, 8019, CUT_MENU__MSG\9 || SHIFT_KEY__MSG'+'DELETE_KEY__MSG, 'Cut'CUT_MENUP__MSG,       0, mpfrom2short(HP_EDIT_CUT, 0)
  835.       buildmenuitem menuname, 80, 8020, \0,                               '',          4, 0
  836.       buildmenuitem menuname, 80, 8021, STYLE_MENU__MSG\9'Ctrl+Y',        'fontlist'STYLE_MENUP__MSG,    0, mpfrom2short(HP_OPTIONS_STYLE, 0)
  837.  compile if CHECK_FOR_LEXAM
  838.    if LEXAM_is_available then
  839.  compile endif
  840.       buildmenuitem menuname, 80, 8022, \0,                               '',          4, 0
  841.       buildmenuitem menuname, 80, 8023, PROOF_MENU__MSG,           'proof'PROOF_MENUP__MSG,     0, mpfrom2short(HP_OPTIONS_PROOF, 16384*(mt<>'L'))
  842.  compile if CHECK_FOR_LEXAM
  843.    endif
  844.  compile endif
  845.       buildmenuitem menuname, 80, 8024, \0,                               '',          4, 0
  846. compile if ENHANCED_PRINT_SUPPORT
  847.       buildmenuitem menuname, 80, 8025, PRT_MARK_MENU__MSG'...',          'PRINTDLG M'ENHPRT_MARK_MENUP__MSG,0, mpfrom2short(HP_EDIT_ENHPRINT, 0)
  848. compile else
  849.       buildmenuitem menuname, 80, 8025, PRT_MARK_MENU__MSG,               'DUPMARK P'PRT_MARK_MENUP__MSG, 0, mpfrom2short(HP_EDIT_PRINT, 0)
  850. compile endif
  851.    elseif mt<>' ' then  -- Build Outside-Mark pop-up
  852.       'MH_gotoposition'
  853.       buildmenuitem menuname, 80, 8000, COPY_MARK_MENU__MSG\9'Alt+C',     'DUPMARK C'COPY_MARK_MENUP__MSG, 0, mpfrom2short(HP_EDIT_COPYMARK, 0)
  854.       buildmenuitem menuname, 80, 8001, MOVE_MARK_MENU__MSG\9'Alt+M',     'DUPMARK M'MOVE_MARK_MENUP__MSG, 0, mpfrom2short(HP_EDIT_MOVE, 0)
  855.       buildmenuitem menuname, 80, 8002, OVERLAY_MARK_MENU__MSG\9'Alt+O',  'DUPMARK O'OVERLAY_MARK_MENUP__MSG, 0, mpfrom2short(HP_EDIT_OVERLAY, 0)
  856.       buildmenuitem menuname, 80, 8003, ADJUST_MARK_MENU__MSG\9'Alt+A',   'DUPMARK A'ADJUST_MARK_MENUP__MSG, 0, mpfrom2short(HP_EDIT_ADJUST, 0)
  857.       buildmenuitem menuname, 80, 8004, \0,                       '',          4, 0
  858.       buildmenuitem menuname, 80, 8005, UNMARK_MARK_MENU__MSG\9'Alt+U',   'DUPMARK U'UNMARK_MARK_MENUP__MSG, 0, mpfrom2short(HP_EDIT_UNMARK, 0)
  859.    else  -- Build No-mark pop-up
  860.       'MH_gotoposition'
  861.       ch = substr(textline(.line), .col, 1)
  862.       gray_if_space = 16384*(ch=' ')
  863.       buildmenuitem menuname, 80, 8000, MARK_WORD_MENU__MSG\9'Alt+W',      'MARKWORD'MARK_WORD_MENUP__MSG, 0, mpfrom2short(HP_POPUP_MARKWORD, gray_if_space)
  864.       buildmenuitem menuname, 80, 8001, MARK_TOKEN_MENU__MSG\9'CtrL+W',    'MARKTOKEN'MARK_TOKEN_MENUP__MSG, 0, mpfrom2short(HP_POPUP_MARKTOKEN, gray_if_space)
  865.       buildmenuitem menuname, 80, 8002, FIND_TOKEN_MENU__MSG,              'FINDWORD'FIND_TOKEN_MENUP__MSG, 0, mpfrom2short(HP_POPUP_FINDTOKEN, gray_if_space)
  866.       buildmenuitem menuname, 80, 8003, \0,                       '',          4, 0
  867.       buildmenuitem menuname, 80, 8004, UPCASE_WORD_MENU__MSG\9'Ctrl+F1',  'key 1 c+f1'UPCASE_WORD_MENUP__MSG, 0, mpfrom2short(HP_POPUP_UPCASEWORD, gray_if_space)
  868.       buildmenuitem menuname, 80, 8005, LOCASE_WORD_MENU__MSG\9'Ctrl+F2',  'key 1 c+f2'LOCASE_WORD_MENUP__MSG, 0, mpfrom2short(HP_POPUP_LOCASEWORD, gray_if_space)
  869.       buildmenuitem menuname, 80, 8006, \0,                       '',          4, 0
  870.       buildmenuitem menuname, 80, 8007, CENTER_LINE_MENU__MSG\9'Shift+F5', 'key 1 s+f5'CENTER_LINE_MENUP__MSG, 0, mpfrom2short(HP_POPUP_CENTERLINE, 0)
  871.       buildmenuitem menuname, 80, 8008, TOP_LINE_MENU__MSG,                'newtop'TOP_LINE_MENUP__MSG, 0, mpfrom2short(HP_POPUP_TOP, 0)
  872.    endif
  873.    showmenu menuname,1
  874.  
  875. defc newtop = l=.line; .cursory=1; l
  876. compile endif
  877.