When the bline tool is creating new layers, arrange the new layers in the order:...
authordooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Mon, 4 Feb 2008 18:40:49 +0000 (18:40 +0000)
committerdooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Mon, 4 Feb 2008 18:40:49 +0000 (18:40 +0000)
git-svn-id: http://svn.voria.com/code@1577 1f10aa63-cdf2-0310-b900-c93c546f37ac

synfig-studio/trunk/src/gtkmm/state_bline.cpp

index 4dd5ffc..9eadbfb 100644 (file)
@@ -114,7 +114,7 @@ class studio::StateBLine_Context : public sigc::trackable
        Gtk::Table options_table;
        Gtk::Entry entry_id;
        Gtk::CheckButton checkbutton_layer_region;
-       Gtk::CheckButton checkbutton_layer_bline;
+       Gtk::CheckButton checkbutton_layer_outline;
        Gtk::CheckButton checkbutton_layer_curve_gradient;
        Gtk::CheckButton checkbutton_layer_plant;
        Gtk::CheckButton checkbutton_layer_link_offsets;
@@ -131,8 +131,8 @@ public:
        int layers_to_create()const
        {
                return
-                       get_layer_region_flag()+
-                       get_layer_bline_flag()+
+                       get_layer_region_flag() +
+                       get_layer_outline_flag() +
                        get_layer_curve_gradient_flag() +
                        get_layer_plant_flag();
        }
@@ -149,8 +149,8 @@ public:
        bool get_layer_region_flag()const { return checkbutton_layer_region.get_active(); }
        void set_layer_region_flag(bool x) { return checkbutton_layer_region.set_active(x); }
 
-       bool get_layer_bline_flag()const { return checkbutton_layer_bline.get_active(); }
-       void set_layer_bline_flag(bool x) { return checkbutton_layer_bline.set_active(x); }
+       bool get_layer_outline_flag()const { return checkbutton_layer_outline.get_active(); }
+       void set_layer_outline_flag(bool x) { return checkbutton_layer_outline.set_active(x); }
 
        bool get_layer_curve_gradient_flag()const { return checkbutton_layer_curve_gradient.get_active(); }
        void set_layer_curve_gradient_flag(bool x) { return checkbutton_layer_curve_gradient.set_active(x); }
@@ -239,10 +239,10 @@ StateBLine_Context::load_settings()
        else
                set_layer_region_flag(true);
 
-       if(settings.get_value("bline.layer_bline",value) && value=="0")
-               set_layer_bline_flag(false);
+       if(settings.get_value("bline.layer_outline",value) && value=="0")
+               set_layer_outline_flag(false);
        else
-               set_layer_bline_flag(true);
+               set_layer_outline_flag(true);
 
        if(settings.get_value("bline.layer_curve_gradient",value) && value=="1")
                set_layer_curve_gradient_flag(true);
@@ -282,7 +282,7 @@ void
 StateBLine_Context::save_settings()
 {
        sanity_check();
-       settings.set_value("bline.layer_bline",get_layer_bline_flag()?"1":"0");
+       settings.set_value("bline.layer_outline",get_layer_outline_flag()?"1":"0");
        settings.set_value("bline.layer_region",get_layer_region_flag()?"1":"0");
        settings.set_value("bline.layer_curve_gradient",get_layer_curve_gradient_flag()?"1":"0");
        settings.set_value("bline.layer_plant",get_layer_plant_flag()?"1":"0");
@@ -356,7 +356,7 @@ StateBLine_Context::StateBLine_Context(CanvasView* canvas_view):
        settings(synfigapp::Main::get_selected_input_device()->settings()),
        entry_id(),
        checkbutton_layer_region(_("Fill")),
-       checkbutton_layer_bline(_("Outline")),
+       checkbutton_layer_outline(_("Outline")),
        checkbutton_layer_curve_gradient(_("Gradient")),
        checkbutton_layer_plant(_("Plant")),
        checkbutton_layer_link_offsets(_("Link Offsets")),
@@ -373,10 +373,10 @@ StateBLine_Context::StateBLine_Context(CanvasView* canvas_view):
        // Set up the tool options dialog
        //options_table.attach(*manage(new Gtk::Label(_("BLine Tool"))), 0, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
        options_table.attach(entry_id,                                                          0, 2,  1,  2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
-       options_table.attach(checkbutton_layer_region,                          0, 2,  2,  3, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
-       options_table.attach(checkbutton_layer_bline,                           0, 2,  3,  4, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
-       options_table.attach(checkbutton_layer_curve_gradient,          0, 2,  4,  5, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
-       options_table.attach(checkbutton_layer_plant,                           0, 2,  5,  6, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
+       options_table.attach(checkbutton_layer_outline,                         0, 2,  2,  3, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
+       options_table.attach(checkbutton_layer_region,                          0, 2,  3,  4, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
+       options_table.attach(checkbutton_layer_plant,                           0, 2,  4,  5, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
+       options_table.attach(checkbutton_layer_curve_gradient,          0, 2,  5,  6, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
        options_table.attach(checkbutton_layer_link_offsets,            0, 2,  6,  7, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
        options_table.attach(checkbutton_auto_export,                           0, 2,  7,  8, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
        options_table.attach(*manage(new Gtk::Label(_("Feather"))), 0, 1, 10, 11, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
@@ -603,30 +603,19 @@ StateBLine_Context::run_()
                synfigapp::SelectionManager::LayerList layer_selection;
 
                ///////////////////////////////////////////////////////////////////////////
-               //   R E G I O N
+               //   C U R V E   G R A D I E N T
                ///////////////////////////////////////////////////////////////////////////
 
-               if(get_layer_region_flag())
+               if(get_layer_curve_gradient_flag())
                {
                        synfigapp::PushMode push_mode(get_canvas_interface(),synfigapp::MODE_NORMAL);
 
-                       Layer::Handle layer(get_canvas_interface()->add_layer_to("region",canvas,depth));
+                       Layer::Handle layer(get_canvas_interface()->add_layer_to("curve_gradient",canvas,depth));
                        assert(layer);
                        layer_selection.push_back(layer);
-                       layer->set_description(get_id()+_(" Region"));
+                       layer->set_description(get_id()+_(" Gradient"));
                        get_canvas_interface()->signal_layer_new_description()(layer,layer->get_description());
 
-                       if(get_feather())
-                       {
-                               layer->set_param("feather",get_feather());
-                               get_canvas_interface()->signal_layer_param_changed()(layer,"feather");
-                       }
-
-                       if(get_layer_bline_flag())
-                               layer->set_param("color",synfigapp::Main::get_background_color());
-
-                       // I don't know if it's safe to reuse the same layer_param_connect action, so I'm
-                       // using 2 separate ones.
                        {
                                synfigapp::Action::Handle action(synfigapp::Action::create("layer_param_connect"));
                                assert(action);
@@ -641,9 +630,9 @@ StateBLine_Context::run_()
 
                                if(!get_canvas_interface()->get_instance()->perform_action(action))
                                {
-                                       //get_canvas_view()->get_ui_interface()->error(_("Unable to create Region layer"));
+                                       //get_canvas_view()->get_ui_interface()->error(_("Unable to create BLine layer"));
                                        group.cancel();
-                                       throw String(_("Unable to create Region layer"));
+                                       throw String(_("Unable to create Gradient layer"));
                                        return false;
                                }
                        }
@@ -663,32 +652,27 @@ StateBLine_Context::run_()
 
                                if(!get_canvas_interface()->get_instance()->perform_action(action))
                                {
-                                       //get_canvas_view()->get_ui_interface()->error(_("Unable to create Region layer"));
+                                       //get_canvas_view()->get_ui_interface()->error(_("Unable to create BLine layer"));
                                        group.cancel();
-                                       throw String(_("Unable to create Region layer"));
+                                       throw String(_("Unable to create Gradient layer"));
                                        return false;
                                }
                        }
                }
 
                ///////////////////////////////////////////////////////////////////////////
-               //   O U T L I N E
+               //   P L A N T
                ///////////////////////////////////////////////////////////////////////////
 
-               if(get_layer_bline_flag())
+               if(get_layer_plant_flag())
                {
                        synfigapp::PushMode push_mode(get_canvas_interface(),synfigapp::MODE_NORMAL);
 
-                       Layer::Handle layer(get_canvas_interface()->add_layer_to("outline",canvas,depth));
+                       Layer::Handle layer(get_canvas_interface()->add_layer_to("plant",canvas,depth));
                        assert(layer);
                        layer_selection.push_back(layer);
-                       layer->set_description(get_id()+_(" Outline"));
+                       layer->set_description(get_id()+_(" Plant"));
                        get_canvas_interface()->signal_layer_new_description()(layer,layer->get_description());
-                       if(get_feather())
-                       {
-                               layer->set_param("feather",get_feather());
-                               get_canvas_interface()->signal_layer_param_changed()(layer,"feather");
-                       }
 
                        {
                                synfigapp::Action::Handle action(synfigapp::Action::create("layer_param_connect"));
@@ -706,11 +690,12 @@ StateBLine_Context::run_()
                                {
                                        //get_canvas_view()->get_ui_interface()->error(_("Unable to create BLine layer"));
                                        group.cancel();
-                                       throw String(_("Unable to create Outline layer"));
+                                       throw String(_("Unable to create Plant layer"));
                                        return false;
                                }
                        }
 
+                       // plants don't have offsets?
                        if (get_layer_link_offsets_flag())
                        {
                                synfigapp::Action::Handle action(synfigapp::Action::create("layer_param_connect"));
@@ -728,26 +713,37 @@ StateBLine_Context::run_()
                                {
                                        //get_canvas_view()->get_ui_interface()->error(_("Unable to create BLine layer"));
                                        group.cancel();
-                                       throw String(_("Unable to create Outline layer"));
+                                       throw String(_("Unable to create Plant layer"));
                                        return false;
                                }
                        }
                }
 
                ///////////////////////////////////////////////////////////////////////////
-               //   C U R V E   G R A D I E N T
+               //   R E G I O N
                ///////////////////////////////////////////////////////////////////////////
 
-               if(get_layer_curve_gradient_flag())
+               if(get_layer_region_flag())
                {
                        synfigapp::PushMode push_mode(get_canvas_interface(),synfigapp::MODE_NORMAL);
 
-                       Layer::Handle layer(get_canvas_interface()->add_layer_to("curve_gradient",canvas,depth));
+                       Layer::Handle layer(get_canvas_interface()->add_layer_to("region",canvas,depth));
                        assert(layer);
                        layer_selection.push_back(layer);
-                       layer->set_description(get_id()+_(" Gradient"));
+                       layer->set_description(get_id()+_(" Region"));
                        get_canvas_interface()->signal_layer_new_description()(layer,layer->get_description());
 
+                       if(get_feather())
+                       {
+                               layer->set_param("feather",get_feather());
+                               get_canvas_interface()->signal_layer_param_changed()(layer,"feather");
+                       }
+
+                       if(get_layer_outline_flag())
+                               layer->set_param("color",synfigapp::Main::get_background_color());
+
+                       // I don't know if it's safe to reuse the same layer_param_connect action, so I'm
+                       // using 2 separate ones.
                        {
                                synfigapp::Action::Handle action(synfigapp::Action::create("layer_param_connect"));
                                assert(action);
@@ -762,9 +758,9 @@ StateBLine_Context::run_()
 
                                if(!get_canvas_interface()->get_instance()->perform_action(action))
                                {
-                                       //get_canvas_view()->get_ui_interface()->error(_("Unable to create BLine layer"));
+                                       //get_canvas_view()->get_ui_interface()->error(_("Unable to create Region layer"));
                                        group.cancel();
-                                       throw String(_("Unable to create Gradient layer"));
+                                       throw String(_("Unable to create Region layer"));
                                        return false;
                                }
                        }
@@ -784,27 +780,32 @@ StateBLine_Context::run_()
 
                                if(!get_canvas_interface()->get_instance()->perform_action(action))
                                {
-                                       //get_canvas_view()->get_ui_interface()->error(_("Unable to create BLine layer"));
+                                       //get_canvas_view()->get_ui_interface()->error(_("Unable to create Region layer"));
                                        group.cancel();
-                                       throw String(_("Unable to create Gradient layer"));
+                                       throw String(_("Unable to create Region layer"));
                                        return false;
                                }
                        }
                }
 
                ///////////////////////////////////////////////////////////////////////////
-               //   P L A N T
+               //   O U T L I N E
                ///////////////////////////////////////////////////////////////////////////
 
-               if(get_layer_plant_flag())
+               if(get_layer_outline_flag())
                {
                        synfigapp::PushMode push_mode(get_canvas_interface(),synfigapp::MODE_NORMAL);
 
-                       Layer::Handle layer(get_canvas_interface()->add_layer_to("plant",canvas,depth));
+                       Layer::Handle layer(get_canvas_interface()->add_layer_to("outline",canvas,depth));
                        assert(layer);
                        layer_selection.push_back(layer);
-                       layer->set_description(get_id()+_(" Plant"));
+                       layer->set_description(get_id()+_(" Outline"));
                        get_canvas_interface()->signal_layer_new_description()(layer,layer->get_description());
+                       if(get_feather())
+                       {
+                               layer->set_param("feather",get_feather());
+                               get_canvas_interface()->signal_layer_param_changed()(layer,"feather");
+                       }
 
                        {
                                synfigapp::Action::Handle action(synfigapp::Action::create("layer_param_connect"));
@@ -822,12 +823,11 @@ StateBLine_Context::run_()
                                {
                                        //get_canvas_view()->get_ui_interface()->error(_("Unable to create BLine layer"));
                                        group.cancel();
-                                       throw String(_("Unable to create Plant layer"));
+                                       throw String(_("Unable to create Outline layer"));
                                        return false;
                                }
                        }
 
-                       // plants don't have offsets?
                        if (get_layer_link_offsets_flag())
                        {
                                synfigapp::Action::Handle action(synfigapp::Action::create("layer_param_connect"));
@@ -845,7 +845,7 @@ StateBLine_Context::run_()
                                {
                                        //get_canvas_view()->get_ui_interface()->error(_("Unable to create BLine layer"));
                                        group.cancel();
-                                       throw String(_("Unable to create Plant layer"));
+                                       throw String(_("Unable to create Outline layer"));
                                        return false;
                                }
                        }