Krita/NonTool Actions Implementation

From KDE Community Wiki
Revision as of 10:13, 16 June 2011 by Dimula73 (talk | contribs) (Created page with '==Non-tool actions== ===Requirements=== # All non-tool actions, like Resize Image, Resize Canvas, Filters, should go through the same queue as the actions of the tools. # Every g...')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Non-tool actions

Requirements

  1. All non-tool actions, like Resize Image, Resize Canvas, Filters, should go through the same queue as the actions of the tools.
  2. Every global action, like resizing of the image, changing its colorspace consists of the following stages:
    1. locking
    2. processing
    3. unlocking
    4. updating the layer stack in a proper way

All the stages except 'processing' should be encapsulated inside the base non-tool-action-object, so that visitors will not bother about locking and updating the stack. That is needed because currently some visitors call setDirty() for every node they visit. This causes too many superflous updates done when the number of layers is more than one.

  1. (!) The jobs from the stroke should be able to block updates only. So they should allow the stroke to be 'exclusive', not a single action.
  2. Check that KisFullRefreshVisitor calls setDirty() of the root node after the job is done.
  3. It should fit into undo system perfectly.

Description

The system is based on strokes framework. First, we declare KisNodeVisitor's visitAll() method as deprecated. The visitor should only do what it is intended to do: be able to visit a node of any type and describe this action. All the other tasks are left for special classes.

So now the visitor can be defined as "exclusive" and "sequential". These properties totally correspond to the properties of the stroke running this visitor. If the visitor is defined "exclusive" then all the updater threads will be stopped until the visitor has processed all the requested nodes. If the visitor is defined as "sequential", then all the nodes will be processed one-by-one instead of concurrently.

KisNodeProcessingStrategy and NodeProcessingData are just wrappers for the visitor. This is the way how strokes framework works.

KisNodeProcessingStrokeStrategy (what an ugly name!). This class is supposed to do two things. First, it stores the informations about the visitor (sequential, exclusive). And second, it performs an update of the image after the processing is done. Both these tasks are done in a way to support undo().