Move _draw_line() routine from draw.c into HID_DRAW API

The API is now called draw_pcb_line, and the default implementation
resides in hid/common/draw_helpers.c
Move _draw_arc() routine from draw.c into HID_DRAW API

The API is now called draw_pcb_arc, and the default implementation
resides in hid/common/draw_helpers.c
Move DrawTextLowlevel() routine from draw.c into the HID_DRAW API

The API is now called draw_pcb_text, and the default implementation
resides in hid/common/draw_helpers.c
draw.c: Collapse line and arc drawing wrapper functions into only callers
hid/common: Fix including draw_helpers.h from draw_helpers.c

The prototype for hid_common_fill_pcb_pv() was incorrect. To avoid this
kind of mistake in the future, include the header file from the .c file.
Add (HID_DRAW *)->draw_pcb_polygon() API

This pushes special case thindraw vs. fill handling out of the core,
and into each individual HID implementation. We retain the old
implementation as a helper function, common_gui_draw_pcb_polygon()
in hid/common/draw_helpers.c.

This keeps the API more consistent between polygons and other object
types by introducing the new (HID_DRAW *)->draw_pcb_polygon() API.

I've left the (HID_DRAW *)->{fill,thindraw}_pcb_polygon() APIs for
now, as it means we can avoid a little code duplucation between the
GUIs. We may consider removing (or hiding) these APIs at some point,
as they are now _NOT_ intended to be called from outside of the
GUI's (HID_DRAW *)->draw_pcb_polygon() implementation.
hid/gtk: Call ghid_fill_pcb_polygon via (HID_DRAW *)->fill_pcb_polygon()

This indirection allows a more graceful fallback in the case where we
run out of stencil bits and replace our (HID_DRAW *)->fill_pcb_polygon()
vfunc pointer with the common_fill_pcb_polygon() implementation.
Move polygon->Clipped test into the HID implementations which require it.

This keeps draw.c more consistent between object types.
hid/common/hidgl.c: Make (polygon->clipped == NULL) test silent

This is the case for other implementations of this API, so we should
aim to be consistent.
Don't merge lines with different clearances

When multiple lines (with same direction, thickness, and clear flags)
are moved, they are merged into one line. We should also check the
line clearances match to ensure the lines are suitable for merging.

[Commit message re-worded by Peter Clifton]

Signed-off-by: Kevin Redon <kevredon@mail.tsaitgaist.info>
hid/common/hidgl.c: Add support for rendering "fullpoly" polygons

This finally bit someone (and eneded up with them producing
a bad batch of boards), so it is about time I fixed this.

Affects-bug: lp-1089532
hid/common/draw_helpers.c: Fix thindraw for "fullpoly" polygons

Affects-bug: lp-1089532
hid/ps: Add support for rendering "fullpoly" polygons

Affects-bug: lp-1089532
autoroute.c: Remove unnecessary call to ResetConnections()

This is not required to call CollectSubnets, (as the rats.c internal
function GatherSubnets() cleans the flag from objects before it uses
it).

We also use DRCFLAG to mark nets in CreateRouteData(), however:

1. We should be able to assume the DRCFLAG is clear on all objects at the
   point we un-necessary to reset it.

2. We call GatherSubnets() after we reset the DRCFLAG contents, and
   that leaves the objects in a clean state without that flag set.
toporouter.c: Remove un-necessary call to ResetConnections()

This is not required by the call to CollectSubnets() which follows it,
and we don't have any other requirement to clear flags.

Futhermore, as toporouter.c does not setup which flag is being operated
on, the effect of this call will depend on which flag has been left in
"TheFlag" variable in find.c.
select.c: Set an explicit flag to search using when selecting nets by name

If find.c's "TheFlag" variable is not equal to FOUNDFLAG, our code for
selecting nets by name did not work. This could happen, for example - after
a DRC check, where "TheFlag" appears to be left equal to SELECTEDFLAG.
(GTK, Lesstif): Netlist window - Set find flag to FOUNDFLAG explicitly

Our "Select net" functionality depends on find.c's "TheFlag" variable being
set to FOUNDFLAG. In some circumstances (e.g. after a DRC check), this may
not be the case, and selecting nets from the netlist window breaks.
find.c: Set TheFlag to FOUNDFLAG explicitly in LookupUnusedPins()

We relied on it being set to an appropriate value, instead set it to
FOUNDFLAG, similar to how LookupElementConnections() does.
autoroute.c: Remove setting the Find flag to DRCFLAG

We don't use the find features directly, those we do already take
care of setting the appropriate flag.
Add flag parameters to ResetFound{LinesAndPolygons,PinsViasAndPads}, ResetConnections

This avoids relying on the state to be magically correct