]>
Commit | Line | Data |
---|---|---|
12646a5a JS |
1 | Adding wxWindows class documentation |
2 | ==================================== | |
3 | ||
4 | This note is aimed at people wishing to add documentation for a | |
5 | class to either the main wxWindows manual, or to their own | |
6 | manual. | |
7 | ||
8 | wxWindows uses Tex2RTF to process Latex-like input files (.tex) | |
9 | and output in HTML, WinHelp RTF and Word RTF. Tex2RTF is provided | |
10 | in the wxWindows distribution and in the CVS archive, under | |
11 | utils/tex2rtf. Please start by perusing the Tex2RTF manual. | |
12 | ||
13 | If adding to the existing manual in docs/latex/wx, you need to | |
14 | create a new .tex file, e.g. myclass.tex, and add it to the | |
15 | list of classes in classes.tex (in strict alphabetical order). | |
16 | You may also want to write a separate topic file, e.g. tmyclass.tex, | |
b74d0665 GT |
17 | and add the entry to topics.tex. Also, if applicable, and an entry |
18 | to category.tex. | |
12646a5a JS |
19 | |
20 | If compiling a separate manual, copy an existing set of files from the | |
21 | wxWindows manual or a contribution. Contribution documentation | |
22 | normally goes in the contrib/docs hierarchy, with the source | |
23 | going in a latex/mycontrib subdirectory. | |
24 | ||
25 | You can generate a first pass at the myclass.tex file by | |
26 | compiling and running HelpGen (utils/helpgen). | |
27 | ||
28 | Running Tex2RTF | |
29 | =============== | |
30 | ||
31 | See the Tex2RTF documentation, but here are some forms: | |
32 | ||
33 | For HTML: | |
34 | ||
35 | tex2rtf manual.tex manual.htm -html -twice | |
36 | ||
37 | Use of -twice allows Tex2RTF to resolve references. Note that | |
38 | if both filenames are given (first two parameters on the command | |
39 | line) then Tex2RTF will run in non-interactive mode. | |
40 | ||
41 | For WinHelp RTF: | |
42 | ||
43 | tex2rtf manual.tex manual.rtf -winhelp -twice | |
44 | ||
45 | For Word RTF: | |
46 | ||
47 | tex2rtf manual.tex manual.rtf -rtf -twice | |
48 | ||
3ca6a5f0 BP |
49 | If you wish to have a GUI display show the status of what is happening |
50 | as the conversion is happening, use the '-interactive' command line | |
51 | parameter, and then choose FILE|GO from the menu. For example: | |
52 | ||
53 | tex2rtf manual.tex manual.rtf -rtf -twice -interactive | |
54 | ||
55 | NOTE: You must be using the latest tex2rtf which was released with | |
b74d0665 | 56 | v2.2.0 of wxWindows to use the -interactive switch |
3ca6a5f0 | 57 | |
12646a5a JS |
58 | If you wish to generate documentation for wxHTML Help Viewer |
59 | (or Windows HTML Help), set htmlWorkshopFiles to true in your | |
60 | tex2rtf.ini file. See also the wxHTML Notes section in the | |
23d38b36 VS |
61 | wxWindows manual. To futher speed-up HTML help books loading |
62 | in your application, you may use hhp2cached (utils/hhp2cached). | |
12646a5a JS |
63 | |
64 | src/msw/makefile.vc contains targets for generating various | |
65 | formats of documentation. You may like to do something similar if | |
66 | writing your own manual. | |
67 | ||
68 | Important Dos and Don'ts | |
69 | ======================== | |
70 | ||
71 | DO: | |
72 | ||
73 | - put a space (or \rtfsp) at the end of a line or start of a line where | |
74 | a command ends or starts the line. Otherwise, spaces will be | |
75 | omitted in Word or WinHelp RTF. For example: | |
76 | ||
77 | See \helpref{wxBitmap::wxBitmap}{wxbitmapconstr}\rtfsp | |
78 | for a list of possible values. | |
79 | ||
80 | - leave a blank line at the end of the class file. This is | |
81 | important, or the Word RTF table of contents will be messed up. | |
82 | ||
83 | - leave a blank line between a heading and the next paragraph. | |
84 | ||
85 | - test your changes, preferably converting the manual to WinHelp | |
86 | format and running through the Windows help compiler to check | |
87 | for missing labels, etc. | |
88 | ||
b74d0665 GT |
89 | - quote all '_' characters with a '\' character (e.g. "MY\_PROGRAM" |
90 | unless the '_' is inside a comment or a \begin{verbatim} ... | |
91 | \end{verbatim} block | |
92 | ||
93 | - check that your changes/additions to any TEX documentation | |
94 | compiles before checking it in! Use the '-checkcurleybrace' | |
95 | and '-checksyntax' commandline parameters (or the OPTIONS menu | |
96 | if running in GUI mode) to check for some of the more common | |
97 | mistakes. See TROUBLESHOOTING below for more details | |
98 | ||
99 | ||
12646a5a JS |
100 | DON'T: |
101 | ||
102 | - use jargon, such as 'gonna', or omit the definite article. | |
103 | The manual is intended to be a fluent, English document and | |
104 | not a collection of rough notes. | |
105 | ||
106 | - use non-alphanumeric characters in labels. | |
107 | ||
108 | - use incompatible Latex syntax, such as {\it \bf word} (use a pair | |
109 | of braces for each formatting command). | |
110 | ||
111 | - leave multiple consecutive blank lines, or blank lines between | |
112 | \items in a list. | |
113 | ||
b74d0665 GT |
114 | - use \verb$....$ syntax. Instead use \tt{....} syntax |
115 | ||
116 | - add the following tokens anywhere except on a line by themselves: | |
117 | \begin{verbatim} | |
118 | \begin{toocomplex} | |
119 | \end{verbatim} | |
120 | \end{toocomplex} | |
121 | \verb | |
122 | \begin{comment} | |
123 | \end{comment} | |
124 | \verbatiminput | |
125 | \par | |
126 | \input | |
127 | \helpinput | |
128 | \include | |
129 | ||
130 | ||
12646a5a JS |
131 | Troubleshooting |
132 | =============== | |
133 | ||
134 | Please see the troubleshooting section in the Tex2RTF manual, but | |
135 | here is one important tip: | |
136 | ||
b74d0665 | 137 | If you get a "Macro not found: \end{document}" error, |
12646a5a JS |
138 | this is a spurious side-effect of an earlier error, usually an |
139 | incorrect number of arguments to a command. The location of the | |
140 | true error is then anywhere in the document. | |
141 | ||
142 | To home in on the error, try putting \begin{comment}...\end{comment} | |
143 | around much of the document, and then move the \begin{comment} | |
144 | line down until the error manifests itself again. Note that | |
145 | you can abort Tex2RTF after the syntax error stage by clicking | |
146 | on the close button, so you don't have to wait while the whole | |
147 | document is processed. | |
148 | ||
149 | Before looking at a file in detail, you can comment out the | |
150 | \input{myclass.tex} line in classes.tex using the single | |
151 | line comment character (%) to see whether it was that file that | |
152 | caused the problem. | |
153 | ||
b74d0665 GT |
154 | When making changes/additions to the documentation, always use |
155 | the '-checkcurleybraces' and '-checksyntax' commandline parameters | |
156 | (or turn these options on in the GUI version via the OPTIONS menu | |
157 | choice), BEFORE checking in your changes. These two debugging | |
158 | options will catch many of the more common mistakes that are made | |
159 | while writing documents, plus they will catch some of the uses | |
160 | of TeX that are correct syntax-wise, but that tex2rtf cannot | |
161 | handle properly, and report the problems (usually along with | |
162 | a filename and line number that they occur in!) in the programs | |
163 | output window (GUI mode). | |
164 | ||
12646a5a JS |
165 | Elements in a class file |
166 | ======================== | |
167 | ||
168 | Start off with: | |
169 | ||
170 | \section{\class{wxMyClass}}\label{wxmyclass} | |
171 | ||
172 | (note that labels can only go on sections such as \chapter, | |
173 | \section, \subsection, \membersection, but not on \wxheading, for | |
174 | example.) | |
175 | ||
176 | Describe the class briefly. | |
177 | ||
178 | Then there are several \wxheading sections: | |
179 | ||
180 | \wxheading{Derived from} | |
181 | ||
182 | List the base classes, with line breaks following each one (\\) | |
183 | except the last. | |
184 | ||
185 | \wxheading{Include files} | |
186 | ||
187 | List the relevant include files, for example: | |
188 | ||
189 | <wx/myclass.h> | |
190 | ||
191 | \wxheading{Predefined objects} | |
192 | ||
193 | List any predefined objects, such as: | |
194 | ||
195 | {\bf wxNullMyClass} | |
196 | ||
197 | \wxheading{See also} | |
198 | ||
199 | List any relevant classes or topics, using \helpref. | |
200 | ||
201 | \latexignore{\rtfignore{\wxheading{Members}}} | |
202 | ||
203 | This generates the required heading for the member definitions. | |
204 | Put the constructors first, then in alphabetical order, the other | |
205 | members. | |
206 | ||
207 | Here's an example of documentation for a member function: | |
208 | ||
209 | --------------------:x----------------------- | |
210 | ||
211 | \membersection{wxBitmap::Create}\label{wxbitmapcreate} | |
212 | ||
213 | \func{virtual bool}{Create}{\param{int}{ width}, \param{int}{ height}, | |
214 | \param{int}{ depth = -1}} | |
215 | ||
216 | Creates a fresh bitmap. If the final argument is omitted, the display depth of | |
217 | the screen is used. | |
218 | ||
219 | \func{virtual bool}{Create}{\param{void*}{ data}, \param{int}{ type}, | |
220 | \param{int}{ width}, \param{int}{ height}, \param{int}{ depth = -1}} | |
221 | ||
222 | Creates a bitmap from the given data, which can be of arbitrary type. | |
223 | ||
224 | \wxheading{Parameters} | |
225 | ||
226 | \docparam{width}{The width of the bitmap in pixels.} | |
227 | ||
228 | \docparam{height}{The height of the bitmap in pixels.} | |
229 | ||
230 | \docparam{depth}{The depth of the bitmap in pixels. If this is -1, the screen depth is used.} | |
231 | ||
232 | \docparam{data}{Data whose type depends on the value of {\it type}.} | |
233 | ||
234 | \docparam{type}{A bitmap type identifier - see \helpref{wxBitmap::wxBitmap}{wxbitmapconstr} for a list | |
235 | of possible values.} | |
236 | ||
237 | \wxheading{Return value} | |
238 | ||
239 | TRUE if the call succeeded, FALSE otherwise. | |
240 | ||
241 | \wxheading{Remarks} | |
242 | ||
243 | The first form works on all platforms. The portability of the second form depends on the | |
244 | type of data. | |
245 | ||
246 | \wxheading{See also} | |
247 | ||
248 | \helpref{wxBitmap::wxBitmap}{wxbitmapconstr} | |
249 | ||
250 | --------------------:x----------------------- | |
251 | ||
252 | Note the use of \docparam to document parameters; and the fact | |
253 | that several overloaded forms of the same member function are | |
254 | documented within the same \membersection. | |
255 | ||
408a83cb VZ |
256 | |
257 | Special forms: | |
258 | ||
259 | - for a const member function use \constfunc{} instead of \const | |
260 | ||
261 | - for a function without parameters use \func{...}{Function}{\void} | |
262 | ||
263 | - but do NOT use \void for functions without return value, just "void" | |
264 | ||
265 | - for a virtual/static member function use \func{virtual/static ...} | |
266 | ||
267 | - omit the return type for constructors: \func{}{MyClass}{...} | |
268 | ||
269 | - use \destruct macro for the destructors \func{}{\destruct{MyClass}}{\void} | |
270 |