[mcclim-cvs] CVS mcclim

thenriksen thenriksen at common-lisp.net
Sun Jan 6 08:36:58 UTC 2008


Update of /project/mcclim/cvsroot/mcclim
In directory clnet:/tmp/cvs-serv18285

Modified Files:
	mcclim.asd 
Log Message:
Added extension MCCLIM-IMAGES in Extensions/Images.

This extension is a simple collection of functions that make it easy
to load images and convert them into CLIM designs. Currently, only the
GIF and XPM formats are supported. If it turns out that the facilities
provided by MCCLIM-IMAGES are useful for non-CLIM applications, it
could be generalised into an external library, but due to its
simplicity, I doubt the major benefit of this.

An example of use:

;; Is there a non-CLIM-INTERNALS way of getting these things drawn?
(define-presentation-method present ((pattern climi::pattern) (type climi::pattern) stream
                                     (view drei-view)
                                     &key acceptably for-context-type)

  (declare (ignore acceptably for-context-type))
  (multiple-value-bind (x y) (stream-cursor-position stream)
    (draw-pattern* stream pattern x y)
    (stream-increment-cursor-position stream (+ (pattern-width pattern)) 0)))

(asdf:operate 'asdf:load-op :mcclim-images)
(asdf:operate 'asdf:load-op :mcclim-images-gif)
(asdf:operate 'asdf:load-op :mcclim-images-xpm)

(define-command (com-insert-image :name t :command-table climacs-gui::development-table)
    ((image-pathname 'pathname :default (merge-pathnames (user-homedir-pathname))
                               :insert-default t))
  (if (probe-file image-pathname)
      (handler-case
          (insert-object (point) (mcclim-images:load-image image-pathname))
        (mcclim-images:unsupported-image-format (c)
          (display-message "Image format ~A not recognized" (mcclim-images:image-format c))))
      (display-message "No such file: ~A" image-pathname)))


--- /project/mcclim/cvsroot/mcclim/mcclim.asd	2007/12/28 10:08:58	1.70
+++ /project/mcclim/cvsroot/mcclim/mcclim.asd	2008/01/06 08:36:58	1.71
@@ -548,6 +548,34 @@
 		 (:file "Looks/pixie"
                         :pathname #.(make-pathname :directory '(:relative "Looks") :name "pixie" :type "lisp"))))
 
+(defsystem :mcclim-images
+           :depends-on (:clim)
+           :components ((:module "Extensions/Images"
+                         :pathname #.(make-pathname :directory '(:relative "Extensions" "Images"))
+                         :components ((:file "package")
+                                      (:file "images")))))
+
+(defmacro support-format (format &rest depends-on)
+  "Generate the ASDF `defsystem' form for a single-file system
+consisting of a file with the name `format' in
+Extensions/Images. It will depend on the ASDF systems listed in
+`depends-on' as well as MCCLIM-IMAGES."
+  `(defsystem ,(intern (format nil "MCCLIM-IMAGES-~A" (string-upcase format))
+                       (find-package :keyword))
+    :depends-on (:mcclim-images , at depends-on)
+    :components
+    ((:file ,format
+      :pathname ,(make-pathname :directory '(:relative "Extensions" "Images")
+                                :name format)))))
+
+(defmacro support-formats (&rest formats)
+  "Generate the ASDF `defsystem' forms for supporting
+`formats'."
+  `(progn ,@(loop for (format . depends-on) in formats
+               collecting `(support-format ,format , at depends-on))))
+
+(support-formats ("gif" :skippy) ("xpm"))
+
 ;;; The actual McCLIM system that people should to use in their ASDF
 ;;; package dependency lists.
 (defsystem :mcclim




More information about the Mcclim-cvs mailing list