Fellow Evolutionists, time to report on my progress in the composer port. I'd appreciate any feedback and ideas. Disclaimer: a long email, you have been warned. For diligent readers, reward at the end :) When I was starting the port, I essentially just looked on the GtkhtmlEditor sources and tried to clone as much as possible. What I ended up with is a set of classes located in /widgets/editor (libeeditor), which at the end are not really a clone of GtkhtmlEditor... EEditorWidget - WebKit subclass, provides API for configuring behavior of the editor EEditorSelection - represents current selection in the editor widget and provides API to modify formatting of the selection. I keep asking myself if this could be merged to EEditorWidget, the main reason I haven't done it yet is that e_editor_widget_set_bold() does not describe correctly what the method does, unlike e_editor_selection_set_bold(). Also it makes the source files smaller. I hate long source files... :-) But if you would insist, I won't probably strictly object against merging it. EEditor - a GtkGrid with toolbars and EEditorWidget. Can be subclassed to something like ESimpleEditor to be used elsewhere in Evo with limited set of features. EEditorDialog* - implementations of all the dialogs. I decided to throw away the Glade file and single .c with implementation of all the dialogs because it completely violates all principles of OOP and because I have to provide my own implementation of most of the actions in the dialogs anyway, so the single signals file would be huuuge and ugly. EEditorWindow - a GtkWindow which contains EEditor and simple API to pack widgets above or below the editor. It's used by the signature editor and composer and it's there so that I just don't have to copy-paste that much (and because it's the right thing to do ;-). EColorChooserWidget - this is a "subclass" of GtkColorChooserWidget. Unfortunately API of the Gtk widget totally _SUCKS_, so it's more of a hack. It's point is to make the color chooser to accept color by single clicking it instead of double clicking. EImageChooserDialog - this is a cool GtkFileDialog subclass that displays preview of selected image next to the file list. The contact editor does it too, but it does not provide the dialog as a separate class. TODO: The contact editor could probably be ported to use this class EEmoticon* - GtkhtmlEditor used to call this GtkhtmlFace, which is a silly and confusing name. This is one of the very few parts that are almost exact clone of GtkhtmlEditor code. EActionComboBox - I dragged this from /widgets/misc, because I need it in the Editor, but libeeditor can't link against libemiscwidgets (it links against libeeditor). I also tweaked some of the dialogs: for example the Find dialog now supports search wrapping (because WebKit supports it :), "Insert Link" dialog has a new "Remove Link" button and I also unified the buttons - all dialogs (except for the Link dialog) now have only "Close" button, because the changes are always applied immediately, so "OK" makes no sense there. This was slightly inconsistent across GtkhtmlEditor dialogs. I also ended up with my "own" implementation of spell-checking, which are located in e-utils. ESpellChecker - can list all dictionaries and can be used as "storage" for currently active dictionaries. Also implements WebKitSpellChecker interface, so it can be (and is) used as implementation of spell checking in EEditorWidget/WebKit. ESpellDictionary - a thin wrapper around EnchantDict which provides reference counting and nice names (en_US -> "English (American)"). You can either e_spell_dictionary_{learn,ignore}_word() for specific dictionary or e_spell_checker_{learn,ignore}_word() for all active dictionaries in the spell checker. The ESpellChecker. Behavior of the editor is almost identical to GtkhtmlEditor, except for HTML mode -> Plain text switching. GtkhtmlEditor is simply switching renderers on top of a single DOM document, but we can't do this with WebKit. I looked how others do it and ended up with a "Switching to plain text will lose all formatting, OK?" dialog. When user confirms, all formatting is removed and plain text version is inserted back to the editor. Switching from Plain text to HTML does not alter formatting in any way (because there is no formatting to alter :) The "Undo"/"Redo" actions might be slightly broken/inconsistent with Gtkhtml as well, because I don't have access to the action stack of WebKit, and WebKit records only some actions. I'm using these actions I know that WebKit records to do most of the formatting/DOM manipulation, but on some places it's just not possible to get the right result this way. That's probably all about the editor. All the GtkhtmlEditor functionality should be there and I'm quite satisfied with the code, maybe some minor refactoring here and there, but in general I can call it beta stage. I begun porting the actual composer code to the EEditor a few days ago, and it's progressing incredibly fast. I just need to hook in few actions and events here and there and port signature handling and it' done. GtkhtmlEditor had a set of commands for the signatures, but I'll have to handle it all by DOM manipulation. During the port I've run into at least one "unportable" thing - WebKit does not provide any means to change color of the underline of misspelled words, so I'll probably have to remove this feature (I don't see much use in it anyway). Finally, Milan had some objections against the "EEditor" prefix, feel free to discuss a better alternative. I'll write a blog post when the port is merged to master. I'd like to do the merge as soon as possible, because my time to continue working on it will be more and more limited during the semester, so the sooner you can test and report back the better. Feel free to start testing already (you can use the e- editor-test utility to test the editor itself). If you want to report bugs, please use evolution[composer] and evolution[webkit] whiteboards. Sorry for the long mail, but now I can just point people here instead of explaining myself over and over. And it helped me to sort it all nicely in my head :) *Promised reward* Screenshot!!! http://i45.tinypic.com/2uojg9g.png Do you see the huge difference between Gtkhtml and WebKit? Me neither...:-D Cheers, Dan -- dvratil redhat com | Associate Software Engineer / BaseOS / KDE, Qt GPG Key: 0xC59D614F6F4AE348 Fingerprint: 4EC1 86E3 C54E 0B39 5FDD B5FB C59D 614F 6F4A E348
Attachment:
signature.asc
Description: This is a digitally signed message part.