(in-package "KPML-I")

;;; File: presentation-actions.lisp
;;;

;;; Collects all the presentation actions together.

(clim:define-presentation-action present-system
    (system nil kpml-resource-inspector
	    :documentation "Show the system")
  (object)
  (kpml::describe-system object))

(clim:define-presentation-action present-feature
    (feature nil kpml-resource-inspector
	     :documentation "Describe the feature")
  (object)
  (kpml::describe-feature object))

(clim:define-presentation-action present-chooser
    (chooser nil kpml-resource-inspector
	     :documentation "Show the chooser")
  (object)
  (kpml::describe-chooser object))

(clim:define-presentation-action present-inquiry
    (inquiry nil kpml-resource-inspector
	     :documentation "Show the inquiry")
  (object)
  (kpml::describe-inquiry object))

(clim:define-presentation-action present-spl-term
    (spl-term nil kpml-resource-inspector
	      :documentation "Show the SPL term")
  (object)
  (kpml::describe-spl-term object))

(clim:define-presentation-action present-lex-item
    (lex-item nil kpml-resource-inspector
	      :documentation "Show the lexical item")
  (object)
  (kpml::describe-lex-item object))

;;; ----------------------------------------------------------------------
;;; 3.0 added...
;;; ----------------------------------------------------------------------

;;; ----------------------------------------------------------------------
;;; MICROFUNCTIONS...
;;; ... for various reasons the object here is not just a microfunction
;;; but also a region wrt which we are thinking about the microfunction.
;;; This makes some of the information given more usable.
;;; ----------------------------------------------------------------------

(clim:define-presentation-action present-microfunction-usage
    (microfunction nil kpml-resource-inspector
	    :documentation "Show microfunction-usage")
  (object)
  (let ((stream
	 (clim:get-frame-pane 
	  kpml-i::*resource-inspector-frame* 'kpml-i::inspector))

        ;; this must be set, else you get a nil and a crash when pp-ing 
        ;; realization statements...
        (kpml::*print-right-margin* 50))
    (declare (special kpml::*print-right-margin*))
    (who-can-affect-microfunction object stream)))


;;; ----------------------------------------------------------------------
;;; REGIONS...
;;; ----------------------------------------------------------------------

(clim:define-presentation-action present-region
    (region nil kpml-resource-inspector
	    :documentation "Graph region dependencies")
    (object)
  (display-region-overview object))

(clim:define-presentation-action present-region-2
    (region nil kpml-resource-inspector
	    :documentation "Graph region")
    (object)
  (graph-under-current-options object :region-flag T))
