Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: AStyle in Visual Studio

...

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 (and working on Linux), you should run this periodically to keep your code congruent with the rest of the source.To do this, first 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"

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.

Image Added 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"

Image Added 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:

...