home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / epmmac.zip / FEVSHMNU.E < prev    next >
Text File  |  1996-01-25  |  46KB  |  785 lines

  1. ; This is an example of providing an alternate to STDMENU.E.  The name of the
  2. ; alternate menu must be defined in MYCNF.E:  STD_MENU_NAME = 'fevshmnu.e'
  3. ; The alternate menu must provide the following commands, which are called
  4. ; from the other macro files:
  5. ;   LoadDefaultMenu - Called to build the default action bar.  Must set universals
  6. ;                     Activemenu and Defaultmenu.
  7. ;   Readd_help_menu - Called to readd the help menu, after someone deleted it to add their own menu(s).
  8. ;   Maybe_show_menu - Called to reshow the menu iff activemenu = defaultmenu.
  9. ;   Showmenu_activemenu - Called to reshow the menu.  Updates cascaded menus if necessary.
  10. ;   Build_menu_accelerators - Called from Loadaccel() to build the menu-related accelerators.
  11. ;   Update_edit_menu_text - Called to update the edit menu text after CUA Accelerators is toggled.
  12. ;   Menuinit_nnn - Define once for each pulldown or pullright menu ID <nnn> which
  13. ;                  needs to grey, check, etc. its submenu when its menu is activated.
  14.  
  15.  
  16. /*
  17. ┌─────────────────────────────────────────────────────────────────────────────┐
  18. │What's it called  : loaddefaultmenu                                          │
  19. │                                                                             │
  20. │What does it do   : used by stdcnf.e to setup default EPM action bar         │
  21. │                    (Note: a menu id of 0 halts the interpreter when         │
  22. │                     selected.)                                              │
  23. │                                                                             │
  24. │Who and When      : Larry M.     1994/07/29                                  │
  25. └─────────────────────────────────────────────────────────────────────────────┘
  26. */
  27. compile if not defined(CORE_stuff)
  28. ; This determines whether the CORE-specific commands (DEFINE)
  29. ; are included in the menus.
  30.    const CORE_STUFF=0
  31. compile endif
  32.  
  33. defc loaddefaultmenu
  34.    universal activemenu,defaultmenu
  35.  
  36.    parse arg menuname .
  37.    if menuname = '' then                  -- Initialization call
  38.       menuname = 'default'
  39.       defaultmenu = menuname              -- default menu name
  40.       activemenu  = defaultmenu
  41.    endif
  42.  
  43.    call add_file_menu(menuname)
  44.    call add_edit_menu(menuname)
  45.    call add_view_menu(menuname)
  46.    call add_selected_menu(menuname)
  47. compile if MENU_LIMIT
  48.    call add_ring_menu(menuname)
  49. compile endif
  50.    call add_help_menu(menuname)
  51.  
  52. defproc add_file_menu(menuname)
  53. compile if RING_OPTIONAL
  54.    universal ring_enabled
  55. compile endif
  56.    buildsubmenu menuname, 1, FILE_BAR__MSG, FILE_BARP__MSG, 0 , mpfrom2short(HP_FILE, 0)
  57. compile if RING_OPTIONAL
  58.    if ring_enabled then
  59. compile endif
  60.      buildmenuitem menuname, 1, 100, OPENNOAS_MENU__MSG,         OPENAS_MENUP__MSG,     17+64, mpfrom2short(HP_FILE_OPENAS, 0)
  61.        buildmenuitem menuname, 1, 101, NEWWIN_MENU__MSG\9 || CTRL_KEY__MSG'+O', 'OPENDLG'OPEN_MENUP__MSG,  0, mpfrom2short(HP_FILE_NEWWIN, 0)
  62.        buildmenuitem menuname, 1, 102, SAMEWIN_MENU__MSG\9'F8', 'OPENDLG EDIT'ADD_MENUP__MSG,     0, mpfrom2short(HP_FILE_SAMEWIN, 0)
  63.        buildmenuitem menuname, 1, 103, COMMAND_SHELL_MENU__MSG,  'shell'CREATE_SHELL_MENUP__MSG,       32769, mpfrom2short(HP_COMMAND_SHELL, 0)
  64. compile if RING_OPTIONAL
  65.    else
  66.      buildmenuitem menuname, 1, 100, NEWWIN_MENU__MSG\9 || CTRL_KEY__MSG'+O', 'OPENDLG'OPEN_MENUP__MSG,  0, mpfrom2short(HP_FILE_NEWWIN, 0)
  67.    endif
  68. compile endif
  69. ;compile if WANT_APPLICATION_INI_FILE
  70.      buildmenuitem menuname, 1, 105, CONFIG_MENU__MSG,         'configdlg'CONFIG_MENUP__MSG,  0, mpfrom2short(HP_OPTIONS_CONFIG, 0)
  71.      buildmenuitem menuname, 1, 107, \0,                           '',                 4, 0
  72. ;compile endif
  73.      buildmenuitem menuname, 1, 110, SAVE_MENU__MSG\9'F2',     'SAVE'SAVE_MENUP__MSG,             0, mpfrom2short(HP_FILE_SAVE, 0)
  74.      buildmenuitem menuname, 1, 120, SAVEAS_MENU__MSG,         'SAVEAS_DLG'SAVEAS_MENUP__MSG, 0, mpfrom2short(HP_FILE_SAVEAS, 0)
  75. compile if RING_OPTIONAL
  76.    if ring_enabled then
  77. compile endif
  78.      buildmenuitem menuname, 1, 130, FILE_MENU__MSG\9'F4',     'FILE'FILE_MENUP__MSG,             0, mpfrom2short(HP_FILE_FILE, 0)
  79. compile if RING_OPTIONAL
  80.    else
  81.      buildmenuitem menuname, 1, 130, SAVECLOSE_MENU__MSG\9'F4',     'FILE'FILE_MENUP__MSG,        0, mpfrom2short(HP_FILE_FILE, 0)
  82.    endif
  83. compile endif
  84.      buildmenuitem menuname, 1, 135, \0,                           '',                 4, 0
  85.      buildmenuitem menuname, 1, 140, COMMAND_BAR__MSG, COMMAND_BARP__MSG, 17+64, mpfrom2short(HP_COMMAND, 0)
  86.        buildmenuitem menuname, 1, 141, COMMANDLINE_MENU__MSG\9 || CTRL_KEY__MSG'+I', 'commandline'COMMANDLINE_MENUP__MSG,   0, mpfrom2short(HP_COMMAND_CMD, 0)
  87. compile if WANT_EPM_SHELL = 1
  88.        buildmenuitem menuname, 1, 65535, HALT_COMMAND_MENU__MSG, '', 0, mpfrom2short(HP_COMMAND_HALT, 0)
  89.  compile if EPM32 & not POWERPC
  90.        buildmenuitem menuname, 1, 142, WRITE_SHELL_MENU__MSG,        'shell_write'WRITE_SHELL_MENUP__MSG, 0, mpfrom2short(HP_COMMAND_WRITE, 16384)
  91.        buildmenuitem menuname, 1, 143, SHELL_BREAK_MENU__MSG,        'shell_break'SHELL_BREAK_MENUP__MSG,  32769, mpfrom2short(HP_COMMAND_BREAK, 16384)
  92.  compile else
  93.        buildmenuitem menuname, 1, 142, WRITE_SHELL_MENU__MSG,        'shell_write'WRITE_SHELL_MENUP__MSG, 32769, mpfrom2short(HP_COMMAND_WRITE, 16384)
  94.  compile endif
  95. compile else
  96.        buildmenuitem menuname, 1, 65535, HALT_COMMAND_MENU__MSG, '', 32769, mpfrom2short(HP_COMMAND_HALT, 0)
  97. compile endif
  98.      buildmenuitem menuname, 1, 150, GET_MENU__MSG,            'OPENDLG GET'GET_MENUP__MSG,      0, mpfrom2short(HP_FILE_GET , 0)
  99. ;    buildmenuitem menuname, 1, 155, \0,                           '',                 4, 0
  100. compile if ENHANCED_PRINT_SUPPORT
  101.      buildmenuitem menuname, 1, 160, PRINT_MENU__MSG'...',  'printdlg'ENHPRT_FILE_MENUP__MSG,         0, mpfrom2short(HP_FILE_ENHPRINT, 0)
  102. compile else
  103.      buildmenuitem menuname, 1, 160, PRINT_MENU__MSG,       'xcom save /s /ne' default_printer()PRT_FILE_MENUP__MSG,   0, mpfrom2short(HP_FILE_PRINT, 0)
  104. compile endif
  105. compile if RING_OPTIONAL
  106.    if ring_enabled then
  107. compile endif
  108.      buildmenuitem menuname, 1, 165, \0,           '',                       4, 0
  109.      buildmenuitem menuname, 1, 170, QUIT_MENU__MSG\9'F3',     'QUIT'QUIT_MENUP__MSG,             0, mpfrom2short(HP_FILE_QUIT, 0)
  110. compile if RING_OPTIONAL
  111.    endif
  112. compile endif
  113.  
  114.  
  115.  
  116. define
  117.  compile if not defined(ALTERNATE_PASTE)
  118.   compile if DEFAULT_PASTE = ''
  119.    ALTERNATE_PASTE = 'C'
  120.   compile else
  121.    ALTERNATE_PASTE = ''
  122.   compile endif
  123.  compile endif
  124.    PASTE_C_KEY = ''
  125.    PASTE_B_KEY = ''
  126.    PASTE_L_KEY = ''
  127. compile if ALTERNATE_PASTE = ''
  128.    PASTE_L_KEY = \9 || CTRL_KEY__MSG'+'SHIFT_KEY__MSG'+'INSERT_KEY__MSG
  129. compile elseif ALTERNATE_PASTE = 'B'
  130.    PASTE_B_KEY = \9 || CTRL_KEY__MSG'+'SHIFT_KEY__MSG'+'INSERT_KEY__MSG
  131. compile elseif ALTERNATE_PASTE = 'C'
  132.    PASTE_C_KEY = \9 || CTRL_KEY__MSG'+'SHIFT_KEY__MSG'+'INSERT_KEY__MSG
  133. compile else
  134.    * Error:  ALTERNATE_PASTE must be '', 'B', or 'C'
  135. compile endif
  136. compile if DEFAULT_PASTE = ''
  137.    PASTE_L_KEY = \9 || SHIFT_KEY__MSG'+'INSERT_KEY__MSG
  138. compile elseif DEFAULT_PASTE = 'B'
  139.    PASTE_B_KEY = \9 || SHIFT_KEY__MSG'+'INSERT_KEY__MSG
  140. compile elseif DEFAULT_PASTE = 'C'
  141.    PASTE_C_KEY = \9 || SHIFT_KEY__MSG'+'INSERT_KEY__MSG
  142. compile else
  143.    * Error:  DEFAULT_PASTE must be '', 'B', or 'C'
  144. compile endif
  145.  
  146. define  -- Prepare for some conditional tests
  147. compile if MENU_LIMIT
  148.    maybe_ring_accel = 'RING_ACCEL__L <>'
  149. compile else
  150.    maybe_ring_accel = "' ' <"  -- Will be true for any letter
  151. compile endif
  152. compile if defined(ACTIONS_ACCEL__L)  -- For CUSTEPM support
  153.    maybe_actions_accel = 'ACTIONS_ACCEL__L <>'
  154. compile else
  155.    maybe_actions_accel = "' ' <"  -- Will be true for any letter
  156. compile endif
  157.  
  158.  
  159. defproc add_edit_menu(menuname)
  160. compile if RING_OPTIONAL
  161.    universal ring_enabled
  162. compile endif
  163. compile if CHECK_FOR_LEXAM
  164.    universal LEXAM_is_available
  165. compile endif
  166. compile if BLOCK_ACTIONBAR_ACCELERATORS = 'SWITCH'
  167.    universal CUA_MENU_ACCEL
  168. compile endif
  169.    buildsubmenu  menuname, 2, EDIT_BAR__MSG, ''EDIT_BARP__MSG, 0 , mpfrom2short(HP_EDIT, 0)
  170.      buildmenuitem menuname, 2, 200, UNDO__MENU__MSG,   UNDO__MENUP__MSG,    17+64, mpfrom2short(HP_EDIT_UNDO2, 0)
  171.        buildmenuitem menuname, 2, 201, UNDO_MENU__MSG\9 || ALT_KEY__MSG'+'BACKSPACE_KEY__MSG,   'UNDO 1'UNDO_MENUP__MSG,    0, mpfrom2short(HP_EDIT_UNDO, 0)
  172. compile if WANT_DM_BUFFER
  173.        buildmenuitem menuname, 2, 202, UNDO_REDO_MENU__MSG\9 || CTRL_KEY__MSG'+U', 'undodlg'UNDO_REDO_MENUP__MSG,      0, mpfrom2short(HP_EDIT_UNDOREDO, 0)
  174.        buildmenuitem menuname, 2, 203, RECOVER_MARK_MENU__MSG,        'GetDMBuff'RECOVER_MARK_MENUP__MSG,    32769, mpfrom2short(HP_EDIT_RECOVER, 0)
  175. compile else
  176.        buildmenuitem menuname, 2, 202, UNDO_REDO_MENU__MSG\9 || CTRL_KEY__MSG'+U', 'undodlg'UNDO_REDO_MENUP__MSG,      32769, mpfrom2short(HP_EDIT_UNDOREDO, 0)
  177. compile endif  -- WANT_DM_BUFFER
  178.      buildmenuitem menuname, 2, 205, \0,                               '',          4, 0
  179.      buildmenuitem menuname, 2, 210, CLIP_COPY_MENU__MSG\9 || CTRL_KEY__MSG'+'INSERT_KEY__MSG ,  'Copy2Clip'CLIP_COPY_MENUP__MSG, 0, mpfrom2short(HP_EDIT_COPY, 0)
  180.      buildmenuitem menuname, 2, 220, CUT_MENU__MSG\9 || SHIFT_KEY__MSG'+'DELETE_KEY__MSG, 'Cut'CUT_MENUP__MSG,       0, mpfrom2short(HP_EDIT_CUT, 0)
  181.      buildmenuitem menuname, 2, 230, PASTE_C_MENU__MSG,   PASTE_C_MENUP__MSG,   17+64, mpfrom2short(HP_EDIT_PASTEMENU, 0)
  182.        buildmenuitem menuname, 2, 231, PASTE_C_MENU__MSG||PASTE_C_KEY,   'Paste C'PASTE_C_MENUP__MSG,   0, mpfrom2short(HP_EDIT_PASTEC, 0)
  183.        buildmenuitem menuname, 2, 232, PASTE_L_MENU__MSG||PASTE_L_KEY,   'Paste'PASTE_L_MENUP__MSG,     0, mpfrom2short(HP_EDIT_PASTE, 0)
  184.        buildmenuitem menuname, 2, 233, PASTE_B_MENU__MSG||PASTE_B_KEY,   'Paste B'PASTE_B_MENUP__MSG,   32769, mpfrom2short(HP_EDIT_PASTEB, 0)
  185. compile if BLOCK_ACTIONBAR_ACCELERATORS = 'SWITCH'
  186.    accel_len = (3+length(ALT_KEY__MSG))*(not CUA_MENU_ACCEL)
  187. compile endif
  188. compile if BLOCK_ACTIONBAR_ACCELERATORS=1 | (FILE_ACCEL__L<>'D' & EDIT_ACCEL__L<>'D' & VIEW_ACCEL__L<>'D' & SELECTED_ACCEL__L<>'D' & HELP_ACCEL__L<>'D' & $maybe_ring_accel 'D' & $maybe_actions_accel 'D')
  189.      buildmenuitem menuname, 2, 240, DELETE_MENU__MSG\9 || ALT_KEY__MSG'+D',   'DUPMARK D'DELETE_MARK_MENUP__MSG, 0, mpfrom2short(HP_EDIT_DELETE, 0)
  190. compile elseif BLOCK_ACTIONBAR_ACCELERATORS = 'SWITCH'
  191.      buildmenuitem menuname, 2, 240, DELETE_MENU__MSG||leftstr(\9 || ALT_KEY__MSG'+D', accel_len),   'DUPMARK D'DELETE_MARK_MENUP__MSG, 0, mpfrom2short(HP_EDIT_DELETE, 0)
  192. compile else
  193.      buildmenuitem menuname, 2, 240, DELETE_MENU__MSG,   'DUPMARK D'DELETE_MARK_MENUP__MSG, 0, mpfrom2short(HP_EDIT_DELETE, 0)
  194. compile endif
  195.      buildmenuitem menuname, 2, 245, \0,                               '',          4, 0
  196.      buildmenuitem menuname, 2, 250, SELECT_ALL_MENU__MSG\9 || CTRL_KEY__MSG'+/',     'select_all'SELECT_ALL_MENUP__MSG, 0, mpfrom2short(HP_EDIT_SELECTALL, 0)
  197.      buildmenuitem menuname, 2, 251, DESELECT_ALL_MENU__MSG\9 || CTRL_KEY__MSG'+\',   'DUPMARK U'UNMARK_MARK_MENUP__MSG, 0, mpfrom2short(HP_EDIT_DESELECTALL, 0)
  198. compile if SPELL_SUPPORT
  199.  compile if CHECK_FOR_LEXAM
  200.    if LEXAM_is_available then
  201.  compile endif
  202.      buildmenuitem menuname, 2, 255, \0,                               '',          4, 0
  203.      buildmenuitem menuname, 2, 260, PROOF_MENU__MSG,           'proof'PROOF_MENUP__MSG,     0, mpfrom2short(HP_OPTIONS_PROOF, 0)
  204.      buildmenuitem menuname, 2, 261, PROOF_WORD_MENU__MSG,      'proofword'PROOF_WORD_MENUP__MSG, 0, mpfrom2short(HP_OPTIONS_PROOFW, 0)
  205.      buildmenuitem menuname, 2, 262, SYNONYM_MENU__MSG,         'syn'SYNONYM_MENUP__MSG,       0, mpfrom2short(HP_OPTIONS_SYN, 0)
  206.      buildmenuitem menuname, 2, 263, DYNASPELL_MENU__MSG,        'dynaspell'DYNASPELL_MENUP__MSG,       0, mpfrom2short(HP_OPTIONS_DYNASPELL, 0)
  207.  compile if CORE_STUFF
  208.      buildmenuitem menuname, 2, 264, DEFINE_WORD_MENU__MSG,     'define'DEFINE_WORD_MENUP__MSG,    0, mpfrom2short(HP_OPTIONS_DEFINE, 0)
  209.  compile endif  -- CORE_STUFF
  210.  compile if CHECK_FOR_LEXAM
  211.    endif
  212.  compile endif
  213. compile endif
  214.  
  215. defproc add_view_menu(menuname)
  216. compile if RING_OPTIONAL
  217.    universal ring_enabled
  218. compile endif
  219. compile if WANT_STACK_CMDS = 'SWITCH'
  220.    universal stack_cmds
  221. compile endif
  222.    buildsubmenu  menuname, 3, VIEW_BAR__MSG, VIEW_BARP__MSG, 0 , mpfrom2short(HP_VIEW, 0)
  223.      buildmenuitem menuname, 3, 300, SEARCH_BAR__MSG, SEARCH_BARP__MSG, 17+64, mpfrom2short(HP_SEARCH, 0)
  224.      buildmenuitem menuname, 3, 301, SEARCH_MENU__MSG\9 || CTRL_KEY__MSG'+S',      'SEARCHDLG'SEARCH_MENUP__MSG,   0, mpfrom2short(HP_SEARCH_SEARCH, 0)
  225.      buildmenuitem menuname, 3, 302, \0,                           '',            4, 0
  226.      buildmenuitem menuname, 3, 303, FIND_NEXT_MENU__MSG\9 || CTRL_KEY__MSG'+F',   'SEARCHDLG F'FIND_NEXT_MENUP__MSG, 0, mpfrom2short(HP_SEARCH_FIND, 0)
  227.      buildmenuitem menuname, 3, 304, CHANGE_NEXT_MENU__MSG\9 || CTRL_KEY__MSG'+C', 'SEARCHDLG C'CHANGE_NEXT_MENUP__MSG, 32769, mpfrom2short(HP_SEARCH_CHANGE, 0)
  228. compile if WANT_BOOKMARKS
  229.      buildmenuitem menuname, 3, 310, BOOKMARKS_MENU__MSG,   BOOKMARKS_MENUP__MSG, 17 + 64, mpfrom2short(HP_SEARCH_BOOKMARKS, 0)
  230.        buildmenuitem menuname, 3, 311, SET_MARK_MENU__MSG\9 || CTRL_KEY__MSG'+M',  'setmark'SET_MARK_MENUP__MSG, 0, mpfrom2short(HP_SEARCH_BOOKMARKS, 0)
  231.        buildmenuitem menuname, 3, 312, LIST_MARK_MENU__MSG\9 || CTRL_KEY__MSG'+B', 'listmark'LIST_MARK_MENUP__MSG,       0, mpfrom2short(HP_SEARCH_BOOKMARKS, 0)
  232.        buildmenuitem menuname, 3, 313, \0,                  '',               4, 0
  233.        buildmenuitem menuname, 3, 314, NEXT_MARK_MENU__MSG\9 || ALT_KEY__MSG'+/',  'nextbookmark'NEXT_MARK_MENUP__MSG, 0, mpfrom2short(HP_SEARCH_BOOKMARKS, 0)
  234.        buildmenuitem menuname, 3, 315, PREV_MARK_MENU__MSG\9 || ALT_KEY__MSG'+\',  'nextbookmark P'PREV_MARK_MENUP__MSG, 32768+1, mpfrom2short(HP_SEARCH_BOOKMARKS, 0)
  235. compile endif
  236. compile if WANT_TAGS
  237.      buildmenuitem menuname, 3, 320, TAGS_MENU__MSG,   TAGS_MENUP__MSG, 17+64, mpfrom2short(HP_SEARCH_TAGS, 0)
  238.  compile if EPM32
  239.        buildmenuitem menuname, 3, 321, TAGSDLG_MENU__MSG\9, 'poptagsdlg'TAGSDLG_MENUP__MSG, 0, mpfrom2short(HP_SEARCH_TAGS, 0)
  240.        buildmenuitem menuname, 3, 322, \0,                  '',               4, 0
  241.  compile endif
  242.        buildmenuitem menuname, 3, 323, FIND_TAG_MENU__MSG\9 || SHIFT_KEY__MSG'+F6',  'findtag'FIND_TAG_MENUP__MSG, 0, mpfrom2short(HP_SEARCH_TAGS, 0)
  243.        buildmenuitem menuname, 3, 324, FIND_TAG2_MENU__MSG\9 || SHIFT_KEY__MSG'+F7', 'findtag *'FIND_TAG2_MENUP__MSG, 0, mpfrom2short(HP_SEARCH_TAGS, 0)
  244.  compile if not EPM32
  245.        buildmenuitem menuname, 3, 325, \0,                  '',               4, 0
  246.        buildmenuitem menuname, 3, 326, TAGFILE_NAME_MENU__MSG\9 || SHIFT_KEY__MSG'+F8',  'tagsfile'TAGFILE_NAME_MENUP__MSG, 0, mpfrom2short(HP_SEARCH_TAGS, 0)
  247.        buildmenuitem menuname, 3, 327, \0,                  '',               4, 0
  248.        buildmenuitem menuname, 3, 328, MAKE_TAGS_MENU__MSG\9 || SHIFT_KEY__MSG'+F9',  'maketags *'MAKE_TAGS_MENUP__MSG, 0, mpfrom2short(HP_SEARCH_TAGS, 0)
  249.  compile endif
  250.        buildmenuitem menuname, 3, 329, \0,                               '',          4, 0
  251.        buildmenuitem menuname, 3, 330, SCAN_TAGS_MENU__MSG,  'tagscan'SCAN_TAGS_MENUP__MSG, 32769, mpfrom2short(HP_SEARCH_TAGS, 0)
  252. compile endif
  253.      buildmenuitem menuname, 3, 335, \0,                               '',          4, 0
  254. compile if MENU_LIMIT = 0
  255.  compile if RING_OPTIONAL
  256.    if ring_enabled then
  257.  compile endif
  258.      buildmenuitem menuname, 3, 340, FILE_LIST_MENU__MSG\9 || CTRL_KEY__MSG'+G',     'Ring_More'LIST_FILES_MENUP__MSG,  0 , mpfrom2short(HP_OPTIONS_LIST, 0)
  259.  compile if RING_OPTIONAL
  260.    endif
  261.  compile endif
  262. compile endif
  263.      buildmenuitem menuname, 3, 341, MESSAGES_MENU__MSG,       'messagebox'MESSAGES_MENUP__MSG, 0, mpfrom2short(HP_OPTIONS_MESSAGES, 0)
  264. compile if WANT_STACK_CMDS
  265.  compile if WANT_STACK_CMDS = 'SWITCH'
  266.    if stack_cmds then
  267.  compile endif
  268.      buildmenuitem menuname, 3, 342, \0,                               '',          4, 0
  269.      buildmenuitem menuname, 3, 343, PUSH_CURSOR_MENU__MSG\9 || CTRL_KEY__MSG'+'DOWN_KEY__MSG, 'PUSHPOS'PUSH_CURSOR_MENUP__MSG,  0, mpfrom2short(HP_EDIT_PUSHPOS, 0)
  270.      buildmenuitem menuname, 3, 344, POP_CURSOR_MENU__MSG\9 || CTRL_KEY__MSG'+'UP_KEY__MSG, 'POPPOS'POP_CURSOR_MENUP__MSG,   0, mpfrom2short(HP_EDIT_POPPOS, 16384)
  271.      buildmenuitem menuname, 3, 345, SWAP_CURSOR_MENU__MSG\9 || CTRL_KEY__MSG'+=', 'SWAPPOS'SWAP_CURSOR_MENUP__MSG,   0, mpfrom2short(HP_EDIT_SWAPPOS, 16384)
  272.  compile if WANT_STACK_CMDS = 'SWITCH'
  273.    endif
  274.  compile endif
  275. compile endif
  276.  
  277. defproc add_selected_menu(menuname)
  278.  compile if BLOCK_ACTIONBAR_ACCELERATORS = 'SWITCH'
  279.    universal CUA_MENU_ACCEL
  280.  compile endif
  281.  compile if WANT_STACK_CMDS = 'SWITCH'
  282.    universal stack_cmds
  283.  compile endif
  284. compile if BLOCK_ACTIONBAR_ACCELERATORS = 'SWITCH'
  285.    accel_len = (3+length(ALT_KEY__MSG))*(not CUA_MENU_ACCEL)
  286. compile endif
  287.    buildsubmenu  menuname, 4, SELECTED_BAR__MSG, SELECTED_BARP__MSG, 0 , mpfrom2short(HP_SELECTED, 0)
  288.      buildmenuitem menuname, 4, 400, STYLE_MENU__MSG\9 || CTRL_KEY__MSG'+Y',        'fontlist'STYLE_MENUP__MSG,    0, mpfrom2short(HP_OPTIONS_STYLE, 0)
  289.      buildmenuitem menuname, 4, 405, \0,                       '',          4, 0
  290. compile if BLOCK_ACTIONBAR_ACCELERATORS=1 | (FILE_ACCEL__L<>'C' & EDIT_ACCEL__L<>'C' & VIEW_ACCEL__L<>'C' & SELECTED_ACCEL__L<>'C' & HELP_ACCEL__L<>'C' & $maybe_ring_accel 'C' & $maybe_actions_accel 'C')
  291.      buildmenuitem menuname, 4, 410, COPY_MRK_MENU__MSG\9 || ALT_KEY__MSG'+C',     'DUPMARK C'COPY_MARK_MENUP__MSG, 0, mpfrom2short(HP_EDIT_COPYMARK, 0)
  292. compile elseif BLOCK_ACTIONBAR_ACCELERATORS = 'SWITCH'
  293.      buildmenuitem menuname, 4, 410, COPY_MRK_MENU__MSG||leftstr(\9 || ALT_KEY__MSG'+C', accel_len),     'DUPMARK C'COPY_MARK_MENUP__MSG, 0, mpfrom2short(HP_EDIT_COPYMARK, 0)
  294. compile else
  295.      buildmenuitem menuname, 4, 410, COPY_MRK_MENU__MSG,              'DUPMARK C'COPY_MARK_MENUP__MSG, 0, mpfrom2short(HP_EDIT_COPYMARK, 0)
  296. compile endif
  297. compile if BLOCK_ACTIONBAR_ACCELERATORS=1 | (FILE_ACCEL__L<>'M' & EDIT_ACCEL__L<>'M' & VIEW_ACCEL__L<>'M' & SELECTED_ACCEL__L<>'M' & HELP_ACCEL__L<>'M' & $maybe_ring_accel 'M' & $maybe_actions_accel 'M')
  298.      buildmenuitem menuname, 4, 415, MOVE_MRK_MENU__MSG\9 || ALT_KEY__MSG'+M',     'DUPMARK M'MOVE_MARK_MENUP__MSG, 0, mpfrom2short(HP_EDIT_MOVE, 0)
  299. compile elseif BLOCK_ACTIONBAR_ACCELERATORS = 'SWITCH'
  300.      buildmenuitem menuname, 4, 415, MOVE_MRK_MENU__MSG||leftstr(\9 || ALT_KEY__MSG'+M', accel_len),     'DUPMARK M'MOVE_MARK_MENUP__MSG, 0, mpfrom2short(HP_EDIT_MOVE, 0)
  301. compile else
  302.      buildmenuitem menuname, 4, 415, MOVE_MRK_MENU__MSG,     'DUPMARK M'MOVE_MARK_MENUP__MSG, 0, mpfrom2short(HP_EDIT_MOVE, 0)
  303. compile endif
  304. compile if BLOCK_ACTIONBAR_ACCELERATORS=1 | (FILE_ACCEL__L<>'O' & EDIT_ACCEL__L<>'O' & VIEW_ACCEL__L<>'O' & SELECTED_ACCEL__L<>'O' & HELP_ACCEL__L<>'O' & $maybe_ring_accel 'O' & $maybe_actions_accel 'O')
  305.      buildmenuitem menuname, 4, 420, OVERLAY_MRK_MENU__MSG\9 || ALT_KEY__MSG'+O',  'DUPMARK O'OVERLAY_MARK_MENUP__MSG, 0, mpfrom2short(HP_EDIT_OVERLAY, 0)
  306. compile elseif BLOCK_ACTIONBAR_ACCELERATORS = 'SWITCH'
  307.      buildmenuitem menuname, 4, 420, OVERLAY_MRK_MENU__MSG||leftstr(\9 || ALT_KEY__MSG'+O', accel_len),  'DUPMARK O'OVERLAY_MARK_MENUP__MSG, 0, mpfrom2short(HP_EDIT_OVERLAY, 0)
  308. compile else
  309.      buildmenuitem menuname, 4, 420, OVERLAY_MRK_MENU__MSG,  'DUPMARK O'OVERLAY_MARK_MENUP__MSG, 0, mpfrom2short(HP_EDIT_OVERLAY, 0)
  310. compile endif
  311. compile if BLOCK_ACTIONBAR_ACCELERATORS=1 | (FILE_ACCEL__L<>'A' & EDIT_ACCEL__L<>'A' & VIEW_ACCEL__L<>'A' & SELECTED_ACCEL__L<>'A' & HELP_ACCEL__L<>'A' & $maybe_ring_accel 'A' & $maybe_actions_accel 'A')
  312.      buildmenuitem menuname, 4, 425, ADJUST_MRK_MENU__MSG\9 || ALT_KEY__MSG'+A',   'DUPMARK A'ADJUST_MARK_MENUP__MSG, 0, mpfrom2short(HP_EDIT_ADJUST, 0)
  313. compile elseif BLOCK_ACTIONBAR_ACCELERATORS = 'SWITCH'
  314.      buildmenuitem menuname, 4, 425, ADJUST_MRK_MENU__MSG||leftstr(\9 || ALT_KEY__MSG'+A', accel_len),   'DUPMARK A'ADJUST_MARK_MENUP__MSG, 0, mpfrom2short(HP_EDIT_ADJUST, 0)
  315. compile else
  316.      buildmenuitem menuname, 4, 425, ADJUST_MRK_MENU__MSG,   'DUPMARK A'ADJUST_MARK_MENUP__MSG, 0, mpfrom2short(HP_EDIT_ADJUST, 0)
  317. compile endif
  318. compile if WANT_STACK_CMDS
  319.  compile if WANT_STACK_CMDS = 'SWITCH'
  320.    if stack_cmds then
  321.  compile endif
  322.      buildmenuitem menuname, 4, 430, \0,                       '',          4, 0
  323.      buildmenuitem menuname, 4, 431, PUSH_MRK_MENU__MSG\9 || CTRL_KEY__MSG'+'SHIFT_KEY__MSG'+'DOWN_KEY__MSG, 'PUSHMARK'PUSH_MARK_MENUP__MSG, 0, mpfrom2short(HP_EDIT_PUSHMARK, 0)
  324.      buildmenuitem menuname, 4, 432, POP_MRK_MENU__MSG\9 || CTRL_KEY__MSG'+'SHIFT_KEY__MSG'+'UP_KEY__MSG, 'POPMARK'POP_MARK_MENUP__MSG,  0, mpfrom2short(HP_EDIT_POPMARK, 16384)
  325.      buildmenuitem menuname, 4, 433, SWAP_MRK_MENU__MSG\9 || CTRL_KEY__MSG'+'SHIFT_KEY__MSG'+=', 'SWAPMARK'SWAP_MARK_MENUP__MSG,  0, mpfrom2short(HP_EDIT_SWAPMARK, 16384)
  326.  compile if WANT_STACK_CMDS = 'SWITCH'
  327.    endif
  328.  compile endif
  329. compile endif
  330.      buildmenuitem menuname, 4, 440, \0,                       '',          4, 0
  331. compile if ENHANCED_PRINT_SUPPORT
  332.      buildmenuitem menuname, 4, 450, PRINT_MENU__MSG'...',          'PRINTDLG M'ENHPRT_MARK_MENUP__MSG,0, mpfrom2short(HP_EDIT_ENHPRINT, 0)
  333. compile else
  334.      buildmenuitem menuname, 4, 450, PRINT_MENU__MSG,               'DUPMARK P'PRT_MARK_MENUP__MSG, 0, mpfrom2short(HP_EDIT_PRINT, 0)
  335. compile endif
  336.  
  337.  
  338. compile if MENU_LIMIT
  339. defproc add_ring_menu(menuname)
  340.    buildsubmenu menuname, 5, RING_BAR__MSG, LIST_FILES_MENUP__MSG, 0 , 0
  341.      if .titletext=='' then
  342.         buildmenuitem menuname, 5, 500, .filename, '',0,0
  343.      else
  344.         buildmenuitem menuname, 5, 500, .titletext, '',0,0
  345.      endif
  346.    return
  347. compile endif
  348.  
  349.  
  350. defproc add_help_menu(menuname)
  351.    buildsubmenu menuname, HELP_MENU_ID, HELP_BAR__MSG, 'help'HELP_BARP__MSG, /* 512 */  0, mpfrom2short(HP_HELP, 0)
  352.      buildmenuitem menuname, HELP_MENU_ID, 600, HELP_INDEX_MENU__MSG,   'helpmenu 10'/*64044*/HELP_INDEX_MENUP__MSG,   0, mpfrom2short(HP_HELP_INDEX, 0)
  353.      buildmenuitem menuname, HELP_MENU_ID, 601, EXT_HELP_MENU__MSG,     'helpmenu 4000'EXT_HELP_MENUP__MSG, 0, mpfrom2short(HP_HELP_EXTENDED, 0)
  354.      buildmenuitem menuname, HELP_MENU_ID, 602, HELP_HELP_MENU__MSG,    'helpmenu 64027'HELP_HELP_MENUP__MSG,    0, mpfrom2short(HP_HELP_HELP, 0)
  355.      buildmenuitem menuname, HELP_MENU_ID, 603, KEYS_HELP_MENU__MSG,    'helpmenu 1000'KEYS_HELP_MENUP__MSG, 0, mpfrom2short(HP_HELP_KEYS, 0)
  356.      buildmenuitem menuname, HELP_MENU_ID, 604, COMMANDS_HELP_MENU__MSG,'helpmenu 2000'COMMANDS_HELP_MENUP__MSG, 0, mpfrom2short(HP_HELP_COMMANDS, 0)
  357.      buildmenuitem menuname, HELP_MENU_ID, 605, \0,           '',                        4, 0
  358.      buildmenuitem menuname, HELP_MENU_ID, 606, HELP_BROWSER_MENU__MSG, 'help'HELP_BROWSER_MENUP__MSG,    0, mpfrom2short(HP_HELP_BROWSE, 0)
  359.      buildmenuitem menuname, HELP_MENU_ID, 607, \0,           '',                        4, 0
  360. compile if 0
  361.      buildmenuitem menuname, HELP_MENU_ID, 608, '#211'||(3-(screenxysize('X')>1000)), 'IBMmsg'HELP_PROD_MENUP__MSG, 2, mpfrom2short(HP_HELP_IBM, 0)
  362.                          -- Resource # 2112 or 2113 in ERES.DLL
  363. compile else
  364.      buildmenuitem menuname, HELP_MENU_ID, 608, HELP_PROD_MENU__MSG, 'IBMmsg'HELP_PROD_MENUP__MSG, 0, mpfrom2short(HP_HELP_PROD, 0)
  365. compile endif
  366. compile if SUPPORT_USERS_GUIDE | SUPPORT_TECHREF
  367.      buildmenuitem menuname, HELP_MENU_ID, 610, \0,           '',                        4, 0
  368.  compile if SUPPORT_USERS_GUIDE
  369.      buildmenuitem menuname, HELP_MENU_ID, 620, USERS_GUIDE_MENU__MSG,   USERS_GUIDE_MENUP__MSG, 17+64, mpfrom2short(HP_HELP_USERS_GUIDE, 0)
  370.        buildmenuitem menuname, HELP_MENU_ID, 621, VIEW_USERS_MENU__MSG,  'view epmusers'VIEW_USERS_MENUP__MSG, 0, mpfrom2short(HP_HELP_USERS_GUIDE, 0)
  371.        buildmenuitem menuname, HELP_MENU_ID, 622, VIEW_IN_USERS_MENU__MSG,  'viewword epmusers'VIEW_IN_USERS_MENUP__MSG, 0, mpfrom2short(HP_HELP_USERS_GUIDE, 0)
  372.        buildmenuitem menuname, HELP_MENU_ID, 623, VIEW_USERS_SUMMARY_MENU__MSG,  'view epmusers Summary'VIEW_USERS_SUMMARY_MENUP__MSG, 32768+1, mpfrom2short(HP_HELP_USERS_GUIDE, 0)
  373.  compile endif
  374.  compile if SUPPORT_TECHREF
  375.      buildmenuitem menuname, HELP_MENU_ID, 630, TECHREF_MENU__MSG,   TECHREF_MENUP__MSG, 17+64, mpfrom2short(HP_HELP_TECHREF, 0)
  376.        buildmenuitem menuname, HELP_MENU_ID, 631, VIEW_TECHREF_MENU__MSG,  'view epmtech'VIEW_TECHREF_MENUP__MSG, 0, mpfrom2short(HP_HELP_TECHREF, 0)
  377.        buildmenuitem menuname, HELP_MENU_ID, 632, VIEW_IN_TECHREF_MENU__MSG,  'viewword epmtech'VIEW_IN_TECHREF_MENUP__MSG, 32768+1, mpfrom2short(HP_HELP_TECHREF, 0)
  378.  compile endif
  379. compile endif
  380.  
  381. defproc readd_help_menu
  382.    universal defaultmenu, activemenu
  383.    call add_help_menu(defaultmenu)
  384.    call maybe_show_menu()
  385.  
  386. defproc maybe_show_menu
  387.    universal defaultmenu, activemenu
  388.    if activemenu=defaultmenu then
  389.       call showmenu_activemenu()  -- show the updated EPM menu
  390.    endif
  391.  
  392. defproc showmenu_activemenu()
  393.    universal activemenu
  394.    showmenu activemenu  -- show the updated EPM menu
  395.    'postme add_cascade_menus'
  396.  
  397. defc add_cascade_menus
  398. compile if RING_OPTIONAL
  399.    universal ring_enabled
  400. compile endif
  401. compile if RING_OPTIONAL
  402.    if ring_enabled then
  403. compile endif
  404.       'cascade_menu 100 102' -- If ring is enabled, the default is Open as Same Window
  405. compile if RING_OPTIONAL
  406.    else
  407.       'cascade_menu 100 101' -- If ring is not enabled, the default is Open as New Window
  408.    endif
  409. compile endif
  410.    'cascade_menu 140 141'  -- Command cascade; default is Command Dialog
  411.    'cascade_menu 200 202'  -- Undo cascade; default is Undo Dialog
  412.    'cascade_menu 230 231'  -- Paste cascade; default is Paste (character mark)
  413.    'cascade_menu 300 301'  -- Search cascade; default is Search Dialog
  414. compile if WANT_BOOKMARKS
  415.    'cascade_menu 310 314'  -- Bookmarks cascade; default is Next Bookmark
  416. compile endif
  417. compile if WANT_TAGS
  418.  compile if EPM32
  419.    'cascade_menu 320 321'  -- Tags cascade; default is Tags Dialog
  420.  compile else
  421.    'cascade_menu 320 323'  -- Tags cascade; default is Find Current Procedure
  422.  compile endif
  423. compile endif
  424. compile if SUPPORT_USERS_GUIDE
  425.    'cascade_menu 620'
  426. compile endif
  427. compile if SUPPORT_TECHREF
  428.    'cascade_menu 630'
  429. compile endif
  430. compile if defined(CUSTEPM_DEFAULT_SCREEN)
  431.    'cascade_menu' 3700 (CUSTEPM_DEFAULT_SCREEN + 3700)
  432. compile elseif defined(HAVE_CUSTEPM)
  433.    'cascade_menu' 3700
  434. compile endif
  435.  
  436. defproc build_menu_accelerators(activeaccel)
  437. compile if BLOCK_ACTIONBAR_ACCELERATORS = 'SWITCH'
  438.    universal CUA_MENU_ACCEL
  439. compile endif
  440. compile if WANT_STACK_CMDS = 'SWITCH'
  441.    universal stack_cmds
  442. compile endif
  443.                        -- Build keys on File menu
  444.    buildacceltable activeaccel, 'dokey F8',  AF_VIRTUALKEY,                VK_F8, 1101  -- F8
  445.    buildacceltable activeaccel, 'dokey c+O', AF_CHAR+AF_CONTROL,              79, 1102  -- c+O
  446.    buildacceltable activeaccel, 'dokey c+O', AF_CHAR+AF_CONTROL,             111, 1103  -- c+o
  447.    buildacceltable activeaccel, 'dokey F7',  AF_VIRTUALKEY,                VK_F7, 1104  -- F7
  448.    buildacceltable activeaccel, 'dokey F2',  AF_VIRTUALKEY,                VK_F2, 1105  -- F2
  449.    buildacceltable activeaccel, 'dokey F3',  AF_VIRTUALKEY,                VK_F3, 1106  -- F3
  450.    buildacceltable activeaccel, 'dokey F4',  AF_VIRTUALKEY,                VK_F4, 1107  -- F4
  451.  
  452.                        -- Build keys on Edit menu  ('C' & 'O' appear under Action bar keys for English)
  453.   compile if FILE_ACCEL__L <> 'C' & EDIT_ACCEL__L <> 'C' & SELECTED_ACCEL__L <> 'C' & HELP_ACCEL__L <> 'C' & $maybe_ring_accel 'C' & $maybe_actions_accel 'C'
  454.    buildacceltable activeaccel, 'dokey a+C', AF_CHAR+AF_ALT,                  67, 1201  -- a+C
  455.    buildacceltable activeaccel, 'dokey a+C', AF_CHAR+AF_ALT,                  99, 1202  -- a+c
  456.   compile endif
  457.   compile if FILE_ACCEL__L <> 'M' & EDIT_ACCEL__L <> 'M' & SELECTED_ACCEL__L <> 'M' & HELP_ACCEL__L <> 'M' & $maybe_ring_accel 'M' & $maybe_actions_accel 'M'
  458.    buildacceltable activeaccel, 'dokey a+M', AF_CHAR+AF_ALT,                  77, 1203  -- a+M
  459.    buildacceltable activeaccel, 'dokey a+M', AF_CHAR+AF_ALT,                 109, 1204  -- a+m
  460.   compile endif
  461.   compile if FILE_ACCEL__L <> 'O' & EDIT_ACCEL__L <> 'O' & SELECTED_ACCEL__L <> 'O' & HELP_ACCEL__L <> 'O' & $maybe_ring_accel 'O' & $maybe_actions_accel 'O'
  462.    buildacceltable activeaccel, 'dokey a+O', AF_CHAR+AF_ALT,                  79, 1205  -- a+O
  463.    buildacceltable activeaccel, 'dokey a+O', AF_CHAR+AF_ALT,                 111, 1206  -- a+o
  464.   compile endif
  465.   compile if FILE_ACCEL__L <> 'A' & EDIT_ACCEL__L <> 'A' & SELECTED_ACCEL__L <> 'A' & HELP_ACCEL__L <> 'A' & $maybe_ring_accel 'A' & $maybe_actions_accel 'A'
  466.    buildacceltable activeaccel, 'dokey a+A', AF_CHAR+AF_ALT,                  65, 1207  -- a+A
  467.    buildacceltable activeaccel, 'dokey a+A', AF_CHAR+AF_ALT,                  97, 1208  -- a+a
  468.   compile endif
  469.   compile if FILE_ACCEL__L <> 'U' & EDIT_ACCEL__L <> 'U' & SELECTED_ACCEL__L <> 'U' & HELP_ACCEL__L <> 'U' & $maybe_ring_accel 'U' & $maybe_actions_accel 'U'
  470.    buildacceltable activeaccel, 'dokey a+U', AF_CHAR+AF_ALT,                  85, 1209  -- a+U
  471.    buildacceltable activeaccel, 'dokey a+U', AF_CHAR+AF_ALT,                 117, 1210  -- a+u
  472.   compile endif
  473.   compile if FILE_ACCEL__L <> 'D' & EDIT_ACCEL__L <> 'D' & SELECTED_ACCEL__L <> 'D' & HELP_ACCEL__L <> 'D' & $maybe_ring_accel 'D' & $maybe_actions_accel 'D'
  474.    buildacceltable activeaccel, 'dokey a+D', AF_CHAR+AF_ALT,                  68, 1211  -- a+D
  475.    buildacceltable activeaccel, 'dokey a+D', AF_CHAR+AF_ALT,                 100, 1212  -- a+d
  476.   compile endif
  477.    buildacceltable activeaccel, 'copy2clip', AF_VIRTUALKEY+AF_CONTROL, VK_INSERT, 1213  -- c+Insert
  478.    buildacceltable activeaccel, 'cut',       AF_VIRTUALKEY+AF_SHIFT,   VK_DELETE, 1214  -- s+Delete
  479.    buildacceltable activeaccel, 'paste' DEFAULT_PASTE, AF_VIRTUALKEY+AF_SHIFT,   VK_INSERT, 1215  -- s+Insert
  480.    buildacceltable activeaccel, 'paste' ALTERNATE_PASTE, AF_VIRTUALKEY+AF_SHIFT+AF_CONTROL,   VK_INSERT, 1221  -- c+s+Insert
  481.    buildacceltable activeaccel, 'dokey F9',  AF_VIRTUALKEY,                VK_F9, 1216  -- F9
  482.   compile if EVERSION >= 5.50
  483.    buildacceltable activeaccel, 'dokey c+Y', AF_CHAR+AF_CONTROL,              89, 1217  -- c+Y
  484.    buildacceltable activeaccel, 'dokey c+Y', AF_CHAR+AF_CONTROL,             121, 1218  -- c+y
  485.   compile endif
  486.    buildacceltable activeaccel, 'select_all',AF_CHAR+AF_CONTROL,              47, 1219  -- c+/
  487.    buildacceltable activeaccel, 'DUPMARK U', AF_CHAR+AF_CONTROL,              92, 1220  -- c+\
  488.  
  489. compile if WANT_STACK_CMDS
  490.  compile if WANT_STACK_CMDS = 'SWITCH'
  491.    if stack_cmds then
  492.  compile endif
  493.    buildacceltable activeaccel, 'dokey c+down', AF_VIRTUALKEY+AF_CONTROL,   VK_DOWN, 1222  -- c+Down
  494.    buildacceltable activeaccel, 'dokey c+Up',   AF_VIRTUALKEY+AF_CONTROL,     VK_UP, 1223  -- c+Up
  495.  compile if WANT_STACK_CMDS = 'SWITCH'
  496.    endif
  497.  compile endif
  498.    buildacceltable activeaccel, 'swappos',  AF_CHAR+AF_CONTROL,                     61, 1224  -- c+=
  499.    buildacceltable activeaccel, 'pushmark', AF_VIRTUALKEY+AF_CONTROL+AF_SHIFT, VK_DOWN, 1225  -- c+s+Down
  500.    buildacceltable activeaccel, 'popmark',  AF_VIRTUALKEY+AF_CONTROL+AF_SHIFT,   VK_UP, 1226  -- c+s+Up
  501.    buildacceltable activeaccel, 'swapmark', AF_CHAR+AF_CONTROL+AF_SHIFT,            61, 1227  -- c+s+=
  502.    buildacceltable activeaccel, 'swapmark', AF_CHAR+AF_CONTROL+AF_SHIFT,            43, 1228  -- c+s++
  503. compile endif
  504.  
  505.                        -- Build keys on Search menu
  506.    buildacceltable activeaccel, 'dokey c+S', AF_CHAR+AF_CONTROL,              83, 1301  -- c+S
  507.    buildacceltable activeaccel, 'dokey c+S', AF_CHAR+AF_CONTROL,             115, 1302  -- c+s
  508.    buildacceltable activeaccel, 'dokey c+F', AF_CHAR+AF_CONTROL,              70, 1303  -- c+F
  509.    buildacceltable activeaccel, 'dokey c+F', AF_CHAR+AF_CONTROL,             102, 1304  -- c+f
  510.    buildacceltable activeaccel, 'dokey c+C', AF_CHAR+AF_CONTROL,              67, 1305  -- c+C
  511.    buildacceltable activeaccel, 'dokey c+C', AF_CHAR+AF_CONTROL,              99, 1306  -- c+c
  512.                        -- Build keys on Bookmark submenu
  513.   compile if WANT_BOOKMARKS
  514.    buildacceltable activeaccel, 'dokey c+B', AF_CHAR+AF_CONTROL,              66, 1331  -- c+B
  515.    buildacceltable activeaccel, 'dokey c+B', AF_CHAR+AF_CONTROL,              98, 1332  -- c+b
  516.    buildacceltable activeaccel, 'dokey c+M', AF_CHAR+AF_CONTROL,              77, 1333  -- c+M
  517.    buildacceltable activeaccel, 'dokey c+M', AF_CHAR+AF_CONTROL,             109, 1334  -- c+m
  518.    buildacceltable activeaccel, 'nextbookmark',  AF_CHAR+AF_ALT,              47, 1335  -- a+/
  519.    buildacceltable activeaccel, 'nextbookmark P',AF_CHAR+AF_ALT,              92, 1336  -- a+\
  520.   compile endif
  521.                        -- Build keys on Tags submenu
  522.   compile if WANT_TAGS
  523.    buildacceltable activeaccel, 'dokey s+F6', AF_VIRTUALKEY+AF_SHIFT,      VK_F6, 1361  -- s+F6
  524.    buildacceltable activeaccel, 'dokey s+F7', AF_VIRTUALKEY+AF_SHIFT,      VK_F7, 1362  -- s+F7
  525.    buildacceltable activeaccel, 'dokey s+F8', AF_VIRTUALKEY+AF_SHIFT,      VK_F8, 1363  -- s+F8
  526.    buildacceltable activeaccel, 'dokey s+F9', AF_VIRTUALKEY+AF_SHIFT,      VK_F9, 1364  -- s+F9
  527.   compile endif
  528.  
  529.                        -- Build keys on Options menu
  530.    buildacceltable activeaccel, 'dokey c+G', AF_CHAR+AF_CONTROL,              71, 1401  -- c+G
  531.    buildacceltable activeaccel, 'dokey c+G', AF_CHAR+AF_CONTROL,             103, 1402  -- c+g
  532.  
  533.                        -- Build keys on Command menu
  534.    buildacceltable activeaccel, 'dokey c+I', AF_CHAR+AF_CONTROL,              73, 1501  -- c+I
  535.    buildacceltable activeaccel, 'dokey c+I', AF_CHAR+AF_CONTROL,             105, 1502  -- c+i
  536.  
  537.                        -- Block action bar accelerator keys (English)
  538.   compile if BLOCK_ACTIONBAR_ACCELERATORS
  539.    compile if BLOCK_ACTIONBAR_ACCELERATORS = 'SWITCH'
  540.    if not CUA_MENU_ACCEL then
  541.    compile endif
  542.    buildacceltable activeaccel, 'dokey a+'FILE_ACCEL__L,    AF_CHAR+AF_ALT, FILE_ACCEL__A1   , 1001  -- a+F
  543.    buildacceltable activeaccel, 'dokey a+'FILE_ACCEL__L,    AF_CHAR+AF_ALT, FILE_ACCEL__A2   , 1002  -- a+f
  544.    buildacceltable activeaccel, 'dokey a+'EDIT_ACCEL__L,    AF_CHAR+AF_ALT, EDIT_ACCEL__A1   , 1003  -- a+E
  545.    buildacceltable activeaccel, 'dokey a+'EDIT_ACCEL__L,    AF_CHAR+AF_ALT, EDIT_ACCEL__A2   , 1004  -- a+e
  546.    buildacceltable activeaccel, 'dokey a+'SELECTED_ACCEL__L,AF_CHAR+AF_ALT, SELECTED_ACCEL__A1,1005  -- a+S
  547.    buildacceltable activeaccel, 'dokey a+'SELECTED_ACCEL__L,AF_CHAR+AF_ALT, SELECTED_ACCEL__A2,1006  -- a+s
  548.    buildacceltable activeaccel, 'dokey a+'VIEW_ACCEL__L,    AF_CHAR+AF_ALT, VIEW_ACCEL__A1,    1007  -- a+V
  549.    buildacceltable activeaccel, 'dokey a+'VIEW_ACCEL__L,    AF_CHAR+AF_ALT, VIEW_ACCEL__A2,    1008  -- a+v
  550.    buildacceltable activeaccel, 'dokey a+'HELP_ACCEL__L,    AF_CHAR+AF_ALT, HELP_ACCEL__A1   , 1011  -- a+H
  551.    buildacceltable activeaccel, 'dokey a+'HELP_ACCEL__L,    AF_CHAR+AF_ALT, HELP_ACCEL__A2   , 1012  -- a+h
  552.    compile if MENU_LIMIT
  553.    buildacceltable activeaccel, 'dokey a+'RING_ACCEL__L,    AF_CHAR+AF_ALT, RING_ACCEL__A1   , 1013  -- a+R
  554.    buildacceltable activeaccel, 'dokey a+'RING_ACCEL__L,    AF_CHAR+AF_ALT, RING_ACCEL__A2   , 1014  -- a+r
  555.    compile endif
  556.    compile if defined(ACTIONS_ACCEL__L)  -- For CUSTEPM support
  557.    buildacceltable activeaccel, 'dokey a+'ACTIONS_ACCEL__L, AF_CHAR+AF_ALT, ACTIONS_ACCEL__A1, 1017  -- a+A
  558.    buildacceltable activeaccel, 'dokey a+'ACTIONS_ACCEL__L, AF_CHAR+AF_ALT, ACTIONS_ACCEL__A2, 1018  -- a+a
  559.    compile endif
  560.    compile if BLOCK_ACTIONBAR_ACCELERATORS = 'SWITCH'
  561.    endif -- CUA_MENU_ACCEL
  562.    compile endif
  563.   compile endif -- BLOCK_ACTIONBAR_ACCELERATORS
  564.  
  565. compile if BLOCK_ACTIONBAR_ACCELERATORS = 'SWITCH'
  566. define  -- Prepare for some conditional tests
  567.  compile if MENU_LIMIT
  568.    maybe_ring_accel = 'RING_ACCEL__L ='
  569.  compile else
  570.    maybe_ring_accel = "' ' ="  -- Will be false for any letter
  571.  compile endif
  572.  compile if defined(ACTIONS_ACCEL__L)  -- For CUSTEPM support
  573.    maybe_actions_accel = 'ACTIONS_ACCEL__L ='
  574.  compile else
  575.    maybe_actions_accel = "' ' ="  -- Will be false for any letter
  576.  compile endif
  577.  
  578. defproc update_edit_menu_text =  -- Actually, Selected menu, but we'll keep the name...
  579.    universal CUA_MENU_ACCEL
  580.    accel_len = (3+length(ALT_KEY__MSG))*(not CUA_MENU_ACCEL)
  581.  
  582.  compile if FILE_ACCEL__L = 'C' | EDIT_ACCEL__L = 'C' | VIEW_ACCEL__L = 'C' | SELECTED_ACCEL__L = 'C' | HELP_ACCEL__L = 'C' | $maybe_ring_accel 'C' | $maybe_actions_accel 'C'
  583.    menutext = COPY_MARK_MENU__MSG || leftstr(\9 || ALT_KEY__MSG'+C', accel_len)\0
  584.    call windowmessage(1, getpminfo(EPMINFO_EDITMENUHWND),
  585.                       398,                  -- x18e, MM_SetItemText
  586.                       350 + 65536,
  587.                       ltoa(offset(menutext) || selector(menutext), 10) )
  588.  compile endif
  589.  
  590.  compile if FILE_ACCEL__L = 'M' | EDIT_ACCEL__L = 'M' | VIEW_ACCEL__L = 'M' | SELECTED_ACCEL__L = 'M' | HELP_ACCEL__L = 'M' | $maybe_ring_accel 'M' | $maybe_actions_accel 'M'
  591.    menutext = MOVE_MARK_MENU__MSG || leftstr(\9 || ALT_KEY__MSG'+M', accel_len)\0
  592.    call windowmessage(1, getpminfo(EPMINFO_EDITMENUHWND),
  593.                       398,                  -- x18e, MM_SetItemText
  594.                       360 + 65536,
  595.                       ltoa(offset(menutext) || selector(menutext), 10) )
  596.  compile endif
  597.  
  598.  compile if FILE_ACCEL__L = 'O' | EDIT_ACCEL__L = 'O' | VIEW_ACCEL__L = 'O' | SELECTED_ACCEL__L = 'O' | HELP_ACCEL__L = 'O' | $maybe_ring_accel 'O' | $maybe_actions_accel 'O'
  599.    menutext = OVERLAY_MARK_MENU__MSG || leftstr(\9 || ALT_KEY__MSG'+O', accel_len)\0
  600.    call windowmessage(1, getpminfo(EPMINFO_EDITMENUHWND),
  601.                       398,                  -- x18e, MM_SetItemText
  602.                       370 + 65536,
  603.                       ltoa(offset(menutext) || selector(menutext), 10) )
  604.  compile endif
  605.  
  606.  compile if FILE_ACCEL__L = 'A' | EDIT_ACCEL__L = 'A' | VIEW_ACCEL__L = 'A' | SELECTED_ACCEL__L = 'A' | HELP_ACCEL__L = 'A' | $maybe_ring_accel 'A' | $maybe_actions_accel 'A'
  607.    menutext = ADJUST_MARK_MENU__MSG || leftstr(\9 || ALT_KEY__MSG'+A', accel_len)\0
  608.    call windowmessage(1, getpminfo(EPMINFO_EDITMENUHWND),
  609.                       398,                  -- x18e, MM_SetItemText
  610.                       380 + 65536,
  611.                       ltoa(offset(menutext) || selector(menutext), 10) )
  612.  compile endif
  613.  
  614.  compile if FILE_ACCEL__L = 'U' | EDIT_ACCEL__L = 'U' | VIEW_ACCEL__L = 'U' | SELECTED_ACCEL__L = 'U' | HELP_ACCEL__L = 'U' | $maybe_ring_accel 'U' | $maybe_actions_accel 'U'
  615.    menutext = UNMARK_MARK_MENU__MSG || leftstr(\9 || ALT_KEY__MSG'+U', accel_len)\0
  616.    call windowmessage(1, getpminfo(EPMINFO_EDITMENUHWND),
  617.                       398,                  -- x18e, MM_SetItemText
  618.                       334 + 65536,
  619.                       ltoa(offset(menutext) || selector(menutext), 10) )
  620.  compile endif
  621.  
  622.  compile if FILE_ACCEL__L = 'D' | EDIT_ACCEL__L = 'D' | VIEW_ACCEL__L = 'D' | SELECTED_ACCEL__L = 'D' | HELP_ACCEL__L = 'D' | $maybe_ring_accel 'D' | $maybe_actions_accel 'D'
  623.    menutext = DELETE_MARK_MENU__MSG || leftstr(\9 || ALT_KEY__MSG'+D', accel_len)\0
  624.    call windowmessage(1, getpminfo(EPMINFO_EDITMENUHWND),
  625.                       398,                  -- x18e, MM_SetItemText
  626.                       340 + 65536,
  627.                       ltoa(offset(menutext) || selector(menutext), 10) )
  628.  compile endif
  629.  
  630. compile endif
  631.  
  632.  
  633.  
  634. defc menuinit_2                  ------------- Menu id 2 -- Edit -------------------------
  635.  compile if CHECK_FOR_LEXAM
  636.    universal LEXAM_is_available
  637.  compile endif
  638.    undoaction 1, PresentState        -- Do to fix range, not for value.
  639.    undoaction 6, StateRange               -- query range
  640.    parse value staterange with oldeststate neweststate .
  641.    SetMenuAttribute( 200, 16384, oldeststate<>neweststate )  -- Set to 1 if different
  642.    on = marktype()<>''
  643.    buf_flag = 0
  644.    if not on then                             -- Only check buffer if no mark
  645.       bufhndl = buffer(OPENBUF, EPMSHAREDBUFFER)
  646.       if bufhndl then                         -- If the buffer exists, check the
  647.          buf_flag=itoa(peek(bufhndl,2,2),10)  -- amount of used space in buffer
  648.          call buffer(FREEBUF, bufhndl)        -- then free it.
  649.       endif
  650.    endif
  651.    SetMenuAttribute( 210, 16384, on)      -- Copy to clipboard
  652.    SetMenuAttribute( 220, 16384, on)      -- Cut
  653.  compile if EVERSION >= '6.03'
  654.    paste = clipcheck(format) & (format=1024) & not (browse() | .readonly)
  655.  compile elseif EPM32
  656.    paste = clipcheck(format) & (format=1024) & browse()=0
  657.  compile else
  658.    paste = clipcheck(format) & (format=256) & browse()=0
  659.  compile endif  -- EPM32
  660.    SetMenuAttribute( 230, 16384, paste)
  661.    SetMenuAttribute( 240, 16384, on)      -- Delete mark
  662.    SetMenuAttribute( 251, 16384, on)      -- Unmark (Deselect all)
  663.  compile if SPELL_SUPPORT
  664.   compile if CHECK_FOR_LEXAM
  665.     if LEXAM_is_available then
  666.   compile endif
  667.       SetMenuAttribute( 263, 8192, .keyset <> 'SPELL_KEYS')
  668.   compile if CHECK_FOR_LEXAM
  669.     endif
  670.   compile endif
  671.  compile endif  -- SPELL_SUPPORT
  672.  
  673. defc menuinit_200                ------------- Menu id 200 -- Undo ---------------------
  674.    SetMenuAttribute( 201, 16384, isadirtyline())
  675.    undoaction 1, PresentState        -- Do to fix range, not for value.
  676.    undoaction 6, StateRange               -- query range
  677.    parse value staterange with oldeststate neweststate .
  678.    SetMenuAttribute( 202, 16384, oldeststate<>neweststate )  -- Set to 1 if different
  679.  
  680.  
  681.  
  682. defc menuinit_230                ------------- Menu id 230 -- Paste ---------------------
  683. compile if EVERSION >= '6.03'
  684.    paste = clipcheck(format) & (format=1024) & not (browse() | .readonly)
  685. compile elseif EPM32
  686.    paste = clipcheck(format) & (format=1024) & browse()=0
  687. compile else
  688.    paste = clipcheck(format) & (format=256) & browse()=0
  689. compile endif  -- EPM32
  690.    SetMenuAttribute( 231, 16384, paste)
  691.    SetMenuAttribute( 232, 16384, paste)
  692.    SetMenuAttribute( 233, 16384, paste)
  693.  
  694.  
  695. defc menuinit_3                  ------------- Menu id 3 -- View -------------------------
  696.  compile if WANT_STACK_CMDS
  697.    universal position_stack
  698.   compile if WANT_STACK_CMDS = 'SWITCH'
  699.    universal stack_cmds
  700.   compile endif
  701.  compile endif
  702.  compile if RING_OPTIONAL
  703.    universal ring_enabled
  704.  compile endif
  705.  compile if RING_OPTIONAL
  706.    if ring_enabled then
  707.  compile endif
  708.       SetMenuAttribute( 340, 16384, filesinring()>1)  -- List ring
  709.  compile if RING_OPTIONAL
  710.    endif
  711.  compile endif
  712.  compile if WANT_STACK_CMDS
  713.   compile if WANT_STACK_CMDS = 'SWITCH'
  714.    if stack_cmds then
  715.   compile endif
  716.       SetMenuAttribute( 344, 16384, position_stack<>'')  -- Pop cursor
  717.       SetMenuAttribute( 345, 16384, position_stack<>'')  -- Swap cursor
  718.   compile if WANT_STACK_CMDS = 'SWITCH'
  719.    endif
  720.   compile endif
  721.  compile endif
  722.  
  723.  
  724.  
  725. defc menuinit_300               ------------- Menu id 300 -- Search -----------------------
  726.       universal lastchangeargs
  727.       getsearch strng
  728.       parse value strng with . c .       -- blank, 'c', or 'l'
  729.       SetMenuAttribute( 303, 16384, c<>'')  -- Find Next OK if not blank
  730.       SetMenuAttribute( 304, 16384, lastchangeargs<>'')  -- Change Next only if 'c'
  731.  
  732.  
  733.  
  734. compile if WANT_BOOKMARKS
  735. defc menuinit_310                ------------- Menu id 310 -- Bookmarks --------------------
  736.       universal EPM_utility_array_ID
  737.       do_array 3, EPM_utility_array_ID, 'bmi.0', bmcount          -- Index says how many bookmarks there are
  738.  compile if EVERSION >= '6.03'
  739.       SetMenuAttribute( 311, 16384, not(browse() | .readonly))  -- Set
  740.  compile else
  741.       SetMenuAttribute( 311, 16384, browse()=0)  -- Set
  742.  compile endif
  743.       SetMenuAttribute( 312, 16384, bmcount>0)   -- List
  744.       SetMenuAttribute( 314, 16384, bmcount>0)   -- Next
  745.       SetMenuAttribute( 315, 16384, bmcount>0)   -- Prev
  746. compile endif  -- WANT_BOOKMARKS
  747.  
  748.  
  749. defc menuinit_4                  ------------- Menu id 4 -- Selected ---------------------
  750.  compile if WANT_STACK_CMDS
  751.    universal mark_stack
  752.   compile if WANT_STACK_CMDS = 'SWITCH'
  753.    universal stack_cmds
  754.   compile endif
  755.  compile endif
  756.    SetMenuAttribute( 400, 16384, on)      -- Style dialog
  757.    on = marktype()<>''
  758.    buf_flag = 0
  759.    if not on then                             -- Only check buffer if no mark
  760.       bufhndl = buffer(OPENBUF, EPMSHAREDBUFFER)
  761.       if bufhndl then                         -- If the buffer exists, check the
  762.          buf_flag=itoa(peek(bufhndl,2,2),10)  -- amount of used space in buffer
  763.          call buffer(FREEBUF, bufhndl)        -- then free it.
  764.       endif
  765.    endif
  766.    SetMenuAttribute( 410, 16384, on | buf_flag)  -- Can Copy if mark or buffer has data
  767.    SetMenuAttribute( 415, 16384, on)      -- Move mark
  768.    SetMenuAttribute( 420, 16384, on | buf_flag)  -- Ditto for Overlay mark
  769.    SetMenuAttribute( 425, 16384, on)      -- Adjust mark
  770.  compile if WANT_STACK_CMDS
  771.   compile if WANT_STACK_CMDS = 'SWITCH'
  772.    if stack_cmds then
  773.   compile endif
  774.       SetMenuAttribute( 431, 16384, on)                  -- Push mark
  775.       SetMenuAttribute( 432, 16384, mark_stack<>'')      -- Pop mark
  776.       SetMenuAttribute( 433, 16384, on & mark_stack<>'') -- Swap mark
  777.   compile if WANT_STACK_CMDS = 'SWITCH'
  778.    endif
  779.   compile endif
  780.  compile endif
  781.    SetMenuAttribute( 450, 16384, on)      -- Print marked text
  782.  
  783.  
  784.  
  785.