[Pharo-dev] [Esug-list] [ann] moldable brick editor - alpha
tudor at tudorgirba.com
Sat Aug 12 04:45:22 EDT 2017
Sorry for the late reply.
Very relevant point. Indeed, this is something we are still thinking about. The main thing we focused on was to have the attributes as objects first, and then an API that is easily extensible. The fluent API comes on top.
At the moment, we tend to favor a builder approach that goes in this direction:
text attributes textSize: 60.
The issue is a bit of a more general concern as we already have the same need in several places in Bloc and we already use a builder pattern. For example:
BlKeyCombination builder alt; control; key: Key c; build
BlBorder builder dashed; paint: (Color green muchDarker alpha: 0.7); build
However, these two are for creating a new instance, while in the text example we have to deal with modifying an existing one (i.e., the text). Decisions, decisions … :)
> On Aug 5, 2017, at 6:05 PM, Stéphane Ducasse <stephane.ducasse at gmail.com> wrote:
> A design question.
> Do you think that it would not be better to have the constant encapsulated?
> text textSize: 60.
> text attributes: BRFontTextSize size: 60.
> It could be
> text attributes textSize: 60.
> On Sat, Aug 5, 2017 at 6:02 PM, Stéphane Ducasse <stephane.ducasse at gmail.com> wrote:
> Super cool.
> Bloc will change the face of Pharo.
> On Sat, Aug 5, 2017 at 12:19 AM, Tudor Girba <tudor at tudorgirba.com> wrote:
> We are very happy to announce the alpha version of a moldable editor built in Brick (https://github.com/pharo-graphics/Brick) which is based on Bloc (https://github.com/pharo-graphics/Bloc). This is primarily the work of Alex Syrel. The project was initially financially sponsored by ESUG and it is currently supported by feenk. And of course, the project is based on the tremendous work that went into Bloc and Brick by all contributors.
> Take a look at this 2 min video:
> The basic editor works and it is both flexible and scalable. For example, the last example shown in the video is an editor opened on 1M characters, which is reasonably large, and as can be seen see one can interact with it as smoothly as with the one screen text. It actually works just as fine with 100M characters.
> The functionality of the editor includes: rendering, line wrapping, keypress and shortcut handling, navigation, selection and text styling. Currently, the editor is 1260 lines of code including method and class comments. This is not large for a text editor and this is possible because most of the work is done by generic concepts that already exist in Bloc such as layouts and text measurements. Beside the small maintenance cost, the benefit is that we have the option to build all sorts of variations with little effort. That is why we call this a moldable text editor.
> Another benefit of using elements and layouts is that we can also embed other kinds of non-text elements with little effort (such as pictures), and obtain a rich and live text editor. We already have basic examples for this behavior, and we will focus more in the next period on this area.
> The next immediate step is to add syntax highlighting. Beside the text attributes problem, this issue will also exercise the thread-safety the implementation is. The underlying structure (https://en.wikipedia.org/wiki/Rope_(data_structure)) is theoretically thread-safe, but it still needs to be proven in practice.
> We think this is a significant step because the editor was the main piece missing in Brick and it will finally allow us to build value that can be directly perceived by regular users on top of Brick and this, in turn, will generate more traction. Please also note that because now Bloc is directly embeddable in Morphic it means that we can actually start using it right away. For example, the picture below shows the text element being shown through a live preview in the GTInspector.
> This is another puzzle piece towards the final goal of engineering the future of the Pharo user interface. There is still a long way to go to reach that goal, but considering the work that is behind us, that goal that looked so illusive when Alain and Stef initiated the Bloc project is now palpable.
> We will continue the work on this over the next period and we expect to announce new developments soon.
> If you want to play with it, you can load the code like this (works in both Pharo 6 and 7):
> Iceberg enableMetacelloIntegration: true.
> Metacello new
> baseline: 'Brick';
> repository: 'github://pharo-graphics/Brick/src';
> load: #development
> Please let us know what you think.
> Alex and Doru
> "What is more important: To be happy, or to make happy?"
> Esug-list mailing list
> Esug-list at lists.esug.org
"Yesterday is a fact.
Tomorrow is a possibility.
Today is a challenge."
More information about the Pharo-dev