Skip to content

Code Overview

infinity8 edited this page Oct 29, 2017 · 3 revisions

This page will give a quick overview of the parts of the code if you decide to dig into it yourself.

Data and Definition

Each data type in the tool exists in two parts. The definition and the item. The definition describes the general parameters of the type (e.g. name, default value, min, max, etc). The item is a single instantiation of that definition. The item contains the current editted values, children and various changeable parameters.

Undo and Backups

There are two systems for ensuring you do not lose any work. The undo system and the backup system.

Undo

Every action that sets a value on the data is wrapped by the undo system, providing a delegate for the 'do' and 'undo' action. Actions that happen very close together (500ms apart) are grouped together into a 'step'. These steps form the undo and redo stacks. When you undo the top item on the undo stack if popped off, the undo delegate invoked and it gets added to the redo stack. The same happens in reverse when you redo.

Backups

Every 5 seconds when a document is not saved a backup of the document is written to the backups folder. If the tool crashes for any reason, then when it relaunches it can reopen the backups.

Editors

The editors for each data type are stored in the XmlDataViewTemplates file. This is a collection of data templates for each type.