home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / epmmac.zip / MOUSE.E < prev    next >
Text File  |  1996-04-09  |  52KB  |  1,284 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(VANILLA)
  20.    VANILLA = 0
  21.  compile endif
  22.  compile if not defined(DEFAULT_PASTE)
  23.    DEFAULT_PASTE = 'C'
  24.  compile endif
  25.  compile if not defined(WANT_CUA_MARKING)
  26.    WANT_CUA_MARKING = 0
  27.  compile endif
  28.  compile if not defined(WANT_STREAM_MODE)
  29.    WANT_STREAM_MODE = 0
  30.  compile endif
  31.  compile if not defined(NLS_LANGUAGE)
  32.    NLS_LANGUAGE = 'ENGLISH'
  33.  compile endif
  34.  compile if not defined(WANT_KEYWORD_HELP)
  35.    WANT_KEYWORD_HELP = 0
  36.  compile endif
  37.  compile if not defined(WANT_CHAR_OPS)
  38.    WANT_CHAR_OPS = 1
  39.  compile endif
  40.  include NLS_LANGUAGE'.e'
  41. compile endif
  42.  
  43. define
  44.  compile if not defined(ALTERNATE_PASTE)
  45.   compile if DEFAULT_PASTE = ''
  46.    ALTERNATE_PASTE = 'C'
  47.   compile else
  48.    ALTERNATE_PASTE = ''
  49.   compile endif
  50.  compile endif
  51.  
  52. const
  53. compile if not defined(EPM_POINTER)
  54.  compile if EVERSION < 5.50
  55.    EPM_POINTER = SYSTEM_POINTER    -- AVIO version gets arrow pointer
  56.  compile else
  57.    EPM_POINTER = TEXT_POINTER      -- GPI version gets text pointer
  58.  compile endif
  59. compile endif
  60. compile if not defined(LOCAL_MOUSE_SUPPORT)
  61.    LOCAL_MOUSE_SUPPORT = 0
  62. compile endif
  63. compile if not defined(TOP_OF_FILE_VALID)
  64.    TOP_OF_FILE_VALID = 1       -- Can be '0', '1', or 'STREAM' (dependant on STREAM_MODE)
  65. compile endif
  66. compile if not defined(DRAG_ALWAYS_MARKS)
  67.    DRAG_ALWAYS_MARKS = 0
  68. compile endif
  69. compile if not defined(WANT_MMEDIA)
  70.    WANT_MMEDIA = 0
  71. compile endif
  72. ;compile if not defined(WANT_SPEECH)  -- Speech support removed from mouse.e; totally separate now.
  73. ;   WANT_SPEECH = 0
  74. ;compile endif
  75. compile if not defined(UNDERLINE_CURSOR)
  76.    UNDERLINE_CURSOR = 0
  77. compile endif
  78. compile if not defined(INCLUDE_STANDARD_CONTEXT_MENU)
  79.    INCLUDE_STANDARD_CONTEXT_MENU = 1
  80. compile endif
  81. compile if not defined(CLICK_ONLY_GIVES_FOCUS)  -- Can be 0, ADVANCED, CUA, or 1
  82.    CLICK_ONLY_GIVES_FOCUS = 'ADVANCED'
  83. compile endif
  84.  
  85. compile if (EPM_POINTER < 1 | EPM_POINTER > 14) & EPM_POINTER <> 'SWITCH'
  86.  *** Invalid value for EPM_POINTER - must be 1 - 14
  87. compile endif
  88.  
  89. const
  90.   BlankMouseHandler = "BlankMouseHandler"
  91.   TransparentMouseHandler = "TransparentMouseHandler"
  92.  
  93. define
  94. compile if EVERSION < 5.50
  95.    CHARG_MARK =  'CHAR'
  96.    BLOCKG_MARK = 'BLOCK'
  97. compile else                -- New mark types
  98.    CHARG_MARK =  'CHARG'
  99.    BLOCKG_MARK = 'BLOCKG'
  100. compile endif
  101.  
  102. compile if EVERSION >= 5.20
  103. defproc prestore_pos2(save_pos)
  104.    parse value save_pos with svline svcol svsx svsy
  105.    compile if EVERSION >= 5.50
  106.       .lineg = min(svline, .last);                       -- set .line
  107.    compile else
  108.       min(svline, .last);                       -- set .line
  109.    compile endif
  110.    .col = svcol;
  111.    .scrollx = svsx;
  112.    compile if EVERSION >= 5.50
  113.       .cursoryg= svsy;
  114.    compile else
  115.       .scrolly = svsy;
  116.    compile endif
  117.  
  118. defproc psave_pos2(var save_pos)
  119.    compile if EVERSION >= 5.50
  120.       save_pos=.line .col .scrollx .cursoryg
  121.    compile else
  122.       save_pos=.line .col .scrollx .scrolly
  123.    compile endif
  124. compile endif
  125.  
  126. defproc MouseLineColOff(var MouseLine, var MouseCol, var MouseOff, minline)
  127.                         -- MIN = 0 for positioning, 1 for marking.
  128.    xxx = .mousex; mx = xxx
  129.    yyy = .mousey
  130.  
  131.    -- saying 5.21, below, but not sure if it will work for that.
  132.    --    it will work for 5.50.
  133.  
  134.    compile if EVERSION >= 5.21
  135.       --call messagenwait("xxx1="xxx "yyy1="yyy);
  136.       map_point 5, xxx, yyy, off, comment;  -- map screen to line
  137.       --call messagenwait("doc xxx2="xxx "yyy2="yyy);
  138.    compile else
  139.       --call messagenwait("xxx1="xxx "yyy1="yyy);
  140.       map_point 1, xxx, yyy, off, comment;  -- map screen to doc
  141.       --call messagenwait("doc xxx2="xxx "yyy2="yyy);
  142.       map_point 2, xxx, yyy, off, comment;  -- map doc to line/col/offset
  143.       --call messagenwait("line="xxx "col="yyy "off="off);
  144.    compile endif
  145.    MouseLine = min(max(xxx, minline), .last)
  146.    MouseOff  = off
  147. compile if EVERSION >= 5.50  -- can go to MAXCOL+1 for GPI-style marking
  148.    if arg(6) then  -- Flag we want character we're on, not nearest intersection.
  149.       lne = xxx
  150.       col = yyy
  151.       map_point 6, lne, col, off, comment;  -- map line/col/offset to screen
  152.       if lne>mx then  -- The intersection selected is to the right of the mouse pointer;
  153.          yyy = yyy - 1  -- the character clicked on is the one to the left.
  154.       endif             -- Note:  could get col. 0 this way, the but following takes care of that.
  155.    endif
  156.    MouseCol  = min(max(yyy, 1), MAXCOL + (rightstr(arg(5),1)='G' and minline))
  157. compile else
  158.    MouseCol  = min(max(yyy, 1), MAXCOL)
  159. compile endif
  160.    return xxx
  161.  
  162. defproc SetMouseSet(IsGlobal, NewMSName)
  163.    universal GMousePrefix
  164.    universal LMousePrefix
  165.    universal EPM_utility_array_ID
  166.    if IsGlobal then
  167.       GMousePrefix = NewMSName"."
  168. compile if LOCAL_MOUSE_SUPPORT
  169.    else
  170.       LMousePrefix = NewMSName"."
  171.       -- Remember Local MouseSet
  172.       getfileid ThisFile;
  173.       do_array 2, EPM_utility_array_ID, "LocalMausSet."ThisFile, NewMSName
  174. compile endif
  175.    endif
  176.  
  177. compile if 0  -- Now in SELECT.E, only if LOCAL_MOUSE_SUPPORT = 1
  178. defselect
  179.    universal LMousePrefix
  180.    universal EPM_utility_array_ID
  181.    getfileid ThisFile
  182.    OldRC = Rc
  183.    rc = get_array_value(EPM_utility_array_ID, "LocalMausSet."ThisFile, NewMSName)
  184.    if RC then
  185.       if rc=-330 then
  186.          -- no mouseset bound to file yet, assume blank.
  187.          LMousePrefix = TransparentMouseHandler"."
  188.       else
  189.          call messagenwait('RC='RC)
  190.       endif
  191.       RC = OldRC
  192.    else
  193.       LMousePrefix = NewMSName"."
  194.    endif
  195. compile endif
  196.  
  197. defc processmousedropping
  198.    call psave_pos(savepos)
  199.    'MH_gotoposition'
  200.    'GetSharBuff'     -- See clipbrd.e for details
  201.    call prestore_pos(savepos)
  202.  
  203. defc processmouse
  204.    universal EPM_utility_array_ID
  205.    universal GMousePrefix
  206.    universal LMousePrefix
  207. compile if EVERSION >= '6.03'
  208.    universal WindowHadFocus
  209.    parse arg WindowHadFocus arg1
  210. compile else
  211.    arg1 = arg(1)
  212. compile endif
  213.    if LMousePrefix<>BlankMouseHandler"." then
  214.       OldRc = rc
  215. compile if LOCAL_MOUSE_SUPPORT
  216.       rc = get_array_value(EPM_utility_array_ID, LMousePrefix||arg1, CommandString)
  217.       if not rc then
  218.          -- Found it.
  219.          Rc = oldRC
  220.          if CommandString<>'' then
  221.             CommandString
  222.             return
  223.          endif
  224.       else
  225.          if rc<>-330 then
  226.             sayerror UNKNOWN_MOUSE_ERROR__MSG rc
  227.             rc = OldRc
  228.             return
  229.          endif
  230.          -- rc==-330 (no local handler found), now try to find a global one.
  231.       endif
  232. compile endif
  233.       if GMousePrefix<>BlankMouseHandler"." then
  234.          rc = get_array_value(EPM_utility_array_ID, GMousePrefix||arg1, CommandString)
  235.          if not rc then
  236.             -- Found it.
  237.             Rc = oldRC
  238.             if CommandString<>'' then
  239.                CommandString
  240.             endif
  241.             return
  242.          else
  243.             if rc<>-330 then
  244.                sayerror UNKNOWN_MOUSE_ERROR__MSG rc
  245.             else
  246.                -- nothing assigned to that action
  247.             endif
  248.             rc = OldRc
  249.             return
  250.          endif
  251.       endif
  252.    endif
  253.  
  254.  
  255. defproc register_mousehandler(IsGlobal, event, mcommand)
  256.    universal EPM_utility_array_ID
  257.    universal GMousePrefix
  258.    universal LMousePrefix
  259.    if IsGlobal then
  260.       MousePrefix = GMousePrefix
  261.    else
  262. compile if LOCAL_MOUSE_SUPPORT
  263.       if (LMousePrefix=BlankMouseHandler".") or
  264.          (LMousePrefix=TransparentMouseHandler".") then
  265.          -- can't assign to that mouse handler.
  266. compile endif
  267.          return
  268. compile if LOCAL_MOUSE_SUPPORT
  269.       endif
  270.       MousePrefix = LMousePrefix
  271. compile endif
  272.    endif
  273.    do_array 2, EPM_utility_array_ID, MousePrefix||event, mcommand   -- assign
  274.  
  275. compile if EVERSION >= '6.03' & (CLICK_ONLY_GIVES_FOCUS = 1 | CLICK_ONLY_GIVES_FOCUS = 'ADVANCED')
  276. defc MH_gotoposition2
  277.    universal WindowHadFocus
  278.    if WindowHadFocus then
  279.       'MH_gotoposition'
  280.    endif
  281. compile endif
  282.  
  283. defc MH_gotoposition
  284. compile if WANT_STREAM_MODE = 'SWITCH'
  285.    universal stream_mode
  286. compile endif
  287.    -- this procedure moves the cursor to the current mouse location.
  288. ;;
  289. ;;  Old way
  290. ;;
  291. ;;   .cursory = .mousey
  292. ;;   .cursorx = .mousex
  293. ;;
  294. compile if TOP_OF_FILE_VALID = 'STREAM' & WANT_STREAM_MODE = 'SWITCH'
  295.  compile if UNDERLINE_CURSOR
  296.    ml = MouseLineColOff(MouseLine, MouseCol, MouseOff, stream_mode, '', 1)
  297.  compile else
  298.    ml = MouseLineColOff(MouseLine, MouseCol, MouseOff, stream_mode)
  299.  compile endif
  300. compile elseif TOP_OF_FILE_VALID
  301.  compile if UNDERLINE_CURSOR
  302.    ml = MouseLineColOff(MouseLine, MouseCol, MouseOff, 0, '', 1)
  303.  compile else
  304.    ml = MouseLineColOff(MouseLine, MouseCol, MouseOff, 0)
  305.  compile endif
  306. compile else
  307.  compile if UNDERLINE_CURSOR
  308.    ml = MouseLineColOff(MouseLine, MouseCol, MouseOff, 1, '', 1)
  309.  compile else
  310.    ml = MouseLineColOff(MouseLine, MouseCol, MouseOff, 1)
  311.  compile endif
  312. compile endif
  313. compile if EVERSION >= 5.20
  314.    oldsx = .scrollx;
  315.  compile if EVERSION >= 5.50
  316.    .lineg = MouseLine
  317.  compile else
  318.    oldsy = .scrolly;
  319.    MouseLine
  320.  compile endif
  321. compile else
  322.    MouseLine
  323. compile endif
  324. compile if WANT_STREAM_MODE
  325.  compile if WANT_STREAM_MODE = 'SWITCH'
  326.    if stream_mode & ml > .last then
  327.  compile else
  328.    if ml > .last then      -- If click below "Bottom of File",
  329.  compile endif
  330.       end_line             --   go to end of last line.
  331.    else
  332. compile endif  -- WANT_STREAM_MODE
  333.       .col  = MouseCol
  334.       while MouseOff<0 do
  335.          left
  336.          MouseOff = MouseOff + 1
  337.       endwhile
  338.       while MouseOff>0 do
  339.          right
  340.          MouseOff = MouseOff - 1
  341.       endwhile
  342. compile if WANT_STREAM_MODE
  343.    endif
  344. compile endif  -- WANT_STREAM_MODE
  345. compile if WANT_STREAM_MODE
  346.  compile if WANT_STREAM_MODE = 'SWITCH'
  347.    if stream_mode then
  348.  compile endif
  349.    if .col > length(textline(.line)) then
  350.       end_line
  351.    endif
  352.  compile if WANT_STREAM_MODE = 'SWITCH'
  353.    endif
  354.  compile endif
  355. compile endif
  356. compile if EVERSION >= 5.20
  357.    .scrollx = oldsx;
  358.    compile if EVERSION >= 5.50
  359.    compile else
  360.       .scrolly = oldsy;
  361.    compile endif
  362. compile endif
  363.  
  364. defc MH_begin_mark
  365.    universal BeginningLineOfDrag
  366.    universal BeginningColOfDrag
  367. compile if WANT_CUA_MARKING = 'SWITCH'
  368.    universal CUA_marking_switch
  369. compile endif
  370. compile if WANT_STREAM_MODE = 'SWITCH'
  371.    universal stream_mode
  372. compile endif
  373. compile if 0
  374.    mt = upcase(arg(1))
  375.    if marktype() then
  376.       getfileid curfileid
  377.       getmark markfirstline,marklastline,markfirstcol,marklastcol,markfileid
  378.       if marktype() <> mt or markfileid <> curfileid then
  379.          sayerror -279  -- sayerror('Text already marked')
  380.          return
  381.       endif
  382.    endif
  383. compile elseif WANT_CUA_MARKING = 1 | DRAG_ALWAYS_MARKS
  384.    unmark
  385.    'ClearSharBuff'       /* Remove Content in EPM shared text buffer */
  386. compile else
  387.  compile if WANT_CUA_MARKING = 'SWITCH'
  388.    if CUA_marking_switch then
  389.       unmark
  390.       'ClearSharBuff'       /* Remove Content in EPM shared text buffer */
  391.    endif
  392.  compile endif
  393.    if marktype() then
  394.       sayerror-279  --  sayerror('Text already marked')
  395.       return
  396.    endif
  397. compile endif
  398.    ml = MouseLineColOff(BeginningLineOfDrag, BeginningColOfDrag, MouseOff, 1, arg(1));
  399. compile if WANT_STREAM_MODE
  400.  compile if WANT_STREAM_MODE = 'SWITCH'
  401.    if stream_mode & ml > .last then
  402.  compile else
  403.    if ml > .last then      -- If click below "Bottom of File" ...
  404.  compile endif
  405.       BeginningLineOfDrag = .last
  406.       BeginningColOfDrag = length(textline(.last))+1
  407.    endif
  408. compile endif  -- WANT_STREAM_MODE
  409.    call register_mousehandler(1, 'ENDDRAG',    'MH_end_mark '||arg(1))  -- shifted
  410.    call register_mousehandler(1, 'CANCELDRAG', 'MH_cancel_mark')  -- shifted
  411.    if upcase(arg(1))='LINE' then
  412.       .DragStyle = 2
  413.    elseif leftstr(upcase(arg(1)),5)='BLOCK' then
  414.       .DragStyle = 1
  415.    elseif leftstr(upcase(arg(1)),4)='CHAR' then
  416.       .DragStyle = 3
  417.    endif
  418.    mouse_setpointer MARK_POINTER
  419. compile if DRAGCOLOR<>''
  420.    .DragColor = DRAGCOLOR
  421. compile else
  422.    .DragColor = .markcolor
  423. compile endif
  424.  
  425. defc MH_end_mark
  426.    universal BeginningLineOfDrag
  427.    universal BeginningColOfDrag
  428. compile if EPM_POINTER = 'SWITCH'
  429.    universal vEPM_POINTER
  430. compile endif
  431. compile if WANT_CUA_MARKING = 'SWITCH'
  432.    universal CUA_marking_switch
  433. compile endif
  434. compile if WANT_STREAM_MODE = 'SWITCH'
  435.    universal stream_mode
  436. compile endif
  437.    ml = MouseLineColOff(endingline, endingcol, MouseOff, 1, arg(1));
  438. compile if WANT_STREAM_MODE
  439.  compile if WANT_STREAM_MODE = 'SWITCH'
  440.    if stream_mode & ml > .last then
  441.  compile else
  442.    if ml > .last then      -- If click below "Bottom of File" ...
  443.  compile endif
  444.       endingline = .last
  445.       endingcol = length(textline(.last))+1
  446.    endif
  447.    if not (ml > .last & BeginningLineOfDrag = endingline & BeginningColOfDrag = endingcol) then
  448. compile endif  -- WANT_STREAM_MODE
  449.       unmark
  450.       getfileid CurrentFile
  451.       call pset_mark(BeginningLineOfDrag, endingline,
  452.                      BeginningColOfDrag,  max(endingcol,1),  arg(1), CurrentFile)
  453.       /* Copy the marked area to the clipboard in case we want to copy it */
  454.       /* into a different editor window.                                  */
  455.       'Copy2SharBuff'
  456. compile if WANT_STREAM_MODE
  457.    else
  458.       refresh  -- Get rid of the drag-mark highlighting
  459.    endif
  460. compile endif  -- WANT_STREAM_MODE
  461. compile if EPM_POINTER = 'SWITCH'
  462.    mouse_setpointer vEPM_POINTER
  463. compile else
  464.    mouse_setpointer EPM_POINTER
  465. compile endif
  466. compile if WANT_CUA_MARKING
  467.  compile if WANT_CUA_MARKING = 'SWITCH'
  468.    if CUA_marking_switch then
  469.  compile endif
  470.  compile if EVERSION >= '5.50'  -- GPI version allows cursor to be off screen
  471.    if .cursorx > 0 & .cursorx <= .windowwidth & .cursory > 0 & .cursory <= .windowheight then
  472.  compile endif
  473.    getmark  firstline,lastline,firstcol,lastcol,fileid
  474.    if marktype()<>'LINE' then
  475.       .col=lastcol
  476.    endif
  477.    if lastline<>.line then
  478.       if lastline>.line then '+'lastline-.line; else lastline-.line; endif
  479.    endif
  480.  compile if EVERSION >= '5.50'
  481.    endif
  482.  compile endif
  483.    'MH_gotoposition'
  484.  compile if WANT_CUA_MARKING = 'SWITCH'
  485.    endif
  486.  compile endif
  487. compile endif
  488. ;  refresh                                          ???
  489.    call register_mousehandler(1, 'ENDDRAG', ' ')
  490.    call register_mousehandler(1, 'CANCELDRAG', ' ')
  491.  
  492. defc MH_cancel_mark
  493. compile if EPM_POINTER = 'SWITCH'
  494.    universal vEPM_POINTER
  495. compile endif
  496. compile if EPM_POINTER = 'SWITCH'
  497.    mouse_setpointer vEPM_POINTER
  498. compile else
  499.    mouse_setpointer EPM_POINTER
  500. compile endif
  501.    call register_mousehandler(1, 'ENDDRAG', ' ')
  502.    call register_mousehandler(1, 'CANCELDRAG', ' ')
  503.    refresh
  504.  
  505. defc markword
  506.    if arg(1) then
  507.       'MH_gotoposition'
  508.       unmark
  509.    endif
  510.    call pmark_word()
  511.  
  512. defc marktoken
  513.    if arg(1) then
  514.       'MH_gotoposition'
  515.    endif
  516.    if find_token(startcol, endcol) then
  517.       getfileid fid
  518. compile if WANT_CHAR_OPS
  519.       call pset_mark(.line, .line, startcol, endcol, 'CHAR', fid)
  520. compile else
  521.       call pset_mark(.line, .line, startcol, endcol, 'BLOCK', fid)
  522. compile endif
  523.       'Copy2SharBuff'       /* Copy mark to shared text buffer */
  524.    endif
  525.  
  526. defc findword
  527.    if arg(1) then
  528.       'MH_gotoposition'
  529.    endif
  530.    if find_token(startcol, endcol) then
  531.       .col = endcol
  532.       'l '\1 || substr(textline(.line), startcol, (endcol-startcol)+1)
  533.    endif
  534.  
  535. compile if WANT_CUA_MARKING
  536. defc MH_singleclick
  537.  compile if EVERSION >= '6.03' & (CLICK_ONLY_GIVES_FOCUS = 1 | CLICK_ONLY_GIVES_FOCUS = 'CUA')
  538.    universal WindowHadFocus
  539.    if WindowHadFocus then
  540.  compile endif
  541.       unmark
  542.       'ClearSharBuff'       /* Remove Content in EPM shared text buffer */
  543.       'MH_gotoposition'
  544.  compile if EVERSION >= '6.03' & (CLICK_ONLY_GIVES_FOCUS = 1 | CLICK_ONLY_GIVES_FOCUS = 'CUA')
  545.    endif
  546.  compile endif
  547.  
  548. defc MH_dblclick
  549.    unmark
  550.    if .line then
  551. ;;    call pmark_word()  -- pmark_word doesn't include white space; the following does:
  552.       call pbegin_word()
  553.       mark_char
  554.       startcol = .col
  555.       tab_word
  556. ;     if .col<>length(textline(.line)) then .col = .col - 1; endif
  557.       .col = .col - 1
  558.       mark_char
  559.       .col = startcol
  560.    endif
  561.    'Copy2SharBuff'       /* Copy mark to shared text buffer */
  562.  
  563. compile endif
  564.  
  565. defc MH_double  -- Used to be just 'dupmark U', but now overloaded in a DIR listing:
  566. compile if WANT_TREE
  567.    if upcase(subword(.filename,1,2)) = '.DOS DIR' | .filename = '.tree' then
  568. compile else
  569.    if upcase(subword(.filename,1,2)) = '.DOS DIR' then
  570. compile endif
  571.       executekey a_1  -- For simplicity, assume user hasn't redefined this key:
  572.    else
  573.       unmark
  574.       'ClearSharBuff'
  575.    endif
  576.  
  577. defc MH_shiftclick
  578.    if marktype() then
  579.       getmark markfirstline,marklastline,markfirstcol,marklastcol,markfileid
  580.    else
  581.       markfileid=''
  582.    endif
  583.    unmark
  584.    getfileid CurrentFile
  585.    if CurrentFile<>markfileid then
  586.       markfirstline=.line; markfirstcol=.col
  587.    elseif markfirstline=.line & markfirstcol=.col then
  588.       markfirstline=marklastline; markfirstcol=marklastcol
  589.    endif
  590.    call MouseLineColOff(MouseLine, MouseCol, MouseOff, 1, arg(1))
  591.    call pset_mark(markfirstline, MouseLine, markfirstcol, MouseCol, 'CHAR', CurrentFile)
  592.    'MH_gotoposition'
  593.    'Copy2SharBuff'
  594.  
  595. define
  596.    SUPPORT_DRAGDROP_FOR_BOTH = 1  -- Let's see if this works; make it easy to remove if not.
  597.  
  598. #define WM_BUTTON1UP            114 -- 0x0072
  599. #define WM_BUTTON1DBLCLK        115 -- 0x0073
  600. #define WM_BUTTON2UP            117 -- 0x0075
  601. #define WM_BUTTON2DBLCLK        118 -- 0x0076
  602. #define WM_BUTTON3UP            120 -- 0x0078
  603. #define WM_CHORD               1040 -- 0x0410
  604. #define WM_BUTTON1MOTIONSTART  1041 -- 0x0411
  605. #define WM_BUTTON1MOTIONEND    1042 -- 0x0412
  606. #define WM_BUTTON1CLICK        1043 -- 0x0413
  607. #define WM_BUTTON2MOTIONSTART  1044 -- 0x0414
  608. #define WM_BUTTON2MOTIONEND    1045 -- 0x0415
  609. #define WM_BUTTON2CLICK        1046 -- 0x0416
  610. #define WM_BUTTON3MOTIONSTART  1047 -- 0x0417
  611.  
  612. definit
  613. compile if EPM_POINTER = 'SWITCH'
  614.    universal vEPM_POINTER
  615. compile endif
  616. compile if EPM32
  617.  compile if EPM_POINTER = 'SWITCH'
  618.   compile if defined(MY_MOUSE_POINTER)  -- User has a preference for the default pointer
  619.    vEPM_POINTER = MY_MOUSE_POINTER
  620.   compile else
  621.    vEPM_POINTER = TEXT_POINTER      -- GPI version gets text pointer
  622.   compile endif
  623.  compile endif
  624.    'postme mouse_init'
  625.  
  626. defc mouse_init
  627.  compile if EPM_POINTER = 'SWITCH'
  628.    universal vEPM_POINTER
  629.  compile endif
  630. compile endif  -- EPM32
  631.    universal EPM_utility_array_ID, MouseStyle
  632. compile if WANT_MMEDIA
  633.    universal mmedia_font
  634.    mmedia_font = registerfont('Multimedia Icons', 0, 0)
  635. compile endif
  636. compile if EPM_POINTER = 'SWITCH'
  637.  compile if defined(MY_MOUSE_POINTER)  -- User has a preference for the default pointer
  638.   compile if not EPM32
  639.    vEPM_POINTER = MY_MOUSE_POINTER
  640.   compile endif
  641.   compile if (EVERSION < 5.50 & MY_MOUSE_POINTER<>SYSTEM_POINTER) | (EVERSION >= 5.50 & MY_MOUSE_POINTER<>TEXT_POINTER)
  642.    mouse_setpointer vEPM_POINTER
  643.   compile endif
  644.  compile elseif EPM32   -- Do nothing; initialized in DEFINIT so INIT_CONFIG can override.
  645.  compile elseif EVERSION < 5.50        -- No user preference?  Use the default for this version of EPM.
  646.    vEPM_POINTER = SYSTEM_POINTER    -- AVIO version gets arrow pointer
  647.  compile else
  648.    vEPM_POINTER = TEXT_POINTER      -- GPI version gets text pointer
  649.  compile endif
  650. compile elseif (EVERSION < 5.21 & EPM_POINTER<>SYSTEM_POINTER) | (EVERSION >= 5.21 & EPM_POINTER<>TEXT_POINTER)
  651.    mouse_setpointer EPM_POINTER
  652. compile endif
  653.    -- set initial mousesets
  654.    SetMouseSet(1, "BaseMouseHandlers") -- default global mouseset
  655. compile if LOCAL_MOUSE_SUPPORT
  656.    SetMouseSet(0, TransparentMouseHandler)  -- default local mouseset is blank.
  657. compile endif
  658. compile if SUPPORT_DRAGDROP_FOR_BOTH
  659.  compile if EPM32
  660.    res =  atol(dynalink32( 'PMWIN',
  661.                            '#829',           -- Win32QuerySysValue
  662.                             atol(1) ||       -- HWND_DESKTOP
  663.                             atol(75),        -- SV_BEGINDRAG
  664.                             2))
  665. ;  kc_flags = itoa(substr(res,3,2), 10)
  666.    msgid = itoa(substr(res, 1, 2), 10)
  667.    if MouseStyle = 1 then but_1 = BLOCKG_MARK; c_but_1 = CHARG_MARK
  668.                      else but_1 = CHARG_MARK;  c_but_1 = BLOCKG_MARK
  669.    endif
  670.    if msgid = WM_BUTTON1MOTIONSTART then
  671.       call register_mousehandler(1, '1 BEGINDRAG 0', 'MH_begin_drag_2 0' WM_BUTTON1UP but_1 CHARG_MARK)
  672.       call register_mousehandler(1, '1 BEGINDRAG 2', 'MH_begin_drag_2 1' WM_BUTTON1UP c_but_1 CHARG_MARK)
  673.    elseif msgid = WM_BUTTON2MOTIONSTART then
  674.       call register_mousehandler(1, '2 BEGINDRAG 0', 'MH_begin_drag_2 0' WM_BUTTON2UP 'LINE')
  675.       call register_mousehandler(1, '2 BEGINDRAG 2', 'MH_begin_drag_2 1' WM_BUTTON2UP 'LINE')
  676.    elseif msgid = WM_BUTTON3MOTIONSTART then
  677.       call register_mousehandler(1, '3 BEGINDRAG 0', 'MH_begin_drag_2 0' WM_BUTTON3UP  c_but_1)
  678.       call register_mousehandler(1, '3 BEGINDRAG 2', 'MH_begin_drag_2 1' WM_BUTTON3UP  but_1)
  679.    else
  680.       -- Huh?
  681.    endif
  682.  compile else
  683.    call register_mousehandler(1, '2 BEGINDRAG 0', 'MH_begin_drag_2 0')
  684.    call register_mousehandler(1, '2 BEGINDRAG 2', 'MH_begin_drag_2 1')
  685.  compile endif
  686. compile endif
  687. compile if WANT_MMEDIA
  688.    call register_mousehandler(1, '1 SECONDCLK 0', 'MH_MM_dblclick')
  689. ;compile elseif WANT_SPEECH
  690. ;   call register_mousehandler(1, '1 SECONDCLK 0', 'SPPopUp')
  691. compile endif
  692. ;compile if WANT_SPEECH
  693. ;   call register_mousehandler(1, '1 SECONDCLK 2', 'SPPlay')
  694. ;compile endif
  695. compile if WANT_CUA_MARKING = 'SWITCH'
  696.    call MH_set_Mouse(msgid)
  697.  
  698. defproc MH_set_mouse
  699.    universal CUA_marking_switch, MouseStyle
  700.  compile if EPM32
  701.    msgid = arg(1)
  702.    if msgid='' then
  703.       res =  atol(dynalink32( 'PMWIN',
  704.                               '#829',           -- Win32QuerySysValue
  705.                                atol(1) ||       -- HWND_DESKTOP
  706.                                atol(75),        -- SV_BEGINDRAG
  707.                                2))
  708. ;     kc_flags = itoa(substr(res,3,2), 10)
  709.       msgid = itoa(substr(res, 1, 2), 10)
  710.    endif
  711.  compile endif
  712.  
  713.    if CUA_marking_switch then
  714. compile endif
  715.  
  716.       -- 1 == shift, 2 = control, 4 = alt.
  717. compile if WANT_CUA_MARKING
  718.    call register_mousehandler(1, '1 CLICK 0',     'MH_singleclick')
  719.    call register_mousehandler(1, '1 CLICK 1',     'MH_shiftclick')
  720.    call register_mousehandler(1, '1 CLICK 2',     'MH_singleclick')
  721.    call register_mousehandler(1, '1 CLICK 3',     'MH_shiftclick')
  722.    call register_mousehandler(1, '1 CLICK 4',     'MH_singleclick')
  723.    call register_mousehandler(1, '1 CLICK 5',     'MH_shiftclick')
  724.    call register_mousehandler(1, '1 CLICK 6',     'MH_singleclick')
  725.    call register_mousehandler(1, '1 CLICK 7',     'MH_shiftclick')
  726. compile if not WANT_MMEDIA -- and not WANT_SPEECH
  727.    call register_mousehandler(1, '1 SECONDCLK 0', 'MH_dblclick')
  728. compile endif
  729. ;compile if not WANT_SPEECH
  730.    call register_mousehandler(1, '1 SECONDCLK 2', 'MH_dblclick')
  731. ;compile endif
  732.    call register_mousehandler(1, '1 SECONDCLK 4', 'MH_dblclick')
  733.    call register_mousehandler(1, '1 SECONDCLK 6', 'MH_dblclick')
  734.  compile if EPM32
  735.    if msgid <> WM_BUTTON1MOTIONSTART then
  736.  compile endif
  737.    call register_mousehandler(1, '1 BEGINDRAG 0', 'MH_begin_mark' CHARG_MARK)
  738.    call register_mousehandler(1, '1 BEGINDRAG 2', 'MH_begin_mark' CHARG_MARK)
  739.  compile if EPM32
  740.    endif -- msgid <> WM_BUTTON1MOTIONSTART
  741.  compile endif
  742.    call register_mousehandler(1, '1 BEGINDRAG 1', 'MH_begin_mark' CHARG_MARK)
  743.    call register_mousehandler(1, '1 BEGINDRAG 3', 'MH_begin_mark' CHARG_MARK)
  744.    call register_mousehandler(1, '1 BEGINDRAG 4', 'MH_begin_mark' CHARG_MARK)
  745.    call register_mousehandler(1, '1 BEGINDRAG 5', 'MH_begin_mark' CHARG_MARK)
  746.    call register_mousehandler(1, '1 BEGINDRAG 6', 'MH_begin_mark' CHARG_MARK)
  747.    call register_mousehandler(1, '1 BEGINDRAG 7', 'MH_begin_mark' CHARG_MARK)
  748. compile endif  -- WANT_CUA_MARKING
  749.  
  750. compile if WANT_CUA_MARKING = 'SWITCH'
  751.  compile if EPM32
  752.    if msgid <> WM_BUTTON2MOTIONSTART then
  753.       call register_mousehandler(1, '2 BEGINDRAG 0', '')  -- Delete the defs
  754.       call register_mousehandler(1, '2 BEGINDRAG 2', '')
  755.    endif
  756.  compile else  -- else not EPM32
  757.   compile if not SUPPORT_DRAGDROP_FOR_BOTH
  758.       call register_mousehandler(1, '2 BEGINDRAG 0', '')  -- Delete the defs
  759.    compile if EVERSION >= 5.50
  760.       call register_mousehandler(1, '2 BEGINDRAG 2', '')
  761.    compile endif
  762.   compile endif  -- not SUPPORT_DRAGDROP_FOR_BOTH
  763.  compile endif  -- EPM32
  764.  compile if EPM32
  765.    if msgid <> WM_BUTTON3MOTIONSTART then
  766.       call register_mousehandler(1, '3 BEGINDRAG 0', '')  -- Delete the defs
  767.    endif
  768.  compile else  -- else not EPM32
  769.       call register_mousehandler(1, '3 BEGINDRAG 0', '')  -- from the other style.
  770.  compile endif  -- EPM32
  771.  compile if EVERSION >= 5.60 & EVERSION < '6.00c'
  772.       call register_mousehandler(1, '2 CLICK 0',     '')
  773.  compile endif
  774.       call register_mousehandler(1, '2 SECONDCLK 0', '')
  775.       call register_mousehandler(1, '2 SECONDCLK 2', '')
  776.       call register_mousehandler(1, '2 SECONDCLK 1', '')
  777.    else
  778.  compile if EVERSION < 5.50
  779.       call register_mousehandler(1, '1 CLICK 2',     '')  -- (ditto)
  780.  compile endif
  781.  compile if not EPM32
  782.       call register_mousehandler(1, '1 CLICK 4',     '')
  783.  compile endif
  784.       call register_mousehandler(1, '1 CLICK 6',     '')
  785. ;compile if not WANT_SPEECH
  786.      call register_mousehandler(1, '1 SECONDCLK 2', '')
  787. ;compile endif
  788.       call register_mousehandler(1, '1 SECONDCLK 4', '')
  789.       call register_mousehandler(1, '1 SECONDCLK 6', '')
  790.       call register_mousehandler(1, '1 BEGINDRAG 1', '')
  791.       call register_mousehandler(1, '1 BEGINDRAG 3', '')
  792.       call register_mousehandler(1, '1 BEGINDRAG 4', '')
  793.       call register_mousehandler(1, '1 BEGINDRAG 5', '')
  794.       call register_mousehandler(1, '1 BEGINDRAG 6', '')
  795.       call register_mousehandler(1, '1 BEGINDRAG 7', '')
  796. compile endif
  797.  
  798. compile if WANT_CUA_MARKING = 'SWITCH' or WANT_CUA_MARKING = 0
  799.  compile if EVERSION >= '6.03' & (CLICK_ONLY_GIVES_FOCUS = 1 | CLICK_ONLY_GIVES_FOCUS = 'ADVANCED')
  800.    call register_mousehandler(1, '1 CLICK 0',     'MH_gotoposition2')
  801.  compile else
  802.    call register_mousehandler(1, '1 CLICK 0',     'MH_gotoposition')
  803.  compile endif
  804.    call register_mousehandler(1, '1 CLICK 1',     'MH_shiftclick')
  805.    if MouseStyle = 1 then but_1 = BLOCKG_MARK; c_but_1 = CHARG_MARK
  806.                      else but_1 = CHARG_MARK;  c_but_1 = BLOCKG_MARK
  807.    endif
  808.  compile if EPM32
  809.    if msgid <> WM_BUTTON1MOTIONSTART then
  810.  compile endif
  811.    call register_mousehandler(1, '1 BEGINDRAG 0', 'MH_begin_mark 'but_1)
  812.    call register_mousehandler(1, '1 BEGINDRAG 2', 'MH_begin_mark 'c_but_1)
  813.  compile if EPM32
  814.    endif
  815.  compile endif
  816.  compile if EPM32
  817.    if msgid <> WM_BUTTON2MOTIONSTART then
  818.       call register_mousehandler(1, '2 BEGINDRAG 0', 'MH_begin_mark LINE')
  819.    endif
  820.    call register_mousehandler(1, '1 CLICK 2',     'ifinmark copy2clip')
  821.    call register_mousehandler(1, '1 CLICK 3',     'ifinmark cut')
  822.    call register_mousehandler(1, '1 CLICK 4',     'mc /MH_gotoposition/paste' DEFAULT_PASTE)
  823.    call register_mousehandler(1, '1 CLICK 5',     'mc /MH_gotoposition/paste' ALTERNATE_PASTE)
  824.  compile elseif EVERSION < 5.50
  825.    call register_mousehandler(1, '2 BEGINDRAG 0', 'MH_begin_mark LINE')
  826.  compile else
  827.   compile if not SUPPORT_DRAGDROP_FOR_BOTH
  828.    call register_mousehandler(1, '2 BEGINDRAG 0', 'MH_begin_drag_2 0')
  829.    call register_mousehandler(1, '2 BEGINDRAG 2', 'MH_begin_drag_2 1')
  830.   compile endif  -- not SUPPORT_DRAGDROP_FOR_BOTH
  831.    call register_mousehandler(1, '1 CLICK 2',     'MH_gotoposition')
  832.  compile endif
  833.  compile if EPM32
  834.    if msgid <> WM_BUTTON3MOTIONSTART then
  835.  compile endif
  836.    call register_mousehandler(1, '3 BEGINDRAG 0', 'MH_begin_mark 'c_but_1)
  837.  compile if EPM32
  838.    endif
  839.  compile endif
  840.  compile if not WANT_MMEDIA -- and not WANT_SPEECH
  841.    call register_mousehandler(1, '1 SECONDCLK 0', 'MH_double')
  842.  compile endif
  843.  compile if EVERSION >= 5.60 & EVERSION < '6.00c'
  844.    call register_mousehandler(1, '2 CLICK 0',     'MH_popup')
  845.  compile endif
  846.    call register_mousehandler(1, '2 SECONDCLK 0', 'markword 1')
  847.    call register_mousehandler(1, '2 SECONDCLK 2', 'marktoken 1')
  848.    call register_mousehandler(1, '2 SECONDCLK 1', 'findword 1')
  849.  compile if WANT_KEYWORD_HELP -- and not WANT_SPEECH
  850.    call register_mousehandler(1, '1 SECONDCLK 2', 'kwhelp')
  851.  compile endif
  852. compile endif
  853.  
  854. compile if WANT_CUA_MARKING = 'SWITCH'
  855.    endif
  856. compile endif
  857.  
  858. compile if EVERSION >= '6.00c'
  859.    call register_mousehandler(1, 'CHORD',     'Ring_More')
  860.  
  861.    -- NOP out the default action associated with user's context button
  862.    res =  atol(dynalink32( 'PMWIN',
  863.                            '#829',           -- Win32QuerySysValue
  864.                             atol(1) ||       -- HWND_DESKTOP
  865.                             atol(79),        -- SV_CONTEXTMENU
  866.                             2))
  867.    kc_flags = itoa(substr(res,3,2), 10)
  868.    msgid = itoa(substr(res, 1, 2), 10)
  869.    if msgid = WM_CHORD then
  870.       event = 'CHORD'
  871.       call register_mousehandler(1, 'CHORD', '')
  872.    else
  873.       if msgid = WM_BUTTON1DBLCLK or msgid = WM_BUTTON2DBLCLK then
  874.          event = 'SECONDCLK'
  875.       elseif msgid = WM_BUTTON1CLICK or msgid = WM_BUTTON2CLICK then
  876.          event = 'CLICK'
  877.       else
  878.          return  -- Unexpected!
  879.       endif
  880.       if msgid = WM_BUTTON1CLICK or msgid = WM_BUTTON1DBLCLK then
  881.          button = 1
  882.       else  -- must be WM_BUTTON2CLICK or WM_BUTTON2DBLCLK
  883.          button = 2
  884.       endif
  885.       call register_mousehandler(1, button event (kc_flags / 8), '')
  886.    endif
  887.  
  888.    call register_mousehandler(1, 'CONTEXTMENU',   'MH_popup')
  889. compile endif
  890.  
  891. compile if EVERSION >= 5.50
  892. defc MH_begin_drag_2  -- Determine if a click is within the selected area
  893.  compile if WANT_CUA_MARKING = 'SWITCH'
  894.    universal CUA_marking_switch
  895.  compile endif
  896.  compile if EPM32
  897.    parse arg copy_flag buttonup_msg advanced_marking_marktype CUA_marking_marktype
  898.  compile endif
  899.    if mouse_in_mark() then
  900.       call WindowMessage(0,  getpminfo(EPMINFO_EDITCLIENT),
  901.                          5434,               -- EPM_DRAGDROP_DIRECTTEXTMANIP
  902.  compile if EPM32
  903.                          copy_flag,
  904.                          buttonup_msg)
  905.  compile else
  906.                          arg(1),
  907.                          0)
  908.  compile endif
  909.  compile if EPM32
  910.       return
  911.    endif
  912.    -- EPM32 doesn't give focus on a MB2 drag, in case it's direct text manipulation.
  913.    -- Here, we know it's not, so let's activate the window:
  914.    if buttonup_msg = WM_BUTTON2UP then
  915.       call dynalink32( 'PMWIN',
  916.                        '#851',                -- ordinal for Win32SetActiveWindow
  917.                        atol(1)     ||         -- HWND_DESKTOP
  918.                        gethwndc(EPMINFO_PARENTCLIENT), 2)
  919.    endif
  920.   compile if WANT_CUA_MARKING = 'SWITCH'
  921.    if CUA_marking_switch then  -- If 'SWITCH', we do advanced mark action if CUA switch is off
  922.   compile endif  -- WANT_CUA_MARKING = 'SWITCH'
  923.   compile if WANT_CUA_MARKING
  924.       if CUA_marking_marktype<>'' then   -- This can be blank
  925.          'MH_begin_mark' CUA_marking_marktype
  926.       endif
  927.   compile endif
  928.   compile if WANT_CUA_MARKING = 'SWITCH'
  929.    else       -- else, not CUA marking switch - do the standard EPM ('advanced marking') action
  930.   compile endif  -- WANT_CUA_MARKING = 'SWITCH'
  931.   compile if WANT_CUA_MARKING <> 1
  932.       'MH_begin_mark' advanced_marking_marktype
  933.   compile endif
  934.   compile if WANT_CUA_MARKING = 'SWITCH'
  935.    endif
  936.   compile endif  -- WANT_CUA_MARKING = 'SWITCH'
  937.  
  938.  compile else  -- else not EPM32
  939.   compile if WANT_CUA_MARKING <> 1      -- If 1, we never do a line mark
  940.    compile if WANT_CUA_MARKING = 'SWITCH'
  941.    elseif not CUA_marking_switch then  -- If 'SWITCH', we line mark if CUA switch is off
  942.    compile else                         -- Else WANT_CUA_MARKING = 0
  943.    else                                -- so if not drag/drop, we always line mark.
  944.    compile endif  -- WANT_CUA_MARKING = 'SWITCH'
  945.       'MH_begin_mark LINE'
  946.   compile endif  -- WANT_CUA_MARKING <> 1
  947.    endif
  948.  compile endif  -- EPM32
  949.  
  950. defproc mouse_in_mark()
  951.    -- First we query the position of the mouse
  952.    call MouseLineColOff(MouseLine, MouseCol, MouseOff, 0)
  953.    -- Now determine if the mouse is in the selected text area.
  954.    mt=leftstr(marktype(),1)
  955.    if mt then
  956.       getfileid curfileid
  957.       getmark markfirstline,marklastline,markfirstcol,marklastcol,markfileid
  958.       if  (markfileid == curfileid) and
  959.           (MouseLine >= markfirstline) and (MouseLine <= marklastline) then
  960.  
  961.           -- assert:  at this point the only case where the text is outside
  962.           --          the selected area is on a single line char mark and a
  963.           --          block mark.  Any place else is a valid selection
  964.           if not ((mt=='C' & (markfirstline=MouseLine & MouseCol < markfirstcol) or (marklastline=MouseLine & MouseCol > marklastcol)) or
  965.                   (mt=='B' & (MouseCol < markfirstcol or MouseCol > marklastcol)) ) then
  966.              return 1
  967.           endif
  968.       endif
  969.    endif
  970.  
  971. defc ifinmark =
  972.    if mouse_in_mark() then
  973.       ''arg(1)
  974.    endif
  975. compile endif
  976.  
  977. compile if WANT_MMEDIA
  978. defc MH_MM_dblclick
  979.    universal mmedia_font
  980.  compile if WANT_CUA_MARKING = 'SWITCH'
  981.    universal CUA_marking_switch
  982.  compile endif
  983.    -- First we query the position of the mouse
  984.    call MouseLineColOff(MouseLine, MouseCol, MouseOff, 0, '', 1)
  985.    class = 0; offst = -2
  986.    query_attribute class, val, IsPush, offst, MouseCol, MouseLine
  987.    if class=32 /* | (class=16 & val=mmedia_font & IsPush) */ then
  988. ;;    if class=16 then  -- If we got the font class, go for the mmedia class.
  989. ;;       offst = -2
  990. ;;       query_attribute class, val, IsPush, offst, MouseCol, MouseLine
  991. ;;    endif
  992.       .col = MouseCol
  993.       ch = asc(substr(textline(MouseLine), MouseCol, 1))
  994. ;;    sayerror 'selected MMedia type' ch 'with value' val
  995.       circleit 1, MouseLine, MouseCol-1, MouseCol+1, 16777220
  996.       -- Send a message to the owner of the EMLE: OBJEPM_LINKOBJ = 0x15A4 = 5540
  997.       call windowmessage(0,  getpminfo(EPMINFO_PARENTFRAME), 5540, val, ch)
  998. ;compile if WANT_SPEECH
  999. ;   else  -- not mmedia, so do the standard action
  1000. ;      'SPPopUp'  -- Speech support always does this
  1001. ;compile else
  1002.   compile if WANT_CUA_MARKING = 'SWITCH'
  1003.    elseif CUA_marking_switch then
  1004.   compile else
  1005.    else
  1006.   compile endif
  1007.   compile if WANT_CUA_MARKING
  1008.       'MH_dblclick'  -- This is the CUA-marking-mode action
  1009.   compile endif
  1010.   compile if WANT_CUA_MARKING = 'SWITCH'
  1011.    else
  1012.   compile endif
  1013.   compile if WANT_CUA_MARKING <> 1
  1014.       'MH_Double'    -- This is the normal EPM marking mode action
  1015.   compile endif
  1016. ;compile endif  -- WANT_SPEECH
  1017.    endif
  1018. compile endif
  1019.  
  1020. compile if EVERSION >= 5.60
  1021. const
  1022.    FILL_MARK_MENU__MSG = 'Fill mark'
  1023.    FILL_MARK_MENUP__MSG = \1'Fill marked region with a character, overlaying current contents.'
  1024.    HP_POPUP_FILL = 0
  1025.    REFLOW_MARK_MENU__MSG = 'Reflow mark'
  1026.    REFLOW_MARK_MENUP__MSG = \1'Reflow text in marked region.'
  1027.    HP_POPUP_REFLOW = 0
  1028.    MARK_WORD_MENU__MSG = 'Mark word'
  1029.    MARK_WORD_MENUP__MSG = \1'Mark space-delimited word under mouse pointer.'
  1030.    HP_POPUP_MARKWORD = 0
  1031.    MARK_TOKEN_MENU__MSG = 'Mark identifier'
  1032.    MARK_TOKEN_MENUP__MSG = \1'Mark the C-language identifier under the mouse pointer.'
  1033.    HP_POPUP_MARKTOKEN = 0
  1034.    FIND_TOKEN_MENU__MSG = 'Find identifier'
  1035.    FIND_TOKEN_MENUP__MSG = \1'Find the next occurrence of the identifier under the mouse pointer.'
  1036.    HP_POPUP_FINDTOKEN = 0
  1037.    UPCASE_MARK_MENU__MSG = 'Uppercase selection'
  1038.    UPCASE_MARK_MENUP__MSG = \1'Translate selected text to upper case.'
  1039.    HP_POPUP_UPCASEMARK = 0
  1040.    LOCASE_MARK_MENU__MSG = 'Lowercase selection'
  1041.    LOCASE_MARK_MENUP__MSG = \1'Translate selected text to lower case.'
  1042.    HP_POPUP_LOCASEMARK = 0
  1043.    UPCASE_WORD_MENU__MSG = 'Uppercase word'
  1044.    UPCASE_WORD_MENUP__MSG = \1'Translate word under mouse pointer to upper case.'
  1045.    HP_POPUP_UPCASEWORD = 0
  1046.    LOCASE_WORD_MENU__MSG = 'Lowercase word'
  1047.    LOCASE_WORD_MENUP__MSG = \1'Translate word under mouse pointer to lower case.'
  1048.    HP_POPUP_LOCASEWORD = 0
  1049.    SHIFT_MENU__MSG = 'Shift'
  1050.    SHIFT_MENUP__MSG = \1'Shift marked text left or right.'
  1051.    HP_POPUP_SHIFT = 0
  1052.    SHIFTLEFT_MENU__MSG = 'Shift left 1'
  1053.    SHIFTLEFT_MENUP__MSG = \1'Shift marked text left 1 character.'
  1054.    HP_POPUP_SHIFTLEFT = 0
  1055.    SHIFTLEFT3_MENU__MSG = 'Shift left 3'
  1056.    SHIFTLEFT3_MENUP__MSG = \1'Shift marked text left 3 characters.'
  1057.    HP_POPUP_SHIFTLEFT3 = 0
  1058.    SHIFTLEFT8_MENU__MSG = 'Shift left 8'
  1059.    SHIFTLEFT8_MENUP__MSG = \1'Shift marked text left 8 characters.'
  1060.    HP_POPUP_SHIFTLEFT8 = 0
  1061.    SHIFTRIGHT_MENU__MSG = 'Shift right 1'
  1062.    SHIFTRIGHT_MENUP__MSG = \1'Shift marked text right 1 character.'
  1063.    HP_POPUP_SHIFTRIGHT = 0
  1064.    SHIFTRIGHT3_MENU__MSG = 'Shift right 3'
  1065.    SHIFTRIGHT3_MENUP__MSG = \1'Shift marked text right 3 characters.'
  1066.    HP_POPUP_SHIFTRIGHT3 = 0
  1067.    SHIFTRIGHT8_MENU__MSG = 'Shift right 8'
  1068.    SHIFTRIGHT8_MENUP__MSG = \1'Shift marked text right 8 characters.'
  1069.    HP_POPUP_SHIFTRIGHT8 = 0
  1070.    CENTER_LINE_MENU__MSG = 'Center line'
  1071.    CENTER_LINE_MENUP__MSG = \1'Center line under mouse pointer vertically in window.'
  1072.    HP_POPUP_CENTERLINE = 0
  1073.    CENTER_MARK_MENU__MSG = 'Center text'
  1074.    CENTER_MARK_MENUP__MSG = \1'Center marked text within margins or block mark.'
  1075.    HP_POPUP_CENTERMARK = 0
  1076.    SORT_MARK_MENU__MSG = 'Sort'
  1077.    SORT_MARK_MENUP__MSG = \1'Sort marked lines, using block mark (if present) as key.'
  1078.    HP_POPUP_SORT = 0
  1079.    TOP_LINE_MENU__MSG = 'Scroll to top'
  1080.    TOP_LINE_MENUP__MSG = \1'Scroll so line under mouse pointer is at top of window.'
  1081.    HP_POPUP_TOP = 0
  1082.  
  1083.  compile if WANT_TREE
  1084.    LOAD_FILE_MENU__MSG = '~Load file'
  1085.    SORT_ASCENDING_MENU__MSG = '~Sort ascending'
  1086.    SORT_DATE_MENU__MSG = 'Sort by ~date'
  1087.    SORT_TIME_MENU__MSG = 'Sort by ~time'
  1088.    SORT_SIZE_MENU__MSG = 'Sort by ~size'
  1089.    SORT_EASIZE_MENU__MSG = 'Sort by ~EA size'
  1090.    SORT_FULLNAME_MENU__MSG = 'Sort by ~fully-qualified filename'
  1091.    SORT_NAME_MENU__MSG = 'Sort by ~name'
  1092.    SORT_EXTENSION_MENU__MSG = 'Sort by ~extension'
  1093.    SORT_DESCENDING_MENU__MSG = 'Sort ~descending'
  1094.  
  1095.    LOAD_FILE_MENUP__MSG = \1'Load the file or list the directory under the cursor'
  1096.    SORT_ASCENDING_MENUP__MSG = \1'Sort the file or marked lines from smallest to largest'
  1097.    SORT_XXXX_MENUP__MSG = \1'Sort the file or marked lines by the indicated attribute'
  1098.    SORT_DESCENDING_MENUP__MSG = \1'Sort the file or marked lines from largest to smallest'
  1099.  compile endif
  1100.  
  1101.  
  1102. defc MH_popup
  1103.    universal activemenu, previouslyactivemenu
  1104.  compile if CHECK_FOR_LEXAM
  1105.    universal LEXAM_is_available
  1106.  compile endif
  1107.    if previouslyactivemenu = '' then
  1108.       previouslyactivemenu = activemenu
  1109.    endif
  1110.    menuname = 'popup1'
  1111.    activemenu = menuname
  1112.  
  1113.    deletemenu menuname, 0, 0, 0
  1114.    buildsubmenu  menuname, 80, '', '', 0 , 0
  1115.    mt = leftstr(marktype(),1)
  1116.    in_mark = mouse_in_mark()  -- Save in a variable so user's include file can test.
  1117.  
  1118.  compile if INCLUDE_STANDARD_CONTEXT_MENU
  1119.   compile if WANT_TREE
  1120.    if .filename = '.tree' then
  1121.       buildmenuitem menuname, 80, 8000, LOAD_FILE_MENU__MSG\9'Alt+1',   'dokey a_1'LOAD_FILE_MENUP__MSG, 0, 0
  1122.       buildmenuitem menuname, 80, 8001, SORT_ASCENDING_MENU__MSG,   ''SORT_ASCENDING_MENUP__MSG, 17, 0
  1123.       buildmenuitem menuname, 80, 8002, SORT_DATE_MENU__MSG,        'treesort' 'D'SORT_XXXX_MENUP__MSG, 1, 0
  1124.       buildmenuitem menuname, 80, 8003, SORT_TIME_MENU__MSG,        'treesort' 'T'SORT_XXXX_MENUP__MSG, 1, 0
  1125.       buildmenuitem menuname, 80, 8004, SORT_SIZE_MENU__MSG,        'treesort' 'S'SORT_XXXX_MENUP__MSG, 1, 0
  1126.       buildmenuitem menuname, 80, 8005, SORT_EASIZE_MENU__MSG,      'treesort' 'EA'SORT_XXXX_MENUP__MSG, 1, 0
  1127.       buildmenuitem menuname, 80, 8006, SORT_FULLNAME_MENU__MSG,    'treesort' 'F'SORT_XXXX_MENUP__MSG, 1, 0
  1128.       buildmenuitem menuname, 80, 8007, SORT_NAME_MENU__MSG,        'treesort' 'N'SORT_XXXX_MENUP__MSG, 1, 0
  1129.       buildmenuitem menuname, 80, 8008, SORT_EXTENSION_MENU__MSG,   'treesort' 'EX'SORT_XXXX_MENUP__MSG, 32769, 0
  1130.       buildmenuitem menuname, 80, 8011, SORT_DESCENDING_MENU__MSG,  ''SORT_DESCENDING_MENUP__MSG, 17, 0
  1131.       buildmenuitem menuname, 80, 8012, SORT_DATE_MENU__MSG,        'treesort' '/R' 'D'SORT_XXXX_MENUP__MSG, 1, 0
  1132.       buildmenuitem menuname, 80, 8013, SORT_TIME_MENU__MSG,        'treesort' '/R' 'T'SORT_XXXX_MENUP__MSG, 1, 0
  1133.       buildmenuitem menuname, 80, 8014, SORT_SIZE_MENU__MSG,        'treesort' '/R' 'S'SORT_XXXX_MENUP__MSG, 1, 0
  1134.       buildmenuitem menuname, 80, 8015, SORT_EASIZE_MENU__MSG,      'treesort' '/R' 'EA'SORT_XXXX_MENUP__MSG, 1, 0
  1135.       buildmenuitem menuname, 80, 8016, SORT_FULLNAME_MENU__MSG,    'treesort' '/R' 'F'SORT_XXXX_MENUP__MSG, 1, 0
  1136.       buildmenuitem menuname, 80, 8017, SORT_NAME_MENU__MSG,        'treesort' '/R' 'N'SORT_XXXX_MENUP__MSG, 1, 0
  1137.       buildmenuitem menuname, 80, 8018, SORT_EXTENSION_MENU__MSG,   'treesort' '/R' 'EX'SORT_XXXX_MENUP__MSG, 32769, 0
  1138.    elseif in_mark then  -- Build Inside-Mark pop-up
  1139.   compile else
  1140.    if in_mark then  -- Build Inside-Mark pop-up
  1141.   compile endif
  1142.       gray_if_charmark = 16384*(MT='C')
  1143.       buildmenuitem menuname, 80, 8000, UNMARK_MARK_MENU__MSG\9'Alt+U',   'DUPMARK U'UNMARK_MARK_MENUP__MSG, 0, mpfrom2short(HP_EDIT_UNMARK, 0)
  1144.       buildmenuitem menuname, 80, 8001, DELETE_MARK_MENU__MSG\9'Alt+D',   'DUPMARK D'DELETE_MARK_MENUP__MSG, 0, mpfrom2short(HP_EDIT_DELETE, 0)
  1145.       buildmenuitem menuname, 80, 8002, FILL_MARK_MENU__MSG\9'Alt+F',     'Fill'FILL_MARK_MENUP__MSG, 0, mpfrom2short(HP_POPUP_FILL, 0)
  1146.       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)
  1147.       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)
  1148.       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)
  1149.       buildmenuitem menuname, 80, 8006, SORT_MARK_MENU__MSG,              'Sort'SORT_MARK_MENUP__MSG, 0, mpfrom2short(HP_POPUP_SORT, gray_if_charmark)
  1150.       buildmenuitem menuname, 80, 8007, \0,                               '',          4, 0
  1151.       buildmenuitem menuname, 80, 8008, SHIFT_MENU__MSG,   ''SHIFT_MENUP__MSG, 17, mpfrom2short(HP_POPUP_SHIFT, gray_if_charmark)
  1152.       nodismiss_gifc = gray_if_charmark + 32  -- 32 = MIA_NODISMISS
  1153.       buildmenuitem menuname, 80, 8009, SHIFTLEFT_MENU__MSG\9'Ctrl+F7',   'key 1 a+F7'SHIFTLEFT_MENUP__MSG, 1, mpfrom2short(HP_POPUP_SHIFTLEFT, nodismiss_gifc)
  1154.       buildmenuitem menuname, 80, 8010, SHIFTLEFT3_MENU__MSG,             'key 3 a+F7'SHIFTLEFT3_MENUP__MSG, 1, mpfrom2short(HP_POPUP_SHIFTLEFT3, nodismiss_gifc)
  1155.       buildmenuitem menuname, 80, 8011, SHIFTLEFT8_MENU__MSG,             'key 8 a+F7'SHIFTLEFT8_MENUP__MSG, 1, mpfrom2short(HP_POPUP_SHIFTLEFT8, nodismiss_gifc)
  1156.       buildmenuitem menuname, 80, 8013, SHIFTRIGHT_MENU__MSG\9'Ctrl+F8',  'key 1 a+F8'SHIFTRIGHT_MENUP__MSG, 2049, mpfrom2short(HP_POPUP_SHIFTRIGHT, nodismiss_gifc)
  1157.       buildmenuitem menuname, 80, 8014, SHIFTRIGHT3_MENU__MSG,            'key 3 a+F8'SHIFTRIGHT3_MENUP__MSG, 1, mpfrom2short(HP_POPUP_SHIFTRIGHT3, nodismiss_gifc)
  1158.       buildmenuitem menuname, 80, 8015, SHIFTRIGHT8_MENU__MSG,            'key 8 a+F8'SHIFTRIGHT8_MENUP__MSG, 32769, mpfrom2short(HP_POPUP_SHIFTRIGHT8, nodismiss_gifc)
  1159.       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)
  1160.       buildmenuitem menuname, 80, 8017, \0,                               '',          4, 0
  1161.       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)
  1162.       buildmenuitem menuname, 80, 8019, CUT_MENU__MSG\9 || SHIFT_KEY__MSG'+'DELETE_KEY__MSG, 'Cut'CUT_MENUP__MSG,       0, mpfrom2short(HP_EDIT_CUT, 0)
  1163.       buildmenuitem menuname, 80, 8020, \0,                               '',          4, 0
  1164.       buildmenuitem menuname, 80, 8021, STYLE_MENU__MSG\9'Ctrl+Y',        'fontlist'STYLE_MENUP__MSG,    0, mpfrom2short(HP_OPTIONS_STYLE, 0)
  1165.   compile if CHECK_FOR_LEXAM
  1166.    if LEXAM_is_available then
  1167.   compile endif
  1168.       buildmenuitem menuname, 80, 8022, \0,                               '',          4, 0
  1169.       buildmenuitem menuname, 80, 8023, PROOF_MENU__MSG,           'proof'PROOF_MENUP__MSG,     0, mpfrom2short(HP_OPTIONS_PROOF, 16384*(mt<>'L'))
  1170.   compile if CHECK_FOR_LEXAM
  1171.    endif
  1172.   compile endif
  1173.       buildmenuitem menuname, 80, 8024, \0,                               '',          4, 0
  1174.   compile if ENHANCED_PRINT_SUPPORT
  1175.       buildmenuitem menuname, 80, 8025, PRT_MARK_MENU__MSG'...',          'PRINTDLG M'ENHPRT_MARK_MENUP__MSG,0, mpfrom2short(HP_EDIT_ENHPRINT, 0)
  1176.   compile else
  1177.       buildmenuitem menuname, 80, 8025, PRT_MARK_MENU__MSG,               'DUPMARK P'PRT_MARK_MENUP__MSG, 0, mpfrom2short(HP_EDIT_PRINT, 0)
  1178.   compile endif
  1179.    elseif mt<>' ' then  -- Build Outside-Mark pop-up
  1180.       'MH_gotoposition'
  1181.       buildmenuitem menuname, 80, 8000, COPY_MARK_MENU__MSG\9'Alt+C',     'DUPMARK C'COPY_MARK_MENUP__MSG, 0, mpfrom2short(HP_EDIT_COPYMARK, 0)
  1182.       buildmenuitem menuname, 80, 8001, MOVE_MARK_MENU__MSG\9'Alt+M',     'DUPMARK M'MOVE_MARK_MENUP__MSG, 0, mpfrom2short(HP_EDIT_MOVE, 0)
  1183.       buildmenuitem menuname, 80, 8002, OVERLAY_MARK_MENU__MSG\9'Alt+O',  'DUPMARK O'OVERLAY_MARK_MENUP__MSG, 0, mpfrom2short(HP_EDIT_OVERLAY, 0)
  1184.       buildmenuitem menuname, 80, 8003, ADJUST_MARK_MENU__MSG\9'Alt+A',   'DUPMARK A'ADJUST_MARK_MENUP__MSG, 0, mpfrom2short(HP_EDIT_ADJUST, 0)
  1185.       buildmenuitem menuname, 80, 8004, \0,                       '',          4, 0
  1186.       buildmenuitem menuname, 80, 8005, UNMARK_MARK_MENU__MSG\9'Alt+U',   'DUPMARK U'UNMARK_MARK_MENUP__MSG, 0, mpfrom2short(HP_EDIT_UNMARK, 0)
  1187.    else  -- Build No-mark pop-up
  1188.       'MH_gotoposition'
  1189.       ch = substr(textline(.line), .col, 1)
  1190.       gray_if_space = 16384*(ch=' ' | not .line)
  1191.       buildmenuitem menuname, 80, 8000, MARK_WORD_MENU__MSG\9'Alt+W',      'MARKWORD'MARK_WORD_MENUP__MSG, 0, mpfrom2short(HP_POPUP_MARKWORD, gray_if_space)
  1192.       buildmenuitem menuname, 80, 8001, MARK_TOKEN_MENU__MSG\9'CtrL+W',    'MARKTOKEN'MARK_TOKEN_MENUP__MSG, 0, mpfrom2short(HP_POPUP_MARKTOKEN, gray_if_space)
  1193.       buildmenuitem menuname, 80, 8002, FIND_TOKEN_MENU__MSG,              'FINDWORD'FIND_TOKEN_MENUP__MSG, 0, mpfrom2short(HP_POPUP_FINDTOKEN, gray_if_space)
  1194.       buildmenuitem menuname, 80, 8003, \0,                       '',          4, 0
  1195.       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)
  1196.       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)
  1197.       buildmenuitem menuname, 80, 8006, \0,                       '',          4, 0
  1198.       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)
  1199.       buildmenuitem menuname, 80, 8008, TOP_LINE_MENU__MSG,                'newtop'TOP_LINE_MENUP__MSG, 0, mpfrom2short(HP_POPUP_TOP, 0)
  1200.       buildmenuitem menuname, 80, 8009, PASTE_C_MENU__MSG,    PASTE_C_MENUP__MSG,   17+64, mpfrom2short(HP_EDIT_PASTEMENU, 0)
  1201.        buildmenuitem menuname, 80, 8010, PASTE_C_MENU__MSG,   'Paste C'PASTE_C_MENUP__MSG,   0, mpfrom2short(HP_EDIT_PASTEC, 0)
  1202.        buildmenuitem menuname, 80, 8011, PASTE_L_MENU__MSG,   'Paste'PASTE_L_MENUP__MSG,     0, mpfrom2short(HP_EDIT_PASTE, 0)
  1203.        buildmenuitem menuname, 80, 8012, PASTE_B_MENU__MSG,   'Paste B'PASTE_B_MENUP__MSG,   32769, mpfrom2short(HP_EDIT_PASTEB, 0)
  1204.    endif
  1205.  compile endif -- INCLUDE_STANDARD_CONTEXT_MENU
  1206.  compile if not VANILLA
  1207. tryinclude 'mymsemnu.e'  -- For user-added configuration
  1208.  compile endif
  1209.    showmenu menuname,1
  1210.  compile if DEFAULT_PASTE = 'C'
  1211.    'cascade_popupmenu 8009 8010'  -- Paste cascade; default is Paste (character mark)
  1212.  compile elseif DEFAULT_PASTE = 'B'
  1213.    'cascade_popupmenu 8009 8012'  -- Paste cascade; default is Paste Block
  1214.  compile else
  1215.    'cascade_popupmenu 8009 8011'  -- Paste cascade; default is Paste Lines
  1216.  compile endif
  1217.  
  1218. #define ETK_FID_POPUP          50
  1219.  
  1220. defc cascade_popupmenu
  1221.    parse arg menuid defmenuid .
  1222.    menuitem = copies(\0, 16)  -- 2 bytes ea. pos'n, style, attribute, identity; 4 bytes submenu hwnd, long item
  1223.    hwndp= dynalink32( 'PMWIN',
  1224.                       '#899',                -- ordinal for Win32WindowFromID
  1225.                       gethwndc(EPMINFO_EDITCLIENT) ||
  1226.                       atol(ETK_FID_POPUP) )
  1227.    if not windowmessage(1,
  1228.                         hwndp,
  1229.                         386,                  -- x182, MM_QueryItem
  1230.                         menuid + 65536,
  1231.                         ltoa(offset(menuitem) || selector(menuitem), 10) )
  1232.    then return; endif
  1233.    hwnd = substr(menuitem, 9, 4)
  1234.  
  1235. compile if EPM32
  1236.    call dynalink32('PMWIN',
  1237.                    '#874',     -- Win32SetWindowBits
  1238.                     hwnd          ||
  1239.                     atol(-2)      ||  -- QWL_STYLE
  1240.                     atol(64)      ||  -- MS_CONDITIONALCASCADE
  1241.                     atol(64) )        -- MS_CONDITIONALCASCADE
  1242. compile else
  1243.    call dynalink('PMWIN',
  1244.                  '#278',     -- WinSetWindowBits
  1245.                   substr(hwnd,3) || leftstr(hwnd,2) ||
  1246.                   atoi(-2)      ||  -- QWL_STYLE
  1247.                   atol_swap(64) ||  -- MS_CONDITIONALCASCADE
  1248.                   atol_swap(64) )   -- MS_CONDITIONALCASCADE
  1249. compile endif
  1250.    if defmenuid<>'' then  -- Default menu item
  1251.       call windowmessage(1,
  1252.                          ltoa(hwnd,10),
  1253.                          1074,                  -- x432, MM_SETDEFAULTITEMID
  1254.                          defmenuid, 0)  -- Make arg(2) the default menu item
  1255.    endif
  1256.  
  1257. ; The StatWndMouseCmd and MsgWndMouseCmd are invoked with the following argument
  1258. ; when the status or message windows receive the following event:
  1259. ; '1 SECONDCLK 0' - Double-click MB1 (in any shift combination).
  1260. ; 'CONTEXTMENU'   - The context menu action (by default, single-click MB2) is executed .
  1261. ; 'CHORD'         - Both mouse buttons are pressed together.
  1262.  
  1263. defc StatWndMouseCmd
  1264.    if arg(1)='1 SECONDCLK 0' then
  1265.       'versioncheck'
  1266.    endif
  1267.  
  1268. defc MsgWndMouseCmd
  1269.    if arg(1)='1 SECONDCLK 0' then
  1270.       'messagebox'
  1271.    endif
  1272. compile endif  -- EVERSION >= 5.60
  1273.  
  1274. compile if EPM_POINTER = 'SWITCH'
  1275. defc SetMousePointer
  1276.    universal vEPM_POINTER
  1277.    if verify(arg(1), '0123456789') then  -- contained a non-numeric character
  1278.       sayerror INVALID_NUMBER__MSG
  1279.    else
  1280.       vEPM_POINTER = arg(1)
  1281.       mouse_setpointer vEPM_POINTER
  1282.    endif
  1283. compile endif
  1284.