;;; -*- Mode: LISP; Syntax: Common-Lisp; Package: USER; Base: 10 -*-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;         The Garnet User Interface Development Environment.      ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; This code was written as part of the Garnet project at          ;;;
;;; Carnegie Mellon University, and has been placed in the public   ;;;
;;; domain.  If you are using this code or any part of Garnet,      ;;;
;;; please contact garnet@cs.cmu.edu to be put on the mailing list. ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;

#|
==================================================================
Change log:
    4/22/93 Brad Vander Zanden - Created
==================================================================
|#

(in-package "USER" :use '("LISP"))

;; check first to see if place is set
(unless (boundp 'Garnet-Gadgets-PathName)
  (error "Load 'Garnet-Loader' first to set Garnet-Gadgets-PathName before loading Gadgets."))

;;; Load the gadgets that the constraint gadget needs
;;;
(unless (get :garnet-modules :constraint-gadget)
  (format t "Loading Constraint Gadget...~%")
  (dolist (pair '((:error-gadget "error-gadget")
		  (:arrow-line "arrow-line-loader")
		  (:labeled-box "labeled-box-loader")))
    (unless (get :garnet-modules (car pair))
      (load (merge-pathnames (cadr pair)
			     #+cmu "gadgets:"
			     #+(not cmu) Garnet-Gadgets-PathName)
	    :verbose T)))

;;; load c32
(when (not (get :garnet-modules :c32))
      (load garnet-c32-loader))

;;;
;;;     Functions needed from Gilt
(load (merge-pathnames "gilt-functions-loader"
			 user::Garnet-Gilt-PathName))
#|
(load (merge-pathnames "gilt-gadget-utils"
		       user::Garnet-Gilt-PathName))
|#
;; ---- Compile the constraint gadget itself

(Defparameter Garnet-Constraint-Gadget-Files
  '(
    "cg-defs"
    "support-constraints"
    "custom"
    "attach-constraints"
    "support-box-constraints" "box-parts" "box"
    "line-constraint-defs" "line-constraint-objs" "line-constraint"
    "set-feedback"))

(dolist (file Garnet-Constraint-Gadget-Files)
  (compile-file (merge-pathnames file 
			 #+cmu "constraint-gadget:"
			 #+(not cmu) Garnet-Constraint-Gadget-PathName
			 ))
  (load (merge-pathnames file 
			 #+cmu "constraint-gadget:"
			 #+(not cmu) Garnet-Constraint-Gadget-PathName
			 ))))

(setf (get :garnet-modules :constraint-gadget) t)


