From: Paul Tarvydas
Subject: capi:editor-pane
Date: 
Message-ID: <Pc677.57501$2V.12410634@news3.rdc1.on.home.com>
I wish to build a captive text editor into my program which redefines some
of the basic commands of the LispWorks editor, e.g. ^X^S should call my
"save" routine instead of the default one.  I haven't sussed out how this
should be done.  I think that I want to define these routines in my program
instead of modifying the .lispworks initialization file.  I'd like to take
the path of least resistance - bring up a full emacs-like editor and punt
some of the keystrokes to my program.  Suggestions would be appreciated.

The larger problem is - in case you think that I should approach the problem
differently:

I'm writing a graphical data-structure editor using CAPI on Win32 (I'm
making the assumption that CAPI is simpler and easier to use than CLIM
(based on manual thickness), please correct me if I'm wrong).  Much of the
work is done by editing the graphics (on a capi:pinboard-layout), but some
annotations must be made with text (code snippets attached to the graphic
nodes).  I've built two interfaces (using define-interface) - one for
graphics and one for text (using capi:editor-pane).  When a graphic object
has been selected, a text version of its parameters appears in the
editor-pane, where the parameters can be modified using emacs-like gestures.
"Saving" the text should call a function that parses the text and
manipulates the data structures.

I looked at capi:text-input-pane, but it edits only a single line of text (I
need multiple lines).  The docs mention
capi:multiple-line-text-input-pane's, but this class doesn't appear to
exist - it appears to be superceded by editor-pane.

When I bring up an editor-pane and hit ^X^S, I get an error that says
there's something wrong with my echo area (I didn't create an echo area in
the interface, and currently don't know how).

I class-browser'ed the :input-model for editor-pane.  I found that I could
override it completely but that I couldn't override specific keystrokes if I
tried to override it partially (i.e. adding specific keystrokes before or
after the (:gesture-spec capi::gesture-spec-input) didn't seem to do
anything).

It would seem that judicious use of define-command would be what I need, but
I don't see from the documentation how to make it apply to only the
editor-pane within my program.

I'm probably missing something obvious...

Thanks
Paul Taryvdas
·········@tscontrols.com

From: Wade Humeniuk
Subject: Re: capi:editor-pane
Date: 
Message-ID: <9jj60r$rjh$1@news3.cadvision.com>
> I looked at capi:text-input-pane, but it edits only a single line of text
(I
> need multiple lines).  The docs mention
> capi:multiple-line-text-input-pane's, but this class doesn't appear to
> exist - it appears to be superceded by editor-pane.
>

Yes the actual name is capi:multi-line-text-input-pane.  Use the Class
Browser, it inherits from capi:text-input-pane.

CL-USER 13 > (capi:contain (make-instance 'capi:multi-line-text-input-pane))
#<CAPI:MULTI-LINE-TEXT-INPUT-PANE  203FD90C>

CL-USER 14 >

It looks hard to use editor panes for anything other than editing text
buffers.

Wade
From: Clive Tong
Subject: Re: capi:editor-pane
Date: 
Message-ID: <uelr6spbv.fsf@scientia.com>
"Paul Tarvydas" <·········@tscontrols.com> writes:

> ...
> When I bring up an editor-pane and hit ^X^S, I get an error that says
> there's something wrong with my echo area (I didn't create an echo area in
> the interface, and currently don't know how).

Add an echo-area-pane to your interface, and associate with the editor-pane.

(capi:define-interface fred () 
  ()
  (:panes
   (ed-pane capi:editor-pane 
            :echo-area-pane echo-area
            :buffer-name "my buffer"
            :contents "12345678901234567890")
   (echo-area capi:echo-area-pane
              :max-height '(character 1))))

> ....
> 
> It would seem that judicious use of define-command would be what I need, but
> I don't see from the documentation how to make it apply to only the
> editor-pane within my program.

You can make a command apply to a particular buffer, or to buffers in
a particular mode. Hence you could do something along the lines of: 

(editor:defcommand "Move Five" (p)
     "Moves the current point forward five characters.
    Any prefix argument is ignored."      
     "Moves five characters forward."
  (editor:forward-character-command 5))

(capi:define-interface fred () 
  ((buffer-name :initform "my buffer"))
  (:panes
   (ed-pane capi:editor-pane 
            :echo-area-pane echo-area
            :buffer-name buffer-name
            :contents "12345678901234567890")
   (echo-area capi:echo-area-pane
              :max-height '(character 1))))

(defmethod initialize-instance :after ((self fred) &key)
  (with-slots (buffer-name) self
    (editor:bind-key 
     "Move Five" #\space 
     :buffer (editor:buffer-from-name buffer-name))))

(capi:contain (make-instance 'fred))