Remove .gitignore do nothing is ignored.
[synfig.git] / synfig-studio / trunk / src / gtkmm / dock_layers.cpp
index 10cc043..8fa6ede 100644 (file)
@@ -6,7 +6,7 @@
 **
 **     \legal
 **     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
-**     Copyright (c) 2007 Chris Moore
+**     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
@@ -46,6 +46,8 @@
 #include "layeractionmanager.h"
 //#include <ETL/ref_count>
 
+#include "general.h"
+
 #endif
 
 /* === U S I N G =========================================================== */
@@ -86,7 +88,7 @@ Dock_Layers::Dock_Layers():
        {
                synfig::Layer::Book::value_type lyr(*iter);
 
-               if(lyr.second.category==_("Do Not Use"))
+               if(lyr.second.category==CATEGORY_DO_NOT_USE)
                        continue;
 
                action_group_new_layers->add(Gtk::Action::create(
@@ -118,28 +120,43 @@ Dock_Layers::Dock_Layers():
                for(iter=category_map.begin();iter!=category_map.end();++iter)
                {
                        layer_ui_info+=strprintf("<menu action='%s'>%s</menu>",iter->first.c_str(),iter->second.c_str());
-                       action_group_categories->add(Gtk::Action::create(iter->first.c_str(),iter->first.c_str()));
+                       action_group_categories->add(Gtk::Action::create(iter->first.c_str(),dgettext("synfig", iter->first.c_str())));
                }
 
                layer_ui_info+="</menu></menu></popup></ui>";
 
                App::ui_manager()->insert_action_group(action_group_categories);
                App::ui_manager()->insert_action_group(action_group_new_layers);
-               App::ui_manager()->add_ui_from_string(layer_ui_info);
+
+               try
+               {
+                       App::ui_manager()->add_ui_from_string(layer_ui_info);
+               }
+               catch(Glib::MarkupError x)
+               {
+                       error("%s:%d caught MarkupError code %d: %s", __FILE__, __LINE__, x.code(), x.what().c_str());
+                       error("%s:%d with markup: \"%s\"", __FILE__, __LINE__, layer_ui_info.c_str());
+                       exit(1);
+               }
        }
 
+       if(layer_action_manager)
+               action_group_layer_ops->add(layer_action_manager->get_action_select_all_child_layers());
 
-       action_group_layer_ops->add( Gtk::Action::create("toolbar-layer", "Layer Ops") );
+       action_group_layer_ops->add( Gtk::Action::create("toolbar-layer", _("Layer Ops")) );
        App::ui_manager()->insert_action_group(action_group_layer_ops);
 
-
     Glib::ustring ui_info =
        "<ui>"
        "       <toolbar action='toolbar-layer'>"
-       "       <toolitem action='action-layer_raise' />"
-       "       <toolitem action='action-layer_lower' />"
-       "       <toolitem action='action-layer_duplicate' />"
-       "       <toolitem action='action-layer_remove' />"
+       "       <toolitem action='action-LayerRaise' />"
+       "       <toolitem action='action-LayerLower' />"
+       "       <separator />"
+       "       <toolitem action='action-LayerDuplicate' />"
+       "       <toolitem action='action-LayerEncapsulate' />"
+       "       <toolitem action='select-all-child-layers' />"
+       "       <toolitem action='action-LayerRemove' />"
+       "       <separator />"
        "       <toolitem action='cut' />"
        "       <toolitem action='copy' />"
        "       <toolitem action='paste' />"
@@ -208,7 +225,6 @@ Dock_Layers::init_canvas_view_vfunc(etl::loose_handle<CanvasView> canvas_view)
 
        canvas_view->set_tree_model(get_name(),layer_tree_store);
        LayerTree* layer_tree(new LayerTree());
-       layer_tree->set_model(layer_tree_store);
        layer_tree->set_time_adjustment(canvas_view->time_adjustment());
 
        layer_tree->signal_edited_value().connect(
@@ -217,10 +233,13 @@ Dock_Layers::init_canvas_view_vfunc(etl::loose_handle<CanvasView> canvas_view)
                )
        );
 
-       canvas_view->set_ext_widget(get_name()+"_cmp",layer_tree);
+       // (a) should be before (b), (b) should be before (c)
+       canvas_view->set_ext_widget(get_name()+"_cmp",layer_tree); // (a)
        canvas_view->set_ext_widget(get_name(),&layer_tree->get_layer_tree_view());
        canvas_view->set_ext_widget("params",&layer_tree->get_param_tree_view());
-       canvas_view->set_tree_model("params",layer_tree->get_param_tree_view().get_model());
+
+       layer_tree->set_model(layer_tree_store); // (b)
+       canvas_view->set_tree_model("params",layer_tree->get_param_tree_view().get_model()); // (c)
 
        /*
        canvas_view->layermenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-delete"),Gtk::AccelKey("Delete"),