[ltk-user] Adding support for various units of measure for canvas items.
i.zvyagin at rlisystems.ru
Tue Jul 7 20:02:52 UTC 2009
First of all, thank you for a good library.
So far I think LTK is the best CL library for TK.
That is a good reason to make it even better !
I think why does not LTK have support for units of length for canvas
items? At least, I have not found any neither from reading the docs no
from reading the sources (which are compact, indeed).
That is why I tried my own hack for this. The idea is very
simple: we declare a dynamic variable to hold name of units
of measure, with reasonable value of "", which should not
have any effect on the existing applications, and attach it to
each length or size with is forwarded to WISH. Like this:
(defparameter *canvas-units* "")
(defun format-number (stream number)
(when (and (atom number) (not (vectorp number)))
(format *debug-io* "~%format-number: ~A ~A ~A" number (type-of
(format-number stream (realpart number))
(format-number stream (imagpart number)))
(format stream " ~d~a" number *canvas-units*)) ((typep number
(format stream " ~a~a" number *canvas-units*))
(format-number stream (coerce number 'single-float)))
(format stream " ~a" number))
(format-number stream (car number))
(format-number stream (cdr number)))
(dotimes (i (length number))
(format-number stream (aref number i))))
And I also added a branch for STRING parameters.
The reason is I spent significant number of time
trying to figure out why my code using STRING
parameters to length options. LTK in this case silently
ignores these parameters so I think either output branch
or error condition should be added here.
To support the tradition, a WITH-like macro also can be added.
I can provide the code in any form, if it is interesting.
Ilya Zvyagin, OOO Rolis.
e-mail: masterziv AT gmail DOT com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the ltk-user