Hi all!

I've changed some common functionality... in my branch
May be it will help somebody.

Functionality that applies default layer parameters was extracted from
method CanvasInterface::add_layer_to() into separate method
CanvasInterface::apply_layer_param_defaults()

Was:
CanvasInterface::add_layer_to() {
    ...create new layer...
    ...call layer->set_canvas()...
    ...apply default parameters...
    ...create LayerAdd action and...
  * ...call Action::System::perform_action()... *
    ...set layer depth...
}

Action::System::perform_action() which uses for performing action not
supports recursive calls. So we cannot call
Action::System::perform_action() again while performing action. And cannot
call CanvasInterface::add_layer_to() too.


New implementation:
CanvasInterface::apply_layer_param_defaults() {
    ...apply default parameters...
}

CanvasInterface::add_layer_to() {
    ...create new layer...
    ...call layer->set_canvas()...
  * ...call CanvasInterface::apply_layer_param_defaults()... *
    ...create LayerAdd action and call Action::System::perform_action()...
    ...set layer depth...
}

In this implementation still we cannot call
CanvasInterface::add_layer_to() while performing action, but we can apply
default parameters for already created layer by call
CanvasInterface::apply_layer_param_defaults()

One note - apply_layer_param_defaults() requires what canvas should be set
for layer before (layer->set_canvas). Example:

synfig::Layer::Handle new_layer( synfig::Layer::create("outline") );
new_layer->set_canvas(canvas);
canvasinterface->apply_layer_param_defaults(new_layer);

files affected:
    synfig-studio/studioapp/canvasinterface.h
    synfig-studio/studioapp/canvasinterface.cpp

--
Ivan


------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
Synfig-devl mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synfig-devl

Reply via email to