[mcclim-devel] some patches: accepting-values and partial-commands

Max-Gerd Retzlaff m.retzlaff at gmx.net
Thu Aug 18 01:03:00 UTC 2005


Hi,

I've found some problems in McClim yesterday and written some patches
(for three of the four problems).

Regards,
Max-Gerd Retzlaff


========================================================================


- The example in section 10.2.1 of the clim spec v2.2:

  (define-editor-command (com-save-file :menu t
                                        :keystroke (:s :control))
      ()                                      
    ...)                                    

  is either an error and :keystroke (#\s :control) was meant, or it suggests
  that it should be possible to first define a keystroke :s like for example:
 
  (define-gesture-name :s :keyboard (#\s))

  and add modifiers later. The latter does not work in McClim; modifiers
  that are only specified in the :keystroke argument to a define-command
  are simply ignored.

  Patch: - none -


========================================================================


- accepting-dialog should behave as if the argument align-prompts had
  the value :right if it is specified as T (clim spec v2.2, 13.3);
  only the values nil, :left, :right, and t are possible.

  Patch to dialog.lisp:

  -- zipp --

@@ -167,7 +183,10 @@
      (frame-class 'accept-values))
   (declare (ignore own-window exit-boxes modify-initial-query
     resize-frame label scroll-bars x-position y-position
-    width height frame-class))  
+    width height frame-class))
+  (when (and align-prompts ;; t means the same as :right
+             (not (eq align-prompts :left)))
+    (setf align-prompts :right))
   (multiple-value-bind (cx cy) (stream-cursor-position stream)
     (let* ((*accepting-values-stream*
             (make-instance 'accepting-values-stream

  -- zapp --


========================================================================


- accepting-values for partial-commands

  The generated accepting-values shouldn't allow to be exited (via "OK")
  as long as decent values (i.e. matching the specified presentation type)
  are supplied for the required arguments of the command.

  Note: This is a personal taste, I haven't found anything in the
  clim-spec that requires such a behaviour.

  Proposed patch (a hack): Apply the following patch to commands.lisp:

 -- zipp --

--- commands.lisp.~1.53.~       2005-06-28 06:32:46.000000000 +0200
+++ commands.lisp       2005-08-18 02:05:11.975682512 +0200
@@ -746,6 +746,7 @@
       ;; We don't need fresh gensyms of these variables for each accept form.
       (with-gensyms (value ptype changedp)
        `(defun ,name (,command-table ,stream ,partial-command)
+           (do ((still-missing nil t)) (nil)
           (destructuring-bind (,command-name , at original-args)
               ,partial-command
             (let ((,command-line-name (command-line-name-for-command
@@ -755,7 +756,7 @@
                   ,@(mapcar #'list required-arg-names original-args))
               (accepting-values (,stream)
                 (format ,stream
-                        "You are being prompted for arguments to ~S~%"
+                        "You are being prompted for arguments to ~S~%~%"
                         ,command-line-name)
                 ,@(loop
                      for var in required-arg-names
@@ -767,9 +768,16 @@
                                 (declare (ignore ,ptype))
                                 (terpri ,stream)
                                 (when ,changedp
-                                  (setq ,var ,value))))))
-              (list ,command-name , at required-arg-names))))))))
-
+                                  (setq ,var ,value)))))
+                 (when still-missing
+                   (format ,stream
+                           "~&Please supply all arguments.")))
+               (setf ,partial-command (list ,command-name , at required-arg-names))
+               (unless (partial-command-p ,partial-command)
+                 (return ,partial-command))))))))))
 
 ;;; XXX What do to about :acceptably? Probably need to wait for Goatee "buffer
 ;;; streams" so we can insert an accept-result-extent in the buffer for

 -- zapp --


========================================================================


- exit-boxes of accepting-values; 13.3 of the clim spec v2.2 says:

  -- zipp --
  exit-boxes

    [...] The default behavior is as though you specified the following:
  
      '((:exit "OK") (:abort "Cancel"))
  -- zapp --

  The default behavior of McClim correspondends to '((:exit "Exit")
  (:abort "Abort")) at the moment.

  Patch: Replace the strings "Exit" and "Abort" in #'display-exit-boxes
  of dialog.lisp by "Exit" and "Abort", respectively. Patch to dialog.lisp:

  -- zipp --

--- dialog.lisp.~1.19.~ 2005-02-27 21:52:49.000000000 +0100
+++ dialog.lisp 2005-08-17 08:43:20.000000000 +0200
@@ -224,11 +243,11 @@
     (fresh-line stream)
     (with-output-as-presentation
        (stream nil 'exit-button)
-      (format stream "Exit"))
+      (format stream "OK"))
     (write-char #\space stream)
     (with-output-as-presentation
        (stream nil 'abort-button)
-      (format stream "Abort"))
+      (format stream "Cancel"))
     (terpri stream)))
 
 (defmethod stream-accept ((stream accepting-values-stream) type

 -- zapp --


========================================================================

-- 
Max-Gerd Retzlaff <m.retzlaff at gmx.net>

For your amusement:
The human brain is a wonderful thing.  It starts working the moment
you are born, and never stops until you stand up to speak in public.
                -- Sir George Jessel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/mcclim-devel/attachments/20050818/c39b1cb8/attachment.sig>


More information about the mcclim-devel mailing list