Show the name of the current tool in the tool options panel if it has any options...
[synfig.git] / synfig-studio / trunk / src / gtkmm / state_polygon.cpp
index 09caf4f..942d6d8 100644 (file)
@@ -6,6 +6,7 @@
 **
 **     \legal
 **     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**     Copyright (c) 2007, 2008 Chris Moore
 **
 **     This package is free software; you can redistribute it and/or
 **     modify it under the terms of the GNU General Public License as
@@ -188,7 +189,10 @@ StatePolygon_Context::increment_id()
        if(id[id.size()-1]<='9' && id[id.size()-1]>='0')
        {
                // figure out how many digits it is
-               for(digits=0;(int)id.size()-1>=digits && id[id.size()-1-digits]<='9' && id[id.size()-1-digits]>='0';digits++)while(false);
+               for (digits = 0;
+                        (int)id.size()-1 >= digits && id[id.size()-1-digits] <= '9' && id[id.size()-1-digits] >= '0';
+                        digits++)
+                       ;
 
                String str_number;
                str_number=String(id,id.size()-digits,id.size());
@@ -227,8 +231,8 @@ StatePolygon_Context::StatePolygon_Context(CanvasView* canvas_view):
        load_settings();
 
        // Set up the tool options dialog
-       //options_table.attach(*manage(new Gtk::Label(_("Polygon 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(*manage(new Gtk::Label(_("Polygon 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(button_make, 0, 2, 4, 5, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
        button_make.signal_pressed().connect(sigc::mem_fun(*this,&StatePolygon_Context::run));
        options_table.show_all();
@@ -385,6 +389,7 @@ StatePolygon_Context::run()
                                action->set_param("canvas_interface",get_canvas_interface());
                                action->set_param("value_desc",value_desc);
                                action->set_param("type","dynamic_list");
+                               action->set_param("time",get_canvas_interface()->get_time());
                                if(!get_canvas_interface()->get_instance()->perform_action(action))
                                {
                                        group.cancel();
@@ -393,8 +398,12 @@ StatePolygon_Context::run()
                                }
                        }
                        egress_on_selection_change=false;
+                       synfigapp::SelectionManager::LayerList layer_selection;
+                       if (!getenv("SYNFIG_TOOLS_CLEAR_SELECTION"))
+                               layer_selection = get_canvas_view()->get_selection_manager()->get_selected_layers();
                        get_canvas_interface()->get_selection_manager()->clear_selected_layers();
-                       get_canvas_interface()->get_selection_manager()->set_selected_layer(layer);
+                       layer_selection.push_back(layer);
+                       get_canvas_interface()->get_selection_manager()->set_selected_layers(layer_selection);
                        egress_on_selection_change=true;
                        //get_canvas_interface()->signal_dirty_preview()();
                }