Remove .gitignore do nothing is ignored.
[synfig.git] / synfig-studio / trunk / src / gtkmm / layergrouptreestore.cpp
index 750d1bb..6334c09 100644 (file)
@@ -6,6 +6,7 @@
 **
 **     \legal
 **     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**     Copyright (c) 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
@@ -30,7 +31,7 @@
 #endif
 
 #include "layergrouptreestore.h"
-#include "iconcontroler.h"
+#include "iconcontroller.h"
 #include <gtkmm/button.h>
 #include <synfig/paramdesc.h>
 #include <synfigapp/action.h>
 #include <synfigapp/action_system.h>
 #include "dockmanager.h"
 #include "dockable.h"
-#include "iconcontroler.h"
 
 #include <gtk/gtkversion.h>
 #include <ETL/clock>
+#include "general.h"
+
 #endif
 
 /* === U S I N G =========================================================== */
@@ -94,7 +96,9 @@ LayerGroupTreeStore::LayerGroupTreeStore(etl::loose_handle<synfigapp::CanvasInte
 LayerGroupTreeStore::~LayerGroupTreeStore()
 {
        //clear();
-       synfig::info("LayerGroupTreeStore::~LayerGroupTreeStore(): Deleted");
+
+       if (getenv("SYNFIG_DEBUG_DESTRUCTORS"))
+               synfig::info("LayerGroupTreeStore::~LayerGroupTreeStore(): Deleted");
 }
 
 bool
@@ -211,11 +215,7 @@ LayerGroupTreeStore::get_value_vfunc (const Gtk::TreeModel::iterator& iter, int
                        Glib::Value<Glib::ustring> x;
                        g_value_init(x.gobj(),x.value_type());
 
-
-                       if(!layer->get_description().empty())
-                               x.set(layer->get_description());
-                       else
-                               x.set(layer->get_local_name());
+                       x.set(layer->get_non_empty_description());
 
                        g_value_init(value.gobj(),x.value_type());
                        //g_value_copy(x.gobj(),value.gobj());
@@ -347,7 +347,7 @@ LayerGroupTreeStore::set_value_impl(const Gtk::TreeModel::iterator& iter, int co
                                if(new_desc==layer->get_description())
                                        return;
 
-                               synfigapp::Action::Handle action(synfigapp::Action::create("layer_set_desc"));
+                               synfigapp::Action::Handle action(synfigapp::Action::create("LayerSetDesc"));
 
                                if(!action)
                                        return;
@@ -392,7 +392,7 @@ LayerGroupTreeStore::set_value_impl(const Gtk::TreeModel::iterator& iter, int co
                                }
                                else
                                {
-                                       synfigapp::Action::Handle action(synfigapp::Action::create("group_rename"));
+                                       synfigapp::Action::Handle action(synfigapp::Action::create("GroupRename"));
 
                                        if(!action)
                                                return;
@@ -420,7 +420,7 @@ LayerGroupTreeStore::set_value_impl(const Gtk::TreeModel::iterator& iter, int co
                                synfig::Layer::Handle layer((*iter)[model.layer]);
                                if(!layer)return;
 
-                               synfigapp::Action::Handle action(synfigapp::Action::create("layer_activate"));
+                               synfigapp::Action::Handle action(synfigapp::Action::create("LayerActivate"));
 
                                if(!action)
                                        return;
@@ -457,7 +457,7 @@ LayerGroupTreeStore::set_value_impl(const Gtk::TreeModel::iterator& iter, int co
        }
        catch(std::exception x)
        {
-               g_warning(x.what());
+               g_warning("%s", x.what());
        }
 }
 
@@ -465,7 +465,7 @@ LayerGroupTreeStore::set_value_impl(const Gtk::TreeModel::iterator& iter, int co
 
 
 bool
-LayerGroupTreeStore::row_draggable_vfunc (const TreeModel::Path& path)const
+LayerGroupTreeStore::row_draggable_vfunc (const TreeModel::Path& /*path*/)const
 {
        //if(!get_iter(path)) return false;
 //     Gtk::TreeModel::Row row(*get_iter(path));
@@ -512,7 +512,7 @@ LayerGroupTreeStore::drag_data_get_vfunc (const TreeModel::Path& path, Gtk::Sele
 }
 
 bool
-LayerGroupTreeStore::drag_data_delete_vfunc (const TreeModel::Path& path)
+LayerGroupTreeStore::drag_data_delete_vfunc (const TreeModel::Path& /*path*/)
 {
        return true;
 }
@@ -576,7 +576,7 @@ LayerGroupTreeStore::drag_data_received_vfunc (const TreeModel::Path& dest, cons
 
                if(synfig::String(selection_data.get_data_type())=="LAYER")
                {
-                       synfigapp::Action::Handle action(synfigapp::Action::create("group_add_layers"));
+                       synfigapp::Action::Handle action(synfigapp::Action::create("GroupAddLayers"));
 
                        if(!action)
                                return false;
@@ -610,7 +610,7 @@ LayerGroupTreeStore::drag_data_received_vfunc (const TreeModel::Path& dest, cons
 
                        group=dest_group+GROUP_NEST_CHAR+group;
 
-                       synfigapp::Action::Handle action(synfigapp::Action::create("group_rename"));
+                       synfigapp::Action::Handle action(synfigapp::Action::create("GroupRename"));
 
                        if(!action)
                                return false;
@@ -662,7 +662,7 @@ LayerGroupTreeStore::drag_data_received_vfunc (const TreeModel::Path& dest, cons
                                if(dest_canvas==src->get_canvas() && dest_layer_depth==src->get_depth())
                                        continue;
 
-                               synfigapp::Action::Handle action(synfigapp::Action::create("layer_move"));
+                               synfigapp::Action::Handle action(synfigapp::Action::create("LayerMove"));
                                action->set_param("canvas",dest_canvas);
                                action->set_param("canvas_interface",canvas_interface());
                                action->set_param("layer",src);
@@ -670,12 +670,10 @@ LayerGroupTreeStore::drag_data_received_vfunc (const TreeModel::Path& dest, cons
                                action->set_param("dest_canvas",dest_canvas);
                                if(canvas_interface()->get_instance()->perform_action(action))
                                {
-                                       DEBUGPOINT();
                                        ret=true;
                                }
                                else
                                {
-                                       DEBUGPOINT();
                                        passive_grouper.cancel();
                                        return false;
                                }
@@ -683,7 +681,7 @@ LayerGroupTreeStore::drag_data_received_vfunc (const TreeModel::Path& dest, cons
                        }
                }
        }
-       synfig::info("I suposidly moved %d layers",i);
+       synfig::info("I supposedly moved %d layers",i);
 
        // Reselect the previously selected layers
        canvas_interface()->get_selection_manager()->set_selected_layers(selected_layer_list);
@@ -703,7 +701,7 @@ void
 LayerGroupTreeStore::rebuild()
 {
        rebuilding=true;
-               etl::clock timer;timer.reset();
+       // etl::clock timer;timer.reset();
        try {
 
                // Clear out the current list
@@ -724,7 +722,7 @@ LayerGroupTreeStore::rebuild()
                        }
                }
 
-               // Go ahead and and add all the layers
+               // Go ahead and add all the layers
                /*std::for_each(
                        canvas_interface()->get_canvas()->rbegin(), canvas_interface()->get_canvas()->rend(),
                        sigc::mem_fun(*this, &studio::LayerGroupTreeStore::on_layer_added)
@@ -736,7 +734,7 @@ LayerGroupTreeStore::rebuild()
                throw;
        }
        rebuilding=false;
-       synfig::info("LayerGroupTreeStore::rebuild() took %f seconds",float(timer()));
+       // synfig::info("LayerGroupTreeStore::rebuild() took %f seconds",float(timer()));
 }
 
 void
@@ -830,8 +828,6 @@ LayerGroupTreeStore::on_group_added(synfig::String group)
 bool
 LayerGroupTreeStore::on_group_removed(synfig::String group)
 {
-       //DEBUGPOINT();
-
        Gtk::TreeModel::Children::iterator iter;
        if(find_group_row(group,iter) && iter->children().size()==0)
                erase(iter);
@@ -842,18 +838,16 @@ LayerGroupTreeStore::on_group_removed(synfig::String group)
 }
 
 bool
-LayerGroupTreeStore::on_group_changed(synfig::String group)
+LayerGroupTreeStore::on_group_changed(synfig::String /*group*/)
 {
-       //DEBUGPOINT();
        return true;
 }
 
 void
-LayerGroupTreeStore::on_group_pair_added(String group, etl::handle<Layer> layer)
+LayerGroupTreeStore::on_group_pair_added(synfig::String group, etl::handle<synfig::Layer> layer)
 {
        if(!layer->get_canvas())
                return;
-       //DEBUGPOINT();
        Gtk::TreeModel::Children::iterator iter;
        if(!find_group_row(group, iter))
                iter=on_group_added(group);
@@ -864,11 +858,10 @@ LayerGroupTreeStore::on_group_pair_added(String group, etl::handle<Layer> layer)
 }
 
 void
-LayerGroupTreeStore::on_group_pair_removed(String group, etl::handle<Layer> layer)
+LayerGroupTreeStore::on_group_pair_removed(synfig::String group, etl::handle<synfig::Layer> layer)
 {
        if(!layer->get_canvas())
                return;
-       //DEBUGPOINT();
        Gtk::TreeModel::Children::iterator iter;
        if(!find_group_row(group, iter))
                return;
@@ -889,7 +882,7 @@ LayerGroupTreeStore::on_activity()
        // If we aren't rebuilding and the last action
        // had something to do with groups, then go
        // a head and present the groups dialog.
-       if(!rebuilding && canvas_interface()->get_instance()->get_most_recent_action() && canvas_interface()->get_instance()->get_most_recent_action()->get_name().find("group")!=String::npos)
+       if(!rebuilding && canvas_interface()->get_instance()->get_most_recent_action() && canvas_interface()->get_instance()->get_most_recent_action()->get_name().find("Group")!=String::npos)
        try
        {
                App::dock_manager->find_dockable("groups").present();
@@ -898,7 +891,7 @@ LayerGroupTreeStore::on_activity()
 }
 
 void
-LayerGroupTreeStore::on_layer_status_changed(synfig::Layer::Handle handle,bool x)
+LayerGroupTreeStore::on_layer_status_changed(synfig::Layer::Handle handle,bool /*x*/)
 {
        Gtk::TreeModel::Children::iterator iter;
        if(find_layer_row(handle,iter))
@@ -951,7 +944,6 @@ LayerGroupTreeStore::find_layer_row_(const synfig::Layer::Handle &layer, synfig:
                }
 
                iter=children().end();
-               //DEBUGPOINT();
                //return false;
        }
 
@@ -986,7 +978,7 @@ LayerGroupTreeStore::find_layer_row(const synfig::Layer::Handle &layer, Gtk::Tre
 }
 
 bool
-LayerGroupTreeStore::find_group_row(const String &group, Gtk::TreeModel::Children::iterator &iter)
+LayerGroupTreeStore::find_group_row(const synfig::String &group, Gtk::TreeModel::Children::iterator &iter)
 {
        Gtk::TreeModel::Children::iterator prev;
        return find_group_row_(group,children(),iter,prev);
@@ -1005,7 +997,6 @@ LayerGroupTreeStore::find_group_row_(const synfig::String &group, Gtk::TreeModel
                }
 
                iter=children().end();
-               //DEBUGPOINT();
                //return false;
        }