As requested, I'm moving this discussion to the mailing list... for the
history, see the bugzilla entry 76616.
Just to get a few things straight, I've stumbled on the fact the you
can't do simple arithmetic expressions in any widget whatsoever (most
prominently, boundary measurements), and I figured, since this bug had
been open since 2002, there probably wasn't much going on, so just to
get the pot stirring a little I hacked together a little recursive
descent parser / evaluator.
I realize that, for one, i18n considerations must be taken into account,
it's more or less prepared for this, although the hardcoded inch/mm
relationship could be taken from Gimps unit system, so this is more or
less a matter of cutting away code. However, more importantly, the
numeric parsing must be fitting to the locale, so I'll fix that. I've
also seen in the GtkSpinButton implementation that + and - signs are not
universal, probably * and / too, that had to be corrected as well.
Brackets too? Given the use case, the parser doesn't have to be
extremely fast, so a dynamic comparison should be perfectly ok.
Furthermore, just to not throw everyone off again, the feature is
regarding arithmetic. Not units. :) I see there's a close relationship,
especially if you want to do conversions (e.g. 2mm + 4in). A little bit
of dimension analysis won't hurt the user either. The discussion about
units seems to be almost older than me (ok, not THAT old...) though, so
I figured I'd go with what's there and not wait much longer, just do a
little arithmetic.
Any thoughts?
Any pointers what to base a potential widget on is also greatly
appreciated. I came down with gastroentritis last week, and it blossomed
up a little bit yesterday too, so I haven't really gotten around to it yet.
Fredrik.
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer