View states

Log-in or register.

View states

Each RealWorld Designer window with an open document contains one or more views that display and allow modification of the data in the document. Active window layout determines which concrete views are used.

The views operate in concert. A change in one view is eventually reflected in other views. Two classes of data need to be in sync among the views. First, the persistent data in the edited document, and second, the temporary data that represent the current state of the application. The second kind of data is called a view state.

Example: open document is a raster image; colors of actual pixels are the persistent data. The view states keep information about current image mask (selection), active drawing tool, fill style, zoom and panning of the editor, or current colors.

View state persistence

As it was written above, the view states are from their nature temporary. There is no feasible way how to save for example current color used in the editor to a JPG file. Still, selected view states are remembered for recently used files. This applies for example to primary and secondary colors, active drawing tool and fill style, but not to the image mask (selection), camera position in 3D editor, or selected icon in an icon library.

Using view states

View states are used not just to synchronize views, but also to execute operations and filters properly. To delete an icon from an icon library, the invoked operation needs to find out, which icon to actually delete. It will get this information from a view state that holds the selected icons.

When configuring window layout or creating a scripted operation, view states are one of the crucial parts. Each view state has a name and the names must be used consistently in each window layout.

Examine for example the sample scripted operation in Image Editor layout of RealWorld Icon Editor. The operation draws a N-pointed star using current primary color. It reads the primary color from the "COLOR1" view state. "COLOR1" is used in that layout consistently to identify the primary color.

Recent comments

user icon Anonymous
I wish there were...
Vista & Win 7 icons