Formatting rules

To keep the source code looking clean and consistent, we're using the Artistic Style command-line processor. This program will automatically enforce formatting standards whenever it's run. If you're doing a lot of development you should run this periodically to keep your code congruent with the rest of the source.

This will parse the astyle.options file and apply the appropriate formatting changes to the source code. These include:

All of these formatting options are good to keep in mind while you're writing code. But if you forget to implement them, astyle will take care of it.

Linux

Install astyle (sudo apt-get install astyle). Then enter the following from the top-level directory for the GUI:

astyle --options=astyle.options --recursive "./Source/*.cpp" "./Source/*.h"

Windows

An AStyle extension can be installed in the Professional editions of Visual Studio (2010 and higher).

To set up the extension, open Tools -> Options -> AStyle Formatter, and import the astyle_VS.cfg file in the top-level directory for the GUI.

To run the formatter, choose Edit -> Advanced -> Format Document/Format Selection.

General coding style

When it comes to more subjective stylistic considerations, feel free to comment on anything we're doing that's not optimal. Since most of the GUI's developers don't have any formal training in C++, we had to make up a lot of things as we went along. Here are some general rules we try to adhere to:

If you have any suggestions about how to improve our coding style, we'd definitely like to hear them. Much of what constitutes our "style" was picked up from the JUCE example code. So when in doubt, you should default to the standards set for the JUCE Library.

Conventions related to functionality