[squeak-dev] Re: Text Editors

Juan Vuletich juan at jvuletich.org
Sun Aug 2 19:28:55 UTC 2009


Andreas Raab wrote:
> 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.

Great!!! My mistake here is that I want to know exactly what behavior 
I'm modifying. So I turned to the other approach, using clones of the 
existing classes. That faced me to the need to check  perhaps 40 senders 
for each of about 100 methods that would be modified or removed. 
Checking 4000 methods is no fun! Good you tried the more reasonable way.

> 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.

You're right. I'll add a preference for that for Cuis, but as it is done 
outside TextEditor (in MouseClickState), for Squeak, the best is to just 
remove it. This is easy. In TextEditor>>mouseDown: remove the line:
    (oldInterval includes: b stringIndex) ifTrue: [ ^self ].

> * 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).

I moved them to SmalltalkEditor subclass. I'd not add it to Squeak, as 
the "proper" refactoring (moving down lots of methods from TextEditor to 
SmalltalkEditor) is not yet done. So, just fold the 4 class methods from 
SmalltalkEditor into TextEditor. Or you can load them from TextMorphEditor.

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

Excellent!

>> 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.

Good idea, thanks! I'll try to build an updated package for Squeak using 
this.

Cheers,
Juan Vuletich

>
> Cheers,
>   - Andreas




More information about the Squeak-dev mailing list