*** empty log message ***
[anjuta-git-plugin.git] / HACKING
blob91a8030b287f2de3ae0b186f1f01c23c5316aa6b
1 Notes for Developers on contributing to Anjuta:
2 ----------------------------------------------
3 (To be expanded over time. Please post submissions to the Anjuta 
4 Development mailing list or the project maintainer)
6 Getting Started:
7 ---------------
9 First thing to do is to get a build working. Anjuta can be built using jhbuild,
10 which is the recommended way to build GNOME 2.x and Anjuta. It is advisable to
11 use '--enable-warnings --enable-debug' with configure while building anjuta if
12 you want to hack on it. Anjuta can be used to hack on Anjuta, and there is a
13 anjuta.anjuta project file in CVS for this purpose.
15 Once you have got anjuta built and loaded in itself, the most important thing
16 is to decide what to work on (the TODO, as you say). There are many directions
17 you can take. I'm listing some of the more common ones in order of difficulty.
19 0. Use it, test it, report bug, request features, etc. In short, become
20 an active user. That is how most people become anjuta developers.
22 1. Documentation and translation. While this might not be a very
23 attractive option, it has many benefits for newbie developers. You get
24 to know the code and feature set better, and learn the way GNOME
25 projects are developed. Also, you will be helping a lot of people to use
26 Anjuta better. You can use the wiki or update the manuals, DAQ, etc.
27 that are supplied with the source.
29 2. Scratch your itch. This is probably the most attractive option for a
30 reasonably experienced developer. Find something which does not work for
31 you, or some feature that you want but is missing. Then report it on the
32 devel list saying that you'd want to work on it (this is essential to
33 avoid duplication). Then send us patches !
35 3. Fixing bugs and implementing feature requests. You can find our bug
36 and RFE database at http://bugzilla.gnome.org (the module is called anjuta).
37 You can also have a look at the reasonably up-to-date TODO file we maintain
38 in the source code or view it with Task Manager in Anjuta.
40 4. Working on the porting anjuta 1.2 features to anjuta2. This is a noble
41 undertaking but likely to be hard work, and probably not suitable for
42 newbie developers. Note that this is most code and plugins are ported but 
43 they might not yet be as good as in anjuta 1.2.
45 Resources:
46 ----------
47 - Homepage: http://www.anjuta.org/
48 - Project details page: http://sourceforge.net/projects/anjuta/
49 - CVS snapshots: http://www.anjuta.org/cvs/
50 - Anonymous CVS Access: cvs -z3 -d:pserver:anonymous@anoncvs.gnome.org:/cvs/gnome co anjuta
51 - Mailing Lists: http://sourceforge.net/mail/?group_id=14222
52 - Bug database: http://bugzilla.gnome.org (the module is called anjuta)
53 - Feature Requests: See Bug database above
54 - Forums: http://sourceforge.net/forum/?group_id=14222
55 - IRC: irc.gnome.org (Channel: #anjuta and #devel-apps)
57 Tools:
58 -----
59 Anjuta is written using a mixture of C and C++. You will require
60 the standard GNU tool chain and current stable GNOME libraries to 
61 build and work with the Anjuta sources.
62 New code should be in C as long as it does not touch the scintilla
63 editing component. C++ code is only allowed in the editor or if you 
64 need a library which is only availible in C++.
66 Submitting patches:
67 ------------------
68 Patches are good, and patches are always welcome! Small, self-contained 
69 patches are preferred - larger patches which touch on a large number 
70 of areas of the source tree are more complex to apply and test. 
72 Patches may be submitted to the project website, to the mailing lists, 
73 or directly to the project maintainer.
75 The six-step plan to patching happiness is as follows:
76 ------------------------------------------------------
77 1) All patches should be submitted in *unified* form, i.e. created 
78 with the command "diff -u" or "cvs diff -u"). 
80 Make your changes in all files (including the ChangeLog file) and run
81 "cvs diff -u > patch.diff" in the top level anjuta/ directory. This diff
82 file will contain patches for all of the files together.
84 Remember to run the cvs diff for the *top* project directory. It will
85 automatically recurse into the subdirectories and generate the patches.
87 We ask for patches in this format because:
88 - more often then not, patches are out of sync with current CVS. This 
89 can happen because someone is submitting a patch taken against an old 
90 version of Anjuta, or against anonymous CVS (which is usually out of 
91 sync for 24 hours). Therefore, the maintainers have to review patches 
92 manually.
93 - if a patch file is opened in Anjuta (or editors such as Nedit) in 
94 "Diff" mode, *unified* formats are more readable and errors and 
95 mis-syncs are easily detected. Non-unified formats are hard to read.
96 - unified patches are more intelligent in recognizing changed lines
97 (because by default there is a 3-line context buffer).
99 2) Diffs taken against CVS should be preceded by "cvs -z3 up" in 
100 *all* cases.
102 3) If anonymous CVS is used, one way of to matching more closely with 
103 the actual CVS is by running "cvs -z3 up" on all three anonymous CVS 
104 servers (annocvs1.gnome.org, annocvs2.gnome.org and annocvs3.gnome.org). 
105 Run the following command in succession for the three servers:
107 cvs -d:pserver:annocvs[123].gnome.org:/cvs/gnome/anjuta
109 Details about the anonymous CVS servers can be obtained by issuing the 
110 command "host annocvs.gnome.org"
112 (Note: You can of course use the cvs plugin for all this stuff)
114 4) If the patch is big or is not high priority (i.e. things other than 
115 stability patches), then either send it to the lead developers directly 
116 (cc-ing them together is a nice idea), or post it on the sourceforge page. 
117 *Never* post big patches to the mailing lists, since they will annoy 
118 subscribers and are liable to be rejected by the list server. Send
119 a reference email to the list mentioning that you have sent a patch.
121 5) *Always* include a ChangeLog entry as part of the diff to ensure that
122 your entry is also committed directly with your name mentioned.
124 6) Name the patch with a useful filename. e.g. avoid calling your patch
125 patch.diff, anjuta.diff or something like that. It is easier to manage
126 a queue of patches named things like biswa-print-20020605.diff and 
127 bug-544912.diff as the names are more meaningful. Include the bug number
128 or your name and the date in the name of the file. Thanks!
130 Coding style:
131 --------------
133 gchar*
134 function (gchar *arg1, gint arg2)
136         if (x == y)
137         {
139         }
142 - Try to limit the lines to 80 characters.
143 - Please try to write OO-code using GObject (or derived class) as baseclass.
144 This will lead to better design and clear module separation.
145 - If possible gnome-vfs is preferred to standard UNIX IO functions.
146 - Try to avoid forward declaration of static functions, try to keep them in 
147 order instead
148 - Use descriptive variable names like filename instead of f and cur_item instead
149 of i.
150 - If you use a "hack" please add a comment and say why this could not be done
151 cleaner.
153 General source structure:
154 ------------------------
155 When editing the code, adding new classes or methods, etc. please 
156 conform with the style already followed in the source files.
158 If a section of code will require further work, please add helpful
159 comments of the form /* FIXME: ... */, so that an external tool (such as
160 grep) can be used to identify them.
162 Separator in filename:
163 You should always use - instead of _, meaning anjuta-plugin.h
164 insted of anjuta_plugin.h
166 Key elements:
167 * libanjuta/ - Anjuta IDE framework
168 * scintilla/ - the scintilla editing component
169 * launcher/ - launcher wrapper used by the debugger
170 * tagmanager/ - the tagmanager library
171 * libegg/ - extra widgets
172 * plugins/ - plugin components (see the sample for more information)
173 * src/ - the main Anjuta IDE sources
174 * data/ - System data.
175 * mime/ - Mime related files.
176 * global-tags/ - System tags.
177 * manuals/ - All sorts of sgml documents (API and user).
179 Scintilla:
180 ---------
181 The editing component in Anjuta is Scintilla (www.scintilla.org). 
182 The Scintilla sources are imported to the scintilla/ directory in the
183 Anjuta source tree - some reorganization is required:
185 <pre>
186 Scintilla               Anjuta
187 ---------               ------
188 src/            ->      scintilla/
189 gtk/            ->      scintilla/
190 include/        ->      scintilla/include
191 </pre>
193 These are used to compile libscintilla.a, the library which provides
194 the bulk of Anjuta's editing functions.
196 The interface into Scintilla is in src/aneditor-*.cxx. This is based on
197 SciTE and a lot of care needs to be taken when merging code, since it
198 combines several different files from the SciTE source tree and is
199 quite flexible in the ways that they are used. Also, note that lexer
200 objects from Scintilla must be referenced in src/Makefile.am in order 
201 to get linked into Anjuta.
203 Messages and translations:
204 -------------------------
205 There are a few rules we ask contributors to follow when adding new
206 message strings and labels to Anjuta.
208 1. BE CONSISTENT!! 
209 - refer to the standard GNOME Word List in the GNOME Style Guide 
210 (http://developer.gnome.org/documents/style-guide/) when referencing 
211 different user interface features, and then use the same terminology 
212 throughout. Try to ensure that your use of words matches the rest of
213 the code.
214 - make sure that mixed case is only used where it makes sense to do so.
216 Example: "Unable to Start Plug in Module %s".
217 This message is not ideal since the standard terminology is "plugin" (so 
218 please do not use "Plug in", "plug-in", etc.). Also, in this case there 
219 is no reason for the words "start" and "module" to start with an uppercase 
220 letter.
222 There are a few standard terms we use - in particular:
223 - plugin
224 - Project (always with an uppercase P)
226 2. Do not use contractions (don't, can't, etc.). These can make a message 
227 difficult to translate.
229 3. Do not use colloquial expressions. They may seem cool or amusing, but 
230 actually they can be hard to translate into all languages. Also, although as 
231 developers it is OK to have fun, messages with certain language in them can be 
232 intimidating for new or inexperienced users, and are not very professional.
234 Example: "You FOOL! I can not attach to myself." 
235 This message was originally used in the debugger code, and was removed some 
236 time ago. It is quite fun, but a new user might be put off. 
238 4. Do not use the first person "I" for referring to Anjuta in messages 
239 (again, the previous message is an example of this). This is bad practice in 
240 technical writing. If you need to refer to Anjuta itself, please use the word
241 "Anjuta"! :-)
243 Documentation:
244 -------------
245 The documentation is stored in the manuals/ directory, and consists 
246 of a set of SGML sources conforming to the GNOME Documentation Project's
247 Style Guide. Please ensure that all additions also follow these guidelines.
249 Screenshots used in the manual are processed using The Gimp. Single dialogs
250 and menus are converted to RGB and the Script-Fu Drop Shadow effect applied 
251 (with the default settings). All documentation images are in PNG format.
253 Translations of application messages are stored in the standard po/ 
254 directory structure at the top level of the source tree.
256 Graphics:
257 --------
258 PNG format is preferred for application graphics.
260 The image filenames are mapped in the file src/pixmaps.h, with helper functions
261 for manipulating them in src/resources.c. Please use this method for including
262 graphics and do not use the filenames directly.
264 ARCHITECTURE:
265 -------------
267 You can find the API documentation of anjuta in the 
268 "Anjuta Developers Reference Manual" devhelp book!
270 1) Event Driven:
271 ----------------
272 When Anjuta was first designed, the primary goal was to enable the use of 
273 external unix commands in a more productive and intuitive way. Therefore,
274 anjuta follows non-blocking input/output operations aggressively. This means
275 that anjuta UI will not freeze while it performs a lengthy task. All such
276 jobs are event-driven (I am not referring to the gtk-events here) and works
277 on asynchronous basis. The example jobs are compilation, debugging, file search,
278 class updates etc. While asynchronous event-driven implementation is more
279 complex than it's synchronous counter part, it gives a smooth and non frustrative
280 operation. :-)
282 For details how to use the anjuta-launcher consult AnjutaLauncher reference
283 documentation in libanjuta.
285 2) How to add new menu/toolbar items in the Main Menu:
286 ----------------------------------------------
288 Anjuta uses GtkUIManager for creating it's UI. Libanjuta does provide
289 some wrapper functions in anjuta-ui.h. Take a look at the *.ui files in the 
290 plugins, the Plugin docs in the reference and read the GtkUIManager docs for
291 details.
293 4) Dialogs and Windows:
294 -----------------------
296 Dialogs and Windows should be build using libglade. They should be HIG compliant
297 (http://developer.gnome.org/projects/gup/hig/)
299 - All dialogs should be closable by 'ESC'
300 - All dialogs should have default action.
302 5) Property/Config management:
303 ------------------------------
305 Anjuta has a very powerful preferece management. You can read the docs of
306 AnjutaPreferences in the reference.
308 7) How to add a new project type:
309 ---------------------------------
311 FIXME: For no take a look at the project types in 
312 plugins/project-wizard/templates
314 8) How to correctly credit people:
315 ----------------------------------
317 New contributors must always be credited in AUTHORS file
319 You should also ensure that you submit headed ChangeLog entries with a 
320 name and e-mail address when you submit a patch.