[Gambas-user] [Gambas Bug Tracker] Bug #753: Rich text editor
Benoît Minisini
gambas at ...1...
Tue Sep 22 18:03:54 CEST 2015
Le 22/09/2015 17:49, Moviga Technologies a écrit :
>> yes :-)... and maybe with a better synthax. But for that i think you
>> will wait or do it yourself.
>
> (Since you reply by mail, and not in the bugtracker, I reply you also by
> mail)
>
> I am afraid my competence is not enough to undertake such a task. I have
> been trying to look at the gb.form.editor code, and it is a bit hard to
> get a hold on, and there are very few comments explaining what is going
> on.
>
It won't help you a lot. TextEditor is really made and optimized for
displaying and editing text using a monospace font. Automatic
line-breaking was added recently, and is a sort of hack.
Making a rich-text editor is a bit like programming something like
LibreOffice Writer, with less features.
You must have paragraphs, using any font, size, colours, style...
applied to any group of characters in the paragraph.
Then you need a layouting routine that handle where and how to display
paragraph.
Then you need to display a cursor, the selected text.
You need to be able to transform any mouse position in the editor window
into a position in the text.
You have to implement an undo/redo system.
Only the rest is similar to what exists in TextEditor: keyboard
handling, shortcuts, saving and loading. It's the simpler.
Maybe if I have time I will make a library that implement the paragraph
stuff on top of a vectorial canvas (i.e. a sort of DrawingArea that
contains vectorial objects).
It's interesting to have a "canvas" layer between the paragraphs and the
final ScrollArea. Because after you can "easily" add other objects, like
images, tables, vectorial drawings... until you have a real text processor.
Interesting project if you have at least six months.
--
Benoît Minisini
More information about the User
mailing list