X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fgtkmm%2Fhistorytreestore.cpp;h=1f0eb9c0cee2944b531c00b5740eff9a232a044e;hb=9459638ad6797b8139f1e9f0715c96076dbf0890;hp=a0e084466d93efdc5839546bf40d170f05da40ac;hpb=3a3c4bca3a17137bec5d7960560934b91ef4146e;p=synfig.git diff --git a/synfig-studio/trunk/src/gtkmm/historytreestore.cpp b/synfig-studio/trunk/src/gtkmm/historytreestore.cpp index a0e0844..1f0eb9c 100644 --- a/synfig-studio/trunk/src/gtkmm/historytreestore.cpp +++ b/synfig-studio/trunk/src/gtkmm/historytreestore.cpp @@ -1,20 +1,22 @@ -/* === S I N F G =========================================================== */ +/* === S Y N F I G ========================================================= */ /*! \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 Robert B. Quattlebaum Jr. +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** Copyright (c) 2008 Chris Moore ** -** This software and associated documentation -** are CONFIDENTIAL and PROPRIETARY property of -** the above-mentioned copyright holder. +** This package is free software; you can redistribute it and/or +** modify it under the terms of the GNU General Public License as +** published by the Free Software Foundation; either version 2 of +** the License, or (at your option) any later version. ** -** You may not copy, print, publish, or in any -** other way distribute this software without -** a prior written agreement with -** the copyright holder. +** This package is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +** General Public License for more details. ** \endlegal */ /* ========================================================================= */ @@ -29,20 +31,22 @@ #endif #include "historytreestore.h" -#include -#include "iconcontroler.h" -#include +#include +#include "iconcontroller.h" +#include #include -#include +#include #include "instance.h" +#include "general.h" + #endif /* === U S I N G =========================================================== */ using namespace std; using namespace etl; -using namespace sinfg; +using namespace synfig; using namespace studio; /* === M A C R O S ========================================================= */ @@ -74,7 +78,8 @@ HistoryTreeStore::HistoryTreeStore(etl::loose_handle instance_ HistoryTreeStore::~HistoryTreeStore() { - sinfg::info("HistoryTreeStore::~HistoryTreeStore(): Deleted"); + if (getenv("SYNFIG_DEBUG_DESTRUCTORS")) + synfig::info("HistoryTreeStore::~HistoryTreeStore(): Deleted"); } Glib::RefPtr @@ -86,23 +91,25 @@ HistoryTreeStore::create(etl::loose_handle instance_) void HistoryTreeStore::rebuild() { - sinfgapp::Action::Stack::const_iterator iter; - + 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); + } + + signal_undo_tree_changed()(); } void -HistoryTreeStore::insert_action(Gtk::TreeRow row,etl::handle action, bool is_active, bool is_undo, bool is_redo) +HistoryTreeStore::insert_action(Gtk::TreeRow row,etl::handle action, bool /*is_active*/, bool is_undo, bool is_redo) { assert(action); @@ -111,28 +118,28 @@ HistoryTreeStore::insert_action(Gtk::TreeRow row,etl::handleis_active(); row[model.is_undo] = is_undo; row[model.is_redo] = is_redo; - - sinfgapp::Action::CanvasSpecific *specific_action; - specific_action=dynamic_cast(action.get()); + + synfigapp::Action::CanvasSpecific *specific_action; + specific_action=dynamic_cast(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 group; - group=etl::handle::cast_dynamic(action); + etl::handle group; + group=etl::handle::cast_dynamic(action); if(group) { - sinfgapp::Action::ActionList::const_iterator iter; + synfigapp::Action::ActionList::const_iterator iter; for(iter=group->action_list().begin();iter!=group->action_list().end();++iter) { Gtk::TreeRow child_row = *(append(row.children())); insert_action(child_row,*iter,true,is_undo,is_redo); } } - - //row[model.icon] = Gtk::Button().render_icon(Gtk::StockID("sinfg-canvas"),Gtk::ICON_SIZE_SMALL_TOOLBAR); + + //row[model.icon] = Gtk::Button().render_icon(Gtk::StockID("synfig-canvas"),Gtk::ICON_SIZE_SMALL_TOOLBAR); } @@ -153,7 +160,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; @@ -167,7 +174,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; @@ -177,7 +184,7 @@ HistoryTreeStore::on_redo_stack_cleared() } void -HistoryTreeStore::on_new_action(etl::handle action) +HistoryTreeStore::on_new_action(etl::handle action) { // Gtk::TreeRow row = *(append()); Gtk::TreeRow row; @@ -194,21 +201,35 @@ HistoryTreeStore::on_new_action(etl::handle action) row=*insert(iter); insert_action(row,action); + + signal_undo_tree_changed()(); } void -HistoryTreeStore::on_action_status_changed(etl::handle action) +HistoryTreeStore::on_action_status_changed(etl::handle action) { Gtk::TreeModel::Children::iterator iter; Gtk::TreeModel::Children children_(children()); - + for(iter=children_.begin(); iter != children_.end(); ++iter) { Gtk::TreeModel::Row row = *iter; - if(action == (etl::handle)row[model.action]) + if(action == (etl::handle)row[model.action]) { row[model.is_active]=action->is_active(); return; } - } + } +} + +bool +HistoryTreeStore::search_func(const Glib::RefPtr&,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; }