Fix crash when no objects are loaded, retraction improvements.

First commit will fix a crash in the GUI when "Export G-code" is selected but there are no objects on the plater.

I've also done some very simple improvements in retraction handling - to allow specifying retraction length for layer changes specifically, and to make retraction for travel moves shorter than retract_before_travel proportional to travel length. Shorter retraction means less melting of surrounding plastic, so it would be best to retract only just enough.