]> git.street.me.uk Git - andy/viking.git/blame - HACKING
[I8N] Maintain .vik file compatibilty with translated layer names.
[andy/viking.git] / HACKING
CommitLineData
240d1fc8
GB
1This file is meant to summarize the Viking development policies.
2
6c1496fc
RN
3####
4#### Also check information in the Wiki:
5#### http://sourceforge.net/apps/mediawiki/viking/index.php?title=Main_Page
6####
240d1fc8
GB
7
8Clean commits
9=============
10
11Commits/patches should be as fine-grained as possible (and no finer). Every
12distinct change should be in its own commit and every commit should be a
13meaningful change on its own.
14
6c1496fc
RN
15Preferred Code Contribution Methods
16===================================
17
18Since the project uses git for source control, patches that utilize git (especially for patch sets) are preferred in this order:
19* Commits pushed to a publically accessible git host (e.g. GitHub, Gitorious, etc...)
20 - This enables commits to be easily managed such as pulling, merging or cherry-picking
21* Email git diffs to the dev mailing list - use 'git format-patch' method
22* Plain diffs can be emailed to the dev mailing list and/or stored in the SourceForge Patch Tracker for Viking.
23
240d1fc8
GB
24Coding style
25============
26
50a14534
EB
27Naming:
28A "module" is a .c file.
29
30Functions starting with "vik_" operate on an object/structure with the module name (see layer.c for an example).
31Functions starting with "a_" do not, these modules may have static variables.
32Both are followed by the module name. Unless of course the function is static, in which case it may be called anything.
33
34All (well, practically all) global constants and macros start with "VIK_" and then the module name.
35
6c1496fc
RN
36Coding Checks
37=============
38
39Code should compile with the minimum number of warnings (ideally none).
40
41Code should pass static analysis with defaults for 'cppcheck' (http://sourceforge.net/projects/cppcheck/) with no errors.
42
43ATM there is one deliberate error in vikgpslayer.c designed to prevent building if the code encounters a GPSD version we don't handle. Something like:
44[vikgpslayer.c:1479]: (error) Invalid number of character ({) when these macros are defined: 'GPSD_API_MAJOR_VERSION;VIK_CONFIG_REALTIME_GPS_TRACKING'.
45This can be 'hidden' via cppcheck --suppress syntax.
46
240d1fc8
GB
47Technical notices
48=================
50a14534 49
e5c58469
GB
50In order to activate reference documentation, you have to specify the following configure command line:
51$ ./configure --enable-gtk-doc --enable-gtk-doc-html
52
53Then, cd to doc/reference and launch make command.
54
55---
56
50a14534
EB
57The layers panel holds all the layers. Layers connect to the layers panel via what I call "interfaces" which are really just a
58structure of function pointers and pointers to other bits such as icons. viklayer.c switches between the layers like
59polymorhpism. Anything specific to the layer should (in theory) be found solely in that layer's source file.
60
61There are some ugly hacks in here, like the layers panel holding the viewport and each layer holding the viewport and a
62GtkTreeIter. Unfortunately it was the only way I could figure out to do some things. It would be _much_ easier with a
63object-oriented language.
64
65---
66
67"xmpp" and "ympp" are really misnomers, as they only represent the Meters Per Pixel in UTM mode. Otherwise they are an artificial
68zooming system. In expedia mode it represents the "Alti", in Google mode it represents 2^(scale), e.g. 2^0 = 1, 2^8 = 256.
2a035b62
GB
69
70---
71Implementing a MapSource
72
73VikMapSource is the "interface", the really base class of the MapSource tree.
74In order to implement a MapSource, you have to prefer to derive from VikMapSourceDefault, a less abstract class, adding a property based implementation for some aspects of the VikMapSource interface.
75Then, you have to provide implementation for coord_to_mapcoord, mapcoord_to_center_coord and download methods.