#162 "Shapes" tool should be extensible

Other (26)
William Kendrick

A teacher just mentioned that they tried to place new images in Tux Paint's data/images/shapes/ folder, expecting new shapes to be available under the "Shapes" tool. I explained that those images are simply used as icons for the shape tool's buttons.

However, there's no reason Tux Paint's shapes need to be hard-coded. (Already, the color palette, brushes, stamps, starters, templates and even Magic tools can be extended.) We should provide a way to describe shapes, perhaps through a text file (like we use for color palettes). Additionally, the shape icons should be render at start-up, and not rely on PNG images for the button labels, since that's an extra step that we shouldn't force the user to go through when adding new shapes.

At the moment, the shapes are defined by arrays in "src/shapes.h". Each is currently defined twice, once for filled, and again for empty. That should be handled automatically. The arrays are:

  • sides (how many sides)
  • locked (aspect ratio locked? e.g., true for circle and square, false for oval and rectangle)
  • filled (should be handled programmatically)
  • init_angle (initial angle)
  • no_rotate (don't provide a rotate step; currently only true for circle)
  • names (button labels)
  • tips (descriptive text, shown next to Tux penguin)
  • img_fnames (for button label icons; should be rendered automatically, and not rely on bitmap images)