find.c: Avoid repeated lookup of layer pointer by number

Rename a few "layer" varaibles to "layer_no", and re-use "layer"
where necessary as a LayerType *, rather than a Cardinal.
find.c: Avoid modifying bounds of the objects we are passing down

Bloat the bounding box into a local BoxType structure instead, to
avoid passing inconsistent objects to lower level functions.
find.c: Remove file-global "IsBad", use PlowsPolygons() return value.

This variable was used to communicate state from the drc_callback(),
however PlowsPolygons() returns the sum of the values returned by
its callback function. As our callback returns 0 on success, 1 on
DRC failure, we know any non-zero return from PlowsPolygons()
implies a DRC problem.
find.c: Fix inverted logic in LookupConnection()

When AndRats is true, we may consider starting with a ratline object,
otherwise we do no. I got this backwards by mistake.
find.c: Avoid adding any rat-lines at all when AndRats is false.

Previously we were adding some rat-lines when searching for physical
connections. We should stop at the physical->rat boundary, not the
opposite end of the ratline.
Add a new flag, "connected" / CONNECTEDFLAG.

The intended use of this flag is to mark physical connections.
Add FoundColor to resource settings, distinct from the Connected color

For now, set ConnectedColour and FoundColor to the same green, so we can
introduce this patch series without flip-flopping the renderered colours.
draw.c: Support for coloring objects with CONNECTEDFLAG set

We now color objects with the FOUNDFLAG set in the FoundColor, not the
ConnectedColor as we did previously. Unsurprisingly, objects with the
CONNECTEDFLAG set get rendered in the ConnectedColor.

CONNECTEDFLAG is tested before FOUNDFLAG, and takes precidence if an
object has both flags set.
Add option to "Select" action, differentiating "FOUND" and "SELECTED" objects

The exising "Select" action included the variant "Select(Connected)", which
selected any object with the "FOUNDFLAG" set.

As we now make a distinction between logical and physical connectivity
(FOUND and SELECTED) respectively, this commit introduces a split into
"Select(Found)" and "Select(Connected)" variants.

There is a change here, in that "Select(Connected)" now acts on objects
with the CONNECTED flag set, (not the FOUND flag as it did previously).
find.c: Use pointers to objects, not shallow copies of their structures

Since commit 4658e4074b4446337467f99fa2b8f9b7147e7e01, we don't modify
the copied objects, so we can use pointers instead.
Tag physically/logically connected items differently in the "Find" action

This commit restores the semantic meaning of the "found" flag to what it
was before commit 764c3560a722c768a7048f5c70811ec363862882, and uses the
"connected" flag to identify which of the "found" (logically connected)
items are physically connected to the search origin.

The aim here is to differentiate between what an ohm-meter would show
connected with the board as-currently designed, and what it would read
if all rat-lines were implemented.
Change FOUND objects colour from green to purple...

Aim to differentiate the region connected to the search origin from
those which should be (but are not yet) connected to it.
Fix auto-enforce DRC with split connection colouring
Merge branch 'split_find_colouring' into master
Refactor signature of PlowsPolygon callback to take userdata

This allows callers to pass arbitrary data into their callbacks
without resorting to nasty workarounds like global variables.
find.c: Remove some un-needed forward declarations of static functions
find.c: Pass flags to sub-functions without using static variable "TheFlag".
find.c: Move file-global "NumberOfPads" into the function which uses it
find.c: Remove some unnecessary includes.
hid/gcode: Add a more direct "#include <locale.h>" for setlocale()

The lack of this include caused a failure to build on my machine when
compiled without optimisation (-O0). With any optimisation turned on,
the build would work without the include.

Having chased this strangeness down, it turns out that we were including
libintl.h via global.h, and that libintl.h includes locale.h, IFF
optimisation is turned on at the time it is pre-processed.