[squeak-dev] Re: Text Editors

Andreas Raab andreas.raab at gmx.de
Sun Aug 2 18:58:33 UTC 2009


Juan Vuletich wrote:
> I guess I was being too optimistic. I honestly tried to do it. First I 
> tried to file in the Editor classes from Cuis. Unfortunately, they are 
> differences that make them incompatible, for example in NewParagraph. 

I did it slightly differently and had no problems:
* File out Editor, TextEditor, file those into Squeak.
* Make a subclass of TextMorph called TextEditorMorph
* Give it the editorClass TextEditor, open it, edit it
At this point I had one blow-up resulting from missing 
NewParagraph>>replaceFrom:to:with:. I added it and everything seemed to 
work.

I then upped the ante a little and replaced TextMorph>>editorClass with 
TextEditor. And guess what, it seems to be working quite well, except 
from a few issues like:
* One cannot get rid of text selection by clicking inside the old 
selection. I'm presuming that this is done for mobile devices but we 
should have a preference for governing that.
* Programming short cuts do not work (browse senders, implementors etc). 
How are shortcuts expected to work here? Should these be in a subclass? 
(some advice would be welcome).

Other than that I haven't found any problems whatsoever yet.

> I know. Perhaps my anti aliased StrikeFonts could be included in Squeak. 
> I don't know how to handle the creation of instances. Monticello can 
> only handle code, right? No live instances or binary (bmp) files?

We can work this out. In the worst case, initializer methods can carry 
code as well, along the lines of:

blankForm
   "Created using:
     (ByteArray streamContents:[:s|
         PNGReadWriter
             putForm: (Form extent: 100 at 100 depth: 32)
             onStream: s]) asString base64Encoded.
   "
   ^Form fromBinaryStream: (
'iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAAnklEQVR4XuXBMQEAAADCoPVP
bQsfIJ/P5/P5fD6fz+fz+Xw+n8/n8/l8Pp/P5/P5fD6fz+fz+Xw+n8/n8/l8Pp/P5/P5fD6f
z+fz+Xw+n8/n8/l8Pp/P5/P5fD6fz+fz+Xw+n8/n8/l8Pp/P5/P5fD6fz+fz+Xw+n8/n8/l8
Pp/P5/P5fD6fz+fz+Xw+n8/n8/l8Pp/P5/P5fD6fz3c1nKQAAZiW0oUAAAAASUVORK5CYII='
    ) base64Decoded asByteArray readStream.

If we stick this into a temporary class that gets deleted in a later 
update then the overhead is temporary.

Cheers,
   - Andreas



More information about the Squeak-dev mailing list