rxvtRef-menubar.yo 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. COMMENT(-- $Id: rxvtRef-menubar.yo,v 1.4 2000/07/05 08:17:48 gcw Exp $ --)
  2. label(menuBar)
  3. nsect(menuBar)
  4. bf(The exact syntax used is em(almost) solidified.) nl()\
  5. In the menus, bf(DON'T) try to use menuBar commands that add or remove a
  6. menuBar.
  7. Note that in all of the commands, the bf(em(/path/)) em(cannot) be omitted:
  8. use bf(./) to specify a menu relative to the current menu.
  9. nsubsect(Overview of menuBar operation)
  10. For the menuBar XTerm escape sequence tt(ESC ] 10 ; Pt ST), the
  11. syntax of tt(Pt) can be used for a variety of tasks:
  12. startit()
  13. it()link(Commands)(menuBarCommands)
  14. it()link(Adding and accessing menus)(menuBarAdd)
  15. it()link(Removing menus)(menuBarRemove)
  16. it()link(Quick Arrows)(menuBarArrows)
  17. it()link(Command Summary)(menuBarSummary)
  18. endit()
  19. At the top level is the current menuBar which is a member of a circular
  20. linked-list of other such menuBars.
  21. The menuBar acts as a parent for the various drop-down menus, which in turn,
  22. may have labels, separator lines, menuItems and subMenus.
  23. The menuItems are the useful bits: you can use them to mimic keyboard input
  24. or even to send text or escape sequences back to rxvt.
  25. The menuBar syntax is intended to provide a simple yet robust method of
  26. constructing and manipulating menus and navigating through the menuBars.
  27. The first step is to use the tag bf([menu:em(name)]) which creates the
  28. menuBar called em(name) and allows access.
  29. You may now link(add)(menuBarAdd) or link(remove)(menuBarRemove) menus,
  30. subMenus, and menuItems. Finally, use the tag bf([done]) to set the menuBar
  31. access as bf(readonly) to prevent accidental corruption of the menus.
  32. To re-access the current menuBar for alterations, use the tag bf([menu]),
  33. make the alterations and then use bf([done])
  34. label(menuBarCommands)
  35. nsubsect(Commands)
  36. startdl()
  37. dl(bf([menu:+em(name)]))
  38. (access the named menuBar for creation or alteration. If a new menuBar
  39. is created, it is called em(name) (max of 15 chars) and the current
  40. menuBar is pushed onto the stack)
  41. P()\
  42. dl(bf([menu]))
  43. (access the current menuBar for alteration)
  44. P()\
  45. dl(bf([title:+em(string)]))
  46. (set the current menuBar's title to em(string), which may contain the
  47. following format specifiers: nl()\
  48. bf(%%) : literal bf(%) character nl()\
  49. bf(%n) : rxvt name (as per the bf(-name) command-line option) nl()\
  50. bf(%v) : rxvt version)
  51. P()\
  52. dl(bf([done]))
  53. (set menuBar access as bf(readonly). nl()\
  54. End-of-file tag for bf([read:+em(file)]) operations.)
  55. P()\
  56. dl(bf([read:+em(file)]))
  57. (read menu commands directly from em(file) (extension ".menu" will be
  58. appended if required.) Start reading at a line with bf([menu]) or
  59. bf([menu:+em(name)) and continuing until bf([done]) is encountered.
  60. Blank and comment lines (starting with bf(#)) are ignored.
  61. Actually, since any invalid menu commands are also ignored, almost
  62. anything could be construed as a comment line, but this may be
  63. tightened up in the future ... so don't count on it!.)
  64. P()\
  65. dl(bf([read:+em(file);+em(name)]))
  66. (The same as bf([read:+em(file)]), but start reading at a line with
  67. bf([menu:+em(name)]) and continuing until bf([done:+em(name)]) or
  68. bf([done]) is encountered.)
  69. P()\
  70. dl(bf([dump]))
  71. (dump all menuBars to the file bf(/tmp/rxvt-PID) in a format suitable
  72. for later rereading.)
  73. P()\
  74. dl(bf([rm:name]nl()[rm] [rm:]nl()[rm*] [rm:*]))
  75. (remove the named menuBar nl()\
  76. remove the current menuBar nl()\
  77. remove all menuBars)
  78. P()\
  79. dl(bf([swap]))
  80. (swap the top two menuBars)
  81. P()\
  82. dl(bf([prev]nl()[next]))
  83. (access the previous or next menuBar)
  84. P()\
  85. dl(bf([show]nl()[hide]))
  86. (control display of the menuBar ... just like
  87. link(ESC[?10 h/l)(Priv10))
  88. P()\
  89. dl(bf([pixmap:+em(name)]nl()[pixmap:+em(name);em(scaling)]))
  90. (set the background pixmap globally ... just like
  91. link(ESC ] 20 ; Pt ST)(XPM)
  92. bf(A Future implementation em(may) make this local to the menubar))
  93. P()\
  94. dl(bf([:+em(command):]))
  95. (ignore the menu readonly status and issue a em(command) to
  96. link(Add/Modify)(menuBarAdd) or link(Remove)(menuBarRemove) a menu or
  97. menuitem or change the link(Quick Arrows)(menuBarArrows); a useful
  98. shortcut for setting the quick arrows from a menuBar.)
  99. enddl()
  100. label(menuBarAdd)
  101. nsubsect(Adding and accessing menus)
  102. The following commands may also be bf(+) prefixed.
  103. startdl()
  104. dl(bf(/+nl()./+nl()../+nl()../../))
  105. (access menuBar top level nl()\
  106. access current menu level nl()\
  107. access parent menu (1 level up) nl()\
  108. access parent menu (multiple levels up))
  109. dl(bf(em(/path/)menu))
  110. (add/access menu)
  111. dl(bf(em(/path/)menu/*))
  112. (add/access menu and clear it if it exists)
  113. dl(bf(em(/path/){-}))
  114. (add separator)
  115. dl(bf(em(/path/){item}))
  116. (add bf(item) as a label)
  117. dl(bf(em(/path/){item} action))
  118. (add/alter em(menuitem) with an associated em(action))
  119. dl(bf(em(/path/){item}{right-text}))
  120. (add/alter em(menuitem) with bf(right-text) as the right-justified
  121. text and as the associated em(action))
  122. dl(bf(em(/path/){item}{rtext} action))
  123. (add/alter em(menuitem) with an associated em(action) and with
  124. bf(rtext) as the right-justified text.)
  125. enddl()
  126. startdl()
  127. dl(Special characters in em(action) must be backslash-escaped:)
  128. (bf(\a \b \E \e \n \r \t \octal))
  129. dl(or in control-character notation:)
  130. (bf(^@, ^A .. ^Z .. ^_, ^?))
  131. enddl()
  132. To send a string starting with a bf(NUL) (bf(^@)) character to the program,
  133. start em(action) with a pair of bf(NUL) characters (bf(^@^@)), the first of
  134. which will be stripped off and the balance directed to the program.
  135. Otherwise if em(action) begins with bf(NUL) followed by non-+bf(NUL)
  136. characters, the leading bf(NUL) is stripped off and the balance is sent back
  137. to rxvt.
  138. As a convenience for the many Emacs-type editors, em(action) may start
  139. with bf(M-) (eg, bf(M-$) is equivalent to bf(\E$)) and a bf(CR) will be
  140. appended if missed from bf(M-x) commands.
  141. As a convenience for issuing XTerm bf(ESC]) sequences from a menubar
  142. (or quick arrow), a bf(BEL) (bf(^G)) will be appended if needed.
  143. startdl()
  144. dl(For example,)
  145. (bf(M-xapropos) is equivalent to bf(\Exapropos\r))
  146. dl(and)
  147. (bf(\E]10;mona;100) is equivalent to bf(\E]10;mona;100\a))
  148. enddl()
  149. The option bf({em(right-rtext)}) will be right-justified. In the absence of
  150. a specified action, this text will be used as the em(action) as well.
  151. startdl()
  152. dl(For example,)
  153. (bf(/File/{Open}{^X^F}) is equivalent to bf(/File/{Open}{^X^F} ^X^F))
  154. enddl()
  155. The left label em(is) necessary, since it's used for matching,
  156. but implicitly hiding the left label (by using same name for both left
  157. and right labels), or explicitly hiding the left label (by preceeding
  158. it with a dot), makes it possible to have right-justified text only.
  159. startdl()
  160. dl(For example,)
  161. (bf(/File/{Open}{Open} Open-File-Action))
  162. dl(or hiding it)
  163. (bf(/File/{.anylabel}{Open} Open-File-Action))
  164. enddl()
  165. label(menuBarRemove)
  166. nsubsect(Removing menus)
  167. startdl()
  168. dl(bf(-/*+nl()-+em(/path)menu+nl()-+em(/path){item}+nl()-+em(/path){-}))
  169. (remove all menus from the menuBar, the same as bf([clear])nl()\
  170. remove menu nl()\
  171. remove item nl()\
  172. remove separator)
  173. dl(bf(-/path/menu/*))
  174. (remove all items, separators and submenus from menu)
  175. enddl()
  176. label(menuBarArrows)
  177. nsubsect(Quick Arrows)
  178. The menus also provide a hook for em(quick arrows) to provide easier user
  179. access. If nothing has been explicitly set, the default is to emulate the
  180. curror keys. The syntax permits each arrow to be altered individually or
  181. all four at once without re-entering their common beginning/end text. For
  182. example, to explicitly associate cursor actions with the arrows, any of
  183. the following forms could be used:
  184. startdl()
  185. dl(bf(<r>+em(Right)nl()<l>+em(Left)nl()<u>+em(Up)nl()<d>+em(Down)))
  186. (Define actions for the respective arrow buttons)
  187. dl(bf(<b>+em(Begin)nl()<e>+em(End)))
  188. (Define common beginning/end parts for em(quick arrows) which used
  189. in conjunction with the above <r> <l> <u> <d> constructs)
  190. enddl()
  191. startdl()
  192. dl(For example, define arrows individually,)
  193. (bf(<u>\E[A nl()\
  194. <d>\E[B nl()\
  195. <r>\E[C nl()\
  196. <l>\E[D))
  197. dl(or all at once)
  198. (bf(<u>\E[A<d>\E[B<r>\E[C<l>\E[D))
  199. dl(or more compactly (factoring out common parts))
  200. (bf(<b>\E[<u>A<d>B<r>C<l>D))
  201. enddl()
  202. label(menuBarSummary)
  203. nsubsect(Command Summary)
  204. A short summary of the most em(common) commands:
  205. startdl()
  206. dl([menu:name])
  207. (use an existing named menuBar or start a new one)
  208. dl([menu])
  209. (use the current menuBar)
  210. dl([title:string])
  211. (set menuBar title)
  212. dl([done])
  213. (set menu access to readonly and, if reading from a file, signal EOF)
  214. dl([done:name])
  215. (if reading from a file using [read:file;name] signal EOF)
  216. dl([rm:name]+nl()[rm] [rm:]+nl()[rm*] [rm:*])
  217. (remove named, current, or all menuBar(s))
  218. dl([swap])
  219. (swap top two menuBars)
  220. dl([prev]+nl()[next])
  221. (access the previous/next menuBar)
  222. dl([show]+nl()[hide])
  223. (map/unmap menuBar)
  224. dl([pixmap;file]+nl()[pixmap;file;scaling])
  225. (set a background pixmap)
  226. dl([read:file]+nl()[read:file;name])
  227. (read in a menu from a file)
  228. dl([dump])
  229. (dump out all menuBars to /tmp/rxvt-PID)
  230. dl(/)
  231. (access menuBar top level)
  232. dl(./+nl()../+nl()../../)
  233. (access current or parent menu level)
  234. dl(/path/menu)
  235. (add/access menu)
  236. dl(/path/{-})
  237. (add separator)
  238. dl(/path/{item}{rtext} action)
  239. (add/alter menu item+nl()({rtext} and/or action, may be omitted))
  240. dl(-/*)
  241. (remove all menus from the menuBar)
  242. dl(-/path/menu)
  243. (remove menu items, separators and submenus from menu)
  244. dl(-/path/menu)
  245. (remove menu)
  246. dl(-/path/{item})
  247. (remove item)
  248. dl(-/path/{-})
  249. (remove separator)
  250. dl(<b>Begin<r>Right<l>Left<u>Up<d>Down<e>End)
  251. (menu quick arrows)
  252. enddl()