Hi, all.
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 number) *canvas-units*)) (cond ((complexp number) (format-number stream (realpart number)) (format-number stream (imagpart number))) ((integerp number) (format stream " ~d~a" number *canvas-units*)) ((typep number 'single-float) (format stream " ~a~a" number *canvas-units*)) ((numberp number) (format-number stream (coerce number 'single-float))) ((stringp number) (format stream " ~a" number)) ((null number) ) ((listp number) (format-number stream (car number)) (format-number stream (cdr number))) ((arrayp 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. Like :
(WITH-CANVAS-UNITS (m) ...)
I can provide the code in any form, if it is interesting.