<?xml version="1.0"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" 
               "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
    <!ENTITY cong-app   			SYSTEM "xml/cong-app.xml">
    <!ENTITY cong-document			SYSTEM "xml/cong-document.xml">
    <!ENTITY cong-document-traversal		SYSTEM "xml/cong-document-traversal.xml">
    <!ENTITY cong-traversal-node		SYSTEM "xml/cong-traversal-node.xml">
    <!ENTITY cong-dispspec			SYSTEM "xml/cong-dispspec.xml">
    <!ENTITY cong-dispspec-element		SYSTEM "xml/cong-dispspec-element.xml">
    <!ENTITY cong-dispspec-registry		SYSTEM "xml/cong-dispspec-registry.xml">
    <!ENTITY cong-dtd				SYSTEM "xml/cong-dtd.xml">
    <!ENTITY cong-primary-window		SYSTEM "xml/cong-primary-window.xml">

    <!ENTITY cong-node				SYSTEM "xml/cong-node.xml">
    <!ENTITY cong-location			SYSTEM "xml/cong-location.xml">
    <!ENTITY cong-range				SYSTEM "xml/cong-range.xml">
    <!ENTITY cong-selection			SYSTEM "xml/cong-selection.xml">

    <!ENTITY cong-command			SYSTEM "xml/cong-command.xml">
    <!ENTITY cong-command-history		SYSTEM "xml/cong-command-history.xml">
    <!ENTITY cong-modification			SYSTEM "xml/cong-modification.xml">
    <!ENTITY cong-node-modification		SYSTEM "xml/cong-node-modification.xml">
    <!ENTITY cong-node-modification-add-after	SYSTEM "xml/cong-node-modification-add-after.xml">
    <!ENTITY cong-node-modification-add-before	SYSTEM "xml/cong-node-modification-add-before.xml">
    <!ENTITY cong-node-modification-make-orphan	SYSTEM "xml/cong-node-modification-make-orphan.xml">
    <!ENTITY cong-node-modification-remove-attribute	SYSTEM "xml/cong-node-modification-remove-attribute.xml">
    <!ENTITY cong-node-modification-set-attribute	SYSTEM "xml/cong-node-modification-set-attribute.xml">
    <!ENTITY cong-node-modification-set-parent	SYSTEM "xml/cong-node-modification-set-parent.xml">
    <!ENTITY cong-node-modification-set-text	SYSTEM "xml/cong-node-modification-set-text.xml">
    <!ENTITY cong-modification-cursor-change	SYSTEM "xml/cong-modification-cursor-change.xml">
    <!ENTITY cong-modification-selection-change	SYSTEM "xml/cong-modification-selection-change.xml">
    <!ENTITY cong-modification-set-dtd-ptr	SYSTEM "xml/cong-modification-set-dtd-ptr.xml">
    <!ENTITY cong-editor-widget                           SYSTEM "xml/cong-editor-widget.xml">
    <!ENTITY cong-editor-node                           SYSTEM "xml/cong-editor-node.xml">
    <!ENTITY cong-editor-node-comment                           SYSTEM "xml/cong-editor-node-comment.xml">
    <!ENTITY cong-editor-node-document                           SYSTEM "xml/cong-editor-node-document.xml">
    <!ENTITY cong-editor-node-dtd                           SYSTEM "xml/cong-editor-node-dtd.xml">
    <!ENTITY cong-editor-node-element-span                           SYSTEM "xml/cong-editor-node-element-span.xml">
    <!ENTITY cong-editor-node-element-structural                           SYSTEM "xml/cong-editor-node-element-structural.xml">
    <!ENTITY cong-editor-node-element-unknown                           SYSTEM "xml/cong-editor-node-element-unknown.xml">
    <!ENTITY cong-editor-node-element                           SYSTEM "xml/cong-editor-node-element.xml">
    <!ENTITY cong-editor-node-entity-decl                           SYSTEM "xml/cong-editor-node-entity-decl.xml">
    <!ENTITY cong-editor-node-entity-ref                           SYSTEM "xml/cong-editor-node-entity-ref.xml">
    <!ENTITY cong-editor-node-text                           SYSTEM "xml/cong-editor-node-text.xml">
    <!ENTITY cong-editor-node-unimplemented                           SYSTEM "xml/cong-editor-node-unimplemented.xml">
    <!ENTITY cong-editor-area                           SYSTEM "xml/cong-editor-area.xml">
    <!ENTITY cong-editor-area-bin                           SYSTEM "xml/cong-editor-area-bin.xml">
    <!ENTITY cong-editor-area-border                           SYSTEM "xml/cong-editor-area-border.xml">
    <!ENTITY cong-editor-area-composer                           SYSTEM "xml/cong-editor-area-composer.xml">
    <!ENTITY cong-editor-area-container                           SYSTEM "xml/cong-editor-area-container.xml">
    <!ENTITY cong-editor-area-entity-decl                           SYSTEM "xml/cong-editor-area-entity-decl.xml">
    <!ENTITY cong-editor-area-entity-ref                           SYSTEM "xml/cong-editor-area-entity-ref.xml">
    <!ENTITY cong-editor-area-expander                           SYSTEM "xml/cong-editor-area-expander.xml">
    <!ENTITY cong-editor-area-labelled                           SYSTEM "xml/cong-editor-area-labelled.xml">
    <!ENTITY cong-editor-area-line                           SYSTEM "xml/cong-editor-area-line.xml">
    <!ENTITY cong-editor-area-pixbuf                           SYSTEM "xml/cong-editor-area-pixbuf.xml">
    <!ENTITY cong-editor-area-spacer                           SYSTEM "xml/cong-editor-area-spacer.xml">
    <!ENTITY cong-editor-area-span-tag                           SYSTEM "xml/cong-editor-area-span-tag.xml">
    <!ENTITY cong-editor-area-structural-tag                           SYSTEM "xml/cong-editor-area-structural-tag.xml">
    <!ENTITY cong-editor-area-structural                           SYSTEM "xml/cong-editor-area-structural.xml">
    <!ENTITY cong-editor-area-text-comment                           SYSTEM "xml/cong-editor-area-text-comment.xml">
    <!ENTITY cong-editor-area-text-fragment                           SYSTEM "xml/cong-editor-area-text-fragment.xml">
    <!ENTITY cong-editor-area-text                           SYSTEM "xml/cong-editor-area-text.xml">
    <!ENTITY cong-editor-area-underline                           SYSTEM "xml/cong-editor-area-underline.xml">
    <!ENTITY cong-editor-area-unknown-tag                           SYSTEM "xml/cong-editor-area-unknown-tag.xml">
    <!ENTITY cong-view                           SYSTEM "xml/cong-view.xml">
    <!ENTITY cong-tree-view                           SYSTEM "xml/cong-tree-view.xml">
    <!ENTITY cong-overview-view                           SYSTEM "xml/cong-overview-view.xml">
    <!ENTITY cong-plugin                           SYSTEM "xml/cong-plugin.xml">
    <!ENTITY cong-plugin-manager                           SYSTEM "xml/cong-plugin-manager.xml">
    <!ENTITY cong-fake-plugin-hooks                           SYSTEM "xml/cong-fake-plugin-hooks.xml">
    <!ENTITY plugin-admonition-node-element                           SYSTEM "xml/plugin-admonition-node-element.xml">
    <!ENTITY plugin-lists-area-listitem                           SYSTEM "xml/plugin-lists-area-listitem.xml">
    <!ENTITY plugin-lists-node-element-listitem                           SYSTEM "xml/plugin-lists-node-element-listitem.xml">
    <!ENTITY plugin-paragraph-area-paragraph                           SYSTEM "xml/plugin-paragraph-area-paragraph.xml">
    <!ENTITY plugin-paragraph-node-element-paragraph                           SYSTEM "xml/plugin-paragraph-node-element-paragraph.xml">

    <!ENTITY cong-attribute-editor                           SYSTEM "xml/cong-attribute-editor.xml">
    <!ENTITY cong-attribute-editor-cdata                           SYSTEM "xml/cong-attribute-editor-cdata.xml">
    <!ENTITY cong-attribute-editor-enumeration                           SYSTEM "xml/cong-attribute-editor-enumeration.xml">
    <!ENTITY cong-attribute-editor-lang                           SYSTEM "xml/cong-attribute-editor-lang.xml">
<!--
    <!ENTITY cong-attribute-editor-nmtoken                           SYSTEM "xml/cong-attribute-editor-nmtoken.xml">
-->
    <!ENTITY cong-attribute-wrapper                           SYSTEM "xml/cong-attribute-wrapper.xml">
    <!ENTITY cong-attribute-wrapper-check-button                           SYSTEM "xml/cong-attribute-wrapper-check-button.xml">
    <!ENTITY cong-attribute-wrapper-radio-button                           SYSTEM "xml/cong-attribute-wrapper-radio-button.xml">
    <!ENTITY cong-dialog                           SYSTEM "xml/cong-dialog.xml">

    <!ENTITY cong-glade                           SYSTEM "xml/cong-glade.xml">
    <!ENTITY cong-object                        SYSTEM "xml/cong-object.xml">
    <!ENTITY cong-eel                           SYSTEM "xml/cong-eel.xml">
    <!ENTITY cong-eel-graphic-effects                           SYSTEM "xml/cong-eel-graphic-effects.xml">
    <!ENTITY cong-enum-mapping                           SYSTEM "xml/cong-enum-mapping.xml">
    <!ENTITY cong-error-dialog                           SYSTEM "xml/cong-error-dialog.xml">
    <!ENTITY cong-util                           SYSTEM "xml/cong-util.xml">
    <!ENTITY cong-text-cache                           SYSTEM "xml/cong-text-cache.xml">
    <!ENTITY cong-progress-checklist                           SYSTEM "xml/cong-progress-checklist.xml">
    <!ENTITY cong-file-selection                           SYSTEM "xml/cong-file-selection.xml">
    <!ENTITY cong-edit-find-and-replace                           SYSTEM "xml/cong-edit-find-and-replace.xml">
    <!ENTITY cong-ui-hooks                           SYSTEM "xml/cong-ui-hooks.xml">
    <!ENTITY cong-xpath-expression                           SYSTEM "xml/cong-xpath-expression.xml">

    <!ENTITY cong-service  SYSTEM "xml/cong-service.xml">
    <!ENTITY cong-service-tool  SYSTEM "xml/cong-service-tool.xml">
    <!ENTITY cong-service-doc-tool  SYSTEM "xml/cong-service-doc-tool.xml">
    <!ENTITY cong-service-document-factory  SYSTEM "xml/cong-service-document-factory.xml">
    <!ENTITY cong-service-editor-node-factory  SYSTEM "xml/cong-service-editor-node-factory.xml">
    <!ENTITY cong-service-exporter  SYSTEM "xml/cong-service-exporter.xml">
    <!ENTITY cong-service-importer  SYSTEM "xml/cong-service-importer.xml">
    <!ENTITY cong-service-node-property-dialog  SYSTEM "xml/cong-service-node-property-dialog.xml">
    <!ENTITY cong-service-node-tool  SYSTEM "xml/cong-service-node-tool.xml">
    <!ENTITY cong-service-print-method  SYSTEM "xml/cong-service-print-method.xml">

    <!ENTITY cong-font                           SYSTEM "xml/cong-font.xml">
    <!ENTITY cong-graph                           SYSTEM "xml/cong-graph.xml">
    <!ENTITY cong-marshal                           SYSTEM "xml/cong-marshal.xml">
    <!ENTITY cong-parser-error                           SYSTEM "xml/cong-parser-error.xml">
    <!ENTITY global                           SYSTEM "xml/global.xml">
    <!ENTITY cong-vfs                           SYSTEM "xml/cong-vfs.xml">

<!--
    <!ENTITY gxx-declare-object-from-xml-tree    SYSTEM  "xml/gxx-declare-object-from-xml-tree.xml">
    <!ENTITY gxx-declare-object-to-xml-tree      SYSTEM  "xml/gxx-declare-object-to-xml-tree.xml">
    <!ENTITY gxx-object-from-xml-tree            SYSTEM  "xml/gxx-object-from-xml-tree.xml">
    <!ENTITY gxx-object-to-xml-tree              SYSTEM  "xml/gxx-object-to-xml-tree.xml">
-->

    <!ENTITY tree_index                           SYSTEM "xml/tree_index.sgml">
    ]>
<book id="index">
  <bookinfo>
    <title>Conglomerate Programmer's Reference Manual</title>
  </bookinfo>

  <part id="class-overview">
    <title>High-level Classes</title>
    <partintro>
    <para>There is a single <link
    linkend="conglomerate-cong-app">CongApp</link> object representing
    the entire application; this owns a collection of <link
    linkend="conglomerate-cong-primary-window">CongPrimaryWindow</link>
    objects, each represents one of the application's primary windows.
    A primary window corresponds to a particular <link
    linkend="CongDocument">CongDocument</link>.</para>

    <para>In addition, the <classname>CongApp</classname> owns certain
    global resources, including the <link
    linkend="conglomerate-cong-dispspec-registry">CongDispspecRegistry</link>.</para>

    <para>A <classname>CongDocument</classname> is a wrapper around
    the libxml2 document tree, together with a cursor location, and a
    selection range.  It references a <link
    linkend="conglomerate-cong-dispspec">CongDispspec</link>.  It is a
    <classname>GObject</classname>, and it emits signals when things
    change.  </para>

    <warning>
      <title>Deprecated system</title>
      <para>There is also an earlier system, in which there are <link
      linkend="conglomerate-cong-view">CongView</link> structs which
      manually register themselves with
      <classname>CongDocument</classname> objects and receive all
      updates.  This is now deprecated.</para>
    </warning>

    <para>A dispspec is a "display specification"; it is a way of
    looking up tags in the xml document and deciding if they are
    "structural" and hence should appear as big blocks in the view, or
    "spans", in which case they can merely be rendered as an
    underline.  It also supports looking up icons to use, and, in
    theory, localisation of the tag names.</para>

    <para>The display specifications are generally loaded from ".xds"
    files, but can also be created at run-time. </para>

    </partintro>
    &cong-app;
    &cong-document;
    &cong-document-traversal;
    &cong-traversal-node;
    &cong-dispspec;
    &cong-dispspec-element;
    &cong-dispspec-registry;
    &cong-dtd;
    &cong-primary-window;
  </part>

  <part id="xml">
    <title>XML Handling</title>
    <partintro>
    <para>A <link linkend="CongNodePtr">CongNodePtr</link> is a
    libxml2 xmlNodePtr; originally it was something else, though.
    It's a node in the DOM tree of the document.  Everything is stored
    in UTF-8 internally.  There are some CongNode operations, and
    these are generally convenience wrappers around libxml2.</para>

    <para>A <link
    linkend="conglomerate-cong-location">CongLocation</link> is a
    small struct which identifies a "location" in the document
    (e.g. for storing the cursor location).  It's got a pointer to a
    node in the document tree, together with an offset into the
    content of the node, which is only relevant for TEXT and COMMENT
    nodes.  It's the number of bytes, rather than the number of
    characters.</para>

    </partintro>
    &cong-node;
    &cong-location;
    &cong-range;
    &cong-selection;
  </part>

  <part id="state">
    <title>Undo/Redo System</title>
    <partintro>
    <para>All changes to a <link
    linkend="CongDocument">CongDocument</link> should be done using
    <link linkend="CongCommand">CongCommand</link> objects.  Each
    <classname>CongDocument</classname> has a <link
    linkend="CongCommandHistory">CongCommandHistory</link> which
    stores all of the commands that have been applied to that command
    which can be undone, and all that can be redone.</para>

    <para>In order to modify the document, you should do something like this:
<programlisting>
CongCommand *cmd = cong_document_begin_command (doc, _("User-visible name of command"), NULL);

cong_command_add_modification_do_something (cmd, param1);
cong_command_add_modification_do_something_else (cmd, param2, param3, param4);

cong_document_end_command (doc, cmd);
</programlisting>
    </para>
    <para>All commands are built up of modifications, all of which
    break down into a small number of atomic modifications.  Each type
    of modification corresponds to a subclass of <link
    linkend="CongModification">CongModification</link>, and contains
    enough information to be able to redo and undo the command</para>

    <para>As the atomic modifications are done/undone, they call the
    appropriate <classname>CongDocument</classname> methods which have
    the word "private" in their names
    e.g. <function>cong_document_private_node_add_after</function>.
    These emit signals which are listened to by the various views,
    widgets etc.  The CongDocument also handles the signal by calling
    a correspong cong_node_private function
    e.g. <function>cong_node_private_add_after</function>, which
    actual makes the change to the libxml2 representation of the
    document.</para>

    </partintro>
    &cong-command;
    &cong-command-history;
    &cong-modification;
    &cong-node-modification;
    &cong-node-modification-add-after;
    &cong-node-modification-add-before;
    &cong-node-modification-make-orphan;
    &cong-node-modification-remove-attribute;
    &cong-node-modification-set-attribute;
    &cong-node-modification-set-parent;
    &cong-node-modification-set-text;
    &cong-modification-cursor-change;
    &cong-modification-selection-change;
    &cong-modification-set-dtd-ptr;
  </part>

  <part id="editor">
    <title>The Editor Widget</title>
    <partintro>
    <para>For every xml node in the document, there is a <link
    linkend="CongEditorNode">CongEditorNode</link> for each
    editor_widget3.  There is a class hierarchy of
    <classname>CongEditorNode</classname> subclasses, so, for
    instance, there's a <link
    linkend="CongEditorNodeElementStructural">CongEditorNodeElementStructural</link>
    which is used for structural tags, and a <link
    linkend="CongEditorNodeComment">CongEditorNodeComment</link> for
    comments.  This way, we only have to figure out what type a node
    is once, rather than every time we visit it, plus we can store
    useful state in the <classname>CongEditorNode</classname> objects.
    For example, in a <link
    linkend="CongEditorNodeText">CongEditorNodeText</link>, we store a
    <classname>PangoLayout</classname>.</para>

    <para>There is also a collection of <link
    linkend="CongEditorArea">CongEditorArea</link> objects.  These
    form a hierarchical tree of rectangular areas which divide up the
    space allocated to the widget.  They know how to draw themselves,
    can be clicked on, handle size negotiation etc.  They are a little
    bit like a lightweight version of
    <classname>GtkWidgets</classname>, although the analogy isn't
    perfect. </para>

    <para><classname>CongEditorArea</classname> objects are what you
    see and click on when interacting with the editor_widget3,
    although not all of them are visible (e.g. <link
    linkend="CongEditorAreaComposer">CongEditorAreaComposer</link>
    which exists purely to manage the sizing of its children).</para>

    <para><classname>CongEditorNode</classname> objects work behind
    the scenes.  They are responsible for creating
    <classname>CongEditorArea</classname> objects to represent
    themselves.</para>

    <para>There are a few other classes involved: <link
    linkend="CongEditorAreaFlowHolder">CongEditorAreaFlowHolder</link>, 
    and <link
    linkend="CongEditorChildPolicy">CongEditorChildPolicy</link>.
    These are responsible for generating paragraph-like areas, which
    the editor nodes "pour" their
    <classname>CongEditorAreas</classname> into.  This allows us to
    get the nice underlines, which is achieved by using a
    <classname>PangoLayout</classname> for every text node, splitting
    all the <classname>PangoLayoutLines</classname> into separate
    <classname>CongEditorArea</classname> objects, and then merging
    them, together with a few extra
    <classname>CongEditorAreas</classname>. </para>

    <tip>
    <para> If you want to see the
    <classname>CongEditorAreas</classname>, then go to
    <filename>src/cong-editor-area.c</filename> and play around with
    the #define settings; in particular
    <constant>DEBUG_RENDER_ALLOCATIONS</constant> can be used to
    render rectangles to indicate all of the bounding boxes of the
    CongEditorAreas.</para>
    </tip>

    <tip>
    <para>When working on layout code, it may help to turn up the font
    sizes so that everything is much larger on your screen.  You can
    do this by editing <filename>src/cong-app.c</filename> and
    defining <literal>TEST_BIG_FONTS</literal> to be <literal>1</literal>.
    </para>
    </tip>

    </partintro>
    &cong-editor-widget;


    <chapter>
      <title>Editor Nodes</title>
      &cong-editor-node;
      &cong-editor-node-comment;
      &cong-editor-node-document;
      &cong-editor-node-dtd;
      &cong-editor-node-element-span;
      &cong-editor-node-element-structural;
      &cong-editor-node-element-unknown;
      &cong-editor-node-element;
      &cong-editor-node-entity-decl;
      &cong-editor-node-entity-ref;
      &cong-editor-node-text;
      &cong-editor-node-unimplemented;
    </chapter>

    <chapter>
      <title>Editor Areas</title>
      &cong-editor-area;
      &cong-editor-area-bin;
      &cong-editor-area-border;
      &cong-editor-area-composer;
      &cong-editor-area-container;
      &cong-editor-area-entity-decl;
      &cong-editor-area-entity-ref;
      &cong-editor-area-expander;
      &cong-editor-area-labelled;
      &cong-editor-area-line;
      &cong-editor-area-pixbuf;
      &cong-editor-area-spacer;
      &cong-editor-area-span-tag;
      &cong-editor-area-structural-tag;
      &cong-editor-area-structural;
      &cong-editor-area-text-comment;
      &cong-editor-area-text-fragment;
      &cong-editor-area-text;
      &cong-editor-area-underline;
      &cong-editor-area-unknown-tag;
    </chapter>
  </part>

  <part id="views">
    <title>Other Views of the Document</title>
    &cong-view;
    &cong-tree-view;
    &cong-overview-view;
  </part>

  <part id="plugins">
    <title>Plugins</title>
    <partintro>
    <para>The singleton <link linkend="CongApp">CongApp</link> object
    owns a singleton <link
    linkend="CongPluginManager">CongPluginManager</link>.  This in
    turn owns a collection of <link
    linkend="CongPlugin">CongPlugin</link> objects, each of which
    represents a plugin.  In turn, these each contain a collection of
    <link linkend="CongService">CongService</link> objects which they
    register with the program.  The various subclasses of <link
    linkend="CongService">CongService</link> are the various kinds of
    functionality offered by plugins to the progam.</para>

    <para>The plugins aren't actually compiled into separate dynamic
    libraries yet, but instead are all compiled into the main
    executable.  Registration hooks are called manually within
    <filename>cong-fake-plugin-hooks.c</filename>.  Our current plan
    is to move to a genuine plugin system by using the libgoffice
    library (when it is released).</para>

    </partintro>
    &cong-plugin;
    &cong-plugin-manager;
    &cong-service;
    &cong-service-tool;
    &cong-service-doc-tool;
    &cong-service-document-factory;
    &cong-service-editor-node-factory;
    &cong-service-exporter;
    &cong-service-importer;
    &cong-service-node-property-dialog;
    &cong-service-node-tool;
    &cong-service-print-method;
    &cong-fake-plugin-hooks;
    &plugin-admonition-node-element;
    &plugin-lists-area-listitem;
    &plugin-lists-node-element-listitem;
    &plugin-paragraph-area-paragraph;
    &plugin-paragraph-node-element-paragraph;
  </part>

  <part id="helper">
    <title>Helper Routines and Widgets</title>
    &cong-attribute-editor;
    &cong-attribute-editor-cdata;
    &cong-attribute-editor-enumeration;
<!--    &cong-attribute-editor-nmtoken; -->
    &cong-attribute-editor-lang;
    &cong-attribute-wrapper;
    &cong-attribute-wrapper-check-button;
    &cong-attribute-wrapper-radio-button;
    &cong-dialog;
    &cong-glade;
    &cong-object;
    &cong-eel;
    &cong-eel-graphic-effects;
    &cong-enum-mapping;
    &cong-error-dialog;
    &cong-util;
    &cong-text-cache;
    &cong-progress-checklist;
    &cong-file-selection;
    &cong-edit-find-and-replace;
    &cong-ui-hooks;
    &cong-xpath-expression;
  </part>

  <part id="misc">
    <title>Miscellaneous</title>
    &cong-font;
    &cong-graph;
    &cong-marshal;
    &cong-parser-error;
    &global;
    &cong-vfs;
<!-- these create warning messages about multiple "IDs" for constraint linkend
    &gxx-declare-object-from-xml-tree;
    &gxx-declare-object-to-xml-tree;
    &gxx-object-from-xml-tree;
    &gxx-object-to-xml-tree;
-->
  </part>

  <part id="class-hierarchy">
    <title>Class Hierarchy</title>
    &tree_index;
  </part>

  <index/>

</book>
