From: Marco Antoniotti
Subject: Help with CAPI: avoid wrapping text lines in a pane.
Date: 
Message-ID: <y6cu1pqqfiv.fsf@octagon.mrl.nyu.edu>
Hi

the folks at Xanalys have been very helpful over the past days. Tehy
deserve praise.

I just decided to ask this here to avoid overwhelm them.

I have the following problem.

I want to display a few very long lines in a "pane".  I tried the
useful CAPI:COLLECTOR-PANE, but found out that there is no way to
force it not to wrap the output.

So I tried a CAPI:DISPLAY-PANE, but now I have to problem to constrain
its visible size to the size of the container (a CAPI:TAB-LAYOUT).

I would appreciate any help that I could get.  Asking here is better
that RTFM :)

Cheers

-- 
Marco Antoniotti ========================================================
NYU Courant Bioinformatics Group        tel. +1 - 212 - 998 3488
719 Broadway 12th Floor                 fax  +1 - 212 - 995 4122
New York, NY 10003, USA                 http://bioinformatics.cat.nyu.edu
                    "Hello New York! We'll do what we can!"
                           Bill Murray in `Ghostbusters'.

From: Wade Humeniuk
Subject: Re: Help with CAPI: avoid wrapping text lines in a pane.
Date: 
Message-ID: <aasm3d$vif$1@news3.cadvision.com>
You can use capi:output-panes, like...

CL-USER 3 > (setf pane (capi:contain (make-instance 'capi:output-pane :min-width 150
:min-height 200)))
#<CAPI:OUTPUT-PANE  2040CFC4>

CL-USER 4 > (gp:draw-string pane "The Quick Red Fox Jumped Over the Lazy Dog" 0
(gp:get-font-ascent pane))
T

CL-USER 5 >

Make sure the pane is on top when you do gp:draw-string.

OR you can use capi:pinboard-layouts like...

CL-USER 5 : 1 > (setf pane
                  (capi:contain
                   (make-instance 'capi:pinboard-layout
                                  :description
                                  (list
                                   (make-instance 'capi:column-layout
                                                  :description
                                                  (list
                                                   (make-instance
'capi:item-pinboard-object :text "The quick red fox jumped over the lazy brown dog"))))
                                  :min-width 150
                                  :max-width 150)))
#<CAPI:PINBOARD-LAYOUT  203FDA4C>

CL-USER 6 : 1 >

The could add a list of item-pinboard-objects for each line.  The column-layout does all
the position calculations.

Wade

"Marco Antoniotti" <·······@cs.nyu.edu> wrote in message
····················@octagon.mrl.nyu.edu...
>
> Hi
>
> the folks at Xanalys have been very helpful over the past days. Tehy
> deserve praise.
>
> I just decided to ask this here to avoid overwhelm them.
>
> I have the following problem.
>
> I want to display a few very long lines in a "pane".  I tried the
> useful CAPI:COLLECTOR-PANE, but found out that there is no way to
> force it not to wrap the output.
>
> So I tried a CAPI:DISPLAY-PANE, but now I have to problem to constrain
> its visible size to the size of the container (a CAPI:TAB-LAYOUT).
>
> I would appreciate any help that I could get.  Asking here is better
> that RTFM :)
>
> Cheers
>
> --
> Marco Antoniotti ========================================================
> NYU Courant Bioinformatics Group        tel. +1 - 212 - 998 3488
> 719 Broadway 12th Floor                 fax  +1 - 212 - 995 4122
> New York, NY 10003, USA                 http://bioinformatics.cat.nyu.edu
>                     "Hello New York! We'll do what we can!"
>                            Bill Murray in `Ghostbusters'.
From: Wade Humeniuk
Subject: Re: Help with CAPI: avoid wrapping text lines in a pane.
Date: 
Message-ID: <aaspsb$17j$1@news3.cadvision.com>
This is a multi-part message in MIME format.

------=_NextPart_000_000A_01C1F212.6B2C8F20
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

I have attached a lisp file that contains a clas that inherits from capi:pinboard-object.
Makes life a little easier.

Wade

"Marco Antoniotti" <·······@cs.nyu.edu> wrote in message
····················@octagon.mrl.nyu.edu...
>
> Hi
>
> the folks at Xanalys have been very helpful over the past days. Tehy
> deserve praise.
>
> I just decided to ask this here to avoid overwhelm them.
>
> I have the following problem.
>
> I want to display a few very long lines in a "pane".  I tried the
> useful CAPI:COLLECTOR-PANE, but found out that there is no way to
> force it not to wrap the output.
>
> So I tried a CAPI:DISPLAY-PANE, but now I have to problem to constrain
> its visible size to the size of the container (a CAPI:TAB-LAYOUT).
>
> I would appreciate any help that I could get.  Asking here is better
> that RTFM :)
>
> Cheers
>
> --
> Marco Antoniotti ========================================================
> NYU Courant Bioinformatics Group        tel. +1 - 212 - 998 3488
> 719 Broadway 12th Floor                 fax  +1 - 212 - 995 4122
> New York, NY 10003, USA                 http://bioinformatics.cat.nyu.edu
>                     "Hello New York! We'll do what we can!"
>                            Bill Murray in `Ghostbusters'.

------=_NextPart_000_000A_01C1F212.6B2C8F20
Content-Type: application/octet-stream;
	name="capi-extensions.lisp"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="capi-extensions.lisp"

(defclass simple-text-pane (capi:pinboard-layout)
  ())

(defclass simple-text-pane-line (capi:item-pinboard-object)
  ((line-number :initarg :line-number :accessor line-number)))

(defmethod remove-line ((pane simple-text-pane) line-number)
  (let ((existing-line (find line-number (capi:layout-description pane)
                             :key 'line-number)))
    (when existing-line
      (setf (capi:element-parent existing-line) nil))))

(defmethod replace-line ((pane simple-text-pane) new-line line-number)
  (remove-line pane line-number)
  (setf (capi:element-parent new-line) pane))
 =20
(defmethod display-text ((pane simple-text-pane) text line-number)
  (let ((line
         (make-instance 'simple-text-pane-line
                        :text text
                        :line-number line-number
                        :y (+ (gp:get-font-descent pane) (* line-number =
(gp:get-font-height pane)))
                        :x 0)))
    (replace-line pane line line-number)))

#| Sample transcript

CL-USER 18 > (setf pane (capi:contain (make-instance 'simple-text-pane =
:min-width 200 :min-height 200 :background :white :foreground :black)))
#<SIMPLE-TEXT-PANE  203FB444>

CL-USER 19 > (display-text pane "Hello World!" 0)
#<SIMPLE-TEXT-PANE  203FB444>

CL-USER 20 > (display-text pane "The quick red fox jumped over the lazy =
brown dog" 1)
#<SIMPLE-TEXT-PANE  203FB444>

CL-USER 21 > (display-text pane "The quick red fox jumped over the lazy =
brown dog" 10)
#<SIMPLE-TEXT-PANE  203FB444>

CL-USER 22 > (remove-line pane 0)
(#<SIMPLE-TEXT-PANE-LINE "The quick red fox jumped over the lazy brown =
dog" 203FD8FC> #<SIMPLE-TEXT-PANE-LINE "The quick red fox jumped over =
the lazy brown dog" 203FDECC>)

CL-USER 23 >=20

|#
------=_NextPart_000_000A_01C1F212.6B2C8F20--
From: Marco Antoniotti
Subject: Re: Help with CAPI: avoid wrapping text lines in a pane.
Date: 
Message-ID: <y6cd6wdxldv.fsf@octagon.mrl.nyu.edu>
Thanks

it is useful but it does not solve my problem:
how do I specify

        :visible-min-witdh
        :external-min-witdh
        :internal-min-witdh

and scrolling parameters so that a "pane" containing very long lines
does not wrap them and does not influence the size of the containing
layout (which in my case is a tab-layout).

Cheers

-- 
Marco Antoniotti ========================================================
NYU Courant Bioinformatics Group        tel. +1 - 212 - 998 3488
719 Broadway 12th Floor                 fax  +1 - 212 - 995 4122
New York, NY 10003, USA                 http://bioinformatics.cat.nyu.edu
                    "Hello New York! We'll do what we can!"
                           Bill Murray in `Ghostbusters'.
From: Wade Humeniuk
Subject: Re: Help with CAPI: avoid wrapping text lines in a pane.
Date: 
Message-ID: <aauf85$f9f$1@news3.cadvision.com>
"Marco Antoniotti" <·······@cs.nyu.edu> wrote in message
····················@octagon.mrl.nyu.edu...
>
> Thanks
>
> it is useful but it does not solve my problem:
> how do I specify
>
>         :visible-min-witdh
>         :external-min-witdh
>         :internal-min-witdh
>
> and scrolling parameters so that a "pane" containing very long lines
> does not wrap them and does not influence the size of the containing
> layout (which in my case is a tab-layout).

simple-text-pane inherits from pinboard-layout, all the capi init args apply.

CL-USER 15 > (setf pane
                  (make-instance 'simple-text-pane
                                 :visible-min-width 200
                                 :visible-min-height 200
                                 :horizontal-scroll t
                                 :vertical-scroll t
                                 :background :white))
#<SIMPLE-TEXT-PANE  20436B24>

CL-USER 16 > (setf tabbed-pane
                   (capi:contain
                    (make-instance 'capi:tab-layout
                                   :items (list (list "Text" pane))
                                   :print-function 'car
                                   :visible-child-function 'second
                                   :min-width 300
                                   :max-width 300
                                   :min-height 300)))
#<CAPI:TAB-LAYOUT [1 item] 204038DC>

CL-USER 17 > (display-text pane "Hello World!" 0)
#<SIMPLE-TEXT-PANE  20436B24>

CL-USER 18 > (display-text pane "The quick red fox jumped over the lazy brown dog." 15)
#<SIMPLE-TEXT-PANE  20436B24>

CL-USER 19 >

Wade