1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/html4/loose.dtd">
5 <title>readme-developers.html</title>
6 <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
7 <style type="text/css">
10 font-family: Verdana,Helvetica,Arial,sans-serif;
14 font-family: "Courier New",Courier,monospace;
19 border-left: 4px solid #FFCC00;
20 border-bottom: 1px solid #FFCC00;
24 border-left: 8px solid #FF9933;
25 border-bottom: 1px solid #FF9933;
34 background-color: #EEEEEE;
35 border-left: 10px solid #CCCCCC;
39 background-color: #DDDDFF;
40 border: 1px solid #6666FF;
44 border-bottom: 1px dotted black;
50 <h2>readme-developers.html</h2>
52 <h3>Table of Contents</h3>
54 <li><a href="#Code_changes">Code changes</a></li>
55 <li><a href="#Minor_code_changes_and_bug_fixes">Minor code changes and bug fixes</a></li>
56 <li><a href="#Coding_conventions">Coding conventions</a></li>
57 <li><a href="#Doxygen_comments">Doxygen comments</a></li>
58 <li><a href="#Revision_Ids">Revision Ids</a></li>
59 <li><a href="#File_release_numbers">File release numbers</a></li>
60 <li><a href="#Packaging_file_releases">Packaging file releases</a></li>
61 <li><a href="#Tagging_SVN_when_releasing_files">Tagging Subversion when releasing files</a></li>
62 <li><a href="#Localization">Localization</a></li>
63 <li><a href="#Logging">Logging</a></li>
64 <li><a href="#ShellExt">Shell Extension</a></li>
68 <h3><a name="Code_changes">Code changes</a></h3>
70 <p>Please follow these guidelines when submitting changes to WinMerge sources
73 <p class="note">Do not waste yours and our time by submitting large feature
74 patches before you have made sure the feature is a desired addition to WinMerge. Communicate with
76 either in bug/feature request(rfe) items or preferably in the Developers-forum or Developers-
80 <li><p>Post development intentions:</p>
83 If you are fixing a bug, put a note in the SourceForge bug report that you're
84 fixing it. If there is no SourceForge bug report, create one.
87 If you are implementing a new feature, put a note in the SourceForge Feature
88 Request item that you're implementing it. If there is no SourceForge Feature
89 Request item, create one. Alternatively you can discuss new features
90 in the Developers-forum or Developers-mailing list. Please use this! It is a lot
91 less work wasted when we agree about design first.
96 <p>Before you start developing, make sure to capture
97 a snapshot of your starting sources (presumably a pristine copy of sources from
98 subversion, or of a source zip from a distribution).</p>
100 <p><b>DO NOT</b> submit a patch against a year-old version. The latest experimental/beta version
101 is at most a few weeks old. Stable releases should only get bug fixes. And even then
103 is usually first applied to development versions. So there should be no reason to submit
104 a patch against an old version.</p>
107 <p>Review the sections on <a href="#Coding_conventions">Coding conventions</a>
108 and <a href="#Doxygen_comments">Doxygen comments</a></p>
110 <li><p>Develop your new version.</p></li>
112 <p>Post your changes as a patch, to the SourceForge patch list. Try to give an
113 informative patch title of course. Post to any relevant SourceForge bugs
114 or RFEs, giving the patch number and title.</p>
115 <p>If the bug/rfe item is already assigned to you (or you submitted it), you can
116 also attach patch into that item. Remember to add a comment so others notice the
118 <p>The active developers have often been posting entire original and modified
119 files rather than traditional diffs, because obviously all developers
120 have access to WinMerge to compare original and modified files, and this
121 may be viewed as an infinite line context diff :)</p>
122 <p><b>HINT:</b> If you have archive support installed in WinMerge you can do a folder
123 compare of your original and changed source trees. And then select <code>Zip - Differences</code>
124 from context menu and WinMerge creates a zip-file for you. Ready to be posted!</p>
127 <p>Wait for reactions from other developers (and sometimes active users).<br>
128 Usually this means one of the active developers approves your patch before
132 <p>After a reasonable amount of time has passed, and one of active developers
133 has approved the patch, apply the patch to Subversion. (Or ask a
134 project member to do so, if you don't have developer access to
136 <p>What is a reasonable amount of time? That is somewhat subjective, and
137 we need to rely on your expertise as the patch developer, but let us
138 suggest waiting a few days for minor patches, and at least a week for
142 <p>Add a note in <code>Src/Changes.txt</code> telling what files you committed,
143 and what bug/RFE/patch you solved. This is very important so everybody else
144 has a chance to figure out who did what and when.</p>
148 <p>Note that <code>Src/Changes.txt</code> was split from <code>Src/readme.txt</code> after
149 2.4.0 release. So <code>Src/readme.txt</code> contains older changelog entries. Also, many
150 subfolders have their own <code>Changes.txt</code> -file. If the file exists in the folder, it must be
151 used instead of "global" <code>Src/Changes.txt</code>.
153 <h3><a name="Minor_code_changes_and_bug_fixes">Minor code changes and bug fixes</a></h3>
155 <p>It is reasonable to post small snippets of code showing small changes
156 directly in the text in bug postings, or patch postings. For example, see
157 <a href="http://sourceforge.net/tracker/?group_id=13216&atid=313216&func=detail&aid=824987">PATCH [ 824987 ] "Change binary-file detection (look only for zeros)"</a>,
158 which gives the change directly in the text.</p>
160 <p>Note, however, that sourceforge trackers currently ignore tabs, so if you
161 can convert tabs to spaces in your posting, it helps greatly.</p>
163 <p>Bugfixes may be treated less formally, especially for simple ones, or for
164 fixes to code you know well -- eg, you caused the bug yourself with a
167 <p>Consider still posting something to the tracker lists, even if it is
168 simply a summary in English. If the fix is something like
169 "misspelled variable name foo as fooz in many places", it is quite
170 understandable that you prefer to just fix the instances rather than
171 doing a full patch for it.</p>
173 <h3><a name="Coding_conventions">Coding conventions</a></h3>
175 <p>Please conform to the prevalent coding conventions. There are quite a number of
176 files which originated elsewhere, and have their own coding conventions; please
177 conform to the local one, in whichever files you are at work.</p>
181 <p>WinMerge itself uses Microsoft MFC style coding.</p>
183 <li>Code indents are purely tabs.</li>
185 Curly braces are on their own line, indented at the level of the outer code, and
186 code inside the braces is indented one further level.
188 <li>Class member variables are usually prefixed with <code>m_</code>.</li>
192 <p>Crystal Text Editor (<code>WinMerge/editlib/*</code>) and diffutils code (<code>io.c</code>,
193 <code>normal.c</code>, <code>util.c</code>) use traditional Unix style coding.
194 <code>analyze.c</code> should be in this format, but we have made a mess of it :(</p>
196 <li>Code indents are spaces, with tabs used to abbreviate eight consecutive spaces.</li>
198 Curly braces are on their own line, indented two spaces, and then the code inside
199 the curly braces is indented an additional two spaces.
205 <h3><a name="Doxygen_comments">Doxygen comments</a></h3>
207 <p>We have adopted <a href="http://www.doxygen.org">doxygen</a> style as our desired
208 commenting style for functions, classes, files, and so forth, in WinMerge code
209 (this applies only to native WinMerge code, not imported files).</p>
212 <li>We're using JavaDoc style comments.</li>
214 It is probably easiest to simply imitate existing examples. The functions in
215 <code>DiffThread.cpp</code> are fully doxygen commented (<em>TODO: it would be better to give a
216 class example, if anyone knows a fully doxygen commented class</em>).
218 <li>There is ready to use doxygen config file in <code>docs/developers/doxygen.cfg</code></li>
221 <h3><a name="Revision_Ids">Revision IDs</a></h3>
223 <p>We have adopted the convention of using Revision ID lines near the top of our source
224 files (following the doxygen file header comments). Merely add these two lines
225 to any new file you add to the repository, and SVN will modify the Id line by
226 appending revision and date information at checkout:</p>
229 // Revision ID line follows -- this is updated by SVN
233 <h3><a name="File_release_numbers">File release numbers</a></h3>
235 <p>We are trying to keep a consistent numbering scheme on our file releases,
236 so everybody can figure out what we have released by just looking at the
237 release number. Unfortunately the original 4-number version numbering didn't
238 work as well as we thought and caused a lot of confusion. So WinMerge 2.13.x
239 and later use new 3-number version numbers:</p>
246 | | `--------- Denotes a beta release, an experimental release
247 | | or a minor bug fix of a major release.
248 | | For experimental and stable releases this number increases by
249 | | one. For beta releases we may increase few numbers more.
250 | `----------- Denotes a major release.
251 | even numbers means "stable".
252 | odd numbers means "unstable".
253 `------------- Denotes a major release with major changes.
258 <li>The next experimental release will have the number 2.15.1 (and then
259 2.15.2 and then 2.15.3 and so on)</li>
260 <li>The next beta release will likely have the number 2.15.10 or 2.15.20</li>
261 <li>The next major release will have the number 2.16.0</li>
264 <p>And if we decide to rewrite most of the code, the next major release will
265 have the number 3.0.0. This is something big like cross-platform support, 3-way
268 <p>WinMerge 2.12.x and earlier releases used a four-number version numbers:
273 | | | `------- This number increases for each experimental,
274 | | | and it is reset after each beta or major release.
275 | | `--------- Denotes a beta release, an experimental release
276 | | or a minor bug fix of a major release.
277 | | even numbers means "stable" (i.e. a beta).
278 | | odd numbers means "unstable" (i.e. an experimental).
279 | `----------- Denotes a major release.
280 | even numbers means "stable".
281 | odd numbers means "unstable".
282 `------------- Denotes a major release with major changes.
285 <h3><a name="Packaging_file_releases">Packaging file releases</a></h3>
287 <p>On SourceForge there is some space to enter Release Notes and Change Notes.
288 For experimental releases make sure to put in a note telling people that this is indeed experimental,
289 so they should not expect everything to work perfectly.
290 For beta builds we paste in all the changes since the last beta release, so that people can see exactly what changed.
291 For major releases, we paste in the list of changes since the last major release, and this list can become very long.</p>
293 <p>We are using <a href="http://www.jrsoftware.org/isinfo.php">InnoSetup</a> to make
294 the installer for WinMerge.
295 See <a href="readme-developers-InnoSetup.html">readme-developers-InnoSetup.html</a> for more information.
296 Also zip-packages for releases are provided, zip up these files:</p>
299 <li><code>WinMerge.exe</code> and <code>WinMergeU.exe</code></li>
300 <li><code>ShellExtension.dll</code>, <code>ShellExtensionU.dll</code>, <code>register.bat</code>
301 and <code>unregister.bat</code> to register/unregister it.</li>
302 <li>All filters from the <code>filters/</code> directory (remember template file!)</li>
303 <li>All plugins from the <code>plugins/dlls/</code> directory. Create a <code>MergePlugins/</code> directory and copy the plugins to it</li>
304 <li>All <code>*.lang</code> files (currently we have 21 languages, counting both Chinese versions)</li>
307 <p>Please remember to put the version number into both executables. You may use
308 any of the following three methods at least.</p>
311 You may run Src/SetResourceVersions.bat, which will prompt for the new
312 version number, and set it both in Merge.rc and in all the translated rc files.
315 <a href="http://www.elphin.com/products/stampver.html">StampVer</a> to stamp
316 the version number into the executables after they are compiled.
318 You may also use the old-fashioned process
319 of simply copying all the sources, changing the <code>Merge.rc</code> in the copy using
320 the MSVC6 resource editor, and compiling that (many releases have been made in this
321 manual, low-tech fashion).
324 <p>Whatever method you use, please double-check the
325 executable version numbers before uploading and releasing them.</p>
328 Since WinMerge 2.4 we have translations for Shell Extension and must also version it
329 carefully. If we don't update version number, installer won't install updated version.
330 There are no scripts or other tools to update version number, it must be done by hand
331 to <code>ShellExtension.rc</code> file (make sure you update all four numbers!). Version numbers
337 | | | `------- Not used - 0 (or your own build version?)
338 | | `--------- Translation updates or other minor changes increase this by one
339 | `----------- New features, bug fixes and other changes affecting to behavior
340 | increase this number by one
341 `------------- Denotes a major release with major changes.
344 <li>Make sure that version number is updated every time you do a new release!</li>
345 <li>If there are only small changes not affecting behaviour or translation updates<br>
346 - increase 3rd number by one</li>
347 <li>If there's been new features, bug fixes or other non-minor changes<br>
348 - increase 2nd number by one</li>
351 <p>Filenames in file releases follow this standard:</p>
353 <li><code>WinMerge-2.1.6.0-exe.zip</code></li>
354 <li><code>WinMerge-2.1.6.0-src.zip</code></li>
355 <li><code>WinMerge-2.1.6.0-Setup.exe</code></li>
358 <p>That is, dots are used only inside the version number and before the final extension.</p>
360 <h3><a name="Tagging_SVN_when_releasing_files">Tagging Subversion when releasing files</a></h3>
362 <p>When we make a release we always put a note in <code>Src/Changes.txt</code> in SVN.</p>
364 <p>It is recommended to create a tag to the repository when making a stable- or beta- releases.
365 Although with subversion we have kind of tags for every commit (revision numbers) it is still a lot
366 easier to handle and remember them with human-readable names (R2_6_0) than with revision numbers
367 (revision 3637 (not a real revision number!)). Experimental or other testing releases don't need
368 tags since they are not intended for wide use and are usually just one-time snapshots.</p>
370 <p>The tag should follow the same numbering scheme as used above, with the dots replaced by underscores
371 and prefixed with an <code>R</code>, so the example experimental above would have a tag named <code>R2_1_3_0</code>,
372 the next beta would be named <code>R2_1_4</code>, and the next major release would be named <code>R2_2</code>.</p>
374 <h3><a name="Localization">Localization</a></h3>
376 <p><code>WinMerge.exe</code> and <code>WinMergeU.exe</code> are always compiled with the english resources.
377 Custom languages are in per-language PO files in <code>Languages</code> subfolder of WinMerge folder.
378 Language may be changed dynamically through the menu.</p>
380 <p>WinMerge localization is achieved by loading translated strings from per-language PO files. There is only one rc
381 file in the project <code>Merge.rc</code>, which is used to generate POT (PO template) file. Per-language PO files
382 are updated (after <code>Merge.rc</code> changes) from generated POT file. All PO files are in same
383 <code>Languages</code> subfolder.
385 <p>Unlike with 2.6.x versions of WinMerge, there is no anymore need to compile language files. The same PO files
386 are used for translation and in runtime to load translated strings. This helps translating WinMerge a lot.
388 <p>If you have done changes to the <code>Merge.rc</code> file you must call <code>UpdateTranslations.bat</code>
389 to create the latest version from the file <code>English.pot</code> and update the language PO files from this PO template.
390 And for strings, who should not appear in the PO files just add a line in the <code>Languages/StringBlacklist.txt</code> file.</p>
392 <p class="note">Besides the resources files you could also translate things like the
393 <a href="http://svn.sourceforge.net/viewvc/winmerge/trunk/WinMerge/InnoSetup/Languages/">installer</a>
394 (the ISL files are just INI files) and the <a href="http://svn.sourceforge.net/viewvc/winmerge/trunk/WinMerge/Docs/Users/Languages/">readme files</a>.</p>
396 <h4>Tips for developers :</h4>
398 <li><p>The code must use resource strings for all messages, or displayed text (column title ...).</p></li>
400 <p><strong>Strings ID</strong>: when applying a patch, you may define new strings (with as ID the first free ID).
401 But probably you wrote your patch from an old version, and someone may have already inserted a patch for this ID.
402 You need to adapt the ID in resource.h to avoid overlapping ID.</p>
405 <p><strong>Strings order</strong>: that is really annoying with MSVC. It is important to keep the order of strings unchanged,
406 because merging rc files with WinMerge is then a lot easier. Strings are grouped in block according to their ID masked by <code>0xFFF0</code>.
407 So there are at most 16 strings in a block, but maybe less. MSVC reorders strings between and inside blocks, but never reorders blocks
408 (when a new blocks is created, MSVC always put it at the last position).</p>
409 <p>Typical method to merge strings in a <code>Merge.rc</code> from a patch with a <code>Merge.rc</code> in SVN :</p>
411 <li>Add your new strings with WinMerge : <code>resource.h</code> for ID, and <code>Merge.rc</code>.</li>
412 <li>If no overlapping ID, you are finished.</li>
413 <li>Update your ID in <code>resource.h</code>.</li>
415 Open your resource file in MSVC. Force compilation (I just change a string twice, add a space, delete this space,
416 then save). So MSVC classes new strings in blocks (possibly creating new blocks) according to the ID updated in 3.
419 <p><b>Note:</b> Blocks are not really ordered (there order comes from history), it is not a problem as MSVC never reorders
420 blocks after creation. If you use another tool to change resources, please make sure that the blocks order is unchanged.</p>
424 <h3><a name="Logging">Logging</a></h3>
426 <p>Logs are a good tool for tracing errors. But logs must be first written. Its always
427 a good habit to write error message to logfile also.</p>
429 <h4>Writing to log:</h4>
430 <p>Simplest way to write errormessage to log is using
431 <code>void LogErrorString(LPCTSTR sz)</code> defined in <code>stdafx.h</code>. Another
432 way is to directly use <code>gLog</code> which is global instance of
433 <code>CLogFile</code>. Log is written to users temporary directory (<code>$temp</code>) with name
434 <code>WinMerge.log</code>.</p>
436 <h4>Enabling/disabling log writing</h4>
437 <p>Log writing is controlled by registry value:</p>
438 <pre>HKEY_CURRENT_USER\Software\Thingamahoochie\WinMerge\Settings\Logging</pre>
440 <p>Possible values are:</p>
442 <li>0 - no logging</li>
443 <li>1 - all logging enabled</li>
444 <li>2 - only errormessages and warnings written to log</li>
447 <h3><a name="ShellExt">Shell Extension</a></h3>
449 <p>WinMerge sets executable path (<code>WinMerge.exe</code>) which shellextension starts every
450 time when options-dialog is closed. This can cause problems when testing
451 several versions of WinMerge. There is registry value to overwrite path to
452 WinMerge executable:</p>
454 <pre>HKEY_CURRENT_USER\Software\Thingamahoochie\WinMerge\PriExecutable</pre>
456 <p>It does not exist by default, so create <code>PriExecutable</code> as string value and type
457 path of <code>WinMerge.exe</code> you mainly use as its value. If this value exists
458 ShellExtension does not care about another path value.</p>