; #|

Annotation Events - Additional Examples

Note: This is an example file showing concepts of the Integration Kit. The code itself is not supported and will never be supported.
|#

(in-package :docu)
(use-package '( :oli :frame2 :elan))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Begin of page;;
;; 
;; example how to use the *DOCU-PRE-UPDATE-VIEW-EVENT* event
;; 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(sd-unsubscribe-event *DOCU-PRE-UPDATE-VIEW-EVENT* 'docu-pre-update-view-event-fnc)

(defun docu-pre-update-view-event-fnc (&rest arg-list)
  (let ((view nil))

    (setq view (sd-am-inq-view (getf arg-list :v2d)))
  
    (display (format nil "View ~A is going to be updated" 
		         (sd-am-view-struct-name view)))
  )
)

(sd-subscribe-event *DOCU-PRE-UPDATE-VIEW-EVENT* 'docu-pre-update-view-event-fnc)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Begin of page;;
;; 
;; example how to use the *DOCU-POST-UPDATE-VIEW-EVENT* event
;; 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(sd-unsubscribe-event *DOCU-POST-UPDATE-VIEW-EVENT* 'docu-post-update-view-event-fnc)

(defun docu-post-update-view-event-fnc (&rest arg-list)
  (let ((view nil))

    (when (sd-am-view-p (getf arg-list :v3d))
      (sd-process-event "*DOCU-CHANGE-OBJECT-TREE-EVENT*")
      (setq view (sd-am-inq-view (getf arg-list :v2d)))

      (display (format nil "The updated View was a ~A-View" 
		           (sd-am-view-struct-type view)))
    )
  )
)

(sd-subscribe-event *DOCU-POST-UPDATE-VIEW-EVENT* 'docu-post-update-view-event-fnc)

;  END of Example