manual_Manual.cpp 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. /* manual_Manual.cpp
  2. *
  3. * Copyright (C) 1992-2007,2010,2011,2014-2017 Paul Boersma
  4. *
  5. * This code is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or (at
  8. * your option) any later version.
  9. *
  10. * This code is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. * See the GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this work. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #include "ManPagesM.h"
  19. void manual_Manual_init (ManPages me);
  20. void manual_Manual_init (ManPages me) {
  21. MAN_BEGIN (U"Manual", U"ppgb", 20110101)
  22. INTRO (U"The documentation system for the Praat program.")
  23. NORMAL (U"You will get a manual window every time you choose anything from a #Help menu or press a #Help button.")
  24. ENTRY (U"How to find what you are looking for")
  25. NORMAL (U"You can navigate the manual in several ways:")
  26. LIST_ITEM (U"\\bu To go to the Intro, use the #Home button.")
  27. LIST_ITEM (U"\\bu To go to the information behind a %link (a piece of blue text), just click on it.")
  28. LIST_ITEM (U"\\bu To go forward and backward through a tutorial with numbered pages, use ##1 ># and ##< 1#.")
  29. LIST_ITEM (U"\\bu To %revisit previous pages, use the #< and #> buttons.")
  30. LIST_ITEM (U"\\bu To browse %alphabetically, use the horizontal scroll bar and the buttons "
  31. "named ##< 1# and ##1 >#, or the ##Search for page (list)...# command in the ##Go to# menu.")
  32. LIST_ITEM (U"\\bu To find a page with a %%known title%, use the ##Search for page...# command.")
  33. NORMAL (U"The fastest way to find what you want is usually the #Search button.")
  34. ENTRY (U"Search")
  35. NORMAL (U"In the text field after the Search button, you can type strings, separated by spaces. "
  36. "When you press the #Return (or #Enter) key, or click the #Search button, "
  37. "all manual pages are searched for the combination of strings that you typed. "
  38. "The titles of the 20 best matching pages are displayed as links.")
  39. NORMAL (U"##Example:# to know how to create a pitch contour from a sound, type")
  40. CODE (U"sou pit")
  41. NORMAL (U"and press #Return. The best matches should appear on top. These should include "
  42. "##Sound: To Pitch (ac)...# and ##Sound: To Pitch (cc)...#.")
  43. NORMAL (U"The search is case-insensitive. For instance, the search string \"$script\" will give you all "
  44. "the pages that contain the words %script, %Script, %description, %PostScript, or %SCRIPT, and so on.")
  45. NORMAL (U"#Background. The search algorithm uses the following heuristics:")
  46. LIST_ITEM (U"\\bu A match in the page title is better than one in the rest of the text.")
  47. LIST_ITEM (U"\\bu Pages with many matches are better than those with few.")
  48. ENTRY (U"Your own manual pages")
  49. NORMAL (U"To create your own manual pages, create @ManPages text files.")
  50. MAN_END
  51. MAN_BEGIN (U"ManPages", U"ppgb", 20170904)
  52. INTRO (U"You can create a documentation or education system with files that you and others "
  53. "can read into Praat (with the @@Read from file...@ command). "
  54. "Your files will become a hypertext system very similar to the usual @Manual.")
  55. ENTRY (U"Example 1: a single document")
  56. NORMAL (U"If you create a single ManPages text file, it will look like a manual with a single page. "
  57. "Here is an example:")
  58. CODE (U"ManPagesTextFile")
  59. CODE (U"\"Welkom\" \"miep\" 19970820 0")
  60. CODE (U"<intro> \"Hallo allemaal!\"")
  61. CODE (U"<entry> \"Belangrijk...\"")
  62. CODE (U"<normal> \"Hoogge\\bse\\\" \\\" erd publiek!\"")
  63. CODE (U"<normal> \"Einde.\"")
  64. NORMAL (U"A ManPages text file should start with the following information:")
  65. LIST_ITEM (U"1. The word \"ManPagesTextFile\" on the first line.")
  66. LIST_ITEM (U"2. The title of the manual page, between double quotes. "
  67. "This will be drawn at the top of the page. "
  68. "The name of the ManPages text file should be derived from this title (see below).")
  69. LIST_ITEM (U"3. The author of the manual page, between double quotes. "
  70. "This will be drawn at the bottom of the page.")
  71. LIST_ITEM (U"4. The date you created or modified the page, "
  72. "in the format year \\-- month (two digits) \\-- day (two digits), without spaces.")
  73. LIST_ITEM (U"5. The recording time. If this is not zero, "
  74. "three sound buttons (see below) will appear at the top of the page.")
  75. LIST_ITEM (U"6. A sequence of paragraph types and texts. "
  76. "You put the types between < and >, and the texts between double quotes "
  77. "(if your text contains a double quote, you should write two double quotes).")
  78. NORMAL (U"The format of a ManPages text file is rather free, as long as the first line is correct, "
  79. "the four required pieces of information are there in the correct order, "
  80. "and there is a correct alternation between paragraph texts and types. "
  81. "If you put multiple elements on a line, there should be at least one space between them. "
  82. "You may distribute texts across multiple lines, as long as you do not add any spaces:")
  83. CODE (U"<normal> \"Hoogge\\bse\\\" \\\" erd")
  84. CODE (U"publiek!\"")
  85. NORMAL (U"This will have exactly the same effect as above.")
  86. ENTRY (U"Example 2: multiple documents")
  87. NORMAL (U"The above example with a single document is not very useful. "
  88. "You will usually want to refer to other documents:")
  89. CODE (U"ManPagesTextFile")
  90. CODE (U"\"Welcome\" \"Paul Boersma\" 19970820 1.0")
  91. CODE (U"<intro> \"Welcome to Paul's transcription course.\"")
  92. CODE (U"<entry> \"Groups of speech sounds\"")
  93. CODE (U"<normal> \"You can listen to the following sounds")
  94. CODE (U"from the languages of the world,")
  95. CODE (U"pronounced by a single speaker (me):\\\"r")
  96. CODE (U"<list_item> \"\\@ Vowels, quite problematic for Dutch students!\"")
  97. CODE (U"<list_item> \"\\@ \\@ Dorsal fricatives\\@ , equally problematic!\"")
  98. NORMAL (U"With the symbol `\\@ ', you create a %link to another ManPages text file. "
  99. "A link will be drawn in blue on your screen. "
  100. "In this example, you have created links to the files ##Vowels.man# "
  101. "and ##Dorsal_fricatives.man# in the same directory as the current file "
  102. "(all ##.man# files have to be in the same directory; this makes it likely "
  103. "that their names are unique). "
  104. "If the link contains spaces or other non-alphanumeric symbols, "
  105. "you have to use three `\\@ ' symbols, as shown; "
  106. "with a single word, you may use a single `\\@ '.")
  107. NORMAL (U"In resolving the file name, the ManPages system replaces spaces "
  108. "and other special symbols with underscores, "
  109. "and converts any initial lower-case character by its upper-case variant. "
  110. "For instance, if your link is \"\\@ \\@ back vowels\\@ \", "
  111. "the file name will be ##Back_vowels.man#.")
  112. NORMAL (U"The title in the second line of ##Back_vowels.man# must be equal to the link name, "
  113. "though capitalization of the first letter is allowed. "
  114. "Thus, the title of ##Back_vowels.man# will probably be \"Back vowels\". "
  115. "Likewise, the starting file with the title \"Welcome\" should have the name ##Welcome.man# "
  116. "if any other files refer to it.")
  117. ENTRY (U"Paragraph types")
  118. NORMAL (U"A normal paragraph will have type <normal>. The hypertext system will "
  119. "leave a blank space between paragraphs with this type. "
  120. "The first paragraph of a manual page will normally have the type <intro>. "
  121. "Though this may look the same as <normal>, the search system of the @Manual "
  122. "may take account of the distinction.")
  123. NORMAL (U"Headings (like the title \"Paragraph types\" of this subsection) "
  124. "have type <entry>. This will be drawn in a larger character size.")
  125. NORMAL (U"For lists, you use the type <list_item>. You will often combine this with %button symbols, "
  126. "like in the following:")
  127. CODE (U"<normal> \"Choose a colour:\"")
  128. CODE (U"<list_item> \"\\bsbu \\@ Red.\"")
  129. CODE (U"<list_item> \"\\bsbu \\@ Green.\"")
  130. CODE (U"<list_item> \"\\bsbu \\@ Blue.\"")
  131. NORMAL (U"For text that should appear with a fixed character width, you use the type <code>.")
  132. NORMAL (U"For a paragraph that should be connected with the following paragraph "
  133. "without leaving a blank space "
  134. "(probably a list item or a definition), you use the type <tag>.")
  135. NORMAL (U"For a paragraph with a blank left margin, you use the type <definition>.")
  136. NORMAL (U"For a paragraph with an embedded script (a picture), you use the type <script> (see below).")
  137. ENTRY (U"Special symbols and styles")
  138. NORMAL (U"You can use all of Praat's @@special symbols@ and @@text styles@, "
  139. "except that some %single text-style symbols have different meanings:")
  140. LIST_ITEM (U"\\bu A single percent sign introduces a word in italic: $$\\% pot$ gives %pot.")
  141. LIST_ITEM (U"\\bu A single number sign introduces a word in bold: $$\\# pot$ gives #pot.")
  142. LIST_ITEM (U"\\bu A single dollar sign introduces a word in monospace: $$\\$ pot$ gives $pot.")
  143. LIST_ITEM (U"\\bu A single underscore is rendered as an underscore: $$a_b$ gives a_b.")
  144. NORMAL (U"To create a single italic, bold, or subscripted letter, "
  145. "you revert to the usual technique for stretches of italic, bold, or subscripted text. "
  146. "So, to get %F__1_, you type $$\\% F_\\_ 1_.")
  147. ENTRY (U"Sound links")
  148. NORMAL (U"Your text may contain links to sound files. They are drawn in blue. "
  149. "The format is:")
  150. CODE (U"<normal> \"You should know that \\@ \\@ \\bsFIct.aifc|\\bsct\\@ is more open than "
  151. "\\@ \\@ \\bsFIo.aifc|o\\@ .\"")
  152. NORMAL (U"On your screen, you will see an #\\ct and an #o symbol, both drawn in blue. "
  153. "If you click on one of these sound links, one of the sound files ##ct.aifc# "
  154. "or ##o.aifc# will be played.")
  155. NORMAL (U"The format of the sound link \"$$\\@ \\@ \\bsFIo.aifc|o\\@ $\" is to be understood "
  156. "as follows. The pipe symbol separates the link information (\\bsFIo.aifc) from the viewable "
  157. "link text (o). The link information is introduced with a symbol (\\bsFI) that "
  158. "tells the manual system that a sound file name follows. The manual system reads "
  159. "this file, sees that it contains a sound, and plays that sound.")
  160. NORMAL (U"You can use relative path names, e.g., \\bsFIsounds/o.aifc refers to the file "
  161. "##o.aifc# in the subdirectory #sounds, which must be contained in the same directory "
  162. "as the ##.man# files. To make sure that your manual pages run on all platforms "
  163. "(Windows, Macintosh, Unix), you will want to use the forward slash (/) to separate "
  164. "the directory name(s) from the file name, as in this example "
  165. "(i.e. you avoid the backslash (\\bs) that is usual on Windows computers).")
  166. ENTRY (U"Pictures as embedded scripts")
  167. NORMAL (U"Your text may contain Praat scripts. They typically draw a picture in your manual page, "
  168. "with the font and font size of the manual until you specify otherwise in the script. The format is:")
  169. CODE (U"<script> 4.5 4 \"")
  170. CODE1 (U"Draw inner box")
  171. CODE1 (U"Axes: 0, 100, 0, 100")
  172. CODE1 (U"Text: 50, \"Centre\", 50, \"Half\", \"Hello!!\"")
  173. CODE (U"\\\"r")
  174. NORMAL (U"The two numbers after ##<script># are the width and the height of the picture "
  175. "(the \"outer viewport\") in inches, if the font size of the manual is 12. "
  176. "If the font size is larger, the viewport will be scaled up accordingly.")
  177. NORMAL (U"Please note that the script is enclosed within double quotes. "
  178. "Therefore, you will have to double any double quotes that occur in the script.")
  179. NORMAL (U"If needed, a script like this can create objects in the object list of the manual. "
  180. "However, you have to make sure that you remove them after use:")
  181. CODE (U"<script> 6 3 \"")
  182. CODE1 (U"Create Sound from formula: \"sineWithNoise\", 1, 0.0, 1.0, 44100, ~1/2*sin(2*pi*377*x)+randomGauss(0,0.1)")
  183. CODE1 (U"To Spectrogram: 0.005, 5000, 0.002, 20, \"Gaussian\"")
  184. CODE1 (U"Paint: 0, 0, 0, 0, 100.0, \"yes\", 50.0, 6.0, 0.0, \"yes\"")
  185. CODE1 (U"plusObject: \"Sound sineWithNoise\"")
  186. CODE1 (U"Remove")
  187. CODE (U"\\\"r")
  188. NORMAL (U"Note that unlike the previous script, this script does not set the font and font size. "
  189. "This means that the drawing will use the font and font size of the manual page, "
  190. "which is usually what you want.")
  191. NORMAL (U"For obvious safety reasons, embedded scripts cannot contain commands that change the contents of any disk "
  192. "or send messages. Thus, commands like ##Save as WAV file...#, ##filedelete out.txt#, ##string\\$ >> out.txt#, "
  193. "#system, or #sendpraat are forbidden. Several other commands, such as #pause and #editor, "
  194. "are irrelevant inside pictures and are therefore forbidden as well. "
  195. "Note that commands like #echo, ##Read from file...#, and #execute are still available "
  196. "(with the last two, you can use relative paths; "
  197. "with #execute, you can only run scripts that do not contain any of the forbidden commands).")
  198. NORMAL (U"The commands ##Set outer viewport...# and ##Set inner viewport...# are available; "
  199. "they count in inches (if the font size of the manual is 12). The (0, 0) point is in the upper left corner, "
  200. "as in the Picture window, so that you can test your picture with a normal Praat script; "
  201. "for instance, the following script draws a cross in the upper half of the picture and a rectangle in the lower half:")
  202. CODE (U"<script> 4.5 4 \"")
  203. CODE1 (U"Axes: 0, 100, 0, 100")
  204. CODE1 (U"Select inner viewport: 0, 4.5, 0, 2")
  205. CODE1 (U"Draw line: 0, 0, 100, 100")
  206. CODE1 (U"Draw line: 0, 100, 100, 0")
  207. CODE1 (U"Select inner viewport: 0, 4.5, 2, 4")
  208. CODE1 (U"Draw rectangle: 0, 100, 0, 100")
  209. CODE (U"\\\"r")
  210. SCRIPT (4.5, 4, U""
  211. "Axes: 0, 100, 0, 100\n"
  212. "Select inner viewport: 0, 4.5, 0, 2\n"
  213. "Draw line: 0, 0, 100, 100\n"
  214. "Draw line: 0, 100, 100, 0\n"
  215. "Select inner viewport: 0, 4.5, 2, 4\n"
  216. "Draw rectangle: 0, 100, 0, 100\n"
  217. )
  218. ENTRY (U"Script links")
  219. NORMAL (U"Your text may contain links to Praat scripts. They are drawn in blue. "
  220. "The format is:")
  221. CODE (U"<normal> \"Here is a script that \\@ \\@ \\bsSCdraw.praat|draws\\@ what you have selected.\"")
  222. NORMAL (U"On your screen, you will see the word #draws, drawn in blue. "
  223. "If you click on it, the script ##draw.praat# will be executed. The string \"$$\\bsSC$\" indicates "
  224. "that a script file name follows. As with sounds, you can use relative file paths. The script can take "
  225. "arguments:")
  226. CODE (U"<normal> \"This script \\@ \\@ \\bsSCload2files.praat hello.wav hello.TextGrid|loads\\@ some files.\"")
  227. NORMAL (U"If the script file name or any arguments except the last contain spaces, they have to be enclosed "
  228. "within double quotes, which have to be doubled again in the ManPage code:")
  229. CODE (U"<normal> \"Here is a script that \\@ \\@ \\bsSC\\\" \\\" my scripts/draw.praat\\\" \\\" |draws\\@ what you have selected.\"")
  230. CODE (U"<normal> \"This script \\@ \\@ \\bsSC\\\" \\\" my scripts/load2files.praat\\\" \\\" \\\" \\\" my sounds/hello.wav\\\" \\\" my textgrids/hello.TextGrid|loads\\@ some files.\"")
  231. NORMAL (U"For safety reasons, the user will see a warning about "
  232. "\"trusting the author of the manual pages\" if you include script links in your manual.")
  233. ENTRY (U"How to separate link information and link text")
  234. NORMAL (U"The separation between link information and viewable link text, as seen "
  235. "in the above description of sound and script links, is actually a general mechanism "
  236. "in the hypertext system. For instance, if you want to see the text \"x\" "
  237. "in blue on your screen, and create a link from it to the page \"Dorsal fricatives\", "
  238. "you specify the link as $$\\@ \\@ Dorsal fricatives|x\\@ $.")
  239. ENTRY (U"Sound buttons")
  240. NORMAL (U"If the %%recording time% in the second line is not 0, "
  241. "three buttons will appear near the top of the page:")
  242. NORMAL (U"1. The #Record button allows you to record a sound from the microphone.")
  243. NORMAL (U"2. The #Play button allows you to play this recorded sound. "
  244. "In this way, you can compare your own utterances with the sounds "
  245. "behind the sound links, for example.")
  246. NORMAL (U"3. The ##Copy last played to list# button copies the latest sound to the list of objects, "
  247. "allowing you to perform analyses on it, save it to disk, et cetera. "
  248. "The latest sound may be a sound that you recorded with the #Record button, "
  249. "a sound that you played with the #Play button, "
  250. "or a sound that you played by clicking on a sound link, "
  251. "whichever occurred most recently.")
  252. ENTRY (U"And beyond")
  253. NORMAL (U"If you need even more flexibility than ManPages offer you, consider using the @@Demo window@ instead.")
  254. MAN_END
  255. }
  256. /* End of file manual_Manual.cpp */