Commits

Anonymous committed 35d3c21

Replace modal button 'Build From BUILD-FROM-WHAT ...' with two
buttons which are activated/deactivated by the value of
build-from-what.

  • Participants
  • Parent commits 98fbd17

Comments (0)

Files changed (1)

-;;; 	$Id$	
+;;; 	$Id$
 (require 'custom)
 (require 'cus-edit)
 (require 'widget)
   "Show the version number of `build' in the minibuffer.
 If optional argument HERE is non-nil, insert info at point."
   (interactive "P")
-    (if here 
+    (if here
         (insert build-version)
       (if (interactive-p)
           (message "%s" build-version)
    ((equal val (first (get sym 'standard-value)))
     (setq build-make-options (remassoc (sym-to-opt sym) build-make-options)))
    (t
-    (setq build-make-options 
+    (setq build-make-options
 	  (acons (sym-to-opt sym) val
 		 build-make-options))))
   (set-default sym val))
 (defgroup build-tarball nil
   "Standardized the fetching of XEmacs beta/release tarballs."
   :group 'build)
- 
+
 (defcustom build-cvs-checkout-options
   "-P"
   "CVS checkout command-line options to use for all CVS commands."
                    :test (lambda (a b)
                            (string=
                             (first a) (first b))))
-                  "")))    
+                  "")))
         (compilation-mode-hook
          'build-compilation-mode-hook)
         (compilation-buffer-name-function
 XEmacs.  All aspects of fetching tarballs, configuring, making and
 reporting can be customized and executed from the newly created buffer
 *Build*."
-  (interactive)	
+  (interactive)
   (let
-      (from-button-widget
+      (
+;;;        build-from-cvs-button-widget
+;;;        build-from-tarballs-button-widget
        (name "*Build XEmacs*"))
     (kill-buffer (get-buffer-create name))
     (switch-to-buffer (get-buffer-create name))
                    :value build-from-what
                    :notify (lambda (widget &rest ignore)
                              (setq build-from-what (widget-value widget))
-                             (widget-value-set build-from-button-widget
-                                               (format "Build XEmacs From %s Now ..." build-from-what)))
+                             (cond
+                              ((string-equal build-from-what "CVS")
+                               (widget-apply 
+                                build-from-cvs-button-widget
+                                :activate)
+                               (widget-apply 
+                                build-from-tarballs-button-widget
+                                :deactivate))
+                              ((string-equal build-from-what "Tarballs")
+                               (widget-apply 
+                                build-from-cvs-button-widget
+                                :deactivate)
+                               (widget-apply 
+                                build-from-tarballs-button-widget
+                                :activate))))
                    '(item :value "Tarballs")
                    '(item :value "CVS"))
     (widget-insert
 
 ")
     (setq
-     build-from-button-widget     
+     build-from-cvs-button-widget
      (widget-create 'push-button
                     :notify (lambda (&rest ignore)
-                              (cond
-                               ((string-equal build-from-what "Tarballs")
-                                (build-from-tarballs))
-                               ((string-equal build-from-what "CVS")
-                                (build-from-CVS))))
-                    (format "Build XEmacs From %s Now ..." build-from-what)))
+                              (build-from-CVS))
+                    "Build XEmacs From CVS Now ..."))
+    (widget-insert "\n\n")
+    (setq
+     build-from-tarballs-button-widget
+     (widget-create 'push-button
+                    :notify (lambda (&rest ignore)
+                              (build-from-tarballs))
+                    "Build XEmacs From Tarballs Now ..."))
+    ;; Initialize these buttons according to `build-from-what'.
+    (cond
+     ((string-equal build-from-what "CVS")
+      (widget-apply 
+       build-from-cvs-button-widget
+       :activate)
+      (widget-apply 
+       build-from-tarballs-button-widget
+       :deactivate))
+     ((string-equal build-from-what "Tarballs")
+      (widget-apply 
+       build-from-cvs-button-widget
+       :deactivate)
+      (widget-apply 
+       build-from-tarballs-button-widget
+       :activate)))
     (widget-insert
      "\nProceed after you have chosen what sources to build from and and what
 tools to build with.
 ")
     (use-local-map widget-keymap)
-    (custom-mode)
+    ;; (custom-mode)
     (widget-setup)
     (goto-char (point-min))))
 
 (defun build-from-tarballs ()
-  (interactive)	
+  (interactive)
   (let
       ((name "*Build XEmacs From Tarballs*"))
     (kill-buffer (get-buffer-create name))
     (goto-char (point-min))))
 
 (defun build-from-CVS ()
-  (interactive)	
+  (interactive)
   (let
       ((name "*Build XEmacs From CVS*"))
     (kill-buffer (get-buffer-create name))
 ;;; Functionality which was prototyped in co2cu.el:
 
 (defun build-configure-customize (a-list)
-  (mapcar 
+  (mapcar
    (lambda (cat)
      (princ (format "(defgroup build-configure-%s nil\n" (first cat)))
      (princ (format "  \"%s options.\"\n" (first cat)))
             (first (cdr (assoc option (assoc category a-list)))))
       (setq prev-val
             (append prev-val (list value))))
-    (setq detected 
+    (setq detected
           (or
            (second (cdr (assoc option (assoc category a-list))))
            (null (null detected))))
             (setq category (match-string 1))
             (setq build-configure-alist
                   (append build-configure-alist (list (list category)))))
-;;; We avoid matching a potentially zero-length string to avoid infinite looping. 
+;;; We avoid matching a potentially zero-length string to avoid infinite looping.
            ((looking-at
              "^.+$")
             (goto-char (match-end 0)))
             (goto-char (match-end 0)))))
         (build-configure-customize build-configure-alist)
         (print build-configure-alist)
-        )) 
+        ))
     (set-buffer buffer)
 ;;;    (switch-to-buffer (get-buffer-create name))
     (kill-all-local-variables)
 	       build-configure-options))
   (set-default sym val))\n
 (defun build-set-value (sym val)
-  (setq build-configure-options 
+  (setq build-configure-options
 	(acons (sym-to-opt sym) val
 	       build-configure-options))
   (set-default sym val))\n
       (list "TIFF_DIR" "")
       (list "JPEG_DIR" "")
       (list "COMPFACE_DIR" "")))))
-  (mapcar 
+  (mapcar
    (lambda (macro)
      (build-make-string (first macro) (second macro))
      )