CLIM mail archive

[Prev][Next][Index][Thread]

two clim questions



        Date: Wed, 24 Apr 1991 07:42 EDT
        From:     Rainer Koenig <king@fzi.uka.de>
    
        1. Question:
    
        When I "present" a line (in CLIM) using presentation types and try
        to "accept" it, all the functions work well.
    
        But when I "present" a line in a scaled environment, the function 
        "accept" seems to be pure chance.
        I think that the origin of this problem lies in the projection of the
        original coordinates to the scaled coordinates.
        The functions in CLIM use the scaled coordinates (normally not integer
        values, but coordinates like (12.34 | 7.75)), but when we use the mouse
        we only get integer coordinates. So the congruency of mouse coordinates
        and scaled coordinates is only given in some special cases (which happens 
        when the scaled coordinates and the mouse coordinates are the same).
    
        Therfore I wonder if I made a mistake or if, possibly, there is a bug in
        CLIM.
    
        (I tried this with CLIM of ILA and SYMBOLICS)
    
    Could you please forward a small test case?

;;;********************************************************************************
(use-package '(clos clim common-lisp))

;;; part of the examples.lisp file of ILA

(defun clim-scroller (&key (server-path *default-server-path*)
			   (hs 600) (vs #+Imach 200 #-Imach 400))
  (let ((framem (find-frame-manager :server-path server-path))
	(frame (make-frame 'frame))
	stream)
    ;; Enter the context in which to define the contents of this frame
    (with-style (framem frame)
      ;; declare what the frame's child will be
      (setf (frame-pane frame)			;; Frames have only one child
	    (scrolling				;; Make a scrolling pane
	      :subtransformationp t		;; Required for scrolling panes
	      :hs+ *fill*			;; If the frame gets bigger in the
	      :vs+ *fill*			;;   horizontal or vertical dimensions
						;;   expand to fill all available space
	      :hs hs :vs vs			;; Initial h. and v. sizes
	      ;; A form to generate the contents
	      (setq stream (make-pane 'clim-stream-pane))))
      (adopt-frame framem frame)
      ;; Make the frame visible
      (enable-frame frame)
      (values stream frame))))

(defclass section-class ()())

(defmethod presentation-type ((section section-class))
   'section)


(defun present-section (stream section x1 y1 x2 y2 scale &optional (thickness 1))
  (let ((transform (make-scaling-transformation scale scale)))
    (with-drawing-options (stream :transformation transform)
			  (with-output-as-presentation (:type 'section
							:object section
							:stream stream)
						       (draw-line* stream
								   x1
								   y1
								   x2
								   y2
								   :thickness 1)))))

(defun accept-section (stream)
  (let ((object (accept 'section
			:stream stream)))
    (format stream "Section:  ~S" object)))

(defvar *scale* 0.11)

(setq section1 (make-instance 'section-class))
(setq section2 (make-instance 'section-class))
(setq section3 (make-instance 'section-class))
(setq section4 (make-instance 'section-class))
(setq section5 (make-instance 'section-class))
(setq section6 (make-instance 'section-class))

(setq stream (clim-scroller))

(window-clear stream)

(present-section stream section1 10 804 5000 804 *scale*)
(present-section stream section2 15 2200 1005 2200 *scale*)
(present-section stream section3 550 2030 550 4300 *scale*)
(present-section stream section4 389 2011 389 5400 *scale*)
(present-section stream section5 5 1005 3000 5055 *scale*)
(present-section stream section6 304 301 2056 2089 *scale*)

(dotimes (i 5) (accept-section stream))


To accept 

- section1 fails.  The scaled Y-coordinate of that line is a real value.
- section2 is possible, because the scaled Y-coordinate could be converted
  without rest to an integer value (the X-coordinate is in that example
  irrelevant - parallel to X-axis)
          89.34 -> integer 89 rest 0.34 
          88.0  -> integer 88 rest 0
- section3 is possible, because the scaled X-coordinate could be converted
  without rest to an integer value (parallel to Y-axis)
- section1 fails.  The scaled X-coordinate of that line is a real value.
- section5 or section6 is possible at those points, where the X- and Y-coordinates
  could be converted without rest to integer values.
;;;********************************************************************************
    
    I also don't understand how it is that you have "Symbolics" CLIM.  Did you
    get it via Symbolics GmbH?  What version of Symbolics CLIM are you using
    (what does :Show Herald tell you)?

The test was carried out on a symbolics using CLIM 15 distributed with CLOE
    
        2. Question
    
        I now want to draw a picture in a scrollable pane, which exceeds the 
        boundaries. So I'm now looking for some functions/methods
    
        - in order to get the coordinates of the visible part 
        - which indicate us the cases when the scrollbar has been used.
    
    
    CLIM:WINDOW-VIEWPORT will return a rectangle object that corresponds to the
    visible region in the output history.  You can use WITH-BOUNDING-RECTANGLE*
    on WINDOW-VIEWPORT to get the four values corresponding to the left, top,
    right, and bottom coordinates of the viewport.
    
Is there an appropriate function to CLIM:WINDOW-VIEWPORT in CLIM of ILA.
I tried CLIM:PANE-VIEWPORT, but the returened values seem to be constant (independent
from the visible part, CLIM:WINDOW-VIEWPORT is not available)

    I have no idea what you mean by the second part of the question.  What is
    it you are trying to do?

I draw a picture in a "first" pane, which exceeds the boundaries. In the "second" pane
I want to draw the scaled picture and a rectangle, indicating the visible part of the
"first" pane. Therefore I need the coordinates of the visible part and the method,
which indicate us the scrolling of the "first" pane to adjust the "second" pane.
    
        ==============================================================================
        Rainer Koenig                                               rkoenig@fzi.uka.de
        Forschungszentrum Informatik                                king@fzi.uka.de
        an der Universitaet Karlsruhe
        Abtl. Technische Expertensysteme und Robotik
        Haid-und-Neu-Strasse 10-14                      Fax : (+49 | 0) 721 / 6906-309
        D - 7500 Karlsruhe 1                            Tel.: (+49 | 0) 721 / 6906-313
        ==============================================================================

0,,


Main Index | Thread Index