"The Wrath of Dom" by Martin Sevior and Dom Lachowicz

"The Wrath of Dom" by Martin Sevior and Dom Lachowicz

June 16-18, Trinity College Dublin AbiWord 2.0 - "The Wrath Of Dom" by Martin Sevior and Dom Lachowicz Martin Sevior and Dom Lachowicz GUADEC-4 AbiWord 2.0 - 1 June 16-18, Trinity College Dublin Abstract AbiWord is a cross platform Word Processor and is GNOME©s word processor. The future of AbiWord depends on the future of the GNOME project as a whole and to GNOME Of®ce in particular. The future of GNOME Of®ce looks promising, with the leading hackers of the Gnumeric and AbiWord team resolving to tackle the many tough issues that lie ahead. Martin Sevior and Dom Lachowicz GUADEC-4 AbiWord 2.0 - 2 June 16-18, Trinity College Dublin Outline · Brief History of AbiWord · How it works · What we did since 1.0 · Cool new stuff in 2.0 · Demonstration of AbiWord-2.0 · Questions? Martin Sevior and Dom Lachowicz GUADEC-4 AbiWord 2.0 - 3 June 16-18, Trinity College Dublin History of AbiWord Started by some people who are now SourceGear in 1998. Jeff Hostetler, Eric Sink, Paul Rohr, Bob Sievers Abandoned except for Paul and Bob in 1999. Dom and Martin took over as maintainers in 2000. 1.0 released in 2002. 2.0 Real Soon Now(TM). Martin Sevior and Dom Lachowicz GUADEC-4 AbiWord 2.0 - 4 June 16-18, Trinity College Dublin AbiWord©s Goals and Ambitions "Word Processing for Everyone" AbiWord aims to be the word processor of and for the masses. The most powerful, easiest and most pleasant way to write stuff. AbiWord does its best to inter-operate with the user©s native environment and its existing applications, toolkits, and ®le formats while providing an incomparable level of quality, service, and performance. AbiWord achieves this through: · A unique approach to cross-platform application development Martin Sevior and Dom Lachowicz GUADEC-4 AbiWord 2.0 - 5 June 16-18, Trinity College Dublin · A very robust import/export architecture, with a profound focus on inter-operability with the many existing word processors on the market today · An ever-growing array of plugins, capable of everything from providing new image loaders to inline translations to dictionaries and thesauri. Martin Sevior and Dom Lachowicz GUADEC-4 AbiWord 2.0 - 6 June 16-18, Trinity College Dublin AbiWord Internals Is a C++ program with a large effort to abstract and re-use code. It has a cross Application Architecture (xap), cross platform architecture (xp) AbiWord was designed to be the ®rst of a full suite of applications. A large fraction of the code was identi®ed as being useful to other applications. This code was placed in (xap) classes. Examples include the event logic, much of the code for dealing with windows and frames, many dialogs. Martin Sevior and Dom Lachowicz GUADEC-4 AbiWord 2.0 - 7 June 16-18, Trinity College Dublin Martin Sevior and Dom Lachowicz GUADEC-4 AbiWord 2.0 - 8 June 16-18, Trinity College Dublin static EV_EditMethod_Fn delLeft; The code snippet opposite shows how events . are mapped into actions. static EV_EditMethod s_arrayEditMethods[] = { #if de®ned(PT_TEST) || de®ned(FMT_TEST) || de®ned(UT_TEST) (This case the Backspace command) EV_EditMethod(NF(Test_Dump), 0, ""), EV_EditMethod(NF(Test_Ftr), 0, ""), #endif The events mapped to static functions makes it very easy to extend AbiWord. // a EV_EditMethod(NF(activateWindow_1), 0, ""), EV_EditMethod(NF(activateWindow_2), 0, ""), . One simply de®nes new static functions and EV_EditMethod(NF(delLeft), 0, ""), } adds them to the list methods. #de®ne Defun1(fn) bool F(fn)(AV_View* pAV_View, EV_EditMethodCallData * /*\pCallData*/) Makes it easy to extend write plugins. Defun1(delLeft) { The menu and toolbar code is similar. CHECK_FRAME; ABIWORD_VIEW; pView->cmdCharDelete(false,1); Menu and toolbar items are de®ned in XP return true; structures and then built with platform code. } Menus and Toolbars are easily con®gurable. Martin Sevior and Dom Lachowicz GUADEC-4 AbiWord 2.0 - 9 June 16-18, Trinity College Dublin The Cross Platform Architecture AbiWord makes extensive use of abstract virtual methods in base classes to implement platform speci®c code. Martin Sevior and Dom Lachowicz GUADEC-4 AbiWord 2.0 - 10 June 16-18, Trinity College Dublin Example - The Graphics class The base class gr_Graphics has both virtual virtual GR_Font* getGUIFont() = 0; methods and real code. virtual GR_Font* ®ndFont(const char* pszFontFamily, const char* pszFontStyle, The code snippet opposite is from the header const char* pszFontVariant, ®le of the gr_Graphics base class. const char* pszFontWeight, const char* pszFontStretch, const char* pszFontSize) =0; "®ndNearestFont" looks up a hash table of static const char* ®ndNearestFont(const char* pszFontFamily, const char* pszFontStyle, cached fonts implemented for all platforms. const char* pszFontVariant, const char* pszFontWeight, const char* pszFontStretch, The other methods in the class are pure virtual const char* pszFontSize); which are implemented in the platform code. virtual void drawChars(const UT_UCSChar* pChars, int iCharOffset, int iLength, The code for drawing with the Win32 API is UT_sint32 xoff, totally different from GTK. UT_sint32 yoff, int* pCharWidths = NULL) = 0; Martin Sevior and Dom Lachowicz GUADEC-4 AbiWord 2.0 - 11 June 16-18, Trinity College Dublin The net result of the approach used by AbiWord is that the application is a native application on each target platform pure win32 program on win32, pure Gtk on Unix can easily implement GNOME architecture to overide Gtk as needed. Complete separation of GUI from backend. Leads to a modular and stable platform despite huge complexity. Downside is that platform developers are needed. Quite resource intensive. Martin Sevior and Dom Lachowicz GUADEC-4 AbiWord 2.0 - 12 June 16-18, Trinity College Dublin Text and other objects in AbiWord AbiWord uses a Model-View-Controller architecture. The "Model" is the PieceTable. The "View" are the Layout classes. The "Controller" is split between document level manipulations and manipulations on the view via the insertion point. The PieceTable is a doubly-linked list of objects that contain pointers to text, data and const char * text strings which represent attribute-value pairs. These attribute-value pairs can be arbitrarily complex. Martin Sevior and Dom Lachowicz GUADEC-4 AbiWord 2.0 - 13 June 16-18, Trinity College Dublin Represent the attributes of the text (font, font-size, sub/superscript etc) Represent the attributes of the Text structures like (paragraphs, sections, table, cells etc) You can get a feel for this by browsing *.abw ®les. (These are basically XML-ized dumps of the piecetable. This little snippet of an *.abw shows how a <table> <cell props="bot-attach:1; left-attach:0; right-attach:1; top-attach:0"> simple 2x2 table is de®ned. <p style="Normal">Cell 1</p> <table> represents a table structure fragment </cell> <cell props="bot-attach:1; left-attach:1; right-attach:2; top-attach:0"> <cell ....> represents a cell structure. <p style="Normal">cell 2</p> Notice the list of props=..... </cell> <cell props="bot-attach:2; left-attach:0; right-attach:1; top-attach:1"> These are key-value pairs. <p style="Normal">cell 3</p> The values assigned to bot-attach, top-attach </cell> <cell props="bot-attach:2; left-attach:1; right-attach:2; top-attach:1"> etc tell the Layout classes where to place the <p style="Normal">cell 4</p> </cell> cell in the table </table> Martin Sevior and Dom Lachowicz GUADEC-4 AbiWord 2.0 - 14 June 16-18, Trinity College Dublin Layout Classes There is only one Piecetable per document but each document can have any number of views. The Views are created by the Layout classes, which interpret the attribute-value pairs, text and data in the PieceTable and create formatted text on the screen. Each Structure fragment in the PieceTable has a vector of pointers to corresponding Layout classes. Changes to the PieceTable are recorded in Change Record classes. These are both recorded in a Stack for Undo and broadcast out the Layout classes. Martin Sevior and Dom Lachowicz GUADEC-4 AbiWord 2.0 - 15 June 16-18, Trinity College Dublin The MVC arrangement of AbiWord Documents are imported/exported directly through the controller Users interact ®rstly with the frame, then the layout control. PieceTable changes are broadcast to all Layouts via the controller Martin Sevior and Dom Lachowicz GUADEC-4 AbiWord 2.0 - 16 June 16-18, Trinity College Dublin What we©ve done since 1.0 · Refactored the Layout classes to enable complex structures like tables and footnotes. · Extended the PieceTable to allow these structures. · Ported to GTK 2.0, 2.2, 2.3, GNOME2 · Use FreeType via XFT2 to draw hardware accelerated anti-aliased text. · Use FontCon®g to ®nd all the fonts on a users system (also allows TTF©s) Martin Sevior and Dom Lachowicz GUADEC-4 AbiWord 2.0 - 17 June 16-18, Trinity College Dublin · Other big internal changes to simplify our hacking life (Single Units, Cursor Class, Frame Refactoring). · OSX Port! · Us libglade for dialog generation (HIG compliance) All these are internal changes to enable our new features. Many of these were hugely de-stablizing. Still ironing out bugs. But this hard work is a good investment. New features will ¯ow more easily now. Martin Sevior and Dom Lachowicz GUADEC-4 AbiWord 2.0 - 18 June 16-18, Trinity College Dublin What©s new for Users in 2.0? · Tons of big new features and bug ®xes - Tables! (Able to reuse GTK Table algorithm) - Footnotes. - Endnotes. - Mail-Merge. - New and vastly improved importers/exporters. Martin Sevior and Dom Lachowicz GUADEC-4 AbiWord 2.0 - 19 June 16-18, Trinity College Dublin - Can import and work correctly with very complex documents from MS Word, RTF, Word Perfect. - Export to HTML. (Now a nice little WYSIWYG HTML generator) - Revision Marks.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    35 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us