Added copyright lines for files I've edited this year.
[synfig.git] / synfig-studio / trunk / src / gtkmm / layeractionmanager.cpp
index 80b91b9..e42d4f8 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
@@ -35,6 +36,8 @@
 #include "instance.h"
 #include <synfigapp/selectionmanager.h>
 
+#include "general.h"
+
 #endif
 
 /* === U S I N G =========================================================== */
@@ -301,13 +304,12 @@ LayerActionManager::refresh()
                }
        }
 
-       ui_info="<ui><menubar action='menu-main'><menu action='menu-layer'>"+ui_info+"<separator/><menuitem action='cut' /><menuitem action='copy' /><menuitem action='paste' /><separator/></menu></menubar></ui>";
+       ui_info="<ui><popup action='menu-main'><menu action='menu-layer'>"+ui_info+"<separator/><menuitem action='cut' /><menuitem action='copy' /><menuitem action='paste' /><separator/></menu></popup></ui>";
        popup_id_=get_ui_manager()->add_ui_from_string(ui_info);
 #ifdef ONE_ACTION_GROUP
 #else
        get_ui_manager()->insert_action_group(action_group_);
 #endif
-       DEBUGPOINT();
 }
 
 void
@@ -381,7 +383,8 @@ LayerActionManager::paste()
                        return;
                }
 
-               synfig::info("DEPTH=%d",depth);
+               // synfig::info("DEPTH=%d",depth);
+
                // Action to move the layer (if necessary)
                if(depth>0)
                {
@@ -411,6 +414,22 @@ LayerActionManager::paste()
                        }
                }
                depth++;
+
+               // automatically export the Index parameter of Duplicate layers when pasting
+               if (layer->get_name() == "duplicate")
+                       for (int i = 1; ; i++)
+                       {
+                               String name = strprintf(_("Index %d"), i);
+                               try
+                               {
+                                       canvas->find_value_node(name);
+                               }
+                               catch (Exception::IDNotFound x)
+                               {
+                                       get_canvas_interface()->add_value_node(layer->dynamic_param_list().find("index")->second, name);
+                                       break;
+                               }
+                       }
        }
        get_canvas_interface()->get_selection_manager()->clear_selected_layers();
        get_canvas_interface()->get_selection_manager()->set_selected_layers(layer_selection);