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