2013/5/16 Camillo Bruni <[email protected]>
>
> On 2013-05-16, at 13:04, Denis Kudriashov <[email protected]> wrote:
> > Hello.
> >
> > 2013/5/16 Camillo Bruni <[email protected]>
> >
> >> I have a question concerning the new TxText layout.
> >> How hard is it support inline non-text nodes (aka inline morphs) in a
> text
> >> layout?
> >>
> >
> > Do you mean supporting "TxMorphSpan" objects from text model at text
> layout
> > level?
> > I think it is is not hard. Main issue here is supporting such kind of
> spans
> > at text model level. But I think it is not difficult too,
> > I should look at code to answer in detail (can't do it now).
> >
> >
> >>
> >> My dream is still to be able to drag and drop an "instance" from an
> >> inspector to a workspace and do some operations on it using standard
> >> smalltalk.
> >
> >
> > +1
> > And I want drag and drop objects between inspectors and between
> workspaces.
> >
> >
> >> The only difference here would be instead of using a variable or
> >> expression to get an instance of something I would have a textual/visual
> >> node directly representing an instance!
> >>
> >
> > I'm not understand it.
> > By dropping some object to workspace It can create named variable and
> then
> > you can use it for scripting inside workspace.
> > But what you suggest here? Can you explan deeply?
>
>
> Indeed I am not very clear (as usual :).
> a) I want to have a morph representing an object
> b) I want to embed these morphs into text
> c) I want to interact with these morphs and the text
>
> Let's say [Set] is the morph representing a set and I have the following
> source code with this morph inside:
>
> [Set] includes: #a
>
> Then this would be equivalent to the following:
>
> Smalltalk at: #MySetInstance put Set new.
>
> MySetInstance includes: #a
>
> However [Set] is not just text but a real morph I can drag around, right
> click
> and get a decent, instance specific menu on... and so forth :)
>
> is that more clear?
>
Ok. Now I understand what you want.
I look at code.
As I sad before. TxMorphSpan requires some changes in text model code and
layout code.
Now TxLayout is collection of TxLayoutLine's where TxLayoutLine is
collection of TxLayoutSpan's. And now TxLayoutSpan is interval of
TxCharacterSpan. So TxLayoutSpan know that it is layout of characters. It
has font.
One of the options to support TxMorphSpan layout is to introduce
TxLayoutMorphSpan and implement all required protocol. To hook up this
object during layout building you should implement something like:
TxMorphSpan>>layoutContentsBy: aLayoutBuilder
aLayoutBuilder currentSpan: (TxLayoutMorphSpan on: self)
aLayoutBuilder completeSpan
You see it is quite simple.
Now I almost finich edit decorators stuff. (I have TxNoneEditDecorator,
TxMaskEditDecorator, TxInsertModeEditDecorator, TxSmartCharsEditDecorator).
And next my task will validation/filtering of input. I think it will
require text model changes, so I will think about morph span too.
And of couse if you again join to TxText development it will be perfect!
You and Igor started this project.
Best regards,
Denis
.