Skip to content
Snippets Groups Projects
Commit a4cf9d7f authored by garland's avatar garland
Browse files

Added support for deleting all active inspection panes.

Added comments and descriptions on how to implement inspector
display methods for view customization.
parent fe121aad
No related branches found
No related tags found
No related merge requests found
;;;; -*- Mode: Lisp ; Package: Interface -*- ;;;; -*- Mode: Lisp ; Package: Interface -*-
;;; ;;;
;;; **********************************************************************
;;; This code was written as part of the CMU Common Lisp project at
;;; Carnegie Mellon University, and has been placed in the public domain.
;;; If you want to use this code or any part of CMU Common Lisp, please contact
;;; Scott Fahlman or slisp-group@cs.cmu.edu.
;;;
;;; **********************************************************************
;;;
;;; Written by Michael Garland
;;;
;;; This file implements the methods used in graphically inspecting Lisp
;;; objects.
;;;
;;; The inspector mechanism revolves around two generic functions:
;;; - INSPECTOR-PANE-TITLE which returns a string meant to be the
;;; title of the inspection pane displaying the given object
;;; - DISPLAY-INSPECTOR-PANE which creates a window pane displaying
;;; the relevant information about the given object
;;;
;;; You can add new display mechanisms by defining new methods for these
;;; generic functions. Specific functions for aiding in the construction
;;; of inspection panes are given below.
;;; ;;;
(in-package "INTERFACE") (in-package "INTERFACE")
...@@ -14,6 +36,8 @@ ...@@ -14,6 +36,8 @@
(defun destroy-pane-callback (widget call-data object) (defun destroy-pane-callback (widget call-data object)
(declare (ignore widget call-data)) (declare (ignore widget call-data))
(setf *current-inspector-objects*
(delete object *current-inspector-objects*))
(destroy-interface-pane object)) (destroy-interface-pane object))
(defun inspect-object-callback (widget call-data object) (defun inspect-object-callback (widget call-data object)
...@@ -101,6 +125,14 @@ ...@@ -101,6 +125,14 @@
;;;; Methods for constructing the title of inspection panes ;;;; Methods for constructing the title of inspection panes
;;; INSPECTOR-PANE-TITLE -- Public
;;;
;;; This function takes a Lisp object and returns a string which is meant
;;; to be the title of the inspection pane displaying the given object.
;;; This particular method is a catch-all for the types which PCL does not
;;; allow us to discriminate.
;;;
(defmethod inspector-pane-title (object) (defmethod inspector-pane-title (object)
(typecase object (typecase object
(pcl::std-instance (pcl::std-instance
...@@ -144,6 +176,17 @@ ...@@ -144,6 +176,17 @@
;;;; Methods for displaying object inspection panes ;;;; Methods for displaying object inspection panes
;;; WITH-INSPECTOR-PANE -- Public
;;;
;;; This macro is the primary tool for building inspection panes. It
;;; creates all the fundamental pieces of the display pane and then calls
;;; the supplied body to create the rest. A typical display method would
;;; like something like:
;;; (defmethod display-inspector-pane ((x mytype))
;;; (with-inspector-pane (x)
;;; ... custom forms ...
;;; ))
;;;
(defmacro with-inspector-pane ((object) &body forms) (defmacro with-inspector-pane ((object) &body forms)
`(multiple-value-bind `(multiple-value-bind
(pane is-new) (pane is-new)
...@@ -158,7 +201,8 @@ ...@@ -158,7 +201,8 @@
(obmenu (create-interface-menu (obmenu (create-interface-menu
menu-bar "Object" menu-bar "Object"
,``(("Eval Expression" popup-eval-callback ,pane ,,object) ,``(("Eval Expression" popup-eval-callback ,pane ,,object)
("Close Pane" destroy-pane-callback ,,object)))) ("Close Pane" destroy-pane-callback ,,object)
("Close All Panes" close-all-callback))))
(title (create-label-gadget (title (create-label-gadget
over-form "inspectTitle" over-form "inspectTitle"
:label-string (inspector-pane-title ,object) :label-string (inspector-pane-title ,object)
...@@ -181,6 +225,14 @@ ...@@ -181,6 +225,14 @@
(manage-children menu-bar title form))) (manage-children menu-bar title form)))
(popup-interface-pane pane))) (popup-interface-pane pane)))
;;; DISPLAY-INSPECTOR-PANE -- Public
;;;
;;; This function takes an object and creates a graphical inspection pane
;;; for displaying it.
;;; This particular method is a catch all for the types which PCL won't
;;; specialize on.
;;;
(defmethod display-inspector-pane (object) (defmethod display-inspector-pane (object)
(typecase object (typecase object
(pcl::std-instance (display-clos-pane object)) (pcl::std-instance (display-clos-pane object))
...@@ -480,6 +532,7 @@ ...@@ -480,6 +532,7 @@
(with-motif-connection (connection) (with-motif-connection (connection)
(verify-control-pane-displayed) (verify-control-pane-displayed)
(display-inspector-pane object) (display-inspector-pane object)
(push object *current-inspector-objects*)
(inspector-add-history-item object))) (inspector-add-history-item object)))
object) object)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment