Use the existing layers_to_create() method rather than reimplementing it.
[synfig.git] / synfig-studio / trunk / src / gtkmm / state_bline.cpp
index 4eccbd0..5fcba88 100644 (file)
@@ -607,6 +607,9 @@ StateBLine_Context::run_()
 
                synfigapp::SelectionManager::LayerList layer_selection;
 
+               // count how many layers we're going to be creating
+               int layers_to_create = this->layers_to_create();
+
                ///////////////////////////////////////////////////////////////////////////
                //   C U R V E   G R A D I E N T
                ///////////////////////////////////////////////////////////////////////////
@@ -642,7 +645,8 @@ StateBLine_Context::run_()
                                }
                        }
 
-                       if (get_layer_link_offsets_flag())
+                       // only link the curve gradient's offset parameter if the option is selected and we're creating more than one layer
+                       if (get_layer_link_offsets_flag() && layers_to_create > 1)
                        {
                                synfigapp::Action::Handle action(synfigapp::Action::create("layer_param_connect"));
                                assert(action);
@@ -700,7 +704,8 @@ StateBLine_Context::run_()
                                }
                        }
 
-                       if (get_layer_link_offsets_flag())
+                       // only link the plant's offset parameter if the option is selected and we're creating more than one layer
+                       if (get_layer_link_offsets_flag() && layers_to_create > 1)
                        {
                                synfigapp::Action::Handle action(synfigapp::Action::create("layer_param_connect"));
                                assert(action);
@@ -769,7 +774,8 @@ StateBLine_Context::run_()
                                }
                        }
 
-                       if (get_layer_link_offsets_flag())
+                       // only link the region's offset parameter if the option is selected and we're creating more than one layer
+                       if (get_layer_link_offsets_flag() && layers_to_create > 1)
                        {
                                synfigapp::Action::Handle action(synfigapp::Action::create("layer_param_connect"));
                                assert(action);
@@ -832,7 +838,8 @@ StateBLine_Context::run_()
                                }
                        }
 
-                       if (get_layer_link_offsets_flag())
+                       // only link the outline's offset parameter if the option is selected and we're creating more than one layer
+                       if (get_layer_link_offsets_flag() && layers_to_create > 1)
                        {
                                synfigapp::Action::Handle action(synfigapp::Action::create("layer_param_connect"));
                                assert(action);