id
int64 0
45.1k
| file_name
stringlengths 4
68
| file_path
stringlengths 14
193
| content
stringlengths 32
9.62M
| size
int64 32
9.62M
| language
stringclasses 1
value | extension
stringclasses 6
values | total_lines
int64 1
136k
| avg_line_length
float64 3
903k
| max_line_length
int64 3
4.51M
| alphanum_fraction
float64 0
1
| repo_name
stringclasses 779
values | repo_stars
int64 0
882
| repo_forks
int64 0
108
| repo_open_issues
int64 0
90
| repo_license
stringclasses 8
values | repo_extraction_date
stringclasses 146
values | sha
stringlengths 64
64
| __index_level_0__
int64 0
45.1k
| exdup_ids_cmlisp_stkv2
sequencelengths 1
47
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
32,813 | canvas-button-mcl.lsp | rwoldford_Quail/source/window-basics/mouse/canvas-button-mcl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; canvas-button-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; H.A. Chipman 1991
;;; C.B. Hurley 1989-1991
;;; J.A. McDonald 1988-89
;;; R.W. Oldford 1989-1991
;;; J.O. Pedersen 1988-89
;;;
;;;
;;;===========================================================================
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '()))
;;;===================================================================
;;;
;;; Now make button events function uniformly
;;;
;;;===================================================================
(defmethod ccl:view-click-event-handler ((canvas canvas-button) click-pos)
;; Call the button event handler. Note that click-pos
;; is translated into a window-basics position.
(declare (ignore click-pos))
(mouse-button-event-fn canvas (mouse-position canvas))
(call-next-method))
(defmethod ccl:window-mouse-up-event-handler ((canvas canvas-button))
(mouse-button-event-fn canvas (mouse-position canvas))
(call-next-method))
| 1,627 | Common Lisp | .cl | 40 | 37.6 | 86 | 0.481859 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 97c28faa35454999f621a32701f2f0cf8a2874b4e01c7439ca7f02c620823c13 | 32,813 | [
-1
] |
32,814 | canvas-button-clx.lsp | rwoldford_Quail/source/window-basics/mouse/canvas-button-clx.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; canvas-button-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; H.A. Chipman 1991
;;; C.B. Hurley 1989-1991
;;; J.A. McDonald 1988-89
;;; R.W. Oldford 1989-1991
;;; J.O. Pedersen 1988-89
;;;
;;;
;;;===========================================================================
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '()))
#|
;;;===================================================================
;;;
;;; Now make button events function uniformly
;;;
;;;===================================================================
(defmethod ccl:view-click-event-handler ((canvas canvas-button) click-pos)
;; Call the button event handler. Note that click-pos
;; is translated into a window-basics position.
(declare (ignore click-pos))
(mouse-button-event-fn canvas (mouse-position canvas))
(call-next-method))
(defmethod ccl:window-mouse-up-event-handler ((canvas canvas-button))
(mouse-button-event-fn canvas (mouse-position canvas))
(call-next-method))
|#
| 1,631 | Common Lisp | .cl | 42 | 35.904762 | 86 | 0.480025 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 4ea3fc7c238800f649be956622b54d67b87ec5ff7333c9a510756a2b3c048965 | 32,814 | [
-1
] |
32,815 | old-mouse-clx2.lsp | rwoldford_Quail/source/window-basics/mouse/old-mouse-clx2.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; mouse-clx.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; N.G. Bennett 1993
;;;
;;;
;;;==========================================================================
;;; History:
;;;
;;; - created June 1989 by [email protected] to provide
;;; uniform three-button mouse interaction.
;;;
;;;
;;; Each key can also be modified by either the shift-key or the
;;; control-key.
;;;
;;;===========================================================================
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(mouse-position mouse-x mouse-y
screen-mouse-position screen-mouse-x screen-mouse-y)))
(defmacro host-to-canvas-mouse-state (state)
`(cond ((eq ,state 256) :left)
((eq ,state 257) :left)
((eq ,state 260) :left)
((eq ,state 512) :middle)
((eq ,state 513) :middle)
((eq ,state 516) :middle)
((eq ,state 1024) :right)
((eq ,state 1025) :right)
((eq ,state 1028) :right)))
(defun mouse-down-p (&optional canvas)
"Tests whether a mouse button is being held down."
(if canvas
(multiple-value-bind
(a b c d state)
(xlib::query-pointer (host-window canvas))
(host-to-canvas-mouse-state state))
(multiple-value-bind
(foo bar root-window)
(xlib::global-pointer-position *default-display*)
(multiple-value-bind
(a b c d state)
(xlib::query-pointer root-window)
(host-to-canvas-mouse-state state)))))
(defun mouse-position (canvas)
(multiple-value-bind
(x y)
(xlib::pointer-position (host-window canvas))
(make-position x (host-to-canvas-y canvas y))))
(defun mouse-x (canvas)
(xlib::pointer-position (host-window canvas)))
(defun mouse-y (canvas)
(multiple-value-bind
(x y)
(xlib::pointer-position (host-window canvas))
(host-to-canvas-y canvas y)))
;;;========================================================================================
;;; mouse position in screen coordinates, cbh
;;;========================================================================================
(defun screen-mouse-position ()
"Returns position of mouse in screen coords."
(multiple-value-bind
(x y)
(xlib::global-pointer-position *default-display*)
(make-position x y)))
(defun screen-mouse-x ()
(xlib::global-pointer-position *default-display*))
(defun screen-mouse-y ()
(multiple-value-bind
(x y)
(xlib::global-pointer-position *default-display*)
y))
(defun same-button-state-p (state test)
(equal state test))
(defmacro get-wb-class-instance (window)
`(cdr (assoc :wb-class-instance (xlib:window-plist ,window))))
(defmethod wb-refresh ((self null))
(declare (ignore self)))
#|
(defmethod xwindow-of ((self xlib::window))
(parent-of (parent-of self)))
|#
(defun event-handler (display &aux (last NIL))
(xlib:event-case
(display :force-output-p t :discard-p t)
(:map-notify
(window)
(let ((c (get-wb-class-instance window)))
(when (canvas-p c)
(menu-present (menu-bar-of c))))
nil)
(:exposure
(window count)
(when (zerop count)
(xlib::with-event-queue (display)
(wb-refresh (get-wb-class-instance window))))
nil)
(:configure-notify
(window x y width)
(let ((c (get-wb-class-instance window)))
(when (canvas-p c)
(menu-present (menu-bar-of c))
))
nil)
(:visibility-notify
()
#|(window state)
;;(format *terminal-io* "~&In :visibility-notify ~%~5Twindow = ~s ~~%~5Tstate= ~s"
;; window state)
(let ((c (get-wb-class-instance window)))
(when (and (member state
'(:partially-obscured :fully-obscured))
(menu-p c))
(menu-present
c
)))
|#
nil)
(:button-press
(window code state x y)
(let ((c (get-wb-class-instance window)))
(cond
((canvas-p c)
(let ((mouse-pos (make-position
x
(host-to-canvas-y c y))))
(cond
((equal code *left-button-code*)
(cond
((equal state *button-no-modifier*)
(funcall (left-button-fn-of c) c mouse-pos))
((equal state *shift-button*)
(funcall (shift-left-button-fn-of c) c mouse-pos))
((equal state *ctrl-button*)
(funcall (ctrl-left-button-fn-of c) c mouse-pos))))
((equal code *middle-button-code*)
(cond
((equal state *button-no-modifier*)
(funcall (middle-button-fn-of c) c mouse-pos))
((equal state *shift-button*)
(funcall (shift-middle-button-fn-of c) c mouse-pos))
((equal state *ctrl-button*)
(funcall (ctrl-middle-button-fn-of c) c mouse-pos))))
((equal code *right-button-code*)
(cond
((equal state *button-no-modifier*)
(funcall (right-button-fn-of c) c mouse-pos))
((equal state *shift-button*)
(funcall (shift-right-button-fn-of c) c mouse-pos))
((equal state *ctrl-button*)
(funcall (ctrl-right-button-fn-of c) c mouse-pos)))))))
((and (menu-p c) (enabled-p c))
(menu-highlight c)
(when ;;(and (eq window (item-window-of c))
(sub-menus-of c)
;;)
(xlib::with-event-queue (display)
(place-item-sub-menu c))))
((button-p c)
(let* (;;(window (button-window-of c))
(width (xlib::drawable-width window))
(height (xlib::drawable-height window))
(gcontext (button-gcontext-of c))
(bg (xlib::gcontext-foreground gcontext))
(fg (xlib::gcontext-background gcontext))
(association (get-association window)))
(when (check-dialog-p association)
(setf (button-text-of c)
(if (string= (button-text-of c) "T ")
"NIL" "T "))
(setf (check-dialog-t-or-nil-of association)
(not (check-dialog-t-or-nil-of association))))
(xlib::with-gcontext (gcontext :function *host-bic-mode*
:foreground fg :background bg)
(xlib::draw-rectangle window gcontext 0 0 width height t)
(wb-refresh c))))
)
)
nil)
(:button-release
(event-window state)
(let ((c (get-wb-class-instance event-window)))
(when (and (menu-p c)
(enabled-p c)
(mouse-in-item-p c))
(funcall (when-selected-fn-of c)
(items-of c)
(super-menu-of c)
(host-to-canvas-mouse-state state))
)
(when *current-canvas*
(dolist (thing (sub-menus-of (menu-bar-of *current-canvas*)))
(menu-downlight thing)
(when (eq (xlib::window-map-state (window-of thing)) :viewable)
(xlib::unmap-window (window-of thing)))))
(when (button-p c)
(let* ((w (xlib::drawable-width event-window))
(h (xlib::drawable-height event-window))
(gcontext (button-gcontext-of c))
(fg (xlib::gcontext-background gcontext))
(bg (xlib::gcontext-foreground gcontext)))
(xlib::with-gcontext (gcontext :foreground fg :background bg)
(xlib::draw-rectangle event-window gcontext 0 0 w h t))
(wb-refresh c))))
nil)
(:enter-notify
(window state)
(let ((c (get-wb-class-instance window)))
(if (canvas-p c)
(setf *current-canvas* c)
(when (and (menu-p c) (host-to-canvas-mouse-state state))
(when (and last (not (member c (sub-menus-of last))))
(dolist (thing (sub-menus-of (super-menu-of c)))
(when (eq (xlib::window-map-state (window-of thing)) :viewable)
(xlib::unmap-window (window-of thing)))))
(when (enabled-p c)
(when (sub-menus-of c)
(xlib::with-event-queue (display)
(place-item-sub-menu c)))
(menu-highlight c)))))
nil)
(:leave-notify
(window state)
(let ((c (get-wb-class-instance window)))
(when (and (menu-p c) (host-to-canvas-mouse-state state))
(setf last c)
(menu-downlight c)))
nil)
(:unmap-notify
(window)
(let ((c (get-wb-class-instance window)))
(if ;;(and
(canvas-p c)
;;(eq window (xwindow-of c)))
(shutdown-menu (menu-bar-of c))
(when (and (menu-p c) (eq window (window-of c)))
(dolist (thing (sub-menus-of c))
(when (eq (xlib::window-map-state (window-of thing)) :viewable)
(xlib::unmap-window (window-of thing)))))))
nil)
(otherwise nil)
))
;;--------------------------------------------------------------
;; EVENT MASKS FOR BUTTON-PRESS EVENTS
;;--------------------------------------------------------------
(defparameter *left-button-code* 1)
(defparameter *middle-button-code* 2)
(defparameter *right-button-code* 3)
(defparameter *button-no-modifier* 0)
(defparameter *shift-button* 1)
(defparameter *ctrl-button* 4)
;;--------------------------------------------------------------
;; EVENT MASKS FOR BUTTON-RELEASE EVENTS
;;--------------------------------------------------------------
(defparameter *left-button-no-modifier* 256)
(defparameter *shift-left-button* 257)
(defparameter *ctrl-left-button* 260)
(defparameter *middle-button-no-modifier* 512)
(defparameter *shift-middle-button* 513)
(defparameter *ctrl-middle-button* 516)
(defparameter *right-button-no-modifier* 1024)
(defparameter *shift-right-button* 1025)
(defparameter *ctrl-right-button* 1028)
| 10,746 | Common Lisp | .cl | 276 | 30.282609 | 96 | 0.521697 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 04f983a98b7150b2879232412658712304c7080d28545640dd40a57e72e7dac4 | 32,815 | [
-1
] |
32,816 | start-windows-excl.lsp | rwoldford_Quail/source/window-basics/start-windows/start-windows-excl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; start-windows-excl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; R.W. Oldford 1994
;;;
;;;
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(start-windows stop-windows)))
(defun default-host ()
"Returns value of *default-host* if it's non-NIL ~
otherwise queries the system environment variable DISPLAY for the ~
host, assigns the result to *default-host* and returns it."
(declare (special *default-host*))
(unless *default-host*
(let ((system-host (si:getenv "DISPLAY")))
(setf *default-host*
(subseq system-host 0
(position #\: system-host)))))
*default-host*)
(defun start-windows ()
"Starts up the windowing environment for this implementation."
(default-display)
(mp:process-run-function "Quail Event Handler"
#'event-handler *default-display*)
)
(defun stop-windows ()
"Shuts down the windowing environment for this implementation."
(let ((quail-event-handler
(find-if #'(lambda (proc)
(string-equal "Quail Event Handler"
(mp:process-name proc)))
mp:*all-processes*)))
(if quail-event-handler
(mp:process-kill quail-event-handler))
(setf *current-canvas* NIL)
(setf *default-display* (xlib:close-display *default-display*))))
| 2,017 | Common Lisp | .cl | 49 | 33.77551 | 95 | 0.5573 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 40d0b1590ddea862d6da2aa0c76d4dbf133cf4efdc5a16b1058319e4662e29d2 | 32,816 | [
-1
] |
32,817 | start-windows-mcl.lsp | rwoldford_Quail/source/window-basics/start-windows/start-windows-mcl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; start-windows-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; R.W. Oldford 1994
;;;
;;;
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(start-windows stop-windows)))
(defun start-windows ()
"Starts up the windowing environment for this implementation. ~
Does nothing for the MCL implementation."
)
(defun stop-windows ()
"Shuts down the windowing environment for this implementation ~
Does nothing for the MCL implementation."
)
| 1,060 | Common Lisp | .cl | 29 | 33.62069 | 95 | 0.54439 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 5d5b0ab0b0a4ceb95ba717df329eb5dac55d6e72578dea9258e3a6de04b37b50 | 32,817 | [
-1
] |
32,818 | color-canvas-mcl.lsp | rwoldford_Quail/source/window-basics/canvas/color-canvas-mcl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; color-canvas-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; N.G. Bennett 1993
;;; R.W. Oldford 1994
;;;
;;;
;;;
;;;----------------------------------------------------------------------------------
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(make-color-canvas)))
;;; =======================================================================
;;;
;;; Creating a colour canvas
;;;
;;; =======================================================================
(defun make-color-canvas (&rest
canvas-keywords
&key
left bottom width height
(type (device-type))
(canvas-class 'canvas)
(title "Color Canvas")
(background-color NIL)
(pen-color NIL)
(pen-width nil)
(pen-operation nil)
(font *normal-graphics-font*)
&allow-other-keys)
"Creates and returns a color canvas."
(declare (special *normal-graphics-font*
*default-canvas-background-color*
*default-canvas-pen-color*))
(unless left
(setq left (round (/ (- (screen-width) width) 2))))
(unless bottom
(setq bottom (round (/ (- (screen-height) height) 2))))
(let* ((c (apply
#'make-instance canvas-class
:view-position
(h-draw:make-point left
(- (screen-height) bottom height))
:view-size (h-draw:make-point width height)
:window-title title
:color? t
:color-p t
:window-show t
:view-font (canvas-font-to-host-font font)
:font font
:window-type :document-with-zoom
:close-box-p t
:track-thumb-p t
:type type
:allow-other-keywords t
canvas-keywords)))
;;
;; Now set the colours
;;
(canvas-set-background-color c (or background-color
*default-canvas-background-color*))
(canvas-set-pen c
:color (or pen-color
*default-canvas-pen-color*
(canvas-default-draw-color c))
:width pen-width
:operation pen-operation)
;;
;; Finally get the pen back to the correct origin
;;
(canvas-move-to c 0 0)
c))
| 3,286 | Common Lisp | .cl | 84 | 26.809524 | 87 | 0.414394 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | bf1570b450e1a6a9f4b9c253d10f9191ca9a5cea1b0c4800d1c209c4a7439db7 | 32,818 | [
-1
] |
32,819 | color-canvas-clx.lsp | rwoldford_Quail/source/window-basics/canvas/color-canvas-clx.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; color-canvas-clx.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; N.G. Bennett 1993
;;; R.W. Oldford 1994
;;;
;;;
;;;
;;;----------------------------------------------------------------------------------
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(make-color-canvas)))
;;; =======================================================================
;;;
;;; Creating a colour canvas
;;;
;;; =======================================================================
(defun make-color-canvas (&rest
canvas-keywords
&key
left bottom width height
;; (type (device-type))
(canvas-class 'canvas)
(title "Color Canvas")
(background-color NIL)
(pen-color NIL)
(pen-width nil)
(pen-operation nil)
(font *normal-graphics-font*)
&allow-other-keys)
"Creates and returns a black and white canvas."
(declare (special *normal-graphics-font*
*default-canvas-background-color*
*default-canvas-pen-color*
*white-color*
*black-color*))
(unless left
(setq left (round (/ (- (screen-width) width) 2))))
(unless bottom
(setq bottom (round (/ (- (screen-height) height) 2))))
(let* ((top (+ bottom height))
(c (apply
#'make-instance canvas-class
:top (- (wb::screen-height) top)
:left left
:height height
:width width
:title title
:color? T
:font font
:allow-other-keywords t
canvas-keywords)))
;;
;; Now set the colors
;;
(canvas-set-background-color c (or background-color
*default-canvas-background-color*))
(canvas-set-pen c
:color (or pen-color
*default-canvas-pen-color*
(canvas-default-draw-color c))
:width pen-width
:operation pen-operation)
;;
;; Finally get the pen back to the correct origin
;;
(canvas-move-to c 0 0)
c))
| 3,078 | Common Lisp | .cl | 80 | 26.65 | 87 | 0.40678 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | aba7c124801d01eb213d457d6a8959cb964cb0a378b03ec964b995da00595c8d | 32,819 | [
-1
] |
32,820 | key-event-mcl.lsp | rwoldford_Quail/source/window-basics/canvas/key-event-mcl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; key-event-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; R.W. Oldford 1996
;;;
;;;
;;;
;;;----------------------------------------------------------------------------------
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute) (export
'(;*backspace-event* *tab-event* *linefeed-event* *page-event* *return-key-event*
;*rubout-event* *delete-event* *enter-key-event* *escape-key-event*
;*home-key-event*
;*up-arrow-event* *down-arrow-event* *back-arrow-event* *forward-arrow-event*
+backspace-event+ +tab-event+ +linefeed-event+ +page-event+ +return-key-event+
+rubout-event+ +delete-event+ +enter-key-event+ +escape-key-event+
+home-key-event+
+up-arrow-event+ +down-arrow-event+ +back-arrow-event+ +forward-arrow-event+
)
))
(defmethod ccl::view-key-event-handler ((canvas canvas) event)
"Hands off to the window-basics key-event handler."
(handle-key-event canvas event)
)
;;; The Semi-standard characters of CL
(defconstant +backspace-event+ #\Backspace ;*backspace-event* #\Backspace 23FEB2022 gwb
"The value of the backspace keyboard event.")
(defconstant +tab-event+ #\Tab ;*tab-event* #\Tab 23FEB2022 gwb
"The value of the tab keyboard event.")
(defconstant +linefeed-event+ \Linefeed;*linefeed-event* #\Linefeed 23FEB2022 gwb
"The value of the linefeed keyboard event.")
(defconstant +page-event+ #\Page ;*page-event* #\Page 23FEB2022 gwb
"The value of the Page keyboard event.")
(defconstant +return-key-event+ #\Return ;*return-key-event* #\Return 23FEB2022 gwb
"The value of the return keyboard event.")
(defconstant +rubout-event+ #\Rubout ;*rubout-event* #\Rubout 23FEB2022 gwb
"The value of the rubout keyboard event.")
;;; Some non-standard and hence non-portable characters.
(defconstant +delete-event+ #\Delete ;*delete-event* #\Delete 23FEB2022 gwb
"The value of the delete keyboard event.")
(defconstant +enter-key-event+ #\Enter ;*enter-key-event* #\Enter 23FEB2022 gwb
"The value of the enter keyboard event.")
(defconstant +escape-key-event+ #\ESC ;*escape-key-event* #\ESC 23FEB2022 gwb
"The value of the escape key keyboard event.")
(defconstant +home-key-event+ #\Home ;*home-key-event* #\Home 23FEB2022 gwb
"The value of the Home key keyboard event.")
;;; The (again non-standard) arrow movement keys.
(defconstant +up-arrow-event+ #\UpArrow ;*up-arrow-event* #\UpArrow 23FEB2022 gwb
"The value of the up arrow keyboard event.")
(defconstant +down-arrow-event+ #\DownArrow ;*down-arrow-event* #\DownArrow 23FEB2022 gwb
"The value of the down arrow keyboard event.")
(defconstant +back-arrow-event+ #\BackArrow ;*back-arrow-event* #\BackArrow 23FEB2022 gwb
"The value of the left or back arrow keyboard event.")
(defconstant +forward-arrow-event+ #\ForwardArrow ;*forward-arrow-event* #\ForwardArrow 23FEB2022 gwb
"The value of the right or forward arrow keyboard event.")
| 3,561 | Common Lisp | .cl | 68 | 48.588235 | 102 | 0.648649 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 8c49297f67e9f8ec68cd2d45672103a9fd6a659ad5af7b2e5061ca29f5c94bf1 | 32,820 | [
-1
] |
32,821 | bw-canvas-mcl.lsp | rwoldford_Quail/source/window-basics/canvas/bw-canvas-mcl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; bw-canvas-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; H.A. Chipman 1991
;;; C.B. Hurley 1989-1991
;;; J.A. McDonald 1988-89
;;; R.W. Oldford 1989-1992
;;; J.O. Pedersen 1988-89
;;;
;;;
;;;
;;;----------------------------------------------------------------------------------
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(make-b&w-canvas)))
;;;==============================================================================
;;;
;;; The following function is called by make-canvas if color is not available
;;; (i.e. specified)
;;;
(defun make-b&w-canvas (&rest canvas-keywords
&key left bottom
(width (round (/ (screen-width) 2)))
(height (round (/ (screen-height) 2)))
(title "Canvas")
(canvas-class 'canvas)
(pen-color *black-shade*)
(pen-width nil)
(pen-operation nil)
(font *normal-graphics-font*))
"Creates an returns a black and white canvas."
(declare (special *normal-graphics-font*
*black-shade*))
(unless left
(setq left (round (/ (- (screen-width) width) 2))))
(unless bottom
(setq bottom (round (/ (- (screen-height) height) 2))))
(let* ((w (apply
#'make-instance canvas-class
:view-position
(h-draw:make-point left (- (screen-height) bottom height))
:view-size (h-draw:make-point width height)
:window-title title
:window-show t
:color? NIL
:view-font (canvas-font-to-host-font font)
:font font
:window-type :document-with-zoom
:close-box-p t
:allow-other-keys t
canvas-keywords)))
;;
;; Now set the pen
;;
(canvas-set-pen w :color pen-color
:width pen-width :operation pen-operation)
;;
;; Finally get the pen back to the correct origin
;;
(canvas-move-to w 0 0)
w))
| 2,877 | Common Lisp | .cl | 73 | 28.917808 | 120 | 0.436554 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 0e9b1d2df73414b40e39b6695af5363c9990501968393827404cf79e59ac091d | 32,821 | [
-1
] |
32,822 | bw-canvas-clx.lsp | rwoldford_Quail/source/window-basics/canvas/bw-canvas-clx.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; bw-canvas-clx.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; N.G. Bennett 1993
;;; R.W. Oldford 1994
;;;
;;;
;;;
;;;----------------------------------------------------------------------------------
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(make-b&w-canvas)))
;;; =======================================================================
;;;
;;; Creating a black and white canvas
;;;
;;; =======================================================================
(defun make-b&w-canvas (&rest
canvas-keywords
&key
left bottom width height
;; (type (device-type))
(canvas-class 'canvas)
(title "Canvas")
(pen-color *black-shade*)
(pen-width nil)
(pen-operation nil)
(font *normal-graphics-font*)
&allow-other-keys)
"Creates and returns a black and white canvas."
(declare (special *normal-graphics-font*
*black-shade*))
(unless left
(setq left (round (/ (- (screen-width) width) 2))))
(unless bottom
(setq bottom (round (/ (- (screen-height) height) 2))))
(let* ((top (+ bottom height))
(c (apply
#'make-instance canvas-class
:top (- (wb::screen-height) top)
:left left
:height height
:width width
:title title
:color? nil
:font font
:allow-other-keywords t
canvas-keywords)))
;;
;; Now set the pen
;;
;; (canvas-set-pen c :color pen-color :width pen-width :operation pen-operation)
;;
;; Finally get the pen back to the correct origin
;;
;; (canvas-move-to c 0 0)
c))
| 2,575 | Common Lisp | .cl | 69 | 27.710145 | 88 | 0.409276 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | eb3ef1eeb762213f827b2d5cb2286e3f53c99bdc48c64d01cc9aa982e990b100 | 32,822 | [
-1
] |
32,823 | old-ps-font-mcl.lsp | rwoldford_Quail/source/window-basics/postscript/old-ps-font-mcl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; ps-font-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; N.G. Bennett 1992
;;; R.W. Oldford 1992
;;;
;;;
;;;----------------------------------------------------------------------------------
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(*canvas-to-ps-font-name*)))
(defun get-ps-font-name (canvas canvas-font)
"Returns the PostScript font name corresponding to the canvas-font."
(declare (special *canvas-to-ps-font-name*))
(when (and (member :outline (canvas-font-style canvas-font))
(not (command-included-p "Outline Font Generation Procedures")))
(toggle-includes canvas "Outline Font Generation Procedures")
(read-write (include-file-of "Outline Font Generation Procedures")
(header-file-of canvas)))
(flet ((sort-style-list (s-l)
(sort (copy-list s-l)
#'(lambda (x y)
(< (position x *canvas-font-styles*)
(position y *canvas-font-styles*))))))
(let ((result
(assoc canvas-font *canvas-to-ps-font-name*
:test
#'(lambda (cf key)
(and
(string-equal (canvas-font-name cf)
(canvas-font-name key))
(equal (sort-style-list (canvas-font-style cf))
(sort-style-list (canvas-font-style key))))))))
(if result
(cdr result)
"Ugly"))))
(defun ps-set-canvas-font (canvas font)
(with-open-file (ofile (body-full-pathname canvas)
:direction :output
:if-exists :append
:if-does-not-exist :create)
(format ofile "~%/~a findfont ~a scalefont setfont~%"
(get-ps-font-name canvas font)
(* (canvas-font-size font)
(floor (/ (+ (ps-x-scale-of canvas)
(ps-y-scale-of canvas)) 2))))))
(defvar *canvas-to-ps-font-name*
(list
(cons (canvas-make-font :name "Helvetica"
:style :plain)
"Helvetica")
(cons (canvas-make-font :name "Helvetica"
:style :bold)
"Helvetica-Bold")
(cons (canvas-make-font :name "Helvetica"
:style :italic)
"Helvetica-Oblique")
(cons (canvas-make-font :name "Helvetica"
:style (list :bold :italic))
"Helvetica-BoldOblique")
(cons (canvas-make-font :name "Helvetica"
:style :outline)
"Helvetica /Helvetica-Outline MakeOutlinePlainFont~
/Helvetica-Outline")
(cons (canvas-make-font :name "Helvetica"
:style (list :bold :outline))
"Helvetica-Bold /Helvetica-Bold-Outline MakeOutlinePlainFont~
/Helvetica-Bold-Outline")
(cons (canvas-make-font :name "Helvetica"
:style (list :italic :outline))
"Helvetica-Oblique /Helvetica-Oblique-Outline MakeOutlinePlainFont~
/Helvetica-Oblique-Outline")
(cons (canvas-make-font :name "Helvetica"
:style (list :bold :italic :outline))
"Helvetica-BoldOblique /Helvetica-BoldOblique-Outline~
MakeOutlinePlainFont~
/Helvetica-BoldOblique-Outline")
(cons (canvas-make-font :name "Avant Garde"
:style :plain)
"AvantGarde-Book")
(cons (canvas-make-font :name "Avant Garde"
:style :italic)
"AvantGarde-BookOblique")
(cons (canvas-make-font :name "Avant Garde"
:style :bold)
"AvantGarde-Demi")
(cons (canvas-make-font :name "Avant Garde"
:style (list :bold :italic))
"AvantGarde-DemiOblique")
(cons (canvas-make-font :name "Avant Garde"
:style :outline)
"AvantGarde-Book /AvantGarde-Book-Outline MakeOutlinePlainFont~
/AvantGarde-Book-Outline")
(cons (canvas-make-font :name "Avant Garde"
:style (list :bold :outline))
"AvantGarde-Demi /AvantGarde-Demi-Outline MakeOutlinePlainFont~
/AvantGarde-Demi-Outline")
(cons (canvas-make-font :name "Avant Garde"
:style (list :italic :outline))
"AvantGarde-BookOblique /AvantGarde-BookOblique-Outline MakeOutlinePlainFont~
/AvantGarde-BookOblique-Outline")
(cons (canvas-make-font :name "Avant Garde"
:style (list :bold :italic :outline))
"AvantGarde-DemiOblique /AvantGarde-DemiOblique-Outline~
MakeOutlinePlainFont~
/AvantGarde-DemiOblique-Outline")
(cons (canvas-make-font :name "Bookman"
:style :plain)
"Bookman-Light")
(cons (canvas-make-font :name "Bookman"
:style :italic)
"Bookman-LightItalic")
(cons (canvas-make-font :name "Bookman"
:style :bold)
"Bookman-Demi")
(cons (canvas-make-font :name "Bookman"
:style (list :bold :italic))
"Bookman-DemiItalic")
(cons (canvas-make-font :name "Bookman"
:style :outline)
"Bookman-Light /Bookman-Light-Outline MakeOutlinePlainFont~
/Bookman-Light-Outline")
(cons (canvas-make-font :name "Bookman"
:style (list :bold :outline))
"Bookman-Demi /Bookman-Demi-Outline MakeOutlinePlainFont~
/Bookman-Demi-Outline")
(cons (canvas-make-font :name "Bookman"
:style (list :italic :outline))
"Bookman-LightItalic /Bookman-LightItalic-Outline MakeOutlinePlainFont~
/Bookman-LightItalic-Outline")
(cons (canvas-make-font :name "Bookman"
:style (list :bold :italic :outline))
"Bookman-DemiItalic /Bookman-DemiItalic-Outline~
MakeOutlinePlainFont~
/Bookman-DemiItalic-Outline")
(cons (canvas-make-font :name "Courier"
:style :plain)
"Courier")
(cons (canvas-make-font :name "Courier"
:style :italic)
"Courier-Oblique")
(cons (canvas-make-font :name "Courier"
:style :bold)
"Courier-Bold")
(cons (canvas-make-font :name "Courier"
:style (list :bold :italic))
"Courier-BoldOblique")
(cons (canvas-make-font :name "Courier"
:style :outline)
"Courier /Courier-Outline MakeOutlinePlainFont~
/Courier-Outline")
(cons (canvas-make-font :name "Courier"
:style (list :bold :outline))
"Courier-Bold /Courier-Bold-Outline MakeOutlinePlainFont~
/Courier-Bold-Outline")
(cons (canvas-make-font :name "Courier"
:style (list :italic :outline))
"Courier-Oblique /Courier-Oblique-Outline MakeOutlinePlainFont~
/Courier-Oblique-Outline")
(cons (canvas-make-font :name "Courier"
:style (list :bold :italic :outline))
"Courier-BoldOblique /Courier-BoldOblique-Outline~
MakeOutlinePlainFont~
/Courier-BoldOblique-Outline")
(cons (canvas-make-font :name "Palatino"
:style :plain)
"Palatino-Roman")
(cons (canvas-make-font :name "Palatino"
:style :italic)
"Palatino-Italic")
(cons (canvas-make-font :name "Palatino"
:style :bold)
"Palatino-Bold")
(cons (canvas-make-font :name "Palatino"
:style (list :bold :italic))
"Palatino-BoldItalic")
(cons (canvas-make-font :name "Palatino"
:style :outline)
"Palatino-Roman /Palatino-Roman-Outline MakeOutlinePlainFont~
/Palatino-Roman-Outline")
(cons (canvas-make-font :name "Palatino"
:style (list :bold :outline))
"Palatino-Bold /Palatino-Bold-Outline MakeOutlinePlainFont~
/Palatino-Bold-Outline")
(cons (canvas-make-font :name "Palatino"
:style (list :italic :outline))
"Palatino-Italic-Outline /Palatino-Italic-Outline MakeOutlinePlainFont~
/Palatino-Italic-Outline")
(cons (canvas-make-font :name "Palatino"
:style (list :bold :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline~
MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "Times"
:style :plain)
"Times-Roman")
(cons (canvas-make-font :name "Times"
:style :italic)
"Times-Italic")
(cons (canvas-make-font :name "Times"
:style :bold)
"Times-Bold")
(cons (canvas-make-font :name "Times"
:style (list :bold :italic))
"Times-BoldItalic")
(cons (canvas-make-font :name "Times"
:style :outline)
"Times-Roman /Times-Roman-Outline MakeOutlinePlainFont~
/Times-Roman-Outline")
(cons (canvas-make-font :name "Times"
:style (list :bold :outline))
"Times-Bold /Times-Bold-Outline MakeOutlinePlainFont~
/Times-Bold-Outline")
(cons (canvas-make-font :name "Times"
:style (list :italic :outline))
"Times-Italic /Times-Italic-Outline MakeOutlinePlainFont~
/Times-Italic-Outline")
(cons (canvas-make-font :name "Times"
:style (list :bold :italic :outline))
"Times-BoldItalic /Times-BoldItalic-Outline~
MakeOutlinePlainFont~
/Times-BoldItalic-Outline")
(cons (canvas-make-font :name "Symbol"
:style :plain)
"Symbol")
(cons (canvas-make-font :name "Symbol"
:style :italic)
"Symbol")
(cons (canvas-make-font :name "Symbol"
:style :bold)
"Symbol")
(cons (canvas-make-font :name "Symbol"
:style (list :bold :italic))
"Symbol")
(cons (canvas-make-font :name "Symbol"
:style :outline)
"Symbol /Symbol-Outline MakeOutlinePlainFont~
/Symbol-Outline")
(cons (canvas-make-font :name "Symbol"
:style (list :bold :outline))
"Symbol /Symbol-Outline MakeOutlinePlainFont~
/Symbol-Outline")
(cons (canvas-make-font :name "Symbol"
:style (list :italic :outline))
"Symbol /Symbol-Outline MakeOutlinePlainFont~
/Symbol-Outline")
(cons (canvas-make-font :name "Symbol"
:style (list :bold :italic :outline))
"Symbol /Symbol-Outline~
MakeOutlinePlainFont~
/Symbol-Outline")
(cons (canvas-make-font :name "Zapf Dingbats"
:style :plain)
"Zapf-Dingbats")
(cons (canvas-make-font :name "Zapf Dingbats"
:style :italic)
"Zapf-Dingbats")
(cons (canvas-make-font :name "Zapf Dingbats"
:style :bold)
"Zapf-Dingbats")
(cons (canvas-make-font :name "Zapf Dingbats"
:style (list :bold :italic))
"Zapf-Dingbats")
(cons (canvas-make-font :name "Zapf Dingbats"
:style :outline)
"Zapf-Dingbats /Zapf-Dingbats-Outline MakeOutlinePlainFont~
/Zapf-Dingbats-Outline")
(cons (canvas-make-font :name "Zapf Dingbats"
:style (list :bold :outline))
"Zapf-Dingbats /Zapf-Dingbats-Outline MakeOutlinePlainFont~
/Zapf-Dingbats-Outline")
(cons (canvas-make-font :name "Zapf Dingbats"
:style (list :italic :outline))
"Zapf-Dingbats /Zapf-Dingbats-Outline MakeOutlinePlainFont~
/Zapf-Dingbats-Outline")
(cons (canvas-make-font :name "Zapf Dingbats"
:style (list :bold :italic :outline))
"Zapf-Dingbats /Zapf-Dingbats-Outline~
MakeOutlinePlainFont~
/Zapf-Dingbats-Outline")
(cons (canvas-make-font :name "New Century Schlbk"
:style :plain)
"NewCenturySchlbk-Roman")
(cons (canvas-make-font :name "New Century Schlbk"
:style :italic)
"NewCenturySchlbk-Italic")
(cons (canvas-make-font :name "New Century Schlbk"
:style :bold)
"NewCenturySchlbk-Bold")
(cons (canvas-make-font :name "New Century Schlbk"
:style (list :bold :italic))
"NewCenturySchlbk-BoldItalic")
(cons (canvas-make-font :name "New Century Schlbk"
:style :outline)
"NewCenturySchlbk-Roman /NewCenturySchlbk-Roman-Outline MakeOutlinePlainFont~
/NewCenturySchlbk-Roman-Outline")
(cons (canvas-make-font :name "New Century Schlbk"
:style (list :bold :outline))
"NewCenturySchlbk-Bold /NewCenturySchlbk-Bold-Outline MakeOutlinePlainFont~
/NewCenturySchlbk-Bold-Outline")
(cons (canvas-make-font :name "New Century Schlbk"
:style (list :italic :outline))
"NewCenturySchlbk-Italic /NewCenturySchlbk-Italic-Outline MakeOutlinePlainFont~
/NewCenturySchlbk-Italic-Outline")
(cons (canvas-make-font :name "New Century Schlbk"
:style (list :bold :italic :outline))
"NewCenturySchlbk-BoldItalic /NewCenturySchlbk-BoldItalic-Outline~
MakeOutlinePlainFont~
/NewCenturySchlbk-BoldItalic-Outline")
(cons (canvas-make-font :name "AGaramond"
:style :plain)
"Palatino")
(cons (canvas-make-font :name "AGaramond"
:style :italic)
"Palatino-Italic")
(cons (canvas-make-font :name "AGaramond"
:style :bold)
"Palatino-Bold")
(cons (canvas-make-font :name "AGaramond"
:style (list :bold :italic))
"Palatino-BoldItalic")
(cons (canvas-make-font :name "AGaramond"
:style :outline)
"Palatino /Palatino-Outline MakeOutlinePlainFont~
/Palatino-Outline")
(cons (canvas-make-font :name "AGaramond"
:style (list :bold :outline))
"Palatino-Bold /Palatino-Bold-Outline MakeOutlinePlainFont~
/Palatino-Bold-Outline")
(cons (canvas-make-font :name "AGaramond"
:style (list :italic :outline))
"Palatino-Italic /Palatino-Italic-Outline MakeOutlinePlainFont~
/Palatino-Italic-Outline")
(cons (canvas-make-font :name "AGaramond"
:style (list :bold :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline~
MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "AGaramond Bold"
:style :plain)
"Palatino")
(cons (canvas-make-font :name "AGaramond Bold"
:style :italic)
"Palatino-Italic")
(cons (canvas-make-font :name "AGaramond Bold"
:style :bold)
"Palatino-Bold")
(cons (canvas-make-font :name "AGaramond Bold"
:style (list :bold :italic))
"Palatino-BoldItalic")
(cons (canvas-make-font :name "AGaramond Bold"
:style :outline)
"Palatino /Palatino-Outline MakeOutlinePlainFont~
/Palatino-Outline")
(cons (canvas-make-font :name "AGaramond Bold"
:style (list :bold :outline))
"Palatino-Bold /Palatino-Bold-Outline MakeOutlinePlainFont~
/Palatino-Bold-Outline")
(cons (canvas-make-font :name "AGaramond Bold"
:style (list :italic :outline))
"Palatino-Italic /Palatino-Italic-Outline MakeOutlinePlainFont~
/Palatino-Italic-Outline")
(cons (canvas-make-font :name "AGaramond Bold"
:style (list :bold :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline~
MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "AGaramond BoldItalic"
:style :plain)
"Palatino")
(cons (canvas-make-font :name "AGaramond BoldItalic"
:style :italic)
"Palatino-Italic")
(cons (canvas-make-font :name "AGaramond BoldItalic"
:style :bold)
"Palatino-Bold")
(cons (canvas-make-font :name "AGaramond BoldItalic"
:style (list :bold :italic))
"Palatino-BoldItalic")
(cons (canvas-make-font :name "AGaramond BoldItalic"
:style :outline)
"Palatino /Palatino-Outline MakeOutlinePlainFont~
/Palatino-Outline")
(cons (canvas-make-font :name "AGaramond BoldItalic"
:style (list :bold :outline))
"Palatino-Bold /Palatino-Bold-Outline MakeOutlinePlainFont~
/Palatino-Bold-Outline")
(cons (canvas-make-font :name "AGaramond BoldItalic"
:style (list :italic :outline))
"Palatino-Italic /Palatino-Italic-Outline MakeOutlinePlainFont~
/Palatino-Italic-Outline")
(cons (canvas-make-font :name "AGaramond BoldItalic"
:style (list :bold :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline~
MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "AGaramond Italic"
:style :plain)
"Palatino")
(cons (canvas-make-font :name "AGaramond Italic"
:style :italic)
"Palatino-Italic")
(cons (canvas-make-font :name "AGaramond Italic"
:style :bold)
"Palatino-Bold")
(cons (canvas-make-font :name "AGaramond Italic"
:style (list :bold :italic))
"Palatino-BoldItalic")
(cons (canvas-make-font :name "AGaramond Italic"
:style :outline)
"Palatino /Palatino-Outline MakeOutlinePlainFont~
/Palatino-Outline")
(cons (canvas-make-font :name "AGaramond Italic"
:style (list :bold :outline))
"Palatino-Bold /Palatino-Bold-Outline MakeOutlinePlainFont~
/Palatino-Bold-Outline")
(cons (canvas-make-font :name "AGaramond Italic"
:style (list :italic :outline))
"Palatino-Italic /Palatino-Italic-Outline MakeOutlinePlainFont~
/Palatino-Italic-Outline")
(cons (canvas-make-font :name "AGaramond Italic"
:style (list :bold :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline~
MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "AGaramond Semibold"
:style :plain)
"Palatino")
(cons (canvas-make-font :name "AGaramond Semibold"
:style :italic)
"Palatino-Italic")
(cons (canvas-make-font :name "AGaramond Semibold"
:style :bold)
"Palatino-Bold")
(cons (canvas-make-font :name "AGaramond Semibold"
:style (list :bold :italic))
"Palatino-BoldItalic")
(cons (canvas-make-font :name "AGaramond Semibold"
:style :outline)
"Palatino /Palatino-Outline MakeOutlinePlainFont~
/Palatino-Outline")
(cons (canvas-make-font :name "AGaramond Semibold"
:style (list :bold :outline))
"Palatino-Bold /Palatino-Bold-Outline MakeOutlinePlainFont~
/Palatino-Bold-Outline")
(cons (canvas-make-font :name "AGaramond Semibold"
:style (list :italic :outline))
"Palatino-Italic /Palatino-Italic-Outline MakeOutlinePlainFont~
/Palatino-Italic-Outline")
(cons (canvas-make-font :name "AGaramond Semibold"
:style (list :bold :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline~
MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "AGaramond SemiboldItalic"
:style :plain)
"Palatino")
(cons (canvas-make-font :name "AGaramond SemiboldItalic"
:style :italic)
"Palatino-Italic")
(cons (canvas-make-font :name "AGaramond SemiboldItalic"
:style :bold)
"Palatino-Bold")
(cons (canvas-make-font :name "AGaramond SemiboldItalic"
:style (list :bold :italic))
"Palatino-BoldItalic")
(cons (canvas-make-font :name "AGaramond SemiboldItalic"
:style :outline)
"Palatino /Palatino-Outline MakeOutlinePlainFont~
/Palatino-Outline")
(cons (canvas-make-font :name "AGaramond SemiboldItalic"
:style (list :bold :outline))
"Palatino-Bold /Palatino-Bold-Outline MakeOutlinePlainFont~
/Palatino-Bold-Outline")
(cons (canvas-make-font :name "AGaramond SemiboldItalic"
:style (list :italic :outline))
"Palatino-Italic /Palatino-Italic-Outline MakeOutlinePlainFont~
/Palatino-Italic-Outline")
(cons (canvas-make-font :name "AGaramond SemiboldItalic"
:style (list :bold :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline~
MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "B Garamond Bold"
:style :plain)
"Palatino-Bold")
(cons (canvas-make-font :name "B Garamond Bold"
:style :italic)
"Palatino-BoldItalic")
(cons (canvas-make-font :name "B Garamond Bold"
:style :bold)
"Palatino-Bold")
(cons (canvas-make-font :name "B Garamond Bold"
:style (list :bold :italic))
"Palatino-BoldItalic")
(cons (canvas-make-font :name "B Garamond Bold"
:style :outline)
"Palatino-Bold /Palatino-Bold-Outline MakeOutlinePlainFont~
/Palatino-Bold-Outline")
(cons (canvas-make-font :name "B Garamond Bold"
:style (list :bold :outline))
"Palatino-Bold /Palatino-Bold-Outline MakeOutlinePlainFont~
/Palatino-Bold-Outline")
(cons (canvas-make-font :name "B Garamond Bold"
:style (list :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "B Garamond Bold"
:style (list :bold :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline~
MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "BI Garamond BoldItalic"
:style :plain)
"Palatino-BoldItalic")
(cons (canvas-make-font :name "BI Garamond BoldItalic"
:style :italic)
"Palatino-BoldItalic")
(cons (canvas-make-font :name "BI Garamond BoldItalic"
:style :bold)
"Palatino-BoldItalic")
(cons (canvas-make-font :name "BI Garamond BoldItalic"
:style (list :bold :italic))
"Palatino-BoldItalic")
(cons (canvas-make-font :name "BI Garamond BoldItalic"
:style :outline)
"Palatino-BoldItalic /Palatino-BoldItalic-Outline MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "BI Garamond BoldItalic"
:style (list :bold :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "BI Garamond BoldItalic"
:style (list :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "BI Garamond BoldItalic"
:style (list :bold :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline~
MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "I Garamond LightItalic"
:style :plain)
"Palatino-Italic")
(cons (canvas-make-font :name "I Garamond LightItalic"
:style :italic)
"Palatino-Italic")
(cons (canvas-make-font :name "I Garamond LightItalic"
:style :bold)
"Palatino-BoldItalic")
(cons (canvas-make-font :name "I Garamond LightItalic"
:style (list :bold :italic))
"Palatino-BoldItalic")
(cons (canvas-make-font :name "I Garamond LightItalic"
:style :outline)
"Palatino-Italic /Palatino-Italic-Outline MakeOutlinePlainFont~
/Palatino-Italic-Outline")
(cons (canvas-make-font :name "I Garamond LightItalic"
:style (list :bold :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "I Garamond LightItalic"
:style (list :italic :outline))
"Palatino-Italic /Palatino-Italic-Outline MakeOutlinePlainFont~
/Palatino-Italic-Outline")
(cons (canvas-make-font :name "I Garamond LightItalic"
:style (list :bold :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline~
MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "Garamond"
:style :plain)
"Palatino")
(cons (canvas-make-font :name "Garamond"
:style :italic)
"Palatino-Italic")
(cons (canvas-make-font :name "Garamond"
:style :bold)
"Palatino-Bold")
(cons (canvas-make-font :name "Garamond"
:style (list :bold :italic))
"Palatino-BoldItalic")
(cons (canvas-make-font :name "Garamond"
:style :outline)
"Palatino /Palatino-Outline MakeOutlinePlainFont~
/Palatino-Outline")
(cons (canvas-make-font :name "Garamond"
:style (list :bold :outline))
"Palatino-Bold /Palatino-Bold-Outline MakeOutlinePlainFont~
/Palatino-Bold-Outline")
(cons (canvas-make-font :name "Garamond"
:style (list :italic :outline))
"Palatino-Italic /Palatino-Italic-Outline MakeOutlinePlainFont~
/Palatino-Italic-Outline")
(cons (canvas-make-font :name "Garamond"
:style (list :bold :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline~
MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "Zapf Chancery"
:style :plain)
"Palatino")
(cons (canvas-make-font :name "Zapf Chancery"
:style :italic)
"Palatino-Italic")
(cons (canvas-make-font :name "Zapf Chancery"
:style :bold)
"Palatino-Bold")
(cons (canvas-make-font :name "Zapf Chancery"
:style (list :bold :italic))
"Palatino-BoldItalic")
(cons (canvas-make-font :name "Zapf Chancery"
:style :outline)
"Palatino /Palatino-Outline MakeOutlinePlainFont~
/Palatino-Outline")
(cons (canvas-make-font :name "Zapf Chancery"
:style (list :bold :outline))
"Palatino-Bold /Palatino-Bold-Outline MakeOutlinePlainFont~
/Palatino-Bold-Outline")
(cons (canvas-make-font :name "Zapf Chancery"
:style (list :italic :outline))
"Palatino-Italic /Palatino-Italic-Outline MakeOutlinePlainFont~
/Palatino-Italic-Outline")
(cons (canvas-make-font :name "Zapf Chancery"
:style (list :bold :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline~
MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "Merrion Square"
:style :plain)
"Ugly")
(cons (canvas-make-font :name "Merrion Square"
:style :italic)
"Ugly")
(cons (canvas-make-font :name "Merrion Square"
:style :bold)
"Ugly")
(cons (canvas-make-font :name "Merrion Square"
:style (list :bold :italic))
"Ugly")
(cons (canvas-make-font :name "Merrion Square"
:style :outline)
"Ugly /Ugly-Outline MakeOutlinePlainFont~
/Ugly-Outline")
(cons (canvas-make-font :name "Merrion Square"
:style (list :bold :outline))
"Ugly /Ugly-Outline MakeOutlinePlainFont~
/Ugly-Outline")
(cons (canvas-make-font :name "Merrion Square"
:style (list :italic :outline))
"Ugly /Ugly-Outline MakeOutlinePlainFont~
/Ugly-Outline")
(cons (canvas-make-font :name "Merrion Square"
:style (list :bold :italic :outline))
"Ugly /Ugly-Outline~
MakeOutlinePlainFont~
/Ugly-Outline")
(cons (canvas-make-font :name "Chicago"
:style :plain)
"Times-Roman")
(cons (canvas-make-font :name "Chicago"
:style :italic)
"Times-Italic")
(cons (canvas-make-font :name "Chicago"
:style :bold)
"Times-Bold")
(cons (canvas-make-font :name "Chicago"
:style (list :bold :italic))
"Times-BoldItalic")
(cons (canvas-make-font :name "Chicago"
:style :outline)
"Times-Roman /Times-Roman-Outline MakeOutlinePlainFont~
/Times-Roman-Outline")
(cons (canvas-make-font :name "Chicago"
:style (list :bold :outline))
"Times-Bold /Times-Bold-Outline MakeOutlinePlainFont~
/Times-Bold-Outline")
(cons (canvas-make-font :name "Chicago"
:style (list :italic :outline))
"Times-Italic /Times-Italic-Outline MakeOutlinePlainFont~
/Times-Italic-Outline")
(cons (canvas-make-font :name "Chicago"
:style (list :bold :italic :outline))
"Times-BoldItalic /Times-BoldItalic-Outline~
MakeOutlinePlainFont~
/Times-BoldItalic-Outline")
(cons (canvas-make-font :name "Geneva"
:style :plain)
"AvantGarde")
(cons (canvas-make-font :name "Geneva"
:style :italic)
"AvantGarde-Oblique")
(cons (canvas-make-font :name "Geneva"
:style :bold)
"AvantGarde-Demi")
(cons (canvas-make-font :name "Geneva"
:style (list :bold :italic))
"AvantGarde-DemiOblique")
(cons (canvas-make-font :name "Geneva"
:style :outline)
"AvantGarde /AvantGarde-Outline MakeOutlinePlainFont~
/AvantGarde-Outline")
(cons (canvas-make-font :name "Geneva"
:style (list :bold :outline))
"AvantGarde-Demi /AvantGarde-Demi-Outline MakeOutlinePlainFont~
/AvantGarde-Demi-Outline")
(cons (canvas-make-font :name "Geneva"
:style (list :italic :outline))
"AvantGarde-Oblique /AvantGarde-Oblique-Outline MakeOutlinePlainFont~
/AvantGarde-Oblique-Outline")
(cons (canvas-make-font :name "Geneva"
:style (list :bold :italic :outline))
"AvantGarde-DemiOblique /AvantGarde-DemiOblique-Outline~
MakeOutlinePlainFont~
/AvantGarde-DemiOblique-Outline")
(cons (canvas-make-font :name "Monaco"
:style :plain)
"Times-Roman")
(cons (canvas-make-font :name "Monaco"
:style :italic)
"Times-Italic")
(cons (canvas-make-font :name "Monaco"
:style :bold)
"Times-Bold")
(cons (canvas-make-font :name "Monaco"
:style (list :bold :italic))
"Times-BoldItalic")
(cons (canvas-make-font :name "Monaco"
:style :outline)
"Times-Roman /Times-Roman-Outline MakeOutlinePlainFont~
/Times-Roman-Outline")
(cons (canvas-make-font :name "Monaco"
:style (list :bold :outline))
"Times-Bold /Times-Bold-Outline MakeOutlinePlainFont~
/Times-Bold-Outline")
(cons (canvas-make-font :name "Monaco"
:style (list :italic :outline))
"Times-Italic /Times-Italic-Outline MakeOutlinePlainFont~
/Times-Italic-Outline")
(cons (canvas-make-font :name "Monaco"
:style (list :bold :italic :outline))
"Times-BoldItalic /Times-BoldItalic-Outline~
MakeOutlinePlainFont~
/Times-BoldItalic-Outline")
(cons (canvas-make-font :name "N Helvetica Narrow"
:style :plain)
"Helvetica")
(cons (canvas-make-font :name "N Helvetica Narrow"
:style :italic)
"Helvetica-Oblique")
(cons (canvas-make-font :name "N Helvetica Narrow"
:style :bold)
"Helvetica-Bold")
(cons (canvas-make-font :name "N Helvetica Narrow"
:style (list :bold :italic))
"Helvetica-BoldOblique")
(cons (canvas-make-font :name "N Helvetica Narrow"
:style :outline)
"Helvetica /Helvetica-Outline MakeOutlinePlainFont~
/Helvetica-Outline")
(cons (canvas-make-font :name "N Helvetica Narrow"
:style (list :bold :outline))
"Helvetica-Bold /Helvetica-Bold-Outline MakeOutlinePlainFont~
/Helvetica-Bold-Outline")
(cons (canvas-make-font :name "N Helvetica Narrow"
:style (list :italic :outline))
"Helvetica-Oblique /Helvetica-Oblique-Outline MakeOutlinePlainFont~
/Helvetica-Oblique-Outline")
(cons (canvas-make-font :name "N Helvetica Narrow"
:style (list :bold :italic :outline))
"Helvetica-BoldOblique /Helvetica-BoldOblique-Outline~
MakeOutlinePlainFont~
/Helvetica-BoldOblique-Outline")
(cons (canvas-make-font :name "New York"
:style :plain)
"Times-Roman")
(cons (canvas-make-font :name "New York"
:style :italic)
"Times-Italic")
(cons (canvas-make-font :name "New York"
:style :bold)
"Times-Bold")
(cons (canvas-make-font :name "New York"
:style (list :bold :italic))
"Times-BoldItalic")
(cons (canvas-make-font :name "New York"
:style :outline)
"Times-Roman /Times-Roman-Outline MakeOutlinePlainFont~
/Times-Roman-Outline")
(cons (canvas-make-font :name "New York"
:style (list :bold :outline))
"Times-Bold /Times-Bold-Outline MakeOutlinePlainFont~
/Times-Bold-Outline")
(cons (canvas-make-font :name "New York"
:style (list :italic :outline))
"Times-Italic /Times-Italic-Outline MakeOutlinePlainFont~
/Times-Italic-Outline")
(cons (canvas-make-font :name "New York"
:style (list :bold :italic :outline))
"Times-BoldItalic /Times-BoldItalic-Outline~
MakeOutlinePlainFont~
/Times-BoldItalic-Outline")
"This variable maps the standard Macintosh fonts to the~
standard Postscript fonts."
))
| 41,566 | Common Lisp | .cl | 817 | 32.899633 | 94 | 0.510473 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | e05a53f6a9fa946124b03e5d6d374ba53b164c53d0f3dd6977f3f193d31f0fd0 | 32,823 | [
-1
] |
32,824 | ps-font-mcl.lsp | rwoldford_Quail/source/window-basics/postscript/ps-font-mcl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; ps-font-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; N.G. Bennett 1992
;;; R.W. Oldford 1992
;;;
;;;
;;;----------------------------------------------------------------------------------
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(*canvas-to-ps-font-name*)))
(defun get-ps-font-name (canvas canvas-font)
"Returns the PostScript font name corresponding to the canvas-font."
(declare (special *canvas-to-ps-font-name*))
(when (and (member :outline (canvas-font-style canvas-font))
(not (command-included-p canvas "Outline Font Generation Procedures")))
(toggle-includes canvas "Outline Font Generation Procedures")
(read-write (include-file-of "Outline Font Generation Procedures")
(header-file-of canvas)))
(flet ((sort-style-list (s-l)
(sort (copy-list s-l)
#'(lambda (x y)
(< (position x (canvas-font-styles))
(position y (canvas-font-styles)))))))
(let ((result
(assoc canvas-font *canvas-to-ps-font-name*
:test
#'(lambda (cf key)
(and
(string-equal (canvas-font-name cf)
(canvas-font-name key))
(equal (sort-style-list (canvas-font-style cf))
(sort-style-list (canvas-font-style key))))))))
(if result
(cdr result)
"Ugly"))))
(defun ps-set-canvas-font (canvas font)
(declare (ignore font))
(with-open-file (ofile (body-full-pathname canvas)
:direction :output
:if-exists :append
:if-does-not-exist :create)
(format ofile "~%/~a findfont ~a scalefont setfont~%"
(get-ps-font-name canvas (canvas-font canvas))
(* (canvas-font-size (canvas-font canvas))
(min (ps-x-scale-of canvas) (ps-y-scale-of canvas))))))
(defvar *canvas-to-ps-font-name*
(list
(cons (canvas-make-font :name "Helvetica"
:style :plain)
"Helvetica")
(cons (canvas-make-font :name "Helvetica"
:style :bold)
"Helvetica-Bold")
(cons (canvas-make-font :name "Helvetica"
:style :italic)
"Helvetica-Oblique")
(cons (canvas-make-font :name "Helvetica"
:style (list :bold :italic))
"Helvetica-BoldOblique")
(cons (canvas-make-font :name "Helvetica"
:style :outline)
"Helvetica /Helvetica-Outline MakeOutlinePlainFont~
/Helvetica-Outline")
(cons (canvas-make-font :name "Helvetica"
:style (list :bold :outline))
"Helvetica-Bold /Helvetica-Bold-Outline MakeOutlinePlainFont~
/Helvetica-Bold-Outline")
(cons (canvas-make-font :name "Helvetica"
:style (list :italic :outline))
"Helvetica-Oblique /Helvetica-Oblique-Outline MakeOutlinePlainFont~
/Helvetica-Oblique-Outline")
(cons (canvas-make-font :name "Helvetica"
:style (list :bold :italic :outline))
"Helvetica-BoldOblique /Helvetica-BoldOblique-Outline~
MakeOutlinePlainFont~
/Helvetica-BoldOblique-Outline")
(cons (canvas-make-font :name "Avant Garde"
:style :plain)
"AvantGarde-Book")
(cons (canvas-make-font :name "Avant Garde"
:style :italic)
"AvantGarde-BookOblique")
(cons (canvas-make-font :name "Avant Garde"
:style :bold)
"AvantGarde-Demi")
(cons (canvas-make-font :name "Avant Garde"
:style (list :bold :italic))
"AvantGarde-DemiOblique")
(cons (canvas-make-font :name "Avant Garde"
:style :outline)
"AvantGarde-Book /AvantGarde-Book-Outline MakeOutlinePlainFont~
/AvantGarde-Book-Outline")
(cons (canvas-make-font :name "Avant Garde"
:style (list :bold :outline))
"AvantGarde-Demi /AvantGarde-Demi-Outline MakeOutlinePlainFont~
/AvantGarde-Demi-Outline")
(cons (canvas-make-font :name "Avant Garde"
:style (list :italic :outline))
"AvantGarde-BookOblique /AvantGarde-BookOblique-Outline MakeOutlinePlainFont~
/AvantGarde-BookOblique-Outline")
(cons (canvas-make-font :name "Avant Garde"
:style (list :bold :italic :outline))
"AvantGarde-DemiOblique /AvantGarde-DemiOblique-Outline~
MakeOutlinePlainFont~
/AvantGarde-DemiOblique-Outline")
(cons (canvas-make-font :name "Bookman"
:style :plain)
"Bookman-Light")
(cons (canvas-make-font :name "Bookman"
:style :italic)
"Bookman-LightItalic")
(cons (canvas-make-font :name "Bookman"
:style :bold)
"Bookman-Demi")
(cons (canvas-make-font :name "Bookman"
:style (list :bold :italic))
"Bookman-DemiItalic")
(cons (canvas-make-font :name "Bookman"
:style :outline)
"Bookman-Light /Bookman-Light-Outline MakeOutlinePlainFont~
/Bookman-Light-Outline")
(cons (canvas-make-font :name "Bookman"
:style (list :bold :outline))
"Bookman-Demi /Bookman-Demi-Outline MakeOutlinePlainFont~
/Bookman-Demi-Outline")
(cons (canvas-make-font :name "Bookman"
:style (list :italic :outline))
"Bookman-LightItalic /Bookman-LightItalic-Outline MakeOutlinePlainFont~
/Bookman-LightItalic-Outline")
(cons (canvas-make-font :name "Bookman"
:style (list :bold :italic :outline))
"Bookman-DemiItalic /Bookman-DemiItalic-Outline~
MakeOutlinePlainFont~
/Bookman-DemiItalic-Outline")
(cons (canvas-make-font :name "Courier"
:style :plain)
"Courier")
(cons (canvas-make-font :name "Courier"
:style :italic)
"Courier-Oblique")
(cons (canvas-make-font :name "Courier"
:style :bold)
"Courier-Bold")
(cons (canvas-make-font :name "Courier"
:style (list :bold :italic))
"Courier-BoldOblique")
(cons (canvas-make-font :name "Courier"
:style :outline)
"Courier /Courier-Outline MakeOutlinePlainFont~
/Courier-Outline")
(cons (canvas-make-font :name "Courier"
:style (list :bold :outline))
"Courier-Bold /Courier-Bold-Outline MakeOutlinePlainFont~
/Courier-Bold-Outline")
(cons (canvas-make-font :name "Courier"
:style (list :italic :outline))
"Courier-Oblique /Courier-Oblique-Outline MakeOutlinePlainFont~
/Courier-Oblique-Outline")
(cons (canvas-make-font :name "Courier"
:style (list :bold :italic :outline))
"Courier-BoldOblique /Courier-BoldOblique-Outline~
MakeOutlinePlainFont~
/Courier-BoldOblique-Outline")
(cons (canvas-make-font :name "Palatino"
:style :plain)
"Palatino-Roman")
(cons (canvas-make-font :name "Palatino"
:style :italic)
"Palatino-Italic")
(cons (canvas-make-font :name "Palatino"
:style :bold)
"Palatino-Bold")
(cons (canvas-make-font :name "Palatino"
:style (list :bold :italic))
"Palatino-BoldItalic")
(cons (canvas-make-font :name "Palatino"
:style :outline)
"Palatino-Roman /Palatino-Roman-Outline MakeOutlinePlainFont~
/Palatino-Roman-Outline")
(cons (canvas-make-font :name "Palatino"
:style (list :bold :outline))
"Palatino-Bold /Palatino-Bold-Outline MakeOutlinePlainFont~
/Palatino-Bold-Outline")
(cons (canvas-make-font :name "Palatino"
:style (list :italic :outline))
"Palatino-Italic-Outline /Palatino-Italic-Outline MakeOutlinePlainFont~
/Palatino-Italic-Outline")
(cons (canvas-make-font :name "Palatino"
:style (list :bold :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline~
MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "Times"
:style :plain)
"Times-Roman")
(cons (canvas-make-font :name "Times"
:style :italic)
"Times-Italic")
(cons (canvas-make-font :name "Times"
:style :bold)
"Times-Bold")
(cons (canvas-make-font :name "Times"
:style (list :bold :italic))
"Times-BoldItalic")
(cons (canvas-make-font :name "Times"
:style :outline)
"Times-Roman /Times-Roman-Outline MakeOutlinePlainFont~
/Times-Roman-Outline")
(cons (canvas-make-font :name "Times"
:style (list :bold :outline))
"Times-Bold /Times-Bold-Outline MakeOutlinePlainFont~
/Times-Bold-Outline")
(cons (canvas-make-font :name "Times"
:style (list :italic :outline))
"Times-Italic /Times-Italic-Outline MakeOutlinePlainFont~
/Times-Italic-Outline")
(cons (canvas-make-font :name "Times"
:style (list :bold :italic :outline))
"Times-BoldItalic /Times-BoldItalic-Outline~
MakeOutlinePlainFont~
/Times-BoldItalic-Outline")
(cons (canvas-make-font :name "Symbol"
:style :plain)
"Symbol")
(cons (canvas-make-font :name "Symbol"
:style :italic)
"Symbol")
(cons (canvas-make-font :name "Symbol"
:style :bold)
"Symbol")
(cons (canvas-make-font :name "Symbol"
:style (list :bold :italic))
"Symbol")
(cons (canvas-make-font :name "Symbol"
:style :outline)
"Symbol /Symbol-Outline MakeOutlinePlainFont~
/Symbol-Outline")
(cons (canvas-make-font :name "Symbol"
:style (list :bold :outline))
"Symbol /Symbol-Outline MakeOutlinePlainFont~
/Symbol-Outline")
(cons (canvas-make-font :name "Symbol"
:style (list :italic :outline))
"Symbol /Symbol-Outline MakeOutlinePlainFont~
/Symbol-Outline")
(cons (canvas-make-font :name "Symbol"
:style (list :bold :italic :outline))
"Symbol /Symbol-Outline~
MakeOutlinePlainFont~
/Symbol-Outline")
(cons (canvas-make-font :name "Zapf Dingbats"
:style :plain)
"Zapf-Dingbats")
(cons (canvas-make-font :name "Zapf Dingbats"
:style :italic)
"Zapf-Dingbats")
(cons (canvas-make-font :name "Zapf Dingbats"
:style :bold)
"Zapf-Dingbats")
(cons (canvas-make-font :name "Zapf Dingbats"
:style (list :bold :italic))
"Zapf-Dingbats")
(cons (canvas-make-font :name "Zapf Dingbats"
:style :outline)
"Zapf-Dingbats /Zapf-Dingbats-Outline MakeOutlinePlainFont~
/Zapf-Dingbats-Outline")
(cons (canvas-make-font :name "Zapf Dingbats"
:style (list :bold :outline))
"Zapf-Dingbats /Zapf-Dingbats-Outline MakeOutlinePlainFont~
/Zapf-Dingbats-Outline")
(cons (canvas-make-font :name "Zapf Dingbats"
:style (list :italic :outline))
"Zapf-Dingbats /Zapf-Dingbats-Outline MakeOutlinePlainFont~
/Zapf-Dingbats-Outline")
(cons (canvas-make-font :name "Zapf Dingbats"
:style (list :bold :italic :outline))
"Zapf-Dingbats /Zapf-Dingbats-Outline~
MakeOutlinePlainFont~
/Zapf-Dingbats-Outline")
(cons (canvas-make-font :name "New Century Schlbk"
:style :plain)
"NewCenturySchlbk-Roman")
(cons (canvas-make-font :name "New Century Schlbk"
:style :italic)
"NewCenturySchlbk-Italic")
(cons (canvas-make-font :name "New Century Schlbk"
:style :bold)
"NewCenturySchlbk-Bold")
(cons (canvas-make-font :name "New Century Schlbk"
:style (list :bold :italic))
"NewCenturySchlbk-BoldItalic")
(cons (canvas-make-font :name "New Century Schlbk"
:style :outline)
"NewCenturySchlbk-Roman /NewCenturySchlbk-Roman-Outline MakeOutlinePlainFont~
/NewCenturySchlbk-Roman-Outline")
(cons (canvas-make-font :name "New Century Schlbk"
:style (list :bold :outline))
"NewCenturySchlbk-Bold /NewCenturySchlbk-Bold-Outline MakeOutlinePlainFont~
/NewCenturySchlbk-Bold-Outline")
(cons (canvas-make-font :name "New Century Schlbk"
:style (list :italic :outline))
"NewCenturySchlbk-Italic /NewCenturySchlbk-Italic-Outline MakeOutlinePlainFont~
/NewCenturySchlbk-Italic-Outline")
(cons (canvas-make-font :name "New Century Schlbk"
:style (list :bold :italic :outline))
"NewCenturySchlbk-BoldItalic /NewCenturySchlbk-BoldItalic-Outline~
MakeOutlinePlainFont~
/NewCenturySchlbk-BoldItalic-Outline")
(cons (canvas-make-font :name "AGaramond"
:style :plain)
"Palatino")
(cons (canvas-make-font :name "AGaramond"
:style :italic)
"Palatino-Italic")
(cons (canvas-make-font :name "AGaramond"
:style :bold)
"Palatino-Bold")
(cons (canvas-make-font :name "AGaramond"
:style (list :bold :italic))
"Palatino-BoldItalic")
(cons (canvas-make-font :name "AGaramond"
:style :outline)
"Palatino /Palatino-Outline MakeOutlinePlainFont~
/Palatino-Outline")
(cons (canvas-make-font :name "AGaramond"
:style (list :bold :outline))
"Palatino-Bold /Palatino-Bold-Outline MakeOutlinePlainFont~
/Palatino-Bold-Outline")
(cons (canvas-make-font :name "AGaramond"
:style (list :italic :outline))
"Palatino-Italic /Palatino-Italic-Outline MakeOutlinePlainFont~
/Palatino-Italic-Outline")
(cons (canvas-make-font :name "AGaramond"
:style (list :bold :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline~
MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "AGaramond Bold"
:style :plain)
"Palatino")
(cons (canvas-make-font :name "AGaramond Bold"
:style :italic)
"Palatino-Italic")
(cons (canvas-make-font :name "AGaramond Bold"
:style :bold)
"Palatino-Bold")
(cons (canvas-make-font :name "AGaramond Bold"
:style (list :bold :italic))
"Palatino-BoldItalic")
(cons (canvas-make-font :name "AGaramond Bold"
:style :outline)
"Palatino /Palatino-Outline MakeOutlinePlainFont~
/Palatino-Outline")
(cons (canvas-make-font :name "AGaramond Bold"
:style (list :bold :outline))
"Palatino-Bold /Palatino-Bold-Outline MakeOutlinePlainFont~
/Palatino-Bold-Outline")
(cons (canvas-make-font :name "AGaramond Bold"
:style (list :italic :outline))
"Palatino-Italic /Palatino-Italic-Outline MakeOutlinePlainFont~
/Palatino-Italic-Outline")
(cons (canvas-make-font :name "AGaramond Bold"
:style (list :bold :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline~
MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "AGaramond BoldItalic"
:style :plain)
"Palatino")
(cons (canvas-make-font :name "AGaramond BoldItalic"
:style :italic)
"Palatino-Italic")
(cons (canvas-make-font :name "AGaramond BoldItalic"
:style :bold)
"Palatino-Bold")
(cons (canvas-make-font :name "AGaramond BoldItalic"
:style (list :bold :italic))
"Palatino-BoldItalic")
(cons (canvas-make-font :name "AGaramond BoldItalic"
:style :outline)
"Palatino /Palatino-Outline MakeOutlinePlainFont~
/Palatino-Outline")
(cons (canvas-make-font :name "AGaramond BoldItalic"
:style (list :bold :outline))
"Palatino-Bold /Palatino-Bold-Outline MakeOutlinePlainFont~
/Palatino-Bold-Outline")
(cons (canvas-make-font :name "AGaramond BoldItalic"
:style (list :italic :outline))
"Palatino-Italic /Palatino-Italic-Outline MakeOutlinePlainFont~
/Palatino-Italic-Outline")
(cons (canvas-make-font :name "AGaramond BoldItalic"
:style (list :bold :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline~
MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "AGaramond Italic"
:style :plain)
"Palatino")
(cons (canvas-make-font :name "AGaramond Italic"
:style :italic)
"Palatino-Italic")
(cons (canvas-make-font :name "AGaramond Italic"
:style :bold)
"Palatino-Bold")
(cons (canvas-make-font :name "AGaramond Italic"
:style (list :bold :italic))
"Palatino-BoldItalic")
(cons (canvas-make-font :name "AGaramond Italic"
:style :outline)
"Palatino /Palatino-Outline MakeOutlinePlainFont~
/Palatino-Outline")
(cons (canvas-make-font :name "AGaramond Italic"
:style (list :bold :outline))
"Palatino-Bold /Palatino-Bold-Outline MakeOutlinePlainFont~
/Palatino-Bold-Outline")
(cons (canvas-make-font :name "AGaramond Italic"
:style (list :italic :outline))
"Palatino-Italic /Palatino-Italic-Outline MakeOutlinePlainFont~
/Palatino-Italic-Outline")
(cons (canvas-make-font :name "AGaramond Italic"
:style (list :bold :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline~
MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "AGaramond Semibold"
:style :plain)
"Palatino")
(cons (canvas-make-font :name "AGaramond Semibold"
:style :italic)
"Palatino-Italic")
(cons (canvas-make-font :name "AGaramond Semibold"
:style :bold)
"Palatino-Bold")
(cons (canvas-make-font :name "AGaramond Semibold"
:style (list :bold :italic))
"Palatino-BoldItalic")
(cons (canvas-make-font :name "AGaramond Semibold"
:style :outline)
"Palatino /Palatino-Outline MakeOutlinePlainFont~
/Palatino-Outline")
(cons (canvas-make-font :name "AGaramond Semibold"
:style (list :bold :outline))
"Palatino-Bold /Palatino-Bold-Outline MakeOutlinePlainFont~
/Palatino-Bold-Outline")
(cons (canvas-make-font :name "AGaramond Semibold"
:style (list :italic :outline))
"Palatino-Italic /Palatino-Italic-Outline MakeOutlinePlainFont~
/Palatino-Italic-Outline")
(cons (canvas-make-font :name "AGaramond Semibold"
:style (list :bold :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline~
MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "AGaramond SemiboldItalic"
:style :plain)
"Palatino")
(cons (canvas-make-font :name "AGaramond SemiboldItalic"
:style :italic)
"Palatino-Italic")
(cons (canvas-make-font :name "AGaramond SemiboldItalic"
:style :bold)
"Palatino-Bold")
(cons (canvas-make-font :name "AGaramond SemiboldItalic"
:style (list :bold :italic))
"Palatino-BoldItalic")
(cons (canvas-make-font :name "AGaramond SemiboldItalic"
:style :outline)
"Palatino /Palatino-Outline MakeOutlinePlainFont~
/Palatino-Outline")
(cons (canvas-make-font :name "AGaramond SemiboldItalic"
:style (list :bold :outline))
"Palatino-Bold /Palatino-Bold-Outline MakeOutlinePlainFont~
/Palatino-Bold-Outline")
(cons (canvas-make-font :name "AGaramond SemiboldItalic"
:style (list :italic :outline))
"Palatino-Italic /Palatino-Italic-Outline MakeOutlinePlainFont~
/Palatino-Italic-Outline")
(cons (canvas-make-font :name "AGaramond SemiboldItalic"
:style (list :bold :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline~
MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "B Garamond Bold"
:style :plain)
"Palatino-Bold")
(cons (canvas-make-font :name "B Garamond Bold"
:style :italic)
"Palatino-BoldItalic")
(cons (canvas-make-font :name "B Garamond Bold"
:style :bold)
"Palatino-Bold")
(cons (canvas-make-font :name "B Garamond Bold"
:style (list :bold :italic))
"Palatino-BoldItalic")
(cons (canvas-make-font :name "B Garamond Bold"
:style :outline)
"Palatino-Bold /Palatino-Bold-Outline MakeOutlinePlainFont~
/Palatino-Bold-Outline")
(cons (canvas-make-font :name "B Garamond Bold"
:style (list :bold :outline))
"Palatino-Bold /Palatino-Bold-Outline MakeOutlinePlainFont~
/Palatino-Bold-Outline")
(cons (canvas-make-font :name "B Garamond Bold"
:style (list :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "B Garamond Bold"
:style (list :bold :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline~
MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "BI Garamond BoldItalic"
:style :plain)
"Palatino-BoldItalic")
(cons (canvas-make-font :name "BI Garamond BoldItalic"
:style :italic)
"Palatino-BoldItalic")
(cons (canvas-make-font :name "BI Garamond BoldItalic"
:style :bold)
"Palatino-BoldItalic")
(cons (canvas-make-font :name "BI Garamond BoldItalic"
:style (list :bold :italic))
"Palatino-BoldItalic")
(cons (canvas-make-font :name "BI Garamond BoldItalic"
:style :outline)
"Palatino-BoldItalic /Palatino-BoldItalic-Outline MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "BI Garamond BoldItalic"
:style (list :bold :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "BI Garamond BoldItalic"
:style (list :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "BI Garamond BoldItalic"
:style (list :bold :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline~
MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "I Garamond LightItalic"
:style :plain)
"Palatino-Italic")
(cons (canvas-make-font :name "I Garamond LightItalic"
:style :italic)
"Palatino-Italic")
(cons (canvas-make-font :name "I Garamond LightItalic"
:style :bold)
"Palatino-BoldItalic")
(cons (canvas-make-font :name "I Garamond LightItalic"
:style (list :bold :italic))
"Palatino-BoldItalic")
(cons (canvas-make-font :name "I Garamond LightItalic"
:style :outline)
"Palatino-Italic /Palatino-Italic-Outline MakeOutlinePlainFont~
/Palatino-Italic-Outline")
(cons (canvas-make-font :name "I Garamond LightItalic"
:style (list :bold :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "I Garamond LightItalic"
:style (list :italic :outline))
"Palatino-Italic /Palatino-Italic-Outline MakeOutlinePlainFont~
/Palatino-Italic-Outline")
(cons (canvas-make-font :name "I Garamond LightItalic"
:style (list :bold :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline~
MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "Garamond"
:style :plain)
"Palatino")
(cons (canvas-make-font :name "Garamond"
:style :italic)
"Palatino-Italic")
(cons (canvas-make-font :name "Garamond"
:style :bold)
"Palatino-Bold")
(cons (canvas-make-font :name "Garamond"
:style (list :bold :italic))
"Palatino-BoldItalic")
(cons (canvas-make-font :name "Garamond"
:style :outline)
"Palatino /Palatino-Outline MakeOutlinePlainFont~
/Palatino-Outline")
(cons (canvas-make-font :name "Garamond"
:style (list :bold :outline))
"Palatino-Bold /Palatino-Bold-Outline MakeOutlinePlainFont~
/Palatino-Bold-Outline")
(cons (canvas-make-font :name "Garamond"
:style (list :italic :outline))
"Palatino-Italic /Palatino-Italic-Outline MakeOutlinePlainFont~
/Palatino-Italic-Outline")
(cons (canvas-make-font :name "Garamond"
:style (list :bold :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline~
MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "Zapf Chancery"
:style :plain)
"Palatino")
(cons (canvas-make-font :name "Zapf Chancery"
:style :italic)
"Palatino-Italic")
(cons (canvas-make-font :name "Zapf Chancery"
:style :bold)
"Palatino-Bold")
(cons (canvas-make-font :name "Zapf Chancery"
:style (list :bold :italic))
"Palatino-BoldItalic")
(cons (canvas-make-font :name "Zapf Chancery"
:style :outline)
"Palatino /Palatino-Outline MakeOutlinePlainFont~
/Palatino-Outline")
(cons (canvas-make-font :name "Zapf Chancery"
:style (list :bold :outline))
"Palatino-Bold /Palatino-Bold-Outline MakeOutlinePlainFont~
/Palatino-Bold-Outline")
(cons (canvas-make-font :name "Zapf Chancery"
:style (list :italic :outline))
"Palatino-Italic /Palatino-Italic-Outline MakeOutlinePlainFont~
/Palatino-Italic-Outline")
(cons (canvas-make-font :name "Zapf Chancery"
:style (list :bold :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline~
MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "Merrion Square"
:style :plain)
"Ugly")
(cons (canvas-make-font :name "Merrion Square"
:style :italic)
"Ugly")
(cons (canvas-make-font :name "Merrion Square"
:style :bold)
"Ugly")
(cons (canvas-make-font :name "Merrion Square"
:style (list :bold :italic))
"Ugly")
(cons (canvas-make-font :name "Merrion Square"
:style :outline)
"Ugly /Ugly-Outline MakeOutlinePlainFont~
/Ugly-Outline")
(cons (canvas-make-font :name "Merrion Square"
:style (list :bold :outline))
"Ugly /Ugly-Outline MakeOutlinePlainFont~
/Ugly-Outline")
(cons (canvas-make-font :name "Merrion Square"
:style (list :italic :outline))
"Ugly /Ugly-Outline MakeOutlinePlainFont~
/Ugly-Outline")
(cons (canvas-make-font :name "Merrion Square"
:style (list :bold :italic :outline))
"Ugly /Ugly-Outline~
MakeOutlinePlainFont~
/Ugly-Outline")
(cons (canvas-make-font :name "Chicago"
:style :plain)
"Times-Roman")
(cons (canvas-make-font :name "Chicago"
:style :italic)
"Times-Italic")
(cons (canvas-make-font :name "Chicago"
:style :bold)
"Times-Bold")
(cons (canvas-make-font :name "Chicago"
:style (list :bold :italic))
"Times-BoldItalic")
(cons (canvas-make-font :name "Chicago"
:style :outline)
"Times-Roman /Times-Roman-Outline MakeOutlinePlainFont~
/Times-Roman-Outline")
(cons (canvas-make-font :name "Chicago"
:style (list :bold :outline))
"Times-Bold /Times-Bold-Outline MakeOutlinePlainFont~
/Times-Bold-Outline")
(cons (canvas-make-font :name "Chicago"
:style (list :italic :outline))
"Times-Italic /Times-Italic-Outline MakeOutlinePlainFont~
/Times-Italic-Outline")
(cons (canvas-make-font :name "Chicago"
:style (list :bold :italic :outline))
"Times-BoldItalic /Times-BoldItalic-Outline~
MakeOutlinePlainFont~
/Times-BoldItalic-Outline")
(cons (canvas-make-font :name "Geneva"
:style :plain)
"AvantGarde")
(cons (canvas-make-font :name "Geneva"
:style :italic)
"AvantGarde-Oblique")
(cons (canvas-make-font :name "Geneva"
:style :bold)
"AvantGarde-Demi")
(cons (canvas-make-font :name "Geneva"
:style (list :bold :italic))
"AvantGarde-DemiOblique")
(cons (canvas-make-font :name "Geneva"
:style :outline)
"AvantGarde /AvantGarde-Outline MakeOutlinePlainFont~
/AvantGarde-Outline")
(cons (canvas-make-font :name "Geneva"
:style (list :bold :outline))
"AvantGarde-Demi /AvantGarde-Demi-Outline MakeOutlinePlainFont~
/AvantGarde-Demi-Outline")
(cons (canvas-make-font :name "Geneva"
:style (list :italic :outline))
"AvantGarde-Oblique /AvantGarde-Oblique-Outline MakeOutlinePlainFont~
/AvantGarde-Oblique-Outline")
(cons (canvas-make-font :name "Geneva"
:style (list :bold :italic :outline))
"AvantGarde-DemiOblique /AvantGarde-DemiOblique-Outline~
MakeOutlinePlainFont~
/AvantGarde-DemiOblique-Outline")
(cons (canvas-make-font :name "Monaco"
:style :plain)
"Times-Roman")
(cons (canvas-make-font :name "Monaco"
:style :italic)
"Times-Italic")
(cons (canvas-make-font :name "Monaco"
:style :bold)
"Times-Bold")
(cons (canvas-make-font :name "Monaco"
:style (list :bold :italic))
"Times-BoldItalic")
(cons (canvas-make-font :name "Monaco"
:style :outline)
"Times-Roman /Times-Roman-Outline MakeOutlinePlainFont~
/Times-Roman-Outline")
(cons (canvas-make-font :name "Monaco"
:style (list :bold :outline))
"Times-Bold /Times-Bold-Outline MakeOutlinePlainFont~
/Times-Bold-Outline")
(cons (canvas-make-font :name "Monaco"
:style (list :italic :outline))
"Times-Italic /Times-Italic-Outline MakeOutlinePlainFont~
/Times-Italic-Outline")
(cons (canvas-make-font :name "Monaco"
:style (list :bold :italic :outline))
"Times-BoldItalic /Times-BoldItalic-Outline~
MakeOutlinePlainFont~
/Times-BoldItalic-Outline")
(cons (canvas-make-font :name "N Helvetica Narrow"
:style :plain)
"Helvetica")
(cons (canvas-make-font :name "N Helvetica Narrow"
:style :italic)
"Helvetica-Oblique")
(cons (canvas-make-font :name "N Helvetica Narrow"
:style :bold)
"Helvetica-Bold")
(cons (canvas-make-font :name "N Helvetica Narrow"
:style (list :bold :italic))
"Helvetica-BoldOblique")
(cons (canvas-make-font :name "N Helvetica Narrow"
:style :outline)
"Helvetica /Helvetica-Outline MakeOutlinePlainFont~
/Helvetica-Outline")
(cons (canvas-make-font :name "N Helvetica Narrow"
:style (list :bold :outline))
"Helvetica-Bold /Helvetica-Bold-Outline MakeOutlinePlainFont~
/Helvetica-Bold-Outline")
(cons (canvas-make-font :name "N Helvetica Narrow"
:style (list :italic :outline))
"Helvetica-Oblique /Helvetica-Oblique-Outline MakeOutlinePlainFont~
/Helvetica-Oblique-Outline")
(cons (canvas-make-font :name "N Helvetica Narrow"
:style (list :bold :italic :outline))
"Helvetica-BoldOblique /Helvetica-BoldOblique-Outline~
MakeOutlinePlainFont~
/Helvetica-BoldOblique-Outline")
(cons (canvas-make-font :name "New York"
:style :plain)
"Times-Roman")
(cons (canvas-make-font :name "New York"
:style :italic)
"Times-Italic")
(cons (canvas-make-font :name "New York"
:style :bold)
"Times-Bold")
(cons (canvas-make-font :name "New York"
:style (list :bold :italic))
"Times-BoldItalic")
(cons (canvas-make-font :name "New York"
:style :outline)
"Times-Roman /Times-Roman-Outline MakeOutlinePlainFont~
/Times-Roman-Outline")
(cons (canvas-make-font :name "New York"
:style (list :bold :outline))
"Times-Bold /Times-Bold-Outline MakeOutlinePlainFont~
/Times-Bold-Outline")
(cons (canvas-make-font :name "New York"
:style (list :italic :outline))
"Times-Italic /Times-Italic-Outline MakeOutlinePlainFont~
/Times-Italic-Outline")
(cons (canvas-make-font :name "New York"
:style (list :bold :italic :outline))
"Times-BoldItalic /Times-BoldItalic-Outline~
MakeOutlinePlainFont~
/Times-BoldItalic-Outline")
)
"This variable maps the standard Macintosh fonts to the~
standard Postscript fonts."
)
| 41,591 | Common Lisp | .cl | 818 | 32.92176 | 94 | 0.511254 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 74153924e5a3f6e46239ad44e57541c00e546c6dfd3a3460d40ca8c3bc6c615d | 32,824 | [
-1
] |
32,825 | ps-font-clx.lsp | rwoldford_Quail/source/window-basics/postscript/ps-font-clx.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; ps-font-clx.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; N.G. Bennett 1992
;;; R.W. Oldford 1992
;;;
;;;
;;;----------------------------------------------------------------------------------
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(*canvas-to-ps-font-name*)))
(defun get-ps-font-name (canvas canvas-font)
"Returns the PostScript font name corresponding to the canvas-font."
(declare (special *canvas-to-ps-font-name*))
(when (and (member :outline (canvas-font-style canvas-font))
(not (command-included-p canvas "Outline Font Generation Procedures")))
(toggle-includes canvas "Outline Font Generation Procedures")
(read-write (include-file-of "Outline Font Generation Procedures")
(header-file-of canvas)))
(flet ((sort-style-list (s-l)
(sort (copy-list s-l)
#'(lambda (x y)
(< (position x (canvas-font-styles))
(position y (canvas-font-styles)))))))
(let ((result
(assoc canvas-font *canvas-to-ps-font-name*
:test
#'(lambda (cf key)
(and
(string-equal (canvas-font-name cf)
(canvas-font-name key))
(equal (sort-style-list (canvas-font-style cf))
(sort-style-list (canvas-font-style key))))))))
(if result
(cdr result)
"Ugly"))))
(defun ps-set-canvas-font (canvas font)
(with-open-file (ofile (body-full-pathname canvas)
:direction :output
:if-exists :append
:if-does-not-exist :create)
(format ofile "~%/~a findfont ~a scalefont setfont~%"
(get-ps-font-name canvas font)
(* 0.5
(canvas-font-size font)
(+ (ps-x-scale-of canvas)
(ps-y-scale-of canvas))))))
(defvar *canvas-to-ps-font-name*
(list
(cons (canvas-make-font :name "Helvetica"
:style :plain)
"Helvetica")
(cons (canvas-make-font :name "Helvetica"
:style :bold)
"Helvetica-Bold")
(cons (canvas-make-font :name "Helvetica"
:style :italic)
"Helvetica-Oblique")
(cons (canvas-make-font :name "Helvetica"
:style (list :bold :italic))
"Helvetica-BoldOblique")
(cons (canvas-make-font :name "Helvetica"
:style :outline)
"Helvetica /Helvetica-Outline MakeOutlinePlainFont~
/Helvetica-Outline")
(cons (canvas-make-font :name "Helvetica"
:style (list :bold :outline))
"Helvetica-Bold /Helvetica-Bold-Outline MakeOutlinePlainFont~
/Helvetica-Bold-Outline")
(cons (canvas-make-font :name "Helvetica"
:style (list :italic :outline))
"Helvetica-Oblique /Helvetica-Oblique-Outline MakeOutlinePlainFont~
/Helvetica-Oblique-Outline")
(cons (canvas-make-font :name "Helvetica"
:style (list :bold :italic :outline))
"Helvetica-BoldOblique /Helvetica-BoldOblique-Outline~
MakeOutlinePlainFont~
/Helvetica-BoldOblique-Outline")
(cons (canvas-make-font :name "Avant Garde"
:style :plain)
"AvantGarde-Book")
(cons (canvas-make-font :name "Avant Garde"
:style :italic)
"AvantGarde-BookOblique")
(cons (canvas-make-font :name "Avant Garde"
:style :bold)
"AvantGarde-Demi")
(cons (canvas-make-font :name "Avant Garde"
:style (list :bold :italic))
"AvantGarde-DemiOblique")
(cons (canvas-make-font :name "Avant Garde"
:style :outline)
"AvantGarde-Book /AvantGarde-Book-Outline MakeOutlinePlainFont~
/AvantGarde-Book-Outline")
(cons (canvas-make-font :name "Avant Garde"
:style (list :bold :outline))
"AvantGarde-Demi /AvantGarde-Demi-Outline MakeOutlinePlainFont~
/AvantGarde-Demi-Outline")
(cons (canvas-make-font :name "Avant Garde"
:style (list :italic :outline))
"AvantGarde-BookOblique /AvantGarde-BookOblique-Outline MakeOutlinePlainFont~
/AvantGarde-BookOblique-Outline")
(cons (canvas-make-font :name "Avant Garde"
:style (list :bold :italic :outline))
"AvantGarde-DemiOblique /AvantGarde-DemiOblique-Outline~
MakeOutlinePlainFont~
/AvantGarde-DemiOblique-Outline")
(cons (canvas-make-font :name "Bookman"
:style :plain)
"Bookman-Light")
(cons (canvas-make-font :name "Bookman"
:style :italic)
"Bookman-LightItalic")
(cons (canvas-make-font :name "Bookman"
:style :bold)
"Bookman-Demi")
(cons (canvas-make-font :name "Bookman"
:style (list :bold :italic))
"Bookman-DemiItalic")
(cons (canvas-make-font :name "Bookman"
:style :outline)
"Bookman-Light /Bookman-Light-Outline MakeOutlinePlainFont~
/Bookman-Light-Outline")
(cons (canvas-make-font :name "Bookman"
:style (list :bold :outline))
"Bookman-Demi /Bookman-Demi-Outline MakeOutlinePlainFont~
/Bookman-Demi-Outline")
(cons (canvas-make-font :name "Bookman"
:style (list :italic :outline))
"Bookman-LightItalic /Bookman-LightItalic-Outline MakeOutlinePlainFont~
/Bookman-LightItalic-Outline")
(cons (canvas-make-font :name "Bookman"
:style (list :bold :italic :outline))
"Bookman-DemiItalic /Bookman-DemiItalic-Outline~
MakeOutlinePlainFont~
/Bookman-DemiItalic-Outline")
(cons (canvas-make-font :name "Courier"
:style :plain)
"Courier")
(cons (canvas-make-font :name "Courier"
:style :italic)
"Courier-Oblique")
(cons (canvas-make-font :name "Courier"
:style :bold)
"Courier-Bold")
(cons (canvas-make-font :name "Courier"
:style (list :bold :italic))
"Courier-BoldOblique")
(cons (canvas-make-font :name "Courier"
:style :outline)
"Courier /Courier-Outline MakeOutlinePlainFont~
/Courier-Outline")
(cons (canvas-make-font :name "Courier"
:style (list :bold :outline))
"Courier-Bold /Courier-Bold-Outline MakeOutlinePlainFont~
/Courier-Bold-Outline")
(cons (canvas-make-font :name "Courier"
:style (list :italic :outline))
"Courier-Oblique /Courier-Oblique-Outline MakeOutlinePlainFont~
/Courier-Oblique-Outline")
(cons (canvas-make-font :name "Courier"
:style (list :bold :italic :outline))
"Courier-BoldOblique /Courier-BoldOblique-Outline~
MakeOutlinePlainFont~
/Courier-BoldOblique-Outline")
(cons (canvas-make-font :name "Palatino"
:style :plain)
"Palatino-Roman")
(cons (canvas-make-font :name "Palatino"
:style :italic)
"Palatino-Italic")
(cons (canvas-make-font :name "Palatino"
:style :bold)
"Palatino-Bold")
(cons (canvas-make-font :name "Palatino"
:style (list :bold :italic))
"Palatino-BoldItalic")
(cons (canvas-make-font :name "Palatino"
:style :outline)
"Palatino-Roman /Palatino-Roman-Outline MakeOutlinePlainFont~
/Palatino-Roman-Outline")
(cons (canvas-make-font :name "Palatino"
:style (list :bold :outline))
"Palatino-Bold /Palatino-Bold-Outline MakeOutlinePlainFont~
/Palatino-Bold-Outline")
(cons (canvas-make-font :name "Palatino"
:style (list :italic :outline))
"Palatino-Italic-Outline /Palatino-Italic-Outline MakeOutlinePlainFont~
/Palatino-Italic-Outline")
(cons (canvas-make-font :name "Palatino"
:style (list :bold :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline~
MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "Times"
:style :plain)
"Times-Roman")
(cons (canvas-make-font :name "Times"
:style :italic)
"Times-Italic")
(cons (canvas-make-font :name "Times"
:style :bold)
"Times-Bold")
(cons (canvas-make-font :name "Times"
:style (list :bold :italic))
"Times-BoldItalic")
(cons (canvas-make-font :name "Times"
:style :outline)
"Times-Roman /Times-Roman-Outline MakeOutlinePlainFont~
/Times-Roman-Outline")
(cons (canvas-make-font :name "Times"
:style (list :bold :outline))
"Times-Bold /Times-Bold-Outline MakeOutlinePlainFont~
/Times-Bold-Outline")
(cons (canvas-make-font :name "Times"
:style (list :italic :outline))
"Times-Italic /Times-Italic-Outline MakeOutlinePlainFont~
/Times-Italic-Outline")
(cons (canvas-make-font :name "Times"
:style (list :bold :italic :outline))
"Times-BoldItalic /Times-BoldItalic-Outline~
MakeOutlinePlainFont~
/Times-BoldItalic-Outline")
(cons (canvas-make-font :name "Symbol"
:style :plain)
"Symbol")
(cons (canvas-make-font :name "Symbol"
:style :italic)
"Symbol")
(cons (canvas-make-font :name "Symbol"
:style :bold)
"Symbol")
(cons (canvas-make-font :name "Symbol"
:style (list :bold :italic))
"Symbol")
(cons (canvas-make-font :name "Symbol"
:style :outline)
"Symbol /Symbol-Outline MakeOutlinePlainFont~
/Symbol-Outline")
(cons (canvas-make-font :name "Symbol"
:style (list :bold :outline))
"Symbol /Symbol-Outline MakeOutlinePlainFont~
/Symbol-Outline")
(cons (canvas-make-font :name "Symbol"
:style (list :italic :outline))
"Symbol /Symbol-Outline MakeOutlinePlainFont~
/Symbol-Outline")
(cons (canvas-make-font :name "Symbol"
:style (list :bold :italic :outline))
"Symbol /Symbol-Outline~
MakeOutlinePlainFont~
/Symbol-Outline")
(cons (canvas-make-font :name "Zapf Dingbats"
:style :plain)
"Zapf-Dingbats")
(cons (canvas-make-font :name "Zapf Dingbats"
:style :italic)
"Zapf-Dingbats")
(cons (canvas-make-font :name "Zapf Dingbats"
:style :bold)
"Zapf-Dingbats")
(cons (canvas-make-font :name "Zapf Dingbats"
:style (list :bold :italic))
"Zapf-Dingbats")
(cons (canvas-make-font :name "Zapf Dingbats"
:style :outline)
"Zapf-Dingbats /Zapf-Dingbats-Outline MakeOutlinePlainFont~
/Zapf-Dingbats-Outline")
(cons (canvas-make-font :name "Zapf Dingbats"
:style (list :bold :outline))
"Zapf-Dingbats /Zapf-Dingbats-Outline MakeOutlinePlainFont~
/Zapf-Dingbats-Outline")
(cons (canvas-make-font :name "Zapf Dingbats"
:style (list :italic :outline))
"Zapf-Dingbats /Zapf-Dingbats-Outline MakeOutlinePlainFont~
/Zapf-Dingbats-Outline")
(cons (canvas-make-font :name "Zapf Dingbats"
:style (list :bold :italic :outline))
"Zapf-Dingbats /Zapf-Dingbats-Outline~
MakeOutlinePlainFont~
/Zapf-Dingbats-Outline")
(cons (canvas-make-font :name "New Century Schlbk"
:style :plain)
"NewCenturySchlbk-Roman")
(cons (canvas-make-font :name "New Century Schlbk"
:style :italic)
"NewCenturySchlbk-Italic")
(cons (canvas-make-font :name "New Century Schlbk"
:style :bold)
"NewCenturySchlbk-Bold")
(cons (canvas-make-font :name "New Century Schlbk"
:style (list :bold :italic))
"NewCenturySchlbk-BoldItalic")
(cons (canvas-make-font :name "New Century Schlbk"
:style :outline)
"NewCenturySchlbk-Roman /NewCenturySchlbk-Roman-Outline MakeOutlinePlainFont~
/NewCenturySchlbk-Roman-Outline")
(cons (canvas-make-font :name "New Century Schlbk"
:style (list :bold :outline))
"NewCenturySchlbk-Bold /NewCenturySchlbk-Bold-Outline MakeOutlinePlainFont~
/NewCenturySchlbk-Bold-Outline")
(cons (canvas-make-font :name "New Century Schlbk"
:style (list :italic :outline))
"NewCenturySchlbk-Italic /NewCenturySchlbk-Italic-Outline MakeOutlinePlainFont~
/NewCenturySchlbk-Italic-Outline")
(cons (canvas-make-font :name "New Century Schlbk"
:style (list :bold :italic :outline))
"NewCenturySchlbk-BoldItalic /NewCenturySchlbk-BoldItalic-Outline~
MakeOutlinePlainFont~
/NewCenturySchlbk-BoldItalic-Outline")
(cons (canvas-make-font :name "AGaramond"
:style :plain)
"Palatino")
(cons (canvas-make-font :name "AGaramond"
:style :italic)
"Palatino-Italic")
(cons (canvas-make-font :name "AGaramond"
:style :bold)
"Palatino-Bold")
(cons (canvas-make-font :name "AGaramond"
:style (list :bold :italic))
"Palatino-BoldItalic")
(cons (canvas-make-font :name "AGaramond"
:style :outline)
"Palatino /Palatino-Outline MakeOutlinePlainFont~
/Palatino-Outline")
(cons (canvas-make-font :name "AGaramond"
:style (list :bold :outline))
"Palatino-Bold /Palatino-Bold-Outline MakeOutlinePlainFont~
/Palatino-Bold-Outline")
(cons (canvas-make-font :name "AGaramond"
:style (list :italic :outline))
"Palatino-Italic /Palatino-Italic-Outline MakeOutlinePlainFont~
/Palatino-Italic-Outline")
(cons (canvas-make-font :name "AGaramond"
:style (list :bold :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline~
MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "AGaramond Bold"
:style :plain)
"Palatino")
(cons (canvas-make-font :name "AGaramond Bold"
:style :italic)
"Palatino-Italic")
(cons (canvas-make-font :name "AGaramond Bold"
:style :bold)
"Palatino-Bold")
(cons (canvas-make-font :name "AGaramond Bold"
:style (list :bold :italic))
"Palatino-BoldItalic")
(cons (canvas-make-font :name "AGaramond Bold"
:style :outline)
"Palatino /Palatino-Outline MakeOutlinePlainFont~
/Palatino-Outline")
(cons (canvas-make-font :name "AGaramond Bold"
:style (list :bold :outline))
"Palatino-Bold /Palatino-Bold-Outline MakeOutlinePlainFont~
/Palatino-Bold-Outline")
(cons (canvas-make-font :name "AGaramond Bold"
:style (list :italic :outline))
"Palatino-Italic /Palatino-Italic-Outline MakeOutlinePlainFont~
/Palatino-Italic-Outline")
(cons (canvas-make-font :name "AGaramond Bold"
:style (list :bold :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline~
MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "AGaramond BoldItalic"
:style :plain)
"Palatino")
(cons (canvas-make-font :name "AGaramond BoldItalic"
:style :italic)
"Palatino-Italic")
(cons (canvas-make-font :name "AGaramond BoldItalic"
:style :bold)
"Palatino-Bold")
(cons (canvas-make-font :name "AGaramond BoldItalic"
:style (list :bold :italic))
"Palatino-BoldItalic")
(cons (canvas-make-font :name "AGaramond BoldItalic"
:style :outline)
"Palatino /Palatino-Outline MakeOutlinePlainFont~
/Palatino-Outline")
(cons (canvas-make-font :name "AGaramond BoldItalic"
:style (list :bold :outline))
"Palatino-Bold /Palatino-Bold-Outline MakeOutlinePlainFont~
/Palatino-Bold-Outline")
(cons (canvas-make-font :name "AGaramond BoldItalic"
:style (list :italic :outline))
"Palatino-Italic /Palatino-Italic-Outline MakeOutlinePlainFont~
/Palatino-Italic-Outline")
(cons (canvas-make-font :name "AGaramond BoldItalic"
:style (list :bold :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline~
MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "AGaramond Italic"
:style :plain)
"Palatino")
(cons (canvas-make-font :name "AGaramond Italic"
:style :italic)
"Palatino-Italic")
(cons (canvas-make-font :name "AGaramond Italic"
:style :bold)
"Palatino-Bold")
(cons (canvas-make-font :name "AGaramond Italic"
:style (list :bold :italic))
"Palatino-BoldItalic")
(cons (canvas-make-font :name "AGaramond Italic"
:style :outline)
"Palatino /Palatino-Outline MakeOutlinePlainFont~
/Palatino-Outline")
(cons (canvas-make-font :name "AGaramond Italic"
:style (list :bold :outline))
"Palatino-Bold /Palatino-Bold-Outline MakeOutlinePlainFont~
/Palatino-Bold-Outline")
(cons (canvas-make-font :name "AGaramond Italic"
:style (list :italic :outline))
"Palatino-Italic /Palatino-Italic-Outline MakeOutlinePlainFont~
/Palatino-Italic-Outline")
(cons (canvas-make-font :name "AGaramond Italic"
:style (list :bold :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline~
MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "AGaramond Semibold"
:style :plain)
"Palatino")
(cons (canvas-make-font :name "AGaramond Semibold"
:style :italic)
"Palatino-Italic")
(cons (canvas-make-font :name "AGaramond Semibold"
:style :bold)
"Palatino-Bold")
(cons (canvas-make-font :name "AGaramond Semibold"
:style (list :bold :italic))
"Palatino-BoldItalic")
(cons (canvas-make-font :name "AGaramond Semibold"
:style :outline)
"Palatino /Palatino-Outline MakeOutlinePlainFont~
/Palatino-Outline")
(cons (canvas-make-font :name "AGaramond Semibold"
:style (list :bold :outline))
"Palatino-Bold /Palatino-Bold-Outline MakeOutlinePlainFont~
/Palatino-Bold-Outline")
(cons (canvas-make-font :name "AGaramond Semibold"
:style (list :italic :outline))
"Palatino-Italic /Palatino-Italic-Outline MakeOutlinePlainFont~
/Palatino-Italic-Outline")
(cons (canvas-make-font :name "AGaramond Semibold"
:style (list :bold :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline~
MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "AGaramond SemiboldItalic"
:style :plain)
"Palatino")
(cons (canvas-make-font :name "AGaramond SemiboldItalic"
:style :italic)
"Palatino-Italic")
(cons (canvas-make-font :name "AGaramond SemiboldItalic"
:style :bold)
"Palatino-Bold")
(cons (canvas-make-font :name "AGaramond SemiboldItalic"
:style (list :bold :italic))
"Palatino-BoldItalic")
(cons (canvas-make-font :name "AGaramond SemiboldItalic"
:style :outline)
"Palatino /Palatino-Outline MakeOutlinePlainFont~
/Palatino-Outline")
(cons (canvas-make-font :name "AGaramond SemiboldItalic"
:style (list :bold :outline))
"Palatino-Bold /Palatino-Bold-Outline MakeOutlinePlainFont~
/Palatino-Bold-Outline")
(cons (canvas-make-font :name "AGaramond SemiboldItalic"
:style (list :italic :outline))
"Palatino-Italic /Palatino-Italic-Outline MakeOutlinePlainFont~
/Palatino-Italic-Outline")
(cons (canvas-make-font :name "AGaramond SemiboldItalic"
:style (list :bold :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline~
MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "B Garamond Bold"
:style :plain)
"Palatino-Bold")
(cons (canvas-make-font :name "B Garamond Bold"
:style :italic)
"Palatino-BoldItalic")
(cons (canvas-make-font :name "B Garamond Bold"
:style :bold)
"Palatino-Bold")
(cons (canvas-make-font :name "B Garamond Bold"
:style (list :bold :italic))
"Palatino-BoldItalic")
(cons (canvas-make-font :name "B Garamond Bold"
:style :outline)
"Palatino-Bold /Palatino-Bold-Outline MakeOutlinePlainFont~
/Palatino-Bold-Outline")
(cons (canvas-make-font :name "B Garamond Bold"
:style (list :bold :outline))
"Palatino-Bold /Palatino-Bold-Outline MakeOutlinePlainFont~
/Palatino-Bold-Outline")
(cons (canvas-make-font :name "B Garamond Bold"
:style (list :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "B Garamond Bold"
:style (list :bold :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline~
MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "BI Garamond BoldItalic"
:style :plain)
"Palatino-BoldItalic")
(cons (canvas-make-font :name "BI Garamond BoldItalic"
:style :italic)
"Palatino-BoldItalic")
(cons (canvas-make-font :name "BI Garamond BoldItalic"
:style :bold)
"Palatino-BoldItalic")
(cons (canvas-make-font :name "BI Garamond BoldItalic"
:style (list :bold :italic))
"Palatino-BoldItalic")
(cons (canvas-make-font :name "BI Garamond BoldItalic"
:style :outline)
"Palatino-BoldItalic /Palatino-BoldItalic-Outline MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "BI Garamond BoldItalic"
:style (list :bold :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "BI Garamond BoldItalic"
:style (list :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "BI Garamond BoldItalic"
:style (list :bold :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline~
MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "I Garamond LightItalic"
:style :plain)
"Palatino-Italic")
(cons (canvas-make-font :name "I Garamond LightItalic"
:style :italic)
"Palatino-Italic")
(cons (canvas-make-font :name "I Garamond LightItalic"
:style :bold)
"Palatino-BoldItalic")
(cons (canvas-make-font :name "I Garamond LightItalic"
:style (list :bold :italic))
"Palatino-BoldItalic")
(cons (canvas-make-font :name "I Garamond LightItalic"
:style :outline)
"Palatino-Italic /Palatino-Italic-Outline MakeOutlinePlainFont~
/Palatino-Italic-Outline")
(cons (canvas-make-font :name "I Garamond LightItalic"
:style (list :bold :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "I Garamond LightItalic"
:style (list :italic :outline))
"Palatino-Italic /Palatino-Italic-Outline MakeOutlinePlainFont~
/Palatino-Italic-Outline")
(cons (canvas-make-font :name "I Garamond LightItalic"
:style (list :bold :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline~
MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "Garamond"
:style :plain)
"Palatino")
(cons (canvas-make-font :name "Garamond"
:style :italic)
"Palatino-Italic")
(cons (canvas-make-font :name "Garamond"
:style :bold)
"Palatino-Bold")
(cons (canvas-make-font :name "Garamond"
:style (list :bold :italic))
"Palatino-BoldItalic")
(cons (canvas-make-font :name "Garamond"
:style :outline)
"Palatino /Palatino-Outline MakeOutlinePlainFont~
/Palatino-Outline")
(cons (canvas-make-font :name "Garamond"
:style (list :bold :outline))
"Palatino-Bold /Palatino-Bold-Outline MakeOutlinePlainFont~
/Palatino-Bold-Outline")
(cons (canvas-make-font :name "Garamond"
:style (list :italic :outline))
"Palatino-Italic /Palatino-Italic-Outline MakeOutlinePlainFont~
/Palatino-Italic-Outline")
(cons (canvas-make-font :name "Garamond"
:style (list :bold :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline~
MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "Zapf Chancery"
:style :plain)
"Palatino")
(cons (canvas-make-font :name "Zapf Chancery"
:style :italic)
"Palatino-Italic")
(cons (canvas-make-font :name "Zapf Chancery"
:style :bold)
"Palatino-Bold")
(cons (canvas-make-font :name "Zapf Chancery"
:style (list :bold :italic))
"Palatino-BoldItalic")
(cons (canvas-make-font :name "Zapf Chancery"
:style :outline)
"Palatino /Palatino-Outline MakeOutlinePlainFont~
/Palatino-Outline")
(cons (canvas-make-font :name "Zapf Chancery"
:style (list :bold :outline))
"Palatino-Bold /Palatino-Bold-Outline MakeOutlinePlainFont~
/Palatino-Bold-Outline")
(cons (canvas-make-font :name "Zapf Chancery"
:style (list :italic :outline))
"Palatino-Italic /Palatino-Italic-Outline MakeOutlinePlainFont~
/Palatino-Italic-Outline")
(cons (canvas-make-font :name "Zapf Chancery"
:style (list :bold :italic :outline))
"Palatino-BoldItalic /Palatino-BoldItalic-Outline~
MakeOutlinePlainFont~
/Palatino-BoldItalic-Outline")
(cons (canvas-make-font :name "Merrion Square"
:style :plain)
"Ugly")
(cons (canvas-make-font :name "Merrion Square"
:style :italic)
"Ugly")
(cons (canvas-make-font :name "Merrion Square"
:style :bold)
"Ugly")
(cons (canvas-make-font :name "Merrion Square"
:style (list :bold :italic))
"Ugly")
(cons (canvas-make-font :name "Merrion Square"
:style :outline)
"Ugly /Ugly-Outline MakeOutlinePlainFont~
/Ugly-Outline")
(cons (canvas-make-font :name "Merrion Square"
:style (list :bold :outline))
"Ugly /Ugly-Outline MakeOutlinePlainFont~
/Ugly-Outline")
(cons (canvas-make-font :name "Merrion Square"
:style (list :italic :outline))
"Ugly /Ugly-Outline MakeOutlinePlainFont~
/Ugly-Outline")
(cons (canvas-make-font :name "Merrion Square"
:style (list :bold :italic :outline))
"Ugly /Ugly-Outline~
MakeOutlinePlainFont~
/Ugly-Outline")
(cons (canvas-make-font :name "Chicago"
:style :plain)
"Times-Roman")
(cons (canvas-make-font :name "Chicago"
:style :italic)
"Times-Italic")
(cons (canvas-make-font :name "Chicago"
:style :bold)
"Times-Bold")
(cons (canvas-make-font :name "Chicago"
:style (list :bold :italic))
"Times-BoldItalic")
(cons (canvas-make-font :name "Chicago"
:style :outline)
"Times-Roman /Times-Roman-Outline MakeOutlinePlainFont~
/Times-Roman-Outline")
(cons (canvas-make-font :name "Chicago"
:style (list :bold :outline))
"Times-Bold /Times-Bold-Outline MakeOutlinePlainFont~
/Times-Bold-Outline")
(cons (canvas-make-font :name "Chicago"
:style (list :italic :outline))
"Times-Italic /Times-Italic-Outline MakeOutlinePlainFont~
/Times-Italic-Outline")
(cons (canvas-make-font :name "Chicago"
:style (list :bold :italic :outline))
"Times-BoldItalic /Times-BoldItalic-Outline~
MakeOutlinePlainFont~
/Times-BoldItalic-Outline")
(cons (canvas-make-font :name "Geneva"
:style :plain)
"AvantGarde")
(cons (canvas-make-font :name "Geneva"
:style :italic)
"AvantGarde-Oblique")
(cons (canvas-make-font :name "Geneva"
:style :bold)
"AvantGarde-Demi")
(cons (canvas-make-font :name "Geneva"
:style (list :bold :italic))
"AvantGarde-DemiOblique")
(cons (canvas-make-font :name "Geneva"
:style :outline)
"AvantGarde /AvantGarde-Outline MakeOutlinePlainFont~
/AvantGarde-Outline")
(cons (canvas-make-font :name "Geneva"
:style (list :bold :outline))
"AvantGarde-Demi /AvantGarde-Demi-Outline MakeOutlinePlainFont~
/AvantGarde-Demi-Outline")
(cons (canvas-make-font :name "Geneva"
:style (list :italic :outline))
"AvantGarde-Oblique /AvantGarde-Oblique-Outline MakeOutlinePlainFont~
/AvantGarde-Oblique-Outline")
(cons (canvas-make-font :name "Geneva"
:style (list :bold :italic :outline))
"AvantGarde-DemiOblique /AvantGarde-DemiOblique-Outline~
MakeOutlinePlainFont~
/AvantGarde-DemiOblique-Outline")
(cons (canvas-make-font :name "Monaco"
:style :plain)
"Times-Roman")
(cons (canvas-make-font :name "Monaco"
:style :italic)
"Times-Italic")
(cons (canvas-make-font :name "Monaco"
:style :bold)
"Times-Bold")
(cons (canvas-make-font :name "Monaco"
:style (list :bold :italic))
"Times-BoldItalic")
(cons (canvas-make-font :name "Monaco"
:style :outline)
"Times-Roman /Times-Roman-Outline MakeOutlinePlainFont~
/Times-Roman-Outline")
(cons (canvas-make-font :name "Monaco"
:style (list :bold :outline))
"Times-Bold /Times-Bold-Outline MakeOutlinePlainFont~
/Times-Bold-Outline")
(cons (canvas-make-font :name "Monaco"
:style (list :italic :outline))
"Times-Italic /Times-Italic-Outline MakeOutlinePlainFont~
/Times-Italic-Outline")
(cons (canvas-make-font :name "Monaco"
:style (list :bold :italic :outline))
"Times-BoldItalic /Times-BoldItalic-Outline~
MakeOutlinePlainFont~
/Times-BoldItalic-Outline")
(cons (canvas-make-font :name "N Helvetica Narrow"
:style :plain)
"Helvetica")
(cons (canvas-make-font :name "N Helvetica Narrow"
:style :italic)
"Helvetica-Oblique")
(cons (canvas-make-font :name "N Helvetica Narrow"
:style :bold)
"Helvetica-Bold")
(cons (canvas-make-font :name "N Helvetica Narrow"
:style (list :bold :italic))
"Helvetica-BoldOblique")
(cons (canvas-make-font :name "N Helvetica Narrow"
:style :outline)
"Helvetica /Helvetica-Outline MakeOutlinePlainFont~
/Helvetica-Outline")
(cons (canvas-make-font :name "N Helvetica Narrow"
:style (list :bold :outline))
"Helvetica-Bold /Helvetica-Bold-Outline MakeOutlinePlainFont~
/Helvetica-Bold-Outline")
(cons (canvas-make-font :name "N Helvetica Narrow"
:style (list :italic :outline))
"Helvetica-Oblique /Helvetica-Oblique-Outline MakeOutlinePlainFont~
/Helvetica-Oblique-Outline")
(cons (canvas-make-font :name "N Helvetica Narrow"
:style (list :bold :italic :outline))
"Helvetica-BoldOblique /Helvetica-BoldOblique-Outline~
MakeOutlinePlainFont~
/Helvetica-BoldOblique-Outline")
(cons (canvas-make-font :name "New York"
:style :plain)
"Times-Roman")
(cons (canvas-make-font :name "New York"
:style :italic)
"Times-Italic")
(cons (canvas-make-font :name "New York"
:style :bold)
"Times-Bold")
(cons (canvas-make-font :name "New York"
:style (list :bold :italic))
"Times-BoldItalic")
(cons (canvas-make-font :name "New York"
:style :outline)
"Times-Roman /Times-Roman-Outline MakeOutlinePlainFont~
/Times-Roman-Outline")
(cons (canvas-make-font :name "New York"
:style (list :bold :outline))
"Times-Bold /Times-Bold-Outline MakeOutlinePlainFont~
/Times-Bold-Outline")
(cons (canvas-make-font :name "New York"
:style (list :italic :outline))
"Times-Italic /Times-Italic-Outline MakeOutlinePlainFont~
/Times-Italic-Outline")
(cons (canvas-make-font :name "New York"
:style (list :bold :italic :outline))
"Times-BoldItalic /Times-BoldItalic-Outline~
MakeOutlinePlainFont~
/Times-BoldItalic-Outline")
)
"This variable maps the standard Macintosh fonts to the~
standard Postscript fonts."
)
| 41,580 | Common Lisp | .cl | 819 | 32.814408 | 94 | 0.510347 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 869bfcff3c2558a5fbf4682ea6b7a9c2c03cd171cbf882f9fc641025daf334d0 | 32,825 | [
-1
] |
32,826 | check-items-mcl.lsp | rwoldford_Quail/source/window-basics/prompt/check-items-mcl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; check-items-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; R.W. Oldford 1992
;;;
;;;
;;;
;;;----------------------------------------------------------------------------------
;;;
;;; History:
;;;
;;; - Construct a uniform prompting facility.
;;;
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(check-items)))
(defun check-items (item-default-pairs
&key
(prompt-text "Set parameters.")
(select-text "OK")
(cancel-text "Cancel")
(columns 1)
)
"Prompts user for value (T or NIL) of several items as given by the ~
argument item-default-pairs. Prompt-text, select-text, and cancel-text ~
are strings which will appear in the message, select button, and cancel ~
button, respectively. Columns is the number of columns to be used in the ~
display (default 1)."
(setq item-default-pairs
(loop
for pair in item-default-pairs
collect
(cond
((consp pair) pair)
(T (cons pair NIL)))))
(let
((p1 (make-instance 'check-items
:window-show NIL
:items item-default-pairs
:prompt-text prompt-text
:select-text select-text
:cancel-text cancel-text
:columns columns)))
(modal-dialog p1)))
(defclass check-items (ccl:dialog)
((item-pairs
:initarg :items
:initform NIL)
(prompt-text
:initform "Set parameters."
:initarg :prompt-text)
(check-items :initform NIL)
(columns :initform 1 :initarg :columns)
)
(:documentation "A dialog that allows the user to set ~
the logical value of several parameters at once.")
)
(defmethod initialize-instance ((self check-items) &rest initargs)
(apply #'call-next-method self
:window-show NIL
:window-type :double-edge-box
:view-position '(:top 100)
initargs))
(defmethod initialize-instance :after ((self check-items)
&rest initargs
&key
(select-text "OK")
(cancel-text "Cancel"))
(declare (ignore initargs))
(let*
((item-pairs (slot-value self 'item-pairs))
(columns (slot-value self 'columns))
(view-font (view-font self))
(max-item-text-width
(loop for i in item-pairs maximize
(string-width (string (car i)) view-font)))
(max-item-width (+ 10 max-item-text-width))
(prompt-text (slot-value self 'prompt-text))
(prompt-text-width (string-width prompt-text view-font))
(text-height (multiple-value-bind (ascent descent widmax leading)
(font-info view-font)
(declare (ignore widmax))
(+ ascent descent leading)))
(text-box-x 10)
(text-box-y 10)
(text-box-width (+ 5 prompt-text-width))
(text-box-height (round (* 2 text-height)))
(check-box-height (+ 5 text-height))
(button-height (+ 2 text-height))
(button-width
(+ 5 (max (string-width select-text view-font)
(string-width cancel-text view-font))))
(select-button-y (+ text-box-y 2 text-box-height))
(cancel-button-y (+ select-button-y button-height 10))
(n-items (length item-pairs))
(col-width (+ 10 max-item-width))
(nrows (ceiling (/ n-items columns)))
(first-item-y (+ text-box-y text-box-height))
(first-item-x 10)
(button-x (+ 10 first-item-x (* columns col-width)))
(view-size-width (max (+ button-x button-width 6)
(+ text-box-x text-box-width 6)))
(view-size-height (max (+ first-item-y
(* nrows check-box-height)
4)
(+ cancel-button-y
button-height
4)))
(text-dialog (make-dialog-item
'static-text-dialog-item
(h-draw:make-point text-box-x text-box-y)
(h-draw:make-point text-box-width text-box-height)
prompt-text))
(check-items
(setf (slot-value self 'check-items)
(loop
for item in item-pairs
with y-start = first-item-y
with x-start = first-item-x
with row = 0
with col = 0
collect
(make-dialog-item
'check-box-dialog-item
(h-draw:make-point (+ x-start (* col col-width))
(+ y-start (* row check-box-height)))
(h-draw:make-point max-item-width check-box-height)
(string (car item))
#'(lambda (d) d)
:dialog-item-enabled-p T
:check-box-checked-p (cdr item))
do (cond
((>= row (1- nrows))
(incf col 1)
(setq row 0))
(T (incf row 1))))))
(select-button
(make-dialog-item
'default-button-dialog-item
(h-draw:make-point button-x select-button-y)
(h-draw:make-point button-width button-height)
select-text
#'(lambda (d)
(let*
((p (view-container d))
(items (slot-value p 'item-pairs))
(check-items (slot-value p 'check-items)))
(loop for i in items
as ci in check-items
do
(setf (cdr i)
(check-box-checked-p ci)))
(return-from-modal-dialog items)
))))
(cancel-button
(make-dialog-item
'button-dialog-item
(h-draw:make-point button-x cancel-button-y)
(h-draw:make-point button-width button-height)
cancel-text
#'(lambda (d)
(declare (ignore d))
(return-from-modal-dialog (values)))))
)
(set-view-size self (h-draw:make-point view-size-width view-size-height))
(add-subviews self text-dialog select-button cancel-button)
(loop for ci in check-items
do
(add-subviews self ci))
))
#|
(setf items
(check-items (list 'checkItOut!! "try this" "Or this" "or this"
"Gold" "Silver" "Bronze")))
(setf items (check-items items))
(check-items (list 'checkItOut!! "try this" "Or this" "or this"
"Gold" "Silver" "Bronze")
:columns 2)
(check-items (list 'checkItOut!! "try this" "Or this" "or this"
"Gold" "Silver" "Bronze")
:columns 3)
(check-items (list 'checkItOut!! "try this" "Or this" "or this"
"Gold" "Silver" "Bronze"
"platinum" "Tin" "lead" "zinc"
"iron")
:prompt-text "Give the man a medal!"
:select-text "DO IT"
:cancel-text "Forget it." :columns 3)
|#
| 8,042 | Common Lisp | .cl | 201 | 27.427861 | 86 | 0.487068 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | df335aed26acf804c0b533a4c2bc6eed8410d058e086194f5ccad44efbbb3389 | 32,826 | [
-1
] |
32,827 | check-items-clx.lsp | rwoldford_Quail/source/window-basics/prompt/check-items-clx.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; check-items-clx.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; R.W. Oldford 1992
;;;
;;;
;;;
;;;----------------------------------------------------------------------------------
;;;
;;; History:
;;;
;;; - Construct a uniform prompting facility.
;;;
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(check-items)))
(defun check-items (item-default-pairs
&key
(prompt-text "Set parameters.")
(select-text "OK")
(cancel-text "Cancel")
(columns 1)
)
"Prompts user for value (T or NIL) of several items as given by the ~
argument item-default-pairs. Prompt-text, select-text, and cancel-text ~
are strings which will appear in the message, select button, and cancel ~
button, respectively. Columns is the number of columns to be used in the ~
display (default 1)."
(setq item-default-pairs
(loop
for pair in item-default-pairs
collect
(cond
((consp pair) pair)
(T (cons pair NIL)))))
(let
((d (make-instance 'check-item-dialog
:items item-default-pairs
:title "Check items."
:text prompt-text
:ok-text select-text
:cancel-text cancel-text
:columns columns)))
(when-dialog-done (d :timeout NIL)
(loop for check-item in (slot-value d 'check-items)
collect
(cons
(dialog-original-item (car check-item))
(box-checked-p (cdr check-item)))))
))
(defclass check-item-dialog (dialog)
((ok-text :initform "OK"
:initarg :ok-text
:accessor ok-text-of)
(cancel-text :initform "Cancel"
:initarg :cancel-text
:accessor cancel-text-of)
(ok-button :initform NIL
:accessor ok-button-of)
(cancel-button :initform NIL
:accessor cancel-button-of)
(item-pairs :initarg :items
:initform NIL)
(check-items :initform NIL)
(check-item-windows :initform NIL)
(columns :initform 1
:initarg :columns)
)
(:default-initargs :text "Set parameters.")
(:documentation "A dialog that allows the user to set ~
the logical value of several parameters at once.")
)
(defmethod dialog-compute-interior ((self check-item-dialog))
(let* ((font (dialog-font-of self))
(ok-text (ok-text-of self))
(cancel-text (cancel-text-of self))
(gcontext (gcontext-of self))
(item-pairs (slot-value self 'item-pairs))
(n-items (length item-pairs))
(check-items (make-list n-items))
(check-item-windows (make-list n-items))
(window (window-of self))
)
(setf (xlib::gcontext-font gcontext)
(canvas-font-to-host-font font))
(setf (ok-button-of self)
(make-text-button
:text ok-text
:gcontext gcontext
:font font
:border-width 2
:on-action
#'(lambda ()
(shutdown-dialog self)
(dialog-done self))
)
(cancel-button-of self)
(make-text-button
:text cancel-text
:gcontext gcontext
:font font
:border-width 2
:on-action
#'(lambda ()
(shutdown-dialog self)
(format *quail-terminal-io* "~&Cancelled.~%")
(dialog-done self)
(throw :cancel T))
))
(let (text-item check-box)
(loop
for i from 0 to (- n-items 1)
as item in item-pairs
do
(setf text-item
(make-instance 'text-dialog-item
:gcontext gcontext
:font font
:item (car item)
:text (string (car item))))
(setf check-box
(make-instance 'check-box
:box-size 20
:foreground-color *black-color*
:background-color *white-color*
:check? (cdr item)))
(setf (elt check-items i)
(cons text-item check-box))
(setf (elt check-item-windows i)
(cons (window-of text-item)
(window-of check-box)))))
(setf
(slot-value self 'check-items)
check-items
(slot-value self 'check-item-windows)
check-item-windows)
)
)
(defmethod dialog-compute-geometry ((self check-item-dialog))
(let* ((ok-b (ok-button-of self))
(c-b (cancel-button-of self))
(ok-bw (window-of ok-b))
(c-bw (window-of c-b))
(gcontext (gcontext-of self))
(window (window-of self))
(border-width (dialog-border-width-of self))
(h-space (dialog-h-space self))
(v-space (dialog-v-space self))
(font (xlib::gcontext-font gcontext))
(font-ascent (xlib::font-ascent font))
(text-height
(+ font-ascent (xlib::font-descent font)))
(title-width (xlib::text-extents font (dialog-title-of self)))
(text-width (xlib::text-extents font (dialog-text-of self)))
(ok-width (xlib::drawable-width ok-bw))
(c-width (xlib::drawable-width c-bw))
(button-width (max ok-width c-width))
(button-height (xlib::drawable-height ok-bw))
(check-item-windows (slot-value self 'check-item-windows))
(max-item-width
(+ h-space
(reduce #'(lambda (width check-item)
(max width
(+ (xlib::drawable-width
(car check-item))
(xlib::drawable-width
(cdr check-item)))))
check-item-windows
:initial-value 0)))
(max-item-height
(+ v-space
(reduce #'(lambda (height check-item)
(max height
(xlib::drawable-height
(car check-item))
(xlib::drawable-height
(cdr check-item))))
check-item-windows
:initial-value 0)))
(ncols (slot-value self 'columns))
(nrows (ceiling (length check-item-windows) ncols))
(list-width (- (* ncols
(+ h-space max-item-width))
h-space))
(list-height (- (* nrows
max-item-height)
v-space))
(self-width
(+ border-width border-width h-space h-space
(max
list-width
title-width
text-width
(+ button-width h-space button-width))))
(list-y (+ border-width
v-space
text-height
v-space
text-height
v-space))
(self-height
(+ list-y
list-height
v-space
button-height
v-space
border-width))
(button-y (- self-height
button-height
v-space
border-width))
)
;; The dialog:
(xlib::with-state (window)
(setf (xlib::drawable-width window) self-width
(xlib::drawable-height window) self-height))
;; The buttons
(setf (xlib::drawable-width ok-bw) button-width
(xlib::drawable-width c-bw) button-width)
(xlib::reparent-window ok-bw window
(+ h-space border-width)
button-y)
(xlib::reparent-window c-bw window
(+ border-width h-space button-width h-space)
button-y)
;; The check-item-windows
(setf max-item-width
(floor (- self-width
(* 2 (+ border-width h-space))
(* (- ncols 1) 2 h-space))
ncols))
(loop
for item in check-item-windows
as check-item in (slot-value self 'check-items)
with y-start = list-y
with x-start = (+ border-width h-space)
with row = 0
with col = 0
with col-width = (+ max-item-width h-space h-space)
do
(let ((tw (car item))
(cbw (cdr item)))
(xlib::reparent-window tw window
(+ x-start (* col col-width))
(+ y-start
(dialog-border-width-of
(cdr check-item))
(* row max-item-height)))
(xlib::reparent-window cbw window
(- (+ x-start
(* col col-width)
max-item-width)
(xlib::drawable-width cbw))
(+ y-start (* row max-item-height)))
(cond
((>= row (1- nrows))
(incf col 1)
(setq row 0))
(T (incf row 1))))
)
))
#|
(setf items
(check-items (list 'heycheckmeOut!! "try this" "Or this" "or this"
"Gold" "Silver" "Bronze")))
(setf items (check-items items))
(check-items (list 'heycheckmeOut!! "try this" "Or this" "or this"
"Gold" "Silver" "Bronze")
:columns 2)
(check-items (list 'heycheckmeOut!! "try this" "Or this" "or this"
"Gold" "Silver" "Bronze")
:columns 3)
(check-items (list 'heycheckmeOut!! "try this" "Or this" "or this"
"Gold" "Silver" "Bronze"
"platinum" "Tin" "lead" "zinc"
"iron")
:prompt-text "Give the man a medal!"
:select-text "DO IT"
:cancel-text "Forget it." :columns 3)
|#
| 11,244 | Common Lisp | .cl | 292 | 24.517123 | 86 | 0.458583 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 7990f828d6caeec3aae172a0700ea6666a7747704588a9aa26a9cb0ebcf08439 | 32,827 | [
-1
] |
32,828 | collect-input-mcl.lsp | rwoldford_Quail/source/window-basics/prompt/collect-input-mcl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; collect-input-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; R.W. Oldford 1992
;;;
;;;
;;;
;;;----------------------------------------------------------------------------------
;;;
;;; History:
;;;
;;; - Construct a uniform prompting facility.
;;;
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(collect-input)))
(defun collect-input (prompt-default-pairs
&key
(prompt-text "Enter a value for each field.")
(select-text "OK")
(cancel-text "Cancel")
(columns 1))
"Prompts user for value of several items as given by the ~
argument prompt-default-pairs. Prompt-text, select-text, and cancel-text ~
are strings which will appear in the message, select button, and cancel ~
button, respectively. Columns is the number of columns to be used in the ~
display (default 1). ~
(:returns An updated list of prompt-value-pairs. Values are strings or NIL ~
(if no value was specified))."
(setq prompt-default-pairs
(loop
for pair in prompt-default-pairs
collect
(cond
((consp pair) pair)
(T (cons pair NIL)))))
(let
((p1 (make-instance 'collect-input
;;:view-position NIL
:window-show NIL
:items prompt-default-pairs
:prompt-text (format NIL prompt-text)
:select-text select-text
:cancel-text cancel-text
:columns columns)))
(modal-dialog p1)))
(defclass collect-input (ccl:dialog)
((item-pairs
:initarg :items
:initform NIL)
(prompt-text
:initform "Set parameters."
:initarg :prompt-text)
(collect-input :initform NIL)
(columns :initform 1 :initarg :columns)
)
(:documentation "A dialog that allows the user to set ~
the logical value of several parameters at once.")
)
(defmethod initialize-instance ((self collect-input) &rest initargs)
(apply #'call-next-method self :window-show NIL
:window-type :double-edge-box
:view-position '(:left 2)
initargs))
(defmethod initialize-instance :after ((self collect-input)
&rest initargs
&key
(select-text "OK")
(cancel-text "Cancel"))
(declare (ignore initargs))
(flet
((text-width (string font)
(string-width string font)))
(let*
((item-pairs (slot-value self 'item-pairs))
(columns (slot-value self 'columns))
(view-font (view-font self))
(max-prompt-text-width
(loop
for i in item-pairs
maximize
(string-width
(string (car i))
view-font)))
(max-input-text-width
(loop
for i in item-pairs
maximize
(string-width
(string (cdr i))
view-font)))
(max-prompt-width (+ 10 max-prompt-text-width))
(max-input-width (max 100 (+ 20 max-input-text-width)))
(prompt-text (slot-value self 'prompt-text))
(prompt-text-width (string-width prompt-text view-font))
(text-height (multiple-value-bind (ascent descent widmax leading)
(font-info view-font)
(declare (ignore widmax))
(+ ascent descent leading)))
(text-box-x 20)
(text-box-y 20)
(text-box-width (+ 5 prompt-text-width))
(text-box-height (round (* 2.5 text-height)))
(collect-input-height (+ 5 text-height))
(row-sep 10)
(col-sep 30)
(button-height (+ 2 text-height))
(button-width
(+ 5 (max (string-width select-text view-font)
(string-width cancel-text view-font))))
(select-button-y (+ text-box-y 2 text-box-height))
(cancel-button-y (+ select-button-y button-height 10))
(n-items (length item-pairs))
(inter-field-space 3)
(col-width (+ col-sep max-prompt-width
max-input-width inter-field-space))
(nrows (ceiling (/ n-items columns)))
(first-item-y (+ text-box-y text-box-height))
(first-item-x 10)
(button-x (+ 50 first-item-x (* columns col-width)))
(view-size-width (max 200
(+ button-x button-width 2)
(+ text-box-x text-box-width 2)))
(view-size-height (max 100
(+ first-item-y
(+ 2 (* (+ nrows 1)
(+ row-sep collect-input-height)))
2)
(+ cancel-button-y
button-height
2)))
(text-dialog (make-dialog-item
'static-text-dialog-item
(h-draw:make-point text-box-x text-box-y)
(h-draw:make-point text-box-width text-box-height)
prompt-text))
(collect-prompts
(loop
for item in item-pairs
with y-start = first-item-y
with x-start = first-item-x
with row = 0
with col = 0
collect
(make-dialog-item
'static-text-dialog-item
(h-draw:make-point (+ x-start (* col col-width))
(+ y-start
(* row
(+ row-sep collect-input-height))))
(h-draw:make-point max-prompt-width collect-input-height)
(string (car item))
#'(lambda (d) d)
:dialog-item-enabled-p T)
do (cond
((>= row (1- nrows))
(incf col 1)
(setq row 0))
(T (incf row 1)))))
(collect-input
(setf (slot-value self 'collect-input)
(loop
for item in item-pairs
with y-start = first-item-y
with x-start = first-item-x
with row = 0
with col = 0
collect
(make-dialog-item
'editable-text-dialog-item
(h-draw:make-point (+ x-start max-prompt-width
inter-field-space (* col col-width))
(+ y-start (* row
(+ row-sep collect-input-height))))
(h-draw:make-point max-input-width collect-input-height)
(string (or (cdr item) ""))
#'(lambda (d) d)
:dialog-item-enabled-p T
:allow-returns T)
do (cond
((>= row (1- nrows))
(incf col 1)
(setq row 0))
(T (incf row 1))))))
(select-button
(make-dialog-item
'default-button-dialog-item
(h-draw:make-point button-x select-button-y)
(h-draw:make-point button-width button-height)
select-text
#'(lambda (d)
(let*
((p (view-container d))
(items (slot-value p 'item-pairs))
(collect-input (slot-value p 'collect-input)))
(loop for i in items
as ci in collect-input
with result
do
(setf result (dialog-item-text ci))
(if (zerop (length result))
(setf (cdr i) NIL)
(setf (cdr i) (dialog-item-text ci))))
(return-from-modal-dialog items)
))))
(cancel-button
(make-dialog-item
'button-dialog-item
(h-draw:make-point button-x cancel-button-y)
(h-draw:make-point button-width button-height)
cancel-text
#'(lambda (d)
(declare (ignore d))
(return-from-modal-dialog (values)))))
)
(set-view-size self (h-draw:make-point (+ 6 view-size-width) view-size-height))
(add-subviews self text-dialog select-button cancel-button)
(loop for ci in collect-input
do
(add-subviews self ci))
(loop for ci in collect-prompts
do
(add-subviews self ci))
)))
#|
(setf items
(collect-input (list 'heycheckmeOut!! "try this" "Or this" "or this"
"Gold" "Silver" "Bronze")))
(setf items (collect-input items))
(collect-input (list 'heycheckmeOut!! "try this" "Or this" "or this"
"Gold" "Silver" "Bronze")
:columns 2)
(collect-input (list 'heycheckmeOut!! "try this" "Or this" "or this"
"Gold" "Silver" "Bronze")
:columns 3)
(collect-input (list 'heycheckmeOut!! "try this" "Or this" "or this"
"Gold" "Silver" "Bronze"
"platinum" "Tin" "lead" "zinc"
"iron")
:prompt-text "Give the man a medal!"
:select-text "DO IT"
:cancel-text "Forget it." :columns 3)
|#
| 10,386 | Common Lisp | .cl | 255 | 26.32549 | 86 | 0.467663 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 6bb75674671ee7cacac2053ddff80fc6e6ec5d8582596395bd14d3e9e9fd0c32 | 32,828 | [
-1
] |
32,829 | dialog-items-clx.lsp | rwoldford_Quail/source/window-basics/prompt/dialog-items-clx.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; dialog-items-clx.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; Authors:
;;; R.W. Oldford 1994
;;;
;;;
;;;
(in-package :wb)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; dialog-items
;;;
(defclass dialog-item ()
((window :initform NIL
:initarg :window
:accessor window-of)
(gcontext :initform NIL
:initarg :gcontext
:accessor gcontext-of)
(background-color :initform *grey-color*
:initarg :background-color
:accessor dialog-background-color-of)
(foreground-color :initform *black-color*
:initarg :foreground-color
:accessor dialog-foreground-color-of)
(border-width :initform 0
:initarg :border-width
:accessor dialog-border-width-of)
(owner :initform NIL
:initarg :owner
:accessor owner-dialog)
(item :initform NIL
:initarg :item
:accessor dialog-original-item)
(window-border-width :initform 0
:initarg :window-border-width)
)
)
(defun dialog-item-p (thing)
(typep thing 'dialog-item))
(defmethod initialize-instance :after ((self dialog-item)
&key
gcontext
window
border-width
&allow-other-keys)
(let* ((parent (if (xlib::window-p window)
(parent-of window)
(xlib::screen-root
(xlib::display-default-screen
*default-display*))))
(colormap (xlib::window-colormap parent))
(fore-color (xlib::alloc-color
colormap
(dialog-foreground-color-of self)))
(back-color (xlib::alloc-color
colormap
(dialog-background-color-of self)))
)
;; sort out the window
;; First get one.
(cond
((xlib::window-p window)
(xlib::with-state (window)
(setf (xlib::window-background window) back-color)
(setf (xlib::drawable-border-width window)
(window-border-width-of self))))
(T
(setf window
(xlib::create-window
:parent parent
:x 0 :y 0 :width 16 :height 16
:background back-color
:override-redirect :on
:border-width (slot-value self 'window-border-width)
:event-mask
(xlib::make-event-mask
:button-press
:button-release
:key-press
:key-release
:exposure
:enter-window
:leave-window
:owner-grab-button))))
)
;; Hook back to self from window
(if (xlib::window-plist window)
(push (cons :wb-class-instance self)
(xlib::window-plist window))
(setf (xlib::window-plist window)
(acons :wb-class-instance self NIL)))
;; Stuff the window away.
(setf (window-of self) window)
;; sort out the gcontext
(unless (xlib::gcontext-p gcontext)
(setf gcontext
(xlib::create-gcontext
:drawable window)))
(setf (gcontext-of self) gcontext)
(setf (xlib::gcontext-background gcontext)
back-color)
(setf (xlib::gcontext-foreground gcontext)
fore-color)
)
;; compute the geometry
(dialog-item-compute-geometry self)
;; return self
self)
(defgeneric dialog-item-compute-geometry (dialog-item)
(:documentation "Compute the geometry for this dialog-item."))
(defmethod dialog-item-compute-geometry ((self T))
"Taken care of by dialog-item initialize-instance :after ~
for simple dialog-items."
NIL)
(defgeneric process-button-press-event (dialog-item &optional window)
(:documentation "Function called when a button down event occurs ~
within a dialog-item's window."))
(defmethod process-button-press-event ((button dialog-item) &optional window)
(declare (ignore button window)))
(defgeneric process-button-release-event (dialog-item &optional window)
(:documentation "Function called when a button up event occurs ~
within a dialog-item's window."))
(defmethod process-button-release-event ((button dialog-item) &optional window)
(declare (ignore button window)))
(defmethod wb-refresh ((thing dialog-item))
(declare (ignore thing)))
(defgeneric process-key-press-event (dialog-item window code state)
(:documentation "Function called when a key down event occurs ~
within a dialog-item's window."))
(defmethod process-key-press-event ((self dialog-item) window code state)
(declare (ignore self window code state)))
(defgeneric highlight-dialog-item (dialog-item)
(:documentation "Function which draws a highlighted version of the dialog-item."))
(defgeneric downlight-dialog-item (dialog-item)
(:documentation "Function which draws a downlighted version of the dialog-item."))
(defgeneric dialog-enter-notify (dialog-item &optional window state)
(:documentation "Function called when the pointer enters the dialog-item."))
(defmethod dialog-enter-notify ((self dialog-item) &optional window state)
(declare (Ignore self window)))
(defgeneric dialog-leave-notify (dialog-item &optional window)
(:documentation "Function called when the pointer leaves the dialog-item."
))
(defmethod dialog-leave-notify ((self dialog-item) &optional window)
(declare (Ignore self window)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; Buttons
;;;
(defclass button (dialog-item)
((on? :initform NIL
:initarg :on?
:accessor button-on-p)
(on-action :initform NIL
:initarg :on-action
:accessor button-on-action-of)
(off-action :initform NIL
:initarg :off-action
:accessor button-off-action-of)
(alive? :initform NIL
:accessor button-alive-p)
)
)
(defun make-button (&rest args)
(apply #'make-instance 'button args))
(defmethod button-on ((button button))
(highlight-dialog-item button)
(setf (button-on-p button) T))
(defmethod button-off ((button button))
(downlight-dialog-item button)
(setf (button-on-p button) NIL)
)
(defmethod process-button-press-event ((button button) &optional window)
(declare (ignore window))
(setf (button-alive-p button) T)
(if (button-on-p button)
(button-off button)
(button-on button)))
(defmethod process-button-release-event ((button button) &optional window)
(declare (ignore window))
(setf (button-alive-p button) NIL)
(if (button-on-p button)
(if (functionp (button-on-action-of button))
(funcall (button-on-action-of button))
(eval (button-on-action-of button)))
(if (functionp (button-off-action-of button))
(funcall (button-off-action-of button))
(eval (button-off-action-of button)))))
(defmethod dialog-enter-notify ((button button) &optional window state)
(declare (Ignore window))
(if (host-to-canvas-mouse-state state)
(process-button-press-event button window)))
(defmethod dialog-leave-notify ((button button) &optional window)
(declare (Ignore window))
(if (button-alive-p button)
(process-button-press-event button window))
(setf (button-alive-p button) NIL))
(defmethod wb-refresh ((thing button))
(if (button-on-p thing)
(highlight-dialog-item thing)
(downlight-dialog-item thing)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Check-boxes
;;;
(defclass check-box (button)
((box-size :initform 10
:initarg :box-size
:accessor check-box-size-of
:documentation "The width (and length) in pixels of the check box.")
)
(:default-initargs :window-border-width 2)
)
(defmethod box-checked-p ((self check-box))
(button-on-p self))
(defmethod (setf box-checked-p) (new-value (self check-box))
(setf (button-on-p self) new-value))
(defmethod initialize-instance :after ((self check-box)
&rest initargs
&key (check? NIL))
(setf (button-on-p self) check?)
self)
(defmethod downlight-dialog-item ((self check-box))
(setf (box-checked-p self) NIL)
(let* ((drawable (window-of self))
(gcontext (gcontext-of self))
(line-width (dialog-border-width-of self))
(width (xlib::drawable-width drawable))
(height (xlib::drawable-height drawable))
)
(xlib::with-state (drawable)
(let ((erase-color (xlib::gcontext-background gcontext)))
(xlib:with-gcontext (gcontext :line-width line-width
:foreground erase-color)
(xlib:draw-segments drawable gcontext
(list 0 0 width height
0 (- height line-width)
(- width line-width) 0)))))
))
(defmethod highlight-dialog-item ((self check-box))
(setf (box-checked-p self) T)
(let* ((drawable (window-of self))
(gcontext (gcontext-of self))
(line-width (dialog-border-width-of self))
(width (xlib::drawable-width drawable))
(height (xlib::drawable-height drawable))
)
(xlib::with-state (drawable)
(xlib:with-gcontext (gcontext :line-width line-width)
(xlib:draw-segments drawable gcontext
(list 0 0 width height
0 (- height line-width)
(- width line-width) 0))
))))
(defmethod dialog-item-compute-geometry ((self check-box))
(let* ((window (window-of self))
(size (check-box-size-of self)))
(xlib::with-state (window)
(setf (xlib::drawable-width window) size
(xlib::drawable-height window) size))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; Text-buttons
;;;
(defclass text-button (button)
((text :initform " "
:initarg :text
:accessor text-button-text-of)
(text-margin :initform 3
:initarg :margin
:accessor text-button-margin-of)
(font :initform *default-menu-font*
:initarg :font
:accessor text-button-font-of)
)
)
(defun make-text-button (&rest args)
(apply #'make-instance 'text-button args))
(defmethod downlight-dialog-item ((self text-button))
(let* ((drawable (window-of self))
(gcontext (gcontext-of self))
(font (xlib::gcontext-font gcontext))
(text-margin (text-button-margin-of self))
(line-width (dialog-border-width-of self))
(text-start-x (+ line-width text-margin))
(text-start-y (+ line-width text-margin (xlib::font-ascent font)))
(width (xlib::drawable-width drawable))
(height (xlib::drawable-height drawable))
(colormap (xlib::window-colormap (window-of self)))
(light-gray (xlib::alloc-color colormap *light-gray-color*))
(dark-gray (xlib::alloc-color colormap *dark-gray-color*))
(lw/2 (round line-width 2))
(left-x lw/2)
(top-y lw/2)
(bottom-y (- height lw/2))
(right-x (- width line-width))
)
(xlib::with-state (drawable)
;; Left and top of button
(xlib:with-gcontext (gcontext :foreground light-gray :line-width line-width)
(xlib:draw-lines drawable gcontext
(list left-x bottom-y
left-x top-y
right-x top-y )))
;; Bottom and right of button
(xlib:with-gcontext (gcontext :foreground dark-gray :line-width line-width)
(xlib:draw-lines drawable gcontext
(list right-x (+ top-y lw/2)
right-x bottom-y
(+ left-x lw/2) bottom-y)))
;; Draw the text
(xlib::draw-image-glyphs drawable gcontext
text-start-x text-start-y
(text-button-text-of self))
))
)
(defmethod highlight-dialog-item ((self text-button))
(let* ((drawable (window-of self))
(gcontext (gcontext-of self))
(font (xlib::gcontext-font gcontext))
(text-margin (text-button-margin-of self))
(line-width (dialog-border-width-of self))
(text-start-x (+ line-width text-margin))
(text-start-y (+ line-width text-margin (xlib::font-ascent font)))
(width (xlib::drawable-width drawable))
(height (xlib::drawable-height drawable))
(colormap (xlib::window-colormap (window-of self)))
(light-gray (xlib::alloc-color colormap *light-gray-color*))
(dark-gray (xlib::alloc-color colormap *dark-gray-color*))
(lw/2 (round line-width 2))
(left-x lw/2)
(top-y lw/2)
(bottom-y (- height lw/2))
(right-x (- width line-width))
)
(xlib::with-state (drawable)
;; Left and top of button
(xlib:with-gcontext (gcontext :foreground dark-gray :line-width line-width)
(xlib:draw-lines drawable gcontext
(list left-x bottom-y
left-x top-y
right-x top-y )))
;; Right and bottom of button
(xlib:with-gcontext (gcontext :foreground light-gray :line-width line-width)
(xlib:draw-lines drawable gcontext
(list right-x (+ top-y lw/2)
right-x bottom-y
(+ left-x lw/2) bottom-y)))
;; Draw the text
(xlib::draw-image-glyphs drawable gcontext
text-start-x text-start-y
(text-button-text-of self))
)))
(defmethod dialog-item-compute-geometry :before
((self text-button))
(let ((gcontext (gcontext-of self))
(font (canvas-font-to-host-font
(text-button-font-of self))))
(setf (xlib::gcontext-font gcontext) font)))
(defmethod dialog-item-compute-geometry ((self text-button))
(let* ((gcontext (gcontext-of self))
(font (xlib::gcontext-font gcontext))
(window (window-of self))
(margin (text-button-margin-of self))
(text-width (xlib::text-extents
font
(text-button-text-of self)))
(text-height (+ (xlib::font-ascent font)
(xlib::font-descent font)))
(line-width (dialog-border-width-of self))
(button-width (+ text-width (* 2 (+ line-width margin))))
(button-height (+ text-height (* 2 (+ line-width margin)))))
(xlib::with-state (window)
(setf (xlib::drawable-width window) button-width
(xlib::drawable-height window) button-height))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; Text-dialog-item
;;;
(defclass text-dialog-item (dialog-item)
((text :initform " "
:initarg :text
:accessor dialog-text-of)
(text-margin :initform 2
:initarg :margin
:accessor text-margin-of)
(font :initform *default-menu-font*
:initarg :font
:accessor dialog-text-font-of)
)
)
(defmethod wb-refresh ((self text-dialog-item))
(let* ((drawable (window-of self))
(gcontext (gcontext-of self))
(font (xlib::gcontext-font gcontext))
(line-width (dialog-border-width-of self))
(text-margin (+ line-width (text-margin-of self)))
(text-start-x text-margin)
(text-start-y (+ text-margin (xlib::font-ascent font)))
(width (xlib::drawable-width drawable))
(height (xlib::drawable-height drawable))
)
;; Draw the text (boxed if necessary).
(xlib::with-state (drawable)
(if (> line-width 0)
(xlib::with-gcontext (gcontext :line-width line-width)
(xlib::draw-rectangle drawable gcontext 0 0 width height)))
(xlib::draw-image-glyphs drawable gcontext
text-start-x text-start-y
(dialog-text-of self))))
)
(defmethod dialog-item-compute-geometry :before
((self text-dialog-item))
(let ((gcontext (gcontext-of self))
(font (canvas-font-to-host-font
(dialog-text-font-of self))))
(setf (xlib::gcontext-font gcontext) font)))
(defmethod dialog-item-compute-geometry ((self text-dialog-item))
(let* ((gcontext (gcontext-of self))
(font (xlib::gcontext-font gcontext))
(window (window-of self))
(margin (text-margin-of self))
(line-width (dialog-border-width-of self))
(edges-width (* 2 (+ margin line-width)))
(text-width (xlib::text-extents
font
(dialog-text-of self)))
(text-height (+ (xlib::font-ascent font)
(xlib::font-descent font)))
(dialog-width (+ text-width edges-width))
(dialog-height (+ text-height edges-width)))
(xlib::with-state (window)
(setf (xlib::drawable-width window) dialog-width
(xlib::drawable-height window) dialog-height))))
(defmethod process-button-press-event ((self text-dialog-item) &optional window)
(declare (ignore self window))
)
(defmethod process-button-release-event ((self text-dialog-item) &optional window)
(declare (ignore self window))
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; Editable-text-dialog-item
;;;
(defclass editable-text-dialog-item (text-dialog-item)
((box-width :initform 200
:initarg :box-width
:accessor text-box-width-of)
(input-mode? :initform NIL
:initarg :await-input?
:accessor awaiting-input-p)
)
)
(defmethod wb-refresh ((self editable-text-dialog-item))
(let* ((drawable (window-of self))
(gcontext (gcontext-of self))
(font (xlib::gcontext-font gcontext))
(line-width (dialog-border-width-of self))
(text-margin (+ line-width (text-margin-of self)))
(text-start-x text-margin)
(text-start-y (+ text-margin (xlib::font-ascent font)))
(width (xlib::drawable-width drawable))
(height (xlib::drawable-height drawable))
)
;; Draw the text (boxed if necessary).
(xlib::with-state (drawable)
(if (> line-width 0)
(xlib::with-gcontext (gcontext :line-width line-width)
(xlib::draw-rectangle drawable gcontext 0 0 width height)))
(xlib::draw-image-glyphs drawable gcontext
text-start-x text-start-y
(dialog-text-of self))))
)
(defmethod dialog-item-compute-geometry ((self editable-text-dialog-item))
(let* ((gcontext (gcontext-of self))
(font (xlib::gcontext-font gcontext))
(window (window-of self))
(margin (text-margin-of self))
(line-width (dialog-border-width-of self))
(edges-width (* 2 (+ margin line-width)))
(text-width (xlib::text-extents
font
(dialog-text-of self)))
(text-height (+ (xlib::font-ascent font)
(xlib::font-descent font)))
(dialog-width (max (text-box-width-of self)
(+ text-width edges-width)))
(dialog-height (+ text-height edges-width))
)
(xlib::with-state (window)
(setf (xlib::drawable-width window) dialog-width
(xlib::drawable-height window) dialog-height))))
(defmethod process-button-press-event ((self editable-text-dialog-item)
&optional window)
(unless window (setf window (window-of self)))
(let* ((gcontext (gcontext-of self))
(width (xlib::drawable-width window))
(height (xlib::drawable-height window))
)
(setf (awaiting-input-p self) T)
(set-dialog-input-gcontext gcontext window)
(xlib::with-gcontext
(gcontext :foreground (xlib::gcontext-background gcontext))
(xlib::draw-rectangle window gcontext 0 0 width height t)
)
(wb-refresh self)
(xlib::grab-keyboard
window :owner-p t
:sync-pointer-p nil :sync-keyboard-p nil)
)
)
(defun set-dialog-input-gcontext (gcontext window
&key
(foreground *black-color*)
(background *white-color*))
(let* ((colormap (xlib::window-colormap window))
(fore-color (xlib::alloc-color
colormap
foreground))
(back-color (xlib::alloc-color
colormap
background))
)
(setf (xlib::gcontext-foreground gcontext) fore-color)
(setf (xlib::gcontext-background gcontext) back-color)
))
(defun reset-dialog-gcontext (self gcontext window)
(let* ((colormap (xlib::window-colormap window))
(fore-color (xlib::alloc-color
colormap
(dialog-foreground-color-of self)))
(back-color (xlib::alloc-color
colormap
(dialog-background-color-of self))))
(setf (xlib::gcontext-foreground gcontext) fore-color)
(setf (xlib::gcontext-background gcontext) back-color)
))
(defmethod process-button-release-event ((self editable-text-dialog-item)
&optional window)
(declare (ignore self window)))
(defmethod dialog-leave-notify ((self editable-text-dialog-item) &optional window)
(when (awaiting-input-p self)
(unless window (setf window (window-of self)))
(let* ((gcontext (gcontext-of self))
(width (xlib::drawable-width window))
(height (xlib::drawable-height window))
(line-width (dialog-border-width-of self))
(text-margin (+ line-width (text-margin-of self)))
(font (xlib::gcontext-font gcontext))
(text-start-x text-margin)
(text-start-y (+ text-margin (xlib::font-ascent font)))
)
;; Set input mode off
(setf (awaiting-input-p self) NIL)
(reset-dialog-gcontext self gcontext window)
(xlib::with-gcontext
(gcontext :foreground (xlib::gcontext-background gcontext))
(xlib::draw-rectangle window gcontext 0 0 width height t)
)
(wb-refresh self)
)
(xlib::ungrab-keyboard (xlib::drawable-display window))
))
(defmethod process-key-press-event ((self editable-text-dialog-item) window code state)
(let* ((gcontext (gcontext-of self))
(display (xlib::drawable-display window))
(width (xlib::drawable-width window))
(height (xlib::drawable-height window))
(font (xlib::gcontext-font gcontext))
(line-width (dialog-border-width-of self))
(text-margin (+ line-width (text-margin-of self)))
(text-start-x text-margin)
(text-start-y (+ text-margin (xlib::font-ascent font)))
character)
(setf character
(xlib::keycode->character display code state))
(when (awaiting-input-p self)
(cond ((eq character #\return)
(dialog-leave-notify self window)
)
((member
(format nil "~a" character)
'("CAPS-LOCK" "NIL" "LEFT-SHIFT"
"RIGHT-SHIFT" "LEFT-CONTROL"
"RIGHT-CONTROL" "LEFT-ALT"
"RIGHT-ALT")
:test #'string=)
)
(T
(if (dialog-text-of self)
(setf (dialog-text-of self)
(format nil "~a~a" (dialog-text-of self) character))
(setf (dialog-text-of self)
(format nil "~a" character)))
(when (or (eq character #\backspace)
(eq character #\Rubout)
(eq character #\Delete))
(let ((start 0)
(end (- (length (dialog-text-of self)) 2)))
(when (> start end) (setf end 0))
(setf (dialog-text-of self)
(subseq (dialog-text-of self) start end))))
(xlib::with-gcontext
(gcontext :foreground (xlib::gcontext-background gcontext)
:line-width 2)
(xlib::draw-rectangle window gcontext 0 0 width height t))
(xlib::draw-image-glyphs
window gcontext
text-start-x text-start-y
(dialog-text-of self))
(xlib::display-finish-output display)
)))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; list-dialog-item
;;;
(defclass list-dialog-item (text-dialog-item)
((item :initform NIL
:initarg :item
:accessor dialog-item-of)
(selected? :initform NIL
:initarg :selected?
:accessor dialog-item-selected-p)
)
)
(defmethod wb-refresh ((self list-dialog-item))
(if (dialog-item-selected-p self)
(highlight-dialog-item self)
(downlight-dialog-item self)))
(defmethod highlight-dialog-item ((self list-dialog-item))
(let* ((drawable (window-of self))
(gcontext (gcontext-of self))
(font (xlib::gcontext-font gcontext))
(line-width (dialog-border-width-of self))
(text-margin (+ line-width (text-margin-of self)))
(text-start-x text-margin)
(text-start-y (+ text-margin (xlib::font-ascent font)))
(width (xlib::drawable-width drawable))
(height (xlib::drawable-height drawable))
(colormap (xlib::window-colormap (parent-of drawable)))
(fore-color (xlib::alloc-color
colormap
(dialog-foreground-color-of self)))
(back-color (xlib::alloc-color
colormap
(dialog-background-color-of self)))
)
;; Draw the text (boxed if necessary).
(xlib::with-state (drawable)
(if (> line-width 0)
(xlib::with-gcontext (gcontext :line-width line-width)
(xlib::draw-rectangle drawable gcontext 0 0 width height)))
(xlib::with-gcontext (gcontext :background fore-color
:foreground back-color)
(xlib::draw-image-glyphs drawable gcontext
text-start-x text-start-y
(dialog-text-of self))))))
(defmethod downlight-dialog-item ((self list-dialog-item))
(let* ((drawable (window-of self))
(gcontext (gcontext-of self))
(font (xlib::gcontext-font gcontext))
(line-width (dialog-border-width-of self))
(text-margin (+ line-width (text-margin-of self)))
(text-start-x text-margin)
(text-start-y (+ text-margin (xlib::font-ascent font)))
(width (xlib::drawable-width drawable))
(height (xlib::drawable-height drawable))
)
;; Draw the text (boxed if necessary).
(xlib::with-state (drawable)
(if (> line-width 0)
(xlib::with-gcontext (gcontext :line-width line-width)
(xlib::draw-rectangle drawable gcontext 0 0 width height)))
(xlib::draw-image-glyphs drawable gcontext
text-start-x text-start-y
(dialog-text-of self)))))
(defmethod process-button-press-event ((self list-dialog-item) &optional window)
(declare (ignore self window))
(let ((owner (owner-dialog self)))
(cond
((dialog-item-selected-p self)
(downlight-dialog-item self)
(setf (dialog-item-selected-p self) NIL)
(when owner
(case (dialog-selection-type-of owner)
((:contiguous :disjoint)
(setf (selected-dialog-items-of owner)
(remove self (selected-dialog-items-of owner))))
(:single
(setf (selected-dialog-items-of owner) NIL)))
)
)
(T
(highlight-dialog-item self)
(setf (dialog-item-selected-p self) T)
(when owner
(case (dialog-selection-type-of owner)
((:contiguous :disjoint)
(push self (selected-dialog-items-of owner)))
(:single
(loop for item in (selected-dialog-items-of owner)
do
(downlight-dialog-item item)
(setf (dialog-item-selected-p item) NIL)
finally
(setf (selected-dialog-items-of owner) (list self)))))
)))))
(defmethod process-button-release-event ((self list-dialog-item) &optional window)
(declare (ignore self window))
)
| 30,368 | Common Lisp | .cl | 724 | 31.059392 | 88 | 0.556378 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | f89c348538fa3e9460704cea965aca924b3de1915052ee874fd257a7f8677553 | 32,829 | [
-1
] |
32,830 | dialog-clx.lsp | rwoldford_Quail/source/window-basics/prompt/dialog-clx.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; dialog-clx.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; Authors:
;;; R.W. Oldford 1994
;;;
;;;
;;;
(in-package :wb)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; dialogs
;;;
(defclass dialog ()
((window :initform NIL
:initarg :window
:accessor window-of)
(title :initform "Dialog"
:initarg :title
:accessor dialog-title-of)
(gcontext :initform NIL
:initarg :gcontext
:accessor gcontext-of)
(dialog-x :initform 5
:initarg :x
:accessor dialog-x-of)
(dialog-y :initform 5
:initarg :y
:accessor dialog-y-of)
(background-color :initform *grey-color*
:initarg :background-color
:accessor dialog-background-color-of)
(foreground-color :initform *black-color*
:initarg :foreground-color
:accessor dialog-foreground-color-of)
(border-width :initform 0
:initarg :border-width
:accessor dialog-border-width-of)
(horizontal-space :initform 5 :initarg :horizontal-space
:accessor dialog-h-space)
(vertical-space :initform 5 :initarg :vertical-space
:accessor dialog-v-space)
(text :initform NIL
:initarg :text
:accessor dialog-text-of)
(font :initform *default-menu-font*
:initarg :font
:accessor dialog-font-of)
(done? :initform NIL
:accessor dialog-done-p)
)
)
(defun dialog-p (thing)
(typep thing 'dialog))
(defun shutdown-dialog (dialog)
(xlib::unmap-window (window-of dialog))
(xlib::destroy-window (window-of dialog)))
(defun dialog-done (dialog)
(setf (dialog-done-p dialog) T))
(defmethod initialize-instance :after ((self dialog)
&key
gcontext
&allow-other-keys)
(let* (window
(parent (xlib::screen-root
(xlib::display-default-screen
*default-display*)))
(colormap (xlib::window-colormap parent))
(fore-color (xlib::alloc-color
colormap
(dialog-foreground-color-of self)))
(back-color (xlib::alloc-color
colormap
(dialog-background-color-of self)))
(width 16)
(height 16)
(title (dialog-title-of self))
(font (canvas-font-to-host-font
(dialog-font-of self)))
)
;; sort out the window
;; First get one.
(setf window
(xlib::create-window
:parent parent
:x (dialog-x-of self)
:y (dialog-y-of self)
:width 16 :height 16
:background back-color
:override-redirect :on
:border-width 2
:event-mask
(xlib::make-event-mask
:button-press
:button-release
:key-press
:key-release
:exposure
:owner-grab-button)))
;; Hook back to self from window
(if (xlib::window-plist window)
(push (cons :wb-class-instance self)
(xlib::window-plist window))
(setf (xlib::window-plist window)
(acons :wb-class-instance self NIL)))
;; Stuff the window away.
(setf (window-of self) window)
;; sort out the gcontext
(unless (xlib::gcontext-p gcontext)
(setf gcontext
(xlib::create-gcontext
:drawable parent)))
(setf (gcontext-of self) gcontext)
(setf (xlib::gcontext-background gcontext)
back-color)
(setf (xlib::gcontext-foreground gcontext)
fore-color)
(setf (xlib::gcontext-font gcontext) font)
;; set up the title etc. ... mimics host-window-clx
(xlib:set-wm-properties window
:name title
:icon-name title
:resource-name "Dialog"
:resource-class 'dialog
:x (dialog-x-of self) :y (dialog-y-of self)
:width width :height height
:min-width 10 :min-height 10
:input :off :initial-state :normal)
;; compute the interior
(dialog-compute-interior self)
;; compute the geometry
(dialog-compute-geometry self)
;; display the dialog
(dialog-display self)
;; clear the event queue
(xlib::display-finish-output *default-display*)
;; Return self
self
)
)
(defgeneric dialog-compute-interior (dialog)
(:documentation "Compute the interior for this dialog."))
(defmethod dialog-compute-interior ((self T))
"Does nothing."
(declare (ignore self))
NIL)
(defgeneric dialog-compute-geometry (dialog)
(:documentation "Compute the geometry for this dialog."))
(defmethod dialog-compute-geometry ((self T))
"Does nothing."
(declare (ignore self))
NIL)
(defgeneric dialog-display (dialog)
(:documentation "Display this dialog."))
(defmethod dialog-display ((self dialog))
(let ((window (window-of self)))
(xlib::map-window window)
(xlib::map-subwindows window)))
(defgeneric dialog-execute (dialog)
(:documentation "Run the dialog."))
(defmacro when-dialog-done ((dialog &key (timeout 180)) &body forms)
"Let's the dialog appear and process events until it declares ~
itself done or timeout seconds have elapsed. It then processes ~
the forms in the body in sequence and returns the value of the last form ~
processed. ~
(:required ~
(:arg dialog The dialog that is processing events.) ~
) ~
(:key ~
(:arg timeout 180 The number of seconds to wait before processing forms ~
anyway. If non-NIL this should be an integer greater than zero. ~
If NIL, then the loop exits only when dialog-done-p returns non-NIL for ~
this dialog so there is a potential infinite loop here.))~
(:body ~
(:arg forms Forms to be evaluated when the dialog is done processing events.~
))"
(let ((time-sym (gensym "timeout"))
(dialog-sym (gensym "dialog")))
`(let ((,time-sym ,timeout)
(,dialog-sym ,dialog))
(cond
((and ,time-sym (numberp ,time-sym) (> ,time-sym 0))
(let ((start (get-internal-real-time))
(elapsed-time))
(loop
(when (dialog-done-p ,dialog-sym)
(return (progn ,@forms)))
(setf elapsed-time
(/ (- (get-internal-real-time)
start)
internal-time-units-per-second))
(when (> elapsed-time ,timeout)
(warn "~&Dialog ~s timed out after ~s seconds. ~&~
Processing continued.~%"
,dialog-sym elapsed-time)
(return (progn ,@forms)))))
)
((null ,time-sym)
(loop
(when (dialog-done-p ,dialog-sym)
(return (progn ,@forms)))))
(T (error "~&Illegal timeout argument: ~s seconds.~%"
,time-sym)))
)
))
(defmethod process-button-press-event ((self dialog) &optional window)
"Dialogs don't field button events."
(declare (ignore self window))
NIL)
(defmethod process-button-release-event ((self dialog) &optional window)
"Dialogs don't field button events."
(declare (ignore self window))
NIL)
(defmethod process-key-press-event ((self dialog) window code state)
"Dialogs don't field key events."
(declare (ignore self window code state))
NIL)
(defmethod wb-refresh ((self dialog))
(let* ((gcontext (gcontext-of self))
(border-width (dialog-border-width-of self))
(window (window-of self))
(h-space (dialog-h-space self))
(v-space (dialog-v-space self))
(font (xlib::gcontext-font gcontext))
(font-ascent (xlib::font-ascent font))
(text-height
(+ font-ascent (xlib::font-descent font)))
(title-width (xlib::text-extents font (dialog-title-of self))))
(xlib::with-state (window)
(xlib::draw-image-glyphs window
gcontext
(round
(- (xlib::drawable-width window)
title-width)
2)
(+ border-width
v-space
font-ascent)
(dialog-title-of self))
(xlib::draw-image-glyphs window
gcontext
(+ border-width h-space)
(+ border-width
v-space text-height
v-space font-ascent)
(dialog-text-of self))))
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; y-or-n-dialog
;;;
;;;
(defclass y-or-n-dialog (dialog)
((yes-text :initform "Yes"
:initarg :yes-text
:accessor yes-text-of)
(no-text :initform "No"
:initarg :no-text
:accessor no-text-of)
(cancel-text :initform "Cancel"
:initarg :cancel-text
:accessor cancel-text-of)
(yes-button :initform NIL
:accessor yes-button-of)
(no-button :initform NIL
:accessor no-button-of)
(cancel-button :initform NIL
:accessor cancel-button-of)
(selection :initform T
:accessor y-or-n-selection-of)
))
(defun y-or-n-dialog (message
&key
(yes-text "Yes")
(no-text "No")
(cancel-text "Cancel")
&allow-other-keys)
(let ((d (make-instance 'y-or-n-dialog
:text message
:yes-text yes-text
:no-text no-text
:cancel-text cancel-text)))
(when-dialog-done (d :timeout NIL) (y-or-n-selection-of d))))
(defmethod dialog-compute-interior ((self y-or-n-dialog))
(let ((font (dialog-font-of self))
(text (dialog-text-of self))
(yes-text (yes-text-of self))
(no-text (no-text-of self))
(cancel-text (cancel-text-of self))
(gcontext (gcontext-of self)))
(unless text
(setf text
(format NIL "~a or ~a?" yes-text no-text))
)
(setf (xlib::gcontext-font gcontext)
(canvas-font-to-host-font font))
(setf (dialog-text-of self) text
(yes-button-of self)
(make-text-button
:text yes-text
:gcontext gcontext
:font font
:border-width 2
:on-action
#'(lambda ()
(shutdown-dialog self)
(setf (y-or-n-selection-of self) T)
(dialog-done self))
)
(no-button-of self)
(make-text-button
:text no-text
:gcontext gcontext
:font font
:border-width 2
:on-action
#'(lambda ()
(shutdown-dialog self)
(setf (y-or-n-selection-of self) NIL)
(dialog-done self)
)
)
(cancel-button-of self)
(make-text-button
:text cancel-text
:gcontext gcontext
:border-width 2
:font font
:on-action
#'(lambda ()
(shutdown-dialog self)
(format *quail-terminal-io* "~&Cancelled.~%")
(setf (y-or-n-selection-of self) :cancel)
(dialog-done self)
(throw :cancel T))
)))
(let* ((dw (window-of self))
(yes-bw (window-of (yes-button-of self)))
(no-bw (window-of (no-button-of self)))
(cancel-bw (window-of (cancel-button-of self))))
(xlib::reparent-window yes-bw dw 20 20)
(xlib::reparent-window no-bw dw 20 50)
(xlib::reparent-window cancel-bw dw 20 80))
self)
(defmethod dialog-compute-geometry ((self y-or-n-dialog))
(let* ((y-b (yes-button-of self))
(n-b (no-button-of self))
(c-b (cancel-button-of self))
(y-bw (window-of y-b))
(n-bw (window-of n-b))
(c-bw (window-of c-b))
(gcontext (gcontext-of self))
(window (window-of self))
(border-width (dialog-border-width-of self))
(h-space (dialog-h-space self))
(v-space (dialog-v-space self))
(font (xlib::gcontext-font gcontext))
(font-ascent (xlib::font-ascent font))
(text-height
(+ font-ascent (xlib::font-descent font)))
(title-width (xlib::text-extents font (dialog-title-of self)))
(text-width (xlib::text-extents font (dialog-text-of self)))
(item-height (xlib::drawable-height y-bw))
(y-width (xlib::drawable-width y-bw))
(n-width (xlib::drawable-width n-bw))
(c-width (xlib::drawable-width c-bw))
(button-width (max y-width n-width c-width))
self-width self-height button-y)
(setf (xlib::drawable-width y-bw) button-width
(xlib::drawable-width n-bw) button-width
(xlib::drawable-width c-bw) button-width)
(setf self-width
(+ border-width
h-space
(max text-width title-width
(+ button-width h-space button-width h-space button-width))
h-space
border-width)
self-height
(+ border-width
v-space
text-height
v-space
text-height
v-space
item-height
v-space
border-width))
(xlib::with-state (window)
(setf (xlib::drawable-width window) self-width
(xlib::drawable-height window) self-height))
(setf button-y (- self-height
item-height v-space border-width))
(xlib::with-state (y-bw)
(setf (xlib::drawable-x y-bw) (+ h-space border-width)
(xlib::drawable-y y-bw)
button-y))
(xlib::with-state (n-bw)
(setf (xlib::drawable-x n-bw)
(+ border-width (* 2 h-space) button-width)
(xlib::drawable-y n-bw)
button-y))
(xlib::with-state (c-bw)
(setf (xlib::drawable-x c-bw)
(+ border-width (* 3 h-space) button-width button-width)
(xlib::drawable-y c-bw)
button-y))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; list-dialog
;;;
;;;
(defclass list-dialog (dialog)
((ok-text :initform "OK"
:initarg :ok-text
:accessor ok-text-of)
(cancel-text :initform "Cancel"
:initarg :cancel-text
:accessor cancel-text-of)
(ok-button :initform NIL
:accessor ok-button-of)
(cancel-button :initform NIL
:accessor cancel-button-of)
(selection-type :initform :disjoint
:accessor dialog-selection-type-of
:initarg :selection-type)
(selected-items :initform NIL
:accessor selected-dialog-items-of)
(dialog-items :initform NIL
:accessor dialog-items-of)
(list-of-items :initform NIL
:initarg :items
:accessor list-dialog-items-of)
(item-print-function :initform #'(lambda (x) (format nil "~a" x))
:initarg :item-print-function
:accessor dialog-item-print-function-of)
(list-window :initform NIL
:accessor dialog-list-window-of)
))
(defmethod dialog-display ((self list-dialog))
(let ((window (window-of self)))
(xlib::map-window window)
(xlib::map-subwindows window)
(xlib::map-subwindows (dialog-list-window-of self))
))
(defun select-item-from-list
(item-list
&key
(title "List selection")
(prompt-text "Please choose from the following list:")
(select-text "OK")
(cancel-text "Cancel")
(item-print-function
#'(lambda (x) (format nil "~a" x)))
(selection-type :single))
(let ((d (make-instance 'list-dialog
:title title
:text prompt-text
:item-print-function item-print-function
:ok-text select-text
:cancel-text cancel-text
:selection-type selection-type
:items item-list)))
(when-dialog-done (d :timeout NIL)
(loop for dialog-item in (selected-dialog-items-of d)
collect
(dialog-item-of dialog-item)))))
(defmethod dialog-compute-interior ((self list-dialog))
(let* ((font (dialog-font-of self))
(text (dialog-text-of self))
(ok-text (ok-text-of self))
(cancel-text (cancel-text-of self))
(gcontext (gcontext-of self))
(item-function (dialog-item-print-function-of self))
(colormap (xlib::window-colormap
(xlib::screen-root
(xlib::display-default-screen
*default-display*))))
(back-color (xlib::alloc-color
colormap
(dialog-background-color-of self)))
dialog-window list-window ok-bw cancel-bw)
(unless text
(case (dialog-selection-type-of self)
((:disjoint :contiguous)
(setf text "Please choose one or more:"))
(:single (setf text "Please choose one:"))))
(setf (xlib::gcontext-font gcontext)
(canvas-font-to-host-font font))
(setf (dialog-text-of self) text
(ok-button-of self)
(make-text-button
:text ok-text
:gcontext gcontext
:font font
:border-width 2
:on-action
#'(lambda ()
(shutdown-dialog self)
(dialog-done self))
)
(cancel-button-of self)
(make-text-button
:text cancel-text
:gcontext gcontext
:font font
:border-width 2
:on-action
#'(lambda ()
(shutdown-dialog self)
(format *quail-terminal-io* "~&Cancelled.~%")
(dialog-done self)
(throw :cancel T))
))
(setf (dialog-items-of self)
(loop for item in (list-dialog-items-of self)
collect
(make-instance 'list-dialog-item
:font font :gcontext gcontext
:owner self
:item item
:text (funcall item-function item))))
;; The following sets up a default selection.
(process-button-press-event (first (dialog-items-of self)))
(process-button-release-event (first (dialog-items-of self)))
(setf dialog-window (window-of self))
(setf list-window
(xlib::create-window
:parent dialog-window
:x 0 :y 0 :width 16 :height 16
:background back-color
:override-redirect :on
:border-width 1 ;;(dialog-border-width-of self)
:event-mask
(xlib::make-event-mask
:button-press
:button-release
:key-press
:key-release
:exposure
:owner-grab-button)))
(setf (dialog-list-window-of self) list-window)
(loop for dialog-item in (dialog-items-of self)
do (xlib::reparent-window
(window-of dialog-item)
list-window 0 0))
(setf ok-bw (window-of (ok-button-of self)))
(setf cancel-bw (window-of (cancel-button-of self)))
(xlib::reparent-window ok-bw dialog-window 0 0)
(xlib::reparent-window cancel-bw dialog-window 0 0)
self))
(defmethod dialog-compute-geometry ((self list-dialog))
(let* ((y-b (ok-button-of self))
(c-b (cancel-button-of self))
(y-bw (window-of y-b))
(c-bw (window-of c-b))
(list-window (dialog-list-window-of self))
(gcontext (gcontext-of self))
(window (window-of self))
(border-width (dialog-border-width-of self))
(h-space (dialog-h-space self))
(v-space (dialog-v-space self))
(font (xlib::gcontext-font gcontext))
(font-ascent (xlib::font-ascent font))
(text-height
(+ font-ascent (xlib::font-descent font)))
(title-width (xlib::text-extents font (dialog-title-of self)))
(text-width (xlib::text-extents font (dialog-text-of self)))
(button-height (xlib::drawable-height y-bw))
(y-width (xlib::drawable-width y-bw))
(c-width (xlib::drawable-width c-bw))
(button-width (max y-width c-width))
self-width self-height button-y list-y
list-width list-height)
;; First the interior of the list window
(setf list-height
(* (length (list-dialog-items-of self))
(reduce #'(lambda (height dialog-item)
(max height
(xlib::drawable-height
(window-of dialog-item))))
(dialog-items-of self)
:initial-value 0)))
(setf list-width
(reduce #'(lambda (width dialog-item)
(max width
(xlib::drawable-width
(window-of dialog-item))))
(dialog-items-of self)
:initial-value 0))
;; sort out button-width
(setf (xlib::drawable-width y-bw) button-width
(xlib::drawable-width c-bw) button-width)
;; Now self width and height
(setf self-width
(+ border-width
h-space
(max title-width
text-width
(+ button-width h-space button-width)
list-width
)
h-space
border-width)
self-height
(+ border-width
v-space
text-height
v-space
text-height
v-space
list-height
v-space
button-height
v-space
border-width))
(setf (xlib::drawable-width list-window)
(- self-width border-width h-space h-space border-width))
(setf (xlib::drawable-height list-window)
list-height)
(loop for item in (dialog-items-of self)
with h = 0
do
(let* ((w (window-of item))
(delta (xlib::drawable-height w)))
(setf (xlib::drawable-width w) list-width)
(setf (xlib::drawable-y w) h)
(incf h delta)))
(xlib::with-state (window)
(setf (xlib::drawable-width window) self-width
(xlib::drawable-height window) self-height))
;; Now the locations
(xlib::with-state (list-window)
(setf (xlib::drawable-x list-window) (+ h-space border-width)
(xlib::drawable-y list-window)
(+ border-width
v-space
text-height
v-space
text-height
v-space)))
(setf button-y (- self-height
button-height v-space border-width))
(xlib::with-state (y-bw)
(setf (xlib::drawable-x y-bw) (+ h-space border-width)
(xlib::drawable-y y-bw)
button-y))
(xlib::with-state (c-bw)
(setf (xlib::drawable-x c-bw)
(+ border-width h-space button-width h-space)
(xlib::drawable-y c-bw)
button-y))))
| 25,300 | Common Lisp | .cl | 660 | 26.039394 | 81 | 0.508367 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 5328feaba41fbc08e2290b56d6a5f6f66b9c5697ac4c3ae257eebc64411487ed | 32,830 | [
-1
] |
32,831 | collect-input-clx.lsp | rwoldford_Quail/source/window-basics/prompt/collect-input-clx.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; collect-input-clx.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; R.W. Oldford 1992
;;;
;;;
;;;
;;;----------------------------------------------------------------------------------
;;;
;;; History:
;;;
;;; - Construct a uniform prompting facility.
;;;
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(collect-input)))
(defun collect-input (prompt-default-pairs
&key
(prompt-text "Enter text and/or exit dialog.")
(select-text "OK")
(cancel-text "Cancel")
(columns 1)
)
"Prompts user for value of several items as given by the ~
argument prompt-default-pairs. Prompt-text, select-text, and cancel-text ~
are strings which will appear in the message, select button, and cancel ~
button, respectively. Columns is the number of columns to be used in the ~
display (default 1). ~
(:returns An updated list of prompt-value-pairs. Values are strings or NIL ~
(if no value was specified))."
(setq prompt-default-pairs
(loop
for pair in prompt-default-pairs
collect
(cond
((consp pair) pair)
(T (cons pair NIL)))))
(let
((d (make-instance 'collect-input-dialog
:items prompt-default-pairs
:text prompt-text
:ok-text select-text
:cancel-text cancel-text
:columns columns)))
(when-dialog-done (d :timeout NIL)
(loop for item in (slot-value d 'collect-input)
collect
(cons
(dialog-original-item (car item))
(if (zerop (length (dialog-text-of (cdr item))))
NIL
(dialog-text-of (cdr item))))))
))
(defclass collect-input-dialog (dialog)
((ok-text :initform "OK"
:initarg :ok-text
:accessor ok-text-of)
(cancel-text :initform "Cancel"
:initarg :cancel-text
:accessor cancel-text-of)
(ok-button :initform NIL
:accessor ok-button-of)
(cancel-button :initform NIL
:accessor cancel-button-of)
(item-pairs :initarg :items
:initform NIL)
(collect-input :initform NIL)
(collect-input-windows :initform NIL)
(columns :initform 1
:initarg :columns)
)
(:default-initargs :text "Enter text and/or exit dialog."
:title "Input dialog")
(:documentation "A dialog that allows the user to set ~
the logical value of several parameters at once.")
)
(defmethod dialog-compute-interior ((self collect-input-dialog))
(let* ((font (dialog-font-of self))
(ok-text (ok-text-of self))
(cancel-text (cancel-text-of self))
(gcontext (gcontext-of self))
(item-pairs (slot-value self 'item-pairs))
(n-items (length item-pairs))
(collect-input (make-list n-items))
(collect-input-windows (make-list n-items))
(window (window-of self))
)
(setf (xlib::gcontext-font gcontext)
(canvas-font-to-host-font font))
(setf (ok-button-of self)
(make-text-button
:text ok-text
:gcontext gcontext
:font font
:border-width 2
:on-action
#'(lambda ()
(shutdown-dialog self)
(dialog-done self))
)
(cancel-button-of self)
(make-text-button
:text cancel-text
:gcontext gcontext
:font font
:border-width 2
:on-action
#'(lambda ()
(shutdown-dialog self)
(format *quail-terminal-io* "~&Cancelled.~%")
(dialog-done self)
(throw :cancel T))
))
(let (text-item edit-text)
(loop
for i from 0 to (- n-items 1)
as item in item-pairs
do
(setf text-item
(make-instance 'text-dialog-item
:gcontext gcontext
:font font
:item (car item)
:text (string (car item))))
(setf edit-text
(make-instance 'editable-text-dialog-item
:box-size 20
:foreground-color *black-color*
:background-color *gray-color*
:border-width 2
:text (or (cdr item) "")))
(setf (elt collect-input i)
(cons text-item edit-text))
(setf (elt collect-input-windows i)
(cons (window-of text-item)
(window-of edit-text)))))
(setf
(slot-value self 'collect-input)
collect-input
(slot-value self 'collect-input-windows)
collect-input-windows)
)
)
(defmethod dialog-compute-geometry ((self collect-input-dialog))
(let* ((ok-b (ok-button-of self))
(c-b (cancel-button-of self))
(ok-bw (window-of ok-b))
(c-bw (window-of c-b))
(gcontext (gcontext-of self))
(window (window-of self))
(border-width (dialog-border-width-of self))
(h-space (dialog-h-space self))
(v-space (dialog-v-space self))
(font (xlib::gcontext-font gcontext))
(font-ascent (xlib::font-ascent font))
(text-height
(+ font-ascent (xlib::font-descent font)))
(title-width (xlib::text-extents font (dialog-title-of self)))
(text-width (xlib::text-extents font (dialog-text-of self)))
(ok-width (xlib::drawable-width ok-bw))
(c-width (xlib::drawable-width c-bw))
(button-width (max ok-width c-width))
(button-height (xlib::drawable-height ok-bw))
(collect-input-windows (slot-value self 'collect-input-windows))
(max-item-width
(+ h-space
(reduce #'(lambda (width collect-input)
(max width
(+ (xlib::drawable-width
(car collect-input))
(xlib::drawable-width
(cdr collect-input)))))
collect-input-windows
:initial-value 0)))
(max-item-height
(+ v-space
(reduce #'(lambda (height collect-input)
(max height
(xlib::drawable-height
(car collect-input))
(xlib::drawable-height
(cdr collect-input))))
collect-input-windows
:initial-value 0)))
(ncols (slot-value self 'columns))
(nrows (ceiling (length collect-input-windows) ncols))
(list-width (- (* ncols
(+ h-space max-item-width))
h-space))
(list-height (- (* nrows
max-item-height)
v-space))
(self-width
(+ border-width border-width h-space h-space
(max
list-width
title-width
text-width
(+ button-width h-space button-width))))
(list-y (+ border-width
v-space
text-height
v-space
text-height
v-space))
(self-height
(+ list-y
list-height
v-space
button-height
v-space
border-width))
(button-y (- self-height
button-height
v-space
border-width))
)
;; The dialog:
(xlib::with-state (window)
(setf (xlib::drawable-width window) self-width
(xlib::drawable-height window) self-height))
;; The buttons
(setf (xlib::drawable-width ok-bw) button-width
(xlib::drawable-width c-bw) button-width)
(xlib::reparent-window ok-bw window
(+ h-space border-width)
button-y)
(xlib::reparent-window c-bw window
(+ border-width h-space button-width h-space)
button-y)
;; The collect-input-windows
(setf max-item-width
(floor (- self-width
(* 2 (+ border-width h-space))
(* (- ncols 1) 2 h-space))
ncols))
(loop
for item in collect-input-windows
as dialog-item in (slot-value self 'collect-input)
with y-start = list-y
with x-start = (+ border-width h-space)
with row = 0
with col = 0
with col-width = (+ max-item-width h-space h-space)
do
(let ((tw (car item))
(cbw (cdr item)))
(xlib::reparent-window tw window
(+ x-start (* col col-width))
(+ y-start
(dialog-border-width-of
(cdr dialog-item))
(* row max-item-height)))
(xlib::reparent-window cbw window
(- (+ x-start
(* col col-width)
max-item-width)
(xlib::drawable-width cbw))
(+ y-start (* row max-item-height)))
(cond
((>= row (1- nrows))
(incf col 1)
(setq row 0))
(T (incf row 1))))
)
))
#|
(setf items
(collect-input (list 'heycheckmeOut!! "try this" "Or this" "or this"
"Gold" "Silver" "Bronze")))
(setf items (collect-input items))
(collect-input (list 'heycheckmeOut!! "try this" "Or this" "or this"
"Gold" "Silver" "Bronze")
:columns 2)
(collect-input (list 'heycheckmeOut!! "try this" "Or this" "or this"
"Gold" "Silver" "Bronze")
:columns 3)
(collect-input (list 'heycheckmeOut!! "try this" "Or this" "or this"
"Gold" "Silver" "Bronze"
"platinum" "Tin" "lead" "zinc"
"iron")
:prompt-text "Give the man a medal!"
:select-text "DO IT"
:cancel-text "Forget it." :columns 3)
|#
| 11,649 | Common Lisp | .cl | 297 | 25.20202 | 86 | 0.46414 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 72a9534789bd53feb681f101c5be4973aca992b0fd7066bc6ae41e3ff436c740 | 32,831 | [
-1
] |
32,832 | prompt-mcl.lsp | rwoldford_Quail/source/window-basics/prompt/prompt-mcl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; prompt-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; Greg Anglin 1991
;;; H.A. Chipman 1991
;;; C.B. Hurley 1989-1991
;;; J.A. McDonald 1988-89
;;; R.W. Oldford 1989-1992
;;; J.O. Pedersen 1988-89
;;;
;;;
;;;
;;;----------------------------------------------------------------------------------
;;;
;;; History:
;;;
;;; - Construct a uniform prompting facility.
;;;
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(prompt-user save-value prompt-t-or-f prompt-true-or-false
prompt-for-items)))
(defun prompt-user (&key (type T)
(read-type :string)
(prompt-string NIL)
(initial-string "")
(ok-text "OK")
(cancel-text "Cancel")
left top
width
(height 100))
"Prompts user for input. ~
(:key ~
(:arg Prompt-string NIL The string used to query the user.) ~
(:arg initial-string \"\" Appears to the user as the default answer.) ~
(:arg ok-text \"OK\" String used to prompt user for confirmation.) ~
(:arg cancel-text \"Cancel\" String used to prompt user for cancellation.) ~
(:arg type T Data type of item to be returned by user. Any Common Lisp ~
data-type is acceptable.) ~
(:arg read-type :string How to read the typed input. ~
Legal values are :string :eval or :read.) ~
(:arg left NIL Location of the left of the prompt window.) ~
(:arg top NIL Location of the top of the prompt window.) ~
(:arg width NIL Width of prompt window.) ~
(:arg height 100 Height of prompt window.) ~
)"
(setq prompt-string
(if prompt-string
(if (stringp prompt-string)
(format NIL prompt-string)
(format NIL "~a" prompt-string))
(format nil "Please enter a ~S" type)))
(setq width (min (- (screen-width) 40)
(or width (+ 180 (* 5 (length prompt-string))))))
(setq left (or left (- (screen-mouse-x) (round (/ width 2)))))
(setq left (min (max 10 left ) (- (screen-width) width 10)))
(setq top (or top (+ (screen-mouse-y) (round (/ height 2)))))
(setq top (max (min top (- (screen-height) 30)) (+ height 10)))
(let* ((result (ccl:get-string-from-user
prompt-string
:initial-string initial-string
:size (h-draw:make-point width height)
:ok-text ok-text
:cancel-text cancel-text
:position (h-draw:make-point left (screen-to-host-y top)))))
(setf result
(case read-type
(:string result)
(:eval (eval (read-from-string result :preserve-whitespace t)))
(:read (read-from-string result :preserve-whitespace t))
)
)
(if (typep result type)
result
(quail-error "~S is not of type ~S" result type))))
(defun save-value (arg)
"Saves the value of arg as the value of a symbol retrieved from a prompt."
(eval
`(setf ,(prompt-user :read-type :read
:result-type 'symbol
:prompt-string
"Give a symbol to store the value on:")
,arg)))
(defun prompt-t-or-f (message
&key
(true-text "Yes")
(false-text "No")
(cancel-text "Cancel"))
"Prompts the user to make a decision between two alternatives (true-text and false-text) ~
in response to the information given in message. T is returned if the first letter ~
of the true-text (default the string Yes) is typed by the user; NIL is returned if the first letter ~
of the false-text (default the string No) is typed by the user. ~
If cancelled by the user, processing ends. ~
(:see-also prompt-for-items pick-one prompt-true-or-false)"
(ccl::y-or-n-dialog message
:yes-text true-text
:no-text false-text
:cancel-text cancel-text))
(defun prompt-true-or-false (message
&key
(true-text "Yes")
(false-text "No")
(cancel-text "Cancel"))
"Prompts the user to make a decision between two alternatives (true-text and false-text) ~
in response to the information given in message. T is returned if the ~
true-text (default the string Yes) is typed by the user; NIL is returned if the ~
false-text (default the string No) is typed by the user. ~
If cancelled by the user, processing ends. ~
(:see-also prompt-for-items pick-one prompt-t-or-f)"
(prompt-t-or-f message
:true-text true-text
:false-text false-text
:cancel-text cancel-text))
(defun prompt-for-items (list
&key (prompt-text "Choose")
(item-function NIL)
(selection-type :single))
"Prompts user to select one or more items from the list. ~
Prompt-text is displayed to help the user choose. ~
Selection-type is one of :single (indicating only a single item ~
can be selected), :contiguous (indicating only contiguous items ~
can be selected), and :disjoint (indicating that any subset of the items ~
can be selected). It returns a list of all items selected, NIL if no items ~
were selected. ~
Item-print-function is the function called on each item to display it in ~
selection table. ~
(:see-also pick-one prompt-t-or-f)"
(if (functionp item-function)
(ccl::select-item-from-list list
:window-title prompt-text
:table-print-function
#'(lambda(x s) (princ (funcall item-function x) s))
:selection-type selection-type)
(ccl::select-item-from-list list
:window-title prompt-text
:selection-type selection-type)))
| 6,893 | Common Lisp | .cl | 148 | 35.432432 | 124 | 0.533254 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 67c1159f4c817ca8f7de41493e80c0bbd07edc64ac14d5c19eb71b891e372dab | 32,832 | [
-1
] |
32,833 | prompt-patch-clx.lsp | rwoldford_Quail/source/window-basics/prompt/prompt-patch-clx.lsp | (in-package :wb)
(defmethod initialize-instance :after ((self button) &rest initargs))
(defmethod initialize-instance :after ((self y-or-n-dialog) &rest initargs))
(defmethod initialize-instance :after ((self list-dialog-item) &rest initargs))
(defmethod initialize-instance :after ((self list-dialog) &rest initargs))
(defmethod initialize-instance :after ((self text-dialog) &rest initargs))
(defmethod wb-refresh ((self list-dialog)) (call-next-method))
(load "Source/Window-Basics/Mouse/mouse-clx2")
(load "Source/Window-Basics/Prompt/dialog-items-clx")
(load "Source/Window-Basics/Prompt/dialog-clx")
(load "Source/Window-Basics/Prompt/check-items-clx")
(load "Source/Window-Basics/Prompt/collect-input-clx")
(load "Source/Window-Basics/Prompt/pick-one-clx")
(load "Source/Window-Basics/Prompt/prompt-clx2")
| 829 | Common Lisp | .cl | 14 | 57.071429 | 80 | 0.765068 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 7256f7ac4928336aab8c27a2de0423ec96441871fdbe66c4783e0edfa013e0be | 32,833 | [
-1
] |
32,834 | dialog-items-mcl.lsp | rwoldford_Quail/source/window-basics/prompt/dialog-items-mcl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; dialog-items-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; Authors:
;;; R.W. Oldford 1994
;;;
;;;
;;;
(in-package :wb)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; dialog items in ccl are used.
;;;
;; this *all-menus* parameter is used by the re-enable-menubars function to work
;; around a bug on the Mac which occasionally leaves menus disabled after errors
(defparameter *all-menus*
(list ccl:*apple-menu*
ccl:*edit-menu*
ccl:*eval-menu*
ccl:*file-menu*
ccl:*tools-menu*
ccl:*windows-menu*))
;; this re-enable-menubars function uses the *all-menus* parameter to work
;; around a bug on the Mac which occasionally leaves menus disabled after errors.
;; on other systems, this should probably be empty.
(defun re-enable-menubars (&rest whatever)
(declare (ignore whatever))
(loop for m in (union *all-menus*
(union (ccl::menubar)
(loop for vw in (canvases)
append (loop for (key . m) in
(slot-value vw 'title-menus)
;; using key here just suppresses
;; a warning message
collect (progn key m))) :test #'eq)
:test #'eq)
do (ccl::menu-enable m)))
| 1,824 | Common Lisp | .cl | 45 | 30.044444 | 86 | 0.428976 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 8113b12e4cb6188b7363fd5b8c7610f8cb8084cfca67c820a4b9e56a9fd12de8 | 32,834 | [
-1
] |
32,835 | prompt-mcl43.lsp | rwoldford_Quail/source/window-basics/prompt/prompt-mcl43.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; prompt-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; Greg Anglin 1991
;;; H.A. Chipman 1991
;;; C.B. Hurley 1989-1991
;;; J.A. McDonald 1988-89
;;; R.W. Oldford 1989-1992
;;; J.O. Pedersen 1988-89
;;;
;;;
;;;
;;;----------------------------------------------------------------------------------
;;;
;;; History:
;;;
;;; - Construct a uniform prompting facility.
;;;
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(prompt-user save-value prompt-t-or-f prompt-true-or-false
prompt-for-items)))
(defun prompt-user (&key (type T)
(read-type :string)
(prompt-string NIL)
(initial-string "")
(ok-text "OK")
(cancel-text "Cancel")
left top
width
(height 100))
"Prompts user for input. ~
(:key ~
(:arg Prompt-string NIL The string used to query the user.) ~
(:arg initial-string \"\" Appears to the user as the default answer.) ~
(:arg ok-text \"OK\" String used to prompt user for confirmation.) ~
(:arg cancel-text \"Cancel\" String used to prompt user for cancellation.) ~
(:arg type T Data type of item to be returned by user. Any Common Lisp ~
data-type is acceptable.) ~
(:arg read-type :string How to read the typed input. ~
Legal values are :string :eval or :read.) ~
(:arg left NIL Location of the left of the prompt window.) ~
(:arg top NIL Location of the top of the prompt window.) ~
(:arg width NIL Width of prompt window.) ~
(:arg height 100 Height of prompt window.) ~
)"
(setq prompt-string
(if prompt-string
(if (stringp prompt-string)
(format NIL prompt-string)
(format NIL "~a" prompt-string))
(format nil "Please enter a ~S" type)))
(setq width (min (- (screen-width) 40)
(or width (+ 180 (* 5 (length prompt-string))))))
(setq left (or left (- (screen-mouse-x) (round (/ width 2)))))
(setq left (min (max 10 left ) (- (screen-width) width 10)))
(setq top (or top (+ (screen-mouse-y) (round (/ height 2)))))
(setq top (max (min top (- (screen-height) 30)) (+ height 10)))
(let* ((result (ccl:get-string-from-user
prompt-string
:initial-string initial-string
:size (h-draw:make-point width height)
:ok-text ok-text
:cancel-text cancel-text
:position (h-draw:make-point left (screen-to-host-y top)))))
(setf result
(case read-type
(:string result)
(:eval (eval (read-from-string result :preserve-whitespace t)))
(:read (read-from-string result :preserve-whitespace t))
)
)
(let ((w (car (ccl::windows))))
(if (typep w 'canvas)
(mapcar #'ccl:menu-enable (mapcar #'cdr (slot-value w 'title-menus)))))
(if (typep result type)
result
(quail-error "~S is not of type ~S" result type))))
(defun save-value (arg)
"Saves the value of arg as the value of a symbol retrieved from a prompt."
(eval
`(setf ,(prompt-user :read-type :read
:type 'symbol
:prompt-string
"Give a symbol to store the value on:")
,arg)))
(defun prompt-t-or-f (message
&key
(true-text "Yes")
(false-text "No")
(cancel-text "Cancel"))
"Prompts the user to make a decision between two alternatives (true-text and false-text) ~
in response to the information given in message. T is returned if the first letter ~
of the true-text (default the string Yes) is typed by the user; NIL is returned if the first letter ~
of the false-text (default the string No) is typed by the user. ~
If cancelled by the user, processing ends. ~
(:see-also prompt-for-items pick-one prompt-true-or-false)"
(let ((ans
(ccl::y-or-n-dialog message
:yes-text true-text
:no-text false-text
:cancel-text cancel-text)))
(let ((w (car (ccl::windows))))
(if (typep w 'canvas)
(mapcar #'ccl:menu-enable (mapcar #'cdr (slot-value w 'title-menus)))))
ans))
(defun prompt-true-or-false (message
&key
(true-text "Yes")
(false-text "No")
(cancel-text "Cancel"))
"Prompts the user to make a decision between two alternatives (true-text and false-text) ~
in response to the information given in message. T is returned if the ~
true-text (default the string Yes) is typed by the user; NIL is returned if the ~
false-text (default the string No) is typed by the user. ~
If cancelled by the user, processing ends. ~
(:see-also prompt-for-items pick-one prompt-t-or-f)"
(let ((ans (prompt-t-or-f message
:true-text true-text
:false-text false-text
:cancel-text cancel-text)))
(let ((w (car (ccl::windows))))
(if (typep w 'canvas)
(mapcar #'ccl:menu-enable (mapcar #'cdr (slot-value w 'title-menus)))))
ans))
(defun prompt-for-items (list
&key (prompt-text "Choose")
(item-function NIL)
(selection-type :single))
"Prompts user to select one or more items from the list. ~
Prompt-text is displayed to help the user choose. ~
Selection-type is one of :single (indicating only a single item ~
can be selected), :contiguous (indicating only contiguous items ~
can be selected), and :disjoint (indicating that any subset of the items ~
can be selected). It returns a list of all items selected, NIL if no items ~
were selected. ~
Item-print-function is the function called on each item to display it in ~
selection table. ~
(:see-also pick-one prompt-t-or-f)"
(let ((ans
(if (functionp item-function)
(ccl::select-item-from-list list
:window-title prompt-text
:table-print-function
#'(lambda(x s) (princ (funcall item-function x) s))
:selection-type selection-type)
(ccl::select-item-from-list list
:window-title prompt-text
:selection-type selection-type))))
(let ((w (car (ccl::windows))))
(if (typep w 'canvas)
(mapcar #'ccl:menu-enable (mapcar #'cdr (slot-value w 'title-menus)))))
ans))
| 7,636 | Common Lisp | .cl | 165 | 35.042424 | 124 | 0.528081 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 00a7cabea4b7a143f26f5e0f46266f30861fef297fe0944d07fdd044a9a2606c | 32,835 | [
-1
] |
32,836 | pick-one-mcl43.lsp | rwoldford_Quail/source/window-basics/prompt/pick-one-mcl43.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; pick-one-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; R.W. Oldford 1992
;;;
;;;
;;;
;;;----------------------------------------------------------------------------------
;;;
;;; History:
;;;
;;; - Construct a uniform prompting facility.
;;;
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(pick-one)))
(defun pick-one (items &key
(prompt-text "Pick one of the following.")
(item-print-function NIL)
(action-function #'(lambda (i) i))
(select-text "Select")
(cancel-text "Cancel"))
"Prompts the user to pick one of the items in the sequence items, ~
using the text supplied by the keyword prompt-text. ~
If supplied, the function action-function is called on the selected item. ~
Default action just returns the item. ~
If supplied, item-print-function will be used on each item to display it ~
in the table. ~
(:see-also prompt-for-items prompt-t-or-f)"
(let*
((p1 (make-instance 'pick-one-prompt
:view-position (h-draw:make-point 10 10)
:window-show NIL
:window-type :shadow-edge-box
:items items
:item-print-function item-print-function
:item-action-function action-function
:prompt-text prompt-text
:select-text select-text
:cancel-text cancel-text))
(ans (modal-dialog p1)))
(let ((w (car (ccl::windows))))
(if (typep w 'canvas)
(mapcar #'ccl:menu-enable (mapcar #'cdr (slot-value w 'title-menus)))))
ans))
(defclass pick-one-prompt (ccl:dialog)
((items
:initarg :items
:initform NIL)
(prompt-text
:initform "Pick one of the following."
:initarg :prompt-text)
(selected-item)
(item-action-function
:initform #'(lambda (i) i)
:initarg :item-action-function)
)
(:documentation "A dialog that allows the user to pick one of a sequence ~
of items.")
)
(defmethod initialize-instance ((self pick-one-prompt)
&rest initargs)
(apply #'call-next-method self :window-show NIL
:window-type :double-edge-box
:view-position '(:top 100)
initargs))
(defmethod initialize-instance :after ((self pick-one-prompt)
&rest initargs
&key (item-print-function NIL)
(select-text "Select")
(cancel-text "Cancel"))
(declare (ignore initargs))
(flet
((text-width (string font)
(string-width string font)))
(let*
((view-font (view-font self))
(error-text "Please choose an item first!")
(error-text-width (string-width error-text view-font))
(prompt-text (slot-value self 'prompt-text))
(prompt-text-width (string-width prompt-text view-font))
(text-height (multiple-value-bind (ascent descent widmax leading)
(font-info view-font)
(declare (ignore widmax))
(+ ascent descent leading)))
(text-box-width (+ 5 (max prompt-text-width error-text-width)))
(text-box-height (round (* 2.5 text-height)))
(button-height (+ 2 text-height))
(button-width
(+ 5 (max (string-width select-text view-font)
(string-width cancel-text view-font))))
(seq-height 150)
(seq-width 200)
(text-dialog (make-dialog-item
'static-text-dialog-item
#@(10 20)
(h-draw:make-point text-box-width text-box-height)
prompt-text))
(seq-dialog
(if (functionp item-print-function)
(make-dialog-item
'sequence-dialog-item
(h-draw:make-point 10 (+ 12 text-box-height))
(h-draw:make-point seq-width seq-height)
"Pick one"
#'(lambda (d)
(setf (slot-value (view-container d) 'selected-item)
(cell-contents d (first (selected-cells d)))))
:dialog-item-enabled-p T
:table-print-function item-print-function
:table-vscrollp T
:table-sequence (slot-value self 'items)
)
(make-dialog-item
'sequence-dialog-item
(h-draw:make-point 10 (+ 12 text-box-height))
(h-draw:make-point seq-width seq-height)
"Pick one"
#'(lambda (d)
(setf (slot-value (view-container d) 'selected-item)
(cell-contents d (first (selected-cells d)))))
:dialog-item-enabled-p T
:table-vscrollp T
:table-sequence (slot-value self 'items)
)))
(select-button
(make-dialog-item
'default-button-dialog-item
(h-draw:make-point (+ 20 seq-width) (+ 12 text-box-height))
(h-draw:make-point button-width button-height)
select-text
(eval `(function
(lambda (d)
(let
((p (view-container d)))
(if (slot-boundp p 'selected-item)
(return-from-modal-dialog
(funcall
(slot-value p 'item-action-function)
(slot-value p 'selected-item)))
(set-dialog-item-text ,text-dialog ,error-text))))))))
(cancel-button
(make-dialog-item
'button-dialog-item
(h-draw:make-point (+ 20 seq-width) (+ 10 (* 2 (+ 2 text-box-height))))
(h-draw:make-point button-width button-height)
cancel-text
#'(lambda (d)
(declare (ignore d))
(return-from-modal-dialog (values)))))
(self-view-size (view-size self))
)
(set-view-size self (h-draw:make-point (max (h-draw:point-x self-view-size)
(+ 20 seq-width button-width 2)
(+ 20 text-box-width 2))
(max (h-draw:point-y self-view-size)
(+ 16 text-box-height seq-height)
(+ 14 (* 2 (+ 2 text-box-height))
button-height))))
(add-subviews self text-dialog seq-dialog select-button cancel-button)
)))
| 7,452 | Common Lisp | .cl | 173 | 29.572254 | 86 | 0.49102 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | b7bdd7c629355c7c9d19f23e1b25fae9bd03dee3fb8939157a7e7e07b48c7917 | 32,836 | [
-1
] |
32,837 | pick-one-mcl.lsp | rwoldford_Quail/source/window-basics/prompt/pick-one-mcl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; pick-one-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; R.W. Oldford 1992
;;;
;;;
;;;
;;;----------------------------------------------------------------------------------
;;;
;;; History:
;;;
;;; - Construct a uniform prompting facility.
;;;
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(pick-one)))
(defun pick-one (items &key
(prompt-text "Pick one of the following.")
(item-print-function NIL)
(action-function #'(lambda (i) i))
(select-text "Select")
(cancel-text "Cancel"))
"Prompts the user to pick one of the items in the sequence items, ~
using the text supplied by the keyword prompt-text. ~
If supplied, the function action-function is called on the selected item. ~
Default action just returns the item. ~
If supplied, item-print-function will be used on each item to display it ~
in the table. ~
(:see-also prompt-for-items prompt-t-or-f)"
(let
((p1 (make-instance 'pick-one-prompt
:view-position (h-draw:make-point 10 10)
:window-show NIL
:window-type :shadow-edge-box
:items items
:item-print-function item-print-function
:item-action-function action-function
:prompt-text prompt-text
:select-text select-text
:cancel-text cancel-text)))
(modal-dialog p1)))
(defclass pick-one-prompt (ccl:dialog)
((items
:initarg :items
:initform NIL)
(prompt-text
:initform "Pick one of the following."
:initarg :prompt-text)
(selected-item)
(item-action-function
:initform #'(lambda (i) i)
:initarg :item-action-function)
)
(:documentation "A dialog that allows the user to pick one of a sequence ~
of items.")
)
(defmethod initialize-instance ((self pick-one-prompt)
&rest initargs)
(apply #'call-next-method self :window-show NIL
:window-type :double-edge-box
:view-position '(:top 100)
initargs))
(defmethod initialize-instance :after ((self pick-one-prompt)
&rest initargs
&key (item-print-function NIL)
(select-text "Select")
(cancel-text "Cancel"))
(declare (ignore initargs))
(flet
((text-width (string font)
(string-width string font)))
(let*
((view-font (view-font self))
(error-text "Please choose an item first!")
(error-text-width (string-width error-text view-font))
(prompt-text (slot-value self 'prompt-text))
(prompt-text-width (string-width prompt-text view-font))
(text-height (multiple-value-bind (ascent descent widmax leading)
(font-info view-font)
(declare (ignore widmax))
(+ ascent descent leading)))
(text-box-width (+ 5 (max prompt-text-width error-text-width)))
(text-box-height (round (* 2.5 text-height)))
(button-height (+ 2 text-height))
(button-width
(+ 5 (max (string-width select-text view-font)
(string-width cancel-text view-font))))
(seq-height 150)
(seq-width 200)
(text-dialog (make-dialog-item
'static-text-dialog-item
#@(10 20)
(h-draw:make-point text-box-width text-box-height)
prompt-text))
(seq-dialog
(if (functionp item-print-function)
(make-dialog-item
'sequence-dialog-item
(h-draw:make-point 10 (+ 12 text-box-height))
(h-draw:make-point seq-width seq-height)
"Pick one"
#'(lambda (d)
(setf (slot-value (view-container d) 'selected-item)
(cell-contents d (first (selected-cells d)))))
:dialog-item-enabled-p T
:table-print-function item-print-function
:table-vscrollp T
:table-sequence (slot-value self 'items)
)
(make-dialog-item
'sequence-dialog-item
(h-draw:make-point 10 (+ 12 text-box-height))
(h-draw:make-point seq-width seq-height)
"Pick one"
#'(lambda (d)
(setf (slot-value (view-container d) 'selected-item)
(cell-contents d (first (selected-cells d)))))
:dialog-item-enabled-p T
:table-vscrollp T
:table-sequence (slot-value self 'items)
)))
(select-button
(make-dialog-item
'default-button-dialog-item
(h-draw:make-point (+ 20 seq-width) (+ 12 text-box-height))
(h-draw:make-point button-width button-height)
select-text
(eval `(function
(lambda (d)
(let
((p (view-container d)))
(if (slot-boundp p 'selected-item)
(return-from-modal-dialog
(funcall
(slot-value p 'item-action-function)
(slot-value p 'selected-item)))
(set-dialog-item-text ,text-dialog ,error-text))))))))
(cancel-button
(make-dialog-item
'button-dialog-item
(h-draw:make-point (+ 20 seq-width) (+ 10 (* 2 (+ 2 text-box-height))))
(h-draw:make-point button-width button-height)
cancel-text
#'(lambda (d)
(declare (ignore d))
(return-from-modal-dialog (values)))))
(self-view-size (view-size self))
)
(set-view-size self (h-draw:make-point (max (h-draw:point-x self-view-size)
(+ 20 seq-width button-width 2)
(+ 20 text-box-width 2))
(max (h-draw:point-y self-view-size)
(+ 16 text-box-height seq-height)
(+ 14 (* 2 (+ 2 text-box-height))
button-height))))
(add-subviews self text-dialog seq-dialog select-button cancel-button)
)))
| 7,286 | Common Lisp | .cl | 169 | 29.47929 | 86 | 0.49011 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | dc9ce28bccba8e34e9b1e61ba3498c1604bfd11399e08e93eee7162b0b7e451e | 32,837 | [
-1
] |
32,838 | old-prompt-clx2.lsp | rwoldford_Quail/source/window-basics/prompt/old-prompt-clx2.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; prompt-clx.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; N.G. Bennett 1993
;;;
;;;
;;;
;;;----------------------------------------------------------------------------------
;;;
;;; History:
;;;
;;; - Construct a uniform prompting facility.
;;;
(in-package :wb)
(export '(prompt-user save-value prompt-t-or-f prompt-true-or-false
prompt-for-items))
(defun prompt-user (&key (type T)
(read-type :string)
(prompt-string NIL)
(initial-string "")
(ok-text "OK")
(cancel-text "Cancel")
left top
width
(height 100))
"Prompts user for input. ~
(:key ~
(:arg Prompt-string NIL The string used to query the user.) ~
(:arg initial-string \"\" Appears to the user as the default answer.) ~
(:arg ok-text \"OK\" String used to prompt user for confirmation.) ~
(:arg cancel-text \"Cancel\" String used to prompt user for cancellation.) ~
(:arg type T Data type of item to be returned by user. Any Common Lisp ~
data-type is acceptable.) ~
(:arg read-type :string How to read the typed input. ~
Legal values are :string :eval or :read.) ~
(:arg left NIL Location of the left of the prompt window.) ~
(:arg top NIL Location of the top of the prompt window.) ~
(:arg width NIL Width of prompt window.) ~
(:arg height 100 Height of prompt window.) ~
)"
(declare (ignore left top width height))
(setq prompt-string
(if prompt-string
(if (stringp prompt-string)
(format NIL prompt-string)
(format NIL "~a" prompt-string))
(format nil "Please enter a ~S" type)))
(let* ((result (get-string-from-user
prompt-string
:initial-string initial-string
:ok-text ok-text
:cancel-text cancel-text)))
(setf result
(case read-type
(:string result)
(:eval (eval (read-from-string result :preserve-whitespace t)))
(:read (read-from-string result :preserve-whitespace t))
)
)
(if (typep result type)
result
(quail-error "~S is not of type ~S" result type))))
(defun save-value (arg)
"Saves the value of arg as the value of a symbol retrieved from a prompt."
(eval
`(setf ,(prompt-user :read-type :read
:type 'symbol
:prompt-string
"Give a symbol to store the value on:")
,arg)))
(defun prompt-t-or-f (message
&key
(true-text "Yes")
(false-text "No")
(cancel-text "Cancel"))
"Prompts the user to make a decision between two alternatives (true-text and false-text) ~
in response to the information given in message. T is returned if the first letter ~
of the true-text (default the string Yes) is typed by the user; NIL is returned if the first letter ~
of the false-text (default the string No) is typed by the user. ~
If cancelled by the user, processing ends. ~
(:see-also prompt-for-items pick-one prompt-true-or-false)"
(y-or-n-dialog message
:yes-text true-text
:no-text false-text
:cancel-text cancel-text))
(defun prompt-true-or-false (message
&key
(true-text "Yes")
(false-text "No")
(cancel-text "Cancel"))
"Prompts the user to make a decision between two alternatives (true-text and false-text) ~
in response to the information given in message. T is returned if the ~
true-text (default the string Yes) is typed by the user; NIL is returned if the ~
false-text (default the string No) is typed by the user. ~
If cancelled by the user, processing ends. ~
(:see-also prompt-for-items pick-one prompt-t-or-f)"
(prompt-t-or-f message
:yes-text true-text
:no-text false-text
:cancel-text cancel-text))
(defun prompt-for-items (list
&key (prompt-text "Choose")
(item-function NIL)
(selection-type :single))
"Prompts user to select one or more items from the list. ~
Prompt-text is displayed to help the user choose. ~
Selection-type is one of :single (indicating only a single item ~
can be selected), :contiguous (indicating only contiguous items ~
can be selected), and :disjoint (indicating that any subset of the items ~
can be selected). It returns a list of all items selected, NIL if no items ~
were selected. ~
Item-print-function is the function called on each item to display it in ~
selection table. ~
(:see-also pick-one prompt-t-or-f)"
(if (functionp item-function)
(select-item-from-list list
:window-title prompt-text
:table-print-function
#'(lambda(x s)
(format nil "~a" (funcall item-function x)))
:selection-type selection-type)
(select-item-from-list list
:window-title prompt-text
:selection-type selection-type)))
(defclass list-dialog ()
((window :initform NIL
:initarg :window
:accessor list-dialog-window-of)
(gcontext :initform NIL
:initarg :gcontext
:accessor list-dialog-gcontext-of)
(title :initform NIL
:initarg :title
:accessor list-dialog-title-of)
(selection-type :initform NIL
:initarg :selection-type
:accessor list-dialog-selection-type-of)
(items :initform NIL
:initarg :items
:accessor list-dialog-items-of)
(ok-button :initform NIL
:initarg :ok-button
:accessor list-dialog-ok-button-of)
(cancel-button :initform NIL
:initarg :cancel-button
:accessor list-dialog-cancel-button-of)))
(defclass list-dialog-item ()
(
(window :initform NIL
:initarg :window
:accessor list-dialog-item-window-of)
(gcontext :initform NIL
:initarg :gcontext
:accessor list-dialog-item-gcontext-of)
(item :initform NIL
:initarg :item
:accessor list-dialog-item-item-of)
(text :initform NIL
:initarg :text
:accessor list-dialog-item-text-of)
(selected-p :initform NIL
:initarg :selected-p
:accessor list-dialog-item-selected-p)))
(defclass y-or-n-dialog ()
(
(window :initform NIL
:initarg :window
:accessor y-or-n-dialog-window-of)
(gcontext :initform NIL
:initarg :gcontext
:accessor y-or-n-dialog-gcontext-of)
(text :initform NIL
:initarg :text
:accessor y-or-n-dialog-text-of)
(yes-button :initform NIL
:initarg :yes-button
:accessor y-or-n-dialog-yes-button-of)
(no-button :initform NIL
:initarg :no-text
:accessor y-or-n-dialog-no-button-of)
(cancel-button :initform NIL
:initarg :cancel-text
:accessor y-or-n-dialog-cancel-button-of)))
(defclass text-dialog ()
(
(window :initform NIL
:initarg :window
:accessor text-dialog-window-of)
(text :initform NIL
:initarg :text
:accessor text-dialog-text-of)
(title :initform NIL
:initarg :title
:accessor text-dialog-title-of)
(item :initform NIL
:initarg :item
:accessor text-dialog-item-of)
(title-window :initform NIL
:initarg :title-window
:accessor text-dialog-title-window-of)
(gcontext :initform NIL
:initarg :gcontext
:accessor text-dialog-gcontext-of)
(action :initform NIL
:initarg :action
:accessor text-dialog-action-of)))
(defclass check-dialog ()
(
(window :initform NIL
:initarg :window
:accessor check-dialog-window-of)
(text :initform NIL
:initarg :text
:accessor check-dialog-text-of)
(item :initform NIL
:initarg :item
:accessor check-dialog-item-of)
(gcontext :initform NIL
:initarg :gcontext
:accessor check-dialog-gcontext-of)
(t-or-nil :initform NIL
:initarg :t-or-nil
:accessor check-dialog-t-or-nil-of)
(action :initform NIL
:initarg :action
:accessor check-dialog-action-of)
(button :initform NIL
:initarg :button
:accessor check-dialog-button-of)))
(defclass dialog ()
(
(title :initform NIL
:initarg :title
:accessor dialog-title)
(window :initform NIL
:initarg :window
:accessor dialog-window-of)
(gcontext :initform NIL
:initarg :gcontext
:accessor dialog-gcontext-of)
(ok-button :initform NIL
:initarg :ok-button
:accessor dialog-ok-button)
(cancel-button :initform NIL
:initarg :cancel-button
:accessor dialog-cancel-button)
(text-dialogs :initform NIL
:initarg :text-dialogs
:accessor dialog-text-dialogs)
(check-dialogs :initform NIL
:initarg :check-dialogs
:accessor dialog-check-dialogs)))
(defmethod initialize-instance :after ((self dialog)
&key
(font-name "fixed")
(title "A Dialog")
(check-dialogs NIL)
(text-dialogs NIL)
(ok-text "OK")
(cancel-text "CANCEL"))
(declare (special *default-display*))
(let* ((screen (xlib::display-default-screen *default-display*))
(black (xlib::screen-black-pixel screen))
(white (xlib::screen-white-pixel screen))
(parent (xlib::screen-root screen))
(font (xlib::open-font *default-display* font-name)))
(setf (dialog-window-of self)
(xlib::create-window :parent parent
:x 0 :y 0 :width 16 :height 16
:background white
:border-width 2
:override-redirect :on
:event-mask (xlib::make-event-mask
:exposure
:button-press
:button-release))
(xlib::window-plist (dialog-window-of self))
(acons :wb-class-instance self NIL)
(dialog-gcontext-of self)
(xlib::create-gcontext :drawable parent
:foreground black
:background white
:font font)
(dialog-title self) title
(dialog-ok-button self)
(make-button :text ok-text
:gcontext (dialog-gcontext-of self)
:action :OK)
(dialog-cancel-button self)
(make-button :text cancel-text
:gcontext (dialog-gcontext-of self)
:action :CANCEL))
(let ((dw (dialog-window-of self))
(ok-bw (button-window-of (dialog-ok-button self)))
(cancel-bw (button-window-of (dialog-cancel-button self))))
(setf (dialog-check-dialogs self) NIL)
(setf (dialog-text-dialogs self) NIL)
(dolist (check-dialog check-dialogs)
(setf (dialog-check-dialogs self)
(append (dialog-check-dialogs self)
(list (make-check-dialog ;;:display *default-display*
:text (car check-dialog)
:t-or-nil (cadr check-dialog)
:action NIL
:gcontext (dialog-gcontext-of self)))))
(let* ((curr-d (car (last (dialog-check-dialogs self)))))
(xlib::reparent-window (check-dialog-window-of curr-d)
dw 0 0)
(xlib::reparent-window
(button-window-of (check-dialog-button-of curr-d))
dw 0 0)))
(dolist (text-dialog text-dialogs)
(setf (dialog-text-dialogs self)
(append (dialog-text-dialogs self)
(list (make-text-dialog ;;:display *default-display*
:title (car text-dialog)
:text (cadr text-dialog)
:action NIL
:gcontext (dialog-gcontext-of self)))))
(let* ((curr-d (car (last (dialog-text-dialogs self)))))
(xlib::reparent-window (text-dialog-window-of curr-d) dw 0 0)
(xlib::reparent-window (text-dialog-title-window-of curr-d) dw 0 0)))
(xlib::reparent-window ok-bw dw 20 20)
(xlib::reparent-window cancel-bw dw 20 50)
(setf (xlib::window-plist ok-bw)
(acons :associated-with self (xlib::window-plist ok-bw))
(xlib::window-plist cancel-bw)
(acons :associated-with self (xlib::window-plist cancel-bw)))
(dialog-compute-geometry self)
(xlib::map-window dw)
(xlib::with-state (dw)
(setf (xlib::drawable-x dw) 300
(xlib::drawable-y dw) 300))
(xlib::map-subwindows dw)))
self)
(defun max-check-dialog-width (check-dialogs)
(let ((max-width 0))
(dolist (check-dialog check-dialogs)
(setf max-width
(max max-width (when check-dialog
(+ (* 4 *button-margin*)
(xlib:drawable-width (check-dialog-window-of check-dialog))
(xlib:drawable-width (button-window-of (check-dialog-button-of check-dialog))))))))
max-width))
(defun max-text-dialog-width (text-dialogs)
(let ((max-width 0))
(dolist (text-dialog text-dialogs)
(setf max-width
(max max-width (when text-dialog
(+ (* 4 *button-margin*)
(xlib:drawable-width (text-dialog-window-of text-dialog))
(xlib:drawable-width (text-dialog-title-window-of text-dialog)))))))
max-width))
(defun max-text-dialog-title-width (text-dialogs)
(let ((max-width 0))
(dolist (text-dialog text-dialogs)
(setf max-width
(max max-width (when text-dialog
(+ (* 4 *button-margin*)
(xlib:drawable-width (text-dialog-title-window-of text-dialog)))))))
max-width))
(defun dialog-compute-geometry (dialog)
(let* ((gcontext (dialog-gcontext-of dialog))
(window (dialog-window-of dialog))
(font (xlib::gcontext-font gcontext))
(title-width (xlib::text-extents font (dialog-title dialog)))
(check-dialogs (dialog-check-dialogs dialog))
(text-dialogs (dialog-text-dialogs dialog))
(max-t-d-width (max-text-dialog-width text-dialogs))
(max-t-t-width (max-text-dialog-title-width text-dialogs))
(max-c-d-width (max-check-dialog-width check-dialogs))
(item-height (xlib::drawable-height (button-window-of (dialog-ok-button dialog))))
(ok-width (xlib::drawable-width (button-window-of (dialog-ok-button dialog))))
(cancel-width (xlib::drawable-width (button-window-of (dialog-cancel-button dialog))))
dialog-width dialog-height)
(setf dialog-width (+ (max title-width (+ (* 4 *button-margin*) ok-width cancel-width)
max-c-d-width max-t-d-width) (* 2 *button-margin*))
dialog-height (* (+ item-height (* 2 *button-margin*)) (+ 2 (length check-dialogs) (length text-dialogs))))
(xlib::with-state (window)
(setf (xlib::drawable-width window) dialog-width
(xlib::drawable-height window) dialog-height))
(let* ((next-top (+ item-height (* 2 *button-margin*)))
(increment next-top))
(dolist (check-dialog check-dialogs)
(let ((dw (check-dialog-window-of check-dialog))
(bw (button-window-of (check-dialog-button-of check-dialog))))
(xlib::with-state (dw)
(setf (xlib::drawable-x dw) *button-margin*
(xlib::drawable-y dw) next-top))
(xlib::with-state (bw)
(setf (xlib::drawable-x bw) (- max-c-d-width
(xlib::drawable-width bw)
*button-margin*)
(xlib::drawable-y bw) next-top))
(incf next-top increment)))
(dolist (text-dialog text-dialogs)
(let ((dw (text-dialog-window-of text-dialog))
(tw (text-dialog-title-window-of text-dialog)))
(xlib::with-state (tw)
(setf (xlib::drawable-x tw) *button-margin*
(xlib::drawable-y tw) next-top))
(xlib::with-state (dw)
(setf (xlib::drawable-x dw) (+ (* 3 *button-margin*) max-t-t-width)
(xlib::drawable-y dw) next-top))
(incf next-top increment))))
(let ((ok-window (button-window-of (dialog-ok-button dialog)))
(cancel-window (button-window-of (dialog-cancel-button dialog))))
(xlib::with-state (ok-window)
(setf (xlib::drawable-x ok-window) *button-margin*
(xlib::drawable-y ok-window) (- (xlib::drawable-height window)
(xlib::drawable-height ok-window)
*button-margin*)))
(xlib::with-state (cancel-window)
(setf (xlib::drawable-x cancel-window) (+ (* 3 *button-margin*) (xlib::drawable-width ok-window))
(xlib::drawable-y cancel-window) (- (xlib::drawable-height window)
(xlib::drawable-height cancel-window)
*button-margin*))))))
(defclass button ()
((window :initform NIL
:initarg :window
:accessor button-window-of)
(text :initform NIL
:initarg :text
:accessor button-text-of)
(gcontext :initform NIL
:initarg :gcontext
:accessor button-gcontext-of)
(action :initform NIL
:initarg :action
:accessor button-action)))
(defun button-p (thing)
(typep thing 'button))
(defun dialog-p (thing)
(typep thing 'dialog))
(defun y-or-n-dialog-p (thing)
(typep thing 'y-or-n-dialog))
(defmethod wb-refresh ((self button))
(let* ((gcontext (button-gcontext-of self))
(window (button-window-of self))
(font (xlib::gcontext-font gcontext))
(text-start-x *button-margin*)
(text-start-y (+ *button-margin* (xlib::font-ascent font))))
(xlib::draw-image-glyphs window gcontext text-start-x text-start-y (button-text-of self))))
(defmethod wb-refresh ((self dialog))
(let* ((gcontext (dialog-gcontext-of self))
(window (dialog-window-of self))
(font (xlib::gcontext-font gcontext))
(window-width (xlib::drawable-width window))
(title (dialog-title self))
(title-width (xlib::text-extents font title))
(text-start-x (round (- (/ window-width 2) (/ title-width 2))))
(text-start-y (+ *button-margin* (xlib::font-ascent font))))
(xlib::draw-image-glyphs window gcontext text-start-x text-start-y title)))
(defmethod wb-refresh ((self y-or-n-dialog))
(let* ((gcontext (y-or-n-dialog-gcontext-of self))
(window (y-or-n-dialog-window-of self))
(font (xlib::gcontext-font gcontext))
(window-width (xlib::drawable-width window))
(title (y-or-n-dialog-text-of self))
(title-width (xlib::text-extents font title))
(text-start-x (round (- (/ window-width 2) (/ title-width 2))))
(text-start-y (+ *button-margin* (xlib::font-ascent font))))
(xlib::draw-image-glyphs window gcontext text-start-x text-start-y title)))
(defmethod wb-refresh ((self check-dialog))
(let* ((gcontext (check-dialog-gcontext-of self))
(window (check-dialog-window-of self))
(font (xlib::gcontext-font gcontext))
(text (check-dialog-text-of self))
(text-start-x *button-margin*)
(text-start-y (+ *button-margin* (xlib::font-ascent font))))
(xlib::draw-image-glyphs window gcontext text-start-x text-start-y text)))
(defmethod wb-refresh ((self text-dialog))
(let* ((gcontext (text-dialog-gcontext-of self))
(window (text-dialog-window-of self))
(title-window (text-dialog-title-window-of self))
(font (xlib::gcontext-font gcontext))
(text (text-dialog-text-of self))
(title (text-dialog-title-of self))
(text-start-x *button-margin*)
(text-start-y (+ *button-margin* (xlib::font-ascent font))))
(xlib::draw-image-glyphs window gcontext text-start-x text-start-y text)
(xlib::draw-image-glyphs title-window gcontext text-start-x text-start-y title)))
(defmethod initialize-instance :after ((self button)
&key
;;(display NIL)
(text "OK")
gcontext
(action NIL)
&allow-other-keys)
;;(unless display (setf display (open-default-host-display)))
(setf (button-window-of self)
(xlib::create-window
:parent (xlib::screen-root
(xlib::display-default-screen
*default-display*))
:x 0 :y 0 :width 16 :height 16
:background (xlib::screen-white-pixel
(xlib::display-default-screen
*default-display*))
:override-redirect :on
:border-width 2
:event-mask (xlib::make-event-mask
:button-press
:button-release
:exposure
:owner-grab-button))
(xlib::window-plist (button-window-of self))
(acons :wb-class-instance self NIL)
(button-gcontext-of self) gcontext
(button-action self) action
(button-text-of self) text)
(button-compute-geometry self)
self)
(defun button-compute-geometry (button)
(let* ((gcontext (button-gcontext-of button))
(font (xlib::gcontext-font gcontext))
(window (button-window-of button))
(text-width (xlib::text-extents font
(button-text-of button)))
(text-height (+ (xlib::font-ascent font)
(xlib::font-descent font)))
(button-width (+ text-width (* 2 *button-margin*)))
(button-height (+ text-height (* 2 *button-margin*))))
(xlib::with-state (window)
(setf (xlib::drawable-width window) button-width
(xlib::drawable-height window) button-height))))
(defvar *button-margin* 4)
(defun make-button (&rest args)
(apply #'make-instance 'button args))
(defun make-dialog (&rest args)
(apply #'make-instance 'dialog args))
(defun make-check-dialog (&rest args)
(apply #'make-instance 'check-dialog args))
(defun make-y-or-n-dialog (&rest args)
(apply #'make-instance 'y-or-n-dialog args))
(defmethod initialize-instance :after
((self check-dialog)
&key
;;(display NIL)
text
gcontext
(t-or-nil NIL)
(action NIL)
&allow-other-keys)
(declare (special *default-display*))
(let ((display *default-display*)) ;;(setf display (open-default-host-display)))
(setf (check-dialog-window-of self)
(xlib::create-window
:parent (xlib::screen-root
(xlib::display-default-screen display))
:x 0 :y 0 :width 16 :height 16
:background (xlib::screen-white-pixel
(xlib::display-default-screen display))
:override-redirect :on
:border-width 0
:event-mask (xlib::make-event-mask
:exposure))
(xlib::window-plist (check-dialog-window-of self))
(acons :wb-class-instance self NIL)
(check-dialog-gcontext-of self) gcontext
(check-dialog-action-of self) action
(check-dialog-text-of self) (format nil "~a" text)
(check-dialog-item-of self) text
(check-dialog-t-or-nil-of self) t-or-nil
(check-dialog-button-of self)
(make-button :display display
:text (format nil "~3a" t-or-nil)
:gcontext gcontext
:action NIL)
(xlib::window-plist
(button-window-of (check-dialog-button-of self)))
(acons :associated-with self
(xlib::window-plist
(button-window-of
(check-dialog-button-of self)))))
(check-dialog-compute-geometry self)
self))
(defun get-association (window)
(cdr (assoc :associated-with (xlib::window-plist window))))
(defun check-dialog-p (thing)
(typep thing 'check-dialog))
(defun check-dialog-compute-geometry (check-dialog)
(let* ((window (check-dialog-window-of check-dialog))
(gcontext (check-dialog-gcontext-of check-dialog))
(font (xlib::gcontext-font gcontext))
(width
(+ (* 2 *button-margin*)
(xlib::text-extents
font
(check-dialog-text-of check-dialog))))
(height (+ (* 2 *button-margin*)
(xlib::font-ascent font)
(xlib::font-descent font))))
(xlib::with-state (window)
(setf (xlib::drawable-width window) width
(xlib::drawable-height window) height))))
(defmethod initialize-instance
:after ((self text-dialog)
&key
;;(display NIL)
(text "")
title
gcontext
(action NIL)
&allow-other-keys)
(declare (special *default-display*))
(let ((display *default-display*))
;;(unless display (setf display (open-default-host-display)))
(setf (text-dialog-window-of self)
(xlib::create-window
:parent (xlib::screen-root
(xlib::display-default-screen display))
:x 0 :y 0 :width 16 :height 16
:background
(xlib::screen-white-pixel
(xlib::display-default-screen display))
:override-redirect :on
:border-width 2
:event-mask
(xlib::make-event-mask
:button-press
:button-release
:key-press
:key-release
:exposure
:owner-grab-button))
(xlib::window-plist (text-dialog-window-of self))
(acons :wb-class-instance self NIL)
(text-dialog-title-window-of self)
(xlib::create-window
:parent (xlib::screen-root
(xlib::display-default-screen display))
:x 0 :y 0 :width 16 :height 16
:background
(xlib::screen-white-pixel
(xlib::display-default-screen display))
:override-redirect :on
:border-width 0
:event-mask (xlib::make-event-mask
:exposure
:owner-grab-button))
(xlib::window-plist
(text-dialog-title-window-of self))
(acons :wb-class-instance self NIL)
(text-dialog-gcontext-of self) gcontext
(text-dialog-action-of self) action
(text-dialog-title-of self) (format NIL "~a" title)
(text-dialog-item-of self) title
(text-dialog-text-of self) (format NIL "~a" text))
(text-dialog-compute-geometry self)
self))
(defun make-text-dialog (&rest args)
(apply #'make-instance 'text-dialog args))
(defun text-dialog-compute-geometry (text-dialog)
(let* ((window (text-dialog-window-of text-dialog))
(title-window (text-dialog-title-window-of text-dialog))
(gcontext (text-dialog-gcontext-of text-dialog))
(text (text-dialog-text-of text-dialog))
(title (text-dialog-title-of text-dialog))
(font (xlib::gcontext-font gcontext))
(title-width (+ (* 2 *button-margin*)
(xlib::text-extents font title)))
(height (+ (* 2 *button-margin*)
(xlib::font-ascent font)
(xlib::font-descent font)))
(width (max (xlib::text-extents font text)
(* 15 (xlib::text-extents font " ")))))
(xlib::with-state (window)
(setf (xlib::drawable-width window) width
(xlib::drawable-height window) height))
(xlib::with-state (title-window)
(setf (xlib::drawable-width title-window) title-width
(xlib::drawable-height title-window) height))))
(defmethod process-button-press-event ((c button) window root-x root-y)
(let* ((width (xlib::drawable-width window))
(height (xlib::drawable-height window))
(gcontext (button-gcontext-of c))
(bg (xlib::gcontext-foreground gcontext))
(fg (xlib::gcontext-background gcontext))
(result NIL)
(action NIL)
(association (get-association window)))
(when (check-dialog-p association)
(setf (button-text-of c)
(if (string= (button-text-of c) "T ")
"NIL" "T "))
(setf (check-dialog-t-or-nil-of association)
(not (check-dialog-t-or-nil-of association))))
(xlib::with-gcontext (gcontext :function *host-bic-mode*
:foreground fg :background bg)
(xlib::draw-rectangle window gcontext 0 0 width height t)
(wb-refresh c))
(setf result (if (or
(dialog-p association)
(y-or-n-dialog-p association)
(list-dialog-p association)) T NIL))
(when (or
(dialog-p association)
(y-or-n-dialog-p association)
(list-dialog-p association))
(setf action (button-action c)))
(values result action)))
(defmethod process-button-press-event ((c text-dialog) window root-x root-y)
(let ((gcontext (text-dialog-gcontext-of c))
(width (xlib::drawable-width window))
(height (xlib::drawable-height window)))
(xlib::with-gcontext
(gcontext :foreground (xlib::gcontext-background gcontext))
(xlib::draw-rectangle window gcontext 0 0 width height t))
(setf (text-dialog-text-of c) nil)
(xlib::grab-keyboard
window :owner-p t
:sync-pointer-p nil :sync-keyboard-p nil)
NIL))
(defmethod process-button-press-event ((c dialog) w init-x init-y)
(let ((offset-x (- init-x (xlib::drawable-x w)))
(offset-y (- init-y (xlib::drawable-y w)))
(display (xlib::drawable-display w)))
(xlib::event-case
(display :discard-p t :force-output-p t)
(:button-release
(window root-x root-y)
(when (eq w window)
(xlib::with-state (w)
(setf (xlib::drawable-x w) (- root-x offset-x)
(xlib::drawable-y w) (- root-y offset-y))))
(if (eq w window) T NIL))
(otherwise () NIL)))
NIL)
(defmethod process-button-press-event ((c y-or-n-dialog) w init-x init-y)
(let ((offset-x (- init-x (xlib::drawable-x w)))
(offset-y (- init-y (xlib::drawable-y w)))
(display (xlib::drawable-display w)))
(xlib::event-case
(display :discard-p t :force-output-p t)
(:button-release
(window root-x root-y)
(when (eq w window)
(xlib::with-state (w)
(setf (xlib::drawable-x w) (- root-x offset-x)
(xlib::drawable-y w) (- root-y offset-y))))
(if (eq w window) T NIL))
(otherwise () NIL)))
NIL)
(defmethod process-button-press-event ((c list-dialog) w x y)
(let ((offset-x (- x (xlib::drawable-x w)))
(offset-y (- y (xlib::drawable-y w)))
(display (xlib::drawable-display w)))
(xlib::event-case
(display :discard-p t :force-output-p t)
(:button-release
(window root-x root-y)
(when (eq w window)
(xlib::with-state (w)
(setf (xlib::drawable-x w) (- root-x offset-x)
(xlib::drawable-y w) (- root-y offset-y))))
(if (eq w window) T NIL))
(otherwise () NIL)))
NIL)
(defun any-item-selected-p (list-dialog)
(let ((items (list-dialog-items-of list-dialog)))
(loop for item in items
when (list-dialog-item-selected-p item) return item
finally (return NIL))))
(defun previous-item-selected-p (list-dialog item)
(let* ((items (list-dialog-items-of list-dialog))
(prev-pos (- (position item items) 1))
previous)
(when (< prev-pos 0) (setf prev-pos (- (length items) 1)))
(setf previous (nth prev-pos items))
(list-dialog-item-selected-p previous)))
(defun next-item-selected-p (list-dialog item)
(let* ((items (list-dialog-items-of list-dialog))
(next-pos (+ 1 (position item items)))
next)
(when (> next-pos (- (length items) 1)) (setf next-pos 0))
(setf next (nth next-pos items))
(list-dialog-item-selected-p next)))
(defmethod process-button-press-event ((c list-dialog-item) w x y)
(let* ((l-d (get-association w))
(gcontext (list-dialog-item-gcontext-of c))
(width (xlib::drawable-width w))
(height (xlib::drawable-height w))
(fg (xlib::gcontext-foreground gcontext))
(bg (xlib::gcontext-background gcontext))
(selected (list-dialog-item-selected-p c))
(select-type (list-dialog-selection-type-of l-d))
(items (list-dialog-items-of l-d))
(any-selected (any-item-selected-p l-d))
(prev-selected (previous-item-selected-p l-d c))
(next-selected (next-item-selected-p l-d c))
(select NIL))
(if selected
(progn
(xlib::with-gcontext
(gcontext :foreground bg :background fg)
(xlib::draw-rectangle w gcontext 0 0 width height t))
(wb-refresh c)
(setf (list-dialog-item-selected-p c) NIL)
NIL)
(progn
(cond
((eq select-type :single)
(if any-selected
(let*
((a-w (list-dialog-item-window-of any-selected))
(a-width (xlib::drawable-width a-w))
(a-height (xlib::drawable-height a-w))
(agc (list-dialog-item-gcontext-of any-selected)))
(setf (list-dialog-item-selected-p any-selected) NIL)
(xlib::with-gcontext (agc :foreground bg :background fg)
(xlib::draw-rectangle a-w agc 0 0 a-width a-height t))
(wb-refresh any-selected)
(setf select T))
(setf select T)))
((eq select-type :conjoint)
(if any-selected
(when (or prev-selected next-selected)
(setf select T))
(setf select T)))
((eq select-type :disjoint) (setf select T)))
(when select
(setf (list-dialog-item-selected-p c) T)
(wb-refresh c)))))
NIL)
(defmethod process-button-release-event ((c list-dialog-item) window))
(defmethod process-button-release-event ((c button) event-window)
(let* ((w (xlib::drawable-width event-window))
(h (xlib::drawable-height event-window))
(gcontext (button-gcontext-of c))
(fg (xlib::gcontext-background gcontext))
(bg (xlib::gcontext-foreground gcontext))
(association (get-association event-window)))
(xlib::with-gcontext (gcontext :foreground fg :background bg)
(xlib::draw-rectangle event-window gcontext 0 0 w h t))
(wb-refresh c)
NIL))
(defmethod process-button-release-event ((c text-dialog) event-window) NIL)
(defmethod process-button-release-event ((c dialog) event-window) NIL)
(defmethod process-key-press-event ((c text-dialog) window code state)
(let* ((gcontext (text-dialog-gcontext-of c))
(display (xlib::drawable-display window))
(width (xlib::drawable-width window))
(height (xlib::drawable-height window))
(font (xlib::gcontext-font gcontext))
(text-start-x *button-margin*)
(text-start-y (+ *button-margin* (xlib::font-ascent font)))
character)
(setf character (xlib::keycode->character display code state))
(cond ((eq character #\return) (progn (xlib::ungrab-keyboard display) NIL))
((member
(format nil "~a" character)
'("CAPS-LOCK" "NIL" "LEFT-SHIFT"
"RIGHT-SHIFT" "LEFT-CONTROL"
"RIGHT-CONTROL" "LEFT-ALT"
"RIGHT-ALT")
:test #'string=) NIL)
(T (progn
(if (text-dialog-text-of c)
(setf (text-dialog-text-of c)
(format nil "~a~a" (text-dialog-text-of c) character))
(setf (text-dialog-text-of c)
(format nil "~a" character)))
(when (eq character #\backspace)
(let ((start 0)
(end (- (length (text-dialog-text-of c)) 2)))
(when (> start end) (setf end 0))
(setf (text-dialog-text-of c)
(subseq (text-dialog-text-of c) start end))))
(xlib::with-gcontext
(gcontext :foreground (xlib::gcontext-background gcontext))
(xlib::draw-rectangle window gcontext 0 0 width height t))
(xlib::draw-image-glyphs
window gcontext
text-start-x text-start-y
(text-dialog-text-of c))
(xlib::display-finish-output display)
NIL)))))
(defmethod host-window ((self dialog))
(dialog-window-of self))
(defmethod host-window ((self y-or-n-dialog))
(y-or-n-dialog-window-of self))
(defmethod host-window ((self list-dialog))
(list-dialog-window-of self))
(defmethod cancel-button ((self dialog))
(dialog-cancel-button self))
(defmethod cancel-button ((self y-or-n-dialog))
(y-or-n-dialog-cancel-button-of self))
(defmethod cancel-button ((self list-dialog))
(list-dialog-cancel-button-of self))
(defun show-me-my-dialog (dialog)
(let ((display (xlib::drawable-display (host-window dialog)))
(action NIL))
(xlib::display-finish-output display)
(xlib:event-case
(display :force-output-p t :discard-p t)
(:exposure
(window count)
(when (zerop count)
(xlib::with-event-queue (display)
(wb-refresh (get-wb-class-instance window))))
nil)
(:button-press
(window root-x root-y)
(let (result)
(multiple-value-setq (result action)
(process-button-press-event
(get-wb-class-instance window)
window root-x root-y))
result))
(:button-release
(event-window)
(process-button-release-event
(get-wb-class-instance event-window) event-window))
(:key-press
(window code state)
(process-key-press-event (get-wb-class-instance window)
window code state))
(otherwise () nil)
)
(xlib::close-display display)
(cond ((eq action :CANCEL) (error "Dialog action cancelled"))
((eq action :OK) (reconstruct-command-line dialog))
((eq action :YES) T)
((eq action :NO) NIL))))
(defmethod reconstruct-command-line ((self dialog))
(let* ((text-dialogs (dialog-text-dialogs self))
(check-dialogs (dialog-check-dialogs self))
(texts NIL)
(checks NIL))
(dolist (text-dialog text-dialogs)
(push
(list (text-dialog-item-of text-dialog)
(if (string= (text-dialog-text-of text-dialog)
"NIL")
NIL
T))
texts))
(dolist (check-dialog check-dialogs)
(push (list (check-dialog-item-of check-dialog)
(check-dialog-t-or-nil-of check-dialog))
checks))
(values checks texts)))
(defmethod reconstruct-command-line ((self list-dialog))
(let ((items (list-dialog-items-of self)))
(loop for item in items
when (list-dialog-item-selected-p item)
collect (list-dialog-item-item-of item))))
(defmethod initialize-instance :after
((self y-or-n-dialog)
&key
;;(display NIL)
(font-name "fixed")
(yes-text "Yes")
(no-text "No")
(cancel-text "Cancel")
(title "Do you wish to do this?")
&allow-other-keys)
(declare (special *default-display*))
(let ((display *default-display*))
;;(unless display (setf display (open-default-host-display)))
(let* ((screen (xlib::display-default-screen display))
(black (xlib::screen-black-pixel screen))
(white (xlib::screen-white-pixel screen))
(parent (xlib::screen-root screen))
(font (xlib::open-font display font-name)))
(setf (y-or-n-dialog-window-of self)
(xlib::create-window :parent parent
:x 300 :y 300 :width 16 :height 16
:background white
:override-redirect :on
:event-mask
(xlib::make-event-mask
:button-press
:button-release
:exposure))
(xlib::window-plist (y-or-n-dialog-window-of self))
(acons :wb-class-instance self NIL)
(y-or-n-dialog-gcontext-of self)
(xlib::create-gcontext :drawable parent
:foreground black
:background white
:font font)
(y-or-n-dialog-text-of self) title
(y-or-n-dialog-yes-button-of self)
(make-button :display display
:text yes-text
:gcontext
(y-or-n-dialog-gcontext-of self)
:action :YES)
(y-or-n-dialog-no-button-of self)
(make-button :display display
:text no-text
:gcontext
(y-or-n-dialog-gcontext-of self)
:action :NO)
(y-or-n-dialog-cancel-button-of self)
(make-button :display display
:text cancel-text
:gcontext
(y-or-n-dialog-gcontext-of self)
:action :CANCEL))
(let ((dw (y-or-n-dialog-window-of self))
(yes-bw (button-window-of
(y-or-n-dialog-yes-button-of self)))
(no-bw (button-window-of
(y-or-n-dialog-no-button-of self)))
(cancel-bw (button-window-of
(y-or-n-dialog-cancel-button-of self))))
(xlib::reparent-window yes-bw dw 20 20)
(xlib::reparent-window no-bw dw 20 50)
(xlib::reparent-window cancel-bw dw 20 80)
(setf (xlib::window-plist yes-bw)
(acons :associated-with self
(xlib::window-plist yes-bw))
(xlib::window-plist no-bw)
(acons :associated-with self
(xlib::window-plist no-bw))
(xlib::window-plist cancel-bw)
(acons :associated-with self
(xlib::window-plist cancel-bw)))
(y-or-n-dialog-compute-geometry self)
(xlib::map-window dw)
(xlib::map-subwindows dw)))
self))
(defun y-or-n-dialog-compute-geometry (y-or-n-dialog)
(let* ((d y-or-n-dialog)
(y-b (y-or-n-dialog-yes-button-of d))
(n-b (y-or-n-dialog-no-button-of d))
(c-b (y-or-n-dialog-cancel-button-of d))
(y-bw (button-window-of y-b))
(n-bw (button-window-of n-b))
(c-bw (button-window-of c-b))
(gcontext (y-or-n-dialog-gcontext-of d))
(window (y-or-n-dialog-window-of d))
(font (xlib::gcontext-font gcontext))
(title-width
(xlib::text-extents font (y-or-n-dialog-text-of d)))
(item-height (xlib::drawable-height y-bw))
(y-width (xlib::drawable-width y-bw))
(n-width (xlib::drawable-width n-bw))
(c-width (xlib::drawable-width c-bw))
d-width d-height)
(setf d-width
(+ (max title-width
(+ (* 4 *button-margin*)
y-width n-width c-width))
(* 2 *button-margin*))
d-height (* (+ item-height (* 2 *button-margin*)) 2))
(xlib::with-state (window)
(setf (xlib::drawable-width window) d-width
(xlib::drawable-height window) d-height))
(xlib::with-state (y-bw)
(setf (xlib::drawable-x y-bw) *button-margin*
(xlib::drawable-y y-bw)
(- d-height item-height *button-margin*)))
(xlib::with-state (n-bw)
(setf (xlib::drawable-x n-bw)
(+ (* 3 *button-margin*) y-width)
(xlib::drawable-y n-bw)
(- d-height item-height *button-margin*)))
(xlib::with-state (c-bw)
(setf (xlib::drawable-x c-bw)
(+ (* 5 *button-margin*) y-width n-width)
(xlib::drawable-y c-bw)
(- d-height item-height *button-margin*)))))
(defun get-string-from-user (prompt-string
&key
(initial-string NIL)
size
(ok-text "OK")
(cancel-text "Cancel")
position
&allow-other-keys)
(declare (ignore size position))
(let ((d (make-dialog
:text-dialogs (list (list prompt-string initial-string))
:ok-text ok-text
:cancel-text cancel-text))
(string NIL))
(multiple-value-bind (checks texts) (show-me-my-dialog d)
(setf string (cadr (assoc prompt-string texts :test #'string=))))
string))
(defun y-or-n-dialog (message
&key
(yes-text "Yes")
(no-text "No")
(cancel-text "Cancel")
&allow-other-keys)
(let ((d (make-y-or-n-dialog
:title message
:yes-text yes-text
:no-text no-text
:cancel-text cancel-text)))
(show-me-my-dialog d)))
(defmethod initialize-instance :after
((self list-dialog-item)
&key
;;(display NIL)
gcontext text
&allow-other-keys)
(declare (special *default-display*))
(let ((display *default-display*))
;;(unless display (setf display (open-default-host-display)))
(let* ((screen (xlib::display-default-screen display))
(black (xlib::screen-black-pixel screen))
(white (xlib::screen-white-pixel screen))
(parent (xlib::screen-root screen)))
(setf (list-dialog-item-window-of self)
(xlib::create-window
:parent parent
:background white
:x 0 :y 0 :width 16 :height 16
:override-redirect :on
:border-width 2
:event-mask (xlib::make-event-mask :exposure
:button-press
:button-release))
(xlib::window-plist (list-dialog-item-window-of self))
(acons :wb-class-instance self NIL)
(list-dialog-item-text-of self) text)
(list-dialog-item-compute-geometry self))))
(defun list-dialog-item-compute-geometry (item)
(let* ((window (list-dialog-item-window-of item))
(gcontext (list-dialog-item-gcontext-of item))
(font (xlib::gcontext-font gcontext))
(text (list-dialog-item-text-of item))
(width (+ (* 2 *button-margin*) (xlib::text-extents font text)))
(height (+ (* 2 *button-margin*) (xlib::font-ascent font)
(xlib::font-descent font))))
(xlib::with-state (window)
(setf (xlib::drawable-width window) width
(xlib::drawable-height window) height))))
(defmethod initialize-instance :after
((self list-dialog)
&key
;;(display NIL)
(font-name "fixed")
(title "Choose from the list")
(table-print-function
#'(lambda (x s) (format nil "~a" x)))
(list-of-items NIL)
(ok-text "OK")
(cancel-text "CANCEL")
&allow-other-keys)
(declare (special *default-display*))
;;(unless display (setf display (open-default-host-display)))
(let* ((display *default-display*)
(screen (xlib::display-default-screen display))
(black (xlib::screen-black-pixel screen))
(white (xlib::screen-white-pixel screen))
(parent (xlib::screen-root screen))
(font (xlib::open-font display font-name)))
(setf (list-dialog-window-of self)
(xlib::create-window :parent parent
:x 300 :y 300 :width 16 :height 16
:background white
:border-width 2
:override-redirect :on
:event-mask (xlib::make-event-mask
:exposure
:button-press
:button-release))
(xlib::window-plist (list-dialog-window-of self))
(acons :wb-class-instance self NIL)
(list-dialog-gcontext-of self)
(xlib::create-gcontext :drawable parent
:foreground black
:background white
:font font)
(list-dialog-title-of self) title
(list-dialog-ok-button-of self)
(make-button :display display
:text ok-text
:gcontext (list-dialog-gcontext-of self)
:action :OK)
(list-dialog-cancel-button-of self)
(make-button :display display
:text cancel-text
:gcontext (list-dialog-gcontext-of self)
:action :CANCEL))
(let* ((l-dw (list-dialog-window-of self))
(ok-bw (button-window-of (list-dialog-ok-button-of self)))
(cancel-bw (button-window-of (list-dialog-cancel-button-of self))))
(xlib::reparent-window ok-bw l-dw 0 0)
(xlib::reparent-window cancel-bw l-dw 0 0)
(setf (xlib::window-plist ok-bw)
(acons :associated-with self (xlib::window-plist ok-bw)))
(setf (xlib::window-plist cancel-bw)
(acons :associated-with self (xlib::window-plist cancel-bw))))
(dolist (item list-of-items)
(setf (list-dialog-items-of self)
(append (list-dialog-items-of self)
(list (make-list-dialog-item
:display display
:gcontext (list-dialog-gcontext-of self)
:item item
:text (funcall table-print-function item NIL)))))
(let* ((curr-i (car (last (list-dialog-items-of self))))
(i-w (list-dialog-item-window-of curr-i)))
(xlib::reparent-window (list-dialog-item-window-of curr-i)
(list-dialog-window-of self) 0 0)
(setf (xlib::window-plist i-w)
(acons :associated-with self (xlib::window-plist i-w)))))
(list-dialog-compute-geometry self)
(xlib::map-window (list-dialog-window-of self))
(xlib::map-subwindows (list-dialog-window-of self))
self)))
(defun make-list-dialog (&rest args)
(apply #'make-instance 'list-dialog args))
(defun make-list-dialog-item (&rest args)
(apply #'make-instance 'list-dialog-item args))
(defun list-dialog-p (thing)
(typep thing 'list-dialog))
(defun list-dialog-item-p (thing)
(typep thing 'list-dialog-item))
(defmethod wb-refresh ((self list-dialog))
(let* ((window (list-dialog-window-of self))
(gcontext (list-dialog-gcontext-of self))
(font (xlib::gcontext-font gcontext))
(title (list-dialog-title-of self))
(title-width (xlib::text-extents font title))
(window-width (xlib::drawable-width window))
(text-start-x (- (round window-width 2)
(round title-width 2)))
(text-start-y (+ *button-margin*
(xlib::font-ascent font))))
(xlib::draw-image-glyphs window gcontext
text-start-x text-start-y title)))
(defmethod wb-refresh ((self list-dialog-item))
(let* ((window (list-dialog-item-window-of self))
(gcontext (list-dialog-item-gcontext-of self))
(font (xlib::gcontext-font gcontext))
(text (list-dialog-item-text-of self))
(fg (xlib::gcontext-foreground gcontext))
(bg (xlib::gcontext-background gcontext))
(fn *host-bic-mode*)
(width (xlib::drawable-width window))
(height (xlib::drawable-height window))
(selected-p (list-dialog-item-selected-p self))
(text-start-x *button-margin*)
(text-start-y (+ *button-margin* (xlib::font-ascent font))))
(if selected-p
(xlib::with-gcontext (gcontext :function fn
:foreground bg
:background fg)
(xlib::draw-rectangle window gcontext 0 0 width height T)
(xlib::draw-image-glyphs window gcontext
text-start-x text-start-y text))
(xlib::draw-image-glyphs window gcontext
text-start-x text-start-y text))))
(defun max-list-dialog-item-width (items)
(let ((result 0))
(dolist (item items)
(let ((w (list-dialog-item-window-of item)))
(setf result
(max result (+ 2 *button-margin* (xlib::drawable-width w))))))
result))
(defun list-dialog-compute-geometry (dialog)
(let* ((window (list-dialog-window-of dialog))
(gcontext (list-dialog-gcontext-of dialog))
(font (xlib::gcontext-font gcontext))
(title (list-dialog-title-of dialog))
(items (list-dialog-items-of dialog))
(title-width (+ (* 2 *button-margin*)
(xlib::text-extents font title)))
(item-width (max-list-dialog-item-width items))
(item-height (+ (* 2 *button-margin*)
(xlib::font-ascent font)
(xlib::font-descent font)))
(height (+ (* (+ (length items) 2) item-height)
(* 2 *button-margin*)))
(ok-button (list-dialog-ok-button-of dialog))
(cancel-button (list-dialog-cancel-button-of dialog))
(ok-width (xlib::drawable-width
(button-window-of ok-button)))
(cancel-width (xlib::drawable-width
(button-window-of cancel-button)))
(buttons-width (+ (* 4 *button-margin*)
ok-width cancel-width))
(width (+ (* 2 *button-margin*)
(max title-width item-width buttons-width))))
(xlib::with-state (window)
(setf (xlib::drawable-width window) width
(xlib::drawable-height window) height))
(let ((next-top item-height))
(dolist (item items)
(let ((w (list-dialog-item-window-of item)))
(xlib::with-state (w)
(setf (xlib::drawable-width w)
(- item-width (* 2 *button-margin*))
(xlib::drawable-x w) *button-margin*
(xlib::drawable-y w) next-top)))
(incf next-top item-height)))
(let ((ok-window (button-window-of ok-button))
(cancel-window (button-window-of cancel-button))
(button-y (- (xlib::drawable-height window)
item-height))
(ok-x *button-margin*)
(cancel-x (+ (* 3 *button-margin*) ok-width)))
(xlib::with-state (ok-window)
(setf (xlib::drawable-x ok-window) ok-x
(xlib::drawable-y ok-window) button-y))
(xlib::with-state (cancel-window)
(setf (xlib::drawable-x cancel-window) cancel-x
(xlib::drawable-y cancel-window) button-y)))))
(defun select-item-from-list
(list
&key
window-title
(select-text "OK")
(cancel-text "Cancel")
(table-print-function
#'(lambda (x s) (format nil "~a" x)))
(selection-type :single))
(let ((d (make-list-dialog :title window-title
:table-print-function table-print-function
:ok-text select-text
:cancel-text cancel-text
:selection-type selection-type
:list-of-items list)))
(show-me-my-dialog d)))
| 56,254 | Common Lisp | .cl | 1,335 | 31.855431 | 116 | 0.574465 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 5b40b237ea7a5e39add35a2ad091be680e839f0028177858342348ddc8141188 | 32,838 | [
-1
] |
32,839 | dialog-mcl.lsp | rwoldford_Quail/source/window-basics/prompt/dialog-mcl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; dialog-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; Authors:
;;; R.W. Oldford 1994
;;;
;;;
;;;
(in-package :wb)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; dialogs in ccl are used.
;;;
| 565 | Common Lisp | .cl | 21 | 24.619048 | 81 | 0.239777 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | c03023d4ed965c1bcfad21bdcaf57d372c569c478787b60cc0fde7dd07617cf0 | 32,839 | [
-1
] |
32,840 | collect-input-mcl43.lsp | rwoldford_Quail/source/window-basics/prompt/collect-input-mcl43.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; collect-input-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; R.W. Oldford 1992
;;;
;;;
;;;
;;;----------------------------------------------------------------------------------
;;;
;;; History:
;;;
;;; - Construct a uniform prompting facility.
;;;
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(collect-input)))
(defun collect-input (prompt-default-pairs
&key
(prompt-text "Enter a value for each field.")
(select-text "OK")
(cancel-text "Cancel")
(columns 1))
"Prompts user for value of several items as given by the ~
argument prompt-default-pairs. Prompt-text, select-text, and cancel-text ~
are strings which will appear in the message, select button, and cancel ~
button, respectively. Columns is the number of columns to be used in the ~
display (default 1). ~
(:returns An updated list of prompt-value-pairs. Values are strings or NIL ~
(if no value was specified))."
(setq prompt-default-pairs
(loop
for pair in prompt-default-pairs
collect
(cond
((consp pair) pair)
(T (cons pair NIL)))))
(let*
((p1 (make-instance 'collect-input
;;:view-position NIL
:window-show NIL
:items prompt-default-pairs
:prompt-text (format NIL prompt-text)
:select-text select-text
:cancel-text cancel-text
:columns columns))
(ans (modal-dialog p1)))
(let ((w (car (ccl::windows))))
(if (typep w 'canvas)
(mapcar #'ccl:menu-enable (mapcar #'cdr (slot-value w 'title-menus)))))
ans))
(defclass collect-input (ccl:dialog)
((item-pairs
:initarg :items
:initform NIL)
(prompt-text
:initform "Set parameters."
:initarg :prompt-text)
(collect-input :initform NIL)
(columns :initform 1 :initarg :columns)
)
(:documentation "A dialog that allows the user to set ~
the logical value of several parameters at once.")
)
(defmethod initialize-instance ((self collect-input) &rest initargs)
(apply #'call-next-method self :window-show NIL
:window-type :double-edge-box
:view-position '(:left 2)
initargs))
(defmethod initialize-instance :after ((self collect-input)
&rest initargs
&key
(select-text "OK")
(cancel-text "Cancel"))
(declare (ignore initargs))
(flet
((text-width (string font)
(string-width string font)))
(let*
((item-pairs (slot-value self 'item-pairs))
(columns (slot-value self 'columns))
(view-font (view-font self))
(max-prompt-text-width
(loop
for i in item-pairs
maximize
(string-width
(string (car i))
view-font)))
(max-input-text-width
(loop
for i in item-pairs
maximize
(string-width
(string (cdr i))
view-font)))
(max-prompt-width (+ 10 max-prompt-text-width))
(max-input-width (max 100 (+ 20 max-input-text-width)))
(prompt-text (slot-value self 'prompt-text))
(prompt-text-width (string-width prompt-text view-font))
(text-height (multiple-value-bind (ascent descent widmax leading)
(font-info view-font)
(declare (ignore widmax))
(+ ascent descent leading)))
(text-box-x 20)
(text-box-y 20)
(text-box-width (+ 5 prompt-text-width))
(text-box-height (round (* 2.5 text-height)))
(collect-input-height (+ 5 text-height))
(row-sep 10)
(col-sep 30)
(button-height (+ 2 text-height))
(button-width
(+ 5 (max (string-width select-text view-font)
(string-width cancel-text view-font))))
(select-button-y (+ text-box-y 2 text-box-height))
(cancel-button-y (+ select-button-y button-height 10))
(n-items (length item-pairs))
(inter-field-space 3)
(col-width (+ col-sep max-prompt-width
max-input-width inter-field-space))
(nrows (ceiling (/ n-items columns)))
(first-item-y (+ text-box-y text-box-height))
(first-item-x 10)
(button-x (+ 50 first-item-x (* columns col-width)))
(view-size-width (max 200
(+ button-x button-width 2)
(+ text-box-x text-box-width 2)))
(view-size-height (max 100
(+ first-item-y
(+ 2 (* (+ nrows 1)
(+ row-sep collect-input-height)))
2)
(+ cancel-button-y
button-height
2)))
(text-dialog (make-dialog-item
'static-text-dialog-item
(h-draw:make-point text-box-x text-box-y)
(h-draw:make-point text-box-width text-box-height)
prompt-text))
(collect-prompts
(loop
for item in item-pairs
with y-start = first-item-y
with x-start = first-item-x
with row = 0
with col = 0
collect
(make-dialog-item
'static-text-dialog-item
(h-draw:make-point (+ x-start (* col col-width))
(+ y-start
(* row
(+ row-sep collect-input-height))))
(h-draw:make-point max-prompt-width collect-input-height)
(string (car item))
#'(lambda (d) d)
:dialog-item-enabled-p T)
do (cond
((>= row (1- nrows))
(incf col 1)
(setq row 0))
(T (incf row 1)))))
(collect-input
(setf (slot-value self 'collect-input)
(loop
for item in item-pairs
with y-start = first-item-y
with x-start = first-item-x
with row = 0
with col = 0
collect
(make-dialog-item
'editable-text-dialog-item
(h-draw:make-point (+ x-start max-prompt-width
inter-field-space (* col col-width))
(+ y-start (* row
(+ row-sep collect-input-height))))
(h-draw:make-point max-input-width collect-input-height)
(string (or (cdr item) ""))
#'(lambda (d) d)
:dialog-item-enabled-p T
:allow-returns T)
do (cond
((>= row (1- nrows))
(incf col 1)
(setq row 0))
(T (incf row 1))))))
(select-button
(make-dialog-item
'default-button-dialog-item
(h-draw:make-point button-x select-button-y)
(h-draw:make-point button-width button-height)
select-text
#'(lambda (d)
(let*
((p (view-container d))
(items (slot-value p 'item-pairs))
(collect-input (slot-value p 'collect-input)))
(loop for i in items
as ci in collect-input
with result
do
(setf result (dialog-item-text ci))
(if (zerop (length result))
(setf (cdr i) NIL)
(setf (cdr i) (dialog-item-text ci))))
(return-from-modal-dialog items)
))))
(cancel-button
(make-dialog-item
'button-dialog-item
(h-draw:make-point button-x cancel-button-y)
(h-draw:make-point button-width button-height)
cancel-text
#'(lambda (d)
(declare (ignore d))
(return-from-modal-dialog (values)))))
)
(set-view-size self (h-draw:make-point (+ 6 view-size-width) view-size-height))
(add-subviews self text-dialog select-button cancel-button)
(loop for ci in collect-input
do
(add-subviews self ci))
(loop for ci in collect-prompts
do
(add-subviews self ci))
)))
#|
(setf items
(collect-input (list 'heycheckmeOut!! "try this" "Or this" "or this"
"Gold" "Silver" "Bronze")))
(setf items (collect-input items))
(collect-input (list 'heycheckmeOut!! "try this" "Or this" "or this"
"Gold" "Silver" "Bronze")
:columns 2)
(collect-input (list 'heycheckmeOut!! "try this" "Or this" "or this"
"Gold" "Silver" "Bronze")
:columns 3)
(collect-input (list 'heycheckmeOut!! "try this" "Or this" "or this"
"Gold" "Silver" "Bronze"
"platinum" "Tin" "lead" "zinc"
"iron")
:prompt-text "Give the man a medal!"
:select-text "DO IT"
:cancel-text "Forget it." :columns 3)
|#
| 10,551 | Common Lisp | .cl | 259 | 26.436293 | 86 | 0.468615 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 9127e64c579c69e3e45aa7695244f970ff831ccb26c2bff2042b57af46f41b09 | 32,840 | [
-1
] |
32,841 | pick-one-clx.lsp | rwoldford_Quail/source/window-basics/prompt/pick-one-clx.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; pick-one-clx.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; R.W. Oldford 1992
;;;
;;;
;;;
;;;----------------------------------------------------------------------------------
;;;
;;; History:
;;;
;;; - Construct a uniform prompting facility.
;;;
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(pick-one)))
(defun pick-one (items &key
(prompt-text "Pick one of the following.")
(item-print-function NIL)
(action-function #'(lambda (i) i))
(select-text "Select")
(cancel-text "Cancel"))
"Prompts the user to pick one of the items in the sequence items, ~
using the text supplied by the keyword prompt-text. ~
If supplied, the function action-function is called on the selected item. ~
Default action just returns the item. ~
If supplied, item-print-function will be used on each item to display it ~
in the table. ~
(:see-also prompt-for-items prompt-t-or-f)"
(let ((selection (car (select-item-from-list items
:prompt-text prompt-text
:select-text select-text
:cancel-text cancel-text
:selection-type :single
:item-print-function
(if (functionp item-print-function)
item-print-function
#'(lambda (x) (format nil "~a" x)))))))
(funcall action-function selection)
selection))
| 2,027 | Common Lisp | .cl | 52 | 32.788462 | 86 | 0.515998 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 3b47455307dd1f57ea5edb0e3f34cc9d41748fbc9ff437d82b91b211f39167e8 | 32,841 | [
-1
] |
32,842 | prompt-clx.lsp | rwoldford_Quail/source/window-basics/prompt/prompt-clx.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; prompt-clx.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; N.G. Bennett 1993
;;; R.W. Oldford 1994.
;;;
;;;
;;;
;;;----------------------------------------------------------------------------------
;;;
;;; History:
;;;
;;; - Construct a uniform prompting facility.
;;;
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(prompt-user save-value prompt-t-or-f prompt-true-or-false
prompt-for-items)))
(defun prompt-user (&key (type T)
(read-type :string)
(prompt-string NIL)
(initial-string "")
(ok-text "OK")
(cancel-text "Cancel")
left top
width
(height 100))
"Prompts user for input. ~
(:key ~
(:arg Prompt-string NIL The string used to query the user.) ~
(:arg initial-string \"\" Appears to the user as the default answer.) ~
(:arg ok-text \"OK\" String used to prompt user for confirmation.) ~
(:arg cancel-text \"Cancel\" String used to prompt user for cancellation.) ~
(:arg type T Data type of item to be returned by user. Any Common Lisp ~
data-type is acceptable.) ~
(:arg read-type :string How to read the typed input. ~
Legal values are :string :eval or :read.) ~
(:arg left NIL Location of the left of the prompt window.) ~
(:arg top NIL Location of the top of the prompt window.) ~
(:arg width NIL Width of prompt window.) ~
(:arg height 100 Height of prompt window.) ~
)"
(declare (ignore left top width height))
(setq prompt-string
(if prompt-string
(if (stringp prompt-string)
(format NIL prompt-string)
(format NIL "~a" prompt-string))
(format nil "Please enter a ~S" type)))
(let* ((result (cdar
(collect-input
(list ">>>")
:prompt-text prompt-string))))
(setf result
(case read-type
(:string result)
(:eval (eval (read-from-string result :preserve-whitespace t)))
(:read (read-from-string result :preserve-whitespace t))
)
)
(if (typep result type)
result
(quail-error "~S is not of type ~S" result type))))
(defun save-value (arg)
"Saves the value of arg as the value of a symbol retrieved from a prompt."
(eval
`(setf ,(prompt-user :read-type :read
:type 'symbol
:prompt-string
"Give a symbol to store the value on:")
,arg)))
(defun prompt-t-or-f (message
&key
(true-text "Yes")
(false-text "No")
(cancel-text "Cancel"))
"Prompts the user to make a decision between two alternatives (true-text and false-text) ~
in response to the information given in message. T is returned if the first letter ~
of the true-text (default the string Yes) is typed by the user; NIL is returned if the first letter ~
of the false-text (default the string No) is typed by the user. ~
If cancelled by the user, processing ends. ~
(:see-also prompt-for-items pick-one prompt-true-or-false)"
(y-or-n-dialog message
:yes-text true-text
:no-text false-text
:cancel-text cancel-text))
(defun prompt-true-or-false (message
&key
(true-text "Yes")
(false-text "No")
(cancel-text "Cancel"))
"Prompts the user to make a decision between two alternatives (true-text and false-text) ~
in response to the information given in message. T is returned if the ~
true-text (default the string Yes) is typed by the user; NIL is returned if the ~
false-text (default the string No) is typed by the user. ~
If cancelled by the user, processing ends. ~
(:see-also prompt-for-items pick-one prompt-t-or-f)"
(prompt-t-or-f message
:true-text true-text
:false-text false-text
:cancel-text cancel-text))
(defun prompt-for-items (list
&key (prompt-text "Choose")
(item-function NIL)
(selection-type :single))
"Prompts user to select one or more items from the list. ~
Prompt-text is displayed to help the user choose. ~
Selection-type is one of :single (indicating only a single item ~
can be selected), :contiguous (indicating only contiguous items ~
can be selected), and :disjoint (indicating that any subset of the items ~
can be selected). It returns a list of all items selected, NIL if no items ~
were selected. ~
Item-print-function is the function called on each item to display it in ~
selection table. ~
(:see-also pick-one prompt-t-or-f)"
(if (functionp item-function)
(select-item-from-list list
:prompt-text prompt-text
:item-print-function
#'(lambda(x)
(format nil "~a" (funcall item-function x)))
:selection-type selection-type)
(select-item-from-list list
:prompt-text prompt-text
:selection-type selection-type)))
| 6,141 | Common Lisp | .cl | 137 | 34.043796 | 124 | 0.536227 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 7e06265c6d0abf10f5eef2269730fa234d42ff185a94b03f13ed50a20a0dacd0 | 32,842 | [
-1
] |
32,843 | pen-clx.lsp | rwoldford_Quail/source/window-basics/pen/pen-clx.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; pen-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; R.W. Oldford 1989-1992
;;;
;;;
;;;
;;;
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(*pen-operations*)))
(defconstant *pen-operations*
(list :boole-1
:boole-2
:boole-andc1
:boole-andc2
:boole-and
:boole-c1
:boole-c2
:boole-clr
:boole-eqv
:boole-ior
:boole-nand
:boole-nor
:boole-orc1
:boole-orc2
:boole-set
:boole-xor)
"List of legal pen operations.")
| 1,054 | Common Lisp | .cl | 41 | 22.97561 | 86 | 0.51338 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 4693bfd4f5d23e7dfb92521cb09ae97c84948bf76089f3a0ea3ee8bed616815f | 32,843 | [
-1
] |
32,844 | strings-mcl.lsp | rwoldford_Quail/source/window-basics/draw/strings-mcl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; strings-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; C.B. Hurley 1989-1991
;;; J.A. McDonald 1988-89
;;; R.W. Oldford 1989-1992
;;; J.O. Pedersen 1988-89
;;;
;;;
;;;
;;;----------------------------------------------------------------------------------
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(canvas-string-width)))
(defun canvas-string-width (canvas string
&key
(font (if canvas
(canvas-font canvas)
*normal-graphics-font*)))
"Returns the width of the string displayed in the canvas according to ~
the characteristics of font. If canvas is NIL, it determines the ~
width according to the font alone."
(declare (special *normal-graphics-font*))
(ccl::string-width string (canvas-font-to-host-font font)))
(defmethod ccl::stream-tyo ((view canvas) char)
(stream-tyo (the-scroller view) char))
| 1,631 | Common Lisp | .cl | 38 | 35.736842 | 89 | 0.477764 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | e0e9d38cdd8bfd71297b0e5f1f1b667a14b7a46cbbac6ce798886c3ca26378e5 | 32,844 | [
-1
] |
32,845 | draw-clx.lsp | rwoldford_Quail/source/window-basics/draw/draw-clx.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; draw-clx.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; N.G. Bennett 1992
;;; H.A. Chipman 1991
;;; C.B. Hurley 1989-1992
;;; M.E. Lewis 1991
;;; J.A. McDonald 1988-89
;;; R.W. Oldford 1989-1992
;;; J.O. Pedersen 1988-89
;;;
;;;
;;;
;;;----------------------------------------------------------------------------------
;;; CLX dependent draw functions ... just hacked ... .rwo
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(canvas-highlight-rectangle canvas-highlight-arc)))
(defun canvas-highlight-rectangle (canvas left right bottom top
&key
color
(operation :boole-xor)
)
"Highlights a rectangle of canvas using color"
(if (eql operation :boole-xor)
(progn ; for highlight mode on color
(with-focused-canvas canvas
(let ((old-op (pen-operation-of canvas)))
;;(if (colorp color)
;;(with-rgb (color-rgb color)
;;(#_HiliteColor :ptr color-rgb)))
;;(#_PenMode 50)
(canvas-draw-filled-rectangle canvas left right bottom top
:color color )
(h-draw::set-pen-mode canvas (boole-to-op old-op)))))
(canvas-draw-filled-rectangle canvas left right bottom top
:color color :operation operation)))
(defun canvas-highlight-arc (canvas
start-angle arc-angle
x-centre y-centre
x-radius y-radius
&key
color
(operation :boole-xor)
)
"Highlights an arc of canvas using color"
(if (eql operation :boole-xor)
(progn ; for highlight mode on color
(with-focused-canvas canvas
(let ((old-op (pen-operation-of canvas)))
;;(if (colorp color)
;;(with-rgb (color-rgb color)
;;(#_HiliteColor :ptr color-rgb)))
;;(#_PenMode 50)
(canvas-draw-filled-arc canvas
start-angle arc-angle
x-centre y-centre
x-radius y-radius
:color color )
(h-draw::set-pen-mode canvas (boole-to-op old-op)))))
(canvas-draw-filled-arc canvas
start-angle arc-angle
x-centre y-centre
x-radius y-radius
:color color :operation operation)))
| 3,382 | Common Lisp | .cl | 77 | 30.142857 | 116 | 0.442922 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | f79887a940d24342d52db3b61b62e051f3b69a5242009675f885bb99123776d1 | 32,845 | [
-1
] |
32,846 | draw-mcl.lsp | rwoldford_Quail/source/window-basics/draw/draw-mcl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; draw-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; N.G. Bennett 1992
;;; H.A. Chipman 1991
;;; C.B. Hurley 1989-1992
;;; M.E. Lewis 1991
;;; J.A. McDonald 1988-89
;;; R.W. Oldford 1989-1992
;;; J.O. Pedersen 1988-89
;;;
;;;
;;;
;;;----------------------------------------------------------------------------------
;;; MCL dependent draw functions
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(canvas-highlight-rectangle canvas-highlight-arc)))
(defun canvas-highlight-rectangle (canvas left right bottom top
&key
color
(operation :boole-xor)
)
"Highlights a rectangle of canvas using color"
(if (eql operation :boole-xor)
(progn ; for highlight mode on color
(with-focused-canvas canvas
(let ((old-op (pen-operation-of canvas)))
(if (colorp color)
(with-rgb (color-rgb color)
(#_HiliteColor :ptr color-rgb)))
(#_PenMode 50)
(canvas-draw-filled-rectangle canvas left right bottom top
:color color )
(h-draw::set-pen-mode canvas (boole-to-op old-op)))))
(canvas-draw-filled-rectangle canvas left right bottom top
:color color :operation operation)))
(defun canvas-highlight-arc (canvas
start-angle arc-angle
x-centre y-centre
x-radius y-radius
&key
color
(operation :boole-xor)
)
"Highlights an arc of canvas using color"
(if (eql operation :boole-xor)
(progn ; for highlight mode on color
(with-focused-canvas canvas
(let ((old-op (pen-operation-of canvas)))
(if (colorp color)
(with-rgb (color-rgb color)
(#_HiliteColor :ptr color-rgb)))
(#_PenMode 50)
(canvas-draw-filled-arc canvas
start-angle arc-angle
x-centre y-centre
x-radius y-radius
:color color )
(h-draw::set-pen-mode canvas (boole-to-op old-op)))))
(canvas-draw-filled-arc canvas
start-angle arc-angle
x-centre y-centre
x-radius y-radius
:color color :operation operation)))
| 3,341 | Common Lisp | .cl | 77 | 29.61039 | 116 | 0.444513 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 9ad71960cfabe195299ffe231eb1d7a8871c157f127f179f4e90d7d78798c7b9 | 32,846 | [
-1
] |
32,847 | strings-clx.lsp | rwoldford_Quail/source/window-basics/draw/strings-clx.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; strings-clx.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; C.B. Hurley 1989-1991
;;; J.A. McDonald 1988-89
;;; R.W. Oldford 1989-1992
;;; J.O. Pedersen 1988-89
;;;
;;;
;;;
;;;----------------------------------------------------------------------------------
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(canvas-string-width)))
(defun canvas-string-width (canvas string
&key
(font (if canvas
(canvas-font canvas)
*normal-graphics-font*)))
"Returns the width of the string displayed in the canvas according to ~
the characteristics of font. If canvas is NIL, it determines the ~
width according to the font alone."
(declare (special *normal-graphics-font*))
(xlib::text-extents (canvas-font-to-host-font font) string))
#|
(defmethod ccl::stream-tyo ((view canvas) char)
(stream-tyo (the-scroller view) char))
|#
| 1,636 | Common Lisp | .cl | 40 | 34.075 | 89 | 0.475379 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | a3bdcc7d89e67ab7bad572908f0ff13ef38eef055d068b0df677921b92400922 | 32,847 | [
-1
] |
32,848 | default-fonts-clx.lsp | rwoldford_Quail/source/window-basics/fonts/default-fonts-clx.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; default-fonts-clx.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; N.G. Bennett 1993
;;; R.W. Oldford 1992
;;;
;;;
;;;
;;;----------------------------------------------------------------------------------
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(*very-small-graphics-font* *small-graphics-font*
*normal-graphics-font* *large-graphics-font*
*help-normal-text-font* *help-small-text-font*
*help-key-font* *help-little-key-font*
*help-lisp-font* *help-normal-title-font* *help-small-title-font*
*help-lisp-title-font*)))
(defparameter *very-small-graphics-font*
(canvas-make-font :name "times" :size 7 ) ;;11)
"Canvas font used for very small graphics characters.")
(defparameter *small-graphics-font*
(canvas-make-font :name "times" :size 9) ;;14)
"Canvas font used for small graphics characters.")
(defparameter *normal-graphics-font*
(canvas-make-font :name "times" :size 12) ;;17)
"Canvas font used for normal graphics characters.")
(defparameter *large-graphics-font*
(canvas-make-font :name "times" :size 12 ;;20
:style :bold)
"Canvas font used for small graphics characters.")
(defparameter *help-normal-text-font*
(canvas-make-font :name "helvetica" :size 12) ;;14)
"Canvas font used for normal text in help.")
(defparameter *help-small-text-font*
(canvas-make-font :name "helvetica" :size 9);;11)
"Canvas font used for small text in help.")
(defparameter *help-key-font*
(canvas-make-font :name "helvetica" :size 9 ;;14
:style :bold)
"Canvas font used for keys in help.")
(defparameter *help-little-key-font*
(canvas-make-font :name "helvetica" :size 7 ;;11
:style :bold)
"Small canvas font used for keys in help.")
(defparameter *help-lisp-font*
(canvas-make-font :name "courier" :size 12) ;;14)
"Canvas font used for displaying lisp code in help.")
(defparameter *help-normal-title-font*
(canvas-make-font :name "helvetica" :size 12) ;;14)
"Canvas font used for normal text in help title.")
(defparameter *help-small-title-font*
(canvas-make-font :name "helvetica" :size 9) ;;11)
"Canvas font used for small text in help title.")
(defparameter *help-lisp-title-font*
(canvas-make-font :name "courier" :size 12 ;;14
:style :bold)
"Canvas font used for displaying lisp code in help title.")
| 3,075 | Common Lisp | .cl | 69 | 39.347826 | 115 | 0.595494 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | b3e468ee92a29e137faa6bca28d6661d531ef18109bee2a516232a8009b39771 | 32,848 | [
-1
] |
32,849 | default-fonts-mcl.lsp | rwoldford_Quail/source/window-basics/fonts/default-fonts-mcl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; default-fonts-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; H.A. Chipman 1991
;;; C.B. Hurley 1989-1991
;;; J.A. McDonald 1988-89
;;; R.W. Oldford 1989-1991
;;; J.O. Pedersen 1988-89
;;;
;;;
;;;
;;;----------------------------------------------------------------------------------
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(*very-small-graphics-font* *small-graphics-font*
*normal-graphics-font* *large-graphics-font*
*help-normal-text-font* *help-small-text-font*
*help-key-font* *help-little-key-font*
*help-lisp-font* *help-normal-title-font* *help-small-title-font*
*help-lisp-title-font*)))
(defparameter *very-small-graphics-font*
(canvas-make-font :name "Monaco" :size 7)
"Canvas font used for very small graphics characters.")
(defparameter *small-graphics-font*
(canvas-make-font :name "Monaco" :size 9)
"Canvas font used for small graphics characters.")
(defparameter *normal-graphics-font*
(canvas-make-font :name "Monaco" :size 12)
"Canvas font used for normal graphics characters.")
(defparameter *large-graphics-font*
(canvas-make-font :name "Monaco" :size 12 :style :bold)
"Canvas font used for small graphics characters.")
(defparameter *help-normal-text-font*
(canvas-make-font :name "New York" :size 12)
"Canvas font used for normal text in help.")
(defparameter *help-small-text-font*
(canvas-make-font :name "New York" :size 9)
"Canvas font used for small text in help.")
(defparameter *help-key-font*
(canvas-make-font :name "New York" :size 9 :style :bold)
"Canvas font used for keys in help.")
(defparameter *help-little-key-font*
(canvas-make-font :name "New York" :size 7 :style :bold)
"Small canvas font used for keys in help.")
(defparameter *help-lisp-font*
(canvas-make-font :name "Courier" :size 12)
"Canvas font used for displaying lisp code in help.")
(defparameter *help-normal-title-font*
(canvas-make-font :name "New York" :size 12)
"Canvas font used for normal text in help title.")
(defparameter *help-small-title-font*
(canvas-make-font :name "New York" :size 9)
"Canvas font used for small text in help title.")
(defparameter *help-lisp-title-font*
(canvas-make-font :name "Courier" :size 12 :style :bold)
"Canvas font used for displaying lisp code in help title.")
| 3,019 | Common Lisp | .cl | 68 | 40.308824 | 115 | 0.613566 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 454986e8dd76c292a765f84895e5324461823e777e84eb8231e2c261812da7b8 | 32,849 | [
-1
] |
32,850 | font-mixin-clx.lsp | rwoldford_Quail/source/window-basics/fonts/font-mixin-clx.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; font-mixin-clx.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; R.W. Oldford 1992
;;;
;;;
;;;
;;;----------------------------------------------------------------------------------
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(font-mixin canvas-font)))
(defclass font-mixin ()
((canvas-font :initarg :font :reader canvas-font
:documentation "The window-basics font used for drawing characters."))
(:documentation
"A mixin class that allows a window-basics font to be stored."))
(defmethod (setf canvas-font) (new-font (self font-mixin))
(setf (xlib::gcontext-font (gcontext self))
(canvas-font-to-host-font new-font))
(setf (slot-value self 'canvas-font) new-font)
new-font)
(defmethod (setf canvas-font) (new-font (self scrolling-window))
(setf (xlib::gcontext-font (gcontext self))
(canvas-font-to-host-font new-font))
(call-next-method))
(defmethod initialize-instance :after ((self font-mixin)
&rest initargs
&key font)
(declare (ignore initargs))
(setf (canvas-font self) font)
)
| 1,746 | Common Lisp | .cl | 43 | 35.325581 | 92 | 0.526378 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 52ed02c8aee15856e46ac4901d34e327e11e0b48bfb2e53736f09cc7dc31061f | 32,850 | [
-1
] |
32,851 | font-mixin-mcl.lsp | rwoldford_Quail/source/window-basics/fonts/font-mixin-mcl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; font-mixin-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; R.W. Oldford 1992
;;;
;;;
;;;
;;;----------------------------------------------------------------------------------
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(font-mixin canvas-font)))
(defclass font-mixin ()
((canvas-font :initarg :font :reader canvas-font
:documentation "The window-basics font used for drawing characters."))
(:documentation
"A mixin class that allows a window-basics font to be stored."))
#|
(defmethod (setf canvas-font) (new-font (self font-mixin))
(ccl::set-view-font self (canvas-font-to-host-font new-font))
(setf (slot-value self 'canvas-font) new-font)
new-font)
|#
;; changed by cbh
(defmethod (setf canvas-font) (new-font (self font-mixin))
(ccl::set-view-font self (canvas-font-to-host-font new-font))
(setq new-font (host-font-to-canvas-font (ccl::view-font self)))
(setf (slot-value self 'canvas-font) new-font)
new-font)
(defmethod (setf canvas-font) (new-font (self scrolling-window))
(ccl::set-view-font (the-scroller self)
(canvas-font-to-host-font new-font))
(call-next-method))
(defmethod initialize-instance :after ((self font-mixin)
&rest initargs
&key font)
(declare (ignore initargs))
(if (canvas-font-p font)
(setf (canvas-font self) font)
(setf (canvas-font self)
(host-font-to-canvas-font (ccl::view-font self)))
))
| 2,149 | Common Lisp | .cl | 53 | 34.981132 | 92 | 0.543877 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 1ecaa0356ab70f0934d5fe2721f39eda91aba334e0c9e077e029134868e9f255 | 32,851 | [
-1
] |
32,852 | scrolling-window-clx.lsp | rwoldford_Quail/source/window-basics/host/scrolling-window-clx.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; scrolling-windows-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; R.W. Oldford 1989-1992
;;;
;;;
;;;
;;;----------------------------------------------------------------------------------
;;; A new class of windows which contain scroll-bars and a scrollable
;;; area.
;;;
;;; ----------------------------------------------------------------------------------
;;;
;;; Adapted from the scrolling-windows.lisp 1989 examples file distributed by apple
;;;
;;;(require :scrollers) ;; got it in wb-system-mcl.lisp
;;;
;;; Default changed to t for track-thumb-p
;;; my-scroller changed to the-scroller
;;; set-view-size changed to redisplay the entire window ... rwo 92
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '()))
(defclass scrolling-window ()
())
| 1,403 | Common Lisp | .cl | 37 | 35.513514 | 87 | 0.466176 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 03e9657629fba4510dd5e1b38f4187a066b7aa23d98be0cb0f6656c76a2d17cd | 32,852 | [
-1
] |
32,853 | host-fonts-mcl.lsp | rwoldford_Quail/source/window-basics/host/host-fonts-mcl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; host-fonts-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; Copyright (c) 1994 Statistical Computing Laboratory, University of Waterloo
;;;
;;;
;;; Authors:
;;; N.G. Bennett 1993.
;;; R.W. Oldford 1994.
;;;
;;;--------------------------------------------------------------------------------
(in-package :host-draw)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(font-transfer-modes font-styles font-transfer-modes font-names
cached-host-font clear-host-font-cache
get-canvas-font-name get-canvas-font-size get-canvas-font-style
get-canvas-font-transfer-mode host-font-description)
))
(defvar
*font-transfer-modes*
(list :srcCopy :srcOr :srcXor :srcBic
:srcPatCopy :srcPatOr :srcPatXor :srcPatBic)
"Font transfer-modes cache")
(defun font-transfer-modes ()
*font-transfer-modes*)
(defvar
*font-styles*
(loop
for
s in ccl:*style-alist*
collect (car s))
"Font styles cache")
(defun font-styles ()
*font-styles*)
(defun font-names ()
(declare (special ccl::*font-list*))
ccl::*font-list*)
(defun cached-host-font (canvas-font)
"Returns the host-font that has been cached for this canvas-font. ~
If one is not cached, it is found, cached, and returned."
(let ((host-font (sixth canvas-font)))
(unless host-font
(setf host-font
(remove NIL
(concatenate 'list
(list (second canvas-font))
(third canvas-font)
(cdddr canvas-font))))
(nconc canvas-font (list host-font)))
host-font))
(defun clear-host-font-cache (canvas-font)
"Clears the host-font cache for this canvas-font."
(if (sixth canvas-font)
(rplacd (last canvas-font 2) NIL)))
(defun get-canvas-font-name (host-font)
"Translates the host Common Lisp font representation to get the name ~
of the corresponding canvas-font in window-basics."
(unless (listp host-font) (setf host-font (list host-font)))
(loop for n in (font-names)
when (find n host-font
:test #'(lambda (a b)
(and (stringp a) (stringp b)
(string-equal a b))))
return n))
(defun get-canvas-font-size (host-font)
"Translates the host Common Lisp font representation to get the size ~
of the corresponding canvas-font in window-basics."
(unless (listp host-font) (setf host-font (list host-font)))
(find-if #'numberp host-font))
(defun get-canvas-font-style (host-font)
"Translates the host Common Lisp font representation to get the style ~
of the corresponding canvas-font in window-basics."
(unless (listp host-font) (setf host-font (list host-font)))
(loop for s in (font-styles)
when (find s host-font)
collect s))
(defun get-canvas-font-transfer-mode (host-font)
"Translates the host Common Lisp font representation to get the transfer-mode ~
of the corresponding canvas-font in window-basics."
(unless (listp host-font) (setf host-font (list host-font)))
(loop for m in
(font-transfer-modes)
when (find m host-font)
return m))
(defun host-font-description (host-font)
"Returns four values that represent (in pixels) the ascent, ~
descent, max-width, and leading (suggested spacing between ~
lines) of the host-font."
(ccl::font-info host-font))
| 3,755 | Common Lisp | .cl | 92 | 33.423913 | 128 | 0.584276 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 60fae9aaab72528870c367a5b4b92d5db45c4810acece955464e62bfe1635931 | 32,853 | [
-1
] |
32,854 | host-window-clx.lsp | rwoldford_Quail/source/window-basics/host/host-window-clx.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; host-window-clx.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; N.G. Bennett 1993.
;;;
;;;
;;;
;;; ----------------------------------------------------------------------------------
;;; A new class of windows which contain scroll-bars and a scrollable
;;; area.
;;;
;;; ----------------------------------------------------------------------------------
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(host-window)))
(defclass host-window ()
((host-window :accessor host-window)
(window-manager :accessor window-manager
:initform NIL
:initarg :window-manager)
(gcontext :accessor gcontext :documentation "The graphics context.")
(current-position :accessor current-position
:documentation "The pen position.")))
(defmethod window-manager :around ((Self host-window))
(unless (call-next-method)
(or (setf (window-manager self) *window-manager*)
(setf (window-manager self)
(prompt-for-window-manager
*known-window-managers*)))))
#|
(defmethod xwindow-of ((self host-window))
(unless (window-manager self)
(setf (window-manager self)
(prompt-for-window-manager *known-window-managers*)))
(case (window-manager self)
(:4Dwm
(parent-of (parent-of (host-window self))))
(:twm
(parent-of (host-window self)))
(:macx
(host-window self))
(T (host-window self))))
|#
(defmethod wb-refresh ((self host-window))
(declare (ignore self)))
(defmethod initialize-instance ((self host-window)
&key
(host NIL)
(font *normal-graphics-font*)
(left 0)
(top 0)
(width 0)
(height 0)
(title "Canvas"))
(declare (special *default-display*))
(unwind-protect
(let* ((screen (xlib:display-default-screen
*default-display*))
(text-font (canvas-font-to-host-font font))
(black (xlib:screen-black-pixel screen))
(white (xlib:screen-white-pixel screen))
(window (xlib:create-window
:parent
(xlib:screen-root screen)
:x left :y top
:width width :height height
:background black
:border white
:border-width 1
:colormap
(xlib:screen-default-colormap
screen)
:bit-gravity :center
:event-mask
(xlib:make-event-mask
:exposure
:button-press
:button-release
:enter-window
:structure-notify
)))
(gcontext (xlib:create-gcontext :drawable window
:background black
:foreground white
:font text-font))
)
(setf (host-window self) window)
(setf (gcontext self) gcontext)
(setf (current-position self) (list 0 0))
;; The following is an undocumented feature of CLX
(unless (xlib:display-after-function (xlib:window-display window))
(setf (xlib:display-after-function (xlib:window-display window))
#'xlib:display-finish-output))
;; #'xlib:display-force-output))
(xlib:set-wm-properties window
:name title
:icon-name title
:resource-name "Canvas"
:resource-class 'canvas
:x left :y top :width width :height height
:min-width 10 :min-height 10
:input :off :initial-state :normal)
(setf (xlib:window-plist (host-window self))
(acons :wb-class-instance self NIL))
(setf *current-canvas* self)
(call-next-method))))
#|
(defmethod initialize-instance :after
((self host-window)
&key
(host NIL)
(font *normal-graphics-font*)
(left 0)
(top 0)
(width 0)
(height 0)
(title "Canvas"))
;;(xlib:map-window (host-window self))
)
|#
| 5,393 | Common Lisp | .cl | 132 | 27.083333 | 87 | 0.449284 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 501b8ddbd627fc838a45daee43fb9fdd8611973bd1986b7450fc629649c6adbb | 32,854 | [
-1
] |
32,855 | host-menu-canvas-clx2.lsp | rwoldford_Quail/source/window-basics/host/host-menu-canvas-clx2.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; host-menu-canvas-clx.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; R.W. Oldford 1989-1991
;;;
;;;
;;;
;;;-------------------------------------------------------------------
;;;
(in-package :wb)
(defclass host-menu-canvas ()
((menu-bar :initarg :menu-bar
:initform NIL
:accessor menu-bar-of)))
(defun install-menu-bar (canvas)
(let ((left (canvas-get-title-menu canvas :key :left))
(middle (canvas-get-title-menu canvas :key :middle))
(right (canvas-get-title-menu canvas :key :right))
(ctrl-left (canvas-get-title-menu canvas :key :ctrl-left))
(ctrl-middle (canvas-get-title-menu canvas :key :ctrl-middle))
(ctrl-right (canvas-get-title-menu canvas :key :ctrl-right))
(display (xlib::drawable-display (host-window canvas)))
menus menu-bar)
(when ctrl-right
(push ctrl-right menus))
(when ctrl-middle
(push ctrl-middle menus))
(when ctrl-left
(push ctrl-left menus))
(when right
(push right menus))
(when middle
(push middle menus))
(when left
(push left menus))
(when menus
(setf menu-bar (make-instance 'wb-menu
:display display
:title "Canvas Menus"
:type :pop-up
:font *default-menu-font*
;;:canvas canvas
))
(set-menu-fns menu-bar :selected (when-selected-fn-of (first menus))
:held (when-held-fn-of (first menus))
:unheld (when-unheld-fn-of (first menus))
:sub-item (sub-item-fn-of (first menus)))
(dolist (menu menus)
(setf (parent-menu-of menu) menu-bar)
(xlib::reparent-window (item-window-of menu) (window-of menu-bar) 0 0)
(setf (items-alist-of menu-bar) (nconc (items-alist-of menu-bar) (items-alist-of menu))))
(push (list (item-window-of menu-bar) menu-bar) (items-alist-of menu-bar))
(setf (items-of menu-bar) menus)
(menu-compute-geometry menu-bar)
(xlib::unmap-window (item-window-of menu-bar))
(setf (menu-bar-of canvas) menu-bar)
;;(menu menu-bar (make-position (+ (xlib::drawable-x (xwindow-of canvas))
;; (xlib::drawable-width (xwindow-of canvas)))
;; (xlib::drawable-y (xwindow-of canvas))))
(setf (xlib:window-plist (xwindow-of canvas))
(acons :wb-class-instance canvas NIL))
menu-bar)))
| 2,927 | Common Lisp | .cl | 75 | 33.28 | 98 | 0.558679 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | ee4c1ed60e70bfceab7a9daacae3678b2e9db2c5736dcf94c0c6b68998804ba4 | 32,855 | [
-1
] |
32,856 | host-draw-mcl.lsp | rwoldford_Quail/source/window-basics/host/host-draw-mcl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; host-draw-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; Copyright (c) 1991 Statistical Computing Laboratory, University of Waterloo
;;;
;;;
;;; Authors:
;;; R.W. Oldford 1991.
;;; Modified by C. Hurley 9/21/92 for consistency with MCL2.0
;;; (from change history on Quickdraw.lisp:
;;
;; Earlier Mod history
;;
;; 10/16/91 bill PSZ's simplification of with-rectangle-arg
;; ------------- 2.0b3
;; 08/26/91 bill downward-function -> dynamic-extent
;; 08/17/91 bill (pset x :record.slot v) -> (setf (pref x :record.slot) v)
;; No more (require-interface :quickdraw), autoloading is faster.
;; 07/09/91 bill rref & rset -> pref/href & pset/hset
;; ------------- 2.0b2
;; 02/20/91 bill with-pointers in copy-bits, *32-bit-qd-pen-modes* in mode-arg
;;--------------- 2.0b1
;;
;;;
;;;--------------------------------------------------------------------------------
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Host-Draw.lisp
;;
;; version 2.0
;;
;; copyright 1987-89 Apple Computer, Inc
;;
;; This file implements a full error-checked interface to Quickdraw.
;; It is meant to be useful both in programs and as an example of how to use
;; the low-level interface to the Mac.
;;
;; You can compile selected portions of this file, but if you do, make sure to
;; include the macros and utility functions from the top.
;;
;; These functions require a canvas-focus on every drawing command.
;; For faster drawing you should only focus the canvas
;; once, and then issue a series of drawing commands. You can use
;; this file as an example of how to call the Quickdraw traps directly
;; in such a situation.
;;
(in-package :host-draw)
;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Shadowed symbols in defpackage
;;;
;;;(shadow '(make-point))
(defun h-draw:make-point (x &optional y)
"Returns a point having x and y as its coordinates."
(if y
(ccl::make-point x y)
(ccl::make-point x)))
;;; (export '(make-point))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(point-x point-y
*hardcopy-ptr* pen-show pen-hide
pen-shown-p pen-position pen-size set-pen-size pen-mode
set-pen-mode pen-pattern set-pen-pattern set-pen-color pen-state
set-pen-state move-to move line-to line draw-line
draw-rectangle draw-inside-rectangle draw-filled-rectangle
erase-rect invert-rectangle draw-ellipse draw-filled-ellipse draw-arc
fill-arc erase-arc invert-arc new-region set-rect-region
start-polygon get-polygon kill-polygon frame-polygon paint-polygon
draw-polygon draw-filled-polygon make-bitmap copy-bits draw-string
draw-char)
))
(eval-when (eval compile)
(require :deftrap))
(defun point-x (point)
"Returns the x coordinate of point."
(ccl::point-h point))
(defun point-y (point)
"Returns the x coordinate of point."
(ccl::point-v point))
(defvar *hardcopy-ptr*
NIL
"A system dependent pointer to an open printer device.")
(defmacro with-rectangle-arg ((var left &optional top right bottom) &body body)
"Takes a rectangle, two points, or four coordinates and makes a rectangle. ~
Body is evaluated with VAR bound to that rectangle."
(let ((left-var (make-symbol "LEFT"))
(top-var (make-symbol "TOP"))
(right-var (make-symbol "RIGHT"))
(bottom-var (make-symbol "BOTTOM")))
`(let ((,left-var ,left)
(,top-var ,top)
(,right-var ,right)
(,bottom-var ,bottom))
(call-with-rectangle-arg
#'(lambda (,var)
(declare (dynamic-extent))
,@body)
,left-var ,top-var ,right-var ,bottom-var))))
(defun call-with-rectangle-arg (thunk left top right bottom)
(rlet ((var :rect))
(cond (bottom
(setf (pref var rect.topleft) (ccl::make-point left top))
(setf (pref var rect.bottomright) (ccl::make-point right bottom)))
(right
(quail-error "Illegal rectangle arguments: ~s ~s ~s ~s"
left top right bottom))
(top
(setf (pref var rect.topleft) (ccl::make-point left nil))
(setf (pref var rect.bottomright) (ccl::make-point top nil)))
(t (%setf-macptr var left)))
(funcall thunk var)))
(defvar *32-bit-qd-pen-modes*
'((:blend . 32)
(:addPin . 33)
(:addOver . 34)
(:subPin . 35)
(:transparent . 36)
(:adMax . 37)
(:subOver . 38)
(:adMin . 39)
(:hilite . 50)))
(defun mode-arg (thing)
(or
(and (fixnump thing) (<= 0 thing 64) thing)
(position thing *pen-modes*)
(cdr (assq thing *32-bit-qd-pen-modes*))
(quail-error "Unknown pen mode: ~a" thing)))
(defun pen-show (canvas)
(setf (pref (or *hardcopy-ptr* (wptr canvas))
grafport.pnvis) 0)
nil)
(defun pen-hide (canvas)
(setf (pref (or *hardcopy-ptr* (wptr canvas)) grafport.pnvis) -1)
nil)
(defun pen-shown-p (canvas)
(> (pref (or *hardcopy-ptr* (wptr canvas)) grafport.pnvis) -1))
(defun pen-position (canvas)
(pref (or *hardcopy-ptr* (wptr canvas)) windowRecord.pnloc))
(defun pen-size (canvas)
(pref (or *hardcopy-ptr* (wptr canvas)) windowRecord.pnsize))
(defun set-pen-size (canvas h &optional v &aux (pt (ccl::make-point h v)))
(with-port (or *hardcopy-ptr* (wptr canvas))
(#_PenSize :long pt))
pt)
(defun pen-mode (canvas)
(elt *pen-modes* (pref (or *hardcopy-ptr* (wptr canvas)) windowRecord.pnmode)))
(defun set-pen-mode (canvas new-mode)
(with-port (or *hardcopy-ptr* (wptr canvas))
(#_PenMode (mode-arg new-mode))))
(defun pen-pattern (canvas &optional
(save-pat (make-record (:pattern :storage :pointer))))
(copy-record
(pref (or *hardcopy-ptr* (wptr canvas))
windowRecord.pnPat) (:pattern :storage :pointer) save-pat))
(defun set-pen-pattern (canvas new-pattern)
(with-port (or *hardcopy-ptr* (wptr canvas))
(#_PenPat new-pattern))
new-pattern)
(defun set-pen-color (canvas new-color)
(ccl::set-fore-color canvas new-color)
new-color)
; ----------------------------
(defun pen-state (canvas &optional (save-state (make-record :penstate)))
(declare (ignore canvas))
(#_GetPenState save-state)
save-state)
(defun set-pen-state (canvas new-state)
(declare (ignore canvas))
(#_SetPenState new-state)
new-state)
(defun move-to (canvas h &optional v)
(declare (ignore canvas))
(#_MoveTo :long (setq h (ccl::make-point h v)))
h)
(defun move (canvas h &optional v)
(declare (ignore canvas))
(#_Move :long (setq h (ccl::make-point h v)))
h)
(defun line-to (canvas h &optional v)
(declare (ignore canvas))
(#_LineTo :long (setq h (ccl::make-point h v)))
h)
(defun line (canvas h &optional v)
(declare (ignore canvas))
(#_Line :long (setq h (ccl::make-point h v)))
h)
(defun draw-line (canvas x1 y1 x2 y2)
(move-to canvas x1 y1)
(line-to canvas x2 y2))
;;; Revised code to conform with other drawing things
(defun draw-rectangle (canvas x1 y1 x2 y2)
(move-to canvas x1 y1)
(line-to canvas x1 y2)
(line-to canvas x2 y2)
(line-to canvas x2 y1)
(line-to canvas x1 y1))
;;; Original code
#|
(defun draw-rectangle (canvas x1 x2 y1 y2)
(move-to canvas x1 y1)
(line-to canvas x1 y2)
(line-to canvas x2 y2)
(line-to canvas x2 y1)
(line-to canvas x1 y1))
|#
(defun draw-inside-rectangle (canvas left &optional top right bot)
(declare (ignore canvas))
(with-rectangle-arg (r left top right bot) (#_FrameRect r )))
(defun draw-filled-rectangle (canvas left &optional top right bot)
(declare (ignore canvas))
(with-rectangle-arg (r left top right bot) (#_PaintRect r)))
(defun erase-rect (canvas left &optional top right bot)
(declare (ignore canvas))
(with-rectangle-arg (r left top right bot) (#_EraseRect r)))
(defun invert-rectangle (canvas left &optional top right bot)
(declare (ignore canvas))
(with-rectangle-arg (r left top right bot) (#_InvertRect r)))
(defun draw-ellipse (canvas left &optional top right bot)
(declare (ignore canvas))
(with-rectangle-arg (r left top right bot) (#_FrameOval r)))
(defun draw-filled-ellipse (canvas left &optional top right bot)
(declare (ignore canvas))
(with-rectangle-arg (r left top right bot) (#_PaintOval r)))
;;;
;;; Arcs
;;;
;;;
;;; The following exists because of Macintosh's peculiar
;;; orientation of angles
;;; ... rwo
(defun standard-to-mac-angle (theta-in-degrees)
"Transforms the argument from the standard position (0 = positive x-axis; ~
90 = positive y-axis) to Macintosh angle position (0 = positive y-axis; ~
90 = positive x-axis)."
(let (new-angle)
(if (< theta-in-degrees 180)
(setf new-angle (- 90 theta-in-degrees))
(setf new-angle (- 450 theta-in-degrees)))
(when (< new-angle 0)
(setf new-angle (+ 360 new-angle)))
new-angle))
;;;
;;; The following exists because we prefer to work with radii
;;; ... rwo
(defun radii-to-rect (x-centre y-centre x-radius y-radius)
"From the ellipse defined by x-centre y-centre x-radius y-radius ~
computes and returns ~
multiple-values left top right bottom giving the coordinate ~
information on the enclosing rectangle of the ellipse."
(let (left top right bottom)
(setf left (- x-centre x-radius))
(setf top (- y-centre y-radius)) ;inverted y coord system
(setf right (+ x-centre x-radius))
(setf bottom (+ y-centre y-radius)) ;inverted y coord system
(values left top right bottom)))
(defun draw-arc (canvas start-angle arc-angle
x-centre y-centre x-radius y-radius)
(declare (ignore canvas))
(multiple-value-bind
(left top right bottom)
(radii-to-rect x-centre y-centre x-radius y-radius)
(with-rectangle-arg (r left top right bottom)
(#_FrameArc r (standard-to-mac-angle start-angle) (- arc-angle)))))
(defun fill-arc (canvas start-angle arc-angle
x-centre y-centre x-radius y-radius)
(declare (ignore canvas))
(multiple-value-bind
(left top right bottom)
(radii-to-rect x-centre y-centre x-radius y-radius)
(with-rectangle-arg (r left top right bottom)
(#_PaintArc r (standard-to-mac-angle start-angle) (- arc-angle)))))
(defun erase-arc (canvas start-angle arc-angle
x-centre y-centre x-radius y-radius)
(declare (ignore canvas))
(multiple-value-bind
(left top right bottom)
(radii-to-rect x-centre y-centre x-radius y-radius)
(with-rectangle-arg (r left top right bottom)
(#_EraseArc r (standard-to-mac-angle start-angle) (- arc-angle)))))
(defun invert-arc (canvas start-angle arc-angle
x-centre y-centre x-radius y-radius)
(declare (ignore canvas))
(multiple-value-bind
(left top right bottom)
(radii-to-rect x-centre y-centre x-radius y-radius)
(with-rectangle-arg (r left top right bottom)
(#_InvertArc r (standard-to-mac-angle start-angle) (- arc-angle)))))
;;;Regions
(defun new-region ()
(#_NewRgn))
(defun set-rect-region (region left &optional top right bot)
(with-rectangle-arg (r left top right bot)
(#_RectRgn region r))
region)
(defun start-polygon (canvas)
(let ((wptr (or *hardcopy-ptr* (wptr canvas))))
(unless (%null-ptr-p (pref wptr windowRecord.polysave))
(quail-error "A new polygon may not be started for window: ~a.
since one is already started" canvas))
(with-port wptr (setf (view-get canvas 'my-poly) (#_OpenPoly))))
nil)
(defun get-polygon (canvas)
(let ((my-poly (view-get canvas 'my-poly))
(wptr (or *hardcopy-ptr* (wptr canvas))))
(if (and my-poly (not (%null-ptr-p (pref wptr windowRecord.polysave))))
(prog1
my-poly
(with-port wptr (#_ClosePoly))
(setq my-poly nil))
(quail-error "Polygon for window: ~a has not been started" canvas))))
(defun kill-polygon (polygon)
(#_KillPoly polygon))
(defun frame-polygon (canvas polygon)
(declare (ignore canvas))
(#_FramePoly polygon))
(defun paint-polygon (canvas polygon)
(declare (ignore canvas))
(#_PaintPoly polygon))
(defun draw-polygon (canvas list-of-points)
(move-to canvas (car (first list-of-points))
(cdr (first list-of-points)))
(start-polygon canvas)
(dolist (point (cdr list-of-points))
(line-to canvas (car point) (cdr point)))
(line-to canvas (car (first list-of-points))
(cdr (first list-of-points)))
(let ((poly (get-polygon canvas)))
(frame-polygon canvas poly)
(kill-polygon poly)))
(defun draw-filled-polygon (canvas list-of-points)
(move-to canvas (car (first list-of-points))
(cdr (first list-of-points)))
(start-polygon canvas)
(dolist (point (cdr list-of-points))
(line-to canvas (car point) (cdr point)))
(line-to canvas (car (first list-of-points))
(cdr (first list-of-points)))
(let ((poly (get-polygon canvas)))
(paint-polygon canvas poly)
(kill-polygon poly)))
(defun make-bitmap (left &optional top right bottom &aux rowbytes bm)
(with-rectangle-arg (r left top right bottom)
(setq rowbytes
(logand
#xfffe
(+ 2 (ash (- (pref r rect.right) (pref r rect.left) 1) -3))))
(setq bm
(#_NewPtr :check-error
(+ 14 (* rowbytes (- (pref r rect.bottom) (pref r rect.top))))))
(setf (pref bm bitmap.bounds) r)
(setf (pref bm bitmap.rowbytes) rowbytes)
(setf (pref bm bitmap.baseaddr) (%inc-ptr bm 14)))
bm)
(defun copy-bits (source-bitmap dest-bitmap source-rect dest-rect
&optional (mode 0) mask-region)
(with-macptrs ((mask-region (if mask-region mask-region (%null-ptr))))
(#_CopyBits source-bitmap
dest-bitmap
source-rect
dest-rect
(mode-arg mode)
(or mask-region (%null-ptr)))))
(defun draw-string (canvas string)
"Draws a string on the canvas at the current position with ~
current font and colour."
(let (font-face mode-size)
(multiple-value-setq (font-face mode-size)
(view-font-codes canvas))
(with-font-codes font-face mode-size
(with-pstrs ((pstring string))
(#_DrawString pstring)))
))
(defun draw-char (canvas char)
(draw-string canvas (string char)))
(provide 'host-draw)
(pushnew :host-draw *features*)
| 15,051 | Common Lisp | .cl | 380 | 33.857895 | 84 | 0.62183 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | d82c7b8f225c7a3f7c8db6fd467cc209d492572c8cd8ac0a5eb7a1f9a6c920d8 | 32,856 | [
-1
] |
32,857 | scrolling-window-mcl.lsp | rwoldford_Quail/source/window-basics/host/scrolling-window-mcl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; scrolling-windows-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; R.W. Oldford 1989-1992
;;;
;;;
;;;
;;;----------------------------------------------------------------------------------
;;; A new class of windows which contain scroll-bars and a scrollable
;;; area.
;;;
;;; ----------------------------------------------------------------------------------
;;;
;;; Adapted from the scrolling-windows.lisp 1989 examples file distributed by apple
;;;
;;;(require :scrollers) ;; got it in wb-system-mcl.lisp
;;;
;;; Default changed to t for track-thumb-p
;;; my-scroller changed to the-scroller
;;; set-view-size changed to redisplay the entire window ... rwo 92
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '()))
(defclass scrolling-window (window)
((the-scroller :accessor the-scroller)))
(defmethod initialize-instance ((self scrolling-window) &key
(scroller-class 'ccl::scroller)
(scroll-bar-class 'scroll-bar-dialog-item)
h-scroll-class v-scroll-class
(track-thumb-p t)
field-size)
(call-next-method)
(setf (the-scroller self)
(make-instance
scroller-class
:view-container self
:view-size (subtract-points (view-size self) #@(15 15))
:view-position #@(0 0)
:draw-scroller-outline nil
:scroll-bar-class scroll-bar-class
:h-scroll-class h-scroll-class
:v-scroll-class v-scroll-class
:track-thumb-p track-thumb-p
:field-size field-size)))
(defmethod set-view-size ((self scrolling-window) h &optional v)
(declare (ignore h v))
(without-interrupts
(call-next-method)
(let* ((new-size (subtract-points (view-size self) #@(15 15))))
(set-view-size (the-scroller self) new-size))
(redisplay self)
))
(defmethod window-zoom-event-handler ((self scrolling-window) message)
(declare (ignore message))
(without-interrupts
(call-next-method)
(let* ((new-size (subtract-points (view-size self) #@(15 15))))
(set-view-size (the-scroller self) new-size))
))
#|
;;(require 'quickdraw)
(defclass scrolling-window-scroller (scroller) ())
(defmethod view-draw-contents ((self scrolling-window-scroller))
(call-next-method)
(h-draw::paint-oval self 75 75 200 200)
(h-draw::frame-rect self 20 20 100 100)
(h-draw::erase-oval self 50 50 135 135))
(setq foo (make-instance 'scrolling-window
:scroller-class 'scrolling-window-scroller
:window-type :document-with-zoom
:track-thumb-p t))
|#
| 3,385 | Common Lisp | .cl | 84 | 33.214286 | 87 | 0.53771 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 146b8d49c19ad85acb8578182c9b3e4a8275db5552d3b14f2007689943d6270b | 32,857 | [
-1
] |
32,858 | host-draw-clx2.lsp | rwoldford_Quail/source/window-basics/host/host-draw-clx2.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; host-draw-clx.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; Copyright (c) 1991 Statistical Computing Laboratory, University of Waterloo
;;;
;;;
;;; Authors:
;;; R.W. Oldford 1991.
;;; Modified by C. Hurley 9/21/92 for consistency with MCL2.0
;;; (from change history on Quickdraw.lisp:
;;
;; Earlier Mod history
;;
;; 10/16/91 bill PSZ's simplification of with-rectangle-arg
;; ------------- 2.0b3
;; 08/26/91 bill downward-function -> dynamic-extent
;; 08/17/91 bill (pset x :record.slot v) -> (setf (pref x :record.slot) v)
;; No more (require-interface :quickdraw), autoloading is faster.
;; 07/09/91 bill rref & rset -> pref/href & pset/hset
;; ------------- 2.0b2
;; 02/20/91 bill with-pointers in copy-bits, *32-bit-qd-pen-modes* in mode-arg
;;--------------- 2.0b1
;;
;;;
;;;--------------------------------------------------------------------------------
(in-package :host-draw)
(defun make-point (x &optional y)
"Returns a point having x and y as its coordinates."
(if y
(list x y)
x))
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(make-point)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(point-x point-y *hardcopy-ptr* pen-show pen-hide pen-shown-p
pen-position pen-size set-pen-size pen-mode set-pen-mode pen-pattern
set-pen-pattern set-pen-color move-to move line-to line draw-line
draw-rectangle draw-inside-rectangle draw-filled-rectangle
erase-rect invert-rectangle draw-ellipse draw-filled-ellipse draw-arc
fill-arc erase-arc invert-arc fill-arc draw-polygon
draw-filled-polygon make-bitmap copy-bits origin set-origin
draw-string draw-char)
))
(defun point-x (point)
"Returns the x coordinate of point."
(first point))
(defun point-y (point)
"Returns the x coordinate of point."
(second point))
(defvar *hardcopy-ptr*
NIL
"A system dependent pointer to an open printer device.")
#|
(defmacro with-rectangle-arg ((var left &optional top right bottom) &body body)
"Takes a rectangle, two points, or four coordinates and makes a rectangle. ~
Body is evaluated with VAR bound to that rectangle."
(let ((left-var (make-symbol "LEFT"))
(top-var (make-symbol "TOP"))
(right-var (make-symbol "RIGHT"))
(bottom-var (make-symbol "BOTTOM")))
`(let ((,left-var ,left)
(,top-var ,top)
(,right-var ,right)
(,bottom-var ,bottom))
(call-with-rectangle-arg
#'(lambda (,var)
(declare (dynamic-extent))
,@body)
,left-var ,top-var ,right-var ,bottom-var))))
(defun call-with-rectangle-arg (thunk left top right bottom)
(rlet ((var :rect))
(cond (bottom
(setf (pref var rect.topleft) (ccl::make-point left top))
(setf (pref var rect.bottomright) (ccl::make-point right bottom)))
(right
(quail-error "Illegal rectangle arguments: ~s ~s ~s ~s"
left top right bottom))
(top
(setf (pref var rect.topleft) (ccl::make-point left nil))
(setf (pref var rect.bottomright) (ccl::make-point top nil)))
(t (%setf-macptr var left)))
(funcall thunk var)))
;;BOOLEAN EXPRESSIONS FOR THIS??
(defvar *32-bit-qd-pen-modes*
'((:blend . 32)
(:addPin . 33)
(:addOver . 34)
(:subPin . 35)
(:transparent . 36)
(:adMax . 37)
(:subOver . 38)
(:adMin . 39)
(:hilite . 50)))
(defun mode-arg (thing)
(or
(and (fixnump thing) (<= 0 thing 64) thing)
(position thing *pen-modes*)
(cdr (assq thing *32-bit-qd-pen-modes*))
(quail-error "Unknown pen mode: ~a" thing)))
|#
(defun pen-show (canvas)
nil)
(defun pen-hide (canvas)
nil)
(defun pen-shown-p (canvas)
nil)
(defun pen-position (canvas)
(wb::current-position canvas))
(defun pen-size (canvas)
(xlib:gcontext-line-width (wb::gcontext canvas)))
(defun set-pen-size (canvas h &optional v)
(unless h (setq h 1))
(if v
(xlib::set-gcontext-line-width (wb::gcontext canvas) h)
(xlib::set-gcontext-line-width (wb::gcontext canvas) (car h))))
(defun pen-mode (canvas)
(elt *pen-modes* (xlib:gcontext-function (wb::gcontext canvas))))
(defun set-pen-mode (canvas new-mode)
(xlib::set-gcontext-function (wb::gcontext canvas) new-mode))
#|
(defun pen-pattern (canvas &optional
(save-pat (make-record (:pattern :storage :pointer))))
(copy-record
(pref (or *hardcopy-ptr* (wptr canvas))
windowRecord.pnPat) (:pattern :storage :pointer) save-pat))
|#
(defun set-pen-pattern (canvas new-pattern)
(set-pen-color canvas new-pattern))
(defun set-pen-color (canvas new-color)
(let* ((gcontext (wb::gcontext canvas))
(display (xlib::gcontext-display gcontext))
(screen (xlib::display-default-screen display))
(colormap (xlib::screen-default-colormap screen))
(my-new-color (xlib::alloc-color colormap (if new-color new-color
(wb::canvas-default-draw-color canvas)))))
(xlib::set-gcontext-foreground gcontext my-new-color))
new-color)
; ----------------------------
(defun move-to (canvas h &optional v)
(if v
(setf (wb::current-position canvas) (list h v))
(setf (wb::current-position canvas) h)))
(defun move (canvas h &optional v)
(if v
(setq h (+ h (point-x (wb::current-position canvas)))
v (+ v (point-y (wb::current-position canvas)))))
(setq v (+ (second h) (point-y (wb::current-position canvas)))
h (+ (first h) (point-x (wb::current-position canvas))))
(move-to canvas x y))
(defun line-to (canvas h &optional v)
(let ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas))
(x1 (point-x (wb::current-position canvas)))
(y1 (point-y (wb::current-position canvas))))
(unless v
(setq v (second h) h (first h)))
(xlib:draw-line window gcontext x1 y1 h v))
(move-to canvas h v))
(defun line (canvas h &optional v)
(let ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas))
(x1 (point-x (wb::current-position canvas)))
(y1 (point-y (wb::current-position canvas))))
(unless v
(setq v (second h) h (first h)))
(xlib:draw-line window gcontext x1 y1 h v t))
(move-to canvas h v))
(defun draw-line (canvas x1 y1 x2 y2)
(let ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas)))
(xlib:draw-line window gcontext x1 y1 x2 y2))
(move-to canvas x2 y2))
(defun draw-rectangle (canvas x1 x2 y1 y2)
(let ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas))
(width (- x2 x1))
(height (- y2 y1)))
(xlib:draw-rectangle window gcontext x1 y1 width height))
(move-to canvas x1 y1))
(defun draw-inside-rectangle (canvas left &optional top right bot)
(let* ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas))
(x1 (+ left 1))
(y1 (+ top 1))
(width (- right x1 1))
(height (- bot y1 1)))
(xlib:draw-rectangle window gcontext x1 y1 width height)
(move-to canvas x1 y1)))
(defun draw-filled-rectangle (canvas left &optional top right bot)
(let ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas))
(width (- right left))
(height (- bot top)))
(xlib:draw-rectangle window gcontext left top width height t))
(move-to canvas left top))
(defun erase-rect (canvas left &optional top right bot)
(let* ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas))
(width (- right left))
(height (- bot top))
(fore (xlib:gcontext-foreground gcontext))
(back (xlib:gcontext-background gcontext))
(old-fcn (xlib:gcontext-function gcontext)))
(xlib::set-gcontext-foreground gcontext back)
(xlib::set-gcontext-function gcontext boole-1)
(xlib:draw-rectangle window gcontext left top width height t)
(xlib::set-gcontext-foreground gcontext fore)
(xlib::set-gcontext-function gcontext old-fcn))
(move-to canvas left top))
(defun invert-rectangle (canvas left &optional top right bot)
(let* ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas))
(width (- right left))
(height (- bot top))
(old-fcn (xlib:gcontext-function gcontext)))
(xlib::set-gcontext-function gcontext boole-c2)
(xlib:draw-rectangle window gcontext left top width height t)
(xlib::set-gcontext-function gcontext old-fcn))
(move-to canvas left top))
(defun draw-ellipse (canvas left &optional top right bot)
(let ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas))
(width (- right left))
(height (- bot top)))
(xlib:draw-arc window gcontext left top width height 0 7 nil))
(move-to canvas left top))
(defun draw-filled-ellipse (canvas left &optional top right bot)
(let ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas))
(width (- right left))
(height (- bot top)))
(xlib:draw-arc window gcontext left top width height 0 7 t))
(move-to canvas left top))
;;;
;;; Arcs
;;;
;;;
;;; The following exists because we prefer to work with radii
;;; ... rwo
(defun radii-to-rect (x-centre y-centre x-radius y-radius)
"From the ellipse defined by x-centre y-centre x-radius y-radius ~
computes and returns ~
multiple-values left top width height giving the coordinate ~
information on the enclosing rectangle of the ellipse."
(let (left top width height)
(setf left (- x-centre x-radius))
(setf top (- y-centre y-radius)) ;inverted y coord system
(setf width (* 2 x-radius))
(setf height (* 2 y-radius))
(values left top width height)))
(defun draw-arc (canvas start-angle arc-angle
x-centre y-centre x-radius y-radius)
(let ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas)))
(multiple-value-bind
(left top width height)
(radii-to-rect x-centre y-centre x-radius y-radius)
(xlib:draw-arc window gcontext
left top width height start-angle arc-angle)
(move-to canvas left top))))
(defun fill-arc (canvas start-angle arc-angle
x-centre y-centre x-radius y-radius)
(let ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas)))
(multiple-value-bind
(left top width height)
(radii-to-rect x-centre y-centre x-radius y-radius)
(xlib:draw-arc window gcontext
left top width height start-angle arc-angle t)
(move-to canvas left top))))
(defun erase-arc (canvas start-angle arc-angle
x-centre y-centre x-radius y-radius)
(let* ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas))
(fore (xlib:gcontext-foreground gcontext))
(back (xlib:gcontext-background gcontext))
(old-fcn (xlib:gcontext-function gcontext)))
(multiple-value-bind
(left top width height)
(radii-to-rect x-centre y-centre x-radius y-radius)
(xlib::set-gcontext-foreground gcontext back)
(xlib::set-gcontext-function gcontext boole-1)
(xlib:draw-arc window gcontext
left top width height start-angle arc-angle t)
(xlib::set-gcontext-foreground gcontext fore)
(xlib::set-gcontext-function gcontext old-fcn)
(move-to canvas left top))))
(defun invert-arc (canvas start-angle arc-angle
x-centre y-centre x-radius y-radius)
(let* ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas))
(old-fcn (xlib:gcontext-function gcontext)))
(multiple-value-bind
(left top width height)
(radii-to-rect x-centre y-centre x-radius y-radius)
(xlib::set-gcontext-function gcontext boole-c2)
(xlib:draw-arc window gcontext left top width height start-angle arc-angle t)
(xlib::set-gcontext-function gcontext old-fcn)
(move-to canvas left top))))
(defun draw-polygon (canvas list-of-points)
(let ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas)))
(xlib:draw-lines window gcontext list-of-points))
(move-to c (first list-of-points)))
(defun draw-filled-polygon (canvas list-of-points)
(let ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas)))
(xlib:draw-lines window gcontext list-of-points :fill-p t :shape :convex))
(move-to c (first list-of-points)))
(defun make-bitmap (left &optional top right bottom &aux rowbytes bm)
)
(defun copy-bits (source-bitmap dest-bitmap source-rect dest-rect
&optional (mode 0) mask-region)
)
(defun draw-string (canvas string)
"Draws a string on the canvas at the current position with ~
current font and colour."
(let* ((position (wb::current-position canvas))
(x (point-x position))
(y (wb::canvas-to-host-y canvas (point-y position)))
(hw (wb::host-window canvas))
(gc (wb::gcontext canvas)))
(xlib:draw-image-glyphs hw gc x y string))
)
(defun draw-char (canvas char)
(draw-string canvas (string char)))
(provide 'host-draw)
(pushnew :host-draw *features*)
| 13,453 | Common Lisp | .cl | 331 | 35.208459 | 127 | 0.636664 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 375356c5bc769eb7c42af6408c2a62b415fa78913227f1d2a2c6017e83b40953 | 32,858 | [
-1
] |
32,859 | host-draw-clx.lsp | rwoldford_Quail/source/window-basics/host/host-draw-clx.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; host-draw-clx.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; Copyright (c) 1993 Statistical Computing Laboratory, University of Waterloo
;;;
;;;
;;; Authors:
;;; N.G. Bennett 1993
;;; R.W. Oldford 1994
;;;
;;;--------------------------------------------------------------------------------
(in-package :host-draw)
(defun make-point (x &optional y)
"Returns a point having x and y as its coordinates."
(if y
(list x y)
x))
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(make-point)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(point-x point-y *hardcopy-ptr* pen-show pen-hide pen-shown-p
pen-position pen-size set-pen-size pen-mode set-pen-mode pen-pattern
set-pen-pattern set-pen-color move-to move line-to line draw-line
draw-rectangle draw-inside-rectangle draw-filled-rectangle
erase-rect invert-rectangle draw-ellipse draw-filled-ellipse draw-arc
fill-arc erase-arc invert-arc fill-arc draw-polygon
draw-filled-polygon make-bitmap copy-bits origin set-origin
draw-string draw-char)
))
(defun point-x (point)
"Returns the x coordinate of point."
(first point))
(defun point-y (point)
"Returns the x coordinate of point."
(second point))
(defvar *hardcopy-ptr*
NIL
"A system dependent pointer to an open printer device.")
#|
(defmacro with-rectangle-arg ((var left &optional top right bottom) &body body)
"Takes a rectangle, two points, or four coordinates and makes a rectangle. ~
Body is evaluated with VAR bound to that rectangle."
(let ((left-var (make-symbol "LEFT"))
(top-var (make-symbol "TOP"))
(right-var (make-symbol "RIGHT"))
(bottom-var (make-symbol "BOTTOM")))
`(let ((,left-var ,left)
(,top-var ,top)
(,right-var ,right)
(,bottom-var ,bottom))
(call-with-rectangle-arg
#'(lambda (,var)
(declare (dynamic-extent))
,@body)
,left-var ,top-var ,right-var ,bottom-var))))
(defun call-with-rectangle-arg (thunk left top right bottom)
(rlet ((var :rect))
(cond (bottom
(setf (pref var rect.topleft) (ccl::make-point left top))
(setf (pref var rect.bottomright) (ccl::make-point right bottom)))
(right
(quail-error "Illegal rectangle arguments: ~s ~s ~s ~s"
left top right bottom))
(top
(setf (pref var rect.topleft) (ccl::make-point left nil))
(setf (pref var rect.bottomright) (ccl::make-point top nil)))
(t (%setf-macptr var left)))
(funcall thunk var)))
;;BOOLEAN EXPRESSIONS FOR THIS??
(defvar *32-bit-qd-pen-modes*
'((:blend . 32)
(:addPin . 33)
(:addOver . 34)
(:subPin . 35)
(:transparent . 36)
(:adMax . 37)
(:subOver . 38)
(:adMin . 39)
(:hilite . 50)))
(defun mode-arg (thing)
(or
(and (fixnump thing) (<= 0 thing 64) thing)
(position thing *pen-modes*)
(cdr (assq thing *32-bit-qd-pen-modes*))
(quail-error "Unknown pen mode: ~a" thing)))
|#
(defun pen-show (canvas)
nil)
(defun pen-hide (canvas)
nil)
(defun pen-shown-p (canvas)
nil)
(defun pen-position (canvas)
(wb::current-position canvas))
(defun pen-size (canvas)
(xlib:gcontext-line-width (wb::gcontext canvas)))
(defun set-pen-size (canvas h &optional v)
(unless h (setq h 1))
(if v
(xlib::set-gcontext-line-width (wb::gcontext canvas) h)
(xlib::set-gcontext-line-width (wb::gcontext canvas) (car h))))
(defun pen-mode (canvas)
(elt *pen-modes* (xlib:gcontext-function (wb::gcontext canvas))))
(defun set-pen-mode (canvas new-mode)
(xlib::set-gcontext-function (wb::gcontext canvas) new-mode))
#|
(defun pen-pattern (canvas &optional
(save-pat (make-record (:pattern :storage :pointer))))
(copy-record
(pref (or *hardcopy-ptr* (wptr canvas))
windowRecord.pnPat) (:pattern :storage :pointer) save-pat))
|#
(defun set-pen-pattern (canvas new-pattern)
(set-pen-color canvas new-pattern))
(defun set-pen-color (canvas new-color)
(let* ((gcontext (wb::gcontext canvas))
(display (xlib::gcontext-display gcontext))
(screen (xlib::display-default-screen display))
(colormap (xlib::screen-default-colormap screen))
(my-new-color
(xlib::alloc-color colormap
(if new-color new-color
(wb::canvas-default-draw-color canvas)))))
(xlib::set-gcontext-foreground gcontext my-new-color))
new-color)
; ----------------------------
(defun move-to (canvas h &optional v)
(if v
(setf (wb::current-position canvas) (list h v))
(setf (wb::current-position canvas) h)))
(defun move (canvas h &optional v)
(if v
(setq h (+ h (point-x (wb::current-position canvas)))
v (+ v (point-y (wb::current-position canvas)))))
(setq v (+ (second h) (point-y (wb::current-position canvas)))
h (+ (first h) (point-x (wb::current-position canvas))))
(move-to canvas x y))
(defun line-to (canvas h &optional v)
(let ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas))
(x1 (point-x (wb::current-position canvas)))
(y1 (point-y (wb::current-position canvas))))
(unless v
(setq v (second h) h (first h)))
(xlib:draw-line window gcontext x1 y1 h v))
(move-to canvas h v))
(defun line (canvas h &optional v)
(let ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas))
(x1 (point-x (wb::current-position canvas)))
(y1 (point-y (wb::current-position canvas))))
(unless v
(setq v (second h) h (first h)))
(xlib:draw-line window gcontext x1 y1 h v t))
(move-to canvas h v))
(defun draw-line (canvas x1 y1 x2 y2)
(let ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas)))
(xlib:draw-line window gcontext x1 y1 x2 y2))
(move-to canvas x2 y2))
(defun draw-rectangle (canvas x1 x2 y1 y2)
(let ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas))
(width (- x2 x1))
(height (- y2 y1)))
(xlib:draw-rectangle window gcontext x1 y1 width height))
(move-to canvas x1 y1))
(defun draw-inside-rectangle (canvas left &optional top right bot)
(let* ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas))
(x1 (+ left 1))
(y1 (+ top 1))
(width (- right x1 1))
(height (- bot y1 1)))
(xlib:draw-rectangle window gcontext x1 y1 width height)
(move-to canvas x1 y1)))
(defun draw-filled-rectangle (canvas left &optional top right bot)
(let ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas))
(width (- right left))
(height (- bot top)))
(xlib:draw-rectangle window gcontext left top width height t))
(move-to canvas left top))
(defun erase-rect (canvas left &optional top right bot)
(let* ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas))
(width (- right left))
(height (- bot top))
(fore (xlib:gcontext-foreground gcontext))
(back (xlib:gcontext-background gcontext))
(old-fcn (xlib:gcontext-function gcontext)))
(xlib::set-gcontext-foreground gcontext back)
(xlib::set-gcontext-function gcontext boole-1)
(xlib:draw-rectangle window gcontext left top width height t)
(xlib::set-gcontext-foreground gcontext fore)
(xlib::set-gcontext-function gcontext old-fcn))
(move-to canvas left top))
(defun invert-rectangle (canvas left &optional top right bot)
(let* ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas))
(width (- right left))
(height (- bot top))
(old-fcn (xlib:gcontext-function gcontext)))
(xlib::set-gcontext-function gcontext boole-c2)
(xlib:draw-rectangle window gcontext left top width height t)
(xlib::set-gcontext-function gcontext old-fcn))
(move-to canvas left top))
(defun draw-ellipse (canvas left &optional top right bot)
(let ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas))
(width (- right left))
(height (- bot top)))
(xlib:draw-arc window gcontext left top width height 0 7 nil))
(move-to canvas left top))
(defun draw-filled-ellipse (canvas left &optional top right bot)
(let ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas))
(width (- right left))
(height (- bot top)))
(xlib:draw-arc window gcontext left top width height 0 7 t))
(move-to canvas left top))
;;;
;;; Arcs
;;;
;;;
;;; The following exists because we prefer to work with radii
;;; ... rwo
(defun radii-to-rect (x-centre y-centre x-radius y-radius)
"From the ellipse defined by x-centre y-centre x-radius y-radius ~
computes and returns ~
multiple-values left top width height giving the coordinate ~
information on the enclosing rectangle of the ellipse."
(let (left top width height)
(setf left (- x-centre x-radius))
(setf top (- y-centre y-radius)) ;inverted y coord system
(setf width (* 2 x-radius))
(setf height (* 2 y-radius))
(values left top width height)))
(defun draw-arc (canvas start-angle arc-angle
x-centre y-centre x-radius y-radius)
(let ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas)))
(multiple-value-bind
(left top width height)
(radii-to-rect x-centre y-centre x-radius y-radius)
(xlib:draw-arc window gcontext
left top width height start-angle arc-angle)
(move-to canvas left top))))
(defun fill-arc (canvas start-angle arc-angle
x-centre y-centre x-radius y-radius)
(let ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas)))
(multiple-value-bind
(left top width height)
(radii-to-rect x-centre y-centre x-radius y-radius)
(xlib:draw-arc window gcontext
left top width height start-angle arc-angle t)
(move-to canvas left top))))
(defun erase-arc (canvas start-angle arc-angle
x-centre y-centre x-radius y-radius)
(let* ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas))
(fore (xlib:gcontext-foreground gcontext))
(back (xlib:gcontext-background gcontext))
(old-fcn (xlib:gcontext-function gcontext)))
(multiple-value-bind
(left top width height)
(radii-to-rect x-centre y-centre x-radius y-radius)
(xlib::set-gcontext-foreground gcontext back)
(xlib::set-gcontext-function gcontext boole-1)
(xlib:draw-arc window gcontext
left top width height start-angle arc-angle t)
(xlib::set-gcontext-foreground gcontext fore)
(xlib::set-gcontext-function gcontext old-fcn)
(move-to canvas left top))))
(defun invert-arc (canvas start-angle arc-angle
x-centre y-centre x-radius y-radius)
(let* ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas))
(old-fcn (xlib:gcontext-function gcontext)))
(multiple-value-bind
(left top width height)
(radii-to-rect x-centre y-centre x-radius y-radius)
(xlib::set-gcontext-function gcontext boole-c2)
(xlib:draw-arc window gcontext left top width height start-angle arc-angle t)
(xlib::set-gcontext-function gcontext old-fcn)
(move-to canvas left top))))
(defun draw-polygon (canvas list-of-points)
(let ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas)))
(xlib:draw-lines window gcontext list-of-points))
(move-to c (first list-of-points)))
(defun draw-filled-polygon (canvas list-of-points)
(let ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas)))
(xlib:draw-lines window gcontext list-of-points :fill-p t :shape :convex))
(move-to c (first list-of-points)))
(defun make-bitmap (left &optional top right bottom &aux rowbytes bm)
)
(defun copy-bits (source-bitmap dest-bitmap source-rect dest-rect
&optional (mode 0) mask-region)
)
(defun draw-string (canvas string)
"Draws a string on the canvas at the current position with ~
current font and colour."
(let* ((position (wb::current-position canvas))
(x (point-x position))
(y (point-y position))
(hw (wb::host-window canvas))
(gc (wb::gcontext canvas)))
(xlib:draw-image-glyphs hw gc x y string)
(move-to canvas (+ x (xlib::text-extents
(xlib::gcontext-font
(wb::gcontext canvas))
string))
y)
)
)
(defun draw-char (canvas char)
(draw-string canvas (string char)))
(provide 'host-draw)
(pushnew :host-draw *features*)
| 13,088 | Common Lisp | .cl | 325 | 34.276923 | 127 | 0.6296 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | e9d3ad6381c28aeee4012d27d90f6debff933553f56136aa81a74c2d8501d59a | 32,859 | [
-1
] |
32,860 | host-fonts-clx.lsp | rwoldford_Quail/source/window-basics/host/host-fonts-clx.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; host-fonts-clx.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; Copyright (c) 1994 Statistical Computing Laboratory, University of Waterloo
;;;
;;;
;;; Authors:
;;; N.G. Bennett 1993.
;;; R.W. Oldford 1994.
;;;
;;;--------------------------------------------------------------------------------
(in-package :host-draw)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(font-transfer-modes font-styles font-transfer-modes font-names
cached-host-font clear-host-font-cache
get-canvas-font-name get-canvas-font-size get-canvas-font-style
get-canvas-font-transfer-mode host-font-description)
))
(defvar
*font-transfer-modes*
(list :boole-1
:boole-2
:boole-andc1
:boole-andc2
:boole-and
:boole-c1
:boole-c2
:boole-clr
:boole-eqv
:boole-ior
:boole-nand
:boole-nor
:boole-orc1
:boole-orc2
:boole-set
:boole-xor)
"Font transfer-modes cache")
(defun font-transfer-modes ()
*font-transfer-modes*)
(defvar
*font-styles*
(list :plain :bold :italic)
"Font styles cache")
(defun font-styles ()
*font-styles*)
(defun font-names ()
(declare (special wb::*default-display* *font-names*))
(let ((cached-font-names
(assoc wb::*default-display* *font-names*))
font-names)
(cond
(cached-font-names
(setf font-names (cdr cached-font-names)))
(T (setf font-names (xlib::list-font-names wb::*default-display* "*"))
(push (cons wb::*default-display* font-names) *font-names*)
))
font-names))
(defvar
*font-names*
NIL
"Font name cache")
(defun match-name (name fonts)
(remove-if-not
#'(lambda (element)
(search name element))
fonts))
(defun match-style (style fonts)
(remove-if-not
#'(lambda (element)
(cond ((equal style '(:plain))
(or (search "light-r-normal" element)
(search "medium-r-normal" element)
(search "regular-r-normal" element)))
((equal style '(:bold))
(or (search "bold-r-normal" element)
(search "demi-r-normal" element)
(search "demibold-r-normal" element)))
((equal style '(:italic))
(or (search "-o-normal" element)
(search "-i-normal" element)))
((or (equal style '(:italic :bold))
(equal style '(:bold :italic)))
(or (search "bold-o-normal" element)
(search "bold-i-normal" element)
(search "demi-o-normal" element)
(search "demi-i-normal" element)
(search "demibold-o-normal" element)
(search "demibold-i-normal" element)))
))
fonts))
(defun match-psize (size fonts)
(loop
for font in fonts
when
(string-not-lessp
(get-word-i font 7)
(format nil "~a" size))
collect font))
(defun match-font (canvas-font host-fonts)
(let ((fonts NIL)
font)
(setq fonts (match-name (wb::canvas-font-name canvas-font) host-fonts))
(setq fonts (match-style (wb::canvas-font-style canvas-font) fonts))
(setf font (first (match-psize (wb::canvas-font-size canvas-font) fonts)))
(cond
(font font)
(T
(format *error-output* "~&Warning: Canvas font ~s not found. Trying ~s"
canvas-font "fixed")
"fixed"))))
(defun cached-host-font (canvas-font)
"Returns the host-font that has been cached for this canvas-font. ~
If one is not cached, it is found, cached, and returned."
(declare (special wb::*default-display*))
(let ((host-fonts (sixth canvas-font))
(host-font NIL))
(when host-fonts
(setf host-font
(cdr (assoc wb::*default-display* host-fonts))))
(unless host-font
(setf host-font
(xlib::open-font
wb::*default-display*
(match-font
canvas-font
(font-names))))
(If host-fonts
(push (cons wb::*default-display* host-font) (sixth canvas-font))
(nconc canvas-font (list (list (cons wb::*default-display* host-font))))))
host-font))
(defun clear-host-font-cache (canvas-font)
"Clears the host-font cache for this canvas-font."
(if (sixth canvas-font)
(rplacd (last canvas-font 2) NIL)))
(defun get-word-i (string &optional (i 1))
(with-input-from-string (s string)
(let ((num-dashes 0)
(char (read-char s NIL NIL))
(result NIL)
)
(loop
while char
until (> num-dashes i)
do
(if (eq char #\-) (incf num-dashes))
(if (and (= num-dashes i)
(not (eq char #\-)))
(push char result))
(setf char (read-char s NIL NIL)))
(if result
(with-output-to-string (rs )
(loop for c in (reverse result) do (write-char c rs))
))
)))
(defun get-canvas-font-name (host-font)
"Translates the host Common Lisp font representation to get the name ~
of the corresponding canvas-font in window-basics."
(get-word-i host-font 2))
(defun get-canvas-font-size (host-font)
"Translates the host Common Lisp font representation to get the size ~
of the corresponding canvas-font in window-basics."
(get-word-i host-font 7))
(defun get-canvas-font-style (host-font)
"Translates the host Common Lisp font representation to get the style ~
of the corresponding canvas-font in window-basics."
(cond
((or (search "medium-r-normal" host-font)
(search "regular-r-normal" host-font)
(search "light-r-normal" host-font))
'(:plain))
((or (search "medium-o-normal" host-font)
(search "medium-i-normal" host-font)
(search "regular-o-normal" host-font)
(search "regular-i-normal" host-font)
(search "light-o-normal" host-font)
(search "light-i-normal" host-font))
'(:italic))
((or (search "bold-r-normal" host-font)
(search "demi-r-normal" host-font)
(search "demibold-r-normal" host-font))
'(:bold))
((or (search "bold-o-normal" host-font)
(search "bold-i-normal" host-font)
(search "demi-o-normal" host-font)
(search "demi-i-normal" host-font)
(search "demibold-o-normal" host-font)
(search "demibold-i-normal" host-font))
'(:bold :italic))))
(defun get-canvas-font-transfer-mode (host-font)
"Translates the host Common Lisp font representation to get the transfer-mode ~
of the corresponding canvas-font in window-basics."
NIL)
(defun host-font-description (host-font)
"Returns four values that represent (in pixels) the ascent, ~
descent, max-width, and leading (suggested spacing between ~
lines) of the host-font."
(let* ((ascent (xlib:font-ascent host-font))
(descent (xlib:font-descent host-font))
(leading 5) ;; not given!!
(max-width (xlib:max-char-width host-font)))
(values ascent descent leading max-width)))
| 7,400 | Common Lisp | .cl | 204 | 28.651961 | 128 | 0.574608 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | ecde6760719d408854d4c8eb00a038db38acda30cdd63964e332780cab934054 | 32,860 | [
-1
] |
32,861 | host-window-mcl.lsp | rwoldford_Quail/source/window-basics/host/host-window-mcl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; host-window-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; C.B. Hurley 1989-1991
;;; J.A. McDonald 1988-89
;;; R.W. Oldford 1989-1992
;;; J.O. Pedersen 1988-89
;;;
;;;
;;;
;;;----------------------------------------------------------------------------------
(in-package :wb)
(export '(host-window))
(defclass host-window (window)
((the-scroller :accessor the-scroller))
(:documentation
"Mixin to canvas that captures properties of the host window system."))
(defmethod initialize-instance ((self host-window) &key
(scroller-class 'ccl::scroller)
(scroll-bar-class 'scroll-bar-dialog-item)
h-scroll-class v-scroll-class
(track-thumb-p t)
field-size)
(call-next-method)
(setf (the-scroller self)
(make-instance
scroller-class
:view-container self
:view-size (subtract-points (view-size self) #@(15 15))
:view-position #@(0 0)
:draw-scroller-outline nil
:scroll-bar-class scroll-bar-class
:h-scroll-class h-scroll-class
:v-scroll-class v-scroll-class
:track-thumb-p track-thumb-p
:field-size field-size)))
(defmethod ccl::set-view-size ((self host-window) h &optional v)
(declare (ignore h v))
(without-interrupts
(call-next-method)
(let* ((new-size (subtract-points (view-size self) #@(15 15))))
(set-view-size (the-scroller self) new-size))
(redisplay self)
))
(defmethod ccl::window-zoom-event-handler ((self host-window) message)
(declare (ignore message))
(without-interrupts
(call-next-method)
(let* ((new-size (subtract-points (view-size self) #@(15 15))))
(set-view-size (the-scroller self) new-size))
))
(defmethod ccl::window-close ((c host-window))
"Destroys the canvas if the mouse button is down over the ~
close box (Mac style to avoid garbage) ~
hides the canvas if command is down with mouse button."
(declare (special *last-menubar* *current-event*))
(if (and (boundp '*current-event*)
(eq (rref *current-event* eventRecord.modifiers) 256))
(#_HideWindow :ptr (wptr c))
(call-next-method))
)
;;-*- Mode: Lisp; Package: CCL -*-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Pict-Scrap.Lisp
;;
;; Copyright 1989-1994, Apple Computer, Inc.
;; Copyright 1995 Digitool, Inc.
;;
;;
;; This file a scrap-handler for scraps of type PICT
;;
;; Once this is installed, windows which copy and paste PICTs will
;; be able to share their work with other applications
;;
;; Modified for 2.0 by Henry Lieberman
;;;;;;;;;;;;
;;
;; Modification History
;;
;; 04/24/92 bill Don't push multiple entries on *scrap-handler-alist*
;; if loaded multiple times. Also, eliminate the memory
;; leak in internalize-scrap (thanx to Bob Strong).
;; ------------- 2.0
;; 11/18/91 bill Don't need to require traps or records anymore.
;; 08/24/91 gb Use new traps; don't use $applScratch
;;(in-package :ccl)
(defclass pict-scrap-handler (scrap-handler) ())
(defmethod set-internal-scrap ((self pict-scrap-handler) scrap)
(let* ((old-pict (slot-value self 'ccl::internal-scrap)))
(when (handlep old-pict)
(#_KillPicture old-pict))) ;dispose of the old pict before we
;put a new one in its place
;this will crash if your program has
;other pointers to the pict, so
;always make sure cut/copy really do
;-copy- the pict
(call-next-method self scrap)
(when scrap (pushnew :pict *scrap-state*)))
(defmethod externalize-scrap ((pict-scrap-handler pict-scrap-handler))
(let* ((the-pict (slot-value pict-scrap-handler 'ccl::internal-scrap))
(size (#_GetHandleSize the-pict)))
(when the-pict
(with-dereferenced-handles
((the-pict the-pict))
(#_PutScrap size :pict the-pict)))))
(defmethod internalize-scrap ((self pict-scrap-handler))
(let* ((the-pict (slot-value self 'ccl::internal-scrap)))
(unless (handlep the-pict)
(setq the-pict
(setf (slot-value self 'ccl::internal-scrap)
(#_NewHandle 0))))
(rlet ((junk :signed-long))
(#_GetScrap the-pict :pict junk))
the-pict))
(defmethod get-internal-scrap ((pict-scrap-handler pict-scrap-handler))
(slot-value pict-scrap-handler 'ccl::internal-scrap))
(eval-when (:load-toplevel :execute)
(let ((p (assq :pict *scrap-handler-alist*)))
(if p
(setf (cdr p) (make-instance 'pict-scrap-handler))
(push `(:pict . ,(make-instance 'pict-scrap-handler))
*scrap-handler-alist*)))
)
;;;;;;;;;;;;;;;;;;;;;
;;
;; supporting cut and paste with picts
;;
;; because it doesn't remember the picts which it pastes,
;; it can only cut a pseudo-pict, that is, a pict which
;; contains the window's current contents as a bitmap.
(defmethod ccl::paste ((pict-window host-window))
(let* ((pict (get-scrap :pict)))
(when pict
(with-port (wptr pict-window)
(rlet ((r :rect))
(with-dereferenced-handles ((pict-point pict))
(copy-record (rref pict-point :picture.picframe
:storage :pointer)
:rect
r))
(#_DrawPicture pict r))))))
(defmethod ccl::copy ((pict-window host-window))
(let* ((wptr (wptr pict-window)))
(rlet ((rect :rect
:left (rref wptr windowrecord.portrect.left)
:top (rref wptr windowrecord.portrect.top)
:right (rref wptr windowrecord.portrect.right)
:bottom (rref wptr windowrecord.portrect.bottom)))
(with-port wptr
(#_cliprect rect)
(let* ((pict (#_OpenPicture rect))
;; (bits (rref wptr :windowrecord.portbits))
)
(wb::redisplay pict-window)
;; (#_CopyBits
;; bits
;; bits
;; rect
;; rect 0 ;transfer mode
;; (%null-ptr))
(#_ClosePicture)
(put-scrap :pict pict))))))
(defmethod ccl::clear ((pict-window host-window))
(let ((wptr (wptr pict-window)))
(with-port wptr
(#_EraseRect (rref wptr :windowrecord.portrect)))))
(defmethod ccl::cut ((pict-window host-window))
(ccl::copy pict-window)
(ccl::clear pict-window)) | 7,370 | Common Lisp | .cl | 183 | 32.202186 | 86 | 0.555524 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 32787657e186cc8c6fbd8429b8f0904ceced25d0c585c8c43e58947c31ddde21 | 32,861 | [
-1
] |
32,862 | host-menu-canvas-mcl.lsp | rwoldford_Quail/source/window-basics/host/host-menu-canvas-mcl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; host-menu-canvas-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; R.W. Oldford 1989-1991
;;;
;;;
;;;
;;;-------------------------------------------------------------------
;;;
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(*last-menubar* *system-default-menubar*)))
(defclass host-menu-canvas ()
()
(:documentation "A class to define how title menus should appear."))
(defvar *system-default-menubar*
NIL
"The default menubar of the system.")
(defun set-system-default-menubar (&optional (menubar ccl::*default-menubar*))
"Sets the *system-default-menubar* to be the value of the optional ~
argument menubar (defaults to the Macintosh's *default-menubar*)."
(declare (special ccl::*default-menubar*))
(setf *system-default-menubar* menubar))
(eval-when (load)
(set-system-default-menubar))
(defvar *last-menubar* *system-default-menubar*
"The list of elements of the last menubar. To be updated ~
and downdated as canvases are activated and deactivated.")
(defun put-title-menus-on-menubar (canvas)
(declare
(special *current-canvas*
*system-default-menubar*
*last-menubar*))
(setf *current-canvas* canvas)
(let ((title-menus (title-menus-of canvas))
title-menubar)
(when
title-menus
(setf title-menus
(sort (loop for m in title-menus collect m)
#'(lambda (k1 k2)
(string< (string k1) (string k2)))
:key #'car))
(setf title-menubar
(append *system-default-menubar*
(loop for m in title-menus collect (cdr m))))
(setf *last-menubar* (menubar))
(set-menubar title-menubar))
)
)
(defmethod initialize-instance :after ((self host-menu-canvas)
&rest initargs)
(declare (ignore initargs))
(if (title-menus-of self)
(put-title-menus-on-menubar self))
)
(defmethod ccl::view-activate-event-handler :before ((c host-menu-canvas))
(if (title-menus-of c)
(put-title-menus-on-menubar c))
)
(defmethod ccl::view-deactivate-event-handler :before ((c host-menu-canvas))
(declare (special *last-menubar*))
(if (title-menus-of c)
(set-menubar *last-menubar*))
)
(defmethod window-close :after ((c host-menu-canvas))
"Deactivates the menubar and re-enstalls the last one."
(declare (special *last-menubar*))
(if (title-menus-of c)
(set-menubar *last-menubar*))
)
| 3,134 | Common Lisp | .cl | 83 | 31.86747 | 109 | 0.577954 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | f6bc29ca9e7d0161bd6b70c881dfdacf6e156453235b22e302be6138ea148397 | 32,862 | [
-1
] |
32,863 | old-host-draw-mcl.lsp | rwoldford_Quail/source/window-basics/host/old-host-draw-mcl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; host-draw-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; Copyright (c) 1991 Statistical Computing Laboratory, University of Waterloo
;;;
;;;
;;; Authors:
;;; R.W. Oldford 1991.
;;; Modified by C. Hurley 9/21/92 for consistency with MCL2.0
;;; (from change history on Quickdraw.lisp:
;;
;; Earlier Mod history
;;
;; 10/16/91 bill PSZ's simplification of with-rectangle-arg
;; ------------- 2.0b3
;; 08/26/91 bill downward-function -> dynamic-extent
;; 08/17/91 bill (pset x :record.slot v) -> (setf (pref x :record.slot) v)
;; No more (require-interface :quickdraw), autoloading is faster.
;; 07/09/91 bill rref & rset -> pref/href & pset/hset
;; ------------- 2.0b2
;; 02/20/91 bill with-pointers in copy-bits, *32-bit-qd-pen-modes* in mode-arg
;;--------------- 2.0b1
;;
;;;
;;;--------------------------------------------------------------------------------
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Host-Draw.lisp
;;
;; version 2.0
;;
;; copyright 1987-89 Apple Computer, Inc
;;
;; This file implements a full error-checked interface to Quickdraw.
;; It is meant to be useful both in programs and as an example of how to use
;; the low-level interface to the Mac.
;;
;; You can compile selected portions of this file, but if you do, make sure to
;; include the macros and utility functions from the top.
;;
;; These functions require a canvas-focus on every drawing command.
;; For faster drawing you should only focus the canvas
;; once, and then issue a series of drawing commands. You can use
;; this file as an example of how to call the Quickdraw traps directly
;; in such a situation.
;;
(in-package :host-draw)
;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Shadowed symbols in defpackage
;;;
;;;(shadow '(make-point))
(defun h-draw:make-point (x &optional y)
"Returns a point having x and y as its coordinates."
(if y
(ccl::make-point x y)
(ccl::make-point x)))
;;; (export '(make-point))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(point-x point-y
*hardcopy-ptr* clip-region set-clip-region clip-rect pen-show pen-hide
pen-shown-p pen-position pen-size set-pen-size pen-mode
set-pen-mode pen-pattern set-pen-pattern set-pen-color pen-state
set-pen-state pen-normal move-to move line-to line
offset-rect inset-rect intersect-rect union-rect point-in-rect-p
points-to-rect point-to-angle equal-rect empty-rect-p frame-rect
paint-rect erase-rect invert-rect fill-rect frame-oval paint-oval
erase-oval invert-oval fill-oval frame-round-rect paint-round-rect
erase-round-rect invert-round-rect fill-round-rect draw-arc
fill-arc erase-arc invert-arc fill-arc new-region dispose-region
copy-region set-empty-region set-rect-region open-region close-region
offset-region inset-region intersect-region union-region
difference-region xor-region point-in-region-p rect-in-region-p
equal-region-p empty-region-p frame-region paint-region erase-region
invert-region fill-region start-picture get-picture draw-picture
kill-picture start-polygon get-polygon kill-polygon offset-polygon
frame-polygon paint-polygon erase-polygon invert-polygon fill-polygon
local-to-global global-to-local get-pixel scale-point map-point
map-rect map-region map-polygon make-bitmap copy-bits scroll-rect
origin set-origin draw-string draw-char)
))
(eval-when (eval compile)
(require :deftrap))
(defun point-x (point)
"Returns the x coordinate of point."
(ccl::point-h point))
(defun point-y (point)
"Returns the x coordinate of point."
(ccl::point-v point))
(defvar *hardcopy-ptr*
NIL
"A system dependent pointer to an open printer device.")
(defmacro with-rectangle-arg ((var left &optional top right bottom) &body body)
"Takes a rectangle, two points, or four coordinates and makes a rectangle. ~
Body is evaluated with VAR bound to that rectangle."
(let ((left-var (make-symbol "LEFT"))
(top-var (make-symbol "TOP"))
(right-var (make-symbol "RIGHT"))
(bottom-var (make-symbol "BOTTOM")))
`(let ((,left-var ,left)
(,top-var ,top)
(,right-var ,right)
(,bottom-var ,bottom))
(call-with-rectangle-arg
#'(lambda (,var)
(declare (dynamic-extent))
,@body)
,left-var ,top-var ,right-var ,bottom-var))))
(defun call-with-rectangle-arg (thunk left top right bottom)
(rlet ((var :rect))
(cond (bottom
(setf (pref var rect.topleft) (ccl::make-point left top))
(setf (pref var rect.bottomright) (ccl::make-point right bottom)))
(right
(quail-error "Illegal rectangle arguments: ~s ~s ~s ~s"
left top right bottom))
(top
(setf (pref var rect.topleft) (ccl::make-point left nil))
(setf (pref var rect.bottomright) (ccl::make-point top nil)))
(t (%setf-macptr var left)))
(funcall thunk var)))
(defvar *32-bit-qd-pen-modes*
'((:blend . 32)
(:addPin . 33)
(:addOver . 34)
(:subPin . 35)
(:transparent . 36)
(:adMax . 37)
(:subOver . 38)
(:adMin . 39)
(:hilite . 50)))
(defun mode-arg (thing)
(or
(and (fixnump thing) (<= 0 thing 64) thing)
(position thing *pen-modes*)
(cdr (assq thing *32-bit-qd-pen-modes*))
(quail-error "Unknown pen mode: ~a" thing)))
(defun origin (view)
(view-scroll-position view))
(defun set-origin (view h &optional v)
(set-view-scroll-position view h v nil))
(defun clip-region (canvas &optional (save-region (#_NewRgn)))
(declare (ignore canvas))
(#_GetClip save-region)
save-region)
(defun set-clip-region (canvas new-region)
(declare (ignore canvas))
(#_SetClip new-region)
new-region)
(defun clip-rect (canvas left &optional top right bot)
(declare (ignore canvas))
(with-rectangle-arg (r left top right bot)
(#_ClipRect r))
nil)
(defun pen-show (canvas)
(setf (pref (or *hardcopy-ptr* (wptr canvas))
grafport.pnvis) 0)
nil)
(defun pen-hide (canvas)
(setf (pref (or *hardcopy-ptr* (wptr canvas)) grafport.pnvis) -1)
nil)
(defun pen-shown-p (canvas)
(> (pref (or *hardcopy-ptr* (wptr canvas)) grafport.pnvis) -1))
(defun pen-position (canvas)
(pref (or *hardcopy-ptr* (wptr canvas)) windowRecord.pnloc))
(defun pen-size (canvas)
(pref (or *hardcopy-ptr* (wptr canvas)) windowRecord.pnsize))
(defun set-pen-size (canvas h &optional v &aux (pt (ccl::make-point h v)))
(with-port (or *hardcopy-ptr* (wptr canvas))
(#_PenSize :long pt))
pt)
(defun pen-mode (canvas)
(elt *pen-modes* (pref (or *hardcopy-ptr* (wptr canvas)) windowRecord.pnmode)))
(defun set-pen-mode (canvas new-mode)
(with-port (or *hardcopy-ptr* (wptr canvas))
(#_PenMode (mode-arg new-mode))))
(defun pen-pattern (canvas &optional
(save-pat (make-record (:pattern :storage :pointer))))
(copy-record
(pref (or *hardcopy-ptr* (wptr canvas))
windowRecord.pnPat) (:pattern :storage :pointer) save-pat))
(defun set-pen-pattern (canvas new-pattern)
(with-port (or *hardcopy-ptr* (wptr canvas))
(#_PenPat new-pattern))
new-pattern)
(defun set-pen-color (canvas new-color)
(ccl::set-fore-color canvas new-color)
new-color)
; ----------------------------
(defun pen-state (canvas &optional (save-state (make-record :penstate)))
(declare (ignore canvas))
(#_GetPenState save-state)
save-state)
(defun set-pen-state (canvas new-state)
(declare (ignore canvas))
(#_SetPenState new-state)
new-state)
(defun pen-normal (canvas)
(declare (ignore canvas))
(#_PenNormal))
(defun move-to (canvas h &optional v)
(declare (ignore canvas))
(#_MoveTo :long (setq h (ccl::make-point h v)))
h)
(defun move (canvas h &optional v)
(declare (ignore canvas))
(#_Move :long (setq h (ccl::make-point h v)))
h)
(defun line-to (canvas h &optional v)
(declare (ignore canvas))
(#_LineTo :long (setq h (ccl::make-point h v)))
h)
(defun line (canvas h &optional v)
(declare (ignore canvas))
(#_Line :long (setq h (ccl::make-point h v)))
h)
(defun offset-rect (rect h &optional v)
(#_OffsetRect :ptr rect :long (ccl::make-point h v))
rect)
(defun inset-rect (rect h &optional v)
(#_InsetRect :ptr rect :long (ccl::make-point h v))
rect)
(defun intersect-rect (rect1 rect2 dest-rect)
(#_SectRect rect1 rect2 dest-rect)
dest-rect)
(defun union-rect (rect1 rect2 dest-rect)
(#_UnionRect rect1 rect2 dest-rect)
dest-rect)
(defun point-in-rect-p (rect h &optional v)
(#_PtInRect (ccl::make-point h v) rect))
(defun points-to-rect (point1 point2 dest-rect)
(#_Pt2Rect (ccl::make-point point1 nil) (ccl::make-point point2 nil) dest-rect)
dest-rect)
(defun point-to-angle (rect h &optional v)
(%stack-block ((ip 4))
(#_PtToAngle rect (ccl::make-point h v) ip)
(%get-word ip)))
(defun equal-rect (rect1 rect2)
(#_EqualRect rect1 rect2))
(defun empty-rect-p (left &optional top right bot)
(with-rectangle-arg (r left top right bot)
(#_EmptyRect r )))
(defun frame-rect (canvas left &optional top right bot)
(declare (ignore canvas))
(with-rectangle-arg (r left top right bot) (#_FrameRect r )))
(defun paint-rect (canvas left &optional top right bot)
(declare (ignore canvas))
(with-rectangle-arg (r left top right bot) (#_PaintRect r)))
(defun erase-rect (canvas left &optional top right bot)
(declare (ignore canvas))
(with-rectangle-arg (r left top right bot) (#_EraseRect r)))
(defun invert-rect (canvas left &optional top right bot)
(declare (ignore canvas))
(with-rectangle-arg (r left top right bot) (#_InvertRect r)))
(defun fill-rect (canvas pattern left &optional top right bot)
(declare (ignore canvas))
(with-rectangle-arg (r left top right bot)
(#_FillRect r pattern)))
(defun frame-oval (canvas left &optional top right bot)
(declare (ignore canvas))
(with-rectangle-arg (r left top right bot) (#_FrameOval r)))
(defun paint-oval (canvas left &optional top right bot)
(declare (ignore canvas))
(with-rectangle-arg (r left top right bot) (#_PaintOval r)))
(defun erase-oval (canvas left &optional top right bot)
(declare (ignore canvas))
(with-rectangle-arg (r left top right bot) (#_EraseOval r)))
(defun invert-oval (canvas left &optional top right bot)
(declare (ignore canvas))
(with-rectangle-arg (r left top right bot) (#_InvertOval r)))
(defun fill-oval (canvas pattern left &optional top right bot)
(declare (ignore canvas))
(with-rectangle-arg (r left top right bot)
(#_FillOval r pattern)))
(defun frame-round-rect (canvas oval-width oval-height
left &optional top right bot)
(declare (ignore canvas))
(with-rectangle-arg (r left top right bot)
(#_FrameRoundRect r oval-width oval-height)))
(defun paint-round-rect (canvas oval-width oval-height
left &optional top right bot)
(declare (ignore canvas))
(with-rectangle-arg (r left top right bot)
(#_PaintRoundRect r oval-width oval-height)))
(defun erase-round-rect (canvas oval-width oval-height
left &optional top right bot)
(declare (ignore canvas))
(with-rectangle-arg (r left top right bot)
(#_EraseRoundRect r oval-width oval-height)))
(defun invert-round-rect (canvas oval-width oval-height
left &optional top right bot)
(declare (ignore canvas))
(with-rectangle-arg (r left top right bot)
(#_InvertRoundRect r oval-width oval-height)))
(defun fill-round-rect (canvas pattern oval-width oval-height
left &optional top right bot)
(declare (ignore canvas))
(with-rectangle-arg (r left top right bot)
(#_FillRoundRect r oval-width oval-height pattern)))
;;;
;;; Arcs
;;;
;;;
;;; The following exists because of Macintosh's peculiar
;;; orientation of angles
;;; ... rwo
(defun standard-to-mac-angle (theta-in-degrees)
"Transforms the argument from the standard position (0 = positive x-axis; ~
90 = positive y-axis) to Macintosh angle position (0 = positive y-axis; ~
90 = positive x-axis)."
(let (new-angle)
(if (< theta-in-degrees 180)
(setf new-angle (- 90 theta-in-degrees))
(setf new-angle (- 450 theta-in-degrees)))
(when (< new-angle 0)
(setf new-angle (+ 360 new-angle)))
new-angle))
;;;
;;; The following exists because we prefer to work with radii
;;; ... rwo
(defun radii-to-rect (x-centre y-centre x-radius y-radius)
"From the ellipse defined by x-centre y-centre x-radius y-radius ~
computes and returns ~
multiple-values left top right bottom giving the coordinate ~
information on the enclosing rectangle of the ellipse."
(let (left top right bottom)
(setf left (- x-centre x-radius))
(setf top (- y-centre y-radius)) ;inverted y coord system
(setf right (+ x-centre x-radius))
(setf bottom (+ y-centre y-radius)) ;inverted y coord system
(values left top right bottom)))
(defun draw-arc (canvas start-angle arc-angle
x-centre y-centre x-radius y-radius)
(declare (ignore canvas))
(multiple-value-bind
(left top right bottom)
(radii-to-rect x-centre y-centre x-radius y-radius)
(with-rectangle-arg (r left top right bottom)
(#_FrameArc r (standard-to-mac-angle start-angle) (- arc-angle)))))
(defun fill-arc (canvas start-angle arc-angle
x-centre y-centre x-radius y-radius)
(declare (ignore canvas))
(multiple-value-bind
(left top right bottom)
(radii-to-rect x-centre y-centre x-radius y-radius)
(with-rectangle-arg (r left top right bottom)
(#_PaintArc r (standard-to-mac-angle start-angle) (- arc-angle)))))
(defun erase-arc (canvas start-angle arc-angle
x-centre y-centre x-radius y-radius)
(declare (ignore canvas))
(multiple-value-bind
(left top right bottom)
(radii-to-rect x-centre y-centre x-radius y-radius)
(with-rectangle-arg (r left top right bottom)
(#_EraseArc r (standard-to-mac-angle start-angle) (- arc-angle)))))
(defun invert-arc (canvas start-angle arc-angle
x-centre y-centre x-radius y-radius)
(declare (ignore canvas))
(multiple-value-bind
(left top right bottom)
(radii-to-rect x-centre y-centre x-radius y-radius)
(with-rectangle-arg (r left top right bottom)
(#_InvertArc r (standard-to-mac-angle start-angle) (- arc-angle)))))
;;;Regions
(defun new-region ()
(#_NewRgn))
(defun dispose-region (region)
(#_DisposeRgn region))
(defun copy-region (region &optional (dest-region (new-region)))
(#_CopyRgn region dest-region)
dest-region)
(defun set-empty-region (region)
(#_SetEmptyRgn region)
region)
(defun set-rect-region (region left &optional top right bot)
(with-rectangle-arg (r left top right bot)
(#_RectRgn region r))
region)
(defun open-region (canvas)
(let ((wptr (or *hardcopy-ptr* (wptr canvas))))
(unless (%null-ptr-p (pref wptr grafport.rgnSave))
(quail-error "Region already open for window: ~a" canvas))
(with-port wptr (#_OpenRgn))))
(defun close-region (canvas &optional (dest-region (new-region) dp))
(let ((wptr (or *hardcopy-ptr* (wptr canvas))))
(if (%null-ptr-p (pref wptr grafport.rgnSave))
(progn
(if (not dp) (dispose-region dest-region))
(quail-error "Region is not open for window: ~a" canvas)))
(with-port wptr
(#_CloseRgn dest-region)))
dest-region)
(defun offset-region (region h &optional v)
(#_OffsetRgn :ptr region :long (ccl::make-point h v))
region)
(defun inset-region (region h &optional v)
(#_InsetRgn :ptr region :long (ccl::make-point h v))
region)
(defun intersect-region (region1 region2 &optional (dest-region (new-region)))
(#_SectRgn region1 region2 dest-region)
dest-region)
(defun union-region (region1 region2 &optional (dest-region (new-region)))
(#_UnionRgn region1 region2 dest-region)
dest-region)
(defun difference-region (region1 region2 &optional (dest-region (new-region)))
(#_DiffRgn region1 region2 dest-region)
dest-region)
(defun xor-region (region1 region2 &optional (dest-region (new-region)))
(#_XorRgn region1 region2 dest-region)
dest-region)
(defun point-in-region-p (region h &optional v)
(#_PtInRgn (ccl::make-point h v) region))
(defun rect-in-region-p (region left &optional top right bot)
(with-rectangle-arg (r left top right bot)
(#_RectInRgn r region)))
(defun equal-region-p (region1 region2)
(#_EqualRgn region1 region2))
(defun empty-region-p (region)
(#_EmptyRgn region))
(defun frame-region (canvas region)
(declare (ignore canvas))
(#_FrameRgn region))
(defun paint-region (canvas region)
(declare (ignore canvas))
(#_PaintRgn region))
(defun erase-region (canvas region)
(declare (ignore canvas))
(#_EraseRgn region))
(defun invert-region (canvas region)
(declare (ignore canvas))
(#_InvertRgn region))
(defun fill-region (canvas pattern region)
(declare (ignore canvas))
(#_FillRgn region pattern))
;;;Pictures
(defun start-picture (canvas &optional left top right bottom)
(with-macptrs (portrect)
(let ((wptr (or *hardcopy-ptr* (wptr canvas))))
(unless (%null-ptr-p (pref wptr windowRecord.picsave))
(quail-error "A picture may not be started for window: ~a.
since one is already started" canvas))
(unless left (setq left (%setf-macptr portrect (pref wptr windowRecord.portrect)))))
(with-rectangle-arg (r left top right bottom)
(#_cliprect r)
(setf (view-get canvas 'my-hPic) (#_OpenPicture r)))
nil))
(defun get-picture (canvas)
(let ((my-hPic (view-get canvas 'my-hPic))
(wptr (or *hardcopy-ptr* (wptr canvas))))
(if (and my-hPic (not (%null-ptr-p (pref wptr windowRecord.picSave))))
(prog1
my-hPic
(with-port wptr (#_ClosePicture))
(setf (view-get canvas 'my-hPic) nil))
(quail-error "Picture for window: ~a is not started" canvas))))
(defun draw-picture (canvas picture &optional left top right bottom)
(declare (ignore canvas))
(cond ((not left)
(setq left (href picture picture.picFrame.topleft)
top (href picture picture.picFrame.bottomright)))
((pointerp left)
()) ;everythings fine
((and (not right)
(not top))
(setq top
(add-points left
(subtract-points
(href picture picture.picframe.bottomright)
(href picture picture.picframe.topleft))))))
(with-rectangle-arg (r left top right bottom)
(#_DrawPicture picture r))
picture)
(defun kill-picture (picture)
(#_KillPicture picture))
(defun start-polygon (canvas)
(let ((wptr (or *hardcopy-ptr* (wptr canvas))))
(unless (%null-ptr-p (pref wptr windowRecord.polysave))
(quail-error "A new polygon may not be started for window: ~a.
since one is already started" canvas))
(with-port wptr (setf (view-get canvas 'my-poly) (#_OpenPoly))))
nil)
(defun get-polygon (canvas)
(let ((my-poly (view-get canvas 'my-poly))
(wptr (or *hardcopy-ptr* (wptr canvas))))
(if (and my-poly (not (%null-ptr-p (pref wptr windowRecord.polysave))))
(prog1
my-poly
(with-port wptr (#_ClosePoly))
(setq my-poly nil))
(quail-error "Polygon for window: ~a has not been started" canvas))))
(defun kill-polygon (polygon)
(#_KillPoly polygon))
(defun offset-polygon (polygon h &optional v)
(#_OffsetPoly :ptr polygon :long (ccl::make-point h v))
polygon)
(defun frame-polygon (canvas polygon)
(declare (ignore canvas))
(#_FramePoly polygon))
(defun paint-polygon (canvas polygon)
(declare (ignore canvas))
(#_PaintPoly polygon))
(defun erase-polygon (canvas polygon)
(declare (ignore canvas))
(#_ErasePoly polygon))
(defun invert-polygon (canvas polygon)
(declare (ignore canvas))
(#_InvertPoly polygon))
(defun fill-polygon (canvas pattern polygon)
(declare (ignore canvas))
(#_FillPoly polygon pattern))
(defun local-to-global (canvas h &optional v)
(declare (ignore canvas))
(rlet ((p :point))
(%put-long p (ccl::make-point h v))
(#_LocalToGlobal p)
(%get-long p)))
(defun global-to-local (canvas h &optional v)
(declare (ignore canvas))
(rlet ((p :point))
(%put-long p (ccl::make-point h v))
(#_GlobalToLocal p)
(%get-long p)))
(defun get-pixel (canvas h &optional v)
(setq h (ccl::make-point h v))
(if (#_PtInRgn h
(pref (or *hardcopy-ptr* (wptr canvas))
windowRecord.visrgn))
(#_GetPixel :long h :boolean)))
(defun scale-point (source-rect dest-rect h &optional v)
(rlet ((pt :point))
(%put-long pt (ccl::make-point h v))
(#_ScalePt pt source-rect dest-rect)
(%get-long pt)))
(defun map-point (source-rect dest-rect h &optional v)
(rlet ((pt :point))
(%put-long pt (ccl::make-point h v))
(#_MapPt pt source-rect dest-rect)
(%get-long pt)))
(defun map-rect (source-rect dest-rect rect)
(#_MapRect rect source-rect dest-rect)
rect)
(defun map-region (source-rect dest-rect region)
(#_MapRgn region source-rect dest-rect)
region)
(defun map-polygon (source-rect dest-rect polygon)
(#_MapPoly polygon source-rect dest-rect)
polygon)
(defun make-bitmap (left &optional top right bottom &aux rowbytes bm)
(with-rectangle-arg (r left top right bottom)
(setq rowbytes
(logand
#xfffe
(+ 2 (ash (- (pref r rect.right) (pref r rect.left) 1) -3))))
(setq bm
(#_NewPtr :check-error
(+ 14 (* rowbytes (- (pref r rect.bottom) (pref r rect.top))))))
(setf (pref bm bitmap.bounds) r)
(setf (pref bm bitmap.rowbytes) rowbytes)
(setf (pref bm bitmap.baseaddr) (%inc-ptr bm 14)))
bm)
(defun copy-bits (source-bitmap dest-bitmap source-rect dest-rect
&optional (mode 0) mask-region)
(with-macptrs ((mask-region (if mask-region mask-region (%null-ptr))))
(#_CopyBits source-bitmap
dest-bitmap
source-rect
dest-rect
(mode-arg mode)
(or mask-region (%null-ptr)))))
(defun scroll-rect (canvas rect dh &optional dv)
"Ignores any clipping regions"
(declare (ignore canvas))
(let* ((reg (#_newrgn)))
(#_ScrollRect :ptr rect
:long (ccl::make-point dh dv)
:ptr reg)
(#_invalrgn reg)
(#_disposergn reg)))
(defun draw-string (canvas string)
"Draws a string on the canvas at the current position with ~
current font and colour."
(let (font-face mode-size)
(multiple-value-setq (font-face mode-size)
(view-font-codes canvas))
(with-font-codes font-face mode-size
(with-pstrs ((pstring string))
(#_DrawString pstring)))
))
(defun draw-char (canvas char)
(draw-string canvas (string char)))
(provide 'host-draw)
(pushnew :host-draw *features*)
| 24,164 | Common Lisp | .cl | 596 | 34.565436 | 91 | 0.638451 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | b9e55031f689def529206daaf83fa441d59eba49be5721ece1f9d8c1652a7bfc | 32,863 | [
-1
] |
32,864 | host-menu-canvas-clx.lsp | rwoldford_Quail/source/window-basics/host/host-menu-canvas-clx.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; host-menu-canvas-clx.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; R.W. Oldford 1989-1991
;;;
;;;
;;;
;;;-------------------------------------------------------------------
;;;
(in-package :wb)
(defclass host-menu-canvas ()
((menu-bar :initarg :menu-bar
:initform NIL
:accessor menu-bar-of)))
(defun install-menu-bar (canvas)
(let ((left (canvas-get-title-menu canvas :key :left))
(middle (canvas-get-title-menu canvas :key :middle))
(right (canvas-get-title-menu canvas :key :right))
(ctrl-left (canvas-get-title-menu canvas :key :ctrl-left))
(ctrl-middle (canvas-get-title-menu canvas :key :ctrl-middle))
(ctrl-right (canvas-get-title-menu canvas :key :ctrl-right))
menus menu-bar)
(when ctrl-right
(push ctrl-right menus))
(when ctrl-middle
(push ctrl-middle menus))
(when ctrl-left
(push ctrl-left menus))
(when right
(push right menus))
(when middle
(push middle menus))
(when left
(push left menus))
(when menus
(setf menu-bar (make-instance 'wb-menu
:title "" ;;"Canvas Menus"
:type :title
:font *default-menu-font*
))
(set-menu-fns menu-bar
:selected (when-selected-fn-of (first menus))
:held (when-held-fn-of (first menus))
:unheld (when-unheld-fn-of (first menus))
:sub-item (sub-item-fn-of (first menus)))
;; Put menu-bar inside canvas
;;
(xlib::reparent-window
(window-of menu-bar)
(host-window canvas)
0 0)
(dolist (menu menus)
(setf (super-menu-of menu) menu-bar)
(xlib::reparent-window
(item-window-of menu)
(window-of menu-bar)
0 0)
(setf (sub-menus-alist-of menu-bar)
(nconc (sub-menus-alist-of menu-bar)
(sub-menus-alist-of menu))))
(push (list (item-window-of menu-bar)
menu-bar)
(sub-menus-alist-of menu-bar))
(setf (sub-menus-of menu-bar) menus)
(menu-compute-geometry menu-bar)
(xlib::unmap-window (item-window-of menu-bar))
(setf (menu-bar-of canvas) menu-bar)
(setf (xlib:window-plist (host-window canvas)) ;;(xwindow-of canvas))
(acons :wb-class-instance canvas NIL))
menu-bar)))
| 3,041 | Common Lisp | .cl | 83 | 28.506024 | 86 | 0.518493 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 04599200fd9b10a8b9ff751017c963608dae6068e64cfe3e812af46a7572ccb3 | 32,864 | [
-1
] |
32,865 | host-window-clx2.lsp | rwoldford_Quail/source/window-basics/host/host-window-clx2.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; host-window-clx.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; R.W. Oldford 1989-1992
;;;
;;;
;;;
;;; ----------------------------------------------------------------------------------
;;; A new class of windows which contain scroll-bars and a scrollable
;;; area.
;;;
;;; ----------------------------------------------------------------------------------
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(host-window)))
(defclass host-window ()
((host-window :accessor host-window)
(window-manager :accessor window-manager
:initform (or *window-manager*
(prompt-for-window-manager
*known-window-managers*))
:initarg :window-manager)
(gcontext :accessor gcontext :documentation "The graphics context.")
(current-position :accessor current-position
:documentation "The pen position.")))
(defmethod xwindow-of ((self host-window))
(unless (window-manager self)
(setf (window-manager self)
(prompt-for-window-manager *known-window-managers*)))
(case (window-manager self)
(:4Dwm
(parent-of (parent-of (host-window self))))
(:twm
(parent-of (host-window self)))
(:macx
(host-window self))
(T (parent-of (host-window self)))))
(defmethod wb-refresh ((self host-window))
(declare (ignore self)))
(defmethod initialize-instance ((self host-window)
&key
(host NIL)
(font *normal-graphics-font*)
(left 0)
(top 0)
(width 0)
(height 0)
(title "Canvas"))
(call-next-method))
(defmethod initialize-instance ((self host-window)
&key
(host NIL)
(font *normal-graphics-font*)
(left 0)
(top 0)
(width 0)
(height 0)
(title "Canvas"))
(unwind-protect
(let (display screen text-font black white window gcontext)
(setf display (host-display host))
;;(format *terminal-io* "~&display = ~s~%~%" display)
(setf screen (xlib:display-default-screen display))
;;(format *terminal-io* "~&screen = ~s~%~%" screen)
(setf text-font (canvas-font-to-host-font font))
;;(format *terminal-io* "~&text-font = ~s~%~%" text-font)
(setf black (xlib:screen-black-pixel screen))
;;(format *terminal-io* "~&black = ~s~%~%" black)
(setf white (xlib:screen-white-pixel screen))
;;(format *terminal-io* "~&white = ~s~%~%" white)
(setf window (xlib:create-window
:parent
(xlib:screen-root screen)
:x left :y top
:width width :height height
:background black
:border white
:border-width 1
:colormap
(xlib:screen-default-colormap
screen)
:bit-gravity :center
:event-mask
(xlib:make-event-mask
:exposure :button-press
:button-release
:enter-window
)))
;;(format *terminal-io* "~&window = ~s~%~%" window)
(setf gcontext (xlib:create-gcontext :drawable window
:background black
:foreground white
:font text-font))
;;(format *terminal-io* "~&gcontext = ~s~%~%" gcontext)
(setf (host-window self) window)
(setf (gcontext self) gcontext)
(setf (current-position self) (list 0 0))
(xlib:set-wm-properties window
:name title
:icon-name title
:resource-name "Canvas"
:resource-class 'canvas
:x left :y top :width width :height height
:min-width width :min-height height
:input :off :initial-state :normal)
(setf (xlib:window-plist (host-window self))
(acons :wb-class-instance self NIL))
(setf *current-canvas* self)
;;(print "usin it")
(call-next-method))))
(defmethod initialize-instance :after ((self host-window)
&key
(host NIL)
(font *normal-graphics-font*)
(left 0)
(top 0)
(width 0)
(height 0)
(title "Canvas"))
;;(xlib:map-window (host-window self))
)
| 5,759 | Common Lisp | .cl | 133 | 28.744361 | 87 | 0.4396 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 888bec4a0037a19ecdb035c231e2f48562f06198bc5fc9ee1e9bb2c278b0c428 | 32,865 | [
-1
] |
32,866 | host-system-mcl.lsp | rwoldford_Quail/source/window-basics/host/host-system-mcl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; host-system-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; Copyright (c) 1991 Statistical Computing Laboratory, University of Waterloo
;;;
;;;
;;; Authors:
;;; R.W. Oldford 1991.
;;;
;;;
;;;--------------------------------------------------------------------------------
(in-package :wb)
(use-package :ccl)
;;; library files record.lisp and traps.lisp must be available
;;; when evalling or compiling.
;;; hostdraw is made a package and some file changes are here as well.
(eval-when (eval load compile)
;; (make::require :records) ;<-- *** host requires these already!
(make::require :traps) ;<-- *** ... rwo
(make::require :scrollers)
)
| 898 | Common Lisp | .cl | 25 | 32 | 84 | 0.41115 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 85a1e4f08068acb76211a71377804943ab9262690cfa5956c8dc00e516b2e298 | 32,866 | [
-1
] |
32,867 | scrolling-window-clx.lsp | rwoldford_Quail/source/window-basics/host/test/scrolling-window-clx.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; scrolling-windows-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; R.W. Oldford 1989-1992
;;;
;;;
;;;
;;;----------------------------------------------------------------------------------
;;; A new class of windows which contain scroll-bars and a scrollable
;;; area.
;;;
;;; ----------------------------------------------------------------------------------
;;;
;;; Adapted from the scrolling-windows.lisp 1989 examples file distributed by apple
;;;
;;;(require :scrollers) ;; got it in wb-system-mcl.lisp
;;;
;;; Default changed to t for track-thumb-p
;;; my-scroller changed to the-scroller
;;; set-view-size changed to redisplay the entire window ... rwo 92
(in-package :wb)
(export '())
(defclass scrolling-window ()
())
| 1,347 | Common Lisp | .cl | 37 | 34 | 87 | 0.453988 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 67cda85c8240cf1a1c80dc879bf79fa1843218e945cc839b77be93186f16c20e | 32,867 | [
-1
] |
32,868 | host-window-clx.lsp | rwoldford_Quail/source/window-basics/host/test/host-window-clx.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; host-window-clx.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; R.W. Oldford 1989-1992
;;;
;;;
;;;
;;; ----------------------------------------------------------------------------------
;;; A new class of windows which contain scroll-bars and a scrollable
;;; area.
;;;
;;; ----------------------------------------------------------------------------------
(in-package :wb)
(export '(host-window))
(defvar *default-host* (short-site-name)
"The default host for the X window system.")
(defclass host-window (scrolling-window)
((host-window :accessor host-window)
(gcontext :accessor gcontext :documentation "The graphics context.")
(current-position :accessor current-position
:documentation "The pen position.")))
(defmethod initialize-instance ((self host-window)
&key
(host *default-host*)
(font *normal-graphics-font*)
(left 0)
(top 0)
(width 0)
(height 0)
(title "Canvas"))
(unwind-protect
(let* (
(display (xlib:open-display host))
(screen (xlib:display-default-screen display))
(text-font (xlib:open-font display
(canvas-font-to-host-font font)))
(black (xlib:screen-black-pixel screen))
(white (xlib:screen-white-pixel screen))
(window (xlib:create-window
:parent
(xlib:screen-root screen)
:x left :y top
:width width :height height
:background black
:border white
:border-width 1
:colormap
(xlib:screen-default-colormap
screen)
:bit-gravity :center
:event-mask
(xlib:make-event-mask
:exposure :button-press
:enter-window
)))
(gcontext (xlib:create-gcontext :drawable window
:background black
:foreground white
:font text-font))
)
(setf (host-window self) window)
(setf (gcontext self) gcontext)
(setf (current-position self) (list 0 0))
#| (unless (xlib:display-after-function (xlib:window-display window))
(setf (xlib:display-after-function (xlib:window-display window))
#'xlib:display-finish-output))
|#
(xlib:set-wm-properties window
:name title
:icon-name title
:resource-name "Canvas"
:resource-class 'make-canvas
:x left :y top :width width :height height
:min-width width :min-height height
:input :off :initial-state :normal)
(xlib:map-window window)
(call-next-method)
;;(mp:process-run-function "Quail Canvas Event Handler" #'event-handler self)
)))
| 3,937 | Common Lisp | .cl | 92 | 29.141304 | 87 | 0.441015 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 983a5f5dcebd9891ca58804bbdf3d4f9684a134101d44f6111f0952d0cc12c67 | 32,868 | [
-1
] |
32,869 | host-draw-clx.lsp | rwoldford_Quail/source/window-basics/host/test/host-draw-clx.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; host-draw-clx.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; Copyright (c) 1991 Statistical Computing Laboratory, University of Waterloo
;;;
;;;
;;; Authors:
;;; R.W. Oldford 1991.
;;; Modified by C. Hurley 9/21/92 for consistency with MCL2.0
;;; (from change history on Quickdraw.lisp:
;;
;; Earlier Mod history
;;
;; 10/16/91 bill PSZ's simplification of with-rectangle-arg
;; ------------- 2.0b3
;; 08/26/91 bill downward-function -> dynamic-extent
;; 08/17/91 bill (pset x :record.slot v) -> (setf (pref x :record.slot) v)
;; No more (require-interface :quickdraw), autoloading is faster.
;; 07/09/91 bill rref & rset -> pref/href & pset/hset
;; ------------- 2.0b2
;; 02/20/91 bill with-pointers in copy-bits, *32-bit-qd-pen-modes* in mode-arg
;;--------------- 2.0b1
;;
;;;
;;;--------------------------------------------------------------------------------
(in-package :host-draw)
(defun make-point (x &optional y)
"Returns a point having x and y as its coordinates."
(if y
(list x y)
x))
(export '(make-point))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(export '(point-x point-y *hardcopy-ptr* pen-show pen-hide pen-shown-p
pen-position pen-size set-pen-size pen-mode set-pen-mode pen-pattern
set-pen-pattern set-pen-color move-to move line-to line draw-line
draw-rectangle draw-inside-rectangle draw-filled-rectangle
erase-rect invert-rectangle draw-ellipse draw-filled-ellipse draw-arc
fill-arc erase-arc invert-arc fill-arc draw-polygon
draw-filled-polygon make-bitmap copy-bits origin set-origin
draw-string draw-char)
)
(defun point-x (point)
"Returns the x coordinate of point."
(first point))
(defun point-y (point)
"Returns the x coordinate of point."
(second point))
(defvar *hardcopy-ptr*
NIL
"A system dependent pointer to an open printer device.")
#|
(defmacro with-rectangle-arg ((var left &optional top right bottom) &body body)
"Takes a rectangle, two points, or four coordinates and makes a rectangle. ~
Body is evaluated with VAR bound to that rectangle."
(let ((left-var (make-symbol "LEFT"))
(top-var (make-symbol "TOP"))
(right-var (make-symbol "RIGHT"))
(bottom-var (make-symbol "BOTTOM")))
`(let ((,left-var ,left)
(,top-var ,top)
(,right-var ,right)
(,bottom-var ,bottom))
(call-with-rectangle-arg
#'(lambda (,var)
(declare (dynamic-extent))
,@body)
,left-var ,top-var ,right-var ,bottom-var))))
(defun call-with-rectangle-arg (thunk left top right bottom)
(rlet ((var :rect))
(cond (bottom
(setf (pref var rect.topleft) (ccl::make-point left top))
(setf (pref var rect.bottomright) (ccl::make-point right bottom)))
(right
(quail-error "Illegal rectangle arguments: ~s ~s ~s ~s"
left top right bottom))
(top
(setf (pref var rect.topleft) (ccl::make-point left nil))
(setf (pref var rect.bottomright) (ccl::make-point top nil)))
(t (%setf-macptr var left)))
(funcall thunk var)))
;;BOOLEAN EXPRESSIONS FOR THIS??
(defvar *32-bit-qd-pen-modes*
'((:blend . 32)
(:addPin . 33)
(:addOver . 34)
(:subPin . 35)
(:transparent . 36)
(:adMax . 37)
(:subOver . 38)
(:adMin . 39)
(:hilite . 50)))
(defun mode-arg (thing)
(or
(and (fixnump thing) (<= 0 thing 64) thing)
(position thing *pen-modes*)
(cdr (assq thing *32-bit-qd-pen-modes*))
(quail-error "Unknown pen mode: ~a" thing)))
|#
(defun pen-show (canvas)
nil)
(defun pen-hide (canvas)
nil)
(defun pen-shown-p (canvas)
nil)
(defun pen-position (canvas)
(wb::current-position canvas))
(defun pen-size (canvas)
(xlib:gcontext-line-width (wb::gcontext canvas)))
(defun set-pen-size (canvas h &optional v)
(unless h (setq h 1))
(if v
(xlib::set-gcontext-line-width (wb::gcontext canvas) h)
(xlib::set-gcontext-line-width (wb::gcontext canvas) (car h))))
(defun pen-mode (canvas)
(elt *pen-modes* (xlib:gcontext-function (wb::gcontext canvas))))
(defun set-pen-mode (canvas new-mode)
(xlib::set-gcontext-function (wb::gcontext canvas) new-mode))
#|
(defun pen-pattern (canvas &optional
(save-pat (make-record (:pattern :storage :pointer))))
(copy-record
(pref (or *hardcopy-ptr* (wptr canvas))
windowRecord.pnPat) (:pattern :storage :pointer) save-pat))
|#
(defun set-pen-pattern (canvas new-pattern)
(set-pen-color canvas new-pattern))
(defun set-pen-color (canvas new-color)
(let* ((gcontext (wb::gcontext canvas))
(display (xlib::gcontext-display gcontext))
(screen (xlib::display-default-screen display))
(colormap (xlib::screen-default-colormap screen))
(my-new-color (xlib::alloc-color colormap new-color)))
(xlib::set-gcontext-foreground gcontext my-new-color))
new-color)
; ----------------------------
(defun move-to (canvas h &optional v)
(if v
(setf (wb::current-position canvas) (list h v))
(setf (wb::current-position canvas) h)))
(defun move (canvas h &optional v)
(if v
(setq h (+ h (point-x (wb::current-position canvas)))
v (+ v (point-y (wb::current-position canvas)))))
(setq v (+ (second h) (point-y (wb::current-position canvas)))
h (+ (first h) (point-x (wb::current-position canvas))))
(move-to canvas x y))
(defun line-to (canvas h &optional v)
(let ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas))
(x1 (point-x (wb::current-position canvas)))
(y1 (point-y (wb::current-position canvas))))
(unless v
(setq v (second h) h (first h)))
(xlib:draw-line window gcontext x1 y1 h v))
(move-to canvas h v))
(defun line (canvas h &optional v)
(let ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas))
(x1 (point-x (wb::current-position canvas)))
(y1 (point-y (wb::current-position canvas))))
(unless v
(setq v (second h) h (first h)))
(xlib:draw-line window gcontext x1 y1 h v t))
(move-to canvas h v))
(defun draw-line (canvas x1 y1 x2 y2)
(let ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas)))
(xlib:draw-line window gcontext x1 y1 x2 y2))
(move-to canvas x2 y2))
(defun draw-rectangle (canvas x1 x2 y1 y2)
(let ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas))
(width (- x2 x1))
(height (- y2 y1)))
(xlib:draw-rectangle window gcontext x1 y1 width height))
(move-to canvas x1 y1))
(defun draw-inside-rectangle (canvas left &optional top right bot)
(let* ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas))
(x1 (+ left 1))
(y1 (+ top 1))
(width (- right x1 1))
(height (- bot y1 1)))
(xlib:draw-rectangle window gcontext x1 y1 width height)
(move-to canvas x1 y1)))
(defun draw-filled-rectangle (canvas left &optional top right bot)
(let ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas))
(width (- right left))
(height (- bot top)))
(xlib:draw-rectangle window gcontext left top width height t))
(move-to canvas left top))
(defun erase-rect (canvas left &optional top right bot)
(let* ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas))
(width (- right left))
(height (- bot top))
(fore (xlib:gcontext-foreground gcontext))
(back (xlib:gcontext-background gcontext))
(old-fcn (xlib:gcontext-function gcontext)))
(xlib::set-gcontext-foreground gcontext back)
(xlib::set-gcontext-function gcontext boole-1)
(xlib:draw-rectangle window gcontext left top width height t)
(xlib::set-gcontext-foreground gcontext fore)
(xlib::set-gcontext-function gcontext old-fcn))
(move-to canvas left top))
(defun invert-rectangle (canvas left &optional top right bot)
(let* ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas))
(width (- right left))
(height (- bot top))
(old-fcn (xlib:gcontext-function gcontext)))
(xlib::set-gcontext-function gcontext boole-c2)
(xlib:draw-rectangle window gcontext left top width height t)
(xlib::set-gcontext-function gcontext old-fcn))
(move-to canvas left top))
(defun draw-ellipse (canvas left &optional top right bot)
(let ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas))
(width (- right left))
(height (- bot top)))
(xlib:draw-arc window gcontext left top width height 0 7 nil))
(move-to canvas left top))
(defun draw-filled-ellipse (canvas left &optional top right bot)
(let ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas))
(width (- right left))
(height (- bot top)))
(xlib:draw-arc window gcontext left top width height 0 7 t))
(move-to canvas left top))
;;;
;;; Arcs
;;;
;;;
;;; The following exists because we prefer to work with radii
;;; ... rwo
(defun radii-to-rect (x-centre y-centre x-radius y-radius)
"From the ellipse defined by x-centre y-centre x-radius y-radius ~
computes and returns ~
multiple-values left top width height giving the coordinate ~
information on the enclosing rectangle of the ellipse."
(let (left top width height)
(setf left (- x-centre x-radius))
(setf top (- y-centre y-radius)) ;inverted y coord system
(setf width (* 2 x-radius))
(setf height (* 2 y-radius))
(values left top width height)))
(defun draw-arc (canvas start-angle arc-angle
x-centre y-centre x-radius y-radius)
(let ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas)))
(multiple-value-bind
(left top width height)
(radii-to-rect x-centre y-centre x-radius y-radius)
(xlib:draw-arc window gcontext
left top width height start-angle arc-angle)
(move-to canvas left top))))
(defun fill-arc (canvas start-angle arc-angle
x-centre y-centre x-radius y-radius)
(let ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas)))
(multiple-value-bind
(left top width height)
(radii-to-rect x-centre y-centre x-radius y-radius)
(xlib:draw-arc window gcontext
left top width height start-angle arc-angle t)
(move-to canvas left top))))
(defun erase-arc (canvas start-angle arc-angle
x-centre y-centre x-radius y-radius)
(let* ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas))
(fore (xlib:gcontext-foreground gcontext))
(back (xlib:gcontext-background gcontext))
(old-fcn (xlib:gcontext-function gcontext)))
(multiple-value-bind
(left top width height)
(radii-to-rect x-centre y-centre x-radius y-radius)
(xlib::set-gcontext-foreground gcontext back)
(xlib::set-gcontext-function gcontext boole-1)
(xlib:draw-arc window gcontext
left top width height start-angle arc-angle t)
(xlib::set-gcontext-foreground gcontext fore)
(xlib::set-gcontext-function gcontext old-fcn)
(move-to canvas left top))))
(defun invert-arc (canvas start-angle arc-angle
x-centre y-centre x-radius y-radius)
(let* ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas))
(old-fcn (xlib:gcontext-function gcontext)))
(multiple-value-bind
(left top width height)
(radii-to-rect x-centre y-centre x-radius y-radius)
(xlib::set-gcontext-function gcontext boole-c2)
(xlib:draw-arc window gcontext left top width height start-angle arc-angle t)
(xlib::set-gcontext-function gcontext old-fcn)
(move-to canvas left top))))
(defun draw-polygon (canvas list-of-points)
(let ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas)))
(xlib:draw-lines window gcontext list-of-points))
(move-to c (first list-of-points)))
(defun draw-filled-polygon (canvas list-of-points)
(let ((window (wb::host-window canvas))
(gcontext (wb::gcontext canvas)))
(xlib:draw-lines window gcontext list-of-points :fill-p t :shape :convex))
(move-to c (first list-of-points)))
#|
(defun make-bitmap (left &optional top right bottom &aux rowbytes bm)
(with-rectangle-arg (r left top right bottom)
(setq rowbytes
(logand
#xfffe
(+ 2 (ash (- (pref r rect.right) (pref r rect.left) 1) -3))))
(setq bm
(#_NewPtr :check-error
(+ 14 (* rowbytes (- (pref r rect.bottom) (pref r rect.top))))))
(setf (pref bm bitmap.bounds) r)
(setf (pref bm bitmap.rowbytes) rowbytes)
(setf (pref bm bitmap.baseaddr) (%inc-ptr bm 14)))
bm)
(defun copy-bits (source-bitmap dest-bitmap source-rect dest-rect
&optional (mode 0) mask-region)
(with-macptrs ((mask-region (if mask-region mask-region (%null-ptr))))
(#_CopyBits source-bitmap
dest-bitmap
source-rect
dest-rect
(mode-arg mode)
(or mask-region (%null-ptr)))))
(defun draw-string (canvas string)
"Draws a string on the canvas at the current position with ~
current font and colour."
(let (font-face mode-size)
(multiple-value-setq (font-face mode-size)
(view-font-codes canvas))
(with-font-codes font-face mode-size
(with-pstrs ((pstring string))
(#_DrawString pstring)))
))
(defun draw-char (canvas char)
(draw-string canvas (string char)))
|#
(provide 'host-draw)
(pushnew :host-draw *features*)
| 13,936 | Common Lisp | .cl | 349 | 34.332378 | 84 | 0.631345 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | bacbb7d9fb4503d38cdf15e636ea19b2eaae5dba2d1dbf7ca072b6a635251c0d | 32,869 | [
-1
] |
32,870 | host-menu-canvas-clx.lsp | rwoldford_Quail/source/window-basics/host/test/host-menu-canvas-clx.lsp | (in-package :wb)
(defclass host-menu-canvas ()
((menu-bar :initarg :menu-bar
:initform NIL
:accessor menu-bar-of)))
(defun install-menu-bar (canvas)
(let ((left (canvas-get-title-menu canvas :key :left))
(middle (canvas-get-title-menu canvas :key :middle))
(right (canvas-get-title-menu canvas :key :right))
(ctrl-left (canvas-get-title-menu canvas :key :ctrl-left))
(ctrl-middle (canvas-get-title-menu canvas :key :ctrl-middle))
(ctrl-right (canvas-get-title-menu canvas :key :ctrl-right))
(display (xlib::drawable-display (host-window canvas)))
menus menu-bar)
(when ctrl-right
(push ctrl-right menus))
(when ctrl-middle
(push ctrl-middle menus))
(when ctrl-left
(push ctrl-left menus))
(when right
(push right menus))
(when middle
(push middle menus))
(when left
(push left menus))
(when menus
(setf menu-bar (make-instance 'wb-menu
:display display
:title NIL
:type :pop-up
:font *default-menu-font*
:canvas canvas))
(set-menu-fns menu-bar :selected (when-selected-fn-of (first menus))
:held (when-held-fn-of (first menus))
:unheld (when-unheld-fn-of (first menus))
:sub-item (sub-item-fn-of (first menus)))
(dolist (menu menus)
(setf (parent-menu-of menu) menu-bar)
(xlib::reparent-window (item-window-of menu) (window-of menu-bar) 0 0)
(setf (items-alist-of menu-bar) (nconc (items-alist-of menu-bar) (items-alist-of menu))))
(push (list (item-window-of menu-bar) menu-bar) (items-alist-of menu-bar))
(setf (items-of menu-bar) menus)
(menu-compute-geometry menu-bar)
(setf (event-handler-of menu-bar)
(mp:process-run-function "Quail Canvas Event Handler"
#'event-handler canvas))
(setf (menu-bar-of canvas) menu-bar)
(menu menu-bar (make-position 300 300))
menu-bar)))
| 1,994 | Common Lisp | .cl | 50 | 32.5 | 98 | 0.624614 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | b901ffccd547a0886a119c54ba4597a1d8bc4d86c3b5b7027fb0cd4fdbc292c7 | 32,870 | [
-1
] |
32,871 | lines-mcl.lsp | rwoldford_Quail/source/window-basics/fast-graphics/lines-mcl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; lines-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is an addition to Window-basics for moving pointclouds
;;;
;;;
;;; Authors:
;;; H.A. Chipman 1991
;;; C.B. Hurley 1991 George Washington University
;;; R.W. Oldford 1992
;;;
;;;
;;;
;;;
;;;----------------------------------------------------------------------------------
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute)
(export '(canvas-draw-lines canvas-erase-lines canvas-move-lines)))
;; coords are lists with even length (s1 e1 s2 e2...) where s1 and e1 are the start
;; and end of the first line
(defun draw-fw-lines (canvas coords &key (width 1)
color invisible?
erase? &allow-other-keys)
"Draws or erases colored fixed width lines"
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(type fixnum width))
(with-focused-canvas canvas
(choose-mode canvas :erase? erase?)
(set-draw-color canvas color)
(#_PenSize :long (ccl::make-point width width))
(loop with h = (canvas-height canvas)
for (xs ys) fixnum in coords by #'cddr
for (xe ye) fixnum in (cdr coords) by #'cddr
for i in invisible?
unless i
do (fast-draw-line canvas xs (- h ys) xe (- h ye)))))
(defun xor-move-fw-lines (canvas old-coords new-coords
&key (width 1) color invisible? &allow-other-keys )
"Moves colored fixed width lines~
Results with color background are undefined"
(declare (special *host-xor-mode*)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(type fixnum width))
(set-pen-color canvas color)
(with-focused-canvas canvas
(#_PenMode *host-xor-mode*)
(#_PenSize :long (ccl::make-point width width))
(loop with h = (canvas-height canvas)
for (sx1 sy1 ) fixnum in old-coords by #'cddr
for (ex1 ey1 ) fixnum in (cdr old-coords) by #'cddr
for (sx2 sy2 ) fixnum in new-coords by #'cddr
for (ex2 ey2 ) fixnum in (cdr new-coords) by #'cddr
for i in invisible?
unless i
do (fast-draw-line canvas sx1 (- h sy1) ex1 (- h ey1))
(fast-draw-line canvas sx2 (- h sy2) ex2 (- h ey2)))))
(defun move-fw-lines (canvas old-coords new-coords
&key (width 1) color invisible? &allow-other-keys )
"Moves colored fixed width lines"
(declare (special *host-or-mode* *host-bic-mode*)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(type fixnum width))
(set-draw-color canvas color)
(with-focused-canvas canvas
(#_PenSize :long (ccl::make-point width width))
(loop with h = (canvas-height canvas)
for (sx1 sy1 ) fixnum in old-coords by #'cddr
for (ex1 ey1 ) fixnum in (cdr old-coords) by #'cddr
for (sx2 sy2 ) fixnum in new-coords by #'cddr
for (ex2 ey2 ) fixnum in (cdr new-coords) by #'cddr
for i in invisible?
unless i
do
(mode-draw-line canvas sx1 (- h sy1) ex1 (- h ey1) *host-bic-mode*)
(mode-draw-line canvas sx2 (- h sy2) ex2 (- h ey2) *host-or-mode*))))
(defun draw-multi-color-lines (canvas coords &key (width 1) color invisible? erase? &allow-other-keys)
"Draws or erases lines with varying color."
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(type fixnum width))
(with-focused-canvas canvas
(#_PenSize :long (ccl::make-point width width))
(choose-mode canvas :erase? erase?)
(loop with h = (canvas-height canvas)
for (xs ys ) fixnum in coords by #'cddr
for (xe ye ) fixnum in (cdr coords) by #'cddr
for c in color
for i in invisible?
unless i
do (set-draw-color canvas c)
(fast-draw-line canvas xs (- ys h) xe (- ye h)))))
(defun xor-move-multi-color-lines (canvas old-coords new-coords
&key (width 1) color invisible? &allow-other-keys )
"Moves lines with varying color. ~
Results with color background are undefined."
(declare (special *host-xor-mode*)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(type fixnum width))
(with-focused-canvas canvas
(#_PenMode *host-xor-mode*)
(#_PenSize :long (ccl::make-point width width))
(loop with h = (canvas-height canvas)
for (sx1 sy1 ) fixnum in old-coords by #'cddr
for (ex1 ey1 ) fixnum in (cdr old-coords) by #'cddr
for (sx2 sy2 ) fixnum in new-coords by #'cddr
for (ex2 ey2 ) fixnum in (cdr new-coords) by #'cddr
for c in color
for i in invisible?
unless i
do
(set-draw-color canvas c)
(fast-draw-line canvas sx1 (- h sy1) ex1 (- h ey1))
(fast-draw-line canvas sx2 (- h sy2) ex2 (- h ey2)))))
(defun move-multi-color-lines (canvas old-coords new-coords
&key (width 1)
color rgb-color? invisible? &allow-other-keys )
"Moves lines with varying color."
(declare (special *black-color* *host-or-mode* *host-bic-mode*)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(type fixnum width))
(with-focused-canvas canvas
(#_PenSize :long (ccl::make-point width width))
(loop with h = (canvas-height canvas)
for (sx1 sy1 ) fixnum in old-coords by #'cddr
for (ex1 ey1 ) fixnum in (cdr old-coords) by #'cddr
for (sx2 sy2 ) fixnum in new-coords by #'cddr
for (ex2 ey2 ) fixnum in (cdr new-coords) by #'cddr
for c in color
for i in invisible?
unless i
do
(if rgb-color?
(cc-set-rgb-color c)
(set-draw-color canvas c))
(mode-draw-line canvas sx1 (- h sy1) ex1 (- h ey1) *host-bic-mode*)
(mode-draw-line canvas sx2 (- h sy2) ex2 (- h ey2) *host-or-mode*))))
(defun draw-multi-color-&-width-lines (canvas coords &key width color invisible? erase? &allow-other-keys)
"Draws or erases lines with varying color and width."
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(type fixnum width))
(with-focused-canvas canvas
(choose-mode canvas :erase? erase?)
(loop with h = (canvas-height canvas)
for (xs ys ) fixnum in coords by #'cddr
for (xe ye ) fixnum in (cdr coords) by #'cddr
for w in width for c in color
for i in invisible?
unless i
do (set-draw-color canvas c)
(#_PenSize :long (ccl::make-point w w))
(fast-draw-line canvas xs (- ys h) xe (- ye h)))))
(defun xor-move-multi-color-&-width-lines (canvas old-coords new-coords
&key width color invisible? &allow-other-keys )
"Moves lines with varying color and width~
Results with color background are undefined."
(declare (special *host-xor-mode*)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(type fixnum width))
(with-focused-canvas canvas
(#_PenMode *host-xor-mode*)
(loop with h = (canvas-height canvas)
for (sx1 sy1 ) fixnum in old-coords by #'cddr
for (ex1 ey1 ) fixnum in (cdr old-coords) by #'cddr
for (sx2 sy2 ) fixnum in new-coords by #'cddr
for (ex2 ey2 ) fixnum in (cdr new-coords) by #'cddr
for w in width for c in color
for i in invisible?
unless i
do (set-draw-color canvas c)
(#_PenSize :long (ccl::make-point w w))
(fast-draw-line canvas sx1 (- h sy1) ex1 (- h ey1))
(fast-draw-line canvas sx2 (- h sy2) ex2 (- h ey2)))))
(defun move-multi-color-&-width-lines
(canvas old-coords new-coords &key width color rgb-color? invisible? &allow-other-keys )
"Moves lines with varying color and width"
(declare (special *black-color* *host-or-mode* *host-bic-mode*)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(type fixnum width))
(with-focused-canvas canvas
(loop with h = (canvas-height canvas)
for (sx1 sy1 ) fixnum in old-coords by #'cddr
for (ex1 ey1 ) fixnum in (cdr old-coords) by #'cddr
for (sx2 sy2 ) fixnum in new-coords by #'cddr
for (ex2 ey2 ) fixnum in (cdr new-coords) by #'cddr
for w in width for c in color
for i in invisible?
unless i
do
(if rgb-color?
(cc-set-rgb-color c)
(set-draw-color canvas c))
(#_PenSize :long (ccl::make-point w w))
(mode-draw-line canvas sx1 (- h sy1) ex1 (- h ey1) *host-bic-mode*)
(mode-draw-line canvas sx2 (- h sy2) ex2 (- h ey2) *host-or-mode*))))
(defun canvas-draw-lines (canvas coords
&key (width 1) (erase? nil)
color invisible?
&allow-other-keys )
"Draws or erases lines "
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(type fixnum width))
(if (and color (listp color))
(if (and width (listp width))
(draw-multi-color-&-width-lines canvas coords :width width :color color
:invisible? invisible? :erase? erase?)
(draw-multi-color-lines canvas coords :width width :color color
:invisible? invisible? :erase? erase?))
(draw-fw-lines canvas coords
:width (if (listp width ) (car width) width)
:color color
:erase? erase?
:invisible? invisible?)
))
(defun canvas-erase-lines (canvas coords
&key (width 1)
color invisible?
&allow-other-keys )
"Erases lines "
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(type fixnum width)
(inline canvas-draw-lines))
(canvas-draw-lines canvas coords :width width :color color :erase? t
:invisible? invisible?))
(defun canvas-move-lines (canvas old-coords new-coords
&key (width 1) (rgb-color? nil)
color invisible?
&allow-other-keys )
"Moves lines "
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(type fixnum width))
(if (and color (listp color))
(if (and width (listp width))
(move-multi-color-&-width-lines canvas old-coords new-coords
:width width :invisible? invisible?
:color (if (and (colored-canvas-p canvas) (not rgb-color? ))
(rgb-colors color)
color))
(move-multi-color-lines canvas old-coords new-coords
:width width :invisible? invisible?
:color (if (and (colored-canvas-p canvas) (not rgb-color? ))
(rgb-colors color (pen-color-of canvas))
color)))
(move-fw-lines canvas old-coords new-coords
:width (if (listp width ) (car width) width)
:invisible? invisible?
:color color)
)
)
(defun canvas-draw-axes (canvas axes
&key (width 1) (erase? nil)
color)
"Draws or erases axes"
(declare (special *host-or-mode* *host-bic-mode*)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(type fixnum width))
(when axes
(with-focused-canvas canvas
(if erase? (#_PenMode *host-bic-mode*)
(#_PenMode *host-or-mode*))
(set-draw-color canvas color)
(#_PenSize :long (ccl::make-point width width))
(loop with h = (canvas-height canvas)
with xo = (caar axes)
with yo = (- h (cadar axes ) )
for (x y ) fixnum in (cdr axes)
do (fast-draw-line canvas xo yo x (- h y))))))
(defun canvas-erase-axes (canvas axes
&key (width 1)
color)
"Erases axes "
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(type fixnum width)
(inline canvas-draw-axes))
(canvas-draw-axes canvas axes :width width :color color ))
(defun canvas-move-axes (canvas old-axes new-axes
&key (width 1)
color
&allow-other-keys )
"Moves axes "
(declare (special *host-or-mode* *host-bic-mode*)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(type fixnum width))
(when old-axes
(set-draw-color canvas color)
(with-focused-canvas canvas
(#_PenSize :long (ccl::make-point width width))
(loop with h = (canvas-height canvas)
with xo = (caar new-axes)
with yo = (- h (cadar new-axes ) )
for (x-old y-old ) fixnum in (cdr old-axes)
for (x y ) fixnum in (cdr new-axes)
do
(mode-draw-line canvas xo yo x-old (- h y-old) *host-bic-mode*)
(mode-draw-line canvas xo yo x(- h y) *host-or-mode*)))))
| 14,930 | Common Lisp | .cl | 315 | 34.022222 | 107 | 0.524618 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 5bcc9c501d73bd1bda1cedc4f6ec778a222551e2c2aea5dc3998125ea7ee48cc | 32,871 | [
-1
] |
32,872 | symbols-clx.lsp | rwoldford_Quail/source/window-basics/fast-graphics/symbols-clx.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; symbols-clx.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is an addition to Window-basics for moving pointclouds
;;;
;;;
;;; Authors:
;;; H.A. Chipman 1991
;;; C.B. Hurley 1991 George Washington University
;;; N.G. Bennett 1993
;;;
;;;
;;;
;;;
;;;----------------------------------------------------------------------------------
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(canvas-draw-symbol canvas-draw-symbols
canvas-erase-symbols canvas-move-symbols)))
(defun rgb-colors (colors)
(loop for c in colors collect (if c (get-rgb-color c))))
(defun choose-mode (canvas &key (erase? nil))
(declare
(special *host-or-mode* *host-bic-mode*)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(if erase? (xlib::set-gcontext-function (gcontext canvas) *host-bic-mode*)
(xlib::set-gcontext-function (gcontext canvas) *host-or-mode*)))
(defun draw-single-color-symbols
(canvas points
&key size symbol fill? color (erase? nil) invisible?
&allow-other-keys)
"Draws or erases colored symbols with varying size, symbol fill? invisible?."
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
)
(with-focused-canvas canvas
(choose-mode canvas :erase? erase?)
(set-draw-color canvas color)
(loop with h = (canvas-height canvas)
for (x y ) fixnum in points
for sim in symbol
for fill in fill?
for s fixnum in size
for i in invisible?
unless i
do
(fast-draw-symbol canvas sim x (- h y) s fill))))
(defun xor-move-single-color-symbols
(canvas old new
&key size (old-size size) fill? (old-fill? fill?)
symbol (old-symbol symbol) color invisible?
&allow-other-keys)
"Moves colored (shaded) symbols with varying size, symbol fill? invisible?.~
Results with color background are undefined."
(declare (special *host-xor-mode*)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(set-pen-color canvas color)
(with-focused-canvas canvas
(xlib::set-gcontext-function (gcontext canvas) *host-xor-mode*)
(loop with h = (canvas-height canvas)
for (xo yo ) fixnum in old
for (x y ) fixnum in new
for sim in symbol for simo in old-symbol
for fill in fill? for fillo in old-fill?
for s fixnum in size for so fixnum in old-size
for i in invisible?
unless i
do
(fast-draw-symbol canvas simo xo (- h yo) so fillo)
(fast-draw-symbol canvas sim x (- h y) s fill))))
(defun move-single-color-symbols
(canvas old new
&key size (old-size size) fill? (old-fill? fill?)
symbol (old-symbol symbol) color invisible?
&allow-other-keys)
"Moves colored symbols with varying size, symbol fill? invisible?."
(declare (special *host-or-mode* *host-bic-mode*)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(with-focused-canvas canvas
(set-draw-color canvas color)
(loop with h = (canvas-height canvas)
for (xo yo ) fixnum in old
for (x y ) fixnum in new
for sim in symbol for simo in old-symbol
for fill in fill? for fillo in old-fill?
for s fixnum in size for so fixnum in old-size
for i in invisible?
unless i
do (mode-draw-symbol canvas
simo xo (- h yo) so fillo *host-bic-mode*)
(mode-draw-symbol canvas
sim x (- h y) s fill *host-or-mode*))))
(defun draw-multi-color-symbols
(canvas points
&key size symbol fill? color invisible?
&allow-other-keys)
"Draws or erases symbols with varying size, symbol fill? color invisible?."
(declare (special *host-or-mode*)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(with-focused-canvas canvas
(xlib::set-gcontext-function (gcontext canvas) *host-or-mode*)
(loop with h = (canvas-height canvas)
for (x y ) fixnum in points
for sim in symbol
for fill in fill?
for s fixnum in size
for c in color
for i in invisible?
unless i
do
(set-draw-color canvas c)
(fast-draw-symbol canvas sim x (- h y) s fill))))
(defun xor-move-multi-color-symbols
(canvas old new
&key size (old-size size) fill? (old-fill? fill?)
invisible?
symbol (old-symbol symbol) color &allow-other-keys)
"Moves symbols with varying size, symbol fill? color invisible?.~
Results with color background are undefined."
;; move symbols with varying
;; size, symbol fill?, color (shade), invisible?
;; results with color background are undefined
(declare (special *host-xor-mode*)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(with-focused-canvas canvas
(xlib::set-gcontext-function (gcontext canvas) *host-xor-mode*)
(loop with h = (canvas-height canvas)
for (xo yo ) fixnum in old
for (x y ) fixnum in new
for sim in symbol for simo in old-symbol
for fill in fill? for fillo in old-fill?
for s fixnum in size for so fixnum in old-size
for c in color
for i in invisible?
unless i do
(set-draw-color canvas c)
(fast-draw-symbol canvas simo xo (- h yo) so fillo )
(fast-draw-symbol canvas sim x (- h y) s fill )) ))
(defun move-multi-color-symbols
(canvas old new
&key size (old-size size) fill? (old-fill? fill?) invisible?
symbol (old-symbol symbol) color rgb-color?
&allow-other-keys)
"Moves symbols with varying size, symbol fill? color invisible?."
(declare (special *host-or-mode* *host-bic-mode*)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(with-focused-canvas canvas
(loop with h = (canvas-height canvas)
for (xo yo ) fixnum in old
for (x y ) fixnum in new
for sim in symbol for simo in old-symbol
for fill in fill? for fillo in old-fill?
for s fixnum in size for so fixnum in old-size
for c in color
for i in invisible?
unless i do
(if rgb-color?
(cc-set-rgb-color canvas c)
(set-draw-color canvas c))
(mode-draw-symbol canvas simo xo (- h yo) so fillo *host-bic-mode* )
(mode-draw-symbol canvas sim x (- h y) s fill *host-or-mode* )
)))
(defun canvas-draw-symbols (canvas points
&key size symbol color fill? invisible?
(erase? nil) single-color?
&allow-other-keys)
"Draws or erases symbols with varying size, symbol fill? color invisible?."
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
)
(if (or erase? single-color?)
(draw-single-color-symbols canvas points
:size size :symbol symbol
:color (car color)
:fill? fill?
:invisible? invisible?
:erase? erase?)
(draw-multi-color-symbols canvas points
:size size :symbol symbol
:color color
:fill? fill?
:invisible? invisible?
:erase? erase?)))
(defun canvas-erase-symbols (canvas points
&key size symbol color fill? invisible? single-color?
&allow-other-keys)
"Erases symbols with varying size symbol fill? color invisible? and flag ~
single-color? identifying whether they are all of one colour or not."
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(canvas-draw-symbols canvas points :size size :symbol symbol
:color color :fill? fill? :invisible? invisible?
:single-color? single-color?
:erase? t))
(defun canvas-move-symbols (canvas old-points new-points
&key size symbol color fill? invisible?
(old-size size)
(old-symbol symbol)
old-color
rgb-color? single-color?
(old-fill? fill?)
&allow-other-keys)
"Moves symbols with varying size, symbol fill? color invisible?."
(declare (ignore old-color)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(if single-color?
(move-single-color-symbols canvas old-points new-points
:size size :symbol symbol :fill? fill?
:old-size old-size :old-symbol old-symbol
:invisible? invisible?
:old-fill? old-fill? :color (car color ))
(move-multi-color-symbols canvas old-points new-points
:size size :symbol symbol :fill? fill?
:old-size old-size :old-symbol old-symbol
:old-fill? old-fill?
:invisible? invisible?
:rgb-color? t
:color (if (not rgb-color? )
(rgb-colors color) color)
)))
(defun canvas-draw-symbol
(canvas x y
&key size symbol fill? color erase?
&allow-other-keys)
"Draw symbol using size symbol fill? color and erase?"
(declare (special *host-or-mode* )
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(with-focused-canvas canvas
(if (colored-canvas-p canvas)
(setq color (get-rgb-color color)))
(choose-mode canvas :erase? erase?)
(set-draw-color canvas color)
(fast-draw-symbol canvas symbol x (- (canvas-height canvas) y)
size fill?)))
| 11,683 | Common Lisp | .cl | 248 | 32.532258 | 105 | 0.512441 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | edb53ffa9bef9024f66b26b07961508da513acef0a5ddf9d2229c8029272f0bf | 32,872 | [
-1
] |
32,873 | symbols-mcl.lsp | rwoldford_Quail/source/window-basics/fast-graphics/symbols-mcl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; symbols-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is an addition to Window-basics for moving pointclouds
;;;
;;;
;;; Authors:
;;; H.A. Chipman 1991
;;; C.B. Hurley 1991 George Washington University
;;;
;;;
;;;
;;;
;;;----------------------------------------------------------------------------------
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute)
(export '(canvas-draw-symbol canvas-draw-symbols
canvas-erase-symbols canvas-move-symbols)))
(defun rgb-colors (colors &optional default)
(if default (setq default (get-rgb-color default)))
(if *color-available*
(loop for c in colors collect (or (and c (get-rgb-color c))
default))))
(defun choose-mode (canvas &key (erase? nil))
(declare (ignore canvas)
(special *host-or-mode* *host-bic-mode*)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(if erase? (#_PenMode *host-bic-mode*)
(#_PenMode *host-or-mode*)))
(defun draw-single-color-symbols
(canvas points
&key size symbol fill? color (erase? nil) invisible?
&allow-other-keys)
"Draws or erases colored symbols with varying size, symbol fill? invisible?."
(let* ((h (canvas-height canvas)))
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(type fixnum h)
)
(h-draw::with-rectangle-arg (r 0 0 1 1)
(with-focused-canvas canvas
(choose-mode canvas :erase? erase?)
(set-draw-color canvas color)
(loop
for (x y ) fixnum in points
for sim in symbol
for fill in fill?
for s fixnum in size
for i in invisible?
unless i
do
(fast-draw-symbol sim r x (- h y) s fill))))))
(defun xor-move-single-color-symbols
(canvas old new
&key size (old-size size) fill? (old-fill? fill?)
symbol (old-symbol symbol) color invisible?
&allow-other-keys)
"Moves colored (shaded) symbols with varying size, symbol fill? invisible?.~
Results with color background are undefined."
(declare (special *host-xor-mode*)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(set-pen-color canvas color)
(let* ((h (canvas-height canvas)))
(declare (type fixnum h))
(h-draw::with-rectangle-arg (r 0 0 1 1)
(with-focused-canvas canvas
(#_PenMode *host-xor-mode*)
(loop for (xo yo ) fixnum in old
for (x y ) fixnum in new
for sim in symbol for simo in old-symbol
for fill in fill? for fillo in old-fill?
for s fixnum in size for so fixnum in old-size
for i in invisible?
unless i
do
(fast-draw-symbol simo r xo (- h yo) so fillo)
(fast-draw-symbol sim r x (- h y) s fill))))))
(defun move-single-color-symbols
(canvas old new
&key size (old-size size) fill? (old-fill? fill?)
symbol (old-symbol symbol) color invisible?
&allow-other-keys)
"Moves colored symbols with varying size, symbol fill? invisible?."
(declare (special *host-or-mode* *host-bic-mode*)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(let* ((h (canvas-height canvas)))
(declare (type fixnum h))
(h-draw::with-rectangle-arg (r 0 0 1 1)
(with-focused-canvas canvas
(set-draw-color canvas color)
(loop for (xo yo ) fixnum in old
for (x y ) fixnum in new
for sim in symbol for simo in old-symbol
for fill in fill? for fillo in old-fill?
for s fixnum in size for so fixnum in old-size
for i in invisible?
unless i
do (mode-draw-symbol simo r xo (- h yo) so fillo *host-bic-mode*)
(mode-draw-symbol sim r x (- h y) s fill *host-or-mode*))))))
(defun draw-multi-color-symbols
(canvas points
&key size symbol fill? color invisible?
&allow-other-keys)
"Draws or erases symbols with varying size, symbol fill? color invisible?."
(declare (special *host-or-mode*)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(let* ((h (canvas-height canvas)))
(declare (type fixnum h))
(h-draw::with-rectangle-arg (r 0 0 1 1)
(with-focused-canvas canvas
(#_PenMode *host-or-mode*)
(loop
for (x y ) fixnum in points
for sim in symbol
for fill in fill?
for s fixnum in size
for c in color
for i in invisible?
unless i
do
(set-draw-color canvas c)
(fast-draw-symbol sim r x (- h y) s fill))))))
(defun xor-move-multi-color-symbols
(canvas old new
&key size (old-size size) fill? (old-fill? fill?)
invisible?
symbol (old-symbol symbol) color &allow-other-keys)
"Moves symbols with varying size, symbol fill? color invisible?.~
Results with color background are undefined."
;; move symbols with varying
;; size, symbol fill?, color (shade), invisible?
;; results with color background are undefined
(declare (special *host-xor-mode*)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(let* ((h (canvas-height canvas)))
(declare (type fixnum h))
(h-draw::with-rectangle-arg (r 0 0 1 1)
(with-focused-canvas canvas
(#_PenMode *host-xor-mode*)
(loop for (xo yo ) fixnum in old
for (x y ) fixnum in new
for sim in symbol for simo in old-symbol
for fill in fill? for fillo in old-fill?
for s fixnum in size for so fixnum in old-size
for c in color
for i in invisible?
unless i do
(set-draw-color canvas c)
(fast-draw-symbol simo r xo (- h yo) so fillo )
(fast-draw-symbol sim r x (- h y) s fill )) ))))
(defun move-multi-color-symbols
(canvas old new
&key size (old-size size) fill? (old-fill? fill?) invisible?
symbol (old-symbol symbol) color rgb-color?
&allow-other-keys)
"Moves symbols with varying size, symbol fill? color invisible?."
(declare (special *host-or-mode* *host-bic-mode*)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(let* ((h (canvas-height canvas)))
(declare (type fixnum h))
(h-draw::with-rectangle-arg (r 0 0 1 1)
(with-focused-canvas canvas
(loop for (xo yo ) fixnum in old
for (x y ) fixnum in new
for sim in symbol for simo in old-symbol
for fill in fill? for fillo in old-fill?
for s fixnum in size for so fixnum in old-size
for c in color
for i in invisible?
unless i do
(if rgb-color?
(cc-set-rgb-color c)
(set-draw-color canvas c))
(mode-draw-symbol simo r xo (- h yo) so fillo *host-bic-mode* )
(mode-draw-symbol sim r x (- h y) s fill *host-or-mode* )
)))))
(defun canvas-draw-symbols (canvas points
&key size symbol color fill? invisible?
(erase? nil) single-color?
&allow-other-keys)
"Draws or erases symbols with varying size, symbol fill? color invisible?."
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
)
(if (or erase? single-color?)
(draw-single-color-symbols canvas points
:size size :symbol symbol
:color (car color)
:fill? fill?
:invisible? invisible?
:erase? erase?)
(draw-multi-color-symbols canvas points
:size size :symbol symbol
:color color
:fill? fill?
:invisible? invisible?
:erase? erase?)))
(defun canvas-erase-symbols (canvas points
&key size symbol color fill? invisible? single-color?
&allow-other-keys)
"Erases symbols with varying size symbol fill? color invisible? and flag ~
single-color? identifying whether they are all of one colour or not."
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(canvas-draw-symbols canvas points :size size :symbol symbol
:color color :fill? fill? :invisible? invisible?
:single-color? single-color?
:erase? t))
(defun canvas-move-symbols (canvas old-points new-points
&key size symbol color fill? invisible?
(old-size size)
(old-symbol symbol)
old-color
rgb-color? single-color?
(old-fill? fill?)
&allow-other-keys)
"Moves symbols with varying size, symbol fill? color invisible?."
(declare (ignore old-color)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(if single-color?
(move-single-color-symbols canvas old-points new-points
:size size :symbol symbol :fill? fill?
:old-size old-size :old-symbol old-symbol
:invisible? invisible?
:old-fill? old-fill? :color (car color ))
(move-multi-color-symbols canvas old-points new-points
:size size :symbol symbol :fill? fill?
:old-size old-size :old-symbol old-symbol
:old-fill? old-fill?
:invisible? invisible?
:rgb-color? t
:color (if (not rgb-color? )
(rgb-colors color (pen-color-of canvas)) color)
)))
(defun canvas-draw-symbol
(canvas x y
&key size symbol fill? color erase?
&allow-other-keys)
"Draw symbol using size symbol fill? color and erase?"
(declare (special *host-or-mode* )
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(let* ((h (canvas-height canvas)))
(declare (type fixnum h))
(h-draw::with-rectangle-arg (r 0 0 1 1)
(with-focused-canvas canvas
(if (colored-canvas-p canvas)
(setq color (get-rgb-color color)))
(choose-mode canvas :erase? erase?)
(set-draw-color canvas color)
(fast-draw-symbol symbol r x (- h y) size fill?)))))
| 12,176 | Common Lisp | .cl | 265 | 31.8 | 90 | 0.508128 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 9deb180ce9ab0e820268b71925ddd1cc5fba41d4c13be9fc696df4d57a19c8aa | 32,873 | [
-1
] |
32,874 | lines-clx.lsp | rwoldford_Quail/source/window-basics/fast-graphics/lines-clx.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; lines-clx.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is an addition to Window-basics for moving pointclouds
;;;
;;;
;;; Authors:
;;; H.A. Chipman 1991
;;; C.B. Hurley 1991 George Washington University
;;; R.W. Oldford 1992
;;;
;;;
;;;
;;;
;;;----------------------------------------------------------------------------------
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(canvas-draw-lines canvas-erase-lines canvas-move-lines)))
;; coords are lists with even length (s1 e1 s2 e2...) where s1 and e1 are the start
;; and end of the first line
(defun draw-fw-lines (canvas coords &key (width 1)
color
erase? invisible? &allow-other-keys)
"Draws or erases colored fixed width lines"
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(type fixnum width))
(with-focused-canvas canvas
(choose-mode canvas :erase? erase?)
(set-draw-color canvas color)
(xlib::set-gcontext-line-width (gcontext canvas) width)
(xlib:draw-lines (host-window canvas) (gcontext canvas)
(let ((h (canvas-height canvas)))
(if invisible?
(loop for (xs ys) fixnum in coords by #'cddr
for i in invisible?
unless i do
collect (list xs (- h ys)))
(map 'list #'(lambda (x) (list (car x) (- h (cadr x)))) coords))))))
(defun xor-move-fw-lines (canvas old-coords new-coords
&key (width 1) color invisible? &allow-other-keys )
"Moves colored fixed width lines~
Results with color background are undefined"
(declare (special *host-xor-mode*)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(type fixnum width))
(set-pen-color canvas color)
(with-focused-canvas canvas
(xlib::set-gcontext-function (gcontext canvas) *host-xor-mode*)
(xlib::set-gcontext-line-width (gcontext canvas) width)
(let ((window (host-window canvas))
(gcontext (gcontext canvas))
(h (canvas-height canvas)))
(xlib:draw-lines
window gcontext
(if invisible?
(loop for (xs ys) fixnum in old-coords by #'cddr
for i in invisible?
unless i do
collect (list xs (- h ys)))
(map 'list #'(lambda (x) (list (car x) (- h (cadr x)))) old-coords)))
(xlib:draw-lines
window gcontext
(if invisible?
(loop for (xs ys) fixnum in new-coords by #'cddr
for i in invisible?
unless i do
collect (list xs (- h ys)))
(map 'list #'(lambda (x) (list (car x) (- h (cadr x)))) new-coords))))))
(defun move-fw-lines (canvas old-coords new-coords
&key (width 1) color invisible? &allow-other-keys )
"Moves colored fixed width lines"
(declare (special *host-or-mode* *host-bic-mode*)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(type fixnum width))
(set-draw-color canvas color)
(with-focused-canvas canvas
(let ((window (host-window canvas))
(gcontext (gcontext canvas))
(height (canvas-height canvas)))
(xlib::set-gcontext-line-width gcontext width)
(xlib::set-gcontext-function gcontext *host-bic-mode*)
(xlib:draw-lines
window gcontext
(if invisible?
(loop for (xs ys) fixnum in old-coords by #'cddr
for i in invisible?
unless i do
collect (list xs (- h ys)))
(map 'list #'(lambda (x) (list (car x) (- h (cadr x)))) old-coords)))
(xlib::set-gcontext-function gcontext *host-or-mode*)
(xlib:draw-lines
window gcontext
(if invisible?
(loop for (xs ys) fixnum in new-coords by #'cddr
for i in invisible?
unless i do
collect (list xs (- h ys)))
(map 'list #'(lambda (x) (list (car x) (- h (cadr x)))) new-coords))))))
(defun draw-multi-color-lines (canvas coords &key (width 1) color erase? invisible? &allow-other-keys)
"Draws or erases lines with varying color."
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(type fixnum width))
(with-focused-canvas canvas
(xlib::set-gcontext-line-width (gcontext canvas) width)
(choose-mode canvas :erase? erase?)
(loop with h = (canvas-height canvas)
for (xs ys ) fixnum in coords by #'cddr
for (xe ye ) fixnum in (cdr coords) by #'cddr
for c in color
for i in invisible?
unless i
do (set-draw-color canvas c)
(xlib:draw-line (host-window canvas)
(gcontext canvas)
xs (- ys h) xe (- ye h)))))
(defun xor-move-multi-color-lines (canvas old-coords new-coords
&key (width 1) color invisible? &allow-other-keys )
"Moves lines with varying color. ~
Results with color background are undefined."
(declare (special *host-xor-mode*)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(type fixnum width))
(with-focused-canvas canvas
(xlib::set-gcontext-function (gcontext canvas) *host-xor-mode*)
(xlib::set-gcontext-line-width (gcontext canvas) width)
(loop with h = (canvas-height canvas)
for (sx1 sy1 ) fixnum in old-coords by #'cddr
for (ex1 ey1 ) fixnum in (cdr old-coords) by #'cddr
for (sx2 sy2 ) fixnum in new-coords by #'cddr
for (ex2 ey2 ) fixnum in (cdr new-coords) by #'cddr
for c in color
for i in invisible?
unless i
do
(set-draw-color canvas c)
(draw-line (host-window canvas) (gcontext canvas) sx1 (- h sy1) ex1 (- h ey1))
(draw-line (host-window canvas) (gcontext canvas) sx2 (- h sy2) ex2 (- h ey2)))))
(defun move-multi-color-lines (canvas old-coords new-coords
&key (width 1)
color rgb-color? invisible? &allow-other-keys )
"Moves lines with varying color."
(declare (special *black-color* *host-or-mode* *host-bic-mode*)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(type fixnum width))
(with-focused-canvas canvas
(xlib::set-gcontext-line-width (gcontext canvas) width)
(loop with h = (canvas-height canvas)
for (sx1 sy1 ) fixnum in old-coords by #'cddr
for (ex1 ey1 ) fixnum in (cdr old-coords) by #'cddr
for (sx2 sy2 ) fixnum in new-coords by #'cddr
for (ex2 ey2 ) fixnum in (cdr new-coords) by #'cddr
for c in color
for i in invisible?
unless i
do
(if rgb-color?
(cc-set-rgb-color canvas c)
(set-draw-color canvas c))
(xlib::set-gcontext-function (gcontext canvas) *host-bic-mode*)
(xlib:draw-line (host-window canvas)
(gcontext canvas)
sx1 (- h sy1) ex1 (- h ey1))
(xlib::set-gcontext-function (gcontext canvas) *host-or-mode*)
(xlib:draw-line (host-window canvas)
(gcontext canvas)
sx2 (- h sy2) ex2 (- h ey2)))))
(defun draw-multi-color-&-width-lines (canvas coords &key width color erase? invisible? &allow-other-keys)
"Draws or erases lines with varying color and width."
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(type fixnum width))
(with-focused-canvas canvas
(choose-mode canvas :erase? erase?)
(loop with h = (canvas-height canvas)
for (xs ys ) fixnum in coords by #'cddr
for (xe ye ) fixnum in (cdr coords) by #'cddr
for w in width for c in color
for i in invisible?
unless i
do (set-draw-color canvas c)
(xlib::set-gcontext-line-width (gcontext canvas) w)
(xlib:draw-line (host-window canvas)
(gcontext canvas)
xs (- ys h) xe (- ye h)))))
(defun xor-move-multi-color-&-width-lines (canvas old-coords new-coords
&key width color invisible? &allow-other-keys )
"Moves lines with varying color and width~
Results with color background are undefined."
(declare (special *host-xor-mode*)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(type fixnum width))
(with-focused-canvas canvas
(xlib::set-gcontext-function (gcontext canvas) *host-xor-mode*)
(loop with h = (canvas-height canvas)
for (sx1 sy1 ) fixnum in old-coords by #'cddr
for (ex1 ey1 ) fixnum in (cdr old-coords) by #'cddr
for (sx2 sy2 ) fixnum in new-coords by #'cddr
for (ex2 ey2 ) fixnum in (cdr new-coords) by #'cddr
for w in width for c in color
for i in invisible?
unless i
do (set-draw-color canvas c)
(xlib::set-gcontext-line-width (gcontext canvas) w)
(xlib:draw-line (host-window canvas)
(gcontext canvas)
sx1 (- h sy1) ex1 (- h ey1))
(xlib:draw-line (host-window canvas)
(gcontext canvas)
sx2 (- h sy2) ex2 (- h ey2)))))
(defun move-multi-color-&-width-lines
(canvas old-coords new-coords &key width color rgb-color? invisible? &allow-other-keys )
"Moves lines with varying color and width"
(declare (special *black-color* *host-or-mode* *host-bic-mode*)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(type fixnum width))
(with-focused-canvas canvas
(loop with h = (canvas-height canvas)
for (sx1 sy1 ) fixnum in old-coords by #'cddr
for (ex1 ey1 ) fixnum in (cdr old-coords) by #'cddr
for (sx2 sy2 ) fixnum in new-coords by #'cddr
for (ex2 ey2 ) fixnum in (cdr new-coords) by #'cddr
for w in width for c in color
for i in invisible?
unless i
do
(if rgb-color?
(cc-set-rgb-color canvas c)
(set-draw-color canvas c))
(xlib::set-gcontext-line-width (gcontext canvas) w)
(xlib::set-gcontext-function (gcontext canvas) *host-bic-mode*)
(xlib:draw-line (host-window canvas)
(gcontext canvas)
sx1 (- h sy1) ex1 (- h ey1))
(xlib::set-gcontext-function (gcontext canvas) *host-or-mode*)
(xlib:draw-line (host-window canvas)
(gcontext canvas)
sx2 (- h sy2) ex2 (- h ey2)))))
(defun canvas-draw-lines (canvas coords
&key (width 1) (erase? nil)
color
invisible? &allow-other-keys )
"Draws or erases lines "
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(type fixnum width))
(if (and color (listp color))
(if (and width (listp width))
(draw-multi-color-&-width-lines canvas coords :width width
:invisible? invisible? :color color :erase? erase?)
(draw-multi-color-lines canvas coords :width width
:invisible? invisible? :color color :erase? erase?))
(draw-fw-lines canvas coords
:width (if (listp width ) (car width) width)
:color color
:invisible? invisible?
:erase? erase?)
))
(defun canvas-erase-lines (canvas coords
&key (width 1)
color
invisible? &allow-other-keys )
"Erases lines "
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(type fixnum width)
(inline canvas-draw-lines))
(canvas-draw-lines canvas coords :width width :color color
:invisible? invisible? :erase? t))
(defun canvas-move-lines (canvas old-coords new-coords
&key (width 1) (rgb-color? nil)
color
invisible? &allow-other-keys )
"Moves lines "
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(type fixnum width))
(if (and color (listp color))
(if (and width (listp width))
(move-multi-color-&-width-lines canvas old-coords new-coords
:width width
:invisible? invisible?
:color (if (and (colored-canvas-p canvas) (not rgb-color? ))
(rgb-colors color)
color))
(move-multi-color-lines canvas old-coords new-coords
:width width
:invisible? invisible?
:color (if (and (colored-canvas-p canvas) (not rgb-color? ))
(rgb-colors color)
color)))
(move-fw-lines canvas old-coords new-coords
:invisible? invisible?
:width (if (listp width ) (car width) width)
:color color)
)
)
(defun canvas-draw-axes (canvas axes
&key (width 1) (erase? nil)
color)
"Draws or erases axes"
(declare (special *host-or-mode* *host-bic-mode*)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(type fixnum width))
(when axes
(with-focused-canvas canvas
(if erase? (xlib::set-gcontext-function (gcontext canvas) *host-bic-mode*)
(xlib::set-gcontext-function (gcontext canvas) *host-or-mode*))
(set-draw-color canvas color)
(xlib::set-gcontext-line-width (gcontext canvas) width)
(loop with h = (canvas-height canvas)
with xo = (caar axes)
with yo = (- h (cadar axes ) )
for (x y ) fixnum in (cdr axes)
for i in invisible?
unless i
do (xlib:draw-line (host-window canvas) (gcontext canvas)
xo yo x (- h y))))))
(defun canvas-erase-axes (canvas axes
&key (width 1)
color)
"Erases axes "
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(type fixnum width)
(inline canvas-draw-axes))
(canvas-draw-axes canvas axes :width width :color color ))
(defun canvas-move-axes (canvas old-axes new-axes
&key (width 1)
color
&allow-other-keys )
"Moves axes "
(declare (special *host-or-mode* *host-bic-mode*)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(type fixnum width))
(when old-axes
(set-draw-color canvas color)
(with-focused-canvas canvas
(xlib::set-gcontext-line-width (gcontext canvas) width)
(loop with h = (canvas-height canvas)
with xo = (caar new-axes)
with yo = (- h (cadar new-axes ) )
for (x-old y-old ) fixnum in (cdr old-axes)
for (x y ) fixnum in (cdr new-axes)
for i in invisible?
unless i
do
(xlib::set-gcontext-function (gcontext canvas) *host-bic-mode*)
(xlib:draw-line (host-window canvas)
(gcontext canvas)
xo yo x-old (- h y-old))
(xlib::set-gcontext-function (gcontext canvas) *host-or-mode*)
(xlib:draw-line (host-window canvas)
(gcontext canvas)
xo yo x(- h y))))))
| 16,859 | Common Lisp | .cl | 370 | 32.951351 | 124 | 0.532491 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | baa4ef7ad3b24584621773de616366177b39e2e5f6c61382e6d7d49e9a7e561e | 32,874 | [
-1
] |
32,875 | point-defs-mcl.lsp | rwoldford_Quail/source/window-basics/fast-graphics/point-defs-mcl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; point-defs-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is an addition to Window-basics for moving pointclouds
;;;
;;;
;;; Authors:
;;; H.A. Chipman 1991
;;; C.B. Hurley 1991 George Washington University
;;; R.W. Oldford 1992.
;;;
;;;
;;;
;;;
;;;----------------------------------------------------------------------------------
(in-package :wb)
(defconstant *host-xor-mode* (h-draw::mode-arg :patxor))
(defconstant *host-or-mode* (h-draw::mode-arg :pator))
(defconstant *host-bic-mode* (h-draw::mode-arg :patbic))
(defconstant *host-copy-mode* (h-draw::mode-arg :patcopy))
(defvar *rgb-colors* )
(setq *rgb-colors* nil)
(defun get-rgb-colors ()
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(if *color-available*
(setq *rgb-colors*
(or *rgb-colors*
(loop for c in *colors* collect
(cons c (cond ( (eq-colors c *black-color*)
*black-rgb*)
( (eq-colors c *white-color*)
*white-rgb*)
(t (color-to-rgb c)))))))))
(defmacro get-rgb-color (c)
(let ((pair (gensym)) (rgb-c (gensym)))
`(let ()
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(if ,*color-available*
(let ((,pair (assoc ,c (get-rgb-colors) :test #'=)))
(if ,pair
(cdr ,pair)
(let ((,rgb-c (color-to-rgb ,c)))
(push (cons ,c ,rgb-c) *rgb-colors*)
,rgb-c)))))))
(defmacro set-point-rect (r x y s )
(let ((s2 (gensym))
(l (gensym))
(b (gensym)))
`(let* ((,s2 (truncate ,s 2))
(,l (- (the fixnum ,x) ,s2))
(,b (+ (the fixnum ,y) ,s2)))
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(type fixnum ,l ,b ,s2))
(rset ,r rect.topleft (h-draw:make-point ,l (- ,b ,s)))
(rset ,r rect.bottomright
(h-draw:make-point (+ ,l ,s) ,b )))))
(defmacro fast-draw-box (rect x y size fill? )
`(let ()
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(set-point-rect ,rect
(the fixnum ,x)
(the fixnum ,y)
(the fixnum ,size))
(if ,fill? (#_PaintRect ,rect) (#_FrameRect ,rect) )))
(defmacro fast-draw-circle (rect x y size fill? )
`(let ()
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(set-point-rect ,rect
(the fixnum ,x)
(the fixnum ,y)
(if (oddp (the fixnum ,size))
(1- (the fixnum ,size))
(the fixnum ,size)))
(if ,fill? (#_PaintOval ,rect) (#_FrameOval ,rect) )))
(defmacro fast-draw-cross (rect x y s fill? )
(declare (ignore rect fill?))
(let ((s2 (gensym))
(l (gensym))
(b (gensym)))
`(let* ((,s2 (truncate ,s 2))
(,l (- (the fixnum ,x) ,s2))
(,b (+ (the fixnum ,y) ,s2)))
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(type fixnum ,l ,b ,s2))
(#_MoveTo ,l (the fixnum ,y)) (#_Line (* 2 ,s2) 0)
(#_MoveTo (the fixnum ,x) ,b) (#_Line 0 (- (* 2 ,s2))))))
(defmacro fast-draw-diamond (rect x y s fill? )
(declare (ignore rect))
(let ((s2 (gensym))
(l (gensym)) (r (gensym))
(tp (gensym)) (b (gensym))
(poly (gensym)))
`(let* ((,s2 (truncate ,s 2))
(,l (- (the fixnum ,x) ,s2))
(,b (+ (the fixnum ,y) ,s2))
(,r (+ (the fixnum ,x) ,s2))
(,tp (- (the fixnum ,y) ,s2)))
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(type fixnum ,l ,r ,tp ,b ,s2)
(inline #_LineTo #_MoveTo #_ClosePoly #_PaintPoly #_KillPoly))
(#_MoveTo ,l (the fixnum ,y))
(if ,fill?
(let ((,poly (#_OpenPoly)))
(#_LineTo (the fixnum ,x) ,tp) (#_LineTo ,r (the fixnum ,y))
(#_LineTo (the fixnum ,x) ,b) (#_LineTo ,l (the fixnum ,y))
(#_ClosePoly )
(#_PaintPoly ,poly)
(#_KillPoly ,poly))
(progn
(#_LineTo (the fixnum ,x) ,tp) (#_LineTo ,r (the fixnum ,y))
(#_LineTo (the fixnum ,x) ,b) (#_LineTo ,l (the fixnum ,y)))))))
(defmacro fast-draw-triangle (rect x y s fill? )
(declare (ignore rect))
(let ((s2 (gensym))
(l (gensym)) (r (gensym))
(tp (gensym)) (b (gensym))
(poly (gensym)))
`(let* ((,s2 (truncate ,s 2))
(,l (- (the fixnum ,x) ,s2))
(,b (+ (the fixnum ,y) ,s2))
(,r (+ (the fixnum ,x) ,s2))
(,tp (- (the fixnum ,y) ,s2)))
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(type fixnum ,l ,r ,tp ,b ,s2)
(inline #_LineTo #_MoveTo #_ClosePoly #_PaintPoly #_KillPoly) )
(#_MoveTo ,l ,b)
(if ,fill?
(let ((,poly (#_OpenPoly)))
(#_LineTo (the fixnum ,x) ,tp) (#_LineTo ,r ,b) (#_LineTo ,l ,b)
(#_ClosePoly )
(#_PaintPoly ,poly)
(#_KillPoly ,poly))
(progn
(#_LineTo (the fixnum ,x) ,tp) (#_LineTo ,r ,b)
(#_LineTo ,l ,b))))))
(defconstant *cos-18* (cos (* pi 0.1)) )
(defconstant *cos-54* (cos (* pi 0.3)))
(defconstant *sin-18* (sin (* pi 0.1)))
(defconstant *sin-54* (sin (* pi 0.3)))
(defmacro fast-draw-star (rect x y s fill? )
(declare (ignore rect fill?))
(let ((r (gensym)) (r*c18 (gensym))
(r*s18 (gensym)) (r*c54 (gensym)) (r*s54 (gensym))
(x1 (gensym)) (y1 (gensym))
(x2 (gensym)) (y2 (gensym))
(x3 (gensym)) (x4 (gensym))
(x5 (gensym)) (y5 (gensym)))
`(let* ((,r (truncate ,s 2))
(,r*c18 (round (* ,r *cos-18*)))
(,r*s18 (round (* ,r *sin-18*)))
(,r*c54 (round (* ,r *cos-54*)))
(,r*s54 (round (* ,r *sin-54*)))
(,x1 (+ (the fixnum ,x) (the fixnum ,r*c18)))
(,y1 (- (the fixnum ,y) (the fixnum ,r*s18)))
(,x2 (the fixnum ,x))
(,y2 (- (the fixnum ,y) (the fixnum ,r)))
(,x3 (- (the fixnum ,x) (the fixnum ,r*c18)))
(,x4 (- (the fixnum ,x) (the fixnum ,r*c54)))
(,x5 (+ (the fixnum ,x) (the fixnum ,r*c54)))
(,y5 (+ (the fixnum ,y) (the fixnum ,r*s54))))
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(type fixnum ,x1 ,x2 ,x3 ,x4 ,x5 ,y1 ,y2 ,y5))
(#_MoveTo (the fixnum ,x) (the fixnum ,y)) (#_LineTo ,x1 ,y1)
(#_MoveTo (the fixnum ,x) (the fixnum ,y)) (#_LineTo ,x2 ,y2)
(#_MoveTo (the fixnum ,x) (the fixnum ,y)) (#_LineTo ,x3 ,y1)
(#_MoveTo (the fixnum ,x) (the fixnum ,y)) (#_LineTo ,x4 ,y5)
(#_MoveTo (the fixnum ,x) (the fixnum ,y)) (#_LineTo ,x5 ,y5))))
(defmacro fast-draw-poly-star (rect xc yc s fill? )
(declare (ignore rect ))
(let ((r (gensym)) (r2 (gensym)) (r*c18 (gensym))
(r*s18 (gensym)) (r*c54 (gensym)) (r*s54 (gensym))
(x1 (gensym))
(y1 (gensym))
(x2 (gensym))
(y2 (gensym))
(x3 (gensym))
(y3 (gensym))
(x4 (gensym))
(y4 (gensym))
(x5 (gensym))
(y5 (gensym))
(u1 (gensym))
(v1 (gensym))
(u2 (gensym))
(v2 (gensym))
(u3 (gensym))
(v3 (gensym))
(u4 (gensym))
(v4 (gensym))
(u5 (gensym))
(v5 (gensym))
(poly (gensym)))
`(let* ((,r (truncate ,s 2))
(,r*c18 (round (* ,r *cos-18*)))
(,r*s18 (round (* ,r *sin-18*)))
(,r*c54 (round (* ,r *cos-54*)))
(,r*s54 (round (* ,r *sin-54*)))
(,r2 (truncate ,r 2))
(,x1 (+ (the fixnum ,xc) (the fixnum ,r*c18)))
(,y1 (- (the fixnum ,yc) (the fixnum ,r*s18)))
(,x2 ,xc)
(,y2 (- (the fixnum ,yc) ,r))
(,x3 (- (the fixnum ,xc) (the fixnum ,r*c18))) (,y3 ,y1)
(,x4 (- (the fixnum ,xc) (the fixnum ,r*c54)))
(,y4 (+ (the fixnum ,yc) (the fixnum ,r*s54)))
(,x5 (+ (the fixnum ,xc) (the fixnum ,r*c54)))
(,y5 ,y4)
(,u1 (+ (the fixnum ,xc) (truncate (the fixnum ,r*c54) 2)))
(,v1 (- (the fixnum ,yc) (truncate (the fixnum ,r*s54) 2)))
(,u2 (- (the fixnum ,xc) (truncate (the fixnum ,r*c54) 2)))
(,v2 ,v1)
(,u3 (- (the fixnum ,xc) (truncate (the fixnum ,r*c18) 2)))
(,v3 (+ (the fixnum ,yc) (truncate (the fixnum ,r*s18) 2)))
(,u4 ,xc)
(,v4 (+ (the fixnum ,yc) (the fixnum ,r2)))
(,u5 (+ (the fixnum ,xc) (truncate (the fixnum ,r*c18) 2)))
(,v5 (+ (the fixnum ,yc) (truncate (the fixnum ,r*s18) 2)))
(,poly (if ,fill? (#_OpenPoly)))
)
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(type fixnum ,x1 ,x2 ,x3 ,x4 ,x5 ,y1 ,y2 ,y3 ,y4 ,y5
,u1 ,u2 ,u3 ,u4 ,u5 ,v1 ,v2 ,v3 ,v4 ,v5))
(#_MoveTo (the fixnum ,x1) (the fixnum ,y1))
(#_LineTo ,u1 ,v1)
(#_LineTo ,x2 ,y2) (#_LineTo ,u2 ,v2)
(#_LineTo ,x3 ,y3) (#_LineTo ,u3 ,v3)
(#_LineTo ,x4 ,y4) (#_LineTo ,u4 ,v4)
(#_LineTo ,x5 ,y5) (#_LineTo ,u5 ,v5)
(#_LineTo ,x1 ,y1)
(when ,fill?
(#_ClosePoly )
(#_PaintPoly ,poly)
(#_KillPoly ,poly)))))
(defmacro fast-draw-symbol (sim rect x y size fill )
`(let ()
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(case ,sim
(:box (fast-draw-box ,rect ,x ,y ,size ,fill))
(:circle (fast-draw-circle ,rect ,x ,y ,size ,fill ))
(:cross (fast-draw-cross ,rect ,x ,y ,size ,fill ))
(:star (fast-draw-star ,rect ,x ,y ,size ,fill ))
(:poly-star (fast-draw-poly-star ,rect ,x ,y ,size ,fill ))
(:diamond (fast-draw-diamond ,rect ,x ,y ,size ,fill ))
(:triangle (fast-draw-triangle ,rect ,x ,y ,size ,fill ))
(t nil))))
(defmacro mode-draw-symbol (sim rect x y size fill mode)
`(let ()
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(#_PenMode ,mode)
(fast-draw-symbol ,sim ,rect ,x ,y ,size ,fill)))
(defmacro cc-set-rgb-color ( color)
`(let ()
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(when ,color
(#_rgbforecolor :ptr ,color))))
(defmacro bw-set-color ( color)
`(let ()
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(when ,color
(#_PenPat (if (colorp ,color)
(color-to-shade ,color)
,color)))))
(defmacro set-draw-color (canvas color)
`(let ()
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(when ,color
(if (colored-canvas-p ,canvas)
(if (colorp ,color)
(set-fore-color ,canvas ,color)
(#_rgbforecolor :ptr ,color))
(#_PenPat (if (colorp ,color)
(color-to-shade ,color)
,color))))))
(defmacro set-fast-color (canvas color)
`(let ()
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(if (colored-canvas-p ,canvas)
(#_rgbforecolor :ptr ,color)
(#_PenPat ,color))))
(defmacro fast-move-to (canvas x y)
(declare (ignore canvas))
`(let ()
(declare (inline #_MoveTo))
(#_MoveTo (the fixnum ,x) (the fixnum ,y))))
(defmacro fast-line-to (canvas x y)
(declare (ignore canvas))
`(let ()
(declare (inline #_LineTo))
(#_LineTo (the fixnum ,x) (the fixnum ,y))))
(defmacro fast-draw-line (canvas x1 y1 x2 y2 )
(declare (ignore canvas))
`(let ()
(declare (inline #_MoveTo #_LineTo))
(#_MoveTo (the fixnum ,x1) (the fixnum ,y1))
(#_LineTo (the fixnum ,x2) (the fixnum ,y2))))
(defmacro mode-draw-line (canvas x1 y1 x2 y2 mode)
`(let ()
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(#_PenMode ,mode)
(fast-draw-line ,canvas
(the fixnum ,x1)
(the fixnum ,y1)
(the fixnum ,x2)
(the fixnum ,y2))))
| 13,768 | Common Lisp | .cl | 328 | 30.628049 | 86 | 0.452844 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | a0c987ea1d6d558e5127137db14d9462317ba3c5869a231034e33ee66e6c7ab3 | 32,875 | [
-1
] |
32,876 | point-defs-clx.lsp | rwoldford_Quail/source/window-basics/fast-graphics/point-defs-clx.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; point-defs-clx.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is an addition to Window-basics for moving pointclouds
;;;
;;;
;;; Authors:
;;; H.A. Chipman 1991
;;; C.B. Hurley 1991 George Washington University
;;; R.W. Oldford 1992.
;;; N.G. Bennett 1993
;;;
;;;
;;;
;;;
;;;----------------------------------------------------------------------------------
(in-package :wb)
(defconstant *host-xor-mode* (boole-to-op :boole-xor))
(defconstant *host-or-mode* (boole-to-op :boole-ior))
(defconstant *host-bic-mode* (boole-to-op :boole-andc1))
(defconstant *host-copy-mode* (boole-to-op :boole-1))
(defvar *rgb-colors* )
(setq *rgb-colors* nil)
(defun get-rgb-colors ()
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(if *color-available*
(setq *rgb-colors*
(or *rgb-colors*
(loop for c in *colors* collect
(cons c (cond ( (eq-colors c *black-color*)
*black-rgb*)
( (eq-colors c *white-color*)
*white-rgb*)
(t (color-to-rgb c)))))))))
(defmacro get-rgb-color (c)
(let ((pair (gensym)) (rgb-c (gensym)))
`(let ()
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(if ,*color-available*
(let ((,pair (assoc ,c (get-rgb-colors) :test #'=)))
(if ,pair
(cdr ,pair)
(let ((,rgb-c (color-to-rgb ,c)))
(push (cons ,c ,rgb-c) *rgb-colors*)
,rgb-c)))))))
(defmacro fast-draw-box (canvas x y size fill? )
`(let ()
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(xlib:draw-rectangle (host-window ,canvas) (gcontext ,canvas)
,x ,y ,size ,size ,fill?)))
(defmacro fast-draw-circle (canvas x y size fill? )
`(let ()
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(xlib:draw-arc (host-window ,canvas) (gcontext ,canvas)
,x ,y ,size ,size 0 (* 2 pi) ,fill?)))
(defmacro fast-draw-cross (canvas x y s fill? )
(declare (ignore fill?))
(let ((s2 (gensym))
(l (gensym)))
`(let* ((,s2 (truncate ,s 2))
(,l (list (- ,x ,s2) ,y
(+ ,x ,s2) ,y
,x (- ,y ,s2)
,x (+ ,y ,s2))))
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(xlib:draw-lines (host-window ,canvas) (gcontext ,canvas) ,l))))
(defmacro fast-draw-diamond (canvas x y s fill? )
(let ((s2 (gensym))
(l (gensym)))
`(let* ((,s2 (truncate ,s 2))
(,l (list (- ,x ,s2) ,y
,x (+ ,y ,s2)
,x (+ ,y ,s2)
(+ ,x ,s2) ,y
(+ ,x ,s2) ,y
,x (- ,y ,s2)
,x (- ,y ,s2)
(- ,x ,s2) ,y)))
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(xlib:draw-lines (host-window ,canvas)
(gcontext ,canvas) ,l :fill-p ,fill?))))
(defmacro fast-draw-triangle (canvas x y s fill? )
(let ((s2 (gensym))
(l (gensym))
)
`(let* ((,s2 (truncate ,s 2))
(,l (list (- ,x ,s2) (+ ,y ,s2)
,x (- ,y ,s2)
,x (- ,y ,s2)
(+ ,x ,s2) (+ ,y ,s2)
(+ ,x ,s2) (+ ,y ,s2)
(- ,x ,s2) (+ ,y ,s2))))
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(xlib:draw-lines (host-window ,canvas)
(gcontext ,canvas) ,l :fill-p ,fill?))))
(defconstant *cos-18* (cos (* pi 0.1)))
(defconstant *cos-54* (cos (* pi 0.3)))
(defconstant *sin-18* (sin (* pi 0.1)))
(defconstant *sin-54* (sin (* pi 0.3)))
(defmacro fast-draw-star (canvas x y s fill? )
(declare (ignore fill?))
(let ((r (gensym)) (r*c18 (gensym))
(r*s18 (gensym)) (r*c54 (gensym)) (r*s54 (gensym))
(x1 (gensym)) (y1 (gensym))
(x2 (gensym)) (y2 (gensym))
(x3 (gensym))
(x4 (gensym))
(x5 (gensym)) (y5 (gensym))
(h (gensym)) (g (gensym))
(pt-list (gensym)))
`(let* ((,h (host-window ,canvas))
(,g (gcontext ,canvas))
(,r (truncate ,s 2))
(,r*c18 (round (* ,r *cos-18*)))
(,r*s18 (round (* ,r *sin-18*)))
(,r*c54 (round (* ,r *cos-54*)))
(,r*s54 (round (* ,r *sin-54*)))
(,x1 (+ (the fixnum ,x) (the fixnum ,r*c18)))
(,y1 (- (the fixnum ,y) (the fixnum ,r*s18)))
(,x2 (the fixnum ,x))
(,y2 (- (the fixnum ,y) (the fixnum ,r)))
(,x3 (- (the fixnum ,x) (the fixnum ,r*c18)))
(,x4 (- (the fixnum ,x) (the fixnum ,r*c54)))
(,x5 (+ (the fixnum ,x) (the fixnum ,r*c54)))
(,y5 (+ (the fixnum ,y) (the fixnum ,r*s54)))
(,pt-list (list ,x ,y ,x1 ,y1 ,x ,y ,x2 ,y2 ,x ,y ,x3 ,y1 ,x ,y
,x4 ,y5 ,x ,y ,x5 ,y5)))
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(xlib:draw-lines ,h ,g ,pt-list))))
(defmacro fast-draw-symbol (canvas sim x y size fill )
`(let ()
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(case ,sim
(:box (fast-draw-box ,canvas ,x ,y ,size ,fill))
(:circle (fast-draw-circle ,canvas ,x ,y ,size ,fill ))
(:cross (fast-draw-cross ,canvas ,x ,y ,size ,fill ))
(:star (fast-draw-star ,canvas ,x ,y ,size ,fill ))
(:poly-star (fast-draw-poly-star ,canvas ,x ,y ,size ,fill ))
(:diamond (fast-draw-diamond ,canvas ,x ,y ,size ,fill ))
(:triangle (fast-draw-triangle ,canvas ,x ,y ,size ,fill ))
(t nil))))
(defmacro mode-draw-symbol (canvas sim x y size fill mode)
`(let ()
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(xlib::set-gcontext-function (gcontext ,canvas) ,mode)
(fast-draw-symbol ,canvas ,sim ,x ,y ,size ,fill)))
(defmacro cc-set-rgb-color (canvas color)
`(let ()
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(when ,color
(xlib::set-gcontext-foreground (gcontext ,canvas) ,color))))
(defmacro bw-set-color (canvas color)
`(let ()
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(when ,color
(set-draw-color canvas color))))
(defmacro set-draw-color (canvas color)
`(let ()
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(when ,color
(if (colored-canvas-p ,canvas)
(if (colorp ,color)
(set-fore-color ,canvas ,color)
(xlib::set-gcontext-foreground (gcontext ,canvas) ,color))))))
(defmacro set-fast-color (canvas color)
`(let ()
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(if (colored-canvas-p ,canvas)
(xlib::set-gcontext-foregound (gcontext ,canvas) ,color)
)))
(defmacro fast-move-to (canvas x y)
`(let ()
(setf (current-position ,canvas) (list ,x ,y))))
(defmacro fast-line-to (canvas x y)
`(let ()
(xlib:draw-line (host-window ,canvas) (gcontext ,canvas)
(point-x (current-position ,canvas))
(point-y (current-position ,canvas)) ,x ,y)))
(defmacro fast-draw-line (canvas x1 y1 x2 y2 )
`(let ()
(xlib:draw-line (host-window ,canvas) (gcontext ,canvas) ,x1 ,y1 ,x2 ,y2)))
(defmacro mode-draw-line (canvas x1 y1 x2 y2 mode)
`(let ()
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(xlib::set-gcontext-function (gcontext ,canvas) ,mode)
(fast-draw-line ,canvas
(the fixnum ,x1)
(the fixnum ,y1)
(the fixnum ,x2)
(the fixnum ,y2))))
(defmacro fast-draw-poly-star (canvas xc yc s fill? )
(let ((r (gensym)) (r2 (gensym)) (r*c18 (gensym))
(r*s18 (gensym)) (r*c54 (gensym)) (r*s54 (gensym))
(x1 (gensym))
(y1 (gensym))
(x2 (gensym))
(y2 (gensym))
(x3 (gensym))
(y3 (gensym))
(x4 (gensym))
(y4 (gensym))
(x5 (gensym))
(y5 (gensym))
(u1 (gensym))
(v1 (gensym))
(u2 (gensym))
(v2 (gensym))
(u3 (gensym))
(v3 (gensym))
(u4 (gensym))
(v4 (gensym))
(u5 (gensym))
(v5 (gensym))
(l (gensym)))
`(let* ((,r (truncate ,s 2))
(,r*c18 (round (* ,r *cos-18*)))
(,r*s18 (round (* ,r *sin-18*)))
(,r*c54 (round (* ,r *cos-54*)))
(,r*s54 (round (* ,r *sin-54*)))
(,r2 (truncate ,r 2))
(,x1 (+ (the fixnum ,xc) (the fixnum ,r*c18)))
(,y1 (- (the fixnum ,yc) (the fixnum ,r*s18)))
(,x2 ,xc)
(,y2 (- (the fixnum ,yc) ,r))
(,x3 (- (the fixnum ,xc) (the fixnum ,r*c18))) (,y3 ,y1)
(,x4 (- (the fixnum ,xc) (the fixnum ,r*c54)))
(,y4 (+ (the fixnum ,yc) (the fixnum ,r*s54)))
(,x5 (+ (the fixnum ,xc) (the fixnum ,r*c54)))
(,y5 ,y4)
(,u1 (+ (the fixnum ,xc) (truncate (the fixnum ,r*c54) 2)))
(,v1 (- (the fixnum ,yc) (truncate (the fixnum ,r*s54) 2)))
(,u2 (- (the fixnum ,xc) (truncate (the fixnum ,r*c54) 2)))
(,v2 ,v1)
(,u3 (- (the fixnum ,xc) (truncate (the fixnum ,r*c18) 2)))
(,v3 (+ (the fixnum ,yc) (truncate (the fixnum ,r*s18) 2)))
(,u4 ,xc)
(,v4 (+ (the fixnum ,yc) (the fixnum ,r2)))
(,u5 (+ (the fixnum ,xc) (truncate (the fixnum ,r*c18) 2)))
(,v5 (+ (the fixnum ,yc) (truncate (the fixnum ,r*s18) 2)))
(,l (list ,x1 ,y1 ,u1 ,v1
,u1 ,v1 ,x2 ,y2
,x2 ,y2 ,u2 ,v2
,u2 ,v2 ,x3 ,y3
,x3 ,y3 ,u3 ,v3
,u3 ,v3 ,x4 ,y4
,x4 ,y4 ,u4 ,v4
,u4 ,v4 ,x5 ,y5
,x5 ,y5 ,u5 ,v5
,u5 ,v5 ,x1 ,y1)))
(declare (optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0)))
(xlib:draw-lines (host-window ,canvas)
(gcontext ,canvas) ,l :fill-p ,fill?)))) | 11,264 | Common Lisp | .cl | 275 | 30.421818 | 86 | 0.46139 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 681a7e06eb567f5540ba96bbd8698ed16581fb0c0e42507101cebd09f4466fe5 | 32,876 | [
-1
] |
32,877 | points-mcl.lsp | rwoldford_Quail/source/window-basics/fast-graphics/points-mcl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; points-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is an addition to Window-basics for moving pointclouds
;;;
;;;
;;; Authors:
;;; H.A. Chipman 1991
;;; C.B. Hurley 1991 George Washington University
;;;
;;;
;;;
;;;
;;;----------------------------------------------------------------------------------
(in-package :wb)
(defun xor-draw-points (canvas points &key erase? &allow-other-keys)
"Draws or erases single pixel points ~
Results with color background are undefined."
(declare (special *black-color* *host-xor-mode*)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(ignore erase? ))
(with-focused-canvas canvas
(#_PenMode *host-xor-mode*)
(loop with h fixnum = (canvas-height canvas)
for (x y1) fixnum in points
for y fixnum = (- h y1)
do
(fast-draw-line canvas x y x y))))
(defun xor-move-points (canvas old new &key none &allow-other-keys )
"Moves single pixel points.~
Results with color background are undefined."
(declare (ignore none)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(special *host-xor-mode*))
(with-focused-canvas canvas
(#_PenMode *host-xor-mode*)
(loop with h fixnum = (canvas-height canvas)
for (xo yo1 ) fixnum in old
for (x y1 ) fixnum in new
for yo fixnum = (- h yo1)
for y fixnum = (- h y1)
do
(fast-draw-line canvas xo yo xo yo)
(fast-draw-line canvas x y x y)
)))
(defun xor-draw-boxes (canvas points &key size erase?
&allow-other-keys)
"Draws or erases filled squares with varying size.~
Results with color background are undefined."
(declare (special *host-xor-mode*)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(ignore erase? ))
(let* ((h (canvas-height canvas)))
(h-draw::with-rectangle-arg (r 0 0 1 1)
(with-focused-canvas canvas
(#_PenMode *host-xor-mode*)
(loop
for (x y ) fixnum in points for s fixnum in size
do
(set-point-rect r x (- h y) s)
(#_PaintRect r) )))))
(defun xor-move-boxes (canvas old new &key size (old-size size)
&allow-other-keys)
"Moves filled squares with varying size.~
Results with color background are undefined."
(declare (special *host-xor-mode*)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
)
(let* ((h (canvas-height canvas)))
(h-draw::with-rectangle-arg (r 0 0 1 1)
(with-focused-canvas canvas
(#_PenMode *host-xor-mode*)
(loop for (xo yo ) fixnum in old
for (x y ) fixnum in new
for so fixnum in old-size
for s fixnum in size
do
(set-point-rect r xo (- h yo) so )
(#_PaintRect r)
(set-point-rect r x (- h y) s )
(#_PaintRect r))))))
(defun xor-draw-circles (canvas points &key size erase?
&allow-other-keys)
"Draws or erases filled circles with varying size.~
Results with color background are undefined."
(declare (special *host-xor-mode*)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(ignore erase? ))
(let* ((h (canvas-height canvas)))
(h-draw::with-rectangle-arg (r 0 0 1 1)
(with-focused-canvas canvas
(#_PenMode *host-xor-mode*)
(loop
for (x y ) fixnum in points for s fixnum in size
do
(set-point-rect r x (- h y) s )
(#_PaintOval r) )))))
(defun xor-move-circles (canvas old new &key size (old-size size)
&allow-other-keys)
"Moves filled circles with varying size.~
Results with color background are undefined."
(declare (special *host-xor-mode*)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
)
(let* ((h (canvas-height canvas)))
(h-draw::with-rectangle-arg (r 0 0 1 1)
(with-focused-canvas canvas
(#_PenMode *host-xor-mode*)
(loop for (xo yo ) fixnum in old
for (x y ) fixnum in new
for so fixnum in old-size
for s fixnum in size
do
(set-point-rect r xo (- h yo) so )
(#_PaintOval r)
(set-point-rect r x (- h y) s )
(#_PaintOval r)))))) | 5,189 | Common Lisp | .cl | 130 | 29.538462 | 86 | 0.504618 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 64588392b1059f65d0d947ca4ce564dd7e92e4fe94e37ef58943925b838551cd | 32,877 | [
-1
] |
32,878 | points-clx.lsp | rwoldford_Quail/source/window-basics/fast-graphics/points-clx.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; points-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is an addition to Window-basics for moving pointclouds
;;;
;;;
;;; Authors:
;;; H.A. Chipman 1991
;;; C.B. Hurley 1991 George Washington University
;;;
;;;
;;;
;;;
;;;----------------------------------------------------------------------------------
(in-package :wb)
(defun xor-draw-points (canvas points &key erase? &allow-other-keys)
"Draws or erases single pixel points ~
Results with color background are undefined."
(declare (special *black-color* *host-xor-mode*)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(ignore erase? ))
(with-focused-canvas canvas
(xlib::set-gcontext-function (gcontext canvas) *host-xor-mode*)
(xlib:draw-lines (host-window canvas) (gcontext canvas)
(map 'list #'(lambda (x) (list (car x)
(- (canvas-height canvas) (cadr x)))) points))))
(defun xor-move-points (canvas old new &key none &allow-other-keys )
"Moves single pixel points.~
Results with color background are undefined."
(declare (ignore none)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(special *host-xor-mode*))
(with-focused-canvas canvas
(xlib::set-gcontext-function (gcontext canvas) *host-xor-mode*)
(xlib:draw-lines (host-window canvas) (gcontext canvas)
(map 'list #'(lambda (x) (list (car x)
(- (canvas-height canvas) (cadr x)))) old))
(xlib:draw-lines (host-window canvas) (gcontext canvas)
(map 'list #'(lambda (x) (list (car x)
(- (canvas-height canvas) (cadr x)))) new))))
(defun xor-draw-boxes (canvas points &key size erase?
&allow-other-keys)
"Draws or erases filled squares with varying size.~
Results with color background are undefined."
(declare (special *host-xor-mode*)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(ignore erase? ))
(with-focused-canvas canvas
(xlib::set-gcontext-function (gcontext canvas) *host-xor-mode*)
(loop with h = (canvas-height canvas)
for (x y ) fixnum in points for s fixnum in size
do
(xlib:draw-rectangle (host-window canvas) (gcontext canvas)
x (- h y) s s t))))
(defun xor-move-boxes (canvas old new &key size (old-size size)
&allow-other-keys)
"Moves filled squares with varying size.~
Results with color background are undefined."
(declare (special *host-xor-mode*)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
)
(with-focused-canvas canvas
(xlib::set-gcontext-function (gcontext canvas) *host-xor-mode*)
(loop with h = (canvas-height canvas)
for (xo yo ) fixnum in old
for (x y ) fixnum in new
for so fixnum in old-size
for s fixnum in size
do
(xlib:draw-rectangle (host-window canvas) (gcontext canvas)
xo (- h yo) so so t)
(xlib:draw-rectangle (host-window canvas) (gcontext canvas)
x (- h y) s s t))))
(defun xor-draw-circles (canvas points &key size erase?
&allow-other-keys)
"Draws or erases filled circles with varying size.~
Results with color background are undefined."
(declare (special *host-xor-mode*)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
(ignore erase? ))
(with-focused-canvas canvas
(xlib::set-gcontext-function (gcontext canvas) *host-xor-mode*)
(loop with h = (canvas-height canvas)
for (x y ) fixnum in points for s fixnum in size
do
(xlib:draw-arc (host-window canvas) (gcontext canvas) x (- h y) s s 0 7 t))))
(defun xor-move-circles (canvas old new &key size (old-size size)
&allow-other-keys)
"Moves filled circles with varying size.~
Results with color background are undefined."
(declare (special *host-xor-mode*)
(optimize (speed 3) (safety 0)
(space 0) (compilation-speed 0))
)
(with-focused-canvas canvas
(xlib::set-gcontext-function (gcontext canvas) *host-xor-mode*)
(loop with h = (canvas-height canvas)
for (xo yo ) fixnum in old
for (x y ) fixnum in new
for so fixnum in old-size
for s fixnum in size
do
(xlib:draw-arc (host-window canvas) (gcontext canvas) xo (- h yo) so so 0 7 t)
(xlib:draw-arc (host-window canvas) (gcontext canvas) x (- h y) s s 0 7 t))))
| 5,254 | Common Lisp | .cl | 116 | 35.543103 | 93 | 0.546205 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | f30c5158726359fce83da3618a0fad5dda6b0625a835fdd8b40792903bf606d0 | 32,878 | [
-1
] |
32,879 | canvas-export-mcl.lsp | rwoldford_Quail/source/window-basics/hardcopy/canvas-export-mcl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; canvas-export-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) Statistical Computing Laboratory
;;; University of Waterloo
;;; Canada.
;;;
;;; This file is part of the Window-Basics package intended to provide a uniform
;;; window environment for Common Lisp programming.
;;;
;;; For copyright information and history, see window-basics-copyright.lisp
;;;
;;; Authors:
;;; R.W. Oldford 1999
;;;
;;;
;;;
;;;-------------------------------------------------------------------
(in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute)
(export '(canvas-export)))
(defmethod canvas-export ((self canvas) &key left top width height filename filetype)
"Exports the canvas contents to a file of type filetype."
(unless filetype
(setf filetype (pick-one (list :postscript :bitmap))))
(case
filetype
(:postscript
(canvas-to-ps self))
(:something-else
"OK")))
| 1,185 | Common Lisp | .cl | 34 | 31.323529 | 86 | 0.488189 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | be0f119d3ac89f39aacfc10e6d3a17f9e3c19d978a353409de71d7c3b0db2cda | 32,879 | [
-1
] |
32,880 | hardcopy-clx.lsp | rwoldford_Quail/source/window-basics/hardcopy/hardcopy-clx.lsp | (in-package :wb)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(canvas-hardcopy))) ;; cbh
;; added by CBH , rwo
(defgeneric canvas-hardcopy (canvas &key left top width height)
(:documentation "Produces a hardcopy of the canvas,~
or a selected region in canvas coordinates"))
(defmethod canvas-hardcopy ((self canvas) &key left top width height)
(case
(pick-one (list :postscript :printer))
(:postscript
(canvas-to-ps self))
(:printer
)))
(defmethod window-hardcopy ((self canvas) &optional ignore )
(declare (ignore ignore))
(canvas-hardcopy self))
| 652 | Common Lisp | .cl | 16 | 34.5 | 92 | 0.674194 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | e0e311d4e177f504984f1b3273cb21d1bf74ea4245ef1a8a84ca01baf959b32b | 32,880 | [
-1
] |
32,881 | hardcopy-mcl.lsp | rwoldford_Quail/source/window-basics/hardcopy/hardcopy-mcl.lsp |
(in-package :wb)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;hardcopy-mcl.lisp
;;
;;
;;copyright 1988-89 Apple Computer, Inc.
;;
;; defines a very basic printing routine for windows
;;
;; Code taken from Apple and Bill Kornfeld and played with a bit to get
;; something working. Trying to change the wptr and
;; then doing a view-draw-contents fails --- LISP unexpextantly quits.
;; View-draw-contents without changing the window pointer
;; cases a print job to be sent to the printer but nothing comes out. Using a
;; print-contents function that just makes the
;; appropriate quickdraw calls seems to wrork ok. The basic print-contents
;; functions for text, views and windows is defined
;; here. Some extra print-contents functions for other items is defined in
;; odin-printing.lisp -- DEH 6/20/91
#|
From: [email protected]
Message-Id: <[email protected]>
Received: by a.darpa.mil (5.61/5.61)
id AA15191; Fri, 9 Aug 91 11:02:53 -0500
Date: Fri, 9 Aug 91 11:54:00 EST
To: [email protected]
Cc: [email protected]
Subject: Printing Interface Tools Objects
A number of MCL users have expressed an interest in high-level support
to print interface tools objects. It would be very nice to just pulldown
the File menu and select print.
The code to do this is not difficult to write, and it would greatly enhance
the rapid-prototyping abilities of MCL because hardcopy is a great way to get
people to agree on the look and feel of a window design.
I've been playing with some code passed on to me by David Hirsch at
Price Waterhouse, and with some minor enhancements I think it would be a good
thing to stash in the /pub/MCL2/contrib directory. It needs to be able to
print out more than one page, and to handle the other dialog-item types such
as radio button, sequence, and array. Perhaps we could put the code out
there, and people could just add these enhancements and re-publish the code.
Lawrence Au
Here's the code:
|#
(export '(canvas-hardcopy hardcopy-bitmap print-contents)) ;; cbh
;;;*logical-directory-alist*
;;(load (probe-file "library;records.lisp"))
;; (load (probe-file "library;traps.lisp"))
(defconstant $PrintErr #x944)
(defconstant $prJob.bJDocLoop (+ 62 6))
(defconstant $iPrStatSize 26)
(defconstant $bSpoolLoop 1)
(defconstant $err-printer 94)
(defconstant $err-printer-load 95)
(defconstant $err-printer-start 97)
;;(load (probe-file "interfaces;types.lisp"))
;;(load (probe-file "interfaces;quickdraw.lisp"))
;;(load (probe-file "library;quickdraw.lisp"))
(defun prchk (&optional (errnum $err-printer)
&aux (print-error (ccl:%get-signed-word (ccl:%int-to-ptr
$PrintErr))))
(unless (zerop print-error)
(error (format NIL "errnum = ~s ~&print-error = ~s" errnum print-error)))
)
(defmethod print-schedule ((w window))
(unwind-protect
(with-cursor *arrow-cursor*
(_PrOpen)
(prchk $err-printer-load)
(let ((pRec (get-print-record)))
(when (and (_PrStlDialog :ptr pRec :boolean)
(_PrJobDialog :ptr pRec :boolean))
(let ((*hc-page-open-p* nil)
(ccl::*inhibit-error* t)
err)
;_PrOpenDoc puts up a dialog window which causes the event system
;to get confused. So we do the whole thing without interrupts, and
;make sure to clean up before handling errors.
(declare (special *hc-page-open-p* ccl::*inhibit-error*
host-draw:*hardcopy-ptr*))
(setq err
(progn ;catch-error-quietly
(without-interrupts
;;(let (
(setq host-draw:*hardcopy-ptr*
(_PrOpenDoc :ptr pRec
:ptr (ccl:%null-ptr)
:ptr (ccl:%null-ptr) :ptr))
;;)
(with-port host-draw:*hardcopy-ptr*
(unwind-protect
(with-dereferenced-handles ((ppRec pRec))
pprec
(prchk $err-printer-start)
(unwind-protect
(progn
(_PrOpenPage :ptr host-draw:*hardcopy-ptr*
:ptr (ccl:%null-ptr))
;; Do it!
(with-port host-draw:*hardcopy-ptr* (print-contents w)))
(_PrClosPage :ptr host-draw:*hardcopy-ptr*)
))
(progn
(_PrClosDoc :ptr host-draw:*hardcopy-ptr*)
(setq host-draw:*hardcopy-ptr* NIL))))
;;) ;; end of let
(when t
;;(eq (ccl:%hget-byte pRec $prJob.bJDocLoop)
;;this test always seems to fail???!!!!
;;$bSpoolLoop)
;;(format t "~ccl:%Docloop ~S" (ccl:%hget-byte pRec $prJob.bJDocLoop))
(prchk)
(ccl:%stack-block ((StRec $iPrStatSize))
(_PrPicFile :ptr pRec
:ptr (ccl:%null-ptr)
:ptr (ccl:%null-ptr)
:ptr (ccl:%null-ptr)
:ptr StRec))
(prchk)))))
;;; end of setq err
t))))
;;; end of with-cursor *arrow-cursor*
(progn
(_PrClose)
(setq host-draw:*hardcopy-ptr* NIL))
)
)
;;;------------------ The basic print-contents functions----------------------
(defmethod print-contents ((v window))
"a window draws a box around itself and
then asks its subviews to print themselves"
(let ((size (view-size v))
(top 0)
(left 0)
bottom right)
(setq bottom (+ top (h-draw:point-y size))
right (+ left (h-draw:point-x size)))
;;first frame it
(h-draw::with-rectangle-arg (r left top right bottom) (_FrameRect :ptr r))
(dovector (sv (view-subviews v))
(print-contents sv)))
)
(defmethod print-contents ((v view))
"a view just asks its subviews to print themselves"
(dovector (sv (view-subviews v))
(print-contents sv)))
(defmethod print-contents ((sv ccl::basic-editable-text-dialog-item))
"editable text uses textbox -- take into account font and the justification"
(let ((window (view-window sv))
(container (view-container sv))
(pos (view-position sv))
(size (view-size sv))
cpos
top left bottom right
font-face mode-size)
(multiple-value-setq (font-face mode-size)
(view-font-codes sv))
(setq cpos (convert-coordinates pos container window))
(setq top (h-draw:point-y cpos)
left (h-draw:point-x cpos))
(setq bottom (+ top (h-draw:point-y size))
right (+ left (h-draw:point-x size)))
(with-font-codes font-face mode-size
(h-draw::with-rectangle-arg (r left top right bottom)
(with-pstrs ((pstring (dialog-item-text sv)))
(_TextBox :ptr (ccl:%inc-ptr pstring 1)
:long (length (dialog-item-text sv))
:ptr r
:word (slot-value sv 'ccl::text-justification)))))))
(defmethod print-contents ((sv static-text-dialog-item))
"static text uses textbox -- take into account font and the justification"
(let ((window (view-window sv))
(container (view-container sv))
(pos (view-position sv))
(size (view-size sv))
cpos
top left
bottom right
font-face mode-size)
(multiple-value-setq (font-face mode-size)
(view-font-codes sv))
(setq cpos (convert-coordinates pos container window))
(setq top (h-draw:point-y cpos)
left (h-draw:point-x cpos))
(setq bottom (+ top (h-draw:point-y size))
right (+ left (h-draw:point-x size)))
(with-font-codes font-face mode-size
(h-draw::with-rectangle-arg (r left top right bottom)
(with-pstrs ((pstring (dialog-item-text sv)))
(_TextBox :ptr (ccl:%inc-ptr pstring 1)
:long (length (dialog-item-text sv))
:ptr r
:word (slot-value sv 'ccl::text-justification)))))))
(defmethod print-contents ((sv button-dialog-item))
(let ((window (view-window sv))
(container (view-container sv))
(pos (view-position sv))
(size (view-size sv))
cpos
top left bottom right
font-face mode-size)
(multiple-value-setq (font-face mode-size)
(view-font-codes sv))
(setq cpos (convert-coordinates pos container window))
(setq top (h-draw:point-y cpos)
left (h-draw:point-x cpos))
(setq bottom (+ top (h-draw:point-y size))
right (+ left (h-draw:point-x size)))
(h-draw::with-rectangle-arg (r left top right bottom)
(with-font-codes font-face mode-size
(with-pstrs ((pstring (dialog-item-text sv)))
(_TextBox :ptr (ccl:%inc-ptr pstring 1)
:long (length (dialog-item-text sv))
:ptr r :word 1)))
;;; end of with-font-codes
(rlet ((old-pen-state :penstate) (new-pen-state :penstate))
(_GetPenState :ptr old-pen-state)
(rset new-pen-state :penstate.pnLoc
(rref old-pen-state :penState.pnLoc))
(rset new-pen-state :penstate.pnSize #@(1 1))
(rset new-pen-state :penstate.pnMode :PATOR)
(rset new-pen-state :penstate.pnPat *black-pattern*)
(_SetPenState :ptr new-pen-state)
;;(decf (rref r :rect.left)
;; (floor (dialog-item-width-correction sv) 2))
;;(incf (rref r :rect.right)
;; (floor (dialog-item-width-correction sv) 2))
(_FrameRoundRect :ptr r :word 10 :word 6)
(_SetPenState :ptr old-pen-state)))))
(defmethod print-contents ((sv simple-view))
"Default: if all else fails do nothing"
t
)
#|
(setq w (make-instance 'window
:window-title "HI there"
:view-size #@(300 300)
:view-subviews
(list (make-instance 'view
:view-position #@(20 20)
:view-size #@(150 130)
:view-subviews
(List (make-instance 'static-text-dialog-item
:view-position #@(10 10)
:view-size #@(130 40)
:view-font '("Helvetica" :srcor :bold 12)
:dialog-item-text
"how now said the big brown cow")
(make-instance 'static-text-dialog-item
:view-position #@(10 70)
:view-size #@(130 60)
:view-font '("Geneva" :srcor :underline 14)
:dialog-item-text
"there is a bunch of green cheese here on the moon"))))))
(print-schedule w)
(setf test-window
(MAKE-INSTANCE 'COLOR-DIALOG
:WINDOW-TYPE :DOCUMENT-WITH-ZOOM :VIEW-POSITION ':CENTERED
:VIEW-SIZE #@(918 708)
:VIEW-FONT '("Chicago" 12 :SRCOR :PLAIN)
:VIEW-SUBVIEWS
(LIST (MAKE-DIALOG-ITEM 'STATIC-TEXT-DIALOG-ITEM
#@(13 9)
#@(56 16)
"Untitled"
NIL)
(MAKE-DIALOG-ITEM 'EDITABLE-TEXT-DIALOG-ITEM
#@(15 25)
#@(84 16)
"Untitled"
NIL
:ALLOW-RETURNS NIL)
(MAKE-DIALOG-ITEM 'BUTTON-DIALOG-ITEM
#@(15 47)
#@(62 16)
"Untitled"
NIL
:DEFAULT-BUTTON NIL)
(MAKE-DIALOG-ITEM 'EDITABLE-TEXT-DIALOG-ITEM
#@(381 683)
#@(114 16)
"bottom center"
NIL
:ALLOW-RETURNS NIL)
(MAKE-DIALOG-ITEM 'EDITABLE-TEXT-DIALOG-ITEM
#@(11 688)
#@(84 16)
"bottom left"
NIL
:ALLOW-RETURNS NIL)
(MAKE-DIALOG-ITEM 'EDITABLE-TEXT-DIALOG-ITEM
#@(375 20)
#@(84 16)
"top center"
NIL
:ALLOW-RETURNS NIL)
(MAKE-DIALOG-ITEM 'EDITABLE-TEXT-DIALOG-ITEM
#@(799 676)
#@(84 16)
"bottom right"
NIL
:VIEW-FONT
'("New Century Schlbk"
12
:SRCOR
:PLAIN)
:ALLOW-RETURNS NIL)
(MAKE-DIALOG-ITEM 'EDITABLE-TEXT-DIALOG-ITEM
#@(818 20)
#@(84 16)
"top right"
NIL
:VIEW-FONT
'("New Century Schlbk"
12
:SRCOR
:PLAIN)
:ALLOW-RETURNS NIL)))
)
(print-schedule test-window)
|#
;; added by CBH , rwo
(defgeneric hardcopy-bitmap (canvas &key left top width height)
(:documentation "Produces a hardcopy of the canvas"))
(defgeneric canvas-hardcopy (canvas &key left top width height)
(:documentation "Produces a hardcopy of the canvas,~
or a selected region in canvas coordinates"))
(defmethod canvas-hardcopy ((self canvas) &key left top width height)
(if (or left top width height)
(hardcopy-bitmap self
:left left
:top top
:width width
:height height)
(print-schedule self)))
(defmethod canvas-export ((self canvas) &key left top width height filetype)
(unless filetype
(setf filetype (pick-one (list :postscript :pict))))
(case
filetype
(:postscript
(canvas-to-ps self))
(:pict
(canvas-to-pict-file self))))
(defmethod CCL::WINDOW-SAVE ((window canvas))
(canvas-export window))
(defmethod CCL::WINDOW-SAVE-copy-as ((window canvas) &optional opt-0)
(canvas-export window))
(defmethod window-hardcopy ((self canvas) &optional ignore )
(declare (ignore ignore))
(canvas-hardcopy self))
(defmethod print-contents ((self canvas))
(let ((old-mode (display-mode-of self)))
(unwind-protect
(progn ()
(setf (display-mode-of self) :mcl-printer)
(redisplay self))
(setf (display-mode-of self) old-mode)
)
)
)
(defmethod hardcopy-bitmap ((w canvas) &key left top width height)
(setq left (or left 72))
(setq top (or top 72))
(setq width (or width (canvas-width w)))
(setq height (or height (canvas-height w)))
(unwind-protect
(with-cursor *arrow-cursor*
(_PrOpen)
(prchk $err-printer-load)
(let ((pRec (get-print-record)))
(when (and (_PrStlDialog :ptr pRec :boolean)
(_PrJobDialog :ptr pRec :boolean))
(let ((*hc-page-open-p* nil) (ccl::*inhibit-error* t) err)
;_PrOpenDoc puts up a dialog window which causes the event system
;to get confused. So we do the whole thing without interrupts, and
;make sure to clean up before handling errors.
(declare (special *hc-page-open-p* ccl::*inhibit-error*
host-draw:*hardcopy-ptr*))
(setq err (progn ;catch-error-quietly
(window-select w) (redisplay w)
(rlet ((source-rect :rect
:top 0 :left 0
:bottom (canvas-height w)
:right (canvas-width w))
(target-rect :rect
:top top :left left
:bottom (+ top height)
:right (+ left width)))
(without-interrupts
(let* (;;(window-ptr (wptr w))
(screen-bitmap (rref (wptr w) grafport.portbits))
(temp-bitmap (h-draw::make-bitmap target-rect))
host-draw:*hardcopy-ptr* target-bitmap)
(h-draw::copy-bits screen-bitmap temp-bitmap
source-rect target-rect )
(setq host-draw:*hardcopy-ptr* (_PrOpenDoc :ptr pRec :ptr
(ccl:%null-ptr) :ptr (ccl:%null-ptr) :ptr))
(setq target-bitmap (rref host-draw:*hardcopy-ptr* grafport.portbits))
(with-port host-draw:*hardcopy-ptr*
(unwind-protect
(with-dereferenced-handles ((ppRec pRec))
pprec
(prchk $err-printer-start)
(unwind-protect
(_PrOpenPage :ptr host-draw:*hardcopy-ptr*
:ptr (ccl:%null-ptr))
(h-draw::copy-bits temp-bitmap target-bitmap
target-rect target-rect )
(_PrClosPage :ptr host-draw:*hardcopy-ptr*)
))
(_PrClosDoc :ptr host-draw:*hardcopy-ptr*))))
;;; end of let
(when t
;;(eq (ccl:%hget-byte pRec $prJob.bJDocLoop)
;;this test always seems to fail???!!!!
;;$bSpoolLoop)
;;(format t "~ccl:%Docloop ~S" (ccl:%hget-byte pRec $prJob.bJDocLoop))
(prchk)
(ccl:%stack-block ((StRec $iPrStatSize))
(_PrPicFile :ptr pRec
:ptr (ccl:%null-ptr)
:ptr (ccl:%null-ptr)
:ptr (ccl:%null-ptr)
:ptr StRec))
(prchk))))))
;;; end of setq err
t))))
;;; end of with-cursor *arrow-cursor*
(_PrClose))
)
;;-*- Mode: Lisp; Package: CCL -*-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; picture-files.lisp
;; Copyright 1990-1994, Apple Computer, Inc.
;; Copyright 1995 Digitool, Inc.
; Examples of reading and writing picture files.
; Adapted from the code on page V-88 of Inside Macintosh.
; If you draw a PICT2 pict to a color window with a palette
; (e.g. a PALETTE-WINDOW below), it will copy the color table
; to the palette. Does not yet have any way to clean up your
; desktop. You can always close all the color windows, then
; zoom the listener to fill the screen and back.
; See the function DISPLAY-PICT-FILE for an example of use.
;;;;;;;
;;
;; Modification history
;;
;; 10/18/95 bill open-pict-output-file writes 10 bytes, not 8 for the header,
;; and it initializes *pict-output-handle* correctly so that
;; *put-pict-data* will update the length field and the pict
;; writing code will word-align the opcodes.
;; ------------- 3.0
;; 11/17/93 bill save-pict-to-file, :creator keyword to with-pict-output-file
;; 03/18/93 bill load-pict-file. Warnings on use of open-pict-input-file
;; 04/17/92 bill Steve Miner's def-load-pointers for *std-bits-proc*
;; ------------- 2.0
;; 12/18/91 bill (from STEVE.M) remove %getport, it's in the kernel.
;; scale-point -> scale-lisp-point so it won't conflict with
;; ccl:library;quickdraw.lisp.;;
;; 10/08/91 bill move to CCL package
;;
#-ccl-2
(eval-when (:compile-toplevel :load-toplevel :execute)
(error "This code expects MCL 2.0 or later."))
;;(in-package :ccl)
(require :mac-file-io) ; high-level File I/O ala Inside Macintosh
(eval-when (:compile-toplevel :load-toplevel :execute)
(export '(with-pict-input-file with-pict-output-file display-pict-file
palette-window load-pict-file)))
(defvar *pict-input-pb* nil)
(defpascal *get-pict-data* (:ptr dataPtr :word byteCount)
(FSRead *pict-input-pb* byteCount dataPtr 0 nil))
(defvar *pict-output-pb* nil)
(defvar *pict-output-handle* nil)
(defpascal *put-pict-data* (:ptr dataPtr :word byteCount)
(FSWrite *pict-output-pb* byteCount dataPtr 0 nil)
(let ((handle *pict-output-handle*))
(when handle
(rset handle :picture.picsize
(+ byteCount (rref handle :picture.picsize))))))
; Color palette stuff.
; Note that this initial palette is all black.
; It really should be initialized to the default
; system color table for the device with the most bits.
; It works because set the palette from a PICT that is
; drawn here.
(defun add-palette (window)
(when (window-color-p window)
(let ((wptr (wptr window)))
(when (%null-ptr-p (#_GetPalette wptr))
(#_SetPalette
wptr
(#_NewPalette 256 (%null-ptr) 2 0 )
nil)))))
(defun remove-palette (window)
(when (window-color-p window)
(let* ((wptr (wptr window))
(palette (#_GetPalette wptr)))
(declare (dynamic-extent palette))
(unless (%null-ptr-p palette)
(#_SetPalette wptr (%null-ptr) nil)
(#_DisposePalette palette)))))
(defclass palette-window (window) () ; a class for 8-bit graphics
(:default-initargs
:color-p t
:grow-icon-p nil))
(defmethod initialize-instance :after ((w palette-window) &key)
(add-palette w))
(defmethod window-close :before ((w palette-window))
(remove-palette w))
;;; ********** This has to appear after the macro with-pict-outout-file
;;; and so is farther down in this file
#|(defun canvas-to-pict-file (canvas &key (filepathname NIL))
"Writes out the canvas contents to a PICT file via~
the draw commands necessary to reproduce the canvas as displayed. ~
(:key ~
(:arg filepathname NIL Complete pathname for the saved PICT file. If NIL, ~
then the user is prompted for a filename.))"
.... ETCETERA SEE BELOW) |#
(defvar *std-bits-proc* nil)
(def-load-pointers *std-bits-proc* ()
(setq *std-bits-proc* (%int-to-ptr 0)))
(defvar *bits-proc-cnt* 0)
(defvar *palette-changes* 0)
(defpascal *bits-proc* (:ptr srcBits :ptr srcRect :ptr dstRect
:word mode :ptr rgnHandle)
(incf *bits-proc-cnt*)
(let* ((port (ccl::%getPort)))
(declare (dynamic-extent port))
(when (and (logbitp 15 (rref srcBits :pixMap.rowBytes :storage :pointer))
(logbitp 15 (rref port :cGrafport.portVersion)))
(let ((palette (#_GetPalette port)))
(declare (dynamic-extent palette))
(unless (%null-ptr-p palette)
(incf *palette-changes*)
(#_CTab2Palette (rref srcBits :pixMap.pmTable :storage :pointer)
palette
2 #x0000) ; tolerant usage, no tolerance
(#_ActivatePalette port)))))
(ff-call *std-bits-proc*
:ptr srcBits :ptr srcRect :ptr dstRect :word mode :ptr rgnHandle))
(eval-when (:compile-toplevel :execute)
(defrecord QDProcs
(textProc :pointer)
(lineProc :pointer)
(rectProc :pointer)
(rRectProc :pointer)
(ovalProc :pointer)
(arcProc :pointer)
(polyProc :pointer)
(rgnProc :pointer)
(bitsProc :pointer)
(commentProc :pointer)
(txMeasProc :pointer)
(getPicProc :pointer)
(putPicProc :pointer)
(opcodeProc :pointer)
(newProc1 :pointer)
(newProc2 :pointer)
(newProc3 :pointer)
(newProc4 :pointer)
(newProc5 :pointer)
(newProc6 :pointer))
(defconstant $CQDProcs-size (record-length :QDProcs))
(defconstant $QDProcs-size (- $CQDProcs-size (* 7 4)))
)
(defvar *pict-input-grafProcs* nil)
; Offsets in the GrafProcs structure that we allocate for storing our state
(defconstant $gpWptr 0)
(defconstant $gpPictHand 4)
(defconstant $gpOldGrafProcs 8)
(defconstant $gpHeaderSize 12)
(defconstant $pictureSize 10) ; length of a PICTURE header
; Returns a PICTURE handle on which you can call _DrawPicture to the window.
; If error, signal if errorp is true, or return two values, NIL and the
; error number. Note that you should never use this except when balanced
; with a call to close-pict-file (the easiest way to do this is with-pict-input-file).
; It modifies the :grafport.grafProcs field of window's wptr. close-pict-file does
; the restoration. Also, only one pict file at a time can be open with this file.
; #_DrawPicture on the resultant picture handle will work only to the specified
; window.
(defun open-pict-input-file (filename window &optional (errorp t))
(let ((old-pb *pict-input-pb*)
pb pict-hand errnum grafProcs)
(when old-pb
(error "A picture input file is already open"))
(unwind-protect
(progn
(setq *pict-input-pb* t) ; grab it
(let* ((wptr (wptr window))
(color-p (window-color-p window))
(size (if color-p $CQDProcs-size $QDProcs-size)))
(setq grafProcs (#_NewPtr :errchk (+ $gpHeaderSize size)))
(setq pict-hand (#_NewHandle :errchk $pictureSize))
(multiple-value-setq (pb errnum) (FSOpen filename nil 0 errorp))
(if (not pb)
(values nil errnum)
(let ((oldGrafProcs (rref wptr :grafport.grafProcs))
(newGrafProcs (%inc-ptr GrafProcs $gpHeaderSize)))
(declare (dynamic-extent oldGrafProcs newGrafProcs))
(%put-ptr grafProcs wptr $gpWptr)
(%put-ptr grafProcs pict-hand $gpPictHand)
(%put-ptr grafProcs oldGrafProcs $gpOldGrafProcs)
(if (%null-ptr-p oldGrafProcs)
(if color-p
(#_SetStdCProcs newGrafProcs)
(#_SetStdProcs newGrafProcs))
(#_BlockMove oldGrafProcs newGrafProcs size))
(setFpos pb 512) ; skip MacDraw header block
(with-pointers ((pict pict-hand))
(FSRead pb $pictureSize pict)) ; read size & picture frame
(rset newGrafProcs :QDProcs.getPicProc *get-pict-data*)
(when (window-color-p window)
(let ((bitsProc (rref newGrafProcs :QDProcs.bitsProc)))
(declare (dynamic-extent bitsProc))
(unless (eql *bits-proc* bitsProc)
(%setf-macptr *std-bits-proc* bitsProc)
(rset newGrafProcs :QDProcs.bitsProc *bits-proc*))))
(setq *pict-input-GrafProcs* grafProcs
*pict-input-pb* pb)
(rset wptr :grafport.grafProcs newGrafProcs)
pict-hand
))))
(when (eq t *pict-input-pb*)
(if pb (FSClose pb))
(setq *pict-input-pb* nil)
(when grafProcs
(#_DisposePtr grafProcs))
(when pict-hand
(#_DisposeHandle pict-hand))))))
(defun close-pict-input-file (pict-hand)
(let ((grafProcs *pict-input-GrafProcs*)
(pb *pict-input-pb*))
(unless pb
(error "No picture input file open."))
(unless (eql pict-hand (%get-ptr grafProcs $gpPictHand))
(error "~s is not the pict-hand returned from open-pict-input-file"
pict-hand))
(let ((wptr (%get-ptr grafProcs $gpWptr))
(oldGrafProcs (%get-ptr grafProcs $gpOldGrafProcs)))
(rset wptr :grafport.GrafProcs oldGrafProcs)
(#_DisposePtr grafProcs)
(#_DisposeHandle pict-hand)
(FSClose pb)
(setq *pict-input-GrafProcs* nil
*pict-input-pb* nil))))
(defmacro with-pict-input-file ((pict-hand filename window) &body body)
`(let ((,pict-hand (open-pict-input-file ,filename ,window)))
(unwind-protect
(progn ,@body)
(close-pict-input-file ,pict-hand))))
(defvar *pict-output-GrafProcs* nil)
; Picture output to a file.
; Sets up to output a picture to the file named filename.
; Picture output will be done on the given window in the picture
; frame described by the two points topleft & botright
; Same limitations as for open-pict-input-file. You need to balance
; open-pict-output-file calls with close-pict-output-file, and you
; can only open one pict output file at a time.
(defun open-pict-output-file (filename window topleft botright
&key creator)
(unless creator
(setq creator "dPro")) ; MacDraw Pro
(let ((old-pb *pict-output-pb*)
pb pict-hand grafProcs)
(when old-pb
(error "A picture output file is already open"))
(unwind-protect
(progn
(setq *pict-output-pb* t) ; grab it
(create-file filename
:mac-file-type "PICT"
:mac-file-creator creator)
(let* ((wptr (wptr window))
(color-p (window-color-p window))
(size (if color-p $CQDProcs-size $QDProcs-size)))
(setq grafProcs (#_NewPtr :errchk (+ $gpHeaderSize size)))
(setq pb (FSOpen filename t))
(let ((oldGrafProcs (rref wptr :grafport.grafProcs))
(newGrafProcs (%inc-ptr GrafProcs $gpHeaderSize)))
(declare (dynamic-extent oldGrafProcs newGrafProcs))
(%put-ptr grafProcs wptr $gpWptr)
(%put-ptr grafProcs oldGrafProcs $gpOldGrafProcs)
(if (%null-ptr-p oldGrafProcs)
(if color-p
(#_SetStdCProcs newGrafProcs)
(#_SetStdProcs newGrafProcs))
(#_BlockMove oldGrafProcs newGrafProcs size))
(%stack-block ((data (max 4 $PictureSize) :clear t))
(dotimes (i (/ 512 4))
(FSWrite pb 4 data)
(FsWrite pb $PictureSize data)))
(rset newGrafProcs :QDProcs.putPicProc *put-pict-data*)
(unwind-protect
(progn
(rset wptr :grafport.grafProcs newGrafProcs)
(setq *pict-output-GrafProcs* t
*pict-output-pb* pb)
(rlet ((picFrame :rect :topleft topleft :bottomright botright))
(with-port wptr
(setq pict-hand (#_OpenPicture picFrame)
*pict-output-handle* pict-hand)))
(unless (%null-ptr-p pict-hand)
(setq *pict-output-GrafProcs* GrafProcs)
(%put-ptr grafProcs pict-hand $gpPictHand)))
(when (eq t *pict-output-GrafProcs*)
(setq *pict-output-pb* t)
(rset wptr :grafport.grafProcs oldGrafProcs)))
pict-hand
)))
(when (eq t *pict-output-pb*)
(if pb (FSClose pb))
(setq *pict-output-pb* nil
*pict-output-handle* nil)
(when grafProcs
(#_DisposePtr grafProcs))))))
(defun close-pict-output-file (pict-hand)
(let ((grafProcs *pict-output-GrafProcs*)
(pb *pict-output-pb*))
(unless pb
(error "No picture output file open."))
(unless (eql pict-hand (%get-ptr grafProcs $gpPictHand))
(error "~s is not the pict-hand returned from open-pict-output-file"
pict-hand))
(let ((wptr (%get-ptr grafProcs $gpWptr))
(oldGrafProcs (%get-ptr grafProcs $gpOldGrafProcs)))
(with-port wptr
(#_ClosePicture))
(rset wptr :grafport.GrafProcs oldGrafProcs)
(#_DisposePtr grafProcs)
(SetFpos pb 512)
(with-pointers ((pict pict-hand))
(FSWrite pb $PictureSize pict))
(#_KillPicture pict-hand)
(FSClose pb)
(setq *pict-output-GrafProcs* nil
*pict-output-handle* nil
*pict-output-pb* nil))))
(defmacro with-pict-output-file ((filename window topleft botright &key creator) &body body)
(let ((pict-hand (make-symbol "PICT-HAND")))
`(let ((,pict-hand (open-pict-output-file
,filename ,window ,topleft ,botright :creator ,creator)))
(unwind-protect
(progn ,@body)
(close-pict-output-file ,pict-hand)))))
;;; ********** This has to appear after the macro with-pict-outout-file
(defun canvas-to-pict-file (canvas &key (filepathname NIL))
"Writes out the canvas contents to a PICT file via~
the draw commands necessary to reproduce the canvas as displayed. ~
(:key ~
(:arg filepathname NIL Complete pathname for the saved PICT file. If NIL, ~
then the user is prompted for a filename.))"
(unwind-protect
(progn
(when (null filepathname)
(setf filepathname
(ccl::choose-new-file-dialog :prompt "Save canvas as PICT file ..."))
(with-pict-output-file
(filepathname canvas (ccl::make-point 0 0)
(ccl::make-point (canvas-width canvas)
(canvas-height canvas)))
(redisplay canvas))
))))
(defun scale-lisp-point (point factor)
(ccl::make-point (round (* (point-h point) factor))
(round (* (point-v point) factor))))
(defun display-pict-file (filename &optional (scale-factor 1) window)
(unless window
(setq window (make-instance 'palette-window :window-show nil)))
(with-pict-input-file (pict filename window)
(let* ((topleft (scale-lisp-point (rref pict :picture.picFrame.topLeft) scale-factor))
(bottomright (scale-lisp-point (rref pict :picture.picFrame.bottomRight)
scale-factor))
(size (subtract-points bottomright topleft)))
(set-view-size window size)
(rlet ((rect :rect :topleft topleft :bottomright bottomright))
(window-select window)
(event-dispatch)
(with-focused-view window
(#_DrawPicture pict rect))))))
; Sometimes you want to load a pict file into memory.
(defun load-pict-file (pathname)
(with-FSOpen-file (pb pathname)
(let* ((size (- (getEOF pb) 512))
(pict (#_NewHandle :errchk size)))
(setFpos pb 512)
(with-dereferenced-handles ((pict-pointer pict))
(FSRead pb size pict-pointer))
pict)))
; Sometimes you want to store a pict into a file
(defun store-pict-to-file (pict pathname &key
(if-exists :error)
(creator "dPro")) ; MacDraw Pro
(setq pict (require-type pict 'macptr))
(create-file pathname
:if-exists if-exists
:mac-file-type "PICT"
:mac-file-creator creator)
(with-FSOpen-file (pb pathname t)
(%stack-block ((header 512))
(dotimes (i 512) (setf (%get-byte header i) 0))
(FSWrite pb 512 header))
(with-dereferenced-handles ((pict-pointer pict))
(FSWrite pb (#_GetHandleSize pict) pict-pointer))))
(provide :picture-files)
#|
; Example of use
(defparameter *w* (make-instance 'window :view-size #@(200 200) :color-p t))
(defvar *picture-file* "ccl:picture-file.temp")
; Draw a square with an X inside and save it to *picture-file*
(defun make-it ()
(delete-file *picture-file*)
(window-select *w*)
(with-focused-view *w*
(with-pict-output-file (*picture-file* *w* #@(0 0) #@(200 200))
(#_MoveTo 50 50)
(#_LineTo 150 50)
(#_LineTo 150 150)
(#_LineTo 50 150)
(#_LineTo 50 50)
(#_LineTo 150 150)
(#_MoveTo 150 50)
(#_LineTo 50 150))
(#_EraseRect (rref (wptr *w*) :windowRecord.portrect))))
; Draw the picture that is in *picture-file* on *w* inside the given rect.
(defun draw-it (&optional (bottomright #@(200 200)) (topleft #@(0 0)))
(window-select *w*)
(with-focused-view *w*
(#_EraseRect (rref (wptr *w*) :windowRecord.portrect))
(with-pict-input-file (pict *picture-file* *w*)
; Real code would probably want to access
; (rref pict :picture.picFrame.topleft) &
; (rref pict :picture.picFrame.bottomright) here
(unless topleft (setq topleft (rref pict :picture.picFrame.topLeft)))
(unless bottomright (setq bottomright (rref pict :picture.picFrame.bottomRight)))
(rlet ((rect :rect :topleft topleft :bottomright bottomright))
(#_DrawPicture pict rect)))))
(defun do-it ()
(make-it)
(draw-it))
|#
#|
Change History (most recent last):
2 12/27/94 akh merge with d13
|# ;(do not edit past this line!!)
| 39,896 | Common Lisp | .cl | 846 | 32.864066 | 116 | 0.529932 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 9a6f384909a2f44d60364d2a1eaf0f7f6cdcf538a93b6ee70f8ad2c955ac6c97 | 32,881 | [
-1
] |
32,882 | functions-mcl.lsp | rwoldford_Quail/source/display-network/functions-mcl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; quail-functions-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; Copyright (c) 1991 Statistical Computing Laboratory, University of Waterloo
;;;
;;;
;;; Authors:
;;; G. Desvignes 1988 - 1989
;;; R.W. Oldford 1985 - 1991.
;;;
;;;
;;;--------------------------------------------------------------------------------
(in-package :quail)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(access-expression
quail-print-help
quail-prompt-read
edit-text
get-last-typed-command
get-user-name)))
;;;
;;; functions definitions
;;;
(defun access-expression (variable)
"Returns an expression which returns variable when it is evaluated."
#|
(when (listp variable)
(setq variable (first variable)))
(let ((name (pcl::get-name variable)))
(or name
(list 'ccl:%int-to-ptr
(%ptr-to-int variable))))
|#
)
;;; function access-object is useless for mac
;;; function key-for-access is useless for mac
(defun quail-print-help (message &key font-family font-size font-case)
"Print a Help message in the help window using given font if any."
(declare (special *quail-help-window*))
(declare (ignore font-family font-size))
(declare (object-variable wptr))
(unless (and (boundp '*quail-help-window*)
(wptr *quail-help-window* ))
(setq *quail-help-window*
(make-instance 'ccl:listener
:window-type :document
:window-title "Quail Help Window"
:window-size (make-point 400 200)
:window-position (make-point 0 280))))
;; only changement of font case is implemented
(let ((previous-font (ccl:view-font *quail-help-window*)))
(if (string= (symbol-name font-case) "BOLD")
(ccl:set-window-font *quail-help-window*
(append '(:bold)
(view-font *quail-help-window*))))
(pprint message *quail-help-window*)
(ccl:set-view-font *quail-help-window* previous-font)
nil))
(defun quail-prompt-read (message)
"Ask the user for an input using a standard *quail-prompt-window*."
(let ((*quail-prompt-window*
(make-instance 'ccl:listener
:window-type :document
:window-title "Quail Prompt Window"
:window-size (make-point 300 70)
:window-position (make-point 15 50)))
result)
(terpri *quail-prompt-window*)
(princ message *quail-prompt-window*)
(princ " > " *quail-prompt-window*)
(setq result (read-line))
(if (string= result "")
(setq result nil)
(setq result (read-from-string result)))
(ccl:window-close *quail-prompt-window*)
result))
(defun edit-text (text &key (read-only nil))
"If read-only is t we read the text, ~
otherwise we return the string made by concatenating text with the new entry. ~
Default of read-only is T."
(if read-only
(quail-print-help text)
(let (new-line)
(quail-print text)
(quail-print "")
(princ "Add new note > ")
(if (equal "" (setq new-line (read-line)))
(concatenate 'string text "
" new-line)))))
(defun get-last-typed-command ()
"Returns the last command typed in the listener."
+)
(defun get-user-name ()
'quail-user)
(defun set-window-icon (window icon)
;;; useless for Mac
(declare (ignore window))
icon)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; functions to make window shrink into an ICON
;;;
(defclass icon-window (canvas)
((icon :initarg :icon :accessor icon-of :initform NIL)
(window-owner :initarg :window-owner :accessor window-owner-of :initform NIL))
)
(defmethod window-zoom-event-handler ((self browser) &rest args)
"When middle-button is pressed inside the zoom region, we should make an icon with ~
window and hide window."
(declare (ignore args))
(if (ccl:option-key-p)
(let* ((i-window (icon-w-of self))
icon)
(unless i-window
(when (slot-exists-p (browser-of self)
'sub-view-icon)
(setq icon (eval (slot-value (browser-of self)
'sub-view-icon)))
(setq i-window (make-canvas
:canvas-class 'icon-window
:window-owner self
:icon icon
:window-type :single-edge-box
:window-show nil
:window-size (make-point (wb:bitmap-width icon)
(wb:bitmap-height icon))
:window-position (ccl:rref *current-event* :event.where)))
(setf (icon-w-of self) i-window)))
;; when the icon window is built we can close the main window
(when i-window
(window-show i-window)
(window-hide self)))
(call-next-method)))
(defmethod view-draw-contents ((self icon-window))
"Redraw the icon inside the window."
(let ((my-icon (icon-of self))
(title (icon-title
(browser-of (window-owner-of self)))))
(canvas-bitblt my-icon self
:canvas-left 0 :canvas-bottom (- (bitmap-height my-icon)))
(set-view-font self '("helvetica" 10))
(canvas-move-to (max 2 (ash (- (bitmap-width my-icon)
(string-width title)) -1))
-9 self)
;;(#_TextMode :word (penmode-arg :patXor))
(wb:canvas-draw-string title self)))
(defmethod window-click-event-handler ((self icon-window) where)
"If the button is double clicked, the icon is closed and the associated ~
window is opened; a simple click is treated as a window-event."
(declare (ignore where))
(when (double-click-p)
(window-hide self)
(window-select (window-owner-of self))))
(defmethod window-event ((self icon-window))
"In the classical event treatment, there are no methods to detect ~
a mouse-down event. ~
We must therefore add the test in the main function and call drag-window if a ~
mouse down event is detected."
(if (eq (rref *current-event* :event.what) 1)
(#_DragWindow :ptr (wptr self)
:long (rref *current-event* :event.where)
:ptr (make-record :rect :top 0 :left 0 :bottom 1000 :right 1000)))
(call-next-method))
| 6,962 | Common Lisp | .cl | 166 | 32.036145 | 87 | 0.548402 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 036aabf7ce0f1f8b992ff8b481bc9770551755f56936642ca3909d44a6dc1349 | 32,882 | [
-1
] |
32,883 | icon-mcl.lsp | rwoldford_Quail/source/display-network/icon-mcl.lsp | ;;; -*- Mode: LISP -*-
;;;
;;; this file creates the bitmap used for Quail icons
;;;
;;; this bitmaps can not be defined as constants or parameters because if we
;;; do so, the part corresponding to the bit-array is not saved with dumplisp
;;; which means that our bitmap is empty
;;; Instead of this, the icons are bound with an expression looking like
;;; (get-icon-from-list number) where number identifies the rank of the icon
;;; in a list which is created each time the system is reloaded using the
;;; *restore-lisp-functions* variable which is updated to contain the function
;;; init-list-of-icons
(in-package :quail)
(use-package :specific)
(defun get-icon-from-list (number)
;;; retrieve the icon given its number in the list
(declare (special *list-of-icons*))
(nth (- number 1) *list-of-icons*))
(defconstant analysis-map-icon '(get-icon-from-list 1))
(defconstant analysis-path-icon '(get-icon-from-list 2))
(defconstant analysis-path-icon-mask '(get-icon-from-list 3))
(defconstant analysis-path-map-icon '(get-icon-from-list 4))
(defconstant quail-objects-icon '(get-icon-from-list 5))
(defconstant quail-objects-icon-mask '(get-icon-from-list 6))
(defconstant map-icon '(get-icon-from-list 7))
(defconstant map-icon-mask '(get-icon-from-list 8))
(defconstant toolbox-icon '(get-icon-from-list 9))
(defconstant toolbox-icon-mask '(get-icon-from-list 10))
(defconstant toolbox-map-icon '(get-icon-from-list 11))
(defconstant view-icon '(get-icon-from-list 12))
(defconstant zoom-icon '(get-icon-from-list 13))
(defconstant zoom-icon-mask '(get-icon-from-list 14))
(defun transform-array-in-bitmap (bitmap-width the-array)
;;; make a bitmap with an array of integer and a width for the bitmap
(let* ((the-bitmap (make-bitmap :width bitmap-width
:height (array-dimension the-array 1)))
(bm (ccl:rref (bitmap-raw-bitmap the-bitmap) bitmap.baseaddr))
(offset 0))
(ccl:rset (bitmap-raw-bitmap the-bitmap) bitmap.rowBytes
(array-dimension the-array 0))
(dotimes (y (array-dimension the-array 1))
(dotimes (x (array-dimension the-array 0))
(ccl:%put-byte bm (aref the-array x y) offset)
(setq offset (+ 1 offset))))
the-bitmap))
(defun init-list-of-icons ()
(declare (special *list-of-icons*))
(defvar *list-of-icons*
(list
;; icon number 1 analysis-map-icon
(transform-array-in-bitmap 77
'#2A((255 255 255 255 255 255 255 255 255 255 255 240 224 192 195 195 195
195 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192
192 192 192 192 224 240 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 255 255 255 255
16 8 4 2 7 7 4 5 4 4 4 7 0 0 0 0 3 3 3 3 0 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 129 129 129 129 0
0 0 0 255 255 0 180 68 73 0 255 16 16 16 16 255 255 255 255 0 0 255
255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 255 255 255 255 8
16 32 64 224 224 32 160 32 160 32 224 0 0 0 0 128 128 128 128 0 0
255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 195 195 195 195 0
0 0 0 0 3 3 3 3 0 0 0 0 1 63 63 63 63 0 0 0 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 255 255 255 255
16 16 16 16 16 255 255 255 255 16 32 64 128 0 248 248 248 248 0 0 0
0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 128 128 128 128 0
0 0 0 0 128 128 192 160 16 8 4 2 1 0 0 0 0 0 0 0 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 15 15 15 15 0 0 0
0 0 0 0 0 0 0 0 0 31 31 144 86 49 17 16 31 0 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 254 254 254 254
64 64 64 64 64 64 64 64 64 64 64 64 255 255 0 210 16 38 0 255 0 0
255 255)
(248 248 248 248 248 248 248 248 248 248 248 120 56 24 24 24 24 24
24 24 24 24 24 24 24 24 24 24 24 24 152 152 152 152 152 152 152 152
56 120 248 248)))
;; icon number 2 analysis-path-icon
(transform-array-in-bitmap 70
'#2A((0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 255 255 192 192 192 192 192 192 192 192 192 192 192
192 192 192 192 192 192 192 192 192 192 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255
255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 28 34 34 65 65 65 65 83 65 65 65 65
65 65 83 65 65 65 65 65 65 67 80 64 64 64 64 64 64 64 81 64 64 64
64 64 64 64 64 64 32 32 32 16 16 16 8 8 8 8 4 4 4 4 4 8 8 8 0 0 255
255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 30 33 33 64 64 64 64 64 64 64 64 64 82 64 64 64 64 64 64 64
64 82 64 64 64 64 64 64 64 64 64 64 82 128 0 0 0 0 0 0 1 16 0 0 0 0
0 2 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 15 16 16 32 32 32 160 160 160 160 160 169 160 160 160 160 160 160
160 160 160 160 169 160 160 160 160 160 160 160 160 160 160 160 169
160 64 0 0 4 0 4 32 0 0 4 0 1 8 64 0 32 0 129 0 4 0 8 0 16 0 16 0 8
0 0 0 0 0 0 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 255 255)
(0 0 128 128 71 72 72 80 80 80 80 80 80 80 80 80 84 80 80 80 80 80
80 80 80 84 80 80 80 80 80 80 80 80 80 80 84 32 0 0 128 0 0 0 0 1 8
32 4 0 16 0 64 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 255 255
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 128 64 64 32 32 32 32 32 32 32 32 32 160 32 32 32 32 32 32
32 32 160 32 32 32 32 32 32 32 32 32 32 160 32 16 16 16 8 5 2 0 1 0
0 0 0 0 0 0 0 1 2 4 8 16 32 64 128 128 128 0 0 0 0 0 0 128 128 128
0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 4
8 16 16 36 32 64 128 129 1 2 2 4 4 8 136 16 16 32 64 128 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 224
16 8 16 32 32 64 64 128 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 252 252 12 12 12 12 12 12 12 12 12 12
12 12 12 12 12 12 12 12 12 12 12 252 252)))
;; icon number 3 analysis-path-icon-mask
(transform-array-in-bitmap 70
'#2A((0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 28 62 62 127 127 127 127 127 127 127
127 127 127 127 127 127 127 127 127 127 127 127 127 127 127 127 127
127 127 127 127 127 127 127 127 127 127 127 127 127 63 63 63 31 31
31 15 15 15 15 7 7 7 7 7 15 15 15 0 0 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255)
(0 0 0 0 30 63 63 127 127 127 127 127 127 127 127 127 127 127 127
127 127 127 127 127 127 127 127 127 127 127 127 127 127 127 127 127
127 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255)
(0 15 31 31 63 63 63 191 191 191 191 191 191 191 191 191 191 191 191
191 191 191 191 191 191 191 191 191 191 191 191 191 191 191 191 191
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255)
(0 0 128 128 199 207 207 223 223 223 223 223 223 223 223 223 223 223
223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223
223 223 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 0 0 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255)
(0 0 0 0 128 192 192 224 224 224 224 224 224 224 224 224 224 224 224
224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224
224 224 240 240 240 248 253 255 255 255 255 255 255 255 255 255 255
255 255 254 252 248 240 224 192 128 128 128 0 0 0 0 0 0 128 128 128
0 0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 3 7
15 31 31 63 63 127 255 255 255 254 254 252 252 248 248 240 240 224
192 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 224
240 248 240 224 224 192 192 128 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 252 252 252 252 252 252 252 252
252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252
)))
;; icon number 4 analysis-path-map-icon
(transform-array-in-bitmap 77
'#2A((255 255 255 255 255 255 255 255 255 255 255 240 224 192 192 192 192
192 192 192 207 200 200 232 200 200 200 200 200 202 200 200 201 200
200 200 196 194 225 240 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 3 12 16 17 34 36 36
231 36 36 36 36 36 36 36 36 165 36 36 36 0 33 8 128 0 255 0 255 255
)
(255 255 255 255 255 255 255 255 255 255 255 0 0 252 3 0 248 4 2 2
242 18 18 18 18 18 18 18 18 82 18 18 146 18 18 33 65 128 0 0 255
255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 128 129 70 72
73 72 70 65 64 64 64 65 70 72 73 72 70 65 64 32 31 0 192 63 0 255
255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 15 112 128 15 112
128 112 14 193 56 6 56 193 14 112 128 112 14 193 56 6 248 1 6 248 0
255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 254 1 0 252 2 1 1
1 129 65 65 65 129 1 1 5 5 5 132 68 68 68 132 2 1 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 1 129 66 66 34 34
34 34 34 34 34 34 34 34 34 34 34 42 0 136 0 0 145 0 255 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 63 192 0 31 32 64 79
72 72 68 69 66 66 65 65 64 64 80 80 80 16 144 16 16 16 33 195 0 255
255)
(255 255 255 255 255 255 255 255 255 255 255 0 128 96 16 16 136 72
207 72 72 0 36 1 17 2 34 132 132 72 72 72 72 72 72 72 72 254 255 0
255 255)
(248 248 248 248 248 248 248 248 248 248 248 120 56 24 24 24 24 24
216 88 88 152 152 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 56
120 248 248)))
;; icon number 5 quail-objects-icon
(transform-array-in-bitmap 50
'#2A((0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 2 2 6 4 13 9 9 9 9 17 17 17 48
32 32 32 32 48 16 16 16 16 24 8 12 6 2 3 1 0 0 0)
(0 0 0 0 0 1 3 6 12 24 16 48 96 64 192 128 0 0 0 0 0 0 255 0 0 0 0 0
0 255 0 0 0 0 0 0 0 0 0 60 38 34 34 34 38 60 128 224 56 31)
(7 28 48 96 192 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 226 36 40 48 48
40 36 226 1 0 0 0 0 0 0 0 0 72 76 74 73 72 72 72 0 0 0 255)
(240 28 6 3 1 0 0 0 0 0 0 0 0 0 0 63 32 32 32 96 160 32 63 0 0 0 0 0
0 63 32 160 96 32 32 32 63 0 0 39 36 36 36 164 100 39 0 0 0 255)
(0 0 0 0 128 192 96 48 24 8 4 6 2 1 1 252 4 4 4 4 4 4 252 0 0 0 0 0
0 252 4 4 4 4 4 4 252 0 0 143 200 72 79 72 200 143 0 0 7 254)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 128 192 64 96 32 48 24 8 12 4 4 4 6 2 2
2 3 1 1 1 1 3 2 2 2 130 6 4 12 8 24 144 48 96 192 0)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
;; icon number 6 quail-objects-icon-mask
(transform-array-in-bitmap 50
'#2A((0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 3 3 7 7 15 15 15 15 15 31 31 31
63 63 63 63 63 63 31 31 31 31 31 15 15 7 3 3 1 0 0 0)
(0 0 0 0 0 1 3 7 15 31 31 63 127 127 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 63 31)
(7 31 63 127 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255)
(240 252 254 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255)
(0 0 0 0 128 192 224 240 248 248 252 254 254 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 254)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 128 192 192 224 224 240 248 248 252 252
252 252 254 254 254 254 255 255 255 255 255 255 254 254 254 254 254
252 252 248 248 240 240 224 192 0)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
;; icon number 7 map-icon
(transform-array-in-bitmap 50
'#2A((0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 3 2 6 4 15 8 8 8 8 15 12 4 4 4 4 6 2
3 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 192 192 192 192 192 192
192 192 192 192 192 192 192 192 192 192 192 192 192 192 192 255 255
)
(0 0 0 0 0 0 1 3 6 12 26 51 97 224 16 8 4 2 1 128 112 14 1 0 255 0
3 2 2 2 1 1 1 1 128 192 112 28 6 3 1 0 0 0 0 0 0 0 0 0 255 255 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 126 227 34 34 50 18 18 18 146 214 76 37 53 18 154 74 54
155 106 255 0 255 0 0 0 0 0 0 128 128 128 112 28 7 1 128 192 112
28 7 0 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
255 255)
(0 0 0 0 0 0 128 224 48 48 40 108 68 70 194 143 49 99 70 76 145 179
47 254 0 0 192 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 128 255 18 19
31 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 3 6 12 24 16 16 16 24 8 12 204 88 208 176 96 192 0 0
0 0 0 0 0 0 0 0 0 0 6 12 24 48 224 0 0 1 3 14 248 0 0 248 0 255
255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 192 96 48 216 222 27 25 24 63 56 60 60 92 94 95 223
159 142 128 192 64 64 64 64 96 32 48 32 32 32 32 32 96 64 192 128
0 0 0 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 128 128 192 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 192 192 192 192 192 192
192 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192
192 192 192)))
;; icon number 8 map-icon-mask
(transform-array-in-bitmap 50
'#2A((0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 3 3 7 7 15 15 15 15 15 15 15 7 7 7 7
7 7 7 7 3 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255)
(0 0 0 0 0 0 1 3 7 15 31 63 127 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 127 31 7 3
1 0 0 0 0 0 0 0 0 0 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255)
(0 0 0 0 0 126 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 127 31 7 0 0 0 0 0 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255)
(0 0 0 0 0 0 128 224 240 240 248 252 252 254 254 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 18 19 31 0 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255)
(0 0 0 0 0 0 0 3 7 15 31 31 31 31 31 15 15 207 223 223 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 254 248 0 0 248 0 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255)
(0 0 0 0 0 0 0 192 224 240 248 254 255 255 255 255 248 252 252 220
222 223 223 159 159 128 192 192 192 192 192 224 224 240 224 224 224
224 224 224 192 192 128 0 0 0 0 0 0 0 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 128 128 192 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 192 192 192 192 192 192 192
192 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192
192)))
;; icon number 9 toolbox-icon
(transform-array-in-bitmap 100
'#2A((0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 1 1 2 2 4 4 8 8 16 32 64 128 128 128 128 128 128
128 128 128 128 128 128 128 128 128 128 143 143 132 132 132 132 143
143 128 128 255 0 255 255 192 192 192 192 192 192 192 192 192 192
192 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192
192 192 192 192 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 6 24 32 64 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 142 206 68 68 68 68 206 142 0 0 255 0 255 255 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 1 6 24 96 64 65 65 65 65 65 65 65 65 65 65 65
65 65 65 65 65 65 65 65 65 193 65 65 73 65 73 65 73 65 65 65 65 65
65 65 65 65 65 65 65 65 65 65 65 73 65 73 65 73 65 99 62 0 65 97 113
89 77 71 67 65 0 0 255 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 1 6 24 96 129 6 24 96 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 192 49 14 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 62 63 17 17 17 17 63 62 0 0 255 0 255 255 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 1 6 24 96 129 6 24 96 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 1 6 24 96 128 0 0 0 128 64 64 32 32 16 16 8 8 4 2 1 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 62 62 32 56 56 32 62 62 0 0 255 0 255 255 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
6 24 96 129 6 24 96 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
6 24 96 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 6 24 96 128 128 128 128
128 129 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128
128 131 140 176 192 128 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 6 24 96
129 6 24 96 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 6 24 96
128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 6 24 96 128 0 0 0 0 3 12 56 200
8 8 8 8 8 8 8 0 0 0 0 0 0 3 12 48 192 0 0 0 0 0 0 255 255 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 6 24 96 129 6 24
96 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 2 4 8 112 144 16 16
16 16 16 16 16 16 16 16 16 16 16 16 16 17 22 24 96 128 0 0 0 1 2 4 8
200 8 8 8 8 4 3 0 0 0 0 0 0 0 3 12 48 192 0 0 0 0 0 0 0 0 0 0 255
255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 6 24 96 129 6 24 96 128
0 0 0 0 0 0 0 0 0 0 0 0 0 3 4 8 16 32 32 64 64 128 128 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 1 6 24 96 128 0 0 0 0 1 2 2 194 34 18 18 17 16
16 16 32 64 128 0 0 0 3 12 48 192 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255
255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 129 6 24 104 136 8 8 8 8
8 8 8 8 8 8 8 8 8 8 15 56 192 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 0 1 1 6 24 96 128 0 0 0 0 0 0 112 136 4 4 4 4 4 4 8 16 224 0 0
0 0 3 12 48 192 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 224 160 32 32 32 32 32 32 32
32 32 32 32 32 32 32 32 32 32 32 224 56 6 1 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 1 6 24 96 128 0 0 0 0 0 1 1 128 128 128 128 128 128
128 140 176 192 0 0 0 0 3 12 48 192 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 128 64 32 16 8 8 4 4 2 2 1 1 0 0 0 0 1 6 24 96 128
0 0 0 0 0 0 48 72 128 0 0 248 4 4 4 136 112 0 0 0 0 3 12 48 192 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 128 64 32 112 144 16 16 16
16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 48 192 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 240 240 48
48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48
48 48 48 48 48 48 48 240 240)))
;; icon number 10 toolbox-icon-mask
(transform-array-in-bitmap 100
'#2A((0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 1 1 3 3 7 7 15 15 31 63 127 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 0 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 7 31 63 127 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 0 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 1 7 31 127 127 127 127 127 127 127 127 127
127 127 127 127 127 127 127 127 127 127 127 127 127 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 0 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 1 7 31 127 255 254 248 224 128 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 192 241 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 0 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 1 7 31 127 255 254 248 224 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 1 7 31 127 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 0 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
7 31 127 255 254 248 224 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 7 31 127 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 252 240 192 128
0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 7 31
127 255 254 248 224 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
7 31 127 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 252 240 192 0 0 0 0
0 0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 7 31 127 255
254 248 224 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 3 7 15
127 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 252 240 192 0 0 0 0 0 0 0 0
0 0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 7 31 127 255 254 248
224 128 0 0 0 0 0 0 0 0 0 0 0 0 0 3 7 15 31 63 63 127 127 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 252 240 192 0 0 0 0 0 0
0 0 0 0 0 0 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 255 255 255 239 143 15
15 15 15 15 15 15 15 15 15 15 15 15 15 15 63 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 252 240 192 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 224 224 224 224 224 224 224
224 224 224 224 224 224 224 224 224 224 224 224 224 224 248 254 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 252 240 192 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 128 192 224 240 248 248 252 252 254 254 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 252 240 192
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 128 192 224 240 240 240
240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240
240 240 240 240 240 240 192 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 240 240 240 240 240 240 240 240 240 240 240 240
240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240
240 240 240 240 240 240)))
;; icon number 11 toolbox-map-icon
(transform-array-in-bitmap 77
'#2A((255 255 255 255 255 255 255 255 255 255 255 240 224 192 192 192 192
192 192 192 192 192 192 192 192 192 192 192 193 193 193 192 192 192
192 192 192 192 224 240 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0
0 31 63 127 255 255 227 129 0 0 0 1 3 63 63 31 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0
0 192 224 240 255 255 255 255 255 252 252 252 248 240 224 192 0 255
255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0
0 0 15 255 255 255 255 248 128 0 0 0 0 0 0 0 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0
15 255 255 255 255 248 128 0 0 0 0 0 0 0 0 0 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 0 0 15
255 255 255 255 248 128 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 1 1 1 15 255
255 255 255 248 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 31 63 127 254 252 248
248 248 252 254 255 255 127 63 31 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 192 224 224 0 0 0 0 0
12 60 252 248 240 224 192 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(248 248 248 248 248 248 248 248 248 248 248 120 56 24 24 24 24 24
24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 56 120
248 248)))
;; icon number 12 view-icon
(transform-array-in-bitmap 77
'#2A((255 255 255 255 255 255 255 255 255 255 255 240 224 192 192 192 192
192 192 192 192 192 192 192 192 192 193 193 193 193 193 193 192 192
192 192 192 192 224 240 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 255 255 255 255 255 255 0 0 0 0 0 0 0 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 242 244 248 248 244 242 1 0 0 0 0 0 0 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 15 15
31 47 79 143 0 0 0 0 0 0 0 0 143 79 47 31 15 15 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 255 255
255 255 255 255 0 0 0 0 0 0 0 0 255 255 255 255 255 255 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 1 2 4 200 208
224 224 208 200 4 2 1 0 0 0 0 0 192 192 192 192 192 192 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 63 63 127 191 63 63 0
0 0 0 0 0 0 0 0 63 191 127 63 63 63 0 0 0 0 0 0 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 255 255 255 255 255
255 0 0 0 0 0 0 0 0 0 255 255 255 255 255 255 0 0 0 0 0 0 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(248 248 248 248 248 248 248 248 248 248 248 120 56 24 24 24 24 24
24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 56 120
248 248)))
;; icon number 13 zoom-icon
(transform-array-in-bitmap 50
'#2A((0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 1 1 0 0 0 0 255 255 192 192 192 192 192 192 192 192 192
192 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192
255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 32 80 136 196 98 49 24
12 6 3 1 0 0 0 0 0 0 240 255 255 31 0 0 255 255 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 0 0 0 0 12 15 15 55 71 67 79 49 1 2 4 8 17 10 4 0 0
128 64 32 16 143 199 99 49 24 13 6 0 252 255 255 255 0 255 255 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 1 3 7 15 23 39 199 195 224 241 250 252 254 126 126
190 0 0 0 0 0 0 1 3 15 255 255 255 255 191 1 0 0 0 255 255 255 0
255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(3 4 8 16 32 64 128 0 225 242 244 248 240 252 254 254 63 63 31 31 15
15 15 15 15 31 31 63 255 255 255 254 252 252 248 248 248 248 254
127 255 255 255 254 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 255 255)
(128 192 96 48 16 32 64 128 0 0 0 0 0 0 0 0 0 128 192 192 192 192
192 192 192 192 192 192 128 128 0 0 0 0 0 0 0 0 0 128 128 128 0 0 0
255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 192 192 192 192 192 192 192 192 192 192 192
192 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192
192 192)))
;; icon number 14 zoom-icon-mask
(transform-array-in-bitmap 50
'#2A((0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 1 1 0 0 0 0 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 32 112 248 252 126 63
31 15 7 3 1 0 0 0 0 0 0 240 255 255 31 0 0 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 12 15 15 63 127 127 127 49 1 3 7 15 31 14 4 0
0 128 192 224 240 255 255 127 63 31 15 6 0 252 255 255 255 0 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255)
(0 0 0 0 0 0 0 1 3 7 15 31 63 255 255 255 255 254 252 254 254 254
190 0 0 0 0 0 0 1 3 15 255 255 255 255 191 1 0 0 0 255 255 255 0
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255)
(3 7 15 31 63 127 255 255 255 254 252 248 240 252 254 254 63 63 31
31 15 15 15 15 15 31 31 63 255 255 255 254 252 252 248 248 248 248
254 127 255 255 255 254 0 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255)
(128 192 224 240 240 224 192 128 0 0 0 0 0 0 0 0 0 128 192 192 192
192 192 192 192 192 192 192 128 128 0 0 0 0 0 0 0 0 0 128 128 128 0
0 0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 192 192 192 192 192 192 192 192 192 192 192
192 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192
192 192))))))
(setq *restore-lisp-functions* (append *restore-lisp-functions*
(list #'init-list-of-icons)))
(init-list-of-icons) | 40,999 | Common Lisp | .cl | 578 | 57.084775 | 82 | 0.543001 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | aba02c51016a4a404c31be7e4ecbf91a33f43f193f7bba3b45456b4e172ca8e8 | 32,883 | [
-1
] |
32,884 | quail-icon-mcl.lsp | rwoldford_Quail/source/display-network/quail-icon-mcl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; quail-icon-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; Copyright (c) 1992 Statistical Computing Laboratory, University of Waterloo
;;;
;;;
;;; Authors:
;;; G. Desvignes 1988 - 1989
;;; R.W. Oldford 1985 - 1992.
;;;
;;;
;;;--------------------------------------------------------------------------------
;;;
;;; this file creates the bitmap used for Quail icons
;;;
;;; this bitmaps can not be defined as constants or parameters because if we
;;; do so, the part corresponding to the bit-array is not saved with dumplisp
;;; which means that our bitmap is empty
;;; Instead of this, the icons are bound with an expression looking like
;;; (get-icon-from-list number) where number identifies the rank of the icon
;;; in a list which is created each time the system is reloaded using the
;;; *restore-lisp-functions* variable which is updated to contain the function
;;; init-list-of-icons
(in-package :quail)
(defun get-icon-from-list (number)
"Retrieve the icon given its number in the list."
(declare (special *list-of-icons*))
(nth (- number 1) *list-of-icons*))
(defconstant analysis-map-icon '(get-icon-from-list 1))
(defconstant analysis-path-icon '(get-icon-from-list 2))
(defconstant analysis-path-icon-mask '(get-icon-from-list 3))
(defconstant analysis-path-map-icon '(get-icon-from-list 4))
(defconstant quail-objects-icon '(get-icon-from-list 5))
(defconstant quail-objects-icon-mask '(get-icon-from-list 6))
(defconstant map-icon '(get-icon-from-list 7))
(defconstant map-icon-mask '(get-icon-from-list 8))
(defconstant toolbox-icon '(get-icon-from-list 9))
(defconstant toolbox-icon-mask '(get-icon-from-list 10))
(defconstant toolbox-map-icon '(get-icon-from-list 11))
(defconstant view-icon '(get-icon-from-list 12))
(defconstant zoom-icon '(get-icon-from-list 13))
(defconstant zoom-icon-mask '(get-icon-from-list 14))
(defun transform-array-in-bitmap (bitmap-width the-array)
"Make a bitmap with an array of integer and a width for the bitmap."
(let* ((the-bitmap (wb:make-bitmap :width bitmap-width
:height (array-dimension the-array 1)))
(bm (ccl:rref (wb:bitmap-raw-bitmap the-bitmap) :bitmap.baseaddr))
(offset 0))
(ccl:rset (wb:bitmap-raw-bitmap the-bitmap) :bitmap.rowBytes
(array-dimension the-array 0))
(dotimes (y (array-dimension the-array 1))
(dotimes (x (array-dimension the-array 0))
(ccl:%put-byte bm (aref the-array x y) offset)
(setq offset (+ 1 offset))))
the-bitmap))
(defvar *list-of-icons* NIL)
(defun init-list-of-icons ()
(declare (special *list-of-icons*))
(setf *list-of-icons*
(list
;; icon number 1 analysis-map-icon
(transform-array-in-bitmap 77
'#2A((255 255 255 255 255 255 255 255 255 255 255 240 224 192 195 195 195
195 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192
192 192 192 192 224 240 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 255 255 255 255
16 8 4 2 7 7 4 5 4 4 4 7 0 0 0 0 3 3 3 3 0 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 129 129 129 129 0
0 0 0 255 255 0 180 68 73 0 255 16 16 16 16 255 255 255 255 0 0 255
255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 255 255 255 255 8
16 32 64 224 224 32 160 32 160 32 224 0 0 0 0 128 128 128 128 0 0
255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 195 195 195 195 0
0 0 0 0 3 3 3 3 0 0 0 0 1 63 63 63 63 0 0 0 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 255 255 255 255
16 16 16 16 16 255 255 255 255 16 32 64 128 0 248 248 248 248 0 0 0
0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 128 128 128 128 0
0 0 0 0 128 128 192 160 16 8 4 2 1 0 0 0 0 0 0 0 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 15 15 15 15 0 0 0
0 0 0 0 0 0 0 0 0 31 31 144 86 49 17 16 31 0 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 254 254 254 254
64 64 64 64 64 64 64 64 64 64 64 64 255 255 0 210 16 38 0 255 0 0
255 255)
(248 248 248 248 248 248 248 248 248 248 248 120 56 24 24 24 24 24
24 24 24 24 24 24 24 24 24 24 24 24 152 152 152 152 152 152 152 152
56 120 248 248)))
;; icon number 2 analysis-path-icon
(transform-array-in-bitmap 70
'#2A((0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 255 255 192 192 192 192 192 192 192 192 192 192 192
192 192 192 192 192 192 192 192 192 192 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255
255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 28 34 34 65 65 65 65 83 65 65 65 65
65 65 83 65 65 65 65 65 65 67 80 64 64 64 64 64 64 64 81 64 64 64
64 64 64 64 64 64 32 32 32 16 16 16 8 8 8 8 4 4 4 4 4 8 8 8 0 0 255
255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 30 33 33 64 64 64 64 64 64 64 64 64 82 64 64 64 64 64 64 64
64 82 64 64 64 64 64 64 64 64 64 64 82 128 0 0 0 0 0 0 1 16 0 0 0 0
0 2 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 15 16 16 32 32 32 160 160 160 160 160 169 160 160 160 160 160 160
160 160 160 160 169 160 160 160 160 160 160 160 160 160 160 160 169
160 64 0 0 4 0 4 32 0 0 4 0 1 8 64 0 32 0 129 0 4 0 8 0 16 0 16 0 8
0 0 0 0 0 0 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 255 255)
(0 0 128 128 71 72 72 80 80 80 80 80 80 80 80 80 84 80 80 80 80 80
80 80 80 84 80 80 80 80 80 80 80 80 80 80 84 32 0 0 128 0 0 0 0 1 8
32 4 0 16 0 64 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 255 255
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 128 64 64 32 32 32 32 32 32 32 32 32 160 32 32 32 32 32 32
32 32 160 32 32 32 32 32 32 32 32 32 32 160 32 16 16 16 8 5 2 0 1 0
0 0 0 0 0 0 0 1 2 4 8 16 32 64 128 128 128 0 0 0 0 0 0 128 128 128
0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 4
8 16 16 36 32 64 128 129 1 2 2 4 4 8 136 16 16 32 64 128 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 224
16 8 16 32 32 64 64 128 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 252 252 12 12 12 12 12 12 12 12 12 12
12 12 12 12 12 12 12 12 12 12 12 252 252)))
;; icon number 3 analysis-path-icon-mask
(transform-array-in-bitmap 70
'#2A((0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 28 62 62 127 127 127 127 127 127 127
127 127 127 127 127 127 127 127 127 127 127 127 127 127 127 127 127
127 127 127 127 127 127 127 127 127 127 127 127 127 63 63 63 31 31
31 15 15 15 15 7 7 7 7 7 15 15 15 0 0 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255)
(0 0 0 0 30 63 63 127 127 127 127 127 127 127 127 127 127 127 127
127 127 127 127 127 127 127 127 127 127 127 127 127 127 127 127 127
127 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255)
(0 15 31 31 63 63 63 191 191 191 191 191 191 191 191 191 191 191 191
191 191 191 191 191 191 191 191 191 191 191 191 191 191 191 191 191
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255)
(0 0 128 128 199 207 207 223 223 223 223 223 223 223 223 223 223 223
223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223
223 223 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 0 0 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255)
(0 0 0 0 128 192 192 224 224 224 224 224 224 224 224 224 224 224 224
224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224
224 224 240 240 240 248 253 255 255 255 255 255 255 255 255 255 255
255 255 254 252 248 240 224 192 128 128 128 0 0 0 0 0 0 128 128 128
0 0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 3 7
15 31 31 63 63 127 255 255 255 254 254 252 252 248 248 240 240 224
192 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 224
240 248 240 224 224 192 192 128 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 252 252 252 252 252 252 252 252
252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252
)))
;; icon number 4 analysis-path-map-icon
(transform-array-in-bitmap 77
'#2A((255 255 255 255 255 255 255 255 255 255 255 240 224 192 192 192 192
192 192 192 207 200 200 232 200 200 200 200 200 202 200 200 201 200
200 200 196 194 225 240 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 3 12 16 17 34 36 36
231 36 36 36 36 36 36 36 36 165 36 36 36 0 33 8 128 0 255 0 255 255
)
(255 255 255 255 255 255 255 255 255 255 255 0 0 252 3 0 248 4 2 2
242 18 18 18 18 18 18 18 18 82 18 18 146 18 18 33 65 128 0 0 255
255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 128 129 70 72
73 72 70 65 64 64 64 65 70 72 73 72 70 65 64 32 31 0 192 63 0 255
255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 15 112 128 15 112
128 112 14 193 56 6 56 193 14 112 128 112 14 193 56 6 248 1 6 248 0
255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 254 1 0 252 2 1 1
1 129 65 65 65 129 1 1 5 5 5 132 68 68 68 132 2 1 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 1 129 66 66 34 34
34 34 34 34 34 34 34 34 34 34 34 42 0 136 0 0 145 0 255 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 63 192 0 31 32 64 79
72 72 68 69 66 66 65 65 64 64 80 80 80 16 144 16 16 16 33 195 0 255
255)
(255 255 255 255 255 255 255 255 255 255 255 0 128 96 16 16 136 72
207 72 72 0 36 1 17 2 34 132 132 72 72 72 72 72 72 72 72 254 255 0
255 255)
(248 248 248 248 248 248 248 248 248 248 248 120 56 24 24 24 24 24
216 88 88 152 152 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 56
120 248 248)))
;; icon number 5 quail-objects-icon
(transform-array-in-bitmap 50
'#2A((0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 2 2 6 4 13 9 9 9 9 17 17 17 48
32 32 32 32 48 16 16 16 16 24 8 12 6 2 3 1 0 0 0)
(0 0 0 0 0 1 3 6 12 24 16 48 96 64 192 128 0 0 0 0 0 0 255 0 0 0 0 0
0 255 0 0 0 0 0 0 0 0 0 60 38 34 34 34 38 60 128 224 56 31)
(7 28 48 96 192 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 226 36 40 48 48
40 36 226 1 0 0 0 0 0 0 0 0 72 76 74 73 72 72 72 0 0 0 255)
(240 28 6 3 1 0 0 0 0 0 0 0 0 0 0 63 32 32 32 96 160 32 63 0 0 0 0 0
0 63 32 160 96 32 32 32 63 0 0 39 36 36 36 164 100 39 0 0 0 255)
(0 0 0 0 128 192 96 48 24 8 4 6 2 1 1 252 4 4 4 4 4 4 252 0 0 0 0 0
0 252 4 4 4 4 4 4 252 0 0 143 200 72 79 72 200 143 0 0 7 254)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 128 192 64 96 32 48 24 8 12 4 4 4 6 2 2
2 3 1 1 1 1 3 2 2 2 130 6 4 12 8 24 144 48 96 192 0)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
;; icon number 6 quail-objects-icon-mask
(transform-array-in-bitmap 50
'#2A((0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 3 3 7 7 15 15 15 15 15 31 31 31
63 63 63 63 63 63 31 31 31 31 31 15 15 7 3 3 1 0 0 0)
(0 0 0 0 0 1 3 7 15 31 31 63 127 127 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 63 31)
(7 31 63 127 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255)
(240 252 254 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255)
(0 0 0 0 128 192 224 240 248 248 252 254 254 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 254)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 128 192 192 224 224 240 248 248 252 252
252 252 254 254 254 254 255 255 255 255 255 255 254 254 254 254 254
252 252 248 248 240 240 224 192 0)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
;; icon number 7 map-icon
(transform-array-in-bitmap 50
'#2A((0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 3 2 6 4 15 8 8 8 8 15 12 4 4 4 4 6 2
3 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 192 192 192 192 192 192
192 192 192 192 192 192 192 192 192 192 192 192 192 192 192 255 255
)
(0 0 0 0 0 0 1 3 6 12 26 51 97 224 16 8 4 2 1 128 112 14 1 0 255 0
3 2 2 2 1 1 1 1 128 192 112 28 6 3 1 0 0 0 0 0 0 0 0 0 255 255 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 126 227 34 34 50 18 18 18 146 214 76 37 53 18 154 74 54
155 106 255 0 255 0 0 0 0 0 0 128 128 128 112 28 7 1 128 192 112
28 7 0 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
255 255)
(0 0 0 0 0 0 128 224 48 48 40 108 68 70 194 143 49 99 70 76 145 179
47 254 0 0 192 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 128 255 18 19
31 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 3 6 12 24 16 16 16 24 8 12 204 88 208 176 96 192 0 0
0 0 0 0 0 0 0 0 0 0 6 12 24 48 224 0 0 1 3 14 248 0 0 248 0 255
255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 192 96 48 216 222 27 25 24 63 56 60 60 92 94 95 223
159 142 128 192 64 64 64 64 96 32 48 32 32 32 32 32 96 64 192 128
0 0 0 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 128 128 192 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 192 192 192 192 192 192
192 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192
192 192 192)))
;; icon number 8 map-icon-mask
(transform-array-in-bitmap 50
'#2A((0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 3 3 7 7 15 15 15 15 15 15 15 7 7 7 7
7 7 7 7 3 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255)
(0 0 0 0 0 0 1 3 7 15 31 63 127 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 127 31 7 3
1 0 0 0 0 0 0 0 0 0 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255)
(0 0 0 0 0 126 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 127 31 7 0 0 0 0 0 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255)
(0 0 0 0 0 0 128 224 240 240 248 252 252 254 254 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 18 19 31 0 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255)
(0 0 0 0 0 0 0 3 7 15 31 31 31 31 31 15 15 207 223 223 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 254 248 0 0 248 0 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255)
(0 0 0 0 0 0 0 192 224 240 248 254 255 255 255 255 248 252 252 220
222 223 223 159 159 128 192 192 192 192 192 224 224 240 224 224 224
224 224 224 192 192 128 0 0 0 0 0 0 0 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 128 128 192 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 192 192 192 192 192 192 192
192 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192
192)))
;; icon number 9 toolbox-icon
(transform-array-in-bitmap 100
'#2A((0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 1 1 2 2 4 4 8 8 16 32 64 128 128 128 128 128 128
128 128 128 128 128 128 128 128 128 128 143 143 132 132 132 132 143
143 128 128 255 0 255 255 192 192 192 192 192 192 192 192 192 192
192 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192
192 192 192 192 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 6 24 32 64 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 142 206 68 68 68 68 206 142 0 0 255 0 255 255 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 1 6 24 96 64 65 65 65 65 65 65 65 65 65 65 65
65 65 65 65 65 65 65 65 65 193 65 65 73 65 73 65 73 65 65 65 65 65
65 65 65 65 65 65 65 65 65 65 65 73 65 73 65 73 65 99 62 0 65 97 113
89 77 71 67 65 0 0 255 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 1 6 24 96 129 6 24 96 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 192 49 14 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 62 63 17 17 17 17 63 62 0 0 255 0 255 255 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 1 6 24 96 129 6 24 96 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 1 6 24 96 128 0 0 0 128 64 64 32 32 16 16 8 8 4 2 1 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 62 62 32 56 56 32 62 62 0 0 255 0 255 255 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
6 24 96 129 6 24 96 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
6 24 96 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 6 24 96 128 128 128 128
128 129 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128
128 131 140 176 192 128 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 6 24 96
129 6 24 96 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 6 24 96
128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 6 24 96 128 0 0 0 0 3 12 56 200
8 8 8 8 8 8 8 0 0 0 0 0 0 3 12 48 192 0 0 0 0 0 0 255 255 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 6 24 96 129 6 24
96 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 2 4 8 112 144 16 16
16 16 16 16 16 16 16 16 16 16 16 16 16 17 22 24 96 128 0 0 0 1 2 4 8
200 8 8 8 8 4 3 0 0 0 0 0 0 0 3 12 48 192 0 0 0 0 0 0 0 0 0 0 255
255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 6 24 96 129 6 24 96 128
0 0 0 0 0 0 0 0 0 0 0 0 0 3 4 8 16 32 32 64 64 128 128 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 1 6 24 96 128 0 0 0 0 1 2 2 194 34 18 18 17 16
16 16 32 64 128 0 0 0 3 12 48 192 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255
255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 129 6 24 104 136 8 8 8 8
8 8 8 8 8 8 8 8 8 8 15 56 192 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 0 1 1 6 24 96 128 0 0 0 0 0 0 112 136 4 4 4 4 4 4 8 16 224 0 0
0 0 3 12 48 192 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 224 160 32 32 32 32 32 32 32
32 32 32 32 32 32 32 32 32 32 32 224 56 6 1 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 1 6 24 96 128 0 0 0 0 0 1 1 128 128 128 128 128 128
128 140 176 192 0 0 0 0 3 12 48 192 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 128 64 32 16 8 8 4 4 2 2 1 1 0 0 0 0 1 6 24 96 128
0 0 0 0 0 0 48 72 128 0 0 248 4 4 4 136 112 0 0 0 0 3 12 48 192 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 128 64 32 112 144 16 16 16
16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 48 192 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 240 240 48
48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48
48 48 48 48 48 48 48 240 240)))
;; icon number 10 toolbox-icon-mask
(transform-array-in-bitmap 100
'#2A((0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 1 1 3 3 7 7 15 15 31 63 127 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 0 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 7 31 63 127 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 0 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 1 7 31 127 127 127 127 127 127 127 127 127
127 127 127 127 127 127 127 127 127 127 127 127 127 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 0 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 1 7 31 127 255 254 248 224 128 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 192 241 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 0 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 1 7 31 127 255 254 248 224 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 1 7 31 127 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 0 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
7 31 127 255 254 248 224 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 7 31 127 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 252 240 192 128
0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 7 31
127 255 254 248 224 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
7 31 127 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 252 240 192 0 0 0 0
0 0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 7 31 127 255
254 248 224 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 3 7 15
127 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 252 240 192 0 0 0 0 0 0 0 0
0 0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 7 31 127 255 254 248
224 128 0 0 0 0 0 0 0 0 0 0 0 0 0 3 7 15 31 63 63 127 127 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 252 240 192 0 0 0 0 0 0
0 0 0 0 0 0 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 255 255 255 239 143 15
15 15 15 15 15 15 15 15 15 15 15 15 15 15 63 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 252 240 192 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 224 224 224 224 224 224 224
224 224 224 224 224 224 224 224 224 224 224 224 224 224 248 254 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 252 240 192 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 128 192 224 240 248 248 252 252 254 254 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 252 240 192
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 128 192 224 240 240 240
240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240
240 240 240 240 240 240 192 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 240 240 240 240 240 240 240 240 240 240 240 240
240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240
240 240 240 240 240 240)))
;; icon number 11 toolbox-map-icon
(transform-array-in-bitmap 77
'#2A((255 255 255 255 255 255 255 255 255 255 255 240 224 192 192 192 192
192 192 192 192 192 192 192 192 192 192 192 193 193 193 192 192 192
192 192 192 192 224 240 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0
0 31 63 127 255 255 227 129 0 0 0 1 3 63 63 31 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0
0 192 224 240 255 255 255 255 255 252 252 252 248 240 224 192 0 255
255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0
0 0 15 255 255 255 255 248 128 0 0 0 0 0 0 0 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0
15 255 255 255 255 248 128 0 0 0 0 0 0 0 0 0 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 0 0 15
255 255 255 255 248 128 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 1 1 1 15 255
255 255 255 248 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 31 63 127 254 252 248
248 248 252 254 255 255 127 63 31 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 192 224 224 0 0 0 0 0
12 60 252 248 240 224 192 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(248 248 248 248 248 248 248 248 248 248 248 120 56 24 24 24 24 24
24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 56 120
248 248)))
;; icon number 12 view-icon
(transform-array-in-bitmap 77
'#2A((255 255 255 255 255 255 255 255 255 255 255 240 224 192 192 192 192
192 192 192 192 192 192 192 192 192 193 193 193 193 193 193 192 192
192 192 192 192 224 240 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 255 255 255 255 255 255 0 0 0 0 0 0 0 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 242 244 248 248 244 242 1 0 0 0 0 0 0 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 15 15
31 47 79 143 0 0 0 0 0 0 0 0 143 79 47 31 15 15 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 255 255
255 255 255 255 0 0 0 0 0 0 0 0 255 255 255 255 255 255 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 1 2 4 200 208
224 224 208 200 4 2 1 0 0 0 0 0 192 192 192 192 192 192 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 63 63 127 191 63 63 0
0 0 0 0 0 0 0 0 63 191 127 63 63 63 0 0 0 0 0 0 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 255 255 255 255 255
255 0 0 0 0 0 0 0 0 0 255 255 255 255 255 255 0 0 0 0 0 0 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(248 248 248 248 248 248 248 248 248 248 248 120 56 24 24 24 24 24
24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 56 120
248 248)))
;; icon number 13 zoom-icon
(transform-array-in-bitmap 50
'#2A((0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 1 1 0 0 0 0 255 255 192 192 192 192 192 192 192 192 192
192 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192
255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 32 80 136 196 98 49 24
12 6 3 1 0 0 0 0 0 0 240 255 255 31 0 0 255 255 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 0 0 0 0 12 15 15 55 71 67 79 49 1 2 4 8 17 10 4 0 0
128 64 32 16 143 199 99 49 24 13 6 0 252 255 255 255 0 255 255 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 1 3 7 15 23 39 199 195 224 241 250 252 254 126 126
190 0 0 0 0 0 0 1 3 15 255 255 255 255 191 1 0 0 0 255 255 255 0
255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(3 4 8 16 32 64 128 0 225 242 244 248 240 252 254 254 63 63 31 31 15
15 15 15 15 31 31 63 255 255 255 254 252 252 248 248 248 248 254
127 255 255 255 254 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 255 255)
(128 192 96 48 16 32 64 128 0 0 0 0 0 0 0 0 0 128 192 192 192 192
192 192 192 192 192 192 128 128 0 0 0 0 0 0 0 0 0 128 128 128 0 0 0
255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 192 192 192 192 192 192 192 192 192 192 192
192 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192
192 192)))
;; icon number 14 zoom-icon-mask
(transform-array-in-bitmap 50
'#2A((0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 1 1 0 0 0 0 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 32 112 248 252 126 63
31 15 7 3 1 0 0 0 0 0 0 240 255 255 31 0 0 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 12 15 15 63 127 127 127 49 1 3 7 15 31 14 4 0
0 128 192 224 240 255 255 127 63 31 15 6 0 252 255 255 255 0 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255)
(0 0 0 0 0 0 0 1 3 7 15 31 63 255 255 255 255 254 252 254 254 254
190 0 0 0 0 0 0 1 3 15 255 255 255 255 191 1 0 0 0 255 255 255 0
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255)
(3 7 15 31 63 127 255 255 255 254 252 248 240 252 254 254 63 63 31
31 15 15 15 15 15 31 31 63 255 255 255 254 252 252 248 248 248 248
254 127 255 255 255 254 0 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255)
(128 192 224 240 240 224 192 128 0 0 0 0 0 0 0 0 0 128 192 192 192
192 192 192 192 192 192 192 128 128 0 0 0 0 0 0 0 0 0 128 128 128 0
0 0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 192 192 192 192 192 192 192 192 192 192 192
192 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192
192 192))))))
(add-restore-lisp-functions #'init-list-of-icons)
;;(eval-when (load eval)
;; (init-list-of-icons)) | 41,498 | Common Lisp | .cl | 593 | 56.413153 | 84 | 0.539231 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 97846a5db7ce012b06ae777e8742eed908fb9be54387f7a92db9f6c301cb831f | 32,884 | [
-1
] |
32,885 | quail-methods-mcl.lsp | rwoldford_Quail/source/display-network/quail-methods-mcl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; quail-methods-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; Copyright (c) 1991 Statistical Computing Laboratory, University of Waterloo
;;;
;;;
;;; Authors:
;;; G. Desvignes 1988 - 1989
;;; R.W. Oldford 1985 - 1992.
;;;
;;;
;;;--------------------------------------------------------------------------------
(in-package :quail)
#|This should be unnecessary
(defmethod specific::make-menubar ((browser quail-browser))
;;; specialization from browser to build menus for left and middle items
(declare (special specific::*class-menubar-cache*))
(or (boundp 'specific::*class-menubar-cache*)
(setq specific::*class-menubar-cache* nil))
(unless (assoc (class-of browser) specific::*class-menubar-cache*)
;; if menubar doesn't exist, create it and save it in association list
(push (cons (class-of browser)
(append (list (car ccl:*default-menubar*))
(list (specific::create-menu-with-list
(slot-value browser 'browser::left-title-items)
"info"))
(list (specific::create-menu-with-list
(slot-value browser 'browser::middle-title-items)
"Edit"))))
specific::*class-menubar-cache*)))
|#
(defmethod set-anonymous-object ((self initable-object))
;;; mac version does nothing
self)
(defmethod descriptive-label ((self network-view))
;;; use a bitmap as a descriptive label
;;; this method creates a bitmap representing the view and returns it
;;; this method is almost similar to object function window-draw-content
;;; defined for icon-window except that we have to create a grafport instead of
;;; a window to build the bitmap with a title
(let* ((my-icon (eval (slot-value self 'sub-view-icon)))
(title (icon-title self))
(width (wb:bitmap-width my-icon))
(height (wb:bitmap-height my-icon))
(bitmap-result (wb:make-bitmap :width width :height height))
(my-rect (ccl::make-record :rect :top 0 :left 0
:bottom height
:right width))
(my-window (wb:make-canvas
:window-type :single-edge-box
:window-size (make-point width height))))
;; build a new grafport which portBits is bitmap-result
(wb:canvas-bitblt my-icon my-window
:canvas-left 0 :canvas-bottom (- (wb:bitmap-height my-icon)))
(set-view-font my-window '("helvetica" 10))
(wb:canvas-move-to (max 2 (ash (- (wb:bitmap-width my-icon)
(string-width title)) -1))
-9 my-window)
(with-port (wptr my-window)
(#_TextMode :word (wb::penmode-arg :patXor)))
(wb:canvas-draw-string title my-window)
(wb:copy-canvas-region-to-bitmap my-window 0 (- (wb:bitmap-height my-icon))
bitmap-result
(wb:bitmap-width my-icon)
(wb:bitmap-height my-icon))
(wb:close-canvas my-window)
bitmap-result))
| 3,488 | Common Lisp | .cl | 71 | 37.239437 | 85 | 0.520499 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 8606f4032d1f598b1b9c5523592af77f519e950cff7023192d2bf2384e55f965 | 32,885 | [
-1
] |
32,886 | quail-functions-mcl.lsp | rwoldford_Quail/source/display-network/quail-functions-mcl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; quail-functions-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; Copyright (c) 1991 Statistical Computing Laboratory, University of Waterloo
;;;
;;;
;;; Authors:
;;; G. Desvignes 1988 - 1989
;;; R.W. Oldford 1985 - 1992.
;;;
;;;
;;;--------------------------------------------------------------------------------
(in-package :quail)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(access-expression
quail-print-help
quail-prompt-read
edit-text
get-last-typed-command
get-user-name)))
;;;
;;; functions definitions
;;;
(defun access-expression (variable)
"Returns an expression which returns variable when it is evaluated."
#|
(when (listp variable)
(setq variable (first variable)))
(let ((name (pcl::get-name variable)))
(or name
(list 'ccl:%int-to-ptr
(%ptr-to-int variable))))
|#
)
;;; function access-object is useless for mac
;;; function key-for-access is useless for mac
(defun quail-print-help (message &key font-family font-size font-case)
"Print a Help message in the help window using given font if any."
(declare (special *quail-help-window*))
(declare (ignore font-family font-size))
(unless (and (boundp '*quail-help-window*)
(wptr *quail-help-window* ))
(setq *quail-help-window*
(make-instance 'ccl:listener
:window-type :document
:window-title "Quail Help Window"
:window-size (make-point 400 200)
:window-position (make-point 0 280))))
;; only changement of font case is implemented
(let ((previous-font (ccl:view-font *quail-help-window*)))
(if (string= (symbol-name font-case) "BOLD")
(ccl:set-window-font *quail-help-window*
(append '(:bold)
(ccl:view-font *quail-help-window*))))
(pprint message *quail-help-window*)
(ccl:set-view-font *quail-help-window* previous-font)
nil))
(defun quail-prompt-read (message)
"Ask the user for an input using a standard *quail-prompt-window*."
(wb::prompt-user :prompt-string message)
)
(defun edit-text (text &key (read-only nil))
"If read-only is t we read the text, ~
otherwise we return the string made by concatenating text with the new entry. ~
Default of read-only is T."
(if read-only
(quail-print-help text)
(let (new-line)
(quail-print text)
(quail-print "")
(princ "Add new note > ")
(if (equal "" (setq new-line (read-line)))
(concatenate 'string text "
" new-line)))))
(defun get-last-typed-command ()
"Returns the last command typed in the listener."
(declare (special CL:+))
CL:+)
(defvar *user-name* NIL
"The current user's name.")
(defun user-name (&key (prompt T))
"Returns the current user name. If prompt is T (the default), and ~
no name has been cached, then the user is prompted to supply one."
(declare (special *user-name*))
(if *user-name*
*user-name*
(if prompt
(setf *user-name*
(wb::prompt-user
:read-type :string
:prompt-string "Please enter your user name:"))
"Anonymous")))
(defun set-window-icon (window icon)
;;; useless for Mac
(declare (ignore window))
icon)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; functions to make window shrink into an ICON
;;;
(defclass icon-window (canvas)
((icon :initarg :icon :accessor icon-of :initform NIL)
(window-owner :initarg :window-owner :accessor window-owner-of :initform NIL))
)
(defmethod window-zoom-event-handler ((self browser) message)
"When middle-button is pressed inside the zoom region, we should make an icon with ~
window and hide window."
(declare (ignore args))
(if (ccl:option-key-p)
(let* ((i-window (icon-w-of self))
icon)
(unless i-window
(when (slot-exists-p (browser-of self)
'sub-view-icon)
(setq icon (eval (slot-value (browser-of self)
'sub-view-icon)))
(setq i-window (make-canvas
:canvas-class 'icon-window
:window-owner self
:icon icon
:window-type :single-edge-box
:window-show nil
:window-size (make-point (wb:bitmap-width icon)
(wb:bitmap-height icon))
:window-position (ccl:rref *current-event* :event.where)))
(setf (icon-w-of self) i-window)))
;; when the icon window is built we can close the main window
(when i-window
(window-show i-window)
(window-hide self)))
(call-next-method)))
(defmethod view-draw-contents ((self icon-window))
"Redraw the icon inside the window."
(let ((my-icon (icon-of self))
(title (icon-title
(browser-of (window-owner-of self)))))
(canvas-bitblt my-icon self
:canvas-left 0 :canvas-bottom (- (bitmap-height my-icon)))
(set-view-font self '("helvetica" 10))
(canvas-move-to (max 2 (ash (- (bitmap-width my-icon)
(string-width title)) -1))
-9 self)
;;(#_TextMode :word (penmode-arg :patXor))
(canvas-draw-string title self)))
(defmethod window-click-event-handler ((self icon-window) where)
"If the button is double clicked, the icon is closed and the associated ~
window is opened; a simple click is treated as a window-event."
(declare (ignore where))
(when (double-click-p)
(window-hide self)
(window-select (window-owner-of self))))
(defmethod window-event ((self icon-window))
"In the classical event treatment, there are no methods to detect ~
a mouse-down event. ~
We must therefore add the test in the main function and call drag-window if a ~
mouse down event is detected."
(if (eq (rref *current-event* :event.what) 1)
(#_DragWindow :ptr (wptr self)
:long (rref *current-event* :event.where)
:ptr (make-record :rect :top 0 :left 0 :bottom 1000 :right 1000)))
(call-next-method))
| 6,810 | Common Lisp | .cl | 164 | 32.146341 | 87 | 0.55374 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 08029dcd1431ceb1b8fc862c42375b2281a880db1d5f91d9446b9522462246a5 | 32,886 | [
-1
] |
32,888 | Z-methods-ccl.lsp | rwoldford_Quail/source/display-network/junk/Z-methods-ccl.lsp | ;;; -*- Mode: LISP -*-
(in-package 'specific)
(defmethod make-menubar ((browser Z::Z-browser))
;;; specialization from browser to build menus for left and middle items
(declare (special *class-menubar-cache*))
(or (boundp '*class-menubar-cache*)
(setq *class-menubar-cache* nil))
(unless (assoc (class-of browser) *class-menubar-cache*)
;; if menubar doesn't exist, create it and save it in association list
(push (cons (class-of browser)
(append (list (car *default-menubar*))
(create-menu-with-list
(slot-value browser 'browser::left-title-items)
"info")
(create-menu-with-list
(slot-value browser 'browser::middle-title-items)
"Edit")))
*class-menubar-cache*)))
(in-package 'Z)
(defmethod set-anonymous-object ((self initable-object-mixin))
;;; mac version does nothing
self)
(defmethod descriptive-label ((self network-view))
;;; use a bitmap as a descriptive label
;;; this method creates a bitmap representing the view and returns it
;;; this method is almost similar to object function window-draw-content
;;; defined for icon-window except that we have to create a grafport instead of
;;; a window to build the bitmap with a title
(let* ((my-icon (eval (slot-value self 'sub-view-icon)))
(title (Z::icon-title self))
(width (bitmap-width my-icon))
(height (bitmap-height my-icon))
(bitmap-result (make-bitmap :width width :height height))
(my-rect (specific::make-rect 0 0 height width))
(my-window (oneof *window*
:window-type :single-edge-box
:window-size (make-point width height))))
;; build a new grafport which portBits is bitmap-result
(canvas-bitblt my-icon my-window
:canvas-left 0 :canvas-bottom (- (bitmap-height my-icon)))
(ask my-window (set-window-font '("helvetica" 10)))
(canvas-move-to (max 2 (ash (- (bitmap-width my-icon)
(string-width title)) -1))
-9 my-window)
(with-port (ask my-window wptr)
(_TextMode :word (wb::penmode-arg :patXor)))
(Print-without-length-check title my-window)
(copy-canvas-region-to-bitmap my-window 0 (- (bitmap-height my-icon))
bitmap-result
(bitmap-width my-icon)
(bitmap-height my-icon))
(ask my-window (window-close))
bitmap-result))
| 2,751 | Common Lisp | .cl | 53 | 38.45283 | 80 | 0.576124 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | a8045f0ebdfbe50ceb17e086c52ca20627c4fb77fbde3199806c6401b25608fb | 32,888 | [
-1
] |
32,889 | quail-icon-ccl.lsp | rwoldford_Quail/source/display-network/junk/quail-icon-ccl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; quail-icon-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; Copyright (c) 1991 Statistical Computing Laboratory, University of Waterloo
;;;
;;;
;;; Authors:
;;; G. Desvignes 1988 - 1989
;;; R.W. Oldford 1985 - 1991.
;;;
;;;
;;;--------------------------------------------------------------------------------
;;;
;;; this file creates the bitmap used for Z icons
;;;
;;; this bitmaps can not be defined as constants or parameters because if we
;;; do so, the part corresponding to the bit-array is not saved with dumplisp
;;; which means that our bitmap is empty
;;; Instead of this, the icons are bound with an expression looking like
;;; (get-icon-from-list number) where number identifies the rank of the icon
;;; in a list which is created each time the system is reloaded using the
;;; *restore-lisp-functions* variable which is updated to contain the function
;;; init-list-of-icons
(in-package :quail)
(use-package :specific)
(defun get-icon-from-list (number)
"Retrieve the icon given its number in the list."
(declare (special *list-of-icons*))
(nth (- number 1) *list-of-icons*))
(defconstant analysis-map-icon '(get-icon-from-list 1))
(defconstant analysis-path-icon '(get-icon-from-list 2))
(defconstant analysis-path-icon-mask '(get-icon-from-list 3))
(defconstant analysis-path-map-icon '(get-icon-from-list 4))
(defconstant quail-objects-icon '(get-icon-from-list 5))
(defconstant quail-objects-icon-mask '(get-icon-from-list 6))
(defconstant map-icon '(get-icon-from-list 7))
(defconstant map-icon-mask '(get-icon-from-list 8))
(defconstant toolbox-icon '(get-icon-from-list 9))
(defconstant toolbox-icon-mask '(get-icon-from-list 10))
(defconstant toolbox-map-icon '(get-icon-from-list 11))
(defconstant view-icon '(get-icon-from-list 12))
(defconstant zoom-icon '(get-icon-from-list 13))
(defconstant zoom-icon-mask '(get-icon-from-list 14))
(defun transform-array-in-bitmap (bitmap-width the-array)
"Make a bitmap with an array of integer and a width for the bitmap."
(let* ((the-bitmap (wb:make-bitmap :width bitmap-width
:height (array-dimension the-array 1)))
(bm (ccl:rref (wb:bitmap-raw-bitmap the-bitmap) :bitmap.baseaddr))
(offset 0))
(ccl:rset (wb:bitmap-raw-bitmap the-bitmap) bitmap.rowBytes
(array-dimension the-array 0))
(dotimes (y (array-dimension the-array 1))
(dotimes (x (array-dimension the-array 0))
(ccl:%put-byte bm (aref the-array x y) offset)
(setq offset (+ 1 offset))))
the-bitmap))
(defvar *list-of-icons* NIL)
(defun init-list-of-icons ()
(declare (special *list-of-icons*))
(setf *list-of-icons*
(list
;; icon number 1 analysis-map-icon
(transform-array-in-bitmap 77
'#2A((255 255 255 255 255 255 255 255 255 255 255 240 224 192 195 195 195
195 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192
192 192 192 192 224 240 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 255 255 255 255
16 8 4 2 7 7 4 5 4 4 4 7 0 0 0 0 3 3 3 3 0 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 129 129 129 129 0
0 0 0 255 255 0 180 68 73 0 255 16 16 16 16 255 255 255 255 0 0 255
255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 255 255 255 255 8
16 32 64 224 224 32 160 32 160 32 224 0 0 0 0 128 128 128 128 0 0
255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 195 195 195 195 0
0 0 0 0 3 3 3 3 0 0 0 0 1 63 63 63 63 0 0 0 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 255 255 255 255
16 16 16 16 16 255 255 255 255 16 32 64 128 0 248 248 248 248 0 0 0
0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 128 128 128 128 0
0 0 0 0 128 128 192 160 16 8 4 2 1 0 0 0 0 0 0 0 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 15 15 15 15 0 0 0
0 0 0 0 0 0 0 0 0 31 31 144 86 49 17 16 31 0 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 254 254 254 254
64 64 64 64 64 64 64 64 64 64 64 64 255 255 0 210 16 38 0 255 0 0
255 255)
(248 248 248 248 248 248 248 248 248 248 248 120 56 24 24 24 24 24
24 24 24 24 24 24 24 24 24 24 24 24 152 152 152 152 152 152 152 152
56 120 248 248)))
;; icon number 2 analysis-path-icon
(transform-array-in-bitmap 70
'#2A((0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 255 255 192 192 192 192 192 192 192 192 192 192 192
192 192 192 192 192 192 192 192 192 192 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255
255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 28 34 34 65 65 65 65 83 65 65 65 65
65 65 83 65 65 65 65 65 65 67 80 64 64 64 64 64 64 64 81 64 64 64
64 64 64 64 64 64 32 32 32 16 16 16 8 8 8 8 4 4 4 4 4 8 8 8 0 0 255
255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 30 33 33 64 64 64 64 64 64 64 64 64 82 64 64 64 64 64 64 64
64 82 64 64 64 64 64 64 64 64 64 64 82 128 0 0 0 0 0 0 1 16 0 0 0 0
0 2 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 15 16 16 32 32 32 160 160 160 160 160 169 160 160 160 160 160 160
160 160 160 160 169 160 160 160 160 160 160 160 160 160 160 160 169
160 64 0 0 4 0 4 32 0 0 4 0 1 8 64 0 32 0 129 0 4 0 8 0 16 0 16 0 8
0 0 0 0 0 0 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 255 255)
(0 0 128 128 71 72 72 80 80 80 80 80 80 80 80 80 84 80 80 80 80 80
80 80 80 84 80 80 80 80 80 80 80 80 80 80 84 32 0 0 128 0 0 0 0 1 8
32 4 0 16 0 64 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 255 255
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 128 64 64 32 32 32 32 32 32 32 32 32 160 32 32 32 32 32 32
32 32 160 32 32 32 32 32 32 32 32 32 32 160 32 16 16 16 8 5 2 0 1 0
0 0 0 0 0 0 0 1 2 4 8 16 32 64 128 128 128 0 0 0 0 0 0 128 128 128
0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 4
8 16 16 36 32 64 128 129 1 2 2 4 4 8 136 16 16 32 64 128 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 224
16 8 16 32 32 64 64 128 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 252 252 12 12 12 12 12 12 12 12 12 12
12 12 12 12 12 12 12 12 12 12 12 252 252)))
;; icon number 3 analysis-path-icon-mask
(transform-array-in-bitmap 70
'#2A((0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 28 62 62 127 127 127 127 127 127 127
127 127 127 127 127 127 127 127 127 127 127 127 127 127 127 127 127
127 127 127 127 127 127 127 127 127 127 127 127 127 63 63 63 31 31
31 15 15 15 15 7 7 7 7 7 15 15 15 0 0 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255)
(0 0 0 0 30 63 63 127 127 127 127 127 127 127 127 127 127 127 127
127 127 127 127 127 127 127 127 127 127 127 127 127 127 127 127 127
127 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255)
(0 15 31 31 63 63 63 191 191 191 191 191 191 191 191 191 191 191 191
191 191 191 191 191 191 191 191 191 191 191 191 191 191 191 191 191
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255)
(0 0 128 128 199 207 207 223 223 223 223 223 223 223 223 223 223 223
223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223
223 223 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 0 0 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255)
(0 0 0 0 128 192 192 224 224 224 224 224 224 224 224 224 224 224 224
224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224
224 224 240 240 240 248 253 255 255 255 255 255 255 255 255 255 255
255 255 254 252 248 240 224 192 128 128 128 0 0 0 0 0 0 128 128 128
0 0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 3 7
15 31 31 63 63 127 255 255 255 254 254 252 252 248 248 240 240 224
192 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 224
240 248 240 224 224 192 192 128 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 252 252 252 252 252 252 252 252
252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252
)))
;; icon number 4 analysis-path-map-icon
(transform-array-in-bitmap 77
'#2A((255 255 255 255 255 255 255 255 255 255 255 240 224 192 192 192 192
192 192 192 207 200 200 232 200 200 200 200 200 202 200 200 201 200
200 200 196 194 225 240 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 3 12 16 17 34 36 36
231 36 36 36 36 36 36 36 36 165 36 36 36 0 33 8 128 0 255 0 255 255
)
(255 255 255 255 255 255 255 255 255 255 255 0 0 252 3 0 248 4 2 2
242 18 18 18 18 18 18 18 18 82 18 18 146 18 18 33 65 128 0 0 255
255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 128 129 70 72
73 72 70 65 64 64 64 65 70 72 73 72 70 65 64 32 31 0 192 63 0 255
255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 15 112 128 15 112
128 112 14 193 56 6 56 193 14 112 128 112 14 193 56 6 248 1 6 248 0
255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 254 1 0 252 2 1 1
1 129 65 65 65 129 1 1 5 5 5 132 68 68 68 132 2 1 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 1 129 66 66 34 34
34 34 34 34 34 34 34 34 34 34 34 42 0 136 0 0 145 0 255 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 63 192 0 31 32 64 79
72 72 68 69 66 66 65 65 64 64 80 80 80 16 144 16 16 16 33 195 0 255
255)
(255 255 255 255 255 255 255 255 255 255 255 0 128 96 16 16 136 72
207 72 72 0 36 1 17 2 34 132 132 72 72 72 72 72 72 72 72 254 255 0
255 255)
(248 248 248 248 248 248 248 248 248 248 248 120 56 24 24 24 24 24
216 88 88 152 152 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 56
120 248 248)))
;; icon number 5 quail-objects-icon
(transform-array-in-bitmap 50
'#2A((0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 2 2 6 4 13 9 9 9 9 17 17 17 48
32 32 32 32 48 16 16 16 16 24 8 12 6 2 3 1 0 0 0)
(0 0 0 0 0 1 3 6 12 24 16 48 96 64 192 128 0 0 0 0 0 0 255 0 0 0 0 0
0 255 0 0 0 0 0 0 0 0 0 60 38 34 34 34 38 60 128 224 56 31)
(7 28 48 96 192 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 226 36 40 48 48
40 36 226 1 0 0 0 0 0 0 0 0 72 76 74 73 72 72 72 0 0 0 255)
(240 28 6 3 1 0 0 0 0 0 0 0 0 0 0 63 32 32 32 96 160 32 63 0 0 0 0 0
0 63 32 160 96 32 32 32 63 0 0 39 36 36 36 164 100 39 0 0 0 255)
(0 0 0 0 128 192 96 48 24 8 4 6 2 1 1 252 4 4 4 4 4 4 252 0 0 0 0 0
0 252 4 4 4 4 4 4 252 0 0 143 200 72 79 72 200 143 0 0 7 254)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 128 192 64 96 32 48 24 8 12 4 4 4 6 2 2
2 3 1 1 1 1 3 2 2 2 130 6 4 12 8 24 144 48 96 192 0)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
;; icon number 6 quail-objects-icon-mask
(transform-array-in-bitmap 50
'#2A((0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 3 3 7 7 15 15 15 15 15 31 31 31
63 63 63 63 63 63 31 31 31 31 31 15 15 7 3 3 1 0 0 0)
(0 0 0 0 0 1 3 7 15 31 31 63 127 127 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 63 31)
(7 31 63 127 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255)
(240 252 254 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255)
(0 0 0 0 128 192 224 240 248 248 252 254 254 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 254)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 128 192 192 224 224 240 248 248 252 252
252 252 254 254 254 254 255 255 255 255 255 255 254 254 254 254 254
252 252 248 248 240 240 224 192 0)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
;; icon number 7 map-icon
(transform-array-in-bitmap 50
'#2A((0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 3 2 6 4 15 8 8 8 8 15 12 4 4 4 4 6 2
3 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 192 192 192 192 192 192
192 192 192 192 192 192 192 192 192 192 192 192 192 192 192 255 255
)
(0 0 0 0 0 0 1 3 6 12 26 51 97 224 16 8 4 2 1 128 112 14 1 0 255 0
3 2 2 2 1 1 1 1 128 192 112 28 6 3 1 0 0 0 0 0 0 0 0 0 255 255 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 126 227 34 34 50 18 18 18 146 214 76 37 53 18 154 74 54
155 106 255 0 255 0 0 0 0 0 0 128 128 128 112 28 7 1 128 192 112
28 7 0 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
255 255)
(0 0 0 0 0 0 128 224 48 48 40 108 68 70 194 143 49 99 70 76 145 179
47 254 0 0 192 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 128 255 18 19
31 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 3 6 12 24 16 16 16 24 8 12 204 88 208 176 96 192 0 0
0 0 0 0 0 0 0 0 0 0 6 12 24 48 224 0 0 1 3 14 248 0 0 248 0 255
255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 192 96 48 216 222 27 25 24 63 56 60 60 92 94 95 223
159 142 128 192 64 64 64 64 96 32 48 32 32 32 32 32 96 64 192 128
0 0 0 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 128 128 192 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 192 192 192 192 192 192
192 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192
192 192 192)))
;; icon number 8 map-icon-mask
(transform-array-in-bitmap 50
'#2A((0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 3 3 7 7 15 15 15 15 15 15 15 7 7 7 7
7 7 7 7 3 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255)
(0 0 0 0 0 0 1 3 7 15 31 63 127 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 127 31 7 3
1 0 0 0 0 0 0 0 0 0 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255)
(0 0 0 0 0 126 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 127 31 7 0 0 0 0 0 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255)
(0 0 0 0 0 0 128 224 240 240 248 252 252 254 254 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 18 19 31 0 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255)
(0 0 0 0 0 0 0 3 7 15 31 31 31 31 31 15 15 207 223 223 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 254 248 0 0 248 0 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255)
(0 0 0 0 0 0 0 192 224 240 248 254 255 255 255 255 248 252 252 220
222 223 223 159 159 128 192 192 192 192 192 224 224 240 224 224 224
224 224 224 192 192 128 0 0 0 0 0 0 0 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 128 128 192 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 192 192 192 192 192 192 192
192 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192
192)))
;; icon number 9 toolbox-icon
(transform-array-in-bitmap 100
'#2A((0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 1 1 2 2 4 4 8 8 16 32 64 128 128 128 128 128 128
128 128 128 128 128 128 128 128 128 128 143 143 132 132 132 132 143
143 128 128 255 0 255 255 192 192 192 192 192 192 192 192 192 192
192 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192
192 192 192 192 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 6 24 32 64 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 142 206 68 68 68 68 206 142 0 0 255 0 255 255 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 1 6 24 96 64 65 65 65 65 65 65 65 65 65 65 65
65 65 65 65 65 65 65 65 65 193 65 65 73 65 73 65 73 65 65 65 65 65
65 65 65 65 65 65 65 65 65 65 65 73 65 73 65 73 65 99 62 0 65 97 113
89 77 71 67 65 0 0 255 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 1 6 24 96 129 6 24 96 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 192 49 14 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 62 63 17 17 17 17 63 62 0 0 255 0 255 255 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 1 6 24 96 129 6 24 96 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 1 6 24 96 128 0 0 0 128 64 64 32 32 16 16 8 8 4 2 1 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 62 62 32 56 56 32 62 62 0 0 255 0 255 255 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
6 24 96 129 6 24 96 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
6 24 96 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 6 24 96 128 128 128 128
128 129 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128
128 131 140 176 192 128 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 6 24 96
129 6 24 96 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 6 24 96
128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 6 24 96 128 0 0 0 0 3 12 56 200
8 8 8 8 8 8 8 0 0 0 0 0 0 3 12 48 192 0 0 0 0 0 0 255 255 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 6 24 96 129 6 24
96 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 2 4 8 112 144 16 16
16 16 16 16 16 16 16 16 16 16 16 16 16 17 22 24 96 128 0 0 0 1 2 4 8
200 8 8 8 8 4 3 0 0 0 0 0 0 0 3 12 48 192 0 0 0 0 0 0 0 0 0 0 255
255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 6 24 96 129 6 24 96 128
0 0 0 0 0 0 0 0 0 0 0 0 0 3 4 8 16 32 32 64 64 128 128 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 1 6 24 96 128 0 0 0 0 1 2 2 194 34 18 18 17 16
16 16 32 64 128 0 0 0 3 12 48 192 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255
255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 129 6 24 104 136 8 8 8 8
8 8 8 8 8 8 8 8 8 8 15 56 192 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 0 1 1 6 24 96 128 0 0 0 0 0 0 112 136 4 4 4 4 4 4 8 16 224 0 0
0 0 3 12 48 192 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 224 160 32 32 32 32 32 32 32
32 32 32 32 32 32 32 32 32 32 32 224 56 6 1 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 1 6 24 96 128 0 0 0 0 0 1 1 128 128 128 128 128 128
128 140 176 192 0 0 0 0 3 12 48 192 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 128 64 32 16 8 8 4 4 2 2 1 1 0 0 0 0 1 6 24 96 128
0 0 0 0 0 0 48 72 128 0 0 248 4 4 4 136 112 0 0 0 0 3 12 48 192 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 128 64 32 112 144 16 16 16
16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 48 192 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 240 240 48
48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48
48 48 48 48 48 48 48 240 240)))
;; icon number 10 toolbox-icon-mask
(transform-array-in-bitmap 100
'#2A((0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 1 1 3 3 7 7 15 15 31 63 127 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 0 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 7 31 63 127 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 0 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 1 7 31 127 127 127 127 127 127 127 127 127
127 127 127 127 127 127 127 127 127 127 127 127 127 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 0 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 1 7 31 127 255 254 248 224 128 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 192 241 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 0 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 1 7 31 127 255 254 248 224 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 1 7 31 127 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 0 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
7 31 127 255 254 248 224 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 7 31 127 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 252 240 192 128
0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 7 31
127 255 254 248 224 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
7 31 127 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 252 240 192 0 0 0 0
0 0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 7 31 127 255
254 248 224 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 3 7 15
127 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 252 240 192 0 0 0 0 0 0 0 0
0 0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 7 31 127 255 254 248
224 128 0 0 0 0 0 0 0 0 0 0 0 0 0 3 7 15 31 63 63 127 127 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 252 240 192 0 0 0 0 0 0
0 0 0 0 0 0 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 255 255 255 239 143 15
15 15 15 15 15 15 15 15 15 15 15 15 15 15 63 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 252 240 192 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 224 224 224 224 224 224 224
224 224 224 224 224 224 224 224 224 224 224 224 224 224 248 254 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 252 240 192 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 128 192 224 240 248 248 252 252 254 254 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 252 240 192
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 128 192 224 240 240 240
240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240
240 240 240 240 240 240 192 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 240 240 240 240 240 240 240 240 240 240 240 240
240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240
240 240 240 240 240 240)))
;; icon number 11 toolbox-map-icon
(transform-array-in-bitmap 77
'#2A((255 255 255 255 255 255 255 255 255 255 255 240 224 192 192 192 192
192 192 192 192 192 192 192 192 192 192 192 193 193 193 192 192 192
192 192 192 192 224 240 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0
0 31 63 127 255 255 227 129 0 0 0 1 3 63 63 31 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0
0 192 224 240 255 255 255 255 255 252 252 252 248 240 224 192 0 255
255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0
0 0 15 255 255 255 255 248 128 0 0 0 0 0 0 0 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0
15 255 255 255 255 248 128 0 0 0 0 0 0 0 0 0 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 0 0 15
255 255 255 255 248 128 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 1 1 1 15 255
255 255 255 248 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 31 63 127 254 252 248
248 248 252 254 255 255 127 63 31 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 192 224 224 0 0 0 0 0
12 60 252 248 240 224 192 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(248 248 248 248 248 248 248 248 248 248 248 120 56 24 24 24 24 24
24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 56 120
248 248)))
;; icon number 12 view-icon
(transform-array-in-bitmap 77
'#2A((255 255 255 255 255 255 255 255 255 255 255 240 224 192 192 192 192
192 192 192 192 192 192 192 192 192 193 193 193 193 193 193 192 192
192 192 192 192 224 240 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 255 255 255 255 255 255 0 0 0 0 0 0 0 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 242 244 248 248 244 242 1 0 0 0 0 0 0 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 15 15
31 47 79 143 0 0 0 0 0 0 0 0 143 79 47 31 15 15 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 255 255
255 255 255 255 0 0 0 0 0 0 0 0 255 255 255 255 255 255 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 1 2 4 200 208
224 224 208 200 4 2 1 0 0 0 0 0 192 192 192 192 192 192 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 63 63 127 191 63 63 0
0 0 0 0 0 0 0 0 63 191 127 63 63 63 0 0 0 0 0 0 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 255 255 255 255 255
255 0 0 0 0 0 0 0 0 0 255 255 255 255 255 255 0 0 0 0 0 0 0 255 255)
(255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(248 248 248 248 248 248 248 248 248 248 248 120 56 24 24 24 24 24
24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 56 120
248 248)))
;; icon number 13 zoom-icon
(transform-array-in-bitmap 50
'#2A((0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 1 1 0 0 0 0 255 255 192 192 192 192 192 192 192 192 192
192 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192
255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 32 80 136 196 98 49 24
12 6 3 1 0 0 0 0 0 0 240 255 255 31 0 0 255 255 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 0 0 0 0 12 15 15 55 71 67 79 49 1 2 4 8 17 10 4 0 0
128 64 32 16 143 199 99 49 24 13 6 0 252 255 255 255 0 255 255 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 1 3 7 15 23 39 199 195 224 241 250 252 254 126 126
190 0 0 0 0 0 0 1 3 15 255 255 255 255 191 1 0 0 0 255 255 255 0
255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(3 4 8 16 32 64 128 0 225 242 244 248 240 252 254 254 63 63 31 31 15
15 15 15 15 31 31 63 255 255 255 254 252 252 248 248 248 248 254
127 255 255 255 254 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 255 255)
(128 192 96 48 16 32 64 128 0 0 0 0 0 0 0 0 0 128 192 192 192 192
192 192 192 192 192 192 128 128 0 0 0 0 0 0 0 0 0 128 128 128 0 0 0
255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 192 192 192 192 192 192 192 192 192 192 192
192 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192
192 192)))
;; icon number 14 zoom-icon-mask
(transform-array-in-bitmap 50
'#2A((0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 1 1 0 0 0 0 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 32 112 248 252 126 63
31 15 7 3 1 0 0 0 0 0 0 240 255 255 31 0 0 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 12 15 15 63 127 127 127 49 1 3 7 15 31 14 4 0
0 128 192 224 240 255 255 127 63 31 15 6 0 252 255 255 255 0 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255)
(0 0 0 0 0 0 0 1 3 7 15 31 63 255 255 255 255 254 252 254 254 254
190 0 0 0 0 0 0 1 3 15 255 255 255 255 191 1 0 0 0 255 255 255 0
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255)
(3 7 15 31 63 127 255 255 255 254 252 248 240 252 254 254 63 63 31
31 15 15 15 15 15 31 31 63 255 255 255 254 252 252 248 248 248 248
254 127 255 255 255 254 0 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255)
(128 192 224 240 240 224 192 128 0 0 0 0 0 0 0 0 0 128 192 192 192
192 192 192 192 192 192 192 128 128 0 0 0 0 0 0 0 0 0 128 128 128 0
0 0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 192 192 192 192 192 192 192 192 192 192 192
192 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192
192 192))))))
(add-restore-lisp-functions #'init-list-of-icons)
(eval-when (load eval)
(init-list-of-icons)) | 41,514 | Common Lisp | .cl | 594 | 56.338384 | 84 | 0.539376 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 17c1519d3479e3460a00e26fd03c413f7b5a65ca01652bcb1198ec81991237ed | 32,889 | [
-1
] |
32,890 | Z-functions-ccl.lsp | rwoldford_Quail/source/display-network/junk/Z-functions-ccl.lsp | ;;;
;;; specific mac functions needed for Z
;;;
(in-package 'Z) ; create Z package
(use-package '(window-basics browser pcl specific))
(import 'pcl::object)
(shadow 'object)
(use-package 'ccl)
(in-package 'specific)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(access-expression
set-window-icon
Z-print-help
Z-prompt-read
edit-text
get-last-typed-command
get-user-name)))
;;;
;;; functions definitions
;;;
(defun access-expression (variable)
;;;
;;; returns an expression which returns variable when it is evaluated
;;;
(when (listp variable)
(setq variable (first variable)))
(let ((name (pcl::get-name variable)))
(or name
(list 'ccl:%int-to-ptr
(%ptr-to-int variable)))))
;;; function access-object is useless for mac
;;; function key-for-access is useless for mac
(defun Z-print-help (message &key font-family font-size font-case)
;;;
;;; print a Help message in the help window using given font if any
;;;
(declare (special *Z-help-window*))
(declare (ignore font-family font-size))
(declare (object-variable wptr))
(unless (and (boundp '*Z-help-window*)
(ask *Z-help-window* (boundp 'wptr)))
(setq *Z-help-window* (oneof *listener*
:window-type :document
:window-title "Z HELP Window"
:window-size (make-point 400 200)
:window-position (make-point 0 280))))
;; only changement of font case is implemented
(let ((previous-font (ask *Z-help-window* (window-font))))
(if (string= (symbol-name font-case) "BOLD")
(ask *Z-help-window*
(set-window-font (append '(:bold)
(ask *Z-help-window* (window-font))))))
(pprint message *Z-help-window*)
(ask *Z-help-window* (set-window-font previous-font))
nil))
(defun Z-prompt-read (message)
;;; ask the user for an input using a standard *Z-prompt-window*
(let ((*Z-prompt-window*
(oneof *listener* :window-type :document
:window-title "Z Prompt window"
:window-size (make-point 300 70)
:window-position (make-point 15 50)
))
result)
(terpri *Z-prompt-window*)
(princ message *Z-prompt-window*)
(princ " > " *Z-prompt-window*)
(setq result (read-line))
(if (string= result "")
(setq result nil)
(setq result (read-from-string result)))
(ask *Z-prompt-window* (window-close))
result))
(defun edit-text (text &key (read-only nil))
;;; if read-only is t we read the text
;;; otherwise, we return the string made by concatenating text with the new entry
(if read-only
(Z-print-help text)
(let (new-line)
(quail-print text)
(quail-print "")
(princ "add new note > ")
(if (equal "" (setq new-line (read-line)))
(concatenate 'string text "
" new-line)))))
(defun get-last-typed-command ()
;;; returns the last command typed in the listener
+)
(defun get-user-name ()
'quail-user)
(defun set-window-icon (window icon)
;;; useless for Mac
(declare (ignore window))
icon)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; functions to make window shrink into an ICON
;;;
(defobject icon-window *WINDOW*)
(defobfun (window-zoom-event-handler graph-window) (&rest args)
;;; when button is pressed inside the zoom region, we should make an icon with
;;; window and hide window
(declare (ignore args))
(declare (object-variable icon-w))
(let* ((window (self))
(i-window (ask window icon-w))
icon)
(unless i-window
(when (slot-exists-p (get-window-browser window)
'Z::sub-view-icon)
(setq icon (eval (slot-value (get-window-browser window)
'Z::sub-view-icon)))
(setq i-window (oneof icon-window
:window-type :single-edge-box
:window-show nil
:window-size (make-point (bitmap-width icon)
(bitmap-height icon))
:window-position (rref *current-event* event.where)))
(ask i-window (have 'icon icon))
(ask i-window (have 'window-owner window))
(ask window (setq icon-w i-window))))
;; when the icon window is built we can close the main window
(when i-window
(ask i-window (window-show))
(ask window (window-hide)))))
(defobfun (window-draw-contents icon-window) ()
;;; redraw the icon inside the window
(declare (object-variable icon window-owner))
(let ((my-icon (ask (self) icon))
(title (Z::icon-title
(get-window-browser (ask (self) window-owner)))))
(canvas-bitblt my-icon (self)
:canvas-left 0 :canvas-bottom (- (bitmap-height my-icon)))
(ask (self) (set-window-font '("helvetica" 10)))
(canvas-move-to (max 2 (ash (- (bitmap-width my-icon)
(string-width title)) -1))
-9 (self))
(_TextMode :word (penmode-arg :patXor))
(print-without-length-check title (self))))
(defobfun (window-click-event-handler icon-window) (where)
;;; if the button is double clicked, the icon is closed and the associated
;;; window is opened
;;; simple click is treated in window-event
(declare (object-variable window-owner))
(declare (ignore where))
(when (double-click-p)
(ask (self) (window-hide))
(ask (ask (self) window-owner) (window-select))))
(defobfun (window-event icon-window) ()
;;; in the classical event treatment, there are no method to detect mouse down event
;;; we must therefore add the test in the main function and call drag-window if a
;;; mouse down event is detected
(if (eq (rref *current-event* event.what) 1)
(_DragWindow :ptr (ask (self) wptr)
:long (rref *current-event* event.where)
:ptr (make-rect 0 0 1000 1000)))
(usual-window-event))
| 6,684 | Common Lisp | .cl | 156 | 32.025641 | 85 | 0.559825 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 2ace00ad3eb39a1d08a483ce0f1054c0b4f6e0b920337e561d20d9b4e14306f1 | 32,890 | [
-1
] |
32,892 | doc-index-mcl.lsp | rwoldford_Quail/source/documentation/doc-index-mcl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; doc-index.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; copyright (c) 1990 statistical computing laboratory, university of waterloo
;;;
;;;
;;; authors:
;;; m.e. lewis 1991.
;;; r.w. oldford 1991.
;;;
;;;
;;;----------------------------------------------------------------------------
(in-package :quail-kernel)
(eval-when (:compile-top-level :load-toplevel :execute) (export '(structure-p built-in-class-p)))
(defun structure-p (symbol)
"Returns T if the given symbol is the name of a structure, NIL otherwise."
(let ((the-class-itself (find-class symbol NIL)))
(eql (and the-class-itself
(class-name (class-of the-class-itself)))
'structure-class)))
(defun built-in-class-p (symbol)
"Returns T if the given symbol is the name of a built in class, NIL otherwise."
(let ((the-class-itself (find-class symbol NIL)))
(eql (and the-class-itself
(class-name (class-of the-class-itself)))
| 1,192 | Common Lisp | .cl | 29 | 35.793103 | 98 | 0.471813 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 78ea07bb1ebba8a2297fb3563a334068acc3d864fd733b52fee7463fe1a09774 | 32,892 | [
-1
] |
32,893 | browser-mcl.lsp | rwoldford_Quail/source/browser/browser-mcl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; browser-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; Copyright (c) 1988-1992 Statistical Computing Laboratory, University of Waterloo
;;;
;;;
;;; Authors:
;;; G. Desvignes 1988,1989
;;; R.W. Oldford 1988-1992
;;;
;;;----------------------------------------------------------------------------------
;;;
;;;
;;
(in-package :quail)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(push-in-buffer
select-in-menu
)))
;;;
;;; function definitions
;;;
(defun get-active-region (window)
"Return the inside region of the window. ~
As the height and width of the clipping region are the inside dimensions ~
of the window, we use it and the origin position of the window which is ~
given by the outside region of the window to built the inside region."
(let ((reg-1 (wb::clipping-region-of window))
(reg-2 (wb::canvas-screen-region window)))
(setf (wb::region-left reg-1)
(wb::region-left reg-2))
(setf (wb::region-bottom reg-1)
(wb::region-bottom reg-2))
(setf (wb::region-width reg-1)
(- (wb::region-width reg-1) 24))
(setf (wb::region-height reg-1)
(- (wb::region-height reg-1) 16))
reg-1))
(defun push-in-buffer (text)
(print "push-in-buffer needs to be fixed.")
(format *terminal-io* "Push-in-buffer called with ~s" text)
(ccl:set-window-layer (ccl:front-window) 1)
#|
(or (stringp text)
(setq text (format nil "~s" text)))
(dotimes (k (length text))
(#_PostEvent :errchk :a0 3 :d0 (char text k) :d0)
(#_PostEvent :errchk :a0 4 :d0 (char text k) :d0)
(event-dispatch))
(#_PostEvent :errchk :a0 3 :d0 #\NewLine :d0)
(#_PostEvent :errchk :a0 4 :d0 #\NewLine :d0)
|#
)
| 2,066 | Common Lisp | .cl | 56 | 30.767857 | 86 | 0.497998 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | f2076f0a8a06743f5ad371b1734bfecbdf15ba5c5eae56856908687f19be56fb | 32,893 | [
-1
] |
32,894 | browser-excl.lsp | rwoldford_Quail/source/browser/browser-excl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; browser-excl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; Copyright (c) 1988-1992 Statistical Computing Laboratory, University of Waterloo
;;;
;;;
;;; Authors:
;;; G. Desvignes 1988,1989
;;; R.W. Oldford 1988-1992
;;;
;;;----------------------------------------------------------------------------------
;;;
;;;
;;
(in-package :quail)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(push-in-buffer
select-in-menu
)))
;;;
;;; function definitions
;;;
(defun get-active-region (window)
"Return the inside region of the window. ~
As the height and width of the clipping region are the inside dimensions ~
of the window, we use it and the origin position of the window which is ~
given by the outside region of the window to built the inside region."
(let ((reg-1 (wb::clipping-region-of window))
(reg-2 (wb::canvas-screen-region window)))
(setf (wb::region-left reg-1)
(wb::region-left reg-2))
(setf (wb::region-bottom reg-1)
(wb::region-bottom reg-2))
(setf (wb::region-width reg-1)
(- (wb::region-width reg-1) 24))
(setf (wb::region-height reg-1)
(- (wb::region-height reg-1) 16))
reg-1))
(defun push-in-buffer (text)
(format *terminal-io* "Push-in-buffer called with ~s" text))
| 1,631 | Common Lisp | .cl | 43 | 31.348837 | 86 | 0.473985 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 4687aa66044d2372121048083d507e9e9d1fca21ca1e7704c2d881ada0a806a4 | 32,894 | [
-1
] |
32,895 | quail-kernel-system-excl.lsp | rwoldford_Quail/source/quail-kernel/quail-kernel-system-excl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; quail-kernel-system-excl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; Copyright (c) 1990 Statistical Computing Laboratory, University of Waterloo
;;;
;;;
;;; Authors:
;;; Greg Anglin 1990, 1991.
;;;
;;;
;;;--------------------------------------------------------------------------------
(in-package :quail-kernel)
(defun system-get-pointer (x)
0)
| 562 | Common Lisp | .cl | 18 | 28.666667 | 84 | 0.29291 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 072201e99271077ea4cbb6275cf9d29c746b2bc15fb3d8871ac72f9e47b85dce | 32,895 | [
-1
] |
32,896 | quail-kernel-system-ccl.lsp | rwoldford_Quail/source/quail-kernel/quail-kernel-system-ccl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; quail-kernel-system-ccl.lsp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Copyright (c) 1990 Statistical Computing Laboratory, University of Waterloo
;;; Authors:
;;; Greg Anglin 1990, 1991.
;;; Simply copied -pc version by G.W. Bennett 2017
;;;--------------------------------------------------------------------------------
(in-package :quail-kernel)
(defun system-get-pointer (x)
0)
| 557 | Common Lisp | .cl | 11 | 49.454545 | 83 | 0.349817 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 975ba52847431520f6b439b882c18c9ef1b12ed4d2f4caa95bd52b2d99c11cdf | 32,896 | [
-1
] |
32,897 | quail-kernel-system-mcl.lsp | rwoldford_Quail/source/quail-kernel/quail-kernel-system-mcl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; quail-kernel-system-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; Copyright (c) 1990 Statistical Computing Laboratory, University of Waterloo
;;;
;;;
;;; Authors:
;;; Greg Anglin 1990, 1991.
;;;
;;;
;;;--------------------------------------------------------------------------------
(in-package :quail-kernel)
(defun system-get-pointer (x)
#+:ccl-2
(ccl::%address-of x)
#-:ccl-2
(ccl:%ptr-to-int (ccl:%get-ptr (list x))))
| 679 | Common Lisp | .cl | 21 | 28.142857 | 93 | 0.309231 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | a91991f44db704d299c24a33607bc7a0179533a13b7799383a676faeba6b8a05 | 32,897 | [
-1
] |
32,898 | save-ccl.lsp | rwoldford_Quail/source/quail-kernel/io/save-ccl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; save-ccl.lsp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; Copyright (c) 1990 Statistical Computing Laboratory, University of Waterloo
;;;
;;;
;;; Authors:
;;; Greg Anglin 1991.
;;;
;;; Mods:
;;; R.W. Oldford 1991.
;;; Greg Anglin 1993.
;;; Greg Bennett 1998, 2017
;;;
;;;--------------------------------------------------------------------------------
(in-package :quail-kernel)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(save save-quail-objects add-save-exit-functions)))
;--------------------------------------------------------------------------------
(defun save (&optional file)
"Saves the current Quail image in the named file. ~
If no file named, user is prompted for name."
(unless file
(let ((release-info (get-quail-release-info)))
(cond
(release-info
(let ((version (first release-info))
(distribution (second release-info))
)
(if distribution
(setf file (format NIL "Quail~s(~a)" version distribution))
(setf file (format NIL "Quail~s" version))
)
)
)
(T (setf file "Quail"))
)
)
)
;(let ((image-loc (sf::select-file
; :title "Quail image location ?"
; :prompt "Save as"
; :dialog-type :save
; :ok-label "Save")
;(cg::ask-user-for-new-pathname
; "Quail image location?"
; :initial-name (format NIL "~a.dxl" file))
;)
;)
;(apply #'excl::dumplisp (list ':name image-loc))
;(sb-ext::save-lisp-and-die image-loc)
;)
(save-application file)
)
(defun save-quail-objects ()
"Save all quail objects created in the current session."
(quail-error "Sorry don't know how to save your quail objects yet."))
(defparameter *quail-save-exit-functions* nil
"A list of functions to be executed upon exit form lisp")
(defun quail-save-exit (&rest args)
(declare (ignore args))
(mapcar #'funcall *quail-save-exit-functions*))
(defun add-save-exit-functions (&rest functions)
"Adds the given quail lisp functions to the set that will be ~
executed before the current image is saved."
(setf *quail-save-exit-functions*
(append *quail-save-exit-functions* functions)))
#|
;;; Don't know what these are yet
(pushnew #'quail-save-exit
sys:*exit-cleanup-forms* ;(cg::session-exit-functions cg::*system*) spr29023
)
|#
| 2,777 | Common Lisp | .cl | 76 | 30.881579 | 115 | 0.5026 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 2fca7d1a629b71a1651796155bcac92c92e876a4d57f3c45e8e35357d727d012 | 32,898 | [
-1
] |
32,899 | restore-excl.lsp | rwoldford_Quail/source/quail-kernel/io/restore-excl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; restore-excl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; Copyright (c) 1990 Statistical Computing Laboratory, University of Waterloo
;;;
;;;
;;; Authors:
;;; Greg Anglin 1991.
;;;
;;; Mods:
;;; R.W. Oldford 1991.
;;; Greg Anglin 1993.
;;;
;;;--------------------------------------------------------------------------------
(in-package :quail-kernel)
;; punt for now ...
(warn "quail-restore is incompletely implemented for this Lisp implementation.") | 704 | Common Lisp | .cl | 21 | 29.857143 | 84 | 0.334808 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | fb40b147d15e6506aa12903d7990383e59a3f3bc729eee13e031a599bd8e8b9a | 32,899 | [
-1
] |
32,900 | save-excl.lsp | rwoldford_Quail/source/quail-kernel/io/save-excl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; save-excl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; Copyright (c) 1990 Statistical Computing Laboratory, University of Waterloo
;;;
;;;
;;; Authors:
;;; Greg Anglin 1991.
;;;
;;; Mods:
;;; R.W. Oldford 1991.
;;; Greg Anglin 1993.
;;;
;;;
;;;--------------------------------------------------------------------------------
(in-package :quail-kernel)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(save save-quail-objects add-save-exit-functions)))
;--------------------------------------------------------------------------------
;; this is a quick and dirty version of save which doesn't do the
;; necessary stuff for setting up restart actions
(defun save (file &key (checkpoint NIL) &allow-other-keys)
"Saves the current Quail image in the named file."
(excl:dumplisp :name file :checkpoint checkpoint))
(defun save-quail-objects ()
"Save all quail objects created in the current session."
(quail-error "Sorry don't know how to save your quail objects yet."))
(defparameter *quail-save-exit-functions* nil
"A list of functions to be executed upon exit form lisp")
(defun quail-save-exit ()
(mapcar #'funcall *quail-save-exit-functions*))
(defun add-save-exit-functions (&rest functions)
"Adds the given quail lisp functions to the set that will be ~
executed before the current image is saved."
(setf *quail-save-exit-functions*
(append *quail-save-exit-functions* functions)))
;; To dodge problems while starting a port ... saving
;; isn't usually a big issue just then ... Greg Anglin 93 12
#| Need a means like this in mcl to add to the save-exit-functions
(pushnew #'quail-save-exit
ccl:*save-exit-functions*)
|#
;; use warn here because quail-warn is undefined just yet ...
(warn
"Need to define *save-exit-functions* for this implementation.")
| 2,117 | Common Lisp | .cl | 48 | 40.083333 | 116 | 0.564366 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 4ee427afe6c8adcc9da0f4b404d5764d7f7dd615210ce69dd8cfe3abe47d6bec | 32,900 | [
-1
] |
32,901 | save-mcl.lsp | rwoldford_Quail/source/quail-kernel/io/save-mcl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; save-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; Copyright (c) 1990 Statistical Computing Laboratory, University of Waterloo
;;;
;;;
;;; Authors:
;;; Greg Anglin 1991.
;;;
;;; Mods:
;;; R.W. Oldford 1991.
;;; Greg Anglin 1993.
;;;
;;;
;;;--------------------------------------------------------------------------------
(in-package :quail-kernel)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(save save-quail-objects add-save-exit-functions)))
;--------------------------------------------------------------------------------
(defun save (&optional file)
"Saves the current Quail image in the named file. ~
If no file named, user is prompted for name."
(unless file
(let ((release-info (get-quail-release-info)))
(cond
(release-info
(let ((version (first release-info))
(distribution (second release-info))
)
(if distribution
(setf file (format NIL "Quail ~s (~a)" version distribution))
(setf file (format NIL "Quail ~s" version))
)
)
)
(T (setf file "Quail"))
)
)
)
(ccl:save-application
(ccl:choose-new-file-dialog
:prompt "Quail image location?"
:directory file))
)
(defun save-quail-objects ()
"Save all quail objects created in the current session."
(quail-error "Sorry don't know how to save your quail objects yet."))
(defparameter *quail-save-exit-functions* nil
"A list of functions to be executed upon exit form lisp")
(defun quail-save-exit ()
(mapcar #'funcall *quail-save-exit-functions*))
(defun add-save-exit-functions (&rest functions)
"Adds the given quail lisp functions to the set that will be ~
executed before the current image is saved."
(setf *quail-save-exit-functions*
(append *quail-save-exit-functions* functions)))
(pushnew #'quail-save-exit
ccl:*save-exit-functions*)
| 2,230 | Common Lisp | .cl | 61 | 30.442623 | 116 | 0.51048 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 4f79bd6f387c0f032a75d77383b32716040c166cc6c334ce6e04a09bb94d72eb | 32,901 | [
-1
] |
32,902 | return-class.lsp | rwoldford_Quail/source/quail-kernel/basic/return-class.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; return-class.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; Copyright (c) 1990 Statistical Computing Laboratory, University of Waterloo
;;;
;;;
;;; Authors:
;;; Greg Anglin 1989, 1990.
;;;
;;;
;;;--------------------------------------------------------------------------------
;;;
;;; Includes:
;;; the-class-name
;;; put-return-class
;;; get-return-class
;;; find-return-class
;;;
(in-package :quail-kernel)
;----------------------------------------------------------------------------------
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(put-return-class get-return-class)))
(defvar *return-class-table*)
(setf *return-class-table* (make-hash-table :size 20 :test #'equal))
(defun the-class-name (c)
(if (symbolp c)
c
(quail-class-name c)))
(defun put-return-class (ret-class class-1 classes)
"Assigns the first argument as the name of the class to ~
to be returned as the default type for any binary operation ~
involving the class named as the second argument and any of ~
the classes named in the list constituting the third argument.~
(:see-also get-return-class)"
(declare (special *return-class-table*))
(let* ((ret-class (the-class-name ret-class))
(class-1 (the-class-name class-1))
(classes (mapcar #'the-class-name classes))
(expanded-classes NIL))
(loop for class in classes
do
(cond
((eq class 'number)
(setf expanded-classes
(append '(number complex rational
float integer fixnum bignum)
expanded-classes)))
((eq class 'integer)
(setf expanded-classes
(append '(integer fixnum bignum)
expanded-classes))
)
((eq class 'list)
(setf expanded-classes
(append '(list cons)
expanded-classes))
)
(T (push class expanded-classes))
))
(setf classes
(remove-duplicates expanded-classes :test #'eq))
(loop for class-2 in classes
do (setf (gethash (list class-1 class-2) *return-class-table*)
ret-class)
(setf (gethash (list class-2 class-1) *return-class-table*)
ret-class))
t))
;;; get-return-class returns nil if the pair of class names is not found in the
;;; hash table. This will happen often, and it is up to the calling routine
;;; to decide what class is appropriate (usually use the class of the first
;;; operand).
;;; NOTE: get-return-class expects CLOS class _names_, not the classes themselves!
(defun get-return-class (class-1 class-2)
"Returns the name of the class to ~
to be returned as the default type for any binary operation ~
involving the classes named as the first and second arguments. ~
If no return-class has been identified with this pair, then NIL is returned. ~
(:see-also put-return-class)"
(declare (special *return-class-table*))
(let* ((classes (list class-1 class-2)))
(gethash classes *return-class-table*)))
;----------------------------------------------------------------------------------
;; Note that I've cheated and used class matrix before it is
;; defined -- this may cause problems later.
(defun find-return-class (len-dim minimal-class proto-list)
(let* ((class-list (mapcar #'quail-class-name
proto-list))
;; Here we find the minimal class for a (setf ref)-able
;; object of the required number of dimensions. Use of
;; class matrix for zero dimensions is somewhat arbitrary,
;; but probably the best guess ... This needs to be
;; thought out more carefully when classes like, say,
;; symmetric matrix are around.
(minimal-class (if minimal-class
(the-class-name minimal-class)
(case len-dim
(0 'matrix)
(1 'cons)
(otherwise 'array))))
;; NOTE: if class-list is nil, get-return-class is NOT called.
;; Hence get-return-class is _always_ called with 2 arguments
;; (see definition of reduce).
(ret-class (reduce #'get-return-class
class-list
:initial-value minimal-class)))
(if (not ret-class)
(setf ret-class (first class-list)))
ret-class))
;----------------------------------------------------------------------------------
;;; Initialize some of the hash table
(put-return-class 'cons
'cons
'(cons number integer fixnum float
rational complex symbol))
(put-return-class 'vector
'vector
'(vector cons number integer fixnum float
rational complex symbol))
(put-return-class 'array
'array
'(array vector cons number integer fixnum float
rational complex symbol))
;----------------------------------------------------------------------------------
(defun dump-return-classes ()
(declare (special *return-class-table*
*quail-terminal-io*))
(maphash #'(lambda (x y) (format *quail-terminal-io* "~&~S ~S" x y))
*return-class-table*)
(values))
| 6,003 | Common Lisp | .cl | 132 | 34.295455 | 102 | 0.49571 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 9b4e1d67e88f83253d12f4b6791180ef6247b3266f7364a231e5728dc97f1eca | 32,902 | [
-1
] |
32,903 | utility-excl.lsp | rwoldford_Quail/source/quail-kernel/basic/utility-excl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; utility-excl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; Copyright (c) 1990 Statistical Computing Laboratory, University of Waterloo
;;;
;;;
;;; Authors:
;;; Greg Anglin 1989, 1990, 1991.
;;; R.W. Oldford 1991
;;; M.E. Lewis 1991
;;; Greg Anglin 1993, -excl port
;;;
;;;--------------------------------------------------------------------------------
;;;
;;; Includes:
;;;
;;; get-lambda-list
(in-package :quail-kernel)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(structure-p built-in-class-p)))
;;;---------------------------------------------------------------------------------
;;; preliminaries
;;;
#+:cl-1
(eval-when (:compile-toplevel :load-toplevel :execute)
"A gimmick to accomodate CLtL 1. The package ~
containing the LISP language is called lisp in CLtL 1 but ~
common-lisp in CLtL 2. Here LISP is given the same ~
nicknames."
(let ((old-package (find-package "LISP")))
(excl::enter-new-nicknames old-package (list "COMMON-LISP" "CL")))
)
;;;----------------------
(defun structure-p (symbol)
"Returns T if the given symbol is the name of a structure, NIL otherwise."
(let ((the-class-itself (find-class symbol NIL)))
(eql (and the-class-itself
(class-name (class-of the-class-itself)))
'structure-class)))
(defun built-in-class-p (symbol)
"Returns T if the given symbol is the name of a built in class, NIL otherwise."
(let ((the-class-itself (find-class symbol NIL)))
(eql (and the-class-itself
(class-name (class-of the-class-itself)))
'built-in-class)))
(defun get-lambda-list (symbol)
(tree-apply #'(lambda (x) (if (symbolp x)
(intern (string x))
x))
(excl:arglist symbol)))
| 2,085 | Common Lisp | .cl | 53 | 33.301887 | 97 | 0.482552 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 66cb4afe17b9daf447a05414636ecacb3e658db6f94d04d67ab6ad3de9065bc3 | 32,903 | [
-1
] |
32,904 | utility-mcl.lsp | rwoldford_Quail/source/quail-kernel/basic/utility-mcl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; utility-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; Copyright (c) 1990 Statistical Computing Laboratory, University of Waterloo
;;;
;;;
;;; Authors:
;;; Greg Anglin 1989, 1990, 1991.
;;; R.W. Oldford 1991
;;; M.E. Lewis 1991
;;;
;;;--------------------------------------------------------------------------------
;;;
;;; Includes:
;;;
;;; get-lambda-list
(in-package :quail-kernel)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(structure-p built-in-class-p)))
;;;---------------------------------------------------------------------------------
;;; preliminaries
;;;
#+:cl-1
(eval-when (compile load eval)
"A gimmick to accomodate both CLtL 1 and 2. The package ~
containing the LISP language is called lisp in one and ~
common-lisp in the other. Here they are given the same ~
nickname."
(let ((old-package-name
(package-name (find-package "LISP" )))
(old-package-nicknames
(package-nicknames (find-package "LISP")))
)
(rename-package
(find-package "LISP")
old-package-name
(append (list "CL" "COMMON-LISP") old-package-nicknames))))
(defun structure-p (symbol)
"Returns T if the given symbol is the name of a structure, NIL otherwise."
(let ((the-class-itself (find-class symbol NIL)))
(eql (and the-class-itself
(class-name (class-of the-class-itself)))
'structure-class)))
(defun built-in-class-p (symbol)
"Returns T if the given symbol is the name of a built in class, NIL otherwise."
(let ((the-class-itself (find-class symbol NIL)))
(eql (and the-class-itself
(class-name (class-of the-class-itself)))
'built-in-class)))
(defun get-lambda-list (symbol)
(let ((arglist (ccl:arglist symbol)))
(when (member 'ccl::&method arglist)
(setf arglist (cddr arglist)))
(tree-apply #'(lambda (x) (if (symbolp x)
(intern (string x))
x))
arglist)))
| 2,302 | Common Lisp | .cl | 60 | 31.8 | 97 | 0.49505 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 576d78f4f541f0fd6e7ccaa317b1d08caf16277d72faab742f25d924008abacf | 32,904 | [
-1
] |
32,905 | utility-ccl.lsp | rwoldford_Quail/source/quail-kernel/basic/utility-ccl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; utility-ccl.lsp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; Copyright (c) 1990 Statistical Computing Laboratory, University of Waterloo
;;;
;;;
;;; Authors:
;;; Greg Anglin 1989, 1990, 1991.
;;; R.W. Oldford 1991
;;; M.E. Lewis 1991
;;; Greg Anglin 1993, -excl port
;;;
;;;--------------------------------------------------------------------------------
;;; A copy of utility-excl.lisp <= ***
;;; There is no EXCL package in aclwin
;;;
;;; Includes:
;;;
;;; get-lambda-list
(in-package :quail-kernel)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(structure-p built-in-class-p)))
#+:cl-1(eval-when (:compile-toplevel :load-toplevel :execute)
"A gimmick to accomodate CLtL 1. The package ~
containing the LISP language is called lisp in CLtL 1 but ~
common-lisp in CLtL 2. Here LISP is given the same ~
nicknames."
(let ((old-package (find-package "LISP")))
(excl::enter-new-nicknames old-package (list "COMMON-LISP" "CL")))
)
(defun structure-p (symbol)
"Returns T if the given symbol is the name of a structure, NIL otherwise."
(let ((the-class-itself (find-class symbol NIL)))
(eql (and the-class-itself
(class-name (class-of the-class-itself)))
'structure-class)))
(defun built-in-class-p (symbol)
"Returns T if the given symbol is the name of a built in class, NIL otherwise."
(let ((the-class-itself (find-class symbol NIL)))
(eql (and the-class-itself
(class-name (class-of the-class-itself)))
'built-in-class)))
(defun get-lambda-list (symbol)
(let ((lam-list
(ccl:arglist symbol);(sb-introspect:function-arglist symbol) ;(acl::lambda-list symbol) see spr29023
))
(if (equal lam-list :unknown)
(list :unknown)
(let
((args
(tree-apply #'(lambda (x) (if (symbolp x)
(intern (string x))
x))
lam-list)))
(labels
((get-first-atom (x)
(cond
((symbolp x) x)
((listp x) (get-first-atom (first x)))))
)
(loop for arg in args
collect (get-first-atom arg)))))
)
)
| 2,475 | Common Lisp | .cl | 67 | 30.029851 | 109 | 0.507095 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 6917f12fed0e6af5b75d4324f38e4c012d9487d7807d43a7a58fabd00753961e | 32,905 | [
-1
] |
32,906 | mop-excl.lsp | rwoldford_Quail/source/quail-kernel/mop/mop-excl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; mop-excl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; Copyright (c) 1988-1991 Statistical Computing Laboratory, University of Waterloo
;;;
;;;
;;; Authors:
;;; G. Desvignes 1988,1989
;;; R.W. Oldford 1988-1994
;;; Greg Anglin 1992
;;;
;;;----------------------------------------------------------------------------------
;;;
;;;
;;; Meta-Object protocol interface
;;;
;;; This file imports to quail-kernel fundamental functions which I think are
;;; X3J13-proposed for the standard MOP, and exports them from quail-kernel,
;;; along with some older (perhaps redundant, now) covers for them.
;;;
;;; DGA ... upon arrival of MCL 2.0 final, Oct 92.
;;;
;;; The following are implemented in Allegro CL 4.1 and are imported to quail-kernel.
;;; Others are also present, but I haven't grabbed them ...
;;;
;;; class-direct-subclasses
;;; class-direct-superclasses
;;; class-precedence-list
;;; class-prototype
;;; class-direct-slots
;;; class-slots
;;; specializer-direct-methods
;;; specializer-direct-generic-functions
;;; generic-function-methods
;;; method-function
;;; method-generic-function
;;; method-specializers
;;; slot-definition-name
;;;
(in-package :quail-kernel)
;; We're breaking the rules by putting import before export, so we
;; have to be careful and use eval-when.
(eval-when (:compile-toplevel :load-toplevel :execute)
(import '(clos:class-direct-subclasses
clos:class-direct-superclasses
clos:class-precedence-list
clos:class-prototype
clos:class-direct-slots
clos:class-slots
clos:class-direct-methods
clos:specializer-direct-methods
clos:specializer-direct-generic-functions
clos:generic-function-methods
clos:method-function
clos:method-generic-function
clos:method-specializers
clos:slot-definition-initargs
clos:slot-definition-initform
clos:slot-definition-readers
clos:slot-definition-writers
clos:slot-definition-type
clos:slot-definition-name
)))
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(class-direct-subclasses
class-direct-superclasses
class-precedence-list
class-prototype
class-direct-slots
class-slots
class-direct-methods
specializer-direct-methods
specializer-direct-generic-functions
generic-function-methods
method-function
method-generic-function
method-specializers
slot-definition-initargs
slot-definition-initform
slot-definition-readers
slot-definition-writers
slot-definition-type
slot-definition-name
slot-definition
)))
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(class-p
direct-slots
generic-function-p
reader-method-p
writer-method-p)))
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(collect-methods
collect-accessors
collect-slot-definitions
)))
(defmethod slot-definition-initargs (slot-definition)
(declare (ignore slot-definition)))
(defmethod slot-definition-initform (slot-definition)
(declare (ignore slot-definition)))
(defmethod slot-definition-writers (slot-definition)
(declare (ignore slot-definition)))
(defmethod slot-definition-readers (slot-definition)
(declare (ignore slot-definition)))
(defmethod slot-definition-type (slot-definition)
(declare (ignore slot-definition)))
;;; -----------------------------
(defun class-p (arg)
"Return T if argument is a class."
(typep arg 'standard-class))
(defun generic-function-p (arg)
"Return T if argument is a generic-function."
(typep arg 'generic-function))
(defun reader-method-p (method)
"Tests whether method is a directly defined reader method."
(let ((specializers (method-specializers method)))
(and (= (length specializers) 1)
(member method
(slot-definition-readers (first specializers))
:test #'eq))))
(defun writer-method-p (method)
"Tests whether method is a directly defined writer method."
(let ((specializers (method-specializers method)))
(and (= (length specializers) 2)
(member method
(slot-definition-readers (first specializers))
:test #'eq))))
(defmethod class-slots ((self structure-class))
"Returns the list of slots of the class."
(append (class-class-slots self)
(class-instance-slots self)))
(defmethod class-direct-slots ((self structure-class))
"Returns the list of slots of the class."
(append (class-direct-class-slots self)
(class-direct-instance-slots self)))
(defmethod class-slots ((self standard-class))
"Returns the list of slots of the class."
(append (class-class-slots self)
(class-instance-slots self)))
(defmethod class-direct-slots ((self standard-class))
"Returns the list of slots of the class."
(append (class-direct-class-slots self)
(class-direct-instance-slots self)))
(defmethod class-slots ((self built-in-class))
"Returns the list of slots of the class."
(append (class-class-slots self)
(class-instance-slots self)))
(defmethod class-direct-slots ((self built-in-class))
"Returns the list of slots of the class."
(append (class-direct-class-slots self)
(class-direct-instance-slots self)))
;;;
;;; The following are mop specialized methods to prevent breakage
;;; (in the documentation system anyway) when ``classes'' like T
;;; are encountered where it makes no sense for them to have slots etc.
;;;
(defmethod class-direct-class-slots ((Self T))
"Call makes little sense. Returns NIL."
())
(defmethod class-class-slots ((Self T))
"Call makes little sense. Returns NIL."
())
(defmethod class-instance-slots ((Self T))
"Call makes little sense. Returns NIL."
())
(defmethod class-direct-instance-slots ((Self T))
"Call makes little sense. Returns NIL."
())
(defmethod class-direct-subclasses ((Self T))
"Call makes little sense. Returns NIL."
())
(defmethod class-precedence-list ((Self T))
"Call makes little sense. Returns NIL."
())
(defmethod class-direct-superclasses ((Self T))
"Call makes little sense. Returns NIL."
())
;;;
;;;
;;;
(defun collect-methods (fun)
"Collects all the methods associated with the generic-function fun, ~
organizes these into an association list whose keys are the qualifier ~
lists for each method and whose values are the list of methods having ~
those qualifiers. Those methods which do not have qualifiers, i.e. ~
whose qualifer list is NIL, will be stored with key (\:primary)."
(let ((methods (clos::generic-function-methods
(cond
((symbolp fun) (symbol-function fun))
(T fun))))
(result NIL)
qualifiers
)
(loop for method in methods
do
(setf qualifiers (or (method-qualifiers method)
(list :primary)))
(if (assoc qualifiers result :test #'equal)
(push method (cdr (assoc qualifiers result :test #'equal)))
(setf result (acons qualifiers (list method) result))))
result))
(defun collect-accessors (class)
"Collects all the accessor methods associated with the class class, ~
organizes these into an association list whose keys are either ~
:readers or :writers. ~
The value associated with each key is a list of lists of reader or ~
writer methods respectively for all slots of class. The first element ~
in each value list is the list of method qualifiers; ~
The remaing elements are the method-objects themselves."
(cond
((symbolp class) (setf class (find-class class)))
((stringp class) (setf class (find-class
(with-input-from-string (s class)
(read s)))))
)
(let ((reader-methods (slot-definition-readers class))
(writer-methods (slot-definition-writers class))
qualifiers
reader-list
writer-list)
(loop for method in reader-methods
do
(setf qualifiers (or (method-qualifiers method)
(list :primary)))
(if (assoc qualifiers reader-list :test #'equal)
(push method (cdr (assoc qualifiers reader-list :test #'equal)))
(setf reader-list (acons qualifiers (list method) reader-list))))
(loop for method in writer-methods
do
(setf qualifiers (or (method-qualifiers method)
(list :primary)))
(if (assoc qualifiers writer-list :test #'equal)
(push method (cdr (assoc qualifiers writer-list :test #'equal)))
(setf writer-list (acons qualifiers (list method) writer-list))))
(list
(list :readers reader-list)
(list :writers writer-list))
)
)
(defun collect-slot-definitions (class)
"Collects all the slot-definitions associated with the class class, ~
organizes these into an association list whose keys are one of ~
:class-slots :instance-slots :direct-class-slots and :direct-instance-slots. ~
The value associated with each key is a list of slot-definitions of that type ~
for this class. ~
"
(cond
((symbolp class) (setf class (find-class class)))
((stringp class) (setf class (find-class
(with-input-from-string (s class)
(read s)))))
)
(let ((direct-class-slots (class-direct-class-slots class))
(direct-instance-slots (class-direct-instance-slots class))
(instance-slots (class-instance-slots class))
(class-slots (class-class-slots class))
)
(setf class-slots
(cons
:class-slots
class-slots))
(setf instance-slots
(cons
:instance-slots
instance-slots))
(setf direct-class-slots
(cons
:direct-class-slots
direct-class-slots))
(setf direct-instance-slots
(cons
:direct-instance-slots
direct-instance-slots))
(list class-slots
instance-slots
direct-class-slots
direct-instance-slots)))
(defmethod slot-definition-readers ((thing standard-class))
(let ((direct-methods (specializer-direct-methods (class-of thing)))
)
(loop for method in direct-methods
when (typep method 'clos::standard-reader-method)
collect
method)))
(defmethod slot-definition-writers ((thing standard-class))
(let ((direct-methods (specializer-direct-methods (class-of thing)))
)
(loop for method in direct-methods
when (typep method 'clos::standard-writer-method)
collect
method)))
| 11,643 | Common Lisp | .cl | 292 | 31.907534 | 89 | 0.61823 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 33750e2c6c9831210f0662d5233aab8a0e74c1ede8b452d19225366b30a797be | 32,906 | [
-1
] |
32,907 | function-info-ccl.lsp | rwoldford_Quail/source/quail-kernel/mop/function-info-ccl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; function-info-ccl.lisp
;;;
;;; G.W.Bennett 2017
;;;
;;;
;;;
;;;----------------------------------------------------------------------------------
(in-package :quail-kernel)
(defun function-name (f)
NIL)
| 359 | Common Lisp | .cl | 12 | 27.916667 | 85 | 0.212209 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 112964972a340428eafa88aab79431e4fa4b1ae5b2edc2c6d3530ba424e4d1db | 32,907 | [
-1
] |
32,908 | function-info-mcl.lsp | rwoldford_Quail/source/quail-kernel/mop/function-info-mcl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; function-info-mcl.lisp
;;;
;;; Catherine Hurley 1994
;;;
;;;
;;;
;;;----------------------------------------------------------------------------------
(in-package :quail-kernel)
(defun function-name (f)
(ccl::function-name f)) | 394 | Common Lisp | .cl | 12 | 29.916667 | 86 | 0.244032 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 5b80bc315c6c97985147e49acf2e1835af16c1184bc8eb3e672e765347c91d6a | 32,908 | [
-1
] |
32,909 | function-info-excl.lsp | rwoldford_Quail/source/quail-kernel/mop/function-info-excl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; function-info-excl.lisp
;;;
;;; Catherine Hurley 1994
;;;
;;;
;;;
;;;----------------------------------------------------------------------------------
(in-package :views)
(defun function-name(f)
(xref::object-to-function-name f)
) | 403 | Common Lisp | .cl | 13 | 27.923077 | 86 | 0.249351 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 68053b6f140b0d066022d93bf55595f0aa5f8ce5e44659f4eef844f4dd36018b | 32,909 | [
-1
] |
32,910 | mop-ccl.lsp | rwoldford_Quail/source/quail-kernel/mop/mop-ccl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; mop-ccl.lsp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; Copyright (c) 1988-1991 Statistical Computing Laboratory, University of Waterloo
;;;
;;;
;;; Authors:
;;; G. Desvignes 1988,1989
;;; R.W. Oldford 1988-1994
;;; Greg Anglin 1992
;;; Greg Bennett 2017
;;;
;;;----------------------------------------------------------------------------------
;;;
;;; BASED on mop-excl.lisp
;;;
;;; Meta-Object protocol interface
;;;
;;; This file imports to quail-kernel fundamental functions which I think are
;;; X3J13-proposed for the standard MOP, and exports them from quail-kernel,
;;; along with some older (perhaps redundant, now) covers for them.
;;;
;;; DGA ... upon arrival of MCL 2.0 final, Oct 92.
;;;
;;; The following are implemented in Allegro CL 4.1 and are imported to quail-kernel.
;;; Others are also present, but I haven't grabbed them ...
;;;
;;; y on N shows what aclwin recognises gwb 042097
;;;
;;; class-direct-subclasses
;;; class-direct-superclasses
;;; class-precedence-list
;;; class-prototype
;;; class-direct-slots
;;; class-slots
;;; specializer-direct-methods
;;; specializer-direct-generic-functions
;;; generic-function-methods
;;; method-function
;;; method-generic-function
;;; method-specializers
;;; slot-definition-name
;;;
#|
;;; Debugging stuff ?
;;; 28oct2005 gwb
;;; ACL7.0 has moved function-information to the sys package
;;; here we import it to common-lisp and common-lisp-user,
;;; then export it from both before proceeding as before.
;;; This has to be done early in the LOAD of Quail.
(in-package "COMMON-LISP")
(import 'sys::function-information)
(export 'function-information)
(in-package "COMMON-LISP-USER")
(import 'sys::function-information)
(export 'function-information)
;;; 28oct2005
|#
(in-package :quail-kernel)
;; We're breaking the rules by putting import before export, so we
;; have to be careful and use eval-when.
;;; In aclwin there is no CLOS package <= *****
(eval-when (:compile-toplevel :load-toplevel :execute)
(import '(openmcl-mop::class-direct-subclasses openmcl-mop::class-direct-superclasses
openmcl-mop::class-direct-slots openmcl-mop::specializer-direct-methods
openmcl-mop::specializer-direct-generic-functions openmcl-mop::generic-function-methods
openmcl-mop::method-function openmcl-mop::method-generic-function
openmcl-mop::method-specializers openmcl-mop::slot-definition-readers
openmcl-mop::slot-definition-writers openmcl-mop::slot-definition-initargs
openmcl-mop::slot-definition-initform
openmcl-mop::slot-definition-type
openmcl-mop::slot-definition-name
openmcl-mop::slot-definition-allocation
openmcl-mop::slot-definition-initfunction)
))
(eval-when (:compile-toplevel :load-toplevel :execute)
(shadow '(openmcl-mop::class-precedence-list
openmcl-mop::class-prototype
openmcl-mop::class-slots
))
)
(eval-when (:compile-toplevel :load-toplevel :execute)
(export '(class-direct-subclasses class-direct-superclasses
class-direct-slots specializer-direct-methods
specializer-direct-generic-functions generic-function-methods
method-function method-generic-function
method-specializers slot-definition-readers
slot-definition-writers slot-definition-initargs
slot-definition-initform
slot-definition-type
slot-definition-name
slot-definition-allocation
slot-definition-initfunction)
)
)
(eval-when (:compile-toplevel :load-toplevel :execute)
(export '(class-p
direct-slots
generic-function-p
reader-method-p
writer-method-p)))
(eval-when (:compile-toplevel :load-toplevel :execute)
(export '(collect-methods
collect-accessors
collect-slot-definitions
)))
;;; Had to ensure that the class was finalized before calling
;;;
;;; Added for the benefit of ACL6.0 for right-button problem
(defmethod openmcl-mop::finalize-inheritance
((thing T))
)
(defmethod class-precedence-list ((thing standard-class))
(unless (openmcl-mop::class-finalized-p thing)
(openmcl-mop::finalize-inheritance thing))
(openmcl-mop::class-precedence-list thing)
)
;; Added 02DEC98 for errors on right-button - see porting.lsp [57]
(defmethod class-precedence-list ((thing T))
(unless (openmcl-mop::class-finalized-p thing)
(openmcl-mop::finalize-inheritance thing))
(if (openmcl-mop::class-finalized-p thing)
(openmcl-mop::class-precedence-list thing)
(remove thing (openmcl-mop::compute-class-precedence-list thing))
)
)
(defmethod class-prototype ((thing standard-class))
(unless (openmcl-mop::class-finalized-p thing)
(openmcl-mop::finalize-inheritance thing))
(openmcl-mop::class-prototype thing)
)
(defmethod class-slots ((thing standard-class))
(unless (openmcl-mop::class-finalized-p thing)
(openmcl-mop::finalize-inheritance thing))
(openmcl-mop::class-slots thing)
)
#|
;;; There is sb-pcl::specializer-direct-methods (specialilzer)
;;; is this what is needed ?
(defmethod class-methods ((thing standard-class))
(unless (openmcl-mop::class-finalized-p thing)
(openmcl-mop::finalize-inheritance thing))
(cg::all-specializer-direct-methods thing)
)
|#
(eval-when (:compile-toplevel :load-toplevel :execute)
(export
'(class-prototype class-precedence-list class-slots
class-direct-methods class-methods
)
)
)
;;; -----------------------------
(defun class-p (arg)
"Return T if argument is a class."
(typep arg 'standard-class))
(defun generic-function-p (arg)
"Return T if argument is a generic-function."
(typep arg 'generic-function))
(defgeneric method-name (method-object)
(:documentation "Returns the name of the method."))
(defmethod method-name ((thing standard-method))
(let ((gf (slot-value thing 'generic-function))
)
(when gf
(slot-value gf 'openmcl-mop::name))
)
)
(defmethod method-name ((thing openmcl-mop::standard-writer-method))
(let ((gf (slot-value thing 'generic-function))
name)
(when gf
(setf name (slot-value gf 'openmcl-mop::name)))
(when (and name (listp name))
(setf name (second name)))
name)
)
(defun reader-method-p (method)
"Tests whether method is a directly defined reader method."
(let ((specializers (method-specializers method)))
(and (= (length specializers) 1)
(member method
(slot-definition-readers (first specializers))
:test #'eq))))
(defun writer-method-p (method)
"Tests whether method is a directly defined writer method."
(let ((specializers (method-specializers method)))
(and (= (length specializers) 2)
(member method
(slot-definition-readers (first specializers))
:test #'eq))))
(defmethod class-direct-class-slots ((self standard-class))
"Call makes little sense. Returns NIL."
(loop for slot in (class-direct-slots self)
when (not (eq (openmcl-mop::slot-definition-allocation slot) :instance))
collect slot))
(defmethod class-class-slots ((Self standard-class))
"Call makes little sense. Returns NIL."
(loop for slot in (class-slots self)
when (not (eq (openmcl-mop::slot-definition-allocation slot) :instance))
collect slot))
(defmethod class-instance-slots ((Self standard-class))
"Call makes little sense. Returns NIL."
(loop for slot in (class-slots self)
when (eq (openmcl-mop::slot-definition-allocation slot) :instance)
collect slot))
(defmethod class-direct-instance-slots ((Self standard-class))
"Call makes little sense. Returns NIL."
(loop for slot in (class-direct-slots self)
when (eq (openmcl-mop::slot-definition-allocation slot) :instance)
collect slot))
;;;
;;; The following are mop specialized methods to prevent breakage
;;; (in the documentation system anyway) when ``classes'' like T
;;; are encountered where it makes no sense for them to have slots etc.
;;;
(defmethod class-direct-class-slots ((Self T))
"Call makes little sense. Returns NIL."
())
(defmethod class-class-slots ((Self T))
"Call makes little sense. Returns NIL."
())
(defmethod class-instance-slots ((Self T))
"Call makes little sense. Returns NIL."
())
(defmethod class-direct-instance-slots ((Self T))
"Call makes little sense. Returns NIL."
())
;;;
;;;
;;;
(defun collect-methods (fun)
"Collects all the methods associated with the generic-function fun, ~
organizes these into an association list whose keys are the qualifier ~
lists for each method and whose values are the list of methods having ~
those qualifiers. Those methods which do not have qualifiers, i.e. ~
whose qualifer list is NIL, will be stored with key (\:primary)."
(let ((methods (generic-function-methods
(cond
((symbolp fun) (symbol-function fun))
(T fun))))
(result NIL)
qualifiers
)
(loop for method in methods
do
(setf qualifiers (or (method-qualifiers method)
(list :primary)))
(if (assoc qualifiers result :test #'equal)
(push method (cdr (assoc qualifiers result :test #'equal)))
(setf result (acons qualifiers (list method) result))))
result))
(defun collect-accessors (class)
"Collects all the accessor methods associated with the class class, ~
organizes these into an association list whose keys are either ~
:readers or :writers. ~
The value associated with each key is a list of lists of reader or ~
writer methods respectively for all slots of class. The first element ~
in each value list is the list of method qualifiers; ~
The remaing elements are the method-objects themselves."
(cond
((symbolp class) (setf class (find-class class)))
((stringp class) (setf class (find-class
(with-input-from-string (s class)
(read s)))))
)
(let ((reader-methods (slot-definition-readers class))
(writer-methods (slot-definition-writers class))
qualifiers
reader-list
writer-list)
(loop for method in reader-methods
do
(setf qualifiers (or (method-qualifiers method)
(list :primary)))
(if (assoc qualifiers reader-list :test #'equal)
(push method (cdr (assoc qualifiers reader-list :test #'equal)))
(setf reader-list (acons qualifiers (list method) reader-list))))
(loop for method in writer-methods
do
(setf qualifiers (or (method-qualifiers method)
(list :primary)))
(if (assoc qualifiers writer-list :test #'equal)
(push method (cdr (assoc qualifiers writer-list :test #'equal)))
(setf writer-list (acons qualifiers (list method) writer-list))))
(cond
((and reader-list writer-list)
(list
(cons :readers reader-list)
(cons :writers writer-list))
)
(reader-list (list (cons :readers reader-list)))
(writer-list (list (cons :writers writer-list)))
(T NIL))
)
)
(defun collect-slot-definitions (class)
"Collects all the slot-definitions associated with the class class, ~
organizes these into an association list whose keys are one of ~
:class-slots :instance-slots :direct-class-slots and :direct-instance-slots. ~
The value associated with each key is a list of slot-definitions of that type ~
for this class. ~
"
(cond
((symbolp class) (setf class (find-class class)))
((stringp class) (setf class (find-class
(with-input-from-string (s class)
(read s)))))
)
(let ((direct-class-slots (class-direct-class-slots class))
(direct-instance-slots (class-direct-instance-slots class))
(instance-slots (class-instance-slots class))
(class-slots (class-class-slots class))
)
(setf class-slots
(cons
:class-slots
class-slots))
(setf instance-slots
(cons
:instance-slots
instance-slots))
(setf direct-class-slots
(cons
:direct-class-slots
direct-class-slots))
(setf direct-instance-slots
(cons
:direct-instance-slots
direct-instance-slots))
(list class-slots
instance-slots
direct-class-slots
direct-instance-slots)))
(defmethod slot-definition-readers ((thing T))
NIL)
(defmethod slot-definition-writers ((thing T))
NIL)
(defmethod slot-definition-readers ((thing standard-class))
(let ((direct-methods (specializer-direct-methods thing))
)
(loop for method in direct-methods
when (typep method 'openmcl-mop::standard-reader-method)
collect
method)))
(defmethod slot-definition-writers ((thing standard-class))
(let ((direct-methods (specializer-direct-methods thing))
)
(loop for method in direct-methods
when (typep method 'openmcl-mop::standard-writer-method)
collect
method)))
(defmethod slot-definition-readers ((thing openmcl-mop:standard-effective-slot-definition))
(let ((direct-methods (specializer-direct-methods thing))
)
(loop for method in direct-methods
when (typep method 'openmcl-mop::standard-reader-method)
collect
method)))
(defmethod slot-definition-writers ((thing openmcl-mop:standard-effective-slot-definition))
(let ((direct-methods (specializer-direct-methods thing))
)
(loop for method in direct-methods
when (typep method 'openmcl-mop::standard-writer-method)
collect
method)))
| 14,347 | Common Lisp | .cl | 370 | 32.718919 | 99 | 0.650642 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 7107b92848a3d67f2d595c2450b911395cf0ec4961b773ab3252e6243bf70966 | 32,910 | [
-1
] |
32,911 | mop-mcl.lsp | rwoldford_Quail/source/quail-kernel/mop/mop-mcl.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; mop-mcl.lisp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; Copyright (c) 1988-1991 Statistical Computing Laboratory, University of Waterloo
;;;
;;;
;;; Authors:
;;; G. Desvignes 1988,1989
;;; R.W. Oldford 1988-1991
;;; Greg Anglin 1992
;;;
;;;----------------------------------------------------------------------------------
;;;
;;;
;;; Meta-Object protocol interface
;;;
;;; This file imports to quail-kernel fundamental functions which I think are
;;; X3J13-proposed for the standard MOP, and exports them from quail-kernel,
;;; along with some older (perhaps redundant, now) covers for them.
;;;
;;; Release notes for MCL 2.0 final say:
;;;
;;; CLOS includes the following introspection capabilities:
;;; class-direct-subclasses
;;; class-direct-superclasses
;;; class-precedence-list
;;; class-prototype
;;; class-direct-instance-slots
;;; class-direct-class-slots
;;; class-instance-slots
;;; class-class-slots
;;; specializer-direct-methods
;;; specializer-direct-generic-functions
;;; generic-function-methods
;;; method-function
;;; method-generic-function
;;; method-name
;;; method-qualifiers
;;; method-specializers
;;; slot-definition-name
;;; copy-instance
;;; method-exists-p
;;;
;;; The above actually reside in the :ccl package.
(in-package :quail-kernel)
#|
;;; NOT IN CCL YET !!!!!!!!!!! ... are there ways of getting at these with
;;; the other primitives ?? ... dga
(eval-when (:compile-toplevel :load-toplevel :execute)
(import '(ccl::slot-definition-initargs
ccl::slot-definition-initform
ccl::slot-definition-readers
ccl::slot-definition-writers
ccl::slot-definition-type)))
|#
;; We're breaking the rules by putting import before export, so we
;; have to be careful and use eval-when.
(eval-when (:compile-toplevel :load-toplevel :execute)
(import '(ccl:class-direct-subclasses
ccl:class-direct-superclasses
ccl:class-precedence-list
ccl:class-prototype
ccl:class-direct-instance-slots
ccl:class-direct-class-slots
ccl:class-instance-slots
ccl:class-class-slots
ccl:specializer-direct-methods
ccl:specializer-direct-generic-functions
ccl:generic-function-methods
ccl:method-function
ccl:method-generic-function
ccl:method-name
ccl::method-qualifiers
ccl:method-specializers
ccl:slot-definition-name
ccl:copy-instance
ccl:method-exists-p))
)
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(class-direct-subclasses
class-direct-superclasses
class-precedence-list
class-prototype
class-direct-instance-slots
class-direct-class-slots
class-instance-slots
class-class-slots
specializer-direct-methods
specializer-direct-generic-functions
generic-function-methods
method-function
method-generic-function
method-name
method-qualifiers
method-specializers
slot-definition-name
copy-instance
method-exists-p)))
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(class-p
direct-slots
class-slots
generic-function-p
reader-method-p
writer-method-p)))
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(collect-methods
collect-accessors
collect-slot-definitions
slot-definition
slot-definition-readers
slot-definition-writers)))
(defmethod slot-definition-initargs (slot-definition)
(declare (ignore slot-definition)))
(defmethod slot-definition-initform (slot-definition)
(declare (ignore slot-definition)))
(defmethod slot-definition-writers (slot-definition)
(declare (ignore slot-definition)))
(defmethod slot-definition-readers (slot-definition)
(declare (ignore slot-definition)))
(defmethod slot-definition-type (slot-definition)
(declare (ignore slot-definition)))
(defun class-p (arg)
"Return T if argument is a class."
(typep arg 'standard-class))
(defun generic-function-p (arg)
"Return T if argument is a generic-function."
(typep arg 'generic-function))
(defun mapappend (fun &rest args)
"Like mapcar except the results are appended together."
(if (some #'null args)
()
(append (apply fun (mapcar #'car args))
(apply #'mapappend fun (mapcar #'cdr args)))))
(defun reader-method-p (method)
"Tests whether method is a directly defined reader method."
(let ((specializers (method-specializers method)))
(and (= (length specializers) 1)
(member method
(slot-definition-readers (first specializers))
:test #'eq))))
(defun writer-method-p (method)
"Tests whether method is a directly defined writer method."
(let ((specializers (method-specializers method)))
(and (= (length specializers) 2)
(member method
(slot-definition-readers (first specializers))
:test #'eq))))
(defmethod class-slots ((self structure-class))
"Returns the list of slots of the class."
(append (class-class-slots self)
(class-instance-slots self)))
(defmethod class-direct-slots ((self structure-class))
"Returns the list of slots of the class."
(append (class-direct-class-slots self)
(class-direct-instance-slots self)))
(defmethod class-slots ((self standard-class))
"Returns the list of slots of the class."
(append (class-class-slots self)
(class-instance-slots self)))
(defmethod class-direct-slots ((self standard-class))
"Returns the list of slots of the class."
(append (class-direct-class-slots self)
(class-direct-instance-slots self)))
(defmethod class-slots ((self built-in-class))
"Returns the list of slots of the class."
(append (class-class-slots self)
(class-instance-slots self)))
(defmethod class-direct-slots ((self built-in-class))
"Returns the list of slots of the class."
(append (class-direct-class-slots self)
(class-direct-instance-slots self)))
;;;
;;; The following are mop specialized methods to prevent breakage
;;; (in the documentation system anyway) when ``classes'' like T
;;; are encountered where it makes no sense for them to have slots etc.
;;;
(defmethod class-direct-class-slots ((Self T))
"Call makes little sense. Returns NIL."
())
(defmethod class-class-slots ((Self T))
"Call makes little sense. Returns NIL."
())
(defmethod class-instance-slots ((Self T))
"Call makes little sense. Returns NIL."
())
(defmethod class-direct-instance-slots ((Self T))
"Call makes little sense. Returns NIL."
())
(defmethod class-direct-subclasses ((Self T))
"Call makes little sense. Returns NIL."
())
(defmethod class-precedence-list ((Self T))
"Call makes little sense. Returns NIL."
())
(defmethod class-direct-superclasses ((Self T))
"Call makes little sense. Returns NIL."
())
;;;
;;;
;;;
(defun collect-methods (fun)
"Collects all the methods associated with the generic-function fun, ~
organizes these into an association list whose keys are the qualifier ~
lists for each method and whose values are the list of methods having ~
those qualifiers. Those methods which do not have qualifiers, i.e. ~
whose qualifer list is NIL, will be stored with key (\:primary)."
(let ((methods (generic-function-methods
(cond
((symbolp fun) (symbol-function fun))
(T fun))))
(result NIL)
qualifiers
)
(loop for method in methods
do
(setf qualifiers (or (method-qualifiers method)
(list :primary)))
(if (assoc qualifiers result :test #'equal)
(push method (cdr (assoc qualifiers result :test #'equal)))
(setf result (acons qualifiers (list method) result))))
result));;;
;;;
;;;
;;; Because no slot-definition class exists in MCL, we invent one here.
;;;
;;;(for EFFECTIVE-SLOT-DEFINITION metaobjects:)
;;;slot-definition-location
(defclass slot-definition (ccl::metaobject)
((class :initarg :class
:accessor doc-class-object
:initform NIL
:documentation "The class for which this slot is defined.")
(name :initarg :name
:accessor slot-definition-name
:initform NIL
:documentation "The name of the slot.")
(allocation :accessor slot-definition-allocation
:initarg :allocation
:initform NIL
:documentation "The allocation of the slot.")
(initform :accessor slot-definition-initform
:initarg :initform
:documentation "The initialization form, if any, of the slot. ~
Note that this is stored in an implementation ~
specific way!")
(initargs :accessor slot-definition-initargs
:initarg :initargs
:initform NIL
:documentation "The initialization arguments, if any, for the slot.")
(initfunction :accessor slot-definition-initfunction
:initarg :initfunction
:initform NIL
:documentation "The initialization function, if any, for the slot.")
(type :accessor slot-definition-type
:initarg :type
:initform NIL
:documentation "The type for the slot.")
(readers :accessor slot-definition-readers
:initarg :readers
:initform NIL
:documentation "The reader methods, if any, for the slot.")
(writers :accessor slot-definition-writers
:initarg :writers
:initform NIL
:documentation "The writer methods, if any, for the slot.")
(documentation :initarg :documentation
:initform NIL
:documentation "The documentation string, if any, ~
for the slot.")
)
(:documentation "Information on the named slot"))
(defmethod documentation ((thing slot-definition) &optional doc-type)
(declare (ignore doc-type))
(slot-value thing 'documentation))
(defmethod (setf documentation) (new-value (thing slot-definition)
&optional doc-type)
(declare (ignore doc-type))
(setf (slot-value thing 'documentation) new-value))
(defun collect-accessors (class)
"Collects all the accessor methods associated with the class class. ~
Returns NIL if none are found for that class. ~
Those found are returned organized as an association list whose keys are ~
either \:readers or \:writers. ~
The value associated with each key is a list of lists of reader or ~
writer methods respectively for all slots of class. The first element ~
in each value list is the list of method qualifiers; ~
The remaining elements are the method-objects themselves."
(cond
((symbolp class) (setf class (find-class class)))
((stringp class) (setf class (find-class
(with-input-from-string (s class)
(read s)))))
)
(let ((reader-methods (slot-definition-readers class))
(writer-methods (slot-definition-writers class))
qualifiers
reader-list
writer-list)
(loop for method in reader-methods
do
(setf qualifiers (or (method-qualifiers method)
(list :primary)))
(if (assoc qualifiers reader-list :test #'equal)
(push method (cdr (assoc qualifiers reader-list :test #'equal)))
(setf reader-list (acons qualifiers (list method) reader-list))))
(loop for method in writer-methods
do
(setf qualifiers (or (method-qualifiers method)
(list :primary)))
(if (assoc qualifiers writer-list :test #'equal)
(push method (cdr (assoc qualifiers writer-list :test #'equal)))
(setf writer-list (acons qualifiers (list method) writer-list))))
(cond
((and reader-list writer-list)
(list
(cons :readers reader-list)
(cons :writers writer-list)))
(reader-list
(list (cons :readers reader-list)))
(writer-list
(list (cons :writers writer-list)))
(T NIL))
)
)
(defun collect-slot-definitions (class)
"Collects all the slot-definitions associated with the class class, ~
organizes these into an association list whose keys are one of ~
:class-slots :instance-slots :direct-class-slots and :direct-instance-slots. ~
The value associated with each key is a list of slot-definitions of that type ~
for this class."
(cond
((symbolp class) (setf class (find-class class)))
((stringp class) (setf class (find-class
(with-input-from-string (s class)
(read s)))))
)
(let ((direct-class-slots (class-direct-class-slots class))
(direct-instance-slots (class-direct-instance-slots class))
(instance-slots (class-instance-slots class))
(class-slots (class-class-slots class))
)
(setf class-slots
(cons
:class-slots
(loop
for slot in class-slots
collect
(let ((slot-def
(make-instance 'slot-definition
:class class
:name (first slot)
:initform (second slot)
:initargs (third slot))))
slot-def))))
(setf instance-slots
(cons
:instance-slots
(loop
for slot in instance-slots
collect
(let ((slot-def
(make-instance 'slot-definition
:class class
:name (first slot)
:initform (second slot)
:initargs (third slot))))
slot-def))))
(setf direct-class-slots
(cons
:direct-class-slots
(loop
for slot in direct-class-slots
collect
(let ((slot-def
(make-instance 'slot-definition
:class class
:name (first slot)
:initform (second slot)
:initargs (third slot))))
slot-def))))
(setf direct-instance-slots
(cons
:direct-instance-slots
(loop
for slot in direct-instance-slots
collect
(let ((slot-def
(make-instance 'slot-definition
:class class
:name (first slot)
:initform (second slot)
:initargs (third slot))))
slot-def))))
(list class-slots
instance-slots
direct-class-slots
direct-instance-slots)))
(defmethod slot-definition-readers ((thing standard-class))
(let ((direct-methods (specializer-direct-methods (class-of thing)))
)
(loop for method in direct-methods
when (typep method 'ccl::standard-reader-method)
collect
method)))
(defmethod slot-definition-writers ((thing standard-class))
(let ((direct-methods (specializer-direct-methods (class-of thing)))
)
(loop for method in direct-methods
when (typep method 'ccl::standard-writer-method)
collect
method)))
| 16,541 | Common Lisp | .cl | 413 | 30.578692 | 89 | 0.595354 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 77f7be771bae62390237b01ce3b1ed4db8505f81f3a47183d8998365cad25e60 | 32,911 | [
-1
] |
32,912 | init-return-classes.lsp | rwoldford_Quail/source/quail-kernel/array/init-return-classes.lsp | ;;;------------------------------------------------------------------------
;;; init-return-classes.lisp
;;;
;;; copyright 1991, r. wayne oldford
;;;------------------------------------------------------------------------
(in-package :quail-kernel)
(defmacro initialize-return-classes ()
"Defines the return class hierarchy."
`(make-initial-prototypes
,*return-classes-defined-here*
,*return-precedence-list*))
(eval-when (eval load)
(initialize-return-classes))
| 503 | Common Lisp | .cl | 13 | 34.769231 | 76 | 0.483333 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | bbff1243bd62a9e553daa1b9e297cea8e338ba0e835db568d8e4ef7dc6db457d | 32,912 | [
-1
] |
32,913 | quail-make.lsp | rwoldford_Quail/quail-make.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; quail-make.lsp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; Copyright (c) 1997 Statistical Computing Laboratory, University of Waterloo
;;;
;;;
;;; Authors:
;;; R.W. Oldford 1997-2000
;;;
;;;
;;;----------------------------------------------------------------------------
;;;
;;;
;;; This file contains the parameters which need modification for
;;; each local system. These need to be modified for each installation
;;; NOT for each user.
;;;
;;; After the end of the modifiable parameters, the "make" begins
;;; by loading appropriate files.
;;;
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; In this file various features are used to distinguish which Common Lisp
;;; system is being used. Some examples are
;;;
;;; :ccl, :mcl, :ccl-4.0, etc. ... Macintosh Common Lisp sometimes by version
;;; :aclunix ... Franz Allecro CL for Unix
;;; :aclpc ... Franz Allegro as implemented for Windows
;;; :aclpc-mswins ... running on Windows
;;; :aclpc-linux ... running on Linux
;;; :aclpc-mac ... running on Mac
;;; :cl-2 ... A Common Lisp: The Language 2nd Edition
;;; (by Steele) so CLOS is included for example.
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;
;;;
;;; Begin by figuring out what Common Lisp system is running and
;;; putting appropriate info on the *features* for us.
;;;
;;;
;;; Because the correct name for the Common Lisp's user package
;;; depends on the edition of Steele's book (Common Lisp: The Language)
;;; whether the implementation corresponds to the 2nd edition or not.
;;; DO NOT CHANGE THIS.
;;;
#+(and :allegro :unix)(pushnew :aclunix *features*)
#+(and :allegro :mswindows)(pushnew :aclpc-mswin *features*)
#+(and :linux :allegro)(pushnew :aclpc-linux *features*)
#+(and :target-mac :allegro)(pushnew :aclpc-mac *features*)
#+(and (or :aclpc-linux :aclpc-mac :aclpc-mswin) :allegro)(pushnew :aclpc *features*)
#+(and :sbcl :unix) (pushnew :sbcl-linux *features*)
#+(or :ccl-2 :aclunix :cltl2 :aclpc :sbcl-linux :ccl-1.11)(pushnew :cl-2 *features*)
(format t "Running ~s "(or #+:linux (format nil "LINUX") #+:windows (format nil "WINDOWS")))
(format t "~%Using ~s version ~s "
(format nil (lisp-implementation-type))
(format nil (lisp-implementation-version)))
(format t "~%and ASDF version ~s ~%" (asdf:asdf-version))
(format t "~%At the top of quail-make")
;;; We require this package to find lambda lists etc.
;;; Seemed to be automatically in Linux but not Mac.
#+:sbcl (require "sb-introspect")
;;; fix comp:*cltl1-compile-file-toplevel-compatibility-p* as per allegro documentation
;;; so we are in ansi mode
#+:aclpc-linux(setf comp:*cltl1-compile-file-toplevel-compatibility-p* nil)
;;;
;;; Now get the correct name for the Common Lisp's user package
;;; to be used for this file
;;; DO NOT CHANGE THIS.
;;;
#+(and :cl-2 :aclpc-linux) (in-package :cl-user) ; 19 November 2019
#+(and :cl-2 :sbcl-linux) (in-package :clim-user)
;;; I think, on 24JAN2022, that the above should be :cl-user NOT :clim-user
#-:cl-2(in-package "USER")
#|
;;; 15APR2024 Set the variables quail-speed and quail-safety which are used in forms such as
;;; (declare (optimize (speed 3) (safety 0)))
;;; to check on run-time errors
;;; the original Q files affected had (speed 3) (safety 0)
(defvar quail-speed 1)
(defvar quail-safety 1)
(setf quail-speed (cg::ask-user-for-choice-from-list "Choose speed" (list 0 1 2 3)))
(setf quail-safety (cg::ask-user-for-choice-from-list "Choose safety" (list 0 1 2 3)))
(format t "~%quail-speed is ~d " quail-speed)
(format t "~%quail-safety is ~d " quail-safety)
|#
;;; start with the directory from which quail-make.lsp (this file) was loaded:
#+:cl-2(defvar *quail-make-load-directory* (make-pathname :directory
(pathname-directory *load-truename*)))
;;; Setup logical pathname for quail
(defun set-up-quail (&key (base *quail-make-load-directory*))
(let* ((location (merge-pathnames "quail-init.lsp" base ))
(dir-list (pathname-directory base))
(string-qmld "/"))
(loop for dir in (cdr dir-list)
do (setf string-qmld (concatenate 'string string-qmld dir "/")))
(setf string-qmld (concatenate 'string string-qmld "**/*.*"))
(cond ((probe-file location)
#+(or :sbcl-linux :aclpc-linux :ccl)
(setf location
(list (append (list "**;*.*.*")
(list string-qmld)
)))
#+:aclpc-mswin(setf location
(list (append (list "**;*.*")
(list string-qmld "**\\*.*")))))
(t
(warn (format NIL "~%Prompt cancelled~%path to quail not set. ~
~%Edit or reload quail-make.lsp to try again."))
(return-from set-up-quail))
)))
(setf (logical-pathname-translations "q")
(set-up-quail))
(pushnew :quail *features*)
(defun path-quail()
"q:")
;(format t "~%Just after pushnew :quail *features*")
;;; With Quail located, "q:" is a logical-directory that
;;; now refers to the Quail directory in Common Lisp,
;;;
;;; For example, a file called bar.lsp can now be referred to as
;;;
;;; "q:bar.lsp"
;;;
;;; and files (using the "*" wildcard) in a (non-existent) sub-directory
;;; of Quail called foo can now be referred to as
;;;
;;; "q:foo;*"
;;;
;;; and all ".lsp" files nested (arbitrarly deep)
;;; within all directories within the Quail foo directory as
;;; "q:foo;**;*.lsp"
;;;
;;; (Aside: certain important Quail sub-directories will be given their
;;; own logical directory name defined via "q:", namely
;;;
;;; Data directory ... "Data:"
;;; Examples directory ... "Eg:"
;;;
;;; This is the recommended way to access the directories in Quail.)
;;;
;;;;;;;;;;
;;; Need this from quail-make-1
(defun lisp-ext (filename-string)
(concatenate 'string filename-string "." "lsp"))
;;;;;;;;;;
;;;
;;; What follows should not need modification UNLESS
;;; the Quail Examples and Data directories have been moved out of
;;; the Quail directory system.
;;;
;;; OR unless the lisp downcases names in logical-pathname-translations
;;; as sbcl does
;;;;;;;;;;
;;;
;;; Examples directory
;;;
(let (translation)
;; The following should just work for everything.
;; Do not change this.
(if (probe-file (translate-logical-pathname (lisp-ext "q:examples;welcome")))
(setf translation "q:examples;**;*.*"))
;; If that failed, then the Examples directory has been
;; moved elsewhere and you better say where here.
;; For example
(if translation
(setf (logical-pathname-translations "eg")
(list (list "**;*.*" translation)
#+:aclpc (list "*.*" "q:examples;*.*")
)
)
(warn "Can't find Examples."))
)
;(format t "~%Just after examples")
;;; That done, "eg" now refers to the Quail Examples directory in Common Lisp.
;;;
;;;;;;;;;;
;;;;;;;;;;
;;;
;;; Data
;;;
(let ((translation
;; The following should just work for everything.
;; Do not change this.
(if (probe-file (translate-logical-pathname (lisp-ext "q:data;welcome")))
"q:data;**;*.*")))
;; If that failed, then the Data directory has been
;; moved elsewhere and you better say where here.
;; For example
(if translation
(setf (logical-pathname-translations "data")
(list (list "**;*.*" translation)
#+:aclpc (list "*.*" "q:data;*.*")))
(warn "Can't find Data."))
)
;(format t "~%Just after Data")
;;; That done, "data" now refers to the Quail Data directory in Common Lisp.
;;;
;;;;;;;;;;
;;;;;;;;;;
;;;
;;; Documentation
;;;
(let ((translation
;; The following should just work for everything.
;; Do not change this.
(if (probe-file (translate-logical-pathname (lisp-ext "q:doc;welcome")))
"q:doc;**;*.*")))
;; If that failed, then the Doc directory has been
;; moved elsewhere and you better say where here.
;; For example
(if translation
(setf (logical-pathname-translations "doc")
(list (list "**;*.*" translation)
#+:aclpc (list "*.*" "q:doc;*.*")))
(warn "Can't find Documentation."))
)
;;; That done, "doc" now refers to the Quail Doc directory in Common Lisp.
;;;
;(format t "~%Just after Doc")
;;;;;;;;;;
;;;
;;; Define the lookup for the Quail-init file.
;;;
(defvar *quail-init-directory* *quail-make-load-directory*
"This is where user-defined initialization instructions would be.")
(defun quail-init-file ()
"Returns the pathname for the quail-init file."
(merge-pathnames *quail-make-load-directory* "Quail-init.lsp"))
;;; A variable to contain the Quail subsystems. Set in quail.qmk.
;#+:sbcl(defvar *quail-systems* NIL "Collection of Quail systems loaded into the current Quail image.~%~
; Defined in the file q:quail.qmk")
;;; Define the systems which make up Quail;;;
(defvar *quail-systems* (list ;"quail-user"
;"initialization"
;; "analyis-;map" :03NOV2019 ? gone somewhere else
;; "browser"; ;15F2018 ? gone somewhere else
;"statistics"
;"probability"
;"mathematics"
;"linear"
;"top-level" ;; skipped - needs menus
;"documentation" ;; 19MAR2022
;; systems above this line use Quail package.
;"quail" ;; 19MAR2022
;"views" ;;first try 07MAR2022 - w-b is incomplete ; back off see quail-linux.log line 14383
"window-basics"
"new-math"
"quail-kernel"
)
"Collection of Quail systems loaded into the current Quail image."
)
;(format t "~%Just after defining *quail-systems*")
;;; Make sure we can recompile if things break in w-b
#+:sbcl(setf sb-ext::*on-package-variance* '(:warn (:window-basics :quail-kernel) :error T))
;;; Do the make
(format t "~%Starting the make")
(loop for system in (reverse *quail-systems*)
do
(when (or (string-equal system "quail-kernel") (string-equal system "initialization"))
#+:sbcl(sb-ext:unlock-package :sb-mop)
#+:sbcl(sb-ext:unlock-package :common-lisp))
;#+:aclpc()
;#+:aclpc()
(asdf:clear-source-registry)
(format t "~%Loading ~s " system)
(asdf:load-system system)
(when (or (string-equal system "quail-kernel") (string-equal system "initialization"))
#+:sbcl(sb-ext:lock-package :sb-mop)
#+:sbcl(sb-ext:lock-package :common-lisp)
;#+:aclpc()
;#+:aclpc()
)
(format t "~% ~s loaded" system)
)
(format t "~%Quail Loaded")
;;;;;;;;;;;;;;;;;;;;;;;;;;;; End of File ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
| 11,369 | Common Lisp | .l | 283 | 35.265018 | 120 | 0.583024 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 1a6a0889c7b8e42071dba04b2b02c8118124a7ae385f4b55f59e592f27bc065e | 32,913 | [
-1
] |
32,914 | quail-init.lsp | rwoldford_Quail/quail-init.lsp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Quail-init.lsp
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; Copyright (c) 1997 Statistical Computing Laboratory, University of Waterloo
;;;
;;;
;;; Authors:
;;; R.W. Oldford 1997.
;;;
;;;
;;;----------------------------------------------------------------------------
(in-package :quail-user)
;;; This file, if found in the same directory as the Quail image with name
;;; "Quail-init.lsp", is loaded immediately when Quail is run. It may be
;;; used to modify Quail environment variables, add search directories to
;;; Quail search lists.
(if (probe-file "q:comments;whats-new.lsp")
(load "q:comments;whats-new.lsp"))
| 858 | Common Lisp | .l | 22 | 35.090909 | 81 | 0.425121 | rwoldford/Quail | 0 | 1 | 0 | GPL-3.0 | 9/19/2024, 11:43:28 AM (Europe/Amsterdam) | 0e813ab435fd3e2f8779ca8c5d80b672c3dc9adf815df041535877a3a7edf209 | 32,914 | [
-1
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.