Added copyright lines for files I've edited this year.
[synfig.git] / synfig-studio / trunk / src / gtkmm / historytreestore.cpp
index ae6016a..bc0c97a 100644 (file)
@@ -2,10 +2,11 @@
 /*!    \file historytreestore.cpp
 **     \brief Template File
 **
-**     $Id: historytreestore.cpp,v 1.1.1.1 2005/01/07 03:34:36 darco Exp $
+**     $Id$
 **
 **     \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
 
 #include "historytreestore.h"
 #include <synfig/valuenode.h>
-#include "iconcontroler.h"
+#include "iconcontroller.h"
 #include <synfig/valuenode_timedswap.h>
 #include <gtkmm/button.h>
 #include <synfigapp/action.h>
 #include "instance.h"
 
+#include "general.h"
+
 #endif
 
 /* === U S I N G =========================================================== */
@@ -75,7 +78,8 @@ HistoryTreeStore::HistoryTreeStore(etl::loose_handle<studio::Instance> instance_
 
 HistoryTreeStore::~HistoryTreeStore()
 {
-       synfig::info("HistoryTreeStore::~HistoryTreeStore(): Deleted");
+       if (getenv("SYNFIG_DEBUG_DESTRUCTORS"))
+               synfig::info("HistoryTreeStore::~HistoryTreeStore(): Deleted");
 }
 
 Glib::RefPtr<HistoryTreeStore>
@@ -88,22 +92,22 @@ void
 HistoryTreeStore::rebuild()
 {
        synfigapp::Action::Stack::const_iterator iter;
-       
+
        clear();
-       
+
        for(iter=instance()->undo_action_stack().begin();iter!=instance()->undo_action_stack().end();++iter)
        {
-               insert_action(*(prepend()),*iter,true,true,false);      
+               insert_action(*(prepend()),*iter,true,true,false);
        }
        curr_row=*children().end();
        for(iter=instance()->redo_action_stack().begin();iter!=instance()->redo_action_stack().end();++iter)
        {
-               insert_action(*(append()),*iter,true,false,true);       
-       }               
+               insert_action(*(append()),*iter,true,false,true);
+       }
 }
 
 void
-HistoryTreeStore::insert_action(Gtk::TreeRow row,etl::handle<synfigapp::Action::Undoable> action, bool is_active, bool is_undo, bool is_redo)
+HistoryTreeStore::insert_action(Gtk::TreeRow row,etl::handle<synfigapp::Action::Undoable> action, bool /*is_active*/, bool is_undo, bool is_redo)
 {
        assert(action);
 
@@ -112,13 +116,13 @@ HistoryTreeStore::insert_action(Gtk::TreeRow row,etl::handle<synfigapp::Action::
        row[model.is_active] = action->is_active();
        row[model.is_undo] = is_undo;
        row[model.is_redo] = is_redo;
-       
+
        synfigapp::Action::CanvasSpecific *specific_action;
        specific_action=dynamic_cast<synfigapp::Action::CanvasSpecific*>(action.get());
        if(specific_action)
        {
                row[model.canvas] = specific_action->get_canvas();
-               row[model.canvas_id] = specific_action->get_canvas()->get_id();         
+               row[model.canvas_id] = specific_action->get_canvas()->get_id();
        }
 
        etl::handle<synfigapp::Action::Group> group;
@@ -132,8 +136,8 @@ HistoryTreeStore::insert_action(Gtk::TreeRow row,etl::handle<synfigapp::Action::
                        insert_action(child_row,*iter,true,is_undo,is_redo);
                }
        }
-       
-       //row[model.icon] = Gtk::Button().render_icon(Gtk::StockID("synfig-canvas"),Gtk::ICON_SIZE_SMALL_TOOLBAR);      
+
+       //row[model.icon] = Gtk::Button().render_icon(Gtk::StockID("synfig-canvas"),Gtk::ICON_SIZE_SMALL_TOOLBAR);
 }
 
 
@@ -154,7 +158,7 @@ HistoryTreeStore::on_undo_stack_cleared()
 {
        Gtk::TreeModel::Children::iterator iter,next;
        Gtk::TreeModel::Children children_(children());
-       
+
        for(next=children_.begin(),iter=next++; iter != children_.end(); iter=(next!=children_.end())?next++:next)
        {
                Gtk::TreeModel::Row row = *iter;
@@ -168,7 +172,7 @@ HistoryTreeStore::on_redo_stack_cleared()
 {
        Gtk::TreeModel::Children::iterator iter,next;
        Gtk::TreeModel::Children children_(children());
-       
+
        for(next=children_.begin(),iter=next++; iter != children_.end(); iter=(next!=children_.end())?next++:next)
        {
                Gtk::TreeModel::Row row = *iter;
@@ -202,7 +206,7 @@ HistoryTreeStore::on_action_status_changed(etl::handle<synfigapp::Action::Undoab
 {
        Gtk::TreeModel::Children::iterator iter;
        Gtk::TreeModel::Children children_(children());
-       
+
        for(iter=children_.begin(); iter != children_.end(); ++iter)
        {
                Gtk::TreeModel::Row row = *iter;
@@ -211,5 +215,17 @@ HistoryTreeStore::on_action_status_changed(etl::handle<synfigapp::Action::Undoab
                        row[model.is_active]=action->is_active();
                        return;
                }
-       }       
+       }
+}
+
+bool
+HistoryTreeStore::search_func(const Glib::RefPtr<Gtk::TreeModel>&,int,const Glib::ustring& x,const Gtk::TreeModel::iterator& iter)
+{
+       const Model model;
+
+       Glib::ustring substr(x.uppercase());
+       Glib::ustring name((*iter)[model.name]);
+       name=name.uppercase();
+
+       return name.find(substr)==Glib::ustring::npos;
 }