gui: Exit the mainloop if Ctrl+C is pressed in the terminal

Someone just asked in #gtk+ how this works. Looking into it a bit
there is a nice solution using the GLib mainloop.
Lower the overhead of get_buddy function.
Cache property lookups in loop to detect textbox content.

Thousands of iterations are done for each textfield, and the overhead
of a couple of property lookups was eating a lot of time for nothing.
And the optimization is pretty trivial.
Use a sin/cos lookup table to speed up hough transform.

Recalculating the sin/cos value took a lot of time, using a
small lookup table with speeds things up a lot.
Fix warning.