\documentclass{article} \usepackage{axiom} \begin{document} \title{TeXTK - The Axiom Document Browser} \author{Tim Daly} \maketitle \begin{abstract} \end{abstract} \eject \tableofcontents \eject \section{The general problem} \section{NOTES} \begin{verbatim} (setf img (make-image)) (image-load img "axiom.gif") (create-image canvas x y :image img) \end{verbatim} \section{The ltk package} <>= (require 'ltk) (use-package 'ltk) @ \subsection{A simple test case} <>= (ltk::ltk-eyes) @ \section{The page layout} <>= (main-frame (frame-main)) (topbar-canvas (canvas-topbar main-frame)) (exit-button (button-exit topbar-canvas)) (help-button (button-help topbar-canvas)) (banner-canvas (canvas-banner topbar-canvas)) (banner-left-canvas (canvas-banner-left banner-canvas)) (banner-label (label-banner banner-canvas)) (banner-right-canvas (canvas-banner-right banner-canvas)) (blank1-button (button-blank1 topbar-canvas)) (blank2-button (button-blank2 topbar-canvas)) (main-canvas (canvas-main main-frame)) ; (axiom-image (image-axiom main-canvas)) @ \subsection{The page widgets} <>= (defun frame-main () (make-instance 'frame)); :width 800 :height 600)) (defun canvas-main (master) (make-instance 'canvas :master master :width 700 :height 500)) (defun canvas-topbar (master) (make-instance 'canvas :master master :width 700 :height 10)) (defun button-exit (master) (make-instance 'button :master master :width 5 :height 2 :text "Exit" :command (lambda () (format t "Exit button pushed~&") (setq ltk::*exit-mainloop* t)) :relief :raised)) (defun button-help (master) (make-instance 'button :master master :width 5 :height 2 :text "Help" :command (lambda () (format t "Help button pushed~&")) :relief :raised)) (defun canvas-banner (master) (make-instance 'canvas :master master :width 680 :height 2)) (defun canvas-banner-left (master) (make-instance 'canvas :master master :width 200 :height 2)) (defun label-banner (master) (make-instance 'label :master master :text " AXIOM HyperDoc Top Level ")) (defun canvas-banner-right (master) (make-instance 'canvas :master master :width 200 :height 2)) (defun button-blank1 (master) (make-instance 'button :master master :width 5 :height 2 :command (lambda () (format t "blank1 button pushed~&")))) (defun button-blank2 (master) (make-instance 'button :master master :width 5 :height 2 :command (lambda () (format t "blank2 button pushed~&")))) ;(defun image-axiom (master)) ;; (let ((img (make-image))) ;; (image-load img "axiom.gif"))) ;(defun image-axiom (master) ; (make-instance 'photo-image :name "axiom.gif")) ;; (make-instance 'photo-image :format :gif :file "axiom.gif")) @ \section{The main function} <
>= (defun main () (setq ltk::*wish-args* '("-name" "Axiom Documentation")) (with-ltk (let* ((*debug-tk* nil) (w (screen-width)) (h (screen-height)) <> (old-x 0) (old-y 0)) (setf *debug-tk* nil) (labels ((update () (multiple-value-bind (pos-x pos-y) (screen-mouse) (let* ((wx (window-x *tk*)) (wy (window-y *tk*)) (width (window-width *tk*)) (height (window-height *tk*)) (mx pos-x) (my pos-y) (x (truncate (* width (/ mx w)))) (y (truncate (* height (/ my h)))) (diam (truncate width 8)) (dx1 (- mx (+ wx (truncate width 4)))) (dy1 (- my (+ wy (truncate height 2)))) (dx2 (- mx (+ wx (* 3 (truncate width 4))))) (dy2 (- my (+ wy (truncate height 2)))) (p1x (+ (- (truncate width 4) (truncate diam 2)) (truncate (* width dx1) (* 4.5 w)))) (p1y (+ (- (truncate height 2) (truncate diam 2)) (truncate (* height dy1) (* 2.3 h)))) (p2x (+ (- (* 3 (truncate width 4)) (truncate diam 2)) (truncate (* width dx2) (* 4.5 w)))) (p2y (+ (- (truncate height 2) (truncate diam 2)) (truncate (* height dy2) (* 2.3 h)))) ) (setf *debug-tk* nil) (unless (and (= x old-x) (= y old-y)) (setf old-x x old-y y)) )) (after 100 #'update))) (configure exit-button :background "blue") (pack exit-button :side :left) (configure help-button :background "ForestGreen") (pack help-button :side :left) (pack banner-left-canvas :side :left) (configure banner-label :justify :center) (pack banner-label :side :left) (pack banner-canvas :side :left) (pack banner-right-canvas :side :left) (pack blank2-button :side :right) (pack blank1-button :side :right) (pack topbar-canvas :expand t :side :top :fill :both) ; (pack axiom-image :side :top) (pack main-canvas :expand t :side :top) (pack main-frame) (after 100 #'update) )))) @ \section{The textk function} <>= (defun textk () (let ((*debug-tk* nil)) (main))) @ \section{The startup code} <>= (progn (textk) (bye)) @ \section{The TeXTK code} <<*>>= <> <> <
> <> <> @ \vfill \eject \begin{thebibliography}{99} \bibitem{1} LTK \end{thebibliography} \end{document}