![](https://secure.gravatar.com/avatar/bb65b6b3a109d97cf9f8d6c014ede042.jpg?s=120&d=mm&r=g)
On Wed, 5 Jan 2005 20:46:26 -0400, bulia byak <buliabyak@...400...> wrote:
On Wed, 5 Jan 2005 18:39:05 -0500, Brandi Soggs <soggsbh@...635...> wrote:
- Every time that a user changes an object, we will need to make the same
change on the same object in for the other users. For our purposes, document changes are visible changes- changes to the objects drawn or the creation of new objects. We've seen in the documentation that there is no central place that gathers changes. Ishmal suggested to us that we use the sp-canvas as an area that always gets "hit" by document changes. When a change reaches the sp-canvas, does it actually know all the details (what happened to which sp-item) or does it just know "A change has occurred! Redraw!" ?
No, SPCanvas is way too low in the hierarchy for your purposes.
On the other hand, if you want just to mirror the appearance of a document in some other window, but don't care about the structure of the document, then SPCanvas is just what you need. It's just a screen picture which, if you hook it up properly, will reflect the state of the document. Currently Inkscape does this when you do Edit>Duplicate Window: a new window with a new canvas is created, and when you edit the document in any of these windows, the image in the other window updates at once. At the same time, each window can have its own zoom and selection.
The hierarchy is like this:
SPDesktop: this roughly corresponds to the editing window; this class holds the selection, the current tool, the current zoom, the reference to the current document etc.
SPDesktopWidget: this is contained in SPDesktop and holds together all the widgets in the editing window, including its SPCanvas.
SPCanvas: this is a drawing canvas that displays SPCanvasItems.
SPCanvasItem: most SPCanvasItems are service things such as selection frame and arrows, shape controls, text cursor, etc. These SPCanvasItems are displayed without antialiasing.
SPCanvasArena: this is a special SPCanvasItem which is always one per SPCanvas. It contains the SVG drawing itself, i.e. all the shapes, etc. Each object is visualized as one of NRArenaItems within an SPCanvasArena.
NRArenaItems: these exist within an SPCanvasArena. They are always displayed with antialiasing. An SPObject (which, remember, roughly corresponds to an SVG tree node) has a list of SPArenaItems that display it. If you are editing the document in one window only, this list usually contains a single SPArenaItem that is within that window's arena (which is shown on that window's canvas). If you open the same document in another window, each SPObject will get a second NRArenaItem for that window. Like SPObjects, NRArenaItems are categorized into types, but there are much less types of NRArenaItems: only group, shape, glyphs, and image. For example, rectangles and spirals are different subclasses of SPObject, but they both generate NRArenaShapes (i.e. NRArenaItems that display shapes). The updating of NRArenaItems when their parent SPObject is updated is done by the *_update method of the corresponding SPObject class (e.g. sp_rect_update).
Hope this helps. I may have messed up something, so please correct me where I am wrong.