
[snip]
Thanks for putting up with me Carl! :)
No problem, thank you for sorting the patches out :-)
One strange behavior still exists, and this just might be "by design". In "Dialogs / Document Preferences / Grid" if I switch "Snap units" from "px" to anything else (or back), the "Snap distance" stays the same. If I change "Snap units" from anything not "px" to anything else not "px", unit conversion is performed. Is this just a "feature" of the pixel unit?
I noticed this and had a look into it, but I didn't make much sense of anything.
The first odd thing is that spus_unit_activate() (called when a different unit is chosen) only attempts to update its adjustment values if the "base" of the new unit is different from that of the old. The "base" is the type of unit e.g. dimensionless (%ages), absolute (mm, cm) etc. (see the top of helper/units.h).
I'm not sure why it doesn't try a conversion.
The other strange thing is that sp_unit_selector_init sets up ctmscale and devicescale to both be 1. I think this means that any conversion between device and absolute units will be wrong anyway. It looks to me like sp_unit_selector_init needs to get its scale factors right, perhaps getting the correct values from the OS, or whatever.
The first odd thing may be a consequence of the second, who knows.
Cheers
Carl